diff --git a/Build/AtlasBuildScripts/tag_build.sh b/Build/AtlasBuildScripts/tag_build.sh index bf55462ad691055ed6ceabbbfa9f7c2fd211ce41..54f28cea65c6953a46f4e58c7cd62453c4e26914 100755 --- a/Build/AtlasBuildScripts/tag_build.sh +++ b/Build/AtlasBuildScripts/tag_build.sh @@ -1,21 +1,25 @@ #! /bin/bash # -# Copyright (C) 2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # +REPOURL="https://:@gitlab.cern.ch:8443/atlas/athena.git" + # Function printing the usage information for the script usage() { - echo "Usage: tag_build.sh [-d date_stamp] [-u repository_url]" \ - " Tag a 'nightly' build based on the current branch and timestamp."\ - " This script should really only be used by NICOS to tag nightly builds."\ - " Private builds should not do this."\ - " 'date_stamp' defaults to $datestamp, repository_url to the ATLAS athena"\ - " repository in CERN GitLab (krb5 authenticated)" + cat <<EOF +Usage: tag_build.sh [-d date_stamp] [-u repository_url] + Tag a 'nightly' build based on the current branch and timestamp. If the tag + already exists it will be checked out instead. This script should only be used + by NICOS to tag nightly builds, not for private builds. + + date_stamp Format YYYY-MM-DDTHHMM (default: \$datestamp) + repository_url git repository URL (default: $REPOURL) +EOF } # Parse the command line arguments: DATESTAMP="$datestamp" -REPOURL="https://:@gitlab.cern.ch:8443/atlas/athena.git" while getopts ":d:u:h" opt; do case $opt in d) @@ -60,9 +64,14 @@ set -e ScriptSrcDir=$(dirname ${BASH_SOURCE[0]}) cd $ScriptSrcDir/../.. -# Get branch name, then tag and push +# Get branch name, then tag/push or checkout if it already exists BRANCH=$(git symbolic-ref --short HEAD) TAG="nightly/$BRANCH/$DATESTAMP" -echo "Creating tag $TAG" -git tag $TAG -git push $REPOURL $TAG +if git rev-parse $TAG > /dev/null 2>&1; then + echo "Tag $TAG already exists. Doing checkout..." + git checkout $TAG +else + echo "Creating tag $TAG" + git tag $TAG + git push $REPOURL $TAG +fi diff --git a/Calorimeter/CaloDmDetDescr/CaloDmDetDescr/ATLAS_CHECK_THREAD_SAFETY b/Calorimeter/CaloDmDetDescr/CaloDmDetDescr/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..6797cd81544e60c40cf8d6cab6fd8289f887505b --- /dev/null +++ b/Calorimeter/CaloDmDetDescr/CaloDmDetDescr/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Calorimeter/CaloDmDetDescr diff --git a/Calorimeter/CaloDmDetDescr/CaloDmDetDescr/CaloDmDescrManager.h b/Calorimeter/CaloDmDetDescr/CaloDmDetDescr/CaloDmDescrManager.h index acaa8e2fc22a486db4734a88427f3ebd5de9d5c4..466c5cbbcc407643ec486db2b0b2b5f49d287992 100755 --- a/Calorimeter/CaloDmDetDescr/CaloDmDetDescr/CaloDmDescrManager.h +++ b/Calorimeter/CaloDmDetDescr/CaloDmDetDescr/CaloDmDescrManager.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 */ /* **************************************************************************** @@ -157,7 +157,6 @@ class CaloDmDescrManager { const CaloDM_ID* m_caloDM_ID; const AtlasDetectorID* m_id_helper; StoreGateSvc* m_detStore; - static CaloDmDescrManager* s_instance; CaloDmDescrElement* build_element(const Identifier& cellId, const CaloDmRegion *myRegion); StatusCode load_regions(std::string DmRegionFileName); diff --git a/Calorimeter/CaloDmDetDescr/src/CaloDmDescrManager.cxx b/Calorimeter/CaloDmDetDescr/src/CaloDmDescrManager.cxx index 28b9482c6056a65f28244b6094c1fefbfc00e886..0da40d9aec5681446eaee9fc784b881210ebfc6f 100755 --- a/Calorimeter/CaloDmDetDescr/src/CaloDmDescrManager.cxx +++ b/Calorimeter/CaloDmDetDescr/src/CaloDmDescrManager.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,15 +28,11 @@ #include <fstream> #include <string> #include <vector> -#include <map> #include <cmath> #define MAX_BUFFER_LEN 1024 #undef DEBUG -CaloDmDescrManager* CaloDmDescrManager::s_instance = 0; - - /* ************************************************************************** ************************************************************************** */ @@ -69,11 +65,8 @@ CaloDmDescrManager::~CaloDmDescrManager() ************************************************************************** */ const CaloDmDescrManager* CaloDmDescrManager::instance() { - if(s_instance==0) - { - s_instance = new CaloDmDescrManager(); - } - return s_instance; + static const CaloDmDescrManager s_instance; + return &s_instance; } @@ -146,13 +139,13 @@ CaloDmDescrElement* CaloDmDescrManager::get_element(const Identifier& cellId) co hash = m_caloDM_ID->lar_zone_hash_max() + m_caloDM_ID->tile_zone_hash(cellId); } else { std::cout << "CaloDmDescrManager::get_element-> Error! Wrong dead material identifier! " << m_id_helper->show_to_string(cellId) << std::endl; - return 0; + return nullptr; } if(hash < m_DmElementVector.size()) { return m_DmElementVector[hash]; } else { std::cout << "CaloDmDescrManager::get_element-> Error! Bad hash id for dead material identifier " << hash << std::endl; - return 0; + return nullptr; } } @@ -199,13 +192,13 @@ CaloDmRegion* CaloDmDescrManager::get_dm_region(const Identifier& cellId) const hash_reg = m_caloDM_ID->lar_region_hash_max() + m_caloDM_ID->tile_region_hash(id_reg); } else { std::cout << "CaloDmDescrManager::get_dm_region-> Error! Wrong dead material identifier! " << m_id_helper->show_to_string(cellId) << std::endl; - return 0; + return nullptr; } if(hash_reg < m_DmRegionVector.size()) { return m_DmRegionVector[hash_reg]; } else { std::cout << "CaloDmDescrManager::get_dm_region-> Error! Bad region hash id!" << m_id_helper->show_to_string(cellId) << std::endl; - return 0; + return nullptr; } } diff --git a/Calorimeter/CaloExample/CaloAnaEx/share/CaloAnaExTB.py b/Calorimeter/CaloExample/CaloAnaEx/share/CaloAnaExTB.py index 5bfd28b5679339a53699736f9ae2438e3cbe60cf..29cfe895202a5af4c16fe8818b42c02fb077a4ce 100755 --- a/Calorimeter/CaloExample/CaloAnaEx/share/CaloAnaExTB.py +++ b/Calorimeter/CaloExample/CaloAnaEx/share/CaloAnaExTB.py @@ -765,5 +765,3 @@ theApp.AuditAlgorithms=True #theApp.AuditServices=True #theApp.AuditTools=True # FIXME crash on finalisation MessageSvc.Format = "% F%40W%S%7W%R%T %0W%M" -from __main__ import AtlasTrackingGeometrySvc -AtlasTrackingGeometrySvc.AssignMaterialFromCOOL = False diff --git a/Calorimeter/CaloExample/CaloAnaEx/share/CaloAnaEx_AOD2CBNT.py b/Calorimeter/CaloExample/CaloAnaEx/share/CaloAnaEx_AOD2CBNT.py index 7b186c0a33733ebdb01005590ef5d6d22210fcc8..5a8033f966c9375b3e1e5fcbfdeb00584a250151 100755 --- a/Calorimeter/CaloExample/CaloAnaEx/share/CaloAnaEx_AOD2CBNT.py +++ b/Calorimeter/CaloExample/CaloAnaEx/share/CaloAnaEx_AOD2CBNT.py @@ -36,6 +36,3 @@ class DummyServiceMgr : ServiceMgr=DummyServiceMgr() #hack ends here - -from __main__ import AtlasTrackingGeometrySvc -AtlasTrackingGeometrySvc.AssignMaterialFromCOOL = False diff --git a/Calorimeter/CaloExample/CaloRecEx/share/CaloRecEx_RTT_calib0_csc11_007062_singlepart_gamma_E50.py b/Calorimeter/CaloExample/CaloRecEx/share/CaloRecEx_RTT_calib0_csc11_007062_singlepart_gamma_E50.py index a59b1aa5b1f5800f3f8cfdecce3c3b2b09e6cfda..5fc5e775a257374eebb29c4537456401babb1c51 100755 --- a/Calorimeter/CaloExample/CaloRecEx/share/CaloRecEx_RTT_calib0_csc11_007062_singlepart_gamma_E50.py +++ b/Calorimeter/CaloExample/CaloRecEx/share/CaloRecEx_RTT_calib0_csc11_007062_singlepart_gamma_E50.py @@ -78,5 +78,3 @@ print 'BEGIN_RTTINFO = Photons_calib0_csc11_007062_singlepart_gamma_E50' import os com="echo \"BEGIN_RTTINFO = Photons_calib0_csc11_007062_singlepart_gamma_E50\">&MYRTTINFOS.txt" os.system(com) -#from __main__ import AtlasTrackingGeometrySvc -#AtlasTrackingGeometrySvc.AssignMaterialFromCOOL = False diff --git a/Calorimeter/CaloExample/CaloRecEx/share/CaloRecEx_topOptions.py b/Calorimeter/CaloExample/CaloRecEx/share/CaloRecEx_topOptions.py index 3b8feb71399d32614be4306ad5db345c39a42dfb..0b44f0dcdc701a1458ea26be7cba3d505337e45b 100755 --- a/Calorimeter/CaloExample/CaloRecEx/share/CaloRecEx_topOptions.py +++ b/Calorimeter/CaloExample/CaloRecEx/share/CaloRecEx_topOptions.py @@ -77,6 +77,3 @@ MessageSvc.Format = "% F%40W%S%7W%R%T %0W%M" print "RTTINFO = 1002_H_2e2mu_q02dig_1004" -#from __main__ import AtlasTrackingGeometrySvc -#AtlasTrackingGeometrySvc.AssignMaterialFromCOOL = False - diff --git a/Calorimeter/CaloExample/CaloTests/src/MyAnalysisCal.cxx b/Calorimeter/CaloExample/CaloTests/src/MyAnalysisCal.cxx index c593491334e8ce02362c50076be67c552bf54ce4..d295484870feaaf2d1917ddb378763b9621b1c52 100644 --- a/Calorimeter/CaloExample/CaloTests/src/MyAnalysisCal.cxx +++ b/Calorimeter/CaloExample/CaloTests/src/MyAnalysisCal.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 "CaloTests/AnalysisCal.h" @@ -103,7 +103,7 @@ namespace MyAnalysisCal { double etot_cal=0; nhit_tot=0; - for (const SG::ReadHandleKey<CaloCalibrationHitContainer> k : m_calibHitContainerNames) + for (const SG::ReadHandleKey<CaloCalibrationHitContainer>& k : m_calibHitContainerNames) { SG::ReadHandle<CaloCalibrationHitContainer> calocalibrationhit_container (k, ctx); for (const CaloCalibrationHit* calibhit : *calocalibrationhit_container) { diff --git a/Calorimeter/CaloLocalHadCalib/src/GetLCSinglePionsPerf.cxx b/Calorimeter/CaloLocalHadCalib/src/GetLCSinglePionsPerf.cxx index 62748ba5103a7321e943a7853cc3105885fb73b0..56434e1b5bc2267b414d71a49e5a2949c8efa92a 100644 --- a/Calorimeter/CaloLocalHadCalib/src/GetLCSinglePionsPerf.cxx +++ b/Calorimeter/CaloLocalHadCalib/src/GetLCSinglePionsPerf.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 */ //----------------------------------------------------------------------- @@ -975,13 +975,13 @@ int GetLCSinglePionsPerf::fill_moments (const xAOD::CaloClusterContainer& clusCo reading calibration containers ******************************************** */ std::vector<const CaloCalibrationHitContainer *> v_cchc; - for (const SG::ReadHandleKey<CaloCalibrationHitContainer> k : m_CalibrationHitContainerNames) { + for (const SG::ReadHandleKey<CaloCalibrationHitContainer>& k : m_CalibrationHitContainerNames) { SG::ReadHandle<CaloCalibrationHitContainer> cchc (k, ctx); v_cchc.push_back(cchc.cptr()); } std::vector<const CaloCalibrationHitContainer *> v_dmcchc; - for (const SG::ReadHandleKey<CaloCalibrationHitContainer> k : m_DMCalibrationHitContainerNames) { + for (const SG::ReadHandleKey<CaloCalibrationHitContainer>& k : m_DMCalibrationHitContainerNames) { SG::ReadHandle<CaloCalibrationHitContainer> cchc (k, ctx); v_dmcchc.push_back(cchc.cptr()); } @@ -1202,13 +1202,13 @@ int GetLCSinglePionsPerf::fill_calibhits (const xAOD::CaloClusterContainer& clus reading calibration containers ******************************************** */ std::vector<const CaloCalibrationHitContainer *> v_cchc; - for (const SG::ReadHandleKey<CaloCalibrationHitContainer> k : m_CalibrationHitContainerNames) { + for (const SG::ReadHandleKey<CaloCalibrationHitContainer>& k : m_CalibrationHitContainerNames) { SG::ReadHandle<CaloCalibrationHitContainer> cchc (k, ctx); v_cchc.push_back(cchc.cptr()); } std::vector<const CaloCalibrationHitContainer *> v_dmcchc; - for (const SG::ReadHandleKey<CaloCalibrationHitContainer> k : m_DMCalibrationHitContainerNames) { + for (const SG::ReadHandleKey<CaloCalibrationHitContainer>& k : m_DMCalibrationHitContainerNames) { SG::ReadHandle<CaloCalibrationHitContainer> cchc (k, ctx); v_dmcchc.push_back(cchc.cptr()); } diff --git a/Calorimeter/CaloLocalHadCalib/src/GetLCWeights.cxx b/Calorimeter/CaloLocalHadCalib/src/GetLCWeights.cxx index 07972e1125529e24c8eeea2696bcd20385e45e33..e3c3e340d4c4ba7234847f188aee4ff4ba5278e4 100644 --- a/Calorimeter/CaloLocalHadCalib/src/GetLCWeights.cxx +++ b/Calorimeter/CaloLocalHadCalib/src/GetLCWeights.cxx @@ -359,7 +359,7 @@ StatusCode GetLCWeights::execute() SG::ReadHandle<xAOD::CaloClusterContainer> cc (m_clusterCollName, ctx); std::vector<const CaloCalibrationHitContainer *> v_cchc; - for (const SG::ReadHandleKey<CaloCalibrationHitContainer> k : m_CalibrationHitContainerNames) { + for (const SG::ReadHandleKey<CaloCalibrationHitContainer>& k : m_CalibrationHitContainerNames) { SG::ReadHandle<CaloCalibrationHitContainer> cchc (k, ctx); v_cchc.push_back(cchc.cptr()); } diff --git a/Calorimeter/CaloRec/python/CaloThinCellsByClusterAlg_test.py b/Calorimeter/CaloRec/python/CaloThinCellsByClusterAlg_test.py index 6159caaad5076948c9cb7060e710de8ee05af668..00c993d79f4299e709bcf0ccdacfbed8d31395f2 100644 --- a/Calorimeter/CaloRec/python/CaloThinCellsByClusterAlg_test.py +++ b/Calorimeter/CaloRec/python/CaloThinCellsByClusterAlg_test.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: CaloRec/python/CaloThinCellsByClusterAlg_test.py # Author: scott snyder @@ -134,6 +134,11 @@ def testCfg (configFlags): return result +# Work around issue with cling in root 6.20.06 getting confused +# by forward declarations. +ROOT.xAOD.CaloClusterContainer_v1 + + from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior=1 from AthenaConfiguration.AllConfigFlags import ConfigFlags diff --git a/Control/AthenaBaseComps/AthenaBaseComps/AthReentrantAlgorithm.h b/Control/AthenaBaseComps/AthenaBaseComps/AthReentrantAlgorithm.h index 21fb2f462383f848c26d6f5be329fbb7158dcedd..4784ffabce82c56c02a4eb27a532068688d3a828 100644 --- a/Control/AthenaBaseComps/AthenaBaseComps/AthReentrantAlgorithm.h +++ b/Control/AthenaBaseComps/AthenaBaseComps/AthReentrantAlgorithm.h @@ -136,6 +136,14 @@ class AthReentrantAlgorithm */ virtual const DataObjIDColl& extraOutputDeps() const override; + virtual bool filterPassed(const EventContext& ctx) const { + return execState( ctx ).filterPassed(); + } + + virtual void setFilterPassed( bool state, const EventContext& ctx ) const { + execState( ctx ).setFilterPassed( state ); + } + private: diff --git a/Control/AthenaBaseComps/CMakeLists.txt b/Control/AthenaBaseComps/CMakeLists.txt index 96b3f693f3d3eb52ca8eedb4da0124258ec944fe..e60a757a6aa784ae57f57da4e93adb7e9dea87f3 100644 --- a/Control/AthenaBaseComps/CMakeLists.txt +++ b/Control/AthenaBaseComps/CMakeLists.txt @@ -1,32 +1,18 @@ -# $Id: CMakeLists.txt 739578 2016-04-12 07:34:46Z krasznaa $ -################################################################################ -# Package: AthenaBaseComps -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( AthenaBaseComps ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PUBLIC - Control/AthenaKernel - Control/CxxUtils - Control/StoreGate - Event/xAOD/xAODEventInfo - GaudiKernel - PRIVATE - AtlasTest/TestTools ) - # External dependencies: +find_package( Boost COMPONENTS thread ) find_package( ROOT COMPONENTS Hist Tree Core ) # Component(s) in the package: atlas_add_library( AthenaBaseComps AthenaBaseComps/*.h src/*.cxx PUBLIC_HEADERS AthenaBaseComps - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaKernel CxxUtils xAODEventInfo GaudiKernel - StoreGateLib ) + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaKernel CxxUtils xAODEventInfo GaudiKernel StoreGateLib ) # Test(s) in the package: atlas_add_test( propertyHandling_test diff --git a/Control/AthenaConfiguration/CMakeLists.txt b/Control/AthenaConfiguration/CMakeLists.txt index b9b08175ccb86969accfafba93d4bdb8ab624f5b..d8903a3aa1e973dd7fa55083498d5078f654735b 100644 --- a/Control/AthenaConfiguration/CMakeLists.txt +++ b/Control/AthenaConfiguration/CMakeLists.txt @@ -13,8 +13,6 @@ atlas_install_python_modules( python/*.py python/iconfTool POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_scripts( share/confTool.py python/iconfTool/iconfTool python/CARunner.py) -atlas_install_data( share/*.ref ) - atlas_add_test( ComponentAccumulatorTest SCRIPT python -m unittest -v AthenaConfiguration.ComponentAccumulatorTest POST_EXEC_SCRIPT nopost.sh ) diff --git a/Control/AthenaConfiguration/python/ComponentAccumulator.py b/Control/AthenaConfiguration/python/ComponentAccumulator.py index 6013dbf569fdf9a9f9cc09999f80620858658553..d3a43f99da0f9bb735955ca73c3c635156f2449b 100644 --- a/Control/AthenaConfiguration/python/ComponentAccumulator.py +++ b/Control/AthenaConfiguration/python/ComponentAccumulator.py @@ -827,6 +827,9 @@ def __setProperties( destConfigurableInstance, sourceConf2Instance, indent="" ): pass if pvalue is not None: setattr( destConfigurableInstance, pname, conf2toConfigurable( pvalue, indent=__indent( indent ) ) ) + else: + setattr( destConfigurableInstance, pname, pvalue ) + else: # plain data if isinstance(pvalue,(GaudiConfig2.semantics._ListHelper,GaudiConfig2.semantics._DictHelper)): pvalue=pvalue.data diff --git a/Control/AthenaConfiguration/share/confTool.py b/Control/AthenaConfiguration/share/confTool.py index 57b5e742d6d1b636240957a4c7b53a49a0bef4c3..cfd10954cc0d7fcd59502cd55d6877d974f7e277 100755 --- a/Control/AthenaConfiguration/share/confTool.py +++ b/Control/AthenaConfiguration/share/confTool.py @@ -3,22 +3,20 @@ # # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # -from __future__ import print_function import argparse -import ast -import collections -import json -import pickle -import pprint -import re -import sys -def main(): +def parse_args(): parser = argparse.ArgumentParser( description="Utility to transform/display athena configurations" ) + parser.add_argument( + "-n", + "--newConfig", + action="store_true", + help="Specify to compare two ComponentAccumulator objects", + ) parser.add_argument("-p", "--printConf", action="store_true", help="Prints") parser.add_argument( "--printComps", action="store_true", help="Prints only the components" @@ -64,287 +62,13 @@ def main(): args = parser.parse_args() - if args.printComps: - for fileName in args.file: - conf = __loadSingleFile(fileName, args) - __printComps(conf) - - if args.printConf: - for fileName in args.file: - conf = __loadSingleFile(fileName, args) - __print(conf) - - if args.toJSON: - if len(args.file) != 1: - sys.exit("ERROR, can convert single file at a time, got: %s" % args.file) - conf = __loadSingleFile(args.file[0], args) - with open(args.toJSON, "w") as oFile: - json.dump(conf, oFile, indent=2, ensure_ascii=True) - - if args.toPickle: - if len(args.file) != 1: - sys.exit("ERROR, can convert single file at a time, got: %s" % args.file) - conf = __loadSingleFile(args.file[0], args) - with open(args.toPickle, "wb") as oFile: - for item in conf: - pickle.dump(item, oFile) - - if args.diff: - if len(args.file) != 2: - sys.exit("ERROR, can diff exactly two files at a time, got: %s" % args.file) - configRef = __loadSingleFile(args.file[0], args) - configChk = __loadSingleFile(args.file[1], args) - for ref, chk in zip(configRef, configChk): - if isinstance(ref, dict) and isinstance(chk, dict): - __compareConfig(ref, chk, args) - else: - print("Given list of size %d. Not looking for differences." % len(ref)) - - -def __loadSingleFile(fname, args): - conf = [] - if fname.endswith(".pkl"): - with open(fname, "rb") as input_file: - conf_dict = collections.defaultdict() - while True: - try: - cfg = pickle.load(input_file) - if type(cfg) == collections.defaultdict: - conf_dict.update(cfg) - else: - conf.append(cfg) - except EOFError: - break - conf.append(conf_dict) - print("... Read", len(conf), "items from python pickle file: ", fname) - elif fname.endswith(".json"): - - def __keepPlainStrings(element): - if isinstance(element, str): - return str(element) - if isinstance(element, list): - return [__keepPlainStrings(x) for x in element] - if isinstance(element, dict): - return { - __keepPlainStrings(key): __keepPlainStrings(value) - for key, value in element.items() - } - return element - - with open(fname, "r") as input_file: - conf = json.load(input_file, object_hook=__keepPlainStrings) - print("... Read", len(conf), "items from JSON file: ", fname) - + if args.newConfig: + from new_confTool import main else: - sys.exit("File format not supported.") - - if conf is None: - sys.exit("Unable to load %s file" % fname) - - if args.comps: # returning only wanted components - - def is_component_from_list(component): - return True in [s in component for s in compsToReport] - - compsToReport = [ - item for elem in args.comps for item in elem - ] # creates flat list of wanted components - conf = [ - {key: value for (key, value) in dic.items() if is_component_from_list(key)} - for dic in conf - if isinstance(dic, dict) - ] - return conf - - -def __print(conf): - for item in conf: - pprint.pprint(dict(item)) - - -def __printComps(conf): - for item in conf: - if isinstance(item, dict): - for compName in item.keys(): - print(compName) - - -def __compareConfig(configRef, configChk, args): - # Find superset of all components: - allComps = list(set(configRef.keys()) | set(configChk.keys())) - allComps.sort() - - print("Step 1: reference file #components:", len(configRef)) - print("Step 2: file to check #components:", len(configChk)) - - for component in allComps: - - if component not in configRef: - if not args.ignoreMissing: - print( - "\n\033[91m Component ", - component, - " \033[94m exists only in Chk \033[0m \033[0m \n", - ) - continue - - if component not in configChk: - if not args.ignoreMissing: - print( - "\n\033[91m Component", - component, - " \033[92m exists only in Ref \033[0m \033[0m \n", - ) - continue - - refValue = configRef[component] - chkValue = configChk[component] - - if chkValue == refValue: - if args.printIdenticalComponents: - print("Component", component, "identical") - else: - print("\033[91m Component", component, "differ \033[0m") - if not args.allComponentPrint: - __compareComponent(refValue, chkValue, "\t", args, component) - else: - print( - "\t\033[92mRef\033[0m\t", - sorted(configRef[component].items(), key=lambda kv: kv[0]), - ) - print( - "\t\033[94mChk\033[0m\t", - sorted(configChk[component].items(), key=lambda kv: kv[0]), - ) - - -def __compareComponent(compRef, compChk, prefix, args, component): - - if isinstance(compRef, dict): - - allProps = list(set(compRef.keys()) | set(compChk.keys())) - allProps.sort() - - ignoreList = ["StoreGateSvc", "OutputLevel", "MuonEDMHelperSvc"] - for prop in allProps: - if prop not in compRef.keys(): - print( - "%s%s = %s: \033[94m exists only in Chk \033[0m \033[91m<< !!!\033[0m" - % (prefix, prop, compChk[prop]) - ) - continue - - if prop not in compChk.keys(): - print( - "%s%s = %s: \033[92m exists only in Ref \033[0m \033[91m<< !!!\033[0m" - % (prefix, prop, compRef[prop]) - ) - continue - - refVal = compRef[prop] - chkVal = compChk[prop] - - if args.ignoreIrrelevant and chkVal in ignoreList: - continue - - if str(chkVal) == str(refVal): - if not args.printIdenticalPerParameter: - continue - diffmarker = "" - else: - diffmarker = " \033[91m<< !!!\033[0m" - - if not (component == 'IOVDbSvc' and prop == 'Folders'): - print( - "%s%s : \033[92m %s \033[0m vs \033[94m %s \033[0m %s" - % (prefix, prop, str(refVal), str(chkVal), diffmarker) - ) - - try: - refVal = ast.literal_eval(str(refVal)) if refVal else '' - chkVal = ast.literal_eval(str(chkVal)) if chkVal else '' - except SyntaxError: - pass - except ValueError: - pass # literal_eval exception when parsing particular strings - - if refVal and (isinstance(refVal, list) or isinstance(refVal, dict)): - if component == 'IOVDbSvc' and prop == 'Folders': - __compareIOVDbFolders(refVal, chkVal, "\t", args) - else: - __compareComponent(refVal, chkVal, "\t" + prefix + ">> ", args, component) - - elif isinstance(compRef, list) and len(compRef) > 1: - diffRef = list(set(compRef) - set(compChk)) - diffChk = list(set(compChk) - set(compRef)) - if diffRef: - print( - "%s exists only in Ref : \033[92m %s \033[0m \033[91m<< !!!\033[0m" - % (prefix, str(diffRef)) - ) - if diffChk: - print( - "%s exists only in Chk : \033[94m %s \033[0m \033[91m<< !!!\033[0m" - % (prefix, str(diffChk)) - ) - - if len(compRef) == len(compChk): - if sorted(compRef) == sorted(compChk): - print( - "%s : \033[91m ^^ Different order ^^ !!!\033[0m" - % (prefix) - ) - else: - for i, (refVal, chkVal) in enumerate(zip(compRef, compChk)): - if refVal != chkVal: - print( - "%s : \033[92m %s \033[0m vs \033[94m %s \033[0m \033[91m<< at index %s !!!\033[0m" - % (prefix, str(refVal), str(chkVal), str(i)) - ) - __compareComponent(refVal, chkVal, "\t" + prefix + ">> ", args, '') - - -def __parseIOVDbFolder(definition): - result = {} - # db - db_match = re.search(r'<db>(.*)</db>', definition) - if db_match: - result['db'] = db_match.group(1) - definition = definition.replace(db_match.group(0), '') - # key - key_match = re.search(r'<key>(.*)</key>', definition) - if key_match: - result['key'] = key_match.group(1) - definition = definition.replace(key_match.group(0), '') - # tag - tag_match = re.search(r'<tag>(.*)</tag>', definition) - if tag_match: - result['tag'] = tag_match.group(1) - definition = definition.replace(tag_match.group(0), '') - # cache -- ignore for now - cache_match = re.search(r'<cache>(.*)</cache>', definition) - if cache_match: - definition = definition.replace(cache_match.group(0), '') - # noover - noover_match = re.search(r'<noover/>', definition) - if noover_match: - result['noover'] = True - definition = definition.replace(noover_match.group(0), '') - # name - result['name'] = definition.strip() - - return json.dumps(result) - + from old_confTool import main -def __compareIOVDbFolders(compRef, compChk, prefix, args): - refParsed = [] - chkParsed = [] - for item in compRef: - refParsed.append(__parseIOVDbFolder(item)) - for item in compChk: - chkParsed.append(__parseIOVDbFolder(item)) - __compareComponent(refParsed, chkParsed, prefix, args, '') + main(args) if __name__ == "__main__": - main() + parse_args() diff --git a/Control/AthenaConfiguration/share/new_confTool.py b/Control/AthenaConfiguration/share/new_confTool.py new file mode 100644 index 0000000000000000000000000000000000000000..495513e37dfacf8b00f90173fd1cbba0d44bfa3b --- /dev/null +++ b/Control/AthenaConfiguration/share/new_confTool.py @@ -0,0 +1,224 @@ +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +import json +import pickle +import sys +import six + +from GaudiConfig2 import Configurable + + +def main(args): + if args.printComps: + for fileName in args.file: + conf = _loadSingleFile(fileName) + conf.printConfig() + + if args.printConf: + for fileName in args.file: + conf = _loadSingleFile(fileName) + conf.printConfig(withDetails=True) + + if args.toPickle: + if len(args.file) != 1: + sys.exit("ERROR, can convert single file at a time, got: %s" % args.file) + conf = _loadSingleFile(args.file[0]) + with open(args.toPickle, "wb") as oFile: + conf.store(oFile) + + if args.diff: + if len(args.file) != 2: + sys.exit("ERROR, can diff exactly two files at a time, got: %s" % args.file) + configRef = _loadSingleFile(args.file[0]) + configChk = _loadSingleFile(args.file[1]) + _compareConfig(configRef, configChk, args) + + +def _loadSingleFile(fname): + conf = None + if fname.endswith(".pkl"): + with open(fname, "rb") as input_file: + conf = pickle.load(input_file) + print("Read pickle file: {}".format(fname)) + else: + sys.exit("File format not supported.") + + if conf is None: + sys.exit("Unable to load %s file" % fname) + + return conf + + +def _compareConfig(configRef, configChk, args): + print("\nallSequences:") + for ref_sequence, chk_sequence in zip( + configRef._allSequences, configChk._allSequences + ): + _compareCollection(ref_sequence, chk_sequence, args) + + print("\nallconditionsAlgs:") + _compareCollection( + sorted(configRef._conditionsAlgs, key=lambda x: x.name), + sorted(configChk._conditionsAlgs, key=lambda x: x.name), + args, + ) + + print("\nservices:") + _compareCollection( + sorted(configRef._services, key=lambda x: x.name), + sorted(configChk._services, key=lambda x: x.name), + args, + ) + + print("\npublicTools:") + _compareCollection( + sorted(configRef._publicTools, key=lambda x: x.name), + sorted(configChk._publicTools, key=lambda x: x.name), + args, + ) + + print("\ntheAppProps:") + _compareCollection(configRef._theAppProps, configChk._theAppProps, args) + + +def _compareCollection(ref_collection, chk_collection, args): + if isinstance(ref_collection, list): + all_names = list(set([obj.name for obj in ref_collection + chk_collection])) + # print(all_names) + for name in all_names: + ref = _findByName(name, ref_collection) + chk = _findByName(name, chk_collection) + if not ref: + print( + f"\n\033[91m Component {name} \033[94m exists only in Chk \033[0m \033[0m \n" + ) + elif not chk: + print( + f"\n\033[91m Component {name} \033[92m exists only in Ref \033[0m \033[0m \n" + ) + elif not _equalComponent(ref, chk): + _compareComponent(ref, chk, args) + + elif isinstance(ref_collection, dict): + all_keys = set(list(ref_collection.keys()) + list(chk_collection.keys())) + for key in all_keys: + if key not in ref_collection: + print( + f"{key} = {chk_collection[key]}: \033[94m exists only in Chk \033[0m \033[91m<< !!!\033[0m" + ) + elif key not in chk_collection: + print( + f"{key} = {ref_collection[key]}: \033[92m exists only in Ref \033[0m \033[91m<< !!!\033[0m" + ) + elif ref_collection[key] != chk_collection[key]: + print( + f"{key} : \033[92m {str(ref_collection[key])} \033[0m vs \033[94m {str(chk_collection[key])} \033[0m \033[91m<< !!!\033[0m" + ) + + +def _compareComponent(compRef, compChk, args, level=0): + + ref_keys = compRef._descriptors.keys() + chk_keys = compChk._descriptors.keys() + + all_descriptors = set(list(ref_keys) + list(chk_keys)) + + for prop in all_descriptors: + if prop not in ref_keys: + print( + f"{prop} = {compChk[prop]}: \033[94m exists only in Chk \033[0m \033[91m<< !!!\033[0m" + ) + continue + + if prop not in chk_keys: + print( + f"{prop} = {compRef[prop]}: \033[92m exists only in Ref \033[0m \033[91m<< !!!\033[0m" + ) + continue + + ref_val = compRef._descriptors[prop].__get__(compRef, "") + chk_val = compChk._descriptors[prop].__get__(compChk, "") + + if _getStrDescriptor(ref_val) == _getStrDescriptor(chk_val): + if not args.printIdenticalPerParameter: + continue + diffmarker = "" + else: + diffmarker = " \033[91m<< !!!\033[0m" + + print( + f"{'>> '*level}{prop} : \033[92m {str(ref_val)} \033[0m vs \033[94m {str(chk_val)} \033[0m {diffmarker}" + ) + + if isinstance(ref_val, Configurable): + print(f"vvv") + _compareComponent(ref_val, chk_val, args, level + 1) + + +def _equalComponent(self, other): + + if type(self) is not type(other): + return False + if hasattr(self, "name") != hasattr(other, "name"): + return False + if hasattr(self, "name") and (self.name != other.name): + return False + all_descriptors = set( + list(self._descriptors.keys()) + list(other._descriptors.keys()) + ) + for name in all_descriptors: + if name not in self._descriptors or name not in other._descriptors: + return False + self_prop = self._descriptors[name].__get__(self, "") + other_prop = other._descriptors[name].__get__(other, "") + if _getStrDescriptor(self_prop) != _getStrDescriptor(other_prop): + return False + return True + + +def _getStrDescriptor(obj): + descr = "" + if hasattr(obj, "_name"): + propstr = _getFlattenedProperties(obj) + descr = (obj.name, propstr) + elif isinstance(obj, list) and len(obj) > 0 and isinstance(obj[0], Configurable): + for el in obj: + descr += str(_getStrDescriptor(el)) + else: + descr = str(obj) + return descr + + +def _getFlattenedProperties(obj): + properties = _getPropertyValues(obj) + propstr = "" + for key, val in sorted(six.iteritems(properties)): + if isinstance(val, Configurable): + propstr += "({0}:{1})".format(key, _getFlattenedProperties(val)) + elif isinstance(val, str): + propstr += f"({val})" + elif hasattr(val, "__iter__"): + for th in val: + if isinstance(th, Configurable): + propstr += "({0}:{1})".format(th.name, _getFlattenedProperties(th)) + elif isinstance(th, str) and "{" in th: # parse dict saved as a string + propstr += f"({str(sorted(json.loads(th).items()))})" + else: + propstr += f"({th})" + else: + propstr += "({0}:{1})".format(key, str(val)) + return propstr + + +def _getPropertyValues(obj): + props = {} + for name, proxy in sorted(six.iteritems(obj._descriptors)): + value = proxy.__get__(obj, "") + props[name] = value + return props + + +def _findByName(name, collection): + match = list(filter(lambda x: x.name == name, collection)) + return match[0] if match else None diff --git a/Control/AthenaConfiguration/share/old_confTool.py b/Control/AthenaConfiguration/share/old_confTool.py new file mode 100644 index 0000000000000000000000000000000000000000..23f20d6b3dbdd79d5ab7097d476bb7d1720b87d7 --- /dev/null +++ b/Control/AthenaConfiguration/share/old_confTool.py @@ -0,0 +1,297 @@ +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +from __future__ import print_function + +import argparse +import ast +import collections +import json +import pickle +import pprint +import re +import sys + + +def main(args): + if args.printComps: + for fileName in args.file: + conf = _loadSingleFile(fileName, args) + _printComps(conf) + + if args.printConf: + for fileName in args.file: + conf = _loadSingleFile(fileName, args) + _print(conf) + + if args.toJSON: + if len(args.file) != 1: + sys.exit("ERROR, can convert single file at a time, got: %s" % args.file) + conf = _loadSingleFile(args.file[0], args) + with open(args.toJSON, "w") as oFile: + json.dump(conf, oFile, indent=2, ensure_ascii=True) + + if args.toPickle: + if len(args.file) != 1: + sys.exit("ERROR, can convert single file at a time, got: %s" % args.file) + conf = _loadSingleFile(args.file[0], args) + with open(args.toPickle, "wb") as oFile: + for item in conf: + pickle.dump(item, oFile) + + if args.diff: + if len(args.file) != 2: + sys.exit("ERROR, can diff exactly two files at a time, got: %s" % args.file) + configRef = _loadSingleFile(args.file[0], args) + configChk = _loadSingleFile(args.file[1], args) + for ref, chk in zip(configRef, configChk): + if isinstance(ref, dict) and isinstance(chk, dict): + _compareConfig(ref, chk, args) + else: + print("Given list of size %d. Not looking for differences." % len(ref)) + + +def _loadSingleFile(fname, args): + conf = [] + if fname.endswith(".pkl"): + with open(fname, "rb") as input_file: + conf_dict = collections.defaultdict() + while True: + try: + cfg = pickle.load(input_file) + if type(cfg) == collections.defaultdict: + conf_dict.update(cfg) + else: + conf.append(cfg) + except EOFError: + break + conf.append(conf_dict) + print("... Read", len(conf), "items from python pickle file: ", fname) + elif fname.endswith(".json"): + + def __keepPlainStrings(element): + if isinstance(element, str): + return str(element) + if isinstance(element, list): + return [__keepPlainStrings(x) for x in element] + if isinstance(element, dict): + return { + __keepPlainStrings(key): __keepPlainStrings(value) + for key, value in element.items() + } + return element + + with open(fname, "r") as input_file: + conf = json.load(input_file, object_hook=__keepPlainStrings) + print("... Read", len(conf), "items from JSON file: ", fname) + + else: + sys.exit("File format not supported.") + + if conf is None: + sys.exit("Unable to load %s file" % fname) + + if args.comps: # returning only wanted components + + def is_component_from_list(component): + return True in [s in component for s in compsToReport] + + compsToReport = [ + item for elem in args.comps for item in elem + ] # creates flat list of wanted components + conf = [ + {key: value for (key, value) in dic.items() if is_component_from_list(key)} + for dic in conf + if isinstance(dic, dict) + ] + return conf + + +def _print(conf): + for item in conf: + pprint.pprint(dict(item)) + + +def _printComps(conf): + for item in conf: + if isinstance(item, dict): + for compName in item.keys(): + print(compName) + + +def _compareConfig(configRef, configChk, args): + # Find superset of all components: + allComps = list(set(configRef.keys()) | set(configChk.keys())) + allComps.sort() + + print("Step 1: reference file #components:", len(configRef)) + print("Step 2: file to check #components:", len(configChk)) + + for component in allComps: + + if component not in configRef: + if not args.ignoreMissing: + print( + "\n\033[91m Component ", + component, + " \033[94m exists only in Chk \033[0m \033[0m \n", + ) + continue + + if component not in configChk: + if not args.ignoreMissing: + print( + "\n\033[91m Component", + component, + " \033[92m exists only in Ref \033[0m \033[0m \n", + ) + continue + + refValue = configRef[component] + chkValue = configChk[component] + + if chkValue == refValue: + if args.printIdenticalComponents: + print("Component", component, "identical") + else: + print("\033[91m Component", component, "differ \033[0m") + if not args.allComponentPrint: + _compareComponent(refValue, chkValue, "\t", args, component) + else: + print( + "\t\033[92mRef\033[0m\t", + sorted(configRef[component].items(), key=lambda kv: kv[0]), + ) + print( + "\t\033[94mChk\033[0m\t", + sorted(configChk[component].items(), key=lambda kv: kv[0]), + ) + + +def _compareComponent(compRef, compChk, prefix, args, component): + + if isinstance(compRef, dict): + + allProps = list(set(compRef.keys()) | set(compChk.keys())) + allProps.sort() + + ignoreList = ["StoreGateSvc", "OutputLevel", "MuonEDMHelperSvc"] + for prop in allProps: + if prop not in compRef.keys(): + print( + "%s%s = %s: \033[94m exists only in Chk \033[0m \033[91m<< !!!\033[0m" + % (prefix, prop, compChk[prop]) + ) + continue + + if prop not in compChk.keys(): + print( + "%s%s = %s: \033[92m exists only in Ref \033[0m \033[91m<< !!!\033[0m" + % (prefix, prop, compRef[prop]) + ) + continue + + refVal = compRef[prop] + chkVal = compChk[prop] + + if args.ignoreIrrelevant and chkVal in ignoreList: + continue + + if str(chkVal) == str(refVal): + if not args.printIdenticalPerParameter: + continue + diffmarker = "" + else: + diffmarker = " \033[91m<< !!!\033[0m" + + if not (component == "IOVDbSvc" and prop == "Folders"): + print( + "%s%s : \033[92m %s \033[0m vs \033[94m %s \033[0m %s" + % (prefix, prop, str(refVal), str(chkVal), diffmarker) + ) + + try: + refVal = ast.literal_eval(str(refVal)) if refVal else "" + chkVal = ast.literal_eval(str(chkVal)) if chkVal else "" + except SyntaxError: + pass + except ValueError: + pass # literal_eval exception when parsing particular strings + + if refVal and (isinstance(refVal, list) or isinstance(refVal, dict)): + if component == "IOVDbSvc" and prop == "Folders": + _compareIOVDbFolders(refVal, chkVal, "\t", args) + else: + _compareComponent( + refVal, chkVal, "\t" + prefix + ">> ", args, component + ) + + elif isinstance(compRef, list) and len(compRef) > 1: + diffRef = list(set(compRef) - set(compChk)) + diffChk = list(set(compChk) - set(compRef)) + if diffRef: + print( + "%s exists only in Ref : \033[92m %s \033[0m \033[91m<< !!!\033[0m" + % (prefix, str(diffRef)) + ) + if diffChk: + print( + "%s exists only in Chk : \033[94m %s \033[0m \033[91m<< !!!\033[0m" + % (prefix, str(diffChk)) + ) + + if len(compRef) == len(compChk): + if sorted(compRef) == sorted(compChk): + print("%s : \033[91m ^^ Different order ^^ !!!\033[0m" % (prefix)) + else: + for i, (refVal, chkVal) in enumerate(zip(compRef, compChk)): + if refVal != chkVal: + print( + "%s : \033[92m %s \033[0m vs \033[94m %s \033[0m \033[91m<< at index %s !!!\033[0m" + % (prefix, str(refVal), str(chkVal), str(i)) + ) + _compareComponent( + refVal, chkVal, "\t" + prefix + ">> ", args, "" + ) + + +def _parseIOVDbFolder(definition): + result = {} + # db + db_match = re.search(r"<db>(.*)</db>", definition) + if db_match: + result["db"] = db_match.group(1) + definition = definition.replace(db_match.group(0), "") + # key + key_match = re.search(r"<key>(.*)</key>", definition) + if key_match: + result["key"] = key_match.group(1) + definition = definition.replace(key_match.group(0), "") + # tag + tag_match = re.search(r"<tag>(.*)</tag>", definition) + if tag_match: + result["tag"] = tag_match.group(1) + definition = definition.replace(tag_match.group(0), "") + # cache -- ignore for now + cache_match = re.search(r"<cache>(.*)</cache>", definition) + if cache_match: + definition = definition.replace(cache_match.group(0), "") + # noover + noover_match = re.search(r"<noover/>", definition) + if noover_match: + result["noover"] = True + definition = definition.replace(noover_match.group(0), "") + # name + result["name"] = definition.strip() + + return json.dumps(result) + + +def _compareIOVDbFolders(compRef, compChk, prefix, args): + refParsed = [] + chkParsed = [] + for item in compRef: + refParsed.append(_parseIOVDbFolder(item)) + for item in compChk: + chkParsed.append(_parseIOVDbFolder(item)) + _compareComponent(refParsed, chkParsed, prefix, args, "") diff --git a/Control/AthenaExamples/AthExOnnxRuntime/src/CxxApiAlgorithm.cxx b/Control/AthenaExamples/AthExOnnxRuntime/src/CxxApiAlgorithm.cxx index 24357a468f93afc7c6789efe0711f634e9e73d05..0efc2041879050a1e390be7f9e7d716527da51c8 100644 --- a/Control/AthenaExamples/AthExOnnxRuntime/src/CxxApiAlgorithm.cxx +++ b/Control/AthenaExamples/AthExOnnxRuntime/src/CxxApiAlgorithm.cxx @@ -154,11 +154,11 @@ namespace AthONNX { // create input tensor object from data values auto memory_info = Ort::MemoryInfo::CreateCpu(OrtArenaAllocator, OrtMemTypeDefault); - Ort::Value input_tensor = Ort::Value::CreateTensor<float>(memory_info, input_tensor_values.data(), input_tensor_size, input_node_dims.data(), 3); + Ort::Value input_tensor = Ort::Value::CreateTensor<float>(memory_info, input_tensor_values.data(), input_tensor_size, input_node_dims.data(), input_node_dims.size()); assert(input_tensor.IsTensor()); // score model & input tensor, get back output tensor - auto output_tensors = m_session->Run(Ort::RunOptions{nullptr}, input_node_names.data(), &input_tensor, 1, output_node_names.data(), 1); + auto output_tensors = m_session->Run(Ort::RunOptions{nullptr}, input_node_names.data(), &input_tensor, input_node_names.size(), output_node_names.data(), output_node_names.size()); assert(output_tensors.size() == 1 && output_tensors.front().IsTensor()); // Get pointer to output tensor float values diff --git a/Control/AthenaMonitoringKernel/CMakeLists.txt b/Control/AthenaMonitoringKernel/CMakeLists.txt index 646c1177f43d1cbaa1f748c8098fbd77388fa471..b11c276a798707f8641ad43abfd1a248a5a137c4 100644 --- a/Control/AthenaMonitoringKernel/CMakeLists.txt +++ b/Control/AthenaMonitoringKernel/CMakeLists.txt @@ -31,7 +31,6 @@ atlas_add_component( # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) # Decide whether to use Valgrind in the unit tests. set( _extra_includes ) diff --git a/Control/IOVSvc/CMakeLists.txt b/Control/IOVSvc/CMakeLists.txt index ecbc4d23d0209648768fb8bf9984c1dca0bc7e32..468d5f03ef1e13a2f5dc5b05e70f1c3180bacc4a 100644 --- a/Control/IOVSvc/CMakeLists.txt +++ b/Control/IOVSvc/CMakeLists.txt @@ -1,25 +1,10 @@ -################################################################################ -# Package: IOVSvc -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( IOVSvc ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/SGTools - Control/StoreGate - GaudiKernel - PRIVATE - AtlasTest/TestTools - Control/AthContainersInterfaces - Database/PersistentDataModel - Event/xAOD/xAODEventInfo ) - # External dependencies: -find_package( Boost COMPONENTS filesystem thread system ) +find_package( Boost ) find_package( ROOT COMPONENTS Core ) # Component(s) in the package: @@ -28,30 +13,27 @@ atlas_add_library( IOVSvcLib PUBLIC_HEADERS IOVSvc INCLUDE_DIRS ${Boost_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} AthenaBaseComps AthenaKernel SGTools GaudiKernel StoreGateLib SGtests xAODEventInfo PersistentDataModel - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} TestTools ) + LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel SGTools + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} PersistentDataModel StoreGateLib xAODEventInfo ) atlas_add_component( IOVSvc src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} IOVSvcLib ) + LINK_LIBRARIES IOVSvcLib ) + +# Install files from the package: +atlas_install_joboptions( share/IOVSvc.txt share/IOVSvc.py ) +# Tests in the package: atlas_add_test( IOVSvcTool_test SOURCES test/IOVSvcTool_test.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES IOVSvcLib + LINK_LIBRARIES IOVSvcLib StoreGateLib TestTools LOG_IGNORE_PATTERN "^HistogramPersis.* INFO|^IOVSvc +DEBUG|^IOVSvcTool +DEBUG" ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" ) atlas_add_test( IOVSvc_test SOURCES test/IOVSvc_test.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES IOVSvcLib + LINK_LIBRARIES IOVSvcLib TestTools LOG_IGNORE_PATTERN "^HistogramPersis.* INFO|^IOVSvc +DEBUG|^IOVSvcTool +DEBUG" ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" ) - -# Install files from the package: -atlas_install_joboptions( share/IOVSvc.txt share/IOVSvc.py ) - diff --git a/Control/IOVSvc/src/CondInputLoader.cxx b/Control/IOVSvc/src/CondInputLoader.cxx index 4d40ed5b22a0f33998edb0d1a6968494e78ceabb..fceda41da3e96f29da576605a974bd401e0cf2c8 100644 --- a/Control/IOVSvc/src/CondInputLoader.cxx +++ b/Control/IOVSvc/src/CondInputLoader.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 */ // CondInputLoader.cxx @@ -74,11 +74,6 @@ CondInputLoader::CondInputLoader( const std::string& name, } } -// Destructor -/////////////// -CondInputLoader::~CondInputLoader() -{} - //----------------------------------------------------------------------------- // Athena Algorithm's Hooks @@ -344,8 +339,14 @@ CondInputLoader::execute() } } - if (m_dumpEvt) { - ATH_MSG_DEBUG(m_condStore->dump()); + if (m_dumpCondStore) { + ATH_MSG_DEBUG(m_condStore->dump()); + } + + if (m_dumpCondSvc) { + std::ostringstream ost; + m_condSvc->dump(ost); + ATH_MSG_DEBUG(ost.str()); } return sc; diff --git a/Control/IOVSvc/src/CondInputLoader.h b/Control/IOVSvc/src/CondInputLoader.h index c35e54a4896fa5a9a7b868b3071e3b9d33bab104..aec51a8ff34c90008863f1caee6dbe396831a144 100644 --- a/Control/IOVSvc/src/CondInputLoader.h +++ b/Control/IOVSvc/src/CondInputLoader.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 */ // CondInputLoader.h @@ -10,10 +10,6 @@ #ifndef IOVSVC_CONDINPUTLOADER_H #define IOVSVC_CONDINPUTLOADER_H 1 -// STL includes -#include <string> - - #include "GaudiKernel/DataObjID.h" #include "GaudiKernel/ICondSvc.h" #include "GaudiKernel/ServiceHandle.h" @@ -31,57 +27,34 @@ class CondInputLoader : public ::AthAlgorithm { - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - public: + public: - // Copy constructor: - - /// Constructor with parameters: + /// Constructor with parameters: CondInputLoader( const std::string& name, ISvcLocator* pSvcLocator ); - /// Destructor: - virtual ~CondInputLoader(); - - // Assignment operator: - //CondInputLoader &operator=(const CondInputLoader &alg); - // Athena algorithm's Hooks - virtual StatusCode initialize(); - virtual StatusCode start(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// + virtual StatusCode initialize() override; + virtual StatusCode start() override; + virtual StatusCode execute() override; + virtual StatusCode finalize() override; - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// - private: - - /// Default constructor: - // CondInputLoader(); + private: // need to override the ExtraInputs/Outputs property handler // from AthAlgorithm void extraDeps_update_handler(Property&); - // void loader(Property&); - /// Containers - Gaudi::Property<DataObjIDColl> m_load{this,"Load",{},"List of objects to be loaded","OrderedSet<std::vector<std::string> >"}; + Gaudi::Property<DataObjIDColl> m_load{this,"Load",{}, + "List of objects to be loaded","OrderedSet<std::vector<std::string> >"}; DataObjIDColl m_handlesToCreate; std::vector< SG::VarHandleKey > m_vhk; - Gaudi::Property<bool> m_dumpEvt{ this, "DumpCondStore", false, + Gaudi::Property<bool> m_dumpCondStore{ this, "DumpCondStore", false, "dump the ConditionStore at the end execute"}; + Gaudi::Property<bool> m_dumpCondSvc{ this, "DumpCondSvc", false, + "dump the CondSvc at the end execute"}; Gaudi::Property<bool> m_abort {this, "AbortIfInitFails", true, "Abort execution if unable to create the CondCont<T> in first event"}; @@ -96,4 +69,4 @@ class CondInputLoader }; -#endif //> !SGCOMPS_SGINPUTLOADER_H +#endif diff --git a/Control/PileUpComps/CMakeLists.txt b/Control/PileUpComps/CMakeLists.txt index 1583613e20b1d6ad14b297cba782f139f8c56ca8..61e2054ef5fd4462f79853b7f950b56c6cdfe0e7 100644 --- a/Control/PileUpComps/CMakeLists.txt +++ b/Control/PileUpComps/CMakeLists.txt @@ -5,18 +5,6 @@ # Declare the package name: atlas_subdir( PileUpComps ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PRIVATE - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - Control/StoreGate - Event/EventInfo - Event/EventInfoUtils - Event/xAOD/xAODEventInfo - Event/xAOD/xAODCnvInterfaces - GaudiKernel ) - # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) diff --git a/Control/PileUpTools/CMakeLists.txt b/Control/PileUpTools/CMakeLists.txt index d44bc5cd485cf7f48347aec568423d358b0a1ada..85dbc42b165b34c865f03d866ca944acd7ffe853 100644 --- a/Control/PileUpTools/CMakeLists.txt +++ b/Control/PileUpTools/CMakeLists.txt @@ -5,18 +5,6 @@ # Declare the package name: atlas_subdir( PileUpTools ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/AthLinks - Control/SGTools - Control/StoreGate - Event/EventInfo - Event/xAOD/xAODEventInfo - Event/xAOD/xAODCnvInterfaces - GaudiKernel ) - # Component(s) in the package: atlas_add_library( PileUpToolsLib src/*.cxx @@ -24,7 +12,7 @@ atlas_add_library( PileUpToolsLib LINK_LIBRARIES AthenaBaseComps AthenaKernel AthLinks SGTools EventInfo xAODEventInfo xAODCnvInterfaces - GaudiKernel StoreGateLib SGtests ) + GaudiKernel StoreGateLib SGtests ) atlas_add_component( PileUpTools src/components/*.cxx diff --git a/Control/RootUtils/src/pyroot/PyROOTInspector.cxx b/Control/RootUtils/src/pyroot/PyROOTInspector.cxx index b99ff4e3da4d63ccd54a1c9f4c99512e1abe0fa5..ae1676966ccd27a48bb40aee0a491edca383ea4e 100644 --- a/Control/RootUtils/src/pyroot/PyROOTInspector.cxx +++ b/Control/RootUtils/src/pyroot/PyROOTInspector.cxx @@ -242,8 +242,13 @@ recurse_pyinspect(PyObject *pyobj, // something completely different, so that didn't work. // Rewriting in terms of iteration avoids this. // .. except that it mysteriously fails (sometimes) for TileCellVec. + // .. and if we try to use the iterator interface for vector<char>, + // then with python 3, pyroot will try to convert its contents + // to a unicode string object, which will likely fail. Py_ssize_t nelems = PySequence_Size(pyobj); - if (strcmp(tcls->GetName(), "TileCellVec") == 0) { + if (strcmp(tcls->GetName(), "TileCellVec") == 0 || + strcmp(tcls->GetName(), "vector<char>") == 0) + { for (Py_ssize_t i = 0; i < nelems; ++i) { PyObject *pyidx = PyLong_FromLong(i); PyObject *itr = PySequence_GetItem(pyobj, i); diff --git a/DataQuality/DataQualityInterfaces/src/HanConfig.cxx b/DataQuality/DataQualityInterfaces/src/HanConfig.cxx index ae6006db339f1e4d1c771496006a3ac78c39e8dd..050601694e4be42aff591568c697f1960ea936e2 100644 --- a/DataQuality/DataQualityInterfaces/src/HanConfig.cxx +++ b/DataQuality/DataQualityInterfaces/src/HanConfig.cxx @@ -491,7 +491,7 @@ GetAlgorithmConfiguration( HanConfigAssessor* dqpar, const std::string& algID, } std::string newRefId; std::string absAlgRefName(""); - for (const auto thisRefID : refIDVec) { + for (const auto& thisRefID : refIDVec) { std::string algRefName( m_refConfig.GetStringAttribute(thisRefID,"name") ); std::string algRefPath( m_refConfig.GetStringAttribute(thisRefID,"path") ); std::string algRefInfo( m_refConfig.GetStringAttribute(thisRefID,"info") ); diff --git a/Database/IOVDbSvc/CMakeLists.txt b/Database/IOVDbSvc/CMakeLists.txt index 36381d04534083afa223eeedff9e9103532c13fc..555ab7d5b36ad04c0d51fcb2925b434689903ba9 100644 --- a/Database/IOVDbSvc/CMakeLists.txt +++ b/Database/IOVDbSvc/CMakeLists.txt @@ -101,7 +101,7 @@ atlas_add_test( ReadFromFileMetaData_test atlas_add_test( IOVDbFolder_test SOURCES test/IOVDbFolder_test.cxx src/FolderTypes.cxx src/IOVDbStringFunctions.cxx src/IOVDbParser.cxx src/IOVDbConn.cxx - src/IOVDbFolder.cxx src/IOVDbParser.cxx src/IovStore.cxx + src/IOVDbFolder.cxx src/IovStore.cxx src/ReadFromFileMetaData.cxx src/IOVDbCoolFunctions.cxx src/TagFunctions.cxx src/Cool2Json.cxx src/Base64Codec.cxx src/Json2Cool.cxx src/IOVDbSvcCurl.cxx src/BasicFolder.cxx src/IOVDbResolveTag.cxx src/CrestFunctions.cxx diff --git a/DetectorDescription/AGDD/AGDDControl/AGDDControl/AGDD2GeoModelBuilder.h b/DetectorDescription/AGDD/AGDDControl/AGDDControl/AGDD2GeoModelBuilder.h index 01fb50e4f2e605029cd56daed7b20a76495ad9ad..d3d25f8c42cddde4ef627ddbf8c4d0c74f163f7b 100644 --- a/DetectorDescription/AGDD/AGDDControl/AGDDControl/AGDD2GeoModelBuilder.h +++ b/DetectorDescription/AGDD/AGDDControl/AGDDControl/AGDD2GeoModelBuilder.h @@ -70,6 +70,17 @@ public: private: GeoPhysVol *m_mother; const GeoMaterial* GetMMMaterial(const std::string&); + + /** phi method (cf. EventPrimitives/AmgMatrixBasePlugin.h) */ + inline double phi(const GeoTrf::Vector3D &vec) const { + if (vec.rows() < 2) return 0.; + return std::atan2(vec[1],vec[0]); + } + /** theta method (cf. EventPrimitives/AmgMatrixBasePlugin.h) */ + inline double theta(const GeoTrf::Vector3D &vec) const { + if (vec.rows() < 3) return 0.; + return std::atan2(std::hypot(vec[0],vec[1]),vec[2]); + } }; #endif diff --git a/DetectorDescription/AGDD/AGDDControl/src/AGDD2GeoModelBuilder.cxx b/DetectorDescription/AGDD/AGDDControl/src/AGDD2GeoModelBuilder.cxx index 7ea491175b8d3cf9079f1886f76be0251383076a..f218cb84dca7e7ac083e67a8db58b4eb3dad06c4 100644 --- a/DetectorDescription/AGDD/AGDDControl/src/AGDD2GeoModelBuilder.cxx +++ b/DetectorDescription/AGDD/AGDDControl/src/AGDD2GeoModelBuilder.cxx @@ -52,17 +52,13 @@ #include "GeoModelKernel/GeoShapeShift.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" -#include "CLHEP/Geometry/Transform3D.h" -#include "CLHEP/Geometry/Point3D.h" +#include "GeoModelInterfaces/StoredMaterialManager.h" +#include "GeoPrimitives/CLHEPtoEigenConverter.h" #include <iostream> #include <sstream> @@ -222,16 +218,15 @@ void AGDD2GeoModelBuilder::CreateSnake(AGDDSnake* v) { // here begins a nasty piece of code 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)); + GeoTrf::Vector3D v1(0,0,-1*GeoModelKernelUnits::km); + GeoTrf::Vector3D v2(0,0,+1*GeoModelKernelUnits::km); + GeoTrf::Transform3D ttt1 = GeoTrf::Transform3D::Identity()*GeoTrf::Translation3D(v1); + GeoTrf::Transform3D ttt2 = GeoTrf::Transform3D::Identity()*GeoTrf::Translation3D(v2); + static GeoShape *s1=new GeoShapeShift(box1,ttt1); + static GeoShape *s2=new GeoShapeShift(box1,ttt2); double radius=v->Radius(); - CLHEP::Hep3Vector axis0=(v->GetPoint(0)-v->GetPoint(1)); + CLHEP::Hep3Vector axis0(v->GetPoint(0)-v->GetPoint(1)); CLHEP::Hep3Vector axis(v->GetPoint(1)-v->GetPoint(0)); CLHEP::Hep3Vector axis1; CLHEP::Hep3Vector axis2(v->GetPoint(2)-v->GetPoint(1)); @@ -243,25 +238,18 @@ void AGDD2GeoModelBuilder::CreateSnake(AGDDSnake* v) double lengthnew=length+delta_l2; 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; - rrr.rotateZ(axis2.phi()); - rrr.rotateY(angle2); - HepGeom::Transform3D ttt(rrr,vt); - GeoShape *ssnew=new GeoShapeShift(s1,Amg::CLHEPTransformToEigen(ttt)); + const GeoTrf::Vector3D vt(0.,0.,-lengthnew/2.+delta_l2+2.); + GeoTrf::Transform3D rrr = GeoTrf::RotateY3D(angle2)*GeoTrf::RotateZ3D(axis2.phi()); + GeoShape *ssnew=new GeoShapeShift(s1,GeoTrf::Translation3D(vt)*rrr); solid = new GeoShapeSubtraction(solid,ssnew); - CLHEP::Hep3Vector vref(0.,0.,-lengthnew/2.); - CLHEP::HepRotation r; - HepGeom::Transform3D tref(r,vref); - solid=new GeoShapeShift(solid,Amg::CLHEPTransformToEigen(tref)); - CLHEP::HepRotation r1; - r1.rotateY(axis0.theta()); - r1.rotateZ(axis0.phi()); - CLHEP::Hep3Vector vtt(v->GetPoint(0).x(),v->GetPoint(0).y(),v->GetPoint(0).z()); - HepGeom::Transform3D t(r1,vtt); - solid=new GeoShapeShift(solid,Amg::CLHEPTransformToEigen(t)); + GeoTrf::Vector3D vref(0.,0.,-lengthnew/2.); + GeoTrf::Transform3D tref = GeoTrf::Transform3D::Identity()*GeoTrf::Translation3D(vref); + solid=new GeoShapeShift(solid,tref); + GeoTrf::Transform3D r1 = GeoTrf::RotateZ3D(axis0.phi())*GeoTrf::RotateY3D(axis0.theta()); + GeoTrf::Vector3D vtt(v->GetPoint(0).x(),v->GetPoint(0).y(),v->GetPoint(0).z()); + solid=new GeoShapeShift(solid,GeoTrf::Translation3D(vtt)*r1); for (int i=1;i<v->NrOfPoints()-1;i++) { @@ -282,41 +270,30 @@ void AGDD2GeoModelBuilder::CreateSnake(AGDDSnake* v) length=axis.mag(); lengthnew=length+delta_l1+delta_l2; - CLHEP::HepRotation rr; - CLHEP::Hep3Vector vvref(0.,0.,-lengthnew/2+delta_l1); - HepGeom::Transform3D ttref(rr,vvref); + GeoTrf::Vector3D vvref(0.,0.,-lengthnew/2+delta_l1); + GeoTrf::Transform3D ttref = GeoTrf::Transform3D::Identity()*GeoTrf::Translation3D(vvref); 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.); - CLHEP::HepRotation rrr1,rrr2; - - rrr1.rotateY(angle1); - rrr1.rotateZ(-axis1.phi()); - rrr2.rotateY(-angle2); - rrr2.rotateZ(axis2.phi()); - HepGeom::Transform3D ttt1(rrr1,vt1); - HepGeom::Transform3D ttt2(rrr2,vt2); - GeoShape *ssnew1=new GeoShapeShift(s2,Amg::CLHEPTransformToEigen(ttt1)); + const GeoTrf::Vector3D vt1(0.,0.,+lengthnew/2.-delta_l1-2.); + const GeoTrf::Vector3D vt2(0.,0.,-lengthnew/2.+delta_l2+2.); + GeoTrf::Transform3D rrr1 = GeoTrf::RotateZ3D(-axis1.phi())*GeoTrf::RotateY3D(angle1); + GeoTrf::Transform3D rrr2 = GeoTrf::RotateZ3D(axis2.phi())*GeoTrf::RotateY3D(-angle2); + GeoTrf::Transform3D ttt1 = rrr1*GeoTrf::Translation3D(vt1); + GeoTrf::Transform3D ttt2 = rrr2*GeoTrf::Translation3D(vt2); + GeoShape *ssnew1=new GeoShapeShift(s2,ttt1); ss = new GeoShapeSubtraction(ss,ssnew1); if (i<(v->NrOfPoints()-2)) { - GeoShape *ssnew2=new GeoShapeShift(s1,Amg::CLHEPTransformToEigen(ttt2)); + GeoShape *ssnew2=new GeoShapeShift(s1,ttt2); ss = new GeoShapeSubtraction(ss,ssnew2); } - ss=new GeoShapeShift(ss,Amg::CLHEPTransformToEigen(ttref)); + ss=new GeoShapeShift(ss,ttref); - CLHEP::HepRotation rr1; - - rr1.rotateY(axis0.theta()); - rr1.rotateZ(axis0.phi()); - - const CLHEP::Hep3Vector vv(v->GetPoint(i).x(),v->GetPoint(i).y(),v->GetPoint(i).z()); - HepGeom::Transform3D tt(rr1,vv); - - ss=new GeoShapeShift(ss,Amg::CLHEPTransformToEigen(tt)); + GeoTrf::Transform3D rr1 = GeoTrf::RotateZ3D(axis0.phi())*GeoTrf::RotateY3D(axis0.theta()); + const GeoTrf::Vector3D vv(v->GetPoint(i).x(),v->GetPoint(i).y(),v->GetPoint(i).z()); + ss=new GeoShapeShift(ss,GeoTrf::Translation3D(vv)*rr1); solid=new GeoShapeUnion(solid,ss); } v->SetSolid(solid); @@ -356,7 +333,6 @@ void AGDD2GeoModelBuilder::CreateGvxy(AGDDGvxy* v) void *p=v->GetSolid(); if (!p) { - std::vector<CLHEP::Hep2Vector> points; int nPoint=v->NrOfPoints(); GeoSimplePolygonBrep* solid; solid = new GeoSimplePolygonBrep(v->GetDz()/2.); @@ -523,8 +499,8 @@ void AGDD2GeoModelBuilder::CreateComposition(AGDDComposition *v) log<<MSG::WARNING<<"CreateComposition() - AGDDDetectorPositioner is nullptr"<<endmsg; } } - HepGeom::Transform3D trf=pos->Transform(); - GeoTransform *geotrf=new GeoTransform(Amg::CLHEPTransformToEigen(trf)); + GeoTrf::Transform3D trf=Amg::CLHEPTransformToEigen(pos->Transform()); + GeoTransform *geotrf=new GeoTransform(trf); void *temp=vol->GetVolume(); // GeoFullPhysVol are needed for detectors (corresponding to ReadoutElements) @@ -583,9 +559,7 @@ void AGDD2GeoModelBuilder::BuildAllVolumes() { AGDDVolumeStore *vs=AGDDVolumeStore::GetVolumeStore(); AGDDVolumeMap::const_iterator it; - CLHEP::HepRotation rot; - CLHEP::Hep3Vector transl(0.,0.,0.); - HepGeom::Transform3D trf(rot,transl); + GeoTrf::Transform3D trf = GeoTrf::Transform3D::Identity(); for (it=vs->begin();it!=vs->end();it++) { @@ -606,7 +580,7 @@ void AGDD2GeoModelBuilder::BuildAllVolumes() log<<MSG::WARNING<<"BuildAllVolumes() - mother not set!"<<endmsg; return; } - GeoTransform *gtrf=new GeoTransform(Amg::CLHEPTransformToEigen(trf)); + GeoTransform *gtrf=new GeoTransform(trf); m_mother->add(gtrf); m_mother->add(vvv); } @@ -617,11 +591,8 @@ void AGDD2GeoModelBuilder::BuildAllVolumes() void AGDD2GeoModelBuilder::BuildFromSection(std::string s) { - CLHEP::HepRotation rot; - CLHEP::Hep3Vector transl(0.,0.,0.); - HepGeom::Transform3D trf(rot,transl); - - + GeoTrf::Transform3D trf = GeoTrf::Transform3D::Identity(); + AGDDSectionStore* ss=AGDDSectionStore::GetSectionStore(); AGDDSection* sect=ss->GetSection(s); @@ -651,7 +622,7 @@ void AGDD2GeoModelBuilder::BuildFromSection(std::string s) log<<MSG::WARNING<<"BuildFromSection() - mother not set!"<<endmsg; return; } - GeoTransform *gtrf=new GeoTransform(Amg::CLHEPTransformToEigen(trf)); + GeoTransform *gtrf=new GeoTransform(trf); m_mother->add(gtrf); m_mother->add(vvv); } @@ -678,7 +649,7 @@ void AGDD2GeoModelBuilder::BuildFromSection(std::string s) log<<MSG::WARNING<<"BuildFromSection() - mother not set (no top volume)!"<<endmsg; return; } - GeoTransform *gtrf=new GeoTransform(Amg::CLHEPTransformToEigen(trf)); + GeoTransform *gtrf=new GeoTransform(trf); m_mother->add(gtrf); m_mother->add(vvv); } @@ -693,9 +664,7 @@ void AGDD2GeoModelBuilder::BuildFromSection(std::string s) } void AGDD2GeoModelBuilder::BuildFromVolume(std::string s) { - CLHEP::HepRotation rot; - CLHEP::Hep3Vector transl(0.,0.,0.); - HepGeom::Transform3D trf(rot,transl); + GeoTrf::Transform3D trf = GeoTrf::Transform3D::Identity(); AGDDVolumeStore *vs=AGDDVolumeStore::GetVolumeStore(); AGDDVolume* vol=vs->GetVolume(s); @@ -713,7 +682,7 @@ void AGDD2GeoModelBuilder::BuildFromVolume(std::string s) log<<MSG::WARNING<<"BuildFromVolume() - mother not set!"<<endmsg; return; } - GeoTransform *gtrf=new GeoTransform(Amg::CLHEPTransformToEigen(trf)); + GeoTransform *gtrf=new GeoTransform(trf); m_mother->add(gtrf); m_mother->add(vvv); } diff --git a/DetectorDescription/GeoModel/GeoModelExamples/CMakeLists.txt b/DetectorDescription/GeoModel/GeoModelExamples/CMakeLists.txt index b4a0e512515d0ad1449f02177abf507435c991f7..23870603ef730d72aef0b0d980ea20e716cca22d 100644 --- a/DetectorDescription/GeoModel/GeoModelExamples/CMakeLists.txt +++ b/DetectorDescription/GeoModel/GeoModelExamples/CMakeLists.txt @@ -5,16 +5,6 @@ # Declare the package name: atlas_subdir( GeoModelExamples ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaKernel - DetectorDescription/GeoModel/GeoModelUtilities - PRIVATE - Control/StoreGate - DetectorDescription/GeoModel/GeoModelInterfaces - DetectorDescription/Identifier - GaudiKernel ) - # External dependencies: find_package( Eigen ) find_package( GeoModelCore ) diff --git a/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt b/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt index 808246c5476f4c7c5711e7a72b303f25049408e9..bffea5f28e1b461fe1aee402b42463b454b51a08 100644 --- a/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt +++ b/DetectorDescription/GeoModel/GeoModelSvc/CMakeLists.txt @@ -5,23 +5,8 @@ # Declare the package name: atlas_subdir( GeoModelSvc ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PRIVATE - Control/AthenaBaseComps - Control/AthenaKernel - Control/SGTools - Control/StoreGate - Database/RDBAccessSvc - DetectorDescription/GeoModel/GeoModelInterfaces - DetectorDescription/GeoModel/GeoModelUtilities - Event/EventInfo - Event/EventInfoMgt - GaudiKernel ) - # External dependencies: -find_package( Boost COMPONENTS filesystem thread system ) -find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) - +find_package( CORAL COMPONENTS CoralBase ) find_package( GeoModelCore ) @@ -31,8 +16,8 @@ atlas_add_component( GeoModelSvc src/GeoDbTagSvc.cxx src/RDBMaterialManager.cxx src/components/GeoModelSvc_entries.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${GEOMODELCORE_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests GeoModelUtilities EventInfo GaudiKernel RDBAccessSvcLib EventInfoMgtLib ) + INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${GEOMODELCORE_INCLUDE_DIRS} + LINK_LIBRARIES ${CORAL_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps AthenaKernel SGTools StoreGateLib SGtests GeoModelUtilities EventInfo GaudiKernel RDBAccessSvcLib EventInfoMgtLib ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/DetectorDescription/GeoModel/GeoModelUtilities/CMakeLists.txt b/DetectorDescription/GeoModel/GeoModelUtilities/CMakeLists.txt index b5d5ef95e328a36f556013a650bc3857959b07e1..53d5172ffbaaf85eb8a04f4e18700cd696564880 100644 --- a/DetectorDescription/GeoModel/GeoModelUtilities/CMakeLists.txt +++ b/DetectorDescription/GeoModel/GeoModelUtilities/CMakeLists.txt @@ -6,27 +6,16 @@ atlas_subdir( GeoModelUtilities ) if(NOT BUILDVP1LIGHT) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Database/RDBAccessSvc - DetectorDescription/GeoModel/GeoModelInterfaces - PRIVATE - GaudiKernel ) - # External dependencies: -find_package( Boost COMPONENTS filesystem thread system ) find_package( Eigen ) -find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) find_package( GeoModelCore ) # Component(s) in the package: atlas_add_library( GeoModelUtilities src/*.cxx PUBLIC_HEADERS GeoModelUtilities - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${GEOMODELCORE_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${EIGEN_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps SGTools GeoModelInterfaces + INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${GEOMODELCORE_INCLUDE_DIRS} + LINK_LIBRARIES ${EIGEN_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps SGTools GeoModelInterfaces PRIVATE_LINK_LIBRARIES GaudiKernel ) atlas_add_test( GeoGetIds_test diff --git a/DetectorDescription/GeoModel/GeoSpecialShapes/CMakeLists.txt b/DetectorDescription/GeoModel/GeoSpecialShapes/CMakeLists.txt index 873c9a3c8589194a81cfce0dc70037cc26e200f6..68a16d7e4470d94bc32d1a4734b2c79e7cf858c0 100644 --- a/DetectorDescription/GeoModel/GeoSpecialShapes/CMakeLists.txt +++ b/DetectorDescription/GeoModel/GeoSpecialShapes/CMakeLists.txt @@ -5,51 +5,35 @@ # Declare the package name: atlas_subdir( GeoSpecialShapes ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaKernel - Control/StoreGate - PRIVATE - Control/CxxUtils - Database/RDBAccessSvc - DetectorDescription/GeoModel/GeoModelInterfaces - DetectorDescription/GeoModel/GeoModelUtilities - GaudiKernel ) - # External dependencies: -find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) find_package( GSL ) -find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) find_package( ROOT COMPONENTS Matrix Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Physics HistPainter Rint ) find_package( GeoModelCore ) - - if(NOT BUILDVP1LIGHT) -find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) # Component(s) in the package: atlas_add_library( GeoSpecialShapes src/*.cxx src/LArWheelCalculator_Impl/*.cxx PUBLIC_HEADERS GeoSpecialShapes INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${CLHEP_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaKernel StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} ${GSL_LIBRARIES} AthenaKernel CxxUtils GeoModelUtilities GaudiKernel RDBAccessSvcLib ) + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} AthenaKernel CxxUtils GeoModelUtilities GaudiKernel RDBAccessSvcLib ) atlas_add_dictionary( LArGeoCheckerDict GeoSpecialShapes/LArGeoCheckerDict.h GeoSpecialShapes/selection.xml - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODELCORE_LIBRARIES} StoreGateLib SGtests AthenaKernel CxxUtils GeoModelUtilities GaudiKernel GeoSpecialShapes ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODELCORE_LIBRARIES} StoreGateLib SGtests AthenaKernel CxxUtils GeoModelUtilities GaudiKernel GeoSpecialShapes ) atlas_add_dictionary( LArWheelEnums GeoSpecialShapes/LArWheelCalculatorEnums.h GeoSpecialShapes/selectionEnums.xml - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODELCORE_LIBRARIES} StoreGateLib SGtests AthenaKernel CxxUtils GeoModelUtilities GaudiKernel GeoSpecialShapes ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODELCORE_LIBRARIES} StoreGateLib SGtests AthenaKernel CxxUtils GeoModelUtilities GaudiKernel GeoSpecialShapes ) endif() if(BUILDVP1LIGHT) @@ -59,20 +43,20 @@ atlas_add_library( GeoSpecialShapes src/LArWheelCalculator_Impl/*.cxx PUBLIC_HEADERS GeoSpecialShapes INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${CLHEP_LIBRARIES} GeoModelKernel - PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${GSL_LIBRARIES} CxxUtils GeoModelUtilities ) + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} CxxUtils GeoModelUtilities ) atlas_add_dictionary( LArGeoCheckerDict GeoSpecialShapes/LArGeoCheckerDict.h GeoSpecialShapes/selection.xml - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODELCORE_LIBRARIES} CxxUtils GeoModelUtilities GeoSpecialShapes ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${CLHEP_LIBRARIES} ${GEOMODELCORE_LIBRARIES} CxxUtils GeoModelUtilities GeoSpecialShapes ) atlas_add_dictionary( LArWheelEnums GeoSpecialShapes/LArWheelCalculatorEnums.h GeoSpecialShapes/selectionEnums.xml - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${CLHEP_LIBRARIES} GeoModelKernel CxxUtils GeoModelUtilities GeoSpecialShapes ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${GSL_LIBRARIES} ${CLHEP_LIBRARIES} GeoModelKernel CxxUtils GeoModelUtilities GeoSpecialShapes ) endif() diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.cxx b/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.cxx index 6e8b751ca496883dd78a81ebb6928f09eca3f716..84d10073ffccdf12617b6b5a86c11b7d6809a850 100644 --- a/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.cxx +++ b/Event/ByteStreamCnvSvc/src/ByteStreamEventStorageOutputSvc.cxx @@ -134,10 +134,10 @@ ByteStreamEventStorageOutputSvc::stop() const ByteStreamMetadataContainer* metaDataCont = 0; const ByteStreamMetadata* metaData = 0; ServiceHandle<StoreGateSvc> mds("StoreGateSvc/MetaDataStore", name()); - StatusCode status = mds.retrieve(); - if (!status.isFailure()) { - StatusCode stat = mds->retrieve(metaDataCont, "ByteStreamMetadata"); - if (stat.isSuccess()) metaData = *(metaDataCont->begin()); + if (mds.retrieve().isFailure()) { + ATH_MSG_WARNING("Cannot get MetaDataStore"); + } else { + if (mds->retrieve(metaDataCont, "ByteStreamMetadata").isSuccess()) metaData = *(metaDataCont->begin()); } // Try to write metadata to file dWok = initDataWriterContents(0, metaData); @@ -175,8 +175,16 @@ ByteStreamEventStorageOutputSvc::initDataWriter() ATH_MSG_ERROR("Cannot retrieve EventInfo"); return(false); } + const ByteStreamMetadataContainer* metaDataCont = 0; + const ByteStreamMetadata* metaData = 0; + ServiceHandle<StoreGateSvc> mds("InputMetaDataStore", name()); + if (mds.retrieve().isFailure()) { + ATH_MSG_WARNING("Cannot get InputMetaDataStore"); + } else { + if (mds->retrieve(metaDataCont, "ByteStreamMetadata").isSuccess()) metaData = *(metaDataCont->begin()); + } // Now try to write metadata to file - return initDataWriterContents(evtInfo, 0); + return initDataWriterContents(evtInfo, metaData); } @@ -258,10 +266,13 @@ ByteStreamEventStorageOutputSvc::initDataWriterContents( ATH_MSG_DEBUG("Cannot retrieve TagInfo"); } else { std::string tagName, tagValue; - if (metaData == 0) { // FIXME: Set TriggerType, BeamType? - tagName = "beam_energy"; + if (metaData == 0) { + tagName = "beam_type"; tagInfo->findTag(tagName, tagValue); runPara.beam_type = atof(tagValue.c_str()); + tagName = "beam_energy"; + tagInfo->findTag(tagName, tagValue); + runPara.beam_energy = atof(tagValue.c_str()); } tagName = "GeoAtlas"; tagInfo->findTag(tagName, tagValue); diff --git a/Event/EventContainers/EventContainers/IdentifiableCacheBase.h b/Event/EventContainers/EventContainers/IdentifiableCacheBase.h index be173fe0913179ee46b17b7cb1707a76342f218d..0ee6760ba1311b58fa898abd732540eceaa870f2 100644 --- a/Event/EventContainers/EventContainers/IdentifiableCacheBase.h +++ b/Event/EventContainers/EventContainers/IdentifiableCacheBase.h @@ -107,7 +107,7 @@ private: const IMaker* m_maker; typedef std::mutex mutex_t; - typedef std::lock_guard<mutex_t> lock_t; + typedef std::scoped_lock<mutex_t> lock_t; typedef std::unique_lock<mutex_t> uniqueLock; mutex_t m_mutex; ///Pool of mutexes used for waiting on completion if in a concurrent environment diff --git a/Event/EventContainers/EventContainers/IdentifiableContainerBase.h b/Event/EventContainers/EventContainers/IdentifiableContainerBase.h index b3b1d6d7ab0f0407bbfc7d48e63781f676a225c6..3f355408cbc62e131aeb912ad86ef17660d8a19e 100644 --- a/Event/EventContainers/EventContainers/IdentifiableContainerBase.h +++ b/Event/EventContainers/EventContainers/IdentifiableContainerBase.h @@ -10,7 +10,7 @@ namespace EventContainers{ class IdentifiableCacheBase; -enum class Mode { OfflineLowMemory, OfflineFast }; +enum class Mode { OfflineLowMemory, OfflineFast, OfflineMap }; class IdentifiableContainerBase{ public: #include "EventContainers/deleter.h" diff --git a/Event/EventContainers/EventContainers/IdentifiableContainerMT.h b/Event/EventContainers/EventContainers/IdentifiableContainerMT.h index 8791b57b881f699fa51b2edad021676cc006f323..b2fbf7afa34b74fb226159338f4f9fe8a6cbc0e3 100644 --- a/Event/EventContainers/EventContainers/IdentifiableContainerMT.h +++ b/Event/EventContainers/EventContainers/IdentifiableContainerMT.h @@ -51,7 +51,7 @@ public: } [[nodiscard]] StatusCode addOrDelete(std::unique_ptr<T> ptr){ - if(ATH_UNLIKELY(m_IDC_ptr==nullptr)) return StatusCode::FAILURE; + if(ATH_UNLIKELY(m_hashId >= m_IDC_ptr->m_link->fullSize())) return StatusCode::FAILURE; StatusCode sc = m_IDC_ptr->addLock(std::move(ptr), m_hashId); IDC_WriteHandleBase::ReleaseLock(); return sc; @@ -208,6 +208,8 @@ public: return m_link->fullSize(); } + void prepareItr() const { m_link->wait(); } + /// return number of collections virtual size_t numberOfCollections() const override final{ return IdentifiableContainerBase::numberOfCollections(); diff --git a/Event/EventContainers/EventContainers/InternalOffline.h b/Event/EventContainers/EventContainers/InternalOffline.h index ad24332d624588b5ba4f2b7d856278bcb142b27d..ed8e2d9d28c3dae0a9d0a7adebce2333a4d4e3a5 100644 --- a/Event/EventContainers/EventContainers/InternalOffline.h +++ b/Event/EventContainers/EventContainers/InternalOffline.h @@ -23,8 +23,6 @@ public: 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; @@ -39,7 +37,9 @@ public: virtual StatusCode addLock(IdentifierHash hashId, const void* ptr) override; virtual void* removeCollection( IdentifierHash hashId ) override; virtual void destructor(deleter_f*) noexcept override; - +private: + std::vector<std::pair<IdentifierHash::value_type, const void*>> m_map; + size_t m_maximumSize; }; } diff --git a/Event/EventContainers/EventContainers/InternalOfflineFast.h b/Event/EventContainers/EventContainers/InternalOfflineFast.h index b32569e83eeef8e6ff6e414b620c56c4ecbbc97b..a78aae631afce51190e2c474bf67bbc1ff7db85c 100644 --- a/Event/EventContainers/EventContainers/InternalOfflineFast.h +++ b/Event/EventContainers/EventContainers/InternalOfflineFast.h @@ -24,10 +24,6 @@ public: 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; @@ -42,7 +38,11 @@ public: virtual StatusCode addLock(IdentifierHash hashId, const void* ptr) override; virtual void* removeCollection( IdentifierHash hashId ) override; virtual void destructor(deleter_f*) noexcept override; - +private: + 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 }; } diff --git a/Event/EventContainers/EventContainers/InternalOfflineMap.h b/Event/EventContainers/EventContainers/InternalOfflineMap.h new file mode 100644 index 0000000000000000000000000000000000000000..d101cef3f561931d93290193bd5472553472e249 --- /dev/null +++ b/Event/EventContainers/EventContainers/InternalOfflineMap.h @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EVENTCONTAINERS_InternalOfflineMap_H +#define EVENTCONTAINERS_InternalOfflineMap_H +#include "EventContainers/I_InternalIDC.h" +#include "CxxUtils/checker_macros.h" +#include <atomic> +#include <mutex> +#include <unordered_map> + +namespace EventContainers{ +/* +This class implements the IdentifiableContainer code for the offline case. +This class balances speed against memory usage by using an unordered_map + +Moderately fast random access, fast iteration, moderate memory usage. +*/ +class InternalOfflineMap final : public I_InternalIDC { +public: + InternalOfflineMap(size_t max); + virtual ~InternalOfflineMap()=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; + 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_maxsize;} + 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; +private: + mutable std::vector<std::pair<IdentifierHash::value_type, const void*>> m_map; + std::unordered_map<IdentifierHash::value_type, 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 + const size_t m_maxsize; +}; + +} +#endif diff --git a/Event/EventContainers/share/IdMTCont.ref b/Event/EventContainers/share/IdMTCont.ref index 5e8b13579b757215dd2f64329f04fd87dfb750f0..b8ffc2e1ca96c812e213ba3da0c311ae06d53b63 100644 --- a/Event/EventContainers/share/IdMTCont.ref +++ b/Event/EventContainers/share/IdMTCont.ref @@ -1,14 +1,1246 @@ + container mode 0 + Collection, Skip = 100000 0 + Test level = 10 +Full Size:100000 N Coll:100000 +By interation + Number of Collection Accessed 100000 +By GetAllCurrentHashes search +iter, hash id 0 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 1 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 2 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 3 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 4 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 5 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 6 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 7 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 8 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 9 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 + Number of Digits Accessed 1000000 + TESTING find and lower/upper bound + Number of Collections from Random Access 100000 +wrong hash allignment 0/75000 +Deleted collections +Correctly contains 0 +Correctly contains 3 +count is 20 should be 20 +MyDigits left undeleted 0 +Full Size:100000 N Coll:100000 +By interation + Number of Collection Accessed 100000 +By GetAllCurrentHashes search +iter, hash id 0 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 1 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 2 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 3 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 4 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 5 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 6 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 7 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 8 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 9 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 + Number of Digits Accessed 1000000 + TESTING find and lower/upper bound + Number of Collections from Random Access 100000 +wrong hash allignment 0/75000 +Deleted collections +Correctly contains 0 +Correctly contains 3 +count is 20 should be 20 +MyDigits left undeleted 0 +Full Size:100000 N Coll:100000 +By interation + Number of Collection Accessed 100000 +By GetAllCurrentHashes search +iter, hash id 0 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 1 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 2 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 3 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 4 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 5 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 6 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 7 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 8 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 9 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 + Number of Digits Accessed 1000000 + TESTING find and lower/upper bound + Number of Collections from Random Access 100000 +wrong hash allignment 0/75000 +Deleted collections +Correctly contains 0 +Correctly contains 3 +count is 20 should be 20 +MyDigits left undeleted 0 +Full Size:100000 N Coll:100000 +By interation + Number of Collection Accessed 100000 +By GetAllCurrentHashes search +iter, hash id 0 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 1 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 2 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 3 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 4 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 5 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 6 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 7 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 8 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 9 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 + Number of Digits Accessed 1000000 + TESTING find and lower/upper bound + Number of Collections from Random Access 100000 +wrong hash allignment 0/75000 +Deleted collections +Correctly contains 0 +Correctly contains 3 +count is 20 should be 20 +MyDigits left undeleted 0 +Full Size:100000 N Coll:100000 +By interation + Number of Collection Accessed 100000 +By GetAllCurrentHashes search +iter, hash id 0 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 1 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 2 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 3 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 4 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 5 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 6 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 7 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 8 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 9 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 + Number of Digits Accessed 1000000 + TESTING find and lower/upper bound + Number of Collections from Random Access 100000 +wrong hash allignment 0/75000 +Deleted collections +Correctly contains 0 +Correctly contains 3 +count is 20 should be 20 +MyDigits left undeleted 0 + container mode 1 + Collection, Skip = 100000 0 + Test level = 10 +Full Size:100000 N Coll:100000 +By interation + Number of Collection Accessed 100000 +By GetAllCurrentHashes search +iter, hash id 0 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 1 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 2 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 3 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 4 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 5 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 6 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 7 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 8 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 9 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 + Number of Digits Accessed 1000000 + TESTING find and lower/upper bound + Number of Collections from Random Access 100000 +wrong hash allignment 0/75000 +Deleted collections +Correctly contains 0 +Correctly contains 3 +count is 20 should be 20 +MyDigits left undeleted 0 +Full Size:100000 N Coll:100000 +By interation + Number of Collection Accessed 100000 +By GetAllCurrentHashes search +iter, hash id 0 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 1 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 2 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 3 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 4 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 5 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 6 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 7 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 8 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 9 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 + Number of Digits Accessed 1000000 + TESTING find and lower/upper bound + Number of Collections from Random Access 100000 +wrong hash allignment 0/75000 +Deleted collections +Correctly contains 0 +Correctly contains 3 +count is 20 should be 20 +MyDigits left undeleted 0 +Full Size:100000 N Coll:100000 +By interation + Number of Collection Accessed 100000 +By GetAllCurrentHashes search +iter, hash id 0 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 1 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 2 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 3 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 4 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 5 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 6 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 7 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 8 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 9 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 + Number of Digits Accessed 1000000 + TESTING find and lower/upper bound + Number of Collections from Random Access 100000 +wrong hash allignment 0/75000 +Deleted collections +Correctly contains 0 +Correctly contains 3 +count is 20 should be 20 +MyDigits left undeleted 0 +Full Size:100000 N Coll:100000 +By interation + Number of Collection Accessed 100000 +By GetAllCurrentHashes search +iter, hash id 0 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 1 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 2 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 3 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 4 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 5 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 6 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 7 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 8 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 9 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 + Number of Digits Accessed 1000000 + TESTING find and lower/upper bound + Number of Collections from Random Access 100000 +wrong hash allignment 0/75000 +Deleted collections +Correctly contains 0 +Correctly contains 3 +count is 20 should be 20 +MyDigits left undeleted 0 +Full Size:100000 N Coll:100000 +By interation + Number of Collection Accessed 100000 +By GetAllCurrentHashes search +iter, hash id 0 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 1 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 2 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 3 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 4 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 5 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 6 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 7 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 8 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 +iter, hash id 9 +nd, val 0 0 +nd, val 1 1 +nd, val 2 2 +nd, val 3 3 +nd, val 4 4 +nd, val 5 5 +nd, val 6 6 +nd, val 7 7 +nd, val 8 8 +nd, val 9 9 + Number of Digits Accessed 1000000 + TESTING find and lower/upper bound + Number of Collections from Random Access 100000 +wrong hash allignment 0/75000 +Deleted collections +Correctly contains 0 +Correctly contains 3 +count is 20 should be 20 +MyDigits left undeleted 0 + container mode 2 Collection, Skip = 100000 0 Test level = 10 -Container cleanup: user, kernel, elapsed 0 0 1316 -Created vector of coll + digits: user, kernel, elapsed 40000 10000 48920 -Add colls to container: user, kernel, elapsed 50000 20000 68734 Full Size:100000 N Coll:100000 By interation -Iteration over collections: user, kernel, elapsed 0 0 1957 Number of Collection Accessed 100000 By GetAllCurrentHashes search -Iteration over collections : user, kernel, elapsed 10000 0 1546 iter, hash id 0 nd, val 0 0 nd, val 1 1 @@ -119,10 +1351,8 @@ nd, val 6 6 nd, val 7 7 nd, val 8 8 nd, val 9 9 -Iteration over digits : user, kernel, elapsed 10000 0 10196 Number of Digits Accessed 1000000 TESTING find and lower/upper bound -Random access: user, kernel, elapsed 0 0 233 Number of Collections from Random Access 100000 wrong hash allignment 0/75000 Deleted collections @@ -130,15 +1360,10 @@ Correctly contains 0 Correctly contains 3 count is 20 should be 20 MyDigits left undeleted 0 -Container cleanup: user, kernel, elapsed 0 0 1254 -Created vector of coll + digits: user, kernel, elapsed 30000 0 35758 -Add colls to container: user, kernel, elapsed 50000 0 55844 Full Size:100000 N Coll:100000 By interation -Iteration over collections: user, kernel, elapsed 0 0 2060 Number of Collection Accessed 100000 By GetAllCurrentHashes search -Iteration over collections : user, kernel, elapsed 10000 0 1710 iter, hash id 0 nd, val 0 0 nd, val 1 1 @@ -249,10 +1474,8 @@ nd, val 6 6 nd, val 7 7 nd, val 8 8 nd, val 9 9 -Iteration over digits : user, kernel, elapsed 10000 0 12249 Number of Digits Accessed 1000000 TESTING find and lower/upper bound -Random access: user, kernel, elapsed 0 0 241 Number of Collections from Random Access 100000 wrong hash allignment 0/75000 Deleted collections @@ -260,15 +1483,10 @@ Correctly contains 0 Correctly contains 3 count is 20 should be 20 MyDigits left undeleted 0 -Container cleanup: user, kernel, elapsed 0 0 1380 -Created vector of coll + digits: user, kernel, elapsed 40000 0 36129 -Add colls to container: user, kernel, elapsed 60000 0 55579 Full Size:100000 N Coll:100000 By interation -Iteration over collections: user, kernel, elapsed 0 0 1925 Number of Collection Accessed 100000 By GetAllCurrentHashes search -Iteration over collections : user, kernel, elapsed 0 0 1734 iter, hash id 0 nd, val 0 0 nd, val 1 1 @@ -379,10 +1597,8 @@ nd, val 6 6 nd, val 7 7 nd, val 8 8 nd, val 9 9 -Iteration over digits : user, kernel, elapsed 10000 0 11380 Number of Digits Accessed 1000000 TESTING find and lower/upper bound -Random access: user, kernel, elapsed 0 0 239 Number of Collections from Random Access 100000 wrong hash allignment 0/75000 Deleted collections @@ -390,15 +1606,10 @@ Correctly contains 0 Correctly contains 3 count is 20 should be 20 MyDigits left undeleted 0 -Container cleanup: user, kernel, elapsed 0 0 1266 -Created vector of coll + digits: user, kernel, elapsed 30000 0 36581 -Add colls to container: user, kernel, elapsed 50000 0 56848 Full Size:100000 N Coll:100000 By interation -Iteration over collections: user, kernel, elapsed 0 0 2029 Number of Collection Accessed 100000 By GetAllCurrentHashes search -Iteration over collections : user, kernel, elapsed 10000 0 1651 iter, hash id 0 nd, val 0 0 nd, val 1 1 @@ -509,10 +1720,8 @@ nd, val 6 6 nd, val 7 7 nd, val 8 8 nd, val 9 9 -Iteration over digits : user, kernel, elapsed 10000 0 11559 Number of Digits Accessed 1000000 TESTING find and lower/upper bound -Random access: user, kernel, elapsed 0 0 239 Number of Collections from Random Access 100000 wrong hash allignment 0/75000 Deleted collections @@ -520,15 +1729,10 @@ Correctly contains 0 Correctly contains 3 count is 20 should be 20 MyDigits left undeleted 0 -Container cleanup: user, kernel, elapsed 0 0 1261 -Created vector of coll + digits: user, kernel, elapsed 40000 0 36629 -Add colls to container: user, kernel, elapsed 60000 0 56583 Full Size:100000 N Coll:100000 By interation -Iteration over collections: user, kernel, elapsed 0 10000 2044 Number of Collection Accessed 100000 By GetAllCurrentHashes search -Iteration over collections : user, kernel, elapsed 0 0 1764 iter, hash id 0 nd, val 0 0 nd, val 1 1 @@ -639,10 +1843,8 @@ nd, val 6 6 nd, val 7 7 nd, val 8 8 nd, val 9 9 -Iteration over digits : user, kernel, elapsed 20000 0 11305 Number of Digits Accessed 1000000 TESTING find and lower/upper bound -Random access: user, kernel, elapsed 0 0 249 Number of Collections from Random Access 100000 wrong hash allignment 0/75000 Deleted collections diff --git a/Event/EventContainers/src/IDC_WriteHandleBase.cxx b/Event/EventContainers/src/IDC_WriteHandleBase.cxx index 83710778c12ca69bd6f54fd1090c9d8d3498a376..35db3e989d756dfce42c508040df02afd8b9ce2c 100644 --- a/Event/EventContainers/src/IDC_WriteHandleBase.cxx +++ b/Event/EventContainers/src/IDC_WriteHandleBase.cxx @@ -17,7 +17,7 @@ IDC_WriteHandleBase::~IDC_WriteHandleBase() { ReleaseLock(); } void IDC_WriteHandleBase::ReleaseLock(){ if(m_atomic==nullptr) return; //Convenience declarations - typedef std::lock_guard<decltype(m_mut->mutex)> lockguard; + typedef std::scoped_lock<decltype(m_mut->mutex)> lockguard; const void* waitstate = reinterpret_cast<const void*>(IdentifiableCacheBase::INVALIDflag); const void* ABORTstate = reinterpret_cast<const void*>(IdentifiableCacheBase::ABORTEDflag); diff --git a/Event/EventContainers/src/IdentifiableContainerBase.cxx b/Event/EventContainers/src/IdentifiableContainerBase.cxx index 3c6fdcc09acb4f510c297fd022165761455de6c5..7ed316fa3350416a173c3ed27606ededa51a11f5 100644 --- a/Event/EventContainers/src/IdentifiableContainerBase.cxx +++ b/Event/EventContainers/src/IdentifiableContainerBase.cxx @@ -8,6 +8,7 @@ #include "EventContainers/InternalOnline.h" #include "EventContainers/InternalOffline.h" #include "EventContainers/InternalOfflineFast.h" +#include "EventContainers/InternalOfflineMap.h" using namespace EventContainers; @@ -27,6 +28,7 @@ using namespace EventContainers; 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 if(mode == Mode::OfflineMap) m_link = std::make_unique<EventContainers::InternalOfflineMap>(max); else{ throw std::runtime_error("Invalid Mode specified"); } diff --git a/Event/EventContainers/src/InternalOffline.cxx b/Event/EventContainers/src/InternalOffline.cxx index 000b7629a7f90d8e393ecf1ab14d6558796e42dd..85165e6ff305e3ad6bb196244d85335970d82b25 100644 --- a/Event/EventContainers/src/InternalOffline.cxx +++ b/Event/EventContainers/src/InternalOffline.cxx @@ -5,6 +5,7 @@ #include "EventContainers/InternalOffline.h" #include <algorithm> #include "EventContainers/IDC_WriteHandleBase.h" +#include "CxxUtils/AthUnlikelyMacros.h" using namespace EventContainers; typedef I_InternalIDC::InternalConstItr InternalConstItr; @@ -83,11 +84,8 @@ const void* InternalOffline::findIndexPtr(IdentifierHash hashId) const noexcept{ 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; + if(ATH_UNLIKELY(!added)) { + throw std::runtime_error("IDC WARNING Deletion shouldn't occur in addLock paradigm"); } return StatusCode::SUCCESS; } diff --git a/Event/EventContainers/src/InternalOfflineFast.cxx b/Event/EventContainers/src/InternalOfflineFast.cxx index 4aaa02d53922433e4f51ed1a8af6e0cf86316c82..ff34cefbfca8ad76743bcf7a024ed3caa263fb00 100644 --- a/Event/EventContainers/src/InternalOfflineFast.cxx +++ b/Event/EventContainers/src/InternalOfflineFast.cxx @@ -5,6 +5,7 @@ #include "EventContainers/InternalOfflineFast.h" #include <algorithm> #include "EventContainers/IDC_WriteHandleBase.h" +#include "CxxUtils/AthUnlikelyMacros.h" using namespace EventContainers; typedef I_InternalIDC::InternalConstItr InternalConstItr; @@ -21,7 +22,7 @@ bool InternalOfflineFast::tryAddFromCache(IdentifierHash hash) } void InternalOfflineFast::wait() const { - std::lock_guard lock (m_waitMutex); + std::scoped_lock lock (m_waitMutex); if(m_needsupdate == false) return; m_map.clear(); for(size_t i=0 ;i < m_fullMap.size(); ++i){ @@ -84,7 +85,6 @@ void InternalOfflineFast::cleanUp(deleter_f* deleter) noexcept { } 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); @@ -99,10 +99,7 @@ const void* InternalOfflineFast::findIndexPtr(IdentifierHash hashId) const noexc 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; + throw std::runtime_error("IDC WARNING Deletion shouldn't occur in addLock paradigm"); } return StatusCode::SUCCESS; } diff --git a/Event/EventContainers/src/InternalOfflineMap.cxx b/Event/EventContainers/src/InternalOfflineMap.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e2dc4b5b104264959e2daf71db646d6a5abb121a --- /dev/null +++ b/Event/EventContainers/src/InternalOfflineMap.cxx @@ -0,0 +1,131 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "EventContainers/InternalOfflineMap.h" +#include <algorithm> +#include "EventContainers/IDC_WriteHandleBase.h" +#include "CxxUtils/AthUnlikelyMacros.h" + +using namespace EventContainers; +typedef I_InternalIDC::InternalConstItr InternalConstItr; +InternalOfflineMap::InternalOfflineMap(size_t max) : m_needsupdate(false), m_maxsize(max) {} + + +bool InternalOfflineMap::tryAddFromCache(IdentifierHash hash, EventContainers::IDC_WriteHandleBase&) { + return m_fullMap.count(hash); +} + +bool InternalOfflineMap::tryAddFromCache(IdentifierHash hash) +{ + return m_fullMap.count(hash); +} + +void InternalOfflineMap::wait() const { + std::scoped_lock lock (m_waitMutex); + if(m_needsupdate == false) return; + m_map.clear(); + m_map.reserve(m_fullMap.size()); + for(const auto &pair : m_fullMap){ + m_map.emplace_back(pair.first, pair.second); + } + std::sort(m_map.begin(), m_map.end()); + m_needsupdate.store(false); +} + +std::vector<IdentifierHash> InternalOfflineMap::getAllCurrentHashes() const { + std::vector<IdentifierHash> ids; + ids.reserve(m_fullMap.size()); + if(m_needsupdate == true){ + for(const auto &pair : m_fullMap){ + ids.emplace_back(pair.first); + } + std::sort(ids.begin(), ids.end()); + }else{ + for(const auto &pair : m_map){ + ids.emplace_back(pair.first); + } + } + return ids; +} + +InternalConstItr + InternalOfflineMap::cend() const { + if(m_needsupdate) wait(); + return m_map.cend(); +} + +const std::vector < I_InternalIDC::hashPair >& InternalOfflineMap::getAllHashPtrPair() const{ + if(m_needsupdate) wait(); + return m_map; +} + +InternalConstItr + InternalOfflineMap::cbegin() const { + if(m_needsupdate) wait(); + return m_map.cbegin(); +} + +InternalConstItr InternalOfflineMap::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 InternalOfflineMap::numberOfCollections() const { + return m_fullMap.size(); +} + +void InternalOfflineMap::cleanUp(deleter_f* deleter) noexcept { + destructor(deleter); + m_map.clear(); + m_fullMap.clear(); + m_needsupdate.store(false, std::memory_order_relaxed); +} + +bool InternalOfflineMap::insert(IdentifierHash hashId, const void* ptr) { + auto &mapptr = m_fullMap[hashId]; + if(mapptr!=nullptr) return false; //already present + mapptr = ptr; + m_needsupdate.store(true, std::memory_order_relaxed); + return true; +} + +const void* InternalOfflineMap::findIndexPtr(IdentifierHash hashId) const noexcept{ + auto search = m_fullMap.find(hashId); + if(search!=m_fullMap.cend()) return search->second; + return nullptr; +} + +StatusCode InternalOfflineMap::addLock(IdentifierHash hashId, const void* ptr) { + bool added = insert(hashId, ptr); + if(ATH_UNLIKELY(!added)) { + throw std::runtime_error("IDC WARNING Deletion shouldn't occur in addLock paradigm"); + } + return StatusCode::SUCCESS; +} + +void* InternalOfflineMap::removeCollection( IdentifierHash hashId ) { + auto search = m_fullMap.find(hashId); + if(search==m_fullMap.cend()) return nullptr; + void* ptr = const_cast< void* > (search->second); + m_fullMap.erase(search); + m_needsupdate.store(true, std::memory_order_relaxed); + return ptr; +} + +StatusCode InternalOfflineMap::fetchOrCreate(IdentifierHash) { + throw std::runtime_error("Not implemented in offline mode"); +} +StatusCode InternalOfflineMap::fetchOrCreate(const std::vector<IdentifierHash>&) +{ + throw std::runtime_error("Not implemented in offline mode"); +} + +void InternalOfflineMap::destructor(deleter_f* deleter) noexcept { + if(!m_needsupdate) for(const auto& x : m_map) deleter(x.second); + else { + for(const auto &pair : m_fullMap) { deleter(pair.second); } + } +} diff --git a/Event/EventContainers/src/InternalOnline.cxx b/Event/EventContainers/src/InternalOnline.cxx index 9c175b30c0d5bee499af8f69bbd416c57d14beec..40754f370dd682beb9e65ead0a2d890ec25e35e1 100644 --- a/Event/EventContainers/src/InternalOnline.cxx +++ b/Event/EventContainers/src/InternalOnline.cxx @@ -7,7 +7,7 @@ #include "EventContainers/IDC_WriteHandleBase.h" #include "CxxUtils/AthUnlikelyMacros.h" #include "EventContainers/IdentifiableCacheBase.h" - +#include "CxxUtils/AthUnlikelyMacros.h" using namespace EventContainers; typedef I_InternalIDC::InternalConstItr InternalConstItr; @@ -43,7 +43,7 @@ InternalConstItr InternalOnline::indexFind( IdentifierHash hashId ) const{ void InternalOnline::wait() const { //lockguard to protect m_waitlist from multiple wait calls - std::lock_guard lock (m_waitMutex); + std::scoped_lock lock (m_waitMutex); if(m_waitNeeded == false) return; using namespace EventContainers; const void* ABORTstate = reinterpret_cast<const void*>(IdentifiableCacheBase::ABORTEDflag); @@ -137,13 +137,10 @@ const void* InternalOnline::findIndexPtr(IdentifierHash hashId) const noexcept { } 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; + std::pair<bool, const void*> added = m_cacheLink->addLock(hashId, ptr); + if(ATH_UNLIKELY(!added.first)) { + throw std::runtime_error("IDC WARNING Deletion shouldn't occur in addLock paradigm"); } -#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; diff --git a/Event/EventContainers/test/IDC_Benchmark.cxx b/Event/EventContainers/test/IDC_Benchmark.cxx index 6e7b9bfddfe43d1ea168e9398288d63c969ee498..85c66d3dc51fcdf00d1de43f8f49bd95dbfe916b 100644 --- a/Event/EventContainers/test/IDC_Benchmark.cxx +++ b/Event/EventContainers/test/IDC_Benchmark.cxx @@ -30,6 +30,12 @@ void timebackwardsfill(std::string name, IdentifiableContainerMT<long unsigned i void accessTime(std::string name, IdentifiableContainerMT<long unsigned int>& container){ + auto startwait = std::chrono::steady_clock::now(); + container.prepareItr(); + auto endwait = std::chrono::steady_clock::now(); + std::chrono::duration<double> offlinewait = endwait-startwait; + std::cout << name << " wait time " << offlinewait.count() << std::endl; + auto start3 = std::chrono::steady_clock::now(); auto offlinecnt = container.GetAllCurrentHashes(); for(auto hash : offlinecnt) if(hash != *container.indexFindPtr(hash) ) std::abort(); @@ -81,25 +87,40 @@ int main(){ auto end3 = std::chrono::steady_clock::now(); std::chrono::duration<double> offlinefillfast = end3-start3; std::cout << "offlinefast fill time " << offlinefillfast.count() << std::endl; + + auto start4 = std::chrono::steady_clock::now(); + auto offlinemap = new IdentifiableContainerMT<long unsigned int>(50000, EventContainers::Mode::OfflineMap); + for(size_t i =3;i<50000;i+=3){ + offlinemap->addCollection(new long unsigned int(i) ,i).ignore(); + } + auto end4 = std::chrono::steady_clock::now(); + std::chrono::duration<double> offlinefillmap = end4-start4; + std::cout << "offlinemap fill time " << offlinefillmap.count() << std::endl; + accessTime("online ", *online); accessTime("offline ", *offline); accessTime("offlinefast ", *offlinefast); + accessTime("offlinemap ", *offlinemap); timedelete("onlineCont ", online); timedelete("onlineCache ", cache); timedelete("offline ", offline); timedelete("offlinefast ", offlinefast); + timedelete("offlinemap ", offlinemap); 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); + auto offlinemap2 = new IdentifiableContainerMT<long unsigned int>(50000, EventContainers::Mode::OfflineMap); timebackwardsfill("offlinefast", offlinefast2); + timebackwardsfill("offlinemap", offlinemap2); timebackwardsfill("offline", offline2); timebackwardsfill("online", online2); delete offline2; delete online2; delete cache2; delete offlinefast2; + delete offlinemap2; std::cout << "Test Successful" << std::endl; return 0; } diff --git a/Event/EventContainers/test/IDMT_ContainerTest.cxx b/Event/EventContainers/test/IDMT_ContainerTest.cxx index 17207fdb4df387ff2952061a69d60e0020a4215e..82038c470bbfca42e753476abd8a4d007e75d74c 100644 --- a/Event/EventContainers/test/IDMT_ContainerTest.cxx +++ b/Event/EventContainers/test/IDMT_ContainerTest.cxx @@ -13,6 +13,9 @@ // define a bunch of fake data classes using namespace std; + +static EventContainers::Mode s_mode; + namespace IDC_TEST { @@ -80,8 +83,8 @@ namespace IDC_TEST typedef IdentifiableContainerMT<MyCollection> MyType; // constructor - MyCollectionContainer( int m ) : - IdentifiableContainerMT<MyCollection>(m) { + MyCollectionContainer( int m, EventContainers::Mode mode ) : + IdentifiableContainerMT<MyCollection>(m, mode) { } @@ -135,7 +138,7 @@ int ID_ContainerTest::initialize() { // we own the Container - m_container = new MyCollectionContainer(m_ncollections); + m_container = new MyCollectionContainer(m_ncollections, s_mode); std::cout <<" Collection, Skip = " << m_ncollections<<" "<<m_nskip<<std::endl; std::cout <<" Test level = " << m_test<<std::endl; @@ -501,7 +504,7 @@ int ID_ContainerTest::execute(){ { - auto container2 = new MyCollectionContainer(m_ncollections); + auto container2 = new MyCollectionContainer(m_ncollections, s_mode); int itemsadded=0; for (int coll =0; coll <hfmax; coll=coll+(1+skip) ){ MyID id(coll); @@ -535,7 +538,7 @@ int ID_ContainerTest::execute(){ } delete container2; container2 = nullptr; //Test Empty - MyCollectionContainer* dempty = new MyCollectionContainer(100); + MyCollectionContainer* dempty = new MyCollectionContainer(100, s_mode); if(dempty->begin() != dempty->end()){ std::cout << __FILE__ << " empty container not working see LINE " << __LINE__ << std::endl; std::abort(); } @@ -615,14 +618,14 @@ int ID_ContainerTest::execute(){ 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 containerordertest = new MyCollectionContainer(500, s_mode); + containerordertest->addCollection(new MyCollection, 4).ignore(); + containerordertest->addCollection(new MyCollection, 3).ignore(); + containerordertest->addCollection(new MyCollection, 2).ignore(); + containerordertest->addCollection(new MyCollection, 1).ignore(); + containerordertest->addCollection(new MyCollection, 5).ignore(); + containerordertest->addCollection(new MyCollection, 4).ignore(); //Deliberate duplicate + containerordertest->addCollection(new MyCollection, 7).ignore(); auto hashes = containerordertest->GetAllCurrentHashes(); size_t last =0; @@ -643,6 +646,7 @@ int ID_ContainerTest::execute(){ } if(containerordertest->numberOfCollections() != 6){ std::cout << "Duplicate got added " << std::endl; + std::cout << "numberOfCollections = " << containerordertest->numberOfCollections() << " not 6" << std::endl; std::abort(); } @@ -658,9 +662,14 @@ int main (int /*argc*/, char** /*argv[]*/) { ID_ContainerTest test; - test.initialize(); - for (unsigned int i = 0; i < 5; i++) test.execute(); - test.finalize(); + for(auto x : { EventContainers::Mode::OfflineLowMemory, EventContainers::Mode::OfflineFast, + EventContainers::Mode::OfflineMap }){ + s_mode = x; + std::cout <<" container mode " << static_cast<int>(s_mode) << std::endl; + test.initialize(); + for (unsigned int i = 0; i < 5; i++) test.execute(); + test.finalize(); + } EventContainers::IdentifiableContTemp<MyCollection> emptyContContainer(10); //Put here to test compilation of IdentifiableContTemp emptyContContainer.cleanup(); return 0; diff --git a/Event/EventOverlay/EventOverlayJobTransforms/CMakeLists.txt b/Event/EventOverlay/EventOverlayJobTransforms/CMakeLists.txt index ea881ca5c0602d03249ee98c3f6fb11aa9b14ca9..bb152a8258f31bfede48595d91447d470ea7c4f4 100644 --- a/Event/EventOverlay/EventOverlayJobTransforms/CMakeLists.txt +++ b/Event/EventOverlay/EventOverlayJobTransforms/CMakeLists.txt @@ -17,5 +17,3 @@ atlas_depends_on_subdirs( PUBLIC atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) atlas_install_runtime( scripts/*.py ) -atlas_install_runtime( share/*.db ) - diff --git a/Event/PyDumper/python/Dumpers.py b/Event/PyDumper/python/Dumpers.py index f509e614f295c1bb5b8fe5e45df7fd3bc7f6ffb6..512000ef2ab703ae29b10893ec8555d589c9c127 100644 --- a/Event/PyDumper/python/Dumpers.py +++ b/Event/PyDumper/python/Dumpers.py @@ -39,6 +39,10 @@ cmp = lambda x, y: (x > y) - (x < y) etcone10 = 0 nucone10 = 8 +# Without these, cling gets confused by forward declarations. +ROOT.xAOD.TrackParticleContainer_v1 +ROOT.xAOD.Jet_v1 + # Work around a cling bug. if hasattr(ROOT,'TrackParticleTruthCollection'): ROOT.TrackParticleTruthCollection()[ROOT.Rec.TrackParticleTruthKey()] diff --git a/ForwardDetectors/AFP/AFP_Digitization/CMakeLists.txt b/ForwardDetectors/AFP/AFP_Digitization/CMakeLists.txt index c9581326d8d2af0ffa5cdca395ea8af45e6c151b..16ed77de57cbe110c597a812b1132fc16aaa265d 100644 --- a/ForwardDetectors/AFP/AFP_Digitization/CMakeLists.txt +++ b/ForwardDetectors/AFP/AFP_Digitization/CMakeLists.txt @@ -5,19 +5,6 @@ # Declare the package name: atlas_subdir( AFP_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - Event/xAOD/xAODEventInfo - ForwardDetectors/AFP/AFP_DigiEv - ForwardDetectors/AFP/AFP_SimEv - GaudiKernel - Simulation/HitManagement - PRIVATE - DetectorDescription/Identifier ) - # External dependencies: find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) @@ -30,7 +17,6 @@ atlas_add_component( AFP_Digitization LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib xAODEventInfo AFP_DigiEv AFP_SimEv GaudiKernel HitManagement Identifier ) # Install files from the package: -atlas_install_headers( AFP_Digitization ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) diff --git a/ForwardDetectors/ALFA/ALFA_Digitization/CMakeLists.txt b/ForwardDetectors/ALFA/ALFA_Digitization/CMakeLists.txt index 9fa388cfcef6fd5806f2a4884e8785bab5d769a0..ed3cec90a0a797c023f2515856c88b942e3df5eb 100644 --- a/ForwardDetectors/ALFA/ALFA_Digitization/CMakeLists.txt +++ b/ForwardDetectors/ALFA/ALFA_Digitization/CMakeLists.txt @@ -5,21 +5,6 @@ # Declare the package name: atlas_subdir( ALFA_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - ForwardDetectors/ALFA/ALFA_RawEv - ForwardDetectors/ALFA/ALFA_SimEv - GaudiKernel - Simulation/HitManagement - PRIVATE - DetectorDescription/Identifier - Generators/GeneratorObjects - Generators/AtlasHepMC - Tools/PathResolver ) - # External dependencies: find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) @@ -28,11 +13,10 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) atlas_add_component( ALFA_Digitization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel PileUpToolsLib ALFA_RawEv ALFA_SimEv GaudiKernel HitManagement Identifier GeneratorObjects PathResolver ) # Install files from the package: -atlas_install_headers( ALFA_Digitization ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) atlas_install_runtime( xtalk/*.txt ) diff --git a/ForwardDetectors/LUCID/LUCID_Digitization/CMakeLists.txt b/ForwardDetectors/LUCID/LUCID_Digitization/CMakeLists.txt index a07b0aa70bd042adb61e0d8e9f27e357f042cdc3..3d8f653c3123af1d342bb0a3d2b0954a0d834b23 100644 --- a/ForwardDetectors/LUCID/LUCID_Digitization/CMakeLists.txt +++ b/ForwardDetectors/LUCID/LUCID_Digitization/CMakeLists.txt @@ -5,18 +5,6 @@ # Declare the package name: atlas_subdir( LUCID_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PRIVATE - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - Event/xAOD/xAODEventInfo - ForwardDetectors/LUCID/LUCID_RawEvent - ForwardDetectors/LUCID/LUCID_SimUtils/LUCID_SimEvent - GaudiKernel - Generators/GeneratorObjects - Simulation/HitManagement ) - # External dependencies: find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) diff --git a/ForwardDetectors/ZDC/ZDC_SimuDigitization/CMakeLists.txt b/ForwardDetectors/ZDC/ZDC_SimuDigitization/CMakeLists.txt index 4f35e4c85db70931ea17c3afd6d42fc54f417e42..4f89a3473fa55c81c541ceb8c7ef6d80693437b1 100644 --- a/ForwardDetectors/ZDC/ZDC_SimuDigitization/CMakeLists.txt +++ b/ForwardDetectors/ZDC/ZDC_SimuDigitization/CMakeLists.txt @@ -5,18 +5,6 @@ # Declare the package name: atlas_subdir( ZDC_SimuDigitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - ForwardDetectors/ZDC/ZDC_SimEvent - ForwardDetectors/ZDC/ZdcEvent - GaudiKernel - Simulation/HitManagement - PRIVATE - DetectorDescription/Identifier ) - # External dependencies: find_package( CLHEP ) @@ -28,7 +16,6 @@ atlas_add_component( ZDC_SimuDigitization LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib ZDC_SimEvent ZdcEvent GaudiKernel HitManagement Identifier ) # Install files from the package: -atlas_install_headers( ZDC_SimuDigitization ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) diff --git a/ForwardDetectors/ZDC/ZdcAnalysis/CMakeLists.txt b/ForwardDetectors/ZDC/ZdcAnalysis/CMakeLists.txt index f43afadff02d614f1457a95102cb235bfbe5d17f..d1a0e7097e4cb0578f47e2557469ca43093f30f7 100644 --- a/ForwardDetectors/ZDC/ZdcAnalysis/CMakeLists.txt +++ b/ForwardDetectors/ZDC/ZdcAnalysis/CMakeLists.txt @@ -24,5 +24,3 @@ atlas_add_library (ZdcAnalysisLib PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODForward xAODTrigL1Calo xAODEventInfo PathResolver ) - -atlas_install_joboptions( share/*.py) diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenEvent.h b/Generators/AtlasHepMC/AtlasHepMC/GenEvent.h index 729e7e5637a65498725b53fe141cade954e0d990..9fcc46a700fd4ae363dbe7a0e5fa626d13bead44 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenEvent.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenEvent.h @@ -11,6 +11,7 @@ #include "HepMC3/PrintStreams.h" #include "AtlasHepMC/GenVertex.h" #include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/SimpleVector.h" namespace HepMC3 { inline std::vector<HepMC3::GenParticlePtr>::const_iterator begin(HepMC3::GenEvent& e){ return e.particles().begin(); } diff --git a/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h b/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h index 25987601a67f89b2404bc858c5aacd2214677f1b..d1c4dcc375bbdb00da439a7f38f11034cc37773c 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h +++ b/Generators/AtlasHepMC/AtlasHepMC/GenVertex.h @@ -6,6 +6,11 @@ #ifdef HEPMC3 #include "HepMC3/GenVertex.h" #include "HepMC3/PrintStreams.h" +namespace HepMC3 +{ +inline std::vector<HepMC3::ConstGenParticlePtr>::const_iterator begin(const HepMC3::GenVertex& v){ return v.particles_out().begin(); } +inline std::vector<HepMC3::ConstGenParticlePtr>::const_iterator end(const HepMC3::GenVertex& v){ return v.particles_out().end(); } +} namespace HepMC { typedef HepMC3::GenVertexPtr GenVertexPtr; typedef HepMC3::ConstGenVertexPtr ConstGenVertexPtr; @@ -36,15 +41,23 @@ inline std::vector<HepMC3::ConstGenVertexPtr> DESCENDANTS(HepMC3::ConstGenVertex return std::vector<HepMC3::ConstGenVertexPtr>(); } inline void* raw_pointer(GenVertexPtr p){ return p.get();} +inline const void* raw_pointer(ConstGenVertexPtr p){ return p.get();} } #else #include "HepMC/GenVertex.h" namespace HepMC { typedef HepMC::GenVertex* GenVertexPtr; typedef const HepMC::GenVertex* ConstGenVertexPtr; +inline GenVertex::particles_out_const_iterator begin(const HepMC::GenVertex& v){ return v.particles_out_const_begin(); } +inline GenVertex::particles_out_const_iterator end(const HepMC::GenVertex& v){ return v.particles_out_const_end(); } + inline GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos = HepMC::FourVector(0.0,0.0,0.0,0.0), const int i=0) { return new HepMC::GenVertex(pos,i); } +namespace Print { +inline void line(std::ostream& os,const GenVertex& v){v.print(os);} +inline void line(std::ostream& os,const GenVertex* v){v->print(os);} +} inline int barcode(ConstGenVertexPtr p){ return p->barcode();} inline void* raw_pointer(GenVertexPtr p){ return p;} inline const void* raw_pointer(ConstGenVertexPtr p){ return p;} diff --git a/Generators/AtlasHepMC/AtlasHepMC/Polarization.h b/Generators/AtlasHepMC/AtlasHepMC/Polarization.h index c637be312b2f081984b71f51e47ed4106728057e..59ecdd8d743220b6dec821f0cccceed4cddd12f8 100644 --- a/Generators/AtlasHepMC/AtlasHepMC/Polarization.h +++ b/Generators/AtlasHepMC/AtlasHepMC/Polarization.h @@ -26,6 +26,13 @@ inline Polarization polarization(HepMC3::GenParticlePtr a){ double theta=(theta_A?theta_A->value():0.0); return Polarization(theta,phi); } +inline Polarization polarization(HepMC3::ConstGenParticlePtr a){ + std::shared_ptr<HepMC3::DoubleAttribute> phi_A =a->attribute<HepMC3::DoubleAttribute>("phi"); + std::shared_ptr<HepMC3::DoubleAttribute> theta_A=a->attribute<HepMC3::DoubleAttribute>("theta"); + double phi=(phi_A?phi_A->value():0.0); + double theta=(theta_A?theta_A->value():0.0); + return Polarization(theta,phi); +} template<class T> void set_polarization( T a, Polarization b) { a->add_attribute("phi",std::make_shared<HepMC3::DoubleAttribute>(b.phi())); diff --git a/Generators/CosmicGenerator/src/cosmic2.f b/Generators/CosmicGenerator/src/cosmic2.f index 0b07e1b353f91abf2a9568d0afb4361473eb4dd5..0c46f1667406684746f6de5782d89b675b1b8371 100644 --- a/Generators/CosmicGenerator/src/cosmic2.f +++ b/Generators/CosmicGenerator/src/cosmic2.f @@ -499,7 +499,7 @@ C WRITE(IOU,6102) 6102 FORMAT(/,2X,'FOR COMPARISON : MEASURED TOTAL FLUX ABOVE 0.35 GEV', F/19X,'BY ALLKOFER ET AL. COSMIC RAYS ON EARTH,ISSN 0344-8401'/19X - F ,'J2 = (1.90 ± 0.12).E-2'//) + F ,'J2 = (1.90 +- 0.12).E-2'//) END * SUBROUTINE CDARFX(EMU,THEMU,WQPOS,WQNEG) diff --git a/Generators/EvgenJobTransforms/CMakeLists.txt b/Generators/EvgenJobTransforms/CMakeLists.txt index 6b76ce6dd839895d6cfa4bd2905d7fe6c2184984..53e08f83fde6f8d63fc90562545376edee54f13f 100644 --- a/Generators/EvgenJobTransforms/CMakeLists.txt +++ b/Generators/EvgenJobTransforms/CMakeLists.txt @@ -13,6 +13,4 @@ atlas_depends_on_subdirs( PUBLIC # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) -atlas_install_joboptions( test/test_*.py ) atlas_install_runtime( scripts/*.py ) -atlas_install_runtime( test/EvgenJobTransforms_TestConfiguration.xml ) diff --git a/Generators/EvtGen_i/EvtGen_i/EvtInclusiveDecay.h b/Generators/EvtGen_i/EvtGen_i/EvtInclusiveDecay.h index befc860819b32ff3620271883f3f836e077beaa9..573a844fa6b135d981e74ca35ad76ebd5fcd8faa 100644 --- a/Generators/EvtGen_i/EvtGen_i/EvtInclusiveDecay.h +++ b/Generators/EvtGen_i/EvtGen_i/EvtInclusiveDecay.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 */ //***************************************************************************** @@ -71,10 +71,17 @@ class EvtInclusiveDecay:public GenBase { std::string xmlpath(void); private: +#ifdef HEPMC3 + StatusCode traverseDecayTree(HepMC::GenParticlePtr p, + bool isToBeRemoved, + std::set<HepMC::GenVertexPtr>& visited, + std::set<HepMC::GenParticlePtr>& toBeDecayed); +#else StatusCode traverseDecayTree(HepMC::GenParticlePtr p, bool isToBeRemoved, std::set<HepMC::GenVertexPtr>& visited, std::set<int>& toBeDecayed); +#endif void removeDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticlePtr p); void decayParticle(HepMC::GenEvent* hepMC, HepMC::GenParticlePtr p); void addEvtGenDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticlePtr part, @@ -89,10 +96,14 @@ class EvtInclusiveDecay:public GenBase { // 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); +#ifdef HEPMC3 + void printHepMC(HepMC::GenEvent* hepMC, std::set<HepMC::GenParticlePtr>* barcodeList = nullptr); +#else + void printHepMC(HepMC::GenEvent* hepMC, std::set<int>* barcodeList = nullptr); +#endif unsigned int printTree(HepMC::GenParticlePtr p, std::set<HepMC::GenVertexPtr>& visited, int level, std::set<int>* barcodeList = 0); - std::string pdgName(const HepMC::GenParticlePtr p, bool statusHighlighting = false, std::set<int>* barcodeList = 0); + std::string pdgName(const HepMC::GenParticlePtr p, bool statusHighlighting = false, std::set<int>* barcodeList = nullptr); // StoreGate access // StoreGateSvc* m_sgSvc; diff --git a/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx b/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx index 215ae262fb91df2902c1a27c22af8f5a4f264a62..f9d16e3248ba06111759dbfe5750d91657688c27 100644 --- a/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx +++ b/Generators/EvtGen_i/src/EvtInclusiveDecay.cxx @@ -212,6 +212,25 @@ StatusCode EvtInclusiveDecay::execute() { // 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::GenVertexPtr> visited; +#ifdef HEPMC3 + std::set<HepMC::GenParticlePtr> toBeDecayed; + for (auto p: hepMC->particles()) { + if ( (!p->production_vertex()) || + (p->production_vertex()->particles_in().size() == 0) ) { + StatusCode sc = traverseDecayTree(p,false,visited,toBeDecayed); + if (sc.isFailure()) + return StatusCode::FAILURE; + } + } + // Print HepMC in tree format if desired (before doing anything) + if (m_printHepMCBeforeEvtGen) { + msg(MSG::INFO) << "Printing HepMC record at " << hepMC << " BEFORE running EvtGen:" << endmsg; + if (m_printHepMCHighLightTopLevelDecays) + printHepMC(hepMC,&toBeDecayed); + else + printHepMC(hepMC); + } +#else std::set<int> toBeDecayed; for (HepMC::GenEvent::particle_iterator itp = hepMC->particles_begin(); itp != hepMC->particles_end(); ++itp) { HepMC::GenParticle* p = *itp; @@ -231,11 +250,21 @@ StatusCode EvtInclusiveDecay::execute() { else printHepMC(hepMC); } +#endif // Decay selected particles bool eventPassesCuts(false); int loopCounter(0); while( !eventPassesCuts && loopCounter < m_maxNRepeatedDecays ) { +#ifdef HEPMC3 + for (auto p: toBeDecayed) { + if (p==0) { + msg(MSG::ERROR ) << "Overlapping decay tree for particle" << p <<endmsg; + return StatusCode::FAILURE; + } + decayParticle(hepMC,p); + } +#else for (std::set<int>::iterator itb = toBeDecayed.begin(); itb!=toBeDecayed.end(); ++itb) { auto p = hepMC->barcode_to_particle(*itb); if (p==0) { @@ -244,6 +273,7 @@ StatusCode EvtInclusiveDecay::execute() { } decayParticle(hepMC,p); } +#endif if(m_applyUserSelection) eventPassesCuts = passesUserSelection(hepMC); @@ -255,8 +285,13 @@ StatusCode EvtInclusiveDecay::execute() { } // Store the number of decay attempts in event weights std::map, only if repeated decays enabled +#ifdef HEPMC3 + if(m_maxNRepeatedDecays > 1) + hepMC->weight("nEvtGenDecayAttempts") = loopCounter; +#else if(m_maxNRepeatedDecays > 1) hepMC->weights()["nEvtGenDecayAttempts"] = loopCounter; +#endif // Print HepMC in tree format if desired (after finishing all EvtGen decays) if (m_printHepMCAfterEvtGen) { msg(MSG::INFO) << "Printing HepMC record at " << hepMC << " AFTER running EvtGen:" << endmsg; @@ -316,14 +351,25 @@ StatusCode EvtInclusiveDecay::finalize() { // by EvtGen (with its decay tree being deleted beforehand), we cannot use HepMC's // "descendant" iterator. // +#ifdef HEPMC3 +StatusCode EvtInclusiveDecay::traverseDecayTree(HepMC::GenParticlePtr p, + bool isToBeRemoved, + std::set<HepMC::GenVertexPtr>& visited, + std::set<HepMC::GenParticlePtr>& toBeDecayed) { +#else StatusCode EvtInclusiveDecay::traverseDecayTree(HepMC::GenParticlePtr p, bool isToBeRemoved, std::set<HepMC::GenVertexPtr>& visited, std::set<int>& toBeDecayed) { +#endif ATH_MSG_VERBOSE("Inspecting: " << pdgName(p) << " barcode:"<< HepMC::barcode(p)); if (!isToBeRemoved) { if (isToBeDecayed(p,true)) { +#ifdef HEPMC3 + toBeDecayed.insert(p); +#else toBeDecayed.insert(HepMC::barcode(p)); +#endif isToBeRemoved = true; ATH_MSG_VERBOSE("Selected particle for decay: " << pdgName(p) << " (barcode " << HepMC::barcode(p) << ")"); @@ -335,28 +381,32 @@ StatusCode EvtInclusiveDecay::traverseDecayTree(HepMC::GenParticlePtr p, } } auto v = p->end_vertex(); +#ifdef HEPMC3 + if (v) { + if (visited.insert(v).second) { + if ( isToBeRemoved && (v->particles_in().size()>1) && m_checkDecayTree ) { + ATH_MSG_WARNING("Found particle to be decayed with vertex with >1 incoming mother particles in decay tree"); + ATH_MSG_WARNING( ([&p, &v](){ std::stringstream ss; HepMC::Print::line(ss,p); HepMC::Print::line(ss,v); return ss.str();})()); + } + for (auto itp: v->particles_out()) { + ATH_CHECK(traverseDecayTree(itp,isToBeRemoved,visited,toBeDecayed) ); + } + } + } +#else if (v) { if (visited.insert(v).second) { if ( isToBeRemoved && (v->particles_in_size()>1) && m_checkDecayTree ) { // This is normal for Herwig but should not occur for Pythia ATH_MSG_WARNING("Found particle to be decayed with vertex with >1 incoming mother particles in decay tree"); - if (msgLvl(MSG::WARNING)) { - std::cout << std::endl; - p->print(); - v->print(); - std::cout << std::endl; - //return StatusCode::FAILURE; - } + ATH_MSG_WARNING( ([&p, &v](){ std::stringstream ss; HepMC::Print::line(ss,p); HepMC::Print::line(ss,v); return ss.str();})()); } - for (HepMC::GenVertex::particle_iterator itp = v->particles_begin(HepMC::children); - itp != v->particles_end(HepMC::children); - ++itp) { - StatusCode sc = traverseDecayTree(*itp,isToBeRemoved,visited,toBeDecayed); - if (sc.isFailure()) - return StatusCode::FAILURE; + for (auto itp = v->particles_begin(HepMC::children); itp != v->particles_end(HepMC::children); ++itp) { + ATH_CHECK(traverseDecayTree(*itp,isToBeRemoved,visited,toBeDecayed) ); } } } +#endif return StatusCode::SUCCESS; } @@ -368,6 +418,12 @@ StatusCode EvtInclusiveDecay::traverseDecayTree(HepMC::GenParticlePtr p, void EvtInclusiveDecay::removeDecayTree(HepMC::GenEvent* hepMC, HepMC::GenParticlePtr p) { auto v = p->end_vertex(); if (v) { +#ifdef HEPMC3 + //This is recursive in HepMC3. But explicit deletion is allowed as well. + hepMC->remove_vertex(v); + p->set_status(1); // For now, flag particle as undecayed (stable) + ATH_MSG_DEBUG("Removed existing " << pdgName(p) << " (barcode " << HepMC::barcode(p) << ")" ); +#else std::set<int> vtxBarCodesToDelete; vtxBarCodesToDelete.insert(v->barcode()); for (HepMC::GenVertex::vertex_iterator itv = v->vertices_begin(HepMC::descendants); @@ -382,6 +438,7 @@ void EvtInclusiveDecay::removeDecayTree(HepMC::GenEvent* hepMC, HepMC::GenPartic p->set_status(1); // For now, flag particle as undecayed (stable) ATH_MSG_DEBUG("Removed existing " << pdgName(p) << " (barcode " << p->barcode() << ")" << " decay tree with " << vtxBarCodesToDelete.size() << " vertices"); +#endif } } @@ -479,7 +536,11 @@ bool EvtInclusiveDecay::isToBeDecayed(const HepMC::GenParticlePtr p, bool doCros int stat = p->status(); int nDaughters = 0; auto v = p->end_vertex(); +#ifdef HEPMC3 + if (v) nDaughters = v->particles_out().size(); +#else if (v) nDaughters = v->particles_out_size(); +#endif // Ignore documentation lines if (stat == 3) return false; @@ -521,11 +582,17 @@ bool EvtInclusiveDecay::isToBeDecayed(const HepMC::GenParticlePtr p, bool doCros if (m_prohibitRemoveSelfDecay && nDaughters>0) { // For now, check only children - this should be sufficient and checking all // descendants would be very expensive. +#ifdef HEPMC3 + for (auto itd: v->particles_out()) { + if (std::abs(itd->pdg_id()) == std::abs(id)) return false; + } +#else for (HepMC::GenVertex::particle_iterator itd = v->particles_begin(HepMC::children); itd != v->particles_end(HepMC::children); ++itd) { if (abs((*itd)->pdg_id()) == abs(id)) return false; } +#endif } // Check blackList @@ -572,9 +639,8 @@ bool EvtInclusiveDecay::passesUserSelection(HepMC::GenEvent* hepMC) { bool passed(false); 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; - if( abs(p->pdg_id()) == 13 ) + for ( auto p: *hepMC) { + if( std::abs(p->pdg_id()) == 13 ) muons->push_back(p); } @@ -622,6 +688,25 @@ double EvtInclusiveDecay::invMass(const HepMC::GenParticlePtr p1, const HepMC::G // colors to denote the status of particles and to indicate which particles // are selected by the job options to be decayed by EvtGen. // +#ifdef HEPMC3 +void EvtInclusiveDecay::printHepMC(HepMC::GenEvent* hepMC, std::set<HepMC::GenParticlePtr>* barcodeList) { + std::set<HepMC::GenVertexPtr> visited; + unsigned int nParticlesFound = 0; + unsigned int nTreesFound = 0; + for (auto p: *hepMC) { + if ( (!p->production_vertex()) || + (p->production_vertex()->particles_in().size() == 0) ) { + nTreesFound++; + std::cout << "\n Found new partial decay tree:\n" << std::endl; + unsigned int nParticlesVisited = printTree(p,visited,1,barcodeList); + std::cout << "\n " << nParticlesVisited << " particles in this subtree" << std::endl; + nParticlesFound += nParticlesVisited; + } + } + std::cout << "\n Total of " << nParticlesFound << " particles found in " + << nTreesFound << " decay subtrees in HepMC event record\n" << std::endl; +} +#else void EvtInclusiveDecay::printHepMC(HepMC::GenEvent* hepMC, std::set<int>* barcodeList) { std::set<HepMC::GenVertexPtr> visited; unsigned int nParticlesFound = 0; @@ -640,6 +725,7 @@ void EvtInclusiveDecay::printHepMC(HepMC::GenEvent* hepMC, std::set<int>* barcod std::cout << "\n Total of " << nParticlesFound << " particles found in " << nTreesFound << " decay subtrees in HepMC event record\n" << std::endl; } +#endif unsigned int EvtInclusiveDecay::printTree(HepMC::GenParticlePtr p, std::set<HepMC::GenVertexPtr>& visited, int level, std::set<int>* barcodeList) { @@ -647,6 +733,28 @@ unsigned int EvtInclusiveDecay::printTree(HepMC::GenParticlePtr p, for (int i=0; i<level; i++) std::cout << " "; std::cout << pdgName(p,m_printHepMCHighlighted,barcodeList); auto v = p->end_vertex(); +#ifdef HEPMC3 + if (v) { + if (v->particles_in().size() > 1) + std::cout << " [interaction: " << v->particles_in().size() << " particles, barcode " << HepMC::barcode(v) << "] --> "; + else + std::cout << " --> "; + if (visited.insert(v).second) { + for (auto itp: v->particles_out()) { + std::cout << pdgName(itp,m_printHepMCHighlighted,barcodeList) << " "; + } + std::cout << std::endl; + for (auto itp: v->particles_out()) { + if (itp->end_vertex()) + nParticlesVisited += printTree(itp, visited, level+1, barcodeList); + else + nParticlesVisited++; + } + } else + std:: cout << "see above" << std::endl; + } else + std::cout << " no decay vertex\n" << std::endl; +#else if (v) { if (v->particles_in_size() > 1) std::cout << " [interaction: " << v->particles_in_size() << " particles, barcode " << v->barcode() << "] --> "; @@ -671,6 +779,7 @@ unsigned int EvtInclusiveDecay::printTree(HepMC::GenParticlePtr p, std:: cout << "see above" << std::endl; } else std::cout << " no decay vertex\n" << std::endl; +#endif return nParticlesVisited; } diff --git a/Generators/FlowAfterburner/src/AddFlowByShifting.cxx b/Generators/FlowAfterburner/src/AddFlowByShifting.cxx index 9a9f1fc67b7e94a63a34268ad15661acde7d0f73..8deece141497b6f3c52f0b1fa70fab96110dfa04 100644 --- a/Generators/FlowAfterburner/src/AddFlowByShifting.cxx +++ b/Generators/FlowAfterburner/src/AddFlowByShifting.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: Generators/FlowAfterburnber/AddFlowByShifting.cxx @@ -46,7 +46,6 @@ double AddFlowByShifting::vn_func(double x, void *params) double AddFlowByShifting::vn_func_derivative(double x, void *params) { float *par_float = (float*) params; - //float phi_0 = par_float[0]; float *vn = par_float+1; float *psi_n = vn+6; double val=1 +2*( vn[0]*cos(1*(x-psi_n[0]))/1.0 + vn[1]*cos(2*(x-psi_n[1]))/2.0 + @@ -239,22 +238,20 @@ StatusCode AddFlowByShifting::execute() { for (itr = mcFlowCollptr->begin(); itr!=mcFlowCollptr->end(); ++itr) { ATH_MSG_DEBUG("Next event in the bag ..."); - //int g_id = (*itr)->signal_process_id(); - //GeneratorName_print(g_id); - //std::cout << std::endl; auto mainvtx=HepMC::barcode_to_vertex(*itr,-1); if(m_flow_fluctuations) Set_EbE_Fluctuation_Multipliers(mainvtx,hijing_pars->get_b()); +#ifdef HEPMC3 + int particles_in_event = (*itr)->particles().size(); +#else int particles_in_event = (*itr)->particles_size(); +#endif m_particles_processed = 0; - for ( HepMC::GenVertex::particle_iterator partit = - (*mainvtx).particles_begin(HepMC::children); - partit != (*mainvtx).particles_end(HepMC::children); partit++ ) { + for ( auto parent: *mainvtx) { // Process particles from main vertex - auto parent = (*partit); CLHEP::HepLorentzVector momentum(parent->momentum().px(), parent->momentum().py(), parent->momentum().pz(), @@ -371,11 +368,7 @@ void AddFlowByShifting::MoveDescendantsToParent } // now rotate their associated particles - for ( HepMC::GenVertex::particle_iterator descpartit - = descvtx->particles_begin(HepMC::children); - descpartit != descvtx->particles_end(HepMC::children); - ++descpartit ) { - auto descpart = (*descpartit); + for (auto descpart: *descvtx){ CLHEP::HepLorentzVector momentum(descpart->momentum().px(), descpart->momentum().py(), descpart->momentum().pz(), @@ -492,11 +485,6 @@ double AddFlowByShifting::AddFlowToParent (HepMC::GenParticlePtr parent, const H if (iter>=1000) return 0; - /* - float val=phi +2*( v1*sin(1*(phi-m_psi_n[0]))/1.0 + v2*sin(2*(phi-m_psi_n[1]))/2.0 + - v3*sin(3*(phi-m_psi_n[2]))/3.0 + v4*sin(4*(phi-m_psi_n[3]))/4.0 + - v5*sin(5*(phi-m_psi_n[4]))/5.0 + v6*sin(6*(phi-m_psi_n [5]))/6.0 ); - std::cout<<phi_0<<" "<<val<<" "<<phi_0-val<<std::endl; // */ phishift = phi-phi_0; } @@ -658,10 +646,7 @@ void AddFlowByShifting::Set_EbE_Fluctuation_Multipliers(HepMC::GenVertexPtr main double EbE_Vn[6]; for(int ihar=0;ihar<6;ihar++){m_EbE_Multiplier_vn[ihar]=1.0;EbE_Vn[ihar]=0.0;} - for(auto partit =(*mainvtx).particles_begin(HepMC::children); - partit !=(*mainvtx).particles_end (HepMC::children); - partit++ ) { - auto parent = (*partit); + for(auto parent: *mainvtx) { float eta= parent->momentum().pseudoRapidity(); float pT = parent->momentum().perp(); diff --git a/Generators/FlowAfterburner/src/CheckFlow.cxx b/Generators/FlowAfterburner/src/CheckFlow.cxx index fa82725443b629f9272e32b65f6521e8b0f93a6d..29c6db3e1c6b5278906a9d2761a1225552ccf058 100644 --- a/Generators/FlowAfterburner/src/CheckFlow.cxx +++ b/Generators/FlowAfterburner/src/CheckFlow.cxx @@ -156,7 +156,6 @@ StatusCode CheckFlow::initialize(){ m_tesIO = new GenAccessIO(); - // return StatusCode::SUCCESS; return result; } @@ -180,7 +179,6 @@ StatusCode CheckFlow::execute() { if ( m_sgSvc->retrieve(hijing_pars, "Hijing_event_params").isFailure() ) { -// if ( evtStore()->retrieve(hijing_pars, "Hijing_event_params").isFailure() ) { msg(MSG::ERROR) << "Could not retrieve Hijing_event_params" << endmsg; return StatusCode::FAILURE; @@ -188,13 +186,6 @@ StatusCode CheckFlow::execute() { float b = hijing_pars->get_b(); float phiR = hijing_pars->get_bphi(); - //msglog << MSG::DEBUG<<"SOUMYA " - // <<hijing_pars->get_psi(1) - // <<" "<<hijing_pars->get_psi(2) - // <<" "<<hijing_pars->get_psi(3) - // <<hijing_pars->get_psi(4) - // <<" "<<hijing_pars->get_psi(5) - // <<" "<<hijing_pars->get_psi(6) << endmsg; // Check cut on impact parameter b if(b<m_bcut_min || b>m_bcut_max) diff --git a/Generators/FlowAfterburner/src/CheckFlow_New.cxx b/Generators/FlowAfterburner/src/CheckFlow_New.cxx index d2e3456df4848df546b0a923441194b5bd3335a0..9ea7fd0326a412231ffadf6a6340d074dbb629cd 100644 --- a/Generators/FlowAfterburner/src/CheckFlow_New.cxx +++ b/Generators/FlowAfterburner/src/CheckFlow_New.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 */ // File: Generators/FlowAfterburnber/CheckFlow_New.h @@ -254,7 +254,6 @@ StatusCode CheckFlow_New::execute() { if ( m_sgSvc->retrieve(hijing_pars, "Hijing_event_params").isFailure() ) { -// if ( evtStore()->retrieve(hijing_pars, "Hijing_event_params").isFailure() ) { msg(MSG::ERROR) << "Could not retrieve Hijing_event_params"<< endmsg; return StatusCode::FAILURE; } @@ -389,16 +388,16 @@ StatusCode CheckFlow_New::execute() { double pt = pitr->momentum().perp(); double rapid = pitr->momentum().pseudoRapidity(); double phi = pitr->momentum().phi(); - if( (fabs(rapid) >= m_rapcut_min) && (fabs(rapid) <= m_rapcut_max) && - (fabs(pt) >= m_ptcut_min) && (fabs(pt) <= m_ptcut_max) ) { + if( (std::abs(rapid) >= m_rapcut_min) && (std::abs(rapid) <= m_rapcut_max) && + (std::abs(pt) >= m_ptcut_min) && (std::abs(pt) <= m_ptcut_max) ) { for(int ihar=0;ihar<6;ihar++){ float temp=(ihar+1)*(phi-Psi_n_reco_pos[ihar]); if(rapid>0) temp=(ihar+1)*(phi-Psi_n_reco_neg[ihar]); - int ieta= (int)(fabs(rapid)*n_etabin/eta_bin_max); - if(ieta>=0 && ieta<n_etabin) m_profile_pt_dep_reco [ihar][ieta]->Fill(pt/1000,cos(temp)); + int ieta= (int)(std::abs(rapid)*n_etabin/eta_bin_max); + if(ieta>=0 && ieta<n_etabin) m_profile_pt_dep_reco [ihar][ieta]->Fill(pt/1000,std::cos(temp)); float temp_pt=pt/1000; for(int ipt=0;ipt<n_ptbin;ipt++){ @@ -421,19 +420,6 @@ StatusCode CheckFlow_New::execute() { StatusCode CheckFlow_New::finalize() { msg(MSG::INFO) << ">>> CheckFlow_New from finalize" << endmsg; -/* - for(int ihar=0;ihar<6;ihar++){ - double reso=m_profile_resolution->GetBinContent(ihar+1); - if (reso >=0) reso= sqrt( reso); - else reso=-sqrt(-reso); - for(int ieta=0;ieta<n_etabin;ieta++){ - m_profile_pt_dep_reco [ihar][ieta]->Scale(1.0/reso); - } - for(int ipt=0;ipt<n_ptbin;ipt++){ - m_profile_eta_dep_reco[ihar][ipt]->Scale(1.0/reso); - } - } -*/ return StatusCode::SUCCESS; } diff --git a/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx b/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx index ffe7b94b8ecfa95fab0b626744313f91e6a05bf6..83e3266694a96e9a427533c8357a1db57d3ebe9b 100644 --- a/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.cxx +++ b/Generators/FlowAfterburner/src/CheckFlow_New_Minbias.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 */ // File: Generators/FlowAfterburnber/CheckFlow_New_Minbias.h @@ -314,8 +314,7 @@ StatusCode CheckFlow_New_Minbias::execute() { } //EbE vn for ID acceptance end pt>0.5GeV - //if(fabs(rapid)<=2.5 &&fabs(pt)>=500){ - if(fabs(pt)>=500){ + if(std::abs(pt)>=500){ tot_ID1++; for(int ihar=0;ihar<6;ihar++){ cos_ID1[ihar]+=cos((ihar+1)*phi); diff --git a/Generators/GeneratorFilters/GeneratorFilters/DecayModeFilter.h b/Generators/GeneratorFilters/GeneratorFilters/DecayModeFilter.h index 8ac4f904d67a815a3e58a700e5cff90939a655a8..68fcdfd4eb5aa7e680be580dfc03b8946a93dc4f 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/DecayModeFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/DecayModeFilter.h @@ -59,9 +59,9 @@ private: private: - 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; + std::string printChain(HepMC::ConstGenParticlePtr parent) const; + void analyzeChain(HepMC::ConstGenParticlePtr parent, bool&, bool&, bool&, bool& ); + void countChain(HepMC::ConstGenParticlePtr 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/HTFilter.h b/Generators/GeneratorFilters/GeneratorFilters/HTFilter.h index e89acf18ad75c2151e8264e5b89a1f7e86bd6180..9bbab097e62a78c39dbe0e6bb7e9d10f3d2093b7 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::GenParticlePtr tp ) const; - bool fromWZ( const HepMC::GenParticlePtr tp ) const; + bool fromTau( HepMC::ConstGenParticlePtr tp ) const; + bool fromWZ( HepMC::ConstGenParticlePtr tp ) const; private: diff --git a/Generators/GeneratorFilters/GeneratorFilters/SoftLeptonInJetFilter.h b/Generators/GeneratorFilters/GeneratorFilters/SoftLeptonInJetFilter.h index 69c683e2c09ea5a5c95ca2e55ee24147136b1463..7e6105ab3de8d7d0817c4d05017ef49e8f0ff503 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/SoftLeptonInJetFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/SoftLeptonInJetFilter.h @@ -17,8 +17,8 @@ public: protected: - bool isElectron(HepMC::GenParticlePtr p) const; - bool isParton(HepMC::GenParticlePtr p) const; + bool isElectron(HepMC::ConstGenParticlePtr p) const; + bool isParton(HepMC::ConstGenParticlePtr p) const; private: diff --git a/Generators/GeneratorFilters/GeneratorFilters/TauFilter.h b/Generators/GeneratorFilters/GeneratorFilters/TauFilter.h index 245ab02d476314a9e09ce9c877e216fb344942b3..146ecad0661531495ba26dc1209e7944c24b1ee2 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::GenParticlePtr tau ); + CLHEP::HepLorentzVector sumDaughterNeutrinos( HepMC::ConstGenParticlePtr tau ); private: diff --git a/Generators/GeneratorFilters/GeneratorFilters/TtHtoVVDecayFilter.h b/Generators/GeneratorFilters/GeneratorFilters/TtHtoVVDecayFilter.h index 55012480b5bb302b93e0691ddb9ce97e01bdaf5f..e135e0f14df684c8da83e94823b5b1ea30291485 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::GenVertexPtr searchvertex, + bool findAncestor(HepMC::ConstGenVertexPtr searchvertex, int targetPDGID); }; diff --git a/Generators/GeneratorFilters/GeneratorFilters/VBFForwardJetsFilter.h b/Generators/GeneratorFilters/GeneratorFilters/VBFForwardJetsFilter.h index 9d779a37014ebcbf49400ca00f7ba9a0b367fe0b..0ccf4f0a218004cb3bf70d251924f1a913f0c4b3 100644 --- a/Generators/GeneratorFilters/GeneratorFilters/VBFForwardJetsFilter.h +++ b/Generators/GeneratorFilters/GeneratorFilters/VBFForwardJetsFilter.h @@ -40,13 +40,13 @@ private: std::string m_TruthJetContainerName; - CLHEP::HepLorentzVector sumDaughterNeutrinos(HepMC::GenParticlePtr tau); + CLHEP::HepLorentzVector sumDaughterNeutrinos(HepMC::ConstGenParticlePtr tau); void removePseudoJets(std::vector<const xAOD::Jet*>& jetList, std::vector<HepMC::GenParticlePtr>& MCTruthPhotonList, std::vector<HepMC::GenParticlePtr>& MCTruthElectronList, - std::vector<CLHEP::HepLorentzVector*> & MCTruthTauList); + std::vector<CLHEP::HepLorentzVector> & MCTruthTauList); double getMinDeltaR(const xAOD::Jet* jet, std::vector<HepMC::GenParticlePtr>& list); - double getMinDeltaR(const xAOD::Jet* jet, std::vector<CLHEP::HepLorentzVector*>& list); + double getMinDeltaR(const xAOD::Jet* jet, std::vector<CLHEP::HepLorentzVector>& list); }; #endif diff --git a/Generators/GeneratorFilters/src/ATauFilter.cxx b/Generators/GeneratorFilters/src/ATauFilter.cxx index 439bc448e8326ee70e0cb45983414747478fc326..8abfcf6c5c0ff28746e0d38a9fecf725f3b5020c 100644 --- a/Generators/GeneratorFilters/src/ATauFilter.cxx +++ b/Generators/GeneratorFilters/src/ATauFilter.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 "GeneratorFilters/ATauFilter.h" @@ -50,22 +50,16 @@ StatusCode ATauFilter::filterFinalize() { StatusCode ATauFilter::filterEvent() { - 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 - tau = 0; // will contain the tau once found by id only - atau = 0; - taulep = 0; // lepton that has the genvertex in common with the endvertex of tau - ataulep = 0; - nutau = 0; // nutau that has the genvertex in common with the endvertex of tau - anutau = 0; + HepMC::ConstGenParticlePtr tau = nullptr; // will contain the tau once found by id only + HepMC::ConstGenParticlePtr atau = nullptr; + HepMC::ConstGenParticlePtr taulep = nullptr; // lepton that has the genvertex in common with the endvertex of tau + HepMC::ConstGenParticlePtr ataulep = nullptr; + HepMC::ConstGenParticlePtr nutau = nullptr; // nutau that has the genvertex in common with the endvertex of tau + HepMC::ConstGenParticlePtr anutau = nullptr; m_eventsaccepted++; @@ -77,25 +71,21 @@ StatusCode ATauFilter::filterEvent() { for (auto part: *genEvt){ // Look for the first tau with genstat != 3 which has not a tau as daughter fsr = 0; - if ( part->end_vertex()!= 0 ) { -#ifdef HEPMC3 - for ( auto itr = part->end_vertex()->particles_out().begin(); itr != part->end_vertex()->particles_out().end(); itr++ ) { -#else - for ( auto itr = part->end_vertex()->particles_out_const_begin(); itr != part->end_vertex()->particles_out_const_end(); itr++ ) { -#endif - if ( part->pdg_id() == (*itr)->pdg_id() ) fsr = 1; + if ( part->end_vertex() ) { + for ( auto pitr: *(part->end_vertex())) { + if ( part->pdg_id() == pitr->pdg_id() ) fsr = 1; } } if ( ( part->pdg_id() == 15 ) && ( tau == 0 ) && ( part->status() != 3 ) && ( fsr == 0 ) ) { tau = part; - ATH_MSG_DEBUG("Found tau with barcode " << tau->barcode() << " status " << part->status()); + ATH_MSG_DEBUG("Found tau with barcode " << HepMC::barcode(tau) << " status " << part->status()); } // Look for the first atau with genstat != 3 which has not a tau as daughter if ( ( part->pdg_id() == -15 ) && ( atau == 0 ) && ( part->status() != 3 ) && ( fsr == 0 ) ) { atau = part; - ATH_MSG_DEBUG("Found atau with barcode " << atau->barcode() << " status " << part->status()); + ATH_MSG_DEBUG("Found atau with barcode " << HepMC::barcode(atau) << " status " << part->status()); } // If tau was already found look for his nu @@ -175,8 +165,8 @@ StatusCode ATauFilter::filterEvent() { || ( ( taulep->momentum().perp() >= m_llPtminmu ) && ( taulep->pdg_id() == 13 ) ) ) && ( ( ( ataulep->momentum().perp() >= m_llPtmine ) && ( ataulep->pdg_id() == -11 ) ) || ( ( ataulep->momentum().perp() >= m_llPtminmu ) && ( ataulep->pdg_id() == -13 ) ) ) - && ( ( fabs( taulep->momentum().pseudoRapidity() ) <= m_EtaRange ) ) - && ( fabs( ataulep->momentum().pseudoRapidity() ) <= m_EtaRange ) ) { + && ( ( std::abs( taulep->momentum().pseudoRapidity() ) <= m_EtaRange ) ) + && ( std::abs( ataulep->momentum().pseudoRapidity() ) <= m_EtaRange ) ) { CLHEP::HepLorentzVector mom_taulep(taulep->momentum().px(), taulep->momentum().py(), taulep->momentum().pz(), taulep->momentum().e()); CLHEP::HepLorentzVector mom_ataulep(ataulep->momentum().px(), ataulep->momentum().py(), ataulep->momentum().pz(), ataulep->momentum().e()); if ( fabs(mom_taulep.vect().deltaPhi(mom_ataulep.vect())) < m_maxdphi ) { @@ -209,10 +199,10 @@ StatusCode ATauFilter::filterEvent() { if ( ( ( ( ataulep->momentum().perp() >= m_lhPtmine ) && ( ataulep->pdg_id() == -11 ) ) || ( ( ataulep->momentum().perp() >= m_lhPtminmu ) && ( ataulep->pdg_id() == -13 ) ) ) && ( mom_tauprod.perp() >= m_lhPtminh ) - && ( fabs( mom_tauprod.pseudoRapidity() ) <= m_EtaRange ) - && ( fabs( ataulep->momentum().pseudoRapidity() ) <= m_EtaRange ) ) { + && ( std::abs( mom_tauprod.pseudoRapidity() ) <= m_EtaRange ) + && ( std::abs( ataulep->momentum().pseudoRapidity() ) <= m_EtaRange ) ) { CLHEP::HepLorentzVector mom_ataulep(ataulep->momentum().px(), ataulep->momentum().py(), ataulep->momentum().pz(), ataulep->momentum().e()); - if ( fabs(mom_ataulep.vect().deltaPhi(mom_tauprod.vect())) < m_maxdphi ) { + if ( std::abs(mom_ataulep.vect().deltaPhi(mom_tauprod.vect())) < m_maxdphi ) { m_eventslhacc++; return StatusCode::SUCCESS; } @@ -228,8 +218,8 @@ StatusCode ATauFilter::filterEvent() { m_eventshh++; if ( ( mom_tauprod.perp() >= m_hhPtmin ) // check pt && ( mom_atauprod.perp() >= m_hhPtmin ) - && ( fabs( mom_tauprod.pseudoRapidity() ) <= m_EtaRange ) // check eta-range - && ( fabs( mom_atauprod.pseudoRapidity() ) <= m_EtaRange ) ) { + && ( std::abs( mom_tauprod.pseudoRapidity() ) <= m_EtaRange ) // check eta-range + && ( std::abs( mom_atauprod.pseudoRapidity() ) <= m_EtaRange ) ) { if ( fabs(mom_atauprod.vect().deltaPhi(mom_tauprod.vect())) < m_maxdphi ) { m_eventshhacc++; m_nPass++; diff --git a/Generators/GeneratorFilters/src/BoostedHadTopAndTopPair.cxx b/Generators/GeneratorFilters/src/BoostedHadTopAndTopPair.cxx index 4b799ed9f476934b7d32fc59cc9d408a65f824cc..14ceaf9977d38c3e2425f8c9b917866d3de755b4 100644 --- a/Generators/GeneratorFilters/src/BoostedHadTopAndTopPair.cxx +++ b/Generators/GeneratorFilters/src/BoostedHadTopAndTopPair.cxx @@ -103,12 +103,16 @@ bool BoostedHadTopAndTopPair::isFromTop(HepMC::ConstGenParticlePtr part) const{ if(!prod) return false; +#ifdef HEPMC3 + for (auto p: prod->particles_in()) if (std::abs(p->pdg_id()) == 6) return true; +#else HepMC::GenVertex::particle_iterator firstParent = prod->particles_begin(HepMC::parents); HepMC::GenVertex::particle_iterator endParent = prod->particles_end(HepMC::parents); for(;firstParent!=endParent; ++firstParent){ //if( part->barcode() < (*firstParent)->barcode() ) continue; /// protection for sherpa if( abs( (*firstParent)->pdg_id() ) == 6 ) return true; } +#endif return false; } @@ -119,12 +123,16 @@ HepMC::ConstGenParticlePtr BoostedHadTopAndTopPair::findInitial(HepMC::ConstGen if(!prod) return part; +#ifdef HEPMC3 + for (auto p: prod->particles_in()) if (part->pdg_id() == p->pdg_id()) return findInitial(part); +#else HepMC::GenVertex::particle_iterator firstParent = prod->particles_begin(HepMC::parents); HepMC::GenVertex::particle_iterator endParent = prod->particles_end(HepMC::parents); for(;firstParent!=endParent; ++firstParent){ //if( part->barcode() < (*firstParent)->barcode() ) continue; /// protection for sherpa if( part->pdg_id() == (*firstParent)->pdg_id() ) return findInitial(*firstParent); } +#endif return part; } @@ -132,12 +140,10 @@ HepMC::ConstGenParticlePtr BoostedHadTopAndTopPair::findInitial(HepMC::ConstGen bool BoostedHadTopAndTopPair::isHadronic(HepMC::ConstGenParticlePtr part) const{ 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); - for(;firstChild!=endChild; ++firstChild){ - //if( part->barcode() > (*firstChild)->barcode() ) continue; /// protection for sherpa - if( abs((*firstChild)->pdg_id()) <= 5 ) return true; + if (end) { + for(auto firstChild: *end){ + if( std::abs(firstChild->pdg_id()) <= 5 ) return true; + } } return false; } @@ -148,12 +154,8 @@ bool BoostedHadTopAndTopPair::isFinalParticle(HepMC::ConstGenParticlePtr part) c auto end = part->end_vertex(); if(end){ int type = part->pdg_id(); - HepMC::GenVertex::particle_iterator firstChild = end->particles_begin(HepMC::children); - HepMC::GenVertex::particle_iterator endChild = end->particles_end(HepMC::children); - for(;firstChild!=endChild; ++firstChild){ - //if( part->barcode() > (*firstChild)->barcode() ) continue; /// protection for sherpa - int childtype = (*firstChild)->pdg_id(); - if( childtype == type ) return false; + for(auto firstChild: *end){ + if( firstChild->pdg_id() == type ) return false; } } return true; @@ -166,14 +168,12 @@ HepMC::FourVector BoostedHadTopAndTopPair::momentumBofW(HepMC::ConstGenParticleP auto prod = initpart->production_vertex(); HepMC::FourVector b(0,0,0,0); - - HepMC::GenVertex::particle_iterator firstChild = prod->particles_begin(HepMC::children); - HepMC::GenVertex::particle_iterator endChild = prod->particles_end(HepMC::children); - for(;firstChild!=endChild; ++firstChild){ - //if( part->barcode() > (*firstChild)->barcode() ) continue; /// protection for sherpa - if( abs( (*firstChild)->pdg_id() ) == 5 ){ - b.set((*firstChild)->momentum().x(), (*firstChild)->momentum().y(), (*firstChild)->momentum().z(), (*firstChild)->momentum().t()); +if (prod) { + for( auto firstChild: *prod){ + if( std::abs( firstChild->pdg_id() ) == 5 ){ + b.set(firstChild->momentum().x(), firstChild->momentum().y(), firstChild->momentum().z(), firstChild->momentum().t()); } } +} return b; } diff --git a/Generators/GeneratorFilters/src/DecayModeFilter.cxx b/Generators/GeneratorFilters/src/DecayModeFilter.cxx index d8624c3c88f6ba809cd23907dc9220e8e2cdce13..97952d560db7e4c64497bd330c71d4bf9bafada0 100644 --- a/Generators/GeneratorFilters/src/DecayModeFilter.cxx +++ b/Generators/GeneratorFilters/src/DecayModeFilter.cxx @@ -116,13 +116,24 @@ StatusCode DecayModeFilter::filterEvent() { McEventCollection::const_iterator itr; for (itr = events()->begin(); itr != events()->end(); ++itr) { const HepMC::GenEvent* theGenEvent = *(events()->begin()); +#ifdef HEPMC3 + auto vtx_begin = theGenEvent->vertices().begin(); + auto vtx_end = theGenEvent->vertices().end(); +#else HepMC::GenEvent::vertex_const_iterator vtx_begin = theGenEvent->vertices_begin(); HepMC::GenEvent::vertex_const_iterator vtx_end = theGenEvent->vertices_end(); +#endif for (auto vtx_iter=vtx_begin; vtx_iter!=vtx_end; ++vtx_iter) { // Look for initial vertex +#ifdef HEPMC3 + if ((*vtx_iter)->particles_in().size() != 2) continue; + if ((*vtx_iter)->particles_out().size() < 2) continue; + auto outParticle = (*vtx_iter)->particles_out().begin(); +#else if ((*vtx_iter)->particles_in_size() != 2) continue; if ((*vtx_iter)->particles_out_size() < 2) continue; auto outParticle = (*vtx_iter)->particles_out_const_begin(); +#endif auto parent1 = *outParticle; auto parent2 = *(++outParticle); ATH_MSG_DEBUG("Two in, two out: " << parent1->pdg_id() << " " << parent2->pdg_id()); @@ -184,24 +195,24 @@ StatusCode DecayModeFilter::filterEvent() { } -string DecayModeFilter::printChain(HepMC::GenParticlePtr parent) const { +string DecayModeFilter::printChain(HepMC::ConstGenParticlePtr parent) const { + if (!parent) return std::string(""); std::stringstream ss; - ss << " " << abs(parent->pdg_id()) << " -> "; - HepMC::GenParticlePtr foundChild(NULL); + ss << " " << std::abs(parent->pdg_id()) << " -> "; + HepMC::ConstGenParticlePtr 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); - for (; child != end_child; ++child) { - if (abs((*child)->pdg_id()) < 1000) SMchild_PDG = abs((*child)->pdg_id()); - else foundChild = *child; + if (!parent->end_vertex()) return ss.str(); + for ( auto child: *(parent->end_vertex())) { + if (std::abs(child->pdg_id()) < 1000) SMchild_PDG = std::abs(child->pdg_id()); + else foundChild = child; } - ss << (foundChild ? abs(foundChild->pdg_id()) : -9999) << " (" << SMchild_PDG << ") "; + ss << (foundChild ? std::abs(foundChild->pdg_id()) : -9999) << " (" << SMchild_PDG << ") "; if (foundChild && abs(foundChild->pdg_id()) != 1000022) ss << printChain(foundChild); return ss.str(); } -void DecayModeFilter::analyzeChain(HepMC::GenParticlePtr parent, bool& isDirect, bool& isBosonic, bool& isLeptonic, bool& isDirect3body) { +void DecayModeFilter::analyzeChain(HepMC::ConstGenParticlePtr 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,26 +249,28 @@ void DecayModeFilter::analyzeChain(HepMC::GenParticlePtr parent, bool& isDirect, } -void DecayModeFilter::countChain(HepMC::GenParticlePtr parent, int& length, +void DecayModeFilter::countChain(HepMC::ConstGenParticlePtr parent, int& length, int& Nchi2, int& NW,int& NZ,int& NH, int& Nse, int& Nsmu, int& Nstau, int& nChargedLeptons, int& nSMParticles) const { - HepMC::GenParticlePtr foundChild=nullptr; + HepMC::ConstGenParticlePtr 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); - for (; child != end_child; ++child) { - if (abs((*child)->pdg_id()) < 1000){ - SMchild_PDG = abs((*child)->pdg_id()); + if (!parent) return; + if (parent->end_vertex()) + { + for (auto child: *(parent->end_vertex())) { + if (std::abs(child->pdg_id()) < 1000){ + SMchild_PDG = std::abs(child->pdg_id()); nSMParticles++; } - if (abs((*child)->pdg_id()) > 1000000) foundChild = *child; + if (std::abs(child->pdg_id()) > 1000000) foundChild = child; + } } if (!foundChild) { length = 0; return; } - countPIDs(abs(foundChild->pdg_id()),SMchild_PDG, Nchi2, NW,NZ,NH, Nse,Nsmu,Nstau,nChargedLeptons); + countPIDs(std::abs(foundChild->pdg_id()),SMchild_PDG, Nchi2, NW,NZ,NH, Nse,Nsmu,Nstau,nChargedLeptons); if (!isIn(m_producedParticles_PDG,abs(foundChild->pdg_id()))) length += 1; //allow serveral strong-sparticle steps - if (!isIn( m_LSPs_PDG, abs(foundChild->pdg_id()))) { + if (!isIn( m_LSPs_PDG, std::abs(foundChild->pdg_id()))) { countChain(foundChild,length, Nchi2, NW,NZ,NH, Nse,Nsmu,Nstau,nChargedLeptons,nSMParticles); } } diff --git a/Generators/GeneratorFilters/src/DecayPositionFilter.cxx b/Generators/GeneratorFilters/src/DecayPositionFilter.cxx index dec2072405d6743a54dee291d10005201776afd8..c1005e3f6f7b73215d51fcc748fedd3b2719b356 100644 --- a/Generators/GeneratorFilters/src/DecayPositionFilter.cxx +++ b/Generators/GeneratorFilters/src/DecayPositionFilter.cxx @@ -35,32 +35,25 @@ StatusCode DecayPositionFilter::filterEvent() { int nPass = 0; for (McEventCollection::const_iterator itr = events()->begin(); itr != events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); - for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { - if (abs((*pitr)->pdg_id()) == m_PDGID) { - if ( fabs((*pitr)->momentum().pseudoRapidity()) ) { - + for (auto pitr: *genEvt) { + if (std::abs(pitr->pdg_id()) != m_PDGID) continue; + if ( !std::abs( pitr->momentum().pseudoRapidity()) ) continue;// AV:WHAT IS THIS? // Count only particles not decaying to themselves - bool notSelfDecay = true; - if ((*pitr)->end_vertex()) { - HepMC::GenVertex::particle_iterator child = (*pitr)->end_vertex()->particles_begin(HepMC::children); - HepMC::GenVertex::particle_iterator childE = (*pitr)->end_vertex()->particles_end(HepMC::children); - for (; child != childE; ++child) { - if ( (*child)->pdg_id() == (*pitr)->pdg_id() && (*child)->barcode()!=(*pitr)->barcode() && (*child)->barcode() < 100000) { + bool notSelfDecay = true; + if (!pitr->end_vertex()) continue; + for ( auto child: *(pitr->end_vertex())) { + if ( child->pdg_id() == pitr->pdg_id() && HepMC::barcode(child)!=HepMC::barcode(pitr) && HepMC::barcode(child) < 100000) { notSelfDecay = false; break; } - } - if(notSelfDecay){ - - HepMC::GenVertexPtr vtx = (*pitr)->end_vertex(); - float x = vtx->position().x(); - float y = vtx->position().y(); - float Rdecay = sqrt(x*x + y*y); - if(Rdecay < m_RCut ) nPass++; - } - } - } - } + } + if(notSelfDecay){ + auto vtx = pitr->end_vertex(); + double x = vtx->position().x(); + double y = vtx->position().y(); + double Rdecay = std::sqrt(x*x + y*y); + if(Rdecay < m_RCut ) nPass++; + } } } setFilterPassed(nPass == m_MinPass); diff --git a/Generators/GeneratorFilters/src/DecaysFinalStateFilter.cxx b/Generators/GeneratorFilters/src/DecaysFinalStateFilter.cxx index f68e50cee483de745e6a9fd1b17d8df1498996e6..667dd2cc81f11934684f5b206de849276e42d463 100644 --- a/Generators/GeneratorFilters/src/DecaysFinalStateFilter.cxx +++ b/Generators/GeneratorFilters/src/DecaysFinalStateFilter.cxx @@ -56,23 +56,19 @@ StatusCode DecaysFinalStateFilter::filterEvent() { for (itr = events()->begin(); itr != events()->end(); ++itr) { const HepMC::GenEvent* genEvt = *itr; - // Loop over all particles in event - HepMC::GenEvent::particle_const_iterator pitr; - for (pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr ) { + for (auto part: *genEvt){ // look only at the allowed parents (e.g. W, Z) bool allowedParent = false; for (size_t i=0; i<m_PDGAllowedParents.size(); ++i) { - if ( (*pitr)->pdg_id() == m_PDGAllowedParents[i]) allowedParent = true; + if ( part->pdg_id() == m_PDGAllowedParents[i]) allowedParent = true; } if (!allowedParent) continue; - auto vtx = (*pitr)->end_vertex(); - if (!vtx) continue; + if (!part->end_vertex()) continue; - for (HepMC::GenVertex::particles_out_const_iterator opitr = vtx->particles_out_const_begin(); - opitr != vtx->particles_out_const_end(); ++opitr) { - int apid = abs((*opitr)->pdg_id()); + for (auto opitr: *(part->end_vertex())) { + int apid = std::abs(opitr->pdg_id()); if (apid == 1 || apid == 2 || apid == 3 || apid == 4 || apid ==5) nQuarks++; if (apid == 11 || apid == 13 || apid == 15) nChargedLeptons++; if (apid == 12 || apid == 14 || apid == 16) nNeutrinos++; diff --git a/Generators/GeneratorFilters/src/DirectPhotonFilter.cxx b/Generators/GeneratorFilters/src/DirectPhotonFilter.cxx index 5b527cbf4f113c2d5c2dc5800de06c8242afeb94..6854950ad8b0969c03493660487d86281b5d5b23 100644 --- a/Generators/GeneratorFilters/src/DirectPhotonFilter.cxx +++ b/Generators/GeneratorFilters/src/DirectPhotonFilter.cxx @@ -25,7 +25,71 @@ StatusCode DirectPhotonFilter::filterEvent() { for (itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); ATH_MSG_DEBUG("----->>> Process : " << HepMC::signal_process_id(genEvt)); +#ifdef HEPMC3 + for (auto pitr: genEvt->particles()) { + if (pitr->pdg_id() == 22) { + if( (pitr->momentum().perp() >= m_Ptmin) && (pitr->momentum().perp() <= m_Ptmax) && + std::abs(pitr->momentum().pseudoRapidity()) <= m_EtaRange){ + ATH_MSG_DEBUG("Generic photon found with status = " << pitr->status() << " " << HepMC::barcode(pitr)); + auto CandProdVertex = pitr->production_vertex(); + ATH_MSG_DEBUG("Candidate production vertex ID = " << CandProdVertex->id()); + ATH_MSG_DEBUG("Candidate production vertex barcode = " << HepMC::barcode(CandProdVertex)); + for (auto thisChild: pitr->production_vertex()->particles_out()) { + ATH_MSG_DEBUG("Looping on Production (children) vertex : " << thisChild->pdg_id() << " " << HepMC::barcode(thisChild)); + } + for (auto thisChild1: pitr->production_vertex()->particles_in()) { + ATH_MSG_DEBUG("Looping on Production (parents) vertex : " << thisChild1->pdg_id() << " " << HepMC::barcode(thisChild1)); + } + } + } + // Check for a photon with desired kinematics + if (pitr->pdg_id() == 22) { + if( pitr->status() == 1 && + (pitr->momentum().perp() >= m_Ptmin) && (pitr->momentum().perp() <= m_Ptmax) && + std::abs(pitr->momentum().pseudoRapidity()) <= m_EtaRange){ + // The following lines are for cross checking purpose when using different generators + auto CandProdVertex = pitr->production_vertex(); + ATH_MSG_DEBUG("Candidate production vertex ID = " << CandProdVertex->id()); + ATH_MSG_DEBUG("Candidate production vertex barcode = " << HepMC::barcode(CandProdVertex)); + for(auto thisChild: pitr->production_vertex()->particles_out() ) { + ATH_MSG_DEBUG("Looping on Production (children) vertex : " << thisChild->pdg_id() << " " << HepMC::barcode(thisChild)); + } + /////////////////////////////////////////////////////////////////////////////////////////////// + // + // 1) once a status = 1 photon is found check where it comes from : loop on incoming particle + // + // Pythia : - a photon from HP comes out with status=3 and then turned into a status = 1 photon + // - coming from the status-3 photon. + // : - a photon from brem comes out directly with a status=1 + // Herwig : - NOT CHECKED on HP ! + // - a photon from brem comes out with different status but always turned into a + // status=1 photon at the end coming from a photon with a different status. + // + // So requiring a status=1 photon coming from q/CLHEP::g saves brem photons in Pythia. Requiring + // a status=1 photon coming from a photon should save HP photons in Pythia and Brem in + // Herwig + // + // 2) the second option is to ask for a status = 1 photon which doesn't come from a PDG>100 + // particle. In this way we should veto 'background photon' + // + ////////////////////////////////////////////////////////////////////////////////////////////// + bool fromHadron(false); + for ( auto thisChild1: pitr->production_vertex()->particles_in()) { + int pdgindex = std::abs(thisChild1->pdg_id()); + ATH_MSG_DEBUG("Looping on Production (parents) vertex : " << thisChild1->pdg_id() << " " << HepMC::barcode(thisChild1)); + if (pdgindex > 100) { + fromHadron = true; + if (m_AllowSUSYDecay && ( (pdgindex > 1000000 && pdgindex < 1000040) || (pdgindex > 2000000 && pdgindex < 2000016) ) ) fromHadron = false; + ATH_MSG_DEBUG("event kept"); + } + } + if (!fromHadron) NPhotons++; + + } // if( (*pitr)->status()==1 && ... + } + } +#else for (HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); pitr!=genEvt->particles_end(); ++pitr) { if (((*pitr)->pdg_id() == 22)) { if( ((*pitr)->momentum().perp() >= m_Ptmin) && ((*pitr)->momentum().perp() <= m_Ptmax) && @@ -109,6 +173,7 @@ StatusCode DirectPhotonFilter::filterEvent() { } // if( (*pitr)->status()==1 && ... } // if( ((*pitr)->pdg_id() == 22) ) } +#endif } if (NPhotons >= m_NPhotons) return StatusCode::SUCCESS; diff --git a/Generators/GeneratorFilters/src/HTFilter.cxx b/Generators/GeneratorFilters/src/HTFilter.cxx index 2ba7c8e4ebeadcefb677a905d8a5e49b8758e558..8f161fd3db6ae97e409cdc807241ee464c4e698c 100644 --- a/Generators/GeneratorFilters/src/HTFilter.cxx +++ b/Generators/GeneratorFilters/src/HTFilter.cxx @@ -110,25 +110,25 @@ StatusCode HTFilter::filterEvent() { 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){ - if ( !(*iter) ) continue; - int pdgid = (*iter)->pdg_id(); - if (m_UseNu && MC::PID::isNeutrino(pdgid) && MC::isGenStable(*iter)) { - if( fromWZ(*iter) || fromTau(*iter) ) { - HT += (*iter)->momentum().perp(); + for (auto iter: *((*mecc)[0])){ + if ( !iter ) continue; + int pdgid = iter->pdg_id(); + if (m_UseNu && MC::PID::isNeutrino(pdgid) && MC::isGenStable(iter)) { + if( fromWZ(iter) || fromTau(iter) ) { + HT += iter->momentum().perp(); } } // pick muons and electrons specifically -- isLepton selects both charged leptons and neutrinos - if (m_UseLep && (abs(pdgid)==11 || abs(pdgid)==13) && MC::isGenStable(*iter) - && (*iter)->momentum().perp()>m_MinLepPt*CLHEP::GeV && fabs((*iter)->momentum().eta())<m_MaxLepEta) { - bool isFromWZ = fromWZ(*iter); - if( isFromWZ || fromTau(*iter) ) { - ATH_MSG_VERBOSE("Adding W/Z/tau lepton with pt " << (*iter)->momentum().perp() - << ", eta " << (*iter)->momentum().eta() - << ", phi " << (*iter)->momentum().phi() - << ", status " << (*iter)->status() + if (m_UseLep && (std::abs(pdgid)==11 || std::abs(pdgid)==13) && MC::isGenStable(iter) + && (iter)->momentum().perp()>m_MinLepPt*CLHEP::GeV && std::abs(iter->momentum().eta())<m_MaxLepEta) { + bool isFromWZ = fromWZ(iter); + if( isFromWZ || fromTau(iter) ) { + ATH_MSG_VERBOSE("Adding W/Z/tau lepton with pt " << iter->momentum().perp() + << ", eta " << iter->momentum().eta() + << ", phi " << iter->momentum().phi() + << ", status " << iter->status() << ", pdgId " << pdgid); - HT += (*iter)->momentum().perp(); + HT += iter->momentum().perp(); } } } @@ -149,7 +149,7 @@ StatusCode HTFilter::filterEvent() { return StatusCode::SUCCESS; } -bool HTFilter::fromWZ( const HepMC::GenParticlePtr part ) const +bool HTFilter::fromWZ(HepMC::ConstGenParticlePtr 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 @@ -163,6 +163,15 @@ bool HTFilter::fromWZ( const HepMC::GenParticlePtr part ) const // generators do not include the W or Z in the truth record (like Sherpa) // This code, like the code before it, really assumes one incoming particle per vertex... if (!part->production_vertex()) return false; +#ifdef HEPMC3 + for (auto iter: part->production_vertex()->particles_in()){ + int parent_pdgid = iter->pdg_id(); + if (MC::PID::isW(parent_pdgid) || MC::PID::isZ(parent_pdgid)) return true; + if (MC::PID::isHadron( parent_pdgid ) ) return false; + if ( std::abs( parent_pdgid ) < 9 ) return true; + if ( parent_pdgid == part->pdg_id() ) return fromWZ( iter ); + } +#else for (HepMC::GenVertex::particles_in_const_iterator iter=part->production_vertex()->particles_in_const_begin(); iter!=part->production_vertex()->particles_in_const_end();++iter){ int parent_pdgid = (*iter)->pdg_id(); @@ -171,10 +180,11 @@ bool HTFilter::fromWZ( const HepMC::GenParticlePtr part ) const if ( abs( parent_pdgid ) < 9 ) return true; if ( parent_pdgid == part->pdg_id() ) return fromWZ( *iter ); } +#endif return false; } -bool HTFilter::fromTau( const HepMC::GenParticlePtr part ) const +bool HTFilter::fromTau(HepMC::ConstGenParticlePtr 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 @@ -186,6 +196,14 @@ bool HTFilter::fromTau( const HepMC::GenParticlePtr part ) const // Find a hadron or parton -> return false // This code, like the code before it, really assumes one incoming particle per vertex... if (!part->production_vertex()) return false; +#ifdef HEPMC3 + for (auto iter: part->production_vertex()->particles_in()){ + int parent_pdgid = iter->pdg_id(); + if ( std::abs( parent_pdgid ) == 15 ) return true; + if (MC::PID::isHadron( parent_pdgid ) || std::abs( parent_pdgid ) < 9 ) return false; + if ( parent_pdgid == part->pdg_id() ) return fromTau( iter ); + } +#else for (HepMC::GenVertex::particles_in_const_iterator iter=part->production_vertex()->particles_in_const_begin(); iter!=part->production_vertex()->particles_in_const_end();++iter){ int parent_pdgid = (*iter)->pdg_id(); @@ -193,5 +211,6 @@ bool HTFilter::fromTau( const HepMC::GenParticlePtr part ) const if (MC::PID::isHadron( parent_pdgid ) || abs( parent_pdgid ) < 9 ) return false; if ( parent_pdgid == part->pdg_id() ) return fromTau( *iter ); } +#endif return false; } diff --git a/Generators/GeneratorFilters/src/HiggsFilter.cxx b/Generators/GeneratorFilters/src/HiggsFilter.cxx index bf11e5b3a072fd0e91b95d16b942380e7df25993..be99a51b7f67ecbcfe86e02ea97311279ebc3b7f 100644 --- a/Generators/GeneratorFilters/src/HiggsFilter.cxx +++ b/Generators/GeneratorFilters/src/HiggsFilter.cxx @@ -58,49 +58,27 @@ StatusCode HiggsFilter::filterEvent() { // Loop over all particles in the event const HepMC::GenEvent* genEvt = (*itr); - HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); - for(; pitr!=genEvt->particles_end(); ++pitr ){ - - // Work only with tops - if( std::abs((*pitr)->pdg_id()) == 25 ){ - - N_Higgs_all++; - - int n_daughters = 0; - - HepMC::GenParticle * mcpart = (*pitr); - const HepMC::GenVertex * decayVtx = mcpart->end_vertex(); - + for(auto pitr: *genEvt){ + if( std::abs(pitr->pdg_id()) != 25 ) continue; + N_Higgs_all++; + auto decayVtx = pitr->end_vertex(); // verify if we got a valid pointer and retrieve the number of daughters - if ( decayVtx != 0 ) { - n_daughters = decayVtx->particles_out_size(); - } - - // For this analysis we are not interested in t->t MC structures, only in decays - if( n_daughters >= 2 ){ - - HepMC::GenVertex::particles_in_const_iterator child_mcpartItr = decayVtx->particles_out_const_begin(); - HepMC::GenVertex::particles_in_const_iterator child_mcpartItrE = decayVtx->particles_out_const_end(); - - for (; child_mcpartItr != child_mcpartItrE; ++child_mcpartItr) { - - HepMC::GenParticle * child_mcpart = (*child_mcpartItr); - - // Implicitly, I assume that tops always decay to W X - if ( std::abs(child_mcpart->pdg_id()) == 5 ){ - - if ( (*pitr)->pdg_id() == 25 ) { + if (!decayVtx ) continue; +#ifdef HEPMC3 + int n_daughters = decayVtx->particles_out().size(); +#else + int n_daughters = decayVtx->particles_out_size(); +#endif + if( n_daughters < 2 ) continue; + for ( auto child_mcpart: *decayVtx) { + if ( std::abs(child_mcpart->pdg_id()) != 5 ) continue; + if ( pitr->pdg_id() == 25 ) { N_Higgs++; } - - if( ((*pitr)->momentum().perp() >=m_Ptmin && (*pitr)->momentum().perp() <m_Ptmax ) ){ + if( (pitr->momentum().perp() >=m_Ptmin && pitr->momentum().perp() <m_Ptmax ) ){ N_pt_above_cut++; } - - }//b bbar decay - }//child loop - }// only decaying Higgs - }//Higgs + }//child loop } } diff --git a/Generators/GeneratorFilters/src/HtoVVFilter.cxx b/Generators/GeneratorFilters/src/HtoVVFilter.cxx index d662ff4d1addffc4c48597c97d9ea6a4e2d41579..0d2c48cf7a272ec7be798498df43598309604913 100644 --- a/Generators/GeneratorFilters/src/HtoVVFilter.cxx +++ b/Generators/GeneratorFilters/src/HtoVVFilter.cxx @@ -55,6 +55,29 @@ StatusCode HtoVVFilter::filterEvent() { int nGoodParent = 0; for (itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); +#ifdef HEPMC3 + for (auto pitr: genEvt->particles()) { + if (std::abs(pitr->pdg_id()) != m_PDGParent || pitr->status() != 3) continue; + bool isGrandParentOK = false; + for (auto thisMother: pitr->production_vertex()->particles_in()) { + ATH_MSG_DEBUG(" Parent " << pitr->pdg_id() << " barcode = " << HepMC::barcode(pitr) << " status = " << pitr->status()); + ATH_MSG_DEBUG(" a Parent mother " << thisMother->pdg_id()<< " barc = " << HepMC::barcode(thisMother)); + if ( thisMother->pdg_id() == m_PDGGrandParent ) isGrandParentOK = true; + } + ATH_MSG_DEBUG(" Grand Parent is OK? " << isGrandParentOK); + if (!isGrandParentOK) continue; + ++nGoodParent; + for (auto thisChild: pitr->end_vertex()->particles_out()) { + ATH_MSG_DEBUG(" child " << thisChild->pdg_id()); + if (!okPDGChild1) { + if (find(m_PDGChild1.begin(),m_PDGChild1.end(),std::abs(thisChild->pdg_id()))!=m_PDGChild1.end()) okPDGChild1 = true; + } + if (!okPDGChild2) { + if (find(m_PDGChild2.begin(),m_PDGChild2.end(),std::abs(thisChild->pdg_id()))!=m_PDGChild2.end()) okPDGChild2 = true; + } + } + } +#else for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { if (abs((*pitr)->pdg_id()) == m_PDGParent && (*pitr)->status() == 3) { HepMC::GenVertex::particle_iterator firstMother = (*pitr)->production_vertex()->particles_begin(HepMC::parents); @@ -88,6 +111,7 @@ StatusCode HtoVVFilter::filterEvent() { } } } +#endif } ATH_MSG_DEBUG("Result " << nGoodParent << " " << okPDGChild1 << " " << okPDGChild2); diff --git a/Generators/GeneratorFilters/src/LeptonPairFilter.cxx b/Generators/GeneratorFilters/src/LeptonPairFilter.cxx index 8068ca61e47d2133983a694ec8f3ada09d3095e1..066e842e310d84eb7bd28d287a7a937a4ef579d8 100644 --- a/Generators/GeneratorFilters/src/LeptonPairFilter.cxx +++ b/Generators/GeneratorFilters/src/LeptonPairFilter.cxx @@ -112,6 +112,44 @@ StatusCode LeptonPairFilter::filterEvent() { for (itr = events()->begin(); itr!=events()->end(); ++itr) { // Loop over all particles in the event const HepMC::GenEvent* genEvt = (*itr); +#ifdef HEPMC3 + for(auto pitr: genEvt->particles()) { + if( pitr->status()!=1 ) continue; + // check stable particles only + // We do not place requirements on their origins (updated: optionally rejecting hadron decays) + // save pdg ids of found leptons + // do not consider taus + if( std::abs(pitr->pdg_id()) != 11 && std::abs(pitr->pdg_id()) != 13) continue; + //only consider leptons which satisfy pt and eta requirements + if( (pitr->momentum().perp() < m_Ptmin) || std::abs(pitr->momentum().pseudoRapidity()) > m_EtaRange) continue; + if(m_onlyMassiveParents) + { + auto p = pitr; + bool massiveParent = false; + while(p) + { + auto vxp = p->production_vertex(); + if(!vxp) break; + if(vxp->particles_in().size()!=1) break; + p = vxp->particles_in().at(0); + const int pdg = std::abs(p->pdg_id()); + if(!((pdg>=11 && pdg<=16) || pdg==22)) + { + massiveParent = (p->generated_mass()>20000); + break; + } + } + if(!massiveParent) continue; + } + vLeptonPDGIDs.push_back(pitr->pdg_id()); + vLeptonPt.push_back(pitr->momentum().perp()); + vLeptonEta.push_back(pitr->momentum().pseudoRapidity()); + + std::vector<int> parentPDG_tmp; + for(auto thisParent: pitr->production_vertex()->particles_in()) parentPDG_tmp.push_back(thisParent->pdg_id()); + vLeptonParentPDGIDs.push_back(parentPDG_tmp); + } +#else for(HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); pitr!=genEvt->particles_end(); ++pitr ) if( (*pitr)->status()==1 ) @@ -160,6 +198,7 @@ StatusCode LeptonPairFilter::filterEvent() { } }//end if pdg_id }//end if status==1 +#endif }//end loop over collections int nLeptons = vLeptonPDGIDs.size(); diff --git a/Generators/GeneratorFilters/src/MissingEtFilter.cxx b/Generators/GeneratorFilters/src/MissingEtFilter.cxx index c15a979a9fb6b4bc72e6c453c0148828b66f67df..fa478d14add76066edb0514feafa43e4211cc53f 100644 --- a/Generators/GeneratorFilters/src/MissingEtFilter.cxx +++ b/Generators/GeneratorFilters/src/MissingEtFilter.cxx @@ -52,6 +52,15 @@ bool MissingEtFilter::fromWZ( HepMC::ConstGenParticlePtr part ) const // generators do not include the W or Z in the truth record (like Sherpa) // This code, like the code before it, really assumes one incoming particle per vertex... if (!part->production_vertex()) return false; +#ifdef HEPMC3 + for (auto iter: part->production_vertex()->particles_in()){ + int parent_pdgid = iter->pdg_id(); + if (MC::PID::isW(parent_pdgid) || MC::PID::isZ(parent_pdgid)) return true; + if (MC::PID::isHadron( parent_pdgid ) ) return false; + if ( std::abs( parent_pdgid ) < 9 ) return true; + if ( parent_pdgid == part->pdg_id() ) return fromWZ( iter ); + } +#else for (HepMC::GenVertex::particles_in_const_iterator iter=part->production_vertex()->particles_in_const_begin(); iter!=part->production_vertex()->particles_in_const_end();++iter){ int parent_pdgid = (*iter)->pdg_id(); @@ -60,6 +69,7 @@ bool MissingEtFilter::fromWZ( HepMC::ConstGenParticlePtr part ) const if ( abs( parent_pdgid ) < 9 ) return true; if ( parent_pdgid == part->pdg_id() ) return fromWZ( *iter ); } +#endif return false; } @@ -75,6 +85,14 @@ bool MissingEtFilter::fromTau( HepMC::ConstGenParticlePtr part ) const // Find a hadron or parton -> return false // This code, like the code before it, really assumes one incoming particle per vertex... if (!part->production_vertex()) return false; +#ifdef HEPMC3 + for (auto iter: part->production_vertex()->particles_in()){ + int parent_pdgid = iter->pdg_id(); + if ( std::abs( parent_pdgid ) == 15 && fromWZ(iter)) return true; + if (MC::PID::isHadron( parent_pdgid ) || abs( parent_pdgid ) < 9 ) return false; + if ( parent_pdgid == part->pdg_id() ) return fromTau( iter ); + } +#else for (HepMC::GenVertex::particles_in_const_iterator iter=part->production_vertex()->particles_in_const_begin(); iter!=part->production_vertex()->particles_in_const_end();++iter){ int parent_pdgid = (*iter)->pdg_id(); @@ -82,5 +100,6 @@ bool MissingEtFilter::fromTau( HepMC::ConstGenParticlePtr part ) const if (MC::PID::isHadron( parent_pdgid ) || abs( parent_pdgid ) < 9 ) return false; if ( parent_pdgid == part->pdg_id() ) return fromTau( *iter ); } +#endif return false; } diff --git a/Generators/GeneratorFilters/src/MultiElecMuTauFilter.cxx b/Generators/GeneratorFilters/src/MultiElecMuTauFilter.cxx index 7f73e8ad9538e53fac137f9ff10dd8744cca0af5..e98b52667b48428dd2914bc0dca512b6ea0a08e9 100644 --- a/Generators/GeneratorFilters/src/MultiElecMuTauFilter.cxx +++ b/Generators/GeneratorFilters/src/MultiElecMuTauFilter.cxx @@ -22,14 +22,14 @@ StatusCode MultiElecMuTauFilter::filterEvent() { McEventCollection::const_iterator itr; for (itr = events()->begin(); itr != events()->end(); ++itr) { const HepMC::GenEvent* genEvt = *itr; - for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { + for (auto pitr: *genEvt) { // Electrons and muons - if ((*pitr)->status() == 1 && (abs((*pitr)->pdg_id()) == 11 || abs((*pitr)->pdg_id()) == 13)) { - if ((*pitr)->momentum().perp() >= m_minPt && fabs((*pitr)->momentum().pseudoRapidity()) <= m_maxEta) { - ATH_MSG_DEBUG("Found lepton with PDG ID = " << (*pitr)->pdg_id() - << ", status = " << (*pitr)->status() - << ", pt = " << (*pitr)->momentum().perp() - << ", eta = " << (*pitr)->momentum().pseudoRapidity()); + if (pitr->status() == 1 && (std::abs(pitr->pdg_id()) == 11 || std::abs(pitr->pdg_id()) == 13)) { + if (pitr->momentum().perp() >= m_minPt && std::abs(pitr->momentum().pseudoRapidity()) <= m_maxEta) { + ATH_MSG_DEBUG("Found lepton with PDG ID = " << pitr->pdg_id() + << ", status = " << pitr->status() + << ", pt = " << pitr->momentum().perp() + << ", eta = " << pitr->momentum().pseudoRapidity()); numLeptons++; } continue; @@ -37,43 +37,42 @@ StatusCode MultiElecMuTauFilter::filterEvent() { // Look for Hadronic taus (leptonic ones will be saved by above) that have status!=3 and don't decay to another tau (FSR) if (!m_incHadTau) continue; - - HepMC::GenParticle *tau(0), *taunu(0); - if (abs((*pitr)->pdg_id()) == 15 && (*pitr)->status() != 3) { - tau = *pitr; - + HepMC::ConstGenParticlePtr tau= nullptr; + HepMC::ConstGenParticlePtr taunu= nullptr; + if (std::abs(pitr->pdg_id()) != 15 || pitr->status() == 3) continue; + tau = pitr; + if(!tau->end_vertex()) continue; // Loop over children and: // 1. Find if it is hadronic (i.e. no decay lepton). // 2. Veto tau -> tau (FSR) // 3. Store the tau neutino to calculate the visible momentum - HepMC::GenVertex::particles_out_const_iterator citr; - for (citr = tau->end_vertex()->particles_out_const_begin(); citr != tau->end_vertex()->particles_out_const_end(); citr++) { + for (auto citr: *(tau->end_vertex())) { // Ignore tau -> tau (FSR) - if ((*pitr)->pdg_id() == (*citr)->pdg_id()) { + if (pitr->pdg_id() == citr->pdg_id()) { ATH_MSG_DEBUG("FSR tau decay. Ignoring!"); - tau = 0; + tau = nullptr; break; } // Ignore leptonic decays - if (abs((*citr)->pdg_id()) == 13 || abs((*citr)->pdg_id()) == 11) { - tau = 0; + if (std::abs(citr->pdg_id()) == 13 || std::abs(citr->pdg_id()) == 11) { + tau = nullptr; break; } // Find tau decay nu - if (std::abs((*citr)->pdg_id()) == 16) { - taunu = *citr; + if (std::abs(citr->pdg_id()) == 16) { + taunu = citr; } } - if (tau) { + if (tau && taunu) { // Good hadronic decay CLHEP::HepLorentzVector tauVisMom = CLHEP::HepLorentzVector(tau->momentum().px() - taunu->momentum().px(), tau->momentum().py() - taunu->momentum().py(), tau->momentum().pz() - taunu->momentum().pz(), tau->momentum().e() - taunu->momentum().e()); - if (tauVisMom.perp() >= m_minVisPtHadTau && fabs(tauVisMom.pseudoRapidity()) <= m_maxEta) { + if (tauVisMom.perp() >= m_minVisPtHadTau && std::abs(tauVisMom.pseudoRapidity()) <= m_maxEta) { ATH_MSG_DEBUG("Found hadronic tau decay with PDG ID = " << tau->pdg_id() << ", status = " << tau->status() << ", vis pt = " << tauVisMom.perp() @@ -83,7 +82,6 @@ StatusCode MultiElecMuTauFilter::filterEvent() { } } - } } ATH_MSG_INFO("Found " << numLeptons << "Leptons"); diff --git a/Generators/GeneratorFilters/src/MultiHiggsFilter.cxx b/Generators/GeneratorFilters/src/MultiHiggsFilter.cxx index 7b22b594f757f6e829f60e37e1d7e7f635f9607e..13adf90914596ab15c40a86996ec99ab11e5b2ba 100644 --- a/Generators/GeneratorFilters/src/MultiHiggsFilter.cxx +++ b/Generators/GeneratorFilters/src/MultiHiggsFilter.cxx @@ -75,6 +75,20 @@ StatusCode MultiHiggsFilter::filterEvent() { for (itr = events()->begin(); itr!=events()->end(); ++itr) { // Loop over all particles in the event const HepMC::GenEvent* genEvt = (*itr); +#ifdef HEPMC3 + for(auto pitr: *genEvt) { + if (!( std::abs(pitr->pdg_id()) == 25 && ( pitr->status()==m_Status || !m_UseStatus))) continue; + bool hasHiggsParent = false; + for(auto thisMother: pitr->production_vertex()->particles_in()){ + ATH_MSG_DEBUG(" Parent " << pitr->pdg_id() << " barcode = " << HepMC::barcode(pitr) << " status = " << pitr->status()); + ATH_MSG_DEBUG(" a Parent mother " << thisMother->pdg_id()<< " barc = " << HepMC::barcode(thisMother)); + if( thisMother->pdg_id() == 25 ) hasHiggsParent = true; + } + ATH_MSG_DEBUG(" has Higgs parent? " << hasHiggsParent); + if (hasHiggsParent) continue; + ++nGoodParent; + } +#else for(HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); pitr!=genEvt->particles_end(); ++pitr ) { if( abs((*pitr)->pdg_id()) == 25 && ( (*pitr)->status()==m_Status || !m_UseStatus)){ @@ -94,6 +108,7 @@ StatusCode MultiHiggsFilter::filterEvent() { ++nGoodParent; } } +#endif } ATH_MSG_INFO("Result " << nGoodParent << " Higgs "); diff --git a/Generators/GeneratorFilters/src/ParentChildFilter.cxx b/Generators/GeneratorFilters/src/ParentChildFilter.cxx index 6c6bc806e368cd8586af49c8fd9c325f289d5c40..297997614a6b10a9245da2c11717c0db2cf69a08 100644 --- a/Generators/GeneratorFilters/src/ParentChildFilter.cxx +++ b/Generators/GeneratorFilters/src/ParentChildFilter.cxx @@ -38,28 +38,25 @@ StatusCode ParentChildFilter::filterInitialize() { StatusCode ParentChildFilter::filterEvent() { for (McEventCollection::const_iterator itr = events()->begin(); itr != events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); - for (HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { + for (auto pitr: *genEvt) { int okPDGParent = 0; - for (int i = 0; i < int(m_PDGParent.size()); i++) if (abs((*pitr)->pdg_id()) == m_PDGParent[i]) okPDGParent=1; + for (int i = 0; i < int(m_PDGParent.size()); i++) if (std::abs(pitr->pdg_id()) == m_PDGParent[i]) okPDGParent=1; if ( (m_PDGParent[0] == 0) || (okPDGParent - && (*pitr)->momentum().perp() >= m_PtMinParent - && ((*pitr)->momentum().perp() < m_PtMaxParent) - && ((*pitr)->momentum().m() >= m_MassMinParent) - && ((*pitr)->momentum().m() < m_MassMaxParent) - && fabs((*pitr)->momentum().eta()) < m_EtaRangeParent)) { + && pitr->momentum().perp() >= m_PtMinParent + && (pitr->momentum().perp() < m_PtMaxParent) + && (pitr->momentum().m() >= m_MassMinParent) + && (pitr->momentum().m() < m_MassMaxParent) + && std::abs(pitr->momentum().eta()) < m_EtaRangeParent)) { // Check if has end_vertex (skips initial protons) - if (!(*pitr)->end_vertex()) continue; + if (!pitr->end_vertex()) continue; // Child - HepMC::GenVertex::particle_iterator firstChild = (*pitr)->end_vertex()->particles_begin(HepMC::children); - HepMC::GenVertex::particle_iterator endChild = (*pitr)->end_vertex()->particles_end(HepMC::children); - HepMC::GenVertex::particle_iterator thisChild = firstChild; - for (; thisChild != endChild; ++thisChild) { + for (auto thisChild: *(pitr->end_vertex())) { int okPDGChild = 0; - for (int i=0; i < int(m_PDGChild.size()); i++) if (abs((*thisChild)->pdg_id()) == m_PDGChild[i]) okPDGChild=1; - if ( (*thisChild)->pdg_id() != (*pitr)->pdg_id() + for (int i=0; i < int(m_PDGChild.size()); i++) if (std::abs(thisChild->pdg_id()) == m_PDGChild[i]) okPDGChild=1; + if ( thisChild->pdg_id() != pitr->pdg_id() && (m_PDGChild[0] == 0 || okPDGChild) - && (*thisChild)->momentum().perp() > m_PtMinChild - && fabs((*thisChild)->momentum().eta()) < m_EtaRangeChild ) { + && thisChild->momentum().perp() > m_PtMinChild + && std::abs(thisChild->momentum().eta()) < m_EtaRangeChild ) { return StatusCode::SUCCESS; } } diff --git a/Generators/GeneratorFilters/src/ParentChildwStatusFilter.cxx b/Generators/GeneratorFilters/src/ParentChildwStatusFilter.cxx index e5ff7dca92455347dd4d45bae473a13131277430..25907b1e0eaf5d3f743e5ddc03c525b8b053e335 100644 --- a/Generators/GeneratorFilters/src/ParentChildwStatusFilter.cxx +++ b/Generators/GeneratorFilters/src/ParentChildwStatusFilter.cxx @@ -103,37 +103,31 @@ StatusCode ParentChildwStatusFilter::filterEvent() { for (itr = events()->begin(); itr != events()->end(); ++itr) { // Loop over all particles in the event const HepMC::GenEvent* genEvt = (*itr); - for(HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); - pitr!=genEvt->particles_end(); ++pitr ){ + for(auto pitr: *genEvt){ // Parent int okPDGParent=0; int okStatusParent=0; for(int i=0;i<int(m_PDGParent.size());i++) - if(abs((*pitr)->pdg_id()) == m_PDGParent[i]) okPDGParent=1; + if(std::abs(pitr->pdg_id()) == m_PDGParent[i]) okPDGParent=1; for(int i=0;i<int(m_StatusParent.size());i++) - if(abs((*pitr)->status()) == m_StatusParent[i]) okStatusParent=1; + if(std::abs(pitr->status()) == m_StatusParent[i]) okStatusParent=1; if( ( (m_PDGParent[0] == 0) || (okPDGParent && okStatusParent)) - && ((*pitr)->momentum().perp() >= m_PtMinParent) - && ((*pitr)->momentum().perp() < m_PtMaxParent) - && ((*pitr)->momentum().m() >= m_MassMinParent) - && ((*pitr)->momentum().m() < m_MassMaxParent) - && (fabs((*pitr)->momentum().eta()) < m_EtaRangeParent) ) { + && (pitr->momentum().perp() >= m_PtMinParent) + && (pitr->momentum().perp() < m_PtMaxParent) + && (pitr->momentum().m() >= m_MassMinParent) + && (pitr->momentum().m() < m_MassMaxParent) + && (std::abs(pitr->momentum().eta()) < m_EtaRangeParent) ) { //Check if has end_vertex (skips initial protons) - if(!((*pitr)->end_vertex())) continue; + if(!(pitr->end_vertex())) continue; // Child - HepMC::GenVertex::particle_iterator firstChild = - (*pitr)->end_vertex()->particles_begin(HepMC::children); - HepMC::GenVertex::particle_iterator endChild = - (*pitr)->end_vertex()->particles_end(HepMC::children); - HepMC::GenVertex::particle_iterator thisChild = firstChild; - for(; thisChild != endChild; ++thisChild){ + for(auto thisChild: *(pitr->end_vertex())){ int okPDGChild=0; for(int i=0;i<int(m_PDGChild.size());i++) - if(abs((*thisChild)->pdg_id()) == m_PDGChild[i]) okPDGChild=1; - if( ((*thisChild)->pdg_id() != (*pitr)->pdg_id() ) + if(std::abs(thisChild->pdg_id()) == m_PDGChild[i]) okPDGChild=1; + if( (thisChild->pdg_id() != pitr->pdg_id() ) && ( (m_PDGChild[0] == 0) || okPDGChild ) - && ((*thisChild)->momentum().perp() > m_PtMinChild) - && (fabs((*thisChild)->momentum().eta()) < m_EtaRangeChild) ) { + && (thisChild->momentum().perp() > m_PtMinChild) + && (std::abs(thisChild->momentum().eta()) < m_EtaRangeChild) ) { // appropriate Child found return StatusCode::SUCCESS; } diff --git a/Generators/GeneratorFilters/src/ParentTwoChildrenFilter.cxx b/Generators/GeneratorFilters/src/ParentTwoChildrenFilter.cxx index 555a27ce2698b0803c91ca0d5524b4770e4505db..0e760cb1546ad0c1b9faf70078ce1922389c5a04 100644 --- a/Generators/GeneratorFilters/src/ParentTwoChildrenFilter.cxx +++ b/Generators/GeneratorFilters/src/ParentTwoChildrenFilter.cxx @@ -40,35 +40,33 @@ StatusCode ParentTwoChildrenFilter::filterEvent() { } for (McEventCollection::const_iterator itr = events()->begin(); itr != events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); - for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { - int id = (*pitr)->pdg_id(); - if (abs(id) != m_PDGParent[0]) continue; - if ((*pitr)->momentum().perp() < m_PtMinParent) continue; + for (auto pitr: *genEvt) { + int id = pitr->pdg_id(); + if (std::abs(id) != m_PDGParent[0]) continue; + if (pitr->momentum().perp() < m_PtMinParent) continue; n_parents++; - - int n_daughters = 0; - HepMC::GenParticle* mcpart = (*pitr); - const HepMC::GenVertex* decayVtx = mcpart->end_vertex(); + HepMC::ConstGenVertexPtr decayVtx = pitr->end_vertex(); // Verify if we got a valid pointer and retrieve the number of daughters - if (decayVtx != 0) n_daughters = decayVtx->particles_out_size(); - if (n_daughters >= 2) { - HepMC::GenVertex::particle_iterator firstChild = (*pitr)->end_vertex()->particles_begin(HepMC::children); - HepMC::GenVertex::particle_iterator endChild = (*pitr)->end_vertex()->particles_end(HepMC::children); - HepMC::GenVertex::particle_iterator thisChild = firstChild; - for(; thisChild != endChild; ++thisChild) { - ATH_MSG_DEBUG(" ParentTwoChildrenFilter: parent ==> " <<(*pitr)->pdg_id() << " child ===> " <<(*thisChild)->pdg_id()); + if (!decayVtx) continue; +#ifdef HEPMC3 + int n_daughters = decayVtx->particles_out().size(); +#else + int n_daughters = decayVtx->particles_out_size(); +#endif + if (n_daughters < 2) continue; + for( auto thisChild: *decayVtx ) { + ATH_MSG_DEBUG(" ParentTwoChildrenFilter: parent ==> " <<pitr->pdg_id() << " child ===> " <<thisChild->pdg_id()); for (int i = 0; i < 2; i++) { - if ( abs((*thisChild)->pdg_id()) == m_PDGChild[i] ){ - if ( (*thisChild)->pdg_id() == m_PDGChild[i] ){ - if( ((*thisChild)->momentum().perp() >= m_PtMinChild) )N_Child[i][0]++; + if ( std::abs(thisChild->pdg_id()) == m_PDGChild[i] ){ + if ( thisChild->pdg_id() == m_PDGChild[i] ){ + if (thisChild->momentum().perp() >= m_PtMinChild) N_Child[i][0]++; } - if ( (*thisChild)->pdg_id() == -m_PDGChild[i] ){ - if( ((*thisChild)->momentum().perp() >= m_PtMinChild) )N_Child[i][1]++; + if ( thisChild->pdg_id() == -m_PDGChild[i] ){ + if (thisChild->momentum().perp() >= m_PtMinChild) N_Child[i][1]++; } } } } - } } } setFilterPassed(N_Child[0][0] >= 1 && N_Child[0][1] >= 1 && N_Child[1][0] >= 1 && N_Child[1][1] >= 1); diff --git a/Generators/GeneratorFilters/src/ParticleFilter.cxx b/Generators/GeneratorFilters/src/ParticleFilter.cxx index 7964aa90e54b7fb8cf9f5f62dd4b8a7f45a0e615..72727d9a290ee4ba0c81c723ea652c187c4afa97 100644 --- a/Generators/GeneratorFilters/src/ParticleFilter.cxx +++ b/Generators/GeneratorFilters/src/ParticleFilter.cxx @@ -35,21 +35,16 @@ StatusCode ParticleFilter::filterEvent() { int nParts = 0; for (McEventCollection::const_iterator itr = events()->begin(); itr != events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); - for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { - if (abs((*pitr)->pdg_id()) == m_PDGID && (m_StatusReq == -1 || (*pitr)->status() == m_StatusReq)) { - if ((*pitr)->momentum().perp() >= m_Ptmin && - fabs((*pitr)->momentum().pseudoRapidity()) <= m_EtaRange && - (*pitr)->momentum().e() <= m_EnergyRange) { - if ((!m_Exclusive)&&(m_MinParts == 1)) // Found at least one particle and we have an inclusive requirement - return StatusCode::SUCCESS; - else { + for (auto pitr: *genEvt) { + if (std::abs(pitr->pdg_id()) != m_PDGID || !(m_StatusReq == -1 || pitr->status() == m_StatusReq)) continue; + if (pitr->momentum().perp() >= m_Ptmin && std::abs(pitr->momentum().pseudoRapidity()) <= m_EtaRange && pitr->momentum().e() <= m_EnergyRange) { + if ((!m_Exclusive)&&(m_MinParts == 1)) return StatusCode::SUCCESS; // Found at least one particle and we have an inclusive requirement + // Count only particles not decaying to themselves bool notSelfDecay = true; - if ((*pitr)->end_vertex()) { - HepMC::GenVertex::particle_iterator child = (*pitr)->end_vertex()->particles_begin(HepMC::children); - HepMC::GenVertex::particle_iterator childE = (*pitr)->end_vertex()->particles_end(HepMC::children); - for (; child != childE; ++child) { - if ( (*child)->pdg_id() == (*pitr)->pdg_id() && (*child)->barcode()!=(*pitr)->barcode() && (*child)->barcode() < 100000) { + if (pitr->end_vertex()) { + for (auto child: *(pitr->end_vertex())) { + if ( child->pdg_id() == pitr->pdg_id() && HepMC::barcode(child)!=HepMC::barcode(pitr) && HepMC::barcode(child) < 100000) { notSelfDecay = false; break; } @@ -57,8 +52,6 @@ StatusCode ParticleFilter::filterEvent() { } if (notSelfDecay) nParts++; } - } - } } } if (m_Exclusive) diff --git a/Generators/GeneratorFilters/src/SoftLeptonFilter.cxx b/Generators/GeneratorFilters/src/SoftLeptonFilter.cxx index 75ade1df73c2ff8c2f1439d32df65ebf6257767f..afcca0b9690054a1b21f2eb3f1b0d9d28a891828 100644 --- a/Generators/GeneratorFilters/src/SoftLeptonFilter.cxx +++ b/Generators/GeneratorFilters/src/SoftLeptonFilter.cxx @@ -14,6 +14,44 @@ SoftLeptonFilter::SoftLeptonFilter(const std::string& name, ISvcLocator* pSvcLoc StatusCode SoftLeptonFilter::filterEvent() { for (McEventCollection::const_iterator itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); +#ifdef HEPMC3 + for (auto pitr: genEvt->particles()) { + if (pitr->status() != 1) continue; + if ( ( 2 != m_LeptonType && 11 == std::abs(pitr->pdg_id()) ) || ( 1 != m_LeptonType && 13 == std::abs(pitr->pdg_id()) )) { + if ((pitr->momentum().perp() >= m_Ptmin) && fabs(pitr->momentum().pseudoRapidity()) <= m_EtaRange) { + // select e's from hadrons and from taus that come from hadrons, + // and electrons from gammas that come from hadrons... (dalitz decay) + auto decayVtx = pitr->production_vertex(); + if (!decayVtx) continue; + auto firstParent = decayVtx->particles_in().front(); + if (!firstParent) { + ATH_MSG_WARNING("firstParent iterator is null for this muon; skip it"); + return StatusCode::FAILURE; + } + int parentID=firstParent->pdg_id(); + auto theParent=firstParent; + while(abs(parentID)==15||parentID==pitr->pdg_id()) { + auto parentDecayVtx = theParent->production_vertex(); + auto firstGrandParent = parentDecayVtx->particles_in().front(); + if (!firstGrandParent) { + ATH_MSG_ERROR("firstGrandParent iterator is null for this muon from tau decay; skip it"); + continue; + } + parentID=firstGrandParent->pdg_id(); + theParent=firstGrandParent; + } + // Exclude gauge and Higgs boson decays + if (abs(parentID) > 37) { + ATH_MSG_DEBUG("Found a lepton " << pitr->pdg_id() + << " from " << parentID + << " PT=" << pitr->momentum().perp() + << " eta=" << pitr->momentum().pseudoRapidity()); + return StatusCode::SUCCESS; + } + } + } + } +#else for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { if ((*pitr)->status() != 1) continue; if ( ( 2 != m_LeptonType && 11 == abs((*pitr)->pdg_id()) ) || ( 1 != m_LeptonType && 13 == abs((*pitr)->pdg_id()) ) ) { @@ -33,8 +71,8 @@ StatusCode SoftLeptonFilter::filterEvent() { HepMC::GenVertex * parentDecayVtx = (*theParent)->production_vertex(); HepMC::GenVertex::particle_iterator firstGrandParent = parentDecayVtx->particles_begin(HepMC::parents); if (*firstGrandParent==0) { - ATH_MSG_ERROR("firstGrandParent iterator is null for this muon from tau decay; skip it"); - continue; + ATH_MSG_WARNING("firstGrandParent iterator is null for this muon from tau decay; skip it"); + return StatusCode::FAILURE; } parentID=(*firstGrandParent)->pdg_id(); theParent=firstGrandParent; @@ -50,6 +88,7 @@ StatusCode SoftLeptonFilter::filterEvent() { } } } +#endif } setFilterPassed(false); return StatusCode::SUCCESS; diff --git a/Generators/GeneratorFilters/src/SoftLeptonInJetFilter.cxx b/Generators/GeneratorFilters/src/SoftLeptonInJetFilter.cxx index 0415fba4eb2f9e478acc0e115f2ece35ed4b58cf..484f0ad4d47ca8460ae3b6d6f1f70f363bcdbdff 100644 --- a/Generators/GeneratorFilters/src/SoftLeptonInJetFilter.cxx +++ b/Generators/GeneratorFilters/src/SoftLeptonInJetFilter.cxx @@ -31,6 +31,26 @@ StatusCode SoftLeptonInJetFilter::filterEvent() { int NPartons = 0; for (McEventCollection::const_iterator itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); +#ifdef HEPMC3 + for (auto pitr: *genEvt) { + if ( m_NPartons == 0 ) continue; + if (isParton(pitr)) { + eta_b[NPartons] = pitr->momentum().pseudoRapidity(); + phi_b[NPartons] = pitr->momentum().phi(); + NPartons++; + } + if (isElectron(pitr)) { + for (auto thisParent: pitr->production_vertex()->particles_in()) { + int parentID = std::abs(thisParent->pdg_id()); + if ( MC::PID::isBottomMeson(parentID) || MC::PID::isBottomBaryon(parentID) || MC::PID::isCharmMeson(parentID) || MC::PID::isCharmBaryon(parentID) ) { + eta_e[NLeptons] = pitr->momentum().pseudoRapidity(); + phi_e[NLeptons] = pitr->momentum().phi(); + NLeptons++; + } + } + } + } +#else for (HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { if ( m_NPartons !=0 ) { if (isParton(*pitr)) { @@ -53,6 +73,7 @@ StatusCode SoftLeptonInJetFilter::filterEvent() { } } } +#endif } if (NPartons == m_NPartons && NLeptons >= m_NLeptons) { @@ -96,14 +117,14 @@ StatusCode SoftLeptonInJetFilter::filterEvent() { return StatusCode::SUCCESS; } -bool SoftLeptonInJetFilter::isElectron(HepMC::GenParticlePtr p) const { - return (abs(p->pdg_id())==11 && p->status()==1 && +bool SoftLeptonInJetFilter::isElectron(HepMC::ConstGenParticlePtr p) const { + return (std::abs(p->pdg_id())==11 && p->status()==1 && p->momentum().perp() >= m_Ptmin && - fabs(p->momentum().pseudoRapidity()) <= m_EtaRange ); + std::abs(p->momentum().pseudoRapidity()) <= m_EtaRange ); } -bool SoftLeptonInJetFilter::isParton(HepMC::GenParticlePtr p) const { - return (abs(p->pdg_id()) == m_part_ID && p->status()==3 && +bool SoftLeptonInJetFilter::isParton(HepMC::ConstGenParticlePtr p) const { + return (std::abs(p->pdg_id()) == m_part_ID && p->status()==3 && p->momentum().perp() >= m_part_Ptmin && - fabs(p->momentum().pseudoRapidity()) <= m_part_EtaRange); + std::abs(p->momentum().pseudoRapidity()) <= m_part_EtaRange); } diff --git a/Generators/GeneratorFilters/src/SusySubprocessFinder.cxx b/Generators/GeneratorFilters/src/SusySubprocessFinder.cxx index 3e6f4ac537acd4f33e4b37033f751dcb9a0e42a8..e22d76d4d35c4fbe540232812280d9bf7318c649 100644 --- a/Generators/GeneratorFilters/src/SusySubprocessFinder.cxx +++ b/Generators/GeneratorFilters/src/SusySubprocessFinder.cxx @@ -111,6 +111,62 @@ void SusySubprocessFinder::findInitialSusy(int ID[], int findmode) { // Loop over all particles in the event int ipitr = 0; +#ifdef HEPMC3 + for (auto pitr: genEvt->particles()) { + + if (findmode == 0 || findmode == 1 || findmode == 2) { + // ######################################################## findmode == 0, 1 + // ##### findmode 0 works for [maybe, is fragile]: Pythia, Herwig(fortran) [and Herwigpp? no, don't think so] + // ##### findmode 1 works for Pythia and Herwig, but not Herwigpp (initial spart do not have two mothers) + // ##### fomdmode 2 works for + + int pdg = pitr->pdg_id(); + int pdg_initial = 0; + if (isSUSY(pdg)) { + + // Very simplistic finder: choose two first sparticles + if (findmode == 0) + pdg_initial= pdg; + + // Very simplistic finder: choose two first sparticles which have two parents + else if (findmode == 1) { + // accept as initial sparticle only if has TWO parents (always the case?) + if ( pitr->production_vertex() != NULL ) { + if ( pitr->production_vertex()->particles_in().size() == 2) pdg_initial = pdg; + } + } + + // Simplistic finder: choose two first sparticles wh + else if (findmode == 2) { + // accept as initial sparticle if parents are non-SUSY + int nSusyParents = 0; + if ( pitr->production_vertex() != NULL ) { + for (auto thisParent: pitr->production_vertex()->particles_out()){ + if (isSUSY( thisParent->pdg_id() )) nSusyParents++; + } + } else { + ATH_MSG_WARNING("SUSY particle without parents iPart = " << ipitr); + } + if(nSusyParents == 0) pdg_initial = pdg; + } + + } + + // test if have a hit + if (pdg_initial) { + if (iP < 2) ID[iP++] = pdg_initial; + + // checks etc. + if (findmode == 0 && iP == 2) break; + if (iP > 2) { + ATH_MSG_WARNING("Neglecting additional find: ipitr="<< ipitr << " pdgid=" << pdg_initial); + } + //if (iP == 2) break; // have found two sparticles, break off + } + // ######################################################## + } + } +#else HepMC::GenEvent::particle_const_iterator pitr; for (pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { @@ -171,6 +227,7 @@ void SusySubprocessFinder::findInitialSusy(int ID[], int findmode) { // ######################################################## } } +#endif ipitr++; } @@ -520,6 +577,72 @@ void SusySubprocessFinder::verboseMC() { int iPart = 0, iSusy = 0; // Loop over all particles in the event +#ifdef HEPMC3 + for (auto pitr: genEvt->particles()) { + + // ######################################################## + // Very simplistic finder: choose two first sparticles + + char c[100]; + + int pdg = pitr->pdg_id(); + int status = pitr->status(); + int barcode = HepMC::barcode(pitr); + double mass = pitr->generated_mass(); + + double px = pitr->momentum().px(); + + // Possibilities to filter / break off listing + if (! (m_verbose_mode=="all" || (m_verbose_mode=="susy" && isSUSY(pdg)) ) ) continue; + if (iPart > m_verbose_nPart) continue; + + int particles_in_size = 0; + int particles_out_size = 0; + // Children ------------------------------------ + std::string childrenT = ""; + //std::string childrenbarT = ""; + int nChildren = 0; + + if ( pitr->end_vertex() != NULL ) { + particles_out_size = pitr->end_vertex()->particles_out().size(); + for (auto thisChild: pitr->end_vertex()->particles_out()) { + sprintf(c,"%4i", thisChild->pdg_id()); + childrenT.append(c); + sprintf(c,"(%i)", HepMC::barcode(thisChild)); + childrenT.append(c); + childrenT.append(" "); + nChildren++; + } + } + + // Parents -------------------------------------- + std::string parentsT = ""; + int nParents = 0; + + if ( pitr->production_vertex() ) { + + particles_in_size = pitr->production_vertex()->particles_in().size(); + for (auto thisParent: pitr->production_vertex()->particles_in()) { + sprintf(c,"%4i", thisParent->pdg_id()); + parentsT.append(c); + sprintf(c,"(%i)", HepMC::barcode(thisParent)); + parentsT.append(c); + parentsT.append(" "); + nParents++; + } + + } + + iPart++; + if (isSUSY(pdg)) iSusy++; + if (isSUSY(pdg) || iPart <= 30) printf("SUSYVERBOSE %4i %4i st:%5i CLHEP::bar:%5i pdg: %8i m: %5.1f px: %6.1f | (%i->%i) |%i M: %s ||%i C: %s | \n", iPart, iSusy, status, barcode, pdg, mass, px/1000., particles_in_size, particles_out_size, nParents, parentsT.data(), nChildren, childrenT.data()); + + if ( (particles_in_size != nParents) || (particles_out_size != nChildren) ) { + ATH_MSG_WARNING("Not identical prod: " << particles_in_size << " vs " << nParents << " decay: " << particles_out_size << " vs " << nChildren); + } + + } +#else HepMC::GenEvent::particle_const_iterator pitr; for (pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { @@ -593,5 +716,6 @@ void SusySubprocessFinder::verboseMC() { } } +#endif } } diff --git a/Generators/GeneratorFilters/src/TTbarFilter.cxx b/Generators/GeneratorFilters/src/TTbarFilter.cxx index 9de9f4d9578ea8d9c3e34f00b3e8896f4788d2ec..2c93f95297e34ed54ca3cec078dbae4639ab5275 100644 --- a/Generators/GeneratorFilters/src/TTbarFilter.cxx +++ b/Generators/GeneratorFilters/src/TTbarFilter.cxx @@ -22,31 +22,26 @@ StatusCode TTbarFilter::filterEvent() { McEventCollection::const_iterator itr; for (itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); - HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); - for (; pitr!=genEvt->particles_end(); ++pitr) { - if (std::abs((*pitr)->pdg_id()) == 6) { - if ( (*pitr)->pdg_id() == 6 ) N_quark_t_all++; - if ( (*pitr)->pdg_id() == -6 ) N_quark_tbar_all++; - int n_daughters = 0; - HepMC::GenParticle * mcpart = (*pitr); - const HepMC::GenVertex * decayVtx = mcpart->end_vertex(); - if (decayVtx != 0) n_daughters = decayVtx->particles_out_size(); - + for (auto pitr: *genEvt) { + if (std::abs(pitr->pdg_id()) != 6) continue; + if ( pitr->pdg_id() == 6 ) N_quark_t_all++; + if ( pitr->pdg_id() == -6 ) N_quark_tbar_all++; + auto decayVtx = pitr->end_vertex(); + if (!decayVtx) continue; +#ifdef HEPMC3 + if (decayVtx->particles_out().size()<2) continue; +#else + if (decayVtx->particles_out_size()<2) continue; +#endif // For this analysis we are not interested in t->t MC structures, only in decays - if (n_daughters >= 2) { - HepMC::GenVertex::particles_in_const_iterator child_mcpartItr = decayVtx->particles_out_const_begin(); - HepMC::GenVertex::particles_in_const_iterator child_mcpartItrE = decayVtx->particles_out_const_end(); - for (; child_mcpartItr != child_mcpartItrE; ++child_mcpartItr) { - HepMC::GenParticle * child_mcpart = (*child_mcpartItr); - // Implicitly, I assume that tops always decay to W X - if (abs(child_mcpart->pdg_id()) == 24) { - if ( (*pitr)->pdg_id() == 6 ) N_quark_t++; - if ( (*pitr)->pdg_id() == -6 ) N_quark_tbar++; - if ((*pitr)->momentum().perp() >= m_Ptmin) N_pt_above_cut++; - } + for ( auto child_mcpartItr: *decayVtx ) { + // Implicitly, I assume that tops always decay to W X + if (std::abs(child_mcpartItr->pdg_id()) == 24) { + if ( pitr->pdg_id() == 6 ) N_quark_t++; + if ( pitr->pdg_id() == -6 ) N_quark_tbar++; + if (pitr->momentum().perp() >= m_Ptmin) N_pt_above_cut++; } } - } } } diff --git a/Generators/GeneratorFilters/src/TTbarPlusJetsFilter.cxx b/Generators/GeneratorFilters/src/TTbarPlusJetsFilter.cxx index 6583a6b5e003d7088231f92d0c997566b29ee3fa..017a6f3172ce1d72a3f2a6815ed2001241520ed1 100644 --- a/Generators/GeneratorFilters/src/TTbarPlusJetsFilter.cxx +++ b/Generators/GeneratorFilters/src/TTbarPlusJetsFilter.cxx @@ -55,23 +55,20 @@ StatusCode TTbarPlusJetsFilter::filterEvent() { std::vector<CLHEP::HepLorentzVector> electronFakingJetCandidates; for (itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); - for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { + for (auto pitr: *genEvt) { // Look for an electron from a W or a tau (it could end up as a jet): - if (abs((*pitr)->pdg_id()) == 24 || abs((*pitr)->pdg_id()) == 15) { - if ((*pitr)->end_vertex()) { - HepMC::GenVertex::particle_iterator firstChild = (*pitr)->end_vertex()->particles_begin(HepMC::children); - HepMC::GenVertex::particle_iterator endChild = (*pitr)->end_vertex()->particles_end(HepMC::children); - HepMC::GenVertex::particle_iterator thisChild = firstChild; - for (; thisChild != endChild; ++thisChild) { - if (abs((*thisChild)->pdg_id()) == 11 && fabs((*thisChild)->momentum().pseudoRapidity()) <= m_etaMaxJetB) { + if (std::abs(pitr->pdg_id()) == 24 || std::abs(pitr->pdg_id()) == 15) { + if (pitr->end_vertex()) { + for (auto thisChild: *(pitr->end_vertex())) { + if (std::abs(thisChild->pdg_id()) == 11 && std::abs(thisChild->momentum().pseudoRapidity()) <= m_etaMaxJetB) { ATH_MSG_VERBOSE("Electron from W or tau decay found in the ID acceptance: "); - ATH_MSG_VERBOSE(" eta = " << (*thisChild)->momentum().pseudoRapidity() << - " phi = " << (*thisChild)->momentum().phi() << - " pt = " << (*thisChild)->momentum().perp()); - CLHEP::HepLorentzVector momentum_lv((*thisChild)->momentum().px(), - (*thisChild)->momentum().py(), - (*thisChild)->momentum().pz(), - (*thisChild)->momentum().e()); + ATH_MSG_VERBOSE(" eta = " << thisChild->momentum().pseudoRapidity() << + " phi = " << thisChild->momentum().phi() << + " pt = " << thisChild->momentum().perp()); + CLHEP::HepLorentzVector momentum_lv(thisChild->momentum().px(), + thisChild->momentum().py(), + thisChild->momentum().pz(), + thisChild->momentum().e()); electronFakingJetCandidates.push_back(momentum_lv); } } @@ -79,24 +76,21 @@ StatusCode TTbarPlusJetsFilter::filterEvent() { } // Count good leptons - if ( (*pitr)->status() == 1 && - ((abs((*pitr)->pdg_id()) == 11 && (*pitr)->momentum().perp() >= m_ptMinElec && fabs((*pitr)->momentum().pseudoRapidity()) <= m_etaMaxElec ) || - (abs((*pitr)->pdg_id()) == 13 && (*pitr)->momentum().perp() >= m_ptMinMuon && fabs((*pitr)->momentum().pseudoRapidity()) <= m_etaMaxMuon )) ) { - ATH_MSG_VERBOSE("Good lepton found: PDG ID = " << (*pitr)->pdg_id() - << " eta = " << (*pitr)->momentum().pseudoRapidity() - << " phi = " << (*pitr)->momentum().phi() - << " pt = " << (*pitr)->momentum().perp()); + if ( pitr->status() == 1 && + ((std::abs(pitr->pdg_id()) == 11 && pitr->momentum().perp() >= m_ptMinElec && std::abs(pitr->momentum().pseudoRapidity()) <= m_etaMaxElec ) || + (std::abs(pitr->pdg_id()) == 13 && pitr->momentum().perp() >= m_ptMinMuon && std::abs(pitr->momentum().pseudoRapidity()) <= m_etaMaxMuon )) ) { + ATH_MSG_VERBOSE("Good lepton found: PDG ID = " << pitr->pdg_id() + << " eta = " << pitr->momentum().pseudoRapidity() + << " phi = " << pitr->momentum().phi() + << " pt = " << pitr->momentum().perp()); ilep++; } // Count signs of lepton(s) - if (abs((*pitr)->pdg_id()) == 24) { - if ((*pitr)->end_vertex()) { - HepMC::GenVertex::particle_iterator firstChild = (*pitr)->end_vertex()->particles_begin(HepMC::children); - HepMC::GenVertex::particle_iterator endChild = (*pitr)->end_vertex()->particles_end(HepMC::children); - HepMC::GenVertex::particle_iterator thisChild = firstChild; - for (; thisChild != endChild; ++thisChild) { - if ((*thisChild)->pdg_id() == 11 || (*thisChild)->pdg_id() == 13) nLepMinus++; - if ((*thisChild)->pdg_id() == -11 || (*thisChild)->pdg_id() == -13) nLepPlus++; + if (std::abs(pitr->pdg_id()) == 24) { + if (pitr->end_vertex()) { + for (auto thisChild: *(pitr->end_vertex())) { + if (thisChild->pdg_id() == 11 || thisChild->pdg_id() == 13) nLepMinus++; + if (thisChild->pdg_id() == -11 || thisChild->pdg_id() == -13) nLepPlus++; } } } diff --git a/Generators/GeneratorFilters/src/TauFilter.cxx b/Generators/GeneratorFilters/src/TauFilter.cxx index 36b93bb7ae05fe0e7248e2d085fb574b702a1d81..774c86810171886dc4d2edc255435cbb273287f7 100644 --- a/Generators/GeneratorFilters/src/TauFilter.cxx +++ b/Generators/GeneratorFilters/src/TauFilter.cxx @@ -40,9 +40,9 @@ StatusCode TauFilter::filterFinalize() { } -CLHEP::HepLorentzVector TauFilter::sumDaughterNeutrinos( HepMC::GenParticlePtr part ) { +CLHEP::HepLorentzVector TauFilter::sumDaughterNeutrinos( HepMC::ConstGenParticlePtr part ) { CLHEP::HepLorentzVector nu( 0, 0, 0, 0); - if ( ( abs( part->pdg_id() ) == 12 ) || ( abs( part->pdg_id() ) == 14 ) || ( abs( part->pdg_id() ) == 16 ) ) { + if ( ( std::abs( part->pdg_id() ) == 12 ) || ( std::abs( part->pdg_id() ) == 14 ) || ( std::abs( part->pdg_id() ) == 16 ) ) { nu.setPx(part->momentum().px()); nu.setPy(part->momentum().py()); nu.setPz(part->momentum().pz()); @@ -51,9 +51,7 @@ CLHEP::HepLorentzVector TauFilter::sumDaughterNeutrinos( HepMC::GenParticlePtr p if (part->end_vertex() == 0) return nu; - HepMC::GenVertex::particles_out_const_iterator begin = part->end_vertex()->particles_out_const_begin(); - HepMC::GenVertex::particles_out_const_iterator end = part->end_vertex()->particles_out_const_end(); - for ( ; begin != end; begin++ ) nu += sumDaughterNeutrinos( *begin ); + for ( auto beg: *(part->end_vertex())) nu += sumDaughterNeutrinos( beg ); return nu; } diff --git a/Generators/GeneratorFilters/src/TtHtoVVDecayFilter.cxx b/Generators/GeneratorFilters/src/TtHtoVVDecayFilter.cxx index 822c2ac92eebd80bf557db6685a82cf2dfc30ae0..b920071b026db39776020431b1d2cac829ad331b 100644 --- a/Generators/GeneratorFilters/src/TtHtoVVDecayFilter.cxx +++ b/Generators/GeneratorFilters/src/TtHtoVVDecayFilter.cxx @@ -67,9 +67,6 @@ StatusCode TtHtoVVDecayFilter::filterEvent() { for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { for (size_t iParent=0; iParent < m_PDGParent.size(); iParent++) { - //ATH_MSG_INFO(" Parent to match? pdg = " << m_PDGParent[iParent] << " status = " << m_StatusParent[iParent] ); - //if ( abs((*pitr)->pdg_id()) == m_PDGParent[iParent] ) ATH_MSG_INFO(" particle to check pdg = " << abs((*pitr)->pdg_id()) << " status = " << (*pitr)->status() ); - if ( abs((*pitr)->pdg_id()) == m_PDGParent[iParent] && (*pitr)->status() == m_StatusParent[iParent]) { // if find a parent here HepMC::GenVertex::particle_iterator firstMother = (*pitr)->production_vertex()->particles_begin(HepMC::parents); HepMC::GenVertex::particle_iterator endMother = (*pitr)->production_vertex()->particles_end(HepMC::parents); @@ -126,18 +123,16 @@ StatusCode TtHtoVVDecayFilter::filterEvent() { } -bool TtHtoVVDecayFilter::findAncestor(const HepMC::GenVertexPtr searchvertex, +bool TtHtoVVDecayFilter::findAncestor(HepMC::ConstGenVertexPtr 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 (auto anc = firstAncestor; anc != endAncestor; ++anc) { - if (abs((*anc)->pdg_id()) == targetPDGID) { // same particle as parent - return findAncestor((*anc)->end_vertex(), + for (HepMC::ConstGenParticlePtr anc: *searchvertex) { + if (std::abs(anc->pdg_id()) == targetPDGID) { // same particle as parent + return findAncestor(anc->end_vertex(), targetPDGID); } else { for (size_t i = 0; i < m_PDGChild.size(); ++i) { - if (abs((*anc)->pdg_id()) == m_PDGChild[i]) return true; + if (std::abs(anc->pdg_id()) == m_PDGChild[i]) return true; } } } diff --git a/Generators/GeneratorFilters/src/VBFForwardJetsFilter.cxx b/Generators/GeneratorFilters/src/VBFForwardJetsFilter.cxx index 5d3aa26935a43acddb61ee691f053b007c329788..786b3a2385c9696378e35899ed20ab1286bea647 100644 --- a/Generators/GeneratorFilters/src/VBFForwardJetsFilter.cxx +++ b/Generators/GeneratorFilters/src/VBFForwardJetsFilter.cxx @@ -94,10 +94,49 @@ StatusCode VBFForwardJetsFilter::filterEvent() { // Get MCTruth Photon/Electon/Tau(HadronicDecay) std::vector<HepMC::GenParticlePtr> MCTruthPhotonList; std::vector<HepMC::GenParticlePtr> MCTruthElectronList; - std::vector<CLHEP::HepLorentzVector*> MCTruthTauList; + std::vector<CLHEP::HepLorentzVector> MCTruthTauList; McEventCollection::const_iterator itr; for (itr = events()->begin(); itr!=events()->end(); ++itr) { const HepMC::GenEvent* genEvt = (*itr); +#ifdef HEPMC3 + for (auto pitr: ((HepMC::GenEvent*)genEvt)->particles()) { + // photon + if ( pitr->pdg_id() == 22 && pitr->status() == 1 && + pitr->momentum().perp() >= m_LGMinPt && std::abs(pitr->momentum().pseudoRapidity()) <= m_LGMaxEta) { + MCTruthPhotonList.push_back(pitr); + ATH_MSG_INFO("photon pt(Gaudi::Units::GeV) = " << pitr->momentum().perp()/Gaudi::Units::GeV << " eta = " << pitr->momentum().pseudoRapidity()); + } + // electon + if ( std::abs(pitr->pdg_id()) == 11 && pitr->status() == 1 && + pitr->momentum().perp() >= m_LGMinPt && std::abs(pitr->momentum().pseudoRapidity()) <= m_LGMaxEta) { + MCTruthElectronList.push_back(pitr); + ATH_MSG_INFO("electron pt(Gaudi::Units::GeV) = " << pitr->momentum().perp()/Gaudi::Units::GeV << " eta = " << pitr->momentum().pseudoRapidity()); + } + // tau + if ( std::abs(pitr->pdg_id()) == 15 && pitr->status() != 3 ) { + auto tau = pitr; + int leptonic = 0; + for (auto beg: tau->end_vertex()->particles_out() ) { + if ( beg->production_vertex() != tau->end_vertex() ) continue; + if ( std::abs( beg->pdg_id() ) == 12 ) leptonic = 1; + if ( std::abs( beg->pdg_id() ) == 14 ) leptonic = 2; + if ( std::abs( beg->pdg_id() ) == 15 ) leptonic = 11; + } + + if (leptonic == 0) { + CLHEP::HepLorentzVector nutau = sumDaughterNeutrinos( tau ); + CLHEP::HepLorentzVector tauvis = CLHEP::HepLorentzVector(tau->momentum().px()-nutau.px(), + tau->momentum().py()-nutau.py(), + tau->momentum().pz()-nutau.pz(), + tau->momentum().e()-nutau.e()); + if (tauvis.vect().perp() >= m_LGMinPt && std::abs(tauvis.vect().pseudoRapidity()) <= m_LGMaxEta) { + MCTruthTauList.push_back(tauvis); + ATH_MSG_INFO("had-tau pt(CLHEP::GeV) = " << tauvis.vect().perp()/CLHEP::GeV << " eta = " << tauvis.vect().pseudoRapidity()); + } + } + } + } +#else for (HepMC::GenEvent::particle_const_iterator pitr = genEvt->particles_begin(); pitr != genEvt->particles_end(); ++pitr) { // photon if ( (*pitr)->pdg_id() == 22 && (*pitr)->status() == 1 && @@ -112,7 +151,7 @@ StatusCode VBFForwardJetsFilter::filterEvent() { ATH_MSG_INFO("electron pt(Gaudi::Units::GeV) = " << (*pitr)->momentum().perp()/Gaudi::Units::GeV << " eta = " << (*pitr)->momentum().pseudoRapidity()); } // tau - if ( abs((*pitr)->pdg_id()) == 15 && (*pitr)->status() != 3 ) { + if ( std::abs((*pitr)->pdg_id()) == 15 && (*pitr)->status() != 3 ) { HepMC::GenParticle *tau = (*pitr); HepMC::GenVertex::particles_out_const_iterator begin = tau->end_vertex()->particles_out_const_begin(); HepMC::GenVertex::particles_out_const_iterator end = tau->end_vertex()->particles_out_const_end(); @@ -126,19 +165,18 @@ StatusCode VBFForwardJetsFilter::filterEvent() { if (leptonic == 0) { CLHEP::HepLorentzVector nutau = sumDaughterNeutrinos( tau ); - CLHEP::HepLorentzVector *tauvis = new CLHEP::HepLorentzVector(tau->momentum().px()-nutau.px(), + CLHEP::HepLorentzVector tauvis = CLHEP::HepLorentzVector(tau->momentum().px()-nutau.px(), tau->momentum().py()-nutau.py(), tau->momentum().pz()-nutau.pz(), tau->momentum().e()-nutau.e()); - if (tauvis->vect().perp() >= m_LGMinPt && fabs(tauvis->vect().pseudoRapidity()) <= m_LGMaxEta) { + if (tauvis.vect().perp() >= m_LGMinPt && std::abs(tauvis.vect().pseudoRapidity()) <= m_LGMaxEta) { MCTruthTauList.push_back(tauvis); - ATH_MSG_INFO("had-tau pt(CLHEP::GeV) = " << tauvis->vect().perp()/CLHEP::GeV << " eta = " << tauvis->vect().pseudoRapidity()); - } else { - delete tauvis; - } + ATH_MSG_INFO("had-tau pt(CLHEP::GeV) = " << tauvis.vect().perp()/CLHEP::GeV << " eta = " << tauvis.vect().pseudoRapidity()); + } } } } +#endif } // Select TruthJets @@ -226,18 +264,12 @@ StatusCode VBFForwardJetsFilter::filterEvent() { ATH_MSG_INFO("Sign OK? : " << flagSign); ATH_MSG_INFO("JJ OK? : " << flagJJ); - if (MCTruthTauList.size()) { - for (std::vector<CLHEP::HepLorentzVector*>::reverse_iterator i = MCTruthTauList.rbegin(); i != MCTruthTauList.rend(); ++i) { - delete *i; - } - } - setFilterPassed(flagNJets != 0 && flag1stJet != 0 && flag2ndJet != 0 && flagSign != 0 && flagJJ != 0); return StatusCode::SUCCESS; } -CLHEP::HepLorentzVector VBFForwardJetsFilter::sumDaughterNeutrinos( HepMC::GenParticlePtr part ) { +CLHEP::HepLorentzVector VBFForwardJetsFilter::sumDaughterNeutrinos( HepMC::ConstGenParticlePtr part ) { CLHEP::HepLorentzVector nu( 0, 0, 0, 0); if ( ( abs( part->pdg_id() ) == 12 ) || ( abs( part->pdg_id() ) == 14 ) || ( abs( part->pdg_id() ) == 16 ) ) { @@ -248,11 +280,9 @@ CLHEP::HepLorentzVector VBFForwardJetsFilter::sumDaughterNeutrinos( HepMC::GenPa return nu; } - if ( part->end_vertex() == 0 ) return nu; + if ( !part->end_vertex() ) return nu; - HepMC::GenVertex::particles_out_const_iterator begin = part->end_vertex()->particles_out_const_begin(); - HepMC::GenVertex::particles_out_const_iterator end = part->end_vertex()->particles_out_const_end(); - for ( ; begin != end; begin++ ) nu += sumDaughterNeutrinos( *begin ); + for (auto daughterparticle: *(part->end_vertex())) nu += sumDaughterNeutrinos( daughterparticle ); return nu; } @@ -274,16 +304,16 @@ double VBFForwardJetsFilter::getMinDeltaR(const xAOD::Jet *jet, std::vector<HepM } -double VBFForwardJetsFilter::getMinDeltaR(const xAOD::Jet *jet, std::vector<CLHEP::HepLorentzVector*> &list) { +double VBFForwardJetsFilter::getMinDeltaR(const xAOD::Jet *jet, std::vector<CLHEP::HepLorentzVector> &list) { double minDR = 999.; for (unsigned i=0;i<list.size();++i) { - if (list[i]->vect().perp() != 0.) { - double dphi = jet->phi()-list[i]->phi(); - double deta = jet->eta()-list[i]->vect().pseudoRapidity(); + if (list[i].vect().perp() != 0.) { + double dphi = jet->phi()-list[i].phi(); + double deta = jet->eta()-list[i].vect().pseudoRapidity(); if (dphi > M_PI) { dphi -= 2.*M_PI; } if (dphi < -M_PI) { dphi += 2.*M_PI; } - double dr = sqrt(deta*deta+dphi*dphi); - double ratio_pt= fabs((jet->pt()-list[i]->vect().perp())/list[i]->vect().perp()); + double dr = std::sqrt(deta*deta+dphi*dphi); + double ratio_pt= fabs((jet->pt()-list[i].vect().perp())/list[i].vect().perp()); if (ratio_pt < m_RatioPtJLG && dr < minDR) minDR = dr; } } @@ -294,7 +324,7 @@ double VBFForwardJetsFilter::getMinDeltaR(const xAOD::Jet *jet, std::vector<CLHE void VBFForwardJetsFilter::removePseudoJets( std::vector<const xAOD::Jet*> &jetList, std::vector<HepMC::GenParticlePtr> &MCTruthPhotonList, std::vector<HepMC::GenParticlePtr> &MCTruthElectronList, - std::vector<CLHEP::HepLorentzVector*> &MCTruthTauList) { + std::vector<CLHEP::HepLorentzVector> &MCTruthTauList) { std::vector<const xAOD::Jet*> orgJetList = jetList; jetList.clear(); for (unsigned i=0;i<orgJetList.size();++i) { diff --git a/Generators/GeneratorFilters/src/WeightedBDtoElectronFilter.cxx b/Generators/GeneratorFilters/src/WeightedBDtoElectronFilter.cxx index d92361c11506a3f188da3f73b4e99e0dc9542dd2..ae59cddd9eeef780026ccfcda665ec06d0f9a535 100644 --- a/Generators/GeneratorFilters/src/WeightedBDtoElectronFilter.cxx +++ b/Generators/GeneratorFilters/src/WeightedBDtoElectronFilter.cxx @@ -103,6 +103,48 @@ HepMC::ConstGenParticlePtr WeightedBDtoElectronFilter::FindBParent( HepMC::Const return 0; } +#ifdef HEPMC3 + HepMC::ConstGenParticlePtr bParent = 0; + auto parentItr = part->production_vertex()->particles_in().begin(); + if ( parentItr == part->production_vertex()->particles_in().end() ) { + ATH_MSG_DEBUG("Vertex has no incoming particle "); + return 0; + } + + for ( ;; ) { + if (isBHadron((*parentItr)->pdg_id()) || isDHadron((*parentItr)->pdg_id()) ) { + ATH_MSG_INFO("Found B hadron (grand) parent "); + break; + } + + // get parent + if ( !(*parentItr)->production_vertex() ) { // no production vertex + ATH_MSG_INFO("No production vertex found => interrupt "); + break; + } + if ( (*parentItr)->production_vertex()->particles_in().begin() == (*parentItr)->production_vertex()->particles_in().end() ) { // no parent particle + ATH_MSG_INFO("No parent particle found => interrupt "); + break; + } + if ( (*parentItr)->production_vertex()->particles_in().begin() == parentItr ) { + ATH_MSG_INFO("Particle is its own parent => interrupt "); + break; + } + + ATH_MSG_INFO("Tracing back; id = " << (*parentItr)->pdg_id() << + "; parent id = " << (*(*parentItr)->production_vertex()->particles_in().begin())->pdg_id()); + parentItr = (*parentItr)->production_vertex()->particles_in().begin(); + } + + + if ( isBHadron((*parentItr)->pdg_id()) || isDHadron((*parentItr)->pdg_id()) ) { + bParent = (*parentItr); + ATH_MSG_INFO("Found B hadron: " << (*parentItr)->pdg_id()); + } else { + ATH_MSG_INFO("No B hadron found among ancestors; last found was: " << (*parentItr)->pdg_id()); + } +#else + HepMC::GenVertex::particles_in_const_iterator parentItr = part->production_vertex()->particles_in_const_begin(); if ( parentItr == part->production_vertex()->particles_in_const_end() ) { ATH_MSG_DEBUG("Vertex has no incoming particle "); @@ -141,6 +183,7 @@ HepMC::ConstGenParticlePtr WeightedBDtoElectronFilter::FindBParent( HepMC::Const } else { ATH_MSG_INFO("No B hadron found among ancestors; last found was: " << (*parentItr)->pdg_id()); } +#endif return bParent; } diff --git a/Generators/GeneratorFilters/src/XXvvGGFilter.cxx b/Generators/GeneratorFilters/src/XXvvGGFilter.cxx index 8054f501d57fd43e24f6c010c6cdb2fdb13b8549..a035b389c4d88e7c2d0a35c6d5508422a50599fa 100644 --- a/Generators/GeneratorFilters/src/XXvvGGFilter.cxx +++ b/Generators/GeneratorFilters/src/XXvvGGFilter.cxx @@ -22,34 +22,21 @@ StatusCode XXvvGGFilter::filterEvent() { int N_l = 0; int N_g = 0; const HepMC::GenEvent* genEvt = (*itr); - HepMC::GenEvent::particle_const_iterator pitr=genEvt->particles_begin(); - HepMC::GenEvent::particle_const_iterator pitr_end=genEvt->particles_end(); - for (; pitr != pitr_end; ++pitr) { - if ((*pitr)->pdg_id() == 1000022 && (*pitr)->status() == 155) { //< @todo How safe/portable is this? - HepMC::GenVertex::particle_iterator firstChild, thisChild, lastChild; - firstChild = (*pitr)->end_vertex()->particles_begin(HepMC::children); - lastChild = (*pitr)->end_vertex()->particles_end(HepMC::children); - thisChild = firstChild; - for (; thisChild != lastChild; ++thisChild) { - if ((*thisChild)->pdg_id() == 22) N_p++; - if ((*thisChild)->pdg_id() == 1000039) N_g++; - if ((*thisChild)->pdg_id() == 23) { + for (auto pitr: *genEvt) { + if (pitr->pdg_id() == 1000022 && pitr->status() == 155) { //< @todo How safe/portable is this? + if (!pitr->end_vertex()) continue; + for (auto thisChild: *(pitr->end_vertex())) { + if (thisChild->pdg_id() == 22) N_p++; + if (thisChild->pdg_id() == 1000039) N_g++; + if (thisChild->pdg_id() == 23) { N_z++; - if (!((*thisChild)->end_vertex())) continue; - HepMC::GenVertex::particle_iterator ZfirstChild, ZthisChild, ZlastChild; - ZfirstChild = (*thisChild)->end_vertex()->particles_begin(HepMC::children); - ZlastChild = (*thisChild)->end_vertex()->particles_end(HepMC::children); - ZthisChild = ZfirstChild; - for (; ZthisChild != ZlastChild; ++ZthisChild) { - if ((*ZthisChild)->pdg_id() != 23) continue; - if (!((*ZthisChild)->end_vertex())) continue; - HepMC::GenVertex::particle_iterator ZZfirstChild,ZZthisChild, ZZlastChild; - ZZfirstChild = (*ZthisChild)->end_vertex()->particles_begin(HepMC::children); - ZZlastChild = (*ZthisChild)->end_vertex()->particles_end(HepMC::children); - ZZthisChild = ZZfirstChild; - for (; ZZthisChild != ZZlastChild; ++ZZthisChild) { - if (abs((*ZZthisChild)->pdg_id()) == 11 || abs((*ZZthisChild)->pdg_id()) == 13) { - if (fabs((*ZZthisChild)->momentum().eta())<m_EtaRange) N_l++; + if (!thisChild->end_vertex()) continue; + for (auto ZthisChild: *(thisChild->end_vertex())) { + if (ZthisChild->pdg_id() != 23) continue; + if (!ZthisChild->end_vertex()) continue; + for (auto ZZthisChild: *(ZthisChild->end_vertex())) { + if (std::abs(ZZthisChild->pdg_id()) == 11 || std::abs(ZZthisChild->pdg_id()) == 13) { + if (std::abs(ZZthisChild->momentum().eta())<m_EtaRange) N_l++; } } } diff --git a/Generators/GeneratorFilters/src/XtoVVDecayFilterExtended.cxx b/Generators/GeneratorFilters/src/XtoVVDecayFilterExtended.cxx index 5470286fdc505463ecd45c4ffc0a3230def4e56c..8c6e65c08a79528d59c3b1104b1b50db871e5013 100644 --- a/Generators/GeneratorFilters/src/XtoVVDecayFilterExtended.cxx +++ b/Generators/GeneratorFilters/src/XtoVVDecayFilterExtended.cxx @@ -88,6 +88,19 @@ bool XtoVVDecayFilterExtended::RunHistory(HepMC::ConstGenParticlePtr pitr) { ATH_MSG_DEBUG("No History for this case"); return false; } +#ifdef HEPMC3 + + if (pitr->production_vertex()->particles_in().size()==0) { + ATH_MSG_DEBUG("No mother for this case"); + return false; + } + int result = 999; + auto pitr_current = pitr->production_vertex()->particles_in().at(0); + while ( result >= 0 ) { + pitr_current = CheckGrandparent(pitr_current, result); + if (result == m_PDGGrandParent) return true; + } +#else HepMC::GenVertex::particle_iterator firstMother = pitr->production_vertex()->particles_begin(HepMC::parents); HepMC::GenVertex::particle_iterator endMother = pitr->production_vertex()->particles_end(HepMC::parents); HepMC::GenVertex::particle_iterator thisMother = firstMother; @@ -101,6 +114,7 @@ bool XtoVVDecayFilterExtended::RunHistory(HepMC::ConstGenParticlePtr pitr) { pitr_current = CheckGrandparent(pitr_current, result); if (result == m_PDGGrandParent) return true; } +#endif return false; } @@ -116,6 +130,21 @@ HepMC::ConstGenParticlePtr XtoVVDecayFilterExtended::CheckGrandparent(HepMC::Co return NULL; } bool isGrandParentOK = false; +#ifdef HEPMC3 + if (pitr->production_vertex()->particles_in().size()==0) { + ATH_MSG_DEBUG("No mother for this case"); + result = -2; + return NULL; + } + + for (auto thisMother: pitr->production_vertex()->particles_in()) { + if ( thisMother->pdg_id() == m_PDGGrandParent ) { isGrandParentOK = true; } + } + + if (isGrandParentOK) result = m_PDGGrandParent; + else result = 0; + return pitr->production_vertex()->particles_in()[0]; +#else HepMC::GenVertex::particle_iterator firstMother = pitr->production_vertex()->particles_begin(HepMC::parents); HepMC::GenVertex::particle_iterator endMother = pitr->production_vertex()->particles_end(HepMC::parents); HepMC::GenVertex::particle_iterator thisMother = firstMother; @@ -132,23 +161,21 @@ HepMC::ConstGenParticlePtr XtoVVDecayFilterExtended::CheckGrandparent(HepMC::Co if (isGrandParentOK) result = m_PDGGrandParent; else result = 0; return (*firstMother); +#endif } void XtoVVDecayFilterExtended::FindAncestor(HepMC::ConstGenVertexPtr searchvertex, int targetPDGID, bool& okPDGChild1, bool& okPDGChild2) { if (!searchvertex) return; - 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(); - HepMC::GenVertex::particles_out_const_iterator thisAncestor = firstAncestor; - for (; thisAncestor != endAncestor; ++thisAncestor){ - //ATH_MSG_DEBUG(" child " << (*thisAncestor)->pdg_id()); - if (std::abs((*thisAncestor)->pdg_id()) == targetPDGID) { //same particle as parent - FindAncestor((*thisAncestor)->end_vertex(), targetPDGID, okPDGChild1, okPDGChild2); + for (auto thisAncestor: *searchvertex){ + //ATH_MSG_DEBUG(" child " << thisAncestor->pdg_id()); + if (std::abs(thisAncestor->pdg_id()) == targetPDGID) { //same particle as parent + FindAncestor(thisAncestor->end_vertex(), targetPDGID, okPDGChild1, okPDGChild2); } else { if (!okPDGChild1) { for (size_t i = 0; i < m_PDGChild1.size(); ++i) { - if (abs((*thisAncestor)->pdg_id()) == m_PDGChild1[i]) { + if (std::abs(thisAncestor->pdg_id()) == m_PDGChild1[i]) { okPDGChild1 = true; break; } @@ -157,7 +184,7 @@ void XtoVVDecayFilterExtended::FindAncestor(HepMC::ConstGenVertexPtr searchverte } if (!okPDGChild2) { for (size_t i = 0; i < m_PDGChild2.size(); ++i) { - if (std::abs((*thisAncestor)->pdg_id()) == m_PDGChild2[i]) { + if (std::abs(thisAncestor->pdg_id()) == m_PDGChild2[i]) { okPDGChild2 = true; break; } diff --git a/Generators/GeneratorModules/GeneratorModules/GenBase.h b/Generators/GeneratorModules/GeneratorModules/GenBase.h index f10e0aa5ae8be98d71e63d39b163090a18c058f5..854f2301dfc3f7c1573c896f1106ae9e1cd30fe6 100644 --- a/Generators/GeneratorModules/GeneratorModules/GenBase.h +++ b/Generators/GeneratorModules/GeneratorModules/GenBase.h @@ -15,6 +15,7 @@ #include "GeneratorObjects/McEventCollection.h" #include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" #include "HepPDT/ParticleData.hh" #include "HepPDT/ParticleDataTable.hh" diff --git a/HLT/Event/TrigByteStreamCnvSvc/CMakeLists.txt b/HLT/Event/TrigByteStreamCnvSvc/CMakeLists.txt index d72aaa145985a4acef0f0398386325761f98ef89..5d51b11ecdb1791e811d76339f22847a056632b6 100644 --- a/HLT/Event/TrigByteStreamCnvSvc/CMakeLists.txt +++ b/HLT/Event/TrigByteStreamCnvSvc/CMakeLists.txt @@ -21,4 +21,3 @@ atlas_add_component( # Install files from the package atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) diff --git a/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py b/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py index 85065fe4162900dd7897dc8d88930cb74d0d0ec1..6441ab66d7d00f127f1bcc46b3a984f9bdf2a149 100755 --- a/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py +++ b/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py @@ -178,7 +178,7 @@ def HLTMPPy_cfgdict(args): cdict = {} cdict['HLTMPPU'] = { 'application_name' : 'athenaHLT-%d' % os.getpid(), # unique name required to avoid interference - 'extra_params' : ["SkipFinalizeWorker=0"], + 'extra_params' : ["dumpFDs=1", "dumpThreads=1"] if args.debug_fork else None, 'interactive' : args.interactive, 'log_root' : os.getcwd(), 'log_name' : ('' if args.unique_log_files else 'athenaHLT:'), @@ -191,8 +191,6 @@ def HLTMPPy_cfgdict(args): 'soft_timeout_fraction' : 0.95, 'hltresultSizeMb': args.hltresult_size } - if args.debug_fork: - cdict['HLTMPPU']['extra_params'] += ["dumpFDs=1", "dumpThreads=1"] if args.debug: cdict['HLTMPPU']['debug'] = args.debug diff --git a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/python/MTCalibPebConfig.py b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/python/MTCalibPebConfig.py index 0505712f88c8633e847618922a32fb0ac55ef0fc..e7d41a6c2208a763c258a4beb0dc51e66fe15595 100644 --- a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/python/MTCalibPebConfig.py +++ b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/python/MTCalibPebConfig.py @@ -85,6 +85,7 @@ rob_access_dict = { class MTCalibPebHypoOptions: def __init__(self): + self.UseRandomSeed = False self.RandomAcceptRate = -1.0 self.BurnTimePerCycleMillisec = 0 self.NumBurnCycles = 0 @@ -161,6 +162,7 @@ def make_hypo_alg(name): def make_hypo_tool(name, options=default_options): from TrigExPartialEB.TrigExPartialEBConf import MTCalibPebHypoTool hypo_tool = MTCalibPebHypoTool(name) + hypo_tool.UseRandomSeed = options.UseRandomSeed hypo_tool.RandomAcceptRate = options.RandomAcceptRate hypo_tool.BurnTimePerCycleMillisec = options.BurnTimePerCycleMillisec hypo_tool.NumBurnCycles = options.NumBurnCycles diff --git a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py index def03037a9bf4a809d9b4c5e69f4c5d23e52701a..caddc643a3195c0d1eb61e30db64de61c02790dd 100644 --- a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py +++ b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/share/MTCalibPeb.py @@ -15,6 +15,7 @@ concurrent = get_opt('concurrent', False) # Number of chains num_chains = get_opt('num_chains', 3) # Configure hypo tool options +MTCalibPebConfig.default_options.UseRandomSeed = get_opt('UseRandomSeed', False) MTCalibPebConfig.default_options.RandomAcceptRate = get_opt('RandomAcceptRate', 0.01) MTCalibPebConfig.default_options.BurnTimePerCycleMillisec = get_opt('BurnTimePerCycleMillisec', 20) MTCalibPebConfig.default_options.NumBurnCycles = get_opt('NumBurnCycles', 10) diff --git a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.cxx b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.cxx index 83c6a217465ae114f30247bb0c15ccd9de585282..082c838133d6d86e44cc542c7aa7aa9a1eedbdd0 100644 --- a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.cxx +++ b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.cxx @@ -18,10 +18,20 @@ // Local implementation-specific helper methods namespace { + using rng_t = std::mt19937_64; + using seed_t = rng_t::result_type; + /// Calculate seed from EventID and tool name + seed_t eventSeed(const EventIDBase& eventID, const std::string& name) { + uint64_t evtNum = eventID.event_number(); + uint64_t runNum = eventID.run_number(); + uint64_t nameHash = std::hash<std::string>{}(name); + uint64_t seed = evtNum ^ (runNum << 10) ^ nameHash; + return static_cast<seed_t>(seed); + } /// Returns a reference to static thread-local random number generator - std::mt19937& threadLocalGenerator() { + rng_t& threadLocalGenerator() { static thread_local std::random_device rd; // used only to ensure different seeds for mt19937 - static thread_local std::mt19937 generator(rd()); + static thread_local rng_t generator(rd()); return generator; } /// Basic random real number generation @@ -161,6 +171,12 @@ StatusCode MTCalibPebHypoTool::finalize() { // ============================================================================= StatusCode MTCalibPebHypoTool::decide(const MTCalibPebHypoTool::Input& input) const { + // Re-seed the static thread-local RNG + if (not m_useRandomSeed.value()) { + const seed_t seed = eventSeed(input.eventContext.eventID(), name()); + ATH_MSG_DEBUG("Using seed " << seed << " for event " << input.eventContext.eventID()); + threadLocalGenerator().seed(seed); + } // --------------------------------------------------------------------------- // Burn CPU time diff --git a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.h b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.h index 58bad04d0e515216b0948781258b1c58a1fa6d75..9852ace6ad51eaf9f7af93a1e9926814a6faa784 100644 --- a/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.h +++ b/HLT/Trigger/TrigControl/TrigExamples/TrigExPartialEB/src/MTCalibPebHypoTool.h @@ -60,6 +60,10 @@ private: }; // ------------------------- Properties -------------------------------------- + Gaudi::Property<bool> m_useRandomSeed { + this, "UseRandomSeed", false, + "If true, use random seed for the internal RNG. If false, use a seed based on run/event number and tool name." + }; Gaudi::Property<double> m_acceptRate { this, "RandomAcceptRate", -1, "Rate of random accepts, <=0 is never, >=1 is always" diff --git a/HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Psc.h b/HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Psc.h index 7a334a9c9188ea7a73ab7ac50ed77dca1898249b..6c5de06be417869de08668284a3c4405a9c202ff 100644 --- a/HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Psc.h +++ b/HLT/Trigger/TrigControl/TrigPSC/TrigPSC/Psc.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 */ /** @@ -136,6 +136,7 @@ namespace psc { std::string m_nameEventLoopMgr; ///< name of the event loop manager bool m_interactive{false}; ///< Running in interactive mode (athenaHLT) std::unique_ptr<psc::Config> m_config{nullptr}; ///< Config derived from ptree + int m_workerID{0}; ///< worker ID (0=mother) SmartIF<ISvcLocator> m_svcLoc; ///< Service locator handle }; diff --git a/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx b/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx index 0d06488d73591f3cf37ca5300414d593a408a2c9..034e6ca0d8e32fd6174f5c334e78d7cbcff8d725 100644 --- a/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx +++ b/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx @@ -571,6 +571,19 @@ bool psc::Psc::stopRun (const ptree& /*args*/) return false; } + // Workers: store histograms at the end of stop as the children may not + // go through finalize with SkipFinalizeWorker=1. + if (m_workerID != 0) { + SmartIF<IService> histsvc = m_svcLoc->service("THistSvc", /*createIf=*/ false); + if (histsvc.isValid()) { + ERS_LOG("Finalize THistSvc to save histograms"); + if (histsvc->finalize().isFailure()) { + ERS_PSC_ERROR("Error executing finalize for THistSvc"); + } + } + } + + return true; } @@ -706,6 +719,8 @@ bool psc::Psc::prepareWorker (const boost::property_tree::ptree& args) } } + m_workerID = args.get<int>("workerId"); + ERS_LOG("Individualizing DF properties"); m_config->prepareWorker(args); diff --git a/HLT/Trigger/TrigControl/TrigServices/test/test_TrigMessageSvc.cxx b/HLT/Trigger/TrigControl/TrigServices/test/test_TrigMessageSvc.cxx index d5ba0de4ccf0b95f1f738a860545d4e90ac273b0..4ebc8c565aeb62c1189f70e827b1cb40617b43f3 100644 --- a/HLT/Trigger/TrigControl/TrigServices/test/test_TrigMessageSvc.cxx +++ b/HLT/Trigger/TrigControl/TrigServices/test/test_TrigMessageSvc.cxx @@ -5,6 +5,9 @@ #include "GaudiKernel/IService.h" #include "GaudiKernel/ISvcLocator.h" +#include "TInterpreter.h" +#include "CxxUtils/ubsan_suppress.h" + #include <random> #include <chrono> #include <cassert> @@ -18,7 +21,9 @@ int main() { using namespace std; ISvcLocator* pSvcLoc; assert(Athena_test::initGaudi(pSvcLoc)); - + + CxxUtils::ubsan_suppress ( []() { TInterpreter::Instance(); } ); + //-------------------------------------------------- // Create THistSvc and TrigMessageSvc //-------------------------------------------------- @@ -65,7 +70,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() < 6000); + assert(td.count() < 8000); //-------------------------------------------------- // Stop and finalise the services diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/CMakeLists.txt b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/CMakeLists.txt index eed2a41471e76751f6acbcbd5964ff82e0b958b0..be2d2c51e6859be7f68a6ee9ea9e4c49e5429ef1 100644 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/CMakeLists.txt +++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/CMakeLists.txt @@ -15,7 +15,7 @@ atlas_add_component( TrigOnlineMonitor src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps ByteStreamData ByteStreamData_test GaudiKernel AthenaInterprocess AthenaKernel ByteStreamCnvSvcBaseLib EventInfo MagFieldInterfaces TrigConfL1Data TrigROBDataProviderSvcLib TrigSteeringEvent TrigMonitorBaseLib TrigSteeringLib L1TopoConfig L1TopoRDO TrigT1Interfaces TrigT1Result TrigT1ResultByteStreamLib TrigConfData) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps ByteStreamData ByteStreamData_test GaudiKernel AthenaInterprocess AthenaKernel ByteStreamCnvSvcBaseLib EventInfo MagFieldInterfaces TrigConfL1Data TrigSteeringEvent TrigMonitorBaseLib TrigSteeringLib L1TopoConfig L1TopoRDO TrigT1Interfaces TrigT1Result TrigT1ResultByteStreamLib TrigConfData) # Install files from the package: atlas_install_headers( TrigOnlineMonitor ) diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigMuCTPiROBMonitor.h b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigMuCTPiROBMonitor.h index c8611fe69ba9864f93093fa5dbe2f6f448489ed5..16fea7e702e17f196fcadd4dcb47d6bd23bb7f1c 100755 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigMuCTPiROBMonitor.h +++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigMuCTPiROBMonitor.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 */ #include "AthenaBaseComps/AthAlgorithm.h" @@ -19,7 +19,6 @@ namespace ROIB { } class MuCTPI_RDO; class IROBDataProviderSvc; -class ITrigROBDataProviderSvc; class TH1F; /// for monitoring purposes class TH2F; /// for monitoring purposes class TProfile2D; /// for monitoring purposes @@ -37,8 +36,6 @@ private: typedef ServiceHandle<IROBDataProviderSvc> IIROBDataProviderSvc_t; /// Reference to the ROBDataProviderSvc service IIROBDataProviderSvc_t m_robDataProviderSvc; - /// Reference to a ROBDataProviderSvc which implements also the trigger additions - SmartIF<ITrigROBDataProviderSvc> m_trigROBDataProviderSvc; /// Source identifiers for ROB fragments IntegerProperty m_lvl1CTPROBid ; diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigROBMonitor.h b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigROBMonitor.h index 061109101731373c874e2bbf85fe6ba540dd28e2..ac42c27fff61faa7332f00fdbcc2babd23c6369f 100755 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigROBMonitor.h +++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/TrigOnlineMonitor/TrigROBMonitor.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 */ #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/SmartIF.h" #include "ByteStreamData/RawEvent.h" -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" #include "GaudiKernel/HistoProperty.h" #include "eformat/Status.h" @@ -32,8 +31,6 @@ private: typedef ServiceHandle<IROBDataProviderSvc> IIROBDataProviderSvc_t; /// Reference to the ROBDataProviderSvc service IIROBDataProviderSvc_t m_robDataProviderSvc; - /// Reference to a ROBDataProviderSvc which implements also the trigger additions - SmartIF<ITrigROBDataProviderSvc> m_trigROBDataProviderSvc; /// Switch for setting the debug StreamTag and name for debug stream BooleanProperty m_setDebugStream; diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.cxx b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.cxx index afee948d60eab7500ffac08309a3f1368c1cf559..0397881a3b869688482b76551b48d4e6161cb423 100755 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.cxx +++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.cxx @@ -20,7 +20,6 @@ #include "AthenaKernel/Timeout.h" #include "TrigConfInterfaces/ITrigConfigSvc.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h" #include "AthenaMonitoringKernel/OHLockedHist.h" #include "EventInfo/TriggerInfo.h" #include "EventInfo/EventInfo.h" diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.h b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.h index 9fa4ca75bb12511fa7c139cb8b49afb779072243..840564901a3c2ee9195d65eb4884336fffc5e9c3 100755 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.h +++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigALFAROBMonitor.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 */ #include "AthenaBaseComps/AthReentrantAlgorithm.h" @@ -36,7 +36,6 @@ namespace ROIB { class MuCTPI_RDO; class IROBDataProviderSvc; -class ITrigROBDataProviderSvc; class TH1F; /// for monitoring purposes class TH2F; /// for monitoring purposes diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigMuCTPiROBMonitor.cxx b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigMuCTPiROBMonitor.cxx index 5b8059c3a3c3aa083fcf78f434a1988dcc1f3673..c5cfecf02083c8808999f5e3428abf7c136ae843 100755 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigMuCTPiROBMonitor.cxx +++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigMuCTPiROBMonitor.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 "TrigOnlineMonitor/TrigMuCTPiROBMonitor.h" @@ -10,7 +10,6 @@ #include "GaudiKernel/ITHistSvc.h" #include "AthenaKernel/Timeout.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h" #include "AthenaMonitoringKernel/OHLockedHist.h" #include "EventInfo/TriggerInfo.h" #include "EventInfo/EventInfo.h" @@ -168,31 +167,14 @@ StatusCode TrigMuCTPiROBMonitor::initialize(){ // Locate the ROBDataProviderSvc - StatusCode sc = m_robDataProviderSvc.retrieve(); - if (!sc.isSuccess()) { - ATH_MSG_ERROR( "Could not find ROBDataProviderSvc" ); - return sc; - } else { - // Setup the L2 ROB Data Provider Service when configured - m_trigROBDataProviderSvc = SmartIF<ITrigROBDataProviderSvc>( &*m_robDataProviderSvc ); - if (m_trigROBDataProviderSvc.isValid()) { - ATH_MSG_DEBUG( "A ROBDataProviderSvc implementing the Level-2 interface ITrigROBDataProviderSvc was found." ); - } else { - ATH_MSG_DEBUG( "No ROBDataProviderSvc implementing the Level-2 interface ITrigROBDataProviderSvc was found." ); - } - } + ATH_CHECK( m_robDataProviderSvc.retrieve() ); // Build the vectors with ROB Ids to retrieve - if (m_trigROBDataProviderSvc.isValid()) { // L2 (retrieve only RoIB version) - m_ctpRobIds.push_back(m_lvl1CTPROBid.value()); - m_muCTPiRobIds.push_back(m_lvl1MuCTPiROBid.value()); - } else { // EF (retrieve RoIB+DAQ version) - m_ctpRobIds.push_back(m_lvl1CTPROBid.value()); - m_ctpRobIds.push_back(m_daqCTPROBid.value()); - - m_muCTPiRobIds.push_back(m_lvl1MuCTPiROBid.value()); - m_muCTPiRobIds.push_back(m_daqMuCTPiROBid.value()); - } + m_ctpRobIds.push_back(m_lvl1CTPROBid.value()); + m_ctpRobIds.push_back(m_daqCTPROBid.value()); + + m_muCTPiRobIds.push_back(m_lvl1MuCTPiROBid.value()); + m_muCTPiRobIds.push_back(m_daqMuCTPiROBid.value()); return StatusCode::SUCCESS; } @@ -274,160 +256,157 @@ StatusCode TrigMuCTPiROBMonitor::execute() { } // compare the the RoIB and DAQ RoIs when running in EF - if (!m_trigROBDataProviderSvc.isValid()) { // not running in L2 (obsolete in merged HLT, leave for reference) - - // Total number of RoIs is different - if (m_lvl1muCTPIRoIs.size() != m_daqmuCTPIRoIs.size()) { - ATH_MSG_DEBUG( " ---> RoI Number mismatch:" - << " number of RoIB RoIs = " << m_lvl1muCTPIRoIs.size() - << " number of DAQ RoIs = " << m_daqmuCTPIRoIs.size()); - float diff_roi = float(m_lvl1muCTPIRoIs.size())- float(m_daqmuCTPIRoIs.size()); - if (m_hist_differenceRoIs) m_hist_differenceRoIs->Fill(diff_roi, 1.); - } + // Total number of RoIs is different + if (m_lvl1muCTPIRoIs.size() != m_daqmuCTPIRoIs.size()) { + ATH_MSG_DEBUG( " ---> RoI Number mismatch:" + << " number of RoIB RoIs = " << m_lvl1muCTPIRoIs.size() + << " number of DAQ RoIs = " << m_daqmuCTPIRoIs.size()); + float diff_roi = float(m_lvl1muCTPIRoIs.size())- float(m_daqmuCTPIRoIs.size()); + if (m_hist_differenceRoIs) m_hist_differenceRoIs->Fill(diff_roi, 1.); + } + + // Comparison of Barrel RoIs + if ((m_lvl1muCTPIHash_Barrel.size() != 0) && (m_daqmuCTPIHash_Barrel.size() != 0)) { + sort(m_lvl1muCTPIHash_Barrel.begin(),m_lvl1muCTPIHash_Barrel.end()); + sort(m_daqmuCTPIHash_Barrel.begin(), m_daqmuCTPIHash_Barrel.end() ); + + if ( !equal(m_daqmuCTPIHash_Barrel.begin(), m_daqmuCTPIHash_Barrel.end(), m_lvl1muCTPIHash_Barrel.begin()) ) { + ATH_MSG_DEBUG( " ---> RoI mismatch for BARREL: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" + << m_Number_Of_Barrel_Units.value() << "\n" + << " Hash for RoIB RoIs = " << m_lvl1muCTPIHash_Barrel << "\n" + << " Hash for DAQ RoIs = " << m_daqmuCTPIHash_Barrel); + std::vector<uint32_t> only_in_RoIB(m_lvl1muCTPIHash_Barrel.size()), + only_in_DAQ(m_daqmuCTPIHash_Barrel.size()); + std::vector<uint32_t>::iterator only_in_RoIB_it, only_in_DAQ_it; + only_in_RoIB_it = set_difference( m_lvl1muCTPIHash_Barrel.begin(), m_lvl1muCTPIHash_Barrel.end(), + m_daqmuCTPIHash_Barrel.begin() , m_daqmuCTPIHash_Barrel.end() , + only_in_RoIB.begin()); + for (std::vector<uint32_t>::iterator it=only_in_RoIB.begin(); it != only_in_RoIB_it; ++it) { + std::ostringstream ost; + ost << *it; + if (m_hist_muCTPiL1_Problem_Barrel_Hash) { + oh_scoped_lock_histogram lock; + m_hist_muCTPiL1_Problem_Barrel_Hash->Fill((ost.str()).c_str(), 1.); + m_hist_muCTPiL1_Problem_Barrel_Hash->LabelsDeflate("X"); + } + } - // Comparison of Barrel RoIs - if ((m_lvl1muCTPIHash_Barrel.size() != 0) && (m_daqmuCTPIHash_Barrel.size() != 0)) { - sort(m_lvl1muCTPIHash_Barrel.begin(),m_lvl1muCTPIHash_Barrel.end()); - sort(m_daqmuCTPIHash_Barrel.begin(), m_daqmuCTPIHash_Barrel.end() ); - - if ( !equal(m_daqmuCTPIHash_Barrel.begin(), m_daqmuCTPIHash_Barrel.end(), m_lvl1muCTPIHash_Barrel.begin()) ) { - ATH_MSG_DEBUG( " ---> RoI mismatch for BARREL: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" - << m_Number_Of_Barrel_Units.value() << "\n" - << " Hash for RoIB RoIs = " << m_lvl1muCTPIHash_Barrel << "\n" - << " Hash for DAQ RoIs = " << m_daqmuCTPIHash_Barrel); - std::vector<uint32_t> only_in_RoIB(m_lvl1muCTPIHash_Barrel.size()), - only_in_DAQ(m_daqmuCTPIHash_Barrel.size()); - std::vector<uint32_t>::iterator only_in_RoIB_it, only_in_DAQ_it; - only_in_RoIB_it = set_difference( m_lvl1muCTPIHash_Barrel.begin(), m_lvl1muCTPIHash_Barrel.end(), - m_daqmuCTPIHash_Barrel.begin() , m_daqmuCTPIHash_Barrel.end() , - only_in_RoIB.begin()); - for (std::vector<uint32_t>::iterator it=only_in_RoIB.begin(); it != only_in_RoIB_it; ++it) { - std::ostringstream ost; - ost << *it; - if (m_hist_muCTPiL1_Problem_Barrel_Hash) { - oh_scoped_lock_histogram lock; - m_hist_muCTPiL1_Problem_Barrel_Hash->Fill((ost.str()).c_str(), 1.); - m_hist_muCTPiL1_Problem_Barrel_Hash->LabelsDeflate("X"); - } - } - - only_in_DAQ_it = set_difference( m_daqmuCTPIHash_Barrel.begin() , m_daqmuCTPIHash_Barrel.end() , - m_lvl1muCTPIHash_Barrel.begin(), m_lvl1muCTPIHash_Barrel.end(), - only_in_DAQ.begin()); - for (std::vector<uint32_t>::iterator it=only_in_DAQ.begin(); it != only_in_DAQ_it; ++it) { - std::ostringstream ost; - ost << *it; - if (m_hist_muCTPiDaq_Problem_Barrel_Hash) { - oh_scoped_lock_histogram lock; - m_hist_muCTPiDaq_Problem_Barrel_Hash->Fill((ost.str()).c_str(), 1.); - m_hist_muCTPiDaq_Problem_Barrel_Hash->LabelsDeflate("X"); - } - } - - ATH_MSG_DEBUG( " ---> RoI mismatch for BARREL: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" - << m_Number_Of_Barrel_Units.value() << "\n" - << " Hash for RoIs which are only in the RoIB list = " << only_in_RoIB << "\n" - << " Hash for RoIs which are only in the DAQ list = " << only_in_DAQ - ); + only_in_DAQ_it = set_difference( m_daqmuCTPIHash_Barrel.begin() , m_daqmuCTPIHash_Barrel.end() , + m_lvl1muCTPIHash_Barrel.begin(), m_lvl1muCTPIHash_Barrel.end(), + only_in_DAQ.begin()); + for (std::vector<uint32_t>::iterator it=only_in_DAQ.begin(); it != only_in_DAQ_it; ++it) { + std::ostringstream ost; + ost << *it; + if (m_hist_muCTPiDaq_Problem_Barrel_Hash) { + oh_scoped_lock_histogram lock; + m_hist_muCTPiDaq_Problem_Barrel_Hash->Fill((ost.str()).c_str(), 1.); + m_hist_muCTPiDaq_Problem_Barrel_Hash->LabelsDeflate("X"); + } } + + ATH_MSG_DEBUG( " ---> RoI mismatch for BARREL: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" + << m_Number_Of_Barrel_Units.value() << "\n" + << " Hash for RoIs which are only in the RoIB list = " << only_in_RoIB << "\n" + << " Hash for RoIs which are only in the DAQ list = " << only_in_DAQ + ); } + } - // Comparison of Endcap RoIs - if ((m_lvl1muCTPIHash_Endcap.size() != 0) && (m_daqmuCTPIHash_Endcap.size() != 0)) { - sort(m_lvl1muCTPIHash_Endcap.begin(),m_lvl1muCTPIHash_Endcap.end()); - sort(m_daqmuCTPIHash_Endcap.begin(), m_daqmuCTPIHash_Endcap.end() ); - - if ( !equal(m_daqmuCTPIHash_Endcap.begin(), m_daqmuCTPIHash_Endcap.end(), m_lvl1muCTPIHash_Endcap.begin()) ) { - ATH_MSG_DEBUG( " ---> RoI mismatch for ENDCAP: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" - << m_Number_Of_Endcap_Units.value() << "\n" - << " Hash for RoIB RoIs = " << m_lvl1muCTPIHash_Endcap << "\n" - << " Hash for DAQ RoIs = " << m_daqmuCTPIHash_Endcap); - - std::vector<uint32_t> only_in_RoIB(m_lvl1muCTPIHash_Endcap.size()), - only_in_DAQ(m_daqmuCTPIHash_Endcap.size()); - std::vector<uint32_t>::iterator only_in_RoIB_it, only_in_DAQ_it; - only_in_RoIB_it = set_difference( m_lvl1muCTPIHash_Endcap.begin(), m_lvl1muCTPIHash_Endcap.end(), - m_daqmuCTPIHash_Endcap.begin() , m_daqmuCTPIHash_Endcap.end() , - only_in_RoIB.begin()); - for (std::vector<uint32_t>::iterator it=only_in_RoIB.begin(); it != only_in_RoIB_it; ++it) { - std::ostringstream ost; - ost << *it; - if (m_hist_muCTPiL1_Problem_Endcap_Hash) { - oh_scoped_lock_histogram lock; - m_hist_muCTPiL1_Problem_Endcap_Hash->Fill((ost.str()).c_str(), 1.); - m_hist_muCTPiL1_Problem_Endcap_Hash->LabelsDeflate("X"); - } - } - - only_in_DAQ_it = set_difference( m_daqmuCTPIHash_Endcap.begin() , m_daqmuCTPIHash_Endcap.end() , - m_lvl1muCTPIHash_Endcap.begin(), m_lvl1muCTPIHash_Endcap.end(), - only_in_DAQ.begin()); - for (std::vector<uint32_t>::iterator it=only_in_DAQ.begin(); it != only_in_DAQ_it; ++it) { - std::ostringstream ost; - ost << *it; - if (m_hist_muCTPiDaq_Problem_Endcap_Hash) { - oh_scoped_lock_histogram lock; - m_hist_muCTPiDaq_Problem_Endcap_Hash->Fill((ost.str()).c_str(), 1.); - m_hist_muCTPiDaq_Problem_Endcap_Hash->LabelsDeflate("X"); - } - } - - ATH_MSG_DEBUG( " ---> RoI mismatch for ENDCAP: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" - << m_Number_Of_Endcap_Units.value() << "\n" - << " Hash for RoIs which are only in the RoIB list = " << only_in_RoIB << "\n" - << " Hash for RoIs which are only in the DAQ list = " << only_in_DAQ - ); + // Comparison of Endcap RoIs + if ((m_lvl1muCTPIHash_Endcap.size() != 0) && (m_daqmuCTPIHash_Endcap.size() != 0)) { + sort(m_lvl1muCTPIHash_Endcap.begin(),m_lvl1muCTPIHash_Endcap.end()); + sort(m_daqmuCTPIHash_Endcap.begin(), m_daqmuCTPIHash_Endcap.end() ); + + if ( !equal(m_daqmuCTPIHash_Endcap.begin(), m_daqmuCTPIHash_Endcap.end(), m_lvl1muCTPIHash_Endcap.begin()) ) { + ATH_MSG_DEBUG( " ---> RoI mismatch for ENDCAP: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" + << m_Number_Of_Endcap_Units.value() << "\n" + << " Hash for RoIB RoIs = " << m_lvl1muCTPIHash_Endcap << "\n" + << " Hash for DAQ RoIs = " << m_daqmuCTPIHash_Endcap); + + std::vector<uint32_t> only_in_RoIB(m_lvl1muCTPIHash_Endcap.size()), + only_in_DAQ(m_daqmuCTPIHash_Endcap.size()); + std::vector<uint32_t>::iterator only_in_RoIB_it, only_in_DAQ_it; + only_in_RoIB_it = set_difference( m_lvl1muCTPIHash_Endcap.begin(), m_lvl1muCTPIHash_Endcap.end(), + m_daqmuCTPIHash_Endcap.begin() , m_daqmuCTPIHash_Endcap.end() , + only_in_RoIB.begin()); + for (std::vector<uint32_t>::iterator it=only_in_RoIB.begin(); it != only_in_RoIB_it; ++it) { + std::ostringstream ost; + ost << *it; + if (m_hist_muCTPiL1_Problem_Endcap_Hash) { + oh_scoped_lock_histogram lock; + m_hist_muCTPiL1_Problem_Endcap_Hash->Fill((ost.str()).c_str(), 1.); + m_hist_muCTPiL1_Problem_Endcap_Hash->LabelsDeflate("X"); + } } + + only_in_DAQ_it = set_difference( m_daqmuCTPIHash_Endcap.begin() , m_daqmuCTPIHash_Endcap.end() , + m_lvl1muCTPIHash_Endcap.begin(), m_lvl1muCTPIHash_Endcap.end(), + only_in_DAQ.begin()); + for (std::vector<uint32_t>::iterator it=only_in_DAQ.begin(); it != only_in_DAQ_it; ++it) { + std::ostringstream ost; + ost << *it; + if (m_hist_muCTPiDaq_Problem_Endcap_Hash) { + oh_scoped_lock_histogram lock; + m_hist_muCTPiDaq_Problem_Endcap_Hash->Fill((ost.str()).c_str(), 1.); + m_hist_muCTPiDaq_Problem_Endcap_Hash->LabelsDeflate("X"); + } + } + + ATH_MSG_DEBUG( " ---> RoI mismatch for ENDCAP: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" + << m_Number_Of_Endcap_Units.value() << "\n" + << " Hash for RoIs which are only in the RoIB list = " << only_in_RoIB << "\n" + << " Hash for RoIs which are only in the DAQ list = " << only_in_DAQ + ); } + } + + // Comparison of Forward RoIs + if ((m_lvl1muCTPIHash_Forward.size() != 0) && (m_daqmuCTPIHash_Forward.size() != 0)) { + sort(m_lvl1muCTPIHash_Forward.begin(),m_lvl1muCTPIHash_Forward.end()); + sort(m_daqmuCTPIHash_Forward.begin(), m_daqmuCTPIHash_Forward.end() ); + + if ( !equal(m_daqmuCTPIHash_Forward.begin(), m_daqmuCTPIHash_Forward.end(), m_lvl1muCTPIHash_Forward.begin()) ) { + ATH_MSG_DEBUG( " ---> RoI mismatch for FORWARD: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" + << m_Number_Of_Forward_Units.value() << "\n" + << " Hash for RoIB RoIs = " << m_lvl1muCTPIHash_Forward << "\n" + << " Hash for DAQ RoIs = " << m_daqmuCTPIHash_Forward + ); + std::vector<uint32_t> only_in_RoIB(m_lvl1muCTPIHash_Forward.size()), + only_in_DAQ(m_daqmuCTPIHash_Forward.size()); + std::vector<uint32_t>::iterator only_in_RoIB_it, only_in_DAQ_it; + only_in_RoIB_it = set_difference( m_lvl1muCTPIHash_Forward.begin(), m_lvl1muCTPIHash_Forward.end(), + m_daqmuCTPIHash_Forward.begin() , m_daqmuCTPIHash_Forward.end() , + only_in_RoIB.begin()); + for (std::vector<uint32_t>::iterator it=only_in_RoIB.begin(); it != only_in_RoIB_it; ++it) { + std::ostringstream ost; + ost << *it; + if (m_hist_muCTPiL1_Problem_Forward_Hash) { + oh_scoped_lock_histogram lock; + m_hist_muCTPiL1_Problem_Forward_Hash->Fill((ost.str()).c_str(), 1.); + m_hist_muCTPiL1_Problem_Forward_Hash->LabelsDeflate("X"); + } + } - // Comparison of Forward RoIs - if ((m_lvl1muCTPIHash_Forward.size() != 0) && (m_daqmuCTPIHash_Forward.size() != 0)) { - sort(m_lvl1muCTPIHash_Forward.begin(),m_lvl1muCTPIHash_Forward.end()); - sort(m_daqmuCTPIHash_Forward.begin(), m_daqmuCTPIHash_Forward.end() ); - - if ( !equal(m_daqmuCTPIHash_Forward.begin(), m_daqmuCTPIHash_Forward.end(), m_lvl1muCTPIHash_Forward.begin()) ) { - ATH_MSG_DEBUG( " ---> RoI mismatch for FORWARD: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" - << m_Number_Of_Forward_Units.value() << "\n" - << " Hash for RoIB RoIs = " << m_lvl1muCTPIHash_Forward << "\n" - << " Hash for DAQ RoIs = " << m_daqmuCTPIHash_Forward - ); - std::vector<uint32_t> only_in_RoIB(m_lvl1muCTPIHash_Forward.size()), - only_in_DAQ(m_daqmuCTPIHash_Forward.size()); - std::vector<uint32_t>::iterator only_in_RoIB_it, only_in_DAQ_it; - only_in_RoIB_it = set_difference( m_lvl1muCTPIHash_Forward.begin(), m_lvl1muCTPIHash_Forward.end(), - m_daqmuCTPIHash_Forward.begin() , m_daqmuCTPIHash_Forward.end() , - only_in_RoIB.begin()); - for (std::vector<uint32_t>::iterator it=only_in_RoIB.begin(); it != only_in_RoIB_it; ++it) { - std::ostringstream ost; - ost << *it; - if (m_hist_muCTPiL1_Problem_Forward_Hash) { - oh_scoped_lock_histogram lock; - m_hist_muCTPiL1_Problem_Forward_Hash->Fill((ost.str()).c_str(), 1.); - m_hist_muCTPiL1_Problem_Forward_Hash->LabelsDeflate("X"); - } - } - - only_in_DAQ_it = set_difference( m_daqmuCTPIHash_Forward.begin() , m_daqmuCTPIHash_Forward.end() , - m_lvl1muCTPIHash_Forward.begin(), m_lvl1muCTPIHash_Forward.end(), - only_in_DAQ.begin()); - for (std::vector<uint32_t>::iterator it=only_in_DAQ.begin(); it != only_in_DAQ_it; ++it) { - std::ostringstream ost; - ost << *it; - if (m_hist_muCTPiDaq_Problem_Forward_Hash) { - oh_scoped_lock_histogram lock; - m_hist_muCTPiDaq_Problem_Forward_Hash->Fill((ost.str()).c_str(), 1.); - m_hist_muCTPiDaq_Problem_Forward_Hash->LabelsDeflate("X"); - } - } - - ATH_MSG_DEBUG( " ---> RoI mismatch for FORWARD: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" - << m_Number_Of_Forward_Units.value() << "\n" - << " Hash for RoIs which are only in the RoIB list = " << only_in_RoIB << "\n" - << " Hash for RoIs which are only in the DAQ list = " << only_in_DAQ - ); + only_in_DAQ_it = set_difference( m_daqmuCTPIHash_Forward.begin() , m_daqmuCTPIHash_Forward.end() , + m_lvl1muCTPIHash_Forward.begin(), m_lvl1muCTPIHash_Forward.end(), + only_in_DAQ.begin()); + for (std::vector<uint32_t>::iterator it=only_in_DAQ.begin(); it != only_in_DAQ_it; ++it) { + std::ostringstream ost; + ost << *it; + if (m_hist_muCTPiDaq_Problem_Forward_Hash) { + oh_scoped_lock_histogram lock; + m_hist_muCTPiDaq_Problem_Forward_Hash->Fill((ost.str()).c_str(), 1.); + m_hist_muCTPiDaq_Problem_Forward_Hash->LabelsDeflate("X"); + } } + + ATH_MSG_DEBUG( " ---> RoI mismatch for FORWARD: Hash = RoI-ID*1000 + Sector_ID + hemisphere*" + << m_Number_Of_Forward_Units.value() << "\n" + << " Hash for RoIs which are only in the RoIB list = " << only_in_RoIB << "\n" + << " Hash for RoIs which are only in the DAQ list = " << only_in_DAQ + ); } - } // end test for L2 + } // if the event shows errors, set the DEBUG stream tag when requested @@ -493,8 +472,6 @@ StatusCode TrigMuCTPiROBMonitor::finalize() { m_daqmuCTPIResult=0; } - m_trigROBDataProviderSvc.reset(); - return StatusCode::SUCCESS; } @@ -688,195 +665,192 @@ StatusCode TrigMuCTPiROBMonitor::start() { } } - if (!m_trigROBDataProviderSvc.isValid()) { // Define DAQ histograms only when not running in L2 - // *-- DAQ Endcap - histTitle = m_histProp_muCTPi_Endcap_SectorID.value().title()+std::string("_DAQ_")+strHemisphere[hemisphere]; - m_hist_muCTPiDaq_Endcap_SectorID[hemisphere] = new TH1F ( histTitle.c_str(), - (histTitle+";Sector Id").c_str(), - m_histProp_muCTPi_Endcap_SectorID.value().bins(), - m_histProp_muCTPi_Endcap_SectorID.value().lowEdge(), - m_histProp_muCTPi_Endcap_SectorID.value().highEdge()); - if (m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]) { - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]->GetName(), - m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]->GetName() ); - } + // *-- DAQ Endcap + histTitle = m_histProp_muCTPi_Endcap_SectorID.value().title()+std::string("_DAQ_")+strHemisphere[hemisphere]; + m_hist_muCTPiDaq_Endcap_SectorID[hemisphere] = new TH1F ( histTitle.c_str(), + (histTitle+";Sector Id").c_str(), + m_histProp_muCTPi_Endcap_SectorID.value().bins(), + m_histProp_muCTPi_Endcap_SectorID.value().lowEdge(), + m_histProp_muCTPi_Endcap_SectorID.value().highEdge()); + if (m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]) { + if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]->GetName(), + m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Endcap_SectorID[hemisphere]->GetName() ); } - // *-- DAQ Forward - histTitle = m_histProp_muCTPi_Forward_SectorID.value().title()+std::string("_DAQ_")+strHemisphere[hemisphere]; - m_hist_muCTPiDaq_Forward_SectorID[hemisphere] = new TH1F ( histTitle.c_str(), - (histTitle+";Sector Id").c_str(), - m_histProp_muCTPi_Forward_SectorID.value().bins(), - m_histProp_muCTPi_Forward_SectorID.value().lowEdge(), - m_histProp_muCTPi_Forward_SectorID.value().highEdge()); - if (m_hist_muCTPiDaq_Forward_SectorID[hemisphere]) { - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Forward_SectorID[hemisphere]->GetName(), - m_hist_muCTPiDaq_Forward_SectorID[hemisphere]).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Forward_SectorID[hemisphere]->GetName() ); - } + } + // *-- DAQ Forward + histTitle = m_histProp_muCTPi_Forward_SectorID.value().title()+std::string("_DAQ_")+strHemisphere[hemisphere]; + m_hist_muCTPiDaq_Forward_SectorID[hemisphere] = new TH1F ( histTitle.c_str(), + (histTitle+";Sector Id").c_str(), + m_histProp_muCTPi_Forward_SectorID.value().bins(), + m_histProp_muCTPi_Forward_SectorID.value().lowEdge(), + m_histProp_muCTPi_Forward_SectorID.value().highEdge()); + if (m_hist_muCTPiDaq_Forward_SectorID[hemisphere]) { + if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Forward_SectorID[hemisphere]->GetName(), + m_hist_muCTPiDaq_Forward_SectorID[hemisphere]).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Forward_SectorID[hemisphere]->GetName() ); } - // *-- DAQ Barrel - histTitle = m_histProp_muCTPi_Barrel_SectorID.value().title()+std::string("_DAQ_")+strHemisphere[hemisphere]; - m_hist_muCTPiDaq_Barrel_SectorID[hemisphere] = new TH1F ( histTitle.c_str(), - (histTitle+";Sector Id").c_str(), - m_histProp_muCTPi_Barrel_SectorID.value().bins(), - m_histProp_muCTPi_Barrel_SectorID.value().lowEdge(), - m_histProp_muCTPi_Barrel_SectorID.value().highEdge()); - if (m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]) { - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]->GetName(), - m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]->GetName() ); - } + } + // *-- DAQ Barrel + histTitle = m_histProp_muCTPi_Barrel_SectorID.value().title()+std::string("_DAQ_")+strHemisphere[hemisphere]; + m_hist_muCTPiDaq_Barrel_SectorID[hemisphere] = new TH1F ( histTitle.c_str(), + (histTitle+";Sector Id").c_str(), + m_histProp_muCTPi_Barrel_SectorID.value().bins(), + m_histProp_muCTPi_Barrel_SectorID.value().lowEdge(), + m_histProp_muCTPi_Barrel_SectorID.value().highEdge()); + if (m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]) { + if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]->GetName(), + m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Barrel_SectorID[hemisphere]->GetName() ); } - } // end check for L2 + } } // end loop over hemispheres - if (!m_trigROBDataProviderSvc.isValid()) { // Define RoIB-DAQ comparison histograms only when not running in L2 + // *-- Number of muCTPi RoIs // *-- DAQ - histTitle = m_histProp_NumberOfRoIs.value().title()+std::string("_DAQ"); - m_hist_NumberOfRoIs_DAQ = new TH1F ( histTitle.c_str(), - (histTitle+";Number of RoIs").c_str(), - m_histProp_NumberOfRoIs.value().bins(), - m_histProp_NumberOfRoIs.value().lowEdge(), - m_histProp_NumberOfRoIs.value().highEdge()); - if (m_hist_NumberOfRoIs_DAQ) { - if( rootHistSvc->regHist(path + m_hist_NumberOfRoIs_DAQ->GetName(), m_hist_NumberOfRoIs_DAQ).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_NumberOfRoIs_DAQ->GetName() ); - } + histTitle = m_histProp_NumberOfRoIs.value().title()+std::string("_DAQ"); + m_hist_NumberOfRoIs_DAQ = new TH1F ( histTitle.c_str(), + (histTitle+";Number of RoIs").c_str(), + m_histProp_NumberOfRoIs.value().bins(), + m_histProp_NumberOfRoIs.value().lowEdge(), + m_histProp_NumberOfRoIs.value().highEdge()); + if (m_hist_NumberOfRoIs_DAQ) { + if( rootHistSvc->regHist(path + m_hist_NumberOfRoIs_DAQ->GetName(), m_hist_NumberOfRoIs_DAQ).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_NumberOfRoIs_DAQ->GetName() ); } + } - // *-- Sector_ID vs. Pad_Id for Barrel RoIs from DAQ - for (unsigned int threshold=0; threshold <= NUMBER_OF_PT_THRESHOLDS; ++threshold) { - histTitle = std::string("Sector_ID_vs_Pad_ID_Barrel_DAQ_Threshold_")+strThreshold[threshold]; - m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold] = - new TH2F ( histTitle.c_str(), - (histTitle+";(pad_ID+1)*(2*hemispere-1);SD id;").c_str(), - 17,-8,8, - m_Number_Of_Barrel_Units.value(), 0, m_Number_Of_Barrel_Units.value()); - if (m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold]) { - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold]->GetName(), - m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold]).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold]->GetName() ); - } + // *-- Sector_ID vs. Pad_Id for Barrel RoIs from DAQ + for (unsigned int threshold=0; threshold <= NUMBER_OF_PT_THRESHOLDS; ++threshold) { + histTitle = std::string("Sector_ID_vs_Pad_ID_Barrel_DAQ_Threshold_")+strThreshold[threshold]; + m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold] = + new TH2F ( histTitle.c_str(), + (histTitle+";(pad_ID+1)*(2*hemispere-1);SD id;").c_str(), + 17,-8,8, + m_Number_Of_Barrel_Units.value(), 0, m_Number_Of_Barrel_Units.value()); + if (m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold]) { + if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold]->GetName(), + m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold]).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Barrel_SectorID_Pad[threshold]->GetName() ); } - } // end loop over threshold + } + } // end loop over threshold // *-- Profile: Difference of BCID to event BCID as function of Sector_ID vs. Pad_Id for Barrel RoIs from DAQ - histTitle = std::string("Difference_BCID_for_Sector_ID_vs_Pad_ID_Barrel_DAQ_ROB"); - m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID = new TProfile2D(histTitle.c_str(), - (histTitle+";(pad_ID+1)*(2*hemispere-1);SD id;").c_str(), - 17,-8,8, - m_Number_Of_Barrel_Units.value(), 0, m_Number_Of_Barrel_Units.value(), -10., 10.); - if (m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID) { - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID->GetName(), - m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID->GetName() ); - } + histTitle = std::string("Difference_BCID_for_Sector_ID_vs_Pad_ID_Barrel_DAQ_ROB"); + m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID = new TProfile2D(histTitle.c_str(), + (histTitle+";(pad_ID+1)*(2*hemispere-1);SD id;").c_str(), + 17,-8,8, + m_Number_Of_Barrel_Units.value(), 0, m_Number_Of_Barrel_Units.value(), -10., 10.); + if (m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID) { + if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID->GetName(), + m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Barrel_SectorID_Pad_DeltaBCID->GetName() ); } + } - // *-- Difference # of RoIs in RoIB - DAQ ROB - m_hist_differenceRoIs = new TH1F (m_histProp_differenceRoIs.value().title().c_str(), - (m_histProp_differenceRoIs.value().title()+";Difference (RoIB-DAQ) RoIs").c_str(), - m_histProp_differenceRoIs.value().bins(), - m_histProp_differenceRoIs.value().lowEdge(), - m_histProp_differenceRoIs.value().highEdge()); - if (m_hist_differenceRoIs) { - if( rootHistSvc->regHist(path + m_hist_differenceRoIs->GetName(), m_hist_differenceRoIs).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_differenceRoIs->GetName() ); - } + // *-- Difference # of RoIs in RoIB - DAQ ROB + m_hist_differenceRoIs = new TH1F (m_histProp_differenceRoIs.value().title().c_str(), + (m_histProp_differenceRoIs.value().title()+";Difference (RoIB-DAQ) RoIs").c_str(), + m_histProp_differenceRoIs.value().bins(), + m_histProp_differenceRoIs.value().lowEdge(), + m_histProp_differenceRoIs.value().highEdge()); + if (m_hist_differenceRoIs) { + if( rootHistSvc->regHist(path + m_hist_differenceRoIs->GetName(), m_hist_differenceRoIs).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_differenceRoIs->GetName() ); } + } - // *-- Barrel: Hash for RoIs which are only in RoIB ROB - histTitle = m_histProp_Problem_Barrel_Hash.value().title()+std::string("_RoIB_ROB"); - m_hist_muCTPiL1_Problem_Barrel_Hash = new TH1F (histTitle.c_str(), - (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*32").c_str(), - m_histProp_Problem_Barrel_Hash.value().bins(), - m_histProp_Problem_Barrel_Hash.value().lowEdge(), - m_histProp_Problem_Barrel_Hash.value().highEdge()); - if (m_hist_muCTPiL1_Problem_Barrel_Hash) { - m_hist_muCTPiL1_Problem_Barrel_Hash->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Problem_Barrel_Hash->GetName(), - m_hist_muCTPiL1_Problem_Barrel_Hash).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiL1_Problem_Barrel_Hash->GetName() ); - } + // *-- Barrel: Hash for RoIs which are only in RoIB ROB + histTitle = m_histProp_Problem_Barrel_Hash.value().title()+std::string("_RoIB_ROB"); + m_hist_muCTPiL1_Problem_Barrel_Hash = new TH1F (histTitle.c_str(), + (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*32").c_str(), + m_histProp_Problem_Barrel_Hash.value().bins(), + m_histProp_Problem_Barrel_Hash.value().lowEdge(), + m_histProp_Problem_Barrel_Hash.value().highEdge()); + if (m_hist_muCTPiL1_Problem_Barrel_Hash) { + m_hist_muCTPiL1_Problem_Barrel_Hash->SetCanExtend(TH1::kAllAxes); + if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Problem_Barrel_Hash->GetName(), + m_hist_muCTPiL1_Problem_Barrel_Hash).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiL1_Problem_Barrel_Hash->GetName() ); } + } - // *-- Barrel: Hash for RoIs which are only in DAQ ROB - histTitle = m_histProp_Problem_Barrel_Hash.value().title()+std::string("_DAQ_ROB"); - m_hist_muCTPiDaq_Problem_Barrel_Hash = new TH1F (histTitle.c_str(), - (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*32").c_str(), - m_histProp_Problem_Barrel_Hash.value().bins(), - m_histProp_Problem_Barrel_Hash.value().lowEdge(), - m_histProp_Problem_Barrel_Hash.value().highEdge()); - if (m_hist_muCTPiDaq_Problem_Barrel_Hash) { - m_hist_muCTPiDaq_Problem_Barrel_Hash->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Problem_Barrel_Hash->GetName(), - m_hist_muCTPiDaq_Problem_Barrel_Hash).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Problem_Barrel_Hash->GetName() ); - } + // *-- Barrel: Hash for RoIs which are only in DAQ ROB + histTitle = m_histProp_Problem_Barrel_Hash.value().title()+std::string("_DAQ_ROB"); + m_hist_muCTPiDaq_Problem_Barrel_Hash = new TH1F (histTitle.c_str(), + (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*32").c_str(), + m_histProp_Problem_Barrel_Hash.value().bins(), + m_histProp_Problem_Barrel_Hash.value().lowEdge(), + m_histProp_Problem_Barrel_Hash.value().highEdge()); + if (m_hist_muCTPiDaq_Problem_Barrel_Hash) { + m_hist_muCTPiDaq_Problem_Barrel_Hash->SetCanExtend(TH1::kAllAxes); + if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Problem_Barrel_Hash->GetName(), + m_hist_muCTPiDaq_Problem_Barrel_Hash).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Problem_Barrel_Hash->GetName() ); } + } - // *-- Endcap: Hash for RoIs which are only in RoIB ROB - histTitle = m_histProp_Problem_Endcap_Hash.value().title()+std::string("_RoIB_ROB"); - m_hist_muCTPiL1_Problem_Endcap_Hash = new TH1F (histTitle.c_str(), - (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*48").c_str(), - m_histProp_Problem_Endcap_Hash.value().bins(), - m_histProp_Problem_Endcap_Hash.value().lowEdge(), - m_histProp_Problem_Endcap_Hash.value().highEdge()); - if (m_hist_muCTPiL1_Problem_Endcap_Hash) { - m_hist_muCTPiL1_Problem_Endcap_Hash->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Problem_Endcap_Hash->GetName(), - m_hist_muCTPiL1_Problem_Endcap_Hash).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiL1_Problem_Endcap_Hash->GetName() ); - } + // *-- Endcap: Hash for RoIs which are only in RoIB ROB + histTitle = m_histProp_Problem_Endcap_Hash.value().title()+std::string("_RoIB_ROB"); + m_hist_muCTPiL1_Problem_Endcap_Hash = new TH1F (histTitle.c_str(), + (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*48").c_str(), + m_histProp_Problem_Endcap_Hash.value().bins(), + m_histProp_Problem_Endcap_Hash.value().lowEdge(), + m_histProp_Problem_Endcap_Hash.value().highEdge()); + if (m_hist_muCTPiL1_Problem_Endcap_Hash) { + m_hist_muCTPiL1_Problem_Endcap_Hash->SetCanExtend(TH1::kAllAxes); + if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Problem_Endcap_Hash->GetName(), + m_hist_muCTPiL1_Problem_Endcap_Hash).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiL1_Problem_Endcap_Hash->GetName() ); } + } - // *-- Endcap: Hash for RoIs which are only in DAQ ROB - histTitle = m_histProp_Problem_Endcap_Hash.value().title()+std::string("_DAQ_ROB"); - m_hist_muCTPiDaq_Problem_Endcap_Hash = new TH1F (histTitle.c_str(), - (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*48").c_str(), - m_histProp_Problem_Endcap_Hash.value().bins(), - m_histProp_Problem_Endcap_Hash.value().lowEdge(), - m_histProp_Problem_Endcap_Hash.value().highEdge()); - if (m_hist_muCTPiDaq_Problem_Endcap_Hash) { - m_hist_muCTPiDaq_Problem_Endcap_Hash->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Problem_Endcap_Hash->GetName(), - m_hist_muCTPiDaq_Problem_Endcap_Hash).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Problem_Endcap_Hash->GetName() ); - } + // *-- Endcap: Hash for RoIs which are only in DAQ ROB + histTitle = m_histProp_Problem_Endcap_Hash.value().title()+std::string("_DAQ_ROB"); + m_hist_muCTPiDaq_Problem_Endcap_Hash = new TH1F (histTitle.c_str(), + (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*48").c_str(), + m_histProp_Problem_Endcap_Hash.value().bins(), + m_histProp_Problem_Endcap_Hash.value().lowEdge(), + m_histProp_Problem_Endcap_Hash.value().highEdge()); + if (m_hist_muCTPiDaq_Problem_Endcap_Hash) { + m_hist_muCTPiDaq_Problem_Endcap_Hash->SetCanExtend(TH1::kAllAxes); + if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Problem_Endcap_Hash->GetName(), + m_hist_muCTPiDaq_Problem_Endcap_Hash).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Problem_Endcap_Hash->GetName() ); } + } - // *-- Forward: Hash for RoIs which are only in RoIB ROB - histTitle = m_histProp_Problem_Forward_Hash.value().title()+std::string("_RoIB_ROB"); - m_hist_muCTPiL1_Problem_Forward_Hash = new TH1F (histTitle.c_str(), - (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*24").c_str(), - m_histProp_Problem_Forward_Hash.value().bins(), - m_histProp_Problem_Forward_Hash.value().lowEdge(), - m_histProp_Problem_Forward_Hash.value().highEdge()); - if (m_hist_muCTPiL1_Problem_Forward_Hash) { - m_hist_muCTPiL1_Problem_Forward_Hash->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Problem_Forward_Hash->GetName(), - m_hist_muCTPiL1_Problem_Forward_Hash).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiL1_Problem_Forward_Hash->GetName() ); - } + // *-- Forward: Hash for RoIs which are only in RoIB ROB + histTitle = m_histProp_Problem_Forward_Hash.value().title()+std::string("_RoIB_ROB"); + m_hist_muCTPiL1_Problem_Forward_Hash = new TH1F (histTitle.c_str(), + (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*24").c_str(), + m_histProp_Problem_Forward_Hash.value().bins(), + m_histProp_Problem_Forward_Hash.value().lowEdge(), + m_histProp_Problem_Forward_Hash.value().highEdge()); + if (m_hist_muCTPiL1_Problem_Forward_Hash) { + m_hist_muCTPiL1_Problem_Forward_Hash->SetCanExtend(TH1::kAllAxes); + if( rootHistSvc->regHist(path + m_hist_muCTPiL1_Problem_Forward_Hash->GetName(), + m_hist_muCTPiL1_Problem_Forward_Hash).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiL1_Problem_Forward_Hash->GetName() ); } + } - // *-- Forward: Hash for RoIs which are only in DAQ ROB - histTitle = m_histProp_Problem_Forward_Hash.value().title()+std::string("_DAQ_ROB"); - m_hist_muCTPiDaq_Problem_Forward_Hash = new TH1F (histTitle.c_str(), - (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*24").c_str(), - m_histProp_Problem_Forward_Hash.value().bins(), - m_histProp_Problem_Forward_Hash.value().lowEdge(), - m_histProp_Problem_Forward_Hash.value().highEdge()); - if (m_hist_muCTPiDaq_Problem_Forward_Hash) { - m_hist_muCTPiDaq_Problem_Forward_Hash->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Problem_Forward_Hash->GetName(), - m_hist_muCTPiDaq_Problem_Forward_Hash).isFailure() ) { - ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Problem_Forward_Hash->GetName() ); - } + // *-- Forward: Hash for RoIs which are only in DAQ ROB + histTitle = m_histProp_Problem_Forward_Hash.value().title()+std::string("_DAQ_ROB"); + m_hist_muCTPiDaq_Problem_Forward_Hash = new TH1F (histTitle.c_str(), + (histTitle+";RoI_ID*1000 + Sector_ID + hemisphere*24").c_str(), + m_histProp_Problem_Forward_Hash.value().bins(), + m_histProp_Problem_Forward_Hash.value().lowEdge(), + m_histProp_Problem_Forward_Hash.value().highEdge()); + if (m_hist_muCTPiDaq_Problem_Forward_Hash) { + m_hist_muCTPiDaq_Problem_Forward_Hash->SetCanExtend(TH1::kAllAxes); + if( rootHistSvc->regHist(path + m_hist_muCTPiDaq_Problem_Forward_Hash->GetName(), + m_hist_muCTPiDaq_Problem_Forward_Hash).isFailure() ) { + ATH_MSG_WARNING( "Can not register monitoring histogram: " << m_hist_muCTPiDaq_Problem_Forward_Hash->GetName() ); } - } // end check for L2 + } // release histogramming service diff --git a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigROBMonitor.cxx b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigROBMonitor.cxx index e2a1b3428db98538eb8371492b771cc867487b2a..6d8e576154034638960745f01ec2145e962b2efa 100755 --- a/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigROBMonitor.cxx +++ b/HLT/Trigger/TrigMonitoring/TrigOnlineMonitor/src/TrigROBMonitor.cxx @@ -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 */ #include "TrigOnlineMonitor/TrigROBMonitor.h" #include "GaudiKernel/ITHistSvc.h" #include "AthenaKernel/Timeout.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h" #include "AthenaMonitoringKernel/OHLockedHist.h" #include "EventInfo/TriggerInfo.h" #include "EventInfo/EventInfo.h" @@ -91,23 +90,8 @@ StatusCode TrigROBMonitor::initialize(){ ATH_MSG_INFO( " Plot ROB data volumes = " << m_doROBDataVolume ); ATH_MSG_INFO( " Hist:TotalDataVolumeROB = " << m_histProp_totalDataVolumeROB ); - // Locate the ROBDataProviderSvc - StatusCode sc = m_robDataProviderSvc.retrieve(); - if (!sc.isSuccess()) { - ATH_MSG_ERROR( "Could not find ROBDataProviderSvc" ); - return sc; - } else { - // Setup the L2 ROB Data Provider Service when configured - m_trigROBDataProviderSvc = SmartIF<ITrigROBDataProviderSvc>( &*m_robDataProviderSvc ); - if (m_trigROBDataProviderSvc.isValid()) { - ATH_MSG_DEBUG( "A ROBDataProviderSvc implementing the Level-2 interface ITrigROBDataProviderSvc was found." - ); - } else { - ATH_MSG_DEBUG( "No ROBDataProviderSvc implementing the Level-2 interface ITrigROBDataProviderSvc was found." - ); - } - } + ATH_CHECK( m_robDataProviderSvc.retrieve() ); return StatusCode::SUCCESS; } @@ -133,30 +117,7 @@ StatusCode TrigROBMonitor::execute() { int total_ROB_Data_Volume(0); std::map< eformat::SubDetector, uint32_t > rob_Data_Volume_SD; - // In L2 access directly the cache - if (m_trigROBDataProviderSvc.isValid()) { - ATH_MSG_DEBUG( " ===> Lvl2ROBDataProviderSvc is used : # ROB fragments = " - << m_trigROBDataProviderSvc->sizeROBCache() - ); - for (std::map<uint32_t, OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment>::iterator it = m_trigROBDataProviderSvc->beginROBCache(); - it != m_trigROBDataProviderSvc->endROBCache(); ++it) { - // check for time out - if (Athena::Timeout::instance().reached()) { - ATH_MSG_INFO( " Time out reached in loop over ROB fragments." ); - return StatusCode::SUCCESS; - } - // verify checksum - if (verifyROBChecksum((*it).second )) event_with_checksum_failure=true ; - - // verify status bits - verifyROBStatusBits((*it).second ); - - // get ROB fragment sizes - total_ROB_Data_Volume += (*it).second.fragment_size_word(); - rob_Data_Volume_SD[ eformat::helper::SourceIdentifier( (*it).first ).subdetector_id() ] += (*it).second.fragment_size_word(); - } - // In EF access the full event fragment and extract the ROBs - } else if (m_robDataProviderSvc->getEvent() != 0) { + if (m_robDataProviderSvc->getEvent() != 0) { // get total fragment size total_ROB_Data_Volume = (m_robDataProviderSvc->getEvent())->fragment_size_word(); rob_Data_Volume_SD[ eformat::helper::SourceIdentifier((m_robDataProviderSvc->getEvent())->source_id()).subdetector_id() ] @@ -236,8 +197,6 @@ StatusCode TrigROBMonitor::finalize() { // Get the messaging service ATH_MSG_INFO( "finalize()" ); - m_trigROBDataProviderSvc.reset(); - return StatusCode::SUCCESS; } diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/MultiHisto.icc b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/MultiHisto.icc index 56b206d0ce8f0cb38456702185883a1d19645edb..c1864cb198124f37d3881e9b6380561979bae37d 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/MultiHisto.icc +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/PixelCalibAlgs/MultiHisto.icc @@ -141,7 +141,7 @@ int MultiHisto<ht>::Write(const char* name, Int_t option, Int_t bufsize) const { } template <class ht> -int MultiHisto<ht>::Write ATLAS_NOT_THREAD_SAFE (const char* name, Int_t option, Int_t bufsize) { // const_cast is used. +int MultiHisto<ht>::Write (const char* name, Int_t option, Int_t bufsize) { return const_cast<const MultiHisto<ht>*>(this)->Write(name,option,bufsize); } diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py index 2ad6380f121f4eecb4d197f68c40e78ac85b3f65..9d7affa908bb2673d33fceccf541ac769128ed76 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py @@ -478,17 +478,3 @@ def PixelReadoutSpeedAlgCfg(flags, name="PixelReadoutSpeedAlg", **kwargs): acc.addCondAlgo(CompFactory.PixelReadoutSpeedAlg(name, **kwargs)) return acc -def PixelTDAQCondAlgCfg(flags, name="PixelTDAQCondAlg", **kwargs): - """Return a ComponentAccumulator with configured PixelTDAQCondAlg""" - acc = ComponentAccumulator() - if flags.Common.isOnline: - acc.merge(addFolders(flags, "/TDAQ/Resources/ATLAS/PIXEL/Modules", "TDAQ_ONL", className="CondAttrListCollection")) - kwargs.setdefault("ReadKey", "/TDAQ/Resources/ATLAS/PIXEL/Modules") - else: - kwargs.setdefault("ReadKey", "") - kwargs.setdefault("PixelModuleData", "PixelModuleData") - kwargs.setdefault("WriteKey", "PixelTDAQCondData") - acc.addCondAlgo(CompFactory.PixelTDAQCondAlg(name, **kwargs)) - return acc - - diff --git a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/SpecialPixelMap.h b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/SpecialPixelMap.h index 697c7eaad2be4850e397940fb466d65c15905710..7afe6762b2bdb233b907388a7d301ff75cd4a0d3 100755 --- a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/SpecialPixelMap.h +++ b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/SpecialPixelMap.h @@ -35,7 +35,7 @@ class ModuleSpecialPixelMap; status codes. A ModuleSpecialPixelMap is accessed by its IdentifierHash. */ -class ATLAS_NOT_THREAD_SAFE DetectorSpecialPixelMap : public PixelCoralClientUtils::DetectorSpecialPixelMap{ // Thread unsafe PixelCoralClientUtils::DetectorSpecialPixelMap class is used. +class DetectorSpecialPixelMap : public PixelCoralClientUtils::DetectorSpecialPixelMap{ public: DetectorSpecialPixelMap(); @@ -62,7 +62,7 @@ class ATLAS_NOT_THREAD_SAFE DetectorSpecialPixelMap : public PixelCoralClientUti */ -class ATLAS_NOT_THREAD_SAFE ModuleSpecialPixelMap : public PixelCoralClientUtils::ModuleSpecialPixelMap{ // Thread unsafe PixelCoralClientUtils::ModuleSpecialPixelMap class is used. +class ModuleSpecialPixelMap : public PixelCoralClientUtils::ModuleSpecialPixelMap{ public: ModuleSpecialPixelMap(); diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryConfig.py b/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryConfig.py index 5db700face27b228aa6dd1d7e39dac0b20e38272..d56148f1ac17ce1fef9858947ce01f3979ef5b24 100644 --- a/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryConfig.py +++ b/InnerDetector/InDetConditions/PixelConditionsTools/python/PixelConditionsSummaryConfig.py @@ -6,7 +6,7 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from PixelConditionsAlgorithms.PixelConditionsConfig import ( - PixelDCSCondStateAlgCfg, PixelDCSCondStatusAlgCfg, PixelTDAQCondAlgCfg + PixelDCSCondStateAlgCfg, PixelDCSCondStatusAlgCfg # NEW FOR RUN3 , PixelDeadMapCondAlgCfg ) @@ -17,7 +17,6 @@ def PixelConditionsSummaryCfg(flags, name="PixelConditionsSummary", **kwargs): acc.merge(PixelDCSCondStateAlgCfg(flags)) acc.merge(PixelDCSCondStatusAlgCfg(flags)) # NEW FOR RUN3 acc.merge(PixelDeadMapCondAlgCfg(flags)) - acc.merge(PixelTDAQCondAlgCfg(flags)) acc.setPrivateTools(CompFactory.PixelConditionsSummaryTool(name=name + "Tool", **kwargs)) return acc diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.cxx b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.cxx index 47f56a6d50cfc08a5ea62e2f204c3cd159811b3f..1ee7f24ed8b7865b46a09ba1bd829dacf4e74719 100644 --- a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.cxx @@ -30,7 +30,7 @@ StatusCode PixelConditionsSummaryTool::initialize(){ ATH_CHECK(detStore()->retrieve(m_pixelID,"PixelID")); - ATH_CHECK(m_condTDAQKey.initialize()); + ATH_CHECK(m_condTDAQKey.initialize( !m_condTDAQKey.empty() )); ATH_CHECK(m_condDeadMapKey.initialize()); ATH_CHECK(m_pixelCabling.retrieve()); @@ -126,7 +126,7 @@ bool PixelConditionsSummaryTool::isActive(const IdentifierHash & moduleHash) con } if (!isDCSActive) { return false; } - if (SG::ReadCondHandle<PixelTDAQData>(m_condTDAQKey)->getModuleStatus(moduleHash)) { return false; } + if (!m_condTDAQKey.empty() && SG::ReadCondHandle<PixelTDAQData>(m_condTDAQKey)->getModuleStatus(moduleHash)) { return false; } if (SG::ReadCondHandle<PixelModuleData>(m_condDeadMapKey)->getModuleStatus(moduleHash)) { return false; } @@ -144,7 +144,7 @@ bool PixelConditionsSummaryTool::isActive(const IdentifierHash & moduleHash, con } if (!isDCSActive) { return false; } - if (SG::ReadCondHandle<PixelTDAQData>(m_condTDAQKey)->getModuleStatus(moduleHash)) { return false; } + if (!m_condTDAQKey.empty() && SG::ReadCondHandle<PixelTDAQData>(m_condTDAQKey)->getModuleStatus(moduleHash)) { return false; } if (SG::ReadCondHandle<PixelModuleData>(m_condDeadMapKey)->getModuleStatus(moduleHash)) { return false; } @@ -180,7 +180,7 @@ bool PixelConditionsSummaryTool::isGood(const Identifier & elementId, } if (!isDCSGood) { return false; } - if (SG::ReadCondHandle<PixelTDAQData>(m_condTDAQKey)->getModuleStatus(moduleHash)) { return false; } + if (!m_condTDAQKey.empty() && SG::ReadCondHandle<PixelTDAQData>(m_condTDAQKey)->getModuleStatus(moduleHash)) { return false; } if (SG::ReadCondHandle<PixelModuleData>(m_condDeadMapKey)->getModuleStatus(moduleHash)) { return false; } @@ -209,7 +209,7 @@ bool PixelConditionsSummaryTool::isGood(const IdentifierHash & moduleHash) const } if (!isDCSGood) { return false; } - if (SG::ReadCondHandle<PixelTDAQData>(m_condTDAQKey)->getModuleStatus(moduleHash)) { return false; } + if (!m_condTDAQKey.empty() && SG::ReadCondHandle<PixelTDAQData>(m_condTDAQKey)->getModuleStatus(moduleHash)) { return false; } if (SG::ReadCondHandle<PixelModuleData>(m_condDeadMapKey)->getModuleStatus(moduleHash)) { return false; } @@ -234,7 +234,7 @@ bool PixelConditionsSummaryTool::isGood(const IdentifierHash & moduleHash, const } if (!isDCSGood) { return false; } - if (SG::ReadCondHandle<PixelTDAQData>(m_condTDAQKey)->getModuleStatus(moduleHash)) { return false; } + if (!m_condTDAQKey.empty() && SG::ReadCondHandle<PixelTDAQData>(m_condTDAQKey)->getModuleStatus(moduleHash)) { return false; } if (SG::ReadCondHandle<PixelModuleData>(m_condDeadMapKey)->getModuleStatus(moduleHash)) { return false; } diff --git a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.h b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.h index 2005ea9279aa26657c9b3dd1dbce8c74a52eac6c..a1a17a44d89fae147b08e2d63cc92ac7233ddef2 100644 --- a/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.h +++ b/InnerDetector/InDetConditions/PixelConditionsTools/src/PixelConditionsSummaryTool.h @@ -70,7 +70,7 @@ class PixelConditionsSummaryTool: public AthAlgTool, public IInDetConditionsTool {this, "PixelDCSStatusCondData", "PixelDCSStatusCondData", "Pixel FSM status key"}; SG::ReadCondHandleKey<PixelTDAQData> m_condTDAQKey - {this, "PixelTDAQCondData", "PixelTDAQCondData", "Pixel TDAQ conditions key"}; + {this, "PixelTDAQCondData", "", "Pixel TDAQ conditions key"}; //Default empty - legacy option SG::ReadCondHandleKey<PixelModuleData> m_condDeadMapKey {this, "PixelModuleData", "PixelModuleData", "Pixel deadmap conditions key"}; diff --git a/InnerDetector/InDetConfig/python/InDetRecToolConfig.py b/InnerDetector/InDetConfig/python/InDetRecToolConfig.py index a861cae9dd35528c9ca00f18d888ff742e30b7d6..b64a1fe6a64790da73775f80d5c2d0dd60d613ec 100644 --- a/InnerDetector/InDetConfig/python/InDetRecToolConfig.py +++ b/InnerDetector/InDetConfig/python/InDetRecToolConfig.py @@ -102,7 +102,7 @@ def InDetExtrapolatorCfg(flags, name='InDetExtrapolator', **kwargs) : def PixelConditionsSummaryToolCfg(flags, name = "InDetPixelConditionsSummaryTool", **kwargs): #FIXME - fix the duplication in TrigInDetConfig.py and PixelConditionsSummaryConfig.py - from PixelConditionsAlgorithms.PixelConditionsConfig import PixelConfigCondAlgCfg, PixelDCSCondStateAlgCfg, PixelDCSCondStatusAlgCfg, PixelTDAQCondAlgCfg + from PixelConditionsAlgorithms.PixelConditionsConfig import PixelConfigCondAlgCfg, PixelDCSCondStateAlgCfg, PixelDCSCondStatusAlgCfg kwargs.setdefault( "UseByteStream", not flags.Input.isMC) @@ -114,7 +114,6 @@ def PixelConditionsSummaryToolCfg(flags, name = "InDetPixelConditionsSummaryTool result.merge(PixelConfigCondAlgCfg(flags)) result.merge(PixelDCSCondStateAlgCfg(flags)) result.merge(PixelDCSCondStatusAlgCfg(flags)) - result.merge(PixelTDAQCondAlgCfg(flags)) result.setPrivateTools(CompFactory.PixelConditionsSummaryTool(name, **kwargs)) return result @@ -354,15 +353,6 @@ def SCT_FlaggedConditionToolCfg(flags, name="SCT_FlaggedConditionTool", **kwargs result.setPrivateTools(tool) return result -#<<<<<<< HEAD -#def SCT_MonitorConditionsToolCfg(flags, name="InDetSCT_MonitorConditionsTool", **kwargs): -# acc = ComponentAccumulator() -# folder="/SCT/Derived/Monitoring" - -# acc.merge(addFolders(flags,folder, "SCT_OFL", className="CondAttrListCollection")) - -# acc.addCondAlgo(CompFactory.SCT_MonitorCondAlg( "SCT_MonitorCondAlg",ReadKey = folder)) -#======= def SCT_MonitorConditionsToolCfg(flags, name="InDetSCT_MonitorConditionsTool", cond_kwargs={}, **kwargs): cond_kwargs.setdefault("Folder", "/SCT/Derived/Monitoring") @@ -377,7 +367,6 @@ def SCT_MonitorConditionsToolCfg(flags, name="InDetSCT_MonitorConditionsTool", c result.addCondAlgo( CompFactory.SCT_MonitorCondAlg(name = cond_kwargs["MonitorCondAlgName"], ReadKey = cond_kwargs["Folder"] )) -#>>>>>>> robert/inDetRecToolsConfig tool = CompFactory.SCT_MonitorConditionsTool(name, **kwargs) result.setPrivateTools(tool) diff --git a/InnerDetector/InDetDetDescr/PixelCabling/CMakeLists.txt b/InnerDetector/InDetDetDescr/PixelCabling/CMakeLists.txt index 9122ee0e4257a57a1ffd8d3541ab0f898a3d98de..25c15aefc24e73511b4933f9e70c72b5d2aa9516 100644 --- a/InnerDetector/InDetDetDescr/PixelCabling/CMakeLists.txt +++ b/InnerDetector/InDetDetDescr/PixelCabling/CMakeLists.txt @@ -40,4 +40,3 @@ atlas_add_test( PixelCablingConfigNew_test # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) -atlas_install_runtime( share/*.dat ) diff --git a/InnerDetector/InDetDetDescr/SCT_Cabling/CMakeLists.txt b/InnerDetector/InDetDetDescr/SCT_Cabling/CMakeLists.txt index 8d6feaf6c3fce1189ffb81e8c9311d48e50f0eba..4b6efce09c2093277d35201f8e558b657c3afb58 100644 --- a/InnerDetector/InDetDetDescr/SCT_Cabling/CMakeLists.txt +++ b/InnerDetector/InDetDetDescr/SCT_Cabling/CMakeLists.txt @@ -42,6 +42,4 @@ atlas_add_test( TestSCT_CablingCfg # Install files from the package: atlas_install_joboptions( share/*.py ) -atlas_install_runtime( share/*.dat ) -atlas_install_scripts( share/*.sh ) atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/CMakeLists.txt b/InnerDetector/InDetDetDescr/StripGeoModelXml/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..d33808e561cf5bca1680c99bde66ce14428359bc --- /dev/null +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/CMakeLists.txt @@ -0,0 +1,47 @@ +################################################################################ +# Package: StripGeoModelXml +################################################################################ + +# Declare the package name: +atlas_subdir( StripGeoModelXml ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Control/AthenaKernel + Database/AthenaPOOL/RDBAccessSvc + DetectorDescription/GeoModelXml + DetectorDescription/GeoModel/GeoModelUtilities + GaudiKernel + InnerDetector/InDetDetDescr/InDetGeoModelUtils + InnerDetector/InDetDetDescr/SCT_ReadoutGeometry + InnerDetector/InDetDetDescr/SCT_ReadoutGeometry + InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetSimEvent + PRIVATE + Control/CLIDSvc + Control/SGTools + Control/StoreGate + Database/AthenaPOOL/AthenaPoolUtilities + DetectorDescription/DetDescrCond/DetDescrConditions + DetectorDescription/GeoModel/GeoModelInterfaces + DetectorDescription/GeometryDBSvc + DetectorDescription/Identifier + InnerDetector/InDetDetDescr/InDetIdentifier + Tools/PathResolver ) + +# External dependencies: +find_package( Boost COMPONENTS filesystem thread system ) +find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) + +# Component(s) in the package: +atlas_add_library( StripGeoModelXmlLib + src/*.cxx + PUBLIC_HEADERS StripGeoModelXml + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} AthenaKernel GeoModelXml GeoModelUtilities GaudiKernel InDetGeoModelUtils InDetReadoutGeometry SCT_ReadoutGeometry SCT_ReadoutGeometry StoreGateLib InDetSimEvent + PRIVATE_LINK_LIBRARIES SGTools AthenaPoolUtilities DetDescrConditions Identifier InDetIdentifier PathResolver) + +atlas_add_component( StripGeoModelXml + src/components/*.cxx + INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel GeoModelXml GeoModelUtilities GaudiKernel InDetGeoModelUtils InDetReadoutGeometry SCT_ReadoutGeometry SCT_ReadoutGeometry SGTools StoreGateLib SGtests AthenaPoolUtilities DetDescrConditions Identifier InDetIdentifier StripGeoModelXmlLib ) diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/StripDetectorFactory.h b/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/StripDetectorFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..74b509247ee315a2bb38c2afb91b17b5a7315c72 --- /dev/null +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/StripDetectorFactory.h @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef StripGeoModelXml_STRIPDETECTORFACTORY_H +#define StripGeoModelXml_STRIPDETECTORFACTORY_H +// +// Main routine to build the GeoModel geometry, and handle the GeometryManager and +// DetectorManager. +// +#include "InDetGeoModelUtils/InDetDetectorFactoryBase.h" +#include "SCT_ReadoutGeometry/SCT_DetectorManager.h" +#include "StripGeoModelXml/WaferTree.h" + +namespace InDetDD {class AthenaComps; class SiCommonItems;} +class GeoPhysVol; + +namespace InDetDDSLHC { +class StripOptions; + +class StripDetectorFactory : public InDetDD::DetectorFactoryBase { +public: + StripDetectorFactory(InDetDD::AthenaComps *athenaComps, + InDetDD::SiCommonItems *commonItems, + StripOptions &options); + virtual ~StripDetectorFactory(); + // Creation of geometry: + virtual void create(GeoPhysVol *world); + // Access to the results: + virtual InDetDD::SCT_DetectorManager * getDetectorManager() const; + // Print out how many of each layer/eta/phi etc. have been set up. + void doNumerology(); + // Get the xml from the database instead of a file. Returns gzipped xml as a string. + std::string getBlob(); + // Determine which alignment folders are loaded to decide if we register old or new folders + virtual InDetDD::AlignFolderType getAlignFolderType() const; + +private: + // Copy and assignments operations illegal and so are made private + StripDetectorFactory(StripDetectorFactory &right); + StripDetectorFactory & operator=(StripDetectorFactory &right); + + InDetDD::SCT_DetectorManager *m_detectorManager; + InDetDD::AthenaComps *m_athenaComps; + InDetDD::SiCommonItems *m_commonItems; + StripOptions *m_options; + WaferTree m_waferTree; +}; +} +#endif diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/StripDetectorTool.h b/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/StripDetectorTool.h new file mode 100644 index 0000000000000000000000000000000000000000..bc36870074d7023823605963315d2c84a2ed6f10 --- /dev/null +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/StripDetectorTool.h @@ -0,0 +1,53 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef StripGeoModelXml_STRIPDETECTORTOOL_H +#define StripGeoModelXml_STRIPDETECTORTOOL_H +// +// Create an Athena Tool; handle Athena services and Tools needed for +// building the SCT geometry. Then create the geometry using the SCT_DetectorFactory. +// This is the entry to the StripGeoModelXml package. +// +#include "GeoModelUtilities/GeoModelTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + +#include <string> + +// ADA class ISiLorentzAngleSvc; +class IGeoModelSvc; +class IRDBAccessSvc; +class IGeoDbTagSvc; +class IGeometryDBSvc; + +namespace InDetDD { + class SCT_DetectorManager; + class AthenaComps; + class SiCommonItems; +} + +class StripDetectorTool : public GeoModelTool { +public: + StripDetectorTool(const std::string &type, const std::string &name, const IInterface *parent); + virtual ~StripDetectorTool(); + StatusCode create() override final; + StatusCode clear() override final; + StatusCode registerCallback() override final; + virtual StatusCode align(IOVSVC_CALLBACK_ARGS_P(I,keys)) override; + +private: + std::string m_detectorName; + bool m_alignable; + std::string m_gmxFilename; + const InDetDD::SCT_DetectorManager *m_manager; + InDetDD::AthenaComps *m_athenaComps; + InDetDD::SiCommonItems *m_commonItems; + ServiceHandle<IGeoModelSvc> m_geoModelSvc; + ServiceHandle<IRDBAccessSvc> m_rdbAccessSvc; + ServiceHandle<IGeometryDBSvc> m_geometryDBSvc; + ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc; + // ADA ServiceHandle<ISiLorentzAngleSvc> m_lorentzAngleSvc; +}; + +#endif // StripGeoModelXml_STRIPDETECTORTOOL_H diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/StripGmxInterface.h b/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/StripGmxInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..a954dd9063246819bd5319cfa4946ff86c77cfba --- /dev/null +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/StripGmxInterface.h @@ -0,0 +1,81 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef STRIPGEOMODELXML_STRIPGMXINTERFACE_H +#define STRIPGEOMODELXML_STRIPGMXINTERFACE_H + +#include "GeoModelXml/GmxInterface.h" +//#include "GaudiKernel/MsgStream.h" + +#include <map> +// For template functions getparm(s):----------- +#include <string> +#include <cstdlib> +#include <iostream> +#include <sstream> +//---------------------------------------------- + +#include "StripGeoModelXml/WaferTree.h" + +class MsgStream; +namespace InDetDD {class SiDetectorDesign; class SCT_DetectorManager; class SiCommonItems;} + +class StripGmxInterface: public GmxInterface { +public: + StripGmxInterface(InDetDD::SCT_DetectorManager *detectorManager, InDetDD::SiCommonItems *commonItems, WaferTree *waferTree); + ~StripGmxInterface(); + int sensorId(std::map<std::string, int> &index); + void addSensorType(std::string clas, std::string typeName, std::map<std::string, std::string> parameters); + void addSensor(std::string typeName, std::map<std::string, int> &index, int sequentialId, + GeoVFullPhysVol *fpv); + void addAlignable(int level, std::map<std::string, int> &index, GeoVFullPhysVol *fpv, + GeoAlignableTransform *transform); + void makeSiStripBox(std::string typeName, std::map<std::string, std::string> &par); + void makeStereoAnnulus(std::string typeName, std::map<std::string, std::string> &par); + + template <typename T> void getparm(const std::string typeName, const std::string name, + const std::map<std::string, std::string> &par, T &value) { + std::map<std::string, std::string>::const_iterator found; + if ((found = par.find(name)) != par.end()) { + std::istringstream(found->second) >> value; + } + else { + std::cerr << "StripGmxInterface::addSensorType: Error: missing parameter " << name << " for " << typeName << std::endl; + exit(999); + } + } + + template <typename T, typename A> void getparms(const std::string typeName, const std::string name, + const std::map<std::string, std::string> &par, std::vector<T, A> &vec) { + std::map<std::string, std::string>::const_iterator found; + if ((found = par.find(name)) != par.end()) { + T value; + std::string strVal(found->second); + strVal.erase(strVal.find_last_not_of(" \t\n\r\f\v") + 1); // Strip trailing white space or you get an extra 0 + std::istringstream inString(strVal); + do { + inString >> value; + vec.push_back(value); + } + while (inString.good()); + } + else { + std::cerr << "StripGmxInterface::addSensorType: Error: missing parameter " << name << " for " << typeName << std::endl; + exit(999); + } + } + + std::string getstr(const std::string typeName, const std::string name, const std::map<std::string, std::string> &par); + +private: + std::map<std::string, const InDetDD::SiDetectorDesign *> m_geometryMap; + InDetDD::SCT_DetectorManager *m_detectorManager; + InDetDD::SiCommonItems *m_commonItems; + WaferTree *m_waferTree; + MsgStream *m_log; +}; + + + +#endif // STRIPGEOMODELXML_STRIPGMXINTERFACE_H diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/StripOptions.h b/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/StripOptions.h new file mode 100644 index 0000000000000000000000000000000000000000..01d7c732b89f4050a61ae0c38ce56a794f41fb16 --- /dev/null +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/StripOptions.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef StripGeoModelXml_StripOptions_H +#define StripGeoModelXml_StripOptions_H +#include <string> + +namespace InDetDDSLHC { +// +// Class to store run time options. +// +class StripOptions { +public: + StripOptions(); + bool alignable() const; + bool alignAtModuleLevel() const; + std::string gmxFilename() const; + void setAlignable(bool flag = true); + void setAlignAtModuleLevel(bool flag = true); + void setGmxFilename(std::string filename); + +private: + bool m_alignable; + bool m_alignModule; + std::string m_gmxFilename; +}; + +// Inlined methods + +inline StripOptions::StripOptions() : + m_alignable(true), + m_alignModule(true), + m_gmxFilename("") +{} + +inline bool StripOptions::alignable() const { + return m_alignable; +} + +inline bool StripOptions::alignAtModuleLevel() const { + return m_alignModule; +} + +inline std::string StripOptions::gmxFilename() const { + return m_gmxFilename; +} + +inline void StripOptions::setAlignable(bool flag) { + m_alignable = flag; +} + +inline void StripOptions::setAlignAtModuleLevel(bool flag) { + m_alignModule = flag; +} + +inline void StripOptions::setGmxFilename(std::string filename) { + m_gmxFilename = filename; +} + +} +#endif // StripGeoModelXml_StripOptions_H diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/WaferTree.h b/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/WaferTree.h new file mode 100644 index 0000000000000000000000000000000000000000..9d196c5a6875eb3afde372456f18b19eb190cf2d --- /dev/null +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/StripGeoModelXml/WaferTree.h @@ -0,0 +1,72 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SCT_GEOMODELXML_WAFERTREE_H +#define SCT_GEOMODELXML_WAFERTREE_H +// +// For "numerology". Create a nested set of maps. Bottom layer of leaves are wafer information. +// Order is barrelEndcap/layerDisk/phiModule/etaModule/side; each of these has a map of integer-key (the +// value of the integer index) and value -- a map to the next layer down. +// +// User should only create the top level item, a WaferTree, and Wafers (which are copied: user deletes his own copy). +// add(bec, layer, phi, eta, side, Wafer) for each wafer. +// +// Then the number of items at a given layer can be found from the nXxxxxs member functions of each sub-layer. +// +#include <map> +#include <string> +#include <sstream> + +// Error message build up is spread in many routines; instead of cerr, build up a string. Caller can +// print this string with Athena message service. Make it static to give it internal linkage. +static std::ostringstream errmsg; + +class Wafer { +public: + Wafer(int unsigned hashId): m_hashId(hashId) {} + unsigned int hashId() {return m_hashId;} + void setHashId(unsigned int hashId) {m_hashId = hashId;} +private: + unsigned int m_hashId; +}; + +class Side: public std::map<int, Wafer> { +public: + bool add(int side, Wafer &wafer); + Wafer & operator[](int side) {return at(side);} + int nSides() const {return size();} +}; + +class PhiModule: public std::map<int, Side> { +public: + bool add(int phi, int side, Wafer &wafer); + Side & operator[](int phi) {return at(phi);} + int nPhiModules() const {return size();} +}; + +class EtaModule: public std::map<int, PhiModule> { +public: + bool add(int eta, int phi, int side, Wafer &wafer); + PhiModule & operator[](int eta) {return at(eta);} + int nEtaModules() const {return size();} +}; + +class LayerDisk: public std::map<int, EtaModule> { +public: + bool add(int ld, int eta, int phi, int side, Wafer &wafer); + EtaModule & operator[](int ld) {return at(ld);} + int nLayers() const {return size();} +}; + +class BarrelEndcap: public std::map<int, LayerDisk> { +public: + bool add(int bec, int ld, int eta, int phi, int side, Wafer &wafer, std::string &errorMessage); + LayerDisk & operator[](int bec) {return at(bec);} + int nParts() const {return size();} +}; + +class WaferTree: public BarrelEndcap { // Just a more descriptive name for the class. +}; + +#endif diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorFactory.cxx b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorFactory.cxx new file mode 100644 index 0000000000000000000000000000000000000000..38b0d09926ee3a84077393857818abb0048ec3a3 --- /dev/null +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorFactory.cxx @@ -0,0 +1,325 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "StripGeoModelXml/StripDetectorFactory.h" + +#include <string> +#include <sstream> + +#include "StoreGate/StoreGateSvc.h" // For alignment getAlignableFolderType() +#include "AthenaPoolUtilities/CondAttrListCollection.h" +#include "DetDescrConditions/AlignableTransformContainer.h" + +#include "InDetGeoModelUtils/InDetDDAthenaComps.h" +#include "GeoModelKernel/GeoPhysVol.h" +#include "GeoModelInterfaces/IGeoModelSvc.h" +#include "GeoModelUtilities/DecodeVersionKey.h" + +#include "InDetReadoutGeometry/SiCommonItems.h" +#include "SCT_ReadoutGeometry/SCT_DetectorManager.h" +#include "InDetReadoutGeometry/Version.h" +#include "SCT_ReadoutGeometry/SCT_ModuleSideDesign.h" + +#include "RDBAccessSvc/IRDBAccessSvc.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "RDBAccessSvc/IRDBRecord.h" + +#include "StripGeoModelXml/StripOptions.h" +#include "GeoModelXml/Gmx2Geo.h" +#include "StripGeoModelXml/StripGmxInterface.h" +#include "GeoModelXml/GmxInterface.h" + +#include "PathResolver/PathResolver.h" + +using namespace std; + +namespace InDetDDSLHC { + +StripDetectorFactory::StripDetectorFactory(InDetDD::AthenaComps *athenaComps, + InDetDD::SiCommonItems *commonItems, + StripOptions &options) : + InDetDD::DetectorFactoryBase(athenaComps), + m_athenaComps(athenaComps), + m_commonItems(commonItems), + m_options(&options) { +// +// Create the detector manager +// + m_detectorManager = new InDetDD::SCT_DetectorManager(detStore()); +// +// Set Detector Manager SCT version information +// + DecodeVersionKey versionKey(geoDbTagSvc(), "SCT"); + IRDBRecordset_ptr switchSet = rdbAccessSvc()->getRecordsetPtr("SctSwitches", versionKey.tag(), versionKey.node()); + const IRDBRecord *switches = (*switchSet)[0]; + string layout = "SLHC"; + if (!switches->isFieldNull("LAYOUT")) { + layout = switches->getString("LAYOUT"); + } + string description = "Test geometry"; + if (!switches->isFieldNull("DESCRIPTION")) { + description = switches->getString("DESCRIPTION"); + } + string versionTag = rdbAccessSvc()->getChildTag("SCT", versionKey.tag(), versionKey.node()); + string versionName = switches->getString("VERSIONNAME"); + int versionMajorNumber = 0; + int versionMinorNumber = 0; + int versionPatchNumber = 0; + InDetDD::Version version(versionTag, versionName, layout, description, versionMajorNumber, + versionMinorNumber, versionPatchNumber); + m_detectorManager->setVersion(version); +} + +StripDetectorFactory::~StripDetectorFactory() { + // NB the detector manager (m_detectorManager) is stored in the detector store by the Tool and so we don't delete it. +} + +void StripDetectorFactory::create(GeoPhysVol *world) { + msg(MSG::INFO) << "C R E A T E W O R L D" << endmsg; + + msg(MSG::INFO) << m_detectorManager->getVersion().fullDescription() << endmsg; + + StripGmxInterface gmxInterface(m_detectorManager, m_commonItems, &m_waferTree); +// To set up solid geometry only, without having to worry about sensitive detectors etc., and get loads of debug output, +// comment out above line and uncomment the following line; also, switch header files above. +// GmxInterface gmxInterface; + + int flags(0); + string gmxInput; + + if (m_options->gmxFilename() == "") { + msg(MSG::INFO) << "gmxFilename not set; getting .gmx from Geometry database Blob" << endmsg; + flags = 0x1; // Lowest bit ==> string; next bit implies gzip'd but we decided not to gzip + gmxInput = getBlob(); + string dtdFile = '"' + PathResolver::find_file("geomodel.dtd", "DATAPATH") + '"'; + msg(MSG::INFO) << "dtdFile = " << dtdFile << endmsg; + size_t index = gmxInput.find("\"geomodel.dtd\""); + if (index != string::npos) { + gmxInput.replace(index, 14, dtdFile); + } + else { + cerr << "Did not find string geomodel.dtd in the gmx input string.\n"; + } + } + else { + flags = 0; + gmxInput = PathResolver::find_file(m_options->gmxFilename(), "DATAPATH"); + if (gmxInput == "") { // File not found + string errMessage("StripDetectorFactory::create: Unable to find file " + m_options->gmxFilename() + + " with PathResolver; check filename and DATAPATH environment variable"); + throw runtime_error(errMessage); + } + } + + Gmx2Geo gmx2Geo(gmxInput, world, gmxInterface, flags); +// +// Add the tree-top to the detector manager. This also makes it appear as SCT in VP1. +// It is probably the last (most recently added) thing in the world PV so loop from the +// back looking for our subdetector name. + +// + unsigned int nChildren = world->getNChildVols(); + + for (int iChild = nChildren - 1; iChild>=0; --iChild) { + if (world->getNameOfChildVol(iChild) == "SCT") { + // The * converts from a ConstPVLink to a reference to a GeoVPhysVol; + // the & takes its address. + m_detectorManager->addTreeTop(&*world->getChildVol(iChild)); + break; + } + } + + doNumerology(); + + m_detectorManager->initNeighbours(); + +} + +string StripDetectorFactory::getBlob() { + DecodeVersionKey versionKey(geoDbTagSvc(), "SCT"); + std::string versionTag = versionKey.tag(); + std::string versionNode = versionKey.node(); + msg(MSG::INFO) << "getBlob: versionTag = " << versionTag << endmsg; + msg(MSG::INFO) << "getBlob: versionNode = " << versionNode << endmsg; + + IRDBAccessSvc *accessSvc = m_athenaComps->rdbAccessSvc(); + // ADA accessSvc->connect(); + IRDBRecordset_ptr recordSetSct = accessSvc->getRecordsetPtr("ITKXDD", versionTag, versionNode); + if (!recordSetSct || recordSetSct->size() == 0) { + msg(MSG::FATAL) << "getBlob: Unable to obtain SCT recordSet" << endmsg; + throw runtime_error("getBlob: Unable to obtain SCT recordSet"); + } + const IRDBRecord *recordSct = (*recordSetSct)[0]; + string sctString = recordSct->getString("XMLCLOB"); + // ADA accessSvc->disconnect(); + + return sctString; +} + +InDetDD::SCT_DetectorManager * StripDetectorFactory::getDetectorManager() const { + return m_detectorManager; +} + +void StripDetectorFactory::doNumerology() { + InDetDD::SiNumerology n; + + msg(MSG::INFO) << "\n\nSCT Numerology:\n===============\n\nNumber of parts is " << m_waferTree.nParts() << endl << endl; + + bool barrelDone = false; + for (int b = -1; b <= 1; ++b) { + if (m_waferTree.count(b)) { + msg(MSG::INFO) << " Found barrel with index " << b << endl; + n.addBarrel(b); + if (!barrelDone) { + n.setNumLayers(m_waferTree[b].nLayers()); + msg(MSG::INFO) << " Number of barrel layers = " << n.numLayers() << endl; + for (LayerDisk::iterator l = m_waferTree[b].begin(); l != m_waferTree[b].end(); ++l) { + n.setNumEtaModulesForLayer(l->first, l->second.nEtaModules()); + // All staves within a layer are assumed identical, so we can just look at the first eta + n.setNumPhiModulesForLayer(l->first, l->second.begin()->second.nPhiModules()); + msg(MSG::INFO) << " layer = " << l->first << " has " << n.numEtaModulesForLayer(l->first) << + " etaModules each with " << n.numPhiModulesForLayer(l->first) << " phi modules" << endl; + } + barrelDone = true; + } + } + + } + bool endcapDone = false; + + for (int ec = -2; ec <= 2; ec += 4) { + if (m_waferTree.count(ec)) { + msg(MSG::INFO) << " Found endcap with index " << ec << endl; + n.addEndcap(ec); + if (!endcapDone) { + n.setNumDisks(m_waferTree[ec].nLayers()); + msg(MSG::INFO) << " Number of endcap wheels = " << n.numDisks() << endl; + for (LayerDisk::iterator l = m_waferTree[ec].begin(); l != m_waferTree[ec].end(); ++l) { + n.setNumRingsForDisk(l->first, l->second.nEtaModules()); + msg(MSG::INFO) << " Wheel " << l->first << " has " << n.numRingsForDisk(l->first) << " rings" << endl; + for (EtaModule::iterator eta = l->second.begin(); eta != l->second.end(); ++eta) { + n.setNumPhiModulesForDiskRing(l->first, eta->first, eta->second.nPhiModules()); + msg(MSG::DEBUG) << " Ring " << eta->first << " has " << + n.numPhiModulesForDiskRing(l->first, eta->first) << " phi modules" << endl; + } + } + endcapDone = true; + } + } + } + msg(MSG::INFO) << endmsg; + + int totalWafers = 0; + for (BarrelEndcap::iterator bec = m_waferTree.begin(); bec != m_waferTree.end(); ++bec) { + for (LayerDisk::iterator ld = bec->second.begin(); ld != bec->second.end(); ++ld) { + for (EtaModule::iterator eta = ld->second.begin(); eta != ld->second.end(); ++eta) { + for (PhiModule::iterator phi = eta->second.begin(); phi != eta->second.end(); ++phi) { + for (Side::iterator side =phi->second.begin(); side != phi->second.end(); ++side) { + totalWafers++; + } + } + } + } + } + msg(MSG::INFO) << "Total number of wafers added is " << totalWafers << endmsg; + const SCT_ID *sctIdHelper = dynamic_cast<const SCT_ID *> (m_commonItems->getIdHelper()); + msg(MSG::INFO) << "Total number of wafer identifiers is " << sctIdHelper->wafer_hash_max() << endmsg; +// +// Used in digitization to create one vector big enough to hold all strips, whichever detector is in consideration. +// Anyway they are common to pixels and strips! Pixels dominate the EtaCell count (which traditionally the SCT does not set) +// + n.setMaxNumEtaCells(1); + for (int d = 0; d < m_detectorManager->numDesigns(); ++d) { + n.setMaxNumPhiCells(m_detectorManager->getSCT_Design(d)->cells()); + } + msg(MSG::INFO) << "Max. eta cells is " << n.maxNumEtaCells() << endl; + msg(MSG::INFO) << "Max. phi cells is " << n.maxNumPhiCells() << endl; + msg(MSG::INFO) << "Max. no. strips is " << n.maxNumStrips() << endl; + + m_detectorManager->numerology() = n; + + msg(MSG::INFO) << "End of numerology\n" << endmsg; + +// +// Alignment preparation +// + if (m_options->alignable()) { + msg(MSG::INFO) << "Set up alignment directories" << endmsg; + const std::string topFolder("/Indet/Align"); + const std::string barrelBase("/SCTB"); + const std::string endcapBase("/SCTE"); + std::string baseName(""); + + // Register the keys and the level corresponding to the key + // and whether it expects a global or local shift. + // level 0: sensor, level 1: module, level 2, layer/disc, level 3: whole barrel/enccap + InDetDD::AlignFolderType alignFolderType = getAlignFolderType(); + m_detectorManager->addAlignFolderType(alignFolderType); + + switch (alignFolderType) { + case InDetDD::static_run1: + m_detectorManager->addFolder(topFolder); + m_detectorManager->addChannel(topFolder + "/ID", 3, InDetDD::global); + m_detectorManager->addChannel(topFolder + "/SCT",2,InDetDD::global); + for (BarrelEndcap::iterator bec = m_waferTree.begin(); bec != m_waferTree.end(); ++bec) { + switch (bec->first) { + case -2: + baseName = topFolder + endcapBase + "C"; + break; + case 0: + baseName = topFolder + barrelBase; + break; + case 2: + baseName = topFolder + endcapBase + "A"; + break; + default: + msg(MSG::FATAL) << "Unknown SCT part with bec-ID " << bec->first << " encountered." << endmsg; + throw std::runtime_error("Unknown SCT part for alignment."); + } + for (LayerDisk::iterator ld = bec->second.begin(); ld != bec->second.end(); ++ld) { + std::ostringstream layer; + layer << ld->first + 1; + m_detectorManager->addChannel(baseName + layer.str(), 1, InDetDD::local); + } + } + break; + // To be added: case InDetDD::timedependent_run2:, see SCT_GeoModel + default: + msg(MSG::FATAL) << "Alignment requested for unknown alignment folder type in StripDetectorFactory." << endmsg; + throw std::runtime_error("Wrong alignment folder type for StripDetectorFactory in StripGeoModelXml."); + } + } + + return; +} + +// Determine which alignment folders are loaded to decide if we register old or new folders +InDetDD::AlignFolderType StripDetectorFactory::getAlignFolderType() const { + + bool static_folderStruct = false; + bool timedep_folderStruct = false; + if (detStore()->contains<CondAttrListCollection>("/Indet/AlignL1/ID") && + detStore()->contains<CondAttrListCollection>("/Indet/AlignL2/SCT") && + detStore()->contains<AlignableTransformContainer>("/Indet/AlignL3") ) timedep_folderStruct = true; + + if (detStore()->contains<AlignableTransformContainer>("/Indet/Align") ) static_folderStruct = true; + + if (static_folderStruct && !timedep_folderStruct){ + msg(MSG::INFO) << "Static run1 type alignment folder structure found" << endmsg; + return InDetDD::static_run1; + } + else if (!static_folderStruct && timedep_folderStruct){ + msg(MSG::INFO) << " Time dependent run2 type alignment folder structure found" << endmsg; + return InDetDD::timedependent_run2; + } + else if (static_folderStruct && timedep_folderStruct){ + throw std::runtime_error("Old and new alignment folders are loaded at the same time! This should not happen!"); + } + else { + return InDetDD::none; + } + +} + +} // End namespace diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorTool.cxx b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..26e26305d4bf94fe4d3a36555696725d7ff78f3c --- /dev/null +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripDetectorTool.cxx @@ -0,0 +1,245 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "StripGeoModelXml/StripDetectorTool.h" +#include "StripGeoModelXml/StripDetectorFactory.h" +#include "StripGeoModelXml/StripOptions.h" +#include "SCT_ReadoutGeometry/SCT_DetectorManager.h" +#include "InDetGeoModelUtils/InDetDDAthenaComps.h" +#include "InDetReadoutGeometry/SiCommonItems.h" +// ADA #include "InDetCondServices/ISiLorentzAngleSvc.h" +#include "GeoModelUtilities/GeoModelExperiment.h" +#include "GeoModelInterfaces/IGeoModelSvc.h" +#include "GeoModelUtilities/DecodeVersionKey.h" +#include "StoreGate/StoreGateSvc.h" +#include "GeometryDBSvc/IGeometryDBSvc.h" +#include "RDBAccessSvc/IRDBAccessSvc.h" +#include "RDBAccessSvc/IRDBRecord.h" +#include "RDBAccessSvc/IRDBRecordset.h" +#include "DetDescrConditions/AlignableTransformContainer.h" + +// ADA #include "CLIDSvc/tools/ClassID_traits.h" +#include "SGTools/DataProxy.h" + +using InDetDD::SCT_DetectorManager; +using InDetDD::SiDetectorManager; + + +StripDetectorTool::StripDetectorTool(const std::string &type, + const std::string &name, + const IInterface *parent) : + GeoModelTool(type, name, parent), + m_detectorName("SCT"), + m_alignable(false), + m_gmxFilename(""), + m_manager(0), + m_athenaComps(0), + m_commonItems(0), + m_geoModelSvc("GeoModelSvc", name), + m_rdbAccessSvc("RDBAccessSvc", name), + m_geometryDBSvc("InDetGeometryDBSvc", name), + m_geoDbTagSvc{"GeoDbTagSvc", name} + // ADA m_lorentzAngleSvc("SCTLorentzAngleSvc", name) + { +// +// Get parameter values from jobOptions file +// + declareProperty("DetectorName", m_detectorName); + declareProperty("Alignable", m_alignable); + declareProperty("GmxFilename", m_gmxFilename); + declareProperty("RDBAccessSvc", m_rdbAccessSvc); + declareProperty("GeometryDBSvc", m_geometryDBSvc); + declareProperty("GeoModelSvc", m_geoModelSvc); + declareProperty("GeoDbTagSvc", m_geoDbTagSvc); + // ADA declareProperty("LorentzAngleSvc", m_lorentzAngleSvc); +} + +StripDetectorTool::~StripDetectorTool() { + delete m_athenaComps; +} + +StatusCode StripDetectorTool::create() { +// +// Retrieve all services except LorentzAngleSvc, which has to be done later +// + + // Get the detector configuration. + ATH_CHECK(m_geoDbTagSvc.retrieve()); + + StatusCode sc; + sc = m_geoModelSvc.retrieve(); + if (sc.isFailure()) { + msg(MSG::FATAL) << "Could not locate GeoModelSvc" << endmsg; + return (StatusCode::FAILURE); + } + sc = m_rdbAccessSvc.retrieve(); + if (sc.isFailure()) { + msg(MSG::FATAL) << "Could not locate RDBAccessSvc" << endmsg; + return StatusCode::FAILURE; + } + sc = m_geometryDBSvc.retrieve(); + if (sc.isFailure()) { + msg(MSG::FATAL) << "Could not locate Geometry DB Interface: " << m_geometryDBSvc.name() << endmsg; + return (StatusCode::FAILURE); + } + GeoModelExperiment *theExpt; + sc = detStore()->retrieve(theExpt, "ATLAS"); + if (sc.isFailure()) { + msg(MSG::FATAL) << "Could not find GeoModelExperiment ATLAS" << endmsg; + return (StatusCode::FAILURE); + } + const SCT_ID *idHelper; + if (detStore()->retrieve(idHelper, "SCT_ID").isFailure()) { + msg(MSG::FATAL) << "Could not get SCT ID helper" << endmsg; + return StatusCode::FAILURE; + } +// +// Get their interfaces to pass to the DetectorFactory +// + m_athenaComps = new InDetDD::AthenaComps("StripGeoModelXml"); + m_athenaComps->setDetStore(&*(detStore())); + // ADA m_athenaComps->setGeoModelSvc(&*m_geoModelSvc); + m_athenaComps->setRDBAccessSvc(&*m_rdbAccessSvc); + m_athenaComps->setGeometryDBSvc(&*m_geometryDBSvc); + + m_commonItems = new InDetDD::SiCommonItems(idHelper); + // ADA m_commonItems->setLorentzAngleSvc(m_lorentzAngleSvc); +// +// Get options from python +// + InDetDDSLHC::StripOptions options; + options.setAlignable(m_alignable); + options.setGmxFilename(m_gmxFilename); +// +// Get the version +// + DecodeVersionKey versionKey(&*m_geoModelSvc, "SCT"); + if (versionKey.tag() == "AUTO"){ + msg(MSG::ERROR) << "Atlas version tag is AUTO. You must set a version-tag like ATLAS_P2_ITK-00-00-00." << endmsg; + return StatusCode::FAILURE; + } + if (versionKey.custom()) + msg(MSG::INFO) << "Building custom "; + else + msg(MSG::INFO) << "Building "; + msg(MSG::INFO) << "SCT SLHC with Version Tag: "<< versionKey.tag() << " at Node: " << versionKey.node() << endmsg; +// +// Get the Database Access Service and from there the SCT version tag +// + std::string sctVersionTag = m_rdbAccessSvc->getChildTag("SCT", versionKey.tag(), versionKey.node()); + msg(MSG::INFO) << "SCT Version: " << sctVersionTag << " Package Version: " << PACKAGE_VERSION << endmsg; +// +// Check if SCT version tag is empty. If so, then the SCT cannot be built. +// This may or may not be intentional. We just issue an INFO message. +// + if (sctVersionTag.empty()) { + msg(MSG::INFO) << "No SCT Version. SCT_SLHC will not be built." << endmsg; + return StatusCode::SUCCESS; + } +// +// Create the SCT_DetectorFactory +// + // The * converts a ConstPVLink to a ref to a GeoVPhysVol + // The & takes the address of the GeoVPhysVol + GeoPhysVol *world = &*theExpt->getPhysVol(); + InDetDDSLHC::StripDetectorFactory theSCT(m_athenaComps, m_commonItems, options); + theSCT.create(world); +// +// Get the manager from the factory and store it in the detector store. +// + m_manager = theSCT.getDetectorManager(); + + if (!m_manager) { + msg(MSG::ERROR) << "SCT_DetectorManager not found; not created in SCT_DetectorFactory?" << endmsg; + return(StatusCode::FAILURE); + } + + sc = detStore()->record(m_manager, m_manager->getName()); + if (sc.isFailure() ) { + msg(MSG::ERROR) << "Could not register SCT_DetectorManager" << endmsg; + return StatusCode::FAILURE; + } + theExpt->addManager(m_manager); + + // Create a symLink to the SiDetectorManager base class so it can be accessed as either SiDetectorManager or + // SCT_DetectorManager + const SiDetectorManager *siDetManager = m_manager; + sc = detStore()->symLink(m_manager, siDetManager); + if(sc.isFailure()){ + msg(MSG::ERROR) << "Could not make link between SCT_DetectorManager and SiDetectorManager" << endmsg; + return StatusCode::FAILURE; + } +// +// And retrieve the LorentzAngleService. Has to be after the symLink just made, +// which has to be after the manager is made by the DetectorFactory. +// +// if (m_lorentzAngleSvc.empty()) { +// msg(MSG::INFO) << "Lorentz angle service not requested." << endmsg; +// } +// else { +// sc = m_lorentzAngleSvc.retrieve(); +// if (sc.isFailure()) { +// msg(MSG::INFO) << "Could not retrieve Lorentz angle service:" << m_lorentzAngleSvc << endmsg; +// } +// else { +// msg(MSG::INFO) << "Lorentz angle service retrieved: " << m_lorentzAngleSvc << endmsg; +// } +// } + + return StatusCode::SUCCESS; +} + +StatusCode StripDetectorTool::clear() { + SG::DataProxy* proxy = detStore()->proxy(ClassID_traits<InDetDD::SCT_DetectorManager>::ID(),m_manager->getName()); + if(proxy) { + proxy->reset(); + m_manager = 0; + } + return StatusCode::SUCCESS; +} + +StatusCode StripDetectorTool::registerCallback() { +// +// Register call-back for software alignment +// + StatusCode sc = StatusCode::FAILURE; + if (m_alignable) { + std::string folderName = "/Indet/Align"; + if (detStore()->contains<AlignableTransformContainer>(folderName)) { + msg(MSG::DEBUG) << "Registering callback on AlignableTransformContainer with folder " << folderName << endmsg; + const DataHandle<AlignableTransformContainer> atc; + sc = detStore()->regFcn(&IGeoModelTool::align, dynamic_cast<IGeoModelTool *>(this), atc, folderName); + if(sc.isFailure()) { + msg(MSG::ERROR) << "Could not register callback on AlignableTransformContainer with folder " << + folderName << endmsg; + } + } + else { + msg(MSG::WARNING) << "Unable to register callback on AlignableTransformContainer with folder " << + folderName << ", Alignment disabled (only if no Run2 scheme is loaded)!" << endmsg; + } + } + else { + msg(MSG::INFO) << "Alignment disabled. No callback registered" << endmsg; + // We return failure otherwise it will try and register a GeoModelSvc callback associated with this callback. + } + return sc; +} + +StatusCode StripDetectorTool::align(IOVSVC_CALLBACK_ARGS_P(I, keys)) { +// +// The call-back routine, which just calls the real call-back routine from the manager. +// + if (!m_manager) { + msg(MSG::WARNING) << "Manager does not exist" << endmsg; + return StatusCode::FAILURE; + } + if (m_alignable) { + return m_manager->align(I, keys); + } + else { + msg(MSG::DEBUG) << "Alignment disabled. No alignments applied" << endmsg; + return StatusCode::SUCCESS; + } +} diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f969c728069774fb308c1afa51a7205f5b66eb7e --- /dev/null +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/StripGmxInterface.cxx @@ -0,0 +1,381 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "StripGeoModelXml/StripGmxInterface.h" + +#include <cstdlib> +#include <sstream> + +#include "InDetSimEvent/SiHitIdHelper.h" + +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/IMessageSvc.h" +#include "GaudiKernel/MsgStream.h" + +#include "SCT_ReadoutGeometry/SCT_DetectorManager.h" +#include "SCT_ReadoutGeometry/StripBoxDesign.h" +#include "SCT_ReadoutGeometry/StripAnnulusDesign.h" +#include "SCT_ReadoutGeometry/StripStereoAnnulusDesign.h" +#include "InDetReadoutGeometry/SiDetectorDesign.h" +#include "InDetReadoutGeometry/SiDetectorElement.h" +#include "InDetReadoutGeometry/SiCommonItems.h" + +const int SCT_HitIndex = 1; + +using namespace std; + +StripGmxInterface::StripGmxInterface(InDetDD::SCT_DetectorManager *detectorManager, InDetDD::SiCommonItems *commonItems,WaferTree *waferTree): + m_detectorManager(detectorManager), + m_commonItems(commonItems), + m_waferTree(waferTree) { + // Logging: ref https://wiki.bnl.gov/dayabay/index.php?title=Logging + // Turn on logging in job-options with: MessageSvc.setDebug += {"StripGmxInterface"} + ServiceHandle<IMessageSvc> msgh("MessageSvc", "StripGmxInterface"); + + m_log = new MsgStream(&(*msgh), "StripGmxInterface"); +} + +StripGmxInterface::~StripGmxInterface() { + delete m_log; +} + +int StripGmxInterface::sensorId(map<string, int> &index) { +// +// Return the Simulation HitID (nothing to do with "ATLAS Identifiers" aka "Offline Identifiers" + + int hitIdOfWafer = SiHitIdHelper::GetHelper()->buildHitId(SCT_HitIndex, index["barrel_endcap"], index["layer_wheel"], + index["eta_module"], index["phi_module"], index["side"]); + + *m_log << MSG::DEBUG << "Index list: " << index["barrel_endcap"] << " " << index["layer_wheel"] << " " << + index["eta_module"] << " " << index["phi_module"] << " " << index["side"] << endmsg; + *m_log << MSG::DEBUG << "hitIdOfWafer = " << std::hex << hitIdOfWafer << std::dec << endmsg; + *m_log << MSG::DEBUG << " bec = " << SiHitIdHelper::GetHelper()->getBarrelEndcap(hitIdOfWafer) << + " lay = " << SiHitIdHelper::GetHelper()->getLayerDisk(hitIdOfWafer) << + " eta = " << SiHitIdHelper::GetHelper()->getEtaModule(hitIdOfWafer) << + " phi = " << SiHitIdHelper::GetHelper()->getPhiModule(hitIdOfWafer) << + " side = " << SiHitIdHelper::GetHelper()->getSide(hitIdOfWafer) << endmsg; + return hitIdOfWafer; + +} + + +void StripGmxInterface::addSensorType(string clas, string typeName, map<string, string> parameters) { + + *m_log << MSG::DEBUG << "StripGmxInterface::addSensorType called for class " << clas << " typeName " << typeName << + endmsg; + if (clas == "SiStripBox") { + makeSiStripBox(typeName, parameters); + } + else if (clas == "StereoAnnulus") { + makeStereoAnnulus(typeName, parameters); + } // To-do: add "Annulus" + else { + *m_log << MSG::ERROR << "StripGmxInterface::addSensorType: unrecognised sensor class, " << clas << endmsg; + *m_log << MSG::ERROR << "No sensor design created" << endmsg; + } +} + +void StripGmxInterface::makeSiStripBox(string typeName, map<string, string> &par) { +// +// Get all parameters. +// +InDetDD::SiDetectorDesign::Axis stripDirection; +InDetDD::SiDetectorDesign::Axis fieldDirection; +double thickness(0.320); +int readoutSide(1); +InDetDD::CarrierType carrier(InDetDD::electrons); +int nRows(1); +double pitch(0.080); +int nStrips(1280); // Per row +double length(25.0); + + string car = getstr(typeName, "carrierType", par); + if (car == "electrons") { + carrier = InDetDD::electrons; + } + else if (car == "holes") { + carrier = InDetDD::holes; + } + else { + *m_log << MSG::FATAL << + "StripGmxInterface::makeSiStripBox: Error: parameter carrierType should be electrons or holes for " << + typeName << endmsg; + exit(999); + } + + string ros = getstr(typeName, "readoutSide", par); + if (ros == "+") { + readoutSide = 1; + } + else if (ros == "-") { + readoutSide = -1; + } + else { + *m_log << MSG::FATAL << + "StripGmxInterface::makeSiStripBox: Error: parameter readoutSide should be + or - for " << typeName << endmsg; + exit(999); + } + + string fd = getstr(typeName, "fieldDirection", par); + if (fd == "x") { + fieldDirection = InDetDD::SiDetectorDesign::xAxis; + } + else if (fd == "y") { + fieldDirection = InDetDD::SiDetectorDesign::yAxis; + } + else if (fd == "z") { + fieldDirection = InDetDD::SiDetectorDesign::zAxis; + } + else { + *m_log << MSG::FATAL << + "StripGmxInterface::makeSiStripBox: Error: parameter fieldDirection should be x, y, or z for " << typeName << endmsg; + exit(999); + } + + string sd = getstr(typeName, "stripDirection", par); + if (sd == "x") { + stripDirection = InDetDD::SiDetectorDesign::xAxis; + } + else if (sd == "y") { + stripDirection = InDetDD::SiDetectorDesign::yAxis; + } + else if (sd == "z") { + stripDirection = InDetDD::SiDetectorDesign::zAxis; + } + else { + *m_log << MSG::FATAL << + "StripGmxInterface::makeSiStripBox: Error: parameter stripDirection should be x, y, or z for " << typeName << endmsg; + exit(999); + } + + getparm(typeName, "thickness", par, thickness); + getparm(typeName, "nRows", par, nRows); + getparm(typeName, "nStrips", par, nStrips); + getparm(typeName, "pitch", par, pitch); + getparm(typeName, "stripLength", par, length); +// +// Make Sensor Design and add to DetectorManager +// +// ADA const InDetDD::StripBoxDesign *design = new InDetDD::StripBoxDesign(stripDirection, fieldDirection, thickness, readoutSide, +// ADA carrier, nRows, nStrips, pitch, length); + std::unique_ptr<InDetDD::StripBoxDesign> design=std::make_unique<InDetDD::StripBoxDesign>(stripDirection, fieldDirection, + thickness, readoutSide,carrier, nRows, nStrips, pitch, + length); + +// ADA m_detectorManager->addDesign(dynamic_cast<const InDetDD::SiDetectorDesign*> (design)); + m_detectorManager->addDesign(std::move(design)); +// +// Add to map for addSensor routine +// +// ADA m_geometryMap[typeName] = design; + m_geometryMap[typeName] = design.get(); +} + +void StripGmxInterface::makeStereoAnnulus(string typeName, map<std::string, string> &par) { +// +// Get all parameters. +// +int readoutSide; +InDetDD::SiDetectorDesign::Axis fieldDirection; +InDetDD::SiDetectorDesign::Axis stripDirection; +InDetDD::CarrierType carrier(InDetDD::electrons); +double thickness(0.320); +double stereoAngle(0.020); +double centreR(500.); +int nRows(1); +vector <int> nStrips; +vector<double> phiPitch; +vector<double> startR; +vector<double> endR; + + string car = getstr(typeName, "carrierType", par); + if (car == "electrons") { + carrier = InDetDD::electrons; + } + else if (car == "holes") { + carrier = InDetDD::holes; + } + else { + *m_log << MSG::FATAL << + "StripGmxInterface::makeStereoAnnulus: Error: parameter carrierType should be electrons or holes for " << + typeName << endmsg; + exit(999); + } + + string ros = getstr(typeName, "readoutSide", par); + if (ros == "+") { + readoutSide = 1; + } + else if (ros == "-") { + readoutSide = -1; + } + else { + *m_log << MSG::FATAL << "StripGmxInterface::makeStereoAnnulus: Error: parameter readoutSide should be + or - for " << + typeName << endmsg; + exit(999); + } + + string fd = getstr(typeName, "fieldDirection", par); + if (fd == "x") { + fieldDirection = InDetDD::SiDetectorDesign::xAxis; + } + else if (fd == "y") { + fieldDirection = InDetDD::SiDetectorDesign::yAxis; + } + else if (fd == "z") { + fieldDirection = InDetDD::SiDetectorDesign::zAxis; + } + else { + *m_log << MSG::FATAL << + "StripGmxInterface::makeStereoAnnulus: Error: parameter fieldDirection should be x, y, or z for " << typeName << endmsg; + exit(999); + } + + string sd = getstr(typeName, "stripDirection", par); + if (sd == "x") { + stripDirection = InDetDD::SiDetectorDesign::xAxis; + } + else if (sd == "y") { + stripDirection = InDetDD::SiDetectorDesign::yAxis; + } + else if (sd == "z") { + stripDirection = InDetDD::SiDetectorDesign::zAxis; + } + else { + *m_log << MSG::FATAL << + "StripGmxInterface::makeStereoAnnulus: Error: parameter stripDirection should be x, y, or z for " << typeName << endmsg; + exit(999); + } + + getparm(typeName, "thickness", par, thickness); + getparm(typeName, "stereoAngle", par, stereoAngle); + getparm(typeName, "centreR", par, centreR); + getparm(typeName, "nRows", par, nRows); + getparms(typeName, "nStrips", par, nStrips); + if (nStrips.size() != (unsigned int) nRows) { + *m_log << MSG::FATAL << + "StripGmxInterface::makeStereoAnnulus: Error: Wrong number of nStrip's " << nStrips.size() << " " << typeName << endmsg; + exit(999); + } + getparms(typeName, "phiPitch", par, phiPitch); + if (phiPitch.size() != (unsigned int) nRows) { + *m_log << MSG::FATAL << + "StripGmxInterface::makeStereoAnnulus: Error: Wrong number of pitch's " << phiPitch.size() << " " << typeName << endmsg; + exit(999); + } + getparms(typeName, "startR", par, startR); + if (startR.size() != (unsigned int) nRows) { + *m_log << MSG::FATAL << "StripGmxInterface::makeStereoAnnulus: Error: Wrong number of startR's " << + typeName << endmsg; + exit(999); + } + getparms(typeName, "endR", par, endR); + if (endR.size() != (unsigned int) nRows) { + *m_log << MSG::FATAL << "StripGmxInterface::makeStereoAnnulus: Error: Wrong number of endR's " << typeName << endmsg; + exit(999); + } +// +// Make Sensor Design and add it to the DetectorManager +// +// ADA const InDetDD::StripStereoAnnulusDesign *design = new InDetDD::StripStereoAnnulusDesign(stripDirection, fieldDirection, +// ADA thickness, readoutSide, carrier, nRows, nStrips, phiPitch, startR, endR, stereoAngle, centreR); + std::unique_ptr<InDetDD::StripStereoAnnulusDesign> design=std::make_unique<InDetDD::StripStereoAnnulusDesign>(stripDirection, + fieldDirection,thickness, readoutSide, carrier, nRows, nStrips, phiPitch, startR, endR, stereoAngle, centreR); +// ADA m_detectorManager->addDesign(dynamic_cast <const InDetDD::SiDetectorDesign*> (design)); + m_detectorManager->addDesign(std::move(design)); +// +// Add to map for addSensor routine +// +// ADA m_geometryMap[typeName] = design; + m_geometryMap[typeName] = design.get(); +} + +string StripGmxInterface::getstr(const string typeName, const string name, const map<string, string> &par) { + map<string, string>::const_iterator found; + if ((found = par.find(name)) != par.end()) { + return found->second; + } + else { + *m_log << MSG::FATAL << "StripGmxInterface::addSensorType: Error: missing parameter " << name << " for " << + typeName << endmsg; + exit(999); + } + +} + +void StripGmxInterface::addSensor(string typeName, map<string, int> &index, int /*sensitiveId*/, GeoVFullPhysVol *fpv) { +// +// Get the ATLAS "Offline" wafer identifier +// + const SCT_ID *sctIdHelper = dynamic_cast<const SCT_ID *> (m_commonItems->getIdHelper()); + Identifier id = sctIdHelper->wafer_id(index["barrel_endcap"], index["layer_wheel"], index["phi_module"], + index["eta_module"], index["side"]); + IdentifierHash hashId = sctIdHelper->wafer_hash(id); +// +// Now do our best to check if this is a valid id. If either the gmx file is wrong, or the xml file +// defining the allowed id's is wrong, you can get disallowed id's. These cause a crash later +// if allowed through. To do the check, we ask for the hash-id of this id. Invalid ids give a +// special invalid hash-id (0xFFFFFFFF). But we don't exit the run, to help debug things quicker. +// + if (!hashId.is_valid()) { + *m_log << MSG::ERROR <<"Invalid id for sensitive wafer " << typeName << " volume with indices \n"; + for (map<string, int>::iterator i = index.begin(); i != index.end(); ++i) { + *m_log << MSG::ERROR << i->first << " = " << i->second << "; "; + } + *m_log << MSG::ERROR << + "\nRefusing to make it into a sensitive element. Incompatible gmx and identifier-xml files." << endmsg; + return; + } +// +// Create the detector element and add to the DetectorManager +// + const InDetDD::SiDetectorDesign *design = m_geometryMap[typeName]; + if (!design) { + *m_log << MSG::FATAL << "StripGmxInterface::addSensor: Error: Readout sensor type " << typeName << + " not found.\n" << endmsg; + exit(999); + } + InDetDD::SiDetectorElement *detector = new InDetDD::SiDetectorElement(id, design, fpv, m_commonItems); + m_detectorManager->addDetectorElement(detector); +// +// Build up a map-structure for numerology +// + Wafer wafer((unsigned int) hashId); + string errorMessage(""); + if (!m_waferTree->add(index["barrel_endcap"], index["layer_wheel"], index["eta_module"], + index["phi_module"], index["side"], wafer, errorMessage)) { + *m_log << MSG::ERROR << errorMessage << endmsg; + } + return; +} + +void StripGmxInterface::addAlignable(int level, map<string, int> &index, GeoVFullPhysVol * fpv, GeoAlignableTransform *transform) { + *m_log << MSG::DEBUG << "StripGmxInterface::addAlignable called" << endmsg; +/* + * Get the offline-id appropriate to the level (0 = wafer, 1 = module, 2 = wheel/cylinder, 3 = part, i.e barrel or an endcap) + */ + const SCT_ID *sctIdHelper = dynamic_cast<const SCT_ID *> (m_commonItems->getIdHelper()); + Identifier id; + switch (level) { + case 0: + id = sctIdHelper->wafer_id(index["barrel_endcap"], index["layer_wheel"], index["phi_module"], index["eta_module"], + index["side"]); + break; + case 1: + id = sctIdHelper->wafer_id(index["barrel_endcap"], index["layer_wheel"], index["phi_module"], index["eta_module"], 0); + break; + case 2: + id = sctIdHelper->wafer_id(index["barrel_endcap"], index["layer_wheel"], 0, 0, 0); + break; + case 3: + id = sctIdHelper->wafer_id(index["barrel_endcap"], 0, 0, 0, 0); + break; + default: + *m_log << MSG::FATAL << "Unknown level " << level << " for alignment in StripGmxInterface::addAlignable" << + endmsg; + exit(999); + break; + } + m_detectorManager->addAlignableTransform(level, id, transform, fpv); +} diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/WaferTree.cxx b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/WaferTree.cxx new file mode 100644 index 0000000000000000000000000000000000000000..752ba012280099b2bc04ebc9096313bcb7014fee --- /dev/null +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/WaferTree.cxx @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "StripGeoModelXml/WaferTree.h" + +using namespace std; + +bool Side::add(int side, Wafer &wafer) { + + if (count(side) == 0) { + insert(pair<int, Wafer>(side, wafer)); + return true; + } + else { + errmsg << "WaferTree ERROR: request to add a second copy of a wafer ignored. Identifier = " << + wafer.hashId() << "; side = " << side; + return false; + } +} + +bool PhiModule::add(int phi, int side, Wafer &wafer) { + if (count(phi) == 0) { + insert(pair<int, Side>(phi, Side())); + } + if (!(*this)[phi].add(side, wafer)) { + errmsg << "; phi = " << phi; + return false; + } + return true; +} + +bool EtaModule::add(int eta, int phi, int side, Wafer &wafer) { + if (count(eta) == 0) { + insert(pair<int, PhiModule>(eta, PhiModule())); + } + if (!(*this)[eta].add(phi, side, wafer)) { + errmsg << "; eta = " << eta; + return false; + } + return true; +} + +bool LayerDisk::add(int ld, int eta, int phi, int side, Wafer &wafer) { + if (count(ld) == 0) { + insert(pair<int, EtaModule>(ld, EtaModule())); + } + if (!(*this)[ld].add(eta, phi, side, wafer)) { + errmsg << "; ld = " << ld; + return false; + } + return true; +} + +bool BarrelEndcap::add(int bec, int ld, int eta, int phi, int side, Wafer &wafer, string &errorMessage) { + errorMessage = ""; + errmsg.str(""); + errmsg.str().clear(); + if (count(bec) == 0) { + insert(pair<int, LayerDisk>(bec, LayerDisk())); + } + if (!(*this)[bec].add(ld, eta, phi, side, wafer)) { + errmsg << "; bec = " << bec; + errorMessage = errmsg.str(); + return false; + } + return true; +} diff --git a/InnerDetector/InDetDetDescr/StripGeoModelXml/src/components/StripGeoModelXml_entries.cxx b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/components/StripGeoModelXml_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..127b2d9f1f17248e6ba6ca1e6f9ca971f1b25b9e --- /dev/null +++ b/InnerDetector/InDetDetDescr/StripGeoModelXml/src/components/StripGeoModelXml_entries.cxx @@ -0,0 +1,4 @@ +#include "StripGeoModelXml/StripDetectorTool.h" + +DECLARE_COMPONENT( StripDetectorTool ) + diff --git a/InnerDetector/InDetDigitization/BCM_Digitization/CMakeLists.txt b/InnerDetector/InDetDigitization/BCM_Digitization/CMakeLists.txt index 84c3f07a4a8372ae818ff7359aae58987e5a7d03..3506e5494d9ec51541391315b3b8ef89f6ca3fc9 100644 --- a/InnerDetector/InDetDigitization/BCM_Digitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/BCM_Digitization/CMakeLists.txt @@ -5,19 +5,6 @@ # Declare the package name: atlas_subdir( BCM_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - PRIVATE - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - Event/xAOD/xAODEventInfo - Generators/GeneratorObjects - InnerDetector/InDetRawEvent/InDetBCM_RawData - InnerDetector/InDetRawEvent/InDetSimData - InnerDetector/InDetSimEvent ) - # External dependencies: find_package( CLHEP ) diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/CMakeLists.txt b/InnerDetector/InDetDigitization/FastSiDigitization/CMakeLists.txt index e4696ac3e3aed0c0b08ec735974f4fc1cdbe1afc..fc94caaf60d712d59e9f7ebf3e48a7843423288d 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/FastSiDigitization/CMakeLists.txt @@ -5,42 +5,6 @@ # Declare the package name: atlas_subdir( FastSiDigitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - Event/EventPrimitives - Event/xAOD/xAODEventInfo - GaudiKernel - InnerDetector/InDetConditions/InDetConditionsSummaryService - InnerDetector/InDetConditions/InDetCondTools - InnerDetector/InDetConditions/PixelConditionsTools - InnerDetector/InDetDetDescr/InDetReadoutGeometry - InnerDetector/InDetDetDescr/PixelReadoutGeometry - InnerDetector/InDetDetDescr/SCT_ReadoutGeometry - InnerDetector/InDetRawEvent/InDetSimData - InnerDetector/InDetRecEvent/InDetPrepRawData - InnerDetector/InDetRecTools/SiClusterizationTool - InnerDetector/InDetSimEvent - Simulation/HitManagement - Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel - Simulation/ISF/ISF_Fatras/ISF_FatrasEvent - Tracking/TrkEvent/TrkTruthData - PRIVATE - Control/StoreGate - DetectorDescription/Identifier - Generators/GeneratorObjects - InnerDetector/InDetDetDescr/InDetIdentifier - Tracking/TrkDetDescr/TrkDetDescrInterfaces - Tracking/TrkDetDescr/TrkGeometry - Tracking/TrkDetDescr/TrkSurfaces - Tracking/TrkExtrapolation/TrkExUtils - Tracking/TrkDigitization/TrkDigEvent - Tracking/TrkDigitization/TrkDigInterfaces - DetectorDescription/GeoPrimitives - Generators/AtlasHepMC ) - # External dependencies: find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) diff --git a/InnerDetector/InDetDigitization/FastTRT_Digitization/CMakeLists.txt b/InnerDetector/InDetDigitization/FastTRT_Digitization/CMakeLists.txt index 887f1cce9d83a8e9803bb42e8e967776454a1ebe..4f77d3996e9ec1b833411846816e8b83e6323ce4 100644 --- a/InnerDetector/InDetDigitization/FastTRT_Digitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/FastTRT_Digitization/CMakeLists.txt @@ -5,34 +5,6 @@ # Declare the package name: atlas_subdir( FastTRT_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - Control/StoreGate - DetectorDescription/Identifier - Event/EventInfo - Event/xAOD/xAODEventInfo - GaudiKernel - InnerDetector/InDetConditions/TRT_ConditionsServices - InnerDetector/InDetRecEvent/InDetPrepRawData - InnerDetector/InDetRecTools/TRT_DriftFunctionTool # FIXME this package only builds a component library! - InnerDetector/InDetSimEvent - Simulation/HitManagement - Tracking/TrkEvent/TrkParameters - Tracking/TrkEvent/TrkTruthData - Tracking/TrkTools/TrkToolInterfaces - Event/EventContainers - PRIVATE - DetectorDescription/GeoPrimitives - Generators/GeneratorObjects - InnerDetector/InDetDetDescr/InDetIdentifier - InnerDetector/InDetDetDescr/InDetReadoutGeometry - InnerDetector/InDetDetDescr/TRT_ReadoutGeometry - InnerDetector/InDetRawEvent/InDetSimData - Tracking/TrkDetDescr/TrkDetElementBase ) - # External dependencies: find_package( CLHEP ) find_package( Eigen ) diff --git a/InnerDetector/InDetDigitization/FastTRT_Digitization/src/TRTFastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastTRT_Digitization/src/TRTFastDigitizationTool.cxx index 181fdab20d6d246fadef487f5fcaa75ab6b88a4a..58cd1b8c9eb89fbfa44adddffb427d34de7652c1 100644 --- a/InnerDetector/InDetDigitization/FastTRT_Digitization/src/TRTFastDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastTRT_Digitization/src/TRTFastDigitizationTool.cxx @@ -760,7 +760,7 @@ bool TRTFastDigitizationTool::isArgonStraw( const Identifier &straw_id ) const int TRTFastDigitizationTool::gasType( const Identifier &straw_id ) const { // getStatusHT returns enum EStatus { Undefined, Dead, Good, Xenon, Argon, Krypton } // from 20.7.1 - // ​see InnerDetector/​InDetConditions/​TRT_ConditionsData/​TRT_ConditionsData/​StrawStatus.h + //see InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/StrawStatus.h // TRT representation of gasType = Xenon: 0, Argon: 1, Krypton: 2 int status = m_trtStrawStatusSummaryTool->getStatusHT( straw_id ); diff --git a/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt b/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt index f4aec89fd5b52bb50c4010cd6ccfc51aec94155d..847cb812353bb7130514460ae9ba526cec4d60f7 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt @@ -5,34 +5,6 @@ # Declare the package name: atlas_subdir( PixelDigitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - PRIVATE - Control/AthenaBaseComps - Control/AthenaKernel - Control/CxxUtils - Control/PileUpTools - Control/StoreGate - DetectorDescription/Identifier - Generators/GeneratorObjects - Generators/AtlasHepMC - InnerDetector/InDetConditions/InDetConditionsSummaryService - InnerDetector/InDetConditions/InDetCondTools - InnerDetector/InDetConditions/PixelConditionsTools - InnerDetector/InDetConditions/PixelConditionsData - InnerDetector/InDetConditions/SiPropertiesTool - InnerDetector/InDetDetDescr/InDetIdentifier - InnerDetector/InDetDetDescr/InDetReadoutGeometry - InnerDetector/InDetDetDescr/PixelReadoutGeometry - InnerDetector/InDetDetDescr/PixelCabling - InnerDetector/InDetDigitization/SiDigitization - InnerDetector/InDetRawEvent/InDetRawData - InnerDetector/InDetRawEvent/InDetSimData - InnerDetector/InDetSimEvent - Simulation/HitManagement - Tools/PathResolver ) - # External dependencies: find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Matrix TreePlayer ) @@ -41,7 +13,7 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread Matrix TreePla atlas_add_component( PixelDigitization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel CommissionEvent AthenaKernel PileUpToolsLib StoreGateLib SGtests Identifier GeneratorObjects PixelConditionsData SiPropertiesToolLib InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SiDigitization InDetRawData InDetSimData InDetSimEvent HitManagement PathResolver PixelCablingLib InDetConditionsSummaryService ) # Install files from the package: diff --git a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py index a8e679269022575f59754fd56f2fece3085891cf..fbe378f9f5028586ec0a296b617a9b90a074fb93 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py +++ b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py @@ -333,10 +333,6 @@ def BasicPixelDigitizationTool(name="PixelDigitizationTool", **kwargs): from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDCSCondTempAlg condSeq += PixelDCSCondTempAlg(name="PixelDCSCondTempAlg") - if not hasattr(condSeq, "PixelTDAQCondAlg"): - from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelTDAQCondAlg - condSeq += PixelTDAQCondAlg(name="PixelTDAQCondAlg", ReadKey="/TDAQ/Resources/ATLAS/PIXEL/Modules") - ##################### # Calibration Setup # ##################### diff --git a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfigNew.py b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfigNew.py index 41feb6cf2680f25bb8c5f374b4ec75e214cd71f8..6b262cca367bc1e2ba50c36e6942d9e11eadc9b8 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfigNew.py +++ b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfigNew.py @@ -9,8 +9,7 @@ from PixelConditionsAlgorithms.PixelConditionsConfig import ( PixelCablingCondAlgCfg, PixelChargeCalibCondAlgCfg, PixelConfigCondAlgCfg, PixelDCSCondHVAlgCfg, PixelDCSCondStateAlgCfg, PixelDCSCondStatusAlgCfg, PixelDCSCondTempAlgCfg, PixelDistortionAlgCfg, - PixelHitDiscCnfgAlgCfg, PixelOfflineCalibCondAlgCfg, PixelReadoutSpeedAlgCfg, - PixelTDAQCondAlgCfg + PixelHitDiscCnfgAlgCfg, PixelOfflineCalibCondAlgCfg, PixelReadoutSpeedAlgCfg # NEW FOR RUN3 PixelDeadMapCondAlgCfg, PixelChargeLUTCalibCondAlgCfg ) @@ -171,7 +170,6 @@ def PixelDigitizationBasicToolCfg(flags, name="PixelDigitizationBasicTool", **kw acc.merge(PixelDCSCondStateAlgCfg(flags)) acc.merge(PixelDCSCondStatusAlgCfg(flags)) # NEW FOR RUN3 acc.merge(PixelDeadMapCondAlgCfg(flags)) - acc.merge(PixelTDAQCondAlgCfg(flags)) # offline calibration acc.merge(PixelDistortionAlgCfg(flags)) acc.merge(PixelOfflineCalibCondAlgCfg(flags)) diff --git a/InnerDetector/InDetDigitization/SCT_Digitization/CMakeLists.txt b/InnerDetector/InDetDigitization/SCT_Digitization/CMakeLists.txt index 99da0ad9e2ee583895491a8ed68148ab17bea59d..027e24319b1e714c5da9385f4ea195a23b435577 100644 --- a/InnerDetector/InDetDigitization/SCT_Digitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/SCT_Digitization/CMakeLists.txt @@ -5,32 +5,6 @@ # Declare the package name: atlas_subdir( SCT_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Commission/CommissionEvent - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - DetectorDescription/Identifier - Event/xAOD/xAODEventInfo - GaudiKernel - InnerDetector/InDetConditions/InDetCondTools - InnerDetector/InDetDigitization/SiDigitization - InnerDetector/InDetRawEvent/InDetRawData - InnerDetector/InDetSimEvent - Simulation/HitManagement - PRIVATE - Control/StoreGate - Generators/GeneratorObjects - InnerDetector/InDetConditions/InDetConditionsSummaryService - InnerDetector/InDetConditions/SCT_ConditionsTools - InnerDetector/InDetConditions/SiPropertiesTool - InnerDetector/InDetDetDescr/InDetIdentifier - InnerDetector/InDetDetDescr/InDetReadoutGeometry - InnerDetector/InDetDetDescr/SCT_ReadoutGeometry - InnerDetector/InDetDetDescr/SCT_ModuleDistortions - InnerDetector/InDetRawEvent/InDetSimData ) - # External dependencies: find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) @@ -48,7 +22,6 @@ atlas_add_test( SCT_DigitizationMT_test ENVIRONMENT THREADS=10 ) # Install files from the package: -atlas_install_headers( SCT_Digitization ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) diff --git a/InnerDetector/InDetDigitization/SiDigitization/CMakeLists.txt b/InnerDetector/InDetDigitization/SiDigitization/CMakeLists.txt index 6161672e9259cdbc15ecb1fc74e0fb775afeb4c5..7ab61b59d4bfa653db2804432b7de887c8dc82c2 100644 --- a/InnerDetector/InDetDigitization/SiDigitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/SiDigitization/CMakeLists.txt @@ -5,15 +5,6 @@ # Declare the package name: atlas_subdir( SiDigitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaKernel - Control/AthAllocators - DetectorDescription/Identifier - GaudiKernel - InnerDetector/InDetDetDescr/InDetReadoutGeometry - InnerDetector/InDetSimEvent ) - # Component(s) in the package: atlas_add_library( SiDigitization src/SiChargedDiode.cxx diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/CMakeLists.txt b/InnerDetector/InDetDigitization/TRT_Digitization/CMakeLists.txt index f199a3bcb639619d73eff36c8a5cc17e3c533d3c..9beff4d82596697a76f6df328ee852875e7ba5e3 100644 --- a/InnerDetector/InDetDigitization/TRT_Digitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/TRT_Digitization/CMakeLists.txt @@ -5,35 +5,6 @@ # Declare the package name: atlas_subdir( TRT_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - PRIVATE - Control/StoreGate - Control/AthenaBaseComps - Control/AthenaKernel - Control/CxxUtils - Control/PileUpTools - Database/AthenaPOOL/AthenaPoolUtilities - DetectorDescription/GeoModel/GeoModelInterfaces - DetectorDescription/GeoModel/GeoModelUtilities - DetectorDescription/GeoPrimitives - DetectorDescription/Identifier - Event/xAOD/xAODEventInfo - Generators/GeneratorObjects - InnerDetector/InDetConditions/TRT_ConditionsData - InnerDetector/InDetConditions/TRT_ConditionsServices - InnerDetector/InDetDetDescr/InDetIdentifier - InnerDetector/InDetDetDescr/InDetReadoutGeometry - InnerDetector/InDetDetDescr/TRT_ReadoutGeometry - InnerDetector/InDetRawEvent/InDetRawData - InnerDetector/InDetRawEvent/InDetSimData - InnerDetector/InDetSimEvent - InnerDetector/InDetSimUtils/TRT_PAI_Process - Simulation/HitManagement - MagneticField/MagFieldElements - MagneticField/MagFieldConditions ) - # External dependencies: find_package( CLHEP ) find_package( Eigen ) diff --git a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/CMakeLists.txt b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/CMakeLists.txt index fb69aad883417f07a5df834380c43cbeddee2cc9..635ed7f146826a49f1a55aa3ed41b81259dc5881 100644 --- a/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/TRT_RawDataByteStreamCnv/CMakeLists.txt @@ -43,5 +43,3 @@ atlas_add_component( TRT_RawDataByteStreamCnv # Install files from the package: atlas_install_headers( TRT_RawDataByteStreamCnv ) -atlas_install_runtime( share/*.dat ) - diff --git a/InnerDetector/InDetExample/InDetRecExample/python/ConfiguredNewTrackingCuts.py b/InnerDetector/InDetExample/InDetRecExample/python/ConfiguredNewTrackingCuts.py index 03800a50999144a60392305eeda607b69e3b3a6c..1f2f6c6d287083f5e6ef9e0204bb71997d205abb 100755 --- a/InnerDetector/InDetExample/InDetRecExample/python/ConfiguredNewTrackingCuts.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/ConfiguredNewTrackingCuts.py @@ -125,7 +125,7 @@ class ConfiguredNewTrackingCuts : # --- run back tracking and TRT only in RoI seed regions self.__RoISeededBackTracking = False - + self.__minRoIClusterEt = 0. # -------------------------------------- # --- TRT Only TRACKING cuts # -------------------------------------- @@ -235,7 +235,14 @@ class ConfiguredNewTrackingCuts : self.__keepAllConfirmedSeeds = True self.__maxSeedsPerSP = 1 + if self.__indetflags.cutLevel() >= 19: + # Calo cluster Et for RoI seeded backtracking for TRT segment finding + # and for TRT-si extensions + self.__minRoIClusterEt = 6000. * Units.MeV + self.__minSecondaryPt = 3.0 * Units.GeV # Increase pT cut used for back-tracking to match calo-RoI + + if self.__indetflags.cutLevel() >= 20: print('--------> FATAL ERROR, cut level undefined, abort !') import sys sys.exit() @@ -1074,6 +1081,9 @@ class ConfiguredNewTrackingCuts : def RoISeededBackTracking( self ) : return self.__RoISeededBackTracking + def minRoIClusterEt( self ) : + return self.__minRoIClusterEt + def printInfo( self ) : print('****** Inner Detector Track Reconstruction Cuts ************************************') print('*') @@ -1151,6 +1161,8 @@ class ConfiguredNewTrackingCuts : print('* TRT segment finder pt bins : ', self.__TRTSegFinderPtBins) print('* rejectShortExtensions : ', self.__rejectShortExtensions) print('* SiExtensionsCuts : ', self.__SiExtensionCuts) + if self.__RoISeededBackTracking: + print('* min CaloCluster Et : ', self.__minRoIClusterEt) print('*') if self.__useTRT: print('* useParameterizedTRTCuts : ', self.__useParameterizedTRTCuts) diff --git a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py index 0167190101b08898c08da3f4b9b209fc43e1eaa9..7c6a85cbd4f4f45b1f6dd62b506ff9de24e68a94 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py @@ -302,8 +302,8 @@ class cutLevel(InDetFlagsJobProperty): """ statusOn = True allowedTypes = ['int'] - allowedValues= [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18] - StoredValue = 18 + allowedValues= [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19] + StoredValue = 19 class doBremRecovery(InDetFlagsJobProperty): """Turn on running of Brem Recover in tracking""" diff --git a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py index 99383e9fc4691910df6388e9598cc7969e0a9354..17e91c7b06ae4bb405658d49ad6edee388807adf 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py @@ -1089,7 +1089,7 @@ def getInDetTRT_ExtensionToolCosmics(name='InDetTRT_ExtensionToolCosmics',**kwar TRT_ClustersContainer = InDetKeys.TRT_DriftCircles(), SearchNeighbour = False, # needs debugging!!! RoadWidth = 10.) - + from TRT_TrackExtensionTool_xk.TRT_TrackExtensionTool_xkConf import InDet__TRT_TrackExtensionToolCosmics return InDet__TRT_TrackExtensionToolCosmics(name = the_name, **kwargs) @@ -1160,6 +1160,10 @@ def getInDetTRT_TrackExtensionTool_xk(name='InDetTRT_ExtensionTool', TrackingCut RoadWidth = 20., UseParameterization = InDetNewTrackingCuts.useParameterizedTRTCuts(), maxImpactParameter = 500 if InDetFlags.doBeamHalo() or InDetFlags.doBeamGas() else 50) # single beam running, open cuts + if (InDetNewTrackingCuts.RoISeededBackTracking()): + kwargs=setDefaults(kwargs, + minTRTSegmentpT = InDetNewTrackingCuts.minSecondaryPt()) #50% of the calo roi cluster Et requirement for RoISeededBackTracking + from TRT_TrackExtensionTool_xk.TRT_TrackExtensionTool_xkConf import InDet__TRT_TrackExtensionTool_xk return InDet__TRT_TrackExtensionTool_xk(the_name, **kwargs) diff --git a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredBackTracking.py b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredBackTracking.py index 6f0941cdfe01728e09087aadc3074065ffaed89a..86338aed21c0b08d7cdc3c453f71ad8c8b5d5980 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredBackTracking.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredBackTracking.py @@ -19,6 +19,7 @@ class ConfiguredBackTracking: # get ToolSvc and topSequence # from AthenaCommon.AppMgr import ToolSvc + from AthenaCommon.AppMgr import ServiceMgr from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() @@ -157,7 +158,8 @@ class ConfiguredBackTracking: self.__TRTSeededTracks = InDetKeys.TRTSeededTracks() # # TRT seeded back tracking algorithm - # + + from AthenaCommon import CfgGetter from TRT_SeededTrackFinder.TRT_SeededTrackFinderConf import InDet__TRT_SeededTrackFinder import InDetRecExample.TrackingCommon as TrackingCommon @@ -182,7 +184,13 @@ class ConfiguredBackTracking: FinalStatistics = False, OutputSegments = False, InputSegmentsLocation = InDetKeys.TRT_Segments(), - OutputTracksLocation = self.__TRTSeededTracks) + OutputTracksLocation = self.__TRTSeededTracks, + CaloClusterEt = NewTrackingCuts.minRoIClusterEt()) + + if (NewTrackingCuts.RoISeededBackTracking()): + from RegionSelector.RegSelToolConfig import makeRegSelTool_SCT + InDetTRT_SeededTrackFinder.RegSelTool = makeRegSelTool_SCT() + InDetTRT_SeededTrackFinder.CaloSeededRoI = True # InDetTRT_SeededTrackFinder.OutputLevel = VERBOSE topSequence += InDetTRT_SeededTrackFinder if (InDetFlags.doPrintConfigurables()): diff --git a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingTRTExtension.py b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingTRTExtension.py index 9414458ef86e100b35563546ef042b6c0092d7b1..40b3c1bda75e3b6bf86fe42ee2815c3d5100b414 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingTRTExtension.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredNewTrackingTRTExtension.py @@ -70,7 +70,7 @@ class ConfiguredNewTrackingTRTExtension: # if InDetFlags.doExtensionProcessor() and InDetFlags.doTRTExtensionNew(): - if InDetFlags.trtExtensionType() is 'DAF' : + if InDetFlags.trtExtensionType() == 'DAF' : # # --- DAF Fitter setup # @@ -128,7 +128,7 @@ class ConfiguredNewTrackingTRTExtension: tryBremFit = InDetFlags.doBremRecovery(), caloSeededBrem = InDetFlags.doCaloSeededBrem(), pTminBrem = NewTrackingCuts.minPTBrem(), - RefitPrds = not (InDetFlags.refitROT() or (InDetFlags.trtExtensionType() is 'DAF'))) + RefitPrds = not (InDetFlags.refitROT() or (InDetFlags.trtExtensionType() == 'DAF'))) #InDetExtensionProcessor.OutputLevel = VERBOSE if InDetFlags.materialInteractions(): InDetExtensionProcessorPhase.matEffects = InDetFlags.materialInteractionsType() @@ -154,7 +154,7 @@ class ConfiguredNewTrackingTRTExtension: tryBremFit = InDetFlags.doBremRecovery(), caloSeededBrem = InDetFlags.doCaloSeededBrem(), pTminBrem = NewTrackingCuts.minPTBrem(), - RefitPrds = not (InDetFlags.refitROT() or (InDetFlags.trtExtensionType() is 'DAF'))) + RefitPrds = not (InDetFlags.refitROT() or (InDetFlags.trtExtensionType() == 'DAF'))) #InDetExtensionProcessor.OutputLevel = VERBOSE if InDetFlags.materialInteractions(): InDetExtensionProcessor.matEffects = InDetFlags.materialInteractionsType() diff --git a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredTRTSegmentFinding.py b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredTRTSegmentFinding.py index ddcecad3d6667d3e38cffb5452967a669b3120c3..f4d53ada886c8a1dc2b50bfcc49394dc208f97ca 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredTRTSegmentFinding.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/ConfiguredTRTSegmentFinding.py @@ -142,6 +142,8 @@ class ConfiguredTRTSegmentFinding: SegmentsMakerTool = InDetTRT_TrackSegmentsMaker, SegmentsLocation = BarrelSegments, useCaloSeeds = True, + CaloClusterEt = NewTrackingCuts.minRoIClusterEt(), + MinNumberDriftCircles = NewTrackingCuts.minSecondaryTRTonTrk(), InputClusterContainerName = InDetKeys.CaloClusterROIContainer()) else: diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py index 96d7fd8a18872df44bf6e5cf6246597dbce1636d..9c98a1940e218611f9a3574b56f0139abd9d2f7e 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecConditionsAccess.py @@ -141,14 +141,6 @@ if DetFlags.pixel_on(): alg.ReadKeyStatus = '' condSeq += alg - if athenaCommonFlags.isOnline(): - if not conddb.folderRequested("/TDAQ/Resources/ATLAS/PIXEL/Modules"): - conddb.addFolder("TDAQ_ONL", "/TDAQ/Resources/ATLAS/PIXEL/Modules", className="CondAttrListCollection") - - if not hasattr(condSeq, "PixelTDAQCondAlg"): - from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelTDAQCondAlg - condSeq += PixelTDAQCondAlg(name="PixelTDAQCondAlg") - ##################### # Calibration Setup # ##################### diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecHadCaloSeededROISelection.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecHadCaloSeededROISelection.py index b69bd080af4c208f4695e247dc4d0bf7f7fac4d3..c647c91eb5ca16e6a3f0162a6fb7d2cfdfc82af0 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecHadCaloSeededROISelection.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecHadCaloSeededROISelection.py @@ -25,7 +25,7 @@ from InDetCaloClusterROIBuilder.InDetCaloClusterROIBuilderConf import InDet__Cal InDetCaloClusterROIBuilder = InDet__CaloClusterROI_Builder(name = "InDetCaloClusterROIBuilder") if (InDetFlags.doPrintConfigurables()): - print InDetCaloClusterROIBuilder + print (InDetCaloClusterROIBuilder) # @@ -40,5 +40,5 @@ InDetHadCaloClusterROISelector = InDet__CaloClusterROI_Selector ( name ) topSequence += InDetHadCaloClusterROISelector if (InDetFlags.doPrintConfigurables()): - print InDetHadCaloClusterROISelector + print (InDetHadCaloClusterROISelector) diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py index 9a5dce707a58907b80f02675ce1d5e114eb65a46..16c6014dc09b44f3e71a7f34c4478804fcc72085 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py @@ -558,90 +558,82 @@ if (InDetFlags.doVertexFinding() or InDetFlags.doVertexFindingForMonitoring()) o if (InDetFlags.doPrintConfigurables()): printfunc (InDetLinFactory) - # - # --- load other tools if needed + # --- load configured Seed finder # - if (InDetFlags.primaryVertexSetup() == 'DefaultAdaptiveFinding' or - InDetFlags.primaryVertexSetup() == 'IterativeFinding' or - InDetFlags.primaryVertexSetup() == 'AdaptiveMultiFinding' or - InDetFlags.primaryVertexSetup() == 'MedImgMultiFinding' or - InDetFlags.primaryVertexSetup() == 'GaussIterativeFinding' or - InDetFlags.primaryVertexSetup() == 'GaussAdaptiveMultiFinding'): - # - # --- load configured Seed finder - # - if (InDetFlags.primaryVertexSetup() == 'GaussIterativeFinding' or - InDetFlags.primaryVertexSetup() == 'GaussAdaptiveMultiFinding'): - from TrkVertexSeedFinderUtils.TrkVertexSeedFinderUtilsConf import Trk__GaussianTrackDensity - GaussDensityEstimator = Trk__GaussianTrackDensity( name = "GaussianDensity" ) - ToolSvc += GaussDensityEstimator - - from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__TrackDensitySeedFinder - InDetVtxSeedFinder = Trk__TrackDensitySeedFinder( name = "GaussianDensitySeedFinder", - DensityEstimator = GaussDensityEstimator ) - elif (InDetFlags.primaryVertexSetup() == 'MedImgMultiFinding'): - from TrkVertexSeedFinderUtils.TrkVertexSeedFinderUtilsConf import Trk__LocalMax1DClusterFinder, Trk__VertexImageMaker - InDetMedImgClusterFinder = Trk__LocalMax1DClusterFinder( name = "InDetMedImgClusterFinder", - weightThreshold = 1500.0, - mergeParameter = 0.95, - clusterWindowXY = 0.34, - refineZ = True, - gaussianWindow = True) - ToolSvc += InDetMedImgClusterFinder - InDetMedImgMaker = Trk__VertexImageMaker( name = "InDetMedImgMaker", - xbins = 32, - ybins = 32, - zbins = 2048, - xrange = 2.0, - yrange = 2.0, - zrange = 200.0, - cutoffFreqDenominator_xy = 2, - cutoffFreqDenominator_z = 1, - angularCutoffParameter = 0.75) - ToolSvc += InDetMedImgMaker - from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__ImagingSeedFinder - InDetVtxSeedFinder = Trk__ImagingSeedFinder( name = "InDetMedImgSeedFinder", - VertexCluster = InDetMedImgClusterFinder, - VertexImageMaker = InDetMedImgMaker ) - - elif (InDetFlags.doPrimaryVertex3DFinding()): - from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__CrossDistancesSeedFinder - InDetVtxSeedFinder = Trk__CrossDistancesSeedFinder(name = "InDetCrossDistancesSeedFinder", - trackdistcutoff = 1., - trackdistexppower = 2) - else: - from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__ZScanSeedFinder - InDetVtxSeedFinder = Trk__ZScanSeedFinder(name = "InDetZScanSeedFinder" - # Mode1dFinder = # default, no setting needed - ) - ToolSvc += InDetVtxSeedFinder - if (InDetFlags.doPrintConfigurables()): - printfunc (InDetVtxSeedFinder) + if (InDetFlags.primaryVertexSetup() == 'GaussIterativeFinding' or + InDetFlags.primaryVertexSetup() == 'GaussAdaptiveMultiFinding'): + from TrkVertexSeedFinderUtils.TrkVertexSeedFinderUtilsConf import Trk__GaussianTrackDensity + GaussDensityEstimator = Trk__GaussianTrackDensity(name="GaussianDensity") + ToolSvc += GaussDensityEstimator + + from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__TrackDensitySeedFinder + InDetVtxSeedFinder = Trk__TrackDensitySeedFinder(name="GaussianDensitySeedFinder", + DensityEstimator=GaussDensityEstimator) + + elif (InDetFlags.primaryVertexSetup() == 'MedImgMultiFinding'): + from TrkVertexSeedFinderUtils.TrkVertexSeedFinderUtilsConf import Trk__LocalMax1DClusterFinder, Trk__VertexImageMaker + InDetMedImgClusterFinder = Trk__LocalMax1DClusterFinder(name="InDetMedImgClusterFinder", + weightThreshold=1500.0, + mergeParameter=0.95, + clusterWindowXY=0.34, + refineZ=True, + gaussianWindow=True) + ToolSvc += InDetMedImgClusterFinder + InDetMedImgMaker = Trk__VertexImageMaker(name="InDetMedImgMaker", + xbins=32, + ybins=32, + zbins=2048, + xrange=2.0, + yrange=2.0, + zrange=200.0, + cutoffFreqDenominator_xy=2, + cutoffFreqDenominator_z=1, + angularCutoffParameter=0.75) + ToolSvc += InDetMedImgMaker + from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__ImagingSeedFinder + InDetVtxSeedFinder = Trk__ImagingSeedFinder(name="InDetMedImgSeedFinder", + VertexCluster=InDetMedImgClusterFinder, + VertexImageMaker=InDetMedImgMaker) + + elif (InDetFlags.doPrimaryVertex3DFinding()): + from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__CrossDistancesSeedFinder + InDetVtxSeedFinder = Trk__CrossDistancesSeedFinder(name="InDetCrossDistancesSeedFinder", + trackdistcutoff=1., + trackdistexppower=2) + + else: + from TrkVertexSeedFinderTools.TrkVertexSeedFinderToolsConf import Trk__ZScanSeedFinder + InDetVtxSeedFinder = Trk__ZScanSeedFinder(name="InDetZScanSeedFinder" + # Mode1dFinder = # default, no setting needed + ) + ToolSvc += InDetVtxSeedFinder + if (InDetFlags.doPrintConfigurables()): + printfunc(InDetVtxSeedFinder) - # - # --- load Impact Point Factory - # - from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__ImpactPoint3dEstimator - InDetImpactPoint3dEstimator = Trk__ImpactPoint3dEstimator(name = "InDetImpactPoint3dEstimator", - Extrapolator = InDetExtrapolator) - ToolSvc += InDetImpactPoint3dEstimator - if (InDetFlags.doPrintConfigurables()): - printfunc (InDetImpactPoint3dEstimator) + # + # --- load Impact Point Factory + # + from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__ImpactPoint3dEstimator + InDetImpactPoint3dEstimator = Trk__ImpactPoint3dEstimator(name="InDetImpactPoint3dEstimator", + Extrapolator=InDetExtrapolator) + ToolSvc += InDetImpactPoint3dEstimator + if (InDetFlags.doPrintConfigurables()): + printfunc(InDetImpactPoint3dEstimator) - # - # --- load Configured Annealing Maker - # - from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__DetAnnealingMaker - if(InDetFlags.primaryVertexSetup() == 'GaussAdaptiveMultiFinding'): - InDetAnnealingMaker = Trk__DetAnnealingMaker(name = "InDetAnnealingMaker", - SetOfTemperatures = [8.,4.,2.,1.4142136,1.2247449,1.]) # 'standard' annealing temps raised to 0.5 - else: - InDetAnnealingMaker = Trk__DetAnnealingMaker(name = "InDetAnnealingMaker", - SetOfTemperatures = [64.,16.,4.,2.,1.5,1.]) # not default - ToolSvc += InDetAnnealingMaker - if (InDetFlags.doPrintConfigurables()): - printfunc (InDetAnnealingMaker) + # + # --- load Configured Annealing Maker + # + from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__DetAnnealingMaker + if(InDetFlags.primaryVertexSetup() == 'GaussAdaptiveMultiFinding'): + InDetAnnealingMaker = Trk__DetAnnealingMaker(name="InDetAnnealingMaker", + SetOfTemperatures=[8., 4., 2., 1.4142136, 1.2247449, 1.]) # 'standard' annealing temps raised to 0.5 + else: + InDetAnnealingMaker = Trk__DetAnnealingMaker(name="InDetAnnealingMaker", + SetOfTemperatures=[64., 16., 4., 2., 1.5, 1.]) # not default + ToolSvc += InDetAnnealingMaker + if (InDetFlags.doPrintConfigurables()): + printfunc(InDetAnnealingMaker) if (InDetFlags.primaryVertexSetup() == 'DefaultFastFinding' or InDetFlags.primaryVertexSetup() == 'DefaultFullFinding' or diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPostProcessing.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPostProcessing.py index 0c4cd6a41b88cbdb0ca5c03c9a0be02968a97de9..f1cb2601d1941110c85b409078df70651907a421 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPostProcessing.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecPostProcessing.py @@ -132,7 +132,7 @@ if InDetFlags.doLowBetaFinder(): include ("InDetRecExample/ConfiguredLowBetaFinder.py") from AthenaCommon.GlobalFlags import globalflags InDetLowBetaTrkAlgorithm = ConfiguredLowBetaFinder(InDetKeys.xAODTrackParticleContainer(), - True if (globalflags.DataSource is not "data") else False, + True if (globalflags.DataSource != "data") else False, InDetKeys.UnslimmedTracks()) # ------------------------------------------------------------------------- diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_all.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_all.py index df068c306babb33533fea8a3fe37402607b08742..65477cdcb2ce9ec13b6d4566813222fb1c640c35 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_all.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_all.py @@ -79,7 +79,7 @@ if InDetFlags.doTruth(): from xAODEventInfoCnv.xAODEventInfoCnvConf import xAODMaker__EventInfoCnvAlg alg = xAODMaker__EventInfoCnvAlg() -print alg +print (alg) topSequence += alg #------------------------------------------------------------ @@ -91,7 +91,7 @@ if doEdmMonitor: InDetEdmMonitor = Trk__EventDataModelMonitor (name = 'InDetEdmMonitor') topSequence += InDetEdmMonitor if (InDetFlags.doPrintConfigurables()): - print InDetEdmMonitor + print (InDetEdmMonitor) ## DBM TruthLinks if (InDetFlags.doDBMstandalone() or InDetFlags.doDBM()) and InDetFlags.doTruth(): from AthenaCommon.Resilience import protectedInclude @@ -187,7 +187,7 @@ if InDetFlags.doSplitReco() : ) builder.DoFiltering = False topSequence += builder - print builder + print (builder) # ------------------------------------------------------------ # write BS diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetWriteBS_jobOptions.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetWriteBS_jobOptions.py index 311e8185eb90981bc178c58a39a99e91afbdf802..d60fd6299d2eff526a3a389f257e504e0f959559 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetWriteBS_jobOptions.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetWriteBS_jobOptions.py @@ -32,7 +32,7 @@ if DetFlags.haveRIO.TRT_on(): ByteStreamCnvSvc.InitCnvs += ["TRT_RDO_Container"] if DetFlags.haveRIO.BCM_on(): ByteStreamCnvSvc.InitCnvs += ["BCM_RDO_Container"] -print ByteStreamCnvSvc +print (ByteStreamCnvSvc) # OutputStream from AthenaServices.AthenaServicesConf import AthenaOutputStream @@ -50,7 +50,7 @@ if DetFlags.haveRIO.TRT_on(): oStream.ItemList += [ "TRT_RDO_Container#*" ] if DetFlags.haveRIO.BCM_on(): oStream.ItemList += [ "BCM_RDO_Container#*" ] -print oStream +print (oStream) # add stream theApp.addOutputStream( oStream ) diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/EFInDetConfig.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/EFInDetConfig.py index 58846ae67233b0bbe152d56239e3f0e5729f45ec..1a5385d6fd0bf8d927f5774de08816ea4338309d 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/EFInDetConfig.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/EFInDetConfig.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 # # Configuration classes for EF InDet Algs @@ -72,7 +72,7 @@ class TrigEFIDSequence(TrigInDetSequenceBase): #_line = algName+"_EF(\""+seqinstance+"\","+type")" #the TRTOnly sequence needs to instantiate a dedaicated set of cuts - if seqType is "TRTOnly" and (algName.startswith("TRT_TrigTrackSegmentsFinder") or algName.startswith("TRT_TrigStandaloneTrackFinder")): + if seqType == "TRTOnly" and (algName.startswith("TRT_TrigTrackSegmentsFinder") or algName.startswith("TRT_TrigStandaloneTrackFinder")): _line = "%s_EF(\"%s\",\"%s\",\"%s\")" % (algName,seqinstance,type,seqType) else: _line = "%s_EF(\"%s\",\"%s\")" % (algName,seqinstance,type) diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py index 81194c479fc7c388f7eda61b11faeb40629a8ab9..01112979ea9d538940bdcc5341f7057f5fe12c35 100644 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py @@ -189,16 +189,15 @@ class PixelConditionsServicesSetup: ######################### # TDAQ Conditions Setup # ######################### - TrigPixelTDAQConditionsTool = None - PixelTDAQFolder = "/TDAQ/Resources/ATLAS/PIXEL/Modules" if self.useTDAQ: + PixelTDAQFolder = "/TDAQ/Resources/ATLAS/PIXEL/Modules" PixelTDAQInstance = "TDAQ_ONL" if not conddb.folderRequested(PixelTDAQFolder): conddb.addFolder(PixelTDAQInstance, PixelTDAQFolder, className="CondAttrListCollection") - if not hasattr(condSeq, "PixelTDAQCondAlg"): - from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelTDAQCondAlg - condSeq += PixelTDAQCondAlg(name="PixelTDAQCondAlg", ReadKey=PixelTDAQFolder) + if not hasattr(condSeq, "PixelTDAQCondAlg"): + from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelTDAQCondAlg + condSeq += PixelTDAQCondAlg(name="PixelTDAQCondAlg", ReadKey=PixelTDAQFolder) ############################ # Conditions Summary Setup # diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecBackTracking.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecBackTracking.py index 0aacc9085e47ac7995eedf4d33e91a05cac3f440..bd853408b9e6521c9ffaf1fbad7ed645abcc821c 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecBackTracking.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecBackTracking.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 # ----------- Draft version of TRT Segment finding # @@ -40,7 +40,7 @@ class TRT_TrigTrackSegmentsFinder_EF( InDet__TRT_TrigTrackSegmentsFinder ): from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigPrdAssociationTool, InDetTrigPatternPropagator, InDetTrigPatternUpdator, InDetTrigTRTDriftCircleCut from InDetTrigRecExample.InDetTrigConfigRecLoadToolsBack import InDetTrigTRTDetElementsRoadMaker from AthenaCommon.SystemOfUnits import GeV - if seqType is "TRTOnly": + if seqType == "TRTOnly": from InDetTrigRecExample.ConfiguredNewTrackingTrigCuts import EFIDTrackingCutsTRT InDetTrigCutValues = EFIDTrackingCutsTRT suffixTRT = "_TRTOnly" @@ -72,7 +72,7 @@ class TRT_TrigTrackSegmentsFinder_EF( InDet__TRT_TrigTrackSegmentsFinder ): if (InDetTrigFlags.doPrintConfigurables()): print ( InDetTrigTRTExtensionTool) - if seqType is "TRTOnly": + if seqType == "TRTOnly": # segment finding MinNumberDCs = InDetTrigCutValues.minTRTonly() else: @@ -94,9 +94,9 @@ class TRT_TrigTrackSegmentsFinder_EF( InDet__TRT_TrigTrackSegmentsFinder ): InDetTrigTRT_TrackSegmentsMaker.pTmin = InDetTrigSliceSettings[('pTmin',type)] - if type is 'photon': + if type == 'photon': InDetTrigTRT_TrackSegmentsMaker.PRDtoTrackMap = 'InDetTrigPRDtoTrackMap_Photon_EF' - elif type is 'cosmicsN': + elif type == 'cosmicsN': from TRT_TrackSegmentsTool_xk.TRT_TrackSegmentsTool_xkConf import InDet__TRT_TrackSegmentsMaker_BarrelCosmics #TODO COSMICS - replace old CTB TrackSegmentsMaker @@ -170,7 +170,7 @@ class TRT_TrigSeededTrackFinder_EF( InDet__TRT_TrigSeededTrackFinder ): LoadFull = False, #DoCosmics ) - if type is 'photon': + if type == 'photon': InDetTrigTRT_SeededSpacePointFinder.PRDtoTrackMap = 'InDetTrigPRDtoTrackMap_Photon_EF' elif InDetTrigFlags.loadSimpleTRTSeededSPFinder(): @@ -193,7 +193,7 @@ class TRT_TrigSeededTrackFinder_EF( InDet__TRT_TrigSeededTrackFinder ): MaxHoles = 2, PRDtoTrackMap = "", RestrictROI = True) - if type is 'photon': + if type == 'photon': InDetTrigTRT_SeededSpacePointFinder.PRDtoTrackMap = 'InDetTrigPRDtoTrackMap_Photon_EF' # @TODO correct ? ToolSvc += InDetTrigTRT_SeededSpacePointFinder @@ -387,7 +387,7 @@ class TRT_TrigStandaloneTrackFinder_EF( InDet__TRT_TrigStandaloneTrackFinder ): from AthenaCommon.SystemOfUnits import GeV - if seqType is "TRTOnly": + if seqType == "TRTOnly": from InDetTrigRecExample.ConfiguredNewTrackingTrigCuts import EFIDTrackingCutsTRT InDetTrigCutValues = EFIDTrackingCutsTRT suffixTRT="_TRTOnly" @@ -429,7 +429,7 @@ class TRT_TrigStandaloneTrackFinder_EF( InDet__TRT_TrigStandaloneTrackFinder ): RefitterTool = InDetTrigTrackFitterTRT, Extrapolator = InDetTrigExtrapolator, PRDtoTrackMap = prefix+'PRDtoTrackMap'+suffix \ - if seqType is not "InsideOutAndTRTOnly" else "", + if seqType != "InsideOutAndTRTOnly" else "", TrackSummaryTool = InDetTrigTrackSummaryTool, ScoringTool = InDetTrigTRT_StandaloneScoringTool, FinalRefit = True, diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecNewTracking.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecNewTracking.py index 60d5858ceee3f8f4d96b4a4c4507a7382e78c51a..cc629ddaf5b77dd04323abedd4cb025d7f457e7c 100755 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecNewTracking.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigRecNewTracking.py @@ -432,7 +432,7 @@ class TRTTrackExtAlg_EF( InDet__TRT_TrigTrackExtensionAlg ): # from AthenaCommon.DetFlags import DetFlags if (DetFlags.haveRIO.TRT_on()): - if InDetTrigFlags.trtExtensionType() is 'xk' : + if InDetTrigFlags.trtExtensionType() == 'xk' : from TRT_TrackExtensionTool_xk.TRT_TrackExtensionTool_xkConf import InDet__TRT_TrackExtensionTool_xk from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigTRTDriftCircleCut @@ -452,7 +452,7 @@ class TRTTrackExtAlg_EF( InDet__TRT_TrigTrackExtensionAlg ): RoadWidth = 20., UseParameterization = EFIDTrackingCuts.useParameterizedTRTCuts() ) - elif InDetTrigFlags.trtExtensionType() is 'DAF' : + elif InDetTrigFlags.trtExtensionType() == 'DAF' : # load TRT Competing ROT tool from TrkDeterministicAnnealingFilter.TrkDeterministicAnnealingFilterConf import Trk__DAF_SimpleWeightCalculator InDetTrigWeightCalculator = Trk__DAF_SimpleWeightCalculator( name = 'InDetTrigWeightCalculator') @@ -509,7 +509,7 @@ class TrigExtProcessor_EF( InDet__InDetTrigExtensProcessor ): from AthenaCommon.AppMgr import ToolSvc from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigTrackFitter, InDetTrigPatternUpdator, InDetTrigExtrapolator, InDetTrigTrackSummaryTool - if InDetTrigFlags.trtExtensionType() is 'DAF' : + if InDetTrigFlags.trtExtensionType() == 'DAF' : # DAF Fitter setup # @@ -600,7 +600,7 @@ class TrigExtProcessor_EF( InDet__InDetTrigExtensProcessor ): self.TrackFitter = InDetTrigExtensionFitter self.ScoringTool = InDet__InDetAmbiScoringTool('InDetTrigExtScoringTool_'+type) - self.RefitPrds = not (InDetTrigFlags.refitROT() or (InDetTrigFlags.trtExtensionType() is 'DAF')) + self.RefitPrds = not (InDetTrigFlags.refitROT() or (InDetTrigFlags.trtExtensionType() == 'DAF')) self.suppressHoleSearch = False # does not work properly if type=="cosmicsN": self.ScoringTool = InDetTrigScoringToolCosmics_TRT diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt b/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt index 4b222431f35887dd485890e5c7c249776e9462f4..ca37b502fa8e2364c39bb826bda9b85110537a8d 100644 --- a/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt +++ b/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt @@ -38,7 +38,6 @@ atlas_add_component( InDetOverlay LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps IDC_OverlayBase GaudiKernel InDetRawData StoreGateLib SGtests GeneratorObjects InDetBCM_RawData InDetIdentifier InDetSimData TrkTrack TRT_ConditionsServicesLib TRT_ElectronPidToolsLib) # Install files from the package: -atlas_install_headers( InDetOverlay ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/StoreGateTestCommon.txt ) diff --git a/InnerDetector/InDetRecAlgs/InDetCaloClusterROISelector/CMakeLists.txt b/InnerDetector/InDetRecAlgs/InDetCaloClusterROISelector/CMakeLists.txt index 9f765c36766e5ea74bd568e8a0130f1f03ad10c5..027a5ce6d90661834b598dcac94d64f32e3a70d9 100644 --- a/InnerDetector/InDetRecAlgs/InDetCaloClusterROISelector/CMakeLists.txt +++ b/InnerDetector/InDetRecAlgs/InDetCaloClusterROISelector/CMakeLists.txt @@ -23,7 +23,7 @@ atlas_depends_on_subdirs( PUBLIC atlas_add_component( InDetCaloClusterROISelector src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps xAODCaloEvent GaudiKernel CaloEvent CaloUtilsLib InDetRecToolInterfaces TrkCaloClusterROI ) + LINK_LIBRARIES AthenaBaseComps xAODCaloEvent GaudiKernel CaloEvent CaloUtilsLib InDetRecToolInterfaces TrkCaloClusterROI egammaInterfacesLib ) # Install files from the package: atlas_install_headers( InDetCaloClusterROISelector ) diff --git a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/share/SiSPSeededTracksStandalone.py b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/share/SiSPSeededTracksStandalone.py index 6339fa7e3376a8cbda8c2485ad058f33e5d5faf1..a0103638668fff24113672d52f70f84b6aed369c 100644 --- a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/share/SiSPSeededTracksStandalone.py +++ b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/share/SiSPSeededTracksStandalone.py @@ -278,14 +278,6 @@ if doPixel: from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDCSCondStatusAlg condSeq += PixelDCSCondStatusAlg(name="PixelDCSCondStatusAlg") - if athenaCommonFlags.isOnline(): - if not conddb.folderRequested("/TDAQ/Resources/ATLAS/PIXEL/Modules"): - conddb.addFolder("TDAQ_ONL", "/TDAQ/Resources/ATLAS/PIXEL/Modules", className="CondAttrListCollection") - - if not hasattr(condSeq, "PixelTDAQCondAlg"): - from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelTDAQCondAlg - condSeq += PixelTDAQCondAlg(name="PixelTDAQCondAlg") - ##################### # Calibration Setup # ##################### diff --git a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/share/SiSPSeededTracksStandaloneFromESD.py b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/share/SiSPSeededTracksStandaloneFromESD.py index a7503299a0a444b8c08b6ac90dde0fb5e5feb2e8..aa539246a6de766792890951d626971dda797c03 100644 --- a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/share/SiSPSeededTracksStandaloneFromESD.py +++ b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/share/SiSPSeededTracksStandaloneFromESD.py @@ -265,15 +265,6 @@ if doPixel: from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelDCSCondStatusAlg condSeq += PixelDCSCondStatusAlg(name="PixelDCSCondStatusAlg") - if athenaCommonFlags.isOnline(): - if not conddb.folderRequested("/TDAQ/Resources/ATLAS/PIXEL/Modules"): - conddb.addFolder("TDAQ_ONL", "/TDAQ/Resources/ATLAS/PIXEL/Modules", className="CondAttrListCollection") - - if not hasattr(condSeq, "PixelTDAQCondAlg"): - from PixelConditionsAlgorithms.PixelConditionsAlgorithmsConf import PixelTDAQCondAlg - condSeq += PixelTDAQCondAlg(name="PixelTDAQCondAlg", - ReadKey = '') - ##################### # Calibration Setup # ##################### diff --git a/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/CMakeLists.txt b/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/CMakeLists.txt index 9ee4da02b0b0ba00bea46afcb7bc627f86c357d2..379c054622f3047267db22de9715e8c6b0293bce 100644 --- a/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/CMakeLists.txt +++ b/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/CMakeLists.txt @@ -20,13 +20,15 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetRecEvent/InDetRIO_OnTrack InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData Tracking/TrkEvent/TrkEventPrimitives - Tracking/TrkEvent/TrkPseudoMeasurementOnTrack ) + Tracking/TrkEvent/TrkPseudoMeasurementOnTrack + Tracking/TrkEvent/TrkCaloClusterROI + DetectorDescription/RoiDescriptor ) # Component(s) in the package: atlas_add_component( TRT_SeededTrackFinder src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetRecToolInterfaces TrkSegment TrkTrack TrkExInterfaces TrkFitterInterfaces InDetRIO_OnTrack SiSPSeededTrackFinderData TrkEventPrimitives TrkPseudoMeasurementOnTrack TrkEventUtils BeamSpotConditionsData ) + LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetRecToolInterfaces TrkSegment TrkTrack TrkExInterfaces TrkFitterInterfaces InDetRIO_OnTrack SiSPSeededTrackFinderData TrkEventPrimitives TrkPseudoMeasurementOnTrack TrkEventUtils BeamSpotConditionsData RoiDescriptor TrkCaloClusterROI) # Install files from the package: atlas_install_headers( TRT_SeededTrackFinder ) diff --git a/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/TRT_SeededTrackFinder/TRT_SeededTrackFinder.h b/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/TRT_SeededTrackFinder/TRT_SeededTrackFinder.h index 073e6bf096cdadaf9b63f9cf1fb51dba29e513e9..2552d86910f7053cda6c80f758f0f8f7d0f04266 100755 --- a/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/TRT_SeededTrackFinder/TRT_SeededTrackFinder.h +++ b/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/TRT_SeededTrackFinder/TRT_SeededTrackFinder.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,6 +39,9 @@ #include "CxxUtils/checker_macros.h" +#include "IRegionSelector/IRegSelTool.h" +#include "TrkCaloClusterROI/CaloClusterROI_Collection.h" + class MsgStream; namespace InDet { @@ -79,7 +82,7 @@ namespace InDet { protected: StatusCode execute_r (const EventContext& ctx) const; - + /////////////////////////////////////////////////////////////////// /* Protected data */ /////////////////////////////////////////////////////////////////// @@ -117,6 +120,16 @@ namespace InDet { double m_maxRPhiImp; //!< maximal RPhi impact parameter cut double m_maxZImp; //!< maximal z impact parameter cut + bool m_caloSeededRoI; + SG::ReadHandleKey<CaloClusterROI_Collection> m_caloKey + {this, "InputClusterContainerName", "InDetCaloClusterROIs", "Location of the optional Calo cluster seeds."}; + + ToolHandle<IRegSelTool> m_regionSelector{ this, "RegSelTool", "RegSelTool/RegSel_SCT", "Region selector service instance" }; + + float m_clusterEt; //!< min Et of CaloCluster for ROISeeding + float m_deltaEta; //!< delta Eta used for RoI creation + float m_deltaPhi; //!< delta Phi used for RoI creation + float m_deltaZ; //!< delta Z used for RoI creation /** Global Counters for final algorithm statistics */ struct Stat_t { enum ECounter { diff --git a/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/src/TRT_SeededTrackFinder.cxx b/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/src/TRT_SeededTrackFinder.cxx index f2f020033a2eb2859209b3b8d37229919fc8a087..682673ad4fb6c006283386a662f0588ad005d488 100644 --- a/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/src/TRT_SeededTrackFinder.cxx +++ b/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/src/TRT_SeededTrackFinder.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,6 +25,9 @@ #include "TrkEventPrimitives/FitQualityOnSurface.h" #include "TrkEventPrimitives/FitQuality.h" +#include "TrkCaloClusterROI/CaloClusterROI_Collection.h" +#include "RoiDescriptor/RoiDescriptor.h" + #include <memory> using namespace std; @@ -63,11 +66,16 @@ InDet::TRT_SeededTrackFinder::TRT_SeededTrackFinder declareProperty("MinTRTonly" ,m_minTRTonly = 15); //Minimum Number of Hits on TRT only // --- selection cuts after SI extension declareProperty("SiExtensionCuts", m_SiExtensionCuts = false); - declareProperty("minPt", m_minPt = 500.); - declareProperty("maxEta", m_maxEta = 2.7); - declareProperty("maxRPhiImp", m_maxRPhiImp = 10.); - declareProperty("maxZImp", m_maxZImp = 250.); - declareProperty("Extrapolator", m_extrapolator); + declareProperty("minPt" ,m_minPt = 500. ); + declareProperty("maxEta" ,m_maxEta = 2.7 ); + declareProperty("maxRPhiImp" ,m_maxRPhiImp = 10. ); + declareProperty("maxZImp" ,m_maxZImp = 250. ); + declareProperty("Extrapolator" ,m_extrapolator ); + declareProperty("CaloSeededRoI" ,m_caloSeededRoI=false ); + declareProperty("CaloClusterEt" ,m_clusterEt=3000. ); + declareProperty("dEtaCaloRoI" ,m_deltaEta=0.1 ); + declareProperty("dPhiCaloRoI" ,m_deltaPhi=0.25 ); + declareProperty("dZCaloRoI" ,m_deltaZ=300 ); } /////////////////////////////////////////////////////////////////// @@ -79,7 +87,7 @@ StatusCode InDet::TRT_SeededTrackFinder::initialize() StatusCode sc; msg(MSG::DEBUG) << "Initializing TRT_SeededTrackFinder" << endmsg; - + //Get the TRT seeded track maker tool // ATH_CHECK(m_trackmaker.retrieve()); @@ -103,6 +111,13 @@ StatusCode InDet::TRT_SeededTrackFinder::initialize() ATH_CHECK( m_SegmentsKey.initialize()) ; /** TRT segments to use */ ATH_CHECK( m_outTracksKey.initialize()); + if(m_caloSeededRoI){ + ATH_CHECK( m_regionSelector.retrieve()); + ATH_CHECK( m_caloKey.initialize(m_caloSeededRoI) ); + } else { + m_regionSelector.disable(); + } + // Get output print level // if(msgLvl(MSG::DEBUG)) { @@ -172,8 +187,43 @@ StatusCode InDet::TRT_SeededTrackFinder::execute_r (const EventContext& ctx) con // Event dependent data of SiCombinatorialTrackFinder_xk InDet::ExtendedSiCombinatorialTrackFinderData_xk combinatorialData(m_prdToTrackMap); - // Initialize the TRT seeded track tool's new event - std::unique_ptr<InDet::ITRT_SeededTrackFinder::IEventData> event_data_p( m_trackmaker->newEvent(ctx, combinatorialData)); + std::unique_ptr<InDet::ITRT_SeededTrackFinder::IEventData> event_data_p; + + if(m_caloSeededRoI ) { + SG::ReadHandle calo(m_caloKey,ctx); + std::unique_ptr<RoiDescriptor> roiComp = std::make_unique<RoiDescriptor>(true); + + if (calo.isValid()) { + RoiDescriptor * roi =0; + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx }; + double beamZ = beamSpotHandle->beamVtx().position().z(); + roiComp->clear(); + roiComp->setComposite(); + for (const Trk::CaloClusterROI *c: *calo) { + if ( c->energy()/cosh(c->globalPosition().eta()) < m_clusterEt) { + continue; + } + + double eta = c->globalPosition().eta(); + double phi = c->globalPosition().phi(); + double roiPhiMin = phi -m_deltaPhi; + double roiPhiMax = phi +m_deltaPhi; + double roiEtaMin = eta -m_deltaEta; + double roiEtaMax = eta +m_deltaEta; + double roiZMin = beamZ -m_deltaZ; + double roiZMax = beamZ +m_deltaZ; + roi = new RoiDescriptor( eta, roiEtaMin, roiEtaMax,phi, roiPhiMin ,roiPhiMax, beamZ, roiZMin,roiZMax); + roiComp->push_back(roi); + } + } + std::vector<IdentifierHash> listOfSCTIds; + std::vector<IdentifierHash> listOfPixIds; + m_regionSelector->HashIDList(*roiComp, listOfSCTIds ); + event_data_p = m_trackmaker->newRegion(ctx, combinatorialData, listOfPixIds, listOfSCTIds); + } else { + event_data_p = m_trackmaker->newEvent(ctx, combinatorialData); + } + std::unique_ptr<InDet::ITRT_TrackExtensionTool::IEventData> ext_event_data_p( m_trtExtension->newEvent(ctx) ); // TrackCollection* outTracks = new TrackCollection; //Tracks to be finally output diff --git a/InnerDetector/InDetRecAlgs/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder.h b/InnerDetector/InDetRecAlgs/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder.h index ce378e6f6d0c12b61e2c4b3e42b084206b582623..28a192bd9645def4a32d0e9531ca4413660ea7c6 100755 --- a/InnerDetector/InDetRecAlgs/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder.h +++ b/InnerDetector/InDetRecAlgs/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder/TRT_TrackSegmentsFinder.h @@ -43,14 +43,18 @@ namespace InDet { MsgStream& dumptools(MsgStream& out) const; MsgStream& dumpevent(MsgStream& out, int nsegments) const; + /// @name Flags to configure SiSPSeededTrackFinder + //@{ + BooleanProperty m_useZvertexTool{this, "useZvertexTool", true}; + Gaudi::Property<bool> m_useCaloSeeds {this, "useCaloSeeds", false, "Use calo seeds to find TRT segments"}; Gaudi::Property<int> m_minNumberDCs - {this, "MinNumberDriftCircles", 9, "Minimum number of DriftCircles for a TRT segment."}; + {this, "MinNumberDriftCircles", 15, "Minimum number of DriftCircles for a TRT segment."}; Gaudi::Property<double> m_ClusterEt - {this, "CaloClusterEt", 4500.0, "Minimum ET of calo clusters in MeV too seed the TRT segment finder."}; + {this, "CaloClusterEt", 6000.0, "Minimum ET of calo clusters in MeV too seed the TRT segment finder."}; SG::ReadHandleKey<CaloClusterROI_Collection> m_caloKey {this, "InputClusterContainerName", "InDetCaloClusterROIs", "Location of the optional Calo cluster seeds."}; diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/PixelClusterOnTrack.h b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/PixelClusterOnTrack.h index 0ec4be4743d5409574b98fc72490f794221fbdfc..2a8711828e49921c7c994c6ff71c6d5bb32318cb 100755 --- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/PixelClusterOnTrack.h +++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/PixelClusterOnTrack.h @@ -60,36 +60,39 @@ namespace InDet { /** Constructor with parameters : RIO/PrepRawData pointer, LocalPosition&, LocalErrorMatrix&, idDE& Everything else is owned elsewhere. */ - PixelClusterOnTrack( const PixelCluster* RIO, - const Trk::LocalParameters& locpars, - const Amg::MatrixX& locerr, - const IdentifierHash& idDE, - bool hasAmbiguity=false, - // this parameter is ignored, - // information taken from RIO - // Just kept not to break the interface to - // already existing code. - bool isbroad=false - ); + PixelClusterOnTrack(const PixelCluster* RIO, + const Trk::LocalParameters& locpars, + const Amg::MatrixX& locerr, + const IdentifierHash& idDE, + bool hasAmbiguity = false, + // this parameter is ignored, + // information taken from RIO + // Just kept not to break the interface to + // already existing code. + bool isbroad = false); - /** Constructor with parameters : RIO/PrepRawData pointer, LocalPosition&, LocalErrorMatrix&, idDE&, Global Position. Everything else is owned elsewhere. */ - PixelClusterOnTrack( const PixelCluster* RIO, - const Trk::LocalParameters& locpars, - const Amg::MatrixX& locerr, - const IdentifierHash& idDE, - const Amg::Vector3D& globalPosition, - bool hasAmbiguity=false, - // this parameter is ignored, - // information taken from RIO - // Just kept not to break the interface to - // already existing code. - bool isbroad=false - ); - + PixelClusterOnTrack(const PixelCluster* RIO, + const Trk::LocalParameters& locpars, + const Amg::MatrixX& locerr, + const IdentifierHash& idDE, + const Amg::Vector3D& globalPosition, + bool hasAmbiguity = false, + // this parameter is ignored, + // information taken from RIO + // Just kept not to break the interface to + // already existing code. + bool isbroad = false); + + /* + * Constuctor used by P->T converter. + * The P->T converter calls + * setValues method to complete the object. + * e.g set/reset the DetectorElement + */ PixelClusterOnTrack( const ElementLinkToIDCPixelClusterContainer& RIO, const Trk::LocalParameters& locpars, const Amg::MatrixX& locerr, @@ -149,6 +152,7 @@ namespace InDet { private: friend class PixelClusterOnTrackCnv_p1; friend class ::FakeTrackBuilder; + /** 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) override; diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/SCT_ClusterOnTrack.h b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/SCT_ClusterOnTrack.h index 4952e71948ff0e383e29c71c5c6f74b8d68f1911..29209b4199dcbb0d690395d510df37471a8df22c 100755 --- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/SCT_ClusterOnTrack.h +++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/SCT_ClusterOnTrack.h @@ -92,7 +92,13 @@ namespace InDet{ const IdentifierHash& idDE, const Amg::Vector3D& globalPosition, bool isbroad=false); - + + /* + * Constuctor used by P->T converter. + * The P->T converter calls the + * setValues method to complete the object + * e.g set/reset the DetectorElement + */ SCT_ClusterOnTrack( const ElementLinkToIDCSCT_ClusterContainer& RIO, const Trk::LocalParameters& locpars, const Amg::MatrixX& locerr, diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h index d3912e4bd63c4548646405e86308b69c2643eef0..e84917187f49cd7cd4b3e6dd359708ebc9cedb82 100755 --- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h +++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h @@ -76,9 +76,13 @@ namespace InDet{ const Amg::Vector3D& predictedTrackDirection, const Trk::DriftCircleStatus status); + + /** + * Constructor used by the TP converters + */ TRT_DriftCircleOnTrack( const ElementLinkToIDCTRT_DriftCircleContainer& RIO, const Trk::LocalParameters& driftRadius, - const Amg::MatrixX& errDriftRadius, + const Amg::MatrixX& errDriftRadius, IdentifierHash idDE, const Identifier& id, double predictedLocZ, @@ -86,7 +90,7 @@ namespace InDet{ const Trk::DriftCircleStatus status, bool highLevel, double timeOverThreshold); - + /**Destructor */ virtual ~TRT_DriftCircleOnTrack(); @@ -154,17 +158,19 @@ namespace InDet{ float localAngle() const; float positionAlongWire() const; + 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) override; - /** @brief Uses the passed loc3Dframe to calculate and set the global coord of this hit. - The detector element surface is used*/ - void setGlobalPosition(Amg::Vector3D& loc3Dframe) const; + /** @calculate and set the global coord of this hit. + The detector element surface is used. Can be used from the convertor + after setValues if the element is constructed without a detEl*/ + void setGlobalPositionHelper(); /** global position to be cached */ - CxxUtils::CachedUniquePtr<const Amg::Vector3D> m_globalPosition; + Amg::Vector3D m_globalPosition; /**local angle to be written out */ float m_localAngle; @@ -192,17 +198,22 @@ namespace InDet{ }; - inline TRT_DriftCircleOnTrack* TRT_DriftCircleOnTrack::clone() const + inline TRT_DriftCircleOnTrack* + TRT_DriftCircleOnTrack::clone() const { return new TRT_DriftCircleOnTrack(*this); } - - inline const TRT_DriftCircle* TRT_DriftCircleOnTrack::prepRawData() const + + inline const TRT_DriftCircle* + TRT_DriftCircleOnTrack::prepRawData() const { - // somehow one has to ask first if it is valid ... otherwise it always returns 0 ... - if (m_rio.isValid()) return m_rio.cachedElement(); - else return 0; - } + // ask first if it is valid ... + // otherwise it always returns nullptr ... + if (m_rio.isValid()) { + return m_rio.cachedElement(); + } + return nullptr; + } inline const ElementLinkToIDCTRT_DriftCircleContainer& diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/PixelClusterOnTrack.cxx b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/PixelClusterOnTrack.cxx index 567c65026556c16c20126bce06bdbd7a604539e2..564c1cff51128ff1628486904bbc0f62e2113347 100755 --- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/PixelClusterOnTrack.cxx +++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/PixelClusterOnTrack.cxx @@ -15,47 +15,49 @@ // Constructor with parameters - no global position specified InDet::PixelClusterOnTrack::PixelClusterOnTrack( - const InDet::PixelCluster* RIO, - const Trk::LocalParameters& locpars, - const Amg::MatrixX& locerr, + const InDet::PixelCluster* RIO, + const Trk::LocalParameters& locpars, + const Amg::MatrixX& locerr, const IdentifierHash& idDE, bool, - bool isbroad - ) - : - InDet::SiClusterOnTrack(locpars, locerr, idDE, RIO->identify(),isbroad), //call base class constructor - m_hasClusterAmbiguity(RIO->isAmbiguous()), - m_isFake(RIO->isFake()), - m_energyLoss(RIO->energyLoss()), - m_detEl( RIO->detectorElement() ) + bool isbroad) + : // call base class constructor + InDet::SiClusterOnTrack(locpars, locerr, idDE, RIO->identify(), isbroad) + , m_hasClusterAmbiguity(RIO->isAmbiguous()) + , m_isFake(RIO->isFake()) + , m_energyLoss(RIO->energyLoss()) + , m_detEl(RIO->detectorElement()) { m_rio.setElement(RIO); - // Set global position m_globalPosition = associatedSurface().localToGlobalPos(localParameters()); } // Constructor with parameters InDet::PixelClusterOnTrack::PixelClusterOnTrack( - const InDet::PixelCluster* RIO, - const Trk::LocalParameters& locpars, - const Amg::MatrixX& locerr, - const IdentifierHash& idDE, - const Amg::Vector3D& globalPosition, - bool, - bool isbroad - ) - : - InDet::SiClusterOnTrack(locpars, locerr, idDE, RIO->identify(), globalPosition, isbroad), //call base class constructor - m_hasClusterAmbiguity(RIO->isAmbiguous()), - m_isFake(RIO->isFake()), - m_energyLoss(RIO->energyLoss()), - m_detEl( RIO->detectorElement() ) + const InDet::PixelCluster* RIO, + const Trk::LocalParameters& locpars, + const Amg::MatrixX& locerr, + const IdentifierHash& idDE, + const Amg::Vector3D& globalPosition, + bool, + bool isbroad) + : // call base class constructor + InDet::SiClusterOnTrack(locpars, + locerr, + idDE, + RIO->identify(), + globalPosition, + isbroad) + , m_hasClusterAmbiguity(RIO->isAmbiguous()) + , m_isFake(RIO->isFake()) + , m_energyLoss(RIO->energyLoss()) + , m_detEl(RIO->detectorElement()) { m_rio.setElement(RIO); } - +//P->T constructor InDet::PixelClusterOnTrack::PixelClusterOnTrack ( const ElementLinkToIDCPixelClusterContainer& RIO, const Trk::LocalParameters& locpars, @@ -71,10 +73,10 @@ InDet::PixelClusterOnTrack::PixelClusterOnTrack m_hasClusterAmbiguity (hasClusterAmbiguity), m_isFake (isFake), m_energyLoss (energyLoss), - m_detEl ((*RIO)->detectorElement()) + m_detEl (nullptr) { - // Set global position - m_globalPosition = associatedSurface().localToGlobalPos(localParameters()); + // The setting of the global position + // happens via the setValues method } @@ -103,7 +105,12 @@ const Trk::Surface& InDet::PixelClusterOnTrack::associatedSurface() const void InDet::PixelClusterOnTrack::setValues(const Trk::TrkDetElementBase* detEl, const Trk::PrepRawData* /*prd*/) { + //set detector element m_detEl = dynamic_cast< const InDetDD::SiDetectorElement* >(detEl); + if(m_detEl){ + //Then set global potition based on it + m_globalPosition = associatedSurface().localToGlobalPos(localParameters()); + } } diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/SCT_ClusterOnTrack.cxx b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/SCT_ClusterOnTrack.cxx index d534d01251a2ec6262381053e0bde2f84ac5e626..686b4fc4970bbaa944d9aca9787d781ee420d612 100755 --- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/SCT_ClusterOnTrack.cxx +++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/SCT_ClusterOnTrack.cxx @@ -65,12 +65,9 @@ InDet::SCT_ClusterOnTrack::SCT_ClusterOnTrack( const ElementLinkToIDCSCT_Cluster id, isbroad), m_rio(RIO), - m_detEl((*RIO)->detectorElement()), + m_detEl(nullptr), m_positionAlongStrip (positionAlongStrip) { - // Set global position - Amg::Vector2D lpos(localParameters().get(Trk::locX), m_positionAlongStrip); - m_globalPosition = detectorElement()->surface(identify()).localToGlobalPos(lpos); } @@ -91,8 +88,15 @@ const Trk::Surface& InDet::SCT_ClusterOnTrack::associatedSurface() const void InDet::SCT_ClusterOnTrack::setValues(const Trk::TrkDetElementBase* detEl, const Trk::PrepRawData* ) { m_detEl = dynamic_cast< const InDetDD::SiDetectorElement* >(detEl); + if (m_detEl) { + // Set global position after setting the detector element + Amg::Vector2D lpos(localParameters().get(Trk::locX), + m_positionAlongStrip); + m_globalPosition = + detectorElement()->surface(identify()).localToGlobalPos(lpos); + } } - + MsgStream& InDet::SCT_ClusterOnTrack::dump( MsgStream& sl ) const { SiClusterOnTrack::dump(sl);// use dump(...) from SiClusterOnTrack diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/TRT_DriftCircleOnTrack.cxx b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/TRT_DriftCircleOnTrack.cxx index 1c1cb9b16892d96ced0c303ab6e584f376da420f..52548493e8a2ac56229a33591982eb86f831f1ee 100755 --- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/TRT_DriftCircleOnTrack.cxx +++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/src/TRT_DriftCircleOnTrack.cxx @@ -23,38 +23,71 @@ #include <utility> // Constructor with parameters: -InDet::TRT_DriftCircleOnTrack::TRT_DriftCircleOnTrack( - const InDet::TRT_DriftCircle* RIO, - const Trk::LocalParameters& driftRadius, - const Amg::MatrixX& errDriftRadius, - const IdentifierHash& idDE, - double predictedLocZ, - const Amg::Vector3D& predictedTrackDirection, - const Trk::DriftCircleStatus status) - : - Trk::RIO_OnTrack(driftRadius, errDriftRadius, RIO->identify()), //call base class constructor - m_globalPosition{}, - m_positionAlongWire(predictedLocZ), - m_idDE(idDE), - m_status(status), - m_highLevel(RIO->highLevel()), - m_timeOverThreshold(RIO->timeOverThreshold()), - m_detEl( RIO->detectorElement() ) +InDet::TRT_DriftCircleOnTrack::TRT_DriftCircleOnTrack( + const InDet::TRT_DriftCircle* RIO, + const Trk::LocalParameters& driftRadius, + const Amg::MatrixX& errDriftRadius, + const IdentifierHash& idDE, + double predictedLocZ, + const Amg::Vector3D& predictedTrackDirection, + const Trk::DriftCircleStatus status) + // call base class constructor + : Trk::RIO_OnTrack(driftRadius, errDriftRadius, RIO->identify()) + , m_globalPosition{} + , m_positionAlongWire(predictedLocZ) + , m_idDE(idDE) + , m_status(status) + , m_highLevel(RIO->highLevel()) + , m_timeOverThreshold(RIO->timeOverThreshold()) + , m_detEl(RIO->detectorElement()) { + m_rio.setElement(RIO); - if (m_detEl->surface(RIO->identify()).type()==Trk::Surface::Line){ - const Trk::StraightLineSurface& slsf =static_cast<const Trk::StraightLineSurface&>((m_detEl->surface(RIO->identify()))); - m_globalPosition.store(std::unique_ptr<const Amg::Vector3D>(slsf.localToGlobal(driftRadius, predictedTrackDirection, predictedLocZ))); - } + + const Trk::Surface& detElSurf= m_detEl->surface(RIO->identify()); + if (detElSurf.type() == Trk::Surface::Line) { + + const Trk::StraightLineSurface& slsf = + static_cast<const Trk::StraightLineSurface&>(detElSurf); + + m_globalPosition = + slsf.localToGlobalPos(driftRadius, predictedTrackDirection, predictedLocZ); + } Amg::Vector3D loc_gDirection = predictedTrackDirection; const double dr = driftRadius[Trk::driftRadius]; + //scaling the direction with drift radius - if(dr !=0.){ - m_localAngle = atan2(loc_gDirection.y(),loc_gDirection.x()); - } else m_localAngle = 0.; - + if(dr !=0.){ + m_localAngle = std::atan2(loc_gDirection.y(), loc_gDirection.x()); + } else { + m_localAngle = 0.; + } } +//Constructor used by the converter +InDet::TRT_DriftCircleOnTrack::TRT_DriftCircleOnTrack( + const ElementLinkToIDCTRT_DriftCircleContainer& RIO, + const Trk::LocalParameters& driftRadius, + const Amg::MatrixX& errDriftRadius, + IdentifierHash idDE, + const Identifier& id, + double predictedLocZ, + float localAngle, + const Trk::DriftCircleStatus status, + bool highLevel, + double timeOverThreshold) + : Trk::RIO_OnTrack(driftRadius, errDriftRadius, id) + , m_globalPosition{} + , m_localAngle(localAngle) + , m_positionAlongWire(predictedLocZ) + , m_rio(RIO) + , m_idDE(idDE) + , m_status(status) + , m_highLevel(highLevel) + , m_timeOverThreshold(timeOverThreshold) + , m_detEl(nullptr) +{} + // Destructor: InDet::TRT_DriftCircleOnTrack::~TRT_DriftCircleOnTrack() {} @@ -71,37 +104,13 @@ InDet::TRT_DriftCircleOnTrack::TRT_DriftCircleOnTrack() m_status(Trk::UNDECIDED), m_highLevel(false), m_timeOverThreshold(0.), - m_detEl(0) + m_detEl(nullptr) {} -InDet::TRT_DriftCircleOnTrack::TRT_DriftCircleOnTrack - ( const ElementLinkToIDCTRT_DriftCircleContainer& RIO, - const Trk::LocalParameters& driftRadius, - const Amg::MatrixX& errDriftRadius, - IdentifierHash idDE, - const Identifier& id, - double predictedLocZ, - float localAngle, - const Trk::DriftCircleStatus status, - bool highLevel, - double timeOverThreshold) - : Trk::RIO_OnTrack (driftRadius, errDriftRadius, id), - m_globalPosition{}, - m_localAngle(localAngle), - m_positionAlongWire(predictedLocZ), - m_rio(RIO), - m_idDE(idDE), - m_status(status), - m_highLevel(highLevel), - m_timeOverThreshold(timeOverThreshold), - m_detEl( nullptr) -{ -} - //copy constructor: InDet::TRT_DriftCircleOnTrack::TRT_DriftCircleOnTrack( const InDet::TRT_DriftCircleOnTrack& rot): Trk::RIO_OnTrack(rot), - m_globalPosition{}, + m_globalPosition(rot.m_globalPosition), m_localAngle(rot.m_localAngle), m_positionAlongWire(rot.m_positionAlongWire), m_rio(rot.m_rio), @@ -111,9 +120,6 @@ InDet::TRT_DriftCircleOnTrack::TRT_DriftCircleOnTrack( const InDet::TRT_DriftCir m_timeOverThreshold(rot.m_timeOverThreshold), m_detEl(rot.m_detEl) { - if (rot.m_globalPosition) { - m_globalPosition.store(std::make_unique<const Amg::Vector3D>(*(rot.m_globalPosition))); - } } //assignment operator: @@ -121,11 +127,7 @@ InDet::TRT_DriftCircleOnTrack& InDet::TRT_DriftCircleOnTrack::operator=( const I { if ( &rot != this) { Trk::RIO_OnTrack::operator= (rot); - if (rot.m_globalPosition) { - m_globalPosition.store(std::make_unique<const Amg::Vector3D>(*(rot.m_globalPosition))); - } else if (m_globalPosition) { - m_globalPosition.release().reset(); - } + m_globalPosition = rot.m_globalPosition; m_rio = rot.m_rio; m_localAngle = rot.m_localAngle; m_positionAlongWire = rot.m_positionAlongWire; @@ -168,59 +170,57 @@ const Trk::Surface& InDet::TRT_DriftCircleOnTrack::associatedSurface() const assert(0!=m_detEl); return (m_detEl->surface(identify())); } - -void InDet::TRT_DriftCircleOnTrack::setGlobalPosition(Amg::Vector3D& loc3Dframe) const{ - const Trk::StraightLineSurface* slsf = dynamic_cast<const Trk::StraightLineSurface*>( &(associatedSurface()) ); - if(slsf) { - m_globalPosition.set(std::make_unique<Amg::Vector3D>(slsf->transform() * loc3Dframe)); - }else{ - throw GaudiException("Dynamic_cast to StraightLineSurface failed!", - "TRT_DriftCircleOnTrack::setGlobalPosition()", - StatusCode::FAILURE); - } -} - -void InDet::TRT_DriftCircleOnTrack::setValues(const Trk::TrkDetElementBase* detEl, const Trk::PrepRawData*) -{ - m_detEl = dynamic_cast<const InDetDD::TRT_BaseElement* >(detEl); -} const Amg::Vector3D& InDet::TRT_DriftCircleOnTrack::globalPosition() const { - if (not m_globalPosition) - { - - if (side()==Trk::NONE) - { - //local position - Amg::Vector3D loc3Dframe(0., 0., m_positionAlongWire); + return m_globalPosition; +} - //transfrom to global - setGlobalPosition(loc3Dframe); - }else{ - - // get global position where track and drift radius intersect. - double Sf,Cf; sincos(m_localAngle,&Sf,&Cf); - double x = localParameters()[Trk::driftRadius]*Sf; - double y = localParameters()[Trk::driftRadius]*Cf; - /* - double x = localParameters()[Trk::driftRadius]*std::sin(m_localAngle); - double y = localParameters()[Trk::driftRadius]*std::cos(m_localAngle); - */ - //get local position - Amg::Vector3D loc3Dframe(x, y, m_positionAlongWire); - //transform to global - setGlobalPosition(loc3Dframe); - }//end of checking the side information availability - - }//end of checking whether the global position is there +//Global Position Helper for the converter +void +InDet::TRT_DriftCircleOnTrack::setGlobalPositionHelper() +{ - //returning the result (now stored in private datamember) - return (*m_globalPosition); - } + //default + Amg::Vector3D loc3Dframe(0., 0., m_positionAlongWire); + if (side() != Trk::NONE) { + // get global position where track and drift radius intersect. + double Sf, Cf; + sincos(m_localAngle, &Sf, &Cf); + double x = localParameters()[Trk::driftRadius] * Sf; + double y = localParameters()[Trk::driftRadius] * Cf; + /* + double x = localParameters()[Trk::driftRadius]*std::sin(m_localAngle); + double y = localParameters()[Trk::driftRadius]*std::cos(m_localAngle); + */ + // get local position + loc3Dframe = Amg::Vector3D(x, y, m_positionAlongWire); + } + //We need a surface for the global position + const Trk::StraightLineSurface* slsf = + dynamic_cast<const Trk::StraightLineSurface*>(&(associatedSurface())); + if (slsf) { + m_globalPosition = Amg::Vector3D(slsf->transform() * loc3Dframe); + } else { + throw GaudiException("Dynamic_cast to StraightLineSurface failed!", + "TRT_DriftCircleOnTrack::setGlobalPosition()", + StatusCode::FAILURE); + } +} +//set Values to be used by the converter +void +InDet::TRT_DriftCircleOnTrack::setValues(const Trk::TrkDetElementBase* detEl, + const Trk::PrepRawData*) +{ + m_detEl = dynamic_cast<const InDetDD::TRT_BaseElement* >(detEl); + // If we have a m_detEL we can set the global position + if (m_detEl) { + setGlobalPositionHelper(); + } +} MsgStream& InDet::TRT_DriftCircleOnTrack::dump( MsgStream& sl ) const { @@ -244,14 +244,9 @@ std::ostream& InDet::TRT_DriftCircleOnTrack::dump( std::ostream& sl ) const sl << "Global position (x,y,z) = ("; this->globalPosition(); - if (m_globalPosition) - { - sl <<this->globalPosition().x()<<", " - <<this->globalPosition().y()<<", " - <<this->globalPosition().z()<<")"<<std::endl; - } else { - sl<<"NULL!), "<<std::endl; - } + sl <<this->globalPosition().x()<<", " + <<this->globalPosition().y()<<", " + <<this->globalPosition().z()<<")"<<std::endl; sl << "\t time-over-threshold = " << timeOverThreshold() << (highLevel() ? " with TR flag ON":" with TR flag OFF")<<std::endl; @@ -259,7 +254,3 @@ std::ostream& InDet::TRT_DriftCircleOnTrack::dump( std::ostream& sl ) const return sl; } - - - - diff --git a/InnerDetector/InDetRecTools/InDetCaloClusterROIBuilder/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetCaloClusterROIBuilder/CMakeLists.txt index 38c1dc7a1923f91c86a0902743eb30743166d5f7..e753837804c1987856511566c2a5ff3a9c14dd12 100644 --- a/InnerDetector/InDetRecTools/InDetCaloClusterROIBuilder/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetCaloClusterROIBuilder/CMakeLists.txt @@ -22,4 +22,4 @@ atlas_depends_on_subdirs( PRIVATE atlas_add_component( InDetCaloClusterROIBuilder src/*.cxx src/components/*.cxx - LINK_LIBRARIES CaloDetDescrLib AthenaBaseComps xAODCaloEvent xAODEgamma GaudiKernel InDetRecToolInterfaces TrkSurfaces TrkCaloClusterROI TrkEventPrimitives ) + LINK_LIBRARIES CaloDetDescrLib AthenaBaseComps xAODCaloEvent xAODEgamma GaudiKernel InDetRecToolInterfaces TrkSurfaces TrkCaloClusterROI TrkEventPrimitives CaloTrackingGeometryLib ) diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetConversionFinderTools/CMakeLists.txt index 9c1914d4fbcc86fadafb4336a06b2ef2a41c78a8..ddab67665eaa12b80d99632f3d1a99b2d4f95339 100644 --- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/CMakeLists.txt @@ -39,7 +39,7 @@ atlas_add_library( InDetConversionFinderToolsLib PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES AthenaBaseComps xAODTracking GaudiKernel InDetRecToolInterfaces Particle TrkEventPrimitives TrkParameters TrkParticleBase TrkTrack - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthLinks InDetPrepRawData TrkSurfaces TrkMeasurementBase TrkRIO_OnTrack VxVertex TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces ) + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthLinks InDetPrepRawData TrkSurfaces TrkMeasurementBase TrkRIO_OnTrack VxVertex TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces TrkVertexSeedFinderUtilsLib ) atlas_add_component( InDetConversionFinderTools src/components/*.cxx diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/CMakeLists.txt index 9a9b42d71575bb377d5c6fc6405bd687c4389b2f..dee5f008ae5ca86d70aa85c20888031499bc04ec 100644 --- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/CMakeLists.txt @@ -26,7 +26,7 @@ atlas_depends_on_subdirs( PUBLIC atlas_add_component( InDetMultipleVertexSeedFinder src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetRecToolInterfaces EventPrimitives xAODTracking InDetMultipleVertexSeedFinderUtilsLib TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces ) + LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetRecToolInterfaces EventPrimitives xAODTracking InDetMultipleVertexSeedFinderUtilsLib TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces InDetBeamSpotServiceLib ) # Install files from the package: atlas_install_headers( InDetMultipleVertexSeedFinder ) diff --git a/InnerDetector/InDetRecTools/InDetTestPixelLayer/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetTestPixelLayer/CMakeLists.txt index 7ec5a4f22aef62ad0fa00e604c42c9c22b106a02..46ccec0d5ed51177b09fb3974b66e1416804b72c 100644 --- a/InnerDetector/InDetRecTools/InDetTestPixelLayer/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetTestPixelLayer/CMakeLists.txt @@ -43,7 +43,7 @@ atlas_add_library( InDetTestPixelLayerLib src/*.cxx PUBLIC_HEADERS InDetTestPixelLayer INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier GaudiKernel InDetIdentifier InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkToolInterfaces + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier GaudiKernel InDetIdentifier InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkToolInterfaces InDetConditionsSummaryService PRIVATE_LINK_LIBRARIES AtlasDetDescr IdDictDetDescr InDetReadoutGeometry PixelReadoutGeometry TrkGeometry TrkSurfaces TrkMeasurementBase TrkParticleBase TrkTrack TrkTrackSummary TrkExInterfaces ) atlas_add_component( InDetTestPixelLayer diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h index 1ca1e733c1223aef76d11ee40ba2ebc3267ee928..a1eccb56f26691e7719001f920faaffd754a1af2 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk.h @@ -148,6 +148,7 @@ namespace InDet{ Trk::MagneticFieldProperties m_fieldprop ; // Magnetic field properties SG::ReadHandleKey<TRT_DriftCircleContainer> m_trtname {this,"TRT_ClustersContainer","TRT_DriftCircles","RHK to retrieve TRT_DriftCircleContainer"}; + double m_minTRTSegmentpT; // Min pT cut required for TRT Segments /////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_Trajectory_xk.h b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_Trajectory_xk.h index 4b26d53d388adb14229c53ecc35dbb49d1b4cb19..de198d294df5c2642112f1f6884b3b2d18edc2b9 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_Trajectory_xk.h +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/TRT_TrackExtensionTool_xk/TRT_Trajectory_xk.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 */ ///////////////////////////////////////////////////////////////////////////////// @@ -70,7 +70,8 @@ namespace InDet{ double, double, double, - double); + double, + double); void set(Trk::MagneticFieldProperties&, const AtlasFieldCacheCondObj*); @@ -172,6 +173,12 @@ namespace InDet{ double m_A; double m_B; + /////////////////////////////////////////////////////////////////// + // min pT cut for TRT Segment trajectory + /////////////////////////////////////////////////////////////////// + + double m_minTRTSegmentpT; //min pT check for initial segment + /////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx index 8023ad3a82e58c87c28b4990116d02b35c7bd6c5..1e5afc0595ad944cda1c4c723efcd64deddf7b68 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionTool_xk.cxx @@ -48,9 +48,7 @@ InDet::TRT_TrackExtensionTool_xk::TRT_TrackExtensionTool_xk m_usedriftrad = true ; m_parameterization= true ; m_scale_error = 2. ; - declareInterface<ITRT_TrackExtensionTool>(this); - declareProperty("RoadTool" ,m_roadtool ); declareProperty("PropagatorTool" ,m_proptool ); declareProperty("UpdatorTool" ,m_updatortool ); @@ -70,6 +68,7 @@ InDet::TRT_TrackExtensionTool_xk::TRT_TrackExtensionTool_xk declareProperty("MagneticFieldMode" ,m_fieldmode ); declareProperty("MinNumberSCTclusters" ,m_minNumberSCT ); declareProperty("MinNumberPIXclusters" ,m_minNumberPIX ); + declareProperty("minTRTSegmentpT" ,m_minTRTSegmentpT=300. ); } /////////////////////////////////////////////////////////////////// @@ -343,7 +342,8 @@ InDet::TRT_TrackExtensionTool_xk::newEvent(const EventContext& ctx) const m_roadwidth, m_zVertexWidth, m_impact, - m_scale_error); + m_scale_error, + m_minTRTSegmentpT); event_data->m_measurement.reserve(200); return std::unique_ptr<InDet::ITRT_TrackExtensionTool::IEventData>(event_data.release()); diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_Trajectory_xk.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_Trajectory_xk.cxx index f1239997a4aa675c3cb9a784b4898ecde32bf171..3ee43719c5d6ccdb3138c38a6ee7175a24ed7652 100755 --- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_Trajectory_xk.cxx +++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_Trajectory_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 */ #include <iostream> @@ -24,7 +24,8 @@ void InDet::TRT_Trajectory_xk::set double roadwidth , double zvertexwidth , double impact , - double scale ) + double scale , + double minTRTSegmentpT ) { m_proptool = pr ; m_updatortool = up ; @@ -33,6 +34,7 @@ void InDet::TRT_Trajectory_xk::set m_impact = fabs(impact ) ; m_scale_error = fabs(scale ) ; for(int i=0; i!=400; ++i) m_elements[i].set(m,pr,up,riod,rion,m_scale_error); + m_minTRTSegmentpT = minTRTSegmentpT ; } void InDet::TRT_Trajectory_xk::set @@ -518,8 +520,7 @@ Trk::TrackSegment* InDet::TRT_Trajectory_xk::convert() { // Test quality of propagation to perigee - // - if(fabs(m_parameters.pT()) < 300.) return 0; + if(fabs(m_parameters.pT()) < m_minTRTSegmentpT) return 0; const Trk::Surface* sur = m_parameters.associatedSurface(); @@ -722,7 +723,7 @@ bool InDet::TRT_Trajectory_xk::fitter() const double trad = .003; double rad = 0. ; - if(!trackParametersEstimationForLastPoint() || fabs(m_parameters.pT()) < 300.) return false; + if(!trackParametersEstimationForLastPoint() || std::abs(m_parameters.pT()) < m_minTRTSegmentpT) return false; double sin2 = 1./sin(m_parameters.par()[3]); sin2*= sin2 ; double P42 = m_parameters.par()[4] ; P42 = P42*P42*134.; diff --git a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/CMakeLists.txt b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/CMakeLists.txt index 76334731565e286d6daad96c3e935bb33ebe2e4c..379cb31edc7aa7a047634d7fae7ba0b82459b641 100644 --- a/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/TRT_TrackHoleSearch/CMakeLists.txt @@ -34,14 +34,19 @@ atlas_depends_on_subdirs( PUBLIC find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint ) +atlas_add_library( TRT_TrackHoleSearchLib + TRT_TrackHoleSearch/*.h + INTERFACE + PUBLIC_HEADERS TRT_TrackHoleSearch + LINK_LIBRARIES GaudiKernel AthenaBaseComps TrkToolInterfaces TrigDecisionInterface TRT_ConditionsServicesLib TrkTrack xAODEventInfo xAODTracking StoreGateLib TrkParameters TrkExInterfaces InDetConditionsSummaryService ) + # Component(s) in the package: atlas_add_component( TRT_TrackHoleSearch src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel TrkParameters TrkToolInterfaces Identifier EventPrimitives xAODEventInfo xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetRIO_OnTrack TrkSurfaces TrkEventPrimitives TrkEventUtils TrkTrack TrkTrackSummary VxVertex TrkExInterfaces ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} TRT_TrackHoleSearchLib Identifier EventPrimitives InDetIdentifier InDetRIO_OnTrack TrkSurfaces TrkEventPrimitives TrkEventUtils TrkTrackSummary VxVertex ) # Install files from the package: -atlas_install_headers( TRT_TrackHoleSearch ) atlas_install_joboptions( share/*.py ) diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysHitDecoratorAlg.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysHitDecoratorAlg.cxx index e95505f585b0b3e10b106dd9441b8ff45be5acee..b32e7a858e3aeb8a41df6537b3b85b131bd759f2 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysHitDecoratorAlg.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysHitDecoratorAlg.cxx @@ -27,9 +27,6 @@ #include <tuple> #include <limits> -// ref: -// ​https://svnweb.cern.ch/trac/atlasoff/browser/Tracking/TrkEvent/TrkParametersBase/trunk/TrkParametersBase/CurvilinearParametersT.h - InDetPhysHitDecoratorAlg::InDetPhysHitDecoratorAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthReentrantAlgorithm(name,pSvcLocator), diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValTruthDecoratorAlg.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValTruthDecoratorAlg.cxx index 678bcdf689dbbc9b9e4e6a7ad61b8ba435c8a3bb..49039874fec26c715d45911426bb50dfb8d67d69 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValTruthDecoratorAlg.cxx +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValTruthDecoratorAlg.cxx @@ -207,7 +207,7 @@ InDetPhysValTruthDecoratorAlg::decorateTruth(const xAOD::TruthParticle& particle /** Email from Andi Salzburger to Shaun Roe ** the correct way is actually to extrapolate it. - So you’d need to retrieve the extrapolator: + So you'd need to retrieve the extrapolator: TooHandle<IExtrapolator> m_extrapolator; -> retrieve it in your code and use the AtlasExtrapolator (which is fully configured, and can be imported in python diff --git a/InnerDetector/InDetValidation/InDetTrackValidation/src/SCT_ClusterValidationNtupleWriter.cxx b/InnerDetector/InDetValidation/InDetTrackValidation/src/SCT_ClusterValidationNtupleWriter.cxx index f4a4c03cfddf93191775ffcd815302785ebe63e8..148e395934e36bb34ce4ecc1c399030b67da2fe4 100755 --- a/InnerDetector/InDetValidation/InDetTrackValidation/src/SCT_ClusterValidationNtupleWriter.cxx +++ b/InnerDetector/InDetValidation/InDetTrackValidation/src/SCT_ClusterValidationNtupleWriter.cxx @@ -569,7 +569,7 @@ StatusCode InDet::SCT_ClusterValidationNtupleWriter::execute() { int eta=0,phi=0,bec=0,layer=0,side=0; m_totalNumErrors += errorSet.size(); - for(const auto idHash : errorSet) { + for(const auto& idHash : errorSet) { Identifier itId = m_sctid->wafer_id(idHash); layer = m_sctid->layer_disk(itId); side = m_sctid->side(itId); diff --git a/InnerDetector/InDetValidation/PixelRTT/src/ResPullValidation.cxx b/InnerDetector/InDetValidation/PixelRTT/src/ResPullValidation.cxx index f3336ebb6b3f89a2543512e18872ad0a06a8b66d..e77b1b47899e1c37f2038c22e453641f864bb44f 100644 --- a/InnerDetector/InDetValidation/PixelRTT/src/ResPullValidation.cxx +++ b/InnerDetector/InDetValidation/PixelRTT/src/ResPullValidation.cxx @@ -146,7 +146,7 @@ int ResPullValidation::Read(){ ////////////////////////////////////////////////////////////////////////////////////////// -int ResPullValidation::Write ATLAS_NOT_THREAD_SAFE (){ // Thread unsafe MultiHisto<ht>::Write method is used. +int ResPullValidation::Write(){ TDirectory *current = gDirectory; TDirectory *globaldir = current->mkdir(m_globaldirname.c_str()); diff --git a/InnerDetector/InDetValidation/PixelRTT/src/TrackValidation.cxx b/InnerDetector/InDetValidation/PixelRTT/src/TrackValidation.cxx index e44c89561b1be43b5f7a784590cb46fbd3a24b75..589120816c6f47a5e96c584288ec917d071ad4a3 100644 --- a/InnerDetector/InDetValidation/PixelRTT/src/TrackValidation.cxx +++ b/InnerDetector/InDetValidation/PixelRTT/src/TrackValidation.cxx @@ -112,7 +112,7 @@ int CosmicTrackValidation::Read(){ ////////////////////////////////////////////////////////////////////////////////////////// -int CosmicTrackValidation::Write ATLAS_NOT_THREAD_SAFE (){ // Thread unsafe MultiHisto<ht>::Write method is used. +int CosmicTrackValidation::Write(){ TDirectory *current = gDirectory; TDirectory *globaldir = current->mkdir(m_globaldirname.c_str()); diff --git a/LArCalorimeter/LArCellRec/share/LArCellDeadOTXCorr_test.py b/LArCalorimeter/LArCellRec/share/LArCellDeadOTXCorr_test.py index c142444f30e47e3d3a8b8078a95b678ed311af9a..1757811060b91a804cc8d6ee11cb3c5093107356 100644 --- a/LArCalorimeter/LArCellRec/share/LArCellDeadOTXCorr_test.py +++ b/LArCalorimeter/LArCellRec/share/LArCellDeadOTXCorr_test.py @@ -257,6 +257,10 @@ class TestAlg (Alg): return def initialize (self): + # Work around issue with cling in root 6.20.06 getting confused + # by forward declarations. + ROOT.xAOD.TriggerTowerContainer_v2 + ROOT.ICaloCellMakerTool self.tool1 = ROOT.ToolHandle(ROOT.ICaloCellMakerTool)('LArCellDeadOTXCorr/tool1') self.tool2 = ROOT.ToolHandle(ROOT.ICaloCellMakerTool)('LArCellDeadOTXCorr/tool2') diff --git a/LArCalorimeter/LArCellRec/src/LArNoisyROTool.cxx b/LArCalorimeter/LArCellRec/src/LArNoisyROTool.cxx index 8325fdd5996a6f8725a61693ed111a13b2257885..5662980119defc86eb75144e8748e62fe13e8c75 100644 --- a/LArCalorimeter/LArCellRec/src/LArNoisyROTool.cxx +++ b/LArCalorimeter/LArCellRec/src/LArNoisyROTool.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 */ // LArNoisyROTool.cxx @@ -208,10 +208,10 @@ std::unique_ptr<LArNoisyROSummary> LArNoisyROTool::process(const CaloCellContain //for ( std::vector<HWIdentifier>::const_iterator febit = badfebs.begin(); // febit != badfebs.end(); febit++ ) - for (const HWIdentifier febid : badfebs) + for (const HWIdentifier& febid : badfebs) { // first channel of FEB, as safety since FEBid seem to be the Id of the - // first channel (no garantee?) + // first channel (no guarantee?) HWIdentifier chanID = m_onlineID->channel_Id(febid,0); int weight = 1; diff --git a/LArCalorimeter/LArConfiguration/python/LArMonitoringConfig.py b/LArCalorimeter/LArConfiguration/python/LArMonitoringConfig.py index ca363c26e4bdd14ace498c95a595c988c3cdedfd..d884891989439bcc4cf39c7f084a620b2e59fb51 100644 --- a/LArCalorimeter/LArConfiguration/python/LArMonitoringConfig.py +++ b/LArCalorimeter/LArConfiguration/python/LArMonitoringConfig.py @@ -19,7 +19,8 @@ def LArMonitoringConfig(inputFlags): if not inputFlags.Input.isMC: acc.merge(LArAffectedRegionsConfig(inputFlags)) acc.merge(LArNoisyROMonConfig(inputFlags)) - acc.merge(LArHVCorrMonConfig(inputFlags)) + if 'online' not in inputFlags.DQ.Environment: + acc.merge(LArHVCorrMonConfig(inputFlags)) # algos which can run in ESD but not AOD: if inputFlags.DQ.Environment != 'AOD': diff --git a/LArCalorimeter/LArDigitization/CMakeLists.txt b/LArCalorimeter/LArDigitization/CMakeLists.txt index 8bc6e121421a5f2a7f163dea372bd155ba2ffd67..e31f694723d547dbcda0e531203f3858abbc4d9c 100644 --- a/LArCalorimeter/LArDigitization/CMakeLists.txt +++ b/LArCalorimeter/LArDigitization/CMakeLists.txt @@ -5,30 +5,6 @@ # Declare the package name: atlas_subdir( LArDigitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Calorimeter/CaloDetDescr - Calorimeter/CaloIdentifier - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - Control/StoreGate - DetectorDescription/Identifier - Event/xAOD/xAODEventInfo - GaudiKernel - LArCalorimeter/LArCabling - LArCalorimeter/LArElecCalib - LArCalorimeter/LArIdentifier - LArCalorimeter/LArRawEvent - LArCalorimeter/LArSimEvent - LArCalorimeter/LArRecConditions - LArCalorimeter/LArRawConditions - Event/EventInfoUtils - PRIVATE - Generators/GeneratorObjects - Generators/AtlasHepMC ) - - # External dependencies: find_package( CLHEP ) @@ -36,7 +12,7 @@ find_package( CLHEP ) atlas_add_library( LArDigitizationLib src/*.cxx PUBLIC_HEADERS LArDigitization - PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES CaloIdentifier AthenaBaseComps AthenaKernel Identifier xAODEventInfo GaudiKernel @@ -47,10 +23,9 @@ atlas_add_library( LArDigitizationLib atlas_add_component( LArDigitization src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES LArDigitizationLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) - diff --git a/LArCalorimeter/LArG4/LArG4FastSimulation/src/LArFastShower.cxx b/LArCalorimeter/LArG4/LArG4FastSimulation/src/LArFastShower.cxx index 467d4254b10cd74c05abdd8d2ae743b760071904..0678534f6ba3df99d681a4d7d64808f7b31f9025 100644 --- a/LArCalorimeter/LArG4/LArG4FastSimulation/src/LArFastShower.cxx +++ b/LArCalorimeter/LArG4/LArG4FastSimulation/src/LArFastShower.cxx @@ -161,7 +161,7 @@ void LArFastShower::DoIt(const G4FastTrack& fastTrack, G4FastStep& fastStep) #endif if ( m_generate_starting_points ) { - if ((float)rand()/RAND_MAX <= m_configuration.m_generated_starting_points_ratio) { + if ((float)rand()/static_cast<float>(RAND_MAX) <= m_configuration.m_generated_starting_points_ratio) { HepMC::GenEvent * ge = GetGenEvent(fastTrack); generateFSStartingPoint(ge); delete ge; diff --git a/LArCalorimeter/LArGeoModel/LArGeoH62002Algs/src/LArDetectorToolH62002.h b/LArCalorimeter/LArGeoModel/LArGeoH62002Algs/src/LArDetectorToolH62002.h index fbc0c3c3d374783034b453a47e00c177959060c4..ffe053e3125c15a9bd508c1c78154ae19b0a838a 100755 --- a/LArCalorimeter/LArGeoModel/LArGeoH62002Algs/src/LArDetectorToolH62002.h +++ b/LArCalorimeter/LArGeoModel/LArGeoH62002Algs/src/LArDetectorToolH62002.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 LARDETECTORTOOLH62002_H @@ -7,7 +7,7 @@ #include "GeoModelUtilities/GeoModelTool.h" -class LArDetectorToolH62002 : public GeoModelTool { +class LArDetectorToolH62002 final : public GeoModelTool { public: diff --git a/LArCalorimeter/LArGeoModel/LArGeoH62003Algs/src/LArDetectorToolH62003.h b/LArCalorimeter/LArGeoModel/LArGeoH62003Algs/src/LArDetectorToolH62003.h index 80aea0989f8d22af87e32cef1457615a5d0e2d0b..4e5a768e47a62c7841a0722cea5bc7e6f2f1dc15 100755 --- a/LArCalorimeter/LArGeoModel/LArGeoH62003Algs/src/LArDetectorToolH62003.h +++ b/LArCalorimeter/LArGeoModel/LArGeoH62003Algs/src/LArDetectorToolH62003.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 LARGEOMODEL_LARDETECTORTOOLH62003_H @@ -7,7 +7,7 @@ #include "GeoModelUtilities/GeoModelTool.h" -class LArDetectorToolH62003 : public GeoModelTool { +class LArDetectorToolH62003 final : public GeoModelTool { public: diff --git a/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/LArDetectorToolH62004.h b/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/LArDetectorToolH62004.h index aff18469c3c682e7a2a6f8c525318e97aaf0b720..6eee9644ddb9dfa977027679da992d3fc85f757a 100755 --- a/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/LArDetectorToolH62004.h +++ b/LArCalorimeter/LArGeoModel/LArGeoH62004Algs/src/LArDetectorToolH62004.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 LArDetectorToolH62004_H @@ -7,7 +7,7 @@ #include "GeoModelUtilities/GeoModelTool.h" -class LArDetectorToolH62004 : public GeoModelTool { +class LArDetectorToolH62004 final : public GeoModelTool { public: diff --git a/LArCalorimeter/LArGeoModel/LArGeoTBEC/src/LArDetectorToolTBEC.h b/LArCalorimeter/LArGeoModel/LArGeoTBEC/src/LArDetectorToolTBEC.h index f461b87766963b5d8e068130e4b61ddbc26834b0..b687104a457d88d93932304f62943cb48b99b85b 100755 --- a/LArCalorimeter/LArGeoModel/LArGeoTBEC/src/LArDetectorToolTBEC.h +++ b/LArCalorimeter/LArGeoModel/LArGeoTBEC/src/LArDetectorToolTBEC.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 LARGEOMODEL_LARDETECTORTOOLTBEC_H @@ -7,7 +7,7 @@ #include "GeoModelUtilities/GeoModelTool.h" -class LArDetectorToolTBEC : public GeoModelTool { +class LArDetectorToolTBEC final : public GeoModelTool { public: diff --git a/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py b/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py index c00b0213a3088e3710be517efbb77b827bb8fc75..bea4e71c7c53bba75b86aa68d6ba26ea0f743867 100644 --- a/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py +++ b/LArCalorimeter/LArMonitoring/share/LArMonitoring_jobOption.py @@ -20,7 +20,7 @@ if 'ESD' not in DQMonFlags.monManEnvironment(): from LArMonitoring.LArNoisyROMonAlg import LArNoisyROMonConfigOld topSequence += LArNoisyROMonConfigOld(DQMonFlags) -if globalflags.DataSource == 'data': +if globalflags.DataSource == 'data' and 'online' not in DQMonFlags.monManEnvironment(): from LArMonitoring.LArHVCorrMonAlg import LArHVCorrMonConfigOld topSequence += LArHVCorrMonConfigOld(DQMonFlags) diff --git a/LArCalorimeter/LArOnlDbPrep/src/LArDSPThresholdFillInline.cxx b/LArCalorimeter/LArOnlDbPrep/src/LArDSPThresholdFillInline.cxx index 916da12e45ae849b0383d43fa4e8cd3e074ba0f5..d1ce70d61a1bfc1d44dfaf60ad5a1d697c3eef78 100644 --- a/LArCalorimeter/LArOnlDbPrep/src/LArDSPThresholdFillInline.cxx +++ b/LArCalorimeter/LArOnlDbPrep/src/LArDSPThresholdFillInline.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 "LArOnlDbPrep/LArDSPThresholdFillInline.h" @@ -54,8 +54,8 @@ LArDSPThresholdFillInline::LArDSPThresholdFillInline(const std::string& name, IS //For channel masking declareProperty("MaskBadChannels",m_maskBadChannels=false); declareProperty("BadChannelMasker",m_badChannelMasker); - declareProperty("MaskedtQThreshold",m_maskedtqThrsh=0x7fffffff); - declareProperty("MaskedsamplesThreshold",m_maskedsamplesThrsh=0x7fffffff); + declareProperty("MaskedtQThreshold",m_maskedtqThrsh=static_cast<float>(0x7fffffff)); + declareProperty("MaskedsamplesThreshold",m_maskedsamplesThrsh=static_cast<float>(0x7fffffff)); declareProperty("Dump",m_dump=false); declareProperty("OutFile",m_outFileName="out.txt"); diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolAverage.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolAverage.cxx index 971cbb62ecf510fcbbb61e7c3249161ba2fc3563..161146b89cca021b06af175210ee1131171d1ece 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolAverage.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolAverage.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 */ @@ -127,11 +127,14 @@ bool LArRawChannelBuilderToolAverage::buildRawChannel(const LArDigit* digit, iprovenance |= m_helper->returnBitPattern(); iprovenance = iprovenance & 0x3FFF; + const float fMAXINT = static_cast<float>(MAXINT); + const float fMAXINT2 = static_cast<float>(MAXINT2); + if (time>MAXINT) time=MAXINT; if (time<MAXINT2) time=MAXINT2; - if (energy>MAXINT) energy=MAXINT; - if (energy<MAXINT2) energy=MAXINT2; + if (energy>fMAXINT) energy=fMAXINT; + if (energy<fMAXINT2) energy=fMAXINT2; (this->*m_buildIt)((int)(floor(energy+0.5)),time,iquality,iprovenance,digit); diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolCubic.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolCubic.cxx index 5f44db36a1357475a84b9751a75ca1630b351241..dc0fac65194d60faf6565a722f28d7f767566378 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolCubic.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolCubic.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 */ @@ -185,11 +185,14 @@ bool LArRawChannelBuilderToolCubic::buildRawChannel(const LArDigit* digit, iprovenance |= m_helper->returnBitPattern(); iprovenance = iprovenance & 0x3FFF; - if (time>MAXINT) time=MAXINT; - if (time<MAXINT2) time=MAXINT2; + const float fMAXINT = static_cast<float>(MAXINT); + const float fMAXINT2 = static_cast<float>(MAXINT2); - if (energy>MAXINT) energy=MAXINT; - if (energy<MAXINT2) energy=MAXINT2; + if (time>fMAXINT) time=fMAXINT; + if (time<fMAXINT2) time=fMAXINT2; + + if (energy>fMAXINT) energy=fMAXINT; + if (energy<fMAXINT2) energy=fMAXINT2; (this->*m_buildIt)((int)(floor(energy+0.5)),(int)floor(time+0.5),iquality,iprovenance,digit); diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFC.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFC.cxx index 88df1aad3f107069b555e16801f828ca2b9c3d2c..57ce92f780cf32d5e184180078be1725d8868f0c 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFC.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFC.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 */ @@ -238,11 +238,14 @@ bool LArRawChannelBuilderToolOFC::buildRawChannel(const LArDigit* digit, time=time*(nanosecond/picosecond); //Convert time to ps - if (time>MAXINT) time=MAXINT; - if (time<MAXINT2) time=MAXINT2; + const float fMAXINT = static_cast<float>(MAXINT); + const float fMAXINT2 = static_cast<float>(MAXINT2); - if (energy>MAXINT) energy=MAXINT; - if (energy<MAXINT2) energy=MAXINT2; + if (time>fMAXINT) time=fMAXINT; + if (time<fMAXINT2) time=fMAXINT2; + + if (energy>fMAXINT) energy=fMAXINT; + if (energy<fMAXINT2) energy=fMAXINT2; (this->*m_buildIt)((int)(floor(energy+0.5)),(int)floor(time+0.5),iquality,iprovenance,digit); m_helper->incrementErrorCount(0); diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFCIter.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFCIter.cxx index c2cdb788aeaf4099a90cd2e97181218ddfa6a5bf..edf31b79f3dbea4f88e223a407be64c88a06ade1 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFCIter.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolOFCIter.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 */ @@ -276,11 +276,14 @@ bool LArRawChannelBuilderToolOFCIter::buildRawChannel(const LArDigit* digit, time=time*(nanosecond/picosecond); //Convert time to ps - if (time>MAXINT) time=MAXINT; - if (time<MAXINT2) time=MAXINT2; + const float fMAXINT = static_cast<float>(MAXINT); + const float fMAXINT2 = static_cast<float>(MAXINT2); - if (energy>MAXINT) energy=MAXINT; - if (energy<MAXINT2) energy=MAXINT2; + if (time>fMAXINT) time=fMAXINT; + if (time<fMAXINT2) time=fMAXINT2; + + if (energy>fMAXINT) energy=fMAXINT; + if (energy<fMAXINT2) energy=fMAXINT2; (this->*m_buildIt)((int)(floor(energy+0.5)),(int)floor(time+0.5),iquality,iprovenance,digit); diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolParabola.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolParabola.cxx index 59b5bdb1604fe42b2ef7a17785c17d2c9fe908b2..dfa62e6148df4598eff03c8dc2df301acae17c80 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolParabola.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolParabola.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 */ @@ -79,11 +79,14 @@ bool LArRawChannelBuilderToolParabola::buildRawChannel(const LArDigit* digit, iprovenance |= m_helper->returnBitPattern(); iprovenance = iprovenance & 0x3FFF; + const float fMAXINT = static_cast<float>(MAXINT); + const float fMAXINT2 = static_cast<float>(MAXINT2); + if (time>MAXINT) time=MAXINT; if (time<MAXINT2) time=MAXINT2; - if (energy>MAXINT) energy=MAXINT; - if (energy<MAXINT2) energy=MAXINT2; + if (energy>fMAXINT) energy=fMAXINT; + if (energy<fMAXINT2) energy=fMAXINT2; diff --git a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolTileInfo.cxx b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolTileInfo.cxx index 019e023d3f4dc07e02206449a7d2fe60ac8edb91..59c5e77d69aa94a6cf4ef6be9c7fd47d799a5203 100755 --- a/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolTileInfo.cxx +++ b/LArCalorimeter/LArROD/src/LArRawChannelBuilderToolTileInfo.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 "LArROD/LArRawChannelBuilderToolTileInfo.h" @@ -252,11 +252,14 @@ bool LArRawChannelBuilderToolTileInfo::buildRawChannel(const LArDigit* digit, time=time*(nanosecond/picosecond); //Convert time to ps - if (time>MAXINT) time=MAXINT; - if (time<MAXINT2) time=MAXINT2; + const float fMAXINT = static_cast<float>(MAXINT); + const float fMAXINT2 = static_cast<float>(MAXINT2); - if (energy>MAXINT) energy=MAXINT; - if (energy<MAXINT2) energy=MAXINT2; + if (time>fMAXINT) time=fMAXINT; + if (time<fMAXINT2) time=fMAXINT2; + + if (energy>fMAXINT) energy=fMAXINT; + if (energy<fMAXINT2) energy=fMAXINT2; //Make LArRawChannel Object with new data LArRawChannel larRawChannel(digit->channelID(), diff --git a/LArCalorimeter/LArRecUtils/src/LArHVPathologyDbCondAlg.cxx b/LArCalorimeter/LArRecUtils/src/LArHVPathologyDbCondAlg.cxx index b5518721e5c2d9d669ff605184291dbd9cdcae1c..3ac4918d15a166a7a8fddec19ac99ae9aec8fe8c 100755 --- a/LArCalorimeter/LArRecUtils/src/LArHVPathologyDbCondAlg.cxx +++ b/LArCalorimeter/LArRecUtils/src/LArHVPathologyDbCondAlg.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 "LArHVPathologyDbCondAlg.h" @@ -264,7 +264,7 @@ LArHVPathologyDbCondAlg::fillElectMap(const CaloDetDescrManager* calodetdescrmgr } } // loop over all HEC Identifiers - for (auto const id: m_larhec_id->channel_ids()) { + for (auto const& id: m_larhec_id->channel_ids()) { hwlineId.clear(); hvCabling->getHVLineInCell(id,hwlineId); if (const HECDetectorElement* hecElement = dynamic_cast<const HECDetectorElement*>(calodetdescrmgr->get_element(id))) { @@ -285,7 +285,7 @@ LArHVPathologyDbCondAlg::fillElectMap(const CaloDetDescrManager* calodetdescrmgr } } // loop over all FCAL Identifiers - for (auto const id: m_larfcal_id->channel_ids()) { + for (auto const& id: m_larfcal_id->channel_ids()) { hwlineId.clear(); hvCabling->getHVLineInCell(id,hwlineId); if (const FCALDetectorElement* fcalElement = dynamic_cast<const FCALDetectorElement*>(calodetdescrmgr->get_element(id))) { diff --git a/LArCalorimeter/LArTest/LArEventTest/LArEventTest/DumpLArRawChannels.h b/LArCalorimeter/LArTest/LArEventTest/LArEventTest/DumpLArRawChannels.h index 7cb9f0e37148c07cc6967febc5a2c0f31f5e321f..0c16266993f7331f160c69d8bde05991485ead61 100644 --- a/LArCalorimeter/LArTest/LArEventTest/LArEventTest/DumpLArRawChannels.h +++ b/LArCalorimeter/LArTest/LArEventTest/LArEventTest/DumpLArRawChannels.h @@ -45,6 +45,8 @@ class DumpLArRawChannels : public AthAlgorithm float m_e=0,m_t=0,m_Q=0; unsigned m_gain=0; unsigned m_id=0; + bool m_toLog; + bool m_toFile; ServiceHandle<ITHistSvc> m_thistSvc; diff --git a/LArCalorimeter/LArTest/LArEventTest/python/LArRawChannelDump.py b/LArCalorimeter/LArTest/LArEventTest/python/LArRawChannelDump.py new file mode 100644 index 0000000000000000000000000000000000000000..65ff783076fcf54412d1c0bd85bbe3925d8d056d --- /dev/null +++ b/LArCalorimeter/LArTest/LArEventTest/python/LArRawChannelDump.py @@ -0,0 +1,30 @@ +from AthenaConfiguration.ComponentFactory import CompFactory + +if __name__ == "__main__": + + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior=1 + + from AthenaConfiguration.AllConfigFlags import ConfigFlags + + ConfigFlags.Input.Files = ["myRDO.pool.root",] + ConfigFlags.lock() + + from AthenaConfiguration.MainServicesConfig import MainServicesCfg + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + + cfg=MainServicesCfg(ConfigFlags) + cfg.merge(PoolReadCfg(ConfigFlags)) + + from LArGeoAlgsNV.LArGMConfig import LArGMCfg + cfg.merge(LArGMCfg(ConfigFlags)) + from LArCabling.LArCablingConfig import LArOnOffIdMappingCfg + cfg.merge(LArOnOffIdMappingCfg(ConfigFlags)) + cfg.addEventAlgo(CompFactory.DumpLArRawChannels(NtupStream="LARRC",OutputFileName="",ToLog=False)) + + cfg.addService(CompFactory.THistSvc(Output = ["LARRC DATAFILE='LARRC.root', OPT='RECREATE'"])) + + + cfg.run(-1) + + diff --git a/LArCalorimeter/LArTest/LArEventTest/src/DumpLArRawChannels.cxx b/LArCalorimeter/LArTest/LArEventTest/src/DumpLArRawChannels.cxx index 819ed17fae8f2b3742c0fb401852e3eb76970f16..4ad511d511317394d2f32b54362dbdd2d60c33d4 100644 --- a/LArCalorimeter/LArTest/LArEventTest/src/DumpLArRawChannels.cxx +++ b/LArCalorimeter/LArTest/LArEventTest/src/DumpLArRawChannels.cxx @@ -20,6 +20,7 @@ DumpLArRawChannels::DumpLArRawChannels(const std::string& name, ISvcLocator* pSv declareProperty("LArRawChannelContainerName",m_key=""); declareProperty("OutputFileName",m_FileName="LArRawChannels.txt"); declareProperty("NtupStream",m_ntup); + declareProperty("ToLog",m_toLog=true); } DumpLArRawChannels::~DumpLArRawChannels() @@ -43,7 +44,12 @@ StatusCode DumpLArRawChannels::initialize() ATH_CHECK( m_cablingKey.initialize() ); - m_outfile.open(m_FileName.c_str(),std::ios::out); + if (!m_FileName.empty()) { + m_outfile.open(m_FileName.c_str(),std::ios::out); + m_toFile=true; + } + else + m_toFile=false; if (m_ntup.size()) { m_tree= new TTree("RC","LArRawChannels"); @@ -75,7 +81,7 @@ StatusCode DumpLArRawChannels::execute() ATH_MSG_WARNING ( "No EventInfo object found!" ); else { - std::cout << "*** Event #" << std::dec << thisEventInfo->runNumber() << "/" << thisEventInfo->eventNumber() << std::endl; + if (m_toLog) std::cout << "*** Event #" << std::dec << thisEventInfo->runNumber() << "/" << thisEventInfo->eventNumber() << std::endl; m_evt=thisEventInfo->eventNumber(); } @@ -107,8 +113,8 @@ StatusCode DumpLArRawChannels::execute() m_chan++; channelVector.push_back(&(*it_chan_coll)); } - m_outfile << "Event " << m_count << " contains " << m_chan << " channels\n"; - std::cout << "Event " << m_count << " contains " << m_chan << " channels\n"; + if (m_toFile) m_outfile << "Event " << m_count << " contains " << m_chan << " channels\n"; + if (m_toLog) std::cout << "Event " << m_count << " contains " << m_chan << " channels\n"; mySort aSort; std::sort(channelVector.begin(),channelVector.end(),aSort); @@ -119,12 +125,12 @@ StatusCode DumpLArRawChannels::execute() //if ((*vec_it)->energy()==0) //continue; const HWIdentifier chid=(*vec_it)->channelID();//hardwareID(); - std::cout << "Channel: " << m_onlineHelper->channel_name(chid); - m_outfile << "Channel: " << m_onlineHelper->channel_name(chid); + if (m_toLog) std::cout << "Channel: " << m_onlineHelper->channel_name(chid); + if (m_toFile) m_outfile << "Channel: " << m_onlineHelper->channel_name(chid); if (!cabling->isOnlineConnected(chid)) { - std::cout << " disconnected" << std::endl; - m_outfile << " disconnected" << std::endl; + if (m_toLog) std::cout << " disconnected" << std::endl; + if (m_toFile) m_outfile << " disconnected" << std::endl; continue; } const Identifier id=cabling->cnvToIdentifier(chid); @@ -134,17 +140,17 @@ StatusCode DumpLArRawChannels::execute() phi=m_emId->phi(id); layer=m_emId->sampling(id); if (m_emId->is_em_endcap(id)) { - std::cout << " Endcap l/e/p= " << layer << "/" << eta << "/" << phi << ":"; - m_outfile << " Endcap l/e/p= " << layer << "/" << eta << "/" << phi << ":"; + if (m_toLog) std::cout << " Endcap l/e/p= " << layer << "/" << eta << "/" << phi << ":"; + if (m_toFile) m_outfile << " Endcap l/e/p= " << layer << "/" << eta << "/" << phi << ":"; } else { - std::cout << " Barrel l/e/p= " << layer << "/" << eta << "/" << phi << ":"; - m_outfile << " Barrel l/e/p= " << layer << "/" << eta << "/" << phi << ":"; + if (m_toLog) std::cout << " Barrel l/e/p= " << layer << "/" << eta << "/" << phi << ":"; + if (m_toFile) m_outfile << " Barrel l/e/p= " << layer << "/" << eta << "/" << phi << ":"; } } else { - std::cout << " (is not EM)"; - m_outfile << " (is not EM)"; + if (m_toLog) std::cout << " (is not EM)"; + if (m_toFile) m_outfile << " (is not EM)"; } @@ -157,10 +163,10 @@ StatusCode DumpLArRawChannels::execute() */ //if (abs(Time)>24000) //Time=0; - std::cout << " E= " << (*vec_it)->energy() << " t= " << Time << " Q= " << (*vec_it)->quality() << " P=0x" + if (m_toLog) std::cout << " E= " << (*vec_it)->energy() << " t= " << Time << " Q= " << (*vec_it)->quality() << " P=0x" << std::hex << (*vec_it)->provenance() << std::dec << " G=" << (*vec_it)->gain() << std::endl; - m_outfile << " E= " << (*vec_it)->energy() << " t= " << Time << " Q= " << (*vec_it)->quality() << " P=0x" + if (m_toFile) m_outfile << " E= " << (*vec_it)->energy() << " t= " << Time << " Q= " << (*vec_it)->quality() << " P=0x" << std::hex << (*vec_it)->provenance() << std::dec << " G=" << (*vec_it)->gain() << std::endl; if (m_tree) { @@ -179,7 +185,7 @@ StatusCode DumpLArRawChannels::execute() StatusCode DumpLArRawChannels::finalize() { - m_outfile.close(); + if (m_toFile) m_outfile.close(); ATH_MSG_INFO ( "======== finalize DumpLArRawChannel ========" ); return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx index e062ad50ba94e0c86e717aa0fca9488b1e07ffd2..06069815b7a3fec0e39574c4c5d4ec516cae11bd 100644 --- a/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx +++ b/MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools/src/NSWCalibTool.cxx @@ -140,12 +140,9 @@ StatusCode Muon::NSWCalibTool::calibrateStrip(const Muon::MM_RawData* mmRawData, { Identifier rdoId = mmRawData->identify(); - // @TODO: for the shifter: this code will be used as soon as the NSW is built in the MuonDetectorCondAlg - // for now, we will need to use the nominal manager from the detectorStore to run - // SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey}; - // const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr(); - const MuonGM::MuonDetectorManager* muDetMgr=nullptr; - ATH_CHECK(detStore()->retrieve(muDetMgr)); + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> muDetMgrHandle{m_muDetMgrKey}; + const MuonGM::MuonDetectorManager* muDetMgr = muDetMgrHandle.cptr(); //get globalPos Amg::Vector3D globalPos; diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/CMakeLists.txt index 1458eeaa972da740800cc5835e61554de040e254..6ca95d791dd93474265a3fc1e9b4c840d81b5d39 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/CMakeLists.txt @@ -41,7 +41,3 @@ atlas_add_component( MuonSTGC_CnvTools src/components/*.cxx INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ${EIGEN_LIBRARIES} ByteStreamCnvSvcBaseLib ByteStreamData ByteStreamData_test GaudiKernel AthenaBaseComps Identifier EventPrimitives TGCcablingInterfaceLib MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonRDO MuonPrepRawData MuonTrigCoinData TrkSurfaces STgcClusterizationLib MuonCnvToolInterfacesLib MuonSTGC_CnvToolsLib ) - -# Install files from the package: -atlas_install_joboptions( share/*.py ) - diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.cxx index 25924a048ded723f70e793f9a108882ddb3d4752..5166bfd20f33d8f0fd0720ebdfc0225a0d6b0e04 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolCore.cxx @@ -83,6 +83,15 @@ StatusCode Muon::sTgcRdoToPrepDataToolCore::processCollection(const STGC_RawData std::vector<sTgcPrepData> sTgcPadPrds; // convert the RDO collection to a PRD collection STGC_RawDataCollection::const_iterator it = rdoColl->begin(); + + // MuonDetectorManager from the conditions store + SG::ReadCondHandle<MuonGM::MuonDetectorManager> detMgrHandle{m_muDetMgrKey}; + const MuonGM::MuonDetectorManager* muonDetMgr = detMgrHandle.cptr(); + if(!muonDetMgr){ + ATH_MSG_ERROR("Null pointer to the read MuonDetectorManager conditions object"); + return StatusCode::FAILURE; + } + for ( ; it != rdoColl->end() ; ++it ) { ATH_MSG_DEBUG("Adding a new sTgc PrepRawData"); @@ -95,14 +104,9 @@ StatusCode Muon::sTgcRdoToPrepDataToolCore::processCollection(const STGC_RawData } std::vector<Identifier> rdoList; rdoList.push_back(rdoId); - - // TODO: this needs to be replaced by SG::ReadCondHandle<MuonGM::MuonDetectorManager> - // will do it in a follow-up MR, since for now, we need to get the Run2 detectors running, so skip sTGCs for now - const MuonGM::MuonDetectorManager* muDetMgrNominal=nullptr; - ATH_CHECK(detStore()->retrieve(muDetMgrNominal)); // get the local and global positions - const MuonGM::sTgcReadoutElement* detEl = muDetMgrNominal->getsTgcReadoutElement(rdoId); + const MuonGM::sTgcReadoutElement* detEl = muonDetMgr->getsTgcReadoutElement(rdoId); Amg::Vector2D localPos; bool getLocalPos = detEl->stripPosition(rdoId,localPos); diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt index 4588c18631af875267264e1fea66a68421cd6c6c..373d758696c4e3974df3c20a585008ceb3815e02 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/CMakeLists.txt @@ -52,4 +52,3 @@ atlas_add_component( MuonCondAlg # Install files from the package: atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCondDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCondDbAlg.cxx index a0c0e468ebc8b629464615e8af7d8cbedd3c8fcf..4b8b1defcde4e1533476a00986c99ad036107110 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCondDbAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/MdtCondDbAlg.cxx @@ -37,9 +37,11 @@ MdtCondDbAlg::initialize(){ ATH_CHECK(m_readKey_folder_da_lv .initialize(!m_readKey_folder_da_lv.empty() && m_isData)); ATH_CHECK(m_readKey_folder_da_droppedChambers.initialize(!m_readKey_folder_da_droppedChambers.empty() && m_isData)); ATH_CHECK(m_readKey_folder_mc_droppedChambers.initialize(!m_readKey_folder_mc_droppedChambers.empty() && !m_isData)); - ATH_CHECK(m_readKey_folder_mc_deadElements .initialize(!m_readKey_folder_mc_deadElements.empty() && !m_isData)); - ATH_CHECK(m_readKey_folder_mc_deadTubes .initialize(!m_readKey_folder_mc_deadTubes.empty() && !m_isData)); ATH_CHECK(m_readKey_folder_mc_noisyChannels .initialize(!m_readKey_folder_mc_noisyChannels.empty() && !m_isData)); + // The calls to the functions that use these two are commented out, + // so don't declare a dependencies on them. + ATH_CHECK(m_readKey_folder_mc_deadElements .initialize(false/*!m_readKey_folder_mc_deadElements.empty() && !m_isData*/)); + ATH_CHECK(m_readKey_folder_mc_deadTubes .initialize(false/*!m_readKey_folder_mc_deadTubes.empty() && !m_isData*/)); if(m_condSvc->regHandle(this, m_writeKey).isFailure()) { ATH_MSG_FATAL("Unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc"); diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/RpcCondDbAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/RpcCondDbAlg.cxx index d25e349ec88ac50ecc046df5727a47dce3832b65..34d3ffb16bc75a1a1ebc5042b65ee6aabe4772e0 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/RpcCondDbAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/RpcCondDbAlg.cxx @@ -25,8 +25,8 @@ RpcCondDbAlg::initialize(){ ATH_CHECK(m_condSvc .retrieve()); ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_writeKey.initialize()); - ATH_CHECK(m_readKey_folder_da_deadPanels .initialize(!m_readKey_folder_da_deadPanels.empty())); - ATH_CHECK(m_readKey_folder_da_offPanels .initialize(!m_readKey_folder_da_offPanels.empty())); + ATH_CHECK(m_readKey_folder_da_deadPanels .initialize(!m_readKey_folder_da_deadPanels.empty() && m_isData)); + ATH_CHECK(m_readKey_folder_da_offPanels .initialize(!m_readKey_folder_da_offPanels.empty() && m_isData)); ATH_CHECK(m_readKey_folder_mc_deadElements.initialize(!m_readKey_folder_mc_deadElements.empty())); if(m_condSvc->regHandle(this, m_writeKey).isFailure()) { diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/CMakeLists.txt b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/CMakeLists.txt index 73cf461d9cb3a72219b4ee741b27ef4cc478d331..3d7b2f06647a8ea9f1668f0a98053388b7deff23 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/CMakeLists.txt +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/CMakeLists.txt @@ -38,5 +38,3 @@ atlas_add_component( MuonCondSvc # Install files from the package: atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) - diff --git a/MuonSpectrometer/MuonConfig/CMakeLists.txt b/MuonSpectrometer/MuonConfig/CMakeLists.txt index 43b39d75bac879229aa80e36bbd419e75ba3e294..859d13e5d4be33bfa2e7ed1d2a5a3e2a8067a683 100644 --- a/MuonSpectrometer/MuonConfig/CMakeLists.txt +++ b/MuonSpectrometer/MuonConfig/CMakeLists.txt @@ -7,7 +7,6 @@ atlas_subdir( MuonConfig ) # Install files from the package: atlas_install_python_modules( python/*.py test/MdtRdoToPrepDataTool_test.py test/MdtIntersectGeometry_test.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) atlas_install_data( share/*.ref ) if( NOT SIMULATIONBASE ) diff --git a/MuonSpectrometer/MuonDigitization/CSC_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/CSC_Digitization/CMakeLists.txt index 3137dbe4939d60f6d46ff6668b17ce6bdac3b870..98adc9bc6136c043106c6b937b7152f3e27e55d2 100755 --- a/MuonSpectrometer/MuonDigitization/CSC_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/CSC_Digitization/CMakeLists.txt @@ -5,24 +5,6 @@ # Declare the package name: atlas_subdir( CSC_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - GaudiKernel - MuonSpectrometer/MuonCalib/CscCalib/CscCalibTools - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonSimData - MuonSpectrometer/MuonSimEvent - Simulation/HitManagement - PRIVATE - Control/StoreGate - Generators/GeneratorObjects - Generators/AtlasHepMC ) - # External dependencies: find_package( CLHEP ) @@ -30,11 +12,10 @@ find_package( CLHEP ) atlas_add_component( CSC_Digitization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel PileUpToolsLib GaudiKernel MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimData MuonSimEvent HitManagement StoreGateLib SGtests GeneratorObjects CscCalibToolsLib ) # Install files from the package: -atlas_install_headers( CSC_Digitization ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) diff --git a/MuonSpectrometer/MuonDigitization/MDT_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/MDT_Digitization/CMakeLists.txt index e6b9c3ab0d1e2b16ea6c6b1faab07cda02832895..6b112cd48225b34a1abacd5c4b37b0d1a1624082 100755 --- a/MuonSpectrometer/MuonDigitization/MDT_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/MDT_Digitization/CMakeLists.txt @@ -5,33 +5,6 @@ # Declare the package name: atlas_subdir( MDT_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - Control/StoreGate - DetectorDescription/Identifier - Event/xAOD/xAODEventInfo - GaudiKernel - Generators/GeneratorObjects - Generators/AtlasHepMC - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibSvc - MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface - MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonDigitization/MDT_Response - MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonSimData - MuonSpectrometer/MuonSimEvent - Simulation/HitManagement - Tools/PathResolver - Tracking/TrkDetDescr/TrkDetDescrUtils - PRIVATE - Event/EventPrimitives ) - # External dependencies: find_package( CLHEP ) @@ -39,11 +12,10 @@ find_package( CLHEP ) atlas_add_component( MDT_Digitization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} + INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel PileUpToolsLib StoreGateLib SGtests Identifier xAODEventInfo GaudiKernel GeneratorObjects MdtCalibData MdtCalibSvcLib MuonCondInterface MuonCondData MuonReadoutGeometry MuonDigitContainer MDT_Response MuonIdHelpersLib MuonSimData MuonSimEvent HitManagement PathResolver TrkDetDescrUtils EventPrimitives ) # Install files from the package: -atlas_install_headers( MDT_Digitization ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) atlas_install_runtime( share/*.rt ) diff --git a/MuonSpectrometer/MuonDigitization/MM_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/MM_Digitization/CMakeLists.txt index 02f3c6374f2afd66ef34b5ee67b26a9e708d852a..299a278749b35f23182bfdd214bc73b207307ac6 100644 --- a/MuonSpectrometer/MuonDigitization/MM_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/MM_Digitization/CMakeLists.txt @@ -5,35 +5,6 @@ # Declare the package name: atlas_subdir( MM_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - DetectorDescription/GeoPrimitives - DetectorDescription/Identifier - GaudiKernel - MagneticField/MagFieldElements - MagneticField/MagFieldConditions - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonDigitization/MuonDigToolInterfaces - MuonSpectrometer/MuonSimEvent - Simulation/HitManagement - PRIVATE - Control/StoreGate - Generators/GeneratorObjects - Generators/AtlasHepMC - MuonSpectrometer/MuonDetDescr/MuonAGDDDescription - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonSimData - MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools - Simulation/Tools/AtlasCLHEP_RandomGenerators - Tools/PathResolver - Tracking/TrkDetDescr/TrkDetDescrUtils - Tracking/TrkDetDescr/TrkSurfaces - Tracking/TrkEvent/TrkEventPrimitives ) - # External dependencies: find_package( AIDA ) find_package( CLHEP ) @@ -49,17 +20,15 @@ atlas_add_library( MM_DigitizationLib src/*.cxx PUBLIC_HEADERS MM_Digitization INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} + PRIVATE_INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier GaudiKernel MagFieldInterfaces MuonSimEvent HitManagement PileUpToolsLib StoreGateLib SGtests MuonIdHelpersLib NSWCalibToolsLib MagFieldElements MagFieldConditions MuonReadoutGeometry - PRIVATE_LINK_LIBRARIES AtlasHepMCLib GeneratorObjects MuonAGDDDescription MuonDigitContainer MuonSimData AtlasCLHEP_RandomGenerators PathResolver TrkDetDescrUtils TrkSurfaces TrkEventPrimitives ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier GaudiKernel MagFieldInterfaces MuonSimEvent HitManagement PileUpToolsLib StoreGateLib SGtests MuonIdHelpersLib NSWCalibToolsLib MagFieldElements MagFieldConditions MuonReadoutGeometry MuonSimData MuonDigitContainer MuonDigToolInterfacesLib + PRIVATE_LINK_LIBRARIES AtlasHepMCLib GeneratorObjects MuonAGDDDescription AtlasCLHEP_RandomGenerators PathResolver TrkDetDescrUtils TrkSurfaces TrkEventPrimitives ) atlas_add_component( MM_Digitization src/components/*.cxx - INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib GeoPrimitives Identifier GaudiKernel MagFieldInterfaces MuonSimEvent HitManagement StoreGateLib SGtests GeneratorObjects MuonAGDDDescription MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimData AtlasCLHEP_RandomGenerators PathResolver TrkDetDescrUtils TrkSurfaces TrkEventPrimitives MM_DigitizationLib NSWCalibToolsLib MagFieldElements MagFieldConditions ) + LINK_LIBRARIES MM_DigitizationLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) -atlas_install_runtime( share/*.gas ) diff --git a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/CMakeLists.txt index a9a3122f31fb90ea7f3a24eada4942061facc77e..e47dcb40ddc5194ff135152fda0b803b5ee0efc9 100644 --- a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/CMakeLists.txt @@ -5,24 +5,6 @@ # Declare the package name: atlas_subdir( MuonFastDigitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PRIVATE - Control/AthenaBaseComps - Control/AthenaKernel - Control/StoreGate - DetectorDescription/Identifier - GaudiKernel - MuonSpectrometer/MuonDetDescr/MuonAGDDDescription - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData - MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces - MuonSpectrometer/MuonSimData - MuonSpectrometer/MuonSimEvent - Tools/PathResolver - Tracking/TrkDetDescr/TrkSurfaces - Tracking/TrkEvent/TrkEventPrimitives ) - # External dependencies: find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) diff --git a/MuonSpectrometer/MuonDigitization/RPC_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/RPC_Digitization/CMakeLists.txt index 00c0703a6341069e0fbc0169ce948adc50a9bccb..3e1aacaaf7f7984568df03fdb32ebc69c1d37f31 100755 --- a/MuonSpectrometer/MuonDigitization/RPC_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/RPC_Digitization/CMakeLists.txt @@ -5,31 +5,6 @@ # Declare the package name: atlas_subdir( RPC_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/PileUpTools - Event/xAOD/xAODEventInfo - GaudiKernel - MuonSpectrometer/MuonSimData - MuonSpectrometer/MuonSimEvent - Simulation/HitManagement - PRIVATE - Control/AthenaKernel - Database/RDBAccessSvc - DetectorDescription/GeoModel/GeoModelInterfaces - DetectorDescription/GeometryDBSvc - Event/EventInfo - Event/EventInfoMgt - Generators/GeneratorObjects - Generators/AtlasHepMC - MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface - MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonIdHelpers - Tools/PathResolver ) - # External dependencies: find_package( AIDA ) find_package( Boost COMPONENTS filesystem thread system ) @@ -44,7 +19,6 @@ atlas_add_component( RPC_Digitization LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps PileUpToolsLib xAODEventInfo GaudiKernel MuonSimData MuonSimEvent HitManagement AthenaKernel EventInfo GeneratorObjects MuonCondInterface MuonCondData MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib PathResolver GeometryDBSvcLib EventInfoMgtLib ) # Install files from the package: -atlas_install_headers( RPC_Digitization ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/RPC_Digitization_jobOptions.txt share/*.py ) atlas_install_runtime( share/G4RPC_Digitizer.txt share/PermanentDeadPanels.txt share/PermanentGoodPanels.txt ) diff --git a/MuonSpectrometer/MuonDigitization/TGC_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/TGC_Digitization/CMakeLists.txt index 7b78cf64cf3fafae335aa2d97da814a1793dd427..5e7e596f4d046cfd7389d5970e7e4d4a68525b9b 100755 --- a/MuonSpectrometer/MuonDigitization/TGC_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/TGC_Digitization/CMakeLists.txt @@ -5,27 +5,6 @@ # Declare the package name: atlas_subdir( TGC_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/PileUpTools - DetectorDescription/GeoPrimitives - DetectorDescription/Identifier - GaudiKernel - MuonSpectrometer/MuonSimEvent - Simulation/HitManagement - PRIVATE - Database/RDBAccessSvc - DetectorDescription/GeoModel/GeoModelInterfaces - Event/xAOD/xAODEventInfo - Generators/GeneratorObjects - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonSimData - Tools/PathResolver ) - # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) find_package( CLHEP ) diff --git a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/CMakeLists.txt index 8f8d38b959401432e90148e729678b5fb3c2ec11..c61183789fcc881c679aa8925263c90377d11c6b 100644 --- a/MuonSpectrometer/MuonDigitization/sTGC_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/sTGC_Digitization/CMakeLists.txt @@ -5,34 +5,6 @@ # Declare the package name: atlas_subdir( sTGC_Digitization ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/AthenaKernel - Control/AthContainers - Control/PileUpTools - DetectorDescription/Identifier - Event/xAOD/xAODEventInfo - GaudiKernel - MuonSpectrometer/MuonDigitization/MuonDigToolInterfaces - MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonSimEvent - Simulation/HitManagement - PRIVATE - Control/StoreGate - Event/EventInfo - Event/EventInfoMgt - Generators/GeneratorObjects - Generators/AtlasHepMC - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonSimData - MuonSpectrometer/MuonCalib/NSWCalib/NSWCalibTools - Tools/PathResolver - Tracking/TrkDetDescr/TrkDetDescrUtils - Tracking/TrkDetDescr/TrkSurfaces - Tracking/TrkEvent/TrkEventPrimitives ) - # External dependencies: find_package( AIDA ) find_package( CLHEP ) @@ -46,11 +18,10 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minui atlas_add_component( sTGC_Digitization src/*.cxx src/components/*.cxx - INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + INCLUDE_DIRS ${AIDA_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel AthContainers PileUpToolsLib Identifier xAODEventInfo GaudiKernel MuonSimEvent HitManagement StoreGateLib SGtests EventInfo GeneratorObjects MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimData PathResolver TrkDetDescrUtils TrkSurfaces TrkEventPrimitives NSWCalibToolsLib MuonDigToolInterfacesLib ) # Install files from the package: -atlas_install_headers( sTGC_Digitization ) atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) atlas_install_runtime( share/*.dat ) diff --git a/MuonSpectrometer/MuonGeoModel/CMakeLists.txt b/MuonSpectrometer/MuonGeoModel/CMakeLists.txt index 240ff7dc5909250cfa28396587974828cdb986b3..38fab36fef7175cddf6ab519c65b0245f992a7d1 100644 --- a/MuonSpectrometer/MuonGeoModel/CMakeLists.txt +++ b/MuonSpectrometer/MuonGeoModel/CMakeLists.txt @@ -5,26 +5,6 @@ # Declare the package name: atlas_subdir( MuonGeoModel ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaKernel - Control/StoreGate - DetectorDescription/GeoModel/GeoModelInterfaces - DetectorDescription/GeoModel/GeoModelUtilities - DetectorDescription/GeoPrimitives - GaudiKernel - MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondInterface - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonGMdbObjects - Amdcsimrec/AmdcDb - PRIVATE - Database/AthenaPOOL/AthenaPoolUtilities - Database/RDBAccessSvc - DetectorDescription/AGDD/AGDDKernel - DetectorDescription/IdDictDetDescr - MuonSpectrometer/MuonDetDescr/MuonAGDDDescription - MuonSpectrometer/MuonDetDescr/MuonDetDescrUtils - MuonSpectrometer/MuonIdHelpers ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) diff --git a/MuonSpectrometer/MuonIdHelpersAlgs/MuonIdHelpersAlgs/TestMuonIdHelpers.h b/MuonSpectrometer/MuonIdHelpersAlgs/MuonIdHelpersAlgs/TestMuonIdHelpers.h index f8e34a66ce252f7a5008dd2bd6b8f3e6c241277c..704ebace7eb1cfa2deafc13abd0b645401e6332f 100644 --- a/MuonSpectrometer/MuonIdHelpersAlgs/MuonIdHelpersAlgs/TestMuonIdHelpers.h +++ b/MuonSpectrometer/MuonIdHelpersAlgs/MuonIdHelpersAlgs/TestMuonIdHelpers.h @@ -5,16 +5,18 @@ #ifndef TestMuonIdHelpers_H #define TestMuonIdHelpers_H -#include <vector> - #include "AthenaBaseComps/AthAlgorithm.h" #include "GaudiKernel/ServiceHandle.h" -#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "StoreGate/ReadHandleKey.h" -class StoreGateSvc; -class ActiveStoreSvc; +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonDigitContainer/MdtDigitContainer.h" +#include "MuonDigitContainer/RpcDigitContainer.h" +#include "MuonDigitContainer/CscDigitContainer.h" +#include "MuonDigitContainer/TgcDigitContainer.h" -///////////////////////////////////////////////////////////////////////////// +#include <string> +#include <vector> class TestMuonIdHelpers : public AthAlgorithm { @@ -44,9 +46,13 @@ private: BooleanProperty m_testRPC; BooleanProperty m_testTGC; - ServiceHandle<ActiveStoreSvc> m_activeStore; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + SG::ReadHandleKey<MdtDigitContainer> m_mdtDigitContKey{this,"MdtDigits","MDT_DIGITS","ReadHandleKey for Input MdtDigitContainer"}; + SG::ReadHandleKey<RpcDigitContainer> m_rpcDigitContKey{this,"RpcDigits","RPC_DIGITS","ReadHandleKey for Input RpcDigitContainer"}; + SG::ReadHandleKey<CscDigitContainer> m_cscDigitContKey{this,"CscDigits","CSC_DIGITS","ReadHandleKey for Input CscDigitContainer"}; + SG::ReadHandleKey<TgcDigitContainer> m_tgcDigitContKey{this,"TgcDigits","TGC_DIGITS","ReadHandleKey for Input TgcDigitContainer"}; + mutable std::atomic<long long> m_deltaUser{0}; mutable std::atomic<long long> m_deltaKernel{0}; mutable std::atomic<long long> m_deltaElapsed{0}; diff --git a/MuonSpectrometer/MuonIdHelpersAlgs/src/TestMuonIdHelpers.cxx b/MuonSpectrometer/MuonIdHelpersAlgs/src/TestMuonIdHelpers.cxx index 6cb950c02a130777da28783c103f11a567127d3c..d937dbe05b38ef13f2092ef76a89586ba35ebb4e 100644 --- a/MuonSpectrometer/MuonIdHelpersAlgs/src/TestMuonIdHelpers.cxx +++ b/MuonSpectrometer/MuonIdHelpersAlgs/src/TestMuonIdHelpers.cxx @@ -4,33 +4,11 @@ #include "MuonIdHelpersAlgs/TestMuonIdHelpers.h" -#include "MuonDigitContainer/MdtDigitContainer.h" -#include "MuonDigitContainer/MdtDigitCollection.h" -#include "MuonDigitContainer/MdtDigit.h" - -#include "MuonDigitContainer/CscDigitContainer.h" -#include "MuonDigitContainer/CscDigitCollection.h" -#include "MuonDigitContainer/CscDigit.h" - -#include "MuonDigitContainer/RpcDigitContainer.h" -#include "MuonDigitContainer/RpcDigitCollection.h" -#include "MuonDigitContainer/RpcDigit.h" - -#include "MuonDigitContainer/TgcDigitContainer.h" -#include "MuonDigitContainer/TgcDigitCollection.h" -#include "MuonDigitContainer/TgcDigit.h" - -#include "MuonReadoutGeometry/MuonDetectorManager.h" - #include <algorithm> #include <cmath> -///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// - TestMuonIdHelpers::TestMuonIdHelpers(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator), - m_activeStore("ActiveStoreSvc", name) { + AthAlgorithm(name, pSvcLocator) { m_testMDT = true; m_testCSC = true; @@ -51,10 +29,13 @@ StatusCode TestMuonIdHelpers::initialize(){ ATH_MSG_DEBUG(" in initialize()"); - ATH_CHECK(m_activeStore.retrieve()); - ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_mdtDigitContKey.initialize()); + ATH_CHECK(m_rpcDigitContKey.initialize()); + ATH_CHECK(m_cscDigitContKey.initialize()); + ATH_CHECK(m_tgcDigitContKey.initialize()); + return StatusCode::SUCCESS; } @@ -104,10 +85,12 @@ StatusCode TestMuonIdHelpers::testMdtIdHelper() const { // retrieve data from StoreGate typedef MdtDigitContainer::const_iterator collection_iterator; typedef MdtDigitCollection::const_iterator digit_iterator; - - std::string key = "MDT_DIGITS"; - const DataHandle <MdtDigitContainer> container; - ATH_CHECK( (*m_activeStore)->retrieve(container,key) ); + + SG::ReadHandle<MdtDigitContainer> container(m_mdtDigitContKey); + if (!container.isValid()) { + ATH_MSG_ERROR("Could not find MdtDigitContainer called " << container.name() << " in store " << container.store()); + return StatusCode::FAILURE; + } collection_iterator it1_coll= container->begin(); collection_iterator it2_coll= container->end(); @@ -121,7 +104,8 @@ StatusCode TestMuonIdHelpers::testMdtIdHelper() const { ++nc1; Identifier moduleId = mdtCollection->identify(); if (!m_idHelperSvc->mdtIdHelper().validElement(moduleId)) { - ATH_MSG_ERROR( "Invalid MDT module identifier " << m_idHelperSvc->mdtIdHelper().show_to_string(moduleId) ); + ATH_MSG_ERROR( "Invalid MDT module identifier " << m_idHelperSvc->mdtIdHelper().show_to_string(moduleId)); + return StatusCode::FAILURE; } digit_iterator it1_digit = mdtCollection->begin(); digit_iterator it2_digit = mdtCollection->end(); @@ -138,9 +122,11 @@ StatusCode TestMuonIdHelpers::testMdtIdHelper() const { } ATH_MSG_DEBUG(" Number of MDT Collections Accessed " << nc1 ); - if(error) ATH_MSG_ERROR( "Check of MDT ids FAILED " ); - else ATH_MSG_INFO( "Check of MDT ids OK " ); - + if(error) { + ATH_MSG_ERROR( "Check of MDT ids FAILED " ); + return StatusCode::FAILURE; + } + else ATH_MSG_INFO( "Check of MDT ids OK " ); return StatusCode::SUCCESS; } @@ -158,10 +144,12 @@ StatusCode TestMuonIdHelpers::testCscIdHelper() const { // retrieve data from StoreGate typedef CscDigitContainer::const_iterator collection_iterator; typedef CscDigitCollection::const_iterator digit_iterator; - - std::string key = "CSC_DIGITS"; - const DataHandle <CscDigitContainer> container; - ATH_CHECK( (*m_activeStore)->retrieve(container,key) ); + + SG::ReadHandle<CscDigitContainer> container(m_cscDigitContKey); + if (!container.isValid()) { + ATH_MSG_ERROR("Could not find CscDigitContainer called " << container.name() << " in store " << container.store()); + return StatusCode::FAILURE; + } collection_iterator it1_coll= container->begin(); collection_iterator it2_coll= container->end(); @@ -175,7 +163,8 @@ StatusCode TestMuonIdHelpers::testCscIdHelper() const { ++nc1; Identifier moduleId = cscCollection->identify(); if (!m_idHelperSvc->cscIdHelper().validElement(moduleId)) { - ATH_MSG_ERROR( "Invalid CSC module identifier " << m_idHelperSvc->cscIdHelper().show_to_string(moduleId) ); + ATH_MSG_ERROR( "Invalid CSC module identifier " << m_idHelperSvc->cscIdHelper().show_to_string(moduleId)); + return StatusCode::FAILURE; } digit_iterator it1_digit = cscCollection->begin(); digit_iterator it2_digit = cscCollection->end(); @@ -192,9 +181,10 @@ StatusCode TestMuonIdHelpers::testCscIdHelper() const { } ATH_MSG_DEBUG("Number of CSC Collections Accessed " << nc1 ); - if(error) ATH_MSG_ERROR( "Check of CSC ids FAILED " ); - else ATH_MSG_INFO( "Check of CSC ids OK " ); - + if(error) { + ATH_MSG_ERROR( "Check of CSC ids FAILED " ); + return StatusCode::FAILURE; + } else ATH_MSG_INFO( "Check of CSC ids OK " ); return StatusCode::SUCCESS; } @@ -211,10 +201,12 @@ StatusCode TestMuonIdHelpers::testRpcIdHelper() const { // retrieve data from StoreGate typedef RpcDigitContainer::const_iterator collection_iterator; typedef RpcDigitCollection::const_iterator digit_iterator; - - std::string key = "RPC_DIGITS"; - const DataHandle <RpcDigitContainer> container; - ATH_CHECK( (*m_activeStore)->retrieve(container,key) ); + + SG::ReadHandle<RpcDigitContainer> container(m_rpcDigitContKey); + if (!container.isValid()) { + ATH_MSG_ERROR("Could not find RpcDigitContainer called " << container.name() << " in store " << container.store()); + return StatusCode::FAILURE; + } collection_iterator it1_coll= container->begin(); collection_iterator it2_coll= container->end(); @@ -228,7 +220,8 @@ StatusCode TestMuonIdHelpers::testRpcIdHelper() const { ++nc1; Identifier moduleId = rpcCollection->identify(); if (!m_idHelperSvc->rpcIdHelper().validElement(moduleId)) { - ATH_MSG_ERROR( "Invalid RPC module identifier " << m_idHelperSvc->rpcIdHelper().show_to_string(moduleId) ); + ATH_MSG_ERROR( "Invalid RPC module identifier " << m_idHelperSvc->rpcIdHelper().show_to_string(moduleId)); + return StatusCode::FAILURE; } digit_iterator it1_digit = rpcCollection->begin(); digit_iterator it2_digit = rpcCollection->end(); @@ -245,8 +238,11 @@ StatusCode TestMuonIdHelpers::testRpcIdHelper() const { } ATH_MSG_DEBUG(" Number of RPC Collections Accessed " << nc1 ); - if(error) ATH_MSG_ERROR( "Check of RPC ids FAILED " ); - else ATH_MSG_INFO( "Check of RPC ids OK " ); + if(error) { + ATH_MSG_ERROR("Check of RPC ids FAILED"); + return StatusCode::FAILURE; + } + else ATH_MSG_INFO( "Check of RPC ids OK " ); return StatusCode::SUCCESS; } @@ -264,10 +260,12 @@ StatusCode TestMuonIdHelpers::testTgcIdHelper() const { // retrieve data from StoreGate typedef TgcDigitContainer::const_iterator collection_iterator; typedef TgcDigitCollection::const_iterator digit_iterator; - - std::string key = "TGC_DIGITS"; - const DataHandle <TgcDigitContainer> container; - ATH_CHECK( (*m_activeStore)->retrieve(container,key) ); + + SG::ReadHandle<TgcDigitContainer> container(m_tgcDigitContKey); + if (!container.isValid()) { + ATH_MSG_ERROR("Could not find TgcDigitContainer called " << container.name() << " in store " << container.store()); + return StatusCode::FAILURE; + } collection_iterator it1_coll= container->begin(); collection_iterator it2_coll= container->end(); @@ -281,7 +279,8 @@ StatusCode TestMuonIdHelpers::testTgcIdHelper() const { ++nc1; Identifier moduleId = tgcCollection->identify(); if (!m_idHelperSvc->tgcIdHelper().validElement(moduleId)) { - ATH_MSG_ERROR( "Invalid TGC module identifier " << m_idHelperSvc->tgcIdHelper().show_to_string(moduleId) ); + ATH_MSG_ERROR( "Invalid TGC module identifier " << m_idHelperSvc->tgcIdHelper().show_to_string(moduleId)); + return StatusCode::FAILURE; } digit_iterator it1_digit = tgcCollection->begin(); digit_iterator it2_digit = tgcCollection->end(); @@ -298,8 +297,10 @@ StatusCode TestMuonIdHelpers::testTgcIdHelper() const { } ATH_MSG_DEBUG("Number of TGC Collections Accessed " << nc1 ); - if(error) ATH_MSG_ERROR( "Check of TGC ids FAILED " ); - else ATH_MSG_INFO( "Check of TGC ids OK " ); + if(error) { + ATH_MSG_ERROR( "Check of TGC ids FAILED "); + return StatusCode::FAILURE; + } else ATH_MSG_INFO( "Check of TGC ids OK "); return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonOverlay/MM_Overlay/CMakeLists.txt b/MuonSpectrometer/MuonOverlay/MM_Overlay/CMakeLists.txt index 52e2bc5a1173ed537398b05765826c6d6b6d7e64..bef56ca280611b2bace427e25bb19bc9ed66b925 100644 --- a/MuonSpectrometer/MuonOverlay/MM_Overlay/CMakeLists.txt +++ b/MuonSpectrometer/MuonOverlay/MM_Overlay/CMakeLists.txt @@ -5,17 +5,6 @@ # Declare the package name: atlas_subdir( MM_Overlay ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonOverlay/MuonOverlayBase - PRIVATE - AtlasTest/TestTools - Control/StoreGate - MuonSpectrometer/MuonDigitization/MuonDigToolInterfaces - MuonSpectrometer/MuonIdHelpers ) - #External dependencies: find_package( GTest ) @@ -26,5 +15,4 @@ atlas_add_component( MM_Overlay LINK_LIBRARIES GaudiKernel MuonDigitContainer MuonOverlayBase StoreGateLib SGtests MuonIdHelpersLib ) # Install files from the package: -atlas_install_headers( MM_Overlay ) atlas_install_python_modules( python/*.py ) diff --git a/MuonSpectrometer/MuonOverlay/MdtOverlay/CMakeLists.txt b/MuonSpectrometer/MuonOverlay/MdtOverlay/CMakeLists.txt index 1324cf2ba4ec64d4007fd4159e48b70d841d38fd..320586900710bcd38caf90e20d50438dee556de4 100644 --- a/MuonSpectrometer/MuonOverlay/MdtOverlay/CMakeLists.txt +++ b/MuonSpectrometer/MuonOverlay/MdtOverlay/CMakeLists.txt @@ -5,17 +5,6 @@ # Declare the package name: atlas_subdir( MdtOverlay ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonOverlay/MuonOverlayBase - PRIVATE - AtlasTest/TestTools - Control/StoreGate - MuonSpectrometer/MuonDigitization/MuonDigToolInterfaces - MuonSpectrometer/MuonIdHelpers ) - #External dependencies: find_package( GTest ) @@ -31,5 +20,4 @@ atlas_add_component( MdtOverlay LINK_LIBRARIES GaudiKernel MuonDigitContainer MuonOverlayBase StoreGateLib SGtests MuonIdHelpersLib ) # Install files from the package: -atlas_install_headers( MdtOverlay ) atlas_install_python_modules( python/*.py ) diff --git a/MuonSpectrometer/MuonOverlay/MuonOverlayBase/CMakeLists.txt b/MuonSpectrometer/MuonOverlay/MuonOverlayBase/CMakeLists.txt index ad4acd746af6c4d603f6566521352b2593662350..12716a6795bf0157cd2ae7b3a4bdbd4dc4be8e15 100644 --- a/MuonSpectrometer/MuonOverlay/MuonOverlayBase/CMakeLists.txt +++ b/MuonSpectrometer/MuonOverlay/MuonOverlayBase/CMakeLists.txt @@ -5,10 +5,6 @@ # Declare the package name: atlas_subdir( MuonOverlayBase ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Event/EventOverlay/IDC_OverlayBase ) - # Component(s) in the package: atlas_add_library( MuonOverlayBase PUBLIC_HEADERS MuonOverlayBase diff --git a/MuonSpectrometer/MuonOverlay/RpcOverlay/CMakeLists.txt b/MuonSpectrometer/MuonOverlay/RpcOverlay/CMakeLists.txt index e61b2a39a277c2723995e30308bd49e976635bd8..93d80ac725e350d640dd01fb9048cf1c75f70fe7 100644 --- a/MuonSpectrometer/MuonOverlay/RpcOverlay/CMakeLists.txt +++ b/MuonSpectrometer/MuonOverlay/RpcOverlay/CMakeLists.txt @@ -5,17 +5,6 @@ # Declare the package name: atlas_subdir( RpcOverlay ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonOverlay/MuonOverlayBase - PRIVATE - AtlasTest/TestTools - Control/StoreGate - MuonSpectrometer/MuonDigitization/MuonDigToolInterfaces - MuonSpectrometer/MuonIdHelpers ) - #External dependencies: find_package( GTest ) @@ -31,5 +20,4 @@ atlas_add_component( RpcOverlay LINK_LIBRARIES GaudiKernel MuonDigitContainer MuonOverlayBase StoreGateLib SGtests MuonIdHelpersLib ) # Install files from the package: -atlas_install_headers( RpcOverlay ) atlas_install_python_modules( python/*.py ) diff --git a/MuonSpectrometer/MuonOverlay/STGC_Overlay/CMakeLists.txt b/MuonSpectrometer/MuonOverlay/STGC_Overlay/CMakeLists.txt index 6dcd2d16275d108cf8beec91a2a894925925ca31..0a4321b55f7cea248dc7bf35429813850c471f27 100644 --- a/MuonSpectrometer/MuonOverlay/STGC_Overlay/CMakeLists.txt +++ b/MuonSpectrometer/MuonOverlay/STGC_Overlay/CMakeLists.txt @@ -5,17 +5,6 @@ # Declare the package name: atlas_subdir( STGC_Overlay ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonOverlay/MuonOverlayBase - PRIVATE - AtlasTest/TestTools - Control/StoreGate - MuonSpectrometer/MuonDigitization/MuonDigToolInterfaces - MuonSpectrometer/MuonIdHelpers ) - #External dependencies: find_package( GTest ) @@ -26,5 +15,4 @@ atlas_add_component( STGC_Overlay LINK_LIBRARIES GaudiKernel MuonDigitContainer MuonOverlayBase StoreGateLib SGtests MuonIdHelpersLib ) # Install files from the package: -atlas_install_headers( STGC_Overlay ) atlas_install_python_modules( python/*.py ) diff --git a/MuonSpectrometer/MuonOverlay/TgcOverlay/CMakeLists.txt b/MuonSpectrometer/MuonOverlay/TgcOverlay/CMakeLists.txt index bc66da952662d5feb4c5950d924c29bdcd770a1f..e84f51f36c80d76559eb03cfa81f328652dfb05f 100644 --- a/MuonSpectrometer/MuonOverlay/TgcOverlay/CMakeLists.txt +++ b/MuonSpectrometer/MuonOverlay/TgcOverlay/CMakeLists.txt @@ -5,18 +5,6 @@ # Declare the package name: atlas_subdir( TgcOverlay ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - GaudiKernel - MuonSpectrometer/MuonDigitContainer - MuonSpectrometer/MuonOverlay/MuonOverlayBase - PRIVATE - AtlasTest/TestTools - Control/AthenaKernel - Control/StoreGate - MuonSpectrometer/MuonDigitization/MuonDigToolInterfaces - MuonSpectrometer/MuonIdHelpers ) - #External dependencies: find_package( GTest ) @@ -32,5 +20,4 @@ atlas_add_component( TgcOverlay LINK_LIBRARIES GaudiKernel MuonDigitContainer MuonOverlayBase AthenaKernel StoreGateLib SGtests MuonIdHelpersLib ) # Install files from the package: -atlas_install_headers( TgcOverlay ) atlas_install_python_modules( python/*.py ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/CMakeLists.txt index 41f0ed2c3929d43876bd0f9e45795f10e356e1d2..add0bc5e92deeff7f3a177b90339b916ebc9316e 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools/CMakeLists.txt @@ -44,10 +44,10 @@ atlas_add_library( MuonRecHelperToolsLib PUBLIC_HEADERS MuonRecHelperTools PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES AthenaBaseComps Identifier GaudiKernel MuonPattern MuonSegment TrkParameters TrkToolInterfaces MuonIdHelpersLib - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks xAODMuon MuonCompetingRIOsOnTrack MuonPrepRawData MuonRIO_OnTrack MuonRecToolInterfaces TrkSurfaces TrkEventPrimitives TrkMeasurementBase TrkPrepRawData TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkTrack TrkTrackSummary TrkExInterfaces ) + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks xAODMuon MuonCompetingRIOsOnTrack MuonPrepRawData MuonRIO_OnTrack MuonRecToolInterfaces TrkSurfaces TrkEventPrimitives TrkMeasurementBase TrkPrepRawData TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkTrack TrkTrackSummary TrkExInterfaces MuonSegmentMakerToolInterfaces xAODMuonCnvLib ) atlas_add_component( MuonRecHelperTools src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps Identifier GaudiKernel MuonPattern MuonSegment TrkParameters TrkToolInterfaces AthLinks xAODMuon MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonPrepRawData MuonRIO_OnTrack MuonRecToolInterfaces TrkSurfaces TrkEventPrimitives TrkMeasurementBase TrkPrepRawData TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkTrack TrkTrackSummary TrkExInterfaces MuonRecHelperToolsLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps Identifier GaudiKernel MuonPattern MuonSegment TrkParameters TrkToolInterfaces AthLinks xAODMuon MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonPrepRawData MuonRIO_OnTrack MuonRecToolInterfaces TrkSurfaces TrkEventPrimitives TrkMeasurementBase TrkPrepRawData TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkTrack TrkTrackSummary TrkExInterfaces MuonRecHelperToolsLib MuonSegmentMakerToolInterfaces xAODMuonCnvLib ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/CMakeLists.txt index f323bc02c0d2c47dffdc769421d754fc0c3cc015..c80e90f35fb3cf2e25b32061bd9b54ccafa1ad5d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/CMakeLists.txt @@ -51,4 +51,4 @@ atlas_add_component( MuonTruthTools MuonRecToolInterfaces MuonTrackMakerUtils MuonSimData TrkDetElementBase TrkSurfaces TrkMeasurementBase TrkParameters TrkPrepRawData TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkTrack TrkTruthData - TrkExInterfaces TrkFitterInterfaces TrackRecordLib ) + TrkExInterfaces TrkFitterInterfaces TrackRecordLib TrkTruthTrackInterfaces ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/CMakeLists.txt index 60ca416ad36c64018253222d12626fa9053b95f3..8a04cb691eb5bb87c8453acb09855a2a0c103e0d 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/CMakeLists.txt @@ -46,5 +46,5 @@ atlas_add_component( MooSegmentCombinationFinder src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonChamberT0s MuonPattern MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonLinearSegmentMakerUtilities MuonSegmentMakerUtils MuonEDM_AssociationObjects TrkSurfaces TrkEventPrimitives TrkParameters TrkSegment TrkTrack TrkTruthData TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AtlasHepMCLib AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonChamberT0s MuonPattern MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonLinearSegmentMakerUtilities MuonSegmentMakerUtils MuonEDM_AssociationObjects TrkSurfaces TrkEventPrimitives TrkParameters TrkSegment TrkTrack TrkTruthData TrkExInterfaces TrkFitterInterfaces TrkToolInterfaces MuonSegmentCombinerToolInterfaces MuonSegmentMakerToolInterfaces CscSegmentMakersLib MuonPatternSegmentMakerLib MuonRecToolInterfaces ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/CMakeLists.txt index a10513d9f89a01e5155cdc43753252d87fdabd1b..4dc59bec52a2862bd5b72822e44ab5fd365fa892 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/CMakeLists.txt @@ -5,21 +5,6 @@ # Declare the package name: atlas_subdir( MdtSegmentT0Fitter ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - GaudiKernel - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibSvc - MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerInterfaces - Tracking/TrkUtilityPackages/TrkDriftCircleMath - PRIVATE - MuonSpectrometer/MuonCalib/MdtCalib/MdtCalibData - MuonSpectrometer/MuonCalib/MuonCalibTools - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack ) - # External dependencies: find_package( ROOT COMPONENTS Minuit Core Tree MathCore Hist RIO pthread MathMore Minuit2 Matrix Physics HistPainter Rint ) @@ -32,4 +17,3 @@ atlas_add_component( MdtSegmentT0Fitter # Install files from the package: atlas_install_headers( MdtSegmentT0Fitter ) - diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/MdtSegmentT0Fitter/MdtSegmentT0Fitter.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/MdtSegmentT0Fitter/MdtSegmentT0Fitter.h index a2813ee3795f7cca67216b47868be8e25f8d92b3..76b0e27f529047c92f0a010f090e5b7a4a9624b9 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/MdtSegmentT0Fitter/MdtSegmentT0Fitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/MdtSegmentT0Fitter/MdtSegmentT0Fitter.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 */ // Fitting for in situ calibration of segments @@ -19,9 +19,7 @@ #include <vector> #include <memory> -class IIdToFixedIdTool; -class MdtCalibrationDbTool; -class TMinuit; +#include "TMinuit.h" namespace TrkDriftCircleMath { @@ -29,13 +27,12 @@ namespace TrkDriftCircleMath { public: MdtSegmentT0Fitter(const std::string&,const std::string&,const IInterface*); - virtual ~MdtSegmentT0Fitter (); + virtual ~MdtSegmentT0Fitter()=default; virtual StatusCode initialize() override; - virtual StatusCode finalize () override; + virtual StatusCode finalize() override; virtual bool fit( Segment& result, const Line& line, const DCOnTrackVec& dcs, double t0Seed ) const override; virtual bool fit( Segment& result, const Line& line, const DCOnTrackVec& dcs, const HitSelection& selection, double t0Seed ) const override; - virtual const DCSLFitter* getFitter() const override { return this; } @@ -60,23 +57,21 @@ namespace TrkDriftCircleMath { }; private: - bool m_trace; // debug - traces operation - bool m_dumpToFile; // debug - dumps some performance info - bool m_dumpNoFit; // debug - print hit info where fit doesn't run - - bool m_useInternalRT; // whether to use an internal RT function or the one from Calibration Service - ToolHandle<MdtCalibrationDbTool> m_calibrationDbTool; - - int m_minHits; // minimum number of selected hits for t0 fit. Otherwise use default - - bool m_constrainShifts; // whether to constrain t0 shifts to a 50 ns window - double m_constrainT0Error; // t0 error that is used in the constraint - bool m_rejectWeakTopologies; // Reject topolgies that do not have at least one +- combination in one Multilayer - bool m_scaleErrors; //!< rescale errors in fit - - bool m_propagateErrors; //!< propagate errors - - TMinuit* m_minuit; + ToolHandle<MdtCalibrationDbTool> m_calibrationDbTool{this,"CalibrationDbTool","MdtCalibrationDbTool"}; + + Gaudi::Property<bool> m_trace{this,"TraceOperation",false,"debug - traces operation"}; + Gaudi::Property<bool> m_dumpToFile{this,"DumpToFile",false,"debug - dumps some performance info"}; + Gaudi::Property<bool> m_dumpNoFit{this,"DumpNoFit",false,"debug - print hit info where fit does not run"}; + Gaudi::Property<bool> m_useInternalRT{this,"UseInternalRT",false,"whether to use an internal RT function or the one from Calibration Service"}; + Gaudi::Property<bool> m_constrainShifts{this,"ConstrainShifts",false,"whether to constrain t0 shifts to a 50 ns window"}; + Gaudi::Property<bool> m_rejectWeakTopologies{this,"RejectWeakTopologies",true,"reject topolgies that do not have at least one +- combination in one multilayer"}; + Gaudi::Property<bool> m_scaleErrors{this,"RescaleErrors",true,"rescale errors in fit"}; + Gaudi::Property<bool> m_propagateErrors{this,"PropagateErrors",true,"propagate errors"}; + Gaudi::Property<int> m_minHits{this,"MinimumHits",4,"minimum number of selected hits for t0 fit. Otherwise use default"}; + Gaudi::Property<double> m_constrainT0Error{this,"ConstrainT0Error",10,"t0 error that is used in the constraint"}; + Gaudi::Property<float> m_dRTol{this,"dRTolerance",0.1}; + + std::unique_ptr<TMinuit> m_minuit; // counters mutable std::atomic_uint m_ntotalCalls; @@ -86,7 +81,6 @@ namespace TrkDriftCircleMath { mutable std::atomic_uint m_npassedMinHits; mutable std::atomic_uint m_npassedMinuitFit; - std::unique_ptr<MdtSegmentT0FcnData> m_fcnData; //!< Struct to hold data to pass to/from TMinuit fit function }; inline bool MdtSegmentT0Fitter::fit( Segment& result, const Line& line, const DCOnTrackVec& dcs, double t0Seed ) const { @@ -95,6 +89,4 @@ namespace TrkDriftCircleMath { } } - - #endif diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/src/MdtSegmentT0Fitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/src/MdtSegmentT0Fitter.cxx index aebf4ebb2e41f02934b3b8751e75a1f8d43163b7..60f43aac7fe2133b773a84ddf3e0b88304571d51 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/src/MdtSegmentT0Fitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MdtSegmentT0Fitter/src/MdtSegmentT0Fitter.cxx @@ -8,8 +8,6 @@ #include "MuonReadoutGeometry/MdtReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MdtCalibSvc/MdtCalibrationDbTool.h" -#include "MuonCalibTools/IdToFixedIdTool.h" #include "MdtCalibData/IRtRelation.h" #include "MdtCalibData/IRtResolution.h" #include "MdtCalibData/MdtRtRelation.h" @@ -22,10 +20,6 @@ #include <atomic> #include <mutex> -#include "TMinuit.h" -// tdc count bin size -- seems to be unused -> commenting for the moment as it would be wrong -// #define TDCBINSIZE 0.78125 //1tdc=0.78125ns; 1tdc=0.1953125ns for BMG! - // number of fit parameters #define NUMPAR 3 @@ -52,42 +46,19 @@ namespace TrkDriftCircleMath { MdtSegmentT0Fitter::MdtSegmentT0Fitter(const std::string& ty,const std::string& na,const IInterface* pa) : AthAlgTool(ty,na,pa), DCSLFitter(), - m_calibrationDbTool("MdtCalibrationDbTool",this), m_ntotalCalls(0), m_npassedNHits(0), m_npassedSelectionConsistency(0), m_npassedNSelectedHits(0), m_npassedMinHits(0), - m_npassedMinuitFit(0), - m_fcnData(std::make_unique<MdtSegmentT0FcnData>()) - { + m_npassedMinuitFit(0) { declareInterface <IDCSLFitProvider> (this); - declareProperty("MinimumHits", m_minHits = 4); - declareProperty("DumpToFile", m_dumpToFile = false); - declareProperty("UseInternalRT", m_useInternalRT = false); - declareProperty("TraceOperation", m_trace = false); - declareProperty("DumpNoFit", m_dumpNoFit = false); - declareProperty("ConstrainShifts", m_constrainShifts = false); - declareProperty("ConstrainT0Error", m_constrainT0Error = 10.); - declareProperty("RejectWeakTopologies", m_rejectWeakTopologies = true); - declareProperty("RescaleErrors",m_scaleErrors = true ); - declareProperty("PropagateErrors",m_propagateErrors = true ); - declareProperty("CalibrationDbTool",m_calibrationDbTool); } - - MdtSegmentT0Fitter::~MdtSegmentT0Fitter(){} - StatusCode MdtSegmentT0Fitter::initialize() { - ATH_CHECK ( AthAlgTool::initialize() ); - - m_fcnData->use_hardcoded = m_useInternalRT; - m_fcnData->use_shift_constraint = m_constrainShifts; - m_fcnData->constrainT0Error = m_constrainT0Error; - //count = 0; TMinuit* oldMinuit = gMinuit; - m_minuit = new TMinuit(3); + m_minuit = std::make_unique<TMinuit>(3); m_minuit->SetPrintLevel(-1); // -1: no output, 1: std output if( msgLvl(MSG::VERBOSE) ) m_minuit->SetPrintLevel(1); gMinuit = oldMinuit; @@ -106,9 +77,8 @@ namespace TrkDriftCircleMath { << " sel. hits > 2 " << std::setw(10) << m_npassedNSelectedHits << " " << scaleFactor*m_npassedNSelectedHits << "\n" << " Hits > min hits " << std::setw(10) << m_npassedMinHits << " " << scaleFactor*m_npassedMinHits << "\n" << " Passed Fit " << std::setw(10) << m_npassedMinuitFit << " " << scaleFactor*m_npassedMinuitFit ); - if( gMinuit == m_minuit ) gMinuit = 0; - delete m_minuit; - return AthAlgTool::finalize(); + if(gMinuit == m_minuit.get()) gMinuit = nullptr; + return StatusCode::SUCCESS; } @@ -119,7 +89,7 @@ namespace TrkDriftCircleMath { constexpr double T2R_A[] = {1.184169e-1, 3.32382e-2, 4.179808e-4, -5.012896e-6, 2.61497e-8, -7.800677e-11, 1.407393e-13, -1.516193e-16, 8.967997e-20, -2.238627e-23}; constexpr double RCORR_A[] = {234.3413, -5.803375, 5.061677e-2, -1.994959e-4, 4.017433e-7, -3.975037e-10, 1.522393e-13}; - double rcorr(double tin) { + double rcorr(const double tin) { double rc; if(tin < 16.) { rc = -50.; @@ -136,7 +106,7 @@ namespace TrkDriftCircleMath { return rc; } - double t2r(double tin) { + double t2r(const double tin) { if(tin < 0.) return 0.; if(tin > MAX_DRIFT) return 20.; @@ -152,7 +122,7 @@ namespace TrkDriftCircleMath { } /// derivatives of RT function, use to get errors - double rcorrprime(double tin) { + double rcorrprime(const double tin) { double rc; if(tin < 16.) { rc = 0.; @@ -169,7 +139,7 @@ namespace TrkDriftCircleMath { return rc; } - double t2rprime(double tin) { + double t2rprime(const double tin) { if(tin < 0.) return 0.; if(tin > MAX_DRIFT) return 20.; @@ -187,7 +157,7 @@ namespace TrkDriftCircleMath { /// use a binary search to get rt-inverse from rt /// assumes the function is monotonic, obviously not true for these polynomial parametrizations for all t - double r2t(double r) { + double r2t(const double r) { double ta = 0; double tb = MAX_DRIFT; if(r<t2r(ta) ) { @@ -200,7 +170,7 @@ namespace TrkDriftCircleMath { while (ta <= tb) { double tm = (ta + tb) / 2; // compute mid point. double rtm = t2r(tm); - if(fabs(rtm - r) < 0.001 ) { + if(std::abs(rtm - r) < 0.001 ) { return tm; } else if (r > rtm) { @@ -216,11 +186,8 @@ namespace TrkDriftCircleMath { return -1; // failed to find key } - double r2t_ext( std::vector<const MuonCalib::IRtRelation*> *rtpointers, double r, int i) { + double r2t_ext(std::vector<const MuonCalib::IRtRelation*> *rtpointers, double r, int i) { const MuonCalib::IRtRelation* rtrel = rtpointers->at(i); - // double ta = 0; - // double tb = - double ta = rtrel->tLower(); double tb = rtrel->tUpper(); if(r<rtrel->radius(ta) ) { @@ -233,7 +200,7 @@ namespace TrkDriftCircleMath { while (ta <= tb) { double tm = (ta + tb) / 2; // compute mid point. double rtm = rtrel->radius(tm); - if(fabs(rtm - r) < 0.001 ) { + if(std::abs(rtm - r) < 0.001 ) { return tm; } else if (r > rtm) { @@ -259,14 +226,8 @@ namespace TrkDriftCircleMath { double b = par[1]; double t0 = par[2]; - double cosin = cos(ang); - double sinus = sin(ang); -// if ( sinus < 0.0 ) { -// sinus = -sinus; -// cosin = -cosin; -// } else if ( sinus == 0.0 && cosin < 0.0 ) { -// cosin = -cosin; -// } + double cosin = std::cos(ang); + double sinus = std::sin(ang); fval = 0.; // Add t0 constraint @@ -281,7 +242,7 @@ namespace TrkDriftCircleMath { z = g_fcnData->data[i].z; y = g_fcnData->data[i].y; w = g_fcnData->data[i].w; - dist = fabs(b*cosin + z*sinus - y*cosin); // same thing as fabs(a*z - y + b)/sqrt(1. + a*a); + dist = std::abs(b*cosin + z*sinus - y*cosin); // same thing as fabs(a*z - y + b)/sqrt(1. + a*a); double uppercut = g_fcnData->use_hardcoded ? TUBE_TIME : g_fcnData->data[i].rt->tUpper(); double lowercut = g_fcnData->use_hardcoded ? 0 : g_fcnData->data[i].rt->tLower(); // Penalty for t<lowercut and t >uppercut @@ -315,12 +276,19 @@ namespace TrkDriftCircleMath { bool MdtSegmentT0Fitter::fit( Segment& result, const Line& line, const DCOnTrackVec& dcs, const HitSelection& selection, double t0Seed ) const { ++m_ntotalCalls; - if(m_trace) ATH_MSG_DEBUG( "New seg: " ); + if(m_trace) ATH_MSG_DEBUG("New seg: "); const DCOnTrackVec& dcs_keep = dcs; unsigned int N = dcs_keep.size(); - m_fcnData->used=0; + + std::unique_ptr<MdtSegmentT0FcnData> fcnData = std::make_unique<MdtSegmentT0FcnData>(); + fcnData->use_hardcoded = m_useInternalRT; + fcnData->use_shift_constraint = m_constrainShifts; + fcnData->constrainT0Error = m_constrainT0Error; + + + fcnData->used=0; result.setT0Shift(-99999,-99999); if(N<2) { @@ -328,21 +296,20 @@ namespace TrkDriftCircleMath { } ++m_npassedNHits; if( selection.size() != N ) { - ATH_MSG_ERROR( "MdtSegmentT0Fitter.cxx:fit with t0 <bad HitSelection>" ); + ATH_MSG_ERROR("MdtSegmentT0Fitter.cxx:fit with t0 <bad HitSelection>"); return false; } ++m_npassedSelectionConsistency; for(unsigned int i=0;i<N;++i){ - if( selection[i] == 0 ) ++(m_fcnData->used); - // if(m_trace) *m_log << MSG::DEBUG << " selection flag " << selection[i] << endmsg; + if( selection[i] == 0 ) ++(fcnData->used); } - if(m_fcnData->used < 2){ - if(m_trace) ATH_MSG_DEBUG( "TOO FEW HITS SELECTED" ); + if(fcnData->used < 2){ + if(m_trace) ATH_MSG_DEBUG("TOO FEW HITS SELECTED"); return false; } ++m_npassedNSelectedHits; - if(m_fcnData->used < m_minHits) { - if(m_trace) ATH_MSG_DEBUG( "FEWER THAN Minimum HITS N " << m_minHits << " total hits " <<N<<" used " << m_fcnData->used ); + if(fcnData->used < m_minHits) { + if(m_trace) ATH_MSG_DEBUG("FEWER THAN Minimum HITS N " << m_minHits << " total hits " <<N<<" used " << fcnData->used); // // Copy driftcircles and reset the drift radii as they might have been overwritten @@ -357,7 +324,7 @@ namespace TrkDriftCircleMath { double chi2p = 0.; for(int i=0; it!=it_end; ++it, ++i ){ const DriftCircle* ds = & dcs[i]; - if(fabs(ds->r()-ds->rot()->driftRadius())>0.1&&m_trace) std::cout << " Different radii on dc " << ds->r() << " rot " << ds->rot()->driftRadius() << std::endl; + if(std::abs(ds->r()-ds->rot()->driftRadius())>m_dRTol && m_trace) ATH_MSG_DEBUG("Different radii on dc " << ds->r() << " rot " << ds->rot()->driftRadius()); DriftCircle dc_keep(ds->position(), ds->rot()->driftRadius(), ds->dr(), ds->drPrecise(), ds->state(), ds->id(), ds->index(),ds->rot() ); DCOnTrack dc_new(dc_keep, 0., 0.); dc_new.state(dcs[i].state()); @@ -371,58 +338,60 @@ namespace TrkDriftCircleMath { if(t>tUp) chi2p += (t-tUp)*(t-tUp)*0.1; } } - if(m_trace&&chi2p>0) std::cout << " NO Minuit Fit TOO few hits Chi2 penalty " << chi2p << std::endl; + if(m_trace&&chi2p>0) ATH_MSG_DEBUG("NO Minuit Fit TOO few hits Chi2 penalty " << chi2p); bool oldrefit = DCSLFitter::fit( result, line, dcs_new, selection ); chi2p += result.chi2(); // add chi2 penalty for too large or too small driftTimes t < 0 or t> t upper - result.set( chi2p, result.ndof(), result.dtheta(), result.dy0() ); + result.set(chi2p, result.ndof(), result.dtheta(), result.dy0()); int iok = 0; if(oldrefit) iok = 1; - if(m_trace) std::cout << " chi2 total " << result.chi2() << " angle " << result.line().phi() << " y0 " << result.line().y0() << " nhits "<< selection.size() << " refit ok " << iok << std::endl; + if(m_trace) ATH_MSG_DEBUG(" chi2 total " << result.chi2() << " angle " << result.line().phi() << " y0 " << result.line().y0() << " nhits "<< selection.size() << " refit ok " << iok); return oldrefit; } else { - if(m_trace) ATH_MSG_DEBUG( "FITTING FOR T0 N "<<N<<" used " << m_fcnData->used ); + if(m_trace) ATH_MSG_DEBUG("FITTING FOR T0 N "<<N<<" used " << fcnData->used); } ++m_npassedMinHits; - - - if (m_trace) ATH_MSG_DEBUG(" in MdtSegmentT0Fitter::fit with N dcs "<< N << " hit selection size " << selection.size() ); - if(m_trace) ATH_MSG_DEBUG("in fit "<<result.hasT0Shift()<< " " <<result.t0Shift() ); + if (m_trace) { + ATH_MSG_DEBUG(" in MdtSegmentT0Fitter::fit with N dcs "<< N << " hit selection size " << selection.size()); + ATH_MSG_DEBUG("in fit "<<result.hasT0Shift()<< " " <<result.t0Shift()); + } - double Zc=0, Yc=0, S=0, Sz=0, Sy=0; + double Zc(0); + double Yc(0); + double S(0); + double Sz(0); + double Sy(0); std::vector<double> y(N); std::vector<double> z(N); std::vector<double> w(N); std::vector<double> r(N); std::vector<double> dr(N); std::vector<double> t(N); - // std::vector<double> driftt(N); std::vector<const MuonCalib::IRtRelation*> rtpointers(N); // allocate memory for data - // allocate memory for data - if( m_fcnData->data.capacity() != 50 ) m_fcnData->data.reserve(50); - m_fcnData->data.resize(m_fcnData->used); + if(fcnData->data.capacity() != 50) fcnData->data.reserve(50); + fcnData->data.resize(fcnData->used); { DCOnTrackVec::const_iterator it = dcs_keep.begin(); DCOnTrackVec::const_iterator it_end = dcs_keep.end(); for(int ii=0 ;it!=it_end; ++it, ++ii ){ const Muon::MdtDriftCircleOnTrack *roto = it->rot(); if (!roto) { - ATH_MSG_ERROR(" MdtSegmentT0Fitter: NO DC ROT pointer found " ); + ATH_MSG_ERROR("MdtSegmentT0Fitter: NO DC ROT pointer found"); return false; } - ATH_MSG_DEBUG( "hit # "<<ii ); + ATH_MSG_DEBUG("hit # "<<ii ); y[ii] = it->y(); z[ii] = it->x(); - r[ii] = std::abs( roto->driftRadius() ); + r[ii] = std::abs(roto->driftRadius()); dr[ii] = it->dr(); const Muon::MdtPrepData *peerd; - peerd = dynamic_cast<const Muon::MdtPrepData*>( roto->prepRawData() ); + peerd = dynamic_cast<const Muon::MdtPrepData*>(roto->prepRawData()); if(!peerd) { - ATH_MSG_ERROR("MdtSegmentT0Fitter: Can't convert to MdtPrepData* !! Not fitting for t0" ); + ATH_MSG_ERROR("MdtSegmentT0Fitter: Can't convert to MdtPrepData* !! Not fitting for t0"); return false; } Identifier id = roto->identify(); @@ -437,17 +406,17 @@ namespace TrkDriftCircleMath { w[ii]*=w[ii]; if(r[ii]<0){ r[ii] = 0.; - if(m_trace) ATH_MSG_DEBUG( "MdtSegmentT0Fitter (using times) ERROR: <Negative r> " << r[ii] ); + if(m_trace) ATH_MSG_DEBUG("MdtSegmentT0Fitter (using times) ERROR: <Negative r> " << r[ii]); } - if(m_trace) ATH_MSG_DEBUG( "DC: (" << y[ii] << "," << z[ii] << ") R = " << r[ii] << " W " << w[ii] <<" t " <<t[ii]<< " id: "<<it->id()<<" sel " << selection[ii] ); + if(m_trace) ATH_MSG_DEBUG("DC: (" << y[ii] << "," << z[ii] << ") R = " << r[ii] << " W " << w[ii] <<" t " <<t[ii]<< " id: "<<it->id()<<" sel " << selection[ii]); if( selection[ii] == 0 ){ S+=w[ii]; Sz+= w[ii]*z[ii]; Sy+= w[ii]*y[ii]; if(r[ii] > MAX_RAD ) { - if(m_trace) ATH_MSG_DEBUG("Radius is too big" ); + if(m_trace) ATH_MSG_DEBUG("Radius is too big"); } } } @@ -456,7 +425,7 @@ namespace TrkDriftCircleMath { Zc = Sz*inv_S; Yc = Sy*inv_S; - if(m_trace) ATH_MSG_DEBUG( "Yc " << Yc << " Zc " << Zc ); + if(m_trace) ATH_MSG_DEBUG("Yc " << Yc << " Zc " << Zc); /// go to coordinates centered at the average of the hits for(unsigned int i=0;i<N;++i) { @@ -468,8 +437,8 @@ namespace TrkDriftCircleMath { DCOnTrackVec::const_iterator it = dcs_keep.begin(); DCOnTrackVec::const_iterator it_end = dcs_keep.end(); - m_fcnData->t_lo = 1e10; - m_fcnData->t_hi = -1e10; + fcnData->t_lo = 1e10; + fcnData->t_hi = -1e10; // replicate for the case where the external rt is used... // each hit has an rt function with some range...we want to fit such that // tlower_i < ti - t0 < tupper_i @@ -484,13 +453,13 @@ namespace TrkDriftCircleMath { for(int ii=0 ;it!=it_end; ++it, ++ii ){ if( selection[ii] == 0 ) { - m_fcnData->data[selcount].z = z[ii]; - m_fcnData->data[selcount].y = y[ii]; - m_fcnData->data[selcount].r = r[ii]; - m_fcnData->data[selcount].w = w[ii]; - m_fcnData->data[selcount].rt = rtpointers[ii]; + fcnData->data[selcount].z = z[ii]; + fcnData->data[selcount].y = y[ii]; + fcnData->data[selcount].r = r[ii]; + fcnData->data[selcount].w = w[ii]; + fcnData->data[selcount].rt = rtpointers[ii]; double r2tval; - if(m_fcnData->use_hardcoded) { + if(fcnData->use_hardcoded) { r2tval = r2t(r[ii]); } else { r2tval = r2t_ext(&rtpointers, r[ii], ii) ; @@ -507,7 +476,7 @@ namespace TrkDriftCircleMath { <<" r "<<r[ii] <<" t "<<t[ii] <<" t0 "<<tee0; - if(!m_fcnData->use_hardcoded) { + if(!fcnData->use_hardcoded) { msg() << MSG::DEBUG <<" tLower "<<tl; msg() << MSG::DEBUG <<" tUpper "<<th; } @@ -515,26 +484,26 @@ namespace TrkDriftCircleMath { } t0seed += tee0; st0 += tee0*tee0; - if(tee0 < min_t0 && fabs(r2tval) < R2TSPURIOUS) min_t0 = tee0; + if(tee0 < min_t0 && std::abs(r2tval) < R2TSPURIOUS) min_t0 = tee0; - m_fcnData->data[selcount].t = t[ii]; - if(t[ii]< m_fcnData->t_lo) m_fcnData->t_lo = t[ii]; - if(t[ii] > m_fcnData->t_hi) m_fcnData->t_hi = t[ii]; + fcnData->data[selcount].t = t[ii]; + if(t[ii]< fcnData->t_lo) fcnData->t_lo = t[ii]; + if(t[ii] > fcnData->t_hi) fcnData->t_hi = t[ii]; selcount++; } } t0seed /= selcount; st0 = st0/selcount - t0seed*t0seed; - st0 = st0 > 0. ? sqrt(st0) : 0.; - m_fcnData->t_hi -= MAX_DRIFT; + st0 = st0 > 0. ? std::sqrt(st0) : 0.; + fcnData->t_hi -= MAX_DRIFT; - if(!m_fcnData->use_hardcoded) { - m_fcnData->t_hi = max_tupper; - m_fcnData->t_lo = min_tlower; + if(!fcnData->use_hardcoded) { + fcnData->t_hi = max_tupper; + fcnData->t_lo = min_tlower; } - if(m_trace) ATH_MSG_DEBUG("t_hi "<<m_fcnData->t_hi<<" t_lo "<<m_fcnData->t_lo<<" t0seed "<<t0seed<<" sigma "<<st0<< " min_t0 "<<min_t0 ); - if(m_fcnData->t_hi > m_fcnData->t_lo ) { + if(m_trace) ATH_MSG_DEBUG("t_hi "<<fcnData->t_hi<<" t_lo "<<fcnData->t_lo<<" t0seed "<<t0seed<<" sigma "<<st0<< " min_t0 "<<min_t0); + if(fcnData->t_hi > fcnData->t_lo ) { if(m_dumpNoFit) { std::ofstream gg; gg.open("fitnotdone.txt", std::ios::out | std::ios::app); @@ -566,8 +535,8 @@ namespace TrkDriftCircleMath { // ************************* seed the parameters double theta = line.phi(); - double cosin = cos(theta); - double sinus = sin(theta); + double cosin = std::cos(theta); + double sinus = std::sin(theta); if ( sinus < 0.0 ) { sinus = -sinus; @@ -575,15 +544,15 @@ namespace TrkDriftCircleMath { } else if ( sinus == 0.0 && cosin < 0.0 ) { cosin = -cosin; } - if(m_trace) ATH_MSG_DEBUG("before fit theta "<<theta<<" sinus "<<sinus<< " cosin "<< cosin ); + if(m_trace) ATH_MSG_DEBUG("before fit theta "<<theta<<" sinus "<<sinus<< " cosin "<< cosin); double d = line.y0() + Zc*sinus-Yc*cosin; if(m_trace) { - ATH_MSG_DEBUG(" line x y "<<line.position().x()<<" "<<line.position().y() ); - ATH_MSG_DEBUG(" Zc Yc "<< Zc <<" "<<Yc ); - ATH_MSG_DEBUG(" line x0 y0 "<<line.x0()<<" "<<line.y0() ); - ATH_MSG_DEBUG(" hit shift " << -Zc*sinus+Yc*cosin ); + ATH_MSG_DEBUG(" line x y "<<line.position().x()<<" "<<line.position().y()); + ATH_MSG_DEBUG(" Zc Yc "<< Zc <<" "<<Yc); + ATH_MSG_DEBUG(" line x0 y0 "<<line.x0()<<" "<<line.y0()); + ATH_MSG_DEBUG(" hit shift " << -Zc*sinus+Yc*cosin); } // Calculate signed radii @@ -596,8 +565,7 @@ namespace TrkDriftCircleMath { it = dcs_keep.begin(); for(int ii=0 ;it!=it_end; ++it, ++ii ){ if( selection[ii] != 0 ) continue; - sdist = d*cosin + z[ii]*sinus - y[ii]*cosin; // same thing as fabs(a*z - y + b)/sqrt(1. + a*a); -// if (r[ii] < 1) continue; + sdist = d*cosin + z[ii]*sinus - y[ii]*cosin; // same thing as |a*z - y + b|/sqrt(1. + a*a); if(it->id().ml()==0&&sdist > 0) nml1p++; if(it->id().ml()==0&&sdist < 0) nml1n++; if(it->id().ml()==1&&sdist > 0) nml2p++; @@ -605,12 +573,12 @@ namespace TrkDriftCircleMath { } // Define t0 constraint in Minuit - m_fcnData->t0Error = STRONG_TOPO_T0ERROR; - if (nml1p+nml2p < 2 || nml1n+nml2n < 2) m_fcnData->t0Error = WEAK_TOPO_T0ERROR; + fcnData->t0Error = STRONG_TOPO_T0ERROR; + if (nml1p+nml2p < 2 || nml1n+nml2n < 2) fcnData->t0Error = WEAK_TOPO_T0ERROR; // Reject topologies where in one of the Multilayers no +- combination is present if((nml1p<1||nml1n<1)&&(nml2p<1||nml2n<1)&&m_rejectWeakTopologies) { - if(m_trace) ATH_MSG_DEBUG(" Combination rejected for positive radii ML1 " << nml1p << " ML2 " << nml2p << " negative radii ML1 " << nml1n << " ML " << nml2n << " used hits " << m_fcnData->used << " t0 Error " << m_fcnData->t0Error ); + if(m_trace) ATH_MSG_DEBUG("Combination rejected for positive radii ML1 " << nml1p << " ML2 " << nml2p << " negative radii ML1 " << nml1n << " ML " << nml2n << " used hits " << fcnData->used << " t0 Error " << fcnData->t0Error); it = dcs.begin(); it_end = dcs.end(); double chi2p = 0.; @@ -618,7 +586,7 @@ namespace TrkDriftCircleMath { dcs_new.reserve(dcs.size()); for(int i=0; it!=it_end; ++it, ++i ){ const DriftCircle* ds = & dcs[i]; - if(fabs(ds->r()-ds->rot()->driftRadius())>0.1&&m_trace) std::cout << " Different radii on dc " << ds->r() << " rot " << ds->rot()->driftRadius() << std::endl; + if(std::abs(ds->r()-ds->rot()->driftRadius())>m_dRTol && m_trace) ATH_MSG_DEBUG("Different radii on dc " << ds->r() << " rot " << ds->rot()->driftRadius()); DriftCircle dc_keep(ds->position(), ds->rot()->driftRadius(), ds->dr(), ds->drPrecise(), ds->state(), ds->id(), ds->index(),ds->rot() ); DCOnTrack dc_new(dc_keep, 0., 0.); dc_new.state(dcs[i].state()); @@ -632,7 +600,7 @@ namespace TrkDriftCircleMath { if(t>tUp) chi2p += (t-tUp)*(t-tUp)*0.1; } } - if(m_trace&&chi2p>0) ATH_MSG_DEBUG( " Rejected weak topology Chi2 penalty " << chi2p ); + if(m_trace&&chi2p>0) ATH_MSG_DEBUG(" Rejected weak topology Chi2 penalty " << chi2p); bool oldrefit = DCSLFitter::fit( result, line, dcs_new, selection ); chi2p += result.chi2(); // add chi2 penalty for too large or too small driftTimes t < 0 or t> t upper @@ -640,34 +608,7 @@ namespace TrkDriftCircleMath { return oldrefit; } // end rejection of weak topologies - if(m_trace) ATH_MSG_DEBUG(" positive radii ML1 " << nml1p << " ML2 " << nml2p << " negative radii ML1 " << nml1n << " ML " << nml2n << " used hits " << m_fcnData->used << " t0 Error " << m_fcnData->t0Error ); - -// m_minuit->BuildArrays(3); - m_minuit->SetFCN(mdtSegmentT0Fcn); - Double_t arglist[3]; - - // Set printout level - arglist[0] = -1; - // Clear previous fit - m_minuit->mncler(); - arglist[0] = -1; - - Double_t vstart[3]; - vstart[0] = theta; - // x' = x - xc, y' = y - yc => y' = m x' + b + m xc - yc - // and b = yc - m xc - vstart[1] = d ; - vstart[2] = 0 ; - - // if t0Seed value from outside use this - if(t0Seed > -999.) vstart[2] = t0Seed; - - Double_t step[3] = {0.01 , 0.01 , 0.1 }; - - if(m_trace) { - ATH_MSG_DEBUG("\n____________INITIAL VALUES________________" ); - ATH_MSG_DEBUG("Theta " << theta << "("<<tan(theta)<<") d " << vstart[1] ); - } + if(m_trace) ATH_MSG_DEBUG("positive radii ML1 " << nml1p << " ML2 " << nml2p << " negative radii ML1 " << nml1n << " ML " << nml2n << " used hits " << fcnData->used << " t0 Error " << fcnData->t0Error); int errFlag = 0; int errFlag1 = 0; @@ -675,21 +616,49 @@ namespace TrkDriftCircleMath { int errFlag3 = 0; int errFlag4 = 0; int errFlag5 = 0; - m_minuit->mnparm(0, "a", vstart[0], step[0], -0.5, 3.5,errFlag); - m_minuit->mnparm(1, "b", vstart[1], step[1], 0., 0.,errFlag); - // m_minuit->SetParameter(2, "t0", vstart[2], step[2], t_hi, t_lo,errFlag); - m_minuit->mnparm(2, "t0", vstart[2], step[2], 0., 0.,errFlag); - - if (errFlag !=0 &&m_trace) { - ATH_MSG_DEBUG( " ALARM with steering of Minuit variable " << errFlag ); - } - - m_minuit->FixParameter(0); - m_minuit->FixParameter(1); { // The part where the fcn gets used, requires locking to protect fcnData from concurrent access std::scoped_lock lock(g_fcnDataMutex); - g_fcnData = m_fcnData.get(); + g_fcnData = fcnData.get(); + + m_minuit->SetFCN(mdtSegmentT0Fcn); + Double_t arglist[3]; + + // Set printout level + arglist[0] = -1; + // Clear previous fit + m_minuit->mncler(); + arglist[0] = -1; + + Double_t vstart[3]; + vstart[0] = theta; + // x' = x - xc, y' = y - yc => y' = m x' + b + m xc - yc + // and b = yc - m xc + vstart[1] = d ; + vstart[2] = 0 ; + + // if t0Seed value from outside use this + if(t0Seed > -999.) vstart[2] = t0Seed; + + Double_t step[3] = {0.01 , 0.01 , 0.1 }; + + if(m_trace) { + ATH_MSG_DEBUG("\n____________INITIAL VALUES________________" ); + ATH_MSG_DEBUG("Theta " << theta << "("<<std::tan(theta)<<") d " << vstart[1]); + } + + + m_minuit->mnparm(0, "a", vstart[0], step[0], -0.5, 3.5,errFlag); + m_minuit->mnparm(1, "b", vstart[1], step[1], 0., 0.,errFlag); + m_minuit->mnparm(2, "t0", vstart[2], step[2], 0., 0.,errFlag); + + if (errFlag !=0 &&m_trace) { + ATH_MSG_DEBUG("ALARM with steering of Minuit variable " << errFlag); + } + + m_minuit->FixParameter(0); + m_minuit->FixParameter(1); + m_minuit->mnexcm("MINIMIZE", arglist, 0,errFlag1); m_minuit->Release(0); @@ -703,21 +672,23 @@ namespace TrkDriftCircleMath { if(errFlag5!=0&&errFlag4==0) { m_minuit->mnexcm("MINIMIZE", arglist, 0,errFlag4); if (errFlag4 == 0 &&m_trace) { - ATH_MSG_DEBUG( " ALARM Fall back to MINIMIZE " << errFlag4 ); + ATH_MSG_DEBUG(" ALARM Fall back to MINIMIZE " << errFlag4); } } g_fcnData = nullptr; - } + } // end of scoped_lock // Get the chisquare and errors - double chisq; - double edm; - double errdef; - int npari, nparx, icstat; + double chisq(0); + double edm(0); + double errdef(0); + int npari(0); + int nparx(0); + int icstat(0); m_minuit->mnstat(chisq, edm, errdef, npari, nparx, icstat); int fitretval = errFlag5; - if (npari<0 || nparx < 0 || chisq < 0) ATH_MSG_ERROR( " MdtSegmentT0Fitter MINUIT problem " << " chisq "<<chisq<<" npari "<<npari<<" nparx "<< nparx <<" fitretval "<< fitretval ); + if (npari<0 || nparx < 0 || chisq < 0) ATH_MSG_ERROR("MdtSegmentT0Fitter MINUIT problem " << " chisq "<<chisq<<" npari "<<npari<<" nparx "<< nparx <<" fitretval "<< fitretval); if (fitretval !=0 &&m_trace) { ATH_MSG_DEBUG( " ALARM return value " << fitretval ); @@ -725,19 +696,17 @@ namespace TrkDriftCircleMath { if(m_dumpToFile) { std::ofstream ff; ff.open("fitres.txt", std::ios::out | std::ios::app); -// ff << fitretval<<" 0 "<<chisq<<" "<<t_hi<<" "<<t_lo<<" "<<t0seed<<" "<<st0<<" "<<min_t0<<" "<<m_minuit->GetParameter(2)<<" "<<m_minuit->GetParError(2)<< endmsg; -// TMinut * tm = (TMinuit*) minuit->GetObjectFit(); ff<<npari<<" "<<nparx<<" "<<fitretval<<" "<<chisq<< " "<< std::endl; ff.close(); } - if(m_trace) ATH_MSG_DEBUG("chisq "<<chisq<<" npari "<<npari<<" nparx "<<nparx<<" fitretval "<<fitretval ); + if(m_trace) ATH_MSG_DEBUG("chisq "<<chisq<<" npari "<<npari<<" nparx "<<nparx<<" fitretval "<<fitretval); // Do standard DCSL fit if minuit is bad // Do standard DCSL fit if all fits from minuit are bad - if (errFlag5!=0&&errFlag4!=0&&errFlag3!=0&&errFlag2!=0&&errFlag1!=0) { - if(m_trace)ATH_MSG_DEBUG( " ALARM Minimize fix " << errFlag1 << " ALARM minimize release " << errFlag2 + if (errFlag5!=0&&errFlag4!=0&&errFlag3!=0&&errFlag2!=0&&errFlag1!=0) { + if(m_trace)ATH_MSG_DEBUG(" ALARM Minimize fix " << errFlag1 << " ALARM minimize release " << errFlag2 << " ALARM migrad fix 1 " << errFlag3 << " ALARM minimize all free" << errFlag4 << " ALARM migrad all free " - << errFlag5 ); + << errFlag5); DCOnTrackVec dcs_new; dcs_new.reserve(dcs.size()); @@ -745,64 +714,53 @@ namespace TrkDriftCircleMath { DCOnTrackVec::const_iterator it_end = dcs.end(); for(int i=0; it!=it_end; ++it, ++i ){ - const DriftCircle* ds = & dcs[i]; - DriftCircle dc_keep(ds->position(), ds->rot()->driftRadius(), ds->dr(), ds->drPrecise(), ds->state(), ds->id(), ds->index(),ds->rot() ); - DCOnTrack dc_new(dc_keep, 0., 0.); - dc_new.state(dcs[i].state()); - dcs_new.push_back( dc_new ); + const DriftCircle* ds = & dcs[i]; + DriftCircle dc_keep(ds->position(), ds->rot()->driftRadius(), ds->dr(), ds->drPrecise(), ds->state(), ds->id(), ds->index(),ds->rot() ); + DCOnTrack dc_new(dc_keep, 0., 0.); + dc_new.state(dcs[i].state()); + dcs_new.push_back( dc_new ); } - bool oldrefit = DCSLFitter::fit( result, line , dcs_new, selection ); - //int iok = 0; - //if(oldrefit) iok = 1; - return oldrefit; - } + return oldrefit; + } ++m_npassedMinuitFit; // Get the fit values - double aret(0),aErr(0); + double aret(0); + double aErr(0); m_minuit->GetParameter(0,aret,aErr); // theta returned double dtheta = aErr; - - double tana = tan(aret); // tangent of angle - + double tana = std::tan(aret); // tangent of angle double ang = aret; // between zero and pi - cosin = cos(ang); - sinus = sin(ang); + cosin = std::cos(ang); + sinus = std::sin(ang); if ( sinus < 0.0 ) { sinus = -sinus; cosin = -cosin; } else if ( sinus == 0.0 && cosin < 0.0 ) { cosin = -cosin; } - ang = atan2(sinus, cosin); + ang = std::atan2(sinus, cosin); - double b(0),bErr(0); + double b(0); + double bErr(0); m_minuit->GetParameter(1,b,bErr); // intercept - - - double t0(0),t0Err(0); + double t0(0); + double t0Err(0); m_minuit->GetParameter(2,t0,t0Err); - - - // double y0 = b * cosin ; // parallel distance double dy0 = cosin * bErr - b * sinus * aErr; double del_t; - if(m_fcnData->use_hardcoded) del_t = fabs(t2r((t0+t0Err)) - t2r(t0)); - else del_t = fabs(rtpointers[0]->radius((t0+t0Err)) - rtpointers[0]->radius(t0)) ; + if(fcnData->use_hardcoded) del_t = std::abs(t2r((t0+t0Err)) - t2r(t0)); + else del_t = std::abs(rtpointers[0]->radius((t0+t0Err)) - rtpointers[0]->radius(t0)) ; if(m_trace) { ATH_MSG_DEBUG("____________FINAL VALUES________________" ); - ATH_MSG_DEBUG("Values: a "<<tana<<" d "<<b * cosin <<" t0 "<<t0 ); - ATH_MSG_DEBUG("Errors: a "<<aErr<<" b "<<dy0 <<" t0 "<<t0Err ); + ATH_MSG_DEBUG("Values: a "<<tana<<" d "<<b * cosin <<" t0 "<<t0); + ATH_MSG_DEBUG("Errors: a "<<aErr<<" b "<<dy0 <<" t0 "<<t0Err); } - - d = b * cosin; - - double covar[3][3]; m_minuit->mnemat(&covar[0][0],3); // 3x3 if(m_trace) { @@ -819,7 +777,7 @@ namespace TrkDriftCircleMath { result.clusters().clear(); result.emptyTubes().clear(); - if(m_trace) ATH_MSG_DEBUG("after fit theta "<<ang<<" sinus "<<sinus<< " cosin "<< cosin ); + if(m_trace) ATH_MSG_DEBUG("after fit theta "<<ang<<" sinus "<<sinus<< " cosin "<< cosin); double chi2 = 0; unsigned int nhits(0); @@ -829,14 +787,14 @@ namespace TrkDriftCircleMath { // calculate predicted hit positions from track parameters it = dcs_keep.begin(); it_end = dcs_keep.end(); - ATH_MSG_DEBUG("------NEW HITS------" ); + ATH_MSG_DEBUG("------NEW HITS------"); for(int i=0; it!=it_end; ++it, ++i ){ double rad, drad; - double uppercut = m_fcnData->use_hardcoded ? TUBE_TIME : rtpointers[i]->tUpper(); - double lowercut = m_fcnData->use_hardcoded ? 0 : rtpointers[i]->tLower(); - if(m_fcnData->use_hardcoded) { + double uppercut = fcnData->use_hardcoded ? TUBE_TIME : rtpointers[i]->tUpper(); + double lowercut = fcnData->use_hardcoded ? 0 : rtpointers[i]->tLower(); + if(fcnData->use_hardcoded) { rad = t2r(t[i]-t0); if(t[i]-t0<lowercut) rad = t2r(lowercut); if(t[i]-t0>uppercut) rad = t2r(uppercut); @@ -845,22 +803,24 @@ namespace TrkDriftCircleMath { if(t[i]-t0<lowercut) rad = rtpointers[i]->radius(lowercut); if(t[i]-t0>uppercut) rad = rtpointers[i]->radius(uppercut); } - - drad = 1.0/sqrt(w[i]) ; + if (w[i]==0) { + ATH_MSG_WARNING("w[i]==0, continuing"); + continue; + } + drad = 1.0/std::sqrt(w[i]) ; yl = (y[i] - tana*z[i] - b); if(m_trace) { ATH_MSG_DEBUG("i "<<i<<" "); } - double dth = -(sinus*y[i] + cosin*z[i])*dtheta; - double residuals = fabs(yl)/sqrt((1+tana*tana)) - rad; + double residuals = std::abs(yl)/std::sqrt(1+tana*tana) - rad; if(m_trace) { - ATH_MSG_DEBUG(" dth "<<dth<<" dy0 "<<dy0<<" del_t "<<del_t<<" " ); + ATH_MSG_DEBUG(" dth "<<dth<<" dy0 "<<dy0<<" del_t "<<del_t); } - double errorResiduals = sqrt( dth*dth + dy0*dy0 + del_t*del_t); + double errorResiduals = std::hypot(dth, dy0, del_t); // derivatives of the residual 'R' double deriv[3]; @@ -871,7 +831,7 @@ namespace TrkDriftCircleMath { deriv[1] = sign(dd) * cosin ; // del R / del t0 - if(m_fcnData->use_hardcoded) deriv[2] = -1* t2rprime(t[i]-t0); + if(fcnData->use_hardcoded) deriv[2] = -1* t2rprime(t[i]-t0); else deriv[2] = -1* rtpointers[i]->driftvelocity(t[i]-t0); double covsq=0; @@ -881,35 +841,33 @@ namespace TrkDriftCircleMath { } } if(m_trace) { - ATH_MSG_DEBUG( " covsquared " << covsq ); + ATH_MSG_DEBUG(" covsquared " << covsq); if( covsq < 0. ){ for(int rr=0; rr<3; rr++) { for(int cc=0; cc<3; cc++) { double dot = deriv[rr]*covar[rr][cc]* deriv[cc]; - ATH_MSG_DEBUG( " adding term " << dot << " dev1 " << deriv[rr] << " cov " << covar[rr][cc] - << " dev2 " << deriv[cc] ); + ATH_MSG_DEBUG(" adding term " << dot << " dev1 " << deriv[rr] << " cov " << covar[rr][cc] << " dev2 " << deriv[cc]); } } } } - covsq = covsq > 0. ? sqrt(covsq) : 0.; + covsq = covsq > 0. ? std::sqrt(covsq) : 0.; const DriftCircle* ds = & dcs_keep[i]; if (m_propagateErrors) drad = dr[i]; DriftCircle dc_newrad(dcs_keep[i].position(), rad, drad, ds->state(), dcs_keep[i].id(), dcs_keep[i].index(),ds->rot() ); DCOnTrack dc_new(dc_newrad, residuals, covsq); dc_new.state(dcs_keep[i].state()); - if(m_trace) ATH_MSG_DEBUG("T0 Segment hit res "<<residuals<<" eres "<<errorResiduals<<" covsq "<<covsq<<" ri " << r[i]<<" ro "<<rad<<" drad "<<drad << " sel "<<selection[i]<< " inv error " << w[i] ); + if(m_trace) ATH_MSG_DEBUG("T0 Segment hit res "<<residuals<<" eres "<<errorResiduals<<" covsq "<<covsq<<" ri " << r[i]<<" ro "<<rad<<" drad "<<drad << " sel "<<selection[i]<< " inv error " << w[i]); if( selection[i] == 0 ) { ++nhits; -// chi2 += residuals*residuals*hitwt; if (!m_propagateErrors) { chi2 += residuals*residuals*w[i]; } else { chi2 += residuals*residuals/(drad*drad); } - if(m_trace) std::cout <<" T0 Segment hit res "<<residuals<<" eres "<<errorResiduals<<" covsq "<<covsq<<" ri " << r[i]<<" radius after t0 "<<rad<<" radius error "<< drad << " original error " << dr[i] << std::endl; + if(m_trace) ATH_MSG_DEBUG("T0 Segment hit res "<<residuals<<" eres "<<errorResiduals<<" covsq "<<covsq<<" ri " << r[i]<<" radius after t0 "<<rad<<" radius error "<< drad << " original error " << dr[i]); // Put chi2 penalty for drift times outside window if (t[i]-t0> uppercut ) { // too large chi2 += (t[i]-t0-uppercut)* (t[i]-t0-uppercut)*0.1; @@ -922,7 +880,7 @@ namespace TrkDriftCircleMath { double oldshift; oldshift = result.t0Shift(); - if(m_trace) ATH_MSG_DEBUG("end fit old "<<oldshift<< " new " <<t0 ); + if(m_trace) ATH_MSG_DEBUG("end fit old "<<oldshift<< " new " <<t0); // Final Minuit Fit result if(nhits==NUMPAR) { nhits++; @@ -932,32 +890,18 @@ namespace TrkDriftCircleMath { result.line().set( LocPos( Zc - sinus*d, Yc + cosin*d ), ang ); if(t0==0.) t0=0.00001; result.setT0Shift(t0,t0Err); - if(m_trace) std::cout << "Minuit Fit complete: Chi2 " << chi2 << " angle " << result.line().phi() << " nhits "<< nhits << " t0result " << t0 << std::endl; - if(m_trace) { - ATH_MSG_DEBUG( "Minuit Fit complete: Chi2 " << chi2 << " angle " << result.line().phi() << " nhits "<<nhits<<" numpar "<<NUMPAR << " per dof " << chi2/(nhits-NUMPAR) ); + ATH_MSG_DEBUG("Minuit Fit complete: Chi2 " << chi2 << " angle " << result.line().phi() << " nhits "<< nhits << " t0result " << t0); + ATH_MSG_DEBUG("Minuit Fit complete: Chi2 " << chi2 << " angle " << result.line().phi() << " nhits "<<nhits<<" numpar "<<NUMPAR << " per dof " << chi2/(nhits-NUMPAR)); - ATH_MSG_DEBUG( "Fit complete: Chi2 " << chi2 <<" nhits "<<nhits<<" numpar "<<NUMPAR << " per dof " << chi2/(nhits-NUMPAR) ); + ATH_MSG_DEBUG("Fit complete: Chi2 " << chi2 <<" nhits "<<nhits<<" numpar "<<NUMPAR << " per dof " << chi2/(nhits-NUMPAR)); if(chi2/(nhits-NUMPAR) > 5) { - ATH_MSG_DEBUG( "_______NOT GOOD " ); + ATH_MSG_DEBUG("_______NOT GOOD "); } - ATH_MSG_DEBUG("chi2 "<<chi2<<" per dof "<<chi2/(nhits-NUMPAR)<<" root chisq "<<chisq ); + ATH_MSG_DEBUG("chi2 "<<chi2<<" per dof "<<chi2/(nhits-NUMPAR)<<" root chisq "<<chisq); } - - // Do standard DCSL fit using the t0 updated results - // if minuit MIGRAD failed to converge (and t0 fit converged) -// if (errFlag5!=0&&errFlag4!=0) { -// bool oldrefit = DCSLFitter::fit( result, result.line() , result.dcs(), selection ); -// int iok = 0; -// if(oldrefit) iok = 1; -// if(m_trace)*m_log << MSG::DEBUG << " ALARM Minimize fix " << errFlag1 << " ALARM minimize release " << errFlag2 << " ALARM migrad fix 1 " << errFlag3 << " ALARM minimize all free " << errFlag4 << " ALARM migrad all free " << errFlag5 << endmsg; -// if(m_trace) std::cout << " ALARM Migrad and Minimize failed DCSL Fit Chi2 " << result.chi2() << " angle " << result.line().phi() << " y0 " << result.line().y0() << " nhits "<< selection.size() << " fitretval " << fitretval << " refit ok " << iok << std::endl; -// return oldrefit; -// } - - return true; } - } + diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/CMakeLists.txt index a40dc0792785ebd84f731a9aca70ffc02b9d439a..2d0a4056924490c771d18f2094e96af0508c00b3 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMatchingTools/CMakeLists.txt @@ -33,5 +33,5 @@ atlas_add_component( MuonSegmentMatchingTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonRIO_OnTrack MuonCompetingRIOsOnTrack MuonSegment MuonRecHelperToolsLib TrkDetDescrUtils TrkGeometry TrkEventPrimitives TrkParameters TrkTrack TrkExInterfaces TrkToolInterfaces ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel MuonReadoutGeometry MuonIdHelpersLib MuonRIO_OnTrack MuonCompetingRIOsOnTrack MuonSegment MuonRecHelperToolsLib TrkDetDescrUtils TrkGeometry TrkEventPrimitives TrkParameters TrkTrack TrkExInterfaces TrkToolInterfaces MuonSegmentMakerToolInterfaces ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/CMakeLists.txt index 932ed162555eacf93fe5d770b20833ac345a547d..0d7c93d03fab3b80dd58ba43536b11a5364162a0 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/CMakeLists.txt @@ -64,5 +64,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 MuonAlignErrorBase MuonReadoutGeometry MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MuonRecToolInterfaces MuonStationIntersectSvcLib MuonSegmentMakerUtils MuidInterfaces TrkFitterInterfaces TrkDetDescrInterfaces TrkDetElementBase TrkGeometry TrkSurfaces TrkVolumes TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkMeasurementBase TrkParameters TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkRoad TrkTrack TrkSegment TrkTrackSummary TrkExInterfaces TrkToolInterfaces TrkDriftCircleMath MuonCondData MagFieldElements MagFieldConditions ) + 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 MuidInterfaces TrkFitterInterfaces TrkDetDescrInterfaces TrkDetElementBase TrkGeometry TrkSurfaces TrkVolumes TrkEventPrimitives TrkEventUtils TrkMaterialOnTrack TrkMeasurementBase TrkParameters TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkRoad TrkTrack TrkSegment TrkTrackSummary TrkExInterfaces TrkToolInterfaces TrkDriftCircleMath MuonCondData MagFieldElements MagFieldConditions MuonSegmentMakerInterfacesLib MuonTrackMakerUtils ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/CMakeLists.txt index 6c850c2f9b118cc93e25adaa6fa06965dae28115..6ef9950ea6b715d6fab018d9882afbbe08fb5c83 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/CMakeLists.txt +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/CMakeLists.txt @@ -53,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 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 ) + 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 MuonSegmentMakerToolInterfaces MuonTrackMakerUtils ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/MuonSpectrometer/MuonTruthAlgs/CMakeLists.txt b/MuonSpectrometer/MuonTruthAlgs/CMakeLists.txt index 16edeb80c4b2cf55019860f4e1479f98ac77b38d..c8153446a025640101f6418ab92b8c003ea50cbc 100644 --- a/MuonSpectrometer/MuonTruthAlgs/CMakeLists.txt +++ b/MuonSpectrometer/MuonTruthAlgs/CMakeLists.txt @@ -61,7 +61,7 @@ atlas_add_component( MuonTruthAlgs src/*.cxx src/components/*.cxx INCLUDE_DIRS - LINK_LIBRARIES AtlasHepMCLib StoreGateLib SGtests Identifier GaudiKernel MuonPrepRawData MuonRecToolInterfaces MuonSimData TrkTrack TrkTruthData TrkToolInterfaces AthenaBaseComps AthLinks AthContainers AtlasDetDescr EventPrimitives xAODMuon xAODTracking xAODTruth GeneratorObjects MuonReadoutGeometry MuonGeoModelLib MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonPattern MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MCTruthClassifierLib Particle ParticleTruth TrkDetElementBase TrkGeometry TrkSurfaces TrkCompetingRIOsOnTrack TrkEventUtils TrkMeasurementBase TrkParameters TrkPrepRawData TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkExInterfaces TrkFitterInterfaces TrackRecordLib ) + LINK_LIBRARIES AtlasHepMCLib StoreGateLib SGtests Identifier GaudiKernel MuonPrepRawData MuonRecToolInterfaces MuonSimData TrkTrack TrkTruthData TrkToolInterfaces AthenaBaseComps AthLinks AthContainers AtlasDetDescr EventPrimitives xAODMuon xAODTracking xAODTruth GeneratorObjects MuonReadoutGeometry MuonGeoModelLib MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonPattern MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MCTruthClassifierLib Particle ParticleTruth TrkDetElementBase TrkGeometry TrkSurfaces TrkCompetingRIOsOnTrack TrkEventUtils TrkMeasurementBase TrkParameters TrkPrepRawData TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkExInterfaces TrkFitterInterfaces TrackRecordLib MuonTrackMakerUtils ) # Install files from the package: atlas_install_headers( MuonTruthAlgs ) diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonAlg.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonAlg.h index 3c8c088f6e8b349c943f3b39a3e1d965b22cedea..351fe161c323b061716617ff55421104266ac38b 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonitoring/MdtRawDataMonAlg.h @@ -114,8 +114,6 @@ class MdtRawDataMonAlg: public AthMonitorAlgorithm { TH2* m_mdthitsperchamber_InnerMiddleOuterLumi[2]; TH2* m_mdthitsperML_byLayer[3];//These are alternative Global hit coverage plots - std::string m_title; - MDTNoisyTubes* m_masked_tubes; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; @@ -160,7 +158,6 @@ class MdtRawDataMonAlg: public AthMonitorAlgorithm { StatusCode GetTimingInfo();//here void initDeadChannels(const MuonGM::MdtReadoutElement* mydetEl); - ToolHandleArray<IDQFilterTool> m_DQFilterTools; bool m_atlas_ready; SG::ReadHandleKey<Trk::SegmentCollection> m_segm_type{this,"Eff_segm_type","MuonSegments","muon segments"}; @@ -182,9 +179,7 @@ class MdtRawDataMonAlg: public AthMonitorAlgorithm { // to book or not bookMDTTDCplots --> /Chambers/tmp/ directory bool m_doChamberHists; - bool m_isOnline; bool m_maskNoisyTubes; - bool m_chamber_2D; //DEV to be put back //Set this to true/false in the Job Options in order to see/not see chamber by chamber 2d adc vs tdc plots. SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_key_mdt{this,"MdtPrepDataContainer","MDT_DriftCircles","MDT PRDs"}; SG::ReadHandleKey<Muon::RpcPrepDataContainer> m_key_rpc{this,"RpcPrepDataContainer","RPC_Measurements","RPC PRDs"}; @@ -194,7 +189,6 @@ class MdtRawDataMonAlg: public AthMonitorAlgorithm { //Define configurable adccut and TGC/RPC keys float m_ADCCut; - float m_ADCCut_Bkgrd; //Chamber by Chamber Plots std::vector< MDTChamber* >* m_hist_hash_list; @@ -207,30 +201,22 @@ class MdtRawDataMonAlg: public AthMonitorAlgorithm { bool m_do_mdtchamberstatphislice; bool m_do_mdtChamberHits; bool m_do_mdttdccut_sector; - bool m_do_mdttdc; - bool m_do_mdttdccut_ML1; - bool m_do_mdttdccut_ML2; - bool m_do_mdtadc_onSegm_ML1; - bool m_do_mdtadc_onSegm_ML2; - bool m_do_mdttdccut_RPCtrig_ML1; - bool m_do_mdttdccut_TGCtrig_ML1; - bool m_do_mdttdccut_RPCtrig_ML2; - bool m_do_mdttdccut_TGCtrig_ML2; - bool m_do_mdtadc; - bool m_do_mdttdcadc; - bool m_do_mdtmultil; - bool m_do_mdtlayer; - bool m_do_mdttube; - bool m_do_mdttube_masked; - bool m_do_mdttube_fornoise; - bool m_do_mdttube_bkgrd; - bool m_do_mdtmezz; - bool m_do_mdt_effEntries; - bool m_do_mdt_effCounts; - bool m_do_mdt_effPerTube; - bool m_do_mdt_DRvsDT; - bool m_do_mdt_DRvsDRerr; - bool m_do_mdt_DRvsSegD; + // bool m_do_mdttdc; + // bool m_do_mdttdccut_ML1; + // bool m_do_mdttdccut_ML2; + // bool m_do_mdtadc_onSegm_ML1; + // bool m_do_mdtadc_onSegm_ML2; + // bool m_do_mdtadc; + // bool m_do_mdttdcadc; + // bool m_do_mdtlayer; + // bool m_do_mdttube; + // bool m_do_mdtmezz; + // bool m_do_mdt_effEntries; + // bool m_do_mdt_effCounts; + // bool m_do_mdt_effPerTube; + // bool m_do_mdt_DRvsDT; + // bool m_do_mdt_DRvsDRerr; + // bool m_do_mdt_DRvsSegD; // // NEW diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/python/MDTMonitorAlgorithm.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/python/MDTMonitorAlgorithm.py index 179b37958b6ec4b2904aa00393f67a14fb411bab..af937eb1e4e74d41b6b1d1e3328c60dfa6cb93c3 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/python/MDTMonitorAlgorithm.py +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/python/MDTMonitorAlgorithm.py @@ -40,42 +40,15 @@ def MdtMonitoringConfig(inputFlags): # helper. Then, the helper will instantiate an instance and set up the # base class configuration following the inputFlags. The returned object # is the algorithm. - #MdtRawDataMonAlg.DoMdtEsd = True mdtMonAlg = helper.addAlgorithm(CompFactory.MdtRawDataMonAlg,'MdtMonAlg') mdtMonAlg.DoMdtEsd = True - - # You can actually make multiple instances of the same algorithm and give - # them different configurations - ######anotherExampleMonAlg = helper.addAlgorithm(ExampleMonitorAlgorithm,'AnotherExampleMonAlg') - - # # If for some really obscure reason you need to instantiate an algorithm - # # yourself, the AddAlgorithm method will still configure the base - # # properties and add the algorithm to the monitoring sequence. - # helper.AddAlgorithm(myExistingAlg) - - - ### STEP 3 ### - # Edit properties of a algorithm - #####exampleMonAlg.TriggerChain = '' - - ### STEP 4 ### - # Add some tools. N.B. Do not use your own trigger decion tool. Use the - # standard one that is included with AthMonitorAlgorithm. - - # # First, add a tool that's set up by a different configuration function. - # # In this case, CaloNoiseToolCfg returns its own component accumulator, - # # which must be merged with the one from this function. - # from CaloTools.CaloNoiseToolConfig import CaloNoiseToolCfg - # caloNoiseAcc, caloNoiseTool = CaloNoiseToolCfg(inputFlags) - # result.merge(caloNoiseAcc) - # exampleMonAlg.CaloNoiseTool = caloNoiseTool - - # # Then, add a tool that doesn't have its own configuration function. In - # # this example, no accumulator is returned, so no merge is necessary. - # from MyDomainPackage.MyDomainPackageConf import MyDomainTool - # exampleMonAlg.MyDomainTool = MyDomainTool() - - # Add a generic monitoring tool (a "group" in old language). The returned + mdtMonAlg.DoChamberHist=True + mdtMonAlg.maskNoisyTubes = True + mdtMonAlg.ADCCut = 80. + mdtMonAlg.do_mdtChamberHits=True + mdtMonAlg.do_mdttdccut_sector=True + mdtMonAlg.do_mdtchamberstatphislice=True + # Add a gezneric monitoring tool (a "group" in old language). The returned # object here is the standard GenericMonitoringTool. mdtGroup = helper.addGroup(mdtMonAlg,'MdtMonitor','Muon/MuonRawDataMonitoring/MDT/') diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx index b0e3fde3bf7ed137dfcba46cf1330d9f2405330c..2a0743498eedc154d194fafb97c82c3d96bb4980 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx @@ -123,7 +123,6 @@ MdtRawDataMonAlg::MdtRawDataMonAlg( const std::string& name, ISvcLocator* pSvcLo :AthMonitorAlgorithm(name,pSvcLocator), m_masked_tubes(NULL), m_muonSelectionTool("CP::MuonSelectionTool/MuonSelectionTool"), - m_DQFilterTools(this), m_atlas_ready(0), m_hist_hash_list(0), m_BMGpresent(false), @@ -131,47 +130,34 @@ MdtRawDataMonAlg::MdtRawDataMonAlg( const std::string& name, ISvcLocator* pSvcLo { // Declare the properties declareProperty("DoMdtEsd", m_doMdtESD=false); - declareProperty("DoChamber2DHist", m_chamber_2D=true); declareProperty("DoChamberHist", m_doChamberHists=true); - declareProperty("DoOnlineMonitoring", m_isOnline=false); declareProperty("maskNoisyTubes", m_maskNoisyTubes=true); declareProperty("ADCCut", m_ADCCut=50.); - declareProperty("ADCCutForBackground", m_ADCCut_Bkgrd=80.); declareProperty("Eff_nHits", m_nb_hits=5.); declareProperty("Eff_chi2Cut", m_chi2_cut=10.); - declareProperty("AtlasFilterTool", m_DQFilterTools); - declareProperty("Title", m_title); + //Global Histogram controls declareProperty("do_mdtChamberHits", m_do_mdtChamberHits = true); declareProperty("do_mdttdccut_sector", m_do_mdttdccut_sector = true); - declareProperty("do_mdtchamberstatphislice", m_do_mdtchamberstatphislice = true); + declareProperty("do_mdtchamberstatphislice", m_do_mdtchamberstatphislice = true);// //Chamber wise histogram control - declareProperty("do_mdttdc", m_do_mdttdc = true); - declareProperty("do_mdttdccut_ML1", m_do_mdttdccut_ML1 = true); - declareProperty("do_mdttdccut_ML2", m_do_mdttdccut_ML2 = true); - declareProperty("do_mdtadc_onSegm_ML1", m_do_mdtadc_onSegm_ML1 = true); - declareProperty("do_mdtadc_onSegm_ML2", m_do_mdtadc_onSegm_ML2 = true); - declareProperty("do_mdttdccut_RPCtrig_ML1", m_do_mdttdccut_RPCtrig_ML1 = true); - declareProperty("do_mdttdccut_TGCtrig_ML1", m_do_mdttdccut_TGCtrig_ML1 = true); - declareProperty("do_mdttdccut_RPCtrig_ML2", m_do_mdttdccut_RPCtrig_ML2 = true); - declareProperty("do_mdttdccut_TGCtrig_ML2", m_do_mdttdccut_TGCtrig_ML2 = true); - declareProperty("do_mdtadc", m_do_mdtadc = true); - declareProperty("do_mdttdcadc", m_do_mdttdcadc = true); - declareProperty("do_mdtmultil", m_do_mdtmultil = true); - declareProperty("do_mdtlayer", m_do_mdtlayer = true); - declareProperty("do_mdttube", m_do_mdttube = true); - declareProperty("do_mdttube_masked", m_do_mdttube_masked = true); - declareProperty("do_mdttube_fornoise", m_do_mdttube_fornoise = true); - declareProperty("do_mdttube_bkgrd", m_do_mdttube_bkgrd = true); - declareProperty("do_mdtmezz", m_do_mdtmezz = true); - declareProperty("do_mdt_effEntries", m_do_mdt_effEntries = true); - declareProperty("do_mdt_effCounts", m_do_mdt_effCounts = true); - declareProperty("do_mdt_effPerTube", m_do_mdt_effPerTube = false); - declareProperty("do_mdt_DRvsDT", m_do_mdt_DRvsDT = true); - declareProperty("do_mdt_DRvsDRerr", m_do_mdt_DRvsDRerr = false); - declareProperty("do_mdt_DRvsSegD", m_do_mdt_DRvsSegD = true); - //declareProperty("nHits_NoiseThreshold", m_HighOccThreshold = 16000.); - declareProperty("nHits_NoiseThreshold", m_HighOccThreshold = 400.);//DEV to-be-fixed + // declareProperty("do_mdttdc", m_do_mdttdc = true); + // declareProperty("do_mdttdccut_ML1", m_do_mdttdccut_ML1 = true); + // declareProperty("do_mdttdccut_ML2", m_do_mdttdccut_ML2 = true); + // declareProperty("do_mdtadc_onSegm_ML1", m_do_mdtadc_onSegm_ML1 = true); + // declareProperty("do_mdtadc_onSegm_ML2", m_do_mdtadc_onSegm_ML2 = true); + // declareProperty("do_mdtadc", m_do_mdtadc = true); + // declareProperty("do_mdttdcadc", m_do_mdttdcadc = true); + // declareProperty("do_mdtlayer", m_do_mdtlayer = true); + // declareProperty("do_mdttube", m_do_mdttube = true); + // declareProperty("do_mdtmezz", m_do_mdtmezz = true); + // declareProperty("do_mdt_effEntries", m_do_mdt_effEntries = true); + // declareProperty("do_mdt_effCounts", m_do_mdt_effCounts = true); + // declareProperty("do_mdt_effPerTube", m_do_mdt_effPerTube = false); + // declareProperty("do_mdt_DRvsDT", m_do_mdt_DRvsDT = true); + // declareProperty("do_mdt_DRvsDRerr", m_do_mdt_DRvsDRerr = false); + // declareProperty("do_mdt_DRvsSegD", m_do_mdt_DRvsSegD = true); + declareProperty("nHits_NoiseThreshold", m_HighOccThreshold = 16000.); } MdtRawDataMonAlg::~MdtRawDataMonAlg() @@ -199,15 +185,12 @@ StatusCode MdtRawDataMonAlg::initialize() //If Online ensure that lowStat histograms are made at the runLevel and that _lowStat suffix is suppressed //If online monitoring turn off chamber by chamber hists - if(m_isOnline) m_doChamberHists = false; // MuonDetectorManager from the conditions store ATH_CHECK(m_DetectorManagerKey.initialize()); ATH_CHECK(m_idHelperSvc.retrieve()); - ATH_CHECK(m_DQFilterTools.retrieve()); - ATH_CHECK(m_muonSelectionTool.retrieve()); if(m_maskNoisyTubes) m_masked_tubes = new MDTNoisyTubes(); @@ -441,8 +424,9 @@ StatusCode MdtRawDataMonAlg::fillHistograms(const EventContext& ctx) const isHit_above_ADCCut = true; std::string phi=hardware_name.substr( hardware_name.length() - 2); auto hit_in_chamber = Monitored::Scalar<std::string>("hits_phi_"+phi,hardware_name); + if(m_do_mdtchamberstatphislice) fill("MdtMonitor",hit_in_chamber); auto hit_in_chamber_allphi = Monitored::Scalar<std::string>("hits_allphi",hardware_name); - fill("MdtMonitor",hit_in_chamber,hit_in_chamber_allphi); + fill("MdtMonitor",hit_in_chamber_allphi); } fillMDTOverviewVects(*mdtCollection, isNoiseBurstCandidate, overviewPlots); //======================================================================= @@ -834,9 +818,15 @@ StatusCode MdtRawDataMonAlg::fillMDTSummaryHistograms( const MDTSummaryHistogram for (int icrate = 0; icrate < 4; ++icrate) { auto& thisVects = vects[iregion][ilayer][stationPhi][crate_region][icrate]; auto sector = Monitored::Collection("sector",thisVects.sector); + + fill("MdtMonitor", lb_mon, sector); + auto stationEta = Monitored::Collection("stEta_"+region[iregion]+"_"+layer[ilayer]+"_phi"+std::to_string(stationPhi+1), thisVects.stationEta); - fill("MdtMonitor", lb_mon, sector); + if(m_do_mdtChamberHits){ + fill(MDT_regionGroup, stationEta); + } + auto adc_mon = Monitored::Collection("adc_mon", thisVects.adc_mon); auto tdc_mon = Monitored::Collection("tdc_mon", thisVects.tdc_mon); @@ -852,7 +842,8 @@ StatusCode MdtRawDataMonAlg::fillMDTSummaryHistograms( const MDTSummaryHistogram auto adc_mon_adccut = Monitored::Collection("adc_mon_adccut", thisVects.adc_mon_adccut); auto tdc_mon_adccut = Monitored::Collection("tdc_mon_adccut", thisVects.tdc_mon_adccut); - fill(MDT_regionGroup, stationEta, tdc_mon_adccut, adc_mon_adccut); + // fill(MDT_regionGroup, stationEta, tdc_mon_adccut, adc_mon_adccut); + fill(MDT_regionGroup, tdc_mon_adccut, adc_mon_adccut); std::string varx = iregion < 2 ? "x_mon_barrel" : "x_mon_endcap"; std::string vary = iregion < 2 ? "y_mon_barrel" : "y_mon_endcap"; @@ -1316,10 +1307,12 @@ StatusCode MdtRawDataMonAlg::fillMDTSegmentHistograms( const MDTSegmentHistogram auto adc_segs_overall_mon = Monitored::Collection("adc_segs_overall_mon", thisVects.adc_segs_mon); std::string tdc_var="tdc_segs_"+region[iregion]+"_"+layer[ilayer]+"_phi"+std::to_string(stationPhi+1); auto tdc_segs_mon = Monitored::Collection(tdc_var, thisVects.tdc_segs_mon); + if(m_do_mdttdccut_sector) fill(MDT_regionGroup, tdc_segs_mon); + auto tdc_segs_overall_mon = Monitored::Collection("tdc_segs_overall_mon", thisVects.tdc_segs_mon); auto tdc_segs_region_mon = Monitored::Collection("tdc_segs_region_mon", thisVects.tdc_segs_mon); - fill(MDT_regionGroup, adc_segs_mon, tdc_segs_mon, tdc_segs_region_mon); + fill(MDT_regionGroup, adc_segs_mon, tdc_segs_region_mon); std::string varx = iregion < 2 ? "x_segs_mon_barrel" : "x_segs_mon_endcap"; std::string vary = iregion < 2 ? "y_segs_mon_barrel" : "y_segs_mon_endcap"; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/python/TgcRawDataMonitorAlgorithm.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/python/TgcRawDataMonitorAlgorithm.py index 265d2c9fee9e7e562c67b96c7acdf1b2e1dc1feb..3de766bd0c5963020501d85e7769cb5298d309f3 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/python/TgcRawDataMonitorAlgorithm.py +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/TgcRawDataMonitoring/python/TgcRawDataMonitorAlgorithm.py @@ -14,18 +14,6 @@ def TgcRawDataMonitoringConfig(inputFlags): from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator result = ComponentAccumulator() - from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg - result.merge(MagneticFieldSvcCfg(inputFlags)) - - from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg - result.merge(AtlasGeometryCfg(inputFlags)) - - from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg - trackGeomCfg = TrackingGeometrySvcCfg(inputFlags) - geom_svc = trackGeomCfg.getPrimary() - geom_svc.GeometryBuilder.Compactify = False ######## To avoid crash ######## - result.merge(trackGeomCfg) - from AthenaMonitoring import AthMonitorCfgHelper helper = AthMonitorCfgHelper(inputFlags,'TgcRawDataMonitorCfg') @@ -121,9 +109,7 @@ if __name__=='__main__': from AthenaConfiguration.AllConfigFlags import ConfigFlags import glob - inputs = glob.glob('/data01/masato/L1MuonDevRun3/athenaMT/run_mc_zmumu_normal/*/tmp.ESD') - # inputs = glob.glob('/data01/masato/L1MuonDevRun3/athenaMT/run_mc_zmumu_normal/*/AOD*') - # inputs = glob.glob('/data01/masato/L1MuonDevRun3/athenaMT/mc_scan_normal/*/tmp.ESD') + inputs = glob.glob('/data03/mySamples/run_mc_zmumu/*/tmp.ESD') ConfigFlags.Input.Files = inputs ConfigFlags.Input.isMC = True @@ -146,6 +132,13 @@ if __name__=='__main__': tgcRawDataMonitorAcc.OutputLevel = DEBUG cfg.merge(tgcRawDataMonitorAcc) + from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg + from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg + from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg + cfg.merge(MagneticFieldSvcCfg(ConfigFlags)) + cfg.merge(AtlasGeometryCfg(ConfigFlags)) + cfg.merge(TrackingGeometrySvcCfg(ConfigFlags)) + cfg.printConfig(withDetails=True, summariseProps = True) cfg.run() diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx index 41dd7c70d35b40ae84c83864e9235c57f50284c9..653a267de57ef64fb3468c70225aaf6159f2b991 100644 --- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx +++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/sTGCDigitVariables.cxx @@ -1,4 +1,4 @@ -/* +/* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrec_Run2.sh b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrec_Run2.sh new file mode 100755 index 0000000000000000000000000000000000000000..ca6016a78f237401a0e97a4e6bab3a46776391fe --- /dev/null +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonRecRTT/test/test_muonrec_Run2.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# +# art-description: Test the Run2 layout in reconstruction +# +# art-type: grid +# art-include: master/Athena +# art-include: 21.3/Athena +# art-include: 21.0/Athena +# art-output: trkPerformance_MuonSpectrometerTracks.txt +# art-output: trkPerformance_ExtrapolatedMuonTracks.txt +# art-output: trkPerformance_MSOnlyExtrapolatedMuonTracks.txt +# art-output: trkPerformance_CombinedMuonTracks.txt +# art-output: muonPerformance_segments.txt +# art-output: muonPerformance_xAOD.txt +# art-output: warningCount.txt + +##################################################################### +# run reconstruction on 2000 di-muon events (|eta|<2.7) using the Run2 production layout (ATLAS-R2-2016-01-00-01) +# the input RDO was produced (simulation/digitisation was run) in Athena,21.0.115 +LOG_RECO="log_Run2_reco.log" +Reco_tf.py --inputRDOFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/MuonRecRTT/Run2/RDO/RDO_DiMuon_fullEta_v1.root \ + --preExec "from MuonRecExample.MuonRecFlags import muonRecFlags;muonRecFlags.setDefaults();muonRecFlags.doFastDigitization=False;muonRecFlags.useLooseErrorTuning.set_Value_and_Lock(True);muonRecFlags.doTrackPerformance=True;muonRecFlags.TrackPerfSummaryLevel=2;muonRecFlags.TrackPerfDebugLevel=5;from RecExConfig.RecFlags import rec;rec.doTrigger=False;rec.doEgamma=True;rec.doLucid=True;rec.doZdc=True;rec.doJetMissingETTag=True;from MuonRecExample.MuonStandaloneFlags import muonStandaloneFlags;muonStandaloneFlags.printSummary=True;" \ + --autoConfiguration everything \ + --imf False \ + --outputESDFile OUT_ESD.root &> ${LOG_RECO} +exit_code=$? +echo "art-result: ${exit_code} Reco_tf.py" +if [ ${exit_code} -ne 0 ] +then + exit ${exit_code} +fi +# check the log file for WARNING/ERROR/FATAL +NWARNING="$(cat ${LOG_RECO} | grep WARNING | wc -l)" +NERROR="$(cat ${LOG_RECO} | grep ERROR | wc -l)" +NFATAL="$(cat ${LOG_RECO} | grep FATAL | wc -l)" +echo "Found ${NWARNING} WARNING, ${NERROR} ERROR and ${NFATAL} FATAL messages in ${LOG_RECO}" > warningCount.txt + +echo "art-result: $?" diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/CMakeLists.txt index d14b7a1e4d11129e1f7b6e5858af3bc77339797a..95407b2491ae76020321dc597904b29aa0e13cf4 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/CMakeLists.txt +++ b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 789264 2016-12-12 13:21:11Z cpollard $ ################################################################################ # Package: ParticleJetTools ################################################################################ @@ -70,4 +69,3 @@ atlas_add_dictionary( ParticleJetToolsDict # Install files from the package: atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) diff --git a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/CMakeLists.txt index 2a1bd0d6ae142f82ce46bdbc1c3ce296131c2e79..203f5d62669c0b5bce447ed6629c7517ae097fd4 100644 --- a/PhysicsAnalysis/AnalysisCommon/PileupReweighting/CMakeLists.txt +++ b/PhysicsAnalysis/AnalysisCommon/PileupReweighting/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 777177 2016-10-07 16:09:43Z krasznaa $ ################################################################################ # Package: PileupReweighting ################################################################################ @@ -93,5 +92,4 @@ atlas_add_test( ut_PRWDataWeightExample_test # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) -atlas_install_data( share/*.root ) atlas_install_scripts( scripts/PURW_create_actual_mu_profile.py ) diff --git a/PhysicsAnalysis/CommonTools/ExpressionEvaluation/ExpressionEvaluation/StackElement.icc b/PhysicsAnalysis/CommonTools/ExpressionEvaluation/ExpressionEvaluation/StackElement.icc index 309b6b000b72c8373cfb6300906fe45026cda77a..9f728b7e38a8f67361a789e43829f2a88216c2ae 100644 --- a/PhysicsAnalysis/CommonTools/ExpressionEvaluation/ExpressionEvaluation/StackElement.icc +++ b/PhysicsAnalysis/CommonTools/ExpressionEvaluation/ExpressionEvaluation/StackElement.icc @@ -37,12 +37,12 @@ namespace ExpressionParsing { m_variableType(static_cast<IProxyLoader::VariableType>(a.m_variableType)), m_determinedVariableType(a.m_determinedVariableType ? true : false) { - if (a.m_moved) throw std::logic_error("Content already moved"); \ + if (a.m_moved) throw std::logic_error("Content already moved"); } inline StackElement &StackElement::operator=(StackElement &&a) { if (&a != this) { - if (a.m_moved) throw std::logic_error("Content already moved"); \ + if (a.m_moved) throw std::logic_error("Content already moved"); m_type = a.m_type; m_intVal = a.m_intVal; m_doubleVal = a.m_doubleVal; diff --git a/PhysicsAnalysis/D3PDMaker/CaloD3PDMaker/CMakeLists.txt b/PhysicsAnalysis/D3PDMaker/CaloD3PDMaker/CMakeLists.txt index 3b6503ff7066c7457570b0a6e3848338bf62ab22..ca934cff01a7ee05d89b63379f6f30281b0ce644 100644 --- a/PhysicsAnalysis/D3PDMaker/CaloD3PDMaker/CMakeLists.txt +++ b/PhysicsAnalysis/D3PDMaker/CaloD3PDMaker/CMakeLists.txt @@ -38,5 +38,3 @@ atlas_add_component( CaloD3PDMaker # Install files from the package: atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) - diff --git a/PhysicsAnalysis/D3PDMaker/TrackD3PDMaker/CMakeLists.txt b/PhysicsAnalysis/D3PDMaker/TrackD3PDMaker/CMakeLists.txt index a452d4a987314cec48990e79d37cc3eccba212d7..10d8e26009d876318f816c1ba4109fa5124b5771 100644 --- a/PhysicsAnalysis/D3PDMaker/TrackD3PDMaker/CMakeLists.txt +++ b/PhysicsAnalysis/D3PDMaker/TrackD3PDMaker/CMakeLists.txt @@ -46,5 +46,3 @@ atlas_add_component( TrackD3PDMaker # Install files from the package: atlas_install_headers( TrackD3PDMaker ) atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) - diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/FullListOfSmartContainers.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/FullListOfSmartContainers.py index c17f75757b56668d07932c326e31dec48f47935e..9752dbbbccf3df70f258207c7f24b739fe8ac533 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/FullListOfSmartContainers.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/FullListOfSmartContainers.py @@ -71,6 +71,7 @@ FullListOfSmartContainers = [ "BTagging_AntiKt4EMTopo_201810", "BTagging_AntiKt4EMPFlow_201810", "BTagging_AntiKt4EMPFlow_201903", + 'BTagging_AntiKt4EMPFlow', "BTagging_AntiKtVR30Rmax4Rmin02Track_201810", "BTagging_AntiKtVR30Rmax4Rmin02Track_201810GhostTag", "BTagging_AntiKtVR30Rmax4Rmin02Track_201810_expert", diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/SlimmingHelper.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/SlimmingHelper.py index c8948aa0df317c4fc4d9ce057cde7d7850e91522..3607b1624b45c553fae09bb439b3fec82770e80d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/SlimmingHelper.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkCore/python/SlimmingHelper.py @@ -577,6 +577,9 @@ class SlimmingHelper: elif collectionName=="BTagging_AntiKt4EMPFlow_201903": from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingStandardContent items.extend(BTaggingStandardContent("AntiKt4EMPFlowJets_BTagging201903")) + elif collectionName=="BTagging_AntiKt4EMPFlow": + from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingStandardContent + items.extend(BTaggingStandardContent("AntiKt4EMPFlowJets")) elif collectionName=="BTagging_AntiKt2Track": from DerivationFrameworkFlavourTag.BTaggingContent import BTaggingStandardContent items.extend(BTaggingStandardContent("AntiKt2PV0TrackJets")) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGSelectionToolWrapper.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGSelectionToolWrapper.h index c68ae0a5b4555525b5f1623489acff5cb5a8bcfd..d62e454e74b0807792940cc299775e5cb78d6433 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGSelectionToolWrapper.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/DerivationFrameworkEGamma/EGSelectionToolWrapper.h @@ -14,6 +14,7 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "DerivationFrameworkInterfaces/IAugmentationTool.h" #include "EgammaAnalysisInterfaces/IAsgEGammaIsEMSelector.h" +//#include "EgammaAnalysisInterfaces/IAsgElectronLikelihoodTool.h" #include "EgammaAnalysisInterfaces/IElectronPhotonShowerShapeFudgeTool.h" #include "PATCore/IAsgSelectionTool.h" #include "AsgTools/IAsgTool.h" @@ -30,8 +31,8 @@ namespace DerivationFramework { virtual StatusCode addBranches() const; private: - ToolHandle<IAsgSelectionTool> m_tool; // can't use isemValue, but can use TAccept and then getInvertedCutBitSet to retrieve isem-like value for both cut-based and LH selectors - //ToolHandle<IAsgEGammaIsEMSelector> m_tool; // provides isemValue, but will not work with likelihood.. + //ToolHandle<IAsgSelectionTool> m_tool; // can't use isemValue, but can use TAccept and then getInvertedCutBitSet to retrieve isem-like value for both cut-based and LH selectors + ToolHandle<IAsgEGammaIsEMSelector> m_tool; // provides isemValue, but will not work with likelihood.. ToolHandle<IElectronPhotonShowerShapeFudgeTool> m_fudgeMCTool; std::string m_cut; std::string m_sgName; diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py index 2004520c3426141c22d18b7547c261786c75f72a..1dbe056b965c47e9d8caee966c7f4951d507295d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/python/EGammaCommon.py @@ -87,15 +87,24 @@ ToolSvc += ElectronLHSelectorLooseBL #==================================================================== # ELECTRON CHARGE SELECTION #==================================================================== +# +# Disabled as is missing in R22 +# +''' from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgElectronChargeIDSelectorTool ElectronChargeIDSelector = AsgElectronChargeIDSelectorTool("ElectronChargeIDSelectorLoose") ElectronChargeIDSelector.primaryVertexContainer = "PrimaryVertices" ElectronChargeIDSelector.TrainingFile = "ElectronPhotonSelectorTools/ChargeID/ECIDS_20180731rel21Summer2018.root" ToolSvc += ElectronChargeIDSelector +''' #==================================================================== # FWD ELECTRON LH SELECTORS #==================================================================== +# +# Disabled as is missing in R22 +# +''' from ElectronPhotonSelectorTools.ElectronPhotonSelectorToolsConf import AsgForwardElectronLikelihoodTool ForwardElectronLHSelectorLoose = AsgForwardElectronLikelihoodTool("ForwardElectronLHSelectorLoose", WorkingPoint="LooseLHForwardElectron") @@ -106,7 +115,7 @@ ToolSvc += ForwardElectronLHSelectorMedium ForwardElectronLHSelectorTight = AsgForwardElectronLikelihoodTool("ForwardElectronLHSelectorTight", WorkingPoint="TightLHForwardElectron") ToolSvc += ForwardElectronLHSelectorTight - +''' #==================================================================== # PHOTON SELECTION (loose and tight cut-based) @@ -172,64 +181,73 @@ ToolSvc += EGAMCOM_caloFillRect711 from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__AsgSelectionToolWrapper from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGSelectionToolWrapper from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__EGElectronLikelihoodToolWrapper + # decorate electrons with the output of LH very loose -ElectronPassLHVeryLoose = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassLHVeryLoose", - EGammaSelectionTool = ElectronLHSelectorVeryLoose, - EGammaFudgeMCTool = "", - CutType = "", - StoreGateEntryName = "DFCommonElectronsLHVeryLoose", - ContainerName = "Electrons") +ElectronPassLHVeryLoose = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassLHVeryLoose", + EGammaElectronLikelihoodTool = ElectronLHSelectorVeryLoose, + EGammaFudgeMCTool = "", + CutType = "", + StoreGateEntryName = "DFCommonElectronsLHVeryLoose", + ContainerName = "Electrons", + StoreTResult = False) ToolSvc += ElectronPassLHVeryLoose print(ElectronPassLHVeryLoose) # decorate electrons with the output of LH loose -ElectronPassLHLoose = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassLHLoose", - EGammaSelectionTool = ElectronLHSelectorLoose, - EGammaFudgeMCTool = "", - CutType = "", - StoreGateEntryName = "DFCommonElectronsLHLoose", - ContainerName = "Electrons") +ElectronPassLHLoose = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassLHLoose", + EGammaElectronLikelihoodTool = ElectronLHSelectorLoose, + EGammaFudgeMCTool = "", + CutType = "", + StoreGateEntryName = "DFCommonElectronsLHLoose", + ContainerName = "Electrons", + StoreTResult = False) ToolSvc += ElectronPassLHLoose print(ElectronPassLHLoose) # decorate electrons with the output of LH loose+BL -ElectronPassLHLooseBL = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassLHLooseBL", - EGammaSelectionTool = ElectronLHSelectorLooseBL, - EGammaFudgeMCTool = "", - CutType = "", - StoreGateEntryName = "DFCommonElectronsLHLooseBL", - ContainerName = "Electrons") +ElectronPassLHLooseBL = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassLHLooseBL", + EGammaElectronLikelihoodTool = ElectronLHSelectorLooseBL, + EGammaFudgeMCTool = "", + CutType = "", + StoreGateEntryName = "DFCommonElectronsLHLooseBL", + ContainerName = "Electrons", + StoreTResult = False) ToolSvc += ElectronPassLHLooseBL print (ElectronPassLHLooseBL) # decorate electrons with the output of LH medium -ElectronPassLHMedium = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassLHMedium", - EGammaSelectionTool = ElectronLHSelectorMedium, - EGammaFudgeMCTool = "", - CutType = "", - StoreGateEntryName = "DFCommonElectronsLHMedium", - ContainerName = "Electrons") +ElectronPassLHMedium = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassLHMedium", + EGammaElectronLikelihoodTool = ElectronLHSelectorMedium, + EGammaFudgeMCTool = "", + CutType = "", + StoreGateEntryName = "DFCommonElectronsLHMedium", + ContainerName = "Electrons", + StoreTResult = False) ToolSvc += ElectronPassLHMedium print(ElectronPassLHMedium) # decorate electrons with the output of LH tight -ElectronPassLHTight = DerivationFramework__EGSelectionToolWrapper( name = "ElectronPassLHTight", - EGammaSelectionTool = ElectronLHSelectorTight, - EGammaFudgeMCTool = "", - CutType = "", - StoreGateEntryName = "DFCommonElectronsLHTight", - ContainerName = "Electrons") +ElectronPassLHTight = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassLHTight", + EGammaElectronLikelihoodTool = ElectronLHSelectorTight, + EGammaFudgeMCTool = "", + CutType = "", + StoreGateEntryName = "DFCommonElectronsLHTight", + ContainerName = "Electrons", + StoreTResult = False) ToolSvc += ElectronPassLHTight print(ElectronPassLHTight) +# +# Disabled as is missing in R22 +# +''' # decorate electrons with the output of ECIDS ---------------------------------------------------------------------- ElectronPassECIDS = DerivationFramework__EGElectronLikelihoodToolWrapper( name = "ElectronPassECIDS", EGammaElectronLikelihoodTool = ElectronChargeIDSelector, EGammaFudgeMCTool = "", CutType = "", StoreGateEntryName = "DFCommonElectronsECIDS", - - ContainerName = "Electrons", + ContainerName = "Electrons", StoreTResult = True) ToolSvc += ElectronPassECIDS print (ElectronPassECIDS) @@ -263,7 +281,7 @@ ForwardElectronPassLHTight = DerivationFramework__EGSelectionToolWrapper( name = ContainerName = "ForwardElectrons") ToolSvc += ForwardElectronPassLHTight print (ForwardElectronPassLHTight) - +''' # decorate photons with the output of IsEM loose # on MC, fudge the shower shapes before computing the ID (but the original shower shapes are not overridden) @@ -347,11 +365,14 @@ ElectronAmbiguity = DF_EGEAT(name = "ElectronAdditionnalAmbiguity" isMC = (globalflags.DataSource()!='data')) ToolSvc += ElectronAmbiguity +# +# Commented ForwardElectronPassLHLoose, ForwardElectronPassLHMedium, ForwardElectronPassLHTight, ElectronPassECIDS tools due to they are not available in R22 yet +# # list of all the decorators so far EGAugmentationTools = [DFCommonPhotonsDirection, ElectronPassLHVeryLoose, ElectronPassLHLoose, ElectronPassLHLooseBL, ElectronPassLHMedium, ElectronPassLHTight, - ForwardElectronPassLHLoose, ForwardElectronPassLHMedium, ForwardElectronPassLHTight, - ElectronPassECIDS, + #ForwardElectronPassLHLoose, ForwardElectronPassLHMedium, ForwardElectronPassLHTight, + #ElectronPassECIDS, PhotonPassIsEMLoose, PhotonPassIsEMTight, PhotonPassIsEMTightPtIncl, PhotonPassCleaning, @@ -366,13 +387,12 @@ if rec.doTruth(): # Decorate Electron with bkg electron type/origin from MCTruthClassifier.MCTruthClassifierBase import MCTruthClassifier as BkgElectronMCTruthClassifier BkgElectronMCTruthClassifier.barcodeG4Shift=(DerivationFrameworkSimBarcodeOffset+1) + BkgElectronMCTruthClassifier.ParticleCaloExtensionTool="" from DerivationFrameworkEGamma.DerivationFrameworkEGammaConf import DerivationFramework__BkgElectronClassification BkgElectronClassificationTool = DerivationFramework__BkgElectronClassification (name = "BkgElectronClassificationTool", MCTruthClassifierTool = BkgElectronMCTruthClassifier, barcodeCut=DerivationFrameworkSimBarcodeOffset) - - ToolSvc += BkgElectronClassificationTool print(BkgElectronClassificationTool) EGAugmentationTools.append(BkgElectronClassificationTool) @@ -406,16 +426,17 @@ if rec.doTruth(): # Compute the truth-particle-level energy density in the central eta region from EventShapeTools.EventDensityConfig import configEventDensityTool, EventDensityAthAlg from JetRec.JetRecStandard import jtm - tc=configEventDensityTool("EDTruthCentralTool", jtm.truthget, + tc=configEventDensityTool("EDTruthCentralTool", jtm.truthget.Label, 0.5, + AbsRapidityMin = 0.0, AbsRapidityMax = 1.5, OutputContainer = "TruthIsoCentralEventShape", - OutputLevel = 3, + OutputLevel = 3 ) ToolSvc += tc # Compute the truth-particle-level energy density in the forward eta region - tf=configEventDensityTool("EDTruthForwardTool", jtm.truthget, + tf=configEventDensityTool("EDTruthForwardTool", jtm.truthget.Label, 0.5, AbsRapidityMin = 1.5, AbsRapidityMax = 3.0, @@ -430,7 +451,6 @@ if rec.doTruth(): topSequence += EventDensityAthAlg("EDTruthCentralAlg", EventDensityTool = tc ) topSequence += EventDensityAthAlg("EDTruthForwardAlg", EventDensityTool = tf ) - #======================================= # CREATE THE DERIVATION KERNEL ALGORITHM #======================================= @@ -444,8 +464,11 @@ DerivationFrameworkJob += CfgMgr.DerivationFramework__CommonAugmentation("EGamma # ADD TOOLS #======================================= -import IsolationAlgs.IsoUpdatedTrackCones as isoCones -if not hasattr(DerivationFrameworkJob,"IsolationBuilderTight1000"): - DerivationFrameworkJob += isoCones.GetUpdatedIsoTrackCones() +# +# Disabling this tool due to it's missing in R22 +# +# import IsolationAlgs.IsoUpdatedTrackCones as isoCones +# if not hasattr(DerivationFrameworkJob,"IsolationBuilderTight1000"): +# DerivationFrameworkJob += isoCones.GetUpdatedIsoTrackCones() diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/FtagRun3DerivationConfig.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/FtagRun3DerivationConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..f8c51c522035244500e4e45497f0586abb2ffaf2 --- /dev/null +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/FtagRun3DerivationConfig.py @@ -0,0 +1,145 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +from AthenaCommon.CFElements import findAllAlgorithms +from AthenaCommon.AthenaCommonFlags import jobproperties as jps + + + + + +def FtagJetCollection(jetcol, seq): + + + jetcol_name_without_Jets = jetcol.replace('Jets','') + + from AthenaCommon.AppMgr import athCondSeq + + from AthenaCommon.Configurable import Configurable + + Configurable.configurableRun3Behavior=1 + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + from AthenaConfiguration.ComponentFactory import CompFactory + from AthenaConfiguration.ComponentAccumulator import conf2toConfigurable + from BTagging.JetParticleAssociationAlgConfig import JetParticleAssociationAlgCfg + from BTagging.JetBTaggingAlgConfig import JetBTaggingAlgCfg + from BTagging.JetSecVertexingAlgConfig import JetSecVertexingAlgCfg + from BTagging.JetSecVtxFindingAlgConfig import JetSecVtxFindingAlgCfg + from BTagging.BTagTrackAugmenterAlgConfig import BTagTrackAugmenterAlgCfg + from AthenaConfiguration.AllConfigFlags import ConfigFlags as cfgFlags + + + kwargs = {} + kwargs['Release'] = '22' + + + cfgFlags.Input.Files = jps.AthenaCommonFlags.FilesInput.get_Value() + + + acc = ComponentAccumulator() + + + taggerlist = ['IP2D', 'IP3D', 'SV1', 'SoftMu'] + + + CalibrationChannelAliases = ["AntiKt4EMPFlow->AntiKt4EMPFlow,AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo"] + + grades= cfgFlags.BTagging.Grades + + RNNIPConfig = {'rnnip':''} + + JetTagCalibCondAlg=CompFactory.Analysis.JetTagCalibCondAlg + jettagcalibcondalg = "JetTagCalibCondAlg" + readkeycalibpath = "/GLOBAL/BTagCalib/RUN12" + connSchema = "GLOBAL_OFL" + if not cfgFlags.Input.isMC: + readkeycalibpath = readkeycalibpath.replace("/GLOBAL/BTagCalib","/GLOBAL/Onl/BTagCalib") + connSchema = "GLOBAL" + histoskey = "JetTagCalibHistosKey" + from IOVDbSvc.CondDB import conddb + + conddb.addFolder(connSchema, readkeycalibpath, className='CondAttrListCollection') + JetTagCalib = JetTagCalibCondAlg(jettagcalibcondalg, ReadKeyCalibPath=readkeycalibpath, HistosKey = histoskey, taggers = taggerlist, + channelAliases = CalibrationChannelAliases, IP2D_TrackGradePartitions = grades, RNNIP_NetworkConfig = RNNIPConfig) + + athCondSeq+=conf2toConfigurable( JetTagCalib, indent=" " ) + + acc.merge(JetParticleAssociationAlgCfg(cfgFlags, jetcol_name_without_Jets, "InDetTrackParticles", 'BTagTrackToJetAssociator', **kwargs)) + + SecVertexingAndAssociators = {'JetFitter':'BTagTrackToJetAssociator','SV1':'BTagTrackToJetAssociator'} + for k, v in SecVertexingAndAssociators.items(): + + acc.merge(JetSecVtxFindingAlgCfg(cfgFlags, jetcol_name_without_Jets, "PrimaryVertices", k, v)) + + + acc.merge(JetSecVertexingAlgCfg(cfgFlags, jetcol_name_without_Jets, "PrimaryVertices", k, v)) + + + acc.merge( JetBTaggingAlgCfg(cfgFlags, JetCollection = jetcol_name_without_Jets, PrimaryVertexCollectionName="PrimaryVertices", TaggerList = taggerlist, SVandAssoc = SecVertexingAndAssociators) ) + + + + postTagDL2JetToTrainingMap={ + 'AntiKt4EMPFlow': [ + #'BTagging/201903/smt/antikt4empflow/network.json', + 'BTagging/201903/rnnip/antikt4empflow/network.json', + 'BTagging/201903/dl1r/antikt4empflow/network.json', + 'BTagging/201903/dl1/antikt4empflow/network.json', + #'BTagging/201903/dl1rmu/antikt4empflow/network.json', + ] + } + + acc.merge(BTagTrackAugmenterAlgCfg(cfgFlags)) + + + Analysis__BTagHighLevelAugmenterAlg=CompFactory.Analysis.BTagHighLevelAugmenterAlg + + options = {} + options['JetCollectionName'] = jetcol + options['BTaggingCollectionName'] = 'BTagging_'+jetcol_name_without_Jets + options['JetLinkName'] = options['BTaggingCollectionName'] + '.jetLink' + options['BTagTrackToJetAssociatorName'] = 'BTagTrackToJetAssociator' + options['name'] = ( 'BTagging_'+jetcol_name_without_Jets+ '_Augment').lower() + + acc.addEventAlgo(Analysis__BTagHighLevelAugmenterAlg(**options)) + + + Analysis__HighLevelBTagAlg=CompFactory.Analysis.HighLevelBTagAlg + FlavorTagDiscriminants__DL2Tool=CompFactory.FlavorTagDiscriminants.DL2Tool + + for jsonfile in postTagDL2JetToTrainingMap[jetcol_name_without_Jets]: + + options = {} + options['nnFile'] = jsonfile + options['name'] = "decorator" + dl2tool = FlavorTagDiscriminants__DL2Tool(**options) + + Name = jsonfile.replace("/", "_").replace("_network.json", "") + + options = {} + options['BTaggingCollectionName'] = 'BTagging_'+jetcol_name_without_Jets + options['JetDecorator'] = dl2tool + options['name'] = Name.lower() + + acc.addEventAlgo(Analysis__HighLevelBTagAlg(**options)) + + + + Configurable.configurableRun3Behavior=0 + + + algs = findAllAlgorithms(acc.getSequence("AthAlgSeq")) + + for alg in algs: + + seq += conf2toConfigurable(alg) + + acc.wasMerged() + + + return + + + + + + diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/CMakeLists.txt b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/CMakeLists.txt index f63656e5bce85f9440f0b6fd4ef6a46b603fa5ee..39850db7e11a7869b5d0887c987333b39a31dc12 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/CMakeLists.txt +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/CMakeLists.txt @@ -50,5 +50,3 @@ atlas_add_component( DerivationFrameworkJetEtMiss # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) -atlas_install_runtime( share/*.root ) - diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py index 0e9be5fdc5e183a3efd2ce2e8c0f38362f1b0f18..2519c8ce238caeccae5dd51a97ddd142aaa5c04f 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkPhys/share/PHYS.py @@ -229,18 +229,11 @@ SeqPHYS += CfgMgr.DerivationFramework__DerivationKernel("PHYSKernel", #==================================================================== # FLAVOUR TAGGING #==================================================================== -# Create variable-R trackjets and dress AntiKt10LCTopo with ghost VR-trkjet -# addVRJets(SeqPHYS) -# addVRJets(SeqPHYS, training='201903') -#addVRJetsTCC(DerivationFrameworkJob, "AntiKtVR30Rmax4Rmin02Track", "GhostVR30Rmax4Rmin02TrackJet", -# VRJetAlg="AntiKt", VRJetRadius=0.4, VRJetInputs="pv0track", -# ghostArea = 0 , ptmin = 2000, ptminFilter = 2000, -# variableRMinRadius = 0.02, variableRMassScale = 30000, calibOpt = "none") -# add xbb taggers -# from DerivationFrameworkFlavourTag.HbbCommon import addRecommendedXbbTaggers -# addRecommendedXbbTaggers(SeqPHYS, ToolSvc) - -# FlavorTagInit(JetCollections = [ 'AntiKt4EMTopoJets','AntiKt4EMPFlowJets'], Sequencer = SeqPHYS) + +from DerivationFrameworkFlavourTag.FtagRun3DerivationConfig import FtagJetCollection + +FtagJetCollection('AntiKt4EMPFlowJets',SeqPHYS) + #==================================================================== # TC-LVT Vertices @@ -264,9 +257,7 @@ PHYSSlimmingHelper.SmartCollections = ["Electrons", "InDetTrackParticles", "AntiKt4EMTopoJets", "AntiKt4EMPFlowJets", - #"BTagging_AntiKt4EMTopo_201810", - #"BTagging_AntiKt4EMPFlow_201810", - #"BTagging_AntiKt4EMPFlow_201903", + "BTagging_AntiKt4EMPFlow", #"MET_Baseline_AntiKt4EMTopo", #"MET_Baseline_AntiKt4EMPFlow", "TauJets", diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP3.py index 660c399accb3b6468adb94cfb280ddfd00d5ca90..ae66e81322b5d8ef592ae5a82a701359d8500c86 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP3.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP3.py @@ -7,109 +7,89 @@ from DerivationFrameworkInDet.InDetCommon import * from DerivationFrameworkJetEtMiss.JetCommon import * from DerivationFrameworkJetEtMiss.ExtendedJetCommon import * from DerivationFrameworkJetEtMiss.METCommon import * -from DerivationFrameworkEGamma.EGammaCommon import * from DerivationFrameworkMuons.MuonsCommon import * -if DerivationFrameworkIsMonteCarlo: - from DerivationFrameworkMCTruth.MCTruthCommon import * - from DerivationFrameworkTau.TauTruthCommon import * -from DerivationFrameworkTau.TauCommon import * # ========================================================================================================================== # Set up stream # ========================================================================================================================== -streamName = derivationFlags.WriteDAOD_TAUP3Stream.StreamName -fileName = buildFileName( derivationFlags.WriteDAOD_TAUP3Stream ) -TAUP3Stream = MSMgr.NewPoolRootStream( streamName, fileName ) +streamName = derivationFlags.WriteDAOD_TAUP3Stream.StreamName +fileName = buildFileName( derivationFlags.WriteDAOD_TAUP3Stream ) +TAUP3Stream = MSMgr.NewPoolRootStream( streamName, fileName ) TAUP3Stream.AcceptAlgs(["TAUP3Kernel"]) -augStream = MSMgr.GetStream( streamName ) -evtStream = augStream.GetEventStream() +augStream = MSMgr.GetStream( streamName ) +evtStream = augStream.GetEventStream() + +SeqTAUP3 = CfgMgr.AthSequencer("SeqTAUP3") # ========================================================================================================================== -# Thinning tool +# MC truth # ========================================================================================================================== -# MET/Jet tracks -thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" - -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning -TAUP3JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( - name = "TAUP3JetTPThinningTool", - StreamName = streamName, - JetKey = "AntiKt4LCTopoJets", - InDetTrackParticlesKey = "InDetTrackParticles", - TrackSelectionString = thinning_expression) -ToolSvc += TAUP3JetTPThinningTool +if DerivationFrameworkIsMonteCarlo: + from DerivationFrameworkMCTruth.MCTruthCommon import addStandardTruthContents + addStandardTruthContents(SeqTAUP3,prefix='TAUP3_') +# ========================================================================================================================== +# Thinning tool +# ========================================================================================================================== from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__CaloClusterThinning -TAUP3CaloClusterThinning = DerivationFramework__CaloClusterThinning( - name = "TAUP3ClusterThinning", - StreamName = streamName, - SGKey = "TauJets", - TopoClCollectionSGKey = "CaloCalTopoClusters") -ToolSvc += TAUP3CaloClusterThinning +TAUP3CaloClusterThinning = DerivationFramework__CaloClusterThinning(name = "TAUP3ClusterThinning", + StreamName = streamName, + SGKey = "TauJets", + TopoClCollectionSGKey = "CaloCalTopoClusters") +ToolSvc += TAUP3CaloClusterThinning # Tracks associated with electrons from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__EgammaTrackParticleThinning -TAUP3ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning( - name = "TAUP3ElectronTPThinningTool", - StreamName = streamName, - SGKey = "Electrons", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += TAUP3ElectronTPThinningTool +TAUP3ElectronTPThinningTool = DerivationFramework__EgammaTrackParticleThinning(name = "TAUP3ElectronTPThinningTool", + StreamName = streamName, + SGKey = "Electrons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += TAUP3ElectronTPThinningTool # Tracks associated with muons from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__MuonTrackParticleThinning -TAUP3MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning( - name = "TAUP3MuonTPThinningTool", - StreamName = streamName, - MuonKey = "Muons", - InDetTrackParticlesKey = "InDetTrackParticles") -ToolSvc += TAUP3MuonTPThinningTool +TAUP3MuonTPThinningTool = DerivationFramework__MuonTrackParticleThinning(name = "TAUP3MuonTPThinningTool", + StreamName = streamName, + MuonKey = "Muons", + InDetTrackParticlesKey = "InDetTrackParticles") +ToolSvc += TAUP3MuonTPThinningTool # Tracks associated with taus from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TauTrackParticleThinning -TAUP3TauTPThinningTool = DerivationFramework__TauTrackParticleThinning( - name = "TAUP3TauTPThinningTool", - StreamName = streamName, - TauKey = "TauJets", - InDetTrackParticlesKey = "InDetTrackParticles", - ConeSize = 0.6) -ToolSvc += TAUP3TauTPThinningTool +TAUP3TauTPThinningTool = DerivationFramework__TauTrackParticleThinning(name = "TAUP3TauTPThinningTool", + StreamName = streamName, + TauKey = "TauJets", + InDetTrackParticlesKey = "InDetTrackParticles", + ConeSize = 0.6) +ToolSvc += TAUP3TauTPThinningTool # ========================================================================================================================== # Skimming tool # ========================================================================================================================== -muRequirement = "( count( (Muons.pt > 22.0*GeV) && Muons.DFCommonGoodMuon ) >= 1 )" -tauRequirement = "( count( (TauJets.pt > 18.0*GeV) && (abs(TauJets.charge)==1.0) && ((TauJets.nTracks == 1) || (TauJets.nTracks == 3)) ) >= 1 )" +muRequirement = "( count( (Muons.pt > 22.0*GeV) && Muons.DFCommonGoodMuon ) >= 1 )" +tauRequirement = "( count( (TauJets.pt > 15.0*GeV) && (abs(TauJets.charge)==1.0) && ((TauJets.nTracks == 1) || (TauJets.nTracks == 3)) ) >= 1 )" -expression = muRequirement + " && " + tauRequirement +expression = muRequirement + " && " + tauRequirement from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool -TAUP3SkimmingTool = DerivationFramework__xAODStringSkimmingTool( - name = "TAUP3SkimmingTool", - expression = expression) +TAUP3SkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = "TAUP3SkimmingTool", + expression = expression) -ToolSvc += TAUP3SkimmingTool +ToolSvc += TAUP3SkimmingTool # ========================================================================================================================== # Kernel algorithm # ========================================================================================================================== -augmentationTools = [] -# JRC: This is now done in TauCommon.py -# if DerivationFrameworkIsMonteCarlo: -# augmentationTools += [DFCommonTauTruthMatchingWrapper] - from DerivationFrameworkCore.DerivationFrameworkCoreConf import DerivationFramework__DerivationKernel -DerivationFrameworkJob += CfgMgr.DerivationFramework__DerivationKernel( - "TAUP3Kernel", - SkimmingTools = [TAUP3SkimmingTool], - ThinningTools = [TAUP3MetTPThinningTool, - TAUP3JetTPThinningTool, - TAUP3CaloClusterThinning, - TAUP3ElectronTPThinningTool, - TAUP3MuonTPThinningTool, - TAUP3TauTPThinningTool], - AugmentationTools = augmentationTools) +SeqTAUP3 += CfgMgr.DerivationFramework__DerivationKernel("TAUP3Kernel", + SkimmingTools = [TAUP3SkimmingTool], + ThinningTools = [TAUP3CaloClusterThinning, + TAUP3ElectronTPThinningTool, + TAUP3MuonTPThinningTool, + TAUP3TauTPThinningTool]) + +DerivationFrameworkJob += SeqTAUP3 # ========================================================================================================================== # Add the containers to the output stream (slimming done here) @@ -117,31 +97,19 @@ DerivationFrameworkJob += CfgMgr.DerivationFramework__D from DerivationFrameworkCore.SlimmingHelper import SlimmingHelper from DerivationFrameworkTau.TAUPExtraContent import * -TAUP3SlimmingHelper = SlimmingHelper("TAUP3SlimmingHelper") -TAUP3SlimmingHelper.SmartCollections = ["Electrons", - "Photons", - "Muons", - "TauJets", - "MET_Reference_AntiKt4EMTopo", - "MET_Reference_AntiKt4LCTopo", - "AntiKt4EMTopoJets", - "AntiKt4LCTopoJets", - "BTagging_AntiKt4EMTopo", - "BTagging_AntiKt4LCTopo", - "InDetTrackParticles", - "PrimaryVertices"] - -if DerivationFrameworkIsMonteCarlo: - TAUP3SlimmingHelper.StaticContent = ["xAOD::TruthParticleContainer#TruthElectrons", - "xAOD::TruthParticleAuxContainer#TruthElectronsAux.", - "xAOD::TruthParticleContainer#TruthMuons", - "xAOD::TruthParticleAuxContainer#TruthMuonsAux.", - "xAOD::TruthParticleContainer#TruthTaus", - "xAOD::TruthParticleAuxContainer#TruthTausAux.", - "xAOD::TruthParticleContainer#TruthPhotons", - "xAOD::TruthParticleAuxContainer#TruthPhotonsAux.", - "xAOD::TruthParticleContainer#TruthNeutrinos", - "xAOD::TruthParticleAuxContainer#TruthNeutrinosAux."] +TAUP3SlimmingHelper = SlimmingHelper("TAUP3SlimmingHelper") +TAUP3SlimmingHelper.SmartCollections = ["Electrons", + "Photons", + "Muons", + "TauJets", + "MET_Reference_AntiKt4EMTopo", + "MET_Reference_AntiKt4LCTopo", + "AntiKt4EMTopoJets", + "AntiKt4LCTopoJets", + #"BTagging_AntiKt4EMTopo", + #"BTagging_AntiKt4LCTopo", + "InDetTrackParticles", + "PrimaryVertices"] TAUP3SlimmingHelper.IncludeMuonTriggerContent = True TAUP3SlimmingHelper.IncludeEGammaTriggerContent = True @@ -149,18 +117,19 @@ TAUP3SlimmingHelper.IncludeEtMissTriggerContent = True TAUP3SlimmingHelper.IncludeJetTriggerContent = True TAUP3SlimmingHelper.IncludeBJetTriggerContent = True -TAUP3SlimmingHelper.ExtraVariables = ExtraContentTAUP3 -TAUP3SlimmingHelper.AllVariables = ExtraContainersTAUP3 +TAUP3SlimmingHelper.ExtraVariables = ExtraContentTAUP3 +TAUP3SlimmingHelper.AllVariables = ExtraContainersTAUP3 -if globalflags.DataSource() == "geant4": - TAUP3SlimmingHelper.ExtraVariables += ExtraContentTruthTAUP3 - TAUP3SlimmingHelper.AllVariables += ExtraContainersTruthTAUP3 +if DerivationFrameworkIsMonteCarlo: + TAUP3SlimmingHelper.ExtraVariables += ExtraContentTruthTAUP3 + TAUP3SlimmingHelper.AllVariables += ExtraContainersTruthTAUP3 + TAUP3SlimmingHelper.AllVariables += ["TruthElectrons", + "TruthMuons", + "TruthTaus", + "TruthPhotons", + "TruthNeutrinos"] TAUP3SlimmingHelper.AppendContentToStream(TAUP3Stream) TAUP3Stream.AddItem("xAOD::EventShape#*") TAUP3Stream.AddItem("xAOD::EventShapeAuxInfo#*") - -# Add MET_RefFinalFix -# JRC TEMPORARILY COMMENTED -# addMETOutputs(TAUP3Stream) diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/CMakeLists.txt index 53e8bc68aac7d2f3f13284cc1a391dd7dcec3410..214581144d989e86d781f60869afe46615d339a8 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/CMakeLists.txt +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronEfficiencyCorrection/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 797023 2017-02-14 11:03:58Z christos $ ################################################################################ # Package: ElectronEfficiencyCorrection ################################################################################ @@ -106,6 +105,3 @@ endif() # Install files from the package: atlas_install_joboptions( share/*.py) -atlas_install_data( data/*.root data/*.txt ) - - diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonFourMomentumCorrection/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonFourMomentumCorrection/CMakeLists.txt index 2c4f20cb57adc48280c6011f2e0975fd725f578e..937683c1327d6890e6b3f8ddbee2551db1b5ec7f 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonFourMomentumCorrection/CMakeLists.txt +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonFourMomentumCorrection/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 794027 2017-01-26 15:03:20Z tguillem $ ################################################################################### # Package: ElectronPhotonFourMomentumCorrection ################################################################################### @@ -8,12 +7,14 @@ atlas_subdir( ElectronPhotonFourMomentumCorrection ) # Environment specific extra dependencies: set( extra_dep ) +set( extra_libs ) if( XAOD_STANDALONE ) set( extra_dep Control/xAODRootAccess ) else() set( extra_dep Control/AthenaBaseComps Control/AthAnalysisBaseComps GaudiKernel ) + set( extra_libs AthAnalysisBaseCompsLib ) endif() # Declare the package's dependencies: @@ -49,7 +50,7 @@ atlas_add_library( ElectronPhotonFourMomentumCorrectionLib INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODCaloEvent xAODEgamma xAODEventInfo PATInterfaces EgammaAnalysisInterfacesLib PATCoreLib egammaUtils - egammaMVACalibAnalysisLib xAODTruth + egammaMVACalibAnalysisLib xAODTruth ${extra_libs} PRIVATE_LINK_LIBRARIES xAODTracking xAODMetaData egammaLayerRecalibTool PathResolver ) @@ -103,5 +104,3 @@ endif() # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) -atlas_install_xmls( data/*.root ) -atlas_install_data( data/*.root ) diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt index fb6e5abd7d1d0e13a4070aa9d97e74643635b605..d6213fa1b8f68f9e1717227215e7be08b4b65e2e 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/CMakeLists.txt @@ -86,5 +86,4 @@ endif() # Install files from the package: atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) -atlas_install_data( data/*.root data/*.conf ) +atlas_install_data( data/*.conf ) diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/Root/EGSelectorConfigurationMapping.h b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/Root/EGSelectorConfigurationMapping.h index 20ce54c4d637f48faa620c2d6a97ffac2b7217fe..a9008e4da71d4fcde40c97e755c679cec1324849 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/Root/EGSelectorConfigurationMapping.h +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/Root/EGSelectorConfigurationMapping.h @@ -31,9 +31,11 @@ namespace EgammaSelectors { {"TightLHElectron_Rel20p7","ElectronPhotonSelectorTools/offline/mc15_20160512/ElectronLikelihoodTightOfflineConfig2016_Smooth.conf"}, }; const std::map<std::string,std::string> PhotonCutPointToConfFile={ + // These should be the current best-supported ID menus. Typically picked up by analyzers using the "WorkingPoint" option. + // Note: keep this conf file up to date with the PhotonIsEMTightSelectorConfig function in python/PhotonIsEMTightSelectorCutDefs.py {"LoosePhoton","ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMLooseSelectorCutDefs.conf"}, {"MediumPhoton","ElectronPhotonSelectorTools/offline/mc15_20160512/PhotonIsEMMediumSelectorCutDefs.conf"}, - {"TightPhoton","ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMTightSelectorCutDefs.conf"}, + {"TightPhoton","ElectronPhotonSelectorTools/offline/20180825/PhotonIsEMTightSelectorCutDefs.conf"}, }; const std::map<std::string,std::string> ForwardElectronCutPointToConfFile={ {"LooseForwardElectron","ElectronPhotonSelectorTools/offline/mc15_20150812/ForwardElectronIsEMLooseSelectorCutDefs.conf"}, diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ConfiguredAsgPhotonIsEMSelectors.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ConfiguredAsgPhotonIsEMSelectors.py index aca1c0b090e28586813d932fd044b4329625cba4..d2e0b619d7d4b4e2ec1a04aea5c76a2400c14fd7 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ConfiguredAsgPhotonIsEMSelectors.py +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/ConfiguredAsgPhotonIsEMSelectors.py @@ -21,7 +21,7 @@ from ElectronPhotonSelectorTools.PhotonIsEMSelectorMapping import ( def ConfiguredAsgPhotonIsEMSelector( - name, quality, menu=photonPIDmenu.menuDC14, **kw): + name, quality, menu=photonPIDmenu.menuCurrentCuts, **kw): """ Configure the AsgPhotonIsEMSelector with the quality cuts and allow for (re-)setting of all provided cuts. diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMLooseSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMLooseSelectorCutDefs.py index e3a4c93cb878ee37a274c494c4f2c3bdb0a5250b..ba9d946a6c427d52afb0943ca146d7a8c76083b9 100755 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMLooseSelectorCutDefs.py +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMLooseSelectorCutDefs.py @@ -10,7 +10,7 @@ from PATCore.HelperUtils import * # Define GeV GeV = 1000.0 -def PhotonIsEMLooseSelectorConfigDC14(theTool) : +def PhotonIsEMLooseSelectorConfig(theTool) : ''' These are the photon isEM definitions *DC14* Loose ''' diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMMediumSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMMediumSelectorCutDefs.py index 40ee83253fc7bb1ceb252578993c26d54b9bdf91..1b519e4913aa085756f9f76e5284f6aa54340dd8 100755 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMMediumSelectorCutDefs.py +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMMediumSelectorCutDefs.py @@ -8,7 +8,7 @@ from PATCore.HelperUtils import * -def PhotonIsEMMediumSelectorConfigDC14(theTool) : +def PhotonIsEMMediumSelectorConfig(theTool) : ''' These are the photon isEM definitions from *DC14* ''' diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorMapping.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorMapping.py index d0267f7c89cc477b2a8e4eaf9aa0f744aba4bc34..1f1cc29b2b5481bf7aea24eac4ab69635c2f9962 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorMapping.py +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMSelectorMapping.py @@ -17,12 +17,22 @@ except : from ROOT import egammaPID +# +# The "photonPIDmenu" used to store every menu in existence... now we will simply update the +# location of the conf file to the new path. +# Therefore, the CURRENT MENU is: menuCurrentCuts (corresponding to the PhotonIsEMMapCurrent dict) +# and the other menu that exists is the "menuPtInclJan2018" (the PhotonIsEMMapPtInclJan2018 dict) +# (because it will be used concurrently in the same tag of athena). +# Should remove menuPtInclJan2018 when it is no longer supported. +# class photonPIDmenu: - menu2011 = 0 - menu2012 = 1 - origMenu2012 = 2 # this is the original menu not meant for anyone to use - menuDC14 = 3 - menuTrigDC14 = 4 + # menu2011 = 0 + # menu2012 = 1 + # origMenu2012 = 2 # this is the original menu not meant for anyone to use + # menuDC14 = 3 + # menuTrigDC14 = 4 + menuCurrentCuts = 5 + menuPtInclJan2018 = 6 import ElectronPhotonSelectorTools.PhotonIsEMSelectorCutDefs as PhotonIsEMSelectorCutDefs import ElectronPhotonSelectorTools.PhotonIsEMLooseSelectorCutDefs as PhotonIsEMLooseSelectorCutDefs @@ -33,70 +43,28 @@ import ElectronPhotonSelectorTools.TrigPhotonIsEMCaloCutsOnlySelectorCutDefs as # format - key: (mask, function) -TrigPhotonIsEMMapDC14 = { - egammaPID.PhotonIDLooseEF: ( egammaPID.PhotonLooseEF, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfigDC14 ), - egammaPID.PhotonIDMediumEF: ( egammaPID.PhotonMediumEF, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfigDC14 ), - egammaPID.PhotonIDTight: ( egammaPID.PhotonTight, PhotonIsEMTightSelectorCutDefs.PhotonIsEMTightSelectorConfigDC14 ), - } - - -PhotonIsEMMapDC14 = { - egammaPID.PhotonIDLoose: ( egammaPID.PhotonLoose, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfigDC14 ), - egammaPID.PhotonIDMedium: ( egammaPID.PhotonMedium, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfigDC14 ), - egammaPID.PhotonIDTight: ( egammaPID.PhotonTight, PhotonIsEMTightSelectorCutDefs.PhotonIsEMTightSelectorConfigDC14 ), - - egammaPID.PhotonIDLooseAR: ( egammaPID.PhotonLooseAR, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfigDC14 ), - egammaPID.PhotonIDMediumAR: ( egammaPID.PhotonMediumAR, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfigDC14 ), - egammaPID.PhotonIDTightAR: ( egammaPID.PhotonTightAR, PhotonIsEMTightSelectorCutDefs.PhotonIsEMTightSelectorConfigDC14 ), - - egammaPID.NoIDCut: ( 0, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfigDC14 ) - } - -PhotonIsEMMap2011 = { - egammaPID.PhotonIDLoose: ( egammaPID.PhotonLoose, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2011 ), - egammaPID.PhotonIDTight: ( egammaPID.PhotonTight, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2011 ), +PhotonIsEMMapCurrent = { + egammaPID.PhotonIDLoose: ( egammaPID.PhotonLoose, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfig ), + egammaPID.PhotonIDMedium: ( egammaPID.PhotonMedium, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfig ), + egammaPID.PhotonIDTight: ( egammaPID.PhotonTight, PhotonIsEMTightSelectorCutDefs.PhotonIsEMTightSelectorConfig ), - egammaPID.PhotonIDLooseAR: ( egammaPID.PhotonLooseAR, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2011 ), - egammaPID.PhotonIDTightAR: ( egammaPID.PhotonTightAR, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2011 ), + egammaPID.PhotonIDLooseAR: ( egammaPID.PhotonLooseAR, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfig ), + egammaPID.PhotonIDMediumAR: ( egammaPID.PhotonMediumAR, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfig ), + egammaPID.PhotonIDTightAR: ( egammaPID.PhotonTightAR, PhotonIsEMTightSelectorCutDefs.PhotonIsEMTightSelectorConfig ), - egammaPID.NoIDCut: ( 0, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012 ) + egammaPID.NoIDCut: ( 0, PhotonIsEMLooseSelectorCutDefs.PhotonIsEMLooseSelectorConfig ) } -PhotonIsEMMap2012 = { - egammaPID.PhotonIDLoose: ( egammaPID.PhotonLoose, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012 ), - egammaPID.PhotonIDMedium: ( egammaPID.PhotonMedium, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfig2012 ), - egammaPID.PhotonIDTight: ( egammaPID.PhotonTight, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012 ), - - egammaPID.PhotonIDLooseAR: ( egammaPID.PhotonLooseAR, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012 ), - egammaPID.PhotonIDMediumAR: ( egammaPID.PhotonMediumAR, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfig2012 ), - egammaPID.PhotonIDTightAR: ( egammaPID.PhotonTightAR, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012 ), - - egammaPID.NoIDCut: ( 0, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012 ) - } - -PhotonIsEMMap2012OLD = { - egammaPID.PhotonIDLoose: ( egammaPID.PhotonLoose, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012OLD ), - egammaPID.PhotonIDMedium: ( egammaPID.PhotonMedium, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfig2012 ), # unchanged - egammaPID.PhotonIDTight: ( egammaPID.PhotonTight, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012OLD ), - - egammaPID.PhotonIDLooseAR: ( egammaPID.PhotonLooseAR, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012OLD ), - egammaPID.PhotonIDMediumAR: ( egammaPID.PhotonMediumAR, PhotonIsEMMediumSelectorCutDefs.PhotonIsEMMediumSelectorConfig2012 ), - egammaPID.PhotonIDTightAR: ( egammaPID.PhotonTightAR, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012OLD ), - - egammaPID.NoIDCut: ( 0, PhotonIsEMSelectorCutDefs.PhotonIsEMSelectorConfig2012OLD ) +PhotonIsEMMapPtInclJan2018 = { + egammaPID.PhotonIDTight: ( egammaPID.PhotonTight , PhotonIsEMTightSelectorCutDefs.PhotonIsEMTightSelectorConfigPtInclJan2018 ), } def PhotonIsEMMap(quality, menu): - if menu == photonPIDmenu.menu2011: - return PhotonIsEMMap2011[quality] - elif menu == photonPIDmenu.menu2012: - return PhotonIsEMMap2012[quality] - elif menu == photonPIDmenu.origMenu2012: - return PhotonIsEMMap2012OLD[quality] - elif menu == photonPIDmenu.menuDC14: - return PhotonIsEMMapDC14[quality] - elif menu == photonPIDmenu.menuTrigDC14: - return TrigPhotonIsEMMapDC14[quality] + # These are the "current menus" (non-legacy) + if menu == photonPIDmenu.menuCurrentCuts and quality in PhotonIsEMMapCurrent.keys() : + return PhotonIsEMMapCurrent[quality] + elif menu == photonPIDmenu.menuPtInclJan2018 and quality in PhotonIsEMMapPtInclJan2018.keys() : + return PhotonIsEMMapPtInclJan2018[quality] else: raise ValueError("Requested menu is undefined: %d" % menu) diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMTightSelectorCutDefs.py b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMTightSelectorCutDefs.py index 3aa5adf995f20ed5b444751e615a11ce454d5c60..c34fbe4f771b88671ccaf024b629902935a63c0b 100755 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMTightSelectorCutDefs.py +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools/python/PhotonIsEMTightSelectorCutDefs.py @@ -9,7 +9,12 @@ from PATCore.HelperUtils import * # Define GeV GeV = 1000.0 -def PhotonIsEMTightSelectorConfigDC14(theTool) : +# +# Current cut-based tight menu. When updating tight, simply change the config-file below +# (and please add a meaningful description of the conf file) +# Note: keep this conf file up to date with the PhotonCutPointToConfFile map in Root/EGSelectorConfigurationMapping.h +# +def PhotonIsEMTightSelectorConfig(theTool) : ''' These are the photon isEM definitions for Tight menu ''' @@ -17,7 +22,24 @@ def PhotonIsEMTightSelectorConfigDC14(theTool) : theTool = GetTool(theTool) # - # PHOTON tight cuts, with updated using *DC14* + # Pt-dependent tight cuts, derived in August 2018 ("v11") # - theTool.ConfigFile = "ElectronPhotonSelectorTools/offline/mc15_20150712/PhotonIsEMTightSelectorCutDefs.conf" + theTool.ConfigFile = "ElectronPhotonSelectorTools/offline/20180825/PhotonIsEMTightSelectorCutDefs.conf" + +# +# Pt-inclusive tight ID menu, derived in January 2018. +# Needs to be kept around until the new menu is fully supported, but can be removed +# when it becomes obsolete. +# +def PhotonIsEMTightSelectorConfigPtInclJan2018(theTool) : + ''' + These are the photon isEM definitions for Tight menu + ''' + + theTool = GetTool(theTool) + + # + # PHOTON tight cuts, now with January 2018 re-optimization + # + theTool.ConfigFile = "ElectronPhotonSelectorTools/offline/20180116/PhotonIsEMTightSelectorCutDefs.conf" diff --git a/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/CMakeLists.txt index 73a621138a339a3e750e7f4374b5ed0686887946..e49760cf866b8b8f509d68129d9a8787b28082e6 100644 --- a/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/CMakeLists.txt +++ b/PhysicsAnalysis/ElectronPhotonID/IsolationCorrections/CMakeLists.txt @@ -52,7 +52,3 @@ atlas_add_dictionary( IsolationCorrectionsDict IsolationCorrections/IsolationCorrectionsDict.h IsolationCorrections/selection.xml LINK_LIBRARIES IsolationCorrectionsLib ) - -# Install files from the package: -atlas_install_data( data/*.root ) - diff --git a/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/Root/egammaMVATool.cxx b/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/Root/egammaMVATool.cxx index 0b94e26c1ccc43cc46fb2373d5662014baa75d56..47d00300d9ac73d75dd5c7ba4ec1901889224f18 100644 --- a/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/Root/egammaMVATool.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/Root/egammaMVATool.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 "egammaMVACalibAnalysis/egammaMVATool.h" @@ -54,7 +54,7 @@ StatusCode egammaMVATool::initialize() { ATH_MSG_DEBUG("configuration does not contain list of variables, try to guess:"); // TODO: because it is not implemented std::set<std::string> el_variables = guess_variables(filename); el_variables.insert({"el_cl_E", "el_cl_eta", "el_rawcl_Es0", "el_rawcl_Es1", "el_rawcl_Es2", "el_rawcl_Es3"}); // used for binning - for (const auto var : el_variables) { ATH_MSG_DEBUG(" " << var); } + for (const auto& var : el_variables) { ATH_MSG_DEBUG(" " << var); } ATH_MSG_INFO(el_variables.size() << " variables for electrons"); m_MVATreeElectron = std::make_unique<egammaMVATreeElectron>("MVATreeElectron", el_variables, m_use_layer_corrected); @@ -86,7 +86,7 @@ StatusCode egammaMVATool::initialize() { ph_variables.insert(ph_conv_variables.begin(), ph_conv_variables.end()); ph_variables.insert({"ph_cl_E", "ph_cl_eta", "ph_rawcl_Es0", "ph_rawcl_Es1", "ph_rawcl_Es2", "ph_rawcl_Es3"}); // used for binning ATH_MSG_INFO(ph_variables.size() << " variables for photons"); - for (const auto var : ph_variables) { ATH_MSG_INFO(" " << var); } + for (const auto& var : ph_variables) { ATH_MSG_INFO(" " << var); } m_MVATreePhoton = std::make_unique<egammaMVATreePhoton>("MVATreePhoton", ph_variables, m_use_layer_corrected, true); m_MVATreePhoton->msg().setLevel(this->msg().level()); @@ -120,7 +120,7 @@ std::set<std::string> egammaMVATool::guess_variables(const std::string& filename while (TNamed* obj = dynamic_cast<TNamed*>(iter())) { const std::string expression = obj->GetTitle(); ATH_MSG_DEBUG("searching variables in " << expression); - for (const auto var : all_possible_variables) { + for (const auto& var : all_possible_variables) { const auto pos = expression.find(var); if (pos != std::string::npos) { if (pos + var.size() < expression.size()) { diff --git a/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/egammaMVACalibAnalysis/egammaMVATree.h b/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/egammaMVACalibAnalysis/egammaMVATree.h index 5a27870a78732ec0e24449e67a13b593705e4fe4..2723ea295ea4159b1d855c6d9c3546a1e5ad56a5 100644 --- a/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/egammaMVACalibAnalysis/egammaMVATree.h +++ b/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/egammaMVACalibAnalysis/egammaMVATree.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 EGAMMAMVACALIBANALYSIS_EGAMMAMVATREE @@ -119,7 +119,7 @@ protected: // WARNING: pay attention to iterator/pointer invalidation: // first populate container, then access to pointers. Do not mix! - for (const auto var_name : vars) { + for (const auto& var_name : vars) { search_var_and_add<float>(var_name, map_string_function, container); } diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/BTagJetAugmenter.h b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/BTagJetAugmenter.h index 37e88d2ff8ac5421cbe87bb11d6db0dd9ef57d90..f76f99de91741bb112522cbae6cfa4b3a3ae4801 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/BTagJetAugmenter.h +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/BTagJetAugmenter.h @@ -66,6 +66,9 @@ public: private: bool jfIsDefaults(const xAOD::BTagging &btag); + + float safelog_prob(float p_up, float p_down); + typedef SG::AuxElement AE; AE::Decorator<float> m_pt_uncalib; diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/BTagJetAugmenter.cxx b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/BTagJetAugmenter.cxx index c6bd4b621f21209c769b68754f3114d634870103..60af7d82e5c31df1791c27a414cd110f566d4684 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/BTagJetAugmenter.cxx +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/BTagJetAugmenter.cxx @@ -261,15 +261,38 @@ void BTagJetAugmenter::augmentJfDr(const xAOD::BTagging& btag) { m_jf_deltaR(btag) = std::hypot(m_jf_deltaEta(btag), m_jf_deltaPhi(btag)); } } + + +float BTagJetAugmenter::safelog_prob(float p_up, float p_down){ + + if( std::isnan(p_up) ){ + return -1000.0; + } + + if(std::isnan(p_down) ){ + return -1000.0; + } + + if(p_down < 0.0000000000000000000001 && p_up > p_down){ + return 1000.0; + } + + if(p_up < 0.0000000000000000000001){ + return -1000.0; + } + + return std::log(p_up /p_down); +} + void BTagJetAugmenter::augmentIpRatios(const xAOD::BTagging& btag) { - m_ip2d_cu(btag) = std::log(m_ip2d_pc(btag) / m_ip2d_pu(btag)); - m_ip2d_bu(btag) = std::log(m_ip2d_pb(btag) / m_ip2d_pu(btag)); - m_ip2d_bc(btag) = std::log(m_ip2d_pb(btag) / m_ip2d_pc(btag)); + m_ip2d_cu(btag) = safelog_prob(m_ip2d_pc(btag) , m_ip2d_pu(btag)); + m_ip2d_bu(btag) = safelog_prob(m_ip2d_pb(btag) , m_ip2d_pu(btag)); + m_ip2d_bc(btag) = safelog_prob(m_ip2d_pb(btag) , m_ip2d_pc(btag)); - m_ip3d_cu(btag) = std::log(m_ip3d_pc(btag) / m_ip3d_pu(btag)); - m_ip3d_bu(btag) = std::log(m_ip3d_pb(btag) / m_ip3d_pu(btag)); - m_ip3d_bc(btag) = std::log(m_ip3d_pb(btag) / m_ip3d_pc(btag)); + m_ip3d_cu(btag) = safelog_prob(m_ip3d_pc(btag) , m_ip3d_pu(btag)); + m_ip3d_bu(btag) = safelog_prob(m_ip3d_pb(btag) , m_ip3d_pu(btag)); + m_ip3d_bc(btag) = safelog_prob(m_ip3d_pb(btag) , m_ip3d_pc(btag)); } void BTagJetAugmenter::augmentBtagJes(const xAOD::Jet &target, @@ -331,9 +354,11 @@ void BTagJetAugmenter::augment(const xAOD::Jet &jet) { for (std::size_t jf_vtx_index = 0; jf_vtx_index < m_jf_vertices(btag).size() && jf_vtx_index < m_jf_fittedPosition(btag).size() - 5; jf_vtx_index++) { float jf_vtx_L3d = m_jf_fittedPosition(btag).at(jf_vtx_index + 5); - if (jf_vtx_L3d > 0 && (jf_vtx_L3d < min_jf_vtx_L3d || std::isnan(min_jf_vtx_L3d))) { - secondary_jf_vtx_index = jf_vtx_index; - min_jf_vtx_L3d = jf_vtx_L3d; + if (jf_vtx_L3d > 0){ + if(std::isnan(min_jf_vtx_L3d) || (jf_vtx_L3d < min_jf_vtx_L3d)){ + secondary_jf_vtx_index = jf_vtx_index; + min_jf_vtx_L3d = jf_vtx_L3d; + } } } @@ -386,10 +411,10 @@ void BTagJetAugmenter::augment(const xAOD::Jet &jet) { } track_flightDirRelEta_total += track_flightDirRelEta; - if (track_flightDirRelEta < min_track_flightDirRelEta || std::isnan(min_track_flightDirRelEta)) { + if(std::isnan(min_track_flightDirRelEta) || track_flightDirRelEta < min_track_flightDirRelEta){ min_track_flightDirRelEta = track_flightDirRelEta; } - if (track_flightDirRelEta > max_track_flightDirRelEta || std::isnan(max_track_flightDirRelEta)) { + if (std::isnan(max_track_flightDirRelEta) || track_flightDirRelEta > max_track_flightDirRelEta) { max_track_flightDirRelEta = track_flightDirRelEta; } if (secondary_jf_vtx_index >= 0) { @@ -400,10 +425,10 @@ void BTagJetAugmenter::augment(const xAOD::Jet &jet) { track_fourVector.SetVectM(track_particle.p4().Vect(), track_mass); secondaryVtx_4momentum_total += track_fourVector; secondaryVtx_track_flightDirRelEta_total += track_flightDirRelEta; - if (track_flightDirRelEta < secondaryVtx_min_track_flightDirRelEta || std::isnan(secondaryVtx_min_track_flightDirRelEta)) { + if (std::isnan(secondaryVtx_min_track_flightDirRelEta) || track_flightDirRelEta < secondaryVtx_min_track_flightDirRelEta) { secondaryVtx_min_track_flightDirRelEta = track_flightDirRelEta; } - if (track_flightDirRelEta > secondaryVtx_max_track_flightDirRelEta || std::isnan(secondaryVtx_max_track_flightDirRelEta)) { + if (std::isnan(secondaryVtx_max_track_flightDirRelEta) || track_flightDirRelEta > secondaryVtx_max_track_flightDirRelEta) { secondaryVtx_max_track_flightDirRelEta = track_flightDirRelEta; } } @@ -429,21 +454,29 @@ void BTagJetAugmenter::augment(const xAOD::Jet &jet) { m_secondaryVtx_E(btag) = E; m_secondaryVtx_EFrac(btag) = EFrac; } - { + if(secondaryVtx_track_number > 0){ double min = secondaryVtx_min_track_flightDirRelEta; double max = secondaryVtx_max_track_flightDirRelEta; double avg = secondaryVtx_track_flightDirRelEta_total / secondaryVtx_track_number; m_secondaryVtx_min_trk_flightDirRelEta(btag) = min; m_secondaryVtx_max_trk_flightDirRelEta(btag) = max; m_secondaryVtx_avg_trk_flightDirRelEta(btag) = avg; + }else{ + m_secondaryVtx_min_trk_flightDirRelEta(btag) = NAN; + m_secondaryVtx_max_trk_flightDirRelEta(btag) = NAN; + m_secondaryVtx_avg_trk_flightDirRelEta(btag) = NAN; } - { + if(track_number > 0){ double min = min_track_flightDirRelEta; double max = max_track_flightDirRelEta; double avg = track_flightDirRelEta_total / track_number; m_min_trk_flightDirRelEta(btag) = min; m_max_trk_flightDirRelEta(btag) = max; m_avg_trk_flightDirRelEta(btag) = avg; + }else{ + m_min_trk_flightDirRelEta(btag) = NAN; + m_max_trk_flightDirRelEta(btag) = NAN; + m_avg_trk_flightDirRelEta(btag) = NAN; } if (m_smt_mu_pt(btag) > 0) { diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagLightSecVertexingConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagLightSecVertexingConfig.py index c9b3f11742d936b36957563c71b84921d237985d..99c496d8d23baffe02277c5a90bd80f0b129c130 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagLightSecVertexingConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagLightSecVertexingConfig.py @@ -7,7 +7,8 @@ from JetTagTools.JetFitterVariablesFactoryConfig import JetFitterVariablesFactor Analysis__BTagLightSecVertexing=CompFactory.Analysis.BTagLightSecVertexing -def BTagLightSecVtxToolCfg(flags, Name, JetCollection, SVandAssoc = {""}, TimeStamp = "", **options): + +def BTagLightSecVtxToolCfg(flags, Name, JetCollection, PrimaryVertexCollectionName="", SVandAssoc = {""}, TimeStamp = "", **options): """Adds a SecVtxTool instance and registers it. input: name: The tool's name. @@ -45,8 +46,7 @@ def BTagLightSecVtxToolCfg(flags, Name, JetCollection, SVandAssoc = {""}, TimeSt options.setdefault('SecVtxFinderTrackNameList', secVtxFinderTrackNameList) options.setdefault('SecVtxFinderxAODBaseNameList', secVtxFinderxAODBaseNameList) options['BTagVxSecVertexInfoNames'] = VxSecVertexInfoNameList - options.setdefault('PrimaryVertexName', flags.BTagging.PrimaryVertexCollectionName) - options.setdefault('vxPrimaryCollectionName', flags.BTagging.PrimaryVertexCollectionName) + options.setdefault('vxPrimaryCollectionName', PrimaryVertexCollectionName) options.setdefault('JetFitterVariableFactory', jetFitterVF) options['JetSecVtxLinkName'] = jetcol + '.' + OutputFilesSVname options['JetJFVtxLinkName'] = jetcol + '.' + OutputFilesJFVxname diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagRun3Config.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagRun3Config.py index fe5c1fcfe6f00919a8f10d8cf01dec3b52ac2da3..983a47b620fde86068fbafcae3b320d31d903e64 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagRun3Config.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagRun3Config.py @@ -2,7 +2,6 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -from IOVDbSvc.IOVDbSvcConfig import addFolders from BTagging.JetBTaggerAlgConfig import JetBTaggerAlgCfg from BTagging.JetParticleAssociationAlgConfig import JetParticleAssociationAlgCfg from BTagging.JetBTaggingAlgConfig import JetBTaggingAlgCfg @@ -11,73 +10,8 @@ from BTagging.JetSecVtxFindingAlgConfig import JetSecVtxFindingAlgCfg from BTagging.BTagTrackAugmenterAlgConfig import BTagTrackAugmenterAlgCfg from BTagging.BTagHighLevelAugmenterAlgConfig import BTagHighLevelAugmenterAlgCfg from BTagging.HighLevelBTagAlgConfig import HighLevelBTagAlgCfg +from JetTagCalibration.JetTagCalibConfig import JetTagCalibCfg -def JetTagCalibCfg(ConfigFlags, scheme="", TaggerList = [], useBTagFlagsDefaults = True, **kwargs): - result=ComponentAccumulator() - - CalibrationChannelAliases = [ "myOwnCollection->AntiKt4TopoEM,AntiKt4EMTopo", - "AntiKt4Tower->AntiKt4Tower,AntiKt4H1Tower,AntiKt4TopoEM,AntiKt4EMTopo", - "AntiKt4Topo->AntiKt4Topo,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4H1Topo", - "AntiKt4LCTopo->AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4Topo,AntiKt4H1Topo", - "AntiKt6Tower->AntiKt6Tower,AntiKt6H1Tower,AntiKt4TopoEM,AntiKt4EMTopo", - "AntiKt6Topo->AntiKt6Topo,AntiKt6TopoEM,AntiKt6H1Topo,AntiKt6H1Tower,AntiKt4TopoEM,AntiKt4EMTopo", - "AntiKt6LCTopo->AntiKt6LCTopo,AntiKt6TopoEM,AntiKt6Topo,AntiKt6H1Topo,AntiKt6H1Tower,AntiKt4TopoEM,AntiKt4EMTopo", - "AntiKt4TopoEM->AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4H1Topo,AntiKt4LCTopo", - "AntiKt6TopoEM->AntiKt6TopoEM,AntiKt6H1Topo,AntiKt6H1Tower,AntiKt4TopoEM,AntiKt4EMTopo", - #WOUTER: I added some more aliases here that were previously set up at ./python/BTagging_jobOptions.py. But it cannot - #stay there if we want support for JetRec to setup b-tagging from their end. - "AntiKt4EMTopo->AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo", - "AntiKt4LCTopo->AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo", - "AntiKt4EMTopoOrigin->AntiKt4EMTopoOrigin,AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo", - "AntiKt4LCTopoOrigin->AntiKt4LCTopoOrigin,AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo", - "AntiKt10LCTopo->AntiKt10LCTopo,AntiKt6LCTopo,AntiKt6TopoEM,AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo", - "AntiKt10Truth->AntiKt6TopoEM,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", - "AntiKt10TruthWZ->AntiKt10TruthWZ,AntiKt6TopoEM,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", - "AntiKt4Truth->AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", - "AntiKt4TruthWZ->AntiKt4TruthWZ,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", - "AntiKt4Track->AntiKt4Track,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", - "AntiKt3Track->AntiKt3Track,AntiKt4Track,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", - "AntiKt2Track->AntiKt2Track,AntiKt4Track,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", - "AntiKt4EMPFlow->AntiKt4EMPFlow,AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo", - "AntiKt4HI->AntiKt4HI,AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo"] - - newChannel = kwargs.get("NewChannel") - if newChannel: - CalibrationChannelAliases.append(newChannel) - - if useBTagFlagsDefaults: - #IP2D - grades= ConfigFlags.BTagging.Grades - - #IP3D - #Same as IP2D. Revisit JetTagCalibCondAlg.cxx if not. - - #RNNIP - RNNIPConfig = {'rnnip':''} - - JetTagCalibCondAlg=CompFactory.Analysis.JetTagCalibCondAlg - jettagcalibcondalg = "JetTagCalibCondAlg" - readkeycalibpath = "/GLOBAL/BTagCalib/RUN12" - connSchema = "GLOBAL_OFL" - if not ConfigFlags.Input.isMC: - readkeycalibpath = readkeycalibpath.replace("/GLOBAL/BTagCalib","/GLOBAL/Onl/BTagCalib") - connSchema = "GLOBAL" - histoskey = "JetTagCalibHistosKey" - result.merge(addFolders(ConfigFlags,[readkeycalibpath], connSchema, className='CondAttrListCollection')) - JetTagCalib = JetTagCalibCondAlg(jettagcalibcondalg, ReadKeyCalibPath=readkeycalibpath, HistosKey = histoskey, taggers = TaggerList, channelAliases = CalibrationChannelAliases, IP2D_TrackGradePartitions = grades, RNNIP_NetworkConfig = RNNIPConfig) - # Maybe needed for trigger use - #from IOVDbSvc.CondDB import conddb - #if conddb.dbdata == 'COMP200': - # conddb.addFolder("GLOBAL_ONL", "/GLOBAL/Onl/BTagCalib/RUN12", className='CondAttrListCollection') - # if globalflags.DataSource()!='data': - # conddb.addFolder("GLOBAL_ONL", "/GLOBAL/Onl/TrigBTagCalib/RUN12", className='CondAttrListCollection') - #elif conddb.isMC: - # conddb.addFolder("GLOBAL_OFL", "/GLOBAL/BTagCalib/RUN12", className='CondAttrListCollection') - # conddb.addFolder("GLOBAL_OFL", "/GLOBAL/TrigBTagCalib/RUN12", className='CondAttrListCollection') - - result.addCondAlgo(JetTagCalib) - - return result def registerJetCollectionEL(flags, JetCollection, TimeStamp): ItemList = [] @@ -311,15 +245,17 @@ def JetBTaggerSplitAlgsCfg(inputFlags, JetCollection="", TaggerList=[], SecVerte print( v + ' is not configured, Sec vertex finding skipped') del SecVertexingAndAssociators[k] else: - result.merge(JetSecVtxFindingAlgCfg(inputFlags, jet, "InDetTrackParticles", k, v)) + #result.merge(JetSecVtxFindingAlgCfg(inputFlags, jet, "InDetTrackParticles", k, v)) + result.merge(JetSecVtxFindingAlgCfg(inputFlags, jet, "PrimaryVertices", k, v)) #Sec vertexing - result.merge(JetSecVertexingAlgCfg(inputFlags, jet, "InDetTrackParticles", k, v)) + #result.merge(JetSecVertexingAlgCfg(inputFlags, jet, "InDetTrackParticles", k, v)) + result.merge(JetSecVertexingAlgCfg(inputFlags, jet, "PrimaryVertices", k, v)) #result.merge(JetSecVertexingAlgCfg(inputFlags, jet, "InDetTrackParticles", 'MSV', 'BTagTrackToJetAssociatorBB')) #BTagging for ts in timestamp: - result.merge(JetBTaggingAlgCfg(inputFlags, JetCollection = jet, TaggerList = TaggerList, SVandAssoc = SecVertexingAndAssociators, TimeStamp = ts, **kwargs)) + result.merge(JetBTaggingAlgCfg(inputFlags, JetCollection = jet, PrimaryVertexCollectionName="PrimaryVertices", TaggerList = TaggerList, SVandAssoc = SecVertexingAndAssociators, TimeStamp = ts, **kwargs)) if jet in postTagDL2JetToTrainingMap: #Track Augmenter diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py index 91c0011f6cac26dae266288e5a6c7ec2b8607589..419cafc735121a3411665c94bef1f3fc66d9a8d4 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTagToolConfig.py @@ -4,7 +4,7 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory Analysis__BTagTool=CompFactory.Analysis.BTagTool -def BTagToolCfg(ConfigFlags, TaggerList, useBTagFlagsDefaults = True): +def BTagToolCfg(ConfigFlags, TaggerList, PrimaryVertexCollectionName="", scheme = '', useBTagFlagsDefaults = True): """Adds a new myBTagTool instance and registers it. input: jetcol: The name of the jet collections. @@ -25,47 +25,47 @@ def BTagToolCfg(ConfigFlags, TaggerList, useBTagFlagsDefaults = True): if 'IP2D' in TaggerList: from JetTagTools.IP2DTagConfig import IP2DTagCfg - ip2dtool = acc.popToolsAndMerge(IP2DTagCfg(ConfigFlags, 'IP2DTag')) + ip2dtool = acc.popToolsAndMerge(IP2DTagCfg(ConfigFlags, 'IP2DTag', scheme)) tagToolList.append(ip2dtool) if 'IP3D' in TaggerList: from JetTagTools.IP3DTagConfig import IP3DTagCfg - ip3dtool = acc.popToolsAndMerge(IP3DTagCfg(ConfigFlags, 'IP3DTag')) + ip3dtool = acc.popToolsAndMerge(IP3DTagCfg(ConfigFlags, 'IP3DTag', PrimaryVertexCollectionName, scheme)) tagToolList.append(ip3dtool) if 'SV1' in TaggerList: from JetTagTools.SV1TagConfig import SV1TagCfg - sv1tool = acc.popToolsAndMerge(SV1TagCfg(ConfigFlags, 'SV1Tag')) + sv1tool = acc.popToolsAndMerge(SV1TagCfg(ConfigFlags, 'SV1Tag', scheme)) tagToolList.append(sv1tool) if 'RNNIP' in TaggerList: from JetTagTools.RNNIPTagConfig import RNNIPTagCfg - rnniptool = acc.popToolsAndMerge(RNNIPTagCfg(ConfigFlags, 'RNNIPTag')) + rnniptool = acc.popToolsAndMerge(RNNIPTagCfg(ConfigFlags, 'RNNIPTag', scheme)) tagToolList.append(rnniptool) if 'JetFitterNN' in TaggerList: from JetTagTools.JetFitterTagConfig import JetFitterTagCfg - jetfitterNNtool = acc.popToolsAndMerge(JetFitterTagCfg(ConfigFlags, 'JetFitterTagNN')) + jetfitterNNtool = acc.popToolsAndMerge(JetFitterTagCfg(ConfigFlags, 'JetFitterTagNN', scheme)) tagToolList.append(jetfitterNNtool) if 'SoftMu' in TaggerList: from JetTagTools.SoftMuonTagConfig import SoftMuonTagCfg - softmutool = acc.popToolsAndMerge(SoftMuonTagCfg(ConfigFlags, 'SoftMuonTag')) + softmutool = acc.popToolsAndMerge(SoftMuonTagCfg(ConfigFlags, 'SoftMuonTag', scheme)) tagToolList.append(softmutool) if 'MultiSVbb1' in TaggerList: from JetTagTools.MultiSVTagConfig import MultiSVTagCfg - multisvbb1tool = acc.popToolsAndMerge(MultiSVTagCfg(ConfigFlags,'MultiSVbb1Tag','MultiSVbb1')) + multisvbb1tool = acc.popToolsAndMerge(MultiSVTagCfg(ConfigFlags,'MultiSVbb1Tag','MultiSVbb1', scheme)) tagToolList.append(multisvbb1tool) if 'MultiSVbb2' in TaggerList: from JetTagTools.MultiSVTagConfig import MultiSVTagCfg - multisvbb2tool = acc.popToolsAndMerge(MultiSVTagCfg(ConfigFlags, 'MultiSVbb2Tag','MultiSVbb2')) + multisvbb2tool = acc.popToolsAndMerge(MultiSVTagCfg(ConfigFlags, 'MultiSVbb2Tag','MultiSVbb2', scheme)) tagToolList.append(multisvbb2tool) if 'JetVertexCharge' in TaggerList: from JetTagTools.JetVertexChargeConfig import JetVertexChargeCfg - jvc = acc.popToolsAndMerge(JetVertexChargeCfg(ConfigFlags, 'JetVertexCharge')) + jvc = acc.popToolsAndMerge(JetVertexChargeCfg(ConfigFlags, 'JetVertexCharge', scheme)) tagToolList.append(jvc) # list of taggers that use MultivariateTagManager @@ -78,14 +78,13 @@ def BTagToolCfg(ConfigFlags, TaggerList, useBTagFlagsDefaults = True): mvtm_active_taggers = list(set(mvtm_taggers) & set(TaggerList)) if len(mvtm_active_taggers) > 0: from JetTagTools.MultivariateTagManagerConfig import MultivariateTagManagerCfg - mvtm = acc.popToolsAndMerge(MultivariateTagManagerCfg(ConfigFlags, 'mvtm', TaggerList = mvtm_active_taggers)) + mvtm = acc.popToolsAndMerge(MultivariateTagManagerCfg(ConfigFlags, 'mvtm', TaggerList = mvtm_active_taggers, scheme = scheme)) tagToolList.append(mvtm) options = {} if useBTagFlagsDefaults: defaults = { 'Runmodus' : ConfigFlags.BTagging.RunModus, - 'PrimaryVertexName' : ConfigFlags.BTagging.PrimaryVertexCollectionName, - 'vxPrimaryCollectionName' : ConfigFlags.BTagging.PrimaryVertexCollectionName, + 'vxPrimaryCollectionName' : PrimaryVertexCollectionName, 'TagToolList' : tagToolList, } for option in defaults: diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfigFlags.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfigFlags.py index ffec4236d933177b27dff634b3b156979fc13e9a..4838e4efafb9e4c33cf793d7a745735e8331076b 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfigFlags.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/BTaggingConfigFlags.py @@ -6,6 +6,7 @@ def createBTaggingConfigFlags(): btagcf = AthConfigFlags() btagcf.addFlag("BTagging.run2TaggersList", ['IP2D','IP3D','SV1','SoftMu','JetFitterNN','MV2c10','MV2c10mu','MV2c10rnn','MV2c100','MV2cl100','RNNIP','DL1','DL1mu','DL1rnn']) + btagcf.addFlag("BTagging.TrigTaggersList", ['IP2D','IP3D','SV1','JetFitterNN','MV2c10','MV2c100']) # Disable JetVertexCharge ATLASRECTS-4506 btagcf.addFlag("BTagging.RunModus", "analysis") # reference mode used in FlavourTagPerformanceFramework (RetagFragment.py) btagcf.addFlag("BTagging.ReferenceType", "ALL") # reference type for IP and SV taggers (B, UDSG, ALL) diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/InDetImprovedJetFitterTrackSelectorToolConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/InDetImprovedJetFitterTrackSelectorToolConfig.py index 473bd933cd9ed0d47bcbc5ada15cd2794ab912b7..cebc23d6cafb099b3e346cd8683d64304bd92f51 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/InDetImprovedJetFitterTrackSelectorToolConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/InDetImprovedJetFitterTrackSelectorToolConfig.py @@ -50,7 +50,7 @@ def InDetImprovedJetFitterTrackSelectorToolCfg(name, useBTagFlagsDefaults = True 'useSharedHitInfo' : False, 'useTrackQualityInfo' : True, 'fitChi2OnNdfMax' : 3.5, - 'TrackSummaryTool' : None } + 'TrackSummaryTool' : '' } for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetBTaggerAlgConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetBTaggerAlgConfig.py index 11aa16f2a8d7ff0b771ef055ff107604cc4c4cd1..df5f1f4e7e6e0e15a32c1b52353a8836284c4ebc 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetBTaggerAlgConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetBTaggerAlgConfig.py @@ -9,7 +9,7 @@ from BTagging.BTagToolConfig import BTagToolCfg JetBTaggerAlg=CompFactory.Analysis.JetBTaggerAlg -def JetBTaggerAlgCfg(ConfigFlags, JetCollection="", TaggerList=[], SetupScheme="", **options): +def JetBTaggerAlgCfg(ConfigFlags, JetCollection="", PrimaryVertexCollectionName="", TaggerList=[], SetupScheme="", **options): acc=ComponentAccumulator() jetcol = JetCollection @@ -19,7 +19,7 @@ def JetBTaggerAlgCfg(ConfigFlags, JetCollection="", TaggerList=[], SetupScheme=" # setup the Analysis__BTagTrackAssociation tool options.setdefault('BTagTrackAssocTool', acc.popToolsAndMerge(BTagTrackAssociationCfg(ConfigFlags, 'TrackAssociation'+ ConfigFlags.BTagging.GeneralToolSuffix, jetcol, TaggerList ))) - options.setdefault('BTagTool', acc.popToolsAndMerge(BTagToolCfg(ConfigFlags, TaggerList))) + options.setdefault('BTagTool', acc.popToolsAndMerge(BTagToolCfg(ConfigFlags, TaggerList, PrimaryVertexCollectionName, SetupScheme))) timestamp = options.get('TimeStamp', None) if not timestamp: diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetBTaggingAlgConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetBTaggingAlgConfig.py index 8eb6be5d53e676e75d1e62a51e94e49b00166630..bb163b93e4ba39279587ab0527d5f8ecf05d8fca 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetBTaggingAlgConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetBTaggingAlgConfig.py @@ -8,7 +8,8 @@ from BTagging.BTagLightSecVertexingConfig import BTagLightSecVtxToolCfg # import the JetBTaggingAlg configurable Analysis__JetBTaggingAlg = CompFactory.Analysis.JetBTaggingAlg -def JetBTaggingAlgCfg(ConfigFlags, JetCollection="", TaggerList=[], SetupScheme="", SVandAssoc={""}, TimeStamp = "", **options): + +def JetBTaggingAlgCfg(ConfigFlags, JetCollection="", PrimaryVertexCollectionName="", TaggerList=[], SetupScheme="", SVandAssoc={""}, TimeStamp = "", **options): acc = ComponentAccumulator() jetcol = JetCollection @@ -22,10 +23,10 @@ def JetBTaggingAlgCfg(ConfigFlags, JetCollection="", TaggerList=[], SetupScheme= for assoc in BTagTrackToJetAssocNameList: TrackToJetAssociatorNameList.append(jetcol.replace('Track', 'PV0Track') + 'Jets.' + assoc) - options.setdefault('BTagTool', acc.popToolsAndMerge(BTagToolCfg(ConfigFlags, TaggerList))) + options.setdefault('BTagTool', acc.popToolsAndMerge(BTagToolCfg(ConfigFlags, TaggerList, PrimaryVertexCollectionName, SetupScheme))) # setup the secondary vertexing tool - options['BTagSecVertexing'] = acc.popToolsAndMerge(BTagLightSecVtxToolCfg(ConfigFlags, 'LightSecVx'+ConfigFlags.BTagging.GeneralToolSuffix, jetcol, SVandAssoc =SVandAssoc, TimeStamp = ts, **options)) + options['BTagSecVertexing'] = acc.popToolsAndMerge(BTagLightSecVtxToolCfg(ConfigFlags, 'LightSecVx'+ConfigFlags.BTagging.GeneralToolSuffix, jetcol, PrimaryVertexCollectionName, SVandAssoc =SVandAssoc, TimeStamp = ts, **options)) btagname = ConfigFlags.BTagging.OutputFiles.Prefix + jetcol # Set remaining options @@ -34,6 +35,7 @@ def JetBTaggingAlgCfg(ConfigFlags, JetCollection="", TaggerList=[], SetupScheme= options['JetCalibrationName'] = jetcol.replace('Track', 'PV0Track') options['BTagSVCollectionName'] = btagname + 'SecVtx' options['BTagJFVtxCollectionName'] = btagname + 'JFVtx' + options['BTaggingLinkName'] = options['JetCollectionName'] + '.btaggingLink'+ts if ts: btagname += '_'+ts diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVertexingAlgConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVertexingAlgConfig.py index 0b4f8e68aba47fd47038f4c2490321102e2c165f..f828e2587fe665a7619abcf1c1bcd765b5b7b404 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVertexingAlgConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVertexingAlgConfig.py @@ -6,7 +6,7 @@ from BTagging.MSVVariablesFactoryConfig import MSVVariablesFactoryCfg Analysis__JetSecVertexingAlg=CompFactory.Analysis.JetSecVertexingAlg -def JetSecVertexingAlgCfg(ConfigFlags, JetCollection, ParticleCollection="", SVFinder="", Associator="", **options): +def JetSecVertexingAlgCfg(ConfigFlags, JetCollection, PrimaryVertexCollectionName="", SVFinder="", Associator="", **options): """Adds a SecVtxTool instance and registers it. input: name: The tool's name. @@ -31,8 +31,7 @@ def JetSecVertexingAlgCfg(ConfigFlags, JetCollection, ParticleCollection="", SVF btagname = ConfigFlags.BTagging.OutputFiles.Prefix + jetcol options = {} options.setdefault('SecVtxFinderxAODBaseName', SVFinder) - options.setdefault('PrimaryVertexName', ConfigFlags.BTagging.PrimaryVertexCollectionName) - options.setdefault('vxPrimaryCollectionName', ConfigFlags.BTagging.PrimaryVertexCollectionName) + options.setdefault('vxPrimaryCollectionName', PrimaryVertexCollectionName) options['JetCollectionName'] = jetcol.replace('Track', 'PV0Track') + 'Jets' options['BTagVxSecVertexInfoName'] = SVFinder + 'VxSecVertexInfo_' + JetCollection options['TrackToJetAssociatorName'] = options['JetCollectionName'] + '.' + Associator diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVtxFindingAlgConfig.py b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVtxFindingAlgConfig.py index b6521171463ab3dc527d5be04a59f4d874696dc3..277acf5ed53424b9a103b95ee90e9cab29959c06 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVtxFindingAlgConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/python/JetSecVtxFindingAlgConfig.py @@ -7,7 +7,7 @@ from BTagging.InDetVKalVxInJetToolConfig import InDetVKalVxInJetToolCfg Analysis__JetSecVtxFindingAlg=CompFactory.Analysis.JetSecVtxFindingAlg -def JetSecVtxFindingAlgCfg(ConfigFlags, JetCollection, ParticleCollection="", SVFinder="", Associator="", **options): +def JetSecVtxFindingAlgCfg(ConfigFlags, JetCollection, PrimaryVertexCollectionName="", SVFinder="", Associator="", **options): """Adds a SecVtxTool instance and registers it. input: name: The tool's name. @@ -31,8 +31,7 @@ def JetSecVtxFindingAlgCfg(ConfigFlags, JetCollection, ParticleCollection="", SV options = {} options.setdefault('SecVtxFinder', secVtxFinder) - options.setdefault('PrimaryVertexName', ConfigFlags.BTagging.PrimaryVertexCollectionName) - options.setdefault('vxPrimaryCollectionName', ConfigFlags.BTagging.PrimaryVertexCollectionName) + options.setdefault('vxPrimaryCollectionName', PrimaryVertexCollectionName) options['JetCollectionName'] = jetcol.replace('Track', 'PV0Track') + 'Jets' options['TrackToJetAssociatorName'] = options['JetCollectionName'] + '.' + Associator options['BTagVxSecVertexInfoName'] = SVFinder + 'VxSecVertexInfo_' + JetCollection diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTrackAugmenterAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTrackAugmenterAlg.cxx index b3125b3bab4f0e558ba2debbc91ff2229729ee23..2c7251e69dcb182560107a5788b7edd2ca89187d 100644 --- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTrackAugmenterAlg.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/BTagTrackAugmenterAlg.cxx @@ -96,6 +96,7 @@ namespace Analysis { const xAOD::TrackParticleContainer* tracks = trackContainerHandle.get(); ATH_MSG_DEBUG( "Retrieved " << tracks->size() << " input tracks..." ); + // ========================================================================================================================== // ** Make Decorators (these are outputs) // ========================================================================================================================== @@ -122,6 +123,10 @@ namespace Analysis { decor_z0(*track) = ip->IPz0SinTheta; decor_d0_sigma(*track) = ip->sigmad0; decor_z0_sigma(*track) = ip->sigmaz0SinTheta; + ATH_MSG_DEBUG( " d0= " << ip->IPd0 << + " z0SinTheta= " << ip->IPz0SinTheta << + " sigmad0= " << ip->sigmad0 << + " sigmaz0SinTheta= " << ip->sigmaz0SinTheta ); } else { ATH_MSG_WARNING( "failed to estimate track impact parameter, using dummy values" ); decor_d0(*track) = NAN; @@ -141,6 +146,12 @@ namespace Analysis { const Amg::Vector3D position = track_pos - vertex_pos; const Amg::Vector3D momentum = extrap_pars->momentum(); + //Test output for cross checking output with stored values + ATH_MSG_DEBUG( "vertex_pos (x,y,z)= (" << vertex_pos.x() << ", " << vertex_pos.y() << ", " << vertex_pos.z() << ")"); + ATH_MSG_DEBUG( "track_pos (x,y,z)= (" << track_pos.x() << ", " << track_pos.y() << ", " << track_pos.z() << ")"); + ATH_MSG_DEBUG( "track_displacement (x,y,z)= (" << position.x() << ", " << position.y() << ", " << position.z() << ")"); + ATH_MSG_DEBUG( "track_momentum (x,y,z)= (" << momentum.x() << ", " << momentum.y() << ", " << momentum.z() << ")"); + std::vector< float > out_vec_pos( position.data(), position.data() + position.size() ); std::vector< float > out_vec_mom( momentum.data(), momentum.data() + momentum.size() ); @@ -178,3 +189,4 @@ namespace Analysis { } + diff --git a/PhysicsAnalysis/JetTagging/JetTagCalibration/CMakeLists.txt b/PhysicsAnalysis/JetTagging/JetTagCalibration/CMakeLists.txt index 3faa52873f5adc3789ef07c3964500fdd387568e..074cad3dc740060c235ecbc1f42be7c1fa9b24d0 100644 --- a/PhysicsAnalysis/JetTagging/JetTagCalibration/CMakeLists.txt +++ b/PhysicsAnalysis/JetTagging/JetTagCalibration/CMakeLists.txt @@ -36,6 +36,5 @@ atlas_add_component( JetTagCalibration LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GaudiKernel FileCatalog AthenaPoolUtilities JetTagCalibrationLib ) # Install files from the package: +atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) -atlas_install_runtime( share/*.db ) - diff --git a/PhysicsAnalysis/JetTagging/JetTagCalibration/python/JetTagCalibConfig.py b/PhysicsAnalysis/JetTagging/JetTagCalibration/python/JetTagCalibConfig.py new file mode 100644 index 0000000000000000000000000000000000000000..fd1324918b717d53a0127a3407b1ba4f3dbf7380 --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagCalibration/python/JetTagCalibConfig.py @@ -0,0 +1,105 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +from AthenaConfiguration.ComponentFactory import CompFactory + +def JetTagCalibCfg(ConfigFlags, scheme="", TaggerList = [], **kwargs): + + CalibrationChannelAliases = [ "myOwnCollection->AntiKt4TopoEM,AntiKt4EMTopo", + "AntiKt4Tower->AntiKt4Tower,AntiKt4H1Tower,AntiKt4TopoEM,AntiKt4EMTopo", + "AntiKt4Topo->AntiKt4Topo,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4H1Topo", + "AntiKt4LCTopo->AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4Topo,AntiKt4H1Topo", + "AntiKt6Tower->AntiKt6Tower,AntiKt6H1Tower,AntiKt4TopoEM,AntiKt4EMTopo", + "AntiKt6Topo->AntiKt6Topo,AntiKt6TopoEM,AntiKt6H1Topo,AntiKt6H1Tower,AntiKt4TopoEM,AntiKt4EMTopo", + "AntiKt6LCTopo->AntiKt6LCTopo,AntiKt6TopoEM,AntiKt6Topo,AntiKt6H1Topo,AntiKt6H1Tower,AntiKt4TopoEM,AntiKt4EMTopo", + "AntiKt4TopoEM->AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4H1Topo,AntiKt4LCTopo", + "AntiKt6TopoEM->AntiKt6TopoEM,AntiKt6H1Topo,AntiKt6H1Tower,AntiKt4TopoEM,AntiKt4EMTopo", + #WOUTER: I added some more aliases here that were previously set up at ./python/BTagging_jobOptions.py. But it cannot + #stay there if we want support for JetRec to setup b-tagging from their end. + "AntiKt4EMTopo->AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo", + "AntiKt4LCTopo->AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo", + "AntiKt4EMTopoOrigin->AntiKt4EMTopoOrigin,AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo", + "AntiKt4LCTopoOrigin->AntiKt4LCTopoOrigin,AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo", + "AntiKt10LCTopo->AntiKt10LCTopo,AntiKt6LCTopo,AntiKt6TopoEM,AntiKt4LCTopo,AntiKt4TopoEM,AntiKt4EMTopo", + "AntiKt10Truth->AntiKt6TopoEM,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", + "AntiKt10TruthWZ->AntiKt10TruthWZ,AntiKt6TopoEM,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", + "AntiKt4Truth->AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", + "AntiKt4TruthWZ->AntiKt4TruthWZ,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", + "AntiKt4Track->AntiKt4Track,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", + "AntiKt3Track->AntiKt3Track,AntiKt4Track,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", + "AntiKt2Track->AntiKt2Track,AntiKt4Track,AntiKt4TopoEM,AntiKt4EMTopo,AntiKt4LCTopo", + "AntiKt4EMPFlow->AntiKt4EMPFlow,AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo", + "AntiKt4HI->AntiKt4HI,AntiKt4EMTopo,AntiKt4TopoEM,AntiKt4LCTopo"] + + newChannel = kwargs.get("NewChannel") + if newChannel: + CalibrationChannelAliases+=newChannel + + #IP2D + grades= ConfigFlags.BTagging.Grades + + #IP3D + #Same as IP2D. Revisit JetTagCalibCondAlg.cxx if not. + + #RNNIP + RNNIPConfig = {'rnnip':''} + + if scheme == "Trig": + JetTagCalibCondAlg,=CompFactory.getComps("Analysis__JetTagCalibCondAlg",) + jettagcalibcondalg = "JetTagCalibCondAlg" + histoskey = "JetTagTrigCalibHistosKey" + readkeycalibpath = "/GLOBAL/TrigBTagCalib/RUN12" + connSchema = "GLOBAL_OFL" + if not ConfigFlags.Input.isMC: + readkeycalibpath = readkeycalibpath.replace("/GLOBAL/","/GLOBAL/Onl/") + connSchema = connSchema.replace("OFL","ONL") + from IOVDbSvc.CondDB import conddb + conddb.addFolder(connSchema, readkeycalibpath, className='CondAttrListCollection') + + JetTagCalib = JetTagCalibCondAlg(jettagcalibcondalg, ReadKeyCalibPath=readkeycalibpath, HistosKey = histoskey, taggers = TaggerList, channelAliases = CalibrationChannelAliases, IP2D_TrackGradePartitions = grades, RNNIP_NetworkConfig = RNNIPConfig) + return JetTagCalib + + else: + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + result=ComponentAccumulator() + JetTagCalibCondAlg = CompFactory.Analysis.JetTagCalibCondAlg + jettagcalibcondalg = "JetTagCalibCondAlg" + histoskey = "JetTagCalibHistosKey" + readkeycalibpath = "/GLOBAL/BTagCalib/RUN12" + connSchema = "GLOBAL_OFL" + if not ConfigFlags.Input.isMC: + readkeycalibpath = readkeycalibpath.replace("/GLOBAL/","/GLOBAL/Onl/") + connSchema = connSchema.replace("_OFL","") + from IOVDbSvc.IOVDbSvcConfig import addFolders + result.merge(addFolders(ConfigFlags,[readkeycalibpath], connSchema, className='CondAttrListCollection')) + + JetTagCalib = JetTagCalibCondAlg(jettagcalibcondalg, ReadKeyCalibPath=readkeycalibpath, HistosKey = histoskey, taggers = TaggerList, channelAliases = CalibrationChannelAliases, IP2D_TrackGradePartitions = grades, RNNIP_NetworkConfig = RNNIPConfig) + result.addCondAlgo(JetTagCalib) + return result + + +# #conf2toConfigurable is not working for this at the moment, thats why we need old-config style for trigger +# #if this option would be working, need the following line in runHLT_standalone.py +# #CAtoGlobalWrapper(JetTagCalibCfg, ConfigFlags, scheme="Trig", TaggerList=ConfigFlags.BTagging.TrigTaggersList, ChannelAlias = alias) +# +# from IOVDbSvc.IOVDbSvcConfig import addFolders +# from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator +# result=ComponentAccumulator() +# JetTagCalibCondAlg = CompFactory.Analysis.JetTagCalibCondAlg +# jettagcalibcondalg = "JetTagCalibCondAlg" +# connSchema = "GLOBAL_OFL" +# if scheme == "Trig": +# histoskey = "JetTagTrigCalibHistosKey" +# readkeycalibpath = "/GLOBAL/TrigBTagCalib/RUN12" +# if not ConfigFlags.Input.isMC: +# readkeycalibpath = readkeycalibpath.replace("/GLOBAL/","/GLOBAL/Onl/") +# connSchema = connSchema.replace("OFL","ONL") +# else: +# histoskey = "JetTagCalibHistosKey" +# readkeycalibpath = "/GLOBAL/BTagCalib/RUN12" +# if not ConfigFlags.Input.isMC: +# readkeycalibpath = readkeycalibpath.replace("/GLOBAL/","/GLOBAL/Onl/") +# connSchema = connSchema.replace("_OFL","") +# +# result.merge(addFolders(ConfigFlags,[readkeycalibpath], connSchema, className='CondAttrListCollection')) +# JetTagCalib = JetTagCalibCondAlg(jettagcalibcondalg, ReadKeyCalibPath=readkeycalibpath, HistosKey = histoskey, taggers = TaggerList, channelAliases = CalibrationChannelAliases, IP2D_TrackGradePartitions = grades, RNNIP_NetworkConfig = RNNIPConfig) +# result.addCondAlgo(JetTagCalib) +# return result diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/DL1TagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/DL1TagConfig.py index effd38ac65c64c295fbb0b3bfb9e972313aed717..eb8b81c993d616ebe197c4c049a2a67129539cd0 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/DL1TagConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/DL1TagConfig.py @@ -30,6 +30,8 @@ def DL1TagCfg(flags, name = 'DL1', scheme = '', useBTagFlagsDefaults = True, **o DL1CalibAlias = 'AntiKt4EMTopo' options['xAODBaseName'] = basename options['LocalNNConfigurationFile'] = DL1LocalNNConfig + if scheme == 'Trig': + options['HistosKey'] = 'JetTagTrigCalibHistosKey' if useBTagFlagsDefaults: defaults = { 'Runmodus' : flags.BTagging.RunModus, diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/IP2DTagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/IP2DTagConfig.py index 3aca626d04198369598cd64656dbede276facf04..87f4d8fa511a5d9f03b73dfcfd59a8b720390aef 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/IP2DTagConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/IP2DTagConfig.py @@ -34,15 +34,15 @@ def IP2DTagCfg( flags, name = 'IP2DTag', scheme = '', useBTagFlagsDefaults = Tru options['name'] = name options['xAODBaseName'] = 'IP2D' options['trackAssociationName'] = 'BTagTrackToJetAssociator' - if (scheme == ""): - if useBTagFlagsDefaults: - trackToVertexIPEstimator = acc.popToolsAndMerge(BTagTrackToVertexIPEstimatorCfg(flags, 'TrkToVxIPEstimator')) - svForIPTool = acc.popToolsAndMerge(SVForIPToolCfg('SVForIPTool')) - trackGradeFactory = acc.popToolsAndMerge(IPDetailedTrackGradeFactoryCfg('IP2DDetailedTrackGradeFactory')) - trackSelectorTool = acc.popToolsAndMerge(IPTrackSelectorCfg(flags, 'IP2DTrackSelector')) - likelihood = acc.popToolsAndMerge(NewLikelihoodToolCfg(flags, 'IP2DNewLikelihoodTool', 'IP2D')) - defaults = { 'Runmodus' : flags.BTagging.RunModus, + if useBTagFlagsDefaults: + trackToVertexIPEstimator = acc.popToolsAndMerge(BTagTrackToVertexIPEstimatorCfg(flags, 'TrkToVxIPEstimator')) + svForIPTool = acc.popToolsAndMerge(SVForIPToolCfg('SVForIPTool')) + trackGradeFactory = acc.popToolsAndMerge(IPDetailedTrackGradeFactoryCfg('IP2DDetailedTrackGradeFactory')) + trackSelectorTool = acc.popToolsAndMerge(IPTrackSelectorCfg(flags, 'IP2DTrackSelector')) + likelihood = acc.popToolsAndMerge(NewLikelihoodToolCfg(flags, 'IP2DNewLikelihoodTool', 'IP2D', scheme)) + + defaults = { 'Runmodus' : flags.BTagging.RunModus, 'referenceType' : flags.BTagging.ReferenceType, 'jetPtMinRef' : flags.BTagging.JetPtMinRef, 'impactParameterView' : '2D', @@ -61,8 +61,8 @@ def IP2DTagCfg( flags, name = 'IP2DTag', scheme = '', useBTagFlagsDefaults = Tru 'trackGradeFactory' : trackGradeFactory, 'TrackToVertexIPEstimator' : trackToVertexIPEstimator, } - for option in defaults: - options.setdefault(option, defaults[option]) + for option in defaults: + options.setdefault(option, defaults[option]) acc.setPrivateTools(Analysis__IPTag( **options)) diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/IP3DTagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/IP3DTagConfig.py index a803b72233eb3a04cafdb38c593ec659d15410e6..52c8d9d768a0ca2a7c473ea462c2bfe359516e03 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/IP3DTagConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/IP3DTagConfig.py @@ -13,7 +13,7 @@ from JetTagTools.SpecialTrackAssociatorConfig import SpecialTrackAssociatorCfg # import the IPTag configurable Analysis__IPTag=CompFactory.Analysis.IPTag -def IP3DTagCfg( flags, name = 'IP3DTag', scheme = '', useBTagFlagsDefaults = True, **options ): +def IP3DTagCfg( flags, name = 'IP3DTag', PrimaryVertexCollectionName="", scheme = '', useBTagFlagsDefaults = True, **options ): """Sets up a IP3DTag tool and returns it. The following options have BTaggingFlags defaults: @@ -37,17 +37,16 @@ def IP3DTagCfg( flags, name = 'IP3DTag', scheme = '', useBTagFlagsDefaults = Tru options['xAODBaseName'] = 'IP3D' options['trackAssociationName'] = 'BTagTrackToJetAssociator' - if (scheme == ""): - if useBTagFlagsDefaults: - trackToVertexIPEstimator = acc.popToolsAndMerge(BTagTrackToVertexIPEstimatorCfg(flags, 'TrkToVxIPEstimator')) - svForIPTool = acc.popToolsAndMerge(SVForIPToolCfg('SVForIPTool')) - trackGradeFactory = acc.popToolsAndMerge(IPDetailedTrackGradeFactoryCfg('IP3DDetailedTrackGradeFactory')) - trackSelectorTool = acc.popToolsAndMerge(IPTrackSelectorCfg(flags, 'IP3DTrackSelector')) - likelihood = acc.popToolsAndMerge(NewLikelihoodToolCfg(flags, 'IP3DNewLikelihoodTool', 'IP3D')) - inDetTrackSelectionTool = acc.popToolsAndMerge(InDetTrackSelectorCfg('InDetTrackSelector')) - trackVertexAssociationTool = acc.popToolsAndMerge(SpecialTrackAssociatorCfg('SpecialTrackAssociator')) + if useBTagFlagsDefaults: + trackToVertexIPEstimator = acc.popToolsAndMerge(BTagTrackToVertexIPEstimatorCfg(flags, 'TrkToVxIPEstimator')) + svForIPTool = acc.popToolsAndMerge(SVForIPToolCfg('SVForIPTool')) + trackGradeFactory = acc.popToolsAndMerge(IPDetailedTrackGradeFactoryCfg('IP3DDetailedTrackGradeFactory')) + trackSelectorTool = acc.popToolsAndMerge(IPTrackSelectorCfg(flags, 'IP3DTrackSelector')) + likelihood = acc.popToolsAndMerge(NewLikelihoodToolCfg(flags, 'IP3DNewLikelihoodTool', 'IP3D', scheme)) + inDetTrackSelectionTool = acc.popToolsAndMerge(InDetTrackSelectorCfg('InDetTrackSelector')) + trackVertexAssociationTool = acc.popToolsAndMerge(SpecialTrackAssociatorCfg('SpecialTrackAssociator', PrimaryVertexCollectionName)) - defaults = { 'Runmodus' : flags.BTagging.RunModus, + defaults = { 'Runmodus' : flags.BTagging.RunModus, 'referenceType' : flags.BTagging.ReferenceType, 'jetPtMinRef' : flags.BTagging.JetPtMinRef, 'impactParameterView' : '3D', @@ -68,8 +67,8 @@ def IP3DTagCfg( flags, name = 'IP3DTag', scheme = '', useBTagFlagsDefaults = Tru 'InDetTrackSelectionTool' : inDetTrackSelectionTool, 'TrackVertexAssociationTool' : trackVertexAssociationTool, } - for option in defaults: - options.setdefault(option, defaults[option]) + for option in defaults: + options.setdefault(option, defaults[option]) acc.setPrivateTools(Analysis__IPTag( **options)) return acc diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterNNToolConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterNNToolConfig.py index 30c2068e7849a4427415a1191ca1b295bbcd8985..f1a6f2b4924d2867f932d2cb95b1ec170331b6de 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterNNToolConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterNNToolConfig.py @@ -7,7 +7,7 @@ from JetTagTools.NeuralNetworkToHistoToolConfig import NeuralNetworkToHistoToolC # import the JetFitterNNTool configurable Analysis__JetFitterNNTool=CompFactory.Analysis.JetFitterNNTool -def JetFitterNNToolCfg( name = 'JetFitterNNTool', CombinedIPNN = False, useBTagFlagsDefaults = True, **options ): +def JetFitterNNToolCfg( name = 'JetFitterNNTool', scheme='', CombinedIPNN = False, useBTagFlagsDefaults = True, **options ): """Sets up a JetFitterNNTool tool and returns it. The following options have BTaggingFlags defaults: @@ -23,6 +23,8 @@ def JetFitterNNToolCfg( name = 'JetFitterNNTool', CombinedIPNN = False, useBTagF output: The actual tool.""" acc = ComponentAccumulator() options['name'] = name + if scheme == 'Trig': + options['HistosKey'] = 'JetTagTrigCalibHistosKey' # you can force the NN tool off with this flag (avoids loading # old jetfitter nns which sometimes crash RunJetFitterNNTool = True @@ -48,3 +50,4 @@ def JetFitterNNToolCfg( name = 'JetFitterNNTool', CombinedIPNN = False, useBTagF acc.setPrivateTools(Analysis__JetFitterNNTool( **options)) return acc + diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterTagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterTagConfig.py index 0305c07890064659a68d7a0d2ba569c3420afdcc..74b3845c01e8d01fa5eab50a0f6c5fb7573d2d96 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterTagConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetFitterTagConfig.py @@ -31,11 +31,11 @@ def JetFitterTagCfg(flags, name = 'JetFitterTagNN', scheme = '', CombinedIPNN = options['name'] = name options['xAODBaseName'] = 'JetFitter' - if (scheme == ""): + if scheme == "" or scheme == "Trig": if useBTagFlagsDefaults: if not CombinedIPNN: jetFitterNtupleWriterNN = acc.popToolsAndMerge(JetFitterNtupleWriterNNCfg('JetFitterNtupleWriterNN')) - jetfitterClassifier = acc.popToolsAndMerge(JetFitterNNToolCfg('JetFitterNNTool')) + jetfitterClassifier = acc.popToolsAndMerge(JetFitterNNToolCfg('JetFitterNNTool', scheme)) defaults = { 'Runmodus' : flags.BTagging.RunModus, 'jetCollectionList' : [], #used only in reference mode 'SecVxFinderName' : 'JetFitter', diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetVertexChargeConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetVertexChargeConfig.py index 5a7edddcee4f53aca057ffe63f114227300ecb9a..5f6930d681be548267b444a0a5d322e15a4baa49 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/JetVertexChargeConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/JetVertexChargeConfig.py @@ -7,7 +7,7 @@ from JetTagTools.MuonCorrectionsToolConfig import MuonCorrectionsToolCfg # import the JetVertexCharger configurable from JetTagTools.JetTagToolsConf import Analysis__JetVertexCharge -def JetVertexChargeCfg(flags, name = 'JetVertexCharge', useBTagFlagsDefaults = True, **options ): +def JetVertexChargeCfg(flags, name = 'JetVertexCharge', scheme = '', useBTagFlagsDefaults = True, **options ): """Sets up a JetVertexCharge tool and returns it. @@ -63,5 +63,8 @@ def JetVertexChargeCfg(flags, name = 'JetVertexCharge', useBTagFlagsDefaults = T for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name + if scheme == 'Trig': + options['HistosKey'] = 'JetTagTrigCalibHistosKey' acc.setPrivateTools(Analysis__JetVertexCharge(**options)) return acc + diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py index 2d6d4c408ae5bc2030ead061c7e89f3e347bd573..daff689d3586330f44ba46f92fecd66dcf701e92 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/MV2TagConfig.py @@ -29,6 +29,8 @@ def MV2TagCfg( flags, name = 'MV2c10', scheme = '', useBTagFlagsDefaults = True, ForceMV2CalibrationAlias = False MV2CalibAlias = 'AntiKt4EMTopo' options['xAODBaseName'] = basename + if scheme == 'Trig': + options['HistosKey'] = 'JetTagTrigCalibHistosKey' if useBTagFlagsDefaults: defaults = { 'Runmodus' : flags.BTagging.RunModus, diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/MultiSVTagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/MultiSVTagConfig.py index 55d5d3f314d7e20a318b395310db69d78145d427..06f0fc65aaf3c411f164506786ddbb2195d1d9a6 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/MultiSVTagConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/MultiSVTagConfig.py @@ -7,7 +7,7 @@ from AthenaConfiguration.ComponentFactory import CompFactory Analysis__MultiSVTag=CompFactory.Analysis.MultiSVTag -def MultiSVTagCfg(flags, name = 'MultiSVbb1Tag', taggerNameBase = 'MultiSVbb1', useBTagFlagsDefaults = True, **options): +def MultiSVTagCfg(flags, name = 'MultiSVbb1Tag', taggerNameBase = 'MultiSVbb1', scheme = '', useBTagFlagsDefaults = True, **options): """Sets up a MultiSVTag tool and returns it. The following options have BTaggingFlags defaults: @@ -23,6 +23,9 @@ def MultiSVTagCfg(flags, name = 'MultiSVbb1Tag', taggerNameBase = 'MultiSVbb1', acc = ComponentAccumulator() options['name'] = name options['xAODBaseName'] = 'MSV' + if scheme == 'Trig': + options['HistosKey'] = 'JetTagTrigCalibHistosKey' + if useBTagFlagsDefaults: defaults = { 'Runmodus' : flags.BTagging.RunModus, 'taggerNameBase' : taggerNameBase, @@ -32,3 +35,4 @@ def MultiSVTagCfg(flags, name = 'MultiSVbb1Tag', taggerNameBase = 'MultiSVbb1', acc.setPrivateTools(Analysis__MultiSVTag( **options)) return acc + diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/MultivariateTagManagerConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/MultivariateTagManagerConfig.py index aac2bb9434edbe26dd8bffbb508063b5f64916df..312896d3ab795722a887f6a218199b0d052ed0a3 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/MultivariateTagManagerConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/MultivariateTagManagerConfig.py @@ -32,36 +32,36 @@ def MultivariateTagManagerCfg(flags, name = 'MultivariateTagManager', TaggerList MultivariateTagManagerAuxBranches += ['rnnip_p' + x for x in rnnip_outputs] if 'DL1' in TaggerList: - dl1 = acc.popToolsAndMerge(DL1TagCfg(flags, 'DL1')) + dl1 = acc.popToolsAndMerge(DL1TagCfg(flags, 'DL1', scheme)) mvtagtoollist.append(dl1) if 'DL1mu' in TaggerList: - dl1 = acc.popToolsAndMerge(DL1TagCfg(flags, 'DL1mu')) + dl1 = acc.popToolsAndMerge(DL1TagCfg(flags, 'DL1mu', scheme)) mvtagtoollist.append(dl1) if 'DL1rnn' in TaggerList: - dl1 = acc.popToolsAndMerge(DL1TagCfg(flags, 'DL1rnn')) + dl1 = acc.popToolsAndMerge(DL1TagCfg(flags, 'DL1rnn', scheme)) mvtagtoollist.append(dl1) if 'MV2c10' in TaggerList: - mv2 = acc.popToolsAndMerge(MV2TagCfg(flags, 'MV2c10')) + mv2 = acc.popToolsAndMerge(MV2TagCfg(flags, 'MV2c10', scheme)) mvtagtoollist.append(mv2) if 'MV2c10mu' in TaggerList: - mv2 = acc.popToolsAndMerge(MV2TagCfg(flags, 'MV2c10mu')) + mv2 = acc.popToolsAndMerge(MV2TagCfg(flags, 'MV2c10mu', scheme)) mvtagtoollist.append(mv2) if 'MV2c10rnn' in TaggerList: - mv2 = acc.popToolsAndMerge(MV2TagCfg(flags, 'MV2c10rnn')) + mv2 = acc.popToolsAndMerge(MV2TagCfg(flags, 'MV2c10rnn', scheme)) mvtagtoollist.append(mv2) if 'MV2c100' in TaggerList: - mv2 = acc.popToolsAndMerge(MV2TagCfg(flags, 'MV2c100')) + mv2 = acc.popToolsAndMerge(MV2TagCfg(flags, 'MV2c100', scheme)) mvtagtoollist.append(mv2) if 'MV2cl100' in TaggerList: - mv2 = acc.popToolsAndMerge(MV2TagCfg(flags, 'MV2cl100')) + mv2 = acc.popToolsAndMerge(MV2TagCfg(flags, 'MV2cl100', scheme)) mvtagtoollist.append(mv2) #Check if input has been scheduled diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/NewLikelihoodToolConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/NewLikelihoodToolConfig.py index 9c031793b872d958dbdef1083c057e3abd119152..b90d018e64bf6ac396ed0a905c499ea6e2d7ce43 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/NewLikelihoodToolConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/NewLikelihoodToolConfig.py @@ -6,7 +6,7 @@ from AthenaConfiguration.ComponentFactory import CompFactory # import the NewLikelihoodTool configurable Analysis__NewLikelihoodTool=CompFactory.Analysis.NewLikelihoodTool -def NewLikelihoodToolCfg( flags, name = 'NewLikelihoodTool', taggername = 'IP2D', useBTagFlagsDefaults = True, **options): +def NewLikelihoodToolCfg( flags, name = 'NewLikelihoodTool', taggername = 'IP2D', scheme = '', useBTagFlagsDefaults = True, **options): """Sets up a NewLikelihoodTool tool and returns it. The following options have BTaggingFlags defaults: @@ -31,6 +31,9 @@ def NewLikelihoodToolCfg( flags, name = 'NewLikelihoodTool', taggername = 'IP2D' for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name + if scheme == 'Trig': + options['HistosKey'] = 'JetTagTrigCalibHistosKey' acc.setPrivateTools(Analysis__NewLikelihoodTool(**options)) return acc + diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/RNNIPTagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/RNNIPTagConfig.py index 50d96b45e61783a80277bf7f0880a634d5d0e7f2..94133fd92a528657f0cf4dadc0aa22405ffcbe35 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/RNNIPTagConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/RNNIPTagConfig.py @@ -31,6 +31,8 @@ def RNNIPTagCfg( flags, name = 'RNNIP', scheme = '', calibration=None, useBTagFl WriteRNNInputs = False options['xAODBaseName'] = basename options['trackAssociationName'] = 'BTagTrackToJetAssociator' + if scheme == 'Trig': + options['HistosKey'] = 'JetTagTrigCalibHistosKey' cal_dir = calibration or basename is_flipped=False if (scheme == "Flip"): diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/SV1TagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/SV1TagConfig.py index 19c2bad813f5eb66e38c8d9ab5623dc756ecb822..0595c43f1aa5362d71252a11c0f77e33bea6c1f1 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/SV1TagConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/SV1TagConfig.py @@ -28,7 +28,7 @@ def SV1TagCfg( flags, name = 'SV1Tag', scheme = '', useBTagFlagsDefaults = True, options['name'] = name options['xAODBaseName'] = 'SV1' if useBTagFlagsDefaults: - likelihood = acc.popToolsAndMerge(NewLikelihoodToolCfg(flags, 'SV1NewLikelihoodTool', 'SV1')) + likelihood = acc.popToolsAndMerge(NewLikelihoodToolCfg(flags, 'SV1NewLikelihoodTool', 'SV1', scheme)) defaults = { 'Runmodus' : flags.BTagging.RunModus, 'referenceType' : flags.BTagging.ReferenceType, 'jetPtMinRef' : flags.BTagging.JetPtMinRef, @@ -42,3 +42,4 @@ def SV1TagCfg( flags, name = 'SV1Tag', scheme = '', useBTagFlagsDefaults = True, acc.setPrivateTools(Analysis__SVTag(**options)) return acc + diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/SoftMuonTagConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/SoftMuonTagConfig.py index db46da86737beb1f512442def77234011b04918c..be786050a1b18f4acfacb12d5eeb5aecef117000 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/SoftMuonTagConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/SoftMuonTagConfig.py @@ -9,7 +9,7 @@ from JetTagTools.MuonSelectorToolConfig import MuonSelectorToolCfg # import the SoftMuonTag configurable Analysis__SoftMuonTag=CompFactory.Analysis.SoftMuonTag -def SoftMuonTagCfg( flags, name = 'SoftMu', useBTagFlagsDefaults = True, **options ): +def SoftMuonTagCfg( flags, name = 'SoftMu', scheme = '', useBTagFlagsDefaults = True, **options ): """Sets up a SoftMuonTag tool and returns it. The following options have BTaggingFlags defaults: @@ -29,7 +29,7 @@ def SoftMuonTagCfg( flags, name = 'SoftMu', useBTagFlagsDefaults = True, **optio if useBTagFlagsDefaults: trackToVertexIPEstimator = acc.popToolsAndMerge(BTagTrackToVertexIPEstimatorCfg(flags, 'TrkToVxIPEstimator')) muonSelectorTool = acc.popToolsAndMerge(MuonSelectorToolCfg('MuonSelectorTool')) - likelihood = acc.popToolsAndMerge(NewLikelihoodToolCfg(flags, 'SoftMuonTagNewLikelihoodTool', 'SMT')) + likelihood = acc.popToolsAndMerge(NewLikelihoodToolCfg(flags, 'SoftMuonTagNewLikelihoodTool', 'SMT', scheme)) defaults = { 'Runmodus' : flags.BTagging.RunModus, 'jetCollectionList' : [], #used only in reference mode @@ -43,6 +43,9 @@ def SoftMuonTagCfg( flags, name = 'SoftMu', useBTagFlagsDefaults = True, **optio for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name + if scheme == 'Trig': + options['HistosKey'] = 'JetTagTrigCalibHistosKey' acc.setPrivateTools(Analysis__SoftMuonTag( **options)) return acc + diff --git a/PhysicsAnalysis/JetTagging/JetTagTools/python/SpecialTrackAssociatorConfig.py b/PhysicsAnalysis/JetTagging/JetTagTools/python/SpecialTrackAssociatorConfig.py index f1b54c5d613d47b8729fb243b47d93bf96f59075..0af349bea84d09c55ff8de1816f8724e73d13015 100644 --- a/PhysicsAnalysis/JetTagging/JetTagTools/python/SpecialTrackAssociatorConfig.py +++ b/PhysicsAnalysis/JetTagging/JetTagTools/python/SpecialTrackAssociatorConfig.py @@ -6,7 +6,7 @@ from AthenaConfiguration.ComponentFactory import CompFactory # import the TrackToVertexIPEstimator configurable CP__TrackVertexAssociationTool=CompFactory.CP.TrackVertexAssociationTool -def SpecialTrackAssociatorCfg( name = 'SpecialTrackAssociator', useBTagFlagsDefaults = True, **options ): +def SpecialTrackAssociatorCfg( name = 'SpecialTrackAssociator', PrimaryVertexCollectionName="", useBTagFlagsDefaults = True, **options ): """Sets up a SpecialTrackAssociator tool and returns it. The following options have BTaggingFlags defaults: @@ -22,6 +22,7 @@ def SpecialTrackAssociatorCfg( name = 'SpecialTrackAssociator', useBTagFlagsDefa for option in defaults: options.setdefault(option, defaults[option]) options['name'] = name + options['VertexContainer'] = PrimaryVertexCollectionName acc.setPrivateTools(CP__TrackVertexAssociationTool( **options)) return acc diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/BuildTruthTaus.cxx b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/BuildTruthTaus.cxx index e684027791018664180f5cbaaf2156ef95da898d..f75d60d649b9ecb4565c12fcb24f350d61436e44 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/Root/BuildTruthTaus.cxx +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/Root/BuildTruthTaus.cxx @@ -15,9 +15,6 @@ // Tool include(s) #include "MCTruthClassifier/MCTruthClassifier.h" -#define PRINTVAR(VAR) \ - std::cout<<__FILE__<<" "<<__LINE__<<":"<<#VAR<<" = "<<VAR<<"\n"; - using namespace TauAnalysisTools; //=================================PUBLIC-PART================================== @@ -45,9 +42,8 @@ BuildTruthTaus::BuildTruthTaus( const std::string& name ) } //______________________________________________________________________________ -BuildTruthTaus::~BuildTruthTaus( ) +BuildTruthTaus::~BuildTruthTaus() { - } //______________________________________________________________________________ @@ -56,8 +52,13 @@ StatusCode BuildTruthTaus::initialize() ATH_MSG_INFO( "Initializing BuildTruthTaus" ); m_sNewTruthTauContainerNameAux = m_sNewTruthTauContainerName + "Aux."; + // The following properties are only available in athena +#ifndef XAOD_ANALYSIS ATH_CHECK(m_tMCTruthClassifier.setProperty("ParticleCaloExtensionTool", "")); ATH_CHECK(m_tMCTruthClassifier.setProperty("TruthInConeTool", "")); +#endif + + ATH_CHECK(ASG_MAKE_ANA_TOOL(m_tMCTruthClassifier, MCTruthClassifier)); ATH_CHECK(m_tMCTruthClassifier.initialize()); return StatusCode::SUCCESS; diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/IDiTauTruthMatchingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/IDiTauTruthMatchingTool.h index 83e60a4739072936010b5e2e2376f252a91857c3..2bde682587e7fa56461bfa2406023315aea9711e 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/IDiTauTruthMatchingTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/IDiTauTruthMatchingTool.h @@ -34,8 +34,9 @@ namespace TauAnalysisTools { class IDiTauTruthMatchingTool - : public virtual asg::IAsgTool - , public virtual TauAnalysisTools::IBuildTruthTaus + // The order matters, do not switch them !!! + : public virtual TauAnalysisTools::IBuildTruthTaus + , public virtual asg::IAsgTool { /// Declare the interface that the class provides diff --git a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h index 4eefa0812382fe8fb761585d78769705cf1fe456..1f251f9f8d79ea8a9c86c253e674853cb770d545 100644 --- a/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h +++ b/PhysicsAnalysis/TauID/TauAnalysisTools/TauAnalysisTools/ITauTruthMatchingTool.h @@ -33,8 +33,9 @@ namespace TauAnalysisTools { class ITauTruthMatchingTool - : public virtual asg::IAsgTool - , public virtual TauAnalysisTools::IBuildTruthTaus + // The order matters, do not switch them !!! + : public virtual TauAnalysisTools::IBuildTruthTaus + , public virtual asg::IAsgTool { /// Declare the interface that the class provides diff --git a/PhysicsAnalysis/TileID/TileTripReader/CMakeLists.txt b/PhysicsAnalysis/TileID/TileTripReader/CMakeLists.txt index 859162fa050c795ff49a50673c5e30b21094dfa5..14f67bd06e86b11654343f856026212ff2fcd7ef 100644 --- a/PhysicsAnalysis/TileID/TileTripReader/CMakeLists.txt +++ b/PhysicsAnalysis/TileID/TileTripReader/CMakeLists.txt @@ -55,5 +55,3 @@ atlas_add_dictionary( TileTripReaderDict # Install files from the package: atlas_install_joboptions( share/*.py ) -atlas_install_xmls( data/*.root ) - diff --git a/Reconstruction/DiTauRec/src/SubjetBuilder.cxx b/Reconstruction/DiTauRec/src/SubjetBuilder.cxx index 574d2f22f7b83b960d1b1ee80090813923020a4c..1d54582b1c12d6ce44390ea01c0e2b380b12ae90 100644 --- a/Reconstruction/DiTauRec/src/SubjetBuilder.cxx +++ b/Reconstruction/DiTauRec/src/SubjetBuilder.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 */ @@ -138,7 +138,7 @@ StatusCode SubjetBuilder::execute(DiTauCandidateData * data, } ATH_MSG_DEBUG("found "<< vSubjets.size() << " subjets"); - for (const auto subjet: vSubjets) { + for (const auto& subjet: vSubjets) { ATH_MSG_DEBUG("pt: " << subjet.pt() << " eta: " << subjet.eta() << " phi: " << subjet.phi()); } diff --git a/Reconstruction/Jet/JetCalibTools/CMakeLists.txt b/Reconstruction/Jet/JetCalibTools/CMakeLists.txt index a2ea3a667b6d15a5b83b7492dbb7607bcd8daf20..fdc6500235144d7e328130187750520ba3dd21af 100644 --- a/Reconstruction/Jet/JetCalibTools/CMakeLists.txt +++ b/Reconstruction/Jet/JetCalibTools/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 808750 2017-07-26 19:46:53Z jbossios $ ################################################################################ # Package: JetCalibTools ################################################################################ @@ -33,8 +32,6 @@ atlas_depends_on_subdirs( # External dependencies: find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO Graf Gpad ) -atlas_install_generic( share/* DESTINATION data/JetCalibTools ) - # Libraries in the package: atlas_add_library( JetCalibToolsLib JetCalibTools/*.h Root/*.cxx diff --git a/Reconstruction/Jet/JetInterface/JetInterface/IJetEventSelector.h b/Reconstruction/Jet/JetInterface/JetInterface/IJetEventSelector.h index 7a630808ad06117e7a1aac2d6a30cc2e15c4edf9..91c7ad807e79d2315eddbe49c583267e8e3421ca 100644 --- a/Reconstruction/Jet/JetInterface/JetInterface/IJetEventSelector.h +++ b/Reconstruction/Jet/JetInterface/JetInterface/IJetEventSelector.h @@ -12,6 +12,7 @@ #include "AsgTools/IAsgTool.h" #include "xAODEventInfo/EventInfo.h" +#include "xAODJet/JetContainer.h" class IJetEventSelector : virtual public asg::IAsgTool { ASG_TOOL_INTERFACE(IJetEventSelector) @@ -23,7 +24,7 @@ public: /// Method to select. /// Returns true if eventinfo condition is passed. - virtual int keep(const xAOD::EventInfo &e) const =0; + virtual int keep(const xAOD::EventInfo &e, const xAOD::JetContainer & jets) const =0; }; diff --git a/Reconstruction/Jet/JetJvtEfficiency/CMakeLists.txt b/Reconstruction/Jet/JetJvtEfficiency/CMakeLists.txt index 29fdb6aca282106e42b1f9dd2ab5be6157e56352..5b72604ac5630fd8aabfd91a3165b031f27d4d79 100644 --- a/Reconstruction/Jet/JetJvtEfficiency/CMakeLists.txt +++ b/Reconstruction/Jet/JetJvtEfficiency/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 782671 2016-11-07 09:27:00Z elmsheus $ # The name of the package: atlas_subdir( JetJvtEfficiency ) @@ -43,5 +42,4 @@ atlas_add_dictionary( JetJvtEfficiencyDict LINK_LIBRARIES JetJvtEfficiencyLib ) # Install files from the package: -atlas_install_data( share/*.root ) -atlas_install_python_modules( python/*.py ) \ No newline at end of file +atlas_install_python_modules( python/*.py ) diff --git a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVoronoiDiagramHelpers.h b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVoronoiDiagramHelpers.h index fd4f56dab9362daf6b8339f3db0590a2bda652ef..4e44a8c191d5d55b04ba49b108cb79026facfc31 100644 --- a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVoronoiDiagramHelpers.h +++ b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVoronoiDiagramHelpers.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 */ // JetVoronoiDiagramHelpers.h @@ -98,7 +98,7 @@ namespace JetVoronoiDiagramHelpers { void FillVoroPolygon(VoronoiPolygonBoost & out) const { if (empty()) return; // add all - for ( const Point p : *this ) out.outer().push_back(VoronoiPointBoost(p.x,p.y)); + for ( const Point& p : *this ) out.outer().push_back(VoronoiPointBoost(p.x,p.y)); // add first again to close shape if necessary if ( front() != back() ) out.outer().push_back(VoronoiPointBoost(front().x,front().y)); // correct geometry diff --git a/Reconstruction/Jet/JetMomentTools/src/JetVoronoiDiagramHelpers.cxx b/Reconstruction/Jet/JetMomentTools/src/JetVoronoiDiagramHelpers.cxx index c8aec3da3929671272bcacada631fe5f42e1d9ab..186281021f702e04ac94b57d3c0a8dd9c5abcf7f 100644 --- a/Reconstruction/Jet/JetMomentTools/src/JetVoronoiDiagramHelpers.cxx +++ b/Reconstruction/Jet/JetMomentTools/src/JetVoronoiDiagramHelpers.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 "JetMomentTools/JetVoronoiDiagramHelpers.h" @@ -128,7 +128,7 @@ namespace JetVoronoiDiagramHelpers{ size_t Diagram::findPointIndex(const Point &a) const{ size_t index=0; - for (const Point b: m_voro_vtx){ + for (const Point& b: m_voro_vtx){ if (a==b) return index; index++; } diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/EventHistoVarTool.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/EventHistoVarTool.h index 5013ebdab2301a1b92e8416dc82617040250c442..6a0a32b4236f9b21d7904d5192c157f9da332eed 100644 --- a/Reconstruction/Jet/JetMonitoring/JetMonitoring/EventHistoVarTool.h +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/EventHistoVarTool.h @@ -6,7 +6,7 @@ #define JETMONITORING_EventVARTOOL_H #include "xAODEventInfo/EventInfo.h" - +#include "xAODJet/JetContainer.h" #include "GaudiKernel/IAlgTool.h" #include "AthenaBaseComps/AthAlgTool.h" @@ -16,7 +16,7 @@ static const InterfaceID IID_IEventHistoVarTool("IEventHistoVarTool", 1 , 0); /////////////////////////////////////////////////////////// /// \class EventHistoVarTool /// -/// This class is a simple tool to access EventInfo +/// This class is a simple tool to access EventInfo or JetContainer /// variables within the JetMonitoring environment /// @@ -30,9 +30,9 @@ public: virtual ~IEventHistoVarTool(){} /// the value of the variable for a given Event - virtual float value(const xAOD::EventInfo &) const = 0; + virtual float value(const xAOD::EventInfo &, const xAOD::JetContainer&) const = 0; /// a compact description of the variable. - virtual std::string describe() const =0; + virtual std::string varName() const =0; }; @@ -43,13 +43,14 @@ public: virtual StatusCode initialize() ; - virtual float value(const xAOD::EventInfo &) const; - virtual std::string describe() const {return m_varName;} + virtual float value(const xAOD::EventInfo &, const xAOD::JetContainer&) const; + virtual std::string varName() const {return m_varName;} private: - Gaudi::Property<std::string> m_varName {this,"Variable", ""}; + Gaudi::Property<std::string> m_varName {this,"VarName", ""}; + Gaudi::Property<std::string> m_attName {this,"Attribute", ""}; Gaudi::Property<float> m_defaultValue = {this,"Default", -1.}; }; diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetEventSelector.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetEventSelector.h index f35ce02283e44a7aa69c72f8ebb3f6849830181e..8007fd349c5f9826a94012f4cafc8c5aef7fea7e 100644 --- a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetEventSelector.h +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetEventSelector.h @@ -22,7 +22,7 @@ class JetEventSelector : public asg::AsgTool , virtual public IJetEventSelector virtual StatusCode initialize() ; - int keep(const xAOD::EventInfo& e) const; + int keep(const xAOD::EventInfo& e, const xAOD::JetContainer & jets) const; protected: diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoEventLevelFiller.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoEventLevelFiller.h new file mode 100644 index 0000000000000000000000000000000000000000..e423ccd25065e09d8ac66df6d07c5a6c60fd3d54 --- /dev/null +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoEventLevelFiller.h @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + + +This tool is intended to be able to make histograms of event level variables + +*/ + +#ifndef JETHISTOEVENTLEVELFILLER_H +#define JETHISTOEVENTLEVELFILLER_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "JetMonitoring/IJetHistoFiller.h" +#include "JetMonitoring/EventHistoVarTool.h" + +class JetHistoEventLevelFiller : public AthAlgTool, virtual public IJetHistoFiller { +public: + + JetHistoEventLevelFiller( const std::string& type, const std::string & name ,const IInterface* parent); + virtual ~JetHistoEventLevelFiller(){} + virtual StatusCode processJetContainer(const JetMonitoringAlg& parentAlg, const xAOD::JetContainer & jets, const EventContext& ctx) const ; + +private: + + Gaudi::Property<std::string> m_group {this,"Group", "undefined"}; + ToolHandle<IEventHistoVarTool> m_var; + +}; +#endif + diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetVariable.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetVariable.h index a20cff9723707dc50f1f383fd5f1ddf91f529dcf..5321f6cb976b5176142535ddb9e6c0b9cd567f2e 100644 --- a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetVariable.h +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetVariable.h @@ -168,7 +168,7 @@ namespace JetVar { virtual float value(const xAOD::Jet & j) const { return j.p4().Et()*m_scale;} }; - struct FChargeVar : public Variable { + struct FChargedVar : public Variable { using Variable::Variable; virtual float value(const xAOD::Jet & j) const { bool status = false; diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/NumJetVarTool.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/NumJetVarTool.h new file mode 100644 index 0000000000000000000000000000000000000000..3500d8d6d898371892442927ddbe70c9becb2780 --- /dev/null +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/NumJetVarTool.h @@ -0,0 +1,41 @@ +/* this file is -*- C++ -*- + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef JETMONITORING_NUMJETVARTOOL_H +#define JETMONITORING_NUMJETVARTOOL_H + +#include "JetMonitoring/EventHistoVarTool.h" +#include "GaudiKernel/IAlgTool.h" +#include "AthenaBaseComps/AthAlgTool.h" + +/////////////////////////////////////////////////////////// +/// \class NumJetVarTool +/// +/// This class is a simple tool to count the jet multiplicity +/// using the existing EventHistoVarTool and JetEventSelector +/// + +class NumJetVarTool : public AthAlgTool, virtual public IEventHistoVarTool { +public: + NumJetVarTool(const std::string & type, const std::string & name, const IInterface* parent); + virtual ~NumJetVarTool(){} + + virtual StatusCode initialize() ; + + virtual float value(const xAOD::EventInfo &, const xAOD::JetContainer&) const; + virtual std::string varName() const {return m_varName;} + +private: + + Gaudi::Property<float> m_ptCut = {this,"PtCut", 0.}; + Gaudi::Property<float> m_etCut = {this,"EtCut", 0.}; + Gaudi::Property<float> m_etaMin = {this,"EtaMin", -10.}; + Gaudi::Property<float> m_etaMax = {this,"EtaMax", 10.}; + Gaudi::Property<std::string> m_varName {this,"VarName", ""}; + bool m_failureOnMissingContainer; + +}; + + +#endif diff --git a/Reconstruction/Jet/JetMonitoring/Root/JetEventSelector.cxx b/Reconstruction/Jet/JetMonitoring/Root/JetEventSelector.cxx index 6aeadb562f634201e86e5c112c661ac054f87ea9..ca602fac06d23757d5a76b3bb7750c771a8bdd07 100644 --- a/Reconstruction/Jet/JetMonitoring/Root/JetEventSelector.cxx +++ b/Reconstruction/Jet/JetMonitoring/Root/JetEventSelector.cxx @@ -24,12 +24,12 @@ JetEventSelector:: ~JetEventSelector(){ StatusCode JetEventSelector::initialize() { ATH_CHECK(m_var.retrieve() ); - ATH_MSG_INFO( "Selecting on var ("<< m_var->describe() << ") in ["<< m_min << " , "<< m_max<< "]"); + ATH_MSG_INFO( "Selecting on var ("<< m_var->varName() << ") in ["<< m_min << " , "<< m_max<< "]"); return StatusCode::SUCCESS; } -int JetEventSelector::keep(const xAOD::EventInfo& e) const { - float v = m_var->value(e); +int JetEventSelector::keep(const xAOD::EventInfo& e, const xAOD::JetContainer & jets) const { + float v = m_var->value(e, jets); return (m_min < v ) && (v<m_max); } diff --git a/Reconstruction/Jet/JetMonitoring/python/JetHistoTools.py b/Reconstruction/Jet/JetMonitoring/python/JetHistoTools.py index 9af368bf185f250d18b3d03b872b5dc0052da19a..c7f79825e06dda59620d202c9b82b665bef0c2b4 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetHistoTools.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetHistoTools.py @@ -126,6 +126,11 @@ compactSpecification = { "NumTrkPt500[0]" : (("Number of tracks from PV0 above 0.5 GeV:N_{tracks}(p_{T}>0.5 GeV);", 100,0,100), ("NumTrkPt500[0]", "vector<int>") ), "NumTrkPt1000[0]" : (("Number of all tracks above 1 GeV:N_{tracks}(p_{T}>1 GeV);", 100,0,100), ("NumTrkPt1000[0]", "vector<int>") ), "TrackWidthPt1000[0]": (("Width from tracks from PV0 above 1 GeV:Track Width(p_{T}>1 GeV);", 75,0.,1.5), ("TrackWidthPt1000[0]", "vector<float>") ), + "SumPtChargedPFOPt500" : (("Sum Pt of all charged PFOs above 0.5 GeV:SumPt chargedPFO(p_{T}>0.5 GeV);", 100,0,200), ("SumPtChargedPFOPt500", "vector<float>", "gev") ), + "SumPtChargedPFOPt500[0]" : (("Sum Pt of all charged PFOs from PV0 above 0.5 GeV:SumPt(p_{T}>0.5 GeV);", 100,0,200), ("SumPtChargedPFOPt500[0]", "vector<float>", "gev") ), + "NumChargedPFOPt500[0]" : (("Number of charged PFOs from PVO above 0.5 GeV:N_{charged PFO}(p_{T}>0.5 GeV);", 100,0,100), ("NumChargedPFOPt500[0]", "vector<int>") ), + "NumChargedPFOPt1000[0]" :(("Number of charged PFOs from PVO above 1 GeV:N_{charged PFO}(p_{T}>1 GeV);", 100,0,100), ("NumChargedPFOPt1000[0]", "vector<int>") ), + "ChargedPFOWidthPt1000[0]": (("Width from charged PFOs from PV0 above 1 GeV:Charged PFO Width(p_{T}>1 GeV);", 75,0.,1.5), ("ChargedPFOWidthPt1000[0]", "vector<float>") ), "ActiveArea" : (("Active Area;Area;", 80, 0, 0.8), ("ActiveArea", "float") ), "ActiveArea15" : (("Active Area;Area;", 80, 0, 1.5), ("ActiveArea", "float") ), "BchCorrDotx" : (("BchCorrDotx:BchCorrDotx;",50,0,1), ("BchCorrDotx", "float") ), @@ -198,7 +203,7 @@ jhm.addTool( EfficiencyResponseHistos("effresponse", hdef('erhEfficiencyR2', "Jet p_{T} Efficiency #DeltaR = 0.2;p_{T}^{Truth} (GeV);Efficiency",50,0,100 ), hdef('erhEfficiencyR3', "Jet p_{T} Efficiency #DeltaR = 0.3;p_{T}^{Truth} (GeV);Efficiency",50,0,100 ), - hdef('erhResponse', "Jet p_{T} Response;Number of jets;#frac{p_{T}^{Jet} - p_{T}^{Truth}}{p_{T}^{Truth}}",50,-1,1 ), + hdef('erhResponse', "Jet p_{T} Response;#frac{p_{T}^{Jet} - p_{T}^{Truth}}{p_{T}^{Truth}};Number of jets",50,-1,1 ), hdef('erhResponseVsEta', "Jet p_{T} Response vs #eta;#eta of jet;#frac{p_{T}^{Jet} - p_{T}^{Truth}}{p_{T}^{Truth}}",50,-5,5 ), hdef('erhResponseVsPt', "Jet p_{T} Response vs p_{T};p_{T}^{Truth} of jet;#frac{p_{T}^{Jet} - p_{T}^{Truth}}{p_{T}^{Truth}}",50,0,1000 ), diff --git a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py index c3e3e34cc8ef395a3c79a90b25db5d286423ed21..9577ba56a446f77652588b2d79fc19f77b2e6875 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py @@ -376,6 +376,41 @@ class HistoSpec(ToolSpec): write(')') +class EventHistoSpec(ToolSpec): + """A similar dictionary to HistoSpec above, but specialized to contain a + JetHistoEventLevelFiller specification. + Invocation is like : spec = EventHistoSpec( name, bins=(n,xlow,xhigh) ) + """ + def __init__(self, name, bins, **args): + ToolSpec.__init__(self, klass=None, name=name, **args) # we don't really need to pass a klass because we're specialized for JetHistoEventLevelFiller, see toTool() + self.bins = bins + self.hargs = ConfigDict( **args) + + + def toTool(self): + from AthenaConfiguration.ComponentFactory import CompFactory + from JetMonitoring.JetStandardHistoSpecs import knownEventVar + # force the property "VarName" to simply be the name of the variable specification: + v = knownEventVar[self.name] + v.VarName = v.name + tool = CompFactory.JetHistoEventLevelFiller( self.name+"hfiller", + Var = v.toTool(), + Group = self.name, + ) + return tool + + def defineHisto(self, parentAlg, monhelper , path): + from JetMonitoring.JetStandardHistoSpecs import knownEventVar + hargs = dict(xbins = self.bins[0],xmin = self.bins[1], xmax=self.bins[2], + type='TH1F', ) + hargs.update( **self.hargs) + # we create one group for each histoFiller : self.name() are unique within a JetMonitoringAlg + bottomLevelDir = self.bottomLevelDir if self.bottomLevelDir != '' else parentAlg.JetContainerName + group = monhelper.addGroup(parentAlg, self.name, self.topLevelDir+bottomLevelDir) + group.defineHistogram(knownEventVar[self.name].VarName, path=path, **hargs) + + + class SelectSpec(ToolSpec): @@ -544,15 +579,15 @@ def retrieveVarToolConf(alias): def retrieveEventVarToolConf(alias): - """Return a ToolSpec from alias : (now with EventInfo variables) + """Return a ToolSpec from alias : (now with EventInfo or JetContainer 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', alias, Variable=alias) + if isinstance(alias, str): #check for existing event or jetcontainer specs + conf = knownEventVar.get(alias,None) + if conf is None: #assume it's an eventInfo variable + conf = ToolSpec('EventHistoVarTool', alias, Attribute=alias) else: # assume it's a config dict conf = alias return conf diff --git a/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py b/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py index 16a3c515b0f95b284bc2e81d28f25e9a103e65bb..df219a76df1ecdefd6168a579d4be16dcadc370c 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py @@ -1,7 +1,7 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon import SystemOfUnits -from JetMonitoring.JetMonitoringConfig import HistoSpec, VarSpec, ConfigDict, ToolSpec +from JetMonitoring.JetMonitoringConfig import HistoSpec, EventHistoSpec, VarSpec, ConfigDict, ToolSpec # *********************************************** # *********************************************** @@ -19,13 +19,20 @@ knownVar = dict( # this variable has an index specified. It will thus has only 1 value per jet : the JVF at pos 0 JVF0 = VarSpec('JVF', 'vecfloat', 0), + ) knownEventVar = dict( # These always are of type 'float' - avgMu = ToolSpec('EventHistoVarTool', 'avgMu', Variable='averageInteractionsPerCrossing'), - actMu = ToolSpec('EventHistoVarTool', 'actMu', Variable='actualInteractionsPerCrossing'), + avgMu = ToolSpec('EventHistoVarTool', 'avgMu', Attribute='averageInteractionsPerCrossing'), + actMu = ToolSpec('EventHistoVarTool', 'actMu', Attribute='actualInteractionsPerCrossing'), + njets = ToolSpec('NumJetVarTool', 'njets', ), + njetsPt20 = ToolSpec('NumJetVarTool', 'njetsPt20', PtCut=20.), + njetsPt50 = ToolSpec('NumJetVarTool', 'njetsPt50', PtCut=50.), + njetsEt20 = ToolSpec('NumJetVarTool', 'njetsEt20', EtCut=20.), + njetsEt50 = ToolSpec('NumJetVarTool', 'njetsEt50', EtCut=50.), + njetsEt40Eta1_2 = ToolSpec('NumJetVarTool', 'njetsEt40Eta1_2', EtCut=50., EtaMin=1., EtaMax=2.), ) # *************************************** @@ -38,12 +45,10 @@ knownEventVar = dict( # See various commented examples below for optional arguments. _knownHistos = [ - # Simple form : histogram of variable 'eta' (the name of spec is the same as the name of variable) # As in TH1 ctor, ';' in the title is interpreted as in "Main Title;Title xAxis;Title yAxis" HistoSpec( 'eta', (50,-5,5) , title='#eta;#eta;Entries'), HistoSpec( 'phi', (50,-3.3,3.3) , title='#phi;#phi;Entries'), - # Same but we indicate that the variable is to be plotted in GeV by appending ':GeV' HistoSpec( 'pt:GeV', (100,0,200) , title='p_{T};p_{T} [GeV];'), HistoSpec( 'm:GeV', (100,0,300) , title='mass;mass [GeV];'), @@ -54,7 +59,7 @@ _knownHistos = [ # We add a new spec with a new name and we indicate the actual variable with the argument xvar HistoSpec( 'highpt', (100,0.,4000) , title='p_{T};p_{T} [GeV];', xvar='pt:GeV'), - + #EventHistoSpec( 'njets', (30,0,30), title='Jet Multiplicity;Njets;Entries' ), # When the jet variable is not a simple float, use the xvar argument to refer to a detailed variable spec in 'knownVar' HistoSpec( 'JVF', (100,0,1.2) , title='Jet Vtx Frac;JVF;', xvar='JVF'), # if the var name contains '[N]' the system will assume the variable is a vector<float> and setup tools accordingly (so we don't need to specify 'xvar') @@ -100,7 +105,7 @@ _knownHistos = [ HistoSpec('NumTrkPt1000[0]', (100, 0, 100), title='Number of all tracks above 1 GeV:N_{tracks}(p_{T}>1 GeV);NumTrkPt1000;Entries', ), HistoSpec('SumPtTrkPt500[0]:GeV', (100, 0, 200), title='Sum Pt of all tracks above 0.5 GeV:SumPtTrk(p_{T}>0.5 GeV);SumPtTrkPt500 [GeV];Entries', ), HistoSpec('SumPtChargedPFOPt500[0]:GeV', (100, 0, 200), title='Sum Pt of all charged PFO above 0.5 GeV:SumPtChargedPFO(p_{T}>0.5 GeV);SumPtChargedPFOPt500 [GeV];Entries', ), - HistoSpec('fCharge', (100, 0, 2), title='Normalised sum Pt of all charged PFO above 0.5 GeV:fCharge(p_{T}>0.5 GeV);fCharge;Entries', ), + HistoSpec('fCharged', (100, 0, 2), title='Normalised sum Pt of all charged PFO above 0.5 GeV:fCharged(p_{T}>0.5 GeV);fCharged;Entries', ), 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 index 9db068ccc9ca6473dd8abd39c672bdcb8da606cc..a53ff72e719945f225bde633b28ad4c3dad07383 100644 --- a/Reconstruction/Jet/JetMonitoring/src/EventHistoVarTool.cxx +++ b/Reconstruction/Jet/JetMonitoring/src/EventHistoVarTool.cxx @@ -20,13 +20,13 @@ StatusCode EventHistoVarTool::initialize() { } -float EventHistoVarTool::value(const xAOD::EventInfo & e) const { +float EventHistoVarTool::value(const xAOD::EventInfo & e, const xAOD::JetContainer & /*jets not used in this implementation*/) const { - if (! e.isAvailable<float>(m_varName) ) { - ATH_MSG_WARNING("Could not access EventInfo variable "<< m_varName << ", returning default value " << m_defaultValue ); + if (! e.isAvailable<float>(m_attName) ) { + ATH_MSG_WARNING("Could not access EventInfo variable "<< m_attName << ", returning default value " << m_defaultValue ); return m_defaultValue; } - return e.auxdata<float>(m_varName); + return e.auxdata<float>(m_attName); } diff --git a/Reconstruction/Jet/JetMonitoring/src/JetHistoEventLevelFiller.cxx b/Reconstruction/Jet/JetMonitoring/src/JetHistoEventLevelFiller.cxx new file mode 100644 index 0000000000000000000000000000000000000000..12ac182ee15b07b453af7b2729ad3d9d9df3cd89 --- /dev/null +++ b/Reconstruction/Jet/JetMonitoring/src/JetHistoEventLevelFiller.cxx @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "AthenaMonitoringKernel/Monitored.h" +#include "JetMonitoring/JetHistoEventLevelFiller.h" +#include "JetMonitoring/JetMonitoringAlg.h" +#include "xAODEventInfo/EventInfo.h" + +JetHistoEventLevelFiller::JetHistoEventLevelFiller( const std::string& type, const std::string & name ,const IInterface* parent): + AthAlgTool( type, name, parent ) + , m_var(this) + +{ + declareInterface<IJetHistoFiller>(this); + declareProperty("Var", m_var); +} + +StatusCode JetHistoEventLevelFiller::processJetContainer(const JetMonitoringAlg& parentAlg, const xAOD::JetContainer & jets, const EventContext& ctx) const { + + auto eventInfo = parentAlg.GetEventInfo(ctx); + Monitored::Scalar<float> s( m_var->varName() ); + s = m_var->value( *eventInfo, jets ); + parentAlg.fill(m_group, s ); + + return StatusCode::SUCCESS; +} + diff --git a/Reconstruction/Jet/JetMonitoring/src/JetHistoSelectSort.cxx b/Reconstruction/Jet/JetMonitoring/src/JetHistoSelectSort.cxx index d6608a9aa7e5e975e856bfa18a0796b116881a97..ec9a1a8d913dae26aec6b449a65df812cd48ed99 100644 --- a/Reconstruction/Jet/JetMonitoring/src/JetHistoSelectSort.cxx +++ b/Reconstruction/Jet/JetMonitoring/src/JetHistoSelectSort.cxx @@ -79,7 +79,7 @@ StatusCode JetHistoSelectSort::processJetContainer(const JetMonitoringAlg& paren if(m_eventSelTool.isEnabled()){ auto eventInfo = parentAlg.GetEventInfo(ctx); - if ( ! m_eventSelTool->keep(*eventInfo) ) tmpList.clear(); + if ( ! m_eventSelTool->keep(*eventInfo, jets) ) tmpList.clear(); } diff --git a/Reconstruction/Jet/JetMonitoring/src/JetVariable.cxx b/Reconstruction/Jet/JetMonitoring/src/JetVariable.cxx index 2ec3b27f6de5511d6f905d07b88eaa55e8a0002f..094ab5c78e45a92a379a630f1992ffb14a2d5e84 100644 --- a/Reconstruction/Jet/JetMonitoring/src/JetVariable.cxx +++ b/Reconstruction/Jet/JetMonitoring/src/JetVariable.cxx @@ -17,7 +17,7 @@ namespace JetVar { if(name=="abseta") return std::make_unique<AbsEtaVar>(name); if(name=="|eta|") return std::make_unique<AbsEtaVar>(name); if(name=="rapidity") return std::make_unique<Rapidity>(name); - if(name=="fCharge") return std::make_unique<FChargeVar>(name); + if(name=="fCharged") return std::make_unique<FChargedVar>(name); if(name=="EM3Frac") return std::make_unique<EM3FracVar>(name); if(name=="Tile0Frac") return std::make_unique<Tile0FracVar>(name); diff --git a/Reconstruction/Jet/JetMonitoring/src/NumJetVarTool.cxx b/Reconstruction/Jet/JetMonitoring/src/NumJetVarTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..86d189d2c3bb79fa3e24e4a8f052cf5c72766e2e --- /dev/null +++ b/Reconstruction/Jet/JetMonitoring/src/NumJetVarTool.cxx @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "JetMonitoring/NumJetVarTool.h" +#include "xAODJet/Jet.h" + + +NumJetVarTool::NumJetVarTool(const std::string & type, const std::string & name ,const IInterface* parent): + AthAlgTool( type, name, parent ) + , m_failureOnMissingContainer(false) +{ + declareInterface<IEventHistoVarTool>(this); + declareProperty("FailureOnMissingContainer", m_failureOnMissingContainer); + +} + +StatusCode NumJetVarTool::initialize() { + + ATH_MSG_INFO("Counting number of jets with PtCut: "<<m_ptCut<<", EtCut: "<<m_etCut<<", EtaMin: "<<m_etaMin<<", EtaMax: "<<m_etaMax); + + return StatusCode::SUCCESS; + +} + +float NumJetVarTool::value(const xAOD::EventInfo & /*eventinfo not used in this implementation*/, const xAOD::JetContainer & jets) const { + + if ( jets.empty() ) { + if (m_failureOnMissingContainer){ + ATH_MSG_ERROR("Input JetContainer could not be found or is empty"); + return 0.; + } else { + ATH_MSG_WARNING("Input JetContainer could not be found or is empty"); + return 0.; + } + } + + float njets = 0.; + for (const xAOD::Jet* jet : jets) { + if (jet->pt() >= m_ptCut*1000. && jet->p4().Et() >= m_etCut*1000. && fabs(jet->eta()) >= m_etaMin && fabs(jet->eta()) <= m_etaMax ) { + njets++; + } + } + return njets; +} diff --git a/Reconstruction/Jet/JetMonitoring/src/components/JetMonitoring_entries.cxx b/Reconstruction/Jet/JetMonitoring/src/components/JetMonitoring_entries.cxx index cf1c2e33da6b7ce00d57e7afa8c32d67e697c284..4b902f5e301d2d7545d99c89959345a6135189c8 100644 --- a/Reconstruction/Jet/JetMonitoring/src/components/JetMonitoring_entries.cxx +++ b/Reconstruction/Jet/JetMonitoring/src/components/JetMonitoring_entries.cxx @@ -13,10 +13,12 @@ #include "JetMonitoring/JetMonitoringAlg.h" #include "JetMonitoring/JetHistoPtTool.h" +#include "JetMonitoring/JetHistoEventLevelFiller.h" #include "JetMonitoring/JetHistoAttributeFiller.h" #include "JetMonitoring/JetHistoTriggEfficiency.h" #include "JetMonitoring/JetHistoVarTool.h" #include "JetMonitoring/EventHistoVarTool.h" +#include "JetMonitoring/NumJetVarTool.h" #include "JetMonitoring/JetHistoSelectSort.h" #include "JetMonitoring/JetHistoResponseAndEff.h" @@ -40,10 +42,12 @@ DECLARE_COMPONENT( HIJetUEMonitoring ) DECLARE_COMPONENT( JetMonitoringAlg ) DECLARE_COMPONENT( JetHistoPtTool) DECLARE_COMPONENT( JetHistoTriggEfficiency) +DECLARE_COMPONENT( JetHistoEventLevelFiller) DECLARE_COMPONENT( JetHistoAttributeFiller) DECLARE_COMPONENT( JetHistoSelectSort) DECLARE_COMPONENT( JetHistoVarTool) DECLARE_COMPONENT( EventHistoVarTool) +DECLARE_COMPONENT( NumJetVarTool) DECLARE_COMPONENT( JetHistoResponseAndEff) DECLARE_COMPONENT( JetAttributeHisto ) diff --git a/Reconstruction/Jet/JetRec/CMakeLists.txt b/Reconstruction/Jet/JetRec/CMakeLists.txt index e3521c4012fca6ee685927c039e671b54a0dd1c5..a0b25cc6ff22dd4d56324b4c93de985df4fbad74 100644 --- a/Reconstruction/Jet/JetRec/CMakeLists.txt +++ b/Reconstruction/Jet/JetRec/CMakeLists.txt @@ -54,9 +54,9 @@ atlas_add_library( JetRecLib INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${FASTJET_INCLUDE_DIRS} ${FASTJETCONTRIB_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${FASTJETCONTRIB_LIBRARIES} ${FASTJET_LIBRARIES} AthLinks AthContainers AsgTools xAODCaloEvent xAODJet xAODMuon EventShapeInterface JetEDM - JetInterface + JetInterface ${mon_lib} PRIVATE_LINK_LIBRARIES CxxUtils xAODBase xAODCore - xAODEventInfo xAODTracking ${mon_lib}) + xAODEventInfo xAODTracking ) if( NOT XAOD_STANDALONE ) atlas_add_component( JetRec diff --git a/Reconstruction/Jet/JetRec/python/JetRecUtils.py b/Reconstruction/Jet/JetRec/python/JetRecUtils.py index 737b603a9fa2cd63bb3b001175673505fffc24df..0d0f11efe543734dee97950f2d9084eae0ac978d 100644 --- a/Reconstruction/Jet/JetRec/python/JetRecUtils.py +++ b/Reconstruction/Jet/JetRec/python/JetRecUtils.py @@ -16,29 +16,6 @@ def retrieveAODList(): # jobs starts from empty files. See ATEAM-191. # We hard code the list here while waiting for a more robust solution - exclusionStr = "" - # Build a list of branches to be excluded from writing - if jetFlags.detailLevel()==JetContentDetail.Reduced: - excludedMoments = [ - 'GhostBHadronsFinalCount', 'GhostBHadronsFinalPt', - 'GhostBHadronsInitialCount', 'GhostBHadronsInitialPt', - 'GhostBQuarksFinalCount', 'GhostBQuarksFinalPt', - 'GhostCHadronsFinalCount', 'GhostCHadronsFinalPt', - 'GhostCHadronsInitialCount', 'GhostCHadronsInitialPt', - 'GhostCQuarksFinalCount', 'GhostCQuarksFinalPt', - 'GhostHBosonsCount', 'GhostHBosonsPt', - 'GhostPartonsCount', 'GhostPartonsPt', - 'GhostTQuarksFinalCount', 'GhostTQuarksFinalPt', - 'GhostTausFinalCount', 'GhostTausFinalPt', - 'GhostTruthCount', 'GhostTruthPt', - 'GhostWBosonsCount', 'GhostWBosonsPt', - 'GhostZBosonsCount', 'GhostZBosonsPt', - 'GhostAntiKt4TrackJetCount', 'GhostAntiKt4TrackJetPt', - 'GhostTrackCount', 'GhostTrackPt', - 'GhostAntiKt2TrackJetCount', - ] - exclusionStr = ".".join(["-"+mom for mom in excludedMoments]) - l = [ # event shape objects 'xAOD::EventShape#Kt4EMPFlowEventShape', 'xAOD::EventShapeAuxInfo#Kt4EMPFlowEventShapeAux.', @@ -56,9 +33,9 @@ def retrieveAODList(): 'xAOD::PFOContainer#CHSChargedParticleFlowObjects', 'xAOD::ShallowAuxContainer#CHSChargedParticleFlowObjectsAux.', 'xAOD::PFOContainer#CHSNeutralParticleFlowObjects', 'xAOD::ShallowAuxContainer#CHSNeutralParticleFlowObjectsAux.', - 'xAOD::JetContainer#AntiKt4EMPFlowJets', 'xAOD::JetAuxContainer#AntiKt4EMPFlowJetsAux.'+exclusionStr, - 'xAOD::JetContainer#AntiKt4EMTopoJets', 'xAOD::JetAuxContainer#AntiKt4EMTopoJetsAux.'+exclusionStr, - 'xAOD::JetContainer#AntiKt4LCTopoJets', 'xAOD::JetAuxContainer#AntiKt4LCTopoJetsAux.'+exclusionStr, + 'xAOD::JetContainer#AntiKt4EMPFlowJets', 'xAOD::JetAuxContainer#AntiKt4EMPFlowJetsAux.', + 'xAOD::JetContainer#AntiKt4EMTopoJets', 'xAOD::JetAuxContainer#AntiKt4EMTopoJetsAux.', + 'xAOD::JetContainer#AntiKt4LCTopoJets', 'xAOD::JetAuxContainer#AntiKt4LCTopoJetsAux.', ] if jetFlags.detailLevel()>=JetContentDetail.Full: diff --git a/Reconstruction/Jet/JetRec/src/JetRecAlg.cxx b/Reconstruction/Jet/JetRec/src/JetRecAlg.cxx index 653b0ac1f74ef5750d4d6ec9832b345e1e4cc472..9ede1a27d07fc21e702f9f59440dbeb2c3b5bb15 100644 --- a/Reconstruction/Jet/JetRec/src/JetRecAlg.cxx +++ b/Reconstruction/Jet/JetRec/src/JetRecAlg.cxx @@ -1,6 +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 */ // JetRecAlg.cxx @@ -53,7 +53,7 @@ StatusCode JetRecAlg::execute(const EventContext& ctx) const { ATH_MSG_DEBUG("Applying jet modifiers to " << m_output.key()); // Calculate moments, calibrate, sort, filter... ----------- - for(const ToolHandle<IJetModifier> t : m_modifiers){ + for(const ToolHandle<IJetModifier>& t : m_modifiers){ ATH_CHECK(t->modify(*jetContHandle)); } diff --git a/Reconstruction/Jet/JetValidation/python/PhysicsValidationHistos.py b/Reconstruction/Jet/JetValidation/python/PhysicsValidationHistos.py index 4f68dce25bb89f15fe2adf55ac7e9976cf628db4..96ebef72f7733b2f5ddaa7f2ea86ffcd8f1c3451 100644 --- a/Reconstruction/Jet/JetValidation/python/PhysicsValidationHistos.py +++ b/Reconstruction/Jet/JetValidation/python/PhysicsValidationHistos.py @@ -101,6 +101,15 @@ def commonPhysValTool(container, refcontainer="", onlyKinematics = False, global ] + if "PFlow" in container: + filler.HistoTools += [ + jhm.tool("SumPtChargedPFOPt500[0]"), + jhm.tool("NumChargedPFOPt500[0]"), + jhm.tool("NumChargedPFOPt1000[0]"), + jhm.tool("ChargedPFOWidthPt1000[0]"), + ] + + if refcontainer: # efficiency filler.HistoTools += [jhm.effresponse,] diff --git a/Reconstruction/MVAUtils/test/ut_test_MVAUtils.py b/Reconstruction/MVAUtils/test/ut_test_MVAUtils.py index 0c767baa6b16be0e4e0c73bfa95884dbc01d8e93..a9285fcded4f143e955d6ee0ac0ed7d17a147e7c 100755 --- a/Reconstruction/MVAUtils/test/ut_test_MVAUtils.py +++ b/Reconstruction/MVAUtils/test/ut_test_MVAUtils.py @@ -177,7 +177,7 @@ class TestMVAUtilsBasic(unittest.TestCase): r = list(bdt.GetMultiResponse(my_input, 2)) # numpy has a mehod to compare lists for a, b in zip(r, results): - self.assertAlmostEquals(a, b, places=5) + self.assertAlmostEqual(a, b, places=5) my_inputs = list2stdvector([0., 2., 3., 4.]) do_test(my_inputs, normalization([-1, -0.98])) diff --git a/Reconstruction/PanTau/PanTauAlgs/CMakeLists.txt b/Reconstruction/PanTau/PanTauAlgs/CMakeLists.txt index 45991fa453bcf73cf0bb3c1314f1fba3635fb66f..3350f05e13fb3a08e1e3b80a59bd1ef0d7792420 100644 --- a/Reconstruction/PanTau/PanTauAlgs/CMakeLists.txt +++ b/Reconstruction/PanTau/PanTauAlgs/CMakeLists.txt @@ -49,6 +49,4 @@ endif() # Install files from the package: atlas_install_headers( PanTauAlgs ) -atlas_install_runtime( data/weights/* ) atlas_install_python_modules( python/*.py ) - diff --git a/Reconstruction/RecExample/RecExRecoTest/test/MetaDataTest.py b/Reconstruction/RecExample/RecExRecoTest/test/MetaDataTest.py index bce92da1afa001876e85d2ebf3a0c4fcd4c5070a..f14422e25fb9b493ca960da1198d8179dfa7b834 100755 --- a/Reconstruction/RecExample/RecExRecoTest/test/MetaDataTest.py +++ b/Reconstruction/RecExample/RecExRecoTest/test/MetaDataTest.py @@ -57,6 +57,8 @@ class TestConfiguration: "outputRAWFile": "../draw.root", "outputESDFile": "../esd.root", "outputAODFile": "../aod.root", + "conditionsTag": "CONDBR2-BLKPA-2017-10", + "geometryVersion": "ATLAS-R2-2016-01-00-01", } self.preIncludeContent = textwrap.dedent("""\ from AthenaCommon.JobProperties import jobproperties @@ -105,7 +107,8 @@ class TestConfiguration: """build dictionary construct transform command from""" assert step in STEPS, "{} not one of {}".format(step, STEPS) - common_opts = ["AMI", "preInclude"] + common_opts = ["AMI", "preInclude", "execOnly", "conditionsTag", + "geometryVersion"] cmd_config = { k: self.options[k] for k in common_opts if k in self.options } @@ -387,10 +390,7 @@ def makeInputConfig(test_config): array[-1] = 'pool.root' output_file = '.'.join(array) output_file = output_file.replace('RAW', 'ESD') - input_config.options["outputESDFile"] = "{}/{}".format( - os.getcwd(), - output_file, - ) + input_config.options["outputESDFile"] = output_file result += [input_config] return result @@ -421,6 +421,7 @@ def compareMetadata(step, target, reference): MSG.error( "failed to read metadata from: %s and/or %s", target, reference ) + print("art-result: 1 {}".format(step)) def runTest(config, step, verbose): diff --git a/Reconstruction/RecExample/RecExRecoTest/test/test_compare_SerialAndThreadedAthenas.sh b/Reconstruction/RecExample/RecExRecoTest/test/test_compare_SerialAndThreadedAthenas.sh index 50c47335aa729f7de8d4e3ce8b571b111dfd508e..96785387e715c0d1b066f4f41595ee20c3d9a1d5 100755 --- a/Reconstruction/RecExample/RecExRecoTest/test/test_compare_SerialAndThreadedAthenas.sh +++ b/Reconstruction/RecExample/RecExRecoTest/test/test_compare_SerialAndThreadedAthenas.sh @@ -26,7 +26,8 @@ if [[ $rc -eq 0 ]] && [[ $rc1 -eq 0 ]] then echo "Compare two directories" art.py compare ref --entries 10 --mode=semi-detailed --order-trees --diff-root . ../serial/ | tee diffSerialOneThread.log - echo "art-result: $? Diff-Serial-OneThread" + rcDiff1=${PIPESTATUS[0]} + echo "art-result: $rcDiff1 Diff-Serial-OneThread" fi cd ../ @@ -43,7 +44,8 @@ if [[ $rc1 -eq 0 ]] && [[ $rc2 -eq 0 ]] then echo "Compare two directories" art.py compare ref --entries 10 --mode=semi-detailed --order-trees --diff-root . ../threadOne | tee diffTwoThreadsOneThread.log - echo "art-result: $? Diff-OneThread-TwoThreads" + rcDiff2=${PIPESTATUS[0]} + echo "art-result: $rcDiff2 Diff-OneThread-TwoThreads" fi cd ../ @@ -60,5 +62,6 @@ if [[ $rc2 -eq 0 ]] && [[ $rc5 -eq 0 ]] then echo "Compare two directories" art.py compare ref --entries 10 --mode=semi-detailed --order-trees --diff-root . ../threadTwo | tee diffFiveThreadsTwoThreads.log - echo "art-result: $? Diff-TwoThreads-FiveThreads" + rcDiff5=${PIPESTATUS[0]} + echo "art-result: $rcDiff5 Diff-TwoThreads-FiveThreads" fi 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 be3c32849b05368ea8ece08f7943a7f4cdace5e6..236189a8494111329179dcd46e2d80fbc623688e 100755 --- a/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh +++ b/Reconstruction/RecExample/RecExRecoTest/test/test_reco_tf_compare_SerialAndThreadedAthenas.sh @@ -26,7 +26,8 @@ if [[ $rc -eq 0 ]] && [[ $rc1 -eq 0 ]] then echo "Compare two directories" art.py compare ref --entries 10 --mode=semi-detailed --order-trees --diff-root . ../serial/ | tee diffSerialOneThread.log - echo "art-result: $? Diff-Serial-OneThread" + rcDiff1=${PIPESTATUS[0]} + echo "art-result: $rcDiff1 Diff-Serial-OneThread" fi cd ../ @@ -43,7 +44,8 @@ if [[ $rc1 -eq 0 ]] && [[ $rc2 -eq 0 ]] then echo "Compare two directories" art.py compare ref --entries 10 --mode=semi-detailed --order-trees --diff-root . ../threadOne | tee diffTwoThreadsOneThread.log - echo "art-result: $? Diff-OneThread-TwoThreads" + rcDiff2=${PIPESTATUS[0]} + echo "art-result: $rcDiff2 Diff-OneThread-TwoThreads" fi cd ../ @@ -60,5 +62,6 @@ if [[ $rc2 -eq 0 ]] && [[ $rc5 -eq 0 ]] then echo "Compare two directories" art.py compare ref --entries 10 --mode=semi-detailed --order-trees --diff-root . ../threadTwo | tee diffFiveThreadsTwoThreads.log - echo "art-result: $? Diff-TwoThreads-FiveThreads" + rcDiff5=${PIPESTATUS[0]} + echo "art-result: $rcDiff5 Diff-TwoThreads-FiveThreads" fi diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_cosmis_allstream.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_cosmis_allstream.sh deleted file mode 100755 index f7ad3938e96bbf17f9be1e4b8439274c28989863..0000000000000000000000000000000000000000 --- a/Reconstruction/RecExample/RecJobTransformTests/test/test_cosmis_allstream.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# -# art-description: Reco_tf runs on cosmics with all streams -# art-athena-mt: 4 -# art-type: grid -# art-include: 21.0/Athena -# art-include: 21.0-TrigMC/Athena -# art-include: master/Athena -# art-include: 21.3/Athena -# art-include: 21.9/Athena - - -Reco_tf.py --inputBSFile /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/data11_cos.00193024.physics_CosmicCalo.merge.RAW._lb0096._SFO-ALL._0001.1 --maxEvents 300 --autoConfiguration everything --conditionsTag="COMCOND-BLKPA-RUN1-07" --preExec="rec.doTrigger=False;" --outputESDFile myESD.pool.root --outputHISTFile myMergedMonitoring.root - -RES=$? -echo "art-result: $RES Reco" -return $RES diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_data20_CosmicCalo.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_data20_CosmicCalo.sh new file mode 100755 index 0000000000000000000000000000000000000000..0b59ef3119365c6bcaae1ae36eb88d51e7be6422 --- /dev/null +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_data20_CosmicCalo.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# art-description: Reco_tf runs on 2020 CosmicCalo stream, without trigger. +# art-athena-mt: 4 +# art-type: grid +# art-include: master/Athena +Reco_tf.py --inputBSFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/data20_idcomm/data20_idcomm.00375727.physics_CosmicCalo.merge.RAW._lb0877._SFO-ALL._0001.1 --maxEvents=300 --preExec=rec.doTrigger=False --outputESDFile=myESD.pool.root --outputAODFile=myAOD.pool.root --conditionsTag=CONDBR2-BLKPA-RUN2-01 --geometryVersion=ATLAS-R2-2016-01-00-01 + diff --git a/Reconstruction/RecExample/RecJobTransformTests/test/test_data20_IDCosmic.sh b/Reconstruction/RecExample/RecJobTransformTests/test/test_data20_IDCosmic.sh new file mode 100755 index 0000000000000000000000000000000000000000..06aa626e983134de3ae0ae94967aba374dceba5e --- /dev/null +++ b/Reconstruction/RecExample/RecJobTransformTests/test/test_data20_IDCosmic.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# +# art-description: Reco_tf runs on 2020 IDCosmic stream, without trigger. +# art-athena-mt: 4 +# art-type: grid +# art-include: master/Athena +Reco_tf.py --inputBSFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecJobTransformTests/data20_idcomm/data20_idcomm.00375727.physics_IDCosmic.merge.RAW._lb0876._SFO-ALL._0001.1 --maxEvents=10 --preExec=rec.doTrigger=False --outputESDFile=myESD.pool.root --outputAODFile=myAOD.pool.root --conditionsTag=CONDBR2-BLKPA-RUN2-01 --geometryVersion=ATLAS-R2-2016-01-00-01 + diff --git a/Reconstruction/RecJobTransforms/share/skeleton.RDOtoRDOtrigger.py b/Reconstruction/RecJobTransforms/share/skeleton.RDOtoRDOtrigger.py index 06fc581c80b21e92a373d43682b3e883dc0a885d..eeb8ee4b5e86f148424391e31054b01b7fb9f1d0 100644 --- a/Reconstruction/RecJobTransforms/share/skeleton.RDOtoRDOtrigger.py +++ b/Reconstruction/RecJobTransforms/share/skeleton.RDOtoRDOtrigger.py @@ -105,6 +105,8 @@ if TriggerFlags.doMT(): #======================================================== # Central topOptions (this is one is a string not a list) #======================================================== +if TriggerFlags.doMT(): + TriggerFlags.MuonSlice.doTrigMuonConfig=True if hasattr(runArgs,"topOptions"): include(runArgs.topOptions) else: include( "RecExCommon/RecExCommon_topOptions.py" ) diff --git a/Reconstruction/RecoTools/TrackToCalo/CMakeLists.txt b/Reconstruction/RecoTools/TrackToCalo/CMakeLists.txt index 51ad0d43c436f7ca52438f6406506df14e63b820..5f33c9915e64166753823d31c3aae0bdb8c8cfad 100644 --- a/Reconstruction/RecoTools/TrackToCalo/CMakeLists.txt +++ b/Reconstruction/RecoTools/TrackToCalo/CMakeLists.txt @@ -67,5 +67,4 @@ atlas_add_component( TrackToCalo LINK_LIBRARIES GaudiKernel TrackToCaloLib InDetTrackSelectionToolLib ITrackToVertex TrkLinks VxVertex TrackVertexAssociationToolLib) -atlas_install_joboptions( share/*.py ) atlas_install_python_modules( python/*.py ) diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/CMakeLists.txt b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..74c6928b2aa9f43cfaa6dc09848413b590ef39e8 --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/CMakeLists.txt @@ -0,0 +1,40 @@ +################################################################################ +# Package: NewVrtSecInclusiveTool +################################################################################ + +# Declare the package name: +atlas_subdir( NewVrtSecInclusiveTool ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Control/AthenaBaseComps + Event/xAOD/xAODTracking + GaudiKernel + PRIVATE + Tools/PathResolver + DetectorDescription/GeoPrimitives + Tracking/TrkExtrapolation/TrkExInterfaces + Reconstruction/MVAUtils + Tracking/TrkEvent/VxSecVertex + Tracking/TrkVertexFitter/TrkVKalVrtFitter + InnerDetector/InDetConditions/InDetBeamSpotService) + +# External dependencies: +find_package( Boost COMPONENTS filesystem thread system ) +find_package( Eigen ) +find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread TMVA ) + +# Component(s) in the package: +atlas_add_component( NewVrtSecInclusiveTool + src/*.cxx src/components/*.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps xAODTracking PathResolver GaudiKernel + Particle TrkVKalVrtFitterLib GeoPrimitives MVAUtils AnalysisUtilsLib TrkParticleBase + TrkTrackSummary TrkExInterfaces VxSecVertex ) + +# Install files from the package: +atlas_install_headers( NewVrtSecInclusiveTool ) +atlas_install_python_modules( python/*.py ) +#atlas_install_joboptions( share/*.txt ) +#atlas_install_data( share/*.root ) + diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/ATLAS_CHECK_THREAD_SAFETY b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..0c630dd36b6cb9c47f9ca3a056eb224244c94ba0 --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Reconstruction/VKalVrt/NewVrtSecInclusiveTool diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/IVrtInclusive.h b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/IVrtInclusive.h new file mode 100755 index 0000000000000000000000000000000000000000..3ab765839cbe0654b055558d41923b2854aa5297 --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/IVrtInclusive.h @@ -0,0 +1,62 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +// +// IVrtInclusive.h - Description +// +/* + Interface for inclusive secondary vertex reconstruction + It returns a pointer to Trk::VxSecVertexInfo object which contains + vector of pointers to xAOD::Vertex's of found secondary verteces. + In case of failure pointer to Trk::VxSecVertexInfo is 0. + + + Tool creates a derivative object VxSecVKalVertexInfo which contains also additional variables + see Tracking/TrkEvent/VxSecVertex/VxSecVertex/VxSecVKalVertexInfo.h + + Author: Vadim Kostyukhin + e-mail: vadim.kostyukhin@cern.ch + +-----------------------------------------------------------------------------*/ + + + +#ifndef _Rec_IVrtSecInclusive_H +#define _Rec_IVrtSecInclusive_H +// Normal STL and physical vectors +#include <vector> +// Gaudi includes +#include "AthenaBaseComps/AthAlgTool.h" +#include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/VertexContainer.h" +#include "VxSecVertex/VxSecVertexInfo.h" + + +//------------------------------------------------------------------------ +namespace Rec { + +//------------------------------------------------------------------------ + static const InterfaceID IID_IVrtInclusive("IVrtInclusive", 1, 0); + + class IVrtInclusive : virtual public IAlgTool { + public: + static const InterfaceID& interfaceID() { return IID_IVrtInclusive;} +//--------------------------------------------------------------------------- + + /** @class IVrtInclusive + + Interface class for inclusive vertex reconstruction. + All secondary vertices produced in a phase space around Primary Vertex(PV) and resulted in secondary tracks + provided by inputTracks collection are returned in Trk::VxSecVertexInfo. + Interface assumes that necessary TrackParticles can be pre-selected by user before calling the actual tool implementation + with default track quality cuts. + + */ + virtual std::unique_ptr<Trk::VxSecVertexInfo> findAllVertices( const std::vector<const xAOD::TrackParticle*> & inputTracks, + const xAOD::Vertex & PV) const =0; + + }; + +} //end namespace + +#endif diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h new file mode 100755 index 0000000000000000000000000000000000000000..2749aa5c1aea70ac5329211bbd2e6b5917bb9c22 --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h @@ -0,0 +1,396 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// +// NewVrtSecInclusiveTool.h - Description +// +/* + Tool for inclusive secondary vertex reconstruction + It returns a pointer to Trk::VxSecVertexInfo object which contains + vector of pointers to xAOD::Vertex's of found secondary verteces. + In case of failure pointer to Trk::VxSecVertexInfo is 0. + + + Tool creates a derivative object VxSecVKalVertexInfo which contains also additional variables + see Tracking/TrkEvent/VxSecVertex/VxSecVertex/VxSecVKalVertexInfo.h + + + Author: Vadim Kostyukhin + e-mail: vadim.kostyukhin@cern.ch + +-----------------------------------------------------------------------------*/ + + + +#ifndef _VKalVrt_NewVrtSecInclusiveTool_H +#define _VKalVrt_NewVrtSecInclusiveTool_H +// Normal STL and physical vectors +#include <vector> +// Gaudi includes +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" +#include "boost/graph/adjacency_list.hpp" +// +#include "xAODTruth/TruthEventContainer.h" +#include "TrkExInterfaces/IExtrapolator.h" +// +#include "VxSecVertex/VxSecVertexInfo.h" +#include "NewVrtSecInclusiveTool/IVrtInclusive.h" + +class TH1D; +class TH2D; +class TH1F; +class TProfile; +class TTree; +class IBeamCondSvc; + +namespace Trk{ + class TrkVKalVrtFitter; + class IVertexFitter; + class IVKalState; +} + +namespace MVAUtils { class BDT; } + +typedef std::vector<double> dvect; + + +//------------------------------------------------------------------------ +namespace Rec { + + struct workVectorArrxAOD{ + std::vector<const xAOD::TrackParticle*> listSelTracks; // Selected tracks after quality cuts + std::vector<const xAOD::TrackParticle*> tmpListTracks; + std::vector<const xAOD::TrackParticle*> inpTrk; // All tracks provided to tool + double beamX=0.; + double beamY=0.; + double beamZ=0.; + double tanBeamTiltX=0.; + double tanBeamTiltY=0.; + }; + + class NewVrtSecInclusiveTool : public AthAlgTool, virtual public IVrtInclusive + { + + + public: + /* Constructor */ + NewVrtSecInclusiveTool(const std::string& type, const std::string& name, const IInterface* parent); + /* Destructor */ + virtual ~NewVrtSecInclusiveTool(); + + + StatusCode initialize(); + StatusCode finalize(); + + + + std::unique_ptr<Trk::VxSecVertexInfo> findAllVertices(const std::vector<const xAOD::TrackParticle*> & inputTracks, + const xAOD::Vertex & primaryVertex) const final; +//------------------------------------------------------------------------------------------------------------------ +// Private data and functions +// + + private: + + double m_w_1{}; + TTree* m_tuple{}; + TH1D* m_hb_massPiPi{}; + TH1D* m_hb_massPiPi1{}; + TH1D* m_hb_massPPi{}; + TH1D* m_hb_massEE{}; + TH1D* m_hb_nvrt2{}; + TH1D* m_hb_ratio{}; + TH1D* m_hb_totmass{}; + TH1D* m_hb_impact{}; + TH1D* m_hb_impactR{}; + TH2D* m_hb_impactRZ{}; + TH1D* m_hb_pileupRat{}; + TH1D* m_hb_trkD0{}; + TH1D* m_hb_trkZ{}; + TH1F* m_hb_ntrksel{}; + TH1F* m_hb_ntrkInput{}; + TH1F* m_hb_trkSelect{}; + TH1D* m_hb_impactZ{}; + TH1D* m_hb_r2d{}; + TH1D* m_hb_signif3D{}; + TH1D* m_hb_impV0{}; + TH1D* m_hb_sig3DTot{}; + TH1F* m_hb_goodvrtN{}; + TH1F* m_hb_goodvrt1N{}; + TH1D* m_hb_distVV{}; + TH1D* m_hb_diffPS{}; + TH1D* m_hb_sig3D1tr{}; + TH1D* m_hb_sig3D2tr{}; + TH1D* m_hb_sig3DNtr{}; + TH1F* m_hb_rawVrtN{}; + TH1F* m_hb_cosSVMom{}; + TH1F* m_hb_etaSV{}; + TH1F* m_hb_fakeSVBDT{}; +//-- + + long int m_cutSctHits{}; + long int m_cutPixelHits{}; + long int m_cutSiHits{}; + long int m_cutBLayHits{}; + long int m_cutSharedHits{}; + double m_cutPt{}; + double m_cutZVrt{}; + double m_cutA0{}; + double m_cutChi2{}; + double m_sel2VrtProbCut{}; + double m_globVrtProbCut{}; + double m_maxSVRadiusCut{}; + double m_selVrtSigCut{}; + double m_trkSigCut{}; + float m_a0TrkErrorCut{}; + float m_zTrkErrorCut{}; + float m_VrtMassLimit{}; + float m_Vrt2TrMassLimit{}; + float m_Vrt2TrPtLimit{}; + float m_antiPileupSigRCut{}; + float m_dRdZRatioCut{}; + float m_v2tIniBDTCut{}; + float m_v2tFinBDTCut{}; + float m_vertexMergeCut{}; + float m_trackDetachCut{}; + float m_beampipeR{}; + float m_removeTrkMatSignif{}; + + bool m_fillHist{}; + bool m_useVertexCleaning{}; + bool m_multiWithOneTrkVrt{}; + std::string m_calibFileName; + + std::unique_ptr<MVAUtils::BDT> m_SV2T_BDT; + + ServiceHandle< IBeamCondSvc > m_beamService; + //ToolHandle<Trk::IVertexFitter> m_fitterSvc; + ToolHandle<Trk::IExtrapolator> m_extrapolator{this,"ExtrapolatorName","Trk::Extrapolator/Extrapolator"}; + ToolHandle<Trk::TrkVKalVrtFitter> m_fitSvc; + //Trk::TrkVKalVrtFitter* m_fitSvc{}; + + double m_massPi {}; + double m_massP {}; + double m_massE{}; + double m_massK0{}; + double m_massLam{}; + std::string m_instanceName; + +//======================================================================================= +// Functions and structure below are for algorithm development, debugging and calibration +// NOT USED IN PRODUCTION! + + int notFromBC(int PDGID) const; + const xAOD::TruthParticle * getPreviousParent(const xAOD::TruthParticle * child, int & ParentPDG) const; + int getIdHF(const xAOD::TrackParticle* TP ) const; + int getG4Inter( const xAOD::TrackParticle* TP ) const; + int getMCPileup(const xAOD::TrackParticle* TP ) const; + + struct DevTuple + { + static const int maxNTrk=100; + static const int maxNVrt=100; + int nTrk; + float pttrk[maxNTrk]; + float Sig3D[maxNTrk]; + int n2Vrt; + int VrtTrkHF[maxNVrt]; + int VrtTrkI[maxNVrt]; + int VrtCh[maxNVrt]; + int VrtIBL[maxNVrt]; + int VrtBL[maxNVrt]; + int VrtDisk[maxNVrt]; + float VrtDist2D[maxNVrt]; + float VrtSig3D[maxNVrt]; + float VrtSig2D[maxNVrt]; + float VrtM[maxNVrt]; + float VrtZ[maxNVrt]; + float VrtPt[maxNVrt]; + float VrtEta[maxNVrt]; + float VrtBDT[maxNVrt]; + float VrtProb[maxNVrt]; + float VrtHR1[maxNVrt]; + float VrtHR2[maxNVrt]; + float VrtSinSPM[maxNVrt]; + float VMinPtT[maxNVrt]; + float VMinS3DT[maxNVrt]; + float VMaxS3DT[maxNVrt]; + float VSigMat[maxNVrt]; + //--- + int nNVrt; + int NVrtTrk[maxNVrt]; + int NVrtTrkHF[maxNVrt]; + int NVrtTrkI[maxNVrt]; + int NVrtCh[maxNVrt]; + int NVrtIBL[maxNVrt]; + int NVrtBL[maxNVrt]; + float NVrtM[maxNVrt]; + float NVrtPt[maxNVrt]; + float NVrtEta[maxNVrt]; + float NVrtSinSPM[maxNVrt]; + float NVMinPtT[maxNVrt]; + float NVMinS3DT[maxNVrt]; + float NVMaxS3DT[maxNVrt]; + float NVrtDist2D[maxNVrt]; + float NVrtSig3D[maxNVrt]; + float NVrtSig2D[maxNVrt]; + float NVrtProb[maxNVrt]; + float NVrtBDT[maxNVrt]; + }; + DevTuple* m_curTup; +// +// End of development stuff +//============================================================ + + + struct Vrt2Tr + { + int badVrt=0; + Amg::Vector3D fitVertex; + TLorentzVector momentum; + long int vertexCharge; + std::vector<double> errorMatrix; + std::vector<double> chi2PerTrk; + std::vector< std::vector<double> > trkAtVrt; + double chi2=0.; + double dRSVPV=-1.; + }; + + +// For multivertex version only + + boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS> *m_compatibilityGraph{}; + float m_chiScale[11]{}; + struct WrkVrt + { bool Good=true; + std::deque<long int> selTrk; + Amg::Vector3D vertex; + TLorentzVector vertexMom; + long int vertexCharge{}; + std::vector<double> vertexCov; + std::vector<double> chi2PerTrk; + std::vector< std::vector<double> > trkAtVrt; + double chi2{}; + int nCloseVrt=0; + double dCloseVrt=1000000.; + double projectedVrt=0.; + int detachedTrack=-1; + }; + + +// Private technical functions +// +// + std::vector<xAOD::Vertex*> getVrtSecMulti( workVectorArrxAOD * inpParticlesxAOD, const xAOD::Vertex & primVrt) const; + + void trackClassification(std::vector<WrkVrt> *WrkVrtSet, + std::vector< std::deque<long int> > *TrkInVrt) const; + + double maxOfShared(std::vector<WrkVrt> *WrkVrtSet, + std::vector< std::deque<long int> > *TrkInVrt, + long int & selectedTrack, + long int & selectedVertex) const; + void removeTrackFromVertex(std::vector<WrkVrt> *WrkVrtSet, + std::vector< std::deque<long int> > *TrkInVrt, + long int selectedTrack, + long int selectedVertex) const; +// +// + + void printWrkSet(const std::vector<WrkVrt> * WrkSet, const std::string &name ) const; + +// +// Gives correct mass assignment in case of nonequal masses + double massV0(const std::vector< std::vector<double> >& TrkAtVrt, double massP, double massPi ) const; + + + TLorentzVector MomAtVrt(const std::vector<double>& inpTrk) const; + double VrtRadiusError(const Amg::Vector3D & secVrt, const std::vector<double> & vrtErr) const; + + int nTrkCommon( std::vector<WrkVrt> *WrkVrtSet, int indexV1, int indexV2) const; + double minVrtVrtDist( std::vector<WrkVrt> *WrkVrtSet, int & indexV1, int & indexV2) const; + double minVrtVrtDistNext( std::vector<WrkVrt> *WrkVrtSet, int & indexV1, int & indexV2) const; + bool isPart( std::deque<long int> test, std::deque<long int> base) const; + void Clean1TrVertexSet(std::vector<WrkVrt> *WrkVrtSet) const; + + double VrtVrtDist(const xAOD::Vertex & PrimVrt, const Amg::Vector3D & SecVrt, + const std::vector<double> VrtErr,double& Signif ) const; + double VrtVrtDist2D(const xAOD::Vertex & PrimVrt, const Amg::Vector3D & SecVrt, + const std::vector<double> VrtErr,double& Signif ) const; + double VrtVrtDist(const Amg::Vector3D & Vrt1, const std::vector<double>& VrtErr1, + const Amg::Vector3D & Vrt2, const std::vector<double>& VrtErr2) const; + double VrtVrtDist(const xAOD::Vertex & PrimVrt, const Amg::Vector3D & SecVrt, + const std::vector<double> SecVrtErr, const TLorentzVector & Dir) const; + double PntPntDist(const Amg::Vector3D & Vrt1, const Amg::Vector3D & Vrt2) const; + + void DisassembleVertex(std::vector<WrkVrt> *WrkVrtSet, int iv, + std::vector<const xAOD::TrackParticle*> AllTracks, + Trk::IVKalState& istate) const; + + double ProjSV_PV(const Amg::Vector3D & SV, const xAOD::Vertex & PV, const TLorentzVector & Direction) const; + double MomProjDist(const Amg::Vector3D & SV, const xAOD::Vertex & PV, const TLorentzVector & Direction) const; + + + double distToMatLayerSignificance(Vrt2Tr & Vrt) const; + + StatusCode refitVertex( std::vector<WrkVrt> *WrkVrtSet, int SelectedVertex, + std::vector<const xAOD::TrackParticle*> & SelectedTracks, + Trk::IVKalState& istate, + bool ifCovV0) const; + + double refitVertex( WrkVrt &Vrt,std::vector<const xAOD::TrackParticle*> & SelectedTracks, + Trk::IVKalState& istate, + bool ifCovV0) const; + + int mostHeavyTrk(WrkVrt V, std::vector<const xAOD::TrackParticle*> AllTracks) const; + + double mergeAndRefitVertices( std::vector<WrkVrt> *WrkVrtSet, int V1, int V2, WrkVrt & newvrt, + std::vector<const xAOD::TrackParticle*> & AllTrackList, + Trk::IVKalState& istate) const; + void mergeAndRefitOverlapVertices( std::vector<WrkVrt> *WrkVrtSet, int V1, int V2, + std::vector<const xAOD::TrackParticle*> & AllTrackLis, + Trk::IVKalState& istate) const; + + double improveVertexChi2( std::vector<WrkVrt> *WrkVrtSet, int V, std::vector<const xAOD::TrackParticle*> & AllTracks, + Trk::IVKalState& istate, + bool ifCovV0) const; + + void selGoodTrkParticle( workVectorArrxAOD * xAODwrk, + const xAOD::Vertex & PrimVrt) const; + + + + void select2TrVrt(std::vector<const xAOD::TrackParticle*> & SelectedTracks, + const xAOD::Vertex & PrimVrt) const; + + + void getPixelDiscs (const xAOD::TrackParticle* Part, int &d0Hit, int &d1Hit, int &d2Hit) const; + int getIBLHit(const xAOD::TrackParticle* Part) const; + int getBLHit(const xAOD::TrackParticle* Part) const; + + }; + + + struct clique_visitor + { + clique_visitor(std::vector< std::vector<int> > & input): m_allCliques(input){ input.clear();} + + template <typename Clique, typename Graph> + void clique(const Clique& clq, Graph& ) + { + std::vector<int> new_clique(0); + for(auto i = clq.begin(); i != clq.end(); ++i) new_clique.push_back(*i); + m_allCliques.push_back(new_clique); + } + + std::vector< std::vector<int> > & m_allCliques; + + }; + + +} //end namespace + +#endif diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/README b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/README new file mode 100644 index 0000000000000000000000000000000000000000..fd65f5134f3eafe16e49c039be2f51d59b6c11f0 --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/README @@ -0,0 +1,28 @@ +A tool for inclusive secondary vertex reconstruction in ATLAS ID. + +This is an improved version of the VrtSecInclusive algorithm. + +Changes with respect to original version: + +1) Outdated Graph(CERNLIB) package is replaced by Bron&Kerbosch algorithm from BOOST +2) Fake(fragmentation+pileup) and hadronic interaction vertices are removed using a dedicated MVA +3) Additional material interaction rejection is based on the TrackingGeometry material layers +4) Many improvements in vertex topology resolution +5) One-track vertices are allowed (e.g. 3 track system, where one track crosses 2 others in different places, + so that 3-track vertex has inacceptable Chi2, will be resolved as 2-track + 1-track vertices). + This allows to get 2 vertices in case of e.g. cascade B->D decay with 3 reconstracted tracks in total. +6) Algorithm is converted to Tool for convenience of usage in other Algorithms. +7) Several tool configurations suitable for different problems are provided, e.g.: + SoftBFinderTool - targeting Soft b-tagging for SUSY + InclusiveBFinderTool - inclusive B-hadron decay reconstruction (a la CMS/D0) for b-tagging + DVFinderTool - search for displaced vertices produced by exotic particles + + +Configured finders: +1) SoftBFinderTool - looks for all low-pt (>1GeV) B-hadron vertices in event. No jet presence is assumed +2) InclusiveBFinderTool - looks for all B-hadron vertices in event with low fake rate. + Suitable for ttbar and other processes with similar pt-range. +3) HighPtBFinderTool - looks for all high-pt B-hadron vertices in event. No jet presence is assumed. +4) MaterialSVFinderTool - looks for hadronic interaction vertices in detector material. +5) DVFinderTool - looks for heavy displaced vertices in ID volume. + diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/python/NewVrtSecInclusive.py b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/python/NewVrtSecInclusive.py new file mode 100644 index 0000000000000000000000000000000000000000..7d3c3cebf3f28fb7f46810638800bbaac1ed6fe0 --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/python/NewVrtSecInclusive.py @@ -0,0 +1,189 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# Author: Vadim Kostyukhin vadim.kostyukhin@cern.ch +from GaudiKernel.GaudiHandles import * +from GaudiKernel.Proxy.Configurable import * +from AthenaCommon.Include import Include, IncludeError, include +from AthenaCommon.Logging import logging +from AthenaCommon.AppMgr import ToolSvc +from AthenaCommon import CfgMgr + +from NewVrtSecInclusiveTool.NewVrtSecInclusiveToolConf import Rec__NewVrtSecInclusiveTool + +# define the class +# Search for soft B-hadron vertices. +#------------------------------------ +class SoftBFinderTool( Rec__NewVrtSecInclusiveTool ): + + def __init__(self, name = 'SoftBFinderTool' ): + + from __main__ import ToolSvc + mlog = logging.getLogger( 'SoftBFinderTool::__init__ ' ) + mlog.info("entering") + #---------------------- + # VKalVrt vertex fitter + # + from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter + SVertexFitterTool = Trk__TrkVKalVrtFitter(name="SoftBVertexFitterTool", + Extrapolator="Trk::Extrapolator/AtlasExtrapolator") + ToolSvc += SVertexFitterTool + #---------------------- + # Soft B-hadron vertex finder itself + # + Rec__NewVrtSecInclusiveTool.__init__( self, name = name, + VertexFitterTool = SVertexFitterTool, + CutBLayHits = 1, + CutPixelHits = 3, + CutSiHits = 8, + useVertexCleaning = True, + MultiWithOneTrkVrt = True, + removeTrkMatSignif = -1., # No additional material rejection + AntiPileupSigRCut = 2.0, + TrkSigCut = 2.0, + SelVrtSigCut = 3.0, + v2tIniBDTCut =-0.6, + v2tFinBDTCut = 0.2, + CutPt = 500, + MaxSVRadiusCut = 50 # Inside Pixel BL volume + ) + mlog = logging.getLogger( 'SoftBFinderTool::__configured__ ' ) + +########################################################################################################## +# define the class +class InclusiveBFinderTool( Rec__NewVrtSecInclusiveTool ): + + def __init__(self, name = 'InclusiveBFinderTool' ): + + from __main__ import ToolSvc + mlog = logging.getLogger( 'InclusiveBFinderTool::__init__ ' ) + mlog.info("entering") + #---------------------- + # VKalVrt vertex fitter + # + from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter + SVertexFitterTool = Trk__TrkVKalVrtFitter(name="InclsusiveBVertexFitterTool", + Extrapolator="Trk::Extrapolator/AtlasExtrapolator") + ToolSvc += SVertexFitterTool + #---------------------- + # Soft B-hadron vertex finder itself + # + Rec__NewVrtSecInclusiveTool.__init__( self, name = name, + VertexFitterTool = SVertexFitterTool, + CutBLayHits = 0, + CutPixelHits = 2, + CutSiHits = 8, + useVertexCleaning = True, + MultiWithOneTrkVrt = True, + removeTrkMatSignif = -1., # No additional material rejection + AntiPileupSigRCut = 2.0, + TrkSigCut = 2.0, + SelVrtSigCut = 3.0, + v2tIniBDTCut =-0.5, + v2tFinBDTCut = 0.0, + CutPt = 500 + ) +########################################################################################################## +# define the class +class HighPtBFinderTool( Rec__NewVrtSecInclusiveTool ): + + def __init__(self, name = 'HighPtBFinderTool' ): + + from __main__ import ToolSvc + mlog = logging.getLogger( 'HighPtBFinderTool::__init__ ' ) + mlog.info("entering") + #---------------------- + # VKalVrt vertex fitter + # + from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter + SVertexFitterTool = Trk__TrkVKalVrtFitter(name="HighPtBVertexFitterTool", + Extrapolator="Trk::Extrapolator/AtlasExtrapolator") + ToolSvc += SVertexFitterTool + #---------------------- + # Soft B-hadron vertex finder itself + # + Rec__NewVrtSecInclusiveTool.__init__( self, name = name, + VertexFitterTool = SVertexFitterTool, + CutBLayHits = 0, + CutPixelHits = 2, + CutSiHits = 8, + useVertexCleaning = True, + MultiWithOneTrkVrt = True, + removeTrkMatSignif = -1., # No additional material rejection + AntiPileupSigRCut = 2.0, + TrkSigCut = 2.0, + SelVrtSigCut = 3.0, + v2tIniBDTCut =-0.6, + v2tFinBDTCut = 0.2, + CutPt = 1000 + ) +########################################################################################################## +# define the class +class MaterialSVFinderTool( Rec__NewVrtSecInclusiveTool ): + + def __init__(self, name = 'MaterialSVFinderTool' ): + + from __main__ import ToolSvc + mlog = logging.getLogger( 'MaterialSVFinderTool::__init__ ' ) + mlog.info("entering") + #---------------------- + # VKalVrt vertex fitter + # + from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter + SVertexFitterTool = Trk__TrkVKalVrtFitter(name="MaterialSVVertexFitterTool", + Extrapolator="Trk::Extrapolator/AtlasExtrapolator") + ToolSvc += SVertexFitterTool + #---------------------- + # Soft B-hadron vertex finder itself + # + Rec__NewVrtSecInclusiveTool.__init__( self, name = name, + VertexFitterTool = SVertexFitterTool, + CutBLayHits = 0, + CutPixelHits = 1, + CutSiHits = 8, + useVertexCleaning = False, + MultiWithOneTrkVrt = False, + removeTrkMatSignif = -1., # No additional material rejection + AntiPileupSigRCut = 5.0, + TrkSigCut = 5.0, + SelVrtSigCut = 10.0, + v2tIniBDTCut =-10., #Effectively remove MVA selection + v2tFinBDTCut =-10., #Effectively remove MVA selection + VrtMassLimit = 8000., + Vrt2TrMassLimit = 8000., + CutPt = 500. + ) +########################################################################################################## +# define the class +class DVFinderTool( Rec__NewVrtSecInclusiveTool ): + + def __init__(self, name = 'DVFinderTool' ): + + from __main__ import ToolSvc + mlog = logging.getLogger( 'DVFinderTool::__init__ ' ) + mlog.info("entering") + #---------------------- + # VKalVrt vertex fitter + # + from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter + DVertexFitterTool = Trk__TrkVKalVrtFitter(name="DVertexFitterTool", + Extrapolator="Trk::Extrapolator/AtlasExtrapolator") + ToolSvc += DVertexFitterTool + #---------------------- + # Soft B-hadron vertex finder itself + # + Rec__NewVrtSecInclusiveTool.__init__( self, name = name, + VertexFitterTool = SVertexFitterTool, + CutBLayHits = 0, + CutPixelHits = 0, + CutSiHits = 0, + useVertexCleaning = False, + MultiWithOneTrkVrt = False, + removeTrkMatSignif = 2., + AntiPileupSigRCut = 6.0, + TrkSigCut = 6.0, + SelVrtSigCut = 8.0, + v2tIniBDTCut =-0.5, + v2tFinBDTCut = 0.0, + VrtMassLimit = 50000., + Vrt2TrMassLimit = 50000., + CutPt = 1000. + ) diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/CutTrk.cxx b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/CutTrk.cxx new file mode 100755 index 0000000000000000000000000000000000000000..122b6f0574f8e4cfeaa8a00b0afa3438b6661852 --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/CutTrk.cxx @@ -0,0 +1,97 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +/// +/// @author V.Kostykhin <Vadim.Kostyukhin@cern.ch> +/// + +// Header include +#include "NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h" +#include "AnalysisUtils/AnalysisMisc.h" +#include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" + +#include "TH1.h" + +//------------------------------------------------- +namespace Rec{ + + +//============================================================================================================== +// xAOD based stuff +// + void NewVrtSecInclusiveTool::selGoodTrkParticle( workVectorArrxAOD * xAODwrk, + const xAOD::Vertex & PrimVrt) + const + { + std::vector<const xAOD::TrackParticle*>& inpTrk = xAODwrk->inpTrk; + std::vector<const xAOD::TrackParticle*>& selectedTracks = xAODwrk->listSelTracks; + std::vector<const xAOD::TrackParticle*>::const_iterator i_ntrk; + std::vector<double> impact,impactError; + std::multimap<double,const xAOD::TrackParticle*> orderedTrk; + if(m_fillHist){ m_hb_ntrkInput->Fill( inpTrk.size()+0.1, m_w_1);} + for (i_ntrk = inpTrk.begin(); i_ntrk < inpTrk.end(); ++i_ntrk) { +// +//-- Perigee in TrackParticle +// + if(m_fillHist){ m_hb_trkSelect->Fill( 0., m_w_1);} + if((*i_ntrk)->numberDoF() == 0) continue; //Protection + double trkChi2 = (*i_ntrk)->chiSquared() / (*i_ntrk)->numberDoF(); + if(trkChi2 > m_cutChi2) continue; + if( (*i_ntrk)->pt() < m_cutPt) continue; + if(m_fillHist){ m_hb_trkSelect->Fill( 1., m_w_1);} + + const Trk::Perigee mPer=(*i_ntrk)->perigeeParameters() ; + double CovTrkMtx00 = (*(mPer.covariance()))(0,0); + + uint8_t PixelHits,SctHits,BLayHits; + if( !((*i_ntrk)->summaryValue(PixelHits,xAOD::numberOfPixelHits)) ) continue; // Track is + if( !((*i_ntrk)->summaryValue( SctHits,xAOD::numberOfSCTHits)) ) continue; // definitely + if( SctHits<3 ) continue; // bad + if( !((*i_ntrk)->summaryValue(BLayHits,xAOD::numberOfInnermostPixelLayerHits))) BLayHits=0; + if(m_fillHist){ m_hb_trkSelect->Fill( 2., m_w_1);} + + uint8_t splSCTHits,outSCTHits,splPixHits,outPixHits; + if( !((*i_ntrk)->summaryValue(splSCTHits,xAOD::numberOfSCTSpoiltHits))) splSCTHits=0; + if( !((*i_ntrk)->summaryValue(outSCTHits,xAOD::numberOfSCTOutliers))) outSCTHits=0; + if( !((*i_ntrk)->summaryValue(splPixHits,xAOD::numberOfPixelSpoiltHits)))splPixHits=0; + if( !((*i_ntrk)->summaryValue(outPixHits,xAOD::numberOfPixelOutliers))) outPixHits=0; + + Amg::Vector3D perigeePos=mPer.position(); + double impactA0=sqrt( (perigeePos.x()-PrimVrt.x())*(perigeePos.x()-PrimVrt.x()) + +(perigeePos.y()-PrimVrt.y())*(perigeePos.y()-PrimVrt.y()) ); + double impactZ=perigeePos.z()-PrimVrt.z(); + if(m_fillHist){ + m_hb_trkD0->Fill( impactA0, m_w_1); + m_hb_trkZ ->Fill( impactZ, m_w_1); + } + if(fabs(impactZ)>m_cutZVrt) continue; + if(impactA0>m_cutA0) continue; + if(m_fillHist){ m_hb_trkSelect->Fill( 3., m_w_1);} + + double bX=xAODwrk->beamX + (perigeePos.z()-xAODwrk->beamZ)*xAODwrk->tanBeamTiltX; + double bY=xAODwrk->beamY + (perigeePos.z()-xAODwrk->beamZ)*xAODwrk->tanBeamTiltY; + double impactBeam=sqrt( (perigeePos.x()-bX)*(perigeePos.x()-bX) + (perigeePos.y()-bY)*(perigeePos.y()-bY)); +//----Anti-pileup + double signifBeam = impactBeam / sqrt(CovTrkMtx00); + if(signifBeam < m_antiPileupSigRCut) continue; // cut against tracks from pileup vertices + if(m_fillHist){ m_hb_trkSelect->Fill( 4., m_w_1);} +//---- + if(PixelHits < m_cutPixelHits) continue; + if(SctHits < m_cutSctHits) continue; + if((PixelHits+SctHits) < m_cutSiHits) continue; + if(BLayHits < m_cutBLayHits) continue; + if(m_fillHist){ m_hb_trkSelect->Fill( 5., m_w_1);} +//---- + orderedTrk.emplace(signifBeam,*i_ntrk); + selectedTracks.push_back(*i_ntrk); + } +//---- Order tracks according to pt +// AnalysisUtils::Sort::pT (selectedTracks) +//---- Order tracks according to ranks + std::map<double,const xAOD::TrackParticle*>::reverse_iterator rt=orderedTrk.rbegin(); + selectedTracks.resize(orderedTrk.size()); + for ( int cntt=0; rt!=orderedTrk.rend(); ++rt,++cntt) {selectedTracks[cntt]=(*rt).second;} + return; + } + +}//end namespace diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/MultiUtilities.cxx b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/MultiUtilities.cxx new file mode 100755 index 0000000000000000000000000000000000000000..7d7378aa8d226712c63b87a7d4da00dafdf0fdb5 --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/MultiUtilities.cxx @@ -0,0 +1,620 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +/// +/// @author Vadim Kostyukhin <vadim.kostyukhin@cern.ch> +/// +// Header include +#include "NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h" +//------------------------------------------------- +// Other stuff +#include "AnalysisUtils/AnalysisMisc.h" +#include "GeoPrimitives/GeoPrimitivesHelpers.h" +#include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" +#include "TMath.h" +#include <algorithm> +// + + +namespace Rec{ + + + /* Service routines*/ + +//----------------------------------------------------------------------------------- +// Find track contributing most to the vertex invariant mass + int NewVrtSecInclusiveTool::mostHeavyTrk(WrkVrt V, std::vector<const xAOD::TrackParticle*> AllTracks) + const + { + int NTrk=V.selTrk.size(), SelT=-1; + if(NTrk<3)return -1; +//-------------------------------------------------- + TLorentzVector TSum; + for(int i=0; i<NTrk; i++){ + TSum += AllTracks.at(V.selTrk[i])->p4(); + } + double massMin=1.e9; + for(int i=0; i<NTrk; i++){ + TLorentzVector TSum_m1 = TSum - AllTracks[V.selTrk[i]]->p4(); + if(TSum_m1.M()<massMin){massMin=TSum_m1.M(); SelT=i;} + } + return SelT; + } +//----------------------------------------------------------------------------------- +// Detach the worst Chi2 track from the vertex and join it (if possible) with other track +// from the vertex into additional 2-track vertices +// + void NewVrtSecInclusiveTool::DisassembleVertex(std::vector<WrkVrt> *WrkVrtSet, int iv, + std::vector<const xAOD::TrackParticle*> AllTracks, + Trk::IVKalState& istate) + const + { + WrkVrt newvrt; newvrt.Good=true; + int NTrk=(*WrkVrtSet)[iv].selTrk.size(), SelT=-1; + if(NTrk<3)return; + + std::vector<const xAOD::NeutralParticle*> neutralPartDummy(0); + std::vector<const xAOD::TrackParticle*> ListBaseTracks; + StatusCode sc; sc.setChecked(); +//=== To get robust definition of most bad outlier + m_fitSvc->setRobustness(5, istate); + sc = refitVertex( WrkVrtSet, iv, AllTracks, istate, false); + if(sc.isFailure()){ (*WrkVrtSet)[iv].Good=false; return; } + m_fitSvc->setRobustness(0, istate); +//-------------------------------------------------- + double Chi2Max=0.; + for(int i=0; i<NTrk; i++){ + if( (*WrkVrtSet)[iv].chi2PerTrk[i]>Chi2Max) { Chi2Max=(*WrkVrtSet)[iv].chi2PerTrk[i]; SelT=i;} + } + int NVrtCur=WrkVrtSet->size(); + for(int i=0; i<NTrk; i++){ + if(i==SelT)continue; + ListBaseTracks.clear(); + ListBaseTracks.push_back( AllTracks[(*WrkVrtSet)[iv].selTrk[i]] ); + ListBaseTracks.push_back( AllTracks[(*WrkVrtSet)[iv].selTrk[SelT]] ); + newvrt.selTrk.resize(2); + newvrt.selTrk[0]=(*WrkVrtSet)[iv].selTrk[i]; + newvrt.selTrk[1]=(*WrkVrtSet)[iv].selTrk[SelT]; + sc = m_fitSvc->VKalVrtFitFast(ListBaseTracks,newvrt.vertex,istate); /* Fast crude estimation*/ + if( sc.isFailure() ) continue; + if( newvrt.vertex.perp() > m_maxSVRadiusCut ) newvrt.vertex=Amg::Vector3D(0.,0.,0.); + m_fitSvc->setApproximateVertex(newvrt.vertex[0],newvrt.vertex[1],newvrt.vertex[2],istate); + sc=m_fitSvc->VKalVrtFit(ListBaseTracks, neutralPartDummy, + newvrt.vertex, + newvrt.vertexMom, + newvrt.vertexCharge, + newvrt.vertexCov, + newvrt.chi2PerTrk, + newvrt.trkAtVrt, + newvrt.chi2, + istate, false); + if( sc.isFailure() ) continue; + if( newvrt.chi2>10.) continue; // Too bad 2-track vertex fit + newvrt.chi2PerTrk[0]=newvrt.chi2PerTrk[1]=newvrt.chi2/2.; + newvrt.nCloseVrt = 0; + newvrt.dCloseVrt = 1000000.; + newvrt.projectedVrt = 0.9999; + if((int)WrkVrtSet->size()==NVrtCur) { WrkVrtSet->push_back(newvrt); continue;} // just the first added vertex + if( (*WrkVrtSet).at(NVrtCur).chi2<newvrt.chi2 ) continue; // previously added 2tr vertex was better + WrkVrtSet->pop_back(); + WrkVrtSet->push_back(newvrt); + } + (*WrkVrtSet)[iv].selTrk.erase( (*WrkVrtSet)[iv].selTrk.begin() + SelT ); //remove track + sc = refitVertex( WrkVrtSet, iv, AllTracks, istate, false); + if( sc.isFailure() ) {(*WrkVrtSet)[iv].Good=false; /*std::cout<<" Wrong vertex"<<'\n';*/} + } + + + void NewVrtSecInclusiveTool::Clean1TrVertexSet(std::vector<WrkVrt> *WrkVrtSet) + const + { + std::vector<int> countVT(WrkVrtSet->size(),0); + std::vector<int> linkedVrt(WrkVrtSet->size(),0); +//--- Mark as bad the 1track vertex if the detached track is NOT present in any remaining good vertex (>=2tr) + for(int i1tv=0; i1tv<(int)WrkVrtSet->size(); i1tv++) { + if( (*WrkVrtSet)[i1tv].selTrk.size()!=1) continue; + if(!(*WrkVrtSet)[i1tv].Good) continue; + int Trk1=(*WrkVrtSet)[i1tv].detachedTrack; + int foundInGoodVrt=0; + for(int mtv=0; mtv<(int)WrkVrtSet->size(); mtv++) { //cycle over good vertices with many tracks + if( (*WrkVrtSet)[mtv].selTrk.size()<2) continue; + if(!(*WrkVrtSet)[mtv].Good) continue; + if( std::find((*WrkVrtSet)[mtv].selTrk.begin(),(*WrkVrtSet)[mtv].selTrk.end(), Trk1) != (*WrkVrtSet)[mtv].selTrk.end()){ + //double m2Vrt=((*WrkVrtSet)[mtv].vertexMom+(*WrkVrtSet)[i1tv].vertexMom).M(); //VK Commented. M cut in other places + //if(m2Vrt>m_VrtMassLimit){ (*WrkVrtSet)[i1tv].Good=false; break; } //1Tr + manyTr system is too heavy + foundInGoodVrt++; countVT[mtv]++; linkedVrt[i1tv]=mtv; //Linked vertex found + } + } + if(!foundInGoodVrt)(*WrkVrtSet)[i1tv].Good=false; // Make the vertex bad + } +// +//---Select SINGLE 1tr-vertex from many pointing to one multi-track vertex + for(int mtv=0; mtv<(int)WrkVrtSet->size(); mtv++) { + if( (*WrkVrtSet)[mtv].selTrk.size()<2 ) continue; + if(!(*WrkVrtSet)[mtv].Good ) continue; + if( countVT[mtv] < 1 ) continue; + double distM=1.e9; + int best1TVrt=-1; + for(int i1tv=0; i1tv<(int)WrkVrtSet->size(); i1tv++) { + if( (*WrkVrtSet)[i1tv].selTrk.size()!=1 ) continue; + if(!(*WrkVrtSet)[i1tv].Good ) continue; + if( linkedVrt[i1tv] != mtv ) continue; + //double dist=((*WrkVrtSet)[mtv].vertex - (*WrkVrtSet)[i1tv].vertex).mag(); + double dist=((*WrkVrtSet)[mtv].vertexMom+(*WrkVrtSet)[i1tv].vertexMom).M(); //Use + if( dist < distM ) {distM=dist; best1TVrt=i1tv;} + (*WrkVrtSet)[i1tv].Good=false; + } + if(best1TVrt>-1 && distM<m_VrtMassLimit)(*WrkVrtSet)[best1TVrt].Good=true; + } + } + + + void NewVrtSecInclusiveTool::trackClassification(std::vector<WrkVrt> *WrkVrtSet, + std::vector< std::deque<long int> > *TrkInVrt) + const + { + int NSet=WrkVrtSet->size(); + for(int iv=0; iv<NSet; iv++) { + if(!(*WrkVrtSet)[iv].Good) continue; + int NTrkAtVrt=(*WrkVrtSet)[iv].selTrk.size(); + if(NTrkAtVrt<2) continue; + for(int jt=0; jt<NTrkAtVrt; jt++){ + int tracknum=(*WrkVrtSet)[iv].selTrk[jt]; + (*TrkInVrt).at(tracknum).push_back(iv); + } + } + } + + + double NewVrtSecInclusiveTool::maxOfShared(std::vector<WrkVrt> *WrkVrtSet, + std::vector< std::deque<long int> > *TrkInVrt, + long int & SelectedTrack, + long int & SelectedVertex) + const + { + long int NTrack=TrkInVrt->size(); + int it, jv, itmp, NVrt, VertexNumber; + + double MaxOf=-999999999, Chi2Red=0., SelectedProb=1.; +// + int NShareMax=0; + for( it=0; it<NTrack; it++) { + NVrt=(*TrkInVrt)[it].size(); /*Number of vertices for this track*/ + if( NVrt > NShareMax ) NShareMax=NVrt; + } + if(NShareMax<=1)return MaxOf; /* No shared tracks */ +// + for( it=0; it<NTrack; it++) { + NVrt=(*TrkInVrt)[it].size(); /*Number of vertices for this track*/ + if( NVrt <= 1 ) continue; /*Should ALWAYS be checked for safety*/ + if( NVrt < NShareMax ) continue; /*Not a shared track with maximal sharing*/ + double maxRadius=0; + for(auto &vrtn :(*TrkInVrt)[it] ){ maxRadius=std::max((*WrkVrtSet).at(vrtn).vertex.perp(),maxRadius); } //count number of 2-track vertices + for( jv=0; jv<NVrt; jv++ ){ + VertexNumber=(*TrkInVrt)[it][jv]; + if(!(*WrkVrtSet).at(VertexNumber).Good)continue; + int NTrkInVrt=(*WrkVrtSet)[VertexNumber].selTrk.size(); + if( NTrkInVrt <= 1) continue; // one track vertex - nothing to do + ////if( N2trVrt>0 && N2trVrt<NShareMax && NTrkInVrt>2) continue; // Mixture of multi-track and 2-track vrts. Skip multi-track then.??? Bad!!! + for( itmp=0; itmp<NTrkInVrt; itmp++){ + if( (*WrkVrtSet)[VertexNumber].selTrk[itmp] == it ) { /* Track found*/ + //Chi2Red=(*WrkVrtSet)[VertexNumber].chi2PerTrk.at(itmp); // Normal Chi2 + Chi2Red=(*WrkVrtSet)[VertexNumber].chi2PerTrk.at(itmp)*(*WrkVrtSet)[VertexNumber].vertex.perp()/maxRadius; // Works much better + double prob_vrt = TMath::Prob( (*WrkVrtSet)[VertexNumber].chi2, 2*(*WrkVrtSet)[VertexNumber].selTrk.size()-3); + if( MaxOf < Chi2Red ){ + if(MaxOf>0 && prob_vrt>0.01 && SelectedProb<0.01 ) continue; // Don't disassemble good vertices if a bad one is present + MaxOf = Chi2Red; + SelectedTrack=it; SelectedVertex=VertexNumber; + SelectedProb = prob_vrt; + } + } + } + } + } +//-- Additional check for a common track in 2tr-2tr/Ntr vertex topology + if( (*TrkInVrt)[SelectedTrack].size() == 2){ + int v1=(*TrkInVrt)[SelectedTrack][0]; int v2=(*TrkInVrt)[SelectedTrack][1]; + double prb1=TMath::Prob( (*WrkVrtSet)[v1].chi2, 2*(*WrkVrtSet)[v1].selTrk.size()-3), + prb2=TMath::Prob( (*WrkVrtSet)[v2].chi2, 2*(*WrkVrtSet)[v2].selTrk.size()-3); + double dst1=(*WrkVrtSet)[v1].projectedVrt, dst2=(*WrkVrtSet)[v2].projectedVrt; + if(prb1>0.05 && prb2>0.05){ + if( (*WrkVrtSet)[v1].selTrk.size()==2 && (*WrkVrtSet)[v2].selTrk.size()==2){ + if (SelectedVertex==v1 && dst2<dst1) SelectedVertex=v2; // Swap to remove the closest to PV vertex + else if(SelectedVertex==v2 && dst1<dst2) SelectedVertex=v1; // Swap to remove the closest to PV vertex + double M1=(*WrkVrtSet)[v1].vertexMom.M(); double M2=(*WrkVrtSet)[v2].vertexMom.M(); + if( M1>m_VrtMassLimit && M2<m_VrtMassLimit ) SelectedVertex=v1; + if( M1<m_VrtMassLimit && M2>m_VrtMassLimit ) SelectedVertex=v2; + } + if( (*WrkVrtSet)[v1].selTrk.size()+(*WrkVrtSet)[v2].selTrk.size() > 4){ + if( (*WrkVrtSet)[v1].selTrk.size()==2 && dst1>dst2) SelectedVertex=v2; + if( (*WrkVrtSet)[v2].selTrk.size()==2 && dst2>dst1) SelectedVertex=v1; + } } + } +// + return MaxOf; + } + + + void NewVrtSecInclusiveTool::removeTrackFromVertex(std::vector<WrkVrt> *WrkVrtSet, + std::vector< std::deque<long int> > *TrkInVrt, + long int selectedTrack, + long int selectedVertex) + const + { + int posInVrtFit=0; //Position of SelectedTrack in vertex fit track list. + std::deque<long int>::iterator it; + WrkVrt & CVRT=(*WrkVrtSet).at(selectedVertex); +//std::cout<<" In Found ="<<selectedTrack<<", "<<selectedVertex<<'\n'; + for(it=CVRT.selTrk.begin(); + it!=CVRT.selTrk.end(); it++) { + if( (*it) == selectedTrack ) { + CVRT.selTrk.erase(it); break; + } + posInVrtFit++; + } + + for(it=(*TrkInVrt).at(selectedTrack).begin(); + it!=(*TrkInVrt)[selectedTrack].end(); it++) { + if( (*it) == selectedVertex ) { + (*TrkInVrt)[selectedTrack].erase(it); break; + } + } + (*WrkVrtSet)[selectedVertex].detachedTrack=selectedTrack; +//Check if track is removed from 2tr vertex => then sharing of track left should also be decreased + if( CVRT.selTrk.size() == 1){ + long int LeftTrack=CVRT.selTrk[0]; // track left in 1tr vertex + for(it=(*TrkInVrt).at(LeftTrack).begin(); it!=(*TrkInVrt)[LeftTrack].end(); it++) { + if( (*it) == selectedVertex ) { + (*TrkInVrt)[LeftTrack].erase(it); break; + } + } + if( TMath::Prob( CVRT.chi2, 1) < 0.05 ) CVRT.Good=false; // Not really good Chi2 for one-track vertex + if( CVRT.vertexMom.M()>m_VrtMassLimit)CVRT.Good=false; // Vertex is too heavy + int ipos=0; if(posInVrtFit==0)ipos=1; // Position of remaining track in previous 2track vertex fit + CVRT.vertexMom=MomAtVrt(CVRT.trkAtVrt[ipos]); //Redefine vertexMom using remaining track + if((*TrkInVrt)[LeftTrack].size()>0)CVRT.Good=false; //Vertex is declared false only if remaining track + // is still linked to another vertex + if(CVRT.vertexMom.Pt()<2.*m_cutPt) CVRT.Good=false; //1track vertex should have twice momentum of track pt cut + CVRT.trkAtVrt.erase((*WrkVrtSet)[selectedVertex].trkAtVrt.begin()+posInVrtFit); //Remove also TrkAtVrt + } + + } +// +// Number of common tracks for 2 vertices +// + int NewVrtSecInclusiveTool::nTrkCommon( std::vector<WrkVrt> *WrkVrtSet, + int V1, int V2) + const + { + int NTrk_V1 = (*WrkVrtSet).at(V1).selTrk.size(); if( NTrk_V1< 2) return 0; /* Bad vertex */ + int NTrk_V2 = (*WrkVrtSet).at(V2).selTrk.size(); if( NTrk_V2< 2) return 0; /* Bad vertex */ + int nTrkCom=0; + if(NTrk_V1 < NTrk_V2){ + for(int i=0; i<NTrk_V1; i++){ + int trk=(*WrkVrtSet)[V1].selTrk[i]; + if( std::find((*WrkVrtSet)[V2].selTrk.begin(),(*WrkVrtSet)[V2].selTrk.end(),trk) != (*WrkVrtSet)[V2].selTrk.end()) nTrkCom++; + } + }else{ + for(int i=0; i<NTrk_V2; i++){ + int trk=(*WrkVrtSet)[V2].selTrk[i]; + if( std::find((*WrkVrtSet)[V1].selTrk.begin(),(*WrkVrtSet)[V1].selTrk.end(),trk) != (*WrkVrtSet)[V1].selTrk.end()) nTrkCom++; + } + } + return nTrkCom; + } +// +// Minimal normalized vertex-vertex distance +// + double NewVrtSecInclusiveTool::minVrtVrtDist( std::vector<WrkVrt> *WrkVrtSet, int & V1, int & V2) + const + { + V1=V2=0; + for(int iv=0; iv<(int)WrkVrtSet->size(); iv++) { (*WrkVrtSet).at(iv).dCloseVrt=1000000.; (*WrkVrtSet)[iv].nCloseVrt=-1;} + double foundMinVrtDst=1000000.; + + for(int iv=0; iv<(int)WrkVrtSet->size()-1; iv++) { + if( (*WrkVrtSet)[iv].selTrk.size()< 2) continue; /* Bad vertices */ + if(!(*WrkVrtSet)[iv].Good ) continue; /* Bad vertices */ + for(int jv=iv+1; jv<(int)WrkVrtSet->size(); jv++) { + if( (*WrkVrtSet)[jv].selTrk.size()< 2) continue; /* Bad vertices */ + if(!(*WrkVrtSet)[jv].Good ) continue; /* Bad vertices */ + //if(!nTrkCommon(WrkVrtSet, V1, V2)) continue; /* No common tracks*/ + double tmp= fabs((*WrkVrtSet)[iv].vertex.x()-(*WrkVrtSet)[jv].vertex.x()) + +fabs((*WrkVrtSet)[iv].vertex.y()-(*WrkVrtSet)[jv].vertex.y()) + +fabs((*WrkVrtSet)[iv].vertex.z()-(*WrkVrtSet)[jv].vertex.z()); + if(tmp>20.) continue; + double tmpDst = VrtVrtDist((*WrkVrtSet)[iv].vertex,(*WrkVrtSet)[iv].vertexCov, + (*WrkVrtSet)[jv].vertex,(*WrkVrtSet)[jv].vertexCov); + if( tmpDst < foundMinVrtDst){foundMinVrtDst = tmpDst; V1=iv; V2=jv;} + if( tmpDst < (*WrkVrtSet)[iv].dCloseVrt ) {(*WrkVrtSet)[iv].dCloseVrt=tmpDst; (*WrkVrtSet)[iv].nCloseVrt=jv;} + if( tmpDst < (*WrkVrtSet)[jv].dCloseVrt ) {(*WrkVrtSet)[jv].dCloseVrt=tmpDst; (*WrkVrtSet)[jv].nCloseVrt=iv;} + } + } + return foundMinVrtDst; + } +// +// Give minimal distance between nonmodifed yet vertices +// + double NewVrtSecInclusiveTool::minVrtVrtDistNext( std::vector<WrkVrt> *WrkVrtSet, int & V1, int & V2) + const + { + V1=0; V2=0; + double foundMinVrtDst=1000000.; + for(int iv=0; iv<(int)WrkVrtSet->size()-1; iv++) { + if( (*WrkVrtSet)[iv].selTrk.size()< 2) continue; /* Bad vertex */ + if( (*WrkVrtSet)[iv].nCloseVrt==-1) continue; /* Used vertex */ + if( (*WrkVrtSet)[iv].dCloseVrt <foundMinVrtDst ) { + int vtmp=(*WrkVrtSet)[iv].nCloseVrt; + if((*WrkVrtSet)[vtmp].nCloseVrt==-1) { continue;} // Close vertex to given [iv] one is modified already + foundMinVrtDst=(*WrkVrtSet)[iv].dCloseVrt; + V1=iv; + V2=vtmp; + } + } + return foundMinVrtDst; + } + +// +// Check two close vertices by explicit vertex fit and create combined vertex if successful +// + double NewVrtSecInclusiveTool::mergeAndRefitVertices( std::vector<WrkVrt> *WrkVrtSet, int V1, int V2, WrkVrt & newvrt, + std::vector<const xAOD::TrackParticle*> & AllTrackList, + Trk::IVKalState& istate) + const + { + if(!(*WrkVrtSet).at(V1).Good)return -1.; //bad vertex + if(!(*WrkVrtSet).at(V2).Good)return -1.; //bad vertex + std::vector<const xAOD::NeutralParticle*> neutralPartDummy(0); + newvrt.Good=true; + int NTrk_V1=(*WrkVrtSet)[V1].selTrk.size(); + int NTrk_V2=(*WrkVrtSet)[V2].selTrk.size(); + newvrt.selTrk.resize(NTrk_V1+NTrk_V2); + std::copy((*WrkVrtSet)[V1].selTrk.begin(),(*WrkVrtSet)[V1].selTrk.end(), newvrt.selTrk.begin()); + std::copy((*WrkVrtSet)[V2].selTrk.begin(),(*WrkVrtSet)[V2].selTrk.end(), newvrt.selTrk.begin()+NTrk_V1); + + std::deque<long int>::iterator TransfEnd ; + sort( newvrt.selTrk.begin(), newvrt.selTrk.end() ); + TransfEnd = unique( newvrt.selTrk.begin(), newvrt.selTrk.end() ); + newvrt.selTrk.erase( TransfEnd, newvrt.selTrk.end()); + std::vector<const xAOD::TrackParticle*> fitTrackList(0); + for(int it=0; it<(int)newvrt.selTrk.size(); it++)fitTrackList.push_back( AllTrackList[newvrt.selTrk[it]] ); + m_fitSvc->setApproximateVertex( 0.5*((*WrkVrtSet)[V1].vertex[0]+(*WrkVrtSet)[V2].vertex[0]), + 0.5*((*WrkVrtSet)[V1].vertex[1]+(*WrkVrtSet)[V2].vertex[1]), + 0.5*((*WrkVrtSet)[V1].vertex[2]+(*WrkVrtSet)[V2].vertex[2]), + istate); + + StatusCode sc=m_fitSvc->VKalVrtFit(fitTrackList,neutralPartDummy, + newvrt.vertex, newvrt.vertexMom, newvrt.vertexCharge, newvrt.vertexCov, + newvrt.chi2PerTrk, newvrt.trkAtVrt, newvrt.chi2, + istate, false); + if( sc.isFailure() ) return -1.; + if( newvrt.chi2>500. ) return -1.; //VK protection + if( newvrt.chi2PerTrk.size()==2) newvrt.chi2PerTrk[0]=newvrt.chi2PerTrk[1]=newvrt.chi2/2.; + return TMath::Prob( newvrt.chi2, 2*newvrt.selTrk.size()-3); + } + // + // + //================== Intelligent merge of multitrack vertices with 2 and more common tracks + void NewVrtSecInclusiveTool::mergeAndRefitOverlapVertices( std::vector<WrkVrt> *WrkVrtSet, int V1, int V2, + std::vector<const xAOD::TrackParticle*> & AllTrackList, + Trk::IVKalState& istate) const + { + if(!(*WrkVrtSet).at(V1).Good)return; //bad vertex + if(!(*WrkVrtSet).at(V2).Good)return; //bad vertex + std::vector<const xAOD::NeutralParticle*> neutralPartDummy(0); + WrkVrt newvrt; + newvrt.Good=true; + if( nTrkCommon( WrkVrtSet, V1, V2)<2 )return; //No overlap + //- V1 should become ref. vertex. Another Vrt tracks will be added to it. + if( (*WrkVrtSet)[V1].selTrk.size() < (*WrkVrtSet)[V2].selTrk.size() ) + {int itmp=V2; V2=V1; V1=itmp;} //Vertex with NTrk=max is chosen + else if( (*WrkVrtSet)[V1].selTrk.size() == (*WrkVrtSet)[V2].selTrk.size() ) + { if( (*WrkVrtSet)[V1].chi2 > (*WrkVrtSet)[V2].chi2 ) {int itmp=V2; V2=V1; V1=itmp;} } // Vertex with minimal Chi2 is chosen + //- Fill base track list for new vertex + newvrt.selTrk.resize( (*WrkVrtSet)[V1].selTrk.size() ); + std::copy((*WrkVrtSet)[V1].selTrk.begin(),(*WrkVrtSet)[V1].selTrk.end(), newvrt.selTrk.begin()); + //- Identify non-common tracks in second vertex + std::vector<int> noncommonTrk(0); + for(auto &it : (*WrkVrtSet)[V2].selTrk){ + if( std::find((*WrkVrtSet)[V1].selTrk.begin(), (*WrkVrtSet)[V1].selTrk.end(), it) == (*WrkVrtSet)[V1].selTrk.end() ) + noncommonTrk.push_back(it); + } + // + // Try to add non-common tracks one by one + std::vector<const xAOD::TrackParticle*> fitTrackList(0); + std::vector<int> detachedTrk(0); + StatusCode sc; sc.setChecked(); + WrkVrt bestVrt; + bool foundMerged=false; + for( auto nct : noncommonTrk){ + fitTrackList.clear(); + for(int it=0; it<(int)newvrt.selTrk.size(); it++)fitTrackList.push_back( AllTrackList[newvrt.selTrk[it]] ); + fitTrackList.push_back( AllTrackList.at(nct) ); + m_fitSvc->setApproximateVertex( (*WrkVrtSet)[V1].vertex[0],(*WrkVrtSet)[V1].vertex[1],(*WrkVrtSet)[V1].vertex[2],istate); + sc=m_fitSvc->VKalVrtFit(fitTrackList, neutralPartDummy, newvrt.vertex, newvrt.vertexMom, newvrt.vertexCharge, newvrt.vertexCov, + newvrt.chi2PerTrk, newvrt.trkAtVrt, newvrt.chi2, + istate, false); + if( sc.isFailure() || TMath::Prob( newvrt.chi2, 2*newvrt.selTrk.size()+2-3)<m_globVrtProbCut ) { + detachedTrk.push_back(nct); + continue; + } + newvrt.selTrk.push_back(nct); // Compatible track. Add to common vertex. + bestVrt=newvrt; + foundMerged=true; + } + if(foundMerged)(*WrkVrtSet)[V1]=bestVrt; + (*WrkVrtSet)[V2].Good=false; + // + // Now detached tracks + if(detachedTrk.size()>1){ + WrkVrt nVrt; + fitTrackList.clear(); nVrt.selTrk.clear(); + for(auto nct : detachedTrk){ fitTrackList.push_back( AllTrackList[nct] ); nVrt.selTrk.push_back(nct); } + m_fitSvc->setApproximateVertex( (*WrkVrtSet)[V2].vertex[0],(*WrkVrtSet)[V2].vertex[1],(*WrkVrtSet)[V2].vertex[2],istate); + sc=m_fitSvc->VKalVrtFit(fitTrackList, neutralPartDummy, nVrt.vertex, nVrt.vertexMom, nVrt.vertexCharge, nVrt.vertexCov, + nVrt.chi2PerTrk, nVrt.trkAtVrt, nVrt.chi2, + istate, false); + if(sc.isSuccess()) (*WrkVrtSet).push_back(nVrt); + } else if( detachedTrk.size()==1 ){ + bool tFound=false; + for( auto &vrt : (*WrkVrtSet) ){ + if( !vrt.Good || vrt.selTrk.size()<2 )continue; + if( std::find(vrt.selTrk.begin(), vrt.selTrk.end(), detachedTrk[0]) != vrt.selTrk.end() ) { tFound=true; break; } + } + if( !tFound ) { //Track is not present in other vertices. + double Chi2min=1.e9; int selectedTrk=-1; + WrkVrt saveVrt; + fitTrackList.resize(2); + fitTrackList[0]= AllTrackList[detachedTrk[0]]; + for(auto trk : (*WrkVrtSet)[V2].selTrk){ + if(trk==detachedTrk[0])continue; + WrkVrt nVrt; nVrt.Good=true; + fitTrackList[1]=AllTrackList[trk]; + m_fitSvc->setApproximateVertex( (*WrkVrtSet)[V2].vertex[0],(*WrkVrtSet)[V2].vertex[1],(*WrkVrtSet)[V2].vertex[2],istate); + sc=m_fitSvc->VKalVrtFit(fitTrackList, neutralPartDummy, nVrt.vertex, nVrt.vertexMom, nVrt.vertexCharge, nVrt.vertexCov, + nVrt.chi2PerTrk, nVrt.trkAtVrt, nVrt.chi2, + istate, false); + if(sc.isSuccess() && nVrt.chi2<Chi2min) {Chi2min=nVrt.chi2; saveVrt=nVrt; selectedTrk=trk; } + } + if(Chi2min<1.e9){ + saveVrt.selTrk.resize(1); saveVrt.selTrk[0]=detachedTrk[0]; + saveVrt.detachedTrack=selectedTrk; + saveVrt.vertexMom=MomAtVrt(saveVrt.trkAtVrt[0]); //redefine vertex momentum + (*WrkVrtSet).push_back(saveVrt); + } + } + } + return ; + } + +// +// Iterate track removal until vertex get good Chi2 +// + + double NewVrtSecInclusiveTool::improveVertexChi2( std::vector<WrkVrt> *WrkVrtSet, int V, std::vector<const xAOD::TrackParticle*> & AllTrackList, + Trk::IVKalState& istate, + bool ifCovV0) + const + { + + int NTrk=(*WrkVrtSet)[V].selTrk.size(); + if( NTrk<2 )return 0.; + double Prob=TMath::Prob( (*WrkVrtSet)[V].chi2, 2*NTrk-3); + // + //----Start track removal iterations + while(Prob<0.01){ + NTrk=(*WrkVrtSet)[V].selTrk.size(); + if(NTrk==2)return Prob; + int SelT=-1; double Chi2Max=0.; + for(int i=0; i<NTrk; i++){ + if( (*WrkVrtSet)[V].chi2PerTrk[i]>Chi2Max) { + Chi2Max=(*WrkVrtSet)[V].chi2PerTrk[i]; + SelT=i; + } + } + if (SelT<0) return 0; + (*WrkVrtSet)[V].detachedTrack=(*WrkVrtSet)[V].selTrk[SelT]; + (*WrkVrtSet)[V].selTrk.erase( (*WrkVrtSet)[V].selTrk.begin() + SelT ); //remove track + StatusCode sc = refitVertex( WrkVrtSet, V, AllTrackList, istate, ifCovV0); + if(sc.isFailure())return 0.; + Prob=TMath::Prob( (*WrkVrtSet)[V].chi2, 2*(NTrk-1)-3); + } + return Prob; + } + + + + + StatusCode NewVrtSecInclusiveTool::refitVertex( std::vector<WrkVrt> *WrkVrtSet, + int SelectedVertex, + std::vector<const xAOD::TrackParticle*> & selectedTracks, + Trk::IVKalState& istate, + bool ifCovV0) const + { + int nth = (*WrkVrtSet)[SelectedVertex].selTrk.size(); + + if(nth<2) return StatusCode::SUCCESS; + + std::vector<const xAOD::NeutralParticle*> neutralPartDummy(0); + std::vector<const xAOD::TrackParticle*> ListTracks(0); + for(int i=0;i<nth;i++) { + int j=(*WrkVrtSet)[SelectedVertex].selTrk[i]; /*Track number*/ + ListTracks.push_back( selectedTracks[j] ); + } + (*WrkVrtSet)[SelectedVertex].Good = false; + (*WrkVrtSet)[SelectedVertex].chi2PerTrk.resize(nth); + for(int i=0;i<nth;i++)(*WrkVrtSet)[SelectedVertex].chi2PerTrk[i]=100000.+i; //VK safety + + m_fitSvc->setApproximateVertex((*WrkVrtSet)[SelectedVertex].vertex[0], + (*WrkVrtSet)[SelectedVertex].vertex[1], + (*WrkVrtSet)[SelectedVertex].vertex[2], + istate); + StatusCode sc=m_fitSvc->VKalVrtFit(ListTracks, neutralPartDummy, + (*WrkVrtSet)[SelectedVertex].vertex, + (*WrkVrtSet)[SelectedVertex].vertexMom, + (*WrkVrtSet)[SelectedVertex].vertexCharge, + (*WrkVrtSet)[SelectedVertex].vertexCov, + (*WrkVrtSet)[SelectedVertex].chi2PerTrk, + (*WrkVrtSet)[SelectedVertex].trkAtVrt, + (*WrkVrtSet)[SelectedVertex].chi2, + istate, ifCovV0); + if(sc.isSuccess())(*WrkVrtSet)[SelectedVertex].Good = true; + if((*WrkVrtSet)[SelectedVertex].chi2PerTrk.size()==2) + (*WrkVrtSet)[SelectedVertex].chi2PerTrk[0]= + (*WrkVrtSet)[SelectedVertex].chi2PerTrk[1]=(*WrkVrtSet)[SelectedVertex].chi2/2.; + return sc; + } + + + + double NewVrtSecInclusiveTool::refitVertex(WrkVrt &Vrt, + std::vector<const xAOD::TrackParticle*> & selectedTracks, + Trk::IVKalState& istate, + bool ifCovV0) const + { + int i,j; + int nth = Vrt.selTrk.size(); + + if(nth<2) return -1.; + + std::vector<const xAOD::NeutralParticle*> neutralPartDummy(0); + std::vector<const xAOD::TrackParticle*> ListTracks(0); + for(i=0;i<nth;i++) { + j=Vrt.selTrk[i]; /*Track number*/ + ListTracks.push_back( selectedTracks[j] ); + } + Vrt.Good = false; + Vrt.chi2PerTrk.resize(nth); + for(i=0;i<nth;i++)Vrt.chi2PerTrk[i]=100000.+i; //VK safety + + m_fitSvc->setApproximateVertex(Vrt.vertex[0],Vrt.vertex[1],Vrt.vertex[2],istate); + StatusCode sc=m_fitSvc->VKalVrtFit(ListTracks,neutralPartDummy,Vrt.vertex,Vrt.vertexMom,Vrt.vertexCharge, + Vrt.vertexCov,Vrt.chi2PerTrk, Vrt.trkAtVrt,Vrt.chi2, + istate, ifCovV0); + if(sc.isSuccess())Vrt.Good = true; + else {Vrt.Good = false; return -1.;} + if(Vrt.chi2PerTrk.size()==2) Vrt.chi2PerTrk[0]=Vrt.chi2PerTrk[1]=Vrt.chi2/2.; + return TMath::Prob( Vrt.chi2, 2*nth-1); + } + + + bool NewVrtSecInclusiveTool::isPart( std::deque<long int> test, std::deque<long int> base) + const + { + std::deque<long int>::iterator trk=test.begin(); + for(trk=test.begin(); trk!=test.end(); trk++) + if(std::find(base.begin(), base.end(), (*trk)) == base.end()) return false; //element not found => test is not part of base + return true; + } + + double NewVrtSecInclusiveTool::MomProjDist(const Amg::Vector3D & SecVrt,const xAOD::Vertex &PrimVrt,const TLorentzVector &Mom) + const + { + Amg::Vector3D vv=SecVrt-PrimVrt.position(); + return ( vv.x()*Mom.X()+vv.y()*Mom.Y()+vv.z()*Mom.Z() )/ Mom.P(); + } + +} //end namespace + + + diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/NewVrtSecInclusiveTool.cxx b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/NewVrtSecInclusiveTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..5b18338fc9941b66692c1097857d6e8ade31b29a --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/NewVrtSecInclusiveTool.cxx @@ -0,0 +1,345 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +/// +/// @author Vadim Kostyukhin <vadim.kostyukhin@cern.ch> +/// + + +// Header include +#include "NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h" +#include "VxSecVertex/VxSecVertexInfo.h" +#include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" +#include "InDetBeamSpotService/IBeamCondSvc.h" +#include "PathResolver/PathResolver.h" + +#include "GaudiKernel/ITHistSvc.h" +#include "TH1.h" +#include "TH2.h" +#include "TTree.h" +#include "TMath.h" +#include "TFile.h" +#include "MVAUtils/BDT.h" +// + + +namespace Rec { + +// +//Constructor-------------------------------------------------------------- +NewVrtSecInclusiveTool::NewVrtSecInclusiveTool(const std::string& type, + const std::string& name, + const IInterface* parent): + AthAlgTool(type,name,parent), + m_cutSctHits(4), + m_cutPixelHits(2), + m_cutSiHits(8), + m_cutBLayHits(0), + m_cutSharedHits(1), + m_cutPt(500.), + m_cutZVrt(15.), + m_cutA0(10.), + m_cutChi2(5.), + m_sel2VrtProbCut(0.02), + m_globVrtProbCut(0.005), + m_maxSVRadiusCut(140.), + m_selVrtSigCut(3.0), + m_trkSigCut(2.0), + m_a0TrkErrorCut(1.0), + m_zTrkErrorCut(5.0), + m_VrtMassLimit(5500.), + m_Vrt2TrMassLimit(4000.), + m_Vrt2TrPtLimit(5.e5), + m_antiPileupSigRCut(2.0), + m_dRdZRatioCut(0.25), + m_v2tIniBDTCut(-0.6), + m_v2tFinBDTCut(0.), + m_vertexMergeCut(3.), + m_trackDetachCut(6.), + m_beampipeR(24.3), + m_removeTrkMatSignif(0.), + m_fillHist(false), + m_useVertexCleaning(true), + m_multiWithOneTrkVrt(true), + m_calibFileName("Fake2TrVertexReject.MVA.v01.root"), + m_SV2T_BDT(nullptr), + m_beamService("BeamCondSvc",name), + m_fitSvc("Trk::TrkVKalVrtFitter/VertexFitterTool",this) + { +// +// Declare additional interface +// + declareInterface< IVrtInclusive >(this); +// Properties +// +// + declareProperty("CutSctHits", m_cutSctHits , "Remove track is it has less SCT hits" ); + declareProperty("CutPixelHits", m_cutPixelHits, "Remove track is it has less Pixel hits"); + declareProperty("CutSiHits", m_cutSiHits, "Remove track is it has less Pixel+SCT hits" ); + declareProperty("CutBLayHits", m_cutBLayHits, "Remove track is it has less B-layer hits" ); + declareProperty("CutSharedHits", m_cutSharedHits,"Reject final 2tr vertices if tracks have shared hits" ); + + declareProperty("CutPt", m_cutPt, "Track Pt selection cut" ); + declareProperty("CutA0", m_cutA0, "Track A0 selection cut" ); + declareProperty("CutZVrt", m_cutZVrt, "Track Z impact selection cut"); + declareProperty("CutChi2", m_cutChi2, "Track Chi2 selection cut" ); + declareProperty("TrkSigCut", m_trkSigCut, "Track 3D impact significance w/r primary vertex. Should be >=AntiPileupSigRCut" ); + + declareProperty("A0TrkErrorCut", m_a0TrkErrorCut, "Track A0 error cut" ); + declareProperty("ZTrkErrorCut", m_zTrkErrorCut, "Track Z impact error cut" ); + declareProperty("VrtMassLimit", m_VrtMassLimit, "Maximal allowed mass for found vertices" ); + declareProperty("Vrt2TrMassLimit",m_Vrt2TrMassLimit,"Maximal allowed mass for 2-track vertices" ); + declareProperty("Vrt2TrPtLimit", m_Vrt2TrPtLimit, "Maximal allowed Pt for 2-track vertices. Calibration limit" ); + + declareProperty("Sel2VrtProbCut", m_sel2VrtProbCut, "Cut on probability of 2-track vertex for initial selection" ); + declareProperty("GlobVrtProbCut", m_globVrtProbCut, "Cut on probability of any vertex for final selection" ); + declareProperty("MaxSVRadiusCut", m_maxSVRadiusCut, "Cut on maximal radius of SV (def = Pixel detector size)" ); + declareProperty("SelVrtSigCut", m_selVrtSigCut, "Cut on significance of 3D distance between vertex and PV" ); + declareProperty("AntiPileupSigRCut", m_antiPileupSigRCut, "Upper cut on significance of 2D distance between beam and perigee" ); + declareProperty("dRdZRatioCut", m_dRdZRatioCut, "Cut on dR/dZ ratio to remove pileup tracks" ); + declareProperty("v2tIniBDTCut", m_v2tIniBDTCut, "Initial BDT cut for 2track vertices selection " ); + declareProperty("v2tFinBDTCut", m_v2tFinBDTCut, "Final BDT cut for 2track vertices selection " ); + + declareProperty("FillHist", m_fillHist, "Fill technical histograms" ); + + + declareProperty("useVertexCleaning", m_useVertexCleaning, "Clean vertices by requiring pixel hit presence according to vertex position" ); + + declareProperty("MultiWithOneTrkVrt", m_multiWithOneTrkVrt,"Allow one-track-vertex addition to already found secondary vertices"); + + declareProperty("VertexMergeCut", m_vertexMergeCut, "To allow vertex merging for MultiVertex Finder" ); + declareProperty("TrackDetachCut", m_trackDetachCut, "To allow track from vertex detachment for MultiVertex Finder" ); + + declareProperty("beampipeR", m_beampipeR, "Radius of the beampipe material" ); + declareProperty("removeTrkMatSignif", m_removeTrkMatSignif, "Significance of Vertex-TrackingMaterial distance for removal. No removal if <=0." ); + + declareProperty("calibFileName", m_calibFileName, " MVA calibration file for 2-track fake vertices removal" ); + + declareProperty("BeamSpotSvc", m_beamService, "Name of the BeamSpot service"); + declareProperty("VertexFitterTool", m_fitSvc, "Name of the Vertex Fitter tool"); +// + m_massPi = Trk::ParticleMasses().mass[Trk::pion]; + m_massP = Trk::ParticleMasses().mass[Trk::proton]; + m_massE = Trk::ParticleMasses().mass[Trk::electron]; + m_massK0 = Trk::ParticleMasses().mass[Trk::k0]; + m_massLam = 1115.683 ; + m_compatibilityGraph = nullptr; + m_instanceName=name; + + } + +//Destructor--------------------------------------------------------------- + NewVrtSecInclusiveTool::~NewVrtSecInclusiveTool(){ + ATH_MSG_DEBUG("NewVrtSecInclusiveTool destructor called"); + } + +//Initialize--------------------------------------------------------------- + StatusCode NewVrtSecInclusiveTool::initialize(){ + ATH_MSG_DEBUG( "Initialising NewVrtSecInclusiveTool- Package version: " << PACKAGE_VERSION ); + m_compatibilityGraph = new boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS>(); + + ATH_CHECK( m_beamService.retrieve() ); + ATH_CHECK( m_extrapolator.retrieve() ); + + ATH_CHECK( m_fitSvc.retrieve() ); + ATH_MSG_DEBUG("NewVrtSecInclusiveTool TrkVKalVrtFitter found"); + +//------------------------------------------ +// + ITHistSvc* hist_root=0; + if(m_fillHist){ + + StatusCode sc = service( "THistSvc", hist_root); + if( sc.isFailure() ) ATH_MSG_DEBUG("Could not find THistSvc service"); + else ATH_MSG_DEBUG("NewVrtSecInclusiveTool Histograms found"); + + m_hb_massPiPi = new TH1D("massPiPi"," mass PiPi",200,0., 4000.); + m_hb_massPiPi1 = new TH1D("massPiPi1"," mass PiPi",200,0., 4000.); + m_hb_massPPi = new TH1D("massPPi"," massPPi", 100,1000., 1250.); + m_hb_massEE = new TH1D("massEE"," massEE", 100,0., 200.); + m_hb_nvrt2 = new TH1D("nvrt2"," vertices2", 50,0., 50.); + m_hb_ratio = new TH1D("ratio"," ratio", 51,0., 1.02); + m_hb_totmass = new TH1D("totmass"," totmass", 250,0., 10000.); + m_hb_impact = new TH1D("impact", " impact", 100,0., 20.); + m_hb_impactR = new TH1D("impactR"," impactR", 400,-30., 70.); + m_hb_impactZ = new TH1D("impactZ"," impactZ", 100,-30., 70.); + m_hb_impactRZ = new TH2D("impactRZ"," impactRZ", 40,-10., 10., 60, -30.,30. ); + m_hb_pileupRat = new TH1D("pileupRatio"," dR/dZ ratio", 100, 0., 1.); + m_hb_trkD0 = new TH1D("trkD0"," d0 of tracks", 100, 0., 10.); + m_hb_trkZ = new TH1D("trkZ"," Z of tracks", 120,-60., 60.); + m_hb_r2d = new TH1D("r2interact","Interaction radius 2tr selected", 150,0., 150.); + m_hb_ntrksel = new TH1F("NTrkSel","Number of selected tracks", 200,0., 200.); + m_hb_ntrkInput = new TH1F("NTrkInput","Number of provided tracks", 200,0., 1000.); + m_hb_trkSelect = new TH1F("TrkSelect","Track selection efficiency", 15,0., 15.); + m_hb_signif3D = new TH1D("signif3D"," Signif3D for initial 2tr vertex", 140,-20., 50.); + m_hb_sig3DTot = new TH1D("sig3dcommon"," Signif3D for common vertex", 140,-20., 50.); + m_hb_sig3D1tr = new TH1D("sig3D1tr","Signif3D for 1tr vertices", 140,-20., 50.); + m_hb_sig3D2tr = new TH1D("sig3D2tr","Signif3D for 2tr single vertex", 140,-20., 50.); + m_hb_sig3DNtr = new TH1D("sig3DNtr","Signif3D for many-tr single vertex", 140,-20., 50.); + m_hb_goodvrtN = new TH1F("goodvrtN","Number of good vertices", 20,0., 20.); + m_hb_goodvrt1N = new TH1F("goodvrt1N","Number of good 1-track vertices", 20,0., 20.); + m_hb_distVV = new TH1D("distvv","Vertex-Vertex dist", 100,0., 20.); + m_hb_diffPS = new TH1D("diffPS","Primary-Secondary assoc", 200,-20., 20.); + m_hb_rawVrtN = new TH1F("rawVrtN","Number of raw vertices multivertex case", 20, 0., 20.); + m_hb_cosSVMom = new TH1F("cosSVMom","SV-PV vs SV momentum ", 100, 0., 1.); + m_hb_etaSV = new TH1F("etaSV"," Eta of SV-PV ", 100, -5., 5.); + m_hb_fakeSVBDT = new TH1F("fakeSVBDT"," BDT for fake SV rejection", 100, -1., 1.); +//--- + std::string histDir; + histDir="/file1/stat/MultiSVrt"+m_instanceName+"/"; + sc = hist_root->regHist(histDir+"massPiPi", m_hb_massPiPi); + sc = hist_root->regHist(histDir+"massPiPi1", m_hb_massPiPi1); + sc = hist_root->regHist(histDir+"massPPi", m_hb_massPPi); + sc = hist_root->regHist(histDir+"massEE", m_hb_massEE ); + sc = hist_root->regHist(histDir+"nvrt2", m_hb_nvrt2); + sc = hist_root->regHist(histDir+"ratio", m_hb_ratio); + sc = hist_root->regHist(histDir+"totmass", m_hb_totmass); + sc = hist_root->regHist(histDir+"impact", m_hb_impact); + sc = hist_root->regHist(histDir+"impactR", m_hb_impactR); + sc = hist_root->regHist(histDir+"impactZ", m_hb_impactZ); + sc = hist_root->regHist(histDir+"impactRZ", m_hb_impactRZ); + sc = hist_root->regHist(histDir+"pileupRatio", m_hb_pileupRat); + sc = hist_root->regHist(histDir+"trkD0", m_hb_trkD0); + sc = hist_root->regHist(histDir+"trkZ", m_hb_trkZ); + sc = hist_root->regHist(histDir+"r2interact",m_hb_r2d); + sc = hist_root->regHist(histDir+"NTrkSel", m_hb_ntrksel); + sc = hist_root->regHist(histDir+"NTrkInput", m_hb_ntrkInput); + sc = hist_root->regHist(histDir+"TrkSelect", m_hb_trkSelect); + sc = hist_root->regHist(histDir+"signif3D", m_hb_signif3D); + sc = hist_root->regHist(histDir+"sig3dcommon", m_hb_sig3DTot); + sc = hist_root->regHist(histDir+"sig3D1tr", m_hb_sig3D1tr); + sc = hist_root->regHist(histDir+"sig3D2tr", m_hb_sig3D2tr); + sc = hist_root->regHist(histDir+"sig3DNtr", m_hb_sig3DNtr); + sc = hist_root->regHist(histDir+"goodvrtN", m_hb_goodvrtN); + sc = hist_root->regHist(histDir+"goodvrt1N", m_hb_goodvrt1N); + sc = hist_root->regHist(histDir+"distVV", m_hb_distVV); + sc = hist_root->regHist(histDir+"diffPS", m_hb_diffPS); + sc = hist_root->regHist(histDir+"rawVrtN", m_hb_rawVrtN); + sc = hist_root->regHist(histDir+"cosSVMom", m_hb_cosSVMom); + sc = hist_root->regHist(histDir+"etaSV", m_hb_etaSV); + sc = hist_root->regHist(histDir+"fakeSVBDT", m_hb_fakeSVBDT); + if( sc.isFailure() ) ATH_MSG_INFO( "NewVrtSecInclusive Histogram registration failure!!!"); + m_w_1 = 1.; + //------ + m_curTup=new DevTuple(); + m_tuple = new TTree("Vertices","Vertices"); + std::string TreeDir; + TreeDir="/file1/stat/MultiSVrt"+m_instanceName+"/"; + sc = hist_root->regTree(TreeDir,m_tuple); + if (sc.isSuccess()) { + m_tuple->Branch("ntrk", &m_curTup->nTrk, "ntrk/I"); + m_tuple->Branch("pttrk", &m_curTup->pttrk, "pttrk[ntrk]/F"); + m_tuple->Branch("Sig3D", &m_curTup->Sig3D, "Sig3D[ntrk]/F"); + + m_tuple->Branch("n2Vrt", &m_curTup->n2Vrt, "n2Vrt/I"); + m_tuple->Branch("VrtTrkHF", &m_curTup->VrtTrkHF, "VrtTrkHF[n2Vrt]/I"); + m_tuple->Branch("VrtTrkI", &m_curTup->VrtTrkI, "VrtTrkI[n2Vrt]/I"); + m_tuple->Branch("VrtCh", &m_curTup->VrtCh, "VrtCh[n2Vrt]/I"); + m_tuple->Branch("VrtDist2D", &m_curTup->VrtDist2D, "VrtDist2D[n2Vrt]/F"); + m_tuple->Branch("VrtSig3D", &m_curTup->VrtSig3D, "VrtSig3D[n2Vrt]/F"); + m_tuple->Branch("VrtSig2D", &m_curTup->VrtSig2D, "VrtSig2D[n2Vrt]/F"); + m_tuple->Branch("VrtM", &m_curTup->VrtM, "VrtM[n2Vrt]/F"); + m_tuple->Branch("VrtZ", &m_curTup->VrtZ, "VrtZ[n2Vrt]/F"); + m_tuple->Branch("VrtPt", &m_curTup->VrtPt, "VrtPt[n2Vrt]/F"); + m_tuple->Branch("VrtEta", &m_curTup->VrtEta, "VrtEta[n2Vrt]/F"); + m_tuple->Branch("VrtIBL", &m_curTup->VrtIBL, "VrtIBL[n2Vrt]/I"); + m_tuple->Branch("VrtBL", &m_curTup->VrtBL, "VrtBL[n2Vrt]/I"); + m_tuple->Branch("VrtSinSPM", &m_curTup->VrtSinSPM, "VrtSinSPM[n2Vrt]/F"); + m_tuple->Branch("VMinPtT", &m_curTup->VMinPtT, "VMinPtT[n2Vrt]/F"); + m_tuple->Branch("VMinS3DT", &m_curTup->VMinS3DT, "VMinS3DT[n2Vrt]/F"); + m_tuple->Branch("VMaxS3DT", &m_curTup->VMaxS3DT, "VMaxS3DT[n2Vrt]/F"); + m_tuple->Branch("VrtProb", &m_curTup->VrtProb, "VrtProb[n2Vrt]/F"); + m_tuple->Branch("VrtHR1", &m_curTup->VrtHR1, "VrtHR1[n2Vrt]/F"); + m_tuple->Branch("VrtHR2", &m_curTup->VrtHR2, "VrtHR2[n2Vrt]/F"); + m_tuple->Branch("VrtBDT", &m_curTup->VrtBDT, "VrtBDT[n2Vrt]/F"); + m_tuple->Branch("VrtDisk", &m_curTup->VrtDisk, "VrtDisk[n2Vrt]/I"); + m_tuple->Branch("VSigMat", &m_curTup->VSigMat, "VSigMat[n2Vrt]/F"); + + m_tuple->Branch("nNVrt", &m_curTup->nNVrt, "nNVrt/I"); + m_tuple->Branch("NVrtTrk", &m_curTup->NVrtTrk, "NVrtTrk[nNVrt]/I"); + m_tuple->Branch("NVrtTrkHF", &m_curTup->NVrtTrkHF, "NVrtTrkHF[nNVrt]/I"); + m_tuple->Branch("NVrtTrkI", &m_curTup->NVrtTrkI, "NVrtTrkI[nNVrt]/I"); + m_tuple->Branch("NVrtCh", &m_curTup->NVrtCh, "NVrtCh[nNVrt]/I"); + m_tuple->Branch("NVrtDist2D", &m_curTup->NVrtDist2D, "NVrtDist2D[nNVrt]/F"); + m_tuple->Branch("NVrtSig3D", &m_curTup->NVrtSig3D, "NVrtSig3D[nNVrt]/F"); + m_tuple->Branch("NVrtSig2D", &m_curTup->NVrtSig2D, "NVrtSig2D[nNVrt]/F"); + m_tuple->Branch("NVrtM", &m_curTup->NVrtM, "NVrtM[nNVrt]/F"); + m_tuple->Branch("NVrtPt", &m_curTup->NVrtPt, "NVrtPt[nNVrt]/F"); + m_tuple->Branch("NVrtEta", &m_curTup->NVrtEta, "NVrtEta[nNVrt]/F"); + m_tuple->Branch("NVrtIBL", &m_curTup->NVrtIBL, "NVrtIBL[nNVrt]/I"); + m_tuple->Branch("NVrtBL", &m_curTup->NVrtBL, "NVrtBL[nNVrt]/I"); + m_tuple->Branch("NVrtSinSPM", &m_curTup->NVrtSinSPM, "NVrtSinSPM[nNVrt]/F"); + m_tuple->Branch("NVMinPtT", &m_curTup->NVMinPtT, "NVMinPtT[nNVrt]/F"); + m_tuple->Branch("NVMinS3DT", &m_curTup->NVMinS3DT, "NVMinS3DT[nNVrt]/F"); + m_tuple->Branch("NVrtProb", &m_curTup->NVrtProb, "NVrtProb[nNVrt]/F"); + m_tuple->Branch("NVrtBDT", &m_curTup->NVrtBDT, "NVrtBDT[nNVrt]/F"); + } + } + +//-------------------------------------------------------- + //std::string fileName="NewVrtSecInclusiveTool/Fake2TrVertexReject.MVA.v01.root"; ///For local calibration file + //std::string rootFilePath = PathResolver::find_file(fileName, "DATAPATH"); /// + std::string rootFilePath = PathResolver::find_calib_file("NewVrtSecInclusiveTool/"+m_calibFileName); + TFile* rootFile = TFile::Open(rootFilePath.c_str(), "READ"); + if (!rootFile) { + ATH_MSG_FATAL("Could not retrieve root file: " << m_calibFileName); + return StatusCode::FAILURE; + } + TTree * training = (TTree*)rootFile->Get("BDT"); + m_SV2T_BDT = std::make_unique<MVAUtils::BDT>(training); +//-------------------------------------------------------- + return StatusCode::SUCCESS; + + } + + + + + StatusCode NewVrtSecInclusiveTool::finalize() + { + if(m_compatibilityGraph)delete m_compatibilityGraph; + ATH_MSG_DEBUG("NewVrtSecInclusiveTool finalize()"); + return StatusCode::SUCCESS; + } + + + + + std::unique_ptr<Trk::VxSecVertexInfo> NewVrtSecInclusiveTool::findAllVertices ( + const std::vector<const xAOD::TrackParticle*> & inpTrk, + const xAOD::Vertex & primVrt ) const + { + std::vector<xAOD::Vertex*> listVrtSec(0); + + if(m_fillHist && m_curTup){ + m_curTup->nTrk=0; + m_curTup->n2Vrt=0; + m_curTup->nNVrt=0; + }; + + workVectorArrxAOD * tmpVectxAOD=new workVectorArrxAOD(); + tmpVectxAOD->inpTrk.resize(inpTrk.size()); + std::copy(inpTrk.begin(),inpTrk.end(), tmpVectxAOD->inpTrk.begin()); + tmpVectxAOD->beamX=m_beamService->beamPos().x(); + tmpVectxAOD->beamY=m_beamService->beamPos().y(); + tmpVectxAOD->beamZ=m_beamService->beamPos().z(); + tmpVectxAOD->tanBeamTiltX=tan(m_beamService->beamTilt(0)); + tmpVectxAOD->tanBeamTiltY=tan(m_beamService->beamTilt(1)); + + + listVrtSec = getVrtSecMulti(tmpVectxAOD,primVrt); + delete tmpVectxAOD; + + + + std::vector<const xAOD::IParticle*> iparTrkV0(0); + std::unique_ptr<Trk::VxSecVertexInfo> res = std::make_unique<Trk::VxSecVertexInfo>(Trk::VxSecVertexInfo(listVrtSec)); + + if(m_fillHist && m_tuple){ m_tuple->Fill(); }; + + m_compatibilityGraph->clear(); + return res; + } + + +} // end Rec namespace diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/Sel2TrkVertices.cxx b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/Sel2TrkVertices.cxx new file mode 100755 index 0000000000000000000000000000000000000000..1f9e9b53f9a5e904cfc76b0485dc23978d13e497 --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/Sel2TrkVertices.cxx @@ -0,0 +1,215 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +/// +/// @author Vadim Kostyukhin <vadim.kostyukhin@cern.ch> +/// +// Header include +#include "NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h" +#include "GeoPrimitives/GeoPrimitivesHelpers.h" +#include "MVAUtils/BDT.h" +//------------------------------------------------- +// Other stuff +#include "AnalysisUtils/AnalysisMisc.h" +#include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" + +#include "TMath.h" +#include "TH1.h" +#include "TH2D.h" +// +//#include<iostream> + + +namespace Rec{ + + +// +// +//-------------------------------------------------------- +// Template routine for 2track secondary vertices selection +// + + void NewVrtSecInclusiveTool::select2TrVrt(std::vector<const xAOD::TrackParticle*> & selectedTracks, + const xAOD::Vertex & PrimVrt) + const + { + std::vector<const xAOD::NeutralParticle*> neutralPartDummy(0); + std::vector<const xAOD::TrackParticle*> tracksForFit(2,0); + std::vector<double> impact,impactError; + std::vector<double> inpMass(2,m_massPi); + long int Charge; + int i,j; + StatusCode sc; sc.setChecked(); + Vrt2Tr tmpVrt; + std::vector<Vrt2Tr> all2TrVrt(0); + TLorentzVector PSum2T; + Amg::Vector3D iniVrt(0.,0.,0.); + // + int NTracks = (int) (selectedTracks.size()); +// +// impact parameters with sign calculations +// + std::vector<float> covPV=PrimVrt.covariance(); + double signifR=0.,signifZ=0.; + std::vector<int> hitIBL(NTracks,0), hitBL(NTracks,0); + std::vector<double> trackSignif(NTracks),dRdZratio(NTracks); + for (i=0; i<NTracks; i++) { + m_fitSvc->VKalGetImpact(selectedTracks[i], PrimVrt.position(), 1, impact, impactError); + signifR = impact[0]/ sqrt(impactError[0]); + signifZ = impact[1]/ sqrt(impactError[2]); + trackSignif[i] = sqrt( signifR*signifR + signifZ*signifZ); + dRdZratio[i] = fabs(signifR/signifZ); + if(m_fillHist){ + m_hb_impactR->Fill( signifR, m_w_1); + m_hb_impactZ->Fill( signifZ, m_w_1); + m_hb_impactRZ->Fill(signifR, signifZ, m_w_1); + m_hb_impact->Fill( trackSignif[i], m_w_1); + if(trackSignif[i]>2.) m_hb_pileupRat->Fill(dRdZratio[i],1.); + if( i<DevTuple::maxNTrk && m_curTup){ + m_curTup->pttrk[i]=selectedTracks[i]->pt(); + m_curTup->Sig3D[i]=trackSignif[i]; + } + } + } + + if( m_fillHist && m_curTup ){ + m_curTup->nTrk=std::min(NTracks,DevTuple::maxNTrk); + m_curTup->n2Vrt=0; + } + + for (i=0; i<NTracks-1; i++) { + if(trackSignif[i]<m_trkSigCut || dRdZratio[i]<m_dRdZRatioCut )continue; + for (j=i+1; j<NTracks; j++) { + if(trackSignif[j]<m_trkSigCut || dRdZratio[j]<m_dRdZRatioCut )continue; + PSum2T=selectedTracks[i]->p4()+selectedTracks[j]->p4(); + if(PSum2T.M()>m_Vrt2TrMassLimit)continue; + + std::unique_ptr<Trk::IVKalState> state = m_fitSvc->makeState(); + m_fitSvc->setMassInputParticles( inpMass, *state ); // Use pion masses for fit + tracksForFit[0]=selectedTracks[i]; + tracksForFit[1]=selectedTracks[j]; + sc=m_fitSvc->VKalVrtFitFast(tracksForFit,tmpVrt.fitVertex,*state); /* Fast crude estimation*/ + + if( sc.isFailure() ) { /* No initial estimation */ + iniVrt=PrimVrt.position(); + } else { + double PMomVrtDir = ProjSV_PV(tmpVrt.fitVertex,PrimVrt,PSum2T); + if( PMomVrtDir>0. ) iniVrt=tmpVrt.fitVertex; /* Good initial estimation */ + else iniVrt=PrimVrt.position(); + } + m_fitSvc->setApproximateVertex(iniVrt.x(), iniVrt.y(), iniVrt.z(),*state); + sc=m_fitSvc->VKalVrtFit(tracksForFit, neutralPartDummy, tmpVrt.fitVertex, tmpVrt.momentum, Charge, + tmpVrt.errorMatrix, tmpVrt.chi2PerTrk, tmpVrt.trkAtVrt, tmpVrt.chi2, *state, true ); + if(sc.isFailure()) continue; /* No fit */ + double Prob2v=TMath::Prob(tmpVrt.chi2,1); + if( Prob2v < m_sel2VrtProbCut ) continue; + if( tmpVrt.momentum.M()> m_Vrt2TrMassLimit ) continue; + if( ProjSV_PV(tmpVrt.fitVertex, PrimVrt, tmpVrt.momentum) < 0.) continue; // SV-PV don't coincide with summary momentum direction + if( tmpVrt.fitVertex.perp() > m_maxSVRadiusCut) continue; // Too far from interaction point + double cosSVPV=ProjSV_PV(tmpVrt.fitVertex, PrimVrt, tmpVrt.momentum); + TLorentzVector SVPV(tmpVrt.fitVertex.x()-PrimVrt.x(), + tmpVrt.fitVertex.y()-PrimVrt.y(), + tmpVrt.fitVertex.z()-PrimVrt.z(), 10.); + if(m_fillHist){ + if(Charge==0){m_hb_massPiPi->Fill(tmpVrt.momentum.M(),1.);} + m_hb_cosSVMom->Fill(cosSVPV,1.); + m_hb_etaSV->Fill(SVPV.Eta(),1.); + } + if(cosSVPV<0.8)continue; + if(tmpVrt.momentum.Pt()<1000.)continue; + float vrtR=tmpVrt.fitVertex.perp(); +//Check close material layer + double dstMatSignif=1.e4; + if(m_removeTrkMatSignif>0. && vrtR>20.){ + if(vrtR<30.){ dstMatSignif=fabs(vrtR-m_beampipeR)/VrtRadiusError(tmpVrt.fitVertex,tmpVrt.errorMatrix );} //beampipe + else { dstMatSignif=distToMatLayerSignificance(tmpVrt);} //Material in Pixel volume + if(dstMatSignif<m_removeTrkMatSignif)continue; + } +// +// Check pixel hits vs vertex positions. + int ihitIBL = getIBLHit(selectedTracks[i]); + int jhitIBL = getIBLHit(selectedTracks[j]); + if( ihitIBL<0 && jhitIBL<0)continue; + float ihitR = selectedTracks[i]->radiusOfFirstHit(); + float jhitR = selectedTracks[j]->radiusOfFirstHit(); + if(m_useVertexCleaning){ + if(fabs(ihitR-jhitR)>15.) continue; + if( std::min(ihitR,jhitR)-vrtR > 36.) continue; // Too big dR between vertex and hit in pixel + // Should be another layer in between + if( std::max(ihitR,jhitR)-vrtR <-10.) continue; // Vertex is behind hit in pixel + } +// +// Debugging and BDT + double minPtT = std::min(tracksForFit[0]->pt(),tracksForFit[1]->pt()); + double Sig3D=0.,Sig2D=0., Dist2D=0.; + if( m_fillHist && m_curTup ){ + int ihitBL = getBLHit (selectedTracks[i]); + int jhitBL = getBLHit (selectedTracks[j]); + int idisk1=0,idisk2=0,idisk3=0,jdisk1=0,jdisk2=0,jdisk3=0; + int sumIBLHits = std::max(ihitIBL,0)+std::max(jhitIBL,0); + int sumBLHits = std::max(ihitBL, 0)+std::max(jhitBL, 0); + getPixelDiscs(selectedTracks[i],idisk1,idisk2,idisk3); + getPixelDiscs(selectedTracks[j],jdisk1,jdisk2,jdisk3); + VrtVrtDist(PrimVrt, tmpVrt.fitVertex, tmpVrt.errorMatrix, Sig3D); + Dist2D=VrtVrtDist2D(PrimVrt, tmpVrt.fitVertex, tmpVrt.errorMatrix, Sig2D); + m_hb_signif3D->Fill(Sig3D,1.); + m_curTup->VrtTrkHF [m_curTup->n2Vrt] = getIdHF(tracksForFit[0])+ getIdHF(tracksForFit[1]); + m_curTup->VrtTrkI [m_curTup->n2Vrt] = getG4Inter(tracksForFit[0])+ getG4Inter(tracksForFit[1]); + m_curTup->VrtCh [m_curTup->n2Vrt] = Charge; + m_curTup->VrtProb [m_curTup->n2Vrt] = Prob2v; + m_curTup->VrtSig3D [m_curTup->n2Vrt] = Sig3D; + m_curTup->VrtSig2D [m_curTup->n2Vrt] = Sig2D; + m_curTup->VrtDist2D[m_curTup->n2Vrt] = vrtR<20. ? Dist2D : vrtR; + m_curTup->VrtM [m_curTup->n2Vrt] = tmpVrt.momentum.M(); + m_curTup->VrtZ [m_curTup->n2Vrt] = tmpVrt.fitVertex.z(); + m_curTup->VrtPt [m_curTup->n2Vrt] = tmpVrt.momentum.Pt(); + m_curTup->VrtEta [m_curTup->n2Vrt] = SVPV.Eta(); + m_curTup->VrtIBL [m_curTup->n2Vrt] = sumIBLHits; + m_curTup->VrtBL [m_curTup->n2Vrt] = sumBLHits; + m_curTup->VrtSinSPM[m_curTup->n2Vrt] = sqrt(1.-cosSVPV*cosSVPV); + m_curTup->VMinPtT [m_curTup->n2Vrt] = minPtT; + m_curTup->VMinS3DT [m_curTup->n2Vrt] = std::min(trackSignif[i],trackSignif[j]); + m_curTup->VMaxS3DT [m_curTup->n2Vrt] = std::max(trackSignif[i],trackSignif[j]); + m_curTup->VrtBDT [m_curTup->n2Vrt] = 1.1; + m_curTup->VrtHR1 [m_curTup->n2Vrt] = ihitR; + m_curTup->VrtHR2 [m_curTup->n2Vrt] = jhitR; + m_curTup->VrtDisk [m_curTup->n2Vrt] = idisk1+10*idisk2+20*idisk3+30*jdisk1+40*jdisk2+50*jdisk3; + m_curTup->VSigMat [m_curTup->n2Vrt] = dstMatSignif; + if(m_curTup->n2Vrt<DevTuple::maxNVrt-1)m_curTup->n2Vrt++; + } +//-------------------BDT based rejection + if(tmpVrt.momentum.Pt() > m_Vrt2TrPtLimit) continue; + VrtVrtDist(PrimVrt, tmpVrt.fitVertex, tmpVrt.errorMatrix, Sig3D); + Dist2D=VrtVrtDist2D(PrimVrt, tmpVrt.fitVertex, tmpVrt.errorMatrix, Sig2D); + std::vector<float> VARS(10); + VARS[0]=Prob2v; + VARS[1]=log(tmpVrt.momentum.Pt()); + VARS[2]=log(std::max(minPtT,m_cutPt)); + VARS[3]=log(vrtR<20. ? Dist2D : vrtR); + VARS[4]=log(std::max(std::min(trackSignif[i],trackSignif[j]),m_trkSigCut)); + VARS[5]=log(std::max(trackSignif[i],trackSignif[j])); + VARS[6]=tmpVrt.momentum.M(); + VARS[7]=sqrt(fabs(1.-cosSVPV*cosSVPV)); + VARS[8]=SVPV.Eta(); + VARS[9]=std::max(ihitR,jhitR); + //VARS[9]=sumIBLHits; + //VARS[10]=sumBLHits; + //VARS[11]=std::max(Sig3D,m_selVrtSigCut); + float wgtSelect=m_SV2T_BDT->GetGradBoostMVA(VARS); + //std::vector<float> weights=m_SV2T_BDT->GetMultiResponse(VARS,3); + //float wgtSelect=weights[0]; + if( m_fillHist && m_curTup ) m_curTup->VrtBDT[m_curTup->n2Vrt-1] = wgtSelect; + if(wgtSelect<m_v2tIniBDTCut) continue; + //if(weights[2]>weights[0] && weights[2]>weights[1])continue; +// +//--- Save good candidate for multi-vertex fit +// + add_edge(i,j,*m_compatibilityGraph); + } + } + + return; + } + + +} //end of namespace diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/Utilities.cxx b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/Utilities.cxx new file mode 100755 index 0000000000000000000000000000000000000000..9377d1a92fb868ac24e8a363d891d905cd168be8 --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/Utilities.cxx @@ -0,0 +1,388 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ +/// +/// @author Vadim Kostyukhin <vadim.kostyukhin@cern.ch> +/// +// Header include +#include "NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h" +#include "TrkNeutralParameters/NeutralParameters.h" +#include "TrkTrackSummary/TrackSummary.h" +#include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" +//------------------------------------------------- +#include "TrkGeometry/TrackingGeometry.h" +#include "TrkGeometry/TrackingVolume.h" +#include "TrkGeometry/Layer.h" + // Other stuff +#include <cmath> + + +namespace Rec{ + + +// void NewVrtSecInclusiveTool::printWrkSet(const std::vector<WrkVrt> *, const & std::string ) const { + void NewVrtSecInclusiveTool::printWrkSet(const std::vector<WrkVrt> *WrkVrtSet, const std::string &name) const { + int nGoodV=0; + for(int iv=0; iv<(int)WrkVrtSet->size(); iv++) { + std::cout<<name + <<"= "<<(*WrkVrtSet)[iv].vertex[0] + <<", "<<(*WrkVrtSet)[iv].vertex[1] + <<", "<<(*WrkVrtSet)[iv].vertex[2] + <<" NTrk="<<(*WrkVrtSet)[iv].selTrk.size() + <<" is good="<<std::boolalpha<<(*WrkVrtSet)[iv].Good<<std::noboolalpha + <<" Chi2="<<(*WrkVrtSet)[iv].chi2 + <<" Mass="<<(*WrkVrtSet)[iv].vertexMom.M() + <<" detached="<<(*WrkVrtSet)[iv].detachedTrack + <<" proj.dist="<<(*WrkVrtSet)[iv].projectedVrt + <<" trk="; + for(int kk=0; kk<(int)(*WrkVrtSet)[iv].selTrk.size(); kk++) { + std::cout<<", "<<(*WrkVrtSet)[iv].selTrk[kk];} + //for(int kk=0; kk<(int)(*WrkVrtSet)[iv].selTrk.size(); kk++) { + // std::cout<<", "<<MomAtVrt((*WrkVrtSet)[iv].trkAtVrt[kk]).Perp();} + std::cout<<'\n'; + if((*WrkVrtSet)[iv].Good)nGoodV++; + } + std::cout<<name<<" N="<<nGoodV<<'\n'; + } + + /* Technicalities */ + double NewVrtSecInclusiveTool::ProjSV_PV(const Amg::Vector3D & SV, const xAOD::Vertex & PV, const TLorentzVector & Direction) const + { + TVector3 SV_PV( SV.x()-PV.x(), SV.y()-PV.y(), SV.z()-PV.z() ); + return Direction.Vect().Unit()*SV_PV.Unit(); + } + + + double NewVrtSecInclusiveTool::VrtVrtDist(const xAOD::Vertex & PrimVrt, const Amg::Vector3D & SecVrt, + const std::vector<double> SecVrtErr, double& signif) + const + { + double distx = PrimVrt.x()- SecVrt.x(); + double disty = PrimVrt.y()- SecVrt.y(); + double distz = PrimVrt.z()- SecVrt.z(); + + + AmgSymMatrix(3) PrimCovMtx=PrimVrt.covariancePosition(); //Create + PrimCovMtx(0,0) += SecVrtErr[0]; + PrimCovMtx(0,1) += SecVrtErr[1]; + PrimCovMtx(1,0) += SecVrtErr[1]; + PrimCovMtx(1,1) += SecVrtErr[2]; + PrimCovMtx(0,2) += SecVrtErr[3]; + PrimCovMtx(2,0) += SecVrtErr[3]; + PrimCovMtx(1,2) += SecVrtErr[4]; + PrimCovMtx(2,1) += SecVrtErr[4]; + PrimCovMtx(2,2) += SecVrtErr[5]; + + AmgSymMatrix(3) WgtMtx = PrimCovMtx.inverse(); + + signif = distx*WgtMtx(0,0)*distx + +disty*WgtMtx(1,1)*disty + +distz*WgtMtx(2,2)*distz + +2.*distx*WgtMtx(0,1)*disty + +2.*distx*WgtMtx(0,2)*distz + +2.*disty*WgtMtx(1,2)*distz; + signif=sqrt(fabs(signif)); + if( signif!=signif ) signif = 0.; + return sqrt(distx*distx+disty*disty+distz*distz); + } + + double NewVrtSecInclusiveTool::VrtVrtDist2D(const xAOD::Vertex & PrimVrt, const Amg::Vector3D & SecVrt, + const std::vector<double> SecVrtErr, double& signif) + const + { + double distx = PrimVrt.x()- SecVrt.x(); + double disty = PrimVrt.y()- SecVrt.y(); + + + AmgSymMatrix(3) PrimCovMtx=PrimVrt.covariancePosition(); //Create + AmgSymMatrix(2) CovMtx; + CovMtx(0,0) = PrimCovMtx(0,0) + SecVrtErr[0]; + CovMtx(0,1) = PrimCovMtx(0,1) + SecVrtErr[1]; + CovMtx(1,0) = PrimCovMtx(1,0) + SecVrtErr[1]; + CovMtx(1,1) = PrimCovMtx(1,1) + SecVrtErr[2]; + + AmgSymMatrix(2) WgtMtx = CovMtx.inverse(); + + signif = distx*WgtMtx(0,0)*distx + +disty*WgtMtx(1,1)*disty + +2.*distx*WgtMtx(0,1)*disty; + signif=sqrt(fabs(signif)); + if( signif!=signif ) signif = 0.; + return sqrt(distx*distx+disty*disty); + } + + + double NewVrtSecInclusiveTool::VrtVrtDist(const Amg::Vector3D & Vrt1, const std::vector<double> & VrtErr1, + const Amg::Vector3D & Vrt2, const std::vector<double> & VrtErr2) + const + { + double distx = Vrt1.x()- Vrt2.x(); + double disty = Vrt1.y()- Vrt2.y(); + double distz = Vrt1.z()- Vrt2.z(); + + AmgSymMatrix(3) PrimCovMtx; //Create + PrimCovMtx(0,0) = VrtErr1[0]+VrtErr2[0]; + PrimCovMtx(0,1) = PrimCovMtx(1,0) = VrtErr1[1]+VrtErr2[1]; + PrimCovMtx(1,1) = VrtErr1[2]+VrtErr2[2]; + PrimCovMtx(0,2) = PrimCovMtx(2,0) = VrtErr1[3]+VrtErr2[3]; + PrimCovMtx(1,2) = PrimCovMtx(2,1) = VrtErr1[4]+VrtErr2[4]; + PrimCovMtx(2,2) = VrtErr1[5]+VrtErr2[5]; + + AmgSymMatrix(3) WgtMtx = PrimCovMtx.inverse(); + + + double signif = + distx*WgtMtx(0,0)*distx + +disty*WgtMtx(1,1)*disty + +distz*WgtMtx(2,2)*distz + +2.*distx*WgtMtx(0,1)*disty + +2.*distx*WgtMtx(0,2)*distz + +2.*disty*WgtMtx(1,2)*distz; + signif=sqrt(fabs(signif)); + if(signif != signif) signif = 0.; + return signif; + } +// + double NewVrtSecInclusiveTool::PntPntDist(const Amg::Vector3D & Vrt1, const Amg::Vector3D & Vrt2) const + { + double dx = Vrt1.x()- Vrt2.x(); + double dy = Vrt1.y()- Vrt2.y(); + double dz = Vrt1.z()- Vrt2.z(); + return sqrt(dx*dx+dy*dy*dz*dz); + } +//-------------------------------------------------- +// significance along some direction +//-------------------------------------------------- +double NewVrtSecInclusiveTool::VrtVrtDist(const xAOD::Vertex & PrimVrt, const Amg::Vector3D & SecVrt, + const std::vector<double> SecVrtErr, const TLorentzVector & Dir) + const + { + Amg::Vector3D dir(Dir.Vect().Unit().X(), Dir.Vect().Unit().Y(), Dir.Vect().Unit().Z()); + double projDist=(SecVrt-PrimVrt.position()).dot(dir); + double distx = dir.x()*projDist; + double disty = dir.y()*projDist; + double distz = dir.z()*projDist; + + AmgSymMatrix(3) PrimCovMtx=PrimVrt.covariancePosition(); //Create + PrimCovMtx(0,0) += SecVrtErr[0]; + PrimCovMtx(0,1) += SecVrtErr[1]; + PrimCovMtx(1,0) += SecVrtErr[1]; + PrimCovMtx(1,1) += SecVrtErr[2]; + PrimCovMtx(0,2) += SecVrtErr[3]; + PrimCovMtx(2,0) += SecVrtErr[3]; + PrimCovMtx(1,2) += SecVrtErr[4]; + PrimCovMtx(2,1) += SecVrtErr[4]; + PrimCovMtx(2,2) += SecVrtErr[5]; + + AmgSymMatrix(3) WgtMtx = PrimCovMtx.inverse(); + + double signif = distx*WgtMtx(0,0)*distx + +disty*WgtMtx(1,1)*disty + +distz*WgtMtx(2,2)*distz + +2.*distx*WgtMtx(0,1)*disty + +2.*distx*WgtMtx(0,2)*distz + +2.*disty*WgtMtx(1,2)*distz; + signif=sqrt(fabs(signif)); + if( signif!=signif ) signif = 0.; + if(projDist<0)signif=-signif; + return signif; + } + +//---------------------------- +// Vertex error along radius +//---------------------------- + double NewVrtSecInclusiveTool::VrtRadiusError(const Amg::Vector3D & SecVrt, const std::vector<double> & VrtErr) const + { + double DirX=SecVrt.x(), DirY=SecVrt.y(); + double Covar = DirX*VrtErr[0]*DirX + +2.*DirX*VrtErr[1]*DirY + +DirY*VrtErr[2]*DirY; + Covar /= DirX*DirX + DirY*DirY; + Covar=sqrt(fabs(Covar)); + if(Covar != Covar) Covar = 0.; + return Covar; + } + + + /* Invariant mass calculation for V0 decays*/ + /* Gives correct mass assignment in case of nonequal masses*/ + + + double NewVrtSecInclusiveTool::massV0(const std::vector< std::vector<double> >& TrkAtVrt, + double massP, double massPi ) + const + { + double ap1i=fabs(TrkAtVrt[0][2]); double ap2i=fabs(TrkAtVrt[1][2]); + double px = cos(TrkAtVrt[0][0])*sin(TrkAtVrt[0][1])*ap1i + + cos(TrkAtVrt[1][0])*sin(TrkAtVrt[1][1])*ap2i; + double py = sin(TrkAtVrt[0][0])*sin(TrkAtVrt[0][1])*ap1i + + sin(TrkAtVrt[1][0])*sin(TrkAtVrt[1][1])*ap2i; + double pz = cos(TrkAtVrt[0][1])*ap1i + + cos(TrkAtVrt[1][1])*ap2i; + double ee= (ap1i > ap2i) ? + (sqrt(ap1i*ap1i+massP*massP)+sqrt(ap2i*ap2i+massPi*massPi)): + (sqrt(ap2i*ap2i+massP*massP)+sqrt(ap1i*ap1i+massPi*massPi)); + double test=(ee-pz)*(ee+pz)-px*px-py*py; + return test>0 ? sqrt(test) : 0.; + } + + + + TLorentzVector NewVrtSecInclusiveTool::MomAtVrt(const std::vector< double >& inpTrk) + const + { + double api=1./fabs(inpTrk[2]); + double px = cos ( inpTrk[0]) * sin(inpTrk[1])*api; + double py = sin ( inpTrk[0]) * sin(inpTrk[1])*api; + double pz = cos(inpTrk[1])*api; + double ee = sqrt( px*px + py*py + pz*pz + m_massPi*m_massPi); + return TLorentzVector(px,py,pz,ee); + } + + +/*************************************************************************************************************/ + int NewVrtSecInclusiveTool::getIBLHit(const xAOD::TrackParticle* Part) const + { + uint8_t IBLhit,IBLexp; + if(!Part->summaryValue( IBLexp, xAOD::expectInnermostPixelLayerHit) ) IBLexp = 0; + if( IBLexp==0 ) return -1; + if(!Part->summaryValue( IBLhit, xAOD::numberOfInnermostPixelLayerHits) ) IBLhit = 0; + if(IBLhit) return 1; + else return 0; + } + int NewVrtSecInclusiveTool::getBLHit(const xAOD::TrackParticle* Part) const + { + uint8_t BLhit,BLexp; + if(!Part->summaryValue( BLexp, xAOD::expectNextToInnermostPixelLayerHit) ) BLexp = 0; + if( BLexp==0 ) return -1; + if(!Part->summaryValue( BLhit, xAOD::numberOfNextToInnermostPixelLayerHits) ) BLhit = 0; + if(BLhit) return 1; + else return 0; + } + + void NewVrtSecInclusiveTool::getPixelDiscs(const xAOD::TrackParticle* Part, int &d0Hit, int &d1Hit, int &d2Hit) const + { + uint32_t HitPattern=Part->hitPattern(); + d0Hit=0; if( HitPattern&((1<<Trk::pixelEndCap0)) ) d0Hit=1; + d1Hit=0; if( HitPattern&((1<<Trk::pixelEndCap1)) ) d1Hit=1; + d2Hit=0; if( HitPattern&((1<<Trk::pixelEndCap2)) ) d2Hit=1; + } +/*************************************************************************************************************/ + + int NewVrtSecInclusiveTool::getIdHF(const xAOD::TrackParticle* TP ) const { + if( TP->isAvailable< ElementLink< xAOD::TruthParticleContainer> >( "truthParticleLink") ) { + const ElementLink<xAOD::TruthParticleContainer>& tplink = + TP->auxdata< ElementLink< xAOD::TruthParticleContainer > >("truthParticleLink"); + if( !tplink.isValid() ) return 0; + if( TP->auxdata< float >( "truthMatchProbability" ) < 0.75 ) return 0; + if( (*tplink)->barcode() > 200000) return 0; + if( (*tplink)->hasProdVtx()){ + if( (*tplink)->prodVtx()->nIncomingParticles()==1){ + int PDGID1=0, PDGID2=0, PDGID3=0; + const xAOD::TruthParticle * parTP1=getPreviousParent(*tplink, PDGID1); + const xAOD::TruthParticle * parTP2=0; + int noBC1=notFromBC(PDGID1); + if(noBC1) parTP2 = getPreviousParent(parTP1, PDGID2); + int noBC2=notFromBC(PDGID2); + if(noBC2 && parTP2) getPreviousParent(parTP2, PDGID3); + int noBC3=notFromBC(PDGID3); + if(noBC1 && noBC2 && noBC3)return 0; + return 1; //This is a reconstructed track from B/C decays + } } } + return 0; + } + + int NewVrtSecInclusiveTool::notFromBC(int PDGID) const { + int noBC=0; + if(PDGID<=0)return 1; + if(PDGID>600 && PDGID<4000)noBC=1; + if(PDGID<400 || PDGID>5600)noBC=1; + if(PDGID==513 || PDGID==523 || PDGID==533 || PDGID==543)noBC=1; //Remove tracks from B* (they are in PV) + if(PDGID==5114 || PDGID==5214 || PDGID==5224 || PDGID==5314 || PDGID==5324)noBC=1; //Remove tracks from B_Barions* (they are in PV) + //if(PDGID==413 || PDGID==423 || PDGID==433 )continue; //Keep tracks from D* (they are from B vertex) + //if(PDGID==4114 || PDGID==4214 || PDGID==4224 || PDGID==4314 || PDGID==4324)continue; + return noBC; + } + const xAOD::TruthParticle * NewVrtSecInclusiveTool::getPreviousParent(const xAOD::TruthParticle * child, int & ParentPDG) const { + ParentPDG=0; + if( child->hasProdVtx() ){ + if( child->prodVtx()->nIncomingParticles()==1 ){ + ParentPDG = abs((*(child->prodVtx()->incomingParticleLinks())[0])->pdgId()); + return *(child->prodVtx()->incomingParticleLinks())[0]; + } + } + return 0; + } + + + int NewVrtSecInclusiveTool::getG4Inter(const xAOD::TrackParticle* TP ) const { + if( TP->isAvailable< ElementLink< xAOD::TruthParticleContainer> >( "truthParticleLink") ) { + const ElementLink<xAOD::TruthParticleContainer>& tplink = + TP->auxdata< ElementLink< xAOD::TruthParticleContainer > >("truthParticleLink"); + if( tplink.isValid() && (*tplink)->barcode()>200000) return 1; + } + return 0; + } + int NewVrtSecInclusiveTool::getMCPileup(const xAOD::TrackParticle* TP ) const { + if( TP->isAvailable< ElementLink< xAOD::TruthParticleContainer> >( "truthParticleLink") ) { + const ElementLink<xAOD::TruthParticleContainer>& tplink = + TP->auxdata< ElementLink< xAOD::TruthParticleContainer > >("truthParticleLink"); + if( !tplink.isValid() ) return 1; + } else { return 1; } + return 0; + } + + double NewVrtSecInclusiveTool::distToMatLayerSignificance(Vrt2Tr & Vrt) const + { + if(Vrt.fitVertex.perp()<20.) return 1.e9; + double normP=1./Vrt.momentum.P(); + Amg::Vector3D momentumP(Vrt.momentum.Px()*normP,Vrt.momentum.Py()*normP,Vrt.momentum.Pz()*normP); + Amg::Vector3D momentumN=-momentumP; + + const Trk::Layer * someLayer = 0; + const Trk::Layer * nextLayerP = 0; + const Trk::Layer * nextLayerN = 0; + auto volume = m_extrapolator->trackingGeometry()->lowestTrackingVolume(Vrt.fitVertex); + someLayer = volume->associatedLayer(Vrt.fitVertex); + auto material = someLayer->layerMaterialProperties(); + if(material){ + nextLayerP=someLayer; + } else { + nextLayerP = someLayer->nextLayer(Vrt.fitVertex,momentumP); + if(nextLayerP){ if(!nextLayerP->layerMaterialProperties())nextLayerP=0; } + nextLayerN = someLayer->nextLayer(Vrt.fitVertex,momentumN); + if(nextLayerN){ if(!nextLayerN->layerMaterialProperties())nextLayerN=0; } + } + momentumP *= 1.e5; //100GeV to have straight trajectory + double charge = 1.; + const Trk::Perigee pseudoVrtPart(Vrt.fitVertex, momentumP, charge, Vrt.fitVertex); + + const Trk::TrackParameters * extrapParP=0; //along momentum + const Trk::TrackParameters * extrapParN=0; //backward + if(nextLayerP){ extrapParP = m_extrapolator->extrapolate(pseudoVrtPart, + nextLayerP->surfaceRepresentation(), Trk::anyDirection, false, Trk::nonInteractingMuon) ;} + if(nextLayerN){ extrapParN = m_extrapolator->extrapolate(pseudoVrtPart, + nextLayerN->surfaceRepresentation(), Trk::anyDirection, false, Trk::nonInteractingMuon) ;} + + float distanceP=1.e9, distanceN=1.e9; + if(extrapParP)distanceP=PntPntDist(extrapParP->position(), Vrt.fitVertex); + if(extrapParN)distanceN=PntPntDist(extrapParN->position(), Vrt.fitVertex); + if(distanceP==1.e9 && distanceN==1.e9) return 1.e9; + + //std::pair<const Trk::TrackParameters*,const Trk::Layer*> next= + // m_extrapolator->extrapolateToNextActiveLayer(pseudoVrtPart,Trk::anyDirection,true,Trk::pion) ; + + double signif=1.e9; + std::vector<double> pntCovar={1.e-2,0.,1.e-2,0.,0.,4.e-2}; + if(distanceP<distanceN)signif=VrtVrtDist(Vrt.fitVertex, Vrt.errorMatrix, extrapParP->position(), pntCovar); + else signif=VrtVrtDist(Vrt.fitVertex, Vrt.errorMatrix, extrapParN->position(), pntCovar); + delete extrapParP; + delete extrapParN; + return signif; + } + + + + + +} //end namespace diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/VrtSecMulti.cxx b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/VrtSecMulti.cxx new file mode 100755 index 0000000000000000000000000000000000000000..48342e3225eb6ec03c6d5f77817c7469fa764a60 --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/VrtSecMulti.cxx @@ -0,0 +1,645 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +/// +/// @author Vadim Kostyukhin <vadim.kostyukhin@cern.ch> +/// +// +// Header include +#include "NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h" +//------------------------------------------------- +// Other stuff +#include "AnalysisUtils/AnalysisMisc.h" +#include "GeoPrimitives/GeoPrimitivesHelpers.h" +#include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" +#include "MVAUtils/BDT.h" + +#include "boost/graph/bron_kerbosch_all_cliques.hpp" +#include "TMath.h" +#include "TH1.h" + +#include <algorithm> +// + + +namespace Rec{ + + + std::vector<xAOD::Vertex*> NewVrtSecInclusiveTool::getVrtSecMulti( workVectorArrxAOD * xAODwrk, + const xAOD::Vertex & PrimVrt ) + const + { + + const double probVrtMergeLimit=0.01; + + int inpNPart=0; + int i,j; + inpNPart=xAODwrk->inpTrk.size(); + std::vector<const xAOD::NeutralParticle*> neutralPartDummy(0); + ATH_MSG_DEBUG( "getVrtSecMulti() called with NPart=" << inpNPart); + + std::vector<xAOD::Vertex*> finalVertices(0); + + if( inpNPart < 2 ) { return finalVertices;} // 0,1 track => nothing to do! + + + long int NTracks = 0; + selGoodTrkParticle( xAODwrk, PrimVrt); + NTracks = xAODwrk->listSelTracks.size(); + + if( NTracks < 2 ) { return finalVertices;} // 0,1 selected track => nothing to do! + + ATH_MSG_DEBUG( "Number of selected tracks = " <<NTracks); + + if(m_fillHist){ m_hb_ntrksel->Fill( (double) NTracks, m_w_1); } + +// +// inpTrk[] - input track list +// listSelTracks[] - list of good tracks in jet for vertex search +//------------------------------------------------------------ +// Initial track list ready +// Find 2track vertices +// + + select2TrVrt(xAODwrk->listSelTracks, PrimVrt); + +//--- + ATH_MSG_DEBUG(" Defined edges in the graph="<< num_edges(*m_compatibilityGraph)); + +// +// m_Incomp[] - main vector of pointers for multivertex search +//----------------------------------------------------------------------------------------------------- +// Secondary track list is ready +// Creation of initial vertex set +// + + + std::vector<WrkVrt> *WrkVrtSet= new std::vector<WrkVrt>; + WrkVrt newvrt; newvrt.Good=true; + std::unique_ptr<Trk::IVKalState> state = m_fitSvc->makeState(); + StatusCode sc; sc.setChecked(); + long int NPTR=0, nth=2; // VK nth=2 to speed up PGRAPH when it's used + + + std::vector< std::vector<int> > allCliques; + bron_kerbosch_all_cliques(*m_compatibilityGraph, clique_visitor(allCliques)); + for(int cq=0; cq<(int)allCliques.size();cq++){ + newvrt.selTrk.clear(); + NPTR=allCliques[cq].size(); + for(i=0;i<NPTR;i++){ newvrt.selTrk.push_back(allCliques[cq][i]);} +//================================================== + xAODwrk->tmpListTracks.clear(); + TLorentzVector vpsum; + for(i=0;i<NPTR;i++) { + xAODwrk->tmpListTracks.push_back( xAODwrk->listSelTracks.at(newvrt.selTrk[i]) ); + vpsum += xAODwrk->listSelTracks.at(newvrt.selTrk[i])->p4(); + } + sc = m_fitSvc->VKalVrtFitFast(xAODwrk->tmpListTracks,newvrt.vertex,*state); /* Fast crude estimation*/ + + if( sc.isFailure() ) { /* No initial estimation */ + m_fitSvc->setApproximateVertex(PrimVrt.x(), PrimVrt.y(), PrimVrt.z(),*state); /*Use as starting point*/ + } else { + Amg::Vector3D vDist=newvrt.vertex-PrimVrt.position(); + double MomVrtDir = vpsum.Px()*vDist.x() + vpsum.Py()*vDist.y() + vpsum.Pz()*vDist.z(); + if( MomVrtDir>0. ) { /* Good initial estimation */ + m_fitSvc->setApproximateVertex(newvrt.vertex.x(),newvrt.vertex.y(),newvrt.vertex.z(),*state); /*Use as starting point*/ + }else{ + m_fitSvc->setApproximateVertex(PrimVrt.x(), PrimVrt.y(), PrimVrt.z(),*state); + } + } +// std::cout<<"FoundAppVrt="<<newvrt.vertex[0]<<", "<<newvrt.vertex[1]<<", "<<newvrt.vertex[2]<<'\n'; + sc = StatusCode::FAILURE; + sc=m_fitSvc->VKalVrtFit(xAODwrk->tmpListTracks, neutralPartDummy, + newvrt.vertex, newvrt.vertexMom, newvrt.vertexCharge, newvrt.vertexCov, + newvrt.chi2PerTrk, newvrt.trkAtVrt, newvrt.chi2, + *state, false); + +// std::cout << "Res="<<newvrt.chi2<<", "<<NPTR<<", "<<newvrt.selTrk[0]<<", "<<newvrt.selTrk[1]<<'\n'; + if( sc.isFailure() ) continue; /* Bad fit - goto next solution */ + if(NPTR==2 && newvrt.chi2>10.) continue; /* Bad 2track vertex */ + if(newvrt.chi2PerTrk.size()==2) newvrt.chi2PerTrk[0]=newvrt.chi2PerTrk[1]=newvrt.chi2/2.; + newvrt.Good = true; + newvrt.nCloseVrt = 0; + newvrt.dCloseVrt = 1000000.; + newvrt.projectedVrt=MomProjDist(newvrt.vertex, PrimVrt, newvrt.vertexMom); //3D SV-PV distance + WrkVrtSet->push_back(newvrt); + } +//================================================================================== +// boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS>::vertex_iterator vertexIt, vertexEnd; +// boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS>::adjacency_iterator neighbourIt, neighbourEnd; +// tie(vertexIt, vertexEnd) = vertices(*m_compatibilityGraph); +// for (; vertexIt != vertexEnd; ++vertexIt) { std::cout << *vertexIt << " is connected with "; +// tie(neighbourIt, neighbourEnd) = adjacent_vertices(*vertexIt, *m_compatibilityGraph); +// for (; neighbourIt != neighbourEnd; ++neighbourIt) std::cout << *neighbourIt << " "; std::cout << "\n"; } +//================================================================================== +//========= Initial cleaning of solutions +//-Remove worst track from vertices with very bad Chi2 + bool disassembled=false; + int NSoluI=0; + do{ + disassembled=false; + NSoluI=(*WrkVrtSet).size(); + for(int iv=0; iv<NSoluI; iv++){ + if(!(*WrkVrtSet)[iv].Good || (*WrkVrtSet)[iv].selTrk.size() == 2 ) continue; + if( TMath::Prob( (*WrkVrtSet)[iv].chi2, 2*(*WrkVrtSet)[iv].selTrk.size()-3) <1.e-3){ + //printWrkSet(WrkVrtSet,"BigChi2Vertex present"); + DisassembleVertex(WrkVrtSet,iv,xAODwrk->listSelTracks,*state); + disassembled=true; + } } + }while(disassembled); +//-Modify too heavy vertices + for(auto & iv : (*WrkVrtSet)){ + if( iv.vertexMom.M()>m_VrtMassLimit ) { + int it_bad=mostHeavyTrk(iv,xAODwrk->listSelTracks); + if(it_bad>-1){ + iv.selTrk.erase( iv.selTrk.begin() + it_bad ); + refitVertex(iv, xAODwrk->listSelTracks, *state, false); + } } } +//-Remove vertices fully contained in other vertices + while( (*WrkVrtSet).size()>1 ){ + int tmpN=(*WrkVrtSet).size(); int iv=0; + for(; iv<tmpN-1; iv++){ int jv=iv+1; + if(!(*WrkVrtSet)[iv].Good ) continue; + for(; jv<tmpN; jv++){ + if(!(*WrkVrtSet)[jv].Good ) continue; + int nTCom=nTrkCommon( WrkVrtSet, iv, jv); + if( nTCom==(int)(*WrkVrtSet)[iv].selTrk.size()){ (*WrkVrtSet).erase((*WrkVrtSet).begin()+iv); break; } + else if( nTCom==(int)(*WrkVrtSet)[jv].selTrk.size()){ (*WrkVrtSet).erase((*WrkVrtSet).begin()+jv); break; } + } if(jv!=tmpN) break; // One vertex is erased. Restart check + } if(iv==tmpN-1) break; // No vertex deleted + } +// +//- Try to merge all vertices with common tracks + std::multimap<int,std::pair<int,int>> vrtWithCommonTrk; + std::multimap<int,std::pair<int,int>>::reverse_iterator icvrt; + do{ + NSoluI=(*WrkVrtSet).size(); + vrtWithCommonTrk.clear(); + for(int iv=0; iv<NSoluI-1; iv++ ){ for(int jv=iv+1; jv<NSoluI; jv++){ + if(!(*WrkVrtSet)[iv].Good || !(*WrkVrtSet)[jv].Good) continue; + int nTCom=nTrkCommon( WrkVrtSet, iv, jv); if(!nTCom)continue; + vrtWithCommonTrk.emplace(nTCom,std::make_pair(iv,jv)); + } } + //============================== DEBUG output + //printWrkSet(WrkVrtSet,"InitialVrts"); + //for(auto ku : vrtWithCommonTrk)std::cout<<" nCom="<<ku.first<<" v1="<<ku.second.first<<" v2="<<ku.second.second<<'\n'; + //=========================================== + for(icvrt=vrtWithCommonTrk.rbegin(); icvrt!=vrtWithCommonTrk.rend(); icvrt++){ + int nTCom=(*icvrt).first; + int iv=(*icvrt).second.first; + int jv=(*icvrt).second.second; + int nTrkI=(*WrkVrtSet)[iv].selTrk.size(); + int nTrkJ=(*WrkVrtSet)[jv].selTrk.size(); + double probV=-1.; + probV=mergeAndRefitVertices( WrkVrtSet, iv, jv, newvrt, xAODwrk->listSelTracks, *state); + ////std::cout<<" ntcommon="<<(*icvrt).first<<" prb="<<probV<<" itrk="<<nTrkI<<" jtrk="<<nTrkJ<<'\n'; + if(newvrt.vertexMom.M()>m_VrtMassLimit) continue; //Do not merge vertices if summary one is too heavy + if(probV<probVrtMergeLimit){ + if(nTrkI==2 || nTrkJ==2 || nTCom<2) continue; + if((nTCom>nTrkI-nTCom || nTCom>nTrkJ-nTCom)){ //2 and more common tracks for NTr>=3 vertices. Merge anyway. + mergeAndRefitOverlapVertices( WrkVrtSet, iv, jv, xAODwrk->listSelTracks, *state); + break; //Vertex list is changed. Restart merging from scratch. + } + continue; //Continue merging loop + } + newvrt.Good = true; + (*WrkVrtSet).push_back(newvrt); + (*WrkVrtSet)[iv].Good=false; + (*WrkVrtSet)[jv].Good=false; + break; //Merging successful. Break merging loop and remake list of connected vertices + } + } while( icvrt != vrtWithCommonTrk.rend() ); + if(m_fillHist){ int cvgood=0; for(int iv=0; iv<(int)(*WrkVrtSet).size(); iv++) if((*WrkVrtSet)[iv].Good)cvgood++; + m_hb_rawVrtN->Fill( (float)cvgood, m_w_1); } +// +//-Remove all bad vertices from the working set + int tmpV=0; while( tmpV<(int)(*WrkVrtSet).size() )if( !(*WrkVrtSet)[tmpV].Good ) { (*WrkVrtSet).erase((*WrkVrtSet).begin()+tmpV);} else {tmpV++;} + if((*WrkVrtSet).size()==0){ // No vertices at all + delete WrkVrtSet; + return finalVertices; + } + //------ + //printWrkSet(WrkVrtSet,"Interm"); + //------ + for( auto &tmpV : (*WrkVrtSet) ) tmpV.projectedVrt=MomProjDist(tmpV.vertex, PrimVrt, tmpV.vertexMom ); //Setup ProjectedVrt +//---------------------------------------------------------------------------- +// Here we have the overlapping solutions. +// Vertices may have only 1 common track. +// Now solution cleaning + + int nGoodVertices=0; // Final number of good vertices + int n2trVrt=0; // N of vertices with 2 tracks + int nNtrVrt=0; // N vertices with 3 and more tracks + std::vector< std::deque<long int> > *TrkInVrt =new std::vector< std::deque<long int> >(NTracks); + double foundMaxT; long int SelectedTrack, SelectedVertex; + int foundV1, foundV2; + + trackClassification( WrkVrtSet, TrkInVrt); + + state = m_fitSvc->makeState(); + while((foundMaxT=maxOfShared( WrkVrtSet, TrkInVrt, SelectedTrack, SelectedVertex))>0) { + //std::cout << "MAX="<<foundMaxT<<", "<<SelectedTrack<<", "<<SelectedVertex<<'\n'; + //std::cout << "VRT="<<minVrtVrtDist( WrkVrtSet, foundV1, foundV2)<<", "<<foundV1<<", "<<foundV2<<'\n'; + //printWrkSet(WrkVrtSet,"Iterat"); + + double foundMinVrtDst = 1000000.; + if(foundMaxT<m_trackDetachCut) foundMinVrtDst = minVrtVrtDist( WrkVrtSet, foundV1, foundV2); + +//Choice of action + if( foundMaxT<m_trackDetachCut && foundMinVrtDst<m_vertexMergeCut && nTrkCommon( WrkVrtSet, foundV1, foundV2)){ + //if( foundMaxT<m_trackDetachCut && foundMinVrtDst<m_vertexMergeCut){ + bool vrtMerged=false; //to check whether something is really merged + while(foundMinVrtDst<m_vertexMergeCut){ + if(foundV1<foundV2) { int tmp=foundV1; foundV1=foundV2; foundV2=tmp;} /*Always drop vertex with smallest number*/ + double probV=0.; + probV=mergeAndRefitVertices( WrkVrtSet, foundV1, foundV2, newvrt, xAODwrk->listSelTracks, *state); + if(probV>probVrtMergeLimit && newvrt.vertexMom.M()<m_VrtMassLimit){ // Good merged vertex found + double tstDst=MomProjDist(newvrt.vertex, PrimVrt, newvrt.vertexMom); + if(tstDst>0.){ // only positive vertex directions are accepted as merging result + std::swap((*WrkVrtSet)[foundV1],newvrt); + (*WrkVrtSet)[foundV1].projectedVrt=tstDst; + (*WrkVrtSet)[foundV2].Good=false; //Drop vertex + (*WrkVrtSet)[foundV2].selTrk.clear(); //Clean dropped vertex + vrtMerged=true; + } + } + (*WrkVrtSet)[foundV1].nCloseVrt=-1; (*WrkVrtSet)[foundV1].dCloseVrt=1000000.; //For minVrtVrtDistNext optimisation(!) + (*WrkVrtSet)[foundV2].nCloseVrt=-1; (*WrkVrtSet)[foundV2].dCloseVrt=1000000.; //Exclude given pair + foundMinVrtDst=minVrtVrtDistNext( WrkVrtSet, foundV1, foundV2); //Check other vertices + } + if(vrtMerged){ + delete TrkInVrt; + TrkInVrt = new std::vector< std::deque<long int> >(NTracks); + trackClassification( WrkVrtSet, TrkInVrt); + continue; // Something was merged => goto next cycle. Otherwise break the found track-vertex link + } + } + removeTrackFromVertex(WrkVrtSet, TrkInVrt, SelectedTrack, SelectedVertex); + sc = refitVertex( WrkVrtSet, SelectedVertex, xAODwrk->listSelTracks, *state, false); + if( sc.isFailure() ) { (*WrkVrtSet)[SelectedVertex].Good=false; continue; } //bad vertex + (*WrkVrtSet)[SelectedVertex].projectedVrt=MomProjDist((*WrkVrtSet)[SelectedVertex].vertex, PrimVrt, (*WrkVrtSet)[SelectedVertex].vertexMom); + if( (*WrkVrtSet)[SelectedVertex].projectedVrt<0. && (*WrkVrtSet)[SelectedVertex].selTrk.size()==2 ) + (*WrkVrtSet)[SelectedVertex].Good=false; // 2track vertex migrates behind PV - drop it. + //std::cout<<"Dropped v="<<SelectedVertex<<" dst="<<(*WrkVrtSet)[SelectedVertex].projectedVrt<<'\n'; + } +// +// Final check/merge for close vertices +// + double minDistVV=minVrtVrtDist( WrkVrtSet, foundV1, foundV2); //recalculate VV distances + while ( minDistVV < m_vertexMergeCut) { + if(foundV1<foundV2) { int tmp=foundV1; foundV1=foundV2; foundV2=tmp;} + double probV=0.; + probV=mergeAndRefitVertices( WrkVrtSet, foundV1, foundV2, newvrt, xAODwrk->listSelTracks, *state); + if(probV>probVrtMergeLimit && newvrt.vertexMom.M()<m_VrtMassLimit){ // Good merged vertex found + double tstDst=MomProjDist(newvrt.vertex, PrimVrt, newvrt.vertexMom); + if(tstDst>0.){ // only positive vertex directions are accepted as merging result + std::swap((*WrkVrtSet)[foundV1],newvrt); + (*WrkVrtSet)[foundV1].projectedVrt=tstDst; + (*WrkVrtSet)[foundV2].Good=false; //Drop vertex + (*WrkVrtSet)[foundV2].selTrk.clear(); //Clean dropped vertex + } + } + (*WrkVrtSet)[foundV1].nCloseVrt=-1; (*WrkVrtSet)[foundV1].dCloseVrt=1000000.; //For minVrtVrtDistNext optimisation(!) + (*WrkVrtSet)[foundV2].nCloseVrt=-1; (*WrkVrtSet)[foundV2].dCloseVrt=1000000.; //Exclude given pair + minDistVV=minVrtVrtDistNext( WrkVrtSet, foundV1, foundV2); + } +// +// Try to improve vertices with big Chi2 if something went wrong. Just precaution. + for(int iv=0; iv<(int)WrkVrtSet->size(); iv++) { + if(!(*WrkVrtSet)[iv].Good ) continue; //don't work on vertex which is already bad + if( (*WrkVrtSet)[iv].selTrk.size()<3 ) continue; + double tmpProb=TMath::Prob( (*WrkVrtSet)[iv].chi2, 2*(*WrkVrtSet)[iv].selTrk.size()-3 ); //Chi2 of the original vertex + if(tmpProb<m_globVrtProbCut){ + tmpProb=improveVertexChi2( WrkVrtSet, iv, xAODwrk->listSelTracks, *state, false); + if(tmpProb<m_globVrtProbCut)(*WrkVrtSet)[iv].Good=false; + (*WrkVrtSet)[iv].projectedVrt=MomProjDist((*WrkVrtSet)[iv].vertex, PrimVrt, (*WrkVrtSet)[iv].vertexMom); + } + } + // + //printWrkSet(WrkVrtSet,"Joined"); +//-------------------------------------------------------------------------------------------------------- +// Final vertex selection/cleaning +// + state = m_fitSvc->makeState(); + double signif3D=0., signif2D=0., vProb=0.; + //double Dist3D=0; + +//--------- Start with 1-track vertices +//=First check if the track was detached from a multitrack vertex. If so - reattach. + for(auto &ntrVrt : (*WrkVrtSet)){ if(!ntrVrt.Good || ntrVrt.selTrk.size()<=1) continue; + for(auto &onetVrt : (*WrkVrtSet)){ if(!onetVrt.Good || onetVrt.selTrk.size()!=1) continue; + if(ntrVrt.detachedTrack==onetVrt.selTrk[0]){ + WrkVrt newV(ntrVrt); newV.selTrk.push_back(ntrVrt.detachedTrack); + vProb = refitVertex( newV, xAODwrk->listSelTracks, *state, true); + if( vProb>probVrtMergeLimit && newV.vertexMom.M()<m_VrtMassLimit ){ onetVrt.Good=false; ntrVrt=newV; ntrVrt.detachedTrack=-1;} + break; + } } } +//=Recheck if the track was detached from a 2track vertex. If so - reattach. + for(auto &iVrt : (*WrkVrtSet)){ if(!iVrt.Good || iVrt.selTrk.size()!=1) continue; + for(auto &jVrt : (*WrkVrtSet)){ if(!jVrt.Good || jVrt.selTrk.size()!=1) continue; + if(iVrt.detachedTrack==jVrt.selTrk[0]){ + WrkVrt newV(iVrt); newV.selTrk.push_back(iVrt.detachedTrack); + vProb = refitVertex( newV, xAODwrk->listSelTracks, *state, true); + if( vProb>probVrtMergeLimit && newV.vertexMom.M()<m_VrtMassLimit ){ jVrt.Good=false; iVrt=newV; iVrt.detachedTrack=-1;} + break; + } } } + for(auto &ntrVrt : (*WrkVrtSet)){ if(!ntrVrt.Good || ntrVrt.selTrk.size()<=1) continue; + for(auto tr : ntrVrt.selTrk){ + for(auto &onetVrt : (*WrkVrtSet)){ if(!onetVrt.Good || onetVrt.selTrk.size()!=1) continue; + if(onetVrt.detachedTrack==tr){ + WrkVrt newV(ntrVrt); newV.selTrk.push_back(onetVrt.selTrk[0]); + vProb = refitVertex( newV, xAODwrk->listSelTracks, *state, true); + if( vProb>probVrtMergeLimit && newV.vertexMom.M()<m_VrtMassLimit ){ onetVrt.Good=false; ntrVrt=newV;} + } } } } + for(auto & curVrt : (*WrkVrtSet) ) { + if(!curVrt.Good ) continue; //don't work on vertex which is already bad + if(curVrt.selTrk.size() != 1) continue; + curVrt.Good=false; // Make them bad by default + if(m_multiWithOneTrkVrt){ /* 1track vertices left unassigned from good 2tr vertices */ + VrtVrtDist(PrimVrt,curVrt.vertex, curVrt.vertexCov, signif3D); //VK non-projected signif3D is worse + double tmpProb=TMath::Prob( curVrt.chi2, 1); //Chi2 of the original 2tr vertex + if(tmpProb>0.01){ /* accept only good tracks coming from good 2tr vertex*/ + std::vector<double> impact,impactError; double signif3DP = 0; + signif3DP=m_fitSvc->VKalGetImpact(xAODwrk->listSelTracks[curVrt.selTrk[0]],PrimVrt.position(), 1, impact, impactError, *state); + if(m_fillHist){ + m_hb_diffPS->Fill( signif3DP, m_w_1); + m_hb_sig3D1tr->Fill( signif3D, m_w_1); + } + if( signif3DP>2.*m_trkSigCut && signif3D>m_selVrtSigCut) curVrt.Good=true; // accept only tracks which are far from PV + } + } + } +//----- Vertices with >1 tracks + for(int iv=0; iv<(int)WrkVrtSet->size(); iv++) { + WrkVrt & curVrt=(*WrkVrtSet)[iv]; + if(!curVrt.Good ) continue; //don't work on vertex which is already bad + nth=(*WrkVrtSet)[iv].selTrk.size(); if(nth == 1) continue; // 1track vertices are treated already + VrtVrtDist(PrimVrt,curVrt.vertex, curVrt.vertexCov, signif3D); + xAODwrk->tmpListTracks.resize(nth); + for(i=0;i<nth;i++) { + xAODwrk->tmpListTracks[i]=xAODwrk->listSelTracks[curVrt.selTrk[i]]; + } + (*WrkVrtSet)[iv].Good = false; /* Make all vertices bad for futher selection */ + if(nth <= 1) continue; /* Definitely bad vertices */ + if((*WrkVrtSet)[iv].projectedVrt<0.) continue; /* Remove vertices behind primary one */ + if( TMath::Prob( curVrt.chi2, 2*nth-3)<m_globVrtProbCut) continue; /* Bad Chi2 of refitted vertex */ +//----------------------------------------------------------------------------------------- + if(m_fillHist){ + if(nth==2 && curVrt.vertexCharge==0) m_hb_massPiPi1->Fill(curVrt.vertexMom.M(), m_w_1); + m_hb_sig3DTot->Fill( signif3D, m_w_1); + if(nth==2)m_hb_sig3D2tr->Fill( signif3D, m_w_1); + if(nth >2)m_hb_sig3DNtr->Fill( signif3D, m_w_1); + } +// +//--- Check V0s and conversions ??? +/* if(nth==2 && curVrt.vertexCharge==0 && curVrt.detachedTrack<0){ + double mass_PiPi = curVrt.vertexMom.M(); + double mass_PPi = massV0(curVrt.trkAtVrt,m_massP,m_massPi); + double mass_EE = massV0(curVrt.trkAtVrt,m_massE,m_massE); + if(m_fillHist){ m_hb_massPiPi->Fill( mass_PiPi, m_w_1); + m_hb_massPPi ->Fill( mass_PPi, m_w_1); + if( curVrt.vertex.perp()>20.)m_hb_massEE ->Fill( mass_EE, m_w_1); } + if( fabs(mass_PiPi-m_massK0) < 22.) continue; + if( fabs(mass_PPi-m_massLam) < 8.) continue; + if( mass_EE < 60. && curVrt.vertex.perp() > 20.) continue; + } +*/ +//--- + if(signif3D<m_selVrtSigCut+1.) continue; //Main PV-SV distance quality cut + if(curVrt.vertex.perp() > m_maxSVRadiusCut) continue; // Too far from interaction point +//--- + curVrt.Good = true; /* Vertex is absolutely good */ + } +//------------------------------------------- +// Debug ntuple filling and BDT application +// + std::vector<double> impact,impactError; + for(int iv=0; iv<(int)WrkVrtSet->size(); iv++) { + WrkVrt & curVrt=(*WrkVrtSet)[iv]; + nth=curVrt.selTrk.size(); + if(!curVrt.Good ) continue; //don't work on vertex which is already bad + double minPtT=1.e6, minSig3DT=1.e6, maxSig3DT=0.; + int ntrkBC=0,ntrkI=0,sumIBLHits=0,sumBLHits=0; + for(i=0;i<nth;i++) { + j=curVrt.selTrk[i]; /*Track number*/ + minPtT=std::min( minPtT, xAODwrk->listSelTracks[j]->pt()); + m_fitSvc->VKalGetImpact(xAODwrk->listSelTracks[j], PrimVrt.position(), 1, impact, impactError); + double SigR2 = impact[0]*impact[0]/impactError[0]; + double SigZ2 = impact[1]*impact[1]/impactError[2]; + minSig3DT=std::min( minSig3DT, sqrt( SigR2 + SigZ2) ); + maxSig3DT=std::max( maxSig3DT, sqrt( SigR2 + SigZ2) ); + sumIBLHits += std::max(getIBLHit(xAODwrk->listSelTracks[j]),0); + sumBLHits += std::max(getBLHit(xAODwrk->listSelTracks[j]),0); + if(m_fillHist && m_curTup) { + ntrkBC += getIdHF(xAODwrk->listSelTracks[j]); + ntrkI += getG4Inter(xAODwrk->listSelTracks[j]); + } + } + float vProb=TMath::Prob(curVrt.chi2, 2*nth-3); + float cosSVPVM=ProjSV_PV(curVrt.vertex, PrimVrt, curVrt.vertexMom); + float vrtR=curVrt.vertex.perp(); + TLorentzVector SVPV(curVrt.vertex.x()-PrimVrt.x(),curVrt.vertex.y()-PrimVrt.y(),curVrt.vertex.z()-PrimVrt.z(), 10.); + if(m_fillHist){ + if( m_curTup && nth>1 ){ + VrtVrtDist(PrimVrt,curVrt.vertex, curVrt.vertexCov, signif3D); + float Dist2D=VrtVrtDist2D(PrimVrt,curVrt.vertex, curVrt.vertexCov, signif2D); + m_curTup->NVrtTrk [m_curTup->nNVrt] = nth; + m_curTup->NVrtTrkHF [m_curTup->nNVrt] = ntrkBC; + m_curTup->NVrtTrkI [m_curTup->nNVrt] = ntrkI; + m_curTup->NVrtProb [m_curTup->nNVrt] = vProb; + m_curTup->NVrtSig3D [m_curTup->nNVrt] = signif3D; + m_curTup->NVrtSig2D [m_curTup->nNVrt] = signif2D; + m_curTup->NVrtDist2D[m_curTup->nNVrt] = vrtR<20. ? Dist2D : vrtR; + m_curTup->NVrtM [m_curTup->nNVrt] = curVrt.vertexMom.M(); + m_curTup->NVrtPt [m_curTup->nNVrt] = curVrt.vertexMom.Pt(); + m_curTup->NVrtEta [m_curTup->nNVrt] = SVPV.Eta(); + m_curTup->NVrtIBL [m_curTup->nNVrt] = sumIBLHits; + m_curTup->NVrtBL [m_curTup->nNVrt] = sumBLHits; + m_curTup->NVrtSinSPM[m_curTup->nNVrt] = sqrt(1.-cosSVPVM*cosSVPVM); + m_curTup->NVrtCh [m_curTup->nNVrt] = curVrt.vertexCharge; + m_curTup->NVMinPtT [m_curTup->nNVrt] = minPtT; + m_curTup->NVMinS3DT [m_curTup->nNVrt] = minSig3DT; + m_curTup->NVrtBDT [m_curTup->nNVrt] = 1.1; + if( m_curTup->nNVrt < DevTuple::maxNVrt-1 )m_curTup->nNVrt++; + } + } +//-------------------BDT based rejection + if(nth==2){ + if(curVrt.vertexMom.Pt() > m_Vrt2TrPtLimit){ curVrt.Good = false; continue; } + float rhit0=xAODwrk->listSelTracks[curVrt.selTrk[0]]->radiusOfFirstHit(); + float rhit1=xAODwrk->listSelTracks[curVrt.selTrk[1]]->radiusOfFirstHit(); + VrtVrtDist(PrimVrt,curVrt.vertex, curVrt.vertexCov, signif3D); + float Dist2D=VrtVrtDist2D(PrimVrt,curVrt.vertex, curVrt.vertexCov, signif2D); + std::vector<float> VARS(10); + VARS[0]=vProb; + VARS[1]=log(curVrt.vertexMom.Pt()); + VARS[2]=log(std::max(minPtT,m_cutPt)); + VARS[3]=log(vrtR<20. ? Dist2D : vrtR); + VARS[4]=log(std::max(minSig3DT,m_trkSigCut)); + VARS[5]=log(maxSig3DT); + VARS[6]=curVrt.vertexMom.M(); + VARS[7]=sqrt(fabs(1.-cosSVPVM*cosSVPVM)); + VARS[8]=SVPV.Eta(); + VARS[9]=std::max(rhit0,rhit1); + //VARS[9]=sumIBLHits; + //VARS[10]=sumBLHits; + //VARS[4]=std::max(signif3D,m_selVrtSigCut); + float wgtSelect=m_SV2T_BDT->GetGradBoostMVA(VARS); + //std::vector<float> weights=m_SV2T_BDT->GetMultiResponse(VARS,3); + //float wgtSelect=weights[0]; + if(m_fillHist){ + m_hb_fakeSVBDT->Fill(wgtSelect,1.); + if( m_curTup ) m_curTup->NVrtBDT[m_curTup->nNVrt-1] = wgtSelect; + } + if(wgtSelect<m_v2tFinBDTCut) curVrt.Good = false; + } + } +// +//--Final cleaning of the 1-track vertices set. Must be behind all other cleanings. +//-- Debug ntuple for 1track vertex is filled here as well +// + if(m_multiWithOneTrkVrt) Clean1TrVertexSet(WrkVrtSet); + if(m_fillHist && m_curTup && m_multiWithOneTrkVrt){ + for(auto & V : (*WrkVrtSet)) { + nth=V.selTrk.size(); + if( !V.Good || nth != 1 ) continue; // Good 1track vertices + m_fitSvc->VKalGetImpact(xAODwrk->listSelTracks[V.selTrk[0]], PrimVrt.position(), 1, impact, impactError); + int ntrkBC = getIdHF(xAODwrk->listSelTracks[V.selTrk[0]]); + double SigR2 = impact[0]*impact[0]/impactError[0]; + double SigZ2 = impact[1]*impact[1]/impactError[2]; + float Dist2D=VrtVrtDist2D(PrimVrt,V.vertex, V.vertexCov, signif2D); + m_curTup->NVrtTrk [m_curTup->nNVrt] = nth; + m_curTup->NVrtTrkHF [m_curTup->nNVrt] = ntrkBC; + m_curTup->NVrtProb [m_curTup->nNVrt] = TMath::Prob(V.chi2, 1); + m_curTup->NVrtSig3D [m_curTup->nNVrt] = 0.; + m_curTup->NVrtSig2D [m_curTup->nNVrt] = signif2D; + m_curTup->NVrtDist2D[m_curTup->nNVrt] = Dist2D; + m_curTup->NVrtM [m_curTup->nNVrt] = V.vertexMom.M(); + m_curTup->NVrtPt [m_curTup->nNVrt] = V.vertexMom.Pt(); + m_curTup->NVrtSinSPM[m_curTup->nNVrt] = 0.; + m_curTup->NVrtCh [m_curTup->nNVrt] = V.vertexCharge; + m_curTup->NVMinPtT [m_curTup->nNVrt] = xAODwrk->listSelTracks[V.selTrk[0]]->pt(); + m_curTup->NVMinS3DT [m_curTup->nNVrt] = sqrt(SigR2 + SigZ2); + m_curTup->NVrtBDT [m_curTup->nNVrt] = 1.1; + if( m_curTup->nNVrt < DevTuple::maxNVrt-1 )m_curTup->nNVrt++; + } } +//------------------------------------------- +//Checks + std::vector<WrkVrt> GoodVertices(0); + nGoodVertices=0; // Final number of good vertices + n2trVrt=nNtrVrt=0; // N of vertices with different amount of tracks + for(auto & iv : (*WrkVrtSet) ) { + nth=iv.selTrk.size(); if(nth == 0) continue; /* Definitely bad vertices */ + if( iv.Good) { + nGoodVertices++; + GoodVertices.emplace_back(iv); /* add it */ + if(nth==2)n2trVrt++; + if(nth>=3)nNtrVrt++; + } + } + if(nGoodVertices == 0 || (n2trVrt+nNtrVrt)==0){ // No good vertices at all + delete WrkVrtSet; delete TrkInVrt; + if(m_fillHist && m_curTup ) m_curTup->nNVrt=0; + return finalVertices; + } +// +//sorting + while(1){ bool swapDone=false; // Sort on XY distance from (0.,0.) + for(int iv=0; iv<(int)GoodVertices.size()-1; iv++) { + if( GoodVertices[iv].vertex.perp() > GoodVertices[iv+1].vertex.perp()){ + std::swap( GoodVertices[iv], GoodVertices[iv+1] ); + swapDone=true; + } + } if(!swapDone) break; + } + while(1){ bool swapDone=false; // Then sort on Projected dist if R<20. + for(int iv=0; iv<(int)GoodVertices.size()-1; iv++) { + if(GoodVertices[iv+1].vertex.perp() > 400.) continue; + if(GoodVertices[iv].projectedVrt > GoodVertices[iv+1].projectedVrt){ + std::swap( GoodVertices[iv], GoodVertices[iv+1] ); + swapDone=true; + } + } if(!swapDone) break; + } + if(nGoodVertices>1){ + if( GoodVertices[1].vertexMom.M()-GoodVertices[0].vertexMom.M() > 5000.) std::swap( GoodVertices[0], GoodVertices[1] ); + } + if(m_fillHist){m_hb_distVV->Fill( minVrtVrtDist( WrkVrtSet, foundV1, foundV2), m_w_1); } +//------------------------------------------- +// Saving and final cleaning +// + nGoodVertices=0; // Final number of good vertices + int n1trVrt=0; // Final number of good 1-track vertices + TLorentzVector VertexMom; + for(int iv=0; iv<(int)GoodVertices.size(); iv++) { + nth=GoodVertices[iv].selTrk.size(); + xAODwrk->tmpListTracks.clear(); + for(i=0;i<nth;i++) { + j=GoodVertices[iv].selTrk[i]; /*Track number*/ + xAODwrk->tmpListTracks.push_back( xAODwrk->listSelTracks[j] ); + } + if(m_fillHist){ + m_hb_totmass->Fill(GoodVertices[iv].vertexMom.M(), m_w_1); + m_hb_r2d->Fill( GoodVertices[iv].vertex.perp(), m_w_1); } +// xAOD::Vertex creation----------------------------- + xAOD::Vertex * tmpVertex=new xAOD::Vertex(); + tmpVertex->makePrivateStore(); + tmpVertex->setPosition(GoodVertices[iv].vertex); + int NERMS=GoodVertices[iv].vertexCov.size(); + NERMS=6; + std::vector<float> floatErrMtx; floatErrMtx.resize(NERMS); + for(int i=0; i<NERMS; i++) floatErrMtx[i]=GoodVertices[iv].vertexCov[i]; + tmpVertex->setCovariance(floatErrMtx); + tmpVertex->setFitQuality(GoodVertices[iv].chi2, (float)(nth*2-3)); + + std::vector<Trk::VxTrackAtVertex> & tmpVTAV=tmpVertex->vxTrackAtVertex(); tmpVTAV.clear(); + for(int ii=0; ii<nth; ii++) { + AmgSymMatrix(5) *CovMtxP=new AmgSymMatrix(5); (*CovMtxP).setIdentity(); + Trk::Perigee * tmpMeasPer = new Trk::Perigee( 0.,0., GoodVertices[iv].trkAtVrt[ii][0], + GoodVertices[iv].trkAtVrt[ii][1], + GoodVertices[iv].trkAtVrt[ii][2], + Trk::PerigeeSurface(GoodVertices[iv].vertex), CovMtxP ); + tmpVTAV.push_back( Trk::VxTrackAtVertex( 1., tmpMeasPer) ); + if(xAODwrk){ //No way to store a link to Rec::TrackParticleContainer + ElementLink<xAOD::TrackParticleContainer> TEL; TEL.setElement( xAODwrk->tmpListTracks[ii] ); + const xAOD::TrackParticleContainer* cont = (const xAOD::TrackParticleContainer* ) (xAODwrk->tmpListTracks[ii]->container() ); + TEL.setStorableObject(*cont); + tmpVertex->addTrackAtVertex(TEL,1.); + } + } + finalVertices.push_back(tmpVertex); +//----- + nGoodVertices++; + if(nth==1)n1trVrt++; +//----- + VertexMom += GoodVertices[iv].vertexMom; + } + if(m_fillHist){ + m_hb_goodvrtN->Fill( nGoodVertices+0.1, m_w_1); + m_hb_goodvrt1N->Fill( n1trVrt+0.1, m_w_1); + } + + + if(nGoodVertices == 0){ + delete WrkVrtSet; + delete TrkInVrt; + return finalVertices; + } + +//----------------------------------------------------------------------------------- +// Saving of results +// +// + + + delete WrkVrtSet; delete TrkInVrt; + + return finalVertices; + + + } + + +} //end namespace + + diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/components/NewVrtSecInclusiveTool_entries.cxx b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/components/NewVrtSecInclusiveTool_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..245d17b9d69d448ffb1fbb235aebb787298a3f1f --- /dev/null +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/components/NewVrtSecInclusiveTool_entries.cxx @@ -0,0 +1,7 @@ +#include "NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h" + +using namespace Rec; + +DECLARE_COMPONENT( NewVrtSecInclusiveTool ) + + diff --git a/Reconstruction/egamma/egammaLayerRecalibTool/Root/egammaLayerRecalibTool.cxx b/Reconstruction/egamma/egammaLayerRecalibTool/Root/egammaLayerRecalibTool.cxx index bfda8784ded409b5d5f433068d3101fd7458826b..363ce2e54d4047790a3a165367bf01e8ba8821c5 100644 --- a/Reconstruction/egamma/egammaLayerRecalibTool/Root/egammaLayerRecalibTool.cxx +++ b/Reconstruction/egamma/egammaLayerRecalibTool/Root/egammaLayerRecalibTool.cxx @@ -805,7 +805,7 @@ void egammaLayerRecalibTool::add_scale(InputModifier* modifier, GetAmountBase* a CP::CorrectionCode egammaLayerRecalibTool::scale_inputs(StdCalibrationInputs & inputs) const { CP::CorrectionCode status = CP::CorrectionCode::Ok; - for (const auto modifier : m_modifiers) { + for (const auto& modifier : m_modifiers) { const float amount = (*modifier.second)(inputs); const auto s = (*modifier.first)(inputs, amount); if (s != CP::CorrectionCode::Ok) { diff --git a/Reconstruction/egamma/egammaMVACalib/CMakeLists.txt b/Reconstruction/egamma/egammaMVACalib/CMakeLists.txt index 65284af0c5d22bc0c17438fbce653776ffae397f..44b718d49f1f6aaf44b88081fc11f2a368b7afe4 100644 --- a/Reconstruction/egamma/egammaMVACalib/CMakeLists.txt +++ b/Reconstruction/egamma/egammaMVACalib/CMakeLists.txt @@ -7,12 +7,14 @@ atlas_subdir( egammaMVACalib ) # Extra dependencies for Athena capable builds: set( extra_dep ) +set( extra_libs ) if( XAOD_STANDALONE ) set( extra_dep Control/xAODRootAccess) else() set( extra_dep GaudiKernel Reconstruction/egamma/egammaInterfaces) + set( extra_libs egammaInterfacesLib ) endif() @@ -36,7 +38,7 @@ atlas_add_library( egammaMVACalibLib egammaMVACalib/*.h Root/*.cxx PUBLIC_HEADERS egammaMVACalib INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODCaloEvent xAODEgamma xAODTracking) + LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODCaloEvent xAODEgamma xAODTracking ${extra_libs} ) if( NOT XAOD_STANDALONE ) atlas_add_component( egammaMVACalib diff --git a/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.cxx b/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.cxx index 6a7f5e0c28295757baaa0fdadd8cc27fe90ef8b6..4f3850b9d5726cfeb826b7e0393614ebbfb35272 100644 --- a/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.cxx +++ b/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.cxx @@ -729,6 +729,31 @@ StatusCode EgammaMonitoring::finalize() { ATH_CHECK(recoPhotonConvIsoFixedCutTightCaloOnlyEfficiency.divide( recoPhotonConvIsoFixedCutTightCaloOnly.get(), truthPhotonConvRecoConv.get())); egammaMonitoring::EfficiencyPlot recoPhotonConvIsoFixedCutLooseEfficiency("recoPhotonConvIsoFixedCutLooseEfficiency", "/MONITORING/recoPhotonConvIsoFixedCutLooseEfficiency/", rootHistSvc ); ATH_CHECK(recoPhotonConvIsoFixedCutLooseEfficiency.divide( recoPhotonConvIsoFixedCutLoose.get(), truthPhotonConvRecoConv.get())); + + egammaMonitoring::WidthPlot truthPhotonRecoPhotonWidth("truthPhotonRecoPhotonWidth", "/MONITORING/truthPhotonRecoPhotonWidth/", rootHistSvc); + ATH_CHECK(truthPhotonRecoPhotonWidth.fill(truthPhotonRecoPhoton.get())); + egammaMonitoring::WidthPlot truthPhotonConvPhotonWidth("truthPhotonConvPhotonWidth", "/MONITORING/truthPhotonConvPhotonWidth/", rootHistSvc); + ATH_CHECK(truthPhotonConvPhotonWidth.fill(truthPhotonConvPhoton.get())); + egammaMonitoring::WidthPlot truthPhotonConvRecoConvWidth("truthPhotonConvRecoConvWidth", "/MONITORING/truthPhotonConvRecoConvWidth/", rootHistSvc); + ATH_CHECK(truthPhotonConvRecoConvWidth.fill(truthPhotonConvRecoConv.get())); + egammaMonitoring::WidthPlot truthPhotonConvRecoConv1SiWidth("truthPhotonConvRecoConv1SiWidth", "/MONITORING/truthPhotonConvRecoConv1SiWidth/", rootHistSvc); + ATH_CHECK(truthPhotonConvRecoConv1SiWidth.fill(truthPhotonConvRecoConv1Si.get())); + egammaMonitoring::WidthPlot truthPhotonConvRecoConv1TRTWidth("truthPhotonConvRecoConv1TRTWidth", "/MONITORING/truthPhotonConvRecoConv1TRTWidth/", rootHistSvc); + ATH_CHECK(truthPhotonConvRecoConv1TRTWidth.fill(truthPhotonConvRecoConv1TRT.get())); + egammaMonitoring::WidthPlot truthPhotonConvRecoConv2SiWidth("truthPhotonConvRecoConv2SiWidth", "/MONITORING/truthPhotonConvRecoConv2SiWidth/", rootHistSvc); + ATH_CHECK(truthPhotonConvRecoConv2SiWidth.fill(truthPhotonConvRecoConv2Si.get())); + egammaMonitoring::WidthPlot truthPhotonConvRecoConv2TRTWidth("truthPhotonConvRecoConv2TRTWidth", "/MONITORING/truthPhotonConvRecoConv2TRTWidth/", rootHistSvc); + ATH_CHECK(truthPhotonConvRecoConv2TRTWidth.fill(truthPhotonConvRecoConv2TRT.get())); + egammaMonitoring::WidthPlot truthPhotonConvRecoConv2SiTRTWidth("truthPhotonConvRecoConv2SiTRTWidth", "/MONITORING/truthPhotonConvRecoConv2SiTRTWidth/", rootHistSvc); + ATH_CHECK(truthPhotonConvRecoConv2SiTRTWidth.fill(truthPhotonConvRecoConv2SiTRT.get())); + egammaMonitoring::WidthPlot truthPhotonConvRecoUnconvWidth("truthPhotonConvRecoUnconvWidth", "/MONITORING/truthPhotonConvRecoUnconvWidth/", rootHistSvc); + ATH_CHECK(truthPhotonConvRecoUnconvWidth.fill(truthPhotonConvRecoUnconv.get())); + egammaMonitoring::WidthPlot truthPhotonUnconvPhotonWidth("truthPhotonUnconvPhotonWidth", "/MONITORING/truthPhotonUnconvPhotonWidth/", rootHistSvc); + ATH_CHECK(truthPhotonUnconvPhotonWidth.fill(truthPhotonUnconvPhoton.get())); + egammaMonitoring::WidthPlot truthPhotonUnconvRecoConvWidth("truthPhotonUnconvRecoConvWidth", "/MONITORING/truthPhotonUnconvRecoConvWidth/", rootHistSvc); + ATH_CHECK(truthPhotonUnconvRecoConvWidth.fill(truthPhotonUnconvRecoConv.get())); + egammaMonitoring::WidthPlot truthPhotonUnconvRecoUnconvWidth("truthPhotonUnconvRecoUnconvWidth", "/MONITORING/truthPhotonUnconvRecoUnconvWidth/", rootHistSvc); + ATH_CHECK(truthPhotonUnconvRecoUnconvWidth.fill(truthPhotonUnconvRecoUnconv.get())); } return StatusCode::SUCCESS; diff --git a/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.h b/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.h index 73990419790f47015cd40b8ac28f3d8ad453c74a..2c46cc99f3bb23232c87a2acac758d8b5ee7481b 100644 --- a/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.h +++ b/Reconstruction/egamma/egammaValidation/src/EgammaMonitoring.h @@ -44,6 +44,7 @@ #include "ShowerShapesHistograms.h" #include "ClusterHistograms.h" #include "EfficiencyPlot.h" +#include "WidthPlot.h" #include "IsolationHistograms.h" #include "IsolationSelection/IIsolationSelectionTool.h" diff --git a/Reconstruction/egamma/egammaValidation/src/TruthPhotonHistograms.cxx b/Reconstruction/egamma/egammaValidation/src/TruthPhotonHistograms.cxx index 7fec9899d04b0dd250c5e9b4b03347d123f781e9..04f3686451ed992312f0bbf62839cc076de57ba0 100644 --- a/Reconstruction/egamma/egammaValidation/src/TruthPhotonHistograms.cxx +++ b/Reconstruction/egamma/egammaValidation/src/TruthPhotonHistograms.cxx @@ -19,8 +19,24 @@ StatusCode TruthPhotonHistograms::initializePlots() { histoMap["convRadius"] = new TH1D(Form("%s_%s",m_name.c_str(),"convRadius"), ";Conversion Radius [mm]; Conversion Radius Events", 14, m_cR_bins); + histoMap["resolution_e"] = new TH1D(Form("%s_%s", m_name.c_str(), "resolution_e"), "; E_{reco} - E_{true} / E_{truth}; Events", 40, -0.2, 0.2); + histoMap["resolution_pT"] = new TH1D(Form("%s_%s", m_name.c_str(), "resolution_pT"), "; p_{T}_{reco} - p_{T}_{true} / p_{T}_{truth}; Events", 40, -0.2, 0.2); + histoMap["resolution_eta"] = new TH1D(Form("%s_%s", m_name.c_str(), "resolution_eta"), "; #eta_{reco} - #eta_{true}; Events", 20, -0.05, 0.05); + histoMap["resolution_phi"] = new TH1D(Form("%s_%s", m_name.c_str(), "resolution_phi"), "; #phi_{reco} - #phi_{true}; Events", 20, -0.05, 0.05); + + histo2DMap["resolution_e_vs_pT"] = new TH2D(Form("%s_%s",m_name.c_str(),"resolution_e_vs_pT"), ";p_{T};E_{reco} - E_{true} / E_{truth}", 40, 0, 200, 160, -0.2, 0.2); + histo2DMap["resolution_e_vs_eta"] = new TH2D(Form("%s_%s",m_name.c_str(),"resolution_e_vs_eta"), ";#eta;E_{reco} - E_{true} / E_{truth}", 20, 0, 3, 160, -0.2, 0.2); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"convRadius", histoMap["convRadius"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"resolution_e", histoMap["resolution_e"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"resolution_pT", histoMap["resolution_pT"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"resolution_eta", histoMap["resolution_eta"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"resolution_phi", histoMap["resolution_phi"])); + + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"resolution_e_vs_pT", histo2DMap["resolution_e_vs_pT"])); + ATH_CHECK(m_rootHistSvc->regHist(m_folder+"resolution_e_vs_eta", histo2DMap["resolution_e_vs_eta"])); + return StatusCode::SUCCESS; } @@ -28,16 +44,20 @@ StatusCode TruthPhotonHistograms::initializePlots() { void TruthPhotonHistograms::fill(const xAOD::IParticle& phrec) { float trueR = -999; + float res_e = -999; + float res_pT = -999; + float res_eta = -999; + float res_phi = -999; ParticleHistograms::fill(phrec); - const xAOD::TruthParticle *tmp = xAOD::TruthHelpers::getTruthParticle(phrec); + const xAOD::TruthParticle *truth = xAOD::TruthHelpers::getTruthParticle(phrec); - if (tmp) { - if (tmp->pdgId() == 22 && tmp->hasDecayVtx()) { + if (truth) { + if (truth->pdgId() == 22 && truth->hasDecayVtx()) { - float x = tmp->decayVtx()->x(); - float y = tmp->decayVtx()->y(); + float x = truth->decayVtx()->x(); + float y = truth->decayVtx()->y(); trueR = std::sqrt( x*x + y*y ); } @@ -45,5 +65,27 @@ void TruthPhotonHistograms::fill(const xAOD::IParticle& phrec) { histoMap["convRadius"]->Fill(trueR); + // access reco photon from the xAOD::TruthParticle (can't use the IParticle* here) + auto truthParticle = dynamic_cast<const xAOD::TruthParticle*>(&phrec); + if (truthParticle) { + const xAOD::Photon *photon = xAOD::EgammaHelpers::getRecoPhoton(truthParticle); + + if (photon) { + res_e = (photon->e() - truth->e())/truth->e(); + res_pT = (photon->pt() - truth->pt())/truth->pt(); + res_eta = photon->eta() - truth->eta(); + res_phi = photon->phi() - truth->phi(); + + } + } + + histoMap["resolution_e"]->Fill(res_e); + histoMap["resolution_pT"]->Fill(res_pT); + histoMap["resolution_eta"]->Fill(res_eta); + histoMap["resolution_phi"]->Fill(res_phi); + + histo2DMap["resolution_e_vs_pT"]->Fill(phrec.pt()/1000., res_e); + histo2DMap["resolution_e_vs_eta"]->Fill(std::abs(phrec.eta()), res_e); + } // fill diff --git a/Reconstruction/egamma/egammaValidation/src/TruthPhotonHistograms.h b/Reconstruction/egamma/egammaValidation/src/TruthPhotonHistograms.h index 20a7d3d260dff691d6cdb3938a9d863d18c04650..57f371e4dbbaaa782ac2fa11f3a01c4f1247e0b6 100644 --- a/Reconstruction/egamma/egammaValidation/src/TruthPhotonHistograms.h +++ b/Reconstruction/egamma/egammaValidation/src/TruthPhotonHistograms.h @@ -8,6 +8,7 @@ //#include "xAODEgamma/Photon.h" //#include "xAODEgamma/PhotonContainer.h" #include "ParticleHistograms.h" +#include "TH2D.h" namespace xAOD{ class IParticle; } @@ -20,6 +21,8 @@ namespace egammaMonitoring { using ParticleHistograms::ParticleHistograms; using ParticleHistograms::initializePlots; + std::map<std::string, TH2D* > histo2DMap; + StatusCode initializePlots(); using ParticleHistograms::fill; diff --git a/Reconstruction/egamma/egammaValidation/src/WidthPlot.cxx b/Reconstruction/egamma/egammaValidation/src/WidthPlot.cxx new file mode 100644 index 0000000000000000000000000000000000000000..6360ce859dda99a5fc4539c1848a295cf4c9dcda --- /dev/null +++ b/Reconstruction/egamma/egammaValidation/src/WidthPlot.cxx @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#include "WidthPlot.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/Property.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ITHistSvc.h" +#include "AthenaBaseComps/AthAlgorithm.h" +#include "AsgTools/AnaToolHandle.h" + +#include "TruthPhotonHistograms.h" +#include "widthestimators.h" + +using namespace widthestimators; + +namespace egammaMonitoring { + + WidthPlot::WidthPlot(std::string name, std::string folder, ITHistSvc * &rootHistSvc ) : + m_name(name), + m_folder(folder), + m_rootHistSvc(rootHistSvc) { + + } + + + + StatusCode WidthPlot::fill( IHistograms *input) { + + gROOT->ForceStyle(); + gStyle->SetOptStat(0); + + TruthPhotonHistograms *histograms = dynamic_cast<TruthPhotonHistograms*>(input); + + for ( const auto &p : histograms->histo2DMap ) { + TH1D *hist68 = new TH1D(Form("%s_%s",m_name.c_str(),p.first.c_str()), Form("; %s ; resolution", p.second->GetXaxis()->GetTitle()), p.second->GetXaxis()->GetNbins(), p.second->GetXaxis()->GetXmin(), p.second->GetXaxis()->GetXmax()); + + + for (int bin = 1; bin <= p.second->GetXaxis()->GetNbins(); bin++) { + TH1D *proj = p.second->ProjectionY(Form("%s_%d_projection", p.first.c_str(), bin), bin, bin+1); + + double s68 = binned::s68(proj); + hist68->SetBinContent(bin, s68); + + } + + ATH_CHECK(m_rootHistSvc->regHist(Form("%sWidth_%s", m_folder.c_str(), p.first.c_str()), hist68)); + + } + + return StatusCode::SUCCESS; + + } // + + +} // namespace diff --git a/Reconstruction/egamma/egammaValidation/src/WidthPlot.h b/Reconstruction/egamma/egammaValidation/src/WidthPlot.h new file mode 100644 index 0000000000000000000000000000000000000000..77347b24c5d8510737999748b7cbfa044fd246e8 --- /dev/null +++ b/Reconstruction/egamma/egammaValidation/src/WidthPlot.h @@ -0,0 +1,36 @@ +/* +Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef EGAMMAVALIDATION_WIDTHPLOTS_H +#define EGAMMAVALIDATION_WIDTHPLOTS_H + +#include "TH1.h" +#include "GaudiKernel/ITHistSvc.h" +#include "IHistograms.h" + +#include <TROOT.h> +#include <TStyle.h> + +namespace egammaMonitoring{ + + class WidthPlot{ + public: + + WidthPlot(std::string name, std::string folder, ITHistSvc * &rootHistSvc ) ; + ~WidthPlot(){ }; + StatusCode fill(IHistograms *input); + + + private: + std::string m_name; + std::string m_folder; + ITHistSvc* m_rootHistSvc = nullptr; + + }; + +} + +#endif + + diff --git a/Reconstruction/egamma/egammaValidation/src/widthestimators.h b/Reconstruction/egamma/egammaValidation/src/widthestimators.h new file mode 100644 index 0000000000000000000000000000000000000000..0a3a66af4e19894641bf524f3e2129ca6ee10530 --- /dev/null +++ b/Reconstruction/egamma/egammaValidation/src/widthestimators.h @@ -0,0 +1,107 @@ +/** + * How to use in C++ + * ================= + * + * Just include this header. It depends on ROOT + * + * Example: + * + * #include <iostream> + * #include "widthestimators.h" + * + * using widthestimators; + * + * int main() + * { + * TH1F h("h", "h", 100, -5, 5); + * h.FillRandom("gaus"); + * std::cout << "s68 : " << binned::s68(h) << std::endl; + * return 0; + * } + * + **/ + +#include <utility> +#include <vector> +#include <numeric> +#include <iostream> +#include <algorithm> + +namespace widthestimators +{ + const double PROB_1SIGMA = 0.683; + + namespace binned + { + /** cumulative sum (e.g. (non-normalized) empirical CDF) */ + // need to use template, and not TH1, since GetArray is implemeted for each specialization + // but not in TH1 + template <typename T> + std::vector<double> get_cum_sum(const T &histo, bool normed = false) + { + // use double since it can weighted + std::vector<double> cum_sum(histo->GetNbinsX() + 2); + + std::partial_sum( + histo->GetArray(), + histo->GetArray() + histo->GetNbinsX() + 2, + cum_sum.begin()); + + if (normed) + { + const double last_value = cum_sum.back(); + std::transform(cum_sum.begin(), cum_sum.end(), cum_sum.begin(), + [&last_value](auto &c) { return c / last_value; }); + } + + return cum_sum; + } + + /** return smallest window (first value, second value) containing prob fraction of the events */ + template <typename T> + std::pair<double, double> find_window(const T &histo, double prob = PROB_1SIGMA) + { + if (histo->GetNbinsX() <= 3) + { + return std::make_pair<double>(0, 0); + } + + std::vector<double> cum_sum = get_cum_sum(histo, true); + double min_width = histo->GetBinCenter(histo->GetNbinsX()) - histo->GetBinCenter(1); + std::pair<int, int> window_bin(0, histo->GetNbinsX() + 1); + + for (int ibin = 0; ibin != histo->GetNbinsX() + 1; ++ibin) + { + const double target_prob = prob + cum_sum[ibin]; + if (target_prob > 1) + break; + + const auto up_it = std::upper_bound(cum_sum.begin() + ibin, cum_sum.end(), target_prob); + const auto end_bin = std::distance(cum_sum.begin(), up_it); + const double width = histo->GetBinCenter(end_bin) - histo->GetBinCenter(ibin); + + if (width < min_width) + { + min_width = width; + window_bin.first = ibin; + window_bin.second = end_bin; + } + } + return std::make_pair<double>(histo->GetBinCenter(window_bin.first), histo->GetBinCenter(window_bin.second)); + } + + template <typename T> + double smallest_interval(const T &histo, double prob = PROB_1SIGMA) + { + const auto window = find_window(histo, prob); + return 0.5 * (window.second - window.first); + } + + template <typename T> + double s68(const T &histo) { return smallest_interval(histo, PROB_1SIGMA); } + + template <typename T> + double s90(const T &histo) { return smallest_interval(histo, 0.90); } + + } // namespace binned +} // namespace widthestimators \ No newline at end of file diff --git a/Reconstruction/iPat/iPatRecAlgs/CMakeLists.txt b/Reconstruction/iPat/iPatRecAlgs/CMakeLists.txt index 5662b32a28975a8e706dd7acbbf45e7db3476a73..4de69c698796f225694136f74a09e0c0f823e24c 100644 --- a/Reconstruction/iPat/iPatRecAlgs/CMakeLists.txt +++ b/Reconstruction/iPat/iPatRecAlgs/CMakeLists.txt @@ -42,7 +42,7 @@ atlas_add_component( iPatRecAlgs src/IntersectorTest.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel iPatRecEvent iPatTrack GeoPrimitives xAODEventInfo InDetPrepRawData iPatInterfaces iPatTrackParameters iPatUtility TrkSurfaces TrkMaterialOnTrack TrkMeasurementBase TrkParameters TrkSpacePoint TrkTrack TrkTruthData TrkExInterfaces TrkExUtils TrkFitterInterfaces ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel iPatRecEvent iPatTrack GeoPrimitives xAODEventInfo InDetPrepRawData iPatInterfaces iPatTrackParameters iPatUtility TrkSurfaces TrkMaterialOnTrack TrkMeasurementBase TrkParameters TrkSpacePoint TrkTrack TrkTruthData TrkExInterfaces TrkExUtils TrkFitterInterfaces GenInterfacesLib ) # Install files from the package: atlas_install_headers( iPatRecAlgs ) diff --git a/Reconstruction/iPat/iPatTrackFinder/CMakeLists.txt b/Reconstruction/iPat/iPatTrackFinder/CMakeLists.txt index 40fb3fddad192ea1b0471dac29aeab51ff65f0ae..d3ea26d24e2d49868cba915de2e2f6b0c61b0cae 100644 --- a/Reconstruction/iPat/iPatTrackFinder/CMakeLists.txt +++ b/Reconstruction/iPat/iPatTrackFinder/CMakeLists.txt @@ -44,7 +44,7 @@ atlas_add_component( iPatTrackFinder src/TrackFinder.cxx src/TrackManager.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps Identifier EventPrimitives GaudiKernel InDetPrepRawData iPatInterfaces iPatTrack InDetReadoutGeometry PixelReadoutGeometry MagFieldElements MagFieldConditions iPatGeometry iPatTrackParameters iPatUtility TrkPrepRawData TrkSpacePoint VxVertex EventContainers StoreGateLib) + LINK_LIBRARIES AthenaBaseComps Identifier EventPrimitives GaudiKernel InDetPrepRawData iPatInterfaces iPatTrack InDetReadoutGeometry PixelReadoutGeometry MagFieldElements MagFieldConditions iPatGeometry iPatTrackParameters iPatUtility TrkPrepRawData TrkSpacePoint VxVertex EventContainers StoreGateLib BeamSpotConditionsData ) # Install files from the package: atlas_install_headers( iPatTrackFinder ) diff --git a/Reconstruction/iPat/iPatTruthTrajectory/CMakeLists.txt b/Reconstruction/iPat/iPatTruthTrajectory/CMakeLists.txt index f75b270d248c9763ad35497c2cde06dbf298be98..0454c2e135d2f1e36d203d99bbebd47dbaf7065e 100644 --- a/Reconstruction/iPat/iPatTruthTrajectory/CMakeLists.txt +++ b/Reconstruction/iPat/iPatTruthTrajectory/CMakeLists.txt @@ -28,7 +28,7 @@ atlas_add_component( iPatTruthTrajectory src/TruthParameters.cxx src/components/*.cxx INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel iPatInterfaces iPatTrackParameters TrkExUtils GeneratorObjects TrkSurfaces TrkExInterfaces ) + LINK_LIBRARIES ${HEPPDT_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel iPatInterfaces iPatTrackParameters TrkExUtils GeneratorObjects TrkSurfaces TrkExInterfaces GenInterfacesLib ) # Install files from the package: atlas_install_headers( iPatTruthTrajectory ) diff --git a/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx b/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx index 317f3826676a9df2d249ec8cced356e841a6a278..576467c47f4f3d56964aa9e39b6b6cb47e6908b3 100644 --- a/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx +++ b/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx @@ -15,7 +15,7 @@ #include <sstream> #include <cstdlib> -//________________________________________ + std::string TauRecToolBase::find_file(const std::string& fname) const { std::string full_path; //offline calib files are in GroupData @@ -24,8 +24,6 @@ std::string TauRecToolBase::find_file(const std::string& fname) const { if(full_path=="") full_path = PathResolverFindCalibFile(fname); return full_path; } - -//________________________________________ StatusCode TauRecToolBase::readConfig() { // Sanity check to see if property ConfigPath is declared for a tool. Might be // removed once all tools are updated to have a config path declared. @@ -124,21 +122,16 @@ StatusCode TauRecToolBase::readConfig() { return StatusCode::SUCCESS; } -//________________________________________ TauRecToolBase::TauRecToolBase(const std::string& name) : asg::AsgTool(name) { declareProperty("inTrigger", m_in_trigger=false); - //generally set via tauRec/tauRecFlags.py - //specifically in tauRec/TauRecConfigured.py declareProperty("calibFolder", m_tauRecToolsTag="tauRecTools/00-02-00/"); } -//________________________________________ StatusCode TauRecToolBase::initialize(){ return StatusCode::SUCCESS; } -//________________________________________ StatusCode TauRecToolBase::eventInitialize(){ return StatusCode::SUCCESS; } @@ -149,6 +142,18 @@ StatusCode TauRecToolBase::execute(xAOD::TauJet&) const { return StatusCode::FAILURE; } +#ifdef XAOD_ANALYSIS +StatusCode TauRecToolBase::executeDev(xAOD::TauJet&) { + ATH_MSG_ERROR("function not implemented"); + return StatusCode::FAILURE; +} +#else +StatusCode TauRecToolBase::executePi0CreateROI(xAOD::TauJet& /*pTau*/, CaloCellContainer& /*caloCellContainer*/, std::vector<CaloCell*>& /*map*/ ) { + ATH_MSG_ERROR("function not implemented"); + return StatusCode::FAILURE; +} +#endif + StatusCode TauRecToolBase::executeVertexFinder(xAOD::TauJet&, const xAOD::VertexContainer*, const xAOD::TrackParticleContainer*) const { ATH_MSG_ERROR("function not implemented"); return StatusCode::FAILURE; @@ -174,13 +179,6 @@ StatusCode TauRecToolBase::executeShotFinder(xAOD::TauJet& /*pTau*/, xAOD::CaloC return StatusCode::FAILURE; } -#ifndef XAOD_ANALYSIS -StatusCode TauRecToolBase::executePi0CreateROI(xAOD::TauJet& /*pTau*/, CaloCellContainer& /*caloCellContainer*/, std::vector<CaloCell*>& /*map*/ ) { - ATH_MSG_ERROR("function not implemented"); - return StatusCode::FAILURE; -} -#endif - StatusCode TauRecToolBase::executePi0ClusterCreator(xAOD::TauJet& /*pTau*/, xAOD::PFOContainer& /*neutralPFOContainer*/, xAOD::PFOContainer& /*hadronicPFOContainer*/, xAOD::CaloClusterContainer& /*caloClusterContainer*/, @@ -209,12 +207,10 @@ StatusCode TauRecToolBase::executePanTau(xAOD::TauJet& /*pTau*/, xAOD::ParticleC return StatusCode::FAILURE; } -//________________________________________ -StatusCode TauRecToolBase::eventFinalize() const { +StatusCode TauRecToolBase::eventFinalize() { return StatusCode::SUCCESS; } -//________________________________________ StatusCode TauRecToolBase::finalize(){ return StatusCode::SUCCESS; } diff --git a/Reconstruction/tauRecTools/Root/TauTrackClassifier.cxx b/Reconstruction/tauRecTools/Root/TauTrackClassifier.cxx index 707628fa60318be4074d8b67033fcf45c0c9de9f..5150e1ca4ffc76d2e6461baf29144d7792f7c3be 100644 --- a/Reconstruction/tauRecTools/Root/TauTrackClassifier.cxx +++ b/Reconstruction/tauRecTools/Root/TauTrackClassifier.cxx @@ -37,20 +37,10 @@ StatusCode TauTrackClassifier::initialize() { ATH_MSG_DEBUG("intialize classifiers"); - #ifdef ROOTCORE - for (auto cClassifierName : m_vClassifierNames){ - tauRecTools::TrackMVABDT* mva_tool = dynamic_cast<tauRecTools::TrackMVABDT*> (asg::ToolStore::get(cClassifierName)); - ToolHandle< tauRecTools::TrackMVABDT > handle(mva_tool); - m_vClassifier.push_back(handle); - ATH_CHECK(m_vClassifier.back()->initialize());//retrieve() does not seem to work - } - #else for (auto cClassifier : m_vClassifier){ ATH_MSG_INFO("TauTrackClassifier tool : " << cClassifier ); ATH_CHECK(cClassifier.retrieve()); } - #endif - return StatusCode::SUCCESS; } diff --git a/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h b/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h index 729963cbb9c89d35c3140f69a3e7607de9d3bfae..7eaf8a88137d3672ee926e1817b2ae973dd6fa11 100644 --- a/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h +++ b/Reconstruction/tauRecTools/tauRecTools/ITauToolBase.h @@ -55,9 +55,6 @@ class ITauToolBase : virtual public asg::IAsgTool virtual StatusCode executeTrackClassifier(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer) const = 0; virtual StatusCode executeRNNTrackClassifier(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer) = 0; virtual StatusCode executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& shotClusterContainer, xAOD::PFOContainer& PFOContainer ) = 0; -#ifndef XAOD_ANALYSIS - virtual StatusCode executePi0CreateROI(xAOD::TauJet& pTau, CaloCellContainer& caloCellContainer, std::vector<CaloCell*>& map ) = 0; -#endif virtual StatusCode executePi0ClusterCreator(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer, xAOD::PFOContainer& hadronicPFOContainer, xAOD::CaloClusterContainer& caloClusterContainer, @@ -67,10 +64,18 @@ class ITauToolBase : virtual public asg::IAsgTool virtual StatusCode executePi0nPFO(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer) = 0; virtual StatusCode executePanTau(xAOD::TauJet& pTau, xAOD::ParticleContainer& particleContainer) =0; +#ifdef XAOD_ANALYSIS + // non-const version is needed in THOR + virtual StatusCode executeDev(xAOD::TauJet& pTau) = 0; +#else + // CaloCellContainer not available in AnalysisBase + virtual StatusCode executePi0CreateROI(xAOD::TauJet& pTau, CaloCellContainer& caloCellContainer, std::vector<CaloCell*>& map ) = 0; +#endif + //----------------------------------------------------------------- //! Event finalizer - called at the end of each event //----------------------------------------------------------------- - virtual StatusCode eventFinalize() const = 0; + virtual StatusCode eventFinalize() = 0; //----------------------------------------------------------------- //! Finalizer diff --git a/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h b/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h index b500aa199675113bd41aa66b2dfaf3e9bd1ccaf5..1498f49d9f2de2c896769a6c91640d757820fcd3 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauRecToolBase.h @@ -40,6 +40,11 @@ class TauRecToolBase : public asg::AsgTool, virtual public ITauToolBase { //! Execute - called for each tau candidate //----------------------------------------------------------------- virtual StatusCode execute(xAOD::TauJet& pTau) const override; +#ifdef XAOD_ANALYSIS + virtual StatusCode executeDev(xAOD::TauJet& pTau) override; +#else + virtual StatusCode executePi0CreateROI(xAOD::TauJet& pTau, CaloCellContainer& caloCellContainer, std::vector<CaloCell*>& map ) override; +#endif virtual StatusCode executeVertexFinder(xAOD::TauJet& pTau, const xAOD::VertexContainer* vertexContainer = nullptr, const xAOD::TrackParticleContainer* trackContainer = nullptr) const override; @@ -47,9 +52,6 @@ class TauRecToolBase : public asg::AsgTool, virtual public ITauToolBase { virtual StatusCode executeTrackClassifier(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer) const override; virtual StatusCode executeRNNTrackClassifier(xAOD::TauJet& pTau, xAOD::TauTrackContainer& tauTrackContainer) override; virtual StatusCode executeShotFinder(xAOD::TauJet& pTau, xAOD::CaloClusterContainer& shotClusterContainer, xAOD::PFOContainer& PFOContainer ) override; -#ifndef XAOD_ANALYSIS - virtual StatusCode executePi0CreateROI(xAOD::TauJet& pTau, CaloCellContainer& caloCellContainer, std::vector<CaloCell*>& map ) override; -#endif virtual StatusCode executePi0ClusterCreator(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer, xAOD::PFOContainer& hadronicPFOContainer, xAOD::CaloClusterContainer& caloClusterContainer, @@ -62,7 +64,7 @@ class TauRecToolBase : public asg::AsgTool, virtual public ITauToolBase { //----------------------------------------------------------------- //! Event finalizer - called at the end of each event //----------------------------------------------------------------- - virtual StatusCode eventFinalize() const override; + virtual StatusCode eventFinalize() override; //----------------------------------------------------------------- //! Finalizer diff --git a/Simulation/Digitization/share/jobOpts/cavernfiles.py b/Simulation/Digitization/share/jobOpts/cavernfiles.py index 2dd9d21e4d136bbf58f46b6e80907174deacf867..a0b49f3784042582781984a4e85c7373e5b0a9dc 100644 --- a/Simulation/Digitization/share/jobOpts/cavernfiles.py +++ b/Simulation/Digitization/share/jobOpts/cavernfiles.py @@ -120,4 +120,4 @@ def makeCavernBkgInputCol(nEvts, initialList): from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from Digitization.DigitizationFlags import digitizationFlags digitizationFlags.cavernInputCols=makeCavernBkgInputCol(25*len(athenaCommonFlags.PoolHitsInput.get_Value()), cavernlist) -print "digitizationFlags.cavernInputCols size = ", len(digitizationFlags.cavernInputCols.get_Value()) +printfunc ("digitizationFlags.cavernInputCols size = ", len(digitizationFlags.cavernInputCols.get_Value())) diff --git a/Simulation/Digitization/share/jobOpts/mc09cavernfiles.py b/Simulation/Digitization/share/jobOpts/mc09cavernfiles.py index 5915c3011220c95dd273d4be17e37a40b25a3cd6..685202e7a8015cdd34a252355fb85a989d2a70a0 100644 --- a/Simulation/Digitization/share/jobOpts/mc09cavernfiles.py +++ b/Simulation/Digitization/share/jobOpts/mc09cavernfiles.py @@ -81,4 +81,4 @@ def makeCavernBkgInputCol(nEvts, initialList): from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from Digitization.DigitizationFlags import digitizationFlags digitizationFlags.cavernInputCols=makeCavernBkgInputCol(25*len(athenaCommonFlags.PoolHitsInput.get_Value()), cavernlist) -print "digitizationFlags.cavernInputCols size = ", len(digitizationFlags.cavernInputCols.get_Value()) +printfunc ("digitizationFlags.cavernInputCols size = ", len(digitizationFlags.cavernInputCols.get_Value())) diff --git a/Simulation/Digitization/share/jobOpts/mc09minbiasfiles.py b/Simulation/Digitization/share/jobOpts/mc09minbiasfiles.py index cbbf08e4c9446b92cd1f9035c1d72679fa270b0c..684fff7afa8e2980aac9861780544f609f68d984 100644 --- a/Simulation/Digitization/share/jobOpts/mc09minbiasfiles.py +++ b/Simulation/Digitization/share/jobOpts/mc09minbiasfiles.py @@ -81,4 +81,4 @@ def makeMinBiasBkgInputCol(nEvts, initialList): from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from Digitization.DigitizationFlags import digitizationFlags digitizationFlags.LowPtMinBiasInputCols= makeMinBiasBkgInputCol(25*len(athenaCommonFlags.PoolHitsInput.get_Value()), minbiaslist) -print "digitizationFlags.LowPtMinBiasInputCols size = ", len(digitizationFlags.LowPtMinBiasInputCols.get_Value()) +printfunc ("digitizationFlags.LowPtMinBiasInputCols size = ", len(digitizationFlags.LowPtMinBiasInputCols.get_Value())) diff --git a/Simulation/Digitization/share/jobOpts/mc10Bminbiasfiles.py b/Simulation/Digitization/share/jobOpts/mc10Bminbiasfiles.py index 1edb8060b1a01103f4fe154519d5a11e2d05648e..c60044dfec21fb0fe3c581af84734982d6aeb932 100644 --- a/Simulation/Digitization/share/jobOpts/mc10Bminbiasfiles.py +++ b/Simulation/Digitization/share/jobOpts/mc10Bminbiasfiles.py @@ -30,4 +30,4 @@ def makeMinBiasBkgInputCol(nEvts, initialList): from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from Digitization.DigitizationFlags import digitizationFlags digitizationFlags.LowPtMinBiasInputCols= makeMinBiasBkgInputCol(25*len(athenaCommonFlags.PoolHitsInput.get_Value()), minbiaslist) -print "digitizationFlags.LowPtMinBiasInputCols size = ", len(digitizationFlags.LowPtMinBiasInputCols.get_Value()) +printfunc ("digitizationFlags.LowPtMinBiasInputCols size = ", len(digitizationFlags.LowPtMinBiasInputCols.get_Value())) diff --git a/Simulation/Digitization/share/jobOpts/mc10cavernfiles.py b/Simulation/Digitization/share/jobOpts/mc10cavernfiles.py index 4b5b22481a17d52b5782ccc6a79b0eac92f46a3b..3c6a3d9e256e24a345cb3714c69e5d8f46345400 100644 --- a/Simulation/Digitization/share/jobOpts/mc10cavernfiles.py +++ b/Simulation/Digitization/share/jobOpts/mc10cavernfiles.py @@ -32,4 +32,4 @@ def makeCavernBkgInputCol(nEvts, initialList): from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from Digitization.DigitizationFlags import digitizationFlags digitizationFlags.cavernInputCols=makeCavernBkgInputCol(25*len(athenaCommonFlags.PoolHitsInput.get_Value()), cavernlist) -print "digitizationFlags.cavernInputCols size = ", len(digitizationFlags.cavernInputCols.get_Value()) +printfunc ("digitizationFlags.cavernInputCols size = ", len(digitizationFlags.cavernInputCols.get_Value())) diff --git a/Simulation/Digitization/share/jobOpts/mc10minbiasfiles.py b/Simulation/Digitization/share/jobOpts/mc10minbiasfiles.py index 6bb6c2c263ba954c3d6863409772590b195190b8..04fe90b1a95808feea1eb837665e4b055fbbfd52 100644 --- a/Simulation/Digitization/share/jobOpts/mc10minbiasfiles.py +++ b/Simulation/Digitization/share/jobOpts/mc10minbiasfiles.py @@ -40,4 +40,4 @@ def makeMinBiasBkgInputCol(nEvts, initialList): #print len(uberlist) return uberlist digitizationFlags.LowPtMinBiasInputCols= makeMinBiasBkgInputCol(25*len(athenaCommonFlags.PoolHitsInput.get_Value()), minbiaslist) -print "digitizationFlags.LowPtMinBiasInputCols size = ", len(digitizationFlags.LowPtMinBiasInputCols.get_Value()) +printfunc ("digitizationFlags.LowPtMinBiasInputCols size = ", len(digitizationFlags.LowPtMinBiasInputCols.get_Value())) diff --git a/Simulation/Digitization/share/jobOpts/minbiasfiles.py b/Simulation/Digitization/share/jobOpts/minbiasfiles.py index 2aad45aa07e0319ca40dd89290f11d0a9e3f8636..eeb248c3cdae9516c56a3922a619b81c58b55950 100644 --- a/Simulation/Digitization/share/jobOpts/minbiasfiles.py +++ b/Simulation/Digitization/share/jobOpts/minbiasfiles.py @@ -120,4 +120,4 @@ def makeMinBiasBkgInputCol(nEvts, initialList): from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from Digitization.DigitizationFlags import digitizationFlags digitizationFlags.LowPtMinBiasInputCols= makeMinBiasBkgInputCol(25*len(athenaCommonFlags.PoolHitsInput.get_Value()), minbiaslist) -print "digitizationFlags.LowPtMinBiasInputCols size = ", len(digitizationFlags.LowPtMinBiasInputCols.get_Value()) +printfunc ("digitizationFlags.LowPtMinBiasInputCols size = ", len(digitizationFlags.LowPtMinBiasInputCols.get_Value())) diff --git a/Simulation/FastShower/FastCaloSim/CMakeLists.txt b/Simulation/FastShower/FastCaloSim/CMakeLists.txt index fb7bdfb529ca5ef7bf9a6b2a2403ab3f4dfd4166..f11b4f864f8efc5a79fef1f49f3e0f671ab92138 100644 --- a/Simulation/FastShower/FastCaloSim/CMakeLists.txt +++ b/Simulation/FastShower/FastCaloSim/CMakeLists.txt @@ -46,13 +46,12 @@ atlas_add_library( FastCaloSimLib INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} CaloEvent CaloIdentifier CaloInterfaceLib AthenaBaseComps AthenaKernel FastCaloSimAthenaPool FastSimulationEventLib Identifier GaudiKernel LArRecEvent TileEvent TrkEventPrimitives TrkParameters TrkExInterfaces CaloDetDescrLib StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${Boost_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthAllocators AthenaPoolUtilities AtlasDetDescr DetDescrCondToolsLib GeoPrimitives EventKernel NavFourMom GeneratorObjects TruthUtils PathResolver TrkGeometry TrkSurfaces TrkMaterialOnTrack ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} AtlasHepMCLib CaloEvent CaloIdentifier CaloInterfaceLib AthenaBaseComps AthenaKernel FastCaloSimAthenaPool FastSimulationEventLib GeneratorObjects Identifier GaudiKernel LArRecEvent TileEvent TrkEventPrimitives TrkParameters TrkExInterfaces CaloDetDescrLib StoreGateLib SGtests + PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${Boost_LIBRARIES} ${EIGEN_LIBRARIES} AthAllocators AthenaPoolUtilities AtlasDetDescr DetDescrCondToolsLib GeoPrimitives EventKernel NavFourMom TruthUtils PathResolver TrkGeometry TrkSurfaces TrkMaterialOnTrack ) atlas_add_component( FastCaloSim 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} AtlasHepMCLib ${EIGEN_LIBRARIES} CaloDetDescrLib CaloEvent CaloIdentifier AthenaBaseComps AthenaKernel StoreGateLib SGtests Identifier GaudiKernel LArRecEvent TileEvent TrkEventPrimitives TrkParameters TrkExInterfaces AthAllocators AthenaPoolUtilities AtlasDetDescr GeoPrimitives EventKernel NavFourMom GeneratorObjects TruthUtils FastCaloSimAthenaPool PathResolver TrkGeometry TrkSurfaces TrkMaterialOnTrack FastCaloSimLib ) + LINK_LIBRARIES FastCaloSimLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx b/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx index 15d5479fc7652597130c065b2bea3c624a9a9570..6807a7257de59bd67f4697963a0fcba920321a4c 100755 --- a/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx +++ b/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx @@ -1467,7 +1467,7 @@ FastShowerCellBuilderTool::process_particle(CaloCellContainer* theCellContainer, // a relatively small weight. ERatioThresh = 4; } - if(p.E>=ERatioThresh && p.E*Ein>2000) { + if(p.E>=ERatioThresh && p.E*Ein>2500) { ATH_MSG_WARNING("particle energy/truth="<<p.E); ATH_MSG_WARNING(" - "<<particle_info_str.str()); ATH_MSG_WARNING(" parametrization : "<< Epara->GetTitle()); diff --git a/Simulation/FastShower/FastCaloSimHit/CMakeLists.txt b/Simulation/FastShower/FastCaloSimHit/CMakeLists.txt index 57b94c241260daf6f4131875f7fb2330bc46526e..c325b536b5d49891405b976da8d7b0e6f48741e7 100644 --- a/Simulation/FastShower/FastCaloSimHit/CMakeLists.txt +++ b/Simulation/FastShower/FastCaloSimHit/CMakeLists.txt @@ -23,7 +23,7 @@ atlas_add_library( FastCaloSimHitLib atlas_add_component( FastCaloSimHit src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests GaudiKernel LArSimEvent TileSimEvent CaloEvent CaloIdentifier PileUpToolsLib EventInfo TileConditionsLib TileEvent FastCaloSimHitLib ) + LINK_LIBRARIES FastCaloSimHitLib ) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Simulation/FastSimulation/FastChainPileup/CMakeLists.txt b/Simulation/FastSimulation/FastChainPileup/CMakeLists.txt index 36897620e3639a3bf25a00bbc8cbb14577b97904..49ac265ae8a9b4ecfa18f6c5a63e94a9772bb174 100644 --- a/Simulation/FastSimulation/FastChainPileup/CMakeLists.txt +++ b/Simulation/FastSimulation/FastChainPileup/CMakeLists.txt @@ -22,7 +22,6 @@ atlas_add_component( FastChainPileup # Install files from the package: atlas_install_headers( FastChainPileup ) atlas_install_joboptions( share/*.py ) -atlas_install_runtime( test/FastChainPileup_TestConfiguration.xml ) atlas_install_scripts( scripts/sim_reg_test_fastchain.py ) atlas_install_python_modules( python/*.py ) diff --git a/Simulation/G4Atlas/G4AtlasApps/python/atlas_utilities.py b/Simulation/G4Atlas/G4AtlasApps/python/atlas_utilities.py index d9df7025c20503dd1353ed98886efd873c8b3c59..6756f78439d8f232f3c1a0ca97a3653c9dcb2da1 100644 --- a/Simulation/G4Atlas/G4AtlasApps/python/atlas_utilities.py +++ b/Simulation/G4Atlas/G4AtlasApps/python/atlas_utilities.py @@ -73,8 +73,8 @@ class MemorySnooper(PyAthena.Alg): self.now = now pid = os.getpid() - statm = string.split(open('/proc/%d/statm' % pid, 'r').readlines()[0] ) - stat = string.split(open('/proc/%d/stat' % pid, 'r').readlines()[0] ) + statm = open('/proc/%d/statm' % pid, 'r').readlines()[0].split() + stat = open('/proc/%d/stat' % pid, 'r').readlines()[0].split() print ('*** The Application is in %s with %d kB of VMMEM and %d kB of RSS' % (app_phase,int(stat[22])/1048.576, int(statm[1])*4)) self.file.write("%d %d %d %f\n" % (self.eventNumber, int(stat[22])/1048.576, int(statm[1])*4, elapsed_time) ) @@ -90,8 +90,8 @@ class MemorySnooper(PyAthena.Alg): self.now = now pid = os.getpid() - statm = string.split(open('/proc/%d/statm' % pid, 'r').readlines()[0] ) - stat = string.split(open('/proc/%d/stat' % pid, 'r').readlines()[0] ) + statm = open('/proc/%d/statm' % pid, 'r').readlines()[0].split() + stat = open('/proc/%d/stat' % pid, 'r').readlines()[0].split() if (int(stat[22])/1048.576 != self.memoV or int(statm[0])*4 != self.memoR): self.memoV = int(stat[22])/1048.576 self.memoR = int(statm[0])*4 diff --git a/Simulation/G4Atlas/G4AtlasInterfaces/G4AtlasInterfaces/Geo2G4SvcBase.h b/Simulation/G4Atlas/G4AtlasInterfaces/G4AtlasInterfaces/Geo2G4SvcBase.h index 23a51e664095d0a39149215d04899d240b17cf49..2a76a4cc75461f03d72cd86d1ed8ada15bfdd2dc 100644 --- a/Simulation/G4Atlas/G4AtlasInterfaces/G4AtlasInterfaces/Geo2G4SvcBase.h +++ b/Simulation/G4Atlas/G4AtlasInterfaces/G4AtlasInterfaces/Geo2G4SvcBase.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 G4AtlasInterfaces_Geo2G4SvcBase_H @@ -13,12 +13,9 @@ class VolumeBuilder; class Geo2G4SvcBase { public: - virtual void RegisterVolumeBuilder(VolumeBuilder* vb) = 0; - virtual void UnregisterVolumeBuilder(VolumeBuilder* vb) = 0; virtual VolumeBuilder* GetVolumeBuilder(std::string s) const = 0; virtual VolumeBuilder* GetDefaultBuilder() const = 0; - virtual void SetDefaultBuilder(VolumeBuilder*) = 0; virtual void SetDefaultBuilder(std::string) = 0; virtual void ListVolumeBuilders() const = 0; diff --git a/Simulation/G4Atlas/G4AtlasServices/src/ConstantFieldSvc.cxx b/Simulation/G4Atlas/G4AtlasServices/src/ConstantFieldSvc.cxx index 5d90c928015d7a274a6f3afd30d51e45ef9090ab..877f480d8b94dca1c9f544972b9691a09d4e7635 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/ConstantFieldSvc.cxx +++ b/Simulation/G4Atlas/G4AtlasServices/src/ConstantFieldSvc.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 "ConstantFieldSvc.h" @@ -10,10 +10,6 @@ ConstantFieldSvc::ConstantFieldSvc(const std::string& name, ISvcLocator* pSvcLocator) : G4MagFieldSvcBase(name, pSvcLocator) { - // What are the units?? - declareProperty("FieldX", m_fieldX=0., "Field X component"); - declareProperty("FieldY", m_fieldY=0., "Field Y component"); - declareProperty("FieldZ", m_fieldZ=0., "Field Z component"); } StatusCode ConstantFieldSvc::initialize() diff --git a/Simulation/G4Atlas/G4AtlasServices/src/ConstantFieldSvc.h b/Simulation/G4Atlas/G4AtlasServices/src/ConstantFieldSvc.h index 9a940df9084a0f6985ef7ab8e946144a799a6909..26ec0a124380dac6b730bb6684daddc111166159 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/ConstantFieldSvc.h +++ b/Simulation/G4Atlas/G4AtlasServices/src/ConstantFieldSvc.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 G4ATLASSERVICES_ConstantFieldSvc_H @@ -22,7 +22,7 @@ class ConstantFieldSvc final : public G4MagFieldSvcBase /// Basic constructor and destructor ConstantFieldSvc(const std::string& name, ISvcLocator* pSvcLocator); - ~ConstantFieldSvc() {} + ~ConstantFieldSvc() = default; /** Athena method. called at initialization time, being customized here */ StatusCode initialize() override final; @@ -34,11 +34,11 @@ class ConstantFieldSvc final : public G4MagFieldSvcBase private: - /// @name Field vector components + /// @name Field vector components - What are the units?? /// @{ - double m_fieldX; - double m_fieldY; - double m_fieldZ; + Gaudi::Property<double> m_fieldX{this, "FieldX", 0., "Field X component"}; + Gaudi::Property<double> m_fieldY{this, "FieldY", 0., "Field Y component"}; + Gaudi::Property<double> m_fieldZ{this, "FieldZ", 0., "Field Z component"}; /// @} }; diff --git a/Simulation/G4Atlas/G4AtlasServices/src/DetectorGeometrySvc.cxx b/Simulation/G4Atlas/G4AtlasServices/src/DetectorGeometrySvc.cxx index d7bd2c5024557c1c17c0be5755164fff4d8b7b59..dfbee7a1062adddd6e36787b8cc29e74ba0045df 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/DetectorGeometrySvc.cxx +++ b/Simulation/G4Atlas/G4AtlasServices/src/DetectorGeometrySvc.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 */ @@ -24,27 +24,17 @@ // #include "G4ClassicalRK4.hh" DetectorGeometrySvc::DetectorGeometrySvc( const std::string& name, ISvcLocator* pSvcLocator ) - : base_class(name,pSvcLocator), - m_detTool("",this), - m_detConstruction("",this), - m_regionCreators(this), - m_parallelWorlds(this), - m_configurationTools(this), - m_fieldManagers(this), - m_activateParallelWorlds(false) + : base_class(name,pSvcLocator) + , m_regionCreators(this) + , m_parallelWorlds(this) + , m_configurationTools(this) + , m_fieldManagers(this) { - declareProperty( "World" , m_detTool , "Tool handle of the top-of-the-tree detector geometry tool" ); - declareProperty( "DetectorConstruction" , m_detConstruction , "Tool handle of the DetectorConstruction" ); - declareProperty( "RegionCreators" , m_regionCreators , "Tools to define G4 physics regions" ); - declareProperty( "ParallelWorlds" , m_parallelWorlds , "Tools to define G4 parallel worlds" ); - declareProperty( "ActivateParallelWorlds",m_activateParallelWorlds,"Toggle on/off the G4 parallel geometry system"); - declareProperty( "FieldManagers",m_fieldManagers,"field managers used"); - declareProperty( "GeometryConfigurationTools",m_configurationTools,"Tools for geometry configuration"); ATH_MSG_DEBUG( "DetectorGeometrySvc being created!" ); -} - -DetectorGeometrySvc::~DetectorGeometrySvc() -{ + declareProperty( "RegionCreators", m_regionCreators , "Tools to define G4 physics regions" ); + declareProperty( "ParallelWorlds", m_parallelWorlds , "Tools to define G4 parallel worlds" ); + declareProperty( "FieldManagers", m_fieldManagers,"field managers used"); + declareProperty( "GeometryConfigurationTools",m_configurationTools,"Tools for geometry configuration"); } StatusCode DetectorGeometrySvc::initialize(){ diff --git a/Simulation/G4Atlas/G4AtlasServices/src/DetectorGeometrySvc.h b/Simulation/G4Atlas/G4AtlasServices/src/DetectorGeometrySvc.h index 4929e36ac87cf89c6064a01f05b314a327dfe4f9..b9a4fda470034510cafa942592478ed9d52de6e6 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/DetectorGeometrySvc.h +++ b/Simulation/G4Atlas/G4AtlasServices/src/DetectorGeometrySvc.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 G4ATLASSERVICES_DETECTORGEOMETRYSVC_H @@ -26,7 +26,7 @@ class DetectorGeometrySvc : public extends<AthService, IDetectorGeometrySvc> { public: // Standard constructor and destructor DetectorGeometrySvc( const std::string& name, ISvcLocator* pSvcLocator ); - virtual ~DetectorGeometrySvc(); + virtual ~DetectorGeometrySvc() = default; // Gaudi methods StatusCode initialize() override final; @@ -46,17 +46,14 @@ public: protected: private: - ToolHandle<IDetectorGeometryTool> m_detTool; - ToolHandle<IDetectorConstructionTool> m_detConstruction; + ToolHandle<IDetectorGeometryTool> m_detTool{this, "World", "", "Tool handle of the top-of-the-tree detector geometry tool"}; + ToolHandle<IDetectorConstructionTool> m_detConstruction{this, "DetectorConstruction", "", "Tool handle of the DetectorConstruction"}; ToolHandleArray<IRegionCreator> m_regionCreators; ToolHandleArray<IParallelWorldTool> m_parallelWorlds; ToolHandleArray<IG4GeometryConfigurationTool> m_configurationTools; - ToolHandleArray<IFieldManagerTool> m_fieldManagers; - - - bool m_activateParallelWorlds; - std::vector<std::string> m_parallelWorldNames; + Gaudi::Property<bool> m_activateParallelWorlds{this, "ActivateParallelWorlds", false, "Toggle on/off the G4 parallel geometry system"}; + std::vector<std::string> m_parallelWorldNames{}; }; #endif diff --git a/Simulation/G4Atlas/G4AtlasServices/src/G4AtlasSvc.cxx b/Simulation/G4Atlas/G4AtlasServices/src/G4AtlasSvc.cxx index d1734623dcd425486da2dd860894a73fe20df29f..073327ffb5893409387ece1f829d16bdd46ab813 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/G4AtlasSvc.cxx +++ b/Simulation/G4Atlas/G4AtlasServices/src/G4AtlasSvc.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 "G4AtlasSvc.h" @@ -13,22 +13,8 @@ G4AtlasSvc::G4AtlasSvc( const std::string& name, ISvcLocator* pSvcLocator ) : base_class(name,pSvcLocator) - , m_detGeoSvc("DetectorGeometrySvc",name) - , m_physicsListSvc("PhysicsListSvc",name) - , m_userLimitsSvc("UserLimitsSvc", name) - , m_isMT(false) - , m_activateParallelGeometries(false) { ATH_MSG_DEBUG( "G4AtlasSvc being created!" ); - declareProperty("ActivateParallelWorlds",m_activateParallelGeometries,"Toggle on/off the G4 parallel geometry system"); - declareProperty("DetectorGeometrySvc", m_detGeoSvc ); - declareProperty("PhysicsListSvc", m_physicsListSvc); - declareProperty("UserLimitsSvc", m_userLimitsSvc); - declareProperty("isMT", m_isMT); -} - -G4AtlasSvc::~G4AtlasSvc() -{ } StatusCode G4AtlasSvc::initialize(){ @@ -76,6 +62,6 @@ StatusCode G4AtlasSvc::initialize(){ StatusCode G4AtlasSvc::finalize() { - ATH_MSG_INFO( "G4AtlasSvc being ifinalized!!!" ); + ATH_MSG_INFO( "G4AtlasSvc being finalized!!!" ); return StatusCode::SUCCESS; } diff --git a/Simulation/G4Atlas/G4AtlasServices/src/G4AtlasSvc.h b/Simulation/G4Atlas/G4AtlasServices/src/G4AtlasSvc.h index 2580f47772bdb92a59de06b21cb327c5be4ffd80..c9e1aa1c6b8f83679aae1e63b0bea977b4b914a3 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/G4AtlasSvc.h +++ b/Simulation/G4Atlas/G4AtlasServices/src/G4AtlasSvc.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 G4ATLASSERVICES_G4AtlasSvc_H @@ -19,20 +19,18 @@ class G4AtlasSvc : public extends<AthService , IG4AtlasSvc> { public: // Standard constructor and destructor G4AtlasSvc( const std::string& name, ISvcLocator* pSvcLocator ); - virtual ~G4AtlasSvc(); + virtual ~G4AtlasSvc() = default; // Gaudi methods StatusCode initialize() override final; StatusCode finalize() override final; private: - - ServiceHandle<IDetectorGeometrySvc> m_detGeoSvc; - - ServiceHandle<IPhysicsListSvc> m_physicsListSvc; - ServiceHandle<IUserLimitsSvc> m_userLimitsSvc; - bool m_isMT; - bool m_activateParallelGeometries; + ServiceHandle<IDetectorGeometrySvc> m_detGeoSvc{this, "DetectorGeometrySvc", "DetectorGeometrySvc"}; + ServiceHandle<IPhysicsListSvc> m_physicsListSvc{this, "PhysicsListSvc", "PhysicsListSvc"}; + ServiceHandle<IUserLimitsSvc> m_userLimitsSvc{this, "UserLimitsSvc", "UserLimitsSvc"}; + Gaudi::Property<bool> m_isMT{this, "isMT", false}; + Gaudi::Property<bool> m_activateParallelGeometries{this, "ActivateParallelWorlds", false, "Toggle on/off the G4 parallel geometry system"}; }; #endif diff --git a/Simulation/G4Atlas/G4AtlasServices/src/G4GeometryNotifierSvc.cxx b/Simulation/G4Atlas/G4AtlasServices/src/G4GeometryNotifierSvc.cxx index 8cd1003fd81276dd3e5ad9e9c703c8f6b3250df8..b7eadb51a0bae3876eeeed7c619ad960322b3476 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/G4GeometryNotifierSvc.cxx +++ b/Simulation/G4Atlas/G4AtlasServices/src/G4GeometryNotifierSvc.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 "G4GeometryNotifierSvc.h" @@ -8,14 +8,8 @@ #include "LVNotifier.h" G4GeometryNotifierSvc::G4GeometryNotifierSvc( const std::string& name, ISvcLocator* pSvcLocator ) - : base_class(name,pSvcLocator), - m_activateLVNotifier(false), - m_activatePVNotifier(false), - lvNotifier(nullptr), - pvNotifier(nullptr) + : base_class(name,pSvcLocator) { - declareProperty( "ActivateLVNotifier",m_activateLVNotifier,"Toggle on/off the G4 LV notifier"); - declareProperty( "ActivatePVNotifier",m_activatePVNotifier,"Toggle on/off the G4 PV notifier"); ATH_MSG_DEBUG( "G4GeometryNotifierSvc being created!" ); } diff --git a/Simulation/G4Atlas/G4AtlasServices/src/G4GeometryNotifierSvc.h b/Simulation/G4Atlas/G4AtlasServices/src/G4GeometryNotifierSvc.h index 3a8f15ae85884c9dbe49bf99711695ccc34b3bc3..fc607a35b75e91920fc958848171c6d5067bb529 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/G4GeometryNotifierSvc.h +++ b/Simulation/G4Atlas/G4AtlasServices/src/G4GeometryNotifierSvc.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 G4ATLASSERVICES_G4GEOMETRYNOTIFIERSVC_H @@ -27,12 +27,12 @@ public: const std::string GetCurrentDetectorName() const override final {return m_currentDetectorName;} private: - std::string m_currentDetectorName; + std::string m_currentDetectorName{""}; - bool m_activateLVNotifier=false; - bool m_activatePVNotifier=true; - G4VNotifier* lvNotifier; - G4VNotifier* pvNotifier; + Gaudi::Property<bool> m_activateLVNotifier{this, "ActivateLVNotifier", true, "Toggle on/off the G4 LV notifier"}; + Gaudi::Property<bool> m_activatePVNotifier{this, "ActivatePVNotifier", false, "Toggle on/off the G4 PV notifier"}; + G4VNotifier* lvNotifier{}; + G4VNotifier* pvNotifier{}; }; #endif //G4ATLASSERVICES_G4GEOMETRYNOTIFIERSVC_H diff --git a/Simulation/G4Atlas/G4AtlasServices/src/PhysicsListSvc.cxx b/Simulation/G4Atlas/G4AtlasServices/src/PhysicsListSvc.cxx index 1659393eb3f4cc7a038337d995f3c15dd7a2b1b8..1a58ccd6bfce623eea89b613928db756dd11bc7a 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/PhysicsListSvc.cxx +++ b/Simulation/G4Atlas/G4AtlasServices/src/PhysicsListSvc.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 "PhysicsListSvc.h" @@ -21,22 +21,7 @@ PhysicsListSvc::PhysicsListSvc(const std::string& name, ISvcLocator* pSvcLocator : base_class(name,pSvcLocator) , m_phys_option(this) , m_phys_decay(this) - , m_physicsList(nullptr) { - declareProperty("PhysicsList" , m_physicsListName = "FTFP_BERT", "Name for physics list"); - declareProperty("NeutronTimeCut" , m_neutronTimeCut = 0, "Time cut for neutron killer"); - declareProperty("NeutronEnergyCut", m_neutronEnergyCut = 0, "Energy cut for neutron killer"); - declareProperty("GeneralCut" , m_generalCut = 0, "General cut"); - declareProperty("EMMaxEnergy" , m_emMaxEnergy = -1., "Maximum energy for EM tables"); - declareProperty("EMMinEnergy" , m_emMinEnergy = -1., "Minimum energy for EM tables"); - /* --- ATLASSIM-3967 --- - Old methods SetDEDXBinning and SetLambdaBinning are replaced in G4 10.4 by - SetNumberOfBinsPerDecade which now controls both settings with the same - value. Instead of changing the overall number of bins, user should - specify the number of bins per energy decade instead. - */ - declareProperty("EMNumberOfBinsPerDecade" , m_emNumberOfBinsPerDecade = -1, "Number of bins per Energy decade. Used for both DeDx and for the Lambda binning."); - declareProperty("ApplyEMCuts" , m_applyEMCuts = true, "Apply cuts EM flag in Geant4"); declareProperty("PhysOption" , m_phys_option , "Tool handle array of physics options" ); declareProperty("PhysicsDecay" , m_phys_decay , "Tool handle array of physics decays" ); } @@ -64,16 +49,16 @@ StatusCode PhysicsListSvc::initialize( ) void PhysicsListSvc::CreatePhysicsList() { ATH_MSG_DEBUG("PhysicsListSvc::CreatePhysicsList()"); - if (m_physicsListName != ""){ + if (m_physicsListName.value() != ""){ G4PhysListFactory factory; AtlasPhysListFactory Atlasfactory; - if (factory.IsReferencePhysList(m_physicsListName)) + if (factory.IsReferencePhysList(m_physicsListName.value())) { - m_physicsList = factory.GetReferencePhysList(m_physicsListName); + m_physicsList = factory.GetReferencePhysList(m_physicsListName.value()); } - else if (Atlasfactory.IsReferencePhysList(m_physicsListName)) + else if (Atlasfactory.IsReferencePhysList(m_physicsListName.value())) { - m_physicsList = Atlasfactory.GetReferencePhysList(m_physicsListName); + m_physicsList = Atlasfactory.GetReferencePhysList(m_physicsListName.value()); } } @@ -101,6 +86,7 @@ void PhysicsListSvc::CreatePhysicsList() ATH_MSG_DEBUG("end of PhysicsListSvc::CreatePhysicsList()"); } + G4VUserPhysicsList* PhysicsListSvc::GetPhysicsList() { if (!m_physicsList) { @@ -109,6 +95,7 @@ G4VUserPhysicsList* PhysicsListSvc::GetPhysicsList() return m_physicsList; } + void PhysicsListSvc::SetPhysicsList() { if(!m_physicsList) { @@ -117,6 +104,7 @@ void PhysicsListSvc::SetPhysicsList() G4RunManager::GetRunManager()->SetUserInitialization(m_physicsList); } + void PhysicsListSvc::SetPhysicsOptions() { if (!m_physicsList) @@ -125,23 +113,23 @@ void PhysicsListSvc::SetPhysicsOptions() return; } - if(m_generalCut > 0. && std::fabs(m_generalCut)>std::numeric_limits<double>::epsilon()) + if(m_generalCut.value() > 0. && std::abs(m_generalCut.value())>std::numeric_limits<double>::epsilon()) { - m_physicsList->SetDefaultCutValue(m_generalCut); + m_physicsList->SetDefaultCutValue(m_generalCut.value()); } std::vector<std::string> g4commands; - if (m_neutronTimeCut > 0. && std::fabs(m_neutronTimeCut)>std::numeric_limits<double>::epsilon()) + if (m_neutronTimeCut.value() > 0. && std::abs(m_neutronTimeCut.value())>std::numeric_limits<double>::epsilon()) { std::ostringstream oss; - oss<<"/physics_engine/neutron/timeLimit "<<m_neutronTimeCut<<" ns"; + oss<<"/physics_engine/neutron/timeLimit "<<m_neutronTimeCut.value()<<" ns"; g4commands.push_back(oss.str()); } - if (m_neutronEnergyCut > 0. && std::fabs(m_neutronEnergyCut)>std::numeric_limits<double>::epsilon()) + if (m_neutronEnergyCut.value() > 0. && std::abs(m_neutronEnergyCut.value())>std::numeric_limits<double>::epsilon()) { std::ostringstream oss; - oss<<"/physics_engine/neutron/energyLimit "<<m_neutronEnergyCut<<" MeV"; + oss<<"/physics_engine/neutron/energyLimit "<<m_neutronEnergyCut.value()<<" MeV"; g4commands.push_back(oss.str()); } @@ -156,16 +144,17 @@ void PhysicsListSvc::SetPhysicsOptions() } G4EmParameters* emp = G4EmParameters::Instance(); - if (m_emMaxEnergy>=0) emp->SetMaxEnergy(m_emMaxEnergy); - if (m_emNumberOfBinsPerDecade>=0) emp->SetNumberOfBinsPerDecade(m_emNumberOfBinsPerDecade); - if (m_emMinEnergy>=0) emp->SetMinEnergy(m_emMinEnergy); - if (m_applyEMCuts) + if (m_emMaxEnergy.value()>=0) emp->SetMaxEnergy(m_emMaxEnergy.value()); + if (m_emNumberOfBinsPerDecade.value()>=0) emp->SetNumberOfBinsPerDecade(m_emNumberOfBinsPerDecade.value()); + if (m_emMinEnergy.value()>=0) emp->SetMinEnergy(m_emMinEnergy.value()); + if (m_applyEMCuts.value()) { emp->SetApplyCuts(true); } return; } + void PhysicsListSvc::CommandLog(int returnCode, const std::string& commandString) const { switch(returnCode) { diff --git a/Simulation/G4Atlas/G4AtlasServices/src/PhysicsListSvc.h b/Simulation/G4Atlas/G4AtlasServices/src/PhysicsListSvc.h index 2982f72ef4bcad53c6d08ab967c6fd7d6c844e13..19b3dead7c456edf7a67c064f6abbaefc1e12294 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/PhysicsListSvc.h +++ b/Simulation/G4Atlas/G4AtlasServices/src/PhysicsListSvc.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 G4ATLASTOOLS_PHYSICSLISTSVC_H @@ -42,15 +42,21 @@ private: ToolHandleArray<IPhysicsOptionTool> m_phys_option; ToolHandleArray<IPhysicsOptionTool> m_phys_decay; - G4VModularPhysicsList* m_physicsList; ///!< Handle on the physics list - std::string m_physicsListName; ///!< Name for the physics list (property to be set in the tool) - double m_neutronTimeCut; ///!< Time cut for neutrons (in the neutron killer process) - double m_neutronEnergyCut; ///!< Energy cut for neutrons (in the neutron killer process) - double m_generalCut; ///!< A general cut - this isn't normally used in our simulation - double m_emMaxEnergy; ///!< Maximum energy of the pre-calculated EM cross-section tables - double m_emMinEnergy; ///!< Minimum energy of the pre-calculated EM cross-section tables - int m_emNumberOfBinsPerDecade; ///!< Number of bins per Energy decade. Used for both DeDx and for the Lambda binning. - bool m_applyEMCuts; ///!< Switch for the G4 "apply cuts" EM physics flag + G4VModularPhysicsList* m_physicsList{}; ///!< Handle on the physics list + Gaudi::Property<std::string> m_physicsListName{this, "PhysicsList", "FTFP_BERT", "Name for physics list"}; ///!< Name for the physics list (property to be set in the tool) + Gaudi::Property<double> m_neutronTimeCut{this, "NeutronTimeCut", 0, "Time cut for neutron killer"}; ///!< Time cut for neutrons (in the neutron killer process) + Gaudi::Property<double> m_neutronEnergyCut{this, "NeutronEnergyCut", 0, "Energy cut for neutron killer"}; ///!< Energy cut for neutrons (in the neutron killer process) + Gaudi::Property<double> m_generalCut{this, "GeneralCut", 0, "General cut"}; ///!< A general cut - this isn't normally used in our simulation + Gaudi::Property<double> m_emMaxEnergy{this, "EMMaxEnergy", -1., "Maximum energy for EM tables"}; ///!< Maximum energy of the pre-calculated EM cross-section tables + Gaudi::Property<double> m_emMinEnergy{this, "EMMinEnergy", -1., "Minimum energy for EM tables"}; ///!< Minimum energy of the pre-calculated EM cross-section tables + /* --- ATLASSIM-3967 --- + Old methods SetDEDXBinning and SetLambdaBinning are replaced in G4 10.4 by + SetNumberOfBinsPerDecade which now controls both settings with the same + value. Instead of changing the overall number of bins, user should + specify the number of bins per energy decade instead. + */ + Gaudi::Property<int> m_emNumberOfBinsPerDecade{this, "EMNumberOfBinsPerDecade", -1, "Number of bins per Energy decade. Used for both DeDx and for the Lambda binning."}; ///!< Number of bins per Energy decade. Used for both DeDx and for the Lambda binning. + Gaudi::Property<bool> m_applyEMCuts{this, "ApplyEMCuts", true, "Apply cuts EM flag in Geant4"}; ///!< Switch for the G4 "apply cuts" EM physics flag }; diff --git a/Simulation/G4Atlas/G4AtlasServices/src/StandardFieldSvc.cxx b/Simulation/G4Atlas/G4AtlasServices/src/StandardFieldSvc.cxx index 506d5b78aa9b7b2c7f716069cbaa2730743d7706..2d237afd057fe2fc8f84edeb96640b50a8b32ccc 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/StandardFieldSvc.cxx +++ b/Simulation/G4Atlas/G4AtlasServices/src/StandardFieldSvc.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 "StandardFieldSvc.h" @@ -16,10 +16,8 @@ AtlasField::AtlasField(MagField::IMagFieldSvc* m) //----------------------------------------------------------------------------- StandardFieldSvc::StandardFieldSvc(const std::string& name, ISvcLocator* pSvcLocator) - : G4MagFieldSvcBase(name, pSvcLocator), - m_magFieldSvc("MagField::AtlasFieldSvc/AtlasFieldSvc", name) + : G4MagFieldSvcBase(name, pSvcLocator) { - declareProperty("MagneticFieldSvc", m_magFieldSvc); } //----------------------------------------------------------------------------- diff --git a/Simulation/G4Atlas/G4AtlasServices/src/StandardFieldSvc.h b/Simulation/G4Atlas/G4AtlasServices/src/StandardFieldSvc.h index 05ee51e4e75025e0e763ac0777a43e7b8fd88bd5..03a08adf7233da5180e21af9af5e4837f57a813d 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/StandardFieldSvc.h +++ b/Simulation/G4Atlas/G4AtlasServices/src/StandardFieldSvc.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 G4ATLASSERVICES_StandardFieldSvc_H @@ -41,7 +41,7 @@ class AtlasField : public G4MagneticField /// Pointer to the magnetic field service. /// We use a raw pointer here to avoid ServiceHandle overhead. - MagField::IMagFieldSvc* m_magFieldSvc; + MagField::IMagFieldSvc* m_magFieldSvc{}; }; @@ -57,7 +57,7 @@ class StandardFieldSvc final : public G4MagFieldSvcBase /// Standard constructor StandardFieldSvc(const std::string& name, ISvcLocator* pSvcLocator); /// Empty destructor - ~StandardFieldSvc() {} + ~StandardFieldSvc() = default; /// Athena method. called at initialization time, being customized here. StatusCode initialize() override final; @@ -70,7 +70,7 @@ class StandardFieldSvc final : public G4MagFieldSvcBase private: /// Handle to the ATLAS magnetic field service - ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc; + ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc{this, "MagneticFieldSvc", "MagField::AtlasFieldSvc/AtlasFieldSvc"}; }; diff --git a/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.cxx b/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.cxx index f489b2e72262ddf9e3c6eac1e494429f1c439629..de5a2c741a6f8d67c1696fee0820c0232d23b3ef 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.cxx +++ b/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.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 <mutex> @@ -22,8 +22,8 @@ namespace G4UA //--------------------------------------------------------------------------- UserActionSvc::UserActionSvc(const std::string& name, ISvcLocator* pSvcLocator) - : base_class(name, pSvcLocator), - m_userActionTools(this) + : base_class(name, pSvcLocator) + , m_userActionTools(this) { declareProperty("UserActionTools", m_userActionTools); } diff --git a/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.h b/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.h index 959bc85833d52e7fa6898209f703afac356d17ff..4477e0b8d9c4e517c1a3d73dc5561b77d9231f21 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.h +++ b/Simulation/G4Atlas/G4AtlasServices/src/UserActionSvc.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 */ diff --git a/Simulation/G4Atlas/G4AtlasServices/src/UserLimitsSvc.cxx b/Simulation/G4Atlas/G4AtlasServices/src/UserLimitsSvc.cxx index 7b3db41c0109749393d8564b5c155ccf8f792be6..6f8c427414ad573cf10230a5b6bebac13d7bbfe1 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/UserLimitsSvc.cxx +++ b/Simulation/G4Atlas/G4AtlasServices/src/UserLimitsSvc.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 */ // class header @@ -15,20 +15,7 @@ #include <limits> UserLimitsSvc::UserLimitsSvc( const std::string& name, ISvcLocator* pSvcLocator ) : base_class(name,pSvcLocator) - , m_MaxStep(-1.) - , m_MinEkine(-1.) - , m_MaxTrackLength(-1.) - , m_MaxTime(-1.) - , m_MinRange(-1.) - , m_matchType("isMatch") { - declareProperty("MaxStep", m_MaxStep, "Maximum step length"); - declareProperty("MinEkine", m_MinEkine, "Minimum remaining kinetic energy for a track"); - declareProperty("MaxTrackLength", m_MaxTrackLength, "Maximum total track length"); - declareProperty("MaxTime", m_MaxTime, "Maximum global time for a track"); - declareProperty("MinRange", m_MinRange, "Minimum remaining range for a track"); - declareProperty("VolumeList" , m_logicalVolumes , "List of Logical volume to which these limits should be applied" ); - declareProperty("MatchType" , m_matchType , "Use 'contains' or 'isMatch' function for string comparison" ); } // Athena method, called at initialization time @@ -51,8 +38,8 @@ StatusCode UserLimitsSvc::initialize() funcMap.emplace("contains", &UserLimitsSvc::contains); // Call Limit setting methods here: - std::vector<std::string>::const_iterator volumeItr(m_logicalVolumes.begin()); - const std::vector<std::string>::const_iterator endOfVolumesItr(m_logicalVolumes.end()); + std::vector<std::string>::const_iterator volumeItr(m_logicalVolumes.value().begin()); + const std::vector<std::string>::const_iterator endOfVolumesItr(m_logicalVolumes.value().end()); while(volumeItr!=endOfVolumesItr) { const std::string& volName(*volumeItr); @@ -61,7 +48,7 @@ StatusCode UserLimitsSvc::initialize() { G4LogicalVolume *lv=lvs[i]; // Compare two strings with a configurable method... - if ( (this->*(funcMap[m_matchType]))(volName, lv->GetName()) ){ + if ( (this->*(funcMap[m_matchType.value()]))(volName, lv->GetName()) ){ G4UserLimits *ul=lv->GetUserLimits(); if (!ul) ul=new G4UserLimits; if (-0.5 < m_MaxStep) { ul->SetMaxAllowedStep(m_MaxStep); } diff --git a/Simulation/G4Atlas/G4AtlasServices/src/UserLimitsSvc.h b/Simulation/G4Atlas/G4AtlasServices/src/UserLimitsSvc.h index bf72b3c9ab21d68bdcb0b188e03c46f7789d53be..6c5c880ffbe399e89679bbda0b27898a3d29baa7 100644 --- a/Simulation/G4Atlas/G4AtlasServices/src/UserLimitsSvc.h +++ b/Simulation/G4Atlas/G4AtlasServices/src/UserLimitsSvc.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 G4ATLASTOOLS_USERLIMITSSVC_H @@ -31,19 +31,19 @@ class UserLimitsSvc final : public extends<AthService, IUserLimitsSvc> { bool isMatch(const std::string& pattern, const std::string logicalVolume) const; bool contains(const std::string& pattern, const std::string logicalVolume) const; /** Maximum step length */ - double m_MaxStep; + Gaudi::Property<double> m_MaxStep{this, "MaxStep", -1., "Maximum step length"}; /** Minimum remaining kinetic energy for a track */ - double m_MinEkine; + Gaudi::Property<double> m_MinEkine{this, "MinEkine", -1., "Minimum remaining kinetic energy for a track"}; /** Maximum total track length */ - double m_MaxTrackLength; + Gaudi::Property<double> m_MaxTrackLength{this, "MaxTrackLength", -1., "Maximum total track length"}; /** Maximum global time for a track */ - double m_MaxTime; + Gaudi::Property<double> m_MaxTime{this, "MaxTime", -1., "Maximum global time for a track"}; /** Minimum remaining range for a track */ - double m_MinRange; + Gaudi::Property<double> m_MinRange{this, "MinRange", -1., "Minimum remaining range for a track"}; /** Use 'contains' or 'isMatch' function for string comparison */ - std::string m_matchType; + Gaudi::Property<std::string> m_matchType{this, "MatchType", "isMatch", "Use 'contains' or 'isMatch' function for string comparison"}; /** List of Logical volume to which these limits should be applied */ - std::vector<std::string> m_logicalVolumes; + Gaudi::Property<std::vector<std::string> > m_logicalVolumes{this, "VolumeList" , {}, "List of Logical volume to which these limits should be applied"}; }; #endif //G4ATLASTOOLS_USERLIMITSSVC_H diff --git a/Simulation/G4Atlas/G4AtlasTools/CMakeLists.txt b/Simulation/G4Atlas/G4AtlasTools/CMakeLists.txt index 3b62b1c8dd7a3657f4b4f1176f2a99f1f39439ec..ed856ea9949a496db7b0a2a0994e08fbdb6397ad 100644 --- a/Simulation/G4Atlas/G4AtlasTools/CMakeLists.txt +++ b/Simulation/G4Atlas/G4AtlasTools/CMakeLists.txt @@ -25,8 +25,7 @@ atlas_add_library( G4AtlasToolsLib atlas_add_component( G4AtlasTools src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${TBB_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} ${TBB_LIBRARIES} AthenaBaseComps G4AtlasInterfaces GaudiKernel G4AtlasToolsLib ) + LINK_LIBRARIES G4AtlasToolsLib ) #testing just the simulation parts, no forward detectors or region atlas_add_test( G4GeometryToolConfig_Simtest diff --git a/Simulation/G4Extensions/G4CosmicFilter/CMakeLists.txt b/Simulation/G4Extensions/G4CosmicFilter/CMakeLists.txt index 27a024df161590ec488dcf43ce059842496d8190..9d5392cd43137d47dfea31c8119f00f336632556 100644 --- a/Simulation/G4Extensions/G4CosmicFilter/CMakeLists.txt +++ b/Simulation/G4Extensions/G4CosmicFilter/CMakeLists.txt @@ -20,5 +20,3 @@ atlas_add_component( G4CosmicFilter # Install files from the package: atlas_install_headers( G4CosmicFilter ) atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) - diff --git a/Simulation/G4Sim/MCTruthBase/CMakeLists.txt b/Simulation/G4Sim/MCTruthBase/CMakeLists.txt index af05f69fff4f1bad1f8891e4317abfcb088746d6..e5d326cddf746cdb8926dc4546569f50f31171a5 100644 --- a/Simulation/G4Sim/MCTruthBase/CMakeLists.txt +++ b/Simulation/G4Sim/MCTruthBase/CMakeLists.txt @@ -14,9 +14,9 @@ find_package( XercesC ) atlas_add_library( MCTruthBaseLib src/*.cxx PUBLIC_HEADERS MCTruthBase - INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} + INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaKernel GaudiKernel StoreGateLib SGtests G4AtlasToolsLib + LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaKernel GaudiKernel StoreGateLib SGtests G4AtlasToolsLib TrackRecordLib PRIVATE_LINK_LIBRARIES AthenaBaseComps G4AtlasInterfaces MCTruth SimHelpers ISF_InterfacesLib AtlasDetDescr ISF_Geant4Event @@ -24,15 +24,7 @@ atlas_add_library( MCTruthBaseLib atlas_add_component( MCTruthBase src/components/*.cxx - INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${GEANT4_LIBRARIES} - ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} - AtlasHepMCLib AthenaKernel GaudiKernel - AthenaBaseComps StoreGateLib SGtests - G4AtlasInterfaces G4AtlasToolsLib MCTruth - SimHelpers ISF_InterfacesLib - AtlasDetDescr MCTruthBaseLib - ISF_Geant4Event ) + LINK_LIBRARIES MCTruthBaseLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Simulation/G4Utilities/G4ProfilingTools/CMakeLists.txt b/Simulation/G4Utilities/G4ProfilingTools/CMakeLists.txt index 4be3d4ca17b41559f0fe92772e52915046e9aef4..de705b7c7cd6271f650f9b69f43072fec926b1fc 100644 --- a/Simulation/G4Utilities/G4ProfilingTools/CMakeLists.txt +++ b/Simulation/G4Utilities/G4ProfilingTools/CMakeLists.txt @@ -27,8 +27,7 @@ atlas_add_library( G4ProfilingToolsLib atlas_add_component( G4ProfilingTools src/components/*.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${GEANT4_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${GEANT4_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel AthenaKernel G4AtlasToolsLib G4ProfilingToolsLib ) + LINK_LIBRARIES G4ProfilingToolsLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Simulation/G4Utilities/Geo2G4/src/ExtParameterisedVolumeBuilder.cxx b/Simulation/G4Utilities/Geo2G4/src/ExtParameterisedVolumeBuilder.cxx index 286030c43d2d6cee5549bfd95a0637b116680c32..98630e2f811a63a6c38de8d09a05ee69dd9114ff 100644 --- a/Simulation/G4Utilities/Geo2G4/src/ExtParameterisedVolumeBuilder.cxx +++ b/Simulation/G4Utilities/Geo2G4/src/ExtParameterisedVolumeBuilder.cxx @@ -39,7 +39,7 @@ ExtParameterisedVolumeBuilder::ExtParameterisedVolumeBuilder(std::string n, Geo2 { } -G4LogicalVolume* ExtParameterisedVolumeBuilder::Build(const PVConstLink theGeoPhysVolume, OpticalVolumesMap* optical_volumes) +G4LogicalVolume* ExtParameterisedVolumeBuilder::Build(const PVConstLink theGeoPhysVolume, OpticalVolumesMap* optical_volumes) const { PVConstLink theGeoPhysChild; const GeoSerialTransformer* serialTransformerChild=0; @@ -183,7 +183,7 @@ G4LogicalVolume* ExtParameterisedVolumeBuilder::Build(const PVConstLink theGeoPh return theG4LogVolume; } -Geo2G4AssemblyVolume* ExtParameterisedVolumeBuilder::BuildAssembly(PVConstLink pv) +Geo2G4AssemblyVolume* ExtParameterisedVolumeBuilder::BuildAssembly(PVConstLink pv) const { PVConstLink theGeoPhysChild; G4LogicalVolume* theG4LogChild = 0; diff --git a/Simulation/G4Utilities/Geo2G4/src/ExtParameterisedVolumeBuilder.h b/Simulation/G4Utilities/Geo2G4/src/ExtParameterisedVolumeBuilder.h index 807fb3962887d72508ab8de8502dd8aab6828e30..da0902148a2c9697c13b8a718872173c02baec4c 100644 --- a/Simulation/G4Utilities/Geo2G4/src/ExtParameterisedVolumeBuilder.h +++ b/Simulation/G4Utilities/Geo2G4/src/ExtParameterisedVolumeBuilder.h @@ -19,9 +19,9 @@ class ExtParameterisedVolumeBuilder: public VolumeBuilder public: ExtParameterisedVolumeBuilder(std::string n, Geo2G4AssemblyFactory* G4AssemblyFactory); /// - G4LogicalVolume* Build(PVConstLink pv, OpticalVolumesMap* optical_volumes = 0); + G4LogicalVolume* Build(PVConstLink pv, OpticalVolumesMap* optical_volumes = 0) const; /// - Geo2G4AssemblyVolume* BuildAssembly(PVConstLink pv); + Geo2G4AssemblyVolume* BuildAssembly(PVConstLink pv) const; /// Log a message using the Athena controlled logging system MsgStream& msg( MSG::Level lvl ) const { return m_msg << lvl; } /// Check whether the logging system is active at the provided verbosity level diff --git a/Simulation/G4Utilities/Geo2G4/src/Geo2G4Svc.cxx b/Simulation/G4Utilities/Geo2G4/src/Geo2G4Svc.cxx index 39435689a5ed4085f3282b6da87f083bc83d98f9..aff6fdfc0cfd2b3c200f15655374ccb290abd7e5 100644 --- a/Simulation/G4Utilities/Geo2G4/src/Geo2G4Svc.cxx +++ b/Simulation/G4Utilities/Geo2G4/src/Geo2G4Svc.cxx @@ -1,16 +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 */ #include "Geo2G4Svc.h" -#include "VolumeBuilder.h" #include "ExtParameterisedVolumeBuilder.h" -void InitializeBuilders(Geo2G4AssemblyFactory*); +// separate function not part of this class (why?) +BuilderMap InitializeBuilders(Geo2G4AssemblyFactory*); Geo2G4Svc::Geo2G4Svc(const std::string& name, ISvcLocator* svcLocator) : base_class(name,svcLocator) - , m_defaultBuilder(nullptr) + , m_defaultBuilder() , m_getTopTransform(true) , m_G4AssemblyFactory(nullptr) { @@ -31,12 +31,12 @@ StatusCode Geo2G4Svc::initialize() ATH_MSG_VERBOSE ("Initializing the Geo2G4Svc."); ATH_MSG_VERBOSE ("Creating all builders available."); m_G4AssemblyFactory = std::make_unique<Geo2G4AssemblyFactory>(); - InitializeBuilders(m_G4AssemblyFactory.get()); // separate function not part of this class + m_builders = InitializeBuilders(m_G4AssemblyFactory.get()); const std::string nameBuilder = "Extended_Parameterised_Volume_Builder"; //TODO Configurable property?? this->SetDefaultBuilder(nameBuilder); ATH_MSG_VERBOSE (nameBuilder << " --> set as default builder" ); - ATH_MSG_VERBOSE (nameBuilder << " --> ParamOn flag = " << m_defaultBuilder->GetParam()); + ATH_MSG_VERBOSE (nameBuilder << " --> ParamOn flag = " << GetDefaultBuilder()->GetParam()); initialized=1; if(msgLvl(MSG::VERBOSE)) { @@ -48,14 +48,6 @@ StatusCode Geo2G4Svc::initialize() StatusCode Geo2G4Svc::finalize() { ATH_MSG_VERBOSE ("Finalizing the Geo2G4Svc."); - - // clear builders... - // TODO: replace with std::unique_ptr - for (auto &x : m_builders) { - if (x.second) - delete x.second; - } - return StatusCode::SUCCESS; } @@ -63,21 +55,6 @@ void Geo2G4Svc::handle(const Incident& ) { } -void Geo2G4Svc::RegisterVolumeBuilder(VolumeBuilder* vb) -{ - std::string key(vb->GetKey()); - if (m_builders.find(key)!=m_builders.end()) - { - ATH_MSG_DEBUG ("Trying to set an already existing builder "<<key); - ATH_MSG_DEBUG ("\t request ignored, nothing done "); - } - else - { - m_builders[key]=vb; - ATH_MSG_DEBUG ("Volume builder registered "<<key); - } -} - void Geo2G4Svc::ListVolumeBuilders() const { ATH_MSG_INFO("---- List of all Volume Builders registered with Geo2G4Svc ----"); @@ -87,22 +64,7 @@ void Geo2G4Svc::ListVolumeBuilders() const ATH_MSG_INFO(" Volume Builder: "<<builder.second->GetKey()); } ATH_MSG_INFO("---------------------------------------------------------------"); - ATH_MSG_INFO(" default builder is "<<m_defaultBuilder->GetKey()); -} - -void Geo2G4Svc::UnregisterVolumeBuilder(VolumeBuilder* vb) -{ - const std::string key(vb->GetKey()); - if (m_builders.find(key)!=m_builders.end()) - { - ATH_MSG_DEBUG ("Removing builder "<<key<<" from the list"); - m_builders.erase(key); - } - else - { - ATH_MSG_ERROR ("Trying to remove a not-existing builder "<<key); - ATH_MSG_ERROR ("\t request ignored, nothing done "); - } + ATH_MSG_INFO(" default builder is "<<GetDefaultBuilder()->GetKey()); } VolumeBuilder* Geo2G4Svc::GetVolumeBuilder(std::string s) const @@ -110,12 +72,12 @@ VolumeBuilder* Geo2G4Svc::GetVolumeBuilder(std::string s) const const auto builderItr(m_builders.find(s)); if (builderItr!=m_builders.end()) { - return builderItr->second; + return builderItr->second.get(); } else { ATH_MSG_ERROR ("Trying to retrieve a not existing builder "<<s); ATH_MSG_ERROR ("\treturning Default Builder"); } - return m_defaultBuilder; + return GetDefaultBuilder(); } diff --git a/Simulation/G4Utilities/Geo2G4/src/Geo2G4Svc.h b/Simulation/G4Utilities/Geo2G4/src/Geo2G4Svc.h index f32f0fdd04cd640d07185158dcdbe80fe25aea17..de68c330f48287116c385952f92fc6817e8add80 100644 --- a/Simulation/G4Utilities/Geo2G4/src/Geo2G4Svc.h +++ b/Simulation/G4Utilities/Geo2G4/src/Geo2G4Svc.h @@ -13,12 +13,13 @@ #include "Geo2G4AssemblyFactory.h" #include "Geo2G4AssemblyVolume.h" +#include "VolumeBuilder.h" + #include <string> #include <map> #include <memory> -class VolumeBuilder; -typedef std::map< std::string, VolumeBuilder*,std::less<std::string> > BuilderMap; +typedef std::unordered_map<std::string, std::unique_ptr<VolumeBuilder>> BuilderMap; /// @todo NEEDS DOCUMENTATION class Geo2G4Svc: public extends<AthService, IGeo2G4Svc, IIncidentListener> @@ -32,17 +33,14 @@ public: /// IIncidentListener methods - FIXME does this service actually need to listen for Incidents? virtual void handle(const Incident&) override final; /// Geo2G4SvcBase methods - virtual void RegisterVolumeBuilder(VolumeBuilder* vb) override final; - virtual void UnregisterVolumeBuilder(VolumeBuilder* vb) override final; - virtual void SetDefaultBuilder(VolumeBuilder *vb) override final {m_defaultBuilder=vb;} - virtual void SetDefaultBuilder(std::string n) override final {this->SetDefaultBuilder(this->GetVolumeBuilder(n));} + virtual void SetDefaultBuilder(std::string n) override final {m_defaultBuilder=n;} virtual VolumeBuilder* GetVolumeBuilder(std::string s) const override final; - virtual VolumeBuilder* GetDefaultBuilder() const override final {return m_defaultBuilder;} + virtual VolumeBuilder* GetDefaultBuilder() const override final {return m_builders.at(m_defaultBuilder).get();} virtual bool UseTopTransforms() const override final {return m_getTopTransform;} virtual void ListVolumeBuilders() const override final; private: - VolumeBuilder *m_defaultBuilder; - BuilderMap m_builders ; + std::string m_defaultBuilder; + BuilderMap m_builders; bool m_getTopTransform; std::unique_ptr<Geo2G4AssemblyFactory> m_G4AssemblyFactory; }; diff --git a/Simulation/G4Utilities/Geo2G4/src/InitializeBuilders.cxx b/Simulation/G4Utilities/Geo2G4/src/InitializeBuilders.cxx index 7a002c344c9ad0b83da85db40d223ca4f5eeb2b3..990bacf9544078886890cb624872b3cc89a9a071 100644 --- a/Simulation/G4Utilities/Geo2G4/src/InitializeBuilders.cxx +++ b/Simulation/G4Utilities/Geo2G4/src/InitializeBuilders.cxx @@ -1,12 +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 <memory> + #include "ExtParameterisedVolumeBuilder.h" #include "Geo2G4AssemblyFactory.h" -void InitializeBuilders(Geo2G4AssemblyFactory* assemblyFactory) +typedef std::unordered_map<std::string, std::unique_ptr<VolumeBuilder>> BuilderMap; + +BuilderMap InitializeBuilders(Geo2G4AssemblyFactory *assemblyFactory) { - ExtParameterisedVolumeBuilder *epb __attribute__ ((unused)) = - new ExtParameterisedVolumeBuilder("Extended_Parameterised_Volume_Builder", assemblyFactory); + BuilderMap map; + map.emplace("Extended_Parameterised_Volume_Builder", + std::make_unique<ExtParameterisedVolumeBuilder>("Extended_Parameterised_Volume_Builder", assemblyFactory)); + return map; } diff --git a/Simulation/G4Utilities/Geo2G4/src/VolumeBuilder.h b/Simulation/G4Utilities/Geo2G4/src/VolumeBuilder.h index afc5195d060f948e035c0df0ac4e9cf02b1205e8..4eb85834c8be62e26b0c49e9929026432c4ccafe 100644 --- a/Simulation/G4Utilities/Geo2G4/src/VolumeBuilder.h +++ b/Simulation/G4Utilities/Geo2G4/src/VolumeBuilder.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 GEO2G4_VolumeBuilder_H @@ -22,26 +22,18 @@ class VolumeBuilder { public: VolumeBuilder(std::string k): m_paramOn(false), m_key(k) - { - Geo2G4SvcAccessor accessor; - Geo2G4SvcBase *g=accessor.GetGeo2G4Svc(); - g->RegisterVolumeBuilder(this); - } + {} virtual ~VolumeBuilder() - { - Geo2G4SvcAccessor accessor; - Geo2G4SvcBase *g=accessor.GetGeo2G4Svc(); - g->UnregisterVolumeBuilder(this); - } + {} std::string GetKey() const {return m_key;} // flag controlling Parameterization to Parameterization translation void SetParam(bool flag){m_paramOn = flag;} - bool GetParam(){return m_paramOn;} + bool GetParam() const {return m_paramOn;} - virtual G4LogicalVolume* Build(PVConstLink pv, OpticalVolumesMap* optical_volumes = 0) = 0; + virtual G4LogicalVolume* Build(PVConstLink pv, OpticalVolumesMap* optical_volumes = 0) const = 0; protected: bool m_paramOn; diff --git a/Simulation/G4Utilities/MCTruthAlgs/CMakeLists.txt b/Simulation/G4Utilities/MCTruthAlgs/CMakeLists.txt index 22e41cb97d486a9349964d5b7d06c23faeb8ffef..f1ac8db5e3b96e802a96b00b74dfde97c786629a 100644 --- a/Simulation/G4Utilities/MCTruthAlgs/CMakeLists.txt +++ b/Simulation/G4Utilities/MCTruthAlgs/CMakeLists.txt @@ -21,8 +21,7 @@ atlas_add_library( MCTruthAlgsLib atlas_add_component( MCTruthAlgs src/components/*.cxx - INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel MCTruthAlgsLib ) + LINK_LIBRARIES MCTruthAlgsLib ) # Install files from the package: atlas_install_joboptions( share/*.py ) diff --git a/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt b/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt index 4214bf122c2c5c52edc77caf6ea8c5763be1bd56..74a442533079bbd493085f2ae2ff656dbeb2d840 100644 --- a/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt +++ b/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt @@ -22,8 +22,7 @@ atlas_add_library( TrackWriteFastSimLib atlas_add_component( TrackWriteFastSim src/components/*.cxx - INCLUDE_DIRS ${GEANT4_INCLUDE_DIRS} ${XERCESC_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} StoreGateLib SGtests GaudiKernel G4AtlasInterfaces G4AtlasToolsLib MCTruth TrackWriteFastSimLib ) + LINK_LIBRARIES TrackWriteFastSimLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Simulation/ISF/ISF_Core/ISF_Algorithms/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Algorithms/CMakeLists.txt index e9b973b08d093bc16514bfc2d3decfcd2d0416f2..166b7f76169950c43404b437ce80db8c0292e85e 100644 --- a/Simulation/ISF/ISF_Core/ISF_Algorithms/CMakeLists.txt +++ b/Simulation/ISF/ISF_Core/ISF_Algorithms/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 780090 2016-10-24 15:27:10Z krasznaa $ ################################################################################ # Package: ISF_Algorithms ################################################################################ @@ -61,4 +60,3 @@ set_target_properties( ISF_Algorithms_SimKernelMT_test PROPERTIES ENABLE_EXPORTS # Install files from the package: atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) diff --git a/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt index 27dfefdb3c56c795c22e9db681787764f543bf89..ac713fc23b920f72c6aa5bf529766294cfd60e32 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt +++ b/Simulation/ISF/ISF_Core/ISF_Services/CMakeLists.txt @@ -99,5 +99,5 @@ atlas_add_test( ISF_ServicesConfigNew_test set_target_properties( ISF_Services_TruthSvc_test PROPERTIES ENABLE_EXPORTS True ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfig.py b/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfig.py index 85cce192b92d0449a98d15487a3228c3b29c9def..872560f5ee2b807b4864ebb6611029b2f11cdabf 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfig.py +++ b/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfig.py @@ -7,9 +7,6 @@ KG Tan, 17/06/2012 from AthenaCommon import CfgMgr -from AthenaCommon.Constants import * # FATAL,ERROR etc. -from AthenaCommon.SystemOfUnits import * - def getParticleBrokerSvcNoOrdering(name="ISF_ParticleBrokerSvcNoOrdering", **kwargs): kwargs.setdefault('EntryLayerTool', 'ISF_EntryLayerTool') diff --git a/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfigNew.py b/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfigNew.py index 7cefb98f4f5377f2a5ea4a475ba7e98d00633b65..6f2f6fcdc0c89332e25582a920949d63200cc8a0 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfigNew.py +++ b/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesConfigNew.py @@ -20,7 +20,10 @@ from ISF_HepMC_Tools.ISF_HepMC_ToolsConfigNew import ( ParticleSimWhiteListCfg, ) from BarcodeServices.BarcodeServicesConfigNew import BarcodeSvcCfg - +from ISF_Geant4CommonTools.ISF_Geant4CommonToolsConfigNew import ( + EntryLayerToolCfg, AFIIEntryLayerToolCfg +) +from ISF_Tools.ISF_ToolsConfigNew import ParticleOrderingToolCfg def GenParticleFiltersToolCfg(ConfigFlags): result = ComponentAccumulator() @@ -64,6 +67,43 @@ def LongLivedInputConverterCfg(ConfigFlags, name="ISF_LongLivedInputConverter", return InputConverterCfg(name, **kwargs) +def ParticleBrokerSvcNoOrderingCfg(ConfigFlags, name="ISF_ParticleBrokerSvcNoOrdering", **kwargs): + result = ComponentAccumulator() + if "EntryLayerTool" not in kwargs: + tool = result.popToolsAndMerge(EntryLayerToolCfg(ConfigFlags)) + kwargs.setdefault("EntryLayerTool", tool) + kwargs.setdefault("GeoIDSvc", result.getService("ISF_GeoIDSvc")) + # assume "GeoIDSvc" has been set alongside "EntryLayerTool" + kwargs.setdefault("AlwaysUseGeoIDSvc", False) + kwargs.setdefault("ValidateGeoIDs", ConfigFlags.ISF.ValidationMode) + kwargs.setdefault("ValidationOutput", ConfigFlags.ISF.ValidationMode) + kwargs.setdefault("ValidationStreamName", "ParticleBroker") + + baracc = BarcodeSvcCfg(ConfigFlags) + kwargs.setdefault("BarcodeService", baracc.getPrimary()) + result.merge(baracc) + + result.addService(CompFactory.ISF.ParticleBrokerDynamicOnReadIn(name, **kwargs)) + return result + + +def ParticleBrokerSvcCfg(ConfigFlags, name="ISF_ParticleBrokerSvc", **kwargs): + # comment copied from old config + #kwargs.setdefault("ParticleOrderingTool", "ISF_InToOutSubDetOrderingTool") + result = ParticleOrderingToolCfg(ConfigFlags) + kwargs.setdefault("ParticleOrderingTool", result.popPrivateTools()) + result.merge(ParticleBrokerSvcNoOrderingCfg(name, **kwargs)) + return result + + +def AFIIParticleBrokerSvcCfg(ConfigFlags, name="ISF_AFIIParticleBrokerSvc", **kwargs): + result = AFIIEntryLayerToolCfg(ConfigFlags) + kwargs.setdefault("EntryLayerTool", result.popPrivateTools()) + kwargs.setdefault("GeoIDSvc", result.getService("ISF_AFIIGeoIDSvc")) + result.merge(ParticleBrokerSvcCfg(name, **kwargs)) + return result + + # Generic Truth Service Configurations def TruthServiceCfg(ConfigFlags, **kwargs): """Return the TruthService config flagged by Sim.TruthStrategy""" diff --git a/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesCoreConfigNew.py b/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesCoreConfigNew.py index 6dc3ea47bffa649c08e995f912b6d97c923540d9..fac9ab538c0dcd07fc8a615441f48b6f02dd53a1 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesCoreConfigNew.py +++ b/Simulation/ISF/ISF_Core/ISF_Services/python/ISF_ServicesCoreConfigNew.py @@ -8,34 +8,9 @@ from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from AthenaCommon.SystemOfUnits import mm from SubDetectorEnvelopes.SubDetectorEnvelopesConfigNew import EnvelopeDefSvcCfg -from BarcodeServices.BarcodeServicesConfigNew import BarcodeSvcCfg from ISF_Tools.ISF_ToolsConfigNew import ParticleKillerToolCfg -def ParticleBrokerSvcNoOrderingCfg(ConfigFlags, name="ISF_ParticleBrokerSvcNoOrdering", **kwargs): - kwargs.setdefault("EntryLayerTool", "ISF_EntryLayerTool") # TODO - kwargs.setdefault("GeoIDSvc", "ISF_GeoIDSvc") # TODO - kwargs.setdefault("AlwaysUseGeoIDSvc", False) - kwargs.setdefault("ValidateGeoIDs", ConfigFlags.ISF.ValidationMode) - kwargs.setdefault("ValidationOutput", ConfigFlags.ISF.ValidationMode) - kwargs.setdefault("ValidationStreamName", "ParticleBroker") - result = BarcodeSvcCfg(ConfigFlags) - kwargs.setdefault("BarcodeService", result.getPrimary()) - result.addService(CompFactory.ISF.ParticleBrokerDynamicOnReadIn(name, **kwargs)) - return result - - -def ParticleBrokerSvcCfg(ConfigFlags, name="ISF_ParticleBrokerSvc", **kwargs): - #kwargs.setdefault("ParticleOrderingTool", "ISF_InToOutSubDetOrderingTool") - kwargs.setdefault("ParticleOrderingTool", "ISF_ParticleOrderingTool") # TODO - return ParticleBrokerSvcNoOrderingCfg(name, **kwargs) - - -def AFIIParticleBrokerSvcCfg(ConfigFlags, name="ISF_AFIIParticleBrokerSvc", **kwargs): - kwargs.setdefault("EntryLayerTool", "ISF_AFIIEntryLayerTool") # TODO - return ParticleBrokerSvcCfg(name, **kwargs) - - def ISFEnvelopeDefSvcCfg(ConfigFlags, name="ISF_ISFEnvelopeDefSvc", **kwargs): result = EnvelopeDefSvcCfg(ConfigFlags) # ATLAS common envlope definitions @@ -72,7 +47,8 @@ def AFIIGeoIDSvcCfg(ConfigFlags, name="ISF_AFIIGeoIDSvc", **kwargs): def ParticleKillerSvcCfg(ConfigFlags, name="ISF_ParticleKillerSvc", **kwargs): result = ComponentAccumulator() kwargs.setdefault("Identifier", "ParticleKiller") - kwargs.setdefault("SimulatorTool", ParticleKillerToolCfg(ConfigFlags)) + tool = result.popToolsAndMerge(ParticleKillerToolCfg(ConfigFlags)) + kwargs.setdefault("SimulatorTool", tool) svc = CompFactory.ISF.LegacySimSvc(name, **kwargs) result.addService(svc) return result diff --git a/Simulation/ISF/ISF_Core/ISF_Services/python/LegacySimServicesConfig.py b/Simulation/ISF/ISF_Core/ISF_Services/python/LegacySimServicesConfig.py index 63af5e485275160d9ccec05e7826863d3da8f196..21d06ca2e5903bedfc4f17e21eef19ade78bae51 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/python/LegacySimServicesConfig.py +++ b/Simulation/ISF/ISF_Core/ISF_Services/python/LegacySimServicesConfig.py @@ -6,8 +6,6 @@ Configurations for (potentially) thread-unsafe ISF Sim Services from AthenaCommon import CfgMgr -from AthenaCommon.Constants import * # FATAL,ERROR etc. -from AthenaCommon.SystemOfUnits import * def getParticleKillerSvc(name="ISF_ParticleKillerSvc", **kwargs): kwargs.setdefault('Identifier', "ParticleKiller") diff --git a/Simulation/ISF/ISF_Core/ISF_Tools/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Tools/CMakeLists.txt index 5b8165fe255b83647da958ca5b88fb0b576c350a..5546a231ded81f6c655a7575be426ddbb5350022 100644 --- a/Simulation/ISF/ISF_Core/ISF_Tools/CMakeLists.txt +++ b/Simulation/ISF/ISF_Core/ISF_Tools/CMakeLists.txt @@ -12,5 +12,5 @@ atlas_add_component( ISF_Tools LINK_LIBRARIES GaudiKernel AthenaBaseComps AtlasDetDescr BarcodeInterfacesLib GeneratorObjects ISF_Event ISF_InterfacesLib TrackRecordLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Simulation/ISF/ISF_Core/ISF_Tools/python/ISF_ToolsConfig.py b/Simulation/ISF/ISF_Core/ISF_Tools/python/ISF_ToolsConfig.py index c3c977d988156ff495079ae84fa32a20091cd650..08aafc0e00846a71c579a2f9dfdd7944a3694906 100644 --- a/Simulation/ISF/ISF_Core/ISF_Tools/python/ISF_ToolsConfig.py +++ b/Simulation/ISF/ISF_Core/ISF_Tools/python/ISF_ToolsConfig.py @@ -8,9 +8,7 @@ KG Tan, 17/06/2012 """ from AthenaCommon import CfgMgr -from AthenaCommon.Constants import * # FATAL,ERROR etc. -from AthenaCommon.SystemOfUnits import * -from AthenaCommon.DetFlags import DetFlags +from AthenaCommon.SystemOfUnits import MeV def getParticleHelper(name="ISF_ParticleHelper", **kwargs): from G4AtlasApps.SimFlags import simFlags diff --git a/Simulation/ISF/ISF_Core/ISF_Tools/python/ISF_ToolsConfigDb.py b/Simulation/ISF/ISF_Core/ISF_Tools/python/ISF_ToolsConfigDb.py index 087b25ef0697e44495da414caa05946cf091fb2e..74f7cfc6570e1b68bf03718bfc2c93a51850b9ce 100644 --- a/Simulation/ISF/ISF_Core/ISF_Tools/python/ISF_ToolsConfigDb.py +++ b/Simulation/ISF/ISF_Core/ISF_Tools/python/ISF_ToolsConfigDb.py @@ -7,9 +7,6 @@ Elmar Ritsch, 31/10/2014 from AthenaCommon.CfgGetter import addTool -from AthenaCommon.Constants import * # FATAL,ERROR etc. -import AthenaCommon.SystemOfUnits as Units - # Common tools, services and algorithms used by jobs addTool("ISF_Tools.ISF_ToolsConfig.getParticleHelper" , "ISF_ParticleHelper" ) addTool("ISF_Tools.ISF_ToolsConfig.getMemoryMonitor" , "ISF_MemoryMonitor" ) diff --git a/Simulation/ISF/ISF_Core/ISF_Tools/python/ISF_ToolsConfigNew.py b/Simulation/ISF/ISF_Core/ISF_Tools/python/ISF_ToolsConfigNew.py index 2b8c4355e8c3e77acade30587783e9621fb01e51..b985690499a3fa81502c990370cb3ef0d3709ee2 100644 --- a/Simulation/ISF/ISF_Core/ISF_Tools/python/ISF_ToolsConfigNew.py +++ b/Simulation/ISF/ISF_Core/ISF_Tools/python/ISF_ToolsConfigNew.py @@ -2,6 +2,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from AthenaCommon.SystemOfUnits import MeV from BarcodeServices.BarcodeServicesConfigNew import BarcodeSvcCfg @@ -15,7 +16,9 @@ def ParticleHelperCfg(flags, name="ISF_ParticleHelper", **kwargs): def MemoryMonitorToolCfg(flags, name="ISF_MemoryMonitor", **kwargs): - return CompFactory.ISF.MemoryMonitoringTool(name, **kwargs) + acc = ComponentAccumulator() + acc.setPrivateTools(CompFactory.ISF.MemoryMonitoringTool(name, **kwargs)) + return acc def EntryLayerFilterCfg(ConfigFlags, **kwargs): @@ -112,12 +115,16 @@ def CosmicEventFilterToolCfg(flags, name="ISF_CosmicEventFilter", **kwargs): kwargs.setdefault("PDG_ID", flags.Sim.CosmicFilterID) kwargs.setdefault("ptMin", flags.Sim.CosmicFilterPTmin) kwargs.setdefault("ptMax", flags.Sim.CosmicFilterPTmax) - return CompFactory.ISF.CosmicEventFilterTool(name, **kwargs) + acc = ComponentAccumulator() + acc.setPrivateTools(CompFactory.ISF.CosmicEventFilterTool(name, **kwargs)) + return acc def StoppedParticleFilterToolCfg(flags, name="ISF_StoppedParticleFilter", **kwargs): kwargs.setdefault("VolumeNames", ["StoppingPositions"]) - return CompFactory.ISF.CosmicEventFilterTool(name, **kwargs) + acc = ComponentAccumulator() + acc.setPrivateTools(CompFactory.ISF.CosmicEventFilterTool(name, **kwargs)) + return acc def InToOutSubDetOrderingToolCfg(flags, name="ISF_InToOutSubDetOrderingTool", **kwargs): @@ -127,7 +134,9 @@ def InToOutSubDetOrderingToolCfg(flags, name="ISF_InToOutSubDetOrderingTool", ** kwargs.setdefault("OrderCalo" , 10000 ) kwargs.setdefault("OrderMS" , 100 ) kwargs.setdefault("OrderCavern" , 1 ) - return CompFactory.ISF.GenericParticleOrderingTool(name, **kwargs) + acc = ComponentAccumulator() + acc.setPrivateTools(CompFactory.ISF.GenericParticleOrderingTool(name, **kwargs)) + return acc def ParticleOrderingToolCfg(flags, name="ISF_ParticleOrderingTool", **kwargs): @@ -136,12 +145,18 @@ def ParticleOrderingToolCfg(flags, name="ISF_ParticleOrderingTool", **kwargs): kwargs.setdefault("OrderCalo" , 1) kwargs.setdefault("OrderMS" , 1) kwargs.setdefault("OrderCavern" , 1) - return CompFactory.ISF.GenericParticleOrderingTool(name, **kwargs) + acc = ComponentAccumulator() + acc.setPrivateTools(CompFactory.ISF.GenericParticleOrderingTool(name, **kwargs)) + return acc def EnergyParticleOrderingToolCfg(flags, name="ISF_EnergyParticleOrderingTool", **kwargs): - return CompFactory.ISF.EnergyParticleOrderingTool(name, **kwargs) + acc = ComponentAccumulator() + acc.setPrivateTools(CompFactory.ISF.EnergyParticleOrderingTool(name, **kwargs)) + return acc def ParticleKillerToolCfg(flags, name="ISF_ParticleKillerTool", **kwargs): - return CompFactory.ISF.ParticleKillerSimTool(name, **kwargs) + acc = ComponentAccumulator() + acc.setPrivateTools(CompFactory.ISF.ParticleKillerSimTool(name, **kwargs)) + return acc diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/src/DNNCaloSimSvc.h b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/src/DNNCaloSimSvc.h index 03f75dd0ec9354af87986c8f16835c2b2791825d..c31669323f89ebfc4d72260821ed7ef028725634 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/src/DNNCaloSimSvc.h +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimServices/src/DNNCaloSimSvc.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 */ ////////////////////////////////////////////////////////////////// @@ -51,7 +51,7 @@ namespace ISF { @author Aishik.Ghosh -at- cern.ch, David Rousseau -at- cern.ch, */ - class DNNCaloSimSvc : public BaseSimulationSvc + class DNNCaloSimSvc final : public BaseSimulationSvc { public: /** Constructor with parameters */ diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/CMakeLists.txt b/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/CMakeLists.txt index 61283b2cd776cf5eeba2877cd63272afd5c77e04..c0117617cb72c55cb5b0b8268390e6ef3d3a6ecf 100644 --- a/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/CMakeLists.txt +++ b/Simulation/ISF/ISF_FastCaloSim/ISF_PunchThroughTools/CMakeLists.txt @@ -17,7 +17,3 @@ atlas_add_component( ISF_PunchThroughTools src/components/*.cxx INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel BarcodeInterfacesLib GeoPrimitives ISF_FastCaloSimInterfaces AthContainers GaudiKernel ISF_Event ISF_InterfacesLib PathResolver SubDetectorEnvelopesLib ) - -# Install files from the package: -atlas_install_runtime( Data/*.root ) - diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/CMakeLists.txt index c011d5fcbde25c49dc376965d25b785bbaee0305..a5eaf4c39abc6c55f3bda3bc5c32bfc87e9b8ea3 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/CMakeLists.txt +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/CMakeLists.txt @@ -19,8 +19,7 @@ atlas_add_library( ISF_FatrasDetDescrToolsLib atlas_add_component( ISF_FatrasDetDescrTools src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel ISF_FatrasDetDescrInterfaces ISF_FatrasDetDescrModel TrkDetDescrInterfaces TrkDetDescrUtils TrkSurfaces StoreGateLib SGtests InDetIdentifier InDetReadoutGeometry TrkGeometry TrkVolumes ISF_FatrasDetDescrToolsLib ) + LINK_LIBRARIES ISF_FatrasDetDescrToolsLib ) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfigNew.py b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfigNew.py index ab18670d240b9f8e30d575390315f5eeb98d4dac..ef13934d41ae61f507f44d63d82494b6f9ce18d5 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfigNew.py +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/python/ISF_Geant4CommonToolsConfigNew.py @@ -2,16 +2,19 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ +from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory -from ISF_Services.ISF_ServicesConfigNew import GeoIDSvcCfg, AFIIGeoIDSvcCfg +from ISF_Services.ISF_ServicesCoreConfigNew import GeoIDSvcCfg, AFIIGeoIDSvcCfg from ISF_Tools.ISF_ToolsConfigNew import EntryLayerFilterCfg def EntryLayerToolCfg(flags, name="ISF_EntryLayerTool", **kwargs): - acc = GeoIDSvcCfg(flags) - kwargs.setdefault("GeoIDSvc", acc.getService("ISF_GeoIDSvc")) - acc_filter = EntryLayerFilterCfg(flags) - kwargs.setdefault("ParticleFilters", [acc.popToolsAndMerge(acc_filter)]) + acc = ComponentAccumulator() + if "GeoIDSvc" not in kwargs: + acc.merge(GeoIDSvcCfg(flags)) + kwargs["GeoIDSvc"] = acc.getService("ISF_GeoIDSvc") + filt = acc.popToolsAndMerge(EntryLayerFilterCfg(flags)) + kwargs.setdefault("ParticleFilters", [filt]) if flags.Sim.DoFullChain: # TODO and DetFlags.pileup.any_on(): kwargs.setdefault("EvtStore", "OriginalEvent_SG") # For Fast Chain acc.setPrivateTools(CompFactory.ISF.EntryLayerTool(name, **kwargs)) @@ -19,10 +22,12 @@ def EntryLayerToolCfg(flags, name="ISF_EntryLayerTool", **kwargs): def EntryLayerToolMTCfg(flags, name="ISF_EntryLayerToolMT", **kwargs): - acc = GeoIDSvcCfg(flags) - kwargs.setdefault("GeoIDSvc", acc.getService("ISF_GeoIDSvc")) - acc_filter = EntryLayerFilterCfg(flags) - kwargs.setdefault("ParticleFilters", [acc.popToolsAndMerge(acc_filter)]) + acc = ComponentAccumulator() + if "GeoIDSvc" not in kwargs: + acc.merge(GeoIDSvcCfg(flags)) + kwargs["GeoIDSvc"] = acc.getService("ISF_GeoIDSvc") + filt = acc.popToolsAndMerge(EntryLayerFilterCfg(flags)) + kwargs.setdefault("ParticleFilters", [filt]) if flags.Sim.DoFullChain: # TODO and DetFlags.pileup.any_on(): kwargs.setdefault("EvtStore", "OriginalEvent_SG") # For Fast Chain acc.setPrivateTools(CompFactory.ISF.EntryLayerToolMT(name, **kwargs)) @@ -30,14 +35,20 @@ def EntryLayerToolMTCfg(flags, name="ISF_EntryLayerToolMT", **kwargs): def AFIIEntryLayerToolCfg(flags, name="ISF_AFIIEntryLayerTool", **kwargs): - acc = AFIIGeoIDSvcCfg(flags) - kwargs.setdefault("GeoIDSvc", acc.getService("ISF_AFIIGeoIDSvc")) - acc.merge(EntryLayerToolCfg(name, **kwargs)) + acc = ComponentAccumulator() + if "GeoIDSvc" not in kwargs: + acc.merge(AFIIGeoIDSvcCfg(flags)) + kwargs["GeoIDSvc"] = acc.getService("ISF_AFIIGeoIDSvc") + tool = acc.popToolsAndMerge(EntryLayerToolCfg(name, **kwargs)) + acc.setPrivateTools(tool) return acc def AFIIEntryLayerToolMTCfg(flags, name="ISF_AFIIEntryLayerToolMT", **kwargs): - acc = AFIIGeoIDSvcCfg(flags) - kwargs.setdefault("GeoIDSvc", acc.getService("ISF_AFIIGeoIDSvc")) - acc.merge(EntryLayerToolMTCfg(name, **kwargs)) + acc = ComponentAccumulator() + if "GeoIDSvc" not in kwargs: + acc.merge(AFIIGeoIDSvcCfg(flags)) + kwargs["GeoIDSvc"] = acc.getService("ISF_AFIIGeoIDSvc") + tool = acc.popToolsAndMerge(EntryLayerToolMTCfg(name, **kwargs)) + acc.setPrivateTools(tool) return acc diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt index 4b519f49a9dbadc13a4211f860fa457c11fd191d..a055119d2cfa1b54512e09ff1f1ed1813966eb37 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/CMakeLists.txt @@ -26,5 +26,5 @@ atlas_add_component( ISF_Geant4Tools LINK_LIBRARIES ${ROOT_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib ${GEANT4_LIBRARIES} ${EIGEN_LIBRARIES} AthenaKernel GaudiKernel G4AtlasInterfaces AthenaBaseComps StoreGateLib SGtests AtlasDetDescr GeneratorObjects G4AtlasToolsLib G4AtlasAlgLib MCTruth SimHelpers ISF_Event ISF_InterfacesLib ISF_Geant4Event ISF_Geant4ToolsLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfig.py b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfig.py index 780c222afe5dbb176296164584d095e1cc3864d1..771508249313274d532c186fb428f22634927072 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfig.py +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfig.py @@ -14,6 +14,7 @@ def getMCTruthUserActionTool(name='ISFMCTruthUserActionTool', **kwargs): ## ----------------------------------------------------------------------------- ### Base Version def getPhysicsValidationUserActionTool(name="ISFG4PhysicsValidationUserActionTool", **kwargs): + from AthenaCommon import CfgMgr return CfgMgr.G4UA__iGeant4__PhysicsValidationUserActionTool(name, **kwargs) ## ----------------------------------------------------------------------------- @@ -35,7 +36,6 @@ def getFullG4TrackProcessorUserActionTool(name='FullG4TrackProcessorUserActionTo kwargs.setdefault('EntryLayerTool', 'ISF_EntryLayerToolMT') kwargs.setdefault('EntryLayerTool', 'ISF_EntryLayerTool') kwargs.setdefault('GeoIDSvc', 'ISF_GeoIDSvc' ) - from AthenaCommon.BeamFlags import jobproperties from G4AtlasApps.SimFlags import simFlags if simFlags.SimulateCavern.get_Value(): kwargs.setdefault('TruthVolumeLevel', 2) @@ -104,6 +104,6 @@ def getLongLivedGeant4Tool(name="ISF_LongLivedGeant4Tool", **kwargs): def getAFII_QS_Geant4Tool(name='AFII_QS_Geant4Tool', **kwargs): kwargs.setdefault('InputConverter', 'ISF_LongLivedInputConverter') - return getAFII_Geant4Tool(name, **kwargs) + return getAFIIGeant4Tool(name, **kwargs) ## ----------------------------------------------------------------------------- diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfigNew.py b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfigNew.py index f132d21e71f0eeb5c5e03c89ea0d7ab1f26599e6..6d92ec8ecf05f99837e0cf59cdb98b9fee9fe8d8 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfigNew.py +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/python/ISF_Geant4ToolsConfigNew.py @@ -5,8 +5,9 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from AthenaCommon.SystemOfUnits import MeV +from ISF_Services.ISF_ServicesCoreConfigNew import GeoIDSvcCfg, AFIIGeoIDSvcCfg from ISF_Services.ISF_ServicesConfigNew import ( - TruthServiceCfg, GeoIDSvcCfg, AFIIGeoIDSvcCfg, + TruthServiceCfg, ParticleBrokerSvcCfg, InputConverterCfg, LongLivedInputConverterCfg ) diff --git a/Simulation/ISF/ISF_Validation/CMakeLists.txt b/Simulation/ISF/ISF_Validation/CMakeLists.txt index 195984c0678b175952dbf441d0026fa2d350ba62..dd635b7e7e6584c3824444883140bb5c732da437 100644 --- a/Simulation/ISF/ISF_Validation/CMakeLists.txt +++ b/Simulation/ISF/ISF_Validation/CMakeLists.txt @@ -6,5 +6,4 @@ atlas_subdir( ISF_Validation ) # Install files from the package: -atlas_install_runtime( test/ISF_Validation_TestConfiguration.xml ) atlas_install_scripts( scripts/*.sh test/*.sh ) diff --git a/Simulation/Tests/DigitizationTests/CMakeLists.txt b/Simulation/Tests/DigitizationTests/CMakeLists.txt index b7d5633cad9ae927e5ffa69fc7ee158e20b28ded..b08b5c63d1f13d61c4d82056e7e816c7958ab388 100644 --- a/Simulation/Tests/DigitizationTests/CMakeLists.txt +++ b/Simulation/Tests/DigitizationTests/CMakeLists.txt @@ -19,6 +19,4 @@ atlas_add_component( DigitizationTests # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) -atlas_install_runtime( test/DigitizationTests_TestConfiguration.xml ) atlas_install_scripts( scripts/*.sh test/*.sh ) - diff --git a/Simulation/Tests/SimCoreTests/CMakeLists.txt b/Simulation/Tests/SimCoreTests/CMakeLists.txt index e86d8e07591c2b6e17e148c00747911ef6e2088a..1daba988335735ca9f000a678fd7d85cb6620605 100644 --- a/Simulation/Tests/SimCoreTests/CMakeLists.txt +++ b/Simulation/Tests/SimCoreTests/CMakeLists.txt @@ -6,5 +6,4 @@ atlas_subdir( SimCoreTests ) # Install files from the package: -atlas_install_runtime( test/SimCoreTests_TestConfiguration.xml ) -atlas_install_scripts( test/*.sh test/*.py ) +atlas_install_scripts( test/*.sh ) diff --git a/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx index 0829eb097bc20d1d65eca86e533dafa3b45542e4..e4a5321e25fffe1ce70d8dc6d037ab54fd05309a 100644 --- a/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx +++ b/Simulation/Tools/CaloSamplingFractionAnalysis/src/LArFCalSamplingFraction.cxx @@ -47,10 +47,10 @@ #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 "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenVertex.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/SimpleVector.h" #include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Vector/ThreeVector.h" #include "CLHEP/Geometry/Point3D.h" @@ -746,18 +746,16 @@ void LArFCalSamplingFraction::FCalCalibAnalysis(const std::string name, const Ca void LArFCalSamplingFraction::TruthImpactPosition(McEventCollection::const_iterator e) { - for (HepMC::GenEvent::particle_const_iterator p = (**e).particles_begin(); - p != (**e).particles_end(); p++) + for (auto theParticle: **e) { - 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(); + HepMC::FourVector HMC3vec(0.0,0.0,0.0,0.0); + if (theParticle->production_vertex()) 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 @@ -900,11 +898,8 @@ StatusCode LArFCalSamplingFraction::doFCal() mcEvent++) { // There may be many particles per event - for (HepMC::GenEvent::particle_const_iterator p = (**mcEvent).particles_begin(); - p != (**mcEvent).particles_end(); - p++) + for (auto theParticle: **mcEvent) { - const HepMC::GenParticle *theParticle = *p; m_pdg_id->push_back(theParticle->pdg_id()); numParticles++; } diff --git a/Simulation/Tools/McEventCollectionFilter/CMakeLists.txt b/Simulation/Tools/McEventCollectionFilter/CMakeLists.txt index 03ae0ddc3ea17b55d3d4d51dfe53e7e3605886db..9ccabdd1a4051296c4259d70418a49643df639db 100644 --- a/Simulation/Tools/McEventCollectionFilter/CMakeLists.txt +++ b/Simulation/Tools/McEventCollectionFilter/CMakeLists.txt @@ -15,12 +15,11 @@ atlas_add_library( McEventCollectionFilterLib NO_PUBLIC_HEADERS PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel GeneratorObjects InDetSimEvent MuonSimEvent ) + LINK_LIBRARIES AthenaBaseComps GeneratorObjects InDetSimEvent MuonSimEvent StoreGateLib SGtests + PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} GeoPrimitives GaudiKernel ) atlas_add_component( McEventCollectionFilter src/components/*.cxx - INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GeoPrimitives GaudiKernel GeneratorObjects InDetSimEvent MuonSimEvent McEventCollectionFilterLib ) + LINK_LIBRARIES McEventCollectionFilterLib ) atlas_install_python_modules( python/*.py ) diff --git a/TileCalorimeter/TileConditions/TileConditions/TileCondToolNoiseSample.h b/TileCalorimeter/TileConditions/TileConditions/TileCondToolNoiseSample.h index b84211ee8b39f619cd44d31c787efd249f99d9e7..c25a9a757c17eb5c9f5b2f2192557157940ff4ff 100644 --- a/TileCalorimeter/TileConditions/TileConditions/TileCondToolNoiseSample.h +++ b/TileCalorimeter/TileConditions/TileConditions/TileCondToolNoiseSample.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 TILECONDITIONS_TILECONDTOOLNOISESAMPLE_H @@ -64,8 +64,6 @@ class TileCondToolNoiseSample: public AthAlgTool SG::ReadCondHandleKey<TileEMScale> m_emScaleKey{this, "TileEMScale", "TileEMScale", "Input Tile EMS conditions"}; - - bool m_useOnlineNoise; }; #endif diff --git a/TileCalorimeter/TileConditions/src/TileCondToolNoiseSample.cxx b/TileCalorimeter/TileConditions/src/TileCondToolNoiseSample.cxx index f99cc8724707b796dd3452eaa11e26122e522ba4..778807f859df625707ff3d9223aa07aa9fca7f83 100644 --- a/TileCalorimeter/TileConditions/src/TileCondToolNoiseSample.cxx +++ b/TileCalorimeter/TileConditions/src/TileCondToolNoiseSample.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 */ // Tile includes @@ -21,7 +21,6 @@ const InterfaceID& TileCondToolNoiseSample::interfaceID() { //____________________________________________________________________ TileCondToolNoiseSample::TileCondToolNoiseSample(const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type, name, parent) - , m_useOnlineNoise(false) { declareInterface<ITileCondToolNoise>(this); declareInterface<TileCondToolNoiseSample>(this); @@ -41,11 +40,7 @@ StatusCode TileCondToolNoiseSample::initialize() { //=== retrieve proxy ATH_CHECK( m_calibSampleNoiseKey.initialize() ); - m_useOnlineNoise = !(m_calibOnlineSampleNoiseKey.key().empty()); - - if (m_useOnlineNoise) { - ATH_CHECK( m_calibOnlineSampleNoiseKey.initialize()); - } + ATH_CHECK( m_calibOnlineSampleNoiseKey.initialize (SG::AllowEmpty)); ATH_CHECK( m_emScaleKey.initialize() ); @@ -167,7 +162,7 @@ float TileCondToolNoiseSample::getOnlinePedestalDifference(unsigned int drawerId float pedestalDifference(0.0); - if (m_useOnlineNoise) { + if (!m_calibOnlineSampleNoiseKey.empty()) { SG::ReadCondHandle<TileCalibDataFlt> calibSampleNoise(m_calibSampleNoiseKey); SG::ReadCondHandle<TileCalibDataFlt> calibOnlineSampleNoise(m_calibOnlineSampleNoiseKey); diff --git a/TileCalorimeter/TilePulseSimulator/CMakeLists.txt b/TileCalorimeter/TilePulseSimulator/CMakeLists.txt index a8e1435fce0ff11a3ab422e60518f4635983369c..7b8932863aaa879b85b6642f7dd932bbc9fe7dc3 100644 --- a/TileCalorimeter/TilePulseSimulator/CMakeLists.txt +++ b/TileCalorimeter/TilePulseSimulator/CMakeLists.txt @@ -19,7 +19,3 @@ atlas_add_library( TilePulseSimulator INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} PRIVATE_LINK_LIBRARIES GaudiKernel ) - -# Install files from the package: -atlas_install_runtime( share/*.root ) - diff --git a/TileCalorimeter/TileSimAlgs/CMakeLists.txt b/TileCalorimeter/TileSimAlgs/CMakeLists.txt index 6bf73dc421443d402fee467b6717e66fb71eaef1..8da5213cb0eaecd2a1d244f4f38d7f7bc0a1adec 100644 --- a/TileCalorimeter/TileSimAlgs/CMakeLists.txt +++ b/TileCalorimeter/TileSimAlgs/CMakeLists.txt @@ -5,28 +5,6 @@ # Declare the package name: atlas_subdir( TileSimAlgs ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Control/AthenaBaseComps - Control/PileUpTools - GaudiKernel - TileCalorimeter/TileIdentifier - TileCalorimeter/TileSimEvent - PRIVATE - Calorimeter/CaloDetDescr - Calorimeter/CaloEvent - Calorimeter/CaloIdentifier - Control/AthAllocators - Control/AthenaKernel - Event/EventContainers - TileCalorimeter/TileCalib/TileCalibBlobObjs - TileCalorimeter/TileConditions - TileCalorimeter/TileDetDescr - TileCalorimeter/TileEvent - TileCalorimeter/TilePulseSimulator - TileCalorimeter/TileRecUtils - Tools/PathResolver ) - # External dependencies: find_package( CLHEP ) find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint ) @@ -39,7 +17,6 @@ atlas_add_component( TileSimAlgs LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps PileUpToolsLib GaudiKernel TileIdentifier TileSimEvent CaloDetDescrLib CaloEvent CaloIdentifier AthAllocators AthenaKernel TileCalibBlobObjs TileConditionsLib TileDetDescr TileEvent TilePulseSimulator TileRecUtilsLib PathResolver ) # Install files from the package: -atlas_install_headers( TileSimAlgs ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) diff --git a/Tools/PROCTools/data/master_q221_AOD_digest.ref b/Tools/PROCTools/data/master_q221_AOD_digest.ref index 91978903c7e7af3da1b4f0711111117fc7a8ca5c..0431193610022860bf2724e98ebf51c0c746c572 100644 --- a/Tools/PROCTools/data/master_q221_AOD_digest.ref +++ b/Tools/PROCTools/data/master_q221_AOD_digest.ref @@ -3,22 +3,22 @@ 284500 87473014 85 80 6 0 9 1 8 7 4 3 284500 87473022 38 29 4 0 5 1 4 4 3 1 284500 87473032 27 33 4 1 9 4 5 2 1 1 - 284500 87473037 60 42 7 0 11 2 9 5 3 2 - 284500 87473040 101 95 9 0 17 1 16 7 5 2 - 284500 87473051 142 111 12 1 13 1 12 23 16 7 + 284500 87473037 60 39 7 0 11 2 9 5 3 2 + 284500 87473040 101 94 9 0 17 1 16 6 4 2 + 284500 87473051 142 110 12 1 13 1 12 23 16 7 284500 87473063 62 76 5 2 6 2 4 6 4 2 284500 87473068 26 35 1 1 0 0 0 0 0 0 284500 87473075 72 84 6 0 5 0 5 5 4 1 - 284500 87473084 83 86 7 3 14 1 13 10 5 5 + 284500 87473084 83 85 7 3 14 1 13 10 5 5 284500 87473091 43 49 3 0 2 1 1 5 2 3 284500 87473096 72 75 3 2 2 0 2 3 2 1 284500 87473104 61 63 6 0 6 1 5 5 4 1 - 284500 87473114 93 82 7 2 13 1 12 8 5 3 + 284500 87473114 93 79 7 2 13 1 12 8 5 3 284500 87473121 93 100 6 3 16 4 12 6 5 1 - 284500 87473132 81 59 9 1 10 0 10 5 5 0 + 284500 87473132 81 60 9 1 10 0 10 5 5 0 284500 87473137 81 71 8 3 15 0 15 6 6 0 - 284500 87473144 83 70 7 1 6 0 6 8 5 3 - 284500 87473154 89 89 7 0 9 1 8 8 4 4 + 284500 87473144 83 69 7 1 6 0 6 8 5 3 + 284500 87473154 89 88 7 0 9 1 8 8 4 4 284500 87473162 52 52 3 0 7 0 7 3 2 1 284500 87473167 74 54 6 3 12 2 10 13 8 5 284500 87473171 82 70 8 3 4 2 2 5 3 2 diff --git a/Tools/PROCTools/data/master_q431_AOD_digest.ref b/Tools/PROCTools/data/master_q431_AOD_digest.ref index 534c155ff4c105636f11200debb4add11347d143..46db34c043dbae07f7e7dd9ac9d163a92b688b7f 100644 --- a/Tools/PROCTools/data/master_q431_AOD_digest.ref +++ b/Tools/PROCTools/data/master_q431_AOD_digest.ref @@ -5,10 +5,10 @@ 330470 1183732647 467 452 13 1 330470 1183733040 381 285 6 1 330470 1183734651 361 363 14 3 - 330470 1183735332 406 371 9 1 - 330470 1183736475 741 651 17 2 + 330470 1183735332 406 372 9 1 + 330470 1183736475 741 652 17 2 330470 1183738728 1 0 0 0 - 330470 1183738949 368 418 9 1 + 330470 1183738949 368 419 9 1 330470 1183742489 152 125 2 1 330470 1183743040 285 305 5 0 330470 1183746343 492 465 14 0 diff --git a/Tools/PyJobTransforms/python/trfArgClasses.py b/Tools/PyJobTransforms/python/trfArgClasses.py index e90b3e872f4e60839136a750ca933457e6cd2cf3..b7214f32b140a482a2c5268daaabd15f32c1c8aa 100644 --- a/Tools/PyJobTransforms/python/trfArgClasses.py +++ b/Tools/PyJobTransforms/python/trfArgClasses.py @@ -3,10 +3,12 @@ from future.utils import iteritems from future.utils import itervalues from future.utils import listvalues -from past.builtins import basestring from builtins import object from builtins import int +import six +basestring = six.string_types + # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## @package PyJobTransforms.trfArgClasses diff --git a/Tools/PyJobTransforms/python/trfDecorators.py b/Tools/PyJobTransforms/python/trfDecorators.py index 5095a4d94462439d61d21bb54a7bca6626258a22..ee6a0d6ce113d3605b94ec30afbc52ed8dc87b2f 100644 --- a/Tools/PyJobTransforms/python/trfDecorators.py +++ b/Tools/PyJobTransforms/python/trfDecorators.py @@ -1,8 +1,6 @@ -from future import standard_library -standard_library.install_aliases() # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -## @Package PyJobTrasforms.trfDecorators +## @Package PyJobTransforms.trfDecorators # @brief Some useful decorators used by the transforms # @author atlas-comp-transforms-dev@cern.ch # @version $Id: trfDecorators.py 696484 2015-09-23 17:20:28Z graemes $ @@ -26,23 +24,31 @@ msg = logging.getLogger(__name__) def silent(func): def silent_running(*args, **kwargs): # Create some filehandles to save the stdout/err fds to - save_err = open('/dev/null', 'w') - save_out = open('/dev/null', 'w') - os.dup2(sys.stderr.fileno(), save_err.fileno()) - os.dup2(sys.stdout.fileno(), save_out.fileno()) + save_err = os.open('/dev/null', os.O_WRONLY) + save_out = os.open('/dev/null', os.O_WRONLY) + os.dup2(sys.stderr.fileno(), save_err) + os.dup2(sys.stdout.fileno(), save_out) # Now open 'quiet' file handles and attach stdout/err - quiet_err = open('/dev/null', 'w') - quiet_out = open('/dev/null', 'w') - os.dup2(quiet_err.fileno(), sys.stderr.fileno()) - os.dup2(quiet_out.fileno(), sys.stdout.fileno()) + quiet_err = os.open('/dev/null', os.O_WRONLY) + quiet_out = os.open('/dev/null', os.O_WRONLY) + os.dup2(quiet_err, sys.stderr.fileno()) + os.dup2(quiet_out, sys.stdout.fileno()) # Execute function rc = func(*args, **kwargs) + + sys.stderr.flush() + sys.stdout.flush() # Restore fds - os.dup2(save_err.fileno(), sys.stderr.fileno()) - os.dup2(save_out.fileno(), sys.stdout.fileno()) + os.dup2(save_err, sys.stderr.fileno()) + os.dup2(save_out, sys.stdout.fileno()) + + os.close (save_err) + os.close (save_out) + os.close (quiet_err) + os.close (quiet_out) return rc # Make the wrapper look like the wrapped function diff --git a/Tools/PyJobTransforms/python/trfExe.py b/Tools/PyJobTransforms/python/trfExe.py index 48c3e46855126ef3806d4dea5b28620dee190f00..4006a3709a84bdb8af491f3eeaf874853c8cade1 100755 --- a/Tools/PyJobTransforms/python/trfExe.py +++ b/Tools/PyJobTransforms/python/trfExe.py @@ -4,8 +4,6 @@ from __future__ import print_function from future.utils import iteritems import six -from past.builtins import basestring - from builtins import zip from builtins import next from builtins import object @@ -863,7 +861,7 @@ class athenaExecutor(scriptExecutor): msg.debug("Resource monitoring from PerfMon is now deprecated") # SkeletonFile can be None (disable) or a string or a list of strings - normalise it here - if isinstance(skeletonFile, basestring): + if isinstance(skeletonFile, six.string_types): self._skeleton = [skeletonFile] else: self._skeleton = skeletonFile diff --git a/Tools/PyJobTransforms/python/trfFileUtils-lite.py b/Tools/PyJobTransforms/python/trfFileUtils-lite.py index 9cca048a095346d293bccdbf8fc2fa419ab1b580..9a207d25e4f460eff0f5206a5b83a31a8f09a5c5 100644 --- a/Tools/PyJobTransforms/python/trfFileUtils-lite.py +++ b/Tools/PyJobTransforms/python/trfFileUtils-lite.py @@ -1,4 +1,4 @@ -from past.builtins import basestring +import six from builtins import zip from builtins import range @@ -44,7 +44,7 @@ def AthenaFileInfo(fileNames, retrieveKeys = athFileInterestingKeys): AthFile.server.flush_cache() AthFile.server.disable_pers_cache() - if isinstance(fileNames, basestring): + if isinstance(fileNames, six.string_types): fileNames = [fileNames,] metaDict = {} diff --git a/Tools/PyJobTransforms/python/trfMPTools.py b/Tools/PyJobTransforms/python/trfMPTools.py index 8ec23d42fff4cb52a840dd186338d2d1f7d3c12e..b49903be9cfc3c7e1db7cda1a519e24359351e2e 100644 --- a/Tools/PyJobTransforms/python/trfMPTools.py +++ b/Tools/PyJobTransforms/python/trfMPTools.py @@ -83,7 +83,7 @@ def athenaMPOutputHandler(athenaMPFileReport, athenaMPWorkerTopDir, dataDictiona mpOutputs.parse(athenaMPFileReport) except IOError: raise trfExceptions.TransformExecutionException(trfExit.nameToCode("TRF_OUTPUT_FILE_ERROR"), "Missing AthenaMP outputs file {0} (probably athena crashed)".format(athenaMPFileReport)) - for filesElement in mpOutputs.getroot().getiterator(tag='Files'): + for filesElement in mpOutputs.getroot().iter(tag='Files'): msg.debug('Examining element {0} with attributes {1}'.format(filesElement, filesElement.attrib)) originalArg = None startName = filesElement.attrib['OriginalName'] @@ -98,7 +98,7 @@ def athenaMPOutputHandler(athenaMPFileReport, athenaMPWorkerTopDir, dataDictiona msg.debug('Found matching argument {0}'.format(originalArg)) fileNameList = [] - for fileElement in filesElement.getiterator(tag='File'): + for fileElement in filesElement.iter(tag='File'): msg.debug('Examining element {0} with attributes {1}'.format(fileElement, fileElement.attrib)) fileNameList.append(path.relpath(fileElement.attrib['name'])) diff --git a/Tools/PyJobTransforms/python/trfUtils.py b/Tools/PyJobTransforms/python/trfUtils.py index ebd62f2ab30f663ae6dd32f0e122f182034dc4e9..d1bd9751a18550db17c65e4414d75f7ce44a3439 100644 --- a/Tools/PyJobTransforms/python/trfUtils.py +++ b/Tools/PyJobTransforms/python/trfUtils.py @@ -1,10 +1,7 @@ from __future__ import print_function from future.utils import iteritems -from past.builtins import basestring from builtins import object -from future import standard_library -standard_library.install_aliases() from builtins import map import six @@ -326,7 +323,7 @@ def lineByLine(filename, strip=True, removeTimestamp=True, substepName=None): f = open(filename, 'r', **encargs) for line in f: linecounter += 1 - if substepName and isinstance(substepName, basestring): # Remove substepName only if caller provides that string. + if substepName and isinstance(substepName, six.string_types): # Remove substepName only if caller provides that string. line = line.lstrip(substepName) if removeTimestamp: line = line.lstrip('0123456789:-, ') # Remove timestamps in both serial and MP mode. diff --git a/Tools/PyJobTransforms/python/trfValidation.py b/Tools/PyJobTransforms/python/trfValidation.py index 7f89dbd4c80dcbbee33e0ca99f1fcc458172ee07..e1dc10742637a9b2371338bacbb89e9fa5b2b187 100644 --- a/Tools/PyJobTransforms/python/trfValidation.py +++ b/Tools/PyJobTransforms/python/trfValidation.py @@ -1,10 +1,10 @@ from future.utils import iteritems -from past.builtins import basestring from builtins import zip from builtins import object from builtins import range from builtins import int +import six # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration @@ -185,7 +185,7 @@ class logFileReport(object): def __init__(self, logfile=None, msgLimit=10, msgDetailLevel=stdLogLevels['ERROR']): # We can have one logfile or a set - if isinstance(logfile, basestring): + if isinstance(logfile, six.string_types): self._logfile = [logfile, ] else: self._logfile = logfile diff --git a/Tools/PyJobTransforms/test/test_trfArgs.py b/Tools/PyJobTransforms/test/test_trfArgs.py index 27cdcb9fce0f074c1f32ad0dd2327aa81de9f639..5065e477a1be326ff044d9a20d3ce5731a32f727 100755 --- a/Tools/PyJobTransforms/test/test_trfArgs.py +++ b/Tools/PyJobTransforms/test/test_trfArgs.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 ## @Package test_trfArgs.py # @brief Unittests for trfArgs.py @@ -46,7 +46,7 @@ class trfArgsUnitTests(unittest.TestCase): addStandardTrfArgs(myParser) args = ['--help'] self.assertRaises(SystemExit, myParser.parse_args, args) - + def test_subStep(self): myParser = trfArgParser() addStandardTrfArgs(myParser) @@ -55,7 +55,7 @@ class trfArgsUnitTests(unittest.TestCase): myArgDict = vars(myParser.parse_args(args)) properArgDict = {'r2e': ['stuff', 'somemorestuff'], 'e2e': ['something', 'somethingElse']} self.assertTrue(isinstance(myArgDict, dict)) - self.assertEquals(myArgDict['preExec']._value, properArgDict) + self.assertEqual(myArgDict['preExec']._value, properArgDict) def test_triggerConfig(self): myParser = trfArgParser() @@ -65,7 +65,7 @@ class trfArgsUnitTests(unittest.TestCase): myArgDict = vars(myParser.parse_args(args)) properArgDict = {'r2e': 'MC:TRIGGERDB:124,154,132', 'e2e': 'MC:TRIGGERDB:124,154,132'} self.assertTrue(isinstance(myArgDict, dict)) - self.assertEquals(myArgDict['triggerConfig']._value, properArgDict) + self.assertEqual(myArgDict['triggerConfig']._value, properArgDict) class trfIntArgsUnitTests(unittest.TestCase): @@ -75,7 +75,7 @@ class trfIntArgsUnitTests(unittest.TestCase): from PyJobTransforms.transform import transform tf = transform() addTeaArguments(tf.parser) - self.assertEquals(tf.parseCmdLineArgs(['--cupsOfTea', '123']), None) + self.assertEqual(tf.parseCmdLineArgs(['--cupsOfTea', '123']), None) @silent def test_EchoIntFail(self): @@ -91,7 +91,7 @@ class trfFloatArgsUnitTests(unittest.TestCase): from PyJobTransforms.transform import transform tf = transform() addTeaArguments(tf.parser) - self.assertEquals(tf.parseCmdLineArgs(['--mugVolume', '1.23']), None) + self.assertEqual(tf.parseCmdLineArgs(['--mugVolume', '1.23']), None) @silent def test_EchoFloatFail(self): @@ -110,7 +110,7 @@ class configureFromJSON(unittest.TestCase): "skipEvents": {"first": 10}, "testFloat": 4.67, "testInt": 5}''') - + def tearDown(self): for f in 'argdict.json', 'rewrite.json': try: diff --git a/Tools/PyJobTransforms/test/test_trfMPTools.py b/Tools/PyJobTransforms/test/test_trfMPTools.py index 287ddf1d0873304d9174b7c445560c6bf45665a4..1134346d23ba4767fc9002b70ac1ab26c44f54ac 100755 --- a/Tools/PyJobTransforms/test/test_trfMPTools.py +++ b/Tools/PyJobTransforms/test/test_trfMPTools.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 ## @Package test_trfMPTools.py # @brief Unittests for trfMPTools.py @@ -67,7 +67,7 @@ class AthenaMPOutputParseTests(unittest.TestCase): except OSError: pass for fname in delement[2]: - open(os.path.join(delement[0], fname), "w") + open(os.path.join(delement[0], fname), "w").close() with open("athenaMP-outputs-RAWtoESD-r2e", "w") as mpoutput: print("""<?xml version="1.0" encoding="utf-8"?> diff --git a/Tools/PyJobTransforms/test/test_trfSignatures.py b/Tools/PyJobTransforms/test/test_trfSignatures.py index d2dbed7bdd1a1dfcb8868ed1039ec51940ea6d89..b7509e073925b317abcb79cdda4e3c430880cda0 100755 --- a/Tools/PyJobTransforms/test/test_trfSignatures.py +++ b/Tools/PyJobTransforms/test/test_trfSignatures.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 # # Test generation of transform signatures # $Id: test_trfSignatures.py 630090 2014-11-21 12:06:31Z graemes $ @@ -10,6 +10,7 @@ import os import sys import subprocess import unittest +import six from PyJobTransforms.trfLogger import msg @@ -25,14 +26,24 @@ class SignatureTest(unittest.TestCase): def test_Signatures(self): cmd = ['makeTrfJSONSignatures.py', '--output', 'test.json'] msg.info('Will generate transform signatures: {0}'.format(cmd)) - p = subprocess.Popen(cmd, shell = False, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, bufsize = 1) - while p.poll() is None: - line = p.stdout.readline() - sys.stdout.write(line.decode()) - # Hoover up remaining buffered output lines - for line in p.stdout: - sys.stdout.write(line) - self.assertEqual(p.returncode, 0) + if six.PY2: + p = subprocess.Popen(cmd, shell = False, stdout = subprocess.PIPE, stderr = subprocess.STDOUT) + while p.poll() is None: + line = p.stdout.readline() + sys.stdout.write(line.decode()) + # Hoover up remaining buffered output lines + for line in p.stdout: + sys.stdout.write(line) + self.assertEqual(p.returncode, 0) + else: + with subprocess.Popen(cmd, shell = False, stdout = subprocess.PIPE, stderr = subprocess.STDOUT) as p: + while p.poll() is None: + line = p.stdout.readline() + sys.stdout.write(line.decode()) + # Hoover up remaining buffered output lines + for line in p.stdout: + sys.stdout.write(line) + self.assertEqual(p.returncode, 0) if __name__ == '__main__': unittest.main() diff --git a/Tools/PyJobTransforms/test/test_trfUtilsDBRelease.py b/Tools/PyJobTransforms/test/test_trfUtilsDBRelease.py index fbe8d35a90415db94ce40ba013aaa59531135d21..d5cfa8d256966dbe33e0d758948af07da2edb5f2 100755 --- a/Tools/PyJobTransforms/test/test_trfUtilsDBRelease.py +++ b/Tools/PyJobTransforms/test/test_trfUtilsDBRelease.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 # # Test the various DBRelease scenarios # $Id: test_trfUtilsDBRelease.py 740535 2016-04-15 11:21:07Z graemes $ @@ -126,4 +126,9 @@ def tearDownModule(): shutil.rmtree('DBRelease') if __name__ == '__main__': + import os + testname = 'test_trfUtilsDBRelease' + if not os.path.exists (testname): + os.mkdir (testname) + os.chdir (testname) unittest.main() diff --git a/Tools/PyUtils/python/AthFileLite.py b/Tools/PyUtils/python/AthFileLite.py index c70736871065f5acd71bfcf63640c82d4b1b7489..dcb01f29fe4806baa96d8f0ac3c981a664824155 100644 --- a/Tools/PyUtils/python/AthFileLite.py +++ b/Tools/PyUtils/python/AthFileLite.py @@ -401,8 +401,8 @@ class AthInpFile(object): # _get_guid() code from FilePeeker class by Sebastian Binet pool = f.Get('##Params') if pool: - pool_token = re.compile(r'[[]NAME=(?P<name>.*?)[]]'\ - r'[[]VALUE=(?P<value>.*?)[]]').match + pool_token = re.compile(r'\[NAME=(?P<name>.*?)\]'\ + r'\[VALUE=(?P<value>.*?)\]').match params = [] for i in range(pool.GetEntries()): if pool.GetEntry(i)>0: diff --git a/Tools/PyUtils/python/scripts/diff_root_files.py b/Tools/PyUtils/python/scripts/diff_root_files.py index f5c785f992ec91d92df8c74e1f9765484796dbe5..68a617e66902e81a0d64a30ba985cd8c048a982e 100644 --- a/Tools/PyUtils/python/scripts/diff_root_files.py +++ b/Tools/PyUtils/python/scripts/diff_root_files.py @@ -317,13 +317,13 @@ def main(args): if not in_synch: if _is_detailed(): if d_old: - print('::sync-old %s' %'.'.join(["%03i"%ientry]+map(str, - d_old[2]))) + print('::sync-old %s' %'.'.join(["%03i"%ientry]+list(map(str, + d_old[2])))) else: print('::sync-old ABSENT') if d_new: - print('::sync-new %s' %'.'.join(["%03i"%jentry]+map(str, - d_new[2]))) + print('::sync-new %s' %'.'.join(["%03i"%jentry]+list(map(str, + d_new[2])))) else: print('::sync-new ABSENT') pass @@ -387,9 +387,9 @@ def main(args): continue if not args.order_trees: - n = '.'.join(map(str, ["%03i"%ientry]+name)) + n = '.'.join(list(map(str, ["%03i"%ientry]+name))) else: - n = '.'.join(map(str, ["%03i.%03i"%(ientry,jentry)]+name)) + n = '.'.join(list(map(str, ["%03i.%03i"%(ientry,jentry)]+name))) diff_value = 'N/A' try: diff_value = 50.*(iold-inew)/(iold+inew) diff --git a/Tracking/Acts/ActsInterop/CMakeLists.txt b/Tracking/Acts/ActsInterop/CMakeLists.txt index 212cd23ead3d4b327282cc164d3d82fd3a3ebe3e..3f4c443302d998a96a833db4609b82b6c03ec260 100755 --- a/Tracking/Acts/ActsInterop/CMakeLists.txt +++ b/Tracking/Acts/ActsInterop/CMakeLists.txt @@ -14,6 +14,3 @@ atlas_add_library( ActsInteropLib INCLUDE_DIRS ${Boost_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ActsCore GaudiKernel PRIVATE_LINK_LIBRARIES InDetIdentifier InDetReadoutGeometry ) - -# Install files from the package. -atlas_install_joboptions( share/*.py ) diff --git a/Tracking/Acts/ActsPriVtxFinder/ActsPriVtxFinder/ActsAdaptiveMultiPriVtxFinderTool.h b/Tracking/Acts/ActsPriVtxFinder/ActsPriVtxFinder/ActsAdaptiveMultiPriVtxFinderTool.h index d7838e872097a61cc2e8c8143cb6c43791923b6e..412ae34e4a25fbdbd94925b9b34ba83fe613683b 100644 --- a/Tracking/Acts/ActsPriVtxFinder/ActsPriVtxFinder/ActsAdaptiveMultiPriVtxFinderTool.h +++ b/Tracking/Acts/ActsPriVtxFinder/ActsPriVtxFinder/ActsAdaptiveMultiPriVtxFinderTool.h @@ -144,7 +144,6 @@ private: BooleanProperty m_do3dSplitting{this, "do3dSplitting", false, "Do 3d-splitting"}; DoubleProperty m_maximumVertexContamination{this, "maximumVertexContamination", 0.5, "Max. vertex contamination"}; DoubleProperty m_looseConstrValue{this, "looseConstrValue", 1e+8, "Loose constraint value"}; - BooleanProperty m_refitAfterBadVertex{this, "refitAfterBadVertex", false, "Run multivertex refit after bad vertex"}; BooleanProperty m_useVertexCovForIPEstimation{this, "useVertexCovForIPEstimation", false, "Use seed vertex cov for IPEstimation"}; BooleanProperty m_useSeedConstraint{this, "useSeedConstraint", true, "Use seed constraint in fit"}; // Final vertex selection variables diff --git a/Tracking/Acts/ActsPriVtxFinder/CMakeLists.txt b/Tracking/Acts/ActsPriVtxFinder/CMakeLists.txt index 678d2334b1bea5a430d3384d60dfd0ff315073dc..27be7af70e06f87e0350e0f954997bd6e2ba7418 100644 --- a/Tracking/Acts/ActsPriVtxFinder/CMakeLists.txt +++ b/Tracking/Acts/ActsPriVtxFinder/CMakeLists.txt @@ -95,9 +95,3 @@ atlas_add_component( ActsPriVtxFinder TrkVertexFitterInterfaces AthenaMonitoringKernelLib InDetRecToolInterfaces ) - -# Install files from the package: -atlas_install_headers( ActsPriVtxFinder ) -atlas_install_joboptions( share/*.py ) -atlas_install_python_modules( python/*.py ) - diff --git a/Tracking/Acts/ActsPriVtxFinder/src/ActsAdaptiveMultiPriVtxFinderTool.cxx b/Tracking/Acts/ActsPriVtxFinder/src/ActsAdaptiveMultiPriVtxFinderTool.cxx index bb9e415308077aff314cb582bed988ba34f849fb..55d42bb2d89f28376c8627adbd5f739cb5637479 100755 --- a/Tracking/Acts/ActsPriVtxFinder/src/ActsAdaptiveMultiPriVtxFinderTool.cxx +++ b/Tracking/Acts/ActsPriVtxFinder/src/ActsAdaptiveMultiPriVtxFinderTool.cxx @@ -126,7 +126,6 @@ ActsAdaptiveMultiPriVtxFinderTool::initialize() finderConfig.do3dSplitting = m_do3dSplitting; finderConfig.maximumVertexContamination = m_maximumVertexContamination; finderConfig.looseConstrValue = m_looseConstrValue; - finderConfig.refitAfterBadVertex = m_refitAfterBadVertex; finderConfig.useVertexCovForIPEstimation = m_useVertexCovForIPEstimation; finderConfig.useSeedConstraint = m_useSeedConstraint; m_vertexFinder = std::make_shared<VertexFinder>(finderConfig, extractParameters); diff --git a/Tracking/TrkAlgorithms/TrkAmbiguitySolver/src/TrkAmbiguitySolver.cxx b/Tracking/TrkAlgorithms/TrkAmbiguitySolver/src/TrkAmbiguitySolver.cxx index 4b8907062f1e16777f633fcfebcaaedb2e2de562..d78ebcc0c7138dbcf23dbac5b16c58fe692017e1 100644 --- a/Tracking/TrkAlgorithms/TrkAmbiguitySolver/src/TrkAmbiguitySolver.cxx +++ b/Tracking/TrkAlgorithms/TrkAmbiguitySolver/src/TrkAmbiguitySolver.cxx @@ -55,7 +55,7 @@ Trk::TrkAmbiguitySolver::execute() if ( !scoredTracksHandle.isValid() ) ATH_MSG_ERROR("Could not read scoredTracks."); m_trackInCount += scoredTracksHandle->size(); std::unique_ptr<TrackCollection> resolvedTracks; - if (m_applySolve){ + if (m_applySolve ){ resolvedTracks.reset(m_ambiTool->process(scoredTracksHandle.cptr())); //note: take ownership and delete } else{ diff --git a/Tracking/TrkConditions/TrkCondTest/CMakeLists.txt b/Tracking/TrkConditions/TrkCondTest/CMakeLists.txt index 7540c13fa3d6310bc06e4337397db30753980611..dea29c8a4c95fd08a6c5d44677a89f6ea2a7efec 100644 --- a/Tracking/TrkConditions/TrkCondTest/CMakeLists.txt +++ b/Tracking/TrkConditions/TrkCondTest/CMakeLists.txt @@ -36,5 +36,4 @@ atlas_add_component( TrackingGeometryCondAlgTest ) # Install files from the package: -atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) diff --git a/Tracking/TrkConfig/CMakeLists.txt b/Tracking/TrkConfig/CMakeLists.txt index f8aa1bdd44e54dc62e55c83b309022b8e67f9ffd..fd84ef28f21c5aa0e20789a4777e1b75c80af3a8 100644 --- a/Tracking/TrkConfig/CMakeLists.txt +++ b/Tracking/TrkConfig/CMakeLists.txt @@ -7,7 +7,6 @@ atlas_subdir( TrkConfig ) # Install files from the package: atlas_install_python_modules( python/*.py) -atlas_install_joboptions( share/*.py ) atlas_install_data( share/*.ref ) diff --git a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.h b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.h index 260ac1ef98ae970a9ae9dbb8f08fcf9940e962bb..db57e565fbc56c1a0c0823308dc7d0a572160e5d 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.h +++ b/Tracking/TrkDetDescr/TrkSurfaces/TrkSurfaces/StraightLineSurface.h @@ -178,11 +178,16 @@ public: Amg::Vector2D& loc) const override final; /** Special method for StraightLineSurface - providing a different z estimate + Performs memory allocation the caller owns the ptr */ - const Amg::Vector3D* localToGlobal( - const Trk::LocalParameters& locpars, - const Amg::Vector3D& glomom, - double locZ) const; + Amg::Vector3D* localToGlobal(const Trk::LocalParameters& locpars, + const Amg::Vector3D& glomom, + double locZ) const; + /** Special method for StraightLineSurface - providing a different z estimate + */ + Amg::Vector3D localToGlobalPos(const Trk::LocalParameters& locpars, + const Amg::Vector3D& glomom, + double locZ) const; /** Special method for StraightLineSurface - provides the Line direction from * cache: speedup */ diff --git a/Tracking/TrkDetDescr/TrkSurfaces/src/StraightLineSurface.cxx b/Tracking/TrkDetDescr/TrkSurfaces/src/StraightLineSurface.cxx index eb867589508c33d4828da700b5a8a371944ba6ca..c4197ffd073e7b5667e4ab342f8ba7aa9056757c 100644 --- a/Tracking/TrkDetDescr/TrkSurfaces/src/StraightLineSurface.cxx +++ b/Tracking/TrkDetDescr/TrkSurfaces/src/StraightLineSurface.cxx @@ -110,7 +110,7 @@ Trk::StraightLineSurface::localToGlobal(const Amg::Vector2D& locpos, } // specialized version for providing different Z - local to global method - from LocalParameters/ -const Amg::Vector3D* +Amg::Vector3D* Trk::StraightLineSurface::localToGlobal(const Trk::LocalParameters& locpars, const Amg::Vector3D& glomom, double locZ) const @@ -120,6 +120,17 @@ Trk::StraightLineSurface::localToGlobal(const Trk::LocalParameters& locpars, return Surface::localToGlobal(locPos, glomom); } +Amg::Vector3D +Trk::StraightLineSurface::localToGlobalPos(const Trk::LocalParameters& locpars, + const Amg::Vector3D& glomom, + double locZ) const +{ + // create a local Position + Amg::Vector2D locPos(locpars[Trk::driftRadius], locZ); + return Surface::localToGlobalPos(locPos, glomom); +} + + // true global to local method - fully defined bool Trk::StraightLineSurface::globalToLocal(const Amg::Vector3D& glopos, diff --git a/Tracking/TrkEvent/TrkTrack/TrkTrack/RefittedTrackPair.h b/Tracking/TrkEvent/TrkTrack/TrkTrack/RefittedTrackPair.h deleted file mode 100755 index c6957903a6e844cc55854c321ff5725ecfd5414a..0000000000000000000000000000000000000000 --- a/Tracking/TrkEvent/TrkTrack/TrkTrack/RefittedTrackPair.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/* ==================================================================================== - RefittedTrackPair.h - description - ----------------------------------- -begin : Friday 30th March 2006 -author : Tom Atkinson -email : t.atkinson@physics.unimelb.edu.au -decription : Class holding an element link to a track and pointer to the - refitted -======================================================================================= */ - -#ifndef TrkRefittedTrackPair_H -#define TrkRefittedTrackPair_H - -#include "AthLinks/ElementLink.h" -#include "TrkTrack/Track.h" -#include "TrkTrack/TrackCollection.h" - -namespace Trk{ - -/** - -@brief pair associating a refitted track to a track element link - - The RefittedTrack class is a pair. - - The first element is an element link to the original track - - The second element is a pointer to the refitted track - -@author t.atkinson@physics.unimelb.edu.au - -*/ - - -class RefittedTrackPair : public std::pair< ElementLink< DataVector< Track > >, Track* >{ - public: - - //!< Default constructor - RefittedTrackPair(); - - //!< Constructor using the element link to the original track and the pointer to the refitted track - RefittedTrackPair( const ElementLink< DataVector< Track > >&, Track* ); - - //!< Virtual destructor - virtual ~RefittedTrackPair(); - -}; - -} // end Trk namespace - -#endif diff --git a/Tracking/TrkEvent/TrkTrack/TrkTrack/RefittedTrackPairCollection.h b/Tracking/TrkEvent/TrkTrack/TrkTrack/RefittedTrackPairCollection.h deleted file mode 100755 index 6e8abb86c6fa4f3af38cf7662f6f080cbd812d64..0000000000000000000000000000000000000000 --- a/Tracking/TrkEvent/TrkTrack/TrkTrack/RefittedTrackPairCollection.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/* =============================================================================== - RefittedTrackPairCollection.h - description - --------------------------------------------- -begin : Friday 30th March 2006 -author : Tom Atkinson -email : t.atkinson@physics.unimelb.edu.au -decription : Collection of refitted track pairs -================================================================================== */ - -#ifndef TrkRefittedTrackPairCollection_H -#define TrkRefittedTrackPairCollection_H - -#include "TrkTrack/RefittedTrackPair.h" - -#include "AthContainers/DataVector.h" - -typedef DataVector< Trk::RefittedTrackPair > RefittedTrackPairCollection; - -CLASS_DEF(RefittedTrackPairCollection, 1098918547, 1) - -#endif diff --git a/Tracking/TrkEvent/TrkTrack/TrkTrack/TrkTrackDict.h b/Tracking/TrkEvent/TrkTrack/TrkTrack/TrkTrackDict.h index 7208d93f57ddac2e4d168c60352563775e6bb529..145f667573d9a8287c36d64c983af38702bf6c24 100755 --- a/Tracking/TrkEvent/TrkTrack/TrkTrack/TrkTrackDict.h +++ b/Tracking/TrkEvent/TrkTrack/TrkTrack/TrkTrackDict.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 TRKTRACKDICT_H @@ -10,7 +10,6 @@ // #include is needed for gcc_xml to parse the header files #include "TrkTrack/TrackStateOnSurface.h" #include "TrkTrack/TrackCollection.h" -#include "TrkTrack/RefittedTrackPairCollection.h" #include "TrkTrack/LinkToTrack.h" #include "Identifier/Identifier.h" #include "AthLinks/ElementLink.h" @@ -26,10 +25,11 @@ namespace Trk { DataVector<const TrackStateOnSurface> m_trackStateVector; DataVector<Identifier> m_identifierVector; ElementLink<DataVector<Trk::Track> > m_Elink; - std::bitset< 11 > m_dummy1; + std::bitset< 11 > m_dummy1; TrackCollection m_tc; ElementLink<TrackCollection> m_e1; - std::vector<ElementLink<TrackCollection> > m_e2; //!< really for xAOD, but exposes dependency on TrkTrack to put it there... + //!< really for xAOD, but exposes dependency on TrkTrack to put it there... + std::vector<ElementLink<TrackCollection> > m_e2; }; } #endif diff --git a/Tracking/TrkEvent/TrkTrack/TrkTrack/selection.xml b/Tracking/TrkEvent/TrkTrack/TrkTrack/selection.xml index f94dd4244308ef102a6054eb3627ea9e6343a972..f38e080cd1b129d7f0030a2fa673874971d7fad6 100755 --- a/Tracking/TrkEvent/TrkTrack/TrkTrack/selection.xml +++ b/Tracking/TrkEvent/TrkTrack/TrkTrack/selection.xml @@ -9,6 +9,7 @@ <field name="m_trackStateVector" transient="false" /> <field name="s_numberOfInstantiations" transient="true" /> </class> + <class name="TrackCollection"/> <class name="DataVector<Trk::Track>" id="70ECEBFC-BE00-46C2-8B35-4CC12D18DE39"/> <class name="std::vector<Trk::Track*>" /> @@ -21,13 +22,8 @@ <class name="std::vector<const Trk::TrackStateOnSurface*>" /> <class name="Trk::AlignmentEffectsOnTrack"/> - <!-- RefittedTrackPair --> - <class name="DataVector< Trk::RefittedTrackPair >" id="0168FDD0-A582-40C5-9A47-A39452C09778" /> - <class name="std::vector< Trk::RefittedTrackPair* >" /> - <class name="Trk::RefittedTrackPair" /> - <class name="Trk::LinkToTrack"/> - + <class name="Trk::TrackInfo"/> <exclusion> <class name="Trk::TrackInfo"> diff --git a/Tracking/TrkEvent/TrkTrack/src/RefittedTrackPair.cxx b/Tracking/TrkEvent/TrkTrack/src/RefittedTrackPair.cxx deleted file mode 100755 index 028017a59a8afdad444dd53f963d9eb9aac8fab9..0000000000000000000000000000000000000000 --- a/Tracking/TrkEvent/TrkTrack/src/RefittedTrackPair.cxx +++ /dev/null @@ -1,25 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/* =============================================================================== - RefittedTrackPair.cxx - description - ------------------------------------- -begin : Friday 30th March 2006 -author : Tom Atkinson -email : t.atkinson@physics.unimelb.edu.au -decription : Implementation code for the RefittedTrackPair class -================================================================================== */ - -#include "TrkTrack/RefittedTrackPair.h" - -Trk::RefittedTrackPair::RefittedTrackPair()= default; - -Trk::RefittedTrackPair::RefittedTrackPair( const ElementLink< DataVector< Trk::Track > >& originalTrack, Trk::Track* refittedTrack ) - : - std::pair< ElementLink< DataVector< Trk::Track > >, Trk::Track* >( originalTrack, refittedTrack ) -{} - -Trk::RefittedTrackPair::~RefittedTrackPair()= default; - - diff --git a/Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h b/Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h index b5ce6218eaf62c79bdb3a1cca9faaf964244f1a0..427d843a059fa74ccd9c9634b7047744eaa7f6de 100755 --- a/Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h +++ b/Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.h @@ -254,13 +254,20 @@ public: @return true if sub-detector 'type' is hit*/ bool isHit(const DetectorType& type) const ; - /** returns a pointer to the InDetTrackSummary if available */ + /** returns a const pointer to the InDetTrackSummary if available */ const InDetTrackSummary* indetTrackSummary() const; + /** returns a pointer to a modifiable (non-const) InDetTrackSummary if available */ + InDetTrackSummary* indetTrackSummary() ; + /** returns a pointer to the MuonTrackSummary if available */ const MuonTrackSummary* muonTrackSummary() const; - /**return number of parameters currently created*/ + /** returns pointer to a modifiable (non-const) MuonTrackSummary if available */ + MuonTrackSummary* muonTrackSummary(); + + + /**return number of parameters currently created*/ static unsigned int numberOfInstantiations() ; /** adds the values of the passed TrackSummary to this TrackSummary. Mainly intended for @@ -303,73 +310,19 @@ private: // data members static std::atomic<unsigned int> s_numberOfInstantiations; /** pointer to the InDetTrackSummary */ - const InDetTrackSummary* m_indetTrackSummary; + InDetTrackSummary* m_indetTrackSummary; /** pointer to the MuonTrackSummary */ - const MuonTrackSummary* m_muonTrackSummary; + MuonTrackSummary* m_muonTrackSummary; }; -inline int Trk::TrackSummary::get(const Trk::SummaryType& type) const -{ - return m_information.at(type); -} - -// Troels.Petersen@cern.ch: -inline float Trk::TrackSummary::getPID(const Trk::eProbabilityType& PIDtype) const -{ - return (PIDtype < m_eProbability.size() ? m_eProbability[PIDtype] : 0.); -} - -inline bool Trk::TrackSummary::update(Trk::SummaryType type, int new_value) -{ - if (m_information.at(type) != SummaryTypeNotSet) { - return false; - } - m_information[type]=new_value; - return true; -} - -inline float Trk::TrackSummary::getPixeldEdx() const -{ - return m_dedx; -} - -inline int Trk::TrackSummary::numberOfUsedHitsdEdx() const -{ - return m_nhitsdedx; -} - -inline int Trk::TrackSummary::numberOfOverflowHitsdEdx() const -{ - return m_nhitsoverflowdedx; -} - -inline bool Trk::TrackSummary::isHit(const Trk::DetectorType& type) const -{ - // no range checking because people should be using enums - return (m_idHitPattern&(1<<static_cast<unsigned int>(type))); -} - -inline const Trk::InDetTrackSummary* Trk::TrackSummary::indetTrackSummary() const { - return m_indetTrackSummary; -} - -inline const Trk::MuonTrackSummary* Trk::TrackSummary::muonTrackSummary() const { - return m_muonTrackSummary; -} - /**output. This dumps the values of each of the possible summary enums*/ MsgStream& operator<<(MsgStream& out, const TrackSummary& trackSum); /**output. This dumps the values of each of the possible summary enums*/ std::ostream& operator<<(std::ostream& out, const TrackSummary& trackSum); - -} - -inline unsigned long Trk::TrackSummary::getHitPattern() const -{ - return m_idHitPattern; } +#include "TrkTrackSummary/TrackSummary.icc" #endif diff --git a/Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.icc b/Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.icc new file mode 100644 index 0000000000000000000000000000000000000000..65ec0436a50dbc6388aeadcbddf7daf73e14952f --- /dev/null +++ b/Tracking/TrkEvent/TrkTrackSummary/TrkTrackSummary/TrackSummary.icc @@ -0,0 +1,82 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +inline int +Trk::TrackSummary::get(const Trk::SummaryType& type) const +{ + return m_information.at(type); +} + +// Troels.Petersen@cern.ch: +inline float +Trk::TrackSummary::getPID(const Trk::eProbabilityType& PIDtype) const +{ + return (PIDtype < m_eProbability.size() ? m_eProbability[PIDtype] : 0.); +} + +inline bool +Trk::TrackSummary::update(Trk::SummaryType type, int new_value) +{ + if (m_information.at(type) != SummaryTypeNotSet) { + return false; + } + m_information[type] = new_value; + return true; +} + +inline float +Trk::TrackSummary::getPixeldEdx() const +{ + return m_dedx; +} + +inline int +Trk::TrackSummary::numberOfUsedHitsdEdx() const +{ + return m_nhitsdedx; +} + +inline int +Trk::TrackSummary::numberOfOverflowHitsdEdx() const +{ + return m_nhitsoverflowdedx; +} + +inline bool +Trk::TrackSummary::isHit(const Trk::DetectorType& type) const +{ + // no range checking because people should be using enums + return (m_idHitPattern & (1 << static_cast<unsigned int>(type))); +} + +inline const Trk::InDetTrackSummary* +Trk::TrackSummary::indetTrackSummary() const +{ + return m_indetTrackSummary; +} + +inline Trk::InDetTrackSummary* +Trk::TrackSummary::indetTrackSummary() +{ + return m_indetTrackSummary; +} + + +inline const Trk::MuonTrackSummary* +Trk::TrackSummary::muonTrackSummary() const +{ + return m_muonTrackSummary; +} + +inline Trk::MuonTrackSummary* +Trk::TrackSummary::muonTrackSummary() +{ + return m_muonTrackSummary; +} + +inline unsigned long +Trk::TrackSummary::getHitPattern() const +{ + return m_idHitPattern; +} + diff --git a/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/CMakeLists.txt b/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/CMakeLists.txt index ebb26c6c3eec9767902c6525d76be8db448c9f63..215905a6a66c8d4dfb854ebb0b7f71967e0fa5b6 100644 --- a/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/CMakeLists.txt +++ b/Tracking/TrkExtrapolation/TrkExRungeKuttaIntersector/CMakeLists.txt @@ -35,7 +35,7 @@ atlas_add_component( TrkExRungeKuttaIntersector src/RungeKuttaIntersector.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives EventPrimitives GaudiKernel MagFieldConditions MagFieldElements TrkExInterfaces TrkExUtils TrkDetDescrUtils TrkGeometry TrkSurfaces TrkParameters ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives EventPrimitives GaudiKernel MagFieldConditions MagFieldElements TrkExInterfaces TrkExUtils TrkDetDescrUtils TrkGeometry TrkSurfaces TrkParameters TrkExInterfaces ) # Install files from the package: atlas_install_headers( TrkExRungeKuttaIntersector ) @@ -44,7 +44,7 @@ atlas_install_headers( TrkExRungeKuttaIntersector ) 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 + LINK_LIBRARIES TrkExUtils GaudiKernel TestTools PathResolver CxxUtils ${ROOT_LIBRARIES} MagFieldElements MagFieldConditions TrkExInterfaces PROPERTIES TIMEOUT 300 ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" ) diff --git a/Tracking/TrkExtrapolation/TrkExStraightLineIntersector/CMakeLists.txt b/Tracking/TrkExtrapolation/TrkExStraightLineIntersector/CMakeLists.txt index 2ccff9b6bfe09287f66d2de61934edf39ac25441..94a39be02da027a909bd25661e5395b3bc92180c 100644 --- a/Tracking/TrkExtrapolation/TrkExStraightLineIntersector/CMakeLists.txt +++ b/Tracking/TrkExtrapolation/TrkExStraightLineIntersector/CMakeLists.txt @@ -24,11 +24,11 @@ atlas_add_component( TrkExStraightLineIntersector src/StraightLineIntersector.cxx src/components/*.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps TrkExInterfaces TrkExUtils GaudiKernel TrkSurfaces TrkParameters ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps TrkExInterfaces TrkExUtils GaudiKernel TrkSurfaces TrkParameters TrkExInterfaces ) # Install files from the package: atlas_install_headers( TrkExStraightLineIntersector ) atlas_add_test( StraightLineIntersector_test SOURCES test/StraightLineIntersector_test.cxx - LINK_LIBRARIES TrkExUtils TestTools GaudiKernel ) + LINK_LIBRARIES TrkExUtils TestTools GaudiKernel TrkExInterfaces ) diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.h index a833fe39d9a1ccb6765c5bb640fc67ea7682567a..aea681e00f1d6ce842911a78676b2a960f2e49a4 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.h @@ -3,8 +3,7 @@ */ /** - * @file AlignedDynArray.h - * @date 26th November 2019 + * @author Anthony Morley, Christos Anastopoulos * @brief Dynamic array fullfilling alignment requirements */ @@ -14,10 +13,22 @@ #include <cstdlib> #include <memory> namespace GSFUtils { -template<typename T, size_t Alignment> + +/* + * Use GCC and Clang attributes to express that we return aligned ouputs + * If we have a std implementing ideas from + * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0886r0.pdf + * prb we do not need this. + */ +#if defined(__GNUC__) && !defined(__CLING__) && !defined(__ICC) +#define GSF_ALIGN_RETURN(X) __attribute__((assume_aligned(X))) +#else +#define GSF_ALIGN_RETURN(X) +#endif + /** - * A wrapper around std::aligned_alloc - * + * A wrapper around std::aligned_alloc + * * The main usage is to create an alligned buffer * array to be used with vector instructions * @@ -26,51 +37,87 @@ template<typename T, size_t Alignment> * - Default initialization of elements * - Value initialization of elements. */ - -class AlignedDynArray +template<typename T, size_t ALIGNMENT> +struct AlignedDynArray { -public: + + ///@{ + // Standard typedefs + typedef T value_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef value_type& reference; + typedef const value_type& const_reference; + typedef value_type* iterator; + typedef const value_type* const_iterator; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + /// @} + /// Deleted default constructor AlignedDynArray() = delete; + /// Deleted default copy constructor AlignedDynArray(AlignedDynArray const&) = delete; + /// Deleted default assignment operator AlignedDynArray& operator=(AlignedDynArray const&) = delete; - /// Constructor default initializing elements - explicit AlignedDynArray(size_t n); + /// Constructor with default initializing elements + explicit AlignedDynArray(size_type n); + /// Constructor initializing elements to value - explicit AlignedDynArray(size_t n, const T& value); + explicit AlignedDynArray(size_type n, const T& value); /// Move copy constructor AlignedDynArray(AlignedDynArray&&) noexcept; + /// Move assignment operator AlignedDynArray& operator=(AlignedDynArray&&) noexcept; + /// Destructor ~AlignedDynArray(); /// Get the underlying buffer - T* buffer () noexcept; - /// Get the underlying buffer - const T* buffer() const noexcept; + pointer buffer() noexcept GSF_ALIGN_RETURN(ALIGNMENT); + + /// Get the underlying buffer (const) + const_pointer buffer() const noexcept GSF_ALIGN_RETURN(ALIGNMENT); - /// index array operators - T& operator[](const std::size_t pos) noexcept; - const T& operator[](const std::size_t pos) const noexcept; + /// index array operator + reference operator[](size_type pos) noexcept; + + /// index array operator (const) + const_reference operator[](size_type pos) const noexcept; - /// size of allocated buffer - std::size_t size() const noexcept; + /// iterator pointing to the first element + iterator begin() noexcept GSF_ALIGN_RETURN(ALIGNMENT); + /// const iterator pointing to the first element + const_iterator begin() const noexcept GSF_ALIGN_RETURN(ALIGNMENT); + + /// iterator pointing to the past-the-end element + iterator end() noexcept; + + /// const iterator pointing to the past-the-end element + const_iterator end() const noexcept; + + /// number of elements/size + size_type size() const noexcept; + + /// returns true is size == 0 + bool empty() const noexcept; - typedef T* iterator; - typedef const T* const_iterator; - iterator begin() { return &m_buffer[0]; } - iterator end() { return &m_buffer[m_size]; } private: - void cleanup() noexcept; - T* m_buffer = nullptr; - size_t m_size = 0; + /// Helper method for calling the dtor for the elements + void cleanup(); + + ///Pointer to the underlying buffer + pointer m_buffer = nullptr; + + ///Num of elements/size + size_type m_size = 0; }; } // namespace GSFUtils diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.icc b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.icc index e47f9028a1c73b3da64f84bab4c01326afd037b1..a9b64c6bd030ea6a34e8ccc6489e3549e72f9e72 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.icc +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AlignedDynArray.icc @@ -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 */ /** @@ -11,28 +11,28 @@ namespace GSFUtils { -template<typename T, size_t Alignment> -inline AlignedDynArray<T, Alignment>::AlignedDynArray(size_t n) +template<typename T, size_t ALIGNMENT> +inline AlignedDynArray<T, ALIGNMENT>::AlignedDynArray(size_type n) : m_buffer(nullptr) , m_size(n) { const size_t bufferSize = n * sizeof(T); - m_buffer = static_cast<T*>(std::aligned_alloc(Alignment, bufferSize)); + m_buffer = static_cast<T*>(std::aligned_alloc(ALIGNMENT, bufferSize)); std::uninitialized_default_construct(m_buffer, m_buffer + m_size); } -template<typename T, size_t Alignment> -inline AlignedDynArray<T, Alignment>::AlignedDynArray(size_t n, const T& value) +template<typename T, size_t ALIGNMENT> +inline AlignedDynArray<T, ALIGNMENT>::AlignedDynArray(size_type n, const T& value) : m_buffer(nullptr) , m_size(n) { const size_t bufferSize = n * sizeof(T); - m_buffer = static_cast<T*>(std::aligned_alloc(Alignment, bufferSize)); + m_buffer = static_cast<T*>(std::aligned_alloc(ALIGNMENT, bufferSize)); std::uninitialized_fill(m_buffer, m_buffer + m_size, value); } -template<typename T, size_t Alignment> -inline AlignedDynArray<T, Alignment>::AlignedDynArray( +template<typename T, size_t ALIGNMENT> +inline AlignedDynArray<T, ALIGNMENT>::AlignedDynArray( AlignedDynArray&& other) noexcept : m_buffer(nullptr) , m_size(0) @@ -45,9 +45,9 @@ inline AlignedDynArray<T, Alignment>::AlignedDynArray( other.m_size = 0; } -template<typename T, size_t Alignment> -inline AlignedDynArray<T, Alignment>& -AlignedDynArray<T, Alignment>::operator=(AlignedDynArray&& other) noexcept +template<typename T, size_t ALIGNMENT> +inline AlignedDynArray<T, ALIGNMENT>& +AlignedDynArray<T, ALIGNMENT>::operator=(AlignedDynArray&& other) noexcept { // cleanup this object cleanup(); @@ -61,53 +61,90 @@ AlignedDynArray<T, Alignment>::operator=(AlignedDynArray&& other) noexcept return *this; } -template<typename T, size_t Alignment> -inline AlignedDynArray<T, Alignment>::~AlignedDynArray() +template<typename T, size_t ALIGNMENT> +inline AlignedDynArray<T, ALIGNMENT>::~AlignedDynArray() { cleanup(); } -template<typename T, size_t Alignment> -inline T* -AlignedDynArray<T, Alignment>::buffer() noexcept +template<typename T, size_t ALIGNMENT> +inline typename AlignedDynArray<T, ALIGNMENT>::pointer +AlignedDynArray<T, ALIGNMENT>::buffer() noexcept { return m_buffer; } -template<typename T, size_t Alignment> -inline const T* -AlignedDynArray<T, Alignment>::buffer() const noexcept +template<typename T, size_t ALIGNMENT> +inline typename AlignedDynArray<T, ALIGNMENT>::const_pointer +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) noexcept +template<typename T, size_t ALIGNMENT> +inline typename AlignedDynArray<T, ALIGNMENT>::reference + 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 noexcept +template<typename T, size_t ALIGNMENT> +inline typename AlignedDynArray<T, ALIGNMENT>::const_reference + AlignedDynArray<T, ALIGNMENT>::operator[]( + const AlignedDynArray<T, ALIGNMENT>::size_type pos) const noexcept { return m_buffer[pos]; } -template<typename T, size_t Alignment> -inline std::size_t -AlignedDynArray<T, Alignment>::size() const noexcept +template<typename T, size_t ALIGNMENT> +inline typename AlignedDynArray<T, ALIGNMENT>::iterator +AlignedDynArray<T, ALIGNMENT>::begin() noexcept +{ + return iterator(buffer()); +} + +template<typename T, size_t ALIGNMENT> +inline typename AlignedDynArray<T, ALIGNMENT>::const_iterator +AlignedDynArray<T, ALIGNMENT>::begin() const noexcept +{ + + return const_iterator(buffer()); +} + +template<typename T, size_t ALIGNMENT> +inline typename AlignedDynArray<T, ALIGNMENT>::iterator +AlignedDynArray<T, ALIGNMENT>::end() noexcept +{ + return iterator(buffer() + m_size); +} + +template<typename T, size_t ALIGNMENT> +inline typename AlignedDynArray<T, ALIGNMENT>::const_iterator +AlignedDynArray<T, ALIGNMENT>::end() const noexcept +{ + return const_iterator(buffer() + m_size); +} + +template<typename T, size_t ALIGNMENT> +inline typename AlignedDynArray<T, ALIGNMENT>::size_type +AlignedDynArray<T, ALIGNMENT>::size() const noexcept { return m_size; } -template<typename T, size_t Alignment> +template<typename T, size_t ALIGNMENT> +bool AlignedDynArray<T, ALIGNMENT>::empty() const noexcept +{ + return (size() == 0); +} + +// private cleanup helper +template<typename T, size_t ALIGNMENT> inline void -AlignedDynArray<T, Alignment>::cleanup() noexcept +AlignedDynArray<T, ALIGNMENT>::cleanup() { if (m_buffer) { - for (std::size_t pos = 0; pos < m_size; ++pos) { + for (size_type pos = 0; pos < m_size; ++pos) { m_buffer[pos].~T(); } std::free(m_buffer); diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testAlignedDynArray.ref b/Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testAlignedDynArray.ref index 9b81d1f2ac385c377dbbcd2cff39c97749acd9b7..9650dc8c5e7f7fb63f4bc49941740983667d9c80 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testAlignedDynArray.ref +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/share/ut_GSF_testAlignedDynArray.ref @@ -2,26 +2,32 @@ ==> Test ctor with default init of elements Size = 100 Address of [0]%alignment = 0 -Value of 0th = 0 -Value of last = 0 +Address of begin%alignment = 0 +Address of end%alignment = 16 +Value of begin = 0 +Value of end -1 = 0 ==> Test ctor with value init of elements Size = 100 Address of [0]%alignment = 0 -Value of 0th = 0.1 -Value of last = 0.1 +Address of begin%alignment = 0 +Address of end%alignment = 16 +Value of begin = 4 +Value of end -1 = 4 ==> Test move copy ctor -Size = 100 -Size of moved from 0 +Size after copy ctor = 100 Address of [0]%alignment = 0 -Value of 0th = 0.1 -Value of last = 0.1 +Address of begin%alignment = 0 +Address of end%alignment = 16 +Value of begin = 4 +Value of end -1 = 4 ==> Test move assignment Size before assignment = 50 -Size = 100 -Size of moved from 0 +Size after assignment 100 Address of [0]%alignment = 0 -Value of 0th = 0.1 -Value of last = 0.1 +Address of begin%alignment = 0 +Address of end%alignment = 16 +Value of begin = 4 +Value of end -1 = 4 diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/test/testAlignedDynArray.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/test/testAlignedDynArray.cxx index e0d467666d07308f68769306100b4816dafb6d5a..46cdea220056818e5f27d66d1173541d6fbc5c51 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/test/testAlignedDynArray.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/test/testAlignedDynArray.cxx @@ -3,47 +3,84 @@ */ #include "TrkGaussianSumFilter/AlignedDynArray.h" #include <iostream> -int main() +#include <cstdint> +int +main() { - constexpr size_t alignement = 32; + // + //32 bit int has size 4 bytes + using testType = int32_t; + constexpr size_t alignement = 32; //32 byte alignment constexpr size_t n = 100; - std::cout << "\n ==> Test ctor with default init of elements " << std::endl; - GSFUtils::AlignedDynArray<double, alignement> test1(n); - std::cout << "Size = " << test1.size()<< std::endl; + //begin should be aligned at 32 boundary + //end (32+100*4)%32 ==> 16 + + + std::cout << "\n ==> Test ctor with default init of elements " << '\n'; + GSFUtils::AlignedDynArray<testType, alignement> test1(n); + std::cout << "Size = " << test1.size() << '\n'; std::cout << "Address of [0]%alignment = " - << reinterpret_cast<std::ptrdiff_t>(&test1[0]) % alignement << std::endl; - std::cout << "Value of 0th = " << test1[0] << std::endl; - std::cout << "Value of last = " << test1[99] << std::endl; + << reinterpret_cast<std::ptrdiff_t>(test1.buffer()) % alignement + << '\n'; + std::cout << "Address of begin%alignment = " + << reinterpret_cast<std::ptrdiff_t>(test1.begin()) % alignement + << '\n'; + std::cout << "Address of end%alignment = " + << reinterpret_cast<std::ptrdiff_t>(test1.end()) % alignement + << '\n'; + std::cout << "Value of begin = " << *(test1.begin()) << '\n'; + std::cout << "Value of end -1 = " << *(test1.end() - 1) << '\n'; - std::cout << "\n ==> Test ctor with value init of elements" << std::endl; - GSFUtils::AlignedDynArray<double, alignement> test2(n, 0.1); - std::cout << "Size = " << test2.size()<< std::endl; + std::cout << "\n ==> Test ctor with value init of elements" << '\n'; + GSFUtils::AlignedDynArray<testType, alignement> test2(n, 4); + std::cout << "Size = " << test2.size() << '\n'; std::cout << "Address of [0]%alignment = " - << reinterpret_cast<std::ptrdiff_t>(&test2[0]) % alignement << std::endl; - std::cout << "Value of 0th = " << test2[0] << std::endl; - std::cout << "Value of last = " << test2[99] << std::endl; - - std::cout << "\n ==> Test move copy ctor" << std::endl; - GSFUtils::AlignedDynArray<double, alignement> test3(std::move(test2)); - std::cout << "Size = " << test3.size()<< std::endl; - std::cout << "Size of moved from " << test2.size()<< std::endl; + << reinterpret_cast<std::ptrdiff_t>(test2.buffer()) % alignement + << '\n'; + std::cout << "Address of begin%alignment = " + << reinterpret_cast<std::ptrdiff_t>(test2.begin()) % alignement + << '\n'; + std::cout << "Address of end%alignment = " + << reinterpret_cast<std::ptrdiff_t>(test2.end()) % alignement + << '\n'; + std::cout << "Value of begin = " << *(test2.begin()) << '\n'; + std::cout << "Value of end -1 = " << *(test2.end() - 1) << '\n'; + + std::cout << "\n ==> Test move copy ctor" << '\n'; + GSFUtils::AlignedDynArray<testType, alignement> test3(std::move(test2)); + std::cout << "Size after copy ctor = " << test3.size() <<'\n'; std::cout << "Address of [0]%alignment = " - << reinterpret_cast<std::ptrdiff_t>(&test3[0]) % alignement << std::endl; - std::cout << "Value of 0th = " << test3[0] << std::endl; - std::cout << "Value of last = " << test3[99] << std::endl; - - std::cout << "\n ==> Test move assignment" << std::endl; - GSFUtils::AlignedDynArray<double, alignement> test4(n/2); - std::cout << "Size before assignment = " << test4.size()<< std::endl; - test4=std::move(test3); - std::cout << "Size = " << test4.size()<< std::endl; - std::cout << "Size of moved from " << test3.size()<< std::endl; + << reinterpret_cast<std::ptrdiff_t>(test3.buffer()) % alignement + << '\n'; + std::cout << "Address of begin%alignment = " + << reinterpret_cast<std::ptrdiff_t>(test3.begin()) % alignement + << '\n'; + std::cout << "Address of end%alignment = " + << reinterpret_cast<std::ptrdiff_t>(test3.end()) % alignement + << '\n'; + std::cout << "Value of begin = " << *(test3.begin()) << '\n'; + std::cout << "Value of end -1 = " << *(test3.end() - 1) << '\n'; + + std::cout << "\n ==> Test move assignment" << '\n'; + GSFUtils::AlignedDynArray<testType, alignement> test4(n / 2); + std::cout << "Size before assignment = " << test4.size() << '\n'; + test4 = std::move(test3); + std::cout << "Size after assignment " << test4.size() << '\n'; std::cout << "Address of [0]%alignment = " - << reinterpret_cast<std::ptrdiff_t>(&test4[0]) % alignement << std::endl; - std::cout << "Value of 0th = " << test4[0] << std::endl; - std::cout << "Value of last = " << test4[99] << std::endl; + << reinterpret_cast<std::ptrdiff_t>(test4.buffer()) % alignement + << '\n'; + std::cout << "Address of begin%alignment = " + << reinterpret_cast<std::ptrdiff_t>(test4.begin()) % alignement + << '\n'; + std::cout << "Address of end%alignment = " + << reinterpret_cast<std::ptrdiff_t>(test4.end()) % alignement + << '\n'; + std::cout << "Value of begin = " << *(test4.begin()) << '\n'; + std::cout << "Value of end -1 = " << *(test4.end() - 1) << '\n'; + + return 0; } diff --git a/Tracking/TrkFitter/TrkiPatFitter/CMakeLists.txt b/Tracking/TrkFitter/TrkiPatFitter/CMakeLists.txt index 569e9d6ab9ad635dca88a6162d7b50c472de89dc..ddcf0ff91606ea4cb00548b31a255bff59ff1d1f 100644 --- a/Tracking/TrkFitter/TrkiPatFitter/CMakeLists.txt +++ b/Tracking/TrkFitter/TrkiPatFitter/CMakeLists.txt @@ -40,7 +40,7 @@ atlas_add_component( TrkiPatFitter src/MaterialAllocator.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel TrkParameters TrkTrack TrkFitterInterfaces TrkiPatFitterUtils EventPrimitives TrkDetDescrInterfaces TrkDetElementBase TrkGeometry TrkSurfaces Identifier TrkMaterialOnTrack TrkMeasurementBase TrkRIO_OnTrack MuonCompetingRIOsOnTrack TrkExInterfaces TrkExUtils ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel TrkParameters TrkTrack TrkFitterInterfaces TrkiPatFitterUtils EventPrimitives TrkDetDescrInterfaces TrkDetElementBase TrkGeometry TrkSurfaces Identifier TrkMaterialOnTrack TrkMeasurementBase TrkRIO_OnTrack MuonCompetingRIOsOnTrack TrkExInterfaces TrkExUtils TrkToolInterfaces ) # Install files from the package: atlas_install_headers( TrkiPatFitter ) diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/AmbiCounter.icc b/Tracking/TrkTools/TrkAmbiguityProcessor/src/AmbiCounter.icc index cc6b2af9c86dd08c54cba26e54b6b70aa3d2838f..62e896698e63fa5773aaf77e534f2a469f973b58 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/AmbiCounter.icc +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/AmbiCounter.icc @@ -8,12 +8,15 @@ #include <vector> #include <string> #include "TrkTrack/Track.h" +#include <stdexcept> +#include <algorithm> +#include <optional> template<class EnumType> class AmbiCounter { public: using Categories = EnumType; - enum RegionIndex {iAll = 0, iBarrel = 1, iTransi = 2, iEndcap = 3, iDBM = 4, nRegions=5, iForwrd = 4}; + enum RegionIndex {iBarrel , iTransi , iEndcap , iDBM = 3, nRegions=4, iForwrd = 3}; enum GlobalCounterIndices { nEvents, nInvalidTracks, @@ -22,7 +25,11 @@ public: }; // AmbiCounter(const std::vector<float> &eta_bounds): m_etaBounds(eta_bounds){ - //nop + const std::string errMsgPrefix = "In AmbiCounter.icc, eta_bounds size must be "; + if (m_etaBounds.size()!=nRegions) throw std::runtime_error(errMsgPrefix + std::to_string(nRegions) + " elements long."); + if (not std::is_sorted(m_etaBounds.begin(), m_etaBounds.end())){ + throw std::runtime_error(errMsgPrefix + "in ascending order."); + } } //convert Category to array index @@ -31,6 +38,11 @@ public: return static_cast<size_t>(categoryIndex); } + void + resetGlobalCounters(){ + m_globalCounter.fill(0); + } + //increment event count void newEvent(){ @@ -44,51 +56,54 @@ public: } // increment one bin void - increment(Categories regionIdx, unsigned int etaBinIdx) { - if (etaBinIdx>=nRegions) return; - if (regionIdx<Categories::kNCounter && etaBinIdx < m_counter[idx(regionIdx)].size()) { - ++m_counter[idx(regionIdx)][etaBinIdx]; - } else { throw std::range_error("out of range"); } - + increment(Categories category, unsigned int etaBinIdx) { + if ((category>= Categories::kNCounter) or (etaBinIdx >=nRegions)){ + throw std::out_of_range("in AmbiCounter.icc::increment()"); + } + ++m_counter[idx(category)][etaBinIdx]; } // AmbiCounter<EnumType> & operator +=(const AmbiCounter<EnumType> &a) { for (unsigned int i=0; i<nGlobalCounters; ++i) { m_globalCounter[i]+= a.m_globalCounter[i]; } - for (size_t regionIdx=0; regionIdx < idx(Categories::kNCounter); ++regionIdx) { - for (unsigned int etaBinIdx=0; etaBinIdx < a.m_counter[regionIdx].size(); ++etaBinIdx) { - m_counter[regionIdx][etaBinIdx] += a.m_counter[regionIdx][etaBinIdx]; + for (size_t categoryIdx=0; categoryIdx < idx(Categories::kNCounter); ++categoryIdx) { + for (unsigned int etaBinIdx=0; etaBinIdx < a.m_counter[categoryIdx].size(); ++etaBinIdx) { + m_counter[categoryIdx][etaBinIdx] += a.m_counter[categoryIdx][etaBinIdx]; } } return *this; } // - void incrementCounterByRegion(Categories regionIdx,const Trk::Track* track, bool updateAll=true){ - if (updateAll) increment(regionIdx,iAll); + void incrementCounterByRegion(Categories categoryIdx,const Trk::Track* track){ // test if (!track) { - ++m_globalCounter[nEvents]; + ++m_globalCounter[nInvalidTracks]; return; } // use first parameter if (!track->trackParameters()) { ++m_globalCounter[nTracksWithoutParam]; } else { - std::array<int, nRegions> &nTracks = m_counter[idx(regionIdx)]; + std::array<int, nRegions> &nTracks = m_counter.at(idx(categoryIdx)); // @TODO make sure that list of track parameters is not empty const double absEta = std::abs(track->trackParameters()->front()->eta()); - ++nTracks[etaBin(absEta)]; + if (const auto &possibleIdx{etaBin(absEta)}){//i.e. if it's within bounds + ++nTracks[possibleIdx.value()]; + } } } // std::string - dumpRegions(const std::string & head,Categories regionIdx, const int iw =9) const { + dumpRegions(const std::string & head,Categories categoryIdx, const int iw =9) const { std::stringstream out; out << head; + if (categoryIdx >= Categories::kNCounter) throw std::out_of_range("Array index out of range in AmbiCounter::inc by region"); + const auto & displayedArray = m_counter[idx(categoryIdx)]; + const auto allRegionCounts = std::accumulate(displayedArray.begin(), displayedArray.end(),0); + out << std::setiosflags(std::ios::dec) << std::setw(iw) << allRegionCounts; for (unsigned int etaBinIdx=0; etaBinIdx < nRegions; ++etaBinIdx) { - assert( etaBinIdx < m_counter[idx(regionIdx)].size() ); - out << std::setiosflags(std::ios::dec) << std::setw(iw) << m_counter[idx(regionIdx)][etaBinIdx]; + out << std::setiosflags(std::ios::dec) << std::setw(iw) << m_counter[idx(categoryIdx)][etaBinIdx]; } out << "\n"; return out.str(); @@ -103,14 +118,11 @@ private: std::array<std::array<int, nRegions>,static_cast<size_t>(Categories::kNCounter)> m_counter{}; std::array<int,nGlobalCounters> m_globalCounter{}; const std::vector<float> &m_etaBounds; //!< eta intervals for internal monitoring - size_t + std::optional<size_t> etaBin(const double val){ - size_t regionIdx=1; - //eta *must be* in ascending order in the m_etaBounds vector - for (;regionIdx< nRegions; ++regionIdx){ - if (val < m_etaBounds[regionIdx-1]) break; - } - return regionIdx; + auto pVal = std::lower_bound(m_etaBounds.begin(), m_etaBounds.end(), val); + //if it's in bounds, return the value, otherwise return a nullopt + return (pVal!=m_etaBounds.end()) ? std::optional<size_t>(std::distance(m_etaBounds.begin(), pVal)):std::nullopt; } }; diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx index 38979306628ed799de67657917dd137c922a49d0..9471609d45083cc19a29562c0d48b550cc0bfcca 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx @@ -94,13 +94,10 @@ Trk::DenseEnvironmentsAmbiguityProcessorTool::~DenseEnvironmentsAmbiguityProcess StatusCode Trk::DenseEnvironmentsAmbiguityProcessorTool::initialize() { StatusCode sc = StatusCode::SUCCESS; - ATH_CHECK( m_scoringTool.retrieve()); - ATH_CHECK( m_assoMapName.initialize(!m_assoMapName.key().empty())); ATH_CHECK( m_assoTool.retrieve() ); ATH_CHECK( m_trackSummaryTool.retrieve( DisableTool{ m_trackSummaryTool.name().empty() } ) ); - ATH_CHECK( m_selectionTool.retrieve()); ATH_CHECK( m_fitterTool.retrieve()); if (m_fitterTool.empty()){ @@ -128,8 +125,8 @@ StatusCode Trk::DenseEnvironmentsAmbiguityProcessorTool::initialize() ATH_CHECK(m_dRMap.initialize() ); } - if (m_etaBounds.size() != TrackStat::nRegions-1) { - ATH_MSG_FATAL("There must be exactly " << (TrackStat::nRegions-1) << " eta bounds but " + if (m_etaBounds.size() != TrackStat::nRegions) { + ATH_MSG_FATAL("There must be exactly " << (TrackStat::nRegions) << " eta bounds but " << m_etaBounds.size() << " are set." ); return StatusCode::FAILURE; } @@ -165,7 +162,6 @@ TrackCollection* Trk::DenseEnvironmentsAmbiguityProcessorTool::process(const Tra { if (!trackScoreTrackMap) return nullptr; // clear prdAssociationTool via selection tool - // @TODO remove : std::unique_ptr<Trk::PRDtoTrackMap> prd_to_track_map( m_assoTool->createPRDtoTrackMap() ); if (!m_assoMapName.key().empty()) { @@ -178,9 +174,7 @@ TrackCollection* Trk::DenseEnvironmentsAmbiguityProcessorTool::process(const Tra } } std::vector<std::unique_ptr<const Trk::Track> > cleanup_tracks; - reloadHadROIs(); - // going to do simple algorithm for now: // - take track with highest score // - remove shared hits from all other tracks @@ -198,11 +192,9 @@ TrackCollection* Trk::DenseEnvironmentsAmbiguityProcessorTool::process(const Tra m_stat += stat; } } - if(m_applydRcorrection) - { + if(m_applydRcorrection){ ATH_MSG_ERROR("applydRcorrection is going to be removed."); } - return finalTracks; } @@ -213,12 +205,10 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::addTrack(Trk::Track* track, c std::multimap<float, TrackPtr > &scoreTrackFitflagMap, const Trk::PRDtoTrackMap &prd_to_track_map, std::vector<std::unique_ptr<const Trk::Track> >& cleanup_tracks, - TrackStat &stat) const -{ + TrackStat &stat) const{ // compute score TrackScore score; bool suppressHoleSearch = fitted ? m_suppressHoleSearch : true; - ATH_MSG_DEBUG ("addTrack()::Fitted "<< fitted); if (m_trackSummaryTool.isEnabled()) { m_trackSummaryTool->computeAndReplaceTrackSummary(*track, @@ -288,38 +278,28 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::solveTracks(const TracksScore Trk::PRDtoTrackMap &prd_to_track_map, TrackCollection &finalTracks, std::vector<std::unique_ptr<const Trk::Track> > &cleanup_tracks, - TrackStat &stat) const -{ - + TrackStat &stat) const{ std::multimap<float, TrackPtr > scoreTrackFitflagMap; for(const std::pair< const Trk::Track *, float> &scoreTrack: trackScoreTrackMap){ scoreTrackFitflagMap.emplace(scoreTrack.second, TrackPtr(scoreTrack.first) ); stat.incrementCounterByRegion(EStatType::kNcandidates,scoreTrack.first); } - ATH_MSG_DEBUG ("Starting to solve tracks"); - // now loop as long as map is not empty - while ( !scoreTrackFitflagMap.empty() ) - { + while ( !scoreTrackFitflagMap.empty() ){ // get current best candidate std::multimap<float, TrackPtr >::iterator itnext = scoreTrackFitflagMap.begin(); TrackPtr atrack( std::move(itnext->second) ); float ascore = itnext->first; - scoreTrackFitflagMap.erase(itnext); - // clean it out to make sure not to many shared hits ATH_MSG_DEBUG ("--- Trying next track "<<atrack.track()<<"\t with score "<<-ascore); 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 ("--- cleaned next track "<< cleanedTrack.get()); - - // cleaned track is input track and fitted - if (keep_orig && atrack.fitted()) - { + if (keep_orig && atrack.fitted()){ // track can be kept as is and is already fitted ATH_MSG_DEBUG ("Accepted track "<<atrack.track()<<"\t has score "<<-ascore); stat.incrementCounterByRegion(EStatType::kNaccepted, atrack.track() ); @@ -344,63 +324,50 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::solveTracks(const TracksScore if (atrack.newTrack()) { cleanup_tracks.push_back(std::unique_ptr<const Trk::Track>(atrack.release()) ); } - } - else{ + }else{ // add track to PRD_AssociationTool StatusCode sc = m_assoTool->addPRDs(prd_to_track_map, *atrack); if (sc.isFailure()) ATH_MSG_ERROR( "addPRDs() failed" ); // add to output list finalTracks.push_back( atrack.release() ); } - } - else { + }else { // add track to PRD_AssociationTool StatusCode sc = m_assoTool->addPRDs(prd_to_track_map, *atrack); if (sc.isFailure()) ATH_MSG_ERROR( "addPRDs() failed" ); // add to output list finalTracks.push_back( atrack.release() ); } - } - else if ( keep_orig) - { + }else if ( keep_orig){ // track can be kept as is, but is not yet fitted ATH_MSG_DEBUG ("Good track("<< atrack.track() << ") but need to fit this track first, score, add it into map again and retry ! "); Trk::Track *refittedTrack = refitTrack(atrack.track(),prd_to_track_map, stat); if(refittedTrack) { addTrack( refittedTrack, true , scoreTrackFitflagMap, prd_to_track_map, cleanup_tracks, stat); } - // remove original copy, but delay removal since some pointer to it or its constituents may still be in used if (atrack.newTrack()) { cleanup_tracks.push_back(std::unique_ptr<const Trk::Track>(atrack.release()) ); } - } - else if ( cleanedTrack ) //cleanedTrack != atrack - { + } else if ( cleanedTrack ) {//cleanedTrack != atrack ATH_MSG_DEBUG ("Candidate excluded, add subtrack to map. Track "<<cleanedTrack.get()); stat.incrementCounterByRegion(EStatType::kNsubTrack,cleanedTrack.get()); - // for this case clenedTrack is a new created object. addTrack(cleanedTrack.release(), false, scoreTrackFitflagMap, prd_to_track_map, cleanup_tracks, stat); - // remove original copy, but delay removal since some pointer to it or its constituents may still be in used if (atrack.newTrack()) { cleanup_tracks.push_back(std::unique_ptr<const Trk::Track>(atrack.release()) ); } - } - else - { + } else { // track should be discarded ATH_MSG_DEBUG ("Track "<< atrack.track() << " is excluded, no subtrack, reject"); stat.incrementCounterByRegion(EStatType::kNnoSubTrack,atrack.track()); - // remove original copy, but delay removal since some pointer to it or its constituents may still be in used if (atrack.newTrack()) { cleanup_tracks.push_back(std::unique_ptr<const Trk::Track>(atrack.release()) ); } } } - ATH_MSG_DEBUG ("Finished, number of track on output: "<<finalTracks.size()); } @@ -409,35 +376,30 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::solveTracks(const TracksScore //================================================================================================== Trk::Track* Trk::DenseEnvironmentsAmbiguityProcessorTool::refitTrack( const Trk::Track* track, Trk::PRDtoTrackMap &prd_to_track_map, - TrackStat &stat) const -{ + TrackStat &stat) const{ Trk::Track* newTrack = nullptr; if (!m_suppressTrackFit){ - if (m_refitPrds) - { + if (m_refitPrds) { // simple case, fit PRD directly ATH_MSG_VERBOSE ("Refit track "<<track<<" from PRDs"); newTrack = refitPrds (track,prd_to_track_map, stat); - } - else - { + }else { // ok, we fit ROTs ATH_MSG_VERBOSE ("Refit track "<<track<<" from ROTs"); newTrack = refitRots (track,stat); } } else { - double reXi2 = 0.; int nDF = 0; + double reXi2 = 0.; + int nDF = 0; const DataVector<const TrackStateOnSurface>* tsos = track->trackStateOnSurfaces(); DataVector<const TrackStateOnSurface>* vecTsos = new DataVector<const TrackStateOnSurface>(); // loop over TSOS, copy TSOS and push into vector DataVector<const TrackStateOnSurface>::const_iterator iTsos = tsos->begin(); DataVector<const TrackStateOnSurface>::const_iterator iTsosEnd = tsos->end(); - for ( ; iTsos != iTsosEnd ; ++iTsos) - { + for ( ; iTsos != iTsosEnd ; ++iTsos) { const TrackStateOnSurface* newTsos = new TrackStateOnSurface(**iTsos); vecTsos->push_back(newTsos); - if((*iTsos)->type(Trk::TrackStateOnSurface::Measurement)) - { //Get the chi2 and number of hits + if((*iTsos)->type(Trk::TrackStateOnSurface::Measurement)){ //Get the chi2 and number of hits if ((*iTsos)->fitQualityOnSurface()) { reXi2 += (*iTsos)->fitQualityOnSurface()->chiSquared(); nDF += (*iTsos)->fitQualityOnSurface()->numberDoF(); @@ -450,18 +412,14 @@ Trk::Track* Trk::DenseEnvironmentsAmbiguityProcessorTool::refitTrack( const Trk: Trk::TrackInfo newInfo; newInfo.setPatternRecognitionInfo(Trk::TrackInfo::SimpleAmbiguityProcessorTool); info.addPatternReco(newInfo); - newTrack = new Trk::Track(info, vecTsos, fq); } - if (newTrack!=nullptr) - { + if (newTrack!=nullptr) { ATH_MSG_DEBUG ("New track "<<newTrack<<" successfully fitted from "<<track); - } - else { + } else { ATH_MSG_DEBUG ("Fit failed !"); } - return newTrack; } @@ -902,8 +860,8 @@ Trk::DenseEnvironmentsAmbiguityProcessorTool::dumpStat(MsgStream &out) const{ } out << "------------------------------------------------------------------------------------" << "\n"; out << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setprecision(2) - << " definition: ( 0.0 < Barrel < " << m_etaBounds[TrackStat::iBarrel-1] << " < Transition < " << m_etaBounds[TrackStat::iTransi-1] - << " < Endcap < " << m_etaBounds[TrackStat::iEndcap-1] << " < Forward < " << m_etaBounds[TrackStat::iForwrd-1] << " )" << "\n"; + << " definition: ( 0.0 < Barrel < " << m_etaBounds[TrackStat::iBarrel] << " < Transition < " << m_etaBounds[TrackStat::iTransi] + << " < Endcap < " << m_etaBounds[TrackStat::iEndcap] << " < Forward < " << m_etaBounds[TrackStat::iForwrd] << " )" << "\n"; out << "------------------------------------------------------------------------------------" << "\n"; out << std::setprecision(ss); } diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx index a67ca1678ca5333be7b6d8ee8a5a51eb56a86bf6..1ba7763fe8347fb873f85be696432539c0546688 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx @@ -54,9 +54,7 @@ Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::~DenseEnvironmentsAmbiguitySc StatusCode Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::initialize() { StatusCode sc = StatusCode::SUCCESS; - ATH_CHECK( m_scoringTool.retrieve()); - ATH_CHECK( m_assoTool.retrieve()) ; ATH_CHECK( m_assoToolNotGanged.retrieve( DisableTool{m_assoToolNotGanged.empty()} )) ; ATH_CHECK( m_assoMapName.initialize(!m_assoMapName.key().empty()) ); @@ -68,8 +66,8 @@ StatusCode Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::initialize() ATH_CHECK( m_splitClusterMapKey_last.initialize(!m_splitClusterMapKey_last.key().empty()) ); ATH_CHECK( m_splitClusterMapKey.initialize(!m_splitClusterMapKey.key().empty()) ); - if (m_etaBounds.size() != TrackStat3::nRegions-1) { - ATH_MSG_FATAL("There must be exactly " << (TrackStat3::nRegions-1) << " eta bounds but " + if (m_etaBounds.size() != TrackStat3::nRegions) { + ATH_MSG_FATAL("There must be exactly " << (TrackStat3::nRegions) << " eta bounds but " << m_etaBounds.size() << " are set." ); return StatusCode::FAILURE; } @@ -148,10 +146,8 @@ void Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::addNewTracks(std::vector { TrackStat3 stat(m_etaBounds); stat.newEvent(); - std::unique_ptr<Trk::PRDtoTrackMap> prd_to_track_map( m_assoTool->createPRDtoTrackMap() ); PrdSignatureSet prdSigSet; - ATH_MSG_DEBUG ("Number of tracks at Input: "<<tracks->size()); for(const Track* a_track : *tracks) { @@ -305,7 +301,7 @@ Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::overlappingTracks(const Track // now loop as long as map is not empty std::vector< std::pair< const InDet::PixelCluster*, const Trk::Track* > > sorted; sorted.reserve( setOfPixelClustersToTrackAssoc.size() ); - for( const std::pair< const InDet::PixelCluster*, const Trk::Track* > &pixelTrackItem : setOfPixelClustersToTrackAssoc ) { + for( const std::pair< const InDet::PixelCluster* const, const Trk::Track* > &pixelTrackItem : setOfPixelClustersToTrackAssoc ) { sorted.push_back( pixelTrackItem ); } std::sort( sorted.begin(), sorted.end(), [](const std::pair< const InDet::PixelCluster*, const Trk::Track* > &a, @@ -368,8 +364,8 @@ Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::dumpStat(MsgStream &out) cons out << m_stat.dumpRegions(" - candidates rejected as double :", EStatType::kNcandDouble,iw); out << "------------------------------------------------------------------------------------" << "\n"; out << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setprecision(2) - << " definition: ( 0.0 < Barrel < " << m_etaBounds[TrackStat3::iBarrel-1] << " < Transition < " << m_etaBounds[TrackStat3::iTransi-1] - << " < Endcap < " << m_etaBounds[TrackStat3::iEndcap-1] << " < Forward < " << m_etaBounds[TrackStat3::iForwrd-1] << " )" << "\n"; + << " definition: ( 0.0 < Barrel < " << m_etaBounds[TrackStat3::iBarrel] << " < Transition < " << m_etaBounds[TrackStat3::iTransi] + << " < Endcap < " << m_etaBounds[TrackStat3::iEndcap] << " < Forward < " << m_etaBounds[TrackStat3::iForwrd] << " )" << "\n"; out << "------------------------------------------------------------------------------------" << "\n"; out << std::setprecision(ss); } diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx index 732a75b3b66279310040dd962d10c799c37df8c5..65a534190509111ccf10664763bc034dce63edca 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx @@ -27,7 +27,6 @@ Trk::SimpleAmbiguityProcessorTool::SimpleAmbiguityProcessorTool(const std::strin m_etabounds( {0.8, 1.6, 2.5, - 2.5, 10.0} ), m_stat(m_etabounds) { @@ -56,65 +55,31 @@ Trk::SimpleAmbiguityProcessorTool::~SimpleAmbiguityProcessorTool() } //================================================================================================== -StatusCode Trk::SimpleAmbiguityProcessorTool::initialize() -{ - +StatusCode Trk::SimpleAmbiguityProcessorTool::initialize(){ StatusCode sc = AthAlgTool::initialize(); - if (sc.isFailure()) - { - msg(MSG::FATAL) << "AlgTool::initialise failed" << endmsg; - return StatusCode::FAILURE; - } - + if (sc.isFailure()) { + ATH_MSG_FATAL( "AlgTool::initialise failed" ); + return StatusCode::FAILURE; + } // the association tool can be disabled if for this processor instance a PRD-to-track map is provided by the caller. ATH_CHECK( m_assoTool.retrieve() ); ATH_CHECK( m_trackSummaryTool.retrieve( DisableTool{ m_trackSummaryTool.name().empty() } ) ); - - sc = m_scoringTool.retrieve(); - if (sc.isFailure()) - { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_scoringTool << endmsg; - return StatusCode::FAILURE; - } - - msg(MSG::INFO) << "Retrieved tool " << m_scoringTool << endmsg; - - sc = m_selectionTool.retrieve(); - if (sc.isFailure()) - { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_selectionTool << endmsg; - return StatusCode::FAILURE; - } - - msg(MSG::INFO) << "Retrieved tool " << m_selectionTool << endmsg; - - sc = m_fitterTool.retrieve(); - if (sc.isFailure()) - { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_fitterTool << endmsg; - return sc; - } - - msg(MSG::INFO) << "Retrieved tool " << m_fitterTool << endmsg; - + ATH_CHECK( m_scoringTool.retrieve()); + ATH_CHECK( m_selectionTool.retrieve()); + ATH_CHECK( m_fitterTool.retrieve()); // suppress refit overwrites force refit - if (m_forceRefit && m_suppressTrackFit ) - { - msg(MSG::WARNING) << "Inconsistent parameter settings, forced refit is true, but fitting suppressed, resetingt force refit !" << endmsg; - m_forceRefit = false; - } - + if (m_forceRefit && m_suppressTrackFit ) { + ATH_MSG_WARNING( "Inconsistent parameter settings, forced refit is true, but fitting suppressed, resetingt force refit !" ); + m_forceRefit = false; + } // Print out memo that tracks have to be fitted - if (!m_forceRefit) - { - msg(MSG::INFO) << "The forced refit of Tracks is switched off." << endmsg; - msg(MSG::INFO) << "Ensure, that the tracks are fitted after the ambiguity processing!" << endmsg; - } - + if (!m_forceRefit) { + ATH_MSG_INFO( "The forced refit of Tracks is switched off." ); + ATH_MSG_INFO( "Ensure, that the tracks are fitted after the ambiguity processing!"); + } // Configuration of the material effects Trk::ParticleSwitcher particleSwitch; m_particleHypothesis = particleSwitch.particle[m_matEffects]; - // brem fitting enabled ? if (m_tryBremFit) { ATH_MSG_INFO( "Try brem fit and recovery for electron like tracks."); @@ -152,7 +117,8 @@ void Trk::SimpleAmbiguityProcessorTool::statistics(){ and then returns the tracks which have been selected*/ -TrackCollection* Trk::SimpleAmbiguityProcessorTool::process(const TrackCollection* trackCol, Trk::PRDtoTrackMap *prdToTrackMap) const { +TrackCollection* +Trk::SimpleAmbiguityProcessorTool::process(const TrackCollection* trackCol, Trk::PRDtoTrackMap *prdToTrackMap) const { std::vector<const Track*> tracks; tracks.reserve(trackCol->size()); for(const Track* e: *trackCol){ @@ -173,11 +139,8 @@ TrackCollection* Trk::SimpleAmbiguityProcessorTool::process(const TracksScores* return re_tracks; } -TrackCollection* Trk::SimpleAmbiguityProcessorTool::process_vector(std::vector<const Track*> &tracks, Trk::PRDtoTrackMap *prdToTrackMap) const{ - using namespace std; - - m_stat.newEvent(); // statistics - +TrackCollection* +Trk::SimpleAmbiguityProcessorTool::process_vector(std::vector<const Track*> &tracks, Trk::PRDtoTrackMap *prdToTrackMap) const{ TrackScoreMap trackScoreTrackMap; std::unique_ptr<Trk::PRDtoTrackMap> prdToTrackMap_cleanup; if (!prdToTrackMap) { @@ -189,7 +152,10 @@ TrackCollection* Trk::SimpleAmbiguityProcessorTool::process_vector(std::vector< ATH_MSG_DEBUG ("Adding input track candidates to list"); Counter stat(m_etabounds); addNewTracks(tracks, trackScoreTrackMap, *prdToTrackMap, stat); - + { + std::lock_guard<std::mutex> lock(m_statMutex); + stat.newEvent(); + } // going to do simple algorithm for now: // - take track with highest score // - remove shared hits from all other tracks @@ -210,60 +176,50 @@ TrackCollection* Trk::SimpleAmbiguityProcessorTool::process_vector(std::vector< void Trk::SimpleAmbiguityProcessorTool::addNewTracks(const std::vector<const Track*> &tracks, TrackScoreMap& trackScoreTrackMap, Trk::PRDtoTrackMap &prdToTrackMap, - Counter &stat) const -{ - using namespace std; + Counter &stat) const { ATH_MSG_DEBUG ("Number of tracks at Input: "<<tracks.size()); - /** signature map to drop double track. */ PrdSignatureSet prdSigSet; - for(const Track *pTrack : tracks) { - ATH_MSG_DEBUG ("Processing track candidate "<<pTrack); - // statistics - stat.incrementCounterByRegion(ECounter::kNcandidates,pTrack); - bool reject = false; - // only fitted tracks get hole search, input is not fitted - TrackScore score = m_scoringTool->score( *pTrack, true); - // veto tracks with score 0 - if (score==0) { - ATH_MSG_DEBUG ("Candidate score is zero, reject it"); - // statistic - stat.incrementCounterByRegion(ECounter::kNcandScoreZero,pTrack); - reject = true; - } else { - - ATH_MSG_DEBUG ("Track Score is "<< score); - - // double track rejection - if (m_dropDouble) { - std::vector<const Trk::PrepRawData*> prds = m_assoTool->getPrdsOnTrack(prdToTrackMap, *pTrack); - - // 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 - stat.incrementCounterByRegion(ECounter::kNcandDouble,pTrack); - reject = true; - } 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 ("<< pTrack <<") has score "<<score); - TrackPtr ptr(pTrack); - if (!m_forceRefit) ptr.forceFitted(); - trackScoreTrackMap.insert( make_pair(-score,std::move(ptr)) ); + ATH_MSG_DEBUG ("Processing track candidate "<<pTrack); + // statistics + stat.incrementCounterByRegion(ECounter::kNcandidates,pTrack); + bool reject = false; + // only fitted tracks get hole search, input is not fitted + TrackScore score = m_scoringTool->score( *pTrack, true); + // veto tracks with score 0 + if (score==0) { + ATH_MSG_DEBUG ("Candidate score is zero, reject it"); + // statistic + stat.incrementCounterByRegion(ECounter::kNcandScoreZero,pTrack); + reject = true; + } else { + ATH_MSG_DEBUG ("Track Score is "<< score); + // double track rejection + if (m_dropDouble) { + std::vector<const Trk::PrepRawData*> prds = m_assoTool->getPrdsOnTrack(prdToTrackMap, *pTrack); + // 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 exists already + if ( !(prdSigSet.insert(prdSig)).second ) { + ATH_MSG_DEBUG ("Double track, reject it !"); + // statistic + stat.incrementCounterByRegion(ECounter::kNcandDouble,pTrack); + reject = true; + } 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 ("<< pTrack <<") has score "<<score); + TrackPtr ptr(pTrack); + if (!m_forceRefit) ptr.forceFitted(); + trackScoreTrackMap.insert( std::make_pair(-score,std::move(ptr)) ); + } + } ATH_MSG_DEBUG ("Number of tracks in map:"<<trackScoreTrackMap.size()); } @@ -276,7 +232,6 @@ void Trk::SimpleAmbiguityProcessorTool::addTrack(Trk::Track* in_track, std::vector<std::unique_ptr<const Trk::Track> >& cleanupTracks, Counter &stat) const { - using namespace std; std::unique_ptr<Trk::Track> atrack(in_track); // compute score TrackScore score; @@ -297,7 +252,7 @@ void Trk::SimpleAmbiguityProcessorTool::addTrack(Trk::Track* in_track, stat.incrementCounterByRegion(ECounter::kNscoreOk,atrack.get()); // add track to map, map is sorted small to big ! - trackScoreTrackMap.insert( make_pair(-score, TrackPtr(atrack.release(), fitted)) ); + trackScoreTrackMap.insert( std::make_pair(-score, TrackPtr(atrack.release(), fitted)) ); return; } @@ -322,7 +277,7 @@ void Trk::SimpleAmbiguityProcessorTool::addTrack(Trk::Track* in_track, stat.incrementCounterByRegion(ECounter::kNfailedFits,atrack.get()); // clean up - cleanupTracks.push_back(std::move(atrack)); + cleanupTracks.push_back(std::move(atrack)); } else @@ -342,7 +297,7 @@ void Trk::SimpleAmbiguityProcessorTool::addTrack(Trk::Track* in_track, stat.incrementCounterByRegion(ECounter::kNscoreZeroBremRefit,bremTrack.get()); // add track to map, map is sorted small to big ! - trackScoreTrackMap.insert( make_pair(-score, TrackPtr(bremTrack.release(), fitted)) ); + trackScoreTrackMap.insert( std::make_pair(-score, TrackPtr(bremTrack.release(), fitted)) ); return; } else @@ -369,80 +324,64 @@ void Trk::SimpleAmbiguityProcessorTool::addTrack(Trk::Track* in_track, TrackCollection *Trk::SimpleAmbiguityProcessorTool::solveTracks(TrackScoreMap& trackScoreTrackMap, Trk::PRDtoTrackMap &prdToTrackMap, std::vector<std::unique_ptr<const Trk::Track> >& cleanupTracks, - Counter &stat) const -{ + Counter &stat) const{ std::unique_ptr<TrackCollection> finalTracks(std::make_unique<TrackCollection>()); ATH_MSG_DEBUG ("Starting to solve tracks"); // now loop as long as map is not empty - while ( !trackScoreTrackMap.empty() ) - { - // get current best candidate - TrackScoreMap::iterator itnext = trackScoreTrackMap.begin(); - TrackScore ascore(itnext->first); - TrackPtr atrack(std::move(itnext->second)); - trackScoreTrackMap.erase(itnext); - - // clean it out to make sure not to many shared hits - ATH_MSG_VERBOSE ("--- Trying next track "<<atrack.track()<<"\t with score "<<-ascore); - std::unique_ptr<Trk::Track> cleanedTrack; - auto [cleanedTrack_tmp,keep_orig] = m_selectionTool->getCleanedOutTrack( atrack.track() , -(ascore), prdToTrackMap); - cleanedTrack.reset( cleanedTrack_tmp); - - // cleaned track is input track and fitted - if (keep_orig && atrack.fitted() ) - { - - // track can be kept as is and is already fitted - ATH_MSG_DEBUG ("Accepted track "<<atrack.track()<<"\t has score "<<-(ascore)); - // statistic - stat.incrementCounterByRegion(ECounter::kNaccepted,atrack.track()); - if (m_tryBremFit && atrack->info().trackProperties(Trk::TrackInfo::BremFit)) - stat.incrementCounterByRegion(ECounter::kNacceptedBrem,atrack.track()); - - // add track to PRD_AssociationTool - StatusCode sc = m_assoTool->addPRDs(prdToTrackMap, *atrack.track()); - if (sc.isFailure()) msg(MSG::ERROR) << "addPRDs() failed" << endmsg; - // add to output list - finalTracks->push_back( const_cast<Track*>(atrack.release()) ); - } else if ( keep_orig ) { - // don't forget to drop track from map - // track can be kept as is, but is not yet fitted - ATH_MSG_DEBUG ("Good track, but need to fit this track first, score, add it into map again and retry !"); - refitTrack(atrack.track(),trackScoreTrackMap, prdToTrackMap, cleanupTracks, stat); - if (atrack.newTrack()) { - cleanupTracks.push_back( std::unique_ptr<Trk::Track>(atrack.release()) ); - } + while ( !trackScoreTrackMap.empty() ){ + // get current best candidate + TrackScoreMap::iterator itnext = trackScoreTrackMap.begin(); + TrackScore ascore(itnext->first); + TrackPtr atrack(std::move(itnext->second)); + trackScoreTrackMap.erase(itnext); + // clean it out to make sure not to many shared hits + ATH_MSG_VERBOSE ("--- Trying next track "<<atrack.track()<<"\t with score "<<-ascore); + std::unique_ptr<Trk::Track> cleanedTrack; + auto [cleanedTrack_tmp,keep_orig] = m_selectionTool->getCleanedOutTrack( atrack.track() , -(ascore), prdToTrackMap); + cleanedTrack.reset( cleanedTrack_tmp); + // cleaned track is input track and fitted + if (keep_orig && atrack.fitted() ){ + // track can be kept as is and is already fitted + ATH_MSG_DEBUG ("Accepted track "<<atrack.track()<<"\t has score "<<-(ascore)); + // statistic + stat.incrementCounterByRegion(ECounter::kNaccepted,atrack.track()); + if (m_tryBremFit && atrack->info().trackProperties(Trk::TrackInfo::BremFit)) stat.incrementCounterByRegion(ECounter::kNacceptedBrem,atrack.track()); + // add track to PRD_AssociationTool + if (m_assoTool->addPRDs(prdToTrackMap, *atrack.track()).isFailure()) ATH_MSG_ERROR("addPRDs() failed" ); + // add to output list + finalTracks->push_back( const_cast<Track*>(atrack.release()) ); + } else if ( keep_orig ) { + // don't forget to drop track from map + // track can be kept as is, but is not yet fitted + ATH_MSG_DEBUG ("Good track, but need to fit this track first, score, add it into map again and retry !"); + refitTrack(atrack.track(),trackScoreTrackMap, prdToTrackMap, cleanupTracks, stat); + if (atrack.newTrack()) { + cleanupTracks.push_back( std::unique_ptr<Trk::Track>(atrack.release()) ); + } // delete original copy - } - else if ( cleanedTrack ) - { - // now delete original track - if (atrack.newTrack()) { - cleanupTracks.push_back( std::unique_ptr<Trk::Track>(atrack.release())); - } - // don't forget to drop track from map - - // stripped down version should be reconsidered - ATH_MSG_DEBUG ("Candidate excluded, add subtrack to map. Track "<<cleanedTrack.get()); - // statistic - stat.incrementCounterByRegion(ECounter::kNsubTrack,cleanedTrack.get()); - - // track needs fitting ! - addTrack( cleanedTrack.release(), false, trackScoreTrackMap, prdToTrackMap, cleanupTracks, stat); - - } else { - - // track should be discarded - ATH_MSG_DEBUG ("Track "<< atrack.track() << " is excluded, no subtrack, reject"); - // statistic - stat.incrementCounterByRegion(ECounter::kNnoSubTrack,atrack.track()); - - if (atrack.newTrack()) { - cleanupTracks.push_back( std::unique_ptr<Trk::Track>(atrack.release()) ); - } + } else if ( cleanedTrack ) { + // now delete original track + if (atrack.newTrack()) { + cleanupTracks.push_back( std::unique_ptr<Trk::Track>(atrack.release())); + } + // don't forget to drop track from map + // stripped down version should be reconsidered + ATH_MSG_DEBUG ("Candidate excluded, add subtrack to map. Track "<<cleanedTrack.get()); + // statistic + stat.incrementCounterByRegion(ECounter::kNsubTrack,cleanedTrack.get()); + // track needs fitting ! + addTrack( cleanedTrack.release(), false, trackScoreTrackMap, prdToTrackMap, cleanupTracks, stat); + } else { + // track should be discarded + ATH_MSG_DEBUG ("Track "<< atrack.track() << " is excluded, no subtrack, reject"); + // statistic + stat.incrementCounterByRegion(ECounter::kNnoSubTrack,atrack.track()); + if (atrack.newTrack()) { + cleanupTracks.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: "<<finalTracks->size()); return finalTracks.release(); } @@ -453,82 +392,63 @@ void Trk::SimpleAmbiguityProcessorTool::refitTrack( const Trk::Track* track, TrackScoreMap& trackScoreTrackMap, Trk::PRDtoTrackMap &prdToTrackMap, std::vector<std::unique_ptr<const Trk::Track> >& cleanupTracks, - Counter &stat) const -{ - using namespace std; + Counter &stat) const{ std::unique_ptr<Trk::Track> newTrack; if (!m_suppressTrackFit) { - if (m_refitPrds) - { - // simple case, fit PRD directly - ATH_MSG_VERBOSE ("Refit track "<<track<<" from PRDs"); - newTrack.reset( refitPrds (track, prdToTrackMap,stat) ); - } - else - { - // ok, we fit ROTs - ATH_MSG_VERBOSE ("Refit track "<<track<<" from ROTs"); - newTrack.reset( refitRots (track,stat) ); - } - } - else - { - double reXi2 = 0.; int nDF = 0; - const DataVector<const TrackStateOnSurface>* tsos = track->trackStateOnSurfaces(); - DataVector<const TrackStateOnSurface>* vecTsos = new DataVector<const TrackStateOnSurface>(); - // loop over TSOS, copy TSOS and push into vector - DataVector<const TrackStateOnSurface>::const_iterator iTsos = tsos->begin(); - DataVector<const TrackStateOnSurface>::const_iterator iTsosEnd = tsos->end(); - for ( ; iTsos != iTsosEnd ; ++iTsos) - { - const TrackStateOnSurface* newTsos = new TrackStateOnSurface(**iTsos); - vecTsos->push_back(newTsos); - if((*iTsos)->type(Trk::TrackStateOnSurface::Measurement)) - { //Get the chi2 and number of hits - if ((*iTsos)->fitQualityOnSurface()) { - reXi2 += (*iTsos)->fitQualityOnSurface()->chiSquared(); - nDF += (*iTsos)->fitQualityOnSurface()->numberDoF(); + if (m_refitPrds) { + // simple case, fit PRD directly + ATH_MSG_VERBOSE ("Refit track "<<track<<" from PRDs"); + newTrack.reset( refitPrds (track, prdToTrackMap,stat) ); + } else { + // ok, we fit ROTs + ATH_MSG_VERBOSE ("Refit track "<<track<<" from ROTs"); + newTrack.reset( refitRots (track,stat) ); + } + }else{ + double reXi2 = 0.; int nDF = 0; + const DataVector<const TrackStateOnSurface>* tsos = track->trackStateOnSurfaces(); + DataVector<const TrackStateOnSurface>* vecTsos = new DataVector<const TrackStateOnSurface>(); + // loop over TSOS, copy TSOS and push into vector + DataVector<const TrackStateOnSurface>::const_iterator iTsos = tsos->begin(); + DataVector<const TrackStateOnSurface>::const_iterator iTsosEnd = tsos->end(); + for ( ; iTsos != iTsosEnd ; ++iTsos) { + const TrackStateOnSurface* newTsos = new TrackStateOnSurface(**iTsos); + vecTsos->push_back(newTsos); + if((*iTsos)->type(Trk::TrackStateOnSurface::Measurement)){ //Get the chi2 and number of hits + if ((*iTsos)->fitQualityOnSurface()) { + reXi2 += (*iTsos)->fitQualityOnSurface()->chiSquared(); + nDF += (*iTsos)->fitQualityOnSurface()->numberDoF(); } } - } - Trk::FitQuality* fq = new Trk::FitQuality(reXi2,nDF-5); - Trk::TrackInfo info; - info.addPatternRecoAndProperties(track->info()); - Trk::TrackInfo newInfo; - newInfo.setPatternRecognitionInfo(Trk::TrackInfo::SimpleAmbiguityProcessorTool); - info.addPatternReco(newInfo); - - newTrack = std::make_unique<Trk::Track>( info, vecTsos, fq ); - } - - if (newTrack) - { - ATH_MSG_DEBUG ("New track successfully fitted"<<newTrack.get()); - addTrack( newTrack.release(), true, trackScoreTrackMap, prdToTrackMap, cleanupTracks, stat); - } - else { - ATH_MSG_DEBUG ("Fit failed !"); - } - + } + Trk::FitQuality* fq = new Trk::FitQuality(reXi2,nDF-5); + Trk::TrackInfo info; + info.addPatternRecoAndProperties(track->info()); + Trk::TrackInfo newInfo; + newInfo.setPatternRecognitionInfo(Trk::TrackInfo::SimpleAmbiguityProcessorTool); + info.addPatternReco(newInfo); + newTrack = std::make_unique<Trk::Track>( info, vecTsos, fq ); } + if (newTrack){ + ATH_MSG_DEBUG ("New track successfully fitted"<<newTrack.get()); + addTrack( newTrack.release(), true, trackScoreTrackMap, prdToTrackMap, cleanupTracks, stat); + } else { + ATH_MSG_DEBUG ("Fit failed !"); + } +} //================================================================================================== Trk::Track* Trk::SimpleAmbiguityProcessorTool::refitPrds( const Trk::Track* track, Trk::PRDtoTrackMap &prdToTrackMap, - Counter &stat) const -{ - + Counter &stat) const{ // get vector of PRDs std::vector<const Trk::PrepRawData*> prds = m_assoTool->getPrdsOnTrack(prdToTrackMap,*track); - if ( prds.empty() ) { - msg(MSG::WARNING) << "No PRDs on track"<<endmsg; + ATH_MSG_WARNING( "No PRDs on track"); return nullptr; } - ATH_MSG_VERBOSE ("Track "<<track<<"\t has "<<prds.size()<<"\t PRDs"); - const TrackParameters* par = track->perigeeParameters(); if (par==nullptr) { ATH_MSG_DEBUG ("Track ("<<track<<") has no perigee! Try any other ?"); @@ -538,52 +458,36 @@ Trk::Track* Trk::SimpleAmbiguityProcessorTool::refitPrds( const Trk::Track* trac return nullptr; } } - // refit using first parameter, do outliers Trk::Track* newTrack = nullptr; - - if (m_tryBremFit && track->info().trackProperties(Trk::TrackInfo::BremFit)) - { + if (m_tryBremFit && track->info().trackProperties(Trk::TrackInfo::BremFit)){ + // statistics + stat.incrementCounterByRegion(ECounter::kNbremFits,track); + ATH_MSG_VERBOSE ("Brem track, refit with electron brem fit"); + newTrack = m_fitterTool->fit(prds, *par, true, Trk::electron); + } else { + // statistics + stat.incrementCounterByRegion(ECounter::kNfits,track); + ATH_MSG_VERBOSE ("Normal track, refit"); + newTrack = m_fitterTool->fit(prds, *par, true, m_particleHypothesis); + if (!newTrack && m_tryBremFit && par->pT() > m_pTminBrem && + (!m_caloSeededBrem || track->info().patternRecoInfo(Trk::TrackInfo::TrackInCaloROI))){ // statistics - stat.incrementCounterByRegion(ECounter::kNbremFits,track); - - ATH_MSG_VERBOSE ("Brem track, refit with electron brem fit"); + stat.incrementCounterByRegion(ECounter::kNrecoveryBremFits,track); + ATH_MSG_VERBOSE ("Normal fit failed, try brem recovery"); newTrack = m_fitterTool->fit(prds, *par, true, Trk::electron); - - } - else - { - // statistics - stat.incrementCounterByRegion(ECounter::kNfits,track); - - ATH_MSG_VERBOSE ("Normal track, refit"); - newTrack = m_fitterTool->fit(prds, *par, true, m_particleHypothesis); - - if (!newTrack && m_tryBremFit && par->pT() > m_pTminBrem && - (!m_caloSeededBrem || track->info().patternRecoInfo(Trk::TrackInfo::TrackInCaloROI))) - { - // statistics - stat.incrementCounterByRegion(ECounter::kNrecoveryBremFits,track); - - ATH_MSG_VERBOSE ("Normal fit failed, try brem recovery"); - newTrack = m_fitterTool->fit(prds, *par, true, Trk::electron); - } - } - - if(newTrack) - { - // statistic - stat.incrementCounterByRegion(ECounter::kNgoodFits,newTrack); - - //keeping the track of previously accumulated TrackInfo - const Trk::TrackInfo& old_info = track->info(); - newTrack->info().addPatternReco(old_info); - } - else - { - // statistic - stat.incrementCounterByRegion(ECounter::kNfailedFits,track); } + } + if(newTrack){ + // statistic + stat.incrementCounterByRegion(ECounter::kNgoodFits,newTrack); + //keeping the track of previously accumulated TrackInfo + const Trk::TrackInfo& old_info = track->info(); + newTrack->info().addPatternReco(old_info); + } else { + // statistic + stat.incrementCounterByRegion(ECounter::kNfailedFits,track); + } return newTrack; } @@ -715,8 +619,8 @@ Trk::SimpleAmbiguityProcessorTool::dumpStat(MsgStream &out) const { } out << "---------------------------------------------------------------------------------" << "\n"; out << std::setiosflags(std::ios::fixed | std::ios::showpoint) << std::setprecision(2) - << " definition: ( 0.0 < Barrel < " << m_etabounds[Counter::iBarrel-1] << " < Transition < " << m_etabounds[Counter::iTransi-1] - << " < Endcap < " << m_etabounds[Counter::iEndcap-1] << " DBM )" << "\n"; + << " definition: ( 0.0 < Barrel < " << m_etabounds[Counter::iBarrel] << " < Transition < " << m_etabounds[Counter::iTransi] + << " < Endcap < " << m_etabounds[Counter::iEndcap] << " DBM )" << "\n"; out << "-------------------------------------------------------------------------------" << "\n"; out.precision (ss); } diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackPtr.h b/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackPtr.h index 0e22a32bcfc8caf5e672728ad0917454df718597..b0d98ff041592a91efdb56c7abec476450996ef7 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackPtr.h +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackPtr.h @@ -1,3 +1,6 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ #ifndef _Trk_TrackPtr_h_ #define _Trk_TrackPtr_h_ diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx index 73207c3fc786dbb696028c7cb9f8abf49acc143f..7486cfb338e162e4480edc8506734caef1334a41 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx @@ -71,8 +71,7 @@ StatusCode Trk::TrackScoringTool::finalize() return AlgTool::finalize(); } -Trk::TrackScore Trk::TrackScoringTool::score( const Track& track, const bool suppressHoleSearch ) const -{ +Trk::TrackScore Trk::TrackScoringTool::score( const Track& track, const bool suppressHoleSearch ) const{ const TrackSummary* summary = nullptr; if (suppressHoleSearch) summary = m_trkSummaryTool->createSummaryNoHoleSearch(track); @@ -84,8 +83,8 @@ Trk::TrackScore Trk::TrackScoringTool::score( const Track& track, const bool sup return score; } -Trk::TrackScore Trk::TrackScoringTool::simpleScore( const Track& track, const TrackSummary& trackSummary ) const -{ +Trk::TrackScore +Trk::TrackScoringTool::simpleScore( const Track& track, const TrackSummary& trackSummary ) const{ // --- reject bad tracks if (track.fitQuality() && track.fitQuality()->numberDoF() < 0) { ATH_MSG_VERBOSE("numberDoF < 0, reject it"); diff --git a/Tracking/TrkVertexFitter/TrkJetVxFitter/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkVertexFitter/TrkJetVxFitter/TrkJetVxFitter/ATLAS_CHECK_THREAD_SAFETY similarity index 100% rename from Tracking/TrkVertexFitter/TrkJetVxFitter/ATLAS_CHECK_THREAD_SAFETY rename to Tracking/TrkVertexFitter/TrkJetVxFitter/TrkJetVxFitter/ATLAS_CHECK_THREAD_SAFETY diff --git a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/JetFitterHelper.cxx b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/JetFitterHelper.cxx index c40b33383b8cb5211efc0d74ba4713acdf65a097..39fbb58d78b6783a9deb82620e7ad481e49b1c44 100755 --- a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/JetFitterHelper.cxx +++ b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/JetFitterHelper.cxx @@ -41,7 +41,7 @@ namespace Trk } - JetFitterHelper::~JetFitterHelper() {} + JetFitterHelper::~JetFitterHelper() = default; StatusCode JetFitterHelper::initialize() { @@ -68,7 +68,7 @@ namespace Trk std::vector<VxTrackAtVertex*> tracksOfSecondVertex(second.getTracksAtVertex()); - const std::vector<VxTrackAtVertex*> tracksOfFirstVertex(first.getTracksAtVertex()); + const std::vector<VxTrackAtVertex*>& tracksOfFirstVertex(first.getTracksAtVertex()); const std::vector<VxTrackAtVertex*>::const_iterator tracksBegin=tracksOfFirstVertex.begin(); const std::vector<VxTrackAtVertex*>::const_iterator tracksEnd=tracksOfFirstVertex.end(); @@ -139,7 +139,7 @@ namespace Trk double newNDF=positionToUpdate.fitQuality().numberDoF()+1; //double newNDF=positionToUpdate.doubleNdf()+1.;//fitQuality().numberDoF()+1; - Amg::MatrixX symmetrizedMatrix(newCovPosition); + const Amg::MatrixX& symmetrizedMatrix(newCovPosition); positionToUpdate=Trk::RecVertexPositions(newPosition, symmetrizedMatrix, newNDF, newChi2); } @@ -201,11 +201,12 @@ namespace Trk if (&vertex1==myJetCandidate.getPrimaryVertex()) { mergeVertexToPrimaryInJetCandidate(vertex2,myJetCandidate); return *myJetCandidate.getPrimaryVertex(); - } else if (&vertex2==myJetCandidate.getPrimaryVertex()) { - mergeVertexToPrimaryInJetCandidate(vertex1,myJetCandidate); + } + if (&vertex2 == myJetCandidate.getPrimaryVertex()) { + mergeVertexToPrimaryInJetCandidate(vertex1, myJetCandidate); return *myJetCandidate.getPrimaryVertex(); } - + addTracksOfFirstVertexToSecondVertex(vertex2,vertex1); //now you need to *delete* the second vertex in copyOfRecVertexPositions and @@ -282,7 +283,7 @@ namespace Trk VxVertexOnJetAxis* primaryVertexPtr(myJetCandidate.getPrimaryVertex()); - if (primaryVertexPtr==0) { + if (primaryVertexPtr==nullptr) { ATH_MSG_WARNING ("Pointer to the primary vertex is 0. No merging with primary vertex possible."); return; } diff --git a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/JetFitterInitializationHelper.cxx b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/JetFitterInitializationHelper.cxx index b8639627f9dcd5939b2aa94b3b11c6859c0b790a..8232277534f136562fd7551f20428a8745ed99d4 100755 --- a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/JetFitterInitializationHelper.cxx +++ b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/JetFitterInitializationHelper.cxx @@ -41,7 +41,7 @@ namespace Trk Amg::Vector3D getSingleVtxPositionWithSignFlip(const Amg::VectorX & myPosition, int numVertex, - bool signfliptreatment) { + bool signFlipTreatment) { int numbRow=numRow(numVertex); double xv=myPosition[Trk::jet_xv]; @@ -56,7 +56,7 @@ namespace Trk dist=dist/fabs(dist)*300./sin(theta); } if (dist<0) { - if (signfliptreatment==true) { + if (signFlipTreatment) { dist=-dist; } else { dist=0.; @@ -87,7 +87,7 @@ namespace Trk - JetFitterInitializationHelper::~JetFitterInitializationHelper() {} + JetFitterInitializationHelper::~JetFitterInitializationHelper() = default; StatusCode JetFitterInitializationHelper::initialize() { @@ -190,7 +190,7 @@ namespace Trk //now create a new m_fittedPositions for the VxJetCandidate //start from position... - if (primaryVertex==0) { + if (primaryVertex==nullptr) { std::cout << "ERROR. No valid primary vertex pointer provided to the JetFitterInitializationHelper." << std::endl; throw; } @@ -199,7 +199,7 @@ namespace Trk startPosition[Trk::jet_yv]=primaryVertex->position().y(); startPosition[Trk::jet_zv]=primaryVertex->position().z(); - if (jetdirection!=0) { + if (jetdirection!=nullptr) { startPosition[Trk::jet_theta]=jetdirection->theta(); startPosition[Trk::jet_phi]=jetdirection->phi(); } else { @@ -240,7 +240,7 @@ namespace Trk myJetCandidate->setConstraintVertexPositions(startRecVertexPositions); VertexPositions linVertexPositions; - if (linearizationjetdirection!=0) { + if (linearizationjetdirection!=nullptr) { Amg::VectorX linPosition=startPosition; linPosition[Trk::jet_theta]=linearizationjetdirection->theta(); linPosition[Trk::jet_phi]=linearizationjetdirection->phi(); @@ -257,7 +257,7 @@ namespace Trk const VxVertexOnJetAxis* primaryVertexJC(myJetCandidate->getPrimaryVertex()); - if (primaryVertexJC==0) { + if (primaryVertexJC==nullptr) { // VxVertexOnJetAxis* newPrimaryVertex=new VxVertexOnJetAxis(); VxVertexOnJetAxis newPrimaryVertex; @@ -285,10 +285,10 @@ namespace Trk int numTrack(0);//start from 0 in counting the vertex "clusters" //Horrible but a map is not suited here - if (associatedVertices.size()!=0) {//Was that your intention? to be checked... 15.03.2007 + if (!associatedVertices.empty()) {//Was that your intention? to be checked... 15.03.2007 for (std::vector<VxVertexOnJetAxis*>::const_iterator VtxIter=VtxBegin;VtxIter!=VtxEnd;++VtxIter) { VxVertexOnJetAxis* myVertex=(*VtxIter); - if (myVertex!=0) { + if (myVertex!=nullptr) { myVertex->setNumVertex(numTrack); numTrack+=1; } else { @@ -341,7 +341,7 @@ namespace Trk } void JetFitterInitializationHelper::linearizeAllTracks(VxJetCandidate* myJetCandidate, - bool signfliptreatment, + bool signFlipTreatment, double maxdistance) const { const VertexPositions & myLinVertexPosition=myJetCandidate->getLinearizationVertexPositions(); @@ -351,7 +351,7 @@ namespace Trk const std::vector<VxTrackAtVertex*> & primaryVectorTracks=myPrimary->getTracksAtVertex(); Amg::Vector3D primary3Pos = myPosition.segment(0,3); - Amg::Vector3D primaryVertexPos(primary3Pos); + const Amg::Vector3D& primaryVertexPos(primary3Pos); const std::vector<VxTrackAtVertex*>::const_iterator primaryVectorTracksBegin=primaryVectorTracks.begin(); const std::vector<VxTrackAtVertex*>::const_iterator primaryVectorTracksEnd=primaryVectorTracks.end(); @@ -363,7 +363,7 @@ namespace Trk const Trk::LinearizedTrack* linTrack=(*primaryVectorIter)->linState(); - if (linTrack!=0) { + if (linTrack!=nullptr) { // std::cout << "distance is: " << (linTrack->linearizationPoint()-primary3Pos).mag() << std::endl; if ((linTrack->linearizationPoint()-primary3Pos).mag()>maxdistance) { // std::cout << " redoing linearization" << std::endl; @@ -385,7 +385,7 @@ namespace Trk for (std::vector<VxVertexOnJetAxis*>::const_iterator VtxIter=VtxBegin;VtxIter!=VtxEnd;++VtxIter) { int numVertex=(*VtxIter)->getNumVertex(); - Amg::Vector3D secondaryVertexPos(getSingleVtxPositionWithSignFlip(myPosition,numVertex,signfliptreatment)); + Amg::Vector3D secondaryVertexPos(getSingleVtxPositionWithSignFlip(myPosition,numVertex,signFlipTreatment)); // std::cout << " Considering linearization at n. vertex " << numVertex << " pos " << secondaryVertexPos << std::endl; @@ -399,7 +399,7 @@ namespace Trk const Trk::LinearizedTrack* linTrack=(*TrackVectorIter)->linState(); - if (linTrack!=0) { + if (linTrack!=nullptr) { // std::cout << "distance not primary is: " << (linTrack->linearizationPoint()-secondaryVertexPos.position()).mag() << std::endl; if ((linTrack->linearizationPoint()-secondaryVertexPos).mag()>maxdistance) { // std::cout << " redoing linearization" << std::endl; diff --git a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/JetFitterRoutines.cxx b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/JetFitterRoutines.cxx index 389ea40048aa55b4726014fbcd7ecce3140ffe90..cf5bc4daeb12042476a578c03622d6a92505a544 100755 --- a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/JetFitterRoutines.cxx +++ b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/JetFitterRoutines.cxx @@ -87,7 +87,7 @@ namespace Trk - JetFitterRoutines::~JetFitterRoutines() {} + JetFitterRoutines::~JetFitterRoutines() = default; StatusCode JetFitterRoutines::initialize() { @@ -167,14 +167,14 @@ namespace Trk fieldCondObj->getInitializedCache (fieldCache); for (std::vector<VxVertexOnJetAxis*>::const_iterator VtxIter=VtxBegin;VtxIter!=VtxEnd;++VtxIter) { VxVertexOnJetAxis* myVertex=(*VtxIter); - if (myVertex!=0) { + if (myVertex!=nullptr) { const std::vector<VxTrackAtVertex*> & tracksAtVertex=myVertex->getTracksAtVertex(); if (tracksAtVertex.size()>1) { ATH_MSG_DEBUG( "Warning in JetFitterInitializationHelper.Number of tracks at vertex is bigger than one, " << "even during initialization phase. Skipping this vertex (already initialized)..." ); } - else if (tracksAtVertex.size()==0) + else if (tracksAtVertex.empty()) { ATH_MSG_WARNING( "No track at vertex. Internal fitter error. Contact author (GP) ... " ); } @@ -230,7 +230,7 @@ namespace Trk " distance to axis " << result.second); } // FIXME THIS PART IS DEAD IN NEW TRACKING EDM: - else if (dynamic_cast<const Trk::NeutralPerigee*>((tracksAtVertex[0]->initialPerigee()))!=0) + else if (dynamic_cast<const Trk::NeutralPerigee*>((tracksAtVertex[0]->initialPerigee()))!=nullptr) { double distOnAxis=-999.; std::pair<Amg::Vector3D,double> result; @@ -436,7 +436,7 @@ namespace Trk smoothAllVertices(myJetCandidate); Trk::VxJetFitterDebugInfo * & myDebugInfo=myJetCandidate->getDebugInfo(); - if (myDebugInfo!=0) { + if (myDebugInfo!=nullptr) { delete myDebugInfo; } myDebugInfo=new VxJetFitterDebugInfo(); @@ -551,45 +551,58 @@ namespace Trk //check if primaryvertex exists const VxVertexOnJetAxis* myPrimary=myJetCandidate->getPrimaryVertex(); - if (myPrimary==0) { + if (myPrimary==nullptr) { ATH_MSG_WARNING( "No primary vertex found in VxJetCandidate class. Initialization was not done correctly..." ); return false; - } else { - bool ok=true; - if (myPrimary->getNumVertex()!=-10) { - ok=false; - ATH_MSG_WARNING( "Numvertex of primary vertex not correctly initialized. Not proceeding with the fit!" ); - } - // if (std::abs(myPrimary->getLinearizationPosition(void))>1e-6) { - // ATH_MSG_WARNING( "Primary vertex linearization point is not zero as it should be!" ); - // } - - const std::vector<VxTrackAtVertex*> & primaryVectorTracks=myPrimary->getTracksAtVertex(); - - sizeprimary=primaryVectorTracks.size(); + } - ok = (std::find(primaryVectorTracks.begin(), primaryVectorTracks.end(),nullptr) == primaryVectorTracks.end()); - if (not ok) ATH_MSG_WARNING( "One of the VxTrackAtVertex is a null pointer. Not proceeding with the fit!" ); + bool ok = true; + if (myPrimary->getNumVertex() != -10) { + ok = false; + ATH_MSG_WARNING("Numvertex of primary vertex not correctly initialized. " + "Not proceeding with the fit!"); + } - if (ok==false) { - return false; - } - }//end if else rimary==0 - + const std::vector<VxTrackAtVertex*>& primaryVectorTracks = + myPrimary->getTracksAtVertex(); - bool ok=true; - //check std::vector<VxVertexOnJetAxis*> (if pointers are not empty and if all associated tracks are not empty) - const std::vector<VxVertexOnJetAxis*> & tracksOfVertex=myJetCandidate->getVerticesOnJetAxis(); + sizeprimary = primaryVectorTracks.size(); - auto badVertex=[](VxVertexOnJetAxis* pVertex){return (pVertex==nullptr) or (pVertex->getNumVertex() < 0);}; - ok=(std::find_if(tracksOfVertex.begin(), tracksOfVertex.end(), badVertex) == tracksOfVertex.end()); - if (not ok) ATH_MSG_WARNING( "One of the VxTrackAtVertex is a null pointer or uninitialized. Not proceeding with the fit!" ); // Two error messages combined into one + ok = (std::find(primaryVectorTracks.begin(), + primaryVectorTracks.end(), + nullptr) == primaryVectorTracks.end()); + if (not ok) + ATH_MSG_WARNING("One of the VxTrackAtVertex is a null pointer. Not " + "proceeding with the fit!"); - if (not ok) return false; + if (!ok) { + return false; + } + // end if else rimary==0 + + // check std::vector<VxVertexOnJetAxis*> (if pointers are not empty and if + // all associated tracks are not empty) + const std::vector<VxVertexOnJetAxis*>& tracksOfVertex = + myJetCandidate->getVerticesOnJetAxis(); + + auto badVertex = [](VxVertexOnJetAxis* pVertex) { + return (pVertex == nullptr) or (pVertex->getNumVertex() < 0); + }; + ok = + (std::find_if(tracksOfVertex.begin(), tracksOfVertex.end(), badVertex) == + tracksOfVertex.end()); + if (not ok) { + ATH_MSG_WARNING( + "One of the VxTrackAtVertex is a null pointer or uninitialized. Not " + "proceeding with the fit!"); // Two error messages combined into one + } + if (not ok) { + return false; + } //now check if there is some track at least to do the fit... - if (tracksOfVertex.size()==0&&sizeprimary==0) { + if (tracksOfVertex.empty()&&sizeprimary==0) { ATH_MSG_DEBUG( "No tracks at primary, no tracks on jet axis. Not proceeding with the fit!" ); return false; } @@ -616,8 +629,8 @@ namespace Trk //check if all the diagonal values of the covariance matrix are not zero for (int i=0;i<myPosition.rows();i++) { if (std::abs(myErrorMatrix(i,i))<1e-20) { - ATH_MSG_WARNING ("Value of cov matrix component n. " << i << " has a value smaller than 1e-8. Not considered as possible. Not performing fit..."); - return false; + ATH_MSG_WARNING ("Value of cov matrix component n. " << i << " has a value smaller than 1e-8. Not considered as possible. Not performing fit..."); + return false; } } @@ -638,7 +651,8 @@ namespace Trk if (firstVertex==PrimaryVertex) { return fastProbabilityOfMergingWithPrimary(secondVertex,myJetCandidate); - } else if (secondVertex==PrimaryVertex) { + } + if (secondVertex==PrimaryVertex) { return fastProbabilityOfMergingWithPrimary(firstVertex,myJetCandidate); } @@ -653,13 +667,7 @@ namespace Trk //first get a copy of all vertex positions (this you can't avoid I fear...) RecVertexPositions copyOfRecVertexPositions(myJetCandidate->getRecVertexPositions()); - VertexPositions copyOfLinearizationPositions(myJetCandidate->getLinearizationVertexPositions()); - /* - //now copy the primaryVertex and copy the tracks of otherVertex to this new primaryVertex - VxVertexOnJetAxis primaryVertex(*myJetCandidate->getPrimaryVertex()); - m_helper->addTracksOfFirstVertexToSecondVertex(*otherVertex,primaryVertex); - */ double oldchi2=copyOfRecVertexPositions.fitQuality().chiSquared(); double oldndf=copyOfRecVertexPositions.fitQuality().numberDoF(); @@ -704,8 +712,6 @@ namespace Trk //first get a copy of all vertex positions (this you can't avoid I fear...) RecVertexPositions copyOfRecVertexPositions(myJetCandidate->getRecVertexPositions()); - VertexPositions copyOfLinearizationPositions(myJetCandidate->getLinearizationVertexPositions()); - const FitQuality & copyOfRecVertexQuality=copyOfRecVertexPositions.fitQuality(); double oldchi2=copyOfRecVertexQuality.chiSquared(); @@ -719,11 +725,6 @@ namespace Trk double phierr=std::sqrt(positionCov(Trk::jet_phi,Trk::jet_phi)); double thetaerr=std::sqrt(positionCov(Trk::jet_theta,Trk::jet_theta)); - /* - //now copy the first vertex and copy the tracks of otherVertex to this new common vertex - VxVertexOnJetAxis theCommonVertex(*firstVertex); - m_helper->addTracksOfFirstVertexToSecondVertex(*secondVertex,theCommonVertex); - */ //now do the merging of the second cluster to the primary vertex... m_helper->performKalmanConstraintToMergeVertices(copyOfRecVertexPositions, @@ -762,7 +763,7 @@ namespace Trk double deltachi2_convergence) const { - if (firstVertex==0||secondVertex==0||myJetCandidate==0) { + if (firstVertex==nullptr||secondVertex==nullptr||myJetCandidate==nullptr) { ATH_MSG_WARNING ("zero pointer given to the full probability estimation. No estimation performed, zero prob returned "); return 0; } @@ -782,7 +783,7 @@ namespace Trk const VxVertexOnJetAxis* primaryOfFirst=myJetCandidate->getPrimaryVertex(); VxVertexOnJetAxis* primaryOfSecond=newJetCandidate.getPrimaryVertex(); - if (primaryOfFirst==0||primaryOfSecond==0) { + if (primaryOfFirst==nullptr||primaryOfSecond==nullptr) { ATH_MSG_WARNING ("Empty primary vertex found when estimating fullProbOfMerging. 0 prob returned."); return 0; } @@ -798,7 +799,7 @@ namespace Trk for (unsigned int s=0;s<sizeOfVertices;s++) { const VxVertexOnJetAxis* pointer1=vectorOfOldJetCand[s]; VxVertexOnJetAxis* pointer2=vectorOfNewJetCand[s]; - if (pointer1==0||pointer2==0) { + if (pointer1==nullptr||pointer2==nullptr) { ATH_MSG_WARNING ("One of the pointers of the original or copied vector of vertices is empty during fullProbOfMerging. Skipping it..."); } else { oldToNewVtxPointers[pointer1]=pointer2; @@ -809,7 +810,7 @@ namespace Trk VxVertexOnJetAxis* newFirstVertex=oldToNewVtxPointers[firstVertex]; VxVertexOnJetAxis* newSecondVertex=oldToNewVtxPointers[secondVertex]; - if (newFirstVertex==0||newSecondVertex==0) { + if (newFirstVertex==nullptr||newSecondVertex==nullptr) { ATH_MSG_WARNING ("No correspondence to the given firstVertex or secondVertex in fullProbOfMerging. Returning 0 prob."); return 0.; } @@ -865,14 +866,14 @@ namespace Trk double deltachi2_convergence, double threshold_probability) const { - if (myJetCandidate==0) { + if (myJetCandidate==nullptr) { ATH_MSG_WARNING( "VxJetCandidate provided is a zero pointer. No compatibility table calculated." ); return; } //first create the compatibility table object... Trk::VxClusteringTable* & clusteringTablePtr(myJetCandidate->getClusteringTable()); - if (clusteringTablePtr!=0) { + if (clusteringTablePtr!=nullptr) { delete clusteringTablePtr; } clusteringTablePtr=new Trk::VxClusteringTable(); @@ -881,7 +882,7 @@ namespace Trk VxVertexOnJetAxis* primaryVertex=myJetCandidate->getPrimaryVertex(); - if (primaryVertex==0) { + if (primaryVertex==nullptr) { ATH_MSG_WARNING( "VxJetCandidate provided has no primary vertex. No compatibility table calculated." ); return; } @@ -913,7 +914,7 @@ namespace Trk if (fullcomputation) { if (fastProbabilityAndNonLinearity.first>threshold_probability) { - if (fastProbabilityAndNonLinearity.first>highestprobability/100.&&fastProbabilityAndNonLinearity.second==true) { + if (fastProbabilityAndNonLinearity.first>highestprobability/100.&&fastProbabilityAndNonLinearity.second) { double fullProbability=fullProbabilityOfMerging(primaryVertex,*VtxIter, myJetCandidate,num_maxiterations, @@ -978,7 +979,7 @@ namespace Trk #endif if (fullcomputation) { if (fastProbabilityAndNonLinearity.first>threshold_probability) { - if (fastProbabilityAndNonLinearity.first>highestprobability/100.&&fastProbabilityAndNonLinearity.second==true) { + if (fastProbabilityAndNonLinearity.first>highestprobability/100.&&fastProbabilityAndNonLinearity.second) { double fullProbability=fullProbabilityOfMerging(*VtxIter1,*VtxIter2, myJetCandidate,num_maxiterations, treat_sign_flip, @@ -1078,12 +1079,12 @@ namespace Trk Trk::VxTrackAtVertex* oldPointer=*TracksIter; TracksIter=tracksAtJetCandidate->erase(TracksIter); delete oldPointer; - oldPointer=0; + oldPointer=nullptr; TracksEnd=tracksAtJetCandidate->end(); break; - } else { + } ++TracksIter; - } + } } @@ -1112,9 +1113,9 @@ namespace Trk VerticesEnd=copyOfVerticesAtJetCandidate.end(); found=true; break; - } else { + } ++VerticesIter; - } + } if (!found) { @@ -1141,7 +1142,7 @@ namespace Trk for (std::vector<VxVertexOnJetAxis*>::const_iterator VtxIter=VtxBegin;VtxIter!=VtxEnd;++VtxIter) { VxVertexOnJetAxis* myVertex=(*VtxIter); - if (myVertex!=0) { + if (myVertex!=nullptr) { double distOnAxis=linPositions[numRow(myVertex->getNumVertex())]; diff --git a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/KalmanVertexOnJetAxisSmoother.cxx b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/KalmanVertexOnJetAxisSmoother.cxx index f9bbcb66b39ed461f41fbb6457475517c5780843..dbe2ed27947bd2819bd57b33460c2e35fed78b08 100755 --- a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/KalmanVertexOnJetAxisSmoother.cxx +++ b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/KalmanVertexOnJetAxisSmoother.cxx @@ -3,14 +3,14 @@ */ #include "TrkJetVxFitter/KalmanVertexOnJetAxisSmoother.h" +#include "TrkJetVxFitter/KalmanVertexOnJetAxisUpdator.h" +#include "VxJetVertex/JetVtxParamDefs.h" #include "VxJetVertex/RecVertexPositions.h" #include "VxJetVertex/VxJetCandidate.h" -#include "VxVertex/VxTrackAtVertex.h" #include "VxJetVertex/VxVertexOnJetAxis.h" -#include "VxJetVertex/JetVtxParamDefs.h" #include "VxVertex/LinearizedTrack.h" -#include "TrkJetVxFitter/KalmanVertexOnJetAxisUpdator.h" -#include <math.h> +#include "VxVertex/VxTrackAtVertex.h" +#include <cmath> //#define KalmanVertexOnJetAxisSmoother_DEBUG @@ -63,9 +63,7 @@ namespace Trk } KalmanVertexOnJetAxisSmoother::~KalmanVertexOnJetAxisSmoother() - { - - } + = default; void KalmanVertexOnJetAxisSmoother::update(VxVertexOnJetAxis* vertexToSmooth, @@ -96,7 +94,7 @@ namespace Trk // void KalmanVertexOnJetAxisSmoother::update(VxVertexOnJetAxis* vertexToSmooth,const VxJetCandidate* candidateToUpdate) const // { - if (vertexToSmooth==0) { + if (vertexToSmooth==nullptr) { ATH_MSG_WARNING( " Empty pointers then calling fit method update. No fit will be done..." ); return; } @@ -110,7 +108,7 @@ namespace Trk //care first about the transformation matrix (which is the same for all tracks...) - if (allTracksToSmooth.size()==0) { + if (allTracksToSmooth.empty()) { ATH_MSG_DEBUG(" Nothing to smooth "); if (!isPrimary) ATH_MSG_WARNING ("Nothing to smooth and it's not a primary vertex: BUG... "); @@ -170,7 +168,7 @@ namespace Trk //get linearized track const LinearizedTrack * trk=(*TracksIter)->linState(); - if (trk==0) { + if (trk==nullptr) { ATH_MSG_WARNING (" Empty pointers then calling smoothing method update. No smoothing will be performed..."); return; } diff --git a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/KalmanVertexOnJetAxisUpdator.cxx b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/KalmanVertexOnJetAxisUpdator.cxx index bc162efde99075e0dd0cda1c712d902ec3bbcb5b..fd380247508c228025ff85d53d550d946cd0f812 100755 --- a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/KalmanVertexOnJetAxisUpdator.cxx +++ b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/KalmanVertexOnJetAxisUpdator.cxx @@ -33,7 +33,7 @@ namespace Trk{ } KalmanVertexOnJetAxisUpdator::~KalmanVertexOnJetAxisUpdator() - {} + = default; StatusCode KalmanVertexOnJetAxisUpdator::initialize() { @@ -89,7 +89,7 @@ namespace Trk{ int sign,bool doFastUpdate) const { //check that all pointers are there... - if (trackToUpdate==0||vertexToUpdate==0||candidateToUpdate==0||(sign!=1&&sign!=-1)) { + if (trackToUpdate==nullptr||vertexToUpdate==nullptr||candidateToUpdate==nullptr||(sign!=1&&sign!=-1)) { ATH_MSG_WARNING (" Empty pointers then calling fit method update. No fit will be donw..."); return; } @@ -105,15 +105,15 @@ namespace Trk{ if ((*tracksIter)==0) { ATH_MSG_WARNING (" Empty pointer in vector of VxTrackAtVertex of the VxVertexOnJetAxis which is being fitted. No fit will be done..."); return; - } else { + } if (*tracksIter==trackToUpdate) { found=true; break; } - } + } - if (found==false) { + if (!found) { ATH_MSG_WARNING ("Track was not found in the VxVertexOnJetAxis's list. No fit will be done..."); return; } @@ -124,7 +124,7 @@ namespace Trk{ const Trk::RecVertexPositions & old_vrt = candidateToUpdate->getRecVertexPositions(); - if (trackToUpdate->linState()==0) { + if (trackToUpdate->linState()==nullptr) { ATH_MSG_WARNING ("Linearized state not associated to track. Aborting fit... " << old_vrt); return; } @@ -189,10 +189,6 @@ namespace Trk{ const AmgMatrix(5,3) & B = trk->momentumJacobian(); const AmgVector(5)& trackParameters = trk->expectedParametersAtPCA(); -#ifdef Updator_DEBUG - std::cout << "KalmanVertexOnJetAxisUpdator: expected perigee at pca " << trackParameters << std::endl; - std::cout << "KalmanVertexOnJetAxisUpdator: expected position at pca " << trk->expectedPositionAtPCA() << std::endl; -#endif // CLHEP::HepVector constantTerm = trk->constantTerm(); // the constant term has to be recalculated because of the use of the new parameters @@ -224,48 +220,33 @@ namespace Trk{ old_vrt_cov_momentum(2,2) = m_initialMomentumError*m_initialMomentumError/10000.; //R_k_k-1=V_k+A C_k-1 A_T + B D_k-1 B_T - AmgSymMatrix(5) old_residual_cov = - trackParametersCovariance+A*old_vrt_cov*A.transpose()+B*old_vrt_cov_momentum*B.transpose(); + AmgSymMatrix(5) old_residual_cov = + trackParametersCovariance + A * old_vrt_cov * A.transpose() + + B * old_vrt_cov_momentum * B.transpose(); //the nice thing of the method is that the matrix to invert (old_residual) is just 5x5, //which is much better than n.track+5 x n.track+5 !!! if (old_residual_cov.determinant() == 0. ) { ATH_MSG_ERROR ("The old_residual matrix inversion failed"); ATH_MSG_ERROR ("same vertex as before is returned"); - Trk::RecVertexPositions r_vtx(myPosition); - return r_vtx; + return Trk::RecVertexPositions(myPosition); } // AmgSymMatrix(5) old_residual_cov_inv = old_residual_cov.inverse().eval(); AmgSymMatrix(5) old_residual_cov_inv = old_residual_cov.inverse().eval(); Eigen::Matrix<double,Eigen::Dynamic,5> Kk1 = old_vrt_cov*A.transpose()*old_residual_cov_inv; AmgVector(5) residual_vector=trackParameters-constantTerm-A*old_vrt_pos; -#ifdef Updator_DEBUG - std::cout<<"Gain factor K1 obtained: " << Kk1 << std::endl; - std::cout << "res vector " << residual_vector << std::endl; -#endif //obtain new position Amg::VectorX new_vrt_pos=old_vrt_pos+Kk1*residual_vector; -#ifdef Updator_DEBUG - std::cout << "old position: " << old_vrt_pos << std::endl; - std::cout << "new position: " << new_vrt_pos << std::endl; -#endif Amg::MatrixX new_vrt_cov=old_vrt_cov+Kk1*old_residual_cov*Kk1.transpose()-2.*Kk1*A*old_vrt_cov; -#ifdef Updator_DEBUG - std::cout<<"New vertex covariance obtained: "<<new_vrt_cov<<std::endl; -#endif double chi2 = myPosition.fitQuality().chiSquared() + residual_vector.transpose()*old_residual_cov_inv*residual_vector; -#ifdef Updator_DEBUG - std::cout << " the chi2 before: " << myPosition.fitQuality().chiSquared() << " after: " << chi2 << std::endl; -#endif - //NOT SO NICE: BUT: if there was already a track at this vertex, //then add 2, otherwise add 1 (additional parameter in the fit decreases +2 ndf) double ndf=myPosition.fitQuality().numberDoF()+sign*1.; @@ -274,14 +255,9 @@ namespace Trk{ } else { ndf+=sign*1.; } + return Trk::RecVertexPositions(new_vrt_pos,new_vrt_cov,ndf,chi2); - //add the chi2 to the previous chi2 - //Trk::RecVertexPositions r_vtx(new_vrt_weight_times_position,erm,ndf,0.,true);//ndf, chi2); - Trk::RecVertexPositions r_vtx(new_vrt_pos,new_vrt_cov,ndf,chi2); - - return r_vtx; - - } else { + } const AmgSymMatrix(5) & trackParametersWeight = trk->expectedWeightAtPCA(); @@ -292,12 +268,11 @@ namespace Trk{ //vertex to be updated, needs to be copied - RecVertexPositions myPosition=candidateToUpdate.getRecVertexPositions(); + myPosition=candidateToUpdate.getRecVertexPositions(); if(myPosition.covariancePosition().determinant() ==0.0) { ATH_MSG_WARNING ("The vertex-positions covariance matrix is not invertible"); ATH_MSG_WARNING ("The copy of initial vertex returned"); - Trk::RecVertexPositions r_vtx(myPosition); - return r_vtx; + return Trk::RecVertexPositions(myPosition); } #ifdef KalmanVertexUpdate_OLD const Amg::VectorX & old_vrt_pos = myPosition.position(); @@ -317,19 +292,10 @@ namespace Trk{ ATH_MSG_WARNING(" The determinant of the track covariance matrix is zero or negative: " << trackParametersWeight.determinant()); } - -// if (old_full_vrt_weight.determinant()<=0) -// { -// ATH_MSG_WARNING(" The determinant of the vertex full weight matrix is zero or negative: " << old_full_vrt_weight.determinant()); -// } - - -// std::cout << " WEIGHT MATRIX of POS " << old_full_vrt_weight << std::endl; Amg::MatrixX old_vrt_weight(numrow_toupdate+1,numrow_toupdate+1); old_vrt_weight = old_full_vrt_weight.block(0,0,numrow_toupdate+1,numrow_toupdate+1); -// std::cout << " Reduced Weight of POS " << old_vrt_weight << std::endl; #endif @@ -338,16 +304,14 @@ namespace Trk{ AmgSymMatrix(3) S = B.transpose()*(trackParametersWeight*B); -// std::cout << " Matrix S " << S << std::endl; if(S.determinant() ==0.0) { ATH_MSG_WARNING ("The S matrix is not invertible"); ATH_MSG_WARNING ("A copy of initial vertex returned"); - Trk::RecVertexPositions r_vtx(myPosition); - return r_vtx; - } else S = S.inverse().eval(); + return Trk::RecVertexPositions(myPosition); + } + S = S.inverse().eval(); -// std::cout << " Matrix S after inversion " << S << std::endl; //G_b = G_k - G_k*B_k*W_k*B_k^(T)*G_k @@ -355,7 +319,6 @@ namespace Trk{ //gB=gB/2.0+gB.transpose().eval()/2.0; -// std::cout << " gB " << gB << std::endl; #ifdef Updator_DEBUG std::cout<<"Gain factor obtained: "<<trackParametersWeight*(B*(S*B.transpose()))*trackParametersWeight.transpose()<<std::endl; @@ -406,7 +369,7 @@ namespace Trk{ smartInvert(new_vrt_cov); if (new_vrt_cov.determinant() == 0.0) { ATH_MSG_ERROR ("The reduced weight matrix is not invertible, returning copy of initial vertex."); - Trk::RecVertexPositions r_vtx(myPosition); + const Trk::RecVertexPositions& r_vtx(myPosition); return r_vtx; } // After symmetrizing the matirx by hand, as mentioned above, the smart inversion works agian. @@ -415,7 +378,7 @@ namespace Trk{ catch (std::string a) { ATH_MSG_ERROR( a << " Previous vertex returned " ); - Trk::RecVertexPositions r_vtx(myPosition); + const Trk::RecVertexPositions& r_vtx(myPosition); return r_vtx; } #endif @@ -476,7 +439,7 @@ namespace Trk{ negative=true; } if (negative) { - Trk::RecVertexPositions r_vtx(myPosition); + const Trk::RecVertexPositions& r_vtx(myPosition); return r_vtx; } } @@ -494,7 +457,7 @@ namespace Trk{ Trk::RecVertexPositions r_vtx(new_full_vrt_pos,new_full_vrt_cov,ndf, chi2); #endif return r_vtx; - } + //method which avoids inverting huge covariance matrix still needs to be implemented }//end of position update method @@ -504,7 +467,7 @@ namespace Trk{ VxJetCandidate* vertexCandidate) const { //check that all pointers are there... - if (vertexCandidate==0||trackToUpdate==0) { + if (vertexCandidate==nullptr||trackToUpdate==nullptr) { ATH_MSG_WARNING( " Empty pointers then calling fit method updateChi2NdfInfo. No update will be done..." ); return; } @@ -520,15 +483,15 @@ namespace Trk{ if ((*tracksIter)==0) { ATH_MSG_WARNING( " Empty pointer in vector of VxTrackAtVertex of the VxVertexOnJetAxis whose chi2 is being updated. No update will be done..." ); return; - } else { + } if (*tracksIter==trackToUpdate) { found=true; break; } - } + } - if (found==false) { + if (!found) { ATH_MSG_WARNING( " Track was not found in the VxVertexOnJetAxis's list. No update will be done..." ); return; } @@ -541,7 +504,7 @@ namespace Trk{ // log << MSG::VERBOSE << "vertexPositions (update chi2): " << vertexPositions << endmsg; - if (trackToUpdate->linState()==0) { + if (trackToUpdate->linState()==nullptr) { ATH_MSG_WARNING( "Linearized state not associated to track. Aborting chi2 update... " << vertexPositions ); return; } @@ -610,7 +573,8 @@ namespace Trk{ if(S.determinant() ==0.0) { ATH_MSG_ERROR ("The matrix S is not invertible, return chi2 0"); return -0.; - } else S = S.inverse().eval(); + } + S = S.inverse().eval(); //refitted track momentum Amg::Vector3D newTrackMomentum = S*B.transpose()*trackParametersWeight*(trackParameters - constantTerm - A*new_vrt_position); @@ -629,7 +593,7 @@ namespace Trk{ void KalmanVertexOnJetAxisUpdator::updateVertexChi2(VxJetCandidate* vertexCandidate) const { //check that all pointers are there... - if (vertexCandidate==0) { + if (vertexCandidate==nullptr) { ATH_MSG_WARNING( " Empty pointers then calling chi2 update method updateVertexChi2. No update will be done..." ); return; } @@ -726,7 +690,7 @@ namespace Trk{ int numRows=new_vrt_weight.rows(); if (numRows<=6) { if(new_vrt_weight.determinant() ==0) -// if |A|==0; then A is not invertible; + // if |A|==0; then A is not invertible; { throw std::string("The reduced weight matrix is not invertible. Previous vertex returned "); } @@ -744,13 +708,10 @@ namespace Trk{ B(i,j-5)=new_vrt_weight(i,j); } } -// std::cout << " weight matrix: " << new_vrt_weight << std::endl; -// std::cout << " non diag upper right elem: " << B << std::endl; // CLHEP::HepSymMatrix D=new_vrt_weight.sub(6,numRows); Amg::MatrixX D = new_vrt_weight.block(5,5,numRows-5,numRows-5); // will be of dim (numrows-5) - //std::cout << " D "<<std::endl << D << std::endl; // Eigen::DiagonalMatrix<double,Eigen::Dynamic> DdiagINV(D.rows()); // was CLHEP::HepDiagMatrix // if (numRows>6 && D.isDiagonal(/*precision<scalar>=*/1e-7)) @@ -785,15 +746,12 @@ namespace Trk{ } // D=D.inverse().eval(); -// std::cout << " D after inversion " << D << std::endl; - Amg::MatrixX E = A - B*(D*B.transpose()); if (E.determinant() == 0.) { throw std::string("Cannot invert E matrix..."); } E=E.inverse().eval(); -// std::cout << " E " << E << std::endl; Amg::MatrixX finalWeight(numRows,numRows); finalWeight.setZero(); @@ -804,7 +762,6 @@ namespace Trk{ finalWeight.block(5,5,D.rows(),D.rows()) = D+(D*((B.transpose()*(E*B))*D.transpose())); -// std::cout << " finalWeight " << finalWeight << std::endl; // Amg::MatrixX normalInversion=new_vrt_weight.inverse().eval(); // Amg::MatrixX smartInversion=finalWeight; @@ -822,7 +779,6 @@ namespace Trk{ } } } - if (mismatch) std::cout << " mismatch, normalInv: " << normalInversion << " smartInv " << smartInversion << " det 1 " << normalInversion.determinant() << " det 2 " << smartInversion.determinant() << std::endl; */ // new_vrt_weight = new_vrt_weight.inverse().eval();//finalWeight;//MODIFIED!! diff --git a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/TrkDistanceFinderNeutralCharged.cxx b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/TrkDistanceFinderNeutralCharged.cxx index 6cd9ea28e82314a39cc5c863bce9c9a6d5d4cee9..2efc9e6fa13c64396540f9df5ead1a2c09e97539 100644 --- a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/TrkDistanceFinderNeutralCharged.cxx +++ b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/TrkDistanceFinderNeutralCharged.cxx @@ -45,7 +45,7 @@ StatusCode TrkDistanceFinderNeutralCharged::finalize() } -TrkDistanceFinderNeutralCharged::~TrkDistanceFinderNeutralCharged() { } +TrkDistanceFinderNeutralCharged::~TrkDistanceFinderNeutralCharged() = default; std::pair<Amg::Vector3D,double> TrkDistanceFinderNeutralCharged::getPointAndDistance(const Trk::NeutralTrack& neutraltrk, @@ -229,11 +229,11 @@ TrkDistanceFinderNeutralCharged::getPointAndDistance(const Trk::NeutralTrack& ne b_sinphi=sin(b_phi); continue; } - else - { + + ATH_MSG_WARNING ("Hessian is negative: saddle point"); throw Error::NewtonProblem("Hessian is negative"); - } + } if (det>0&&d2da_lambda2<0) { ATH_MSG_WARNING("Hessian indicates a maximum: derivative will be zero but result incorrect"); diff --git a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/TrkDistanceFinderNeutralNeutral.cxx b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/TrkDistanceFinderNeutralNeutral.cxx index fe5e52266ff002883b426be7b1afa3452b03eb56..3e0bdf521e191fc3e482e040f6acf19fb614c450 100644 --- a/Tracking/TrkVertexFitter/TrkJetVxFitter/src/TrkDistanceFinderNeutralNeutral.cxx +++ b/Tracking/TrkVertexFitter/TrkJetVxFitter/src/TrkDistanceFinderNeutralNeutral.cxx @@ -32,7 +32,7 @@ StatusCode TrkDistanceFinderNeutralNeutral::finalize() } -TrkDistanceFinderNeutralNeutral::~TrkDistanceFinderNeutralNeutral() { } +TrkDistanceFinderNeutralNeutral::~TrkDistanceFinderNeutralNeutral() = default; std::pair<Amg::Vector3D,double> TrkDistanceFinderNeutralNeutral::getPointAndDistance(const Trk::NeutralTrack& neutralaxis, @@ -43,8 +43,8 @@ TrkDistanceFinderNeutralNeutral::getPointAndDistance(const Trk::NeutralTrack& ne const Trk::NeutralTrack& neutraltrk2=neutraltrk; Amg::Vector3D DeltaR0(neutraltrk1.position()-neutraltrk2.position()); - Amg::Vector3D Mom1(neutraltrk1.momentum()); - Amg::Vector3D Mom2(neutraltrk2.momentum()); + const Amg::Vector3D& Mom1(neutraltrk1.momentum()); + const Amg::Vector3D& Mom2(neutraltrk2.momentum()); double p1p2=Mom1.dot(Mom2); double p1DR0=Mom1.dot(DeltaR0); diff --git a/Tracking/TrkVertexFitter/TrkV0Fitter/TrkV0Fitter/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkVertexFitter/TrkV0Fitter/TrkV0Fitter/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..daeac43fcef1c9151e46d2e1ae615a5301d5070f --- /dev/null +++ b/Tracking/TrkVertexFitter/TrkV0Fitter/TrkV0Fitter/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Tracking/TrkVertexFitter/TrkV0Fitter diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFit.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFit.cxx index 5a82a7424345746ff65b25d40a939b9b75401ed0..d498d6c3bdd5ee8e151d1a58c471a99a279aca49 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFit.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFit.cxx @@ -2,14 +2,14 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include <iostream> #include "TrkVKalVrtCore/CommonPars.h" -#include "TrkVKalVrtCore/VKalVrtBMag.h" +#include "TrkVKalVrtCore/Derivt.h" #include "TrkVKalVrtCore/Propagator.h" #include "TrkVKalVrtCore/TrkVKalVrtCore.h" #include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" -#include "TrkVKalVrtCore/Derivt.h" +#include "TrkVKalVrtCore/VKalVrtBMag.h" +#include <cmath> +#include <iostream> namespace Trk { @@ -132,10 +132,7 @@ void fillVertex(VKVertex *vk, int NTRK, long int *ich, double xyz0[3], double (* trk->iniP[1]=trk->cnstP[1]=trk->fitP[1]=par0[tk][1]; trk->iniP[2]=trk->cnstP[2]=trk->fitP[2]=par0[tk][2]; } - vk->setIniV(xyz); vk->setCnstV(xyz); // initial guess. 0 of course. - - return; -} + vk->setIniV(xyz); vk->setCnstV(xyz); } bool checkPosition(VKVertex * vk, double vertex[3]){ @@ -147,8 +144,8 @@ bool checkPosition(VKVertex * vk, double vertex[3]){ } -extern int afterFit(VKVertex *, double *, double *, double *, double *, const VKalVrtControlBase* = 0); -extern void vpderiv(bool, long int , double *, double *, double *, double *, double *, double *, double *, const VKalVrtControl * =0); +extern int afterFit(VKVertex *, double *, double *, double *, double *, const VKalVrtControlBase* = nullptr); +extern void vpderiv(bool, long int , double *, double *, double *, double *, double *, double *, double *, const VKalVrtControl * =nullptr); extern void cfmasserr(VKVertex* , int*, double, double*, double*); extern std::array<double, 4> getFitParticleMom( const VKTrack *, double); @@ -185,7 +182,7 @@ int fitVertex(VKVertex * vk) if ( vrtForCFT.usePassNear ) vk->passNearVertex=true; if ( vrtForCFT.usePassNear==2 ) vk->passWithTrkCov=true; double zeroV[3]={0.,0.,0.}; - VKTrack * trk=0; + VKTrack * trk=nullptr; chi2min = 1e15; @@ -399,7 +396,7 @@ int fitVertex(VKVertex * vk) // Track near vertex constraint recalculation for next fit if ( vk->passNearVertex ) { - if(it==1) jerr = afterFit(vk, 0, vk->FVC.dcv, PartMom, VrtMomCov, (vk->vk_fitterControl).get()); + if(it==1) jerr = afterFit(vk, nullptr, vk->FVC.dcv, PartMom, VrtMomCov, (vk->vk_fitterControl).get()); else jerr = afterFit(vk, vk->ader, vk->FVC.dcv, PartMom, VrtMomCov, (vk->vk_fitterControl).get()); for( i=0; i<3; i++) dparst[i] = vk->refIterV[i]+vk->fitV[i]; // fitted vertex at global frame cfdcopy( PartMom, &dparst[3], 3); diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascade.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascade.cxx index 5be7016a81e2fc9931f22f1cdd4f96e97397ed2e..398977cbf6effea18aaada3d0826aa3fe59138ae 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascade.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascade.cxx @@ -2,13 +2,13 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include <iostream> -#include "TrkVKalVrtCore/VKalVrtBMag.h" -#include "TrkVKalVrtCore/ForCFT.h" #include "TrkVKalVrtCore/Derivt.h" +#include "TrkVKalVrtCore/ForCFT.h" #include "TrkVKalVrtCore/Propagator.h" #include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" +#include "TrkVKalVrtCore/VKalVrtBMag.h" +#include <cmath> +#include <iostream> namespace Trk { @@ -21,12 +21,12 @@ extern int cfInv5(double *cov, double *wgt ); extern double cfSmallEigenvalue( double*, long int ); extern int vtcfit( VKVertex * vk); extern void combinedTrack(long int ICH, double *pv0, double *covi, double BMAG, double *paro, double *covo); -extern int afterFit(VKVertex *, double *, double *, double *, double *, const VKalVrtControlBase * =0 ); -extern int afterFitWithIniPar(VKVertex *vk, double *, double *, double *, double *, const VKalVrtControlBase * =0 ); +extern int afterFit(VKVertex *, double *, double *, double *, double *, const VKalVrtControlBase * =nullptr ); +extern int afterFitWithIniPar(VKVertex *vk, double *, double *, double *, double *, const VKalVrtControlBase * =nullptr ); extern void applyConstraints(VKVertex * vk); extern void FullMTXfill(VKVertex * , double * ); extern int FullMCNSTfill(VKVertex * , double * , double * ); -extern int vkMSolve(double *, double*, long int, double* =0); +extern int vkMSolve(double *, double*, long int, double* =nullptr); extern void copyFullMtx(double *Input, long int IPar, long int IDIM, double *Target, long int TStart, long int TDIM); @@ -34,7 +34,7 @@ extern void addCrossVertexDeriv(CascadeEvent &, double * , long int , const std: extern void setFittedParameters(double * , std::vector<int> &, CascadeEvent &); extern int getCascadeNPar(CascadeEvent &, int Type=0); extern VKTrack * getCombinedVTrack(VKVertex *); -extern void vpderiv(bool, long int , double *, double *, double *, double *, double *, double *, double *, const VKalVrtControl * =0); +extern void vpderiv(bool, long int , double *, double *, double *, double *, double *, double *, double *, const VKalVrtControl * =nullptr); extern std::array<double, 4> getFitParticleMom( const VKTrack *, double); extern void setFittedMatrices(double * , long int , std::vector<int> &, std::vector< std::vector<double> > &, CascadeEvent& ); @@ -70,10 +70,10 @@ int setVTrackMass(VKVertex * vk) totP.E += pp[3]; } VKTrack * target_trk = getCombinedVTrack(vk); - if( target_trk == 0 ) { + if( target_trk == nullptr ) { std::cout<<" ERROR in CASCADE STRUCTURE"<<'\n'; return -1; - }else{ + } double Pt=sqrt(totP.Px*totP.Px + totP.Py*totP.Py); double Mass; if(Pt > fabs(totP.Pz)){ @@ -82,7 +82,7 @@ int setVTrackMass(VKVertex * vk) Mass = sqrt( (totP.E-totP.Pz)*(totP.E+totP.Pz) - Pt*Pt); } target_trk->setMass(Mass); - } + return 0; } @@ -162,7 +162,7 @@ int fitVertexCascade( VKVertex * vk, int Pointing) if(vk->nextCascadeVrt){ FullMTXfill(vk, vk->ader); VKTrack * target_trk = getCombinedVTrack(vk); // get address of combined track - if( target_trk == 0 ) return -12; + if( target_trk == nullptr ) return -12; long int Charge=getVertexCharge(vk); target_trk->Charge=Charge; @@ -791,8 +791,6 @@ void getFittedCascade( CascadeEvent & cascadeEvent_, } for(it=0; it<PDIM; it++) delete[]DPhys[it]; delete[]DPhys; -// - return; } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascadeScale.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascadeScale.cxx index 572cb256f8c45dc64672a9abda8f352fb6511ac0..7745424f0b273bf84dc352873395a27b279ba594 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascadeScale.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CFitCascadeScale.cxx @@ -7,12 +7,12 @@ // Potentially could be more powerful that currently implemented scheme with exact pointing // Currently is LESS efficient, so for the moment left for future work //========================================================================================== -#include <math.h> -#include <iostream> -#include "TrkVKalVrtCore/VKalVrtBMag.h" +#include "TrkVKalVrtCore/Derivt.h" #include "TrkVKalVrtCore/Propagator.h" #include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" -#include "TrkVKalVrtCore/Derivt.h" +#include "TrkVKalVrtCore/VKalVrtBMag.h" +#include <cmath> +#include <iostream> namespace Trk { @@ -24,14 +24,14 @@ extern int cfdinv(double *, double *, long int ); extern int cfInv5(double *cov, double *wgt ); extern int vtcfit( VKVertex * vk); extern void combinedTrack(long int ICH, double *pv0, double *covi, double BMAG, double *paro, double *covo); -extern int afterFit(VKVertex *, double *, double *, double *, double *, const VKalVrtControlBase* = 0); +extern int afterFit(VKVertex *, double *, double *, double *, double *, const VKalVrtControlBase* = nullptr); extern void applyConstraints(VKVertex * vk); extern void FullMTXfill(VKVertex * , double * ); extern int FullMCNSTfill(VKVertex * , double * , double * ); extern int getCascadeNPar(CascadeEvent &, int Type=0); extern VKTrack * getCombinedVTrack(VKVertex *); -extern void vpderiv(bool, long int , double *, double *, double *, double *, double *, double *, double *,const VKalVrtControl * =0); +extern void vpderiv(bool, long int , double *, double *, double *, double *, double *, double *, double *,const VKalVrtControl * =nullptr); extern std::vector<double> transformCovar(int , double **, const std::vector<double>& ); extern double cfVrtDstSig( VKVertex * , bool ); extern long int getVertexCharge( VKVertex *); @@ -89,7 +89,7 @@ int fitVertexCascadeScale( VKVertex * vk, double & distToVertex ) if(vk->nextCascadeVrt){ FullMTXfill(vk, vk->ader); VKTrack * target_trk = getCombinedVTrack(vk); // get address of combined track - if( target_trk == 0 ) return -12; + if( target_trk == nullptr ) return -12; long int Charge=getVertexCharge(vk); target_trk->Charge=Charge; @@ -118,7 +118,7 @@ int fitVertexCascadeScale( VKVertex * vk, double & distToVertex ) } // // Save refitted vertex position as target for predecessors - if(vk->includedVrt.size()){ // Save fitted vertex as target for "pass near" constraint in previous vertex + if(!vk->includedVrt.empty()){ // Save fitted vertex as target for "pass near" constraint in previous vertex for(int pseu=0; pseu<(int)vk->includedVrt.size(); pseu++){ // vk->includedVrt[pseu]->FVC.vrt[0] = (vk->refIterV[0] + vk->fitV[0] + vk->includedVrt[pseu]->FVC.vrt[0])/2.; // vk->includedVrt[pseu]->FVC.vrt[1] = (vk->refIterV[1] + vk->fitV[1] + vk->includedVrt[pseu]->FVC.vrt[1])/2.; @@ -139,7 +139,7 @@ int fitVertexCascadeScale( VKVertex * vk, double & distToVertex ) { extern int translateToFittedPos(CascadeEvent &, double Step=1.); - VKVertex * vk=0; + VKVertex * vk=nullptr; long int Iter, IERR, iv; int countTrk=0; // Number of tracks in cascade for( iv=0; iv<cascadeEvent_.cascadeNV; iv++){ diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeDefinition.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeDefinition.cxx index a1c066c3dabfe1e0a61f01e29763f52cfdd0b7e2..d0c066b43cca728d6d3766203f33fbb4508e39ba 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeDefinition.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeDefinition.cxx @@ -2,11 +2,11 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include <iostream> +#include "TrkVKalVrtCore/Derivt.h" #include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" #include "TrkVKalVrtCore/VKalVrtBMag.h" -#include "TrkVKalVrtCore/Derivt.h" +#include <cmath> +#include <iostream> namespace Trk { @@ -203,7 +203,7 @@ int initCascadeEngine(CascadeEvent & cascadeEvent_) VRT = cascadeEvent_.cascadeVertexList[iv].get(); IERR = fitVertexCascade( VRT, 0); if(IERR)return IERR; //fit IERR = setVTrackMass(VRT); if(IERR)return IERR; //mass of combined particle - if(VRT->includedVrt.size()){ // Save fitted vertex as target for "pass near" constraint in previous vertex + if(!VRT->includedVrt.empty()){ // Save fitted vertex as target for "pass near" constraint in previous vertex for(int pseu=0; pseu<(int)VRT->includedVrt.size(); pseu++){ VRT->includedVrt[pseu]->FVC.vrt[0] = VRT->refIterV[0] + VRT->fitV[0]; VRT->includedVrt[pseu]->FVC.vrt[1] = VRT->refIterV[1] + VRT->fitV[1]; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeUtils.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeUtils.cxx index 1855888aeb6dbb129f5c53cf5b22d053bfe68573..953db14246d5e6c1cbfcbf0c8e0b211e4d0bbab9 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeUtils.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/CascadeUtils.cxx @@ -2,11 +2,11 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include <iostream> -#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" #include "TrkVKalVrtCore/Derivt.h" +#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" #include "TrkVKalVrtCore/VKalVrtBMag.h" +#include <cmath> +#include <iostream> namespace Trk { @@ -113,13 +113,13 @@ int fixPseudoTrackPt(long int NPar, double * fullMtx, double * LSide, CascadeEve // VKTrack * getCombinedVTrack(VKVertex * vk) { - if(!vk->nextCascadeVrt) return 0; //nonpointing vertex + if(!vk->nextCascadeVrt) return nullptr; //nonpointing vertex int NV=vk->nextCascadeVrt->includedVrt.size(); - if(NV==0) return 0; //Error in structure + if(NV==0) return nullptr; //Error in structure int itv=-1; for(int it=0; it<NV; it++) if(vk->nextCascadeVrt->includedVrt[it] == vk) {itv=it; break;}; - if(itv<0) return 0; // Not found in list + if(itv<0) return nullptr; // Not found in list int totNT = vk->nextCascadeVrt->TrackList.size(); return vk->nextCascadeVrt->TrackList[totNT - NV + itv].get(); // pointer to combined track in next vertex diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Derclc1.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Derclc1.cxx index ef1cba35d32224202425a4e5ce51dd780f925bca..dbd57294ebf96b9b1b324ddb7486a9ddb88ff629 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Derclc1.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Derclc1.cxx @@ -2,12 +2,12 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include "TrkVKalVrtCore/Derivt.h" #include "TrkVKalVrtCore/CommonPars.h" +#include "TrkVKalVrtCore/Derivt.h" #include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" -#include <iostream> #include <algorithm> +#include <cmath> +#include <iostream> namespace Trk { diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Derclc2.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Derclc2.cxx index 2b758225e5a18d67ff491128f764e250cfccace5..30b33da5723bd5010cd64b4f68d129d7f943f442 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Derclc2.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Derclc2.cxx @@ -2,12 +2,12 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include "TrkVKalVrtCore/Derivt.h" -#include "TrkVKalVrtCore/VKalVrtBMag.h" #include "TrkVKalVrtCore/CommonPars.h" +#include "TrkVKalVrtCore/Derivt.h" #include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" +#include "TrkVKalVrtCore/VKalVrtBMag.h" #include <algorithm> +#include <cmath> namespace Trk { diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/DerclcAng.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/DerclcAng.cxx index 3975e7760fd6c8f9911bf3fda535947c73b4649b..b0ce3193b30b9dd0b0229ff1c54f93d413df9134 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/DerclcAng.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/DerclcAng.cxx @@ -5,9 +5,9 @@ #include "TrkVKalVrtCore/CommonPars.h" #include "TrkVKalVrtCore/Derivt.h" #include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" -#include <iostream> -#include <math.h> #include <algorithm> +#include <cmath> +#include <iostream> namespace Trk { diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/DummyMag.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/DummyMag.cxx index 9638f14e7faa045af00c8d01baf3924e2ce02012..db66cb3a9790d45e8e0725554a70094262a0b234 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/DummyMag.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/DummyMag.cxx @@ -31,19 +31,19 @@ vkalMagFld::vkalMagFld(): m_saveBZ=0.; } -vkalMagFld::~vkalMagFld() {} +vkalMagFld::~vkalMagFld() = default; -baseMagFld::baseMagFld() {} -baseMagFld::~baseMagFld() {} +baseMagFld::baseMagFld() = default; +baseMagFld::~baseMagFld() = default; void vkalMagFld::getMagFld(const double X,const double Y,const double Z, - double& bx, double& by, double& bz, const VKalVrtControlBase* FitControl=0 ) const + double& bx, double& by, double& bz, const VKalVrtControlBase* FitControl=nullptr ) const { bx=by=0.; //std::cout<<"In coreMag.field0 Control="<<FitControl<<'\n'; //std::cout<<"In coreMag.field0 obj="<<FitControl->vk_objMagFld<<" func="<<FitControl->vk_funcMagFld<<'\n'; - if ( FitControl==0 || (FitControl->vk_funcMagFld == 0 && FitControl->vk_objMagFld==0) ){ + if ( FitControl==nullptr || (FitControl->vk_funcMagFld == nullptr && FitControl->vk_objMagFld==nullptr) ){ bz=m_cnstBMAG; return; } @@ -55,12 +55,12 @@ void vkalMagFld::getMagFld(const double X,const double Y,const double Z, //std::cout<<" coreMag.field="<<bx<<", "<<by<<", "<<bz<<" obj="<<FitControl->vk_objMagFld<<" func="<<FitControl->vk_funcMagFld<<'\n'; } -double vkalMagFld::getMagFld(const double xyz[3], const VKalVrtControlBase* FitControl=0 ) const +double vkalMagFld::getMagFld(const double xyz[3], const VKalVrtControlBase* FitControl=nullptr ) const { //std::cout<<"In coreMag.field1 Control="<<FitControl<<'\n'; //std::cout<<"In coreMag.field1 obj="<<FitControl->vk_objMagFld<<" func="<<FitControl->vk_funcMagFld<<'\n'; double bx=0., by=0., bz=0.; - if ( FitControl==0 || (FitControl->vk_funcMagFld == 0 && FitControl->vk_objMagFld==0) ){ + if ( FitControl==nullptr || (FitControl->vk_funcMagFld == nullptr && FitControl->vk_objMagFld==nullptr) ){ bz=m_cnstBMAG; return bz; } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/FullMtx.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/FullMtx.cxx index 4a89f12f45eafdc62ec33f761a5e44da83840400..cc063af2435e1d8b03570e3b831a7127ab3b8554 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/FullMtx.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/FullMtx.cxx @@ -14,7 +14,7 @@ namespace Trk { /* Author: V.Kostyukhin */ /* --------------------------------------------------- */ -#define ader_ref(a_1,a_2) ader[(a_2)*(vkalNTrkM*3+3) + a_1] +#define ader_ref(a_1,a_2) ader[(a_2)*(vkalNTrkM*3+3) + (a_1)] void FullMTXfill(VKVertex * vk, double * ader) { diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Matrix.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Matrix.cxx index 704358ba6377ef55be07cbb9de74258cd5e4b6e7..591265542343028793e8534b59dc0bb4c84a02c4 100644 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Matrix.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Matrix.cxx @@ -2,10 +2,10 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include <iostream> -#include <exception> #include "TrkVKalVrtCore/TrkVKalUtils.h" +#include <cmath> +#include <exception> +#include <iostream> namespace Trk { @@ -270,9 +270,9 @@ void scaleg(double *g, double *scale, long int N, long int mfirst) for (i__ = 1; i__ <= N; ++i__) { scale[i__] = 1.; if (g_ref(i__, i__) == 0.) continue; - tmp = sqrt(fabs(g_ref(i__, i__))); + tmp = std::sqrt(fabs(g_ref(i__, i__))); //scale[i__] = 1./tmp; g_ref(i__, i__) = d_sign( 1., g_ref(i__, i__)); //VK old version -> diag==1 - scale[i__] = 1./sqrt(tmp); g_ref(i__, i__) = d_sign( tmp, g_ref(i__, i__)); //VK new version -> diag=sqrt(diag_old) + scale[i__] = 1./std::sqrt(tmp); g_ref(i__, i__) = d_sign( tmp, g_ref(i__, i__)); //VK new version -> diag=sqrt(diag_old) } if (N <= 1) return; @@ -377,7 +377,7 @@ void vkLUbksb(double *a, long int n, int *indx, double *b) // Solve linear equation with LU decomposition. // Matrix (*a) left decomposed // -int vkMSolve(double *a, double *b, long int n, double *ainv=0) +int vkMSolve(double *a, double *b, long int n, double *ainv=nullptr) { int *indx=new int[n+1]; double * Scale=new double[n]; scaleg(a,Scale,n,n); @@ -414,8 +414,8 @@ double vkPythag(double a, double b) double absa,absb; absa=fabs(a); absb=fabs(b); - if (absa > absb) return absa*sqrt(1.0+(absb/absa)*absb/absa); - else return (absb == 0.0 ? 0.0 : absb*sqrt(1.0+(absa/absb)*absa/absb)); + if (absa > absb) return absa*std::sqrt(1.0+(absb/absa)*absb/absa); + return (absb == 0.0 ? 0.0 : absb*std::sqrt(1.0+(absa/absb)*absa/absb)); } void vkSVDCmp(double **a, int m, int n, double w[], double **v) @@ -437,7 +437,7 @@ void vkSVDCmp(double **a, int m, int n, double w[], double **v) s += a[k][i]*a[k][i]; } f=a[i][i]; - g = -SIGN(sqrt(s),f); + g = -SIGN(std::sqrt(s),f); h=f*g-s; a[i][i]=f-g; for (j=l;j<=n;j++) { @@ -458,7 +458,7 @@ void vkSVDCmp(double **a, int m, int n, double w[], double **v) s += a[i][k]*a[i][k]; } f=a[i][l]; - g = -SIGN(sqrt(s),f); + g = -SIGN(std::sqrt(s),f); h=f*g-s; a[i][l]=f-g; for (k=l;k<=n;k++) rv1[k]=a[i][k]/h; @@ -600,7 +600,7 @@ void vkSVDCmp(double **a, int m, int n, double w[], double **v) //Invert square matrix using SVD + solve linear equation if needed // Doesn't work for the moment!!! // -int vkInvSVD(double *ci,long int DIM, double *co, double Chk, double *bvect=0) +int vkInvSVD(double *ci,long int DIM, double *co, double Chk, double *bvect=nullptr) { int i,j,k; double **a = new double*[DIM+1]; double *ab = new double[(DIM+1)*(DIM+1)]; @@ -693,12 +693,12 @@ delete[] w; delete[] a; delete[] ab; delete[] v; delete[] vb; delete[] res; dele return 0; } -#define ROTATE(a,i,j,k,l) g=a[i][j];h=a[k][l];a[i][j]=g-s*(h+g*tau);\ - a[k][l]=h+s*(g-h*tau); +#define ROTATE(a,i,j,k,l) g=(a)[i][j];h=(a)[k][l];(a)[i][j]=g-s*(h+g*tau);\ + (a)[k][l]=h+s*(g-h*tau); int vkjacobi(double **a, int n, double d[], double **v) { - bool getEVect= true; if( v==0 )getEVect=false; + bool getEVect= true; if( v==nullptr )getEVect=false; int j,iq,ip,i; double tresh,theta,tau,t,sm,s,h,g,c; @@ -742,10 +742,10 @@ int vkjacobi(double **a, int n, double d[], double **v) t=(a[ip][iq])/h; else { theta=0.5*h/(a[ip][iq]); - t=1.0/(fabs(theta)+sqrt(1.0+theta*theta)); + t=1.0/(fabs(theta)+std::sqrt(1.0+theta*theta)); if (theta < 0.0) t = -t; } - c=1.0/sqrt(1+t*t); + c=1.0/std::sqrt(1+t*t); s=t*c; tau=s/(1.0+c); h=t*a[ip][iq]; @@ -796,7 +796,7 @@ void vkGetEigVal(double ci[], double d[], int n) for( j=i; j<=n; j++) { k=(j-1)*j/2 + i; a[i][j]=a[j][i]=ci[k-1];} } - vkjacobi(a,n,d,0); + vkjacobi(a,n,d,nullptr); for (i=1;i<n;i++) { double p=d[k=i]; for (j=i+1;j<=n;j++) if (d[j] < p) p=d[k=j]; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/PGraph.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/PGraph.cxx index e13abc6c44db5f02f95bc1175bd7950945fbc0a5..da2abae8be9f344339cfd528ed04f4c3aa73ed2c 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/PGraph.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/PGraph.cxx @@ -21,8 +21,8 @@ int PGraph::pgraphm_(long int *weit, long int *edges, long int *nodes, -#define teit_ref(a_1,a_2) m_teit[(a_2)*2 + a_1 - 3] -#define weit_ref(a_1,a_2) weit[(a_2)*2 + a_1] +#define teit_ref(a_1,a_2) m_teit[(a_2)*2 + (a_1) - 3] +#define weit_ref(a_1,a_2) weit[(a_2)*2 + (a_1)] /* * Modified version of CERNLIB V401 PGRAPH routine. */ @@ -377,7 +377,6 @@ L999: /* L30: */ } *newlng = k; - return; } } /* End of VKalVrtCore namespace */ diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/PrCFit.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/PrCFit.cxx index 65d20289a89683c5f6860649350c864d0ca25652..2bb41b88efa20205f12c67bb4c5b91f2ecc3c922 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/PrCFit.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/PrCFit.cxx @@ -2,9 +2,9 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include "TrkVKalVrtCore/ForCFT.h" #include "TrkVKalVrtCore/CommonPars.h" +#include "TrkVKalVrtCore/ForCFT.h" +#include <cmath> #include <iostream> namespace Trk { @@ -160,7 +160,7 @@ void ForCFT::vksetUsePlaneCnst(double a, double b, double c, double d) noexcept void ForCFT::setmasscnst_(long int *ncnsttrk, long int *indextrk, double *wmcnst) noexcept { - if (indextrk==0) return; //Protection! Track indices start from 1 (not 0)! + if (indextrk==nullptr) return; //Protection! Track indices start from 1 (not 0)! --indextrk; ++nmcnst; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Propagate.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Propagate.cxx index 5779f6e9938962387382bd11704c7c629a884ec3..5efe0060c1979c84f7954d75a6e744237459fbf2 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Propagate.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Propagate.cxx @@ -8,10 +8,10 @@ // Single myPropagator object of vkalPropagator type is created in CFit.cxx //------------------------------------------------------------------------ // Header include -#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" #include "TrkVKalVrtCore/Propagator.h" +#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" #include "TrkVKalVrtCore/VKalVrtBMag.h" -#include <math.h> +#include <cmath> //------------------------------------------------- #include <iostream> @@ -22,7 +22,7 @@ extern const vkalMagFld myMagFld; extern void cfnewp(long int*, double*, double*, double*, double*, double*); extern void cferpr(long int*, double*, double*, double*, double*, double*); -extern void cfnewpm (double*, double*, double*, double*, double*, double*, const VKalVrtControlBase * =0); +extern void cfnewpm (double*, double*, double*, double*, double*, double*, const VKalVrtControlBase * =nullptr); //------------------------------------------------------------------------ // Old propagator functions: @@ -58,14 +58,14 @@ extern void cfnewpm (double*, double*, double*, double*, double*, double*, const Goal[1]=RefEnd[1]-RefStart[1]; Goal[2]=RefEnd[2]-RefStart[2]; cfnewp( &Charge, ParOld, &Goal[0], &Way, ParNew, closePoint); - if(CovOld != 0) cferpr( &Charge, ParOld, &Goal[0], &Way, CovOld, CovNew); + if(CovOld != nullptr) cferpr( &Charge, ParOld, &Goal[0], &Way, CovOld, CovNew); if(Charge==0){ // Correction for different magnetic field values in Ini and End double vBx,vBy,vBz,vBzn; myMagFld.getMagFld(RefStart[0],RefStart[1],RefStart[2],vBx,vBy,vBz,CONTROL); myMagFld.getMagFld(RefEnd[0],RefEnd[1],RefEnd[2],vBx,vBy,vBzn,CONTROL); double Corr = vBzn/vBz; ParNew[4] *= Corr; - if(CovOld != 0){ + if(CovOld != nullptr){ CovNew[10] *= Corr; CovNew[11] *= Corr; CovNew[12] *= Corr; @@ -88,7 +88,7 @@ extern void cfnewpm (double*, double*, double*, double*, double*, double*, const Goal[1]=RefEnd[1]-RefStart[1]; Goal[2]=RefEnd[2]-RefStart[2]; cfnewp( &Charge, ParOld, &Goal[0], &Way, ParNew, closePoint); - if(CovOld != 0)cferpr( &Charge, ParOld, &Goal[0], &Way, CovOld, CovNew); + if(CovOld != nullptr)cferpr( &Charge, ParOld, &Goal[0], &Way, CovOld, CovNew); // double Save[5]; if(Way > 100){for (int ii=0; ii<5;ii++) Save[ii]=ParNew[ii];} // double Save[4]; if(Way > 10.){for (int ii=0; ii<3;ii++) Save[ii]=closePoint[ii];Save[3]=ParNew[0];} @@ -117,7 +117,7 @@ extern void cfnewpm (double*, double*, double*, double*, double*, double*, const myMagFld.getMagFld(RefEnd[0],RefEnd[1],RefEnd[2],vBx,vBy,vBzn,CONTROL); double Corr = vBzn/vBz; ParNew[4] *= Corr; - if(CovOld != 0){ + if(CovOld != nullptr){ CovNew[10] *= Corr; CovNew[11] *= Corr; CovNew[12] *= Corr; @@ -130,11 +130,11 @@ extern void cfnewpm (double*, double*, double*, double*, double*, double*, const //---------------------------------------------------------------------------------------- // Propagator object // - vkalPropagator::vkalPropagator(){} - vkalPropagator::~vkalPropagator() {} + vkalPropagator::vkalPropagator()= default; + vkalPropagator::~vkalPropagator() = default; - basePropagator::basePropagator() {} - basePropagator::~basePropagator() {} + basePropagator::basePropagator() = default; + basePropagator::~basePropagator() = default; bool vkalPropagator::checkTarget(double *) const @@ -149,13 +149,13 @@ extern void cfnewpm (double*, double*, double*, double*, double*, double*, const //std::cout<<"Core: propagator control="<<FitControl<<" oldX,Y="<<RefOld[0]<<","<<RefOld[1]<<" newX,Y="<<RefNew[0]<<","<<RefNew[1]<<'\n'; if( RefOld[0]==RefNew[0] && RefOld[1]==RefNew[1] && RefOld[2]==RefNew[2]){ for (int i=0; i<5; i++) ParNew[i]=ParOld[i]; - if(CovOld != 0) { for (int i=0; i<15; i++) CovNew[i]=CovOld[i];} + if(CovOld != nullptr) { for (int i=0; i<15; i++) CovNew[i]=CovOld[i];} return; } // //-- Propagation itself // - if( FitControl==0 || (FitControl->vk_objProp==0 && FitControl->vk_funcProp==0) ){ // No external propagators, use internal ones + if( FitControl==nullptr || (FitControl->vk_objProp==nullptr && FitControl->vk_funcProp==nullptr) ){ // No external propagators, use internal ones //std::cout<<" Core: use INTERNAL propagator. Charge="<<Charge<<'\n'; if(vkalUseRKMPropagator){ Trk::PropagateRKM( Charge, ParOld, CovOld, RefOld, RefNew, ParNew, CovNew, FitControl); } else { Trk::PropagateSTD( TrkID,Charge, ParOld, CovOld, RefOld, RefNew, ParNew, CovNew, FitControl); } @@ -180,8 +180,7 @@ extern void cfnewpm (double*, double*, double*, double*, double*, double*, const return; } //------------------- - return; - } + } void vkalPropagator::Propagate( VKTrack * trk, double *RefOld, double *RefNew, double *ParNew, double *CovNew, @@ -197,7 +196,7 @@ extern void cfnewpm (double*, double*, double*, double*, double*, double*, const // //-- Propagation itself // - if( FitControl==0 || (FitControl->vk_objProp==0 && FitControl->vk_funcProp==0) ){ // No external propagators, use internal ones + if( FitControl==nullptr || (FitControl->vk_objProp==nullptr && FitControl->vk_funcProp==nullptr) ){ // No external propagators, use internal ones if(vkalUseRKMPropagator){ Trk::PropagateRKM( Charge, trk->refPerig, trk->refCovar, RefOld, RefNew, ParNew, CovNew, FitControl); } else { Trk::PropagateSTD( TrkID,Charge, trk->refPerig, trk->refCovar, RefOld, RefNew, ParNew, CovNew, FitControl); } return; @@ -223,8 +222,7 @@ extern void cfnewpm (double*, double*, double*, double*, double*, double*, const FitControl->vk_funcProp( TrkID, Charge, trk->refPerig, trk->refCovar, RefOld, RefNew, ParNew, CovNew); return; } - return; - } + } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/RobTest.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/RobTest.cxx index 71a7c726ebfdf8c863932b3c75d3d750dbed10c4..fb2f22786b04c1ca52dfd57735b00933a0a57aff 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/RobTest.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/RobTest.cxx @@ -2,18 +2,18 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" -#include <iostream> -#include <vector> - -namespace Trk { - - +#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" +#include <cmath> +#include <iostream> +#include <vector> + +namespace Trk { + + //extern void digx(double*, double*, double*, long int , long int ); - + extern void vkGetEigVect(double ci[], double d[], double vect[], int n); - + void robtest(VKVertex * vk, long int ifl) { long int i, j, k, kk, it; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/TrkVKalVrtCoreBase.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/TrkVKalVrtCoreBase.cxx index 88517a2f91454e9edd14645e4e56439ced3af7d1..aae85b40a3e5d25dd6daa36d48ea8588c89b1ec8 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/TrkVKalVrtCoreBase.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/TrkVKalVrtCoreBase.cxx @@ -2,8 +2,10 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> #include <algorithm> +#include <cmath> +#include <memory> + #include "TrkVKalVrtCore/CommonPars.h" #include "TrkVKalVrtCore/TrkVKalVrtCore.h" #include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" @@ -97,11 +99,11 @@ namespace Trk { VKVertex::VKVertex(const VKalVrtControl & FitControl): VKVertex() - { vk_fitterControl = std::unique_ptr<VKalVrtControl>(new VKalVrtControl(FitControl)); } + { vk_fitterControl = std::make_unique<VKalVrtControl>(FitControl); } VKVertex::VKVertex(): useApriorVertex(0), passNearVertex(false), passWithTrkCov(false), - TrackList(0), tmpArr(0), ConstraintList(0),nextCascadeVrt(0),includedVrt(0) + TrackList(0), tmpArr(0), ConstraintList(0),nextCascadeVrt(nullptr),includedVrt(0) { for(int i=0; i<3; i++) apriorV[i]=refV[i]=iniV[i]=fitV[i]=cnstV[i]=fitMom[i]=0.; for(int i=0; i<6; i++) apriorVWGT[i]=0.; @@ -149,7 +151,7 @@ namespace Trk { savedVrtMomCov[i]=src.savedVrtMomCov[i]; fitCovXYZMom[i]=src.fitCovXYZMom[i]; } - nextCascadeVrt = 0; + nextCascadeVrt = nullptr; truncatedStep = src.truncatedStep; existFullCov = src.existFullCov; @@ -163,14 +165,14 @@ namespace Trk { for( int ic=0; ic<(int)src.ConstraintList.size(); ic++){ ConstraintList.emplace_back(src.ConstraintList[ic]->clone()); } - vk_fitterControl = std::unique_ptr<VKalVrtControl>(new VKalVrtControl(*src.vk_fitterControl)); + vk_fitterControl = std::make_unique<VKalVrtControl>(*src.vk_fitterControl); } VKVertex& VKVertex::operator= (const VKVertex & src) //Assignment operator { if (this!=&src){ vk_fitterControl.reset(); - vk_fitterControl=std::unique_ptr<VKalVrtControl>(new VKalVrtControl(*(src.vk_fitterControl))); + vk_fitterControl=std::make_unique<VKalVrtControl>(*(src.vk_fitterControl)); Chi2=src.Chi2; // vertex Chi2 useApriorVertex=src.useApriorVertex; //for a priory vertex position knowledge usage passNearVertex=src.passNearVertex; // needed for "passing near vertex" constraint @@ -192,7 +194,7 @@ namespace Trk { savedVrtMomCov[i]=src.savedVrtMomCov[i]; fitCovXYZMom[i]=src.fitCovXYZMom[i]; } - nextCascadeVrt = 0; + nextCascadeVrt = nullptr; truncatedStep = src.truncatedStep; existFullCov = src.existFullCov; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Utilities.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Utilities.cxx index 05857278b2e19487b1d57120ea00cb7324130d27..f9fe4240997c920bd4e5d0e62c801b08ea15f27b 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Utilities.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/Utilities.cxx @@ -2,10 +2,10 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> +#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" #include <algorithm> +#include <cmath> #include <iostream> -#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" namespace Trk { @@ -259,7 +259,6 @@ void abcCoef(double g1, double g2, double g3, a=g1; c=2.*(g3-g1) - 4.*(g2-g1); b=(g3-g1) - c; - return; } void efdCoef(double Ga0, double Gamb, double Gab, double Gw0, double Gwb, @@ -272,8 +271,7 @@ void efdCoef(double Ga0, double Gamb, double Gab, double Gw0, double Gwb, e = (Gab + Gamb - 2.*Ga0)/bet/bet/2.; f = (Gwb + Gamb - 2.*e*bet*bet - Gw0 - Ga0)/bet/(w-alf); d = (Gab - Ga0 - e*bet*bet - f*alf*bet)/bet; - return; - } +} void ParaMin( double b, double c, double d, double e, double f, @@ -282,8 +280,7 @@ void ParaMin( double b, double c, double d, double e, double f, ymin = (f*b-2.*c*d)/(4.*c*e - f*f); if( fabs(f) > fabs(c) ) { xmin = - (2.*e*ymin + d)/f;} else { xmin = - (f*ymin+b)/(2.*c);} - return; -} + } void cfTrkCovarCorr(double *cov){ // std::cout<<cov[1]*cov[1]/cov[0]/cov[2]<<'\n'; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VKgrkuta.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VKgrkuta.cxx index bccb3432f30fc172e335ef003d8599e977e3ff21..860eb69e222b638c78e212772406944a378fea0c 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VKgrkuta.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VKgrkuta.cxx @@ -2,10 +2,10 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> +#include "TrkVKalVrtCore/CommonPars.h" #include "TrkVKalVrtCore/TrkVKalVrtCore.h" #include "TrkVKalVrtCore/VKalVrtBMag.h" -#include "TrkVKalVrtCore/CommonPars.h" +#include <cmath> #include <iostream> namespace Trk { @@ -235,8 +235,7 @@ L40: } - return; -} + } #undef xyz #undef zt #undef yt diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VKvFast.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VKvFast.cxx index f17228a3eca140209dc3e768b4aaa131258c9ef4..70acb46d5384e944bf837adf204f5ad88e9b821c 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VKvFast.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VKvFast.cxx @@ -2,8 +2,8 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> #include "TrkVKalVrtCore/CommonPars.h" +#include <cmath> #include <iostream> namespace Trk { @@ -19,8 +19,7 @@ namespace Trk { void vkvfast_(double *p1, double *p2, double *dbmag, double *out) { void vkvFastV(double*, double*, double* vRef, double, double *out); - vkvFastV(p1, p2, 0, (*dbmag), out); return; -} + vkvFastV(p1, p2, nullptr, (*dbmag), out); } void vkvFastV(double *p1, double *p2, double* vRef, double dbmag, double *out) diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFit.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFit.cxx index 84a467375d3f92ab6dd9c3cc136c1941bc0478c0..18d510b9e67873055865772aa5bb67a3bbdebdbf 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFit.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFit.cxx @@ -2,13 +2,13 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include <iostream> -#include <thread> -#include <algorithm> -#include "TrkVKalVrtCore/ForCFT.h" #include "TrkVKalVrtCore/CommonPars.h" +#include "TrkVKalVrtCore/ForCFT.h" #include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" +#include <algorithm> +#include <cmath> +#include <iostream> +#include <thread> namespace Trk { @@ -433,7 +433,7 @@ namespace Trk { if ( !vk->passNearVertex ) { /* No correction for these constraints */ /* because solution is calculated with full error matrix*/ - if( vk->ConstraintList.size() == 0){ + if( vk->ConstraintList.empty()){ double EigThreshold = 1.e-9; /* Def. for fit without constraints 5.e-8*/ vkGetEigVal(wa, eigv, 3); if (eigv[0] < 0.) { wa[0] -= 1.*eigv[0]; wa[2] -= 1.*eigv[0]; wa[5] -= 1.*eigv[0]; } @@ -555,7 +555,7 @@ namespace Trk { dsinv(&NParam, vk->ader, vkalNTrkM*3+3, &IERR); if ( IERR != 0) { std::cout << " Bad problem in CFIT inversion ierr="<<IERR<<", "<<eigv[2]<<'\n'; return IERR; - } else { + } double *fortst = new double[vkalNTrkM*3+3]; for (j = 0; j < 3; ++j) { fortst[j] = stv[j]; @@ -584,7 +584,7 @@ namespace Trk { vk->fitVcov[4] = ader_ref(3, 2); vk->fitVcov[5] = ader_ref(3, 3); delete[] fortst; - } + //std::cout<< "NVertex Full="<<vk->fitV[0]<<", "<<vk->fitV[1]<<", "<<vk->fitV[2]<<'\n'; //std::cout<< "NVertex Full shft="<<dxyz[0]<<", "<<dxyz[1]<<", "<<dxyz[2]<<'\n'; //double *tmpA=new double[3+3*NTRK+20]; @@ -597,7 +597,7 @@ namespace Trk { /* Now constraints */ /* ------------------------------------------------------------ */ double dCoefNorm = 0; - if ( vk->ConstraintList.size() > 0) { + if ( !vk->ConstraintList.empty()) { IERR = vtcfitc( vk ); if (IERR != 0) return IERR; ///* dxyz0 - shift of vertex due to fit without constraints */ @@ -721,7 +721,7 @@ namespace Trk { vk->Chi2 = setLimitedFitVrt(vk,1.,0.,dCoefNorm,xyzt);// track parameters at intermediate vertex. vk->setCnstV(xyzt); // Also save to cnstP for constraint vk->Chi2 += calcChi2Addition( vk, wgtvrtd, xyzt); // Constraints of Chi2 type - if (vk->ConstraintList.size()) { // Restore initial derivatives + if (!vk->ConstraintList.empty()) { // Restore initial derivatives int NTRK=vk->TrackList.size(); vk->setCnstV(vk->iniV); for(int i=0; i<NTRK; ++i){ VKTrack* trk=vk->TrackList[i].get(); for (int j=0;j<3;j++){trk->cnstP[j]=trk->iniP[j];}} diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFitC.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFitC.cxx index b7bdda5b40878faf77bf0970c3110aa4c337ff5e..675f6e8df8d1044199cb2395603b6f52ee7144ac 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFitC.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFitC.cxx @@ -2,11 +2,11 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include "TrkVKalVrtCore/ForCFT.h" #include "TrkVKalVrtCore/CommonPars.h" -#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" #include "TrkVKalVrtCore/Derivt.h" +#include "TrkVKalVrtCore/ForCFT.h" +#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" +#include <cmath> #include <iostream> namespace Trk { @@ -30,7 +30,7 @@ int vtcfitc( VKVertex * vk ) long int IERR = 0; long int totNC=0; //total number of constraints long int NTRK = vk->TrackList.size(); - if (vk->ConstraintList.size() == 0) {return 0;} + if (vk->ConstraintList.empty()) {return 0;} // double dxyz[3]={vk->dxyz0[0],vk->dxyz0[1],vk->dxyz0[2]}; //nonconstraint vertex shift // @@ -250,7 +250,7 @@ int vtcfitc( VKVertex * vk ) // double getCnstValues2( VKVertex * vk ) { - if (vk->ConstraintList.size()==0) return 0.; + if (vk->ConstraintList.empty()) return 0.; double sumSQ=0.; for(int ii=0; ii<(int)vk->ConstraintList.size();ii++){ for(int ic=0; ic<(int)vk->ConstraintList[ii]->NCDim; ic++){ diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFitE.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFitE.cxx index 0d2d73881bb2987a5b205f0b6deddf7c6f264287..51fee04032e2ed1064b598509a1d1218f1bdb136 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFitE.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtCFitE.cxx @@ -2,10 +2,10 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> #include "TrkVKalVrtCore/CommonPars.h" -#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" #include "TrkVKalVrtCore/Derivt.h" +#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" +#include <cmath> #include <iostream> namespace Trk { @@ -36,14 +36,14 @@ int getFullVrtCov(VKVertex * vk, double *ader, double *dcv, double verr[6][6]) extern void FullMTXfill( VKVertex* , double *); extern void vkSVDCmp(double**, int, int, double*, double**); - TWRK * t_trk=0; + TWRK * t_trk=nullptr; long int NTRK = vk->TrackList.size(); long int IERR=0; long int NVar = (NTRK + 1) * 3; - if(vk->passNearVertex && vk->ConstraintList.size()==0) { + if(vk->passNearVertex && vk->ConstraintList.empty()) { /* Fit is with "pass near" constraint and then */ /* matrix is already present */ - } else if ( vk->ConstraintList.size()>0 && useWeightScheme ) { + } else if ( !vk->ConstraintList.empty() && useWeightScheme ) { /* Full matrix inversion i */ // FullMTXfill( vk, ader); @@ -259,7 +259,7 @@ int getFullVrtCov(VKVertex * vk, double *ader, double *dcv, double verr[6][6]) } } //for(int ii=1; ii<=9; ii++)std::cout<<ader_ref(ii,ii)<<", "; std::cout<<__func__<<" fast full m NEW"<<'\n'; - if( vk->ConstraintList.size()>0 && !useWeightScheme ){ + if( !vk->ConstraintList.empty() && !useWeightScheme ){ //--------------------------------------------------------------------- // Covariance matrix with constraints a la Avery. // ader_ref() should contain nonconstraint covariance matrix diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtDeriv.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtDeriv.cxx index 45b9bb31cface3730d301822ce405c02bce87b28..e73d032d92a33c4d16c4d329943e0a7b40e0e79c 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtDeriv.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/VtDeriv.cxx @@ -2,11 +2,11 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> #include "TrkVKalVrtCore/CommonPars.h" -#include "TrkVKalVrtCore/VKalVrtBMag.h" #include "TrkVKalVrtCore/Propagator.h" #include "TrkVKalVrtCore/TrkVKalVrtCore.h" +#include "TrkVKalVrtCore/VKalVrtBMag.h" +#include <cmath> #include <iostream> @@ -39,9 +39,9 @@ void vpderiv(bool UseTrackErr, long int Charge, double *pari0, double *covi, dou extern void tdasatVK(double *, double *, double *, long int, long int); -#define rvec_ref(a_1,a_2) rvec[(a_2)*2 + a_1 - 1] -#define drdpar_ref(a_1,a_2) drdpar[(a_2)*2 + a_1] -#define cnv_ref(a_1,a_2) cnv[(a_2)*6 + a_1 - 7] +#define rvec_ref(a_1,a_2) rvec[(a_2)*2 + (a_1) - 1] +#define drdpar_ref(a_1,a_2) drdpar[(a_2)*2 + (a_1)] +#define cnv_ref(a_1,a_2) cnv[(a_2)*6 + (a_1) - 7] /* ---------------------------------------------------------- */ /* Subroutine for derivative calculations */ diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/XYZtrp.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/XYZtrp.cxx index 1f111c4a52dc44358b80350b85aa17c23fe3efdf..b126128704318b7d40ae83dc7a5e75ec19d6b02d 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/XYZtrp.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/XYZtrp.cxx @@ -2,10 +2,10 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> #include "TrkVKalVrtCore/CommonPars.h" -#include "TrkVKalVrtCore/VKalVrtBMag.h" #include "TrkVKalVrtCore/Propagator.h" +#include "TrkVKalVrtCore/VKalVrtBMag.h" +#include <cmath> #include <iostream> namespace Trk { @@ -107,7 +107,7 @@ void xyztrp(long int *ich, double *vrt0, double *pv0, double *covi, double BMAG /* -- Translation to (0,0,0) (BackPropagation) --*/ double Ref0[3]={0.,0.,0.}; - myPropagator.Propagate(-999, (*ich), par, covd, vrt0, Ref0, paro, errt, 0); + myPropagator.Propagate(-999, (*ich), par, covd, vrt0, Ref0, paro, errt, nullptr); } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfClstPnt.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfClstPnt.cxx index 77ddf788132bf17e93960e89ddd055906aba7df2..ba30b5718c62e7abbfd4e6c1b5e5a4ca7e4b51a5 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfClstPnt.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfClstPnt.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> +#include <cmath> namespace Trk { @@ -30,9 +30,6 @@ void cfClstPnt( double *par, double *Vrt, double *ClstPnt) ClstPnt[0]=Per[0] + u*e[0]; ClstPnt[1]=Per[1] + u*e[1]; ClstPnt[2]=Per[2] + u*e[2]; - - - return; } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfErPr.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfErPr.cxx index b1758c45f93be1bb28cab98df0df82e9fb5d9f49..b48bbc9972a79464d7f0f7bb9f7114b06da012bd 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfErPr.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfErPr.cxx @@ -2,9 +2,9 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include <iostream> #include "TrkVKalVrtCore/TrkVKalUtils.h" +#include <cmath> +#include <iostream> namespace Trk { diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfImp.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfImp.cxx index e72c431e860b4f9342e182786ec9e442e0794151..ee0671f6a706dbe7bb0dd8222c10391e258a47fa 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfImp.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfImp.cxx @@ -2,9 +2,9 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include "TrkVKalVrtCore/TrkVKalVrtCore.h" #include "TrkVKalVrtCore/Propagator.h" +#include "TrkVKalVrtCore/TrkVKalVrtCore.h" +#include <cmath> #include <iostream> namespace Trk { diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfMassErr.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfMassErr.cxx index 4cdb0b5e953ace9e31df7258e6487a5cbae4cba0..6232b780b3effb6a458a17ce0ca3453ab6cf8e57 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfMassErr.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfMassErr.cxx @@ -4,9 +4,9 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> #include "TrkVKalVrtCore/CommonPars.h" #include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" +#include <cmath> namespace Trk { @@ -67,7 +67,6 @@ void cfmasserr(VKVertex * vk, int *list, double BMAG, double *MASS, double *sigM if((*MASS)<1.e-10) (*MASS) = 1.e-10; (*MASS) = sqrt(*MASS); (*sigM) = sqrt(covM2) / 2. / (*MASS); - return; } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfMomentum.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfMomentum.cxx index 2e0fcd192905e5539d0c552bd9be1e4a7db680b3..ab2dabc3cdf3b0c9831c5d98fa07a8f0bdcf9c6b 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfMomentum.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfMomentum.cxx @@ -2,10 +2,10 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include "TrkVKalVrtCore/VKalVrtBMag.h" #include "TrkVKalVrtCore/CommonPars.h" #include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" -#include <math.h> +#include "TrkVKalVrtCore/VKalVrtBMag.h" +#include <cmath> #include <iostream> namespace Trk { diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfNewP.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfNewP.cxx index 56d8d3d61361b88fd0bdf62c4afb74a8e6dcd464..f49346999470297f4fa08fbf11e4c4d4bea090b1 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfNewP.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfNewP.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> +#include <cmath> namespace Trk { diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfNewPm.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfNewPm.cxx index b6a1e01537a1dc723cd67c9af866233d94aa7143..fa502b2845ccbe74fb524d1169134a24997f0a87 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfNewPm.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfNewPm.cxx @@ -2,11 +2,11 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> -#include <iostream> -#include "TrkVKalVrtCore/VKalVrtBMag.h" #include "TrkVKalVrtCore/Propagator.h" #include "TrkVKalVrtCore/TrkVKalUtils.h" +#include "TrkVKalVrtCore/VKalVrtBMag.h" +#include <cmath> +#include <iostream> namespace Trk { @@ -15,7 +15,7 @@ extern const vkalMagFld myMagFld; extern double d_sign(double, double); extern void cfnewp(long int *, double *, double *, double *, double *, double *); -extern void vkgrkuta_(double *, double *, double *, double *, const VKalVrtControlBase* =0 ); +extern void vkgrkuta_(double *, double *, double *, double *, const VKalVrtControlBase* =nullptr ); void cfnewpm(double *par, double *xyzStart, double *xyzEnd, double *ustep, double *parn, double *closePoint, const VKalVrtControlBase * CONTROL) @@ -111,17 +111,6 @@ void cfnewpm(double *par, double *xyzStart, double *xyzEnd, double *ustep, doubl closePoint[0] = perig[0] + vout[0]; // with simple program closePoint[1] = perig[1] + vout[1]; closePoint[2] = perig[2] + vout[2]; - -//std::cout <<" Exit from cfNewPm="<<dp<<'\n'; -//std::cout <<parn[0]<<'\n'; -// if(parn[0] == 0.) { -//std::cout <<dp<<", "<<(*ustep)<<'\n'; -// for (int jj=0; jj<6;jj++) std::cout <<" vout="<<vout[jj]<<'\n'; -// for (int jj=0; jj<3;jj++) std::cout <<" xyzst="<<xyzst[jj]<<'\n'; -// for (int jj=0; jj<5;jj++) std::cout <<" dpar0="<<dpar0[jj]<<'\n'; -// for (int jj=0; jj<5;jj++) std::cout <<" parn="<<parn[jj]<<'\n'; -// } - return; } diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfPEst.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfPEst.cxx index 22f237999b2c82483f87a82fb7b70f2ff64c0468..ccec746b44ca580be999c233205c9b3c8041cda8 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfPEst.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfPEst.cxx @@ -22,7 +22,7 @@ void cfpest(int ntrk, double *xyz, long int *ich, double (*parst)[5], double (*p for (int i = 0; i < ntrk; ++i) { long int TrkID=i; - myPropagator.Propagate( TrkID, ich[i], &parst[i][0], 0, Ref0, xyz, partmp, 0); + myPropagator.Propagate( TrkID, ich[i], &parst[i][0], nullptr, Ref0, xyz, partmp, nullptr); parf[i][0] = partmp[2]; parf[i][1] = partmp[3]; diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfTotCov.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfTotCov.cxx index ad61cde0018116500a8f2af51260b500025730b4..11c4c433b7163bf909348f089bdff51155399d01 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfTotCov.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfTotCov.cxx @@ -6,10 +6,10 @@ // for combined (X,Y,Z,Px,Py,Pz) vector after vertex fit // //----------------------------------------------------- -#include <math.h> -#include "TrkVKalVrtCore/VKalVrtBMag.h" #include "TrkVKalVrtCore/CommonPars.h" #include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" +#include "TrkVKalVrtCore/VKalVrtBMag.h" +#include <cmath> namespace Trk { diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfVrtDst.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfVrtDst.cxx index 392d25efc4962a74def18da306fcb64ee7780963..7ba12cecf1173257c1297fac475490c138024fcf 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfVrtDst.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/cfVrtDst.cxx @@ -2,10 +2,10 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#include <math.h> #include "TrkVKalVrtCore/CommonPars.h" -#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" #include "TrkVKalVrtCore/Propagator.h" +#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" +#include <cmath> #include <iostream> namespace Trk { diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/stCnst.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/stCnst.cxx index aee772ef3c362a3de796b4f45ea4a26e689566eb..361b74d698d64c23e89f72ae8fc93f8d0dec836e 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/stCnst.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtCore/src/stCnst.cxx @@ -1,232 +1,206 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// Management of constraints -// -//---------------------------------------------------- -#include "TrkVKalVrtCore/ForCFT.h" -#include "TrkVKalVrtCore/Derivt.h" -#include "TrkVKalVrtCore/CommonPars.h" -#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" -#include <iostream> - -namespace Trk { - - -extern void calcMassConstraint( VKMassConstraint * ); -extern void calcPhiConstraint( VKPhiConstraint * ); -extern void calcThetaConstraint( VKThetaConstraint * ); -extern void calcPointConstraint( VKPointConstraint * ); -extern void calcPlaneConstraint( VKPlaneConstraint * ); - - -void applyConstraints(VKVertex * vk) -{ - int NCEntries=vk->ConstraintList.size(); - int NTRK=vk->TrackList.size(); - for(int ic=0; ic<NCEntries; ic++){ - vk->ConstraintList[ic]->applyConstraint(); - //std::cout<<(*pnt_cnst)<<'\n'; -/*//------------------------------------- - int ici=1; double aa0=vk->ConstraintList[ic]->aa[ici]; - double der1,der2,der3; - for(int it=0; it<NTRK; it++){ - vk->TrackList[it]->cnstP[0] += 0.0001; calcPointConstraint( pnt_cnst ); - vk->TrackList[it]->cnstP[0] -= 0.0001; - der1=(vk->ConstraintList[ic]->aa[ici]-aa0)/0.0001; - vk->TrackList[it]->cnstP[1] += 0.0001; calcPointConstraint( pnt_cnst ); - vk->TrackList[it]->cnstP[1] -= 0.0001; - der2=(vk->ConstraintList[ic]->aa[ici]-aa0)/0.0001; - vk->TrackList[it]->cnstP[2] *= 1.001; calcPointConstraint( pnt_cnst ); - vk->TrackList[it]->cnstP[2] /= 1.001; - der3=(vk->ConstraintList[ic]->aa[ici]-aa0)/(vk->TrackList[it]->cnstP[2]*0.001); - std::cout<<"Numerical deriv it="<<it<<" "<<der1<<", "<<der2<<", "<<der3<<'\n'; - } - vk->cnstV[0] += 0.001; calcPointConstraint( pnt_cnst ); - vk->cnstV[0] -= 0.001; der1=(vk->ConstraintList[ic]->aa[ici]-aa0)/0.001; - vk->cnstV[1] += 0.001; calcPointConstraint( pnt_cnst ); - vk->cnstV[1] -= 0.001; der2=(vk->ConstraintList[ic]->aa[ici]-aa0)/0.001; - vk->cnstV[2] += 0.001; calcPointConstraint( pnt_cnst ); - vk->cnstV[2] -= 0.001; der3=(vk->ConstraintList[ic]->aa[ici]-aa0)/0.001; - std::cout<<"Numerical deriv vrt="<<der1<<", "<<der2<<", "<<der3<<'\n'; -*///------------------------------------------ - - } -// -// Effect of symmetrization -// - for(int ii=0; ii<(int)vk->ConstraintList.size();ii++){ - for(int ic=0; ic<(int)vk->ConstraintList[ii]->NCDim; ic++){ - vk->ConstraintList[ii]->h0t[ic].X /= 2. ; - vk->ConstraintList[ii]->h0t[ic].Y /= 2. ; - vk->ConstraintList[ii]->h0t[ic].Z /= 2. ; - for(int it=0; it<NTRK; it++){ - vk->ConstraintList[ii]->f0t.at(it)[ic].X /= 2. ; - vk->ConstraintList[ii]->f0t[it][ic].Y /= 2. ; - vk->ConstraintList[ii]->f0t[it][ic].Z /= 2. ; - } - } - } - return; -} - - - VKConstraintBase::VKConstraintBase(const int NC,int NTRK, VKContraintType t, VKVertex* vrt): NCDim(NC), NTrk(NTRK), - aa(NC, 0.), f0t(NTRK, std::vector< Vect3DF >(NC, Vect3DF())), h0t(NC, Vect3DF()), m_originVertex(vrt), m_type(t) - { - } - - - VKConstraintBase::~VKConstraintBase(){} - std::ostream & operator << ( std::ostream& out, const VKConstraintBase & cnst ) - { - int NTRK=cnst.f0t.size(); - //out.setf( std::ios::scientific); out.precision(7); out << std::endl; - out.precision(7); out << std::defaultfloat; - out << " Base constraint derivatives for NTRK="<<NTRK<<" CNST dim="<<cnst.NCDim<<std::endl; - out << " Momentum derivatives "<< std::endl; - for(int ic=0; ic<cnst.NCDim; ic++){ - out << " d(...)/dTheta d(...)/dPhi d(...)/dInvR NC="<<ic<<std::endl; - for(int i=0; i<NTRK; i++){ - out <<cnst.f0t[i][ic].X<<", "<<cnst.f0t[i][ic].Y<<", "<<cnst.f0t[i][ic].Z<<std::endl; - } - out << " d(...)/dXv d(...)/dYy d(...)/Zv"<< std::endl; - out <<cnst.h0t[ic].X<<", "<<cnst.h0t[ic].Y<<", "<<cnst.h0t[ic].Z<<std::endl; - out << " aa="<<cnst.aa[ic]<<std::endl; - } - out.precision(6); //restore default - return out; - } -// -// MASS constraint -// - VKMassConstraint::VKMassConstraint(int NTRK, double mass, VKVertex *vk) : - VKConstraintBase(1,NTRK, VKContraintType::Mass, vk), - m_usedParticles(NTRK,0), m_targetMass(mass) - { - for(int i=0; i<NTrk; i++) m_usedParticles[i]=i; - } - VKMassConstraint::VKMassConstraint(int NTRK, double mass, const std::vector<int> &listTrk, VKVertex *vk) : - VKConstraintBase(1,NTRK, VKContraintType::Mass, vk), - m_usedParticles(0), m_targetMass(mass) - { - for(int i=0; i<(int)listTrk.size(); i++) m_usedParticles.push_back(listTrk[i]); - m_originVertex = vk; - } - VKMassConstraint::~VKMassConstraint(){} - std::ostream & operator << ( std::ostream& out, const VKMassConstraint & cnst ) - { - const VKVertex * vk = cnst.getOriginVertex(); - int NP=cnst.m_usedParticles.size(); - //out.setf( std::ios::scientific); out.precision(7); out << std::endl; - out.precision(7); out << std::defaultfloat; - out << " Mass constraint (total NTRK="<<vk->TrackList.size()<<")"<< std::endl; - out << " * target mass: "<< cnst.getTargetMass() << std::endl; - out << " * particle indexes: "; - for(int i=0; i<NP; i++){out <<cnst.m_usedParticles[i]<<", ";} - out << std::endl; - out << " * particle masses: "; - for(int i=0; i<NP; i++){out<<vk->TrackList[cnst.m_usedParticles[i]]->getMass()<<", ";} - out << std::endl; - out<< (VKConstraintBase&)cnst <<'\n'; - out.precision(6); //restore default - return out; - } -// -// Angular constraints -// - VKPhiConstraint::VKPhiConstraint(int NTRK, VKVertex *vk): - VKConstraintBase(1,NTRK, VKContraintType::Phi, vk) - {m_originVertex = vk;} - VKPhiConstraint::~VKPhiConstraint(){} - std::ostream & operator << ( std::ostream& out, const VKPhiConstraint & cnst ) - { const VKVertex * vk = cnst.getOriginVertex(); - //out.setf( std::ios::scientific); out.precision(7); out << std::endl; - out.precision(7); out << std::defaultfloat; - out << " Phi constraint (total NTRK="<<vk->TrackList.size()<<")"<< std::endl; - out<< (VKConstraintBase&)cnst <<'\n'; - out.precision(6); //restore default - return out; - } - - VKThetaConstraint::VKThetaConstraint(int NTRK, VKVertex *vk): - VKConstraintBase(1,NTRK, VKContraintType::Theta, vk) - {m_originVertex = vk;} - VKThetaConstraint::~VKThetaConstraint(){} - std::ostream & operator << ( std::ostream& out, const VKThetaConstraint & cnst ) - { const VKVertex * vk = cnst.getOriginVertex(); - //out.setf( std::ios::scientific); out.precision(7); out << std::endl; - out.precision(7); out << std::defaultfloat; - out << " Theta constraint (total NTRK="<<vk->TrackList.size()<<")"<< std::endl; - out<< (VKConstraintBase&)cnst <<'\n'; - out.precision(6); //restore default - return out; - } -// -// Pointing constraint -// - VKPointConstraint::VKPointConstraint(int NTRK, double vrt[3], VKVertex *vk, bool onlyZ=false): - VKConstraintBase(2,NTRK, VKContraintType::Point, vk) - { m_originVertex = vk;m_targetVertex[0]=vrt[0]; m_targetVertex[1]=vrt[1]; m_targetVertex[2]=vrt[2]; - m_onlyZ=onlyZ; // For Z only constraint - } - VKPointConstraint::~VKPointConstraint(){} - std::ostream & operator << ( std::ostream& out, const VKPointConstraint & cnst ) - { const VKVertex * vk = cnst.getOriginVertex(); - //out.setf( std::ios::scientific); out.precision(7); out << std::endl; - out.precision(7); out << std::defaultfloat; - if(!cnst.onlyZ()){ - out << " Point constraint (total NTRK="<<vk->TrackList.size()<<")"<< std::endl; - }else{ - out << " Z point constraint (total NTRK="<<vk->TrackList.size()<<")"<< std::endl; - } - out << " target vertex="<<cnst.getTargetVertex()[0]<<", " - <<cnst.getTargetVertex()[1]<<", " - <<cnst.getTargetVertex()[2]<<std::endl; - out<< (VKConstraintBase&)cnst <<'\n'; - out.precision(6); //restore default - return out; - } -// -// Vertex in plane constraint -// - VKPlaneConstraint::VKPlaneConstraint(int NTRK, double a, double b, double c, double d, VKVertex *vk): - VKConstraintBase(1,NTRK, VKContraintType::Plane, vk) - {m_A=a; m_B=b; m_C=c; m_D=d; } - VKPlaneConstraint::~VKPlaneConstraint(){} - std::ostream & operator << ( std::ostream& out, const VKPlaneConstraint & cnst ) - { const VKVertex * vk = cnst.getOriginVertex(); - //out.setf( std::ios::scientific); out.precision(7); out << std::endl; - out.precision(7); out << std::defaultfloat; - out << " Vertex in plane constraint (total NTRK="<<vk->TrackList.size()<<")"<< std::endl; - out << " Plane(A,B,C,D):"<<cnst.getA()<<", "<<cnst.getB()<<", "<<cnst.getC()<<", "<<cnst.getD()<<std::endl; - out<< (VKConstraintBase&)cnst <<'\n'; - out.precision(6); //restore default - return out; - } - - VKConstraintBase* VKMassConstraint::clone() const{ - return new VKMassConstraint(*this); - } - VKConstraintBase* VKPhiConstraint::clone() const{ - return new VKPhiConstraint(*this); - } - VKConstraintBase* VKThetaConstraint::clone() const{ - return new VKThetaConstraint(*this); - } - VKConstraintBase* VKPointConstraint::clone() const{ - return new VKPointConstraint(*this); - } - VKConstraintBase* VKPlaneConstraint::clone() const{ - return new VKPlaneConstraint(*this); - } - - void VKMassConstraint::applyConstraint(){ calcMassConstraint(this); } - void VKPhiConstraint::applyConstraint(){ calcPhiConstraint(this); } - void VKThetaConstraint::applyConstraint(){ calcThetaConstraint(this); } - void VKPointConstraint::applyConstraint(){ calcPointConstraint(this); } - void VKPlaneConstraint::applyConstraint(){ calcPlaneConstraint(this); } -} /* End of namespace */ - - +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +// Management of constraints +// +//---------------------------------------------------- +#include "TrkVKalVrtCore/ForCFT.h" +#include "TrkVKalVrtCore/Derivt.h" +#include "TrkVKalVrtCore/CommonPars.h" +#include "TrkVKalVrtCore/TrkVKalVrtCoreBase.h" +#include <iostream> + +namespace Trk { + + +extern void calcMassConstraint( VKMassConstraint * ); +extern void calcPhiConstraint( VKPhiConstraint * ); +extern void calcThetaConstraint( VKThetaConstraint * ); +extern void calcPointConstraint( VKPointConstraint * ); +extern void calcPlaneConstraint( VKPlaneConstraint * ); + + +void applyConstraints(VKVertex * vk) +{ + int NCEntries=vk->ConstraintList.size(); + int NTRK=vk->TrackList.size(); + for(int ic=0; ic<NCEntries; ic++){ + vk->ConstraintList[ic]->applyConstraint(); + } +// +// Effect of symmetrization +// + for(int ii=0; ii<(int)vk->ConstraintList.size();ii++){ + for(int ic=0; ic<(int)vk->ConstraintList[ii]->NCDim; ic++){ + vk->ConstraintList[ii]->h0t[ic].X *= 0.5 ; + vk->ConstraintList[ii]->h0t[ic].Y *= 0.5 ; + vk->ConstraintList[ii]->h0t[ic].Z *= 0.5 ; + for(int it=0; it<NTRK; it++){ + vk->ConstraintList[ii]->f0t.at(it)[ic].X *= 0.5 ; + vk->ConstraintList[ii]->f0t[it][ic].Y *= 0.5 ; + vk->ConstraintList[ii]->f0t[it][ic].Z *= 0.5 ; + } + } + } + } + + + VKConstraintBase::VKConstraintBase(const int NC,int NTRK, VKContraintType t, VKVertex* vrt): NCDim(NC), NTrk(NTRK), + aa(NC, 0.), f0t(NTRK, std::vector< Vect3DF >(NC, Vect3DF())), h0t(NC, Vect3DF()), m_originVertex(vrt), m_type(t) + { + } + + + VKConstraintBase::~VKConstraintBase()= default; + std::ostream & operator << ( std::ostream& out, const VKConstraintBase & cnst ) + { + int NTRK=cnst.f0t.size(); + //out.setf( std::ios::scientific); out.precision(7); out << std::endl; + out.precision(7); out << std::defaultfloat; + out << " Base constraint derivatives for NTRK="<<NTRK<<" CNST dim="<<cnst.NCDim<<std::endl; + out << " Momentum derivatives "<< std::endl; + for(int ic=0; ic<cnst.NCDim; ic++){ + out << " d(...)/dTheta d(...)/dPhi d(...)/dInvR NC="<<ic<<std::endl; + for(int i=0; i<NTRK; i++){ + out <<cnst.f0t[i][ic].X<<", "<<cnst.f0t[i][ic].Y<<", "<<cnst.f0t[i][ic].Z<<std::endl; + } + out << " d(...)/dXv d(...)/dYy d(...)/Zv"<< std::endl; + out <<cnst.h0t[ic].X<<", "<<cnst.h0t[ic].Y<<", "<<cnst.h0t[ic].Z<<std::endl; + out << " aa="<<cnst.aa[ic]<<std::endl; + } + out.precision(6); //restore default + return out; + } +// +// MASS constraint +// + VKMassConstraint::VKMassConstraint(int NTRK, double mass, VKVertex *vk) : + VKConstraintBase(1,NTRK, VKContraintType::Mass, vk), + m_usedParticles(NTRK,0), m_targetMass(mass) + { + for(int i=0; i<NTrk; i++) m_usedParticles[i]=i; + } + VKMassConstraint::VKMassConstraint(int NTRK, double mass, const std::vector<int> &listTrk, VKVertex *vk) : + VKConstraintBase(1,NTRK, VKContraintType::Mass, vk), + m_usedParticles(0), m_targetMass(mass) + { + for(int i=0; i<(int)listTrk.size(); i++) m_usedParticles.push_back(listTrk[i]); + m_originVertex = vk; + } + VKMassConstraint::~VKMassConstraint()= default; + std::ostream & operator << ( std::ostream& out, const VKMassConstraint & cnst ) + { + const VKVertex * vk = cnst.getOriginVertex(); + int NP=cnst.m_usedParticles.size(); + //out.setf( std::ios::scientific); out.precision(7); out << std::endl; + out.precision(7); out << std::defaultfloat; + out << " Mass constraint (total NTRK="<<vk->TrackList.size()<<")"<< std::endl; + out << " * target mass: "<< cnst.getTargetMass() << std::endl; + out << " * particle indexes: "; + for(int i=0; i<NP; i++){out <<cnst.m_usedParticles[i]<<", ";} + out << std::endl; + out << " * particle masses: "; + for(int i=0; i<NP; i++){out<<vk->TrackList[cnst.m_usedParticles[i]]->getMass()<<", ";} + out << std::endl; + out<< (VKConstraintBase&)cnst <<'\n'; + out.precision(6); //restore default + return out; + } +// +// Angular constraints +// + VKPhiConstraint::VKPhiConstraint(int NTRK, VKVertex *vk): + VKConstraintBase(1,NTRK, VKContraintType::Phi, vk) + {m_originVertex = vk;} + VKPhiConstraint::~VKPhiConstraint()= default; + std::ostream & operator << ( std::ostream& out, const VKPhiConstraint & cnst ) + { const VKVertex * vk = cnst.getOriginVertex(); + //out.setf( std::ios::scientific); out.precision(7); out << std::endl; + out.precision(7); out << std::defaultfloat; + out << " Phi constraint (total NTRK="<<vk->TrackList.size()<<")"<< std::endl; + out<< (VKConstraintBase&)cnst <<'\n'; + out.precision(6); //restore default + return out; + } + + VKThetaConstraint::VKThetaConstraint(int NTRK, VKVertex *vk): + VKConstraintBase(1,NTRK, VKContraintType::Theta, vk) + {m_originVertex = vk;} + VKThetaConstraint::~VKThetaConstraint()= default; + std::ostream & operator << ( std::ostream& out, const VKThetaConstraint & cnst ) + { const VKVertex * vk = cnst.getOriginVertex(); + //out.setf( std::ios::scientific); out.precision(7); out << std::endl; + out.precision(7); out << std::defaultfloat; + out << " Theta constraint (total NTRK="<<vk->TrackList.size()<<")"<< std::endl; + out<< (VKConstraintBase&)cnst <<'\n'; + out.precision(6); //restore default + return out; + } +// +// Pointing constraint +// + VKPointConstraint::VKPointConstraint(int NTRK, double vrt[3], VKVertex *vk, bool onlyZ=false): + VKConstraintBase(2,NTRK, VKContraintType::Point, vk) + { m_originVertex = vk;m_targetVertex[0]=vrt[0]; m_targetVertex[1]=vrt[1]; m_targetVertex[2]=vrt[2]; + m_onlyZ=onlyZ; // For Z only constraint + } + VKPointConstraint::~VKPointConstraint()= default; + std::ostream & operator << ( std::ostream& out, const VKPointConstraint & cnst ) + { const VKVertex * vk = cnst.getOriginVertex(); + //out.setf( std::ios::scientific); out.precision(7); out << std::endl; + out.precision(7); out << std::defaultfloat; + if(!cnst.onlyZ()){ + out << " Point constraint (total NTRK="<<vk->TrackList.size()<<")"<< std::endl; + }else{ + out << " Z point constraint (total NTRK="<<vk->TrackList.size()<<")"<< std::endl; + } + out << " target vertex="<<cnst.getTargetVertex()[0]<<", " + <<cnst.getTargetVertex()[1]<<", " + <<cnst.getTargetVertex()[2]<<std::endl; + out<< (VKConstraintBase&)cnst <<'\n'; + out.precision(6); //restore default + return out; + } +// +// Vertex in plane constraint +// + VKPlaneConstraint::VKPlaneConstraint(int NTRK, double a, double b, double c, double d, VKVertex *vk): + VKConstraintBase(1,NTRK, VKContraintType::Plane, vk) + {m_A=a; m_B=b; m_C=c; m_D=d; } + VKPlaneConstraint::~VKPlaneConstraint()= default; + std::ostream & operator << ( std::ostream& out, const VKPlaneConstraint & cnst ) + { const VKVertex * vk = cnst.getOriginVertex(); + //out.setf( std::ios::scientific); out.precision(7); out << std::endl; + out.precision(7); out << std::defaultfloat; + out << " Vertex in plane constraint (total NTRK="<<vk->TrackList.size()<<")"<< std::endl; + out << " Plane(A,B,C,D):"<<cnst.getA()<<", "<<cnst.getB()<<", "<<cnst.getC()<<", "<<cnst.getD()<<std::endl; + out<< (VKConstraintBase&)cnst <<'\n'; + out.precision(6); //restore default + return out; + } + + VKConstraintBase* VKMassConstraint::clone() const{ + return new VKMassConstraint(*this); + } + VKConstraintBase* VKPhiConstraint::clone() const{ + return new VKPhiConstraint(*this); + } + VKConstraintBase* VKThetaConstraint::clone() const{ + return new VKThetaConstraint(*this); + } + VKConstraintBase* VKPointConstraint::clone() const{ + return new VKPointConstraint(*this); + } + VKConstraintBase* VKPlaneConstraint::clone() const{ + return new VKPlaneConstraint(*this); + } + + void VKMassConstraint::applyConstraint(){ calcMassConstraint(this); } + void VKPhiConstraint::applyConstraint(){ calcPhiConstraint(this); } + void VKThetaConstraint::applyConstraint(){ calcThetaConstraint(this); } + void VKPointConstraint::applyConstraint(){ calcPointConstraint(this); } + void VKPlaneConstraint::applyConstraint(){ calcPlaneConstraint(this); } +} /* End of namespace */ + + diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkCascadeFitter.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkCascadeFitter.cxx index 777654eb7bb50d826bedcfbfb024d0f438beb49a..cb96513d1f270c7031aeb9bb8dd132759c71969c 100755 --- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkCascadeFitter.cxx +++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/TrkCascadeFitter.cxx @@ -488,12 +488,18 @@ VxCascadeInfo * TrkVKalVrtFitter::fitCascade(IVKalState& istate, if(msgLvl(MSG::DEBUG)){ msg(MSG::DEBUG)<<"Initial cascade momenta"<<endmsg; for(int kv=0; kv<(int)fittedParticles.size(); kv++){ - for(int kt=0; kt<(int)fittedParticles[kv].size(); kt++)std::cout<< - " Px="<<fittedParticles[kv][kt].Px<<" Py="<<fittedParticles[kv][kt].Py<<";"; std::cout<<'\n'; } + for(int kt=0; kt<(int)fittedParticles[kv].size(); kt++) + std::cout<< + " Px="<<fittedParticles[kv][kt].Px<<" Py="<<fittedParticles[kv][kt].Py<<";"; + std::cout<<'\n'; + } msg(MSG::DEBUG)<<"Squized cascade momenta"<<endmsg; for(int kv=0; kv<(int)t_fittedParticles.size(); kv++){ - for(int kt=0; kt<(int)t_fittedParticles[kv].size(); kt++)std::cout<< - " Px="<<t_fittedParticles[kv][kt].Px<<" Py="<<t_fittedParticles[kv][kt].Py<<";"; std::cout<<'\n'; } + for(int kt=0; kt<(int)t_fittedParticles[kv].size(); kt++) + std::cout<< + " Px="<<t_fittedParticles[kv][kt].Px<<" Py="<<t_fittedParticles[kv][kt].Py<<";"; + std::cout<<'\n'; + } } for(iv=0; iv<(int)cstate.m_cascadeVList.size(); iv++){ index=getSimpleVIndex( cstate.m_cascadeVList[iv].vID, cstate ); //index of vertex in simplified structure @@ -544,8 +550,11 @@ VxCascadeInfo * TrkVKalVrtFitter::fitCascade(IVKalState& istate, if(msgLvl(MSG::DEBUG)){ msg(MSG::DEBUG)<<"Refit cascade momenta"<<endmsg; for(int kv=0; kv<(int)fittedParticles.size(); kv++){ - for(int kt=0; kt<(int)fittedParticles[kv].size(); kt++)std::cout<< - " Px="<<fittedParticles[kv][kt].Px<<" Py="<<fittedParticles[kv][kt].Py<<";"; std::cout<<'\n'; } + for(int kt=0; kt<(int)fittedParticles[kv].size(); kt++) + std::cout<< + " Px="<<fittedParticles[kv][kt].Px<<" Py="<<fittedParticles[kv][kt].Py<<";"; + std::cout<<'\n'; + } } // Covariance matrix for nonmerged vertices is updated. // For merged vertices (both IN and TO ) it's taken from old fit diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexCollectionSortingTool.h b/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexCollectionSortingTool.h index 8e69611e493b8512b6a6087afa2686be42a737aa..365688fc9729e5a27a1415ac00c87d11aba25f48 100644 --- a/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexCollectionSortingTool.h +++ b/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexCollectionSortingTool.h @@ -54,9 +54,8 @@ namespace Trk /** Interface for xAOD::VertexContainer. * A new container and auxiliary store is returned. */ - virtual std::pair<xAOD::VertexContainer*,xAOD::VertexAuxContainer*> sortVertexContainer(const xAOD::VertexContainer& MyVxCont) = 0; - - + virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> + sortVertexContainer(const xAOD::VertexContainer& MyVxCont) const = 0; }; } diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexKinematicFitter.h b/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexKinematicFitter.h deleted file mode 100644 index 8e125012ab884e38c0df3cfd3e595293652c077e..0000000000000000000000000000000000000000 --- a/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexKinematicFitter.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TrkVertexFitterInterfaces_IVertexKinematicFitter_h -#define TrkVertexFitterInterfaces_IVertexKinematicFitter_h - -//#include "TrkVertexFitterInterfaces/IVertexFitter.h" -#include "TrkVertexFitterInterfaces/IKinematicConstraint.h" -#include "GaudiKernel/IAlgTool.h" - -/** - * @class IVertexKinematicFitter - * - * A simple abstract interface for vertex fitters with - * arbitrary additional constraints. It is assumed that the - * constraints equations are added to the fit using the - * Lagrange multipliers method. - * - * @author Kirill.Prokofiev@cern.ch - * March 2008 - */ - -static const InterfaceID IID_IVertexKinematicFitter("Trk::IVertexKinematicFitter", 1, 0); -namespace Trk -{ - - - class KinematicParticle; - class KinematicVertex; - class Vertex; - - class IVertexKinematicFitter: virtual public IAlgTool - { - - public: - - static const InterfaceID& interfaceID(){return IID_IVertexKinematicFitter;} - /** - * Virtual destructor - */ - virtual ~IVertexKinematicFitter(){}; - - - /** - * A vertex fit from a set of kinematic particles, no constraint - */ - virtual KinematicVertex * fit(const std::vector<const Trk::KinematicParticle*>& particleList) = 0; - - - /** - * A vertex fit from a set of kinematic particles with additional constraints - */ - virtual KinematicVertex * fit(const std::vector<const Trk::KinematicParticle*>& particleList, - const std::vector<const Trk::IKinematicConstraint *>& constraintList) = 0; - - - /** - * A vertex fit from a set of kinematic particles with additional constraints and - * starting point. - */ - virtual KinematicVertex * fit(const std::vector<const Trk::KinematicParticle*>& particleList, - const std::vector<const Trk::IKinematicConstraint *>& constraintList, - const Vertex& startingPoint) = 0; - - /** validation/monitoring method: tell history of chi2 during iterations, size gives # of iterations */ - virtual const std::vector<double>& chisquaredConvergenceOfLastFit() const=0; - /** validation/monitoring method: tell history of old-to-new position distances during iterations */ - virtual const std::vector<double>& positionConvergenceOfLastFit() const=0; - - private: - - - }; //end of class definitions -}//end of namespace definitions - -#endif //TrkVertexFitterInterfaces_IVertexKinematicFitter diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexMergingTool.h b/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexMergingTool.h index 83004776a9cdfa29d8a448c3028008f2d834feaa..9a03236d78ae49fafcc557a88536f8c5ce18437e 100644 --- a/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexMergingTool.h +++ b/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexMergingTool.h @@ -49,7 +49,8 @@ namespace Trk static const InterfaceID& interfaceID() { return IID_IVertexMergingTool; }; /** Interface for xAOD vertices **/ - virtual std::pair<xAOD::VertexContainer*,xAOD::VertexAuxContainer*> mergeVertexContainer(const xAOD::VertexContainer& MyVxCont) = 0; + virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> + mergeVertexContainer(const xAOD::VertexContainer& MyVxCont) const = 0; }; } diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexStoringTool.h b/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexStoringTool.h deleted file mode 100644 index ff6528258fc0c789ee611d3d49a13940e8d3c86d..0000000000000000000000000000000000000000 --- a/Tracking/TrkVertexFitter/TrkVertexFitterInterfaces/TrkVertexFitterInterfaces/IVertexStoringTool.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// IVertexStoringTool.h, (c) ATLAS Detector software 2016 -/////////////////////////////////////////////////////////////////// - -#ifndef TRK_IVERTEXSTORINGTOOL_H -#define TRK_IVERTEXSTORINGTOOL_H - -#include "GaudiKernel/IAlgTool.h" - -//xAOD includes -#include "xAODTracking/VertexFwd.h" -#include "xAODTracking/VertexContainerFwd.h" -#include "xAODTracking/VertexAuxContainer.h" - -namespace Trk -{ - - static const InterfaceID IID_IVertexStoringTool("IVertexStoringTool", 1, 0); - - /** - @class IVertexStoringTool - @brief Interface class for storing vertices in a named xAOD::VertexContainer in StoreGate. - - A given instance of this tool manages a single, named VertexContainer in the event store. - - Caller must check validity of returned ElementLink. - */ - - class IVertexStoringTool : virtual public IAlgTool { - - public: - /** Virtual destructor */ - virtual ~IVertexStoringTool(){}; - - /** AlgTool interface methods */ - static const InterfaceID& interfaceID() { return IID_IVertexStoringTool; }; - - /** Interface for null (caller can set properties using pointer returned) */ - virtual xAOD::Vertex* storeVertex() = 0; - - /** Interface for xAOD::Vertex */ - virtual xAOD::Vertex* storeVertex(const xAOD::Vertex& myVertex) = 0; - - /** Interface for 3-vector **/ - virtual xAOD::Vertex* storeVertex(const Amg::Vector3D& myVector) = 0; - - /** Interface for 3-vector and covariance matrix **/ - virtual xAOD::Vertex* storeVertex(const Amg::Vector3D& myVector, const AmgSymMatrix(3)& myMatrix) = 0; - - }; -} - -#endif diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/Chi2TrackCompatibilityEstimator.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/Chi2TrackCompatibilityEstimator.cxx index 39179aea82ffb8e6fa931c76e3cf933c4ecdc5b2..a6e6ce66e65e1018c7c59d330162ed8132b1b573 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/Chi2TrackCompatibilityEstimator.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/Chi2TrackCompatibilityEstimator.cxx @@ -15,7 +15,7 @@ #include "TrkEventPrimitives/ParamDefs.h" #include "TrkParametersBase/ParametersBase.h" -#include <math.h> +#include <cmath> namespace Trk { @@ -114,13 +114,13 @@ namespace Trk { const Trk::AtaPlane * myAtaPlane=vtxTrack.ImpactPoint3dAtaPlane(); - if (myAtaPlane!=0 && myAtaPlane->covariance()!=0) //Looking for a AtaPlane object (track) + if (myAtaPlane!=nullptr && myAtaPlane->covariance()!=nullptr) //Looking for a AtaPlane object (track) return _compatibility(myAtaPlane, vertex); - else { //looking for a NeutralAtaPlane object (neutral) + //looking for a NeutralAtaPlane object (neutral) const Trk::NeutralAtaPlane * myNeutralAtaPlane=vtxTrack.ImpactPoint3dNeutralAtaPlane(); - if (myNeutralAtaPlane!=0 && myNeutralAtaPlane->covariance()!=0) + if (myNeutralAtaPlane!=nullptr && myNeutralAtaPlane->covariance()!=nullptr) return _compatibility(myNeutralAtaPlane, vertex); - } + ATH_MSG_WARNING( " No compatibility plane attached to the VxTrackAtVertex. Compatibility couldn't be found... 0 compatibility returned." ); return 100; diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/DetAnnealingMaker.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/DetAnnealingMaker.cxx index 6fd4c87ac77d4f1446821666a271010270d3a7dd..c0fb77879ea2553389dee2e3643334de404414c4 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/DetAnnealingMaker.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/DetAnnealingMaker.cxx @@ -7,7 +7,7 @@ *********************************************************************/ #include "TrkVertexFitterUtils/DetAnnealingMaker.h" -#include <math.h> +#include <cmath> namespace { double gauss(const double value2, const double error2) { @@ -49,7 +49,7 @@ namespace Trk void DetAnnealingMaker::anneal(AnnealingState& state) const { //check if there are some temperatures - if (m_SetOfTemperatures.size()==0) + if (m_SetOfTemperatures.empty()) { ATH_MSG_ERROR( "The vector SetOfTemperatures for the annealing is empty" ); } diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/FullLinearizedTrackFactory.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/FullLinearizedTrackFactory.cxx index 5bb223ae36a0d1476ce12cae375b3d55136042ab..0260e27e35aa0a34192458bd4ceaff6711c9f6d6 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/FullLinearizedTrackFactory.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/FullLinearizedTrackFactory.cxx @@ -29,7 +29,7 @@ namespace Trk declareInterface<IVertexLinearizedTrackFactory>(this); } - FullLinearizedTrackFactory::~FullLinearizedTrackFactory() {} + FullLinearizedTrackFactory::~FullLinearizedTrackFactory() = default; StatusCode FullLinearizedTrackFactory::initialize() { @@ -57,7 +57,7 @@ namespace Trk LinearizedTrack * FullLinearizedTrackFactory::linearizedTrack(const TrackParameters * trackPars, const Amg::Vector3D& linPoint) const { - if (!trackPars) return NULL; + if (!trackPars) return nullptr; //perigee surface Amg::Vector3D lp =linPoint; const PerigeeSurface perigeeSurface(lp); @@ -77,8 +77,8 @@ namespace Trk const TrackParameters* parsAtVertex = m_extrapolator->extrapolate(*trackPars, perigeeSurface, Trk::anyDirection, true, Trk::pion, mode); - if (dynamic_cast<const Trk::Perigee*>(parsAtVertex)==0 || - parsAtVertex->covariance()==0 ) { + if (dynamic_cast<const Trk::Perigee*>(parsAtVertex)==nullptr || + parsAtVertex->covariance()==nullptr ) { ATH_MSG_INFO ("Could not extrapolate Perigee to vertex pos: x " << lp.x() << " y " << lp.y() << " z " << lp.z() << ". Normal if outside ID acceptance "); @@ -86,7 +86,7 @@ namespace Trk if (parsAtVertex) delete parsAtVertex; // in case extrapolation made other parameters parsAtVertex = trackPars->clone(); } else { - delete parsAtVertex; return 0; + delete parsAtVertex; return nullptr; } } @@ -235,7 +235,7 @@ namespace Trk LinearizedTrack * FullLinearizedTrackFactory::linearizedTrack(const NeutralParameters * neutralPars, const Amg::Vector3D& linPoint) const { - if (!neutralPars) return NULL; + if (!neutralPars) return nullptr; Amg::Vector3D lp =linPoint; PerigeeSurface perigeeSurface(lp); @@ -251,8 +251,8 @@ namespace Trk const NeutralParameters* parsAtVertex = m_extrapolator->extrapolate(*neutralPars, perigeeSurface, Trk::anyDirection, true); - if (dynamic_cast<const Trk::NeutralPerigee*>(parsAtVertex)==0 || - parsAtVertex->covariance()==0 ) { + if (dynamic_cast<const Trk::NeutralPerigee*>(parsAtVertex)==nullptr || + parsAtVertex->covariance()==nullptr ) { ATH_MSG_INFO ("Could not extrapolate Perigee to vertex pos: x " << lp.x() << " y " << lp.y() << " z " << lp.z() << ". Should not happen. "); @@ -260,7 +260,7 @@ namespace Trk if (parsAtVertex) delete parsAtVertex; // in case extrapolation made other parameters parsAtVertex = neutralPars->clone(); } else { - delete parsAtVertex; return 0; + delete parsAtVertex; return nullptr; } } diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.cxx index 31cedce0d3a5d825079997c8081c3c5fbc916f55..0066b9979b755fdac3c708d6d52daf4078478533 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.cxx @@ -35,8 +35,7 @@ namespace Trk declareProperty("Precision",m_precision); } - ImpactPoint3dEstimator::~ImpactPoint3dEstimator() { - } + ImpactPoint3dEstimator::~ImpactPoint3dEstimator() = default; StatusCode ImpactPoint3dEstimator::initialize() { @@ -129,7 +128,7 @@ namespace Trk const Trk::Perigee* thePerigee=dynamic_cast<const Trk::Perigee*>(trackPerigee); - if (thePerigee==0) + if (thePerigee==nullptr) { ATH_MSG_DEBUG( " ImpactPoint3dEstimator didn't get a Perigee* as ParametersBase*: cast not possible. Need to EXTRAPOLATE..."); @@ -143,7 +142,7 @@ namespace Trk Trk::PerigeeSurface perigeeSurface(*theVertex); thePerigee=dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolateDirectly(*trackPerigee, perigeeSurface)); - if (thePerigee == NULL) return 0; + if (thePerigee == nullptr) return nullptr; } ATH_MSG_VERBOSE( " Now running ImpactPoint3dEstimator::Estimate3dIP" ); @@ -164,7 +163,7 @@ namespace Trk if (thePerigee!=trackPerigee) { delete thePerigee; - thePerigee=0; + thePerigee=nullptr; } double xc=theVertex->x(); @@ -236,7 +235,7 @@ namespace Trk isok=true; } - } while (isok==false); + } while (!isok); //now you have to construct the plane with PlaneSurface //first vector at 3d impact point @@ -321,11 +320,11 @@ namespace Trk catch (error::ImpactPoint3dEstimatorProblem err) { ATH_MSG_WARNING( " ImpactPoint3dEstimator failed to find minimum distance between track and vertex seed: " << err.p ); - return 0; + return nullptr; } if(!theSurfaceAtIP){ ATH_MSG_WARNING( " ImpactPoint3dEstimator failed to find minimum distance and returned 0 " ); - return 0; + return nullptr; } #ifdef ImpactPoint3dAtaPlaneFactory_DEBUG ATH_MSG_VERBOSE( "Original perigee was: " << *(vtxTrack.initialPerigee()) ); @@ -350,7 +349,7 @@ namespace Trk catch (error::ImpactPoint3dEstimatorProblem err) { ATH_MSG_WARNING( " ImpactPoint3dEstimator failed to find minimum distance between track and vertex seed: " << err.p ); - return 0; + return nullptr; } if(!theSurfaceAtIP) ATH_MSG_WARNING( " ImpactPoint3dEstimator failed to find minimum distance and returned 0 " ); diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/KalmanVertexTrackUpdator.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/KalmanVertexTrackUpdator.cxx index d6496578bdf456b31eb1ba3d83b50253e8b4041e..92e066272cdef4ec52106c18cd98b29b6d28b754 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/KalmanVertexTrackUpdator.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/KalmanVertexTrackUpdator.cxx @@ -17,9 +17,9 @@ namespace Trk { ATH_MSG_FATAL("Failed to retrieve tool " << m_Updator); return StatusCode::FAILURE; - } else { + } ATH_MSG_INFO("Retrieved tool " << m_Updator); - } + return StatusCode::SUCCESS; } @@ -42,7 +42,7 @@ namespace Trk } KalmanVertexTrackUpdator::~KalmanVertexTrackUpdator() - {} + = default; void KalmanVertexTrackUpdator::update(VxTrackAtVertex& trk, const xAOD::Vertex& vtx) const { @@ -50,7 +50,7 @@ namespace Trk Trk::LinearizedTrack * linTrack = trk.linState(); //protection check - if(linTrack == 0) + if(linTrack == nullptr) { if(trk.weight() > m_maxWeight) { diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/KalmanVertexUpdator.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/KalmanVertexUpdator.cxx index c67034a95537c43c9e627c8b4718e37816ca539b..b00a39fe9b2d92bf3b88bc5829cd2cb1f3e1f211 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/KalmanVertexUpdator.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/KalmanVertexUpdator.cxx @@ -18,7 +18,7 @@ namespace Trk{ } KalmanVertexUpdator::~KalmanVertexUpdator() - {} + = default; StatusCode KalmanVertexUpdator::initialize() { @@ -72,10 +72,10 @@ namespace Trk{ return &vtx; } // addition - here this is expected behaviour - else{ + righttrack = tracksAtVertex.insert(tracksAtVertex.end(),trk); ATH_MSG_VERBOSE ("Updating vertex with new track which is still not attached to vertex. Adding it before updating..."); - } + } //all safe, call the position update @@ -177,7 +177,7 @@ namespace Trk{ AmgSymMatrix(3) Sm = B.transpose()*(trkParametersWeight*B); Sm = Sm.inverse().eval(); - AmgVector(5) theResidual = trk->constantTerm(); + const AmgVector(5)& theResidual = trk->constantTerm(); //refitted track momentum Amg::Vector3D newTrackMomentum = Sm*B.transpose()*trkParametersWeight*(trkParameters - theResidual - A*new_position); diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/NeutralParticleParameterCalculator.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/NeutralParticleParameterCalculator.cxx index 265f60a892f10a7783b956d1e55ad49a97032cc3..5616c970351a6d732019e389738a9cc98dd8c808 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/NeutralParticleParameterCalculator.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/NeutralParticleParameterCalculator.cxx @@ -30,8 +30,7 @@ namespace Trk declareInterface<INeutralParticleParameterCalculator>(this); } - NeutralParticleParameterCalculator::~NeutralParticleParameterCalculator() { - } + NeutralParticleParameterCalculator::~NeutralParticleParameterCalculator() = default; StatusCode NeutralParticleParameterCalculator::initialize() { @@ -63,13 +62,13 @@ namespace Trk if (myVertex.nTrackParticles()!=2) { msg(MSG::WARNING) << " More or less than 2 tracks in Vertex. No Neutral Perigee could be created" << endmsg; - return 0; + return nullptr; } if ( !myVertex.trackParticleLinks()[0].isValid() || !myVertex.trackParticleLinks()[1].isValid() ) { msg(MSG::WARNING) << " Track Particle Element link is not valid" << endmsg; - return 0; + return nullptr; } const xAOD::TrackParticle * myFirstTrack= myVertex.trackParticle( 0 ); @@ -78,7 +77,7 @@ namespace Trk const Trk::Perigee& myFirstPerigee = myFirstTrack->perigeeParameters(); const Trk::Perigee& mySecondPerigee = mySecondTrack->perigeeParameters(); - AmgMatrix(3,3) vrt_cov = myVertex.covariancePosition(); + const AmgMatrix(3,3)& vrt_cov = myVertex.covariancePosition(); AmgMatrix(3,3) vrt_weight = myVertex.covariancePosition().inverse().eval(); //need to recalculate the refitted covariance matrix of the tracks (yes, we don't have it yet) @@ -87,9 +86,9 @@ namespace Trk //check if the linearizedTrackFactory is available... - if (m_linearizedTrackFactoryIsAvailable==false) { + if (!m_linearizedTrackFactoryIsAvailable) { msg(MSG::ERROR) << " No LinearizedTrackFactory is defined and no ExtendedVxCandidate is provided. Cannot obtain covariance matrix of neutral particle. Failed... " << endmsg; - return 0; + return nullptr; } @@ -98,12 +97,12 @@ namespace Trk const Trk::LinearizedTrack * myFirstLinearizedTrack = m_LinearizedTrackFactory->linearizedTrack(&myFirstPerigee, myVertex.position() ); const Trk::LinearizedTrack * mySecondLinearizedTrack= m_LinearizedTrackFactory->linearizedTrack(&mySecondPerigee, myVertex.position() ); - if (myFirstLinearizedTrack==0||mySecondLinearizedTrack==0) + if (myFirstLinearizedTrack==nullptr||mySecondLinearizedTrack==nullptr) { msg(MSG::WARNING) << " Could not find one of the linearized tracks. No Neutral Perigee could be created" << endmsg; if (myFirstLinearizedTrack) delete myFirstLinearizedTrack; if (mySecondLinearizedTrack) delete mySecondLinearizedTrack; - return 0; + return nullptr; } PosMomAndMomCovFirstTrack=getPosMomentumAndMomentumCovMatrix(myFirstLinearizedTrack, @@ -118,7 +117,7 @@ namespace Trk delete mySecondLinearizedTrack; } else { msg(MSG::WARNING) << " getPosMomentumAndMomentumCovMatrix method failed " << endmsg; - return 0; + return nullptr; } const AmgVector(5) & myFirstPerigeeParameters=myFirstPerigee.parameters(); diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/TrackToVertexIPEstimator.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/TrackToVertexIPEstimator.cxx index 91f33482cd520edd54ae62e8677f9a701c2b8baf..6d916c4897ad0160ff19b5cb6be6998b67868138 100644 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/TrackToVertexIPEstimator.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/TrackToVertexIPEstimator.cxx @@ -30,7 +30,7 @@ namespace Trk declareInterface<ITrackToVertexIPEstimator>(this); } - TrackToVertexIPEstimator::~TrackToVertexIPEstimator(){} + TrackToVertexIPEstimator::~TrackToVertexIPEstimator()= default; StatusCode TrackToVertexIPEstimator::initialize() { @@ -41,27 +41,27 @@ namespace Trk { msg(MSG::FATAL) << "Failed to retrieve tool " << m_extrapolator << endmsg; return StatusCode::FAILURE; - } else { + } msg(MSG::INFO) << "Retrieved tool " << m_extrapolator << endmsg; - } + //updator if ( m_Updator.retrieve().isFailure() ) { msg(MSG::FATAL) << "Failed to retrieve tool " << m_Updator << endmsg; return StatusCode::FAILURE; - } else { + } msg(MSG::INFO) << "Retrieved tool " << m_Updator << endmsg; - } + //linearized track factory if ( m_linFactory.retrieve().isFailure() ) { msg(MSG::FATAL) << "Failed to retrieve tool " << m_linFactory << endmsg; return StatusCode::FAILURE; - } else { + } msg(MSG::INFO) << "Retrieved tool " << m_linFactory << endmsg; - } + return StatusCode::SUCCESS; }//end of initialize method @@ -77,10 +77,10 @@ namespace Trk if(track && vtx) { return estimate(&(track->perigeeParameters()),&(track->perigeeParameters()),vtx,doRemoval); - }else{ + } msg(MSG::INFO) << "Empty TrackParticle or Vertex pointer passed. Returning zero " << endmsg; - return 0; - }//end of track particle validity check + return nullptr; + //end of track particle validity check }//end of method using track particles const ImpactParametersAndSigma * TrackToVertexIPEstimator::estimate(const xAOD::TrackParticle * track, const xAOD::TrackParticle * newtrack, const xAOD::Vertex * vtx, bool doRemoval) const @@ -88,10 +88,10 @@ namespace Trk if(track && vtx) { return estimate(&(track->perigeeParameters()),&(newtrack->perigeeParameters()),vtx,doRemoval); - }else{ + } msg(MSG::INFO) << "Empty TrackParticle or Vertex pointer passed. Returning zero " << endmsg; - return 0; - }//end of track particle validity check + return nullptr; + //end of track particle validity check }//end of method using track particles @@ -101,29 +101,29 @@ namespace Trk { if(track && vtx){ return estimate(track,track,vtx,doRemoval); - }else{ + } msg(MSG::INFO) << "Empty TrackParticle or Vertex pointer passed. Returning zero " << endmsg; - return 0; - }//end of track particle validity check + return nullptr; + //end of track particle validity check }//end of parameterBase estimate method const ImpactParametersAndSigma * TrackToVertexIPEstimator::estimate(const TrackParameters * track, const TrackParameters * newtrack, const xAOD::Vertex * vtx, bool doRemoval) const { - if (vtx==0) + if (vtx==nullptr) { ATH_MSG_WARNING("Vertex is zero pointer. Will not estimate IP of track."); - return 0; + return nullptr; } const xAOD::Vertex *newVertex = vtx; if (doRemoval) { newVertex = getUnbiasedVertex(track,vtx); - if (newVertex == 0) { + if (newVertex == nullptr) { ATH_MSG_WARNING("Unbiasing of vertex failed. Will not estimate IP of track."); - return 0; + return nullptr; } } @@ -132,7 +132,7 @@ namespace Trk if (doRemoval) { delete newVertex; - newVertex=0; + newVertex=nullptr; } return IPandSigma; @@ -231,10 +231,10 @@ namespace Trk delete extrapolatedParameters; return newIPandSigma; - } else { + } ATH_MSG_DEBUG ("Cannot extrapolate the trajectory state. Returning null. "); - return 0; - }//end of successfull extrapolation check + return nullptr; + //end of successfull extrapolation check }//end of actual calculation method @@ -361,21 +361,21 @@ const xAOD::Vertex * TrackToVertexIPEstimator::getUnbiasedVertex(const xAOD::Tra if(track) { return getUnbiasedVertex(&(track->perigeeParameters()),vtx); - }else{ + } msg(MSG::INFO) << "Empty xAOD::TrackParticle pointer passed. Returning zero " << endmsg; - return 0; - }//end of track particle validity check + return nullptr; + //end of track particle validity check } const xAOD::Vertex * TrackToVertexIPEstimator::getUnbiasedVertex(const TrackParameters * track, const xAOD::Vertex * vtx ) const { if (!track) { msg(MSG::INFO) << "Empty Trk::TrackParameter pointer passed. Returning zero " << endmsg; - return 0; + return nullptr; } if (!vtx) { msg(MSG::INFO) << "Empty xAOD::Vertex pointer passed. Returning zero " << endmsg; - return 0; + return nullptr; } if (vtx->nTrackParticles() == 0) @@ -398,7 +398,7 @@ const xAOD::Vertex * TrackToVertexIPEstimator::getUnbiasedVertex(const TrackPara const Perigee& testTP = vtx->trackParticle(itrk)->perigeeParameters(); if ((testTP.position() == pos) and (testTP.momentum() == mom)) { //track found, now unbias the vertex using linearized track - const LinearizedTrack *linTrack = 0; + const LinearizedTrack *linTrack = nullptr; double trackWeight(0.0); //first check if a VxTrackAtVertex is already available with linearized track if (vtx->vxTrackAtVertexAvailable()) { @@ -419,7 +419,7 @@ const xAOD::Vertex * TrackToVertexIPEstimator::getUnbiasedVertex(const TrackPara } continue; } - else tmpLinTrack = true; + tmpLinTrack = true; } //now update vertex position removing the linearized track, and do not add the track back to the output vertex const IVertexUpdator::positionUpdateOutcome & reducedVertex = m_Updator->positionUpdate(*vtx, linTrack, trackWeight,IVertexUpdator::removeTrack); @@ -462,7 +462,7 @@ const xAOD::Vertex * TrackToVertexIPEstimator::getUnbiasedVertex(const TrackPara if(track && vtx ){ return estimate( &(track->perigeeParameters()), vtx); } - return 0; + return nullptr; } @@ -473,7 +473,7 @@ const xAOD::Vertex * TrackToVertexIPEstimator::getUnbiasedVertex(const TrackPara if(track && vtx ){ return calculate( track , *vtx); } - return 0; + return nullptr; } diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/Z0PVTrackComaptibilityEstimator.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/Z0PVTrackComaptibilityEstimator.cxx index 80ed2e9da2b0bdf66a0620945cf60221aa8a57ed..055aaeed3b05d28ccfb2c411d4241d450e6fd2cd 100644 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/Z0PVTrackComaptibilityEstimator.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/Z0PVTrackComaptibilityEstimator.cxx @@ -29,7 +29,7 @@ namespace Trk{ declareProperty("Z0SignificanceMax", m_z0SignificanceMax); } - Z0PVTrackCompatibilityEstimator::~Z0PVTrackCompatibilityEstimator(){} + Z0PVTrackCompatibilityEstimator::~Z0PVTrackCompatibilityEstimator()= default; StatusCode Z0PVTrackCompatibilityEstimator::initialize(){ diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/test/ImpactPoint3dEstimator_test.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/test/ImpactPoint3dEstimator_test.cxx index c74dc2b01b3b4c045a3b9b97f374b51c01a6501c..a840d7c9b9912b44375489f631b979bbbb82c561 100644 --- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/test/ImpactPoint3dEstimator_test.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/test/ImpactPoint3dEstimator_test.cxx @@ -114,7 +114,7 @@ void test1 (Trk::IImpactPoint3dEstimator& tool) // not tested here. } -std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string& mapFile, double sol_current, double tor_current) { // find the path to the map file std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); assert ( !resolvedMapFile.empty() ); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/IMode3dFinder.h b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/IMode3dFinder.h index 7dd2e2926afb901a5bf9c5bf0a49d2289d4019b6..b660cfdab5c363ce749e98b81373bc0c138f6f4e 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/IMode3dFinder.h +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/IMode3dFinder.h @@ -60,7 +60,7 @@ namespace Trk * @param vy Primary vertex y-coordinate. * @param points List of points with weights. */ - virtual const Amg::Vector3D + virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector<Trk::PositionAndWeight> &) const = 0; @@ -76,7 +76,7 @@ namespace Trk * additional information. May be left null if additional * information is not available. */ - virtual const Amg::Vector3D + virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector<Trk::PositionAndWeight>& points, @@ -90,7 +90,7 @@ namespace Trk * @param vy Primary vertex y-coordinate. * @param points List of points --- unweighted! */ - virtual const Amg::Vector3D + virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector<Amg::Vector3D>& points) const = 0; @@ -106,7 +106,7 @@ namespace Trk * additional information. May be left null if additional * information is not available. */ - virtual const Amg::Vector3D + virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector<Amg::Vector3D>& points, diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Mode3dFromFsmw1dFinder.h b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Mode3dFromFsmw1dFinder.h index 65178f88a13661c4283e709f9433cf4e42421141..8ccaaa87280e6ae073a25f89701863788ddb86e1 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Mode3dFromFsmw1dFinder.h +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Mode3dFromFsmw1dFinder.h @@ -48,7 +48,7 @@ namespace Trk * @param vy Primary vertex y-coordinate. * @param points List of points with weights. */ - virtual const Amg::Vector3D + virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector<Trk::PositionAndWeight>& points) const override; @@ -64,7 +64,7 @@ namespace Trk * additional information. May be left null if additional * information is not available. */ - virtual const Amg::Vector3D + virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector<Trk::PositionAndWeight>& points, @@ -78,7 +78,7 @@ namespace Trk * @param vy Primary vertex y-coordinate. * @param points List of points --- unweighted! */ - virtual const Amg::Vector3D + virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector<Amg::Vector3D>& points) const override; @@ -94,7 +94,7 @@ namespace Trk * additional information. May be left null if additional * information is not available. */ - virtual const Amg::Vector3D + virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector<Amg::Vector3D>& points, @@ -106,7 +106,7 @@ namespace Trk class Mode3dFromFsmw1dInfo; - const Amg::Vector3D + Amg::Vector3D getMode(Mode3dFromFsmw1dInfo& info, const double vx, const double vy, @@ -156,25 +156,25 @@ namespace Trk getFsmw1dMode( std::vector<IndexedWeighted> &, int ) const ; - const Amg::Vector3D + Amg::Vector3D getClosestPair (Mode3dFromFsmw1dInfo& info, const std::vector<Trk::PositionAndWeight>& vectorOfPoints, const double vx, const double vy) const; - const Amg::Vector3D + Amg::Vector3D Mode2Seed( Mode3dFromFsmw1dInfo& info, const std::vector<Trk::PositionAndWeight>& vectorOfPoints, const VeVecIndices & ) const; - const Amg::Vector3D + Amg::Vector3D Mode2Seed( Mode3dFromFsmw1dInfo& info, const std::vector<Trk::PositionAndWeight>& vectorOfPoints, const VeVecIndices &, const VeVecIndices & ) const; - const Amg::Vector3D + Amg::Vector3D Mode2Seed( Mode3dFromFsmw1dInfo& info, const std::vector<Trk::PositionAndWeight>& vectorOfPoints, const VeVecIndices &, const VeVecIndices &, const VeVecIndices & ) const; diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Mode3dTo1dFinder.h b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Mode3dTo1dFinder.h index 8fc7def1d7cedda9ed479eae22acadd8a46eae97..9850153e76d13ea023b82401c599fbb395fd1d99 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Mode3dTo1dFinder.h +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Mode3dTo1dFinder.h @@ -49,7 +49,7 @@ namespace Trk * @param vy Primary vertex y-coordinate. * @param points List of points with weights. */ - virtual const Amg::Vector3D + virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector<Trk::PositionAndWeight>& points) const override; @@ -65,7 +65,7 @@ namespace Trk * additional information. May be left null if additional * information is not available. */ - virtual const Amg::Vector3D + virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector<Trk::PositionAndWeight>& points, @@ -79,7 +79,7 @@ namespace Trk * @param vy Primary vertex y-coordinate. * @param points List of points --- unweighted! */ - virtual const Amg::Vector3D + virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector<Amg::Vector3D>& points) const override; @@ -95,7 +95,7 @@ namespace Trk * additional information. May be left null if additional * information is not available. */ - virtual const Amg::Vector3D + virtual Amg::Vector3D getMode (const double vx, const double vy, const std::vector<Amg::Vector3D>& points, diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder.h b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder.h index 2826134d4ca83f1944a798edc1d72488d1f79bba..7ae75723a82c354954d78b5d26891aba25749b45 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder.h +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder.h @@ -53,7 +53,7 @@ namespace Trk return GetClosestPoints(PointOnTrack(a),PointOnTrack(b)); } - const TwoPoints GetClosestPoints(const PointOnTrack &, const PointOnTrack &) const; + TwoPoints GetClosestPoints(const PointOnTrack &, const PointOnTrack &) const; const TwoPoints GetClosestPoints(const TwoTracks & twotracks) const { return GetClosestPoints(twotracks.getFirstPerigee(),twotracks.getSecondPerigee()); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h index fdcd923f5418208d91f117c532eacad524dab69a..f3933da0d6c6ebee958ea55859fb157d57e70d11 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h @@ -52,7 +52,7 @@ namespace Trk virtual StatusCode initialize() override; virtual StatusCode finalize() override; - const TwoPointOnTrack GetSeed (const TwoTracks& mytracks, + TwoPointOnTrack GetSeed (const TwoTracks& mytracks, TwoPoints* twopoints = nullptr) const; diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/FsmwMode1dFinder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/FsmwMode1dFinder.cxx index fc125292c0c2da28d773d7670ec11883c66f3177..70338b49de7d0e86af05705279bb9c825ce31099 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/FsmwMode1dFinder.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/FsmwMode1dFinder.cxx @@ -26,7 +26,7 @@ namespace Trk declareInterface<IMode1dFinder>(this); } - FsmwMode1dFinder::~FsmwMode1dFinder() {} + FsmwMode1dFinder::~FsmwMode1dFinder() = default; StatusCode FsmwMode1dFinder::initialize() { @@ -48,7 +48,7 @@ namespace Trk double FsmwMode1dFinder::getMode(std::vector<DoubleAndWeight> DoubleAndWeights) const { - if(DoubleAndWeights.size() == 0) return 0.; + if(DoubleAndWeights.empty()) return 0.; if(DoubleAndWeights.size() == 1) return DoubleAndWeights.begin()->first; #ifdef FSMWMODE1DFINDER_DEBUG diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/GaussianDensityTestAlg.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/GaussianDensityTestAlg.cxx index 72009b197ec2f3b2a8a3e93d54c51f2cde770fe9..e20760d1ce3da2b2fe8f93903f68f09416626f75 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/GaussianDensityTestAlg.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/GaussianDensityTestAlg.cxx @@ -43,7 +43,7 @@ GaussianDensityTestAlg::GaussianDensityTestAlg( const std::string& name, // Destructor /////////////// GaussianDensityTestAlg::~GaussianDensityTestAlg() -{} += default; // Athena Algorithm's Hooks //////////////////////////// @@ -202,7 +202,7 @@ GaussianDensityTestAlg::findTruth(double mode, { auto assocParticle = truthParticleAssoc(**(*lxtp)); ATH_MSG_VERBOSE("Found associated truth particle"); - for (auto truthParticle : evt->truthParticleLinks()) + for (const auto& truthParticle : evt->truthParticleLinks()) { if (!truthParticle.isValid()) continue; if (assocParticle == truthParticle) @@ -265,7 +265,7 @@ GaussianDensityTestAlg::findTruth(double mode, { auto assocParticle = truthParticleAssoc(**(*lxtp)); ATH_MSG_VERBOSE("Found associated truth particle"); - for (auto truthParticle : evt->truthParticleLinks()) + for (const auto& truthParticle : evt->truthParticleLinks()) { if (!truthParticle.isValid()) continue; if (assocParticle == truthParticle) diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.cxx index ad54009b7968786cf955f5090c78a1f662dc576b..475120b0317f657c6375dd5cb5af5fc0a03ae43a 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.cxx @@ -48,7 +48,7 @@ ImagingSeedTuningAlg::ImagingSeedTuningAlg( const std::string& name, m_seedFinder("Trk::ImagingSeedFinder"), m_impactPoint3dEstimator("Trk::ImpactPoint3dEstimator"), m_iTHistSvc("THistSvc", name), - m_h_nTruthVertices(NULL), m_h_zTruthVertices(NULL), m_t_seeds(NULL), + m_h_nTruthVertices(nullptr), m_h_zTruthVertices(nullptr), m_t_seeds(nullptr), m_b_nTruth(0), m_b_nConditions(0), m_iCondition(0) { // @@ -72,7 +72,7 @@ ImagingSeedTuningAlg::ImagingSeedTuningAlg( const std::string& name, // Destructor /////////////// ImagingSeedTuningAlg::~ImagingSeedTuningAlg() -{} += default; // Athena Algorithm's Hooks //////////////////////////// @@ -181,7 +181,7 @@ StatusCode ImagingSeedTuningAlg::finalize() float efficiency = ((float)(nAllTruth - nLost - nMerge))/((float)nAllTruth); float purity = ((float)(nAllSeeds - nFake - nSplit))/((float)nAllSeeds); std::pair<float,float> p(efficiency, purity); - performance.push_back(performance_entry(desc, p)); + performance.emplace_back(desc, p); } std::sort(performance.begin(), performance.end(), [](const performance_entry& a, const performance_entry& b) {return a.second.first*a.second.second > b.second.first*b.second.second;}); @@ -351,7 +351,7 @@ StatusCode ImagingSeedTuningAlg::setupConditions(std::string& conditions) return StatusCode::SUCCESS; } -void ImagingSeedTuningAlg::analyzeSeeds(std::string conditions, +void ImagingSeedTuningAlg::analyzeSeeds(const std::string& conditions, const std::vector<Amg::Vector3D>& seeds, const std::vector<Amg::Vector3D>& truth) { @@ -526,7 +526,7 @@ StatusCode ImagingSeedTuningAlg::findTruth(const std::vector<Trk::ITrackLink*>& if (isAssoc) { auto assocParticle = truthParticleAssoc(**(*lxtp)); - for (auto truthParticle : evt->truthParticleLinks()) + for (const auto& truthParticle : evt->truthParticleLinks()) { if (assocParticle == truthParticle) { @@ -559,7 +559,7 @@ StatusCode ImagingSeedTuningAlg::findTruth(const std::vector<Trk::ITrackLink*>& if (isAssoc) { auto assocParticle = truthParticleAssoc(**(*lxtp)); - for (auto truthParticle : evt->truthParticleLinks()) + for (const auto& truthParticle : evt->truthParticleLinks()) { if (assocParticle == truthParticle) { diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.h b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.h index 34af7a7b7c93c16948f9daa699ab18d5afd23c18..c812dd8b933ef97215b277a7345446d3e67b2c08 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.h +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.h @@ -92,7 +92,7 @@ class ImagingSeedTuningAlg void analyzeTracks(const std::vector<Trk::ITrackLink*> & trackVector, std::vector<const Trk::TrackParameters*>& perigeeList); - void analyzeSeeds(std::string conditions, const std::vector<Amg::Vector3D>& seeds, const std::vector<Amg::Vector3D>& truth); + void analyzeSeeds(const std::string& conditions, const std::vector<Amg::Vector3D>& seeds, const std::vector<Amg::Vector3D>& truth); StatusCode initializeConditions(std::string& conditions); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/LocalMax1DClusterFinder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/LocalMax1DClusterFinder.cxx index 804dc47f324a62496e789513c0df7154812013cb..a3410a6006aa5790b842763a962d0bb8839506f3 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/LocalMax1DClusterFinder.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/LocalMax1DClusterFinder.cxx @@ -64,7 +64,7 @@ namespace Trk // Check if bin is a local max if( zproj[i] > m_weightThreshold && zproj[i] > zproj[i-1] && zproj[i] > zproj[i+1] ) { //bin i is a local max - vmax.push_back(std::make_pair(i,zproj[i])); + vmax.emplace_back(i,zproj[i]); } } @@ -115,7 +115,7 @@ namespace Trk float y = image.getRelPosY( ((float) image.getNBinsY())/2. ); for(auto & m : vmax) { if (!m_refineZ || zproj[m.first] <= 0) { - vertices.push_back( Amg::Vector3D( x, y, image.getRelPosZ(m.first) ) ); + vertices.emplace_back( x, y, image.getRelPosZ(m.first) ); } else { float z; float z2 = image.getRelPosZ(m.first); @@ -167,7 +167,7 @@ namespace Trk z = image.getRelPosZ(m.first); } } - vertices.push_back( Amg::Vector3D( x, y, z ) ); + vertices.emplace_back( x, y, z ); } } diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Mode3dFromFsmw1dFinder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Mode3dFromFsmw1dFinder.cxx index 5db071f8565891d7d0e8cb8865a29a1cc7b8acd0..ce301ea0bac75282ee8e8f495527375e61766527 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Mode3dFromFsmw1dFinder.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Mode3dFromFsmw1dFinder.cxx @@ -1,13 +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 */ //Author: Lianyou Shan <lianyou.shan@cern.ch> //#define Mode3dFromFsmw1d_DEBUG #include "TrkVertexSeedFinderUtils/Mode3dFromFsmw1dFinder.h" -#include "TrkVertexSeedFinderUtils/SeedFinderParamDefs.h" #include "TrkParameters/TrackParameters.h" -#include <math.h> +#include "TrkVertexSeedFinderUtils/SeedFinderParamDefs.h" +#include <cmath> namespace Trk { @@ -57,7 +57,7 @@ StatusCode Mode3dFromFsmw1dFinder::finalize() } -const Amg::Vector3D +Amg::Vector3D Mode3dFromFsmw1dFinder::getMode(const double vx, const double vy, const std::vector<Trk::PositionAndWeight> & VectorOfPoints) const @@ -67,7 +67,7 @@ Mode3dFromFsmw1dFinder::getMode(const double vx, } -const Amg::Vector3D +Amg::Vector3D Mode3dFromFsmw1dFinder::getMode(const double vx, const double vy, const std::vector<Trk::PositionAndWeight> & VectorOfPoints, @@ -82,7 +82,7 @@ Mode3dFromFsmw1dFinder::getMode(const double vx, //obtain the 3d-mode (position) from a list of positions (distribution in space) - NO WEIGHTS -const Amg::Vector3D +Amg::Vector3D Mode3dFromFsmw1dFinder::getMode(const double /*vx*/, const double /*vy*/, const std::vector<Amg::Vector3D> & VectorOfPoints) const @@ -112,7 +112,7 @@ Mode3dFromFsmw1dFinder::getMode(const double /*vx*/, } -const Amg::Vector3D +Amg::Vector3D Mode3dFromFsmw1dFinder::getMode(const double vx, const double vy, const std::vector<Amg::Vector3D> & VectorOfPoints, @@ -122,7 +122,7 @@ Mode3dFromFsmw1dFinder::getMode(const double vx, } -const Amg::Vector3D +Amg::Vector3D Mode3dFromFsmw1dFinder::getMode (Mode3dFromFsmw1dInfo& info, const double vx, const double vy, @@ -137,7 +137,7 @@ Mode3dFromFsmw1dFinder::getMode (Mode3dFromFsmw1dInfo& info, Amg::Vector3D tmpseed( 0., 0., 0. ) ; - if ( VectorOfPoints.size() == 0 ) return tmpseed ; + if ( VectorOfPoints.empty() ) return tmpseed ; if ( VectorOfPoints.size() == 1 ) return Amg::Vector3D( begin->first.x(), begin->first.y(), begin->first.z() ) ; @@ -158,9 +158,9 @@ Mode3dFromFsmw1dFinder::getMode (Mode3dFromFsmw1dInfo& info, double r = sqrt( px*px + py*py ) ; // this Vector3D has no physics meaning of xyz position, just borrowing its form in tri-element - tmpphi.push_back( Amg::Vector3D( phi, wght, 1.0*idx ) ) ; - tmpradi.push_back( Amg::Vector3D( r, wght, 1.0*idx ) ) ; - tmpz.push_back( Amg::Vector3D( i->first.z(), wght, 1.0*idx ) ) ; + tmpphi.emplace_back( phi, wght, 1.0*idx ) ; + tmpradi.emplace_back( r, wght, 1.0*idx ) ; + tmpz.emplace_back( i->first.z(), wght, 1.0*idx ) ; info.pushPoint (phi, r, i->first.z(), wght); vectorOfPoints.push_back( *i ) ; @@ -255,7 +255,7 @@ Mode3dFromFsmw1dFinder::getMode (Mode3dFromFsmw1dInfo& info, VeVecIndices olphiradi = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, info.m_idxradi ) ; // some efforts to patch phi-Radius correlation - if ( olphiradi.size() == 0 ) + if ( olphiradi.empty() ) { if ( phisz > 1 && radisz > 1 ) { @@ -270,7 +270,7 @@ Mode3dFromFsmw1dFinder::getMode (Mode3dFromFsmw1dInfo& info, ATH_MSG_DEBUG( " " << " more modes found : " << phisz <<" "<< radisz ); olphiradi = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, info.m_idxradi ) ; - if ( olphiradi.size() == 0 ) + if ( olphiradi.empty() ) { // shall we clear phi-Radius modes and retry with larger MinimalModeDistance ? if ( phibroader && radiusbroader ) @@ -278,16 +278,16 @@ Mode3dFromFsmw1dFinder::getMode (Mode3dFromFsmw1dInfo& info, olphiZ = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, info.m_idxZ, 1 ) ; olradiZ = CheckCorrelation( info, vectorOfPoints, info.m_idxradi, info.m_idxZ, 1 ) ; - if ( olphiZ.size() == 0 && olradiZ.size() == 0 ) + if ( olphiZ.empty() && olradiZ.empty() ) tmpseed = Mode2Seed( info, vectorOfPoints, info.m_idxphi, info.m_idxradi, info.m_idxZ ) ; - else if ( olphiZ.size() > 0 && olradiZ.size() == 0 ) + else if ( !olphiZ.empty() && olradiZ.empty() ) tmpseed = Mode2Seed( info, vectorOfPoints, olphiZ, info.m_idxradi ) ; - else if ( olphiZ.size() == 0 && olradiZ.size() > 0 ) + else if ( olphiZ.empty() && !olradiZ.empty() ) tmpseed = Mode2Seed( info, vectorOfPoints, olradiZ, info.m_idxphi ) ; else { ol_phi_radi_Z = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, olradiZ, 1 ) ; - if ( ol_phi_radi_Z.size() < 1 ) + if ( ol_phi_radi_Z.empty() ) { ATH_MSG_WARNING(" strange arrival at NON-correlation !" ); tmpseed = Mode2Seed( info, vectorOfPoints, info.m_idxphi, info.m_idxradi, info.m_idxZ ) ; @@ -297,15 +297,15 @@ Mode3dFromFsmw1dFinder::getMode (Mode3dFromFsmw1dInfo& info, tmpsdX = tmpseed.x() - vx ; tmpsdY = tmpseed.y() - vy ; tmpsdXY = sqrt( tmpsdX*tmpsdX + tmpsdY*tmpsdY ) ; - if ( tmpsdXY > m_minXYbeam ) + if (tmpsdXY > m_minXYbeam){ return tmpseed ; - else - return getClosestPair(info, vectorOfPoints, vx, vy) ; - + } + + return getClosestPair(info, vectorOfPoints, vx, vy); } // end of Z mode preCorrelation search - else - { + + ATH_MSG_DEBUG(" One more searching for WIDER mode in phi or/and radius !" ); if ( ! phibroader ) { @@ -321,21 +321,21 @@ Mode3dFromFsmw1dFinder::getMode (Mode3dFromFsmw1dInfo& info, olphiradi = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, info.m_idxradi ) ; - if ( olphiradi.size() == 0 ) + if ( olphiradi.empty() ) { olphiZ = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, info.m_idxZ, 1 ) ; olradiZ = CheckCorrelation( info, vectorOfPoints, info.m_idxradi, info.m_idxZ, 1 ) ; - if ( olphiZ.size() == 0 && olradiZ.size() == 0 ) + if ( olphiZ.empty() && olradiZ.empty() ) tmpseed = Mode2Seed( info, vectorOfPoints, info.m_idxphi, info.m_idxradi, info.m_idxZ ) ; - else if ( olphiZ.size() > 0 && olradiZ.size() == 0 ) + else if ( !olphiZ.empty() && olradiZ.empty() ) tmpseed = Mode2Seed( info, vectorOfPoints, olphiZ, info.m_idxradi ) ; - else if ( olphiZ.size() == 0 && olradiZ.size() > 0 ) + else if ( olphiZ.empty() && !olradiZ.empty() ) tmpseed = Mode2Seed( info, vectorOfPoints, olradiZ, info.m_idxphi ) ; else { ol_phi_radi_Z = CheckCorrelation( info, vectorOfPoints, info.m_idxphi, olradiZ, 1 ) ; - if ( ol_phi_radi_Z.size() < 1 ) + if ( ol_phi_radi_Z.empty() ) { ATH_MSG_WARNING(" strange arrival at NON-correlation !" ); tmpseed = Mode2Seed( info, vectorOfPoints, info.m_idxphi, info.m_idxradi, info.m_idxZ ) ; @@ -345,18 +345,19 @@ Mode3dFromFsmw1dFinder::getMode (Mode3dFromFsmw1dInfo& info, tmpsdX = tmpseed.x() - vx ; tmpsdY = tmpseed.y() - vy ; tmpsdXY = sqrt( tmpsdX*tmpsdX + tmpsdY*tmpsdY ) ; - if ( tmpsdXY > m_minXYbeam ) + if ( tmpsdXY > m_minXYbeam ){ return tmpseed ; - else - return getClosestPair(info, vectorOfPoints, vx, vy) ; + } + + return getClosestPair(info, vectorOfPoints, vx, vy); } - } // end of one more seach for BROADER modes + // end of one more seach for BROADER modes } // end of one more mode seach } ATH_MSG_DEBUG( " " << olphiradi.size() << " modes found with phi-radius correlated " ); ol_phi_radi_Z = CheckCorrelation( info, vectorOfPoints, olphiradi, info.m_idxZ, 1 ) ; - if ( ol_phi_radi_Z.size() == 0 ) + if ( ol_phi_radi_Z.empty() ) { if ( Zsz < 2 ) { @@ -364,24 +365,26 @@ Mode3dFromFsmw1dFinder::getMode (Mode3dFromFsmw1dInfo& info, Zsz += doModeSearch( &info.m_idxZ, allz, m_minModeDistZ ) ; ol_phi_radi_Z = CheckCorrelation( info, vectorOfPoints, olphiradi, info.m_idxZ, 1 ) ; - if ( ol_phi_radi_Z.size() == 0 ) + if ( ol_phi_radi_Z.empty() ) { Zsz += doModeSearch( &info.m_idxZ, allz, m_minModeDistZ + 1 ) ; ol_phi_radi_Z = CheckCorrelation( info, vectorOfPoints, olphiradi, info.m_idxZ, 1 ) ; - if ( ol_phi_radi_Z.size() == 0 ) + if ( ol_phi_radi_Z.empty() ) { tmpseed = Mode2Seed( info, vectorOfPoints, olphiradi, info.m_idxZ ) ; if ( tmpseed.z() == 0. ) return getClosestPair(info, vectorOfPoints, vx, vy) ; tmpsdX = tmpseed.x() - vx ; tmpsdY = tmpseed.y() - vy ; tmpsdXY = sqrt( tmpsdX*tmpsdX + tmpsdY*tmpsdY ) ; - if ( tmpsdXY > m_minXYbeam ) - return tmpseed ; - else - return getClosestPair(info, vectorOfPoints, vx, vy) ; -// for ( unsigned int xy = 0 ; xy < olphiradi.size() ; xy ++ ) -// ol_phi_radi_Z.push_back( olphiradi[xy] ) ; + if (tmpsdXY > m_minXYbeam) { + return tmpseed; + } + + return getClosestPair(info, vectorOfPoints, vx, vy); + // for ( unsigned int xy = 0 ; xy < olphiradi.size() ; + // xy ++ ) + // ol_phi_radi_Z.push_back( olphiradi[xy] ) ; } } } @@ -396,10 +399,11 @@ Mode3dFromFsmw1dFinder::getMode (Mode3dFromFsmw1dInfo& info, tmpsdX = tmpseed.x() - vx ; tmpsdY = tmpseed.y() - vy ; tmpsdXY = sqrt( tmpsdX*tmpsdX + tmpsdY*tmpsdY ) ; - if ( tmpsdXY > m_minXYbeam ) + if ( tmpsdXY > m_minXYbeam ){ return tmpseed ; - else - return getClosestPair( info, vectorOfPoints, vx, vy ) ; + } + + return getClosestPair(info, vectorOfPoints, vx, vy); } @@ -485,7 +489,7 @@ int Mode3dFromFsmw1dFinder::doModeSearch( VeVecIndices * idxs, do { std::vector< std::pair< int,int> > idx_tmp = getFsmw1dMode( spltposi, expectMax ) ; - if ( idx_tmp.size() > 0 ) + if ( !idx_tmp.empty() ) { idxs->push_back( idx_tmp ) ; spltgot ++ ; @@ -561,7 +565,7 @@ Mode3dFromFsmw1dFinder::CheckCorrelation( [[maybe_unused]] Mode3dFromFsmw1dInfo& if ( it == axidx.end() ) { ATH_MSG_DEBUG(" extra indices supplemented : " << bx[k].first ); - supp.push_back( std::pair<int,int>( bx[k].first, bx[k].second ) ) ; + supp.emplace_back( bx[k].first, bx[k].second ) ; } } hit = true ; @@ -579,7 +583,7 @@ Mode3dFromFsmw1dFinder::CheckCorrelation( [[maybe_unused]] Mode3dFromFsmw1dInfo& #ifdef Mode3dFromFsmw1d_DEBUG if ( corre.size() == 0 ) return corre ; #else - if ( corre.size() > 0 ) return corre ; + if ( !corre.empty() ) return corre ; #endif ATH_MSG_DEBUG(" Korrelation failed by indices match, now try 3D distance ... " ); @@ -668,7 +672,7 @@ Mode3dFromFsmw1dFinder::CheckCorrelation( [[maybe_unused]] Mode3dFromFsmw1dInfo& for ( unsigned int m = 0 ; m < bx.size() ; m ++ ) { std::vector<int>::iterator it = std::find( axidx.begin(), axidx.end(), bx[m].first ) ; - if ( it == axidx.end() ) supp.push_back( std::pair<int,int>( bx[m].first, bx[m].second ) ) ; + if ( it == axidx.end() ) supp.emplace_back( bx[m].first, bx[m].second ) ; } supp.insert( supp.end(), ax.begin(), ax.end() ) ; corre.push_back( supp ) ; @@ -704,7 +708,7 @@ Mode3dFromFsmw1dFinder::getFsmw1dMode( std::vector< IndexedWeighted > & posidxwg if ( posidxwght.size() == 1 ) { std::vector<IndexedWeighted>::const_iterator mid = posidxwght.begin(); - idx.push_back( std::pair<int,int>( mid->first.second.first, mid->first.second.second ) ) ; + idx.emplace_back( mid->first.second.first, mid->first.second.second ) ; return idx ; } @@ -775,7 +779,7 @@ Mode3dFromFsmw1dFinder::getFsmw1dMode( std::vector< IndexedWeighted > & posidxwg if ( m_broaden && ( best_end - best_begin ) <= 2 && best_begin != mid ) { mid = best_begin - 1 ; - idx.push_back( std::pair<int,int>( mid->first.second.first, mid->first.second.second ) ) ; + idx.emplace_back( mid->first.second.first, mid->first.second.second ) ; ATH_MSG_DEBUG(" found 1d mode " << ( mid->first ).first <<" " << ( mid->first ).second.first <<" "<< mid->first.second.second ); } @@ -784,7 +788,7 @@ Mode3dFromFsmw1dFinder::getFsmw1dMode( std::vector< IndexedWeighted > & posidxwg for ( mid = best_begin ; mid != best_end ; mid ++ ) { // the indexed position - idx.push_back( std::pair<int,int>( mid->first.second.first, mid->first.second.second ) ) ; + idx.emplace_back( mid->first.second.first, mid->first.second.second ) ; ATH_MSG_DEBUG(" found 1d mode " << ( mid->first ).first <<" " << ( mid->first ).second.first <<" "<< mid->first.second.second ); } @@ -796,7 +800,7 @@ Mode3dFromFsmw1dFinder::getFsmw1dMode( std::vector< IndexedWeighted > & posidxwg if ( best_end != mid ) { mid = best_end ; - idx.push_back( std::pair<int,int>( mid->first.second.first, mid->first.second.second ) ) ; + idx.emplace_back( mid->first.second.first, mid->first.second.second ) ; ATH_MSG_DEBUG(" found 1d mode " << ( mid->first ).first <<" " << ( mid->first ).second.first <<" "<< mid->first.second.second ); } @@ -807,7 +811,7 @@ Mode3dFromFsmw1dFinder::getFsmw1dMode( std::vector< IndexedWeighted > & posidxwg } -const Amg::Vector3D +Amg::Vector3D Mode3dFromFsmw1dFinder::getClosestPair (Mode3dFromFsmw1dInfo& info, const std::vector<Trk::PositionAndWeight>& vectorOfPoints, const double vx, @@ -900,7 +904,7 @@ Mode3dFromFsmw1dFinder::getClosestPair (Mode3dFromFsmw1dInfo& info, } -const Amg::Vector3D +Amg::Vector3D Mode3dFromFsmw1dFinder::Mode2Seed( Mode3dFromFsmw1dInfo& info, const std::vector<Trk::PositionAndWeight>& vectorOfPoints, const VeVecIndices & phiradiZol ) const @@ -944,7 +948,7 @@ Mode3dFromFsmw1dFinder::Mode2Seed( Mode3dFromFsmw1dInfo& info, } -const Amg::Vector3D +Amg::Vector3D Mode3dFromFsmw1dFinder::Mode2Seed( Mode3dFromFsmw1dInfo& info, const std::vector<Trk::PositionAndWeight>& vectorOfPoints, const VeVecIndices & phiradi, @@ -1037,7 +1041,7 @@ Mode3dFromFsmw1dFinder::Mode2Seed( Mode3dFromFsmw1dInfo& info, } -const Amg::Vector3D +Amg::Vector3D Mode3dFromFsmw1dFinder::Mode2Seed( Mode3dFromFsmw1dInfo& info, const std::vector<Trk::PositionAndWeight>& vectorOfPoints, const VeVecIndices & phi, @@ -1269,7 +1273,7 @@ void Mode3dFromFsmw1dFinder::Mode3dFromFsmw1dInfo::pushIndices (const std::vector< std::pair<int,int> >& modes) { - for (const std::pair<int,int> p : modes) { + for (const std::pair<int,int>& p : modes) { m_UsedCrossingPointsIndices.push_back( p.first ) ; } } diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Mode3dTo1dFinder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Mode3dTo1dFinder.cxx index ab3f7524fbeb4973a5268f5250ade8c8208b7184..bb0cbbde03ebf8ae5116108f772d0bd584cf221f 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Mode3dTo1dFinder.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Mode3dTo1dFinder.cxx @@ -6,11 +6,11 @@ Mode3dTo1dFinder.cxx - Description in header file *********************************************************************/ -#include "TrkVertexSeedFinderUtils/IMode1dFinder.h" #include "TrkVertexSeedFinderUtils/Mode3dTo1dFinder.h" -#include "TrkVertexSeedFinderUtils/SeedFinderParamDefs.h" #include "TrkParameters/TrackParameters.h" -#include <math.h> +#include "TrkVertexSeedFinderUtils/IMode1dFinder.h" +#include "TrkVertexSeedFinderUtils/SeedFinderParamDefs.h" +#include <cmath> namespace Trk { @@ -39,7 +39,7 @@ namespace Trk } - const Amg::Vector3D + Amg::Vector3D Mode3dTo1dFinder::getMode(const double /*vx*/, const double /*vy*/, const std::vector<Trk::PositionAndWeight> & myVectorOfPoints) const @@ -54,9 +54,9 @@ namespace Trk std::vector<Trk::DoubleAndWeight> allz; for (std::vector<PositionAndWeight>::const_iterator i = begin; i!=end; i++) { - allx.push_back(Trk::DoubleAndWeight(i->first.x(),i->second)); - ally.push_back(Trk::DoubleAndWeight(i->first.y(),i->second)); - allz.push_back(Trk::DoubleAndWeight(i->first.z(),i->second)); + allx.emplace_back(i->first.x(),i->second); + ally.emplace_back(i->first.y(),i->second); + allz.emplace_back(i->first.z(),i->second); } // now find the mode separately for the distributions in x, y and z @@ -66,7 +66,7 @@ namespace Trk } - const Amg::Vector3D + Amg::Vector3D Mode3dTo1dFinder::getMode(const double vx, const double vy, const std::vector<Trk::PositionAndWeight> & myVectorOfPoints, @@ -77,7 +77,7 @@ namespace Trk //obtain the 3d-mode (position) from a list of positions (distribution in space) - NO WEIGHTS - const Amg::Vector3D + Amg::Vector3D Mode3dTo1dFinder::getMode(const double /*vx*/, const double /*vy*/, const std::vector<Amg::Vector3D> & myVectorOfPoints) const @@ -104,7 +104,7 @@ namespace Trk } - const Amg::Vector3D + Amg::Vector3D Mode3dTo1dFinder::getMode(const double vx, const double vy, const std::vector<Amg::Vector3D> & myVectorOfPoints, diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/NewtonTrkDistanceFinder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/NewtonTrkDistanceFinder.cxx index 364a6f9f8a32f4aaba6a52d4cc62d3e15e753779..c774f28252ef4eb36a46c84244e72c10cb1c57dd 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/NewtonTrkDistanceFinder.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/NewtonTrkDistanceFinder.cxx @@ -16,7 +16,7 @@ #include "MagFieldElements/AtlasFieldCache.h" #include "TrkEventPrimitives/ParamDefs.h" -#include <math.h> +#include <cmath> @@ -38,7 +38,7 @@ namespace Trk declareInterface<NewtonTrkDistanceFinder>(this); } - NewtonTrkDistanceFinder::~NewtonTrkDistanceFinder() {} + NewtonTrkDistanceFinder::~NewtonTrkDistanceFinder() = default; StatusCode NewtonTrkDistanceFinder::initialize() { @@ -53,7 +53,7 @@ namespace Trk return StatusCode::SUCCESS; } -const TwoPoints +TwoPoints NewtonTrkDistanceFinder::GetClosestPoints (const PointOnTrack & firsttrack, const PointOnTrack & secondtrack) const { diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/SeedNewtonTrkDistanceFinder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/SeedNewtonTrkDistanceFinder.cxx index 3c4869cce4f16b2d45446a284c580763c4e6a98c..2b2d2d887ad5a7c078b5c9e0d459d3e8b13c3327 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/SeedNewtonTrkDistanceFinder.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/SeedNewtonTrkDistanceFinder.cxx @@ -10,14 +10,14 @@ #include "TrkVertexSeedFinderUtils/SeedNewtonTrkDistanceFinder.h" -#include "TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h" -#include "TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder.h" -#include "TrkVertexSeedFinderUtils/SeedFinderParamDefs.h" #include "TrkEventPrimitives/ParamDefs.h" -#include "TrkTrack/Track.h" -#include <math.h> -#include "TrkParticleBase/TrackParticleBase.h" #include "TrkParameters/TrackParameters.h" +#include "TrkParticleBase/TrackParticleBase.h" +#include "TrkTrack/Track.h" +#include "TrkVertexSeedFinderUtils/NewtonTrkDistanceFinder.h" +#include "TrkVertexSeedFinderUtils/SeedFinderParamDefs.h" +#include "TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h" +#include <cmath> namespace Trk @@ -34,7 +34,7 @@ namespace Trk declareProperty("TrkDistanceFinderImplementation", m_distancefinder); } - SeedNewtonTrkDistanceFinder::~SeedNewtonTrkDistanceFinder() {} + SeedNewtonTrkDistanceFinder::~SeedNewtonTrkDistanceFinder() = default; StatusCode SeedNewtonTrkDistanceFinder::initialize() { @@ -113,7 +113,7 @@ namespace Trk const Trk::Perigee* parpera=dynamic_cast<const Trk::Perigee*>(¶); const Trk::Perigee* parperb=dynamic_cast<const Trk::Perigee*>(&parb); - if (parpera==0||parperb==0) { + if (parpera==nullptr||parperb==nullptr) { ATH_MSG_WARNING( "Cannot cast to perigee. Neutral will be supported soon" ); return std::nullopt; } diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/SimpleVertexClusterFinder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/SimpleVertexClusterFinder.cxx index e95442e296a9ddb5ca5512699b0d3e69fda34785..fe61f32a4667b07282989a938927dd101db5e3e3 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/SimpleVertexClusterFinder.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/SimpleVertexClusterFinder.cxx @@ -44,10 +44,10 @@ namespace Trk } std::vector<std::unique_ptr<Cluster> > clusts; - while (binsRemaining.size() > 0) { + while (!binsRemaining.empty()) { //get a new cluster, but check that it is filled. Break if not. in this case not all the bins above threshold are used because of the seed quality cut std::unique_ptr<Cluster> tmpClust = highestCluster( image, binsRemaining ); - if(tmpClust->size() > 0) + if(!tmpClust->empty()) clusts.push_back( std::move (tmpClust) ); else { break; @@ -58,9 +58,9 @@ namespace Trk for (std::unique_ptr<Cluster>& cl : clusts) { float xbin,ybin,zbin; getCenter(image, *cl, xbin,ybin,zbin); - vertices.push_back( Amg::Vector3D( image.getRelPosX(xbin), + vertices.emplace_back( image.getRelPosX(xbin), image.getRelPosY(ybin), - image.getRelPosZ(zbin) ) ); + image.getRelPosZ(zbin) ); } ATH_MSG_DEBUG( "returning " << vertices.size() << " clusters" ); @@ -92,10 +92,10 @@ namespace Trk if( maxIdx==binsRemaining.end() ) { //nothing above threshold return clust; - } else { //start the cluster with the highest bin, removing it from future consideration + } //start the cluster with the highest bin, removing it from future consideration clust->push_back(binContent( maxIdx->first, maxIdx->second )); binsRemaining.erase(maxIdx); - } + //find more bins to add addBinsToCluster( image, *clust, 0, binsRemaining ); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Trk2DDistanceFinder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Trk2DDistanceFinder.cxx index 36dcc4d3f0f8cedc0ad4fc57f9909980196a8550..00126f0550b9db106a15c8d9c90d2c8f79fad9ce 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Trk2DDistanceFinder.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Trk2DDistanceFinder.cxx @@ -10,15 +10,15 @@ #include "TrkVertexSeedFinderUtils/Trk2DDistanceFinder.h" -#include "TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h" -#include "TrkParameters/TrackParameters.h" -#include "TrkVertexSeedFinderUtils/SeedFinderParamDefs.h" -#include "GeoPrimitives/GeoPrimitives.h" #include "EventPrimitives/EventPrimitives.h" +#include "GeoPrimitives/GeoPrimitives.h" #include "TrkEventPrimitives/ParamDefs.h" -#include "TrkTrack/Track.h" -#include <math.h> +#include "TrkParameters/TrackParameters.h" #include "TrkParticleBase/TrackParticleBase.h" +#include "TrkTrack/Track.h" +#include "TrkVertexSeedFinderUtils/SeedFinderParamDefs.h" +#include "TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h" +#include <cmath> namespace Trk @@ -33,7 +33,7 @@ namespace Trk declareProperty("Trk2dDistanceSeeder", m_2ddistanceseeder); } - Trk2DDistanceFinder::~Trk2DDistanceFinder() {} + Trk2DDistanceFinder::~Trk2DDistanceFinder() = default; StatusCode Trk2DDistanceFinder::initialize() { @@ -106,7 +106,7 @@ namespace Trk const Trk::Perigee* parpera=dynamic_cast<const Trk::Perigee*>(¶); const Trk::Perigee* parperb=dynamic_cast<const Trk::Perigee*>(&parb); - if (parpera==0||parperb==0) { + if (parpera==nullptr||parperb==nullptr) { ATH_MSG_WARNING("Cannot cast to perigee. Neutral will be supported soon" ); return std::nullopt; } diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Trk2dDistanceSeeder.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Trk2dDistanceSeeder.cxx index 06d662ce3cdce098c4b23785ea56c920909b49d7..5556ece33fdb2ef773eaf17296ffb058d51f6444 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Trk2dDistanceSeeder.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/Trk2dDistanceSeeder.cxx @@ -9,13 +9,13 @@ //#define TRK2DDISTANCESEEDER_DEBUG #include "TrkVertexSeedFinderUtils/Trk2dDistanceSeeder.h" -#include "TrkVertexSeedFinderUtils/TwoTracks.h" -#include "TrkParameters/TrackParameters.h" -#include "GaudiKernel/SystemOfUnits.h" #include "GaudiKernel/EventContext.h" +#include "GaudiKernel/SystemOfUnits.h" #include "MagFieldElements/AtlasFieldCache.h" -#include <math.h> +#include "TrkParameters/TrackParameters.h" +#include "TrkVertexSeedFinderUtils/TwoTracks.h" #include <TMath.h> +#include <cmath> namespace { inline double dist2d(const Amg::Vector3D & a, const Amg::Vector3D & b) { @@ -72,13 +72,13 @@ namespace { inline double getRadiusOfCurvature(const Trk::Perigee & myPerigee,const double Bzfield) { return sin(myPerigee.parameters()[Trk::theta])/(Bzfield*myPerigee.parameters()[Trk::qOverP]); } - inline const Amg::Vector3D getCenterOfCurvature(const Trk::Perigee & myPerigee,const double RadiusOfCurvature,const double phipoca) { + inline Amg::Vector3D getCenterOfCurvature(const Trk::Perigee & myPerigee,const double RadiusOfCurvature,const double phipoca) { return Amg::Vector3D(myPerigee.associatedSurface().center().x()+myPerigee.parameters()[Trk::d0]*cos(phipoca)-RadiusOfCurvature*cos(phipoca), myPerigee.associatedSurface().center().y()+myPerigee.parameters()[Trk::d0]*sin(phipoca)-RadiusOfCurvature*sin(phipoca), myPerigee.associatedSurface().center().z()+myPerigee.parameters()[Trk::z0]+RadiusOfCurvature* myPerigee.parameters()[Trk::phi0]/tan(myPerigee.parameters()[Trk::theta])); } - inline const Amg::Vector3D getSeedPoint(const Trk::Perigee & myPerigee,const Amg::Vector3D & center, + inline Amg::Vector3D getSeedPoint(const Trk::Perigee & myPerigee,const Amg::Vector3D & center, const double radius,const double newphi) { // short int sgnd0=(short int)(myPerigee.parameters()[Trk::d0]/fabs(myPerigee.parameters()[Trk::d0])); return Amg::Vector3D(center.x()+radius*cos(newphi+M_PI/2.), @@ -86,7 +86,7 @@ namespace { // eliminated sgnd0 from center.z()-radius*(newphi-sgnd0*M_PI/2.)/tan(myPerigee.parameters()[Trk::theta])); center.z()-radius*newphi/tan(myPerigee.parameters()[Trk::theta])); } - inline const Amg::Vector3D getSeedPoint(const Amg::Vector3D & center, + inline Amg::Vector3D getSeedPoint(const Amg::Vector3D & center, const double radius,const double newphi) { // short int sgnd0=(short int)(myPerigee.parameters()[Trk::d0]/fabs(myPerigee.parameters()[Trk::d0])); return Amg::Vector3D(center.x()+radius*cos(newphi+M_PI/2.), @@ -106,7 +106,7 @@ namespace Trk declareInterface<Trk2dDistanceSeeder>(this); } - Trk2dDistanceSeeder::~Trk2dDistanceSeeder() {} + Trk2dDistanceSeeder::~Trk2dDistanceSeeder() = default; StatusCode Trk2dDistanceSeeder::initialize() { @@ -123,7 +123,7 @@ StatusCode Trk2dDistanceSeeder::finalize() } - const TwoPointOnTrack + TwoPointOnTrack Trk2dDistanceSeeder::GetSeed (const TwoTracks & mytracks, TwoPoints* twopoints /*=nullptr*/) const { @@ -392,9 +392,9 @@ StatusCode Trk2dDistanceSeeder::finalize() if (bfield==0. || isnan(bfield)) { ATH_MSG_DEBUG( "Could not find a magnetic field different from zero: very very strange" ); return 0.60407; //Value in GeV/mm (ATLAS units) - } else { + } ATH_MSG_DEBUG( "Magnetic field projection of z axis in the perigee position is: " << bfield << " GeV/mm " ); - } + return bfield; } diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/VertexImageMaker.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/VertexImageMaker.cxx index c2a5ba2add6ecc82410a6ed72ffd15aa3cf4ab6b..7b844102fd3de6035c550d6bbf1e956476f877e6 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/VertexImageMaker.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/VertexImageMaker.cxx @@ -25,7 +25,7 @@ namespace Trk m_cutoffFreqDenominator_z( 1 ) , m_angularCutoffParameter( 0.75 ) , m_wx(0.0f), m_wy(0.0f), m_wz(0.0f), m_filttot(0), - m_plan_r2c(NULL), m_plan_c2r(NULL) { + m_plan_r2c(nullptr), m_plan_c2r(nullptr) { declareProperty("xbins" , m_xbins ); declareProperty("ybins" , m_ybins ); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/NewtonTrkDistanceFinder_test.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/NewtonTrkDistanceFinder_test.cxx index a52582a5e6a60b05b51070e5ec4e969cc3d25b3e..26e529b58fa8dc04e1c341b278d5642bde034066 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/NewtonTrkDistanceFinder_test.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/NewtonTrkDistanceFinder_test.cxx @@ -90,7 +90,7 @@ void test1 (Trk::NewtonTrkDistanceFinder& tool) assertVec3D (pp.second, { -4.46622, 4.67974, -2.14596 }); } -std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string& mapFile, double sol_current, double tor_current) { // find the path to the map file std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); assert ( !resolvedMapFile.empty() ); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/SeedNewtonTrkDistanceFinder_test.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/SeedNewtonTrkDistanceFinder_test.cxx index a6a58cb967b37f5352a19062a5fadc35aebfc995..22ff9744f713391cb33b51c573b79d79637c30fe 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/SeedNewtonTrkDistanceFinder_test.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/SeedNewtonTrkDistanceFinder_test.cxx @@ -97,7 +97,7 @@ void test1 (Trk::ITrkDistanceFinder& tool) assertVec3D (pp.second, { -4.46622, 4.67974, -2.14596 }); } -std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string& mapFile, double sol_current, double tor_current) { // find the path to the map file std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); assert ( !resolvedMapFile.empty() ); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2DDistanceFinder_test.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2DDistanceFinder_test.cxx index 3338908181c1ceaad4bfaed659125a953a8ea283..062e116d362fab8a3dfa432eb02103ce454e6eac 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2DDistanceFinder_test.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2DDistanceFinder_test.cxx @@ -103,7 +103,7 @@ void test1 (Trk::ITrkDistanceFinder& tool) assertVec3D (pp.second, { 12.501, 9.50104, 0 }); } -std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string& mapFile, double sol_current, double tor_current) { // find the path to the map file std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); assert ( !resolvedMapFile.empty() ); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2dDistanceSeeder_test.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2dDistanceSeeder_test.cxx index 639fa14f6c5b74ea906665e046ac2e48241c2004..092b263580100a8314c78a28778f0e554cb32ebf 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2dDistanceSeeder_test.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/test/Trk2dDistanceSeeder_test.cxx @@ -122,7 +122,7 @@ void test1 (Trk::Trk2dDistanceSeeder& tool) #endif } -std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string mapFile, double sol_current, double tor_current) { +std::unique_ptr<MagField::AtlasFieldMap> getFieldMap(const std::string& mapFile, double sol_current, double tor_current) { // find the path to the map file std::string resolvedMapFile = PathResolver::find_file( mapFile.c_str(), "DATAPATH" ); assert ( !resolvedMapFile.empty() ); diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/CMakeLists.txt b/Tracking/TrkVertexFitter/TrkVertexTools/CMakeLists.txt index 7a951cf6937fa857205c6dcea4461381eb9b7644..91fb15ae9639dfc0832ef1b6062ca5486ea8160d 100644 --- a/Tracking/TrkVertexFitter/TrkVertexTools/CMakeLists.txt +++ b/Tracking/TrkVertexFitter/TrkVertexTools/CMakeLists.txt @@ -28,7 +28,8 @@ atlas_add_component( TrkVertexTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel xAODTracking GaudiKernel TrkVertexFitterInterfaces EventPrimitives GeneratorObjects TrkEventPrimitives VxVertex BeamSpotConditionsData ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps AthenaKernel xAODTracking GaudiKernel TrkVertexFitterInterfaces EventPrimitives + GeneratorObjects TrkEventPrimitives VxVertex BeamSpotConditionsData ) # Install files from the package: atlas_install_headers( TrkVertexTools ) diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/ATLAS_CHECK_THREAD_SAFETY b/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..d296da173ccfac524f70484468194b6395501975 --- /dev/null +++ b/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Tracking/TrkVertexFitter/TrkVertexTools diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/SecVertexMergingTool.h b/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/SecVertexMergingTool.h index 3ca3411000d9e9be6cc7f00df57637fe79612185..6e90192a06bb55bc47d6c02171761f53b133fc18 100644 --- a/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/SecVertexMergingTool.h +++ b/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/SecVertexMergingTool.h @@ -41,8 +41,8 @@ class SecVertexMergingTool : public AthAlgTool, virtual public IVertexMergingTool { public: - StatusCode initialize(); - StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; /** * constructor @@ -57,16 +57,16 @@ /** *Merging */ - virtual std::pair<xAOD::VertexContainer*,xAOD::VertexAuxContainer*> mergeVertexContainer(const xAOD::VertexContainer& MyVxCont); + virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> + mergeVertexContainer(const xAOD::VertexContainer& MyVxCont) const override; - private: int m_Compatidime ; // Lianyou added float m_minDist ; ToolHandle< Trk::IVertexFitter > m_iVertexFitter; - bool checkCompatibility( const xAOD::Vertex * vx1, const xAOD::Vertex * vx2 ); + bool checkCompatibility( const xAOD::Vertex * vx1, const xAOD::Vertex * vx2 ) const; }; //end of class description }//end of namespace definition diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/VertexCollectionSortingTool.h b/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/VertexCollectionSortingTool.h index 5138e41a9059a96c297c54dd15155faae892a964..7be4f7d5535d4ffa10d9e4b64f48b39dbb330146 100644 --- a/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/VertexCollectionSortingTool.h +++ b/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/VertexCollectionSortingTool.h @@ -38,8 +38,8 @@ class VertexCollectionSortingTool : public AthAlgTool, virtual public IVertexCollectionSortingTool { public: - StatusCode initialize(); - StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; /** * constructor @@ -54,8 +54,9 @@ virtual ~VertexCollectionSortingTool(); /** Sort **/ - virtual std::pair<xAOD::VertexContainer*,xAOD::VertexAuxContainer*> sortVertexContainer(const xAOD::VertexContainer& MyVxCont); - + virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> + sortVertexContainer(const xAOD::VertexContainer& MyVxCont) const override; + private: ToolHandle < Trk::IVertexWeightCalculator> m_iVertexWeightCalculator; diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/VertexMergingTool.h b/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/VertexMergingTool.h index 858b88410467e9418de2075c6d4b926e6067a8c6..f616ec8811c39a72313cf49c2c85ad435774196f 100644 --- a/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/VertexMergingTool.h +++ b/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/VertexMergingTool.h @@ -56,16 +56,16 @@ /** *Merging */ - virtual std::pair<xAOD::VertexContainer*,xAOD::VertexAuxContainer*> mergeVertexContainer(const xAOD::VertexContainer& MyVxCont) override; + virtual std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> + mergeVertexContainer(const xAOD::VertexContainer& MyVxCont) const override; - private: SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; ToolHandle< Trk::IVertexFitter > m_iVertexFitter; bool m_useBeamConstraint; - bool checkCompatibility( const xAOD::Vertex * vx1, const xAOD::Vertex * vx2 ); + bool checkCompatibility( const xAOD::Vertex * vx1, const xAOD::Vertex * vx2 ) const; }; //end of class description }//end of namespace definition diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/VertexStoringTool.h b/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/VertexStoringTool.h deleted file mode 100644 index ed9b0cddec8465a1aadfac80cf5e5e5763aab467..0000000000000000000000000000000000000000 --- a/Tracking/TrkVertexFitter/TrkVertexTools/TrkVertexTools/VertexStoringTool.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TrkVertexTools_VertexStoringTool_H -#define TrkVertexTools_VertexStoringTool_H - -#include "AthenaBaseComps/AthAlgTool.h" -#include "TrkVertexFitterInterfaces/IVertexStoringTool.h" - -//xAOD include -#include "xAODTracking/VertexFwd.h" -#include "xAODTracking/VertexContainerFwd.h" -#include "xAODTracking/VertexAuxContainer.h" - - /** - * @class Trk::VertexStoringTool - * - * @author Dave Casper, February 2016 - */ - - namespace Trk - { - - class VertexStoringTool : public AthAlgTool, virtual public IVertexStoringTool - { - public: - StatusCode initialize(); - StatusCode finalize(); - - /** - * constructor - */ - VertexStoringTool(const std::string& t, const std::string& n, const IInterface* p); - - /** - * destructor - */ - virtual ~VertexStoringTool(); - - /** - *Storing - */ - virtual xAOD::Vertex* storeVertex(); - virtual xAOD::Vertex* storeVertex(const xAOD::Vertex& myVertex); - virtual xAOD::Vertex* storeVertex(const Amg::Vector3D& myVector); - virtual xAOD::Vertex* storeVertex(const Amg::Vector3D& myVector, const AmgSymMatrix(3)& myMatrix); - - - private: - StatusCode registerContainer(); - - std::string m_key; - SG::WriteHandle<xAOD::VertexContainer> m_container; - SG::WriteHandle<xAOD::VertexAuxContainer> m_aux; - - }; //end of class description - }//end of namespace definition - - #endif diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/src/SecVertexMergingTool.cxx b/Tracking/TrkVertexFitter/TrkVertexTools/src/SecVertexMergingTool.cxx index 2ab40fc082d1d45ad767abf3bea179e8c2afea99..e4bbb70750e28ed75db1c4a0e8cc9c44275c515f 100644 --- a/Tracking/TrkVertexFitter/TrkVertexTools/src/SecVertexMergingTool.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexTools/src/SecVertexMergingTool.cxx @@ -44,178 +44,193 @@ namespace Trk{ return StatusCode::SUCCESS; } - std::pair<xAOD::VertexContainer*,xAOD::VertexAuxContainer*> SecVertexMergingTool::mergeVertexContainer(const xAOD::VertexContainer& MyVxCont) { + std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> + SecVertexMergingTool::mergeVertexContainer( + const xAOD::VertexContainer& MyVxCont) const - ATH_MSG_DEBUG("Run vertex remerging"); - - //new output containers to be filled - xAOD::VertexContainer *NewContainer = new xAOD::VertexContainer(); - xAOD::VertexAuxContainer* auxNewContainer = new xAOD::VertexAuxContainer(); - NewContainer->setStore( auxNewContainer ); - - bool moreDeco = ( MyVxCont.front() )->isAvailable<float>( "MomentaDirection" ) ; - - if ( ! moreDeco ) ATH_MSG_DEBUG( "Missing decoration !!! " ) ; - -/** - SG::AuxElement::Decorator<std::vector<float> > mDecor_trkWght( "trkWeight" ) ; - SG::AuxElement::Decorator<float> mDecor_trkDOE( "trkDistOverError" ) ; - SG::AuxElement::Decorator<float> mDecor_direction( "MomentaDirection" ); - SG::AuxElement::Decorator< float > mDecor_HitsFilter( "radiiPattern" ); -**/ - - SG::AuxElement::Decorator<float> mDecor_sumPt2( "sumPt2" ); - SG::AuxElement::Decorator<float> mDecor_mass( "mass" ); - SG::AuxElement::Decorator<float> mDecor_energy( "ee" ); - SG::AuxElement::Decorator<int> mDecor_nrobbed( "nrobbed" ); - SG::AuxElement::Decorator<int> mDecor_intrk( "NumInputTrk" ); - - //add remerged flags to all - std::vector<bool> remerged( MyVxCont.size(), false ); - - xAOD::VertexContainer::const_iterator beginIter = MyVxCont.begin(); - xAOD::VertexContainer::const_iterator endIter = MyVxCont.end(); - unsigned int Ni=0; - for(xAOD::VertexContainer::const_iterator i = beginIter; i!=endIter; ++i, Ni++ ) { - xAOD::Vertex * vx = new xAOD::Vertex( **i ); - - if( remerged[Ni] ) continue ; //skip vertices already merged into another - - std::vector<const xAOD::TrackParticle*> combinedTracks; - std::vector< ElementLink< xAOD::TrackParticleContainer > > tpLinks1 = vx->trackParticleLinks(); - if ( tpLinks1.size() >= 1 ) - { - for(const auto & tp_EL : tpLinks1 ) - { - const xAOD::TrackParticle* trk = *tp_EL ; - combinedTracks.push_back( trk ) ; - } - - unsigned int Nj = Ni+1; - bool newmerge = false ; - for(xAOD::VertexContainer::const_iterator j=i+1; j!=endIter; ++j, Nj++ ) - { - const xAOD::Vertex * mergeCand = (*j); - if ( remerged[Nj] ) continue ; - - if ( newmerge ) - { - combinedTracks.clear() ; - tpLinks1 = vx->trackParticleLinks(); - if ( tpLinks1.size() < 1 ) break ; - for(const auto & tp_EL : tpLinks1 ) - { - const xAOD::TrackParticle* trk = *tp_EL ; - combinedTracks.push_back( trk ) ; - } - newmerge = false ; - } - - //not dummy and not already merged into earlier vertex, so consider it as merging candidate - if( ! checkCompatibility( vx, mergeCand ) ) continue ; - - ATH_MSG_DEBUG("To merge vertices " << Ni << " and " << Nj); - //get all the track particles to fit - - const std::vector< ElementLink< xAOD::TrackParticleContainer > > - tpLinks2 = mergeCand->trackParticleLinks(); - if ( tpLinks2.size() < 1 ) continue ; - - for(const auto & tp_EL : tpLinks2 ) - { - const xAOD::TrackParticle* trk = *tp_EL ; - combinedTracks.push_back( trk ) ; - } - - ATH_MSG_DEBUG("Tracks input : " << tpLinks1.size() << " + " << tpLinks2.size() ); - - //call the fitter -> using xAOD::TrackParticle it should set the track links for us - xAOD::Vertex * mergedVtx = 0; - //no interface for no constraint and no starting point, so use starting point of original vertex - Amg::Vector3D start( 0.5*( vx->position() + mergeCand->position() )); - mergedVtx = m_iVertexFitter->fit( combinedTracks, start ); - - ATH_MSG_DEBUG("Merged vertices " << mergedVtx->nTrackParticles() ); - - remerged[Nj] = true; - remerged[Ni] = true; - newmerge = true ; - - // update the decors - float pt1 = sqrt( vx->auxdata<float>( "sumPt2" ) ); - float pt2 = sqrt( mergeCand->auxdata<float>( "sumPt2" ) ) ; - float ntrk1 = 1.0*( ( vx->trackParticleLinks() ).size() ) ; - float ntrk2 = 1.0*( ( mergeCand->trackParticleLinks() ).size() ) ; - float wght1 = 0.6*pt1/( pt1 + pt2 ) + 0.4*ntrk1/( ntrk1 + ntrk2 ) ; - float wght2 = 0.6*pt2/( pt1 + pt2 ) + 0.4*ntrk2/( ntrk1 + ntrk2 ) ; - - xAOD::VxType::VertexType typ1 = vx->vertexType() ; - xAOD::VxType::VertexType typ2 = mergeCand->vertexType() ; - float mas1 = vx->auxdata<float>( "mass" ) ; - float mas2 = mergeCand->auxdata<float>( "mass" ) ; - float e1 = vx->auxdata<float>( "ee" ) ; - float e2 = mergeCand->auxdata<float>( "ee" ) ; - int inNtrk1 = vx->auxdata<int>( "NumInputTrk" ) ; - int inNtrk2 = mergeCand->auxdata<int>( "NumInputTrk" ) ; - - int ntrks = 0 ; - float md1=0., md2=0., hf1=0., hf2=0. ; - std::vector<float> trkW1, trkW2, doe1, doe2 ; - if ( moreDeco ) - { - doe1 = vx->auxdataConst<std::vector<float>> ( "trkDistOverError") ; - doe2 = mergeCand->auxdataConst<std::vector<float>> ( "trkDistOverError") ; - doe2.insert( doe2.end(), doe1.begin(), doe1.end() ) ; - md1 = vx->auxdata<float>( "MomentaDirection" ); - md2 = mergeCand->auxdata<float>( "MomentaDirection" ); - hf1 = vx->auxdataConst<float>( "radiiPattern" ); - hf2 = mergeCand->auxdataConst<float>( "radiiPattern" ); - trkW1 = vx->auxdata< std::vector<float> >( "trkWeight" ) ; - trkW2 = mergeCand->auxdata< std::vector<float> >( "trkWeight" ) ; - trkW2.insert( trkW2.end(), trkW1.begin(), trkW1.end() ) ; - ntrks = vx->auxdata<int>( "NumTrkAtVtx" ) + mergeCand->auxdata<int>( "NumTrkAtVtx" ) ; - } - - //delete copy of first vertex and then overwrite with merged vertex - delete vx; - vx = mergedVtx; - - if ( wght1 >= wght2 ) - vx->setVertexType( typ1 ) ; - else - vx->setVertexType( typ2 ) ; - - if ( moreDeco ) - { - vx->auxdata<std::vector<float> >( "trkDistOverError" ) = doe2 ; - vx->auxdata<float>( "MomentaDirection" ) = wght1*md1 + wght2*md2 ; - vx->auxdata<float>( "radiiPattern" ) = wght1*hf1 + wght2*hf2 ; - vx->auxdata< std::vector<float> >( "trkWeight" ) = trkW2 ; - vx->auxdata< int >( "NumTrkAtVtx" ) = ntrks ; - } - - mDecor_sumPt2( *vx ) = pt1*pt1 + pt2*pt2 ; - mDecor_mass( *vx ) = wght1*mas1 + wght2*mas2 ; - mDecor_energy( *vx ) = wght1*e1 + wght2*e2 ; - mDecor_nrobbed( *vx ) = 0 ; - mDecor_intrk( *vx ) = (int)(wght1*inNtrk1 + wght1*inNtrk2) ; - - - } //loop over j - } // if vx found partner in compatibility - - ATH_MSG_DEBUG( "Merged sumPt2 " << vx->auxdataConst<float>( "sumPt2" ) ) ; - - //whether we merged or not, can add vx to the container - if ( vx != NULL ) NewContainer->push_back( vx ); - - } + { - return std::make_pair( NewContainer, auxNewContainer ); + ATH_MSG_DEBUG("Run vertex remerging"); + + // new output containers to be filled + xAOD::VertexContainer* NewContainer = new xAOD::VertexContainer(); + xAOD::VertexAuxContainer* auxNewContainer = new xAOD::VertexAuxContainer(); + NewContainer->setStore(auxNewContainer); + + bool moreDeco = (MyVxCont.front())->isAvailable<float>("MomentaDirection"); + + if (!moreDeco) + ATH_MSG_DEBUG("Missing decoration !!! "); + + /** + SG::AuxElement::Decorator<std::vector<float> > mDecor_trkWght( + "trkWeight" ) ; SG::AuxElement::Decorator<float> mDecor_trkDOE( + "trkDistOverError" ) ; SG::AuxElement::Decorator<float> mDecor_direction( + "MomentaDirection" ); SG::AuxElement::Decorator< float > mDecor_HitsFilter( + "radiiPattern" ); + **/ + + static const SG::AuxElement::Decorator<float> mDecor_sumPt2("sumPt2"); + static const SG::AuxElement::Decorator<float> mDecor_mass("mass"); + static const SG::AuxElement::Decorator<float> mDecor_energy("ee"); + static const SG::AuxElement::Decorator<int> mDecor_nrobbed("nrobbed"); + static const SG::AuxElement::Decorator<int> mDecor_intrk("NumInputTrk"); + + // add remerged flags to all + std::vector<bool> remerged(MyVxCont.size(), false); + + xAOD::VertexContainer::const_iterator beginIter = MyVxCont.begin(); + xAOD::VertexContainer::const_iterator endIter = MyVxCont.end(); + unsigned int Ni = 0; + for (xAOD::VertexContainer::const_iterator i = beginIter; i != endIter; + ++i, Ni++) { + xAOD::Vertex* vx = new xAOD::Vertex(**i); + + if (remerged[Ni]) + continue; // skip vertices already merged into another + + std::vector<const xAOD::TrackParticle*> combinedTracks; + std::vector<ElementLink<xAOD::TrackParticleContainer>> tpLinks1 = + vx->trackParticleLinks(); + if (tpLinks1.size() >= 1) { + for (const auto& tp_EL : tpLinks1) { + const xAOD::TrackParticle* trk = *tp_EL; + combinedTracks.push_back(trk); + } + + unsigned int Nj = Ni + 1; + bool newmerge = false; + for (xAOD::VertexContainer::const_iterator j = i + 1; j != endIter; + ++j, Nj++) { + const xAOD::Vertex* mergeCand = (*j); + if (remerged[Nj]) + continue; + + if (newmerge) { + combinedTracks.clear(); + tpLinks1 = vx->trackParticleLinks(); + if (tpLinks1.size() < 1) + break; + for (const auto& tp_EL : tpLinks1) { + const xAOD::TrackParticle* trk = *tp_EL; + combinedTracks.push_back(trk); + } + newmerge = false; + } + + // not dummy and not already merged into earlier vertex, so consider + // it as merging candidate + if (!checkCompatibility(vx, mergeCand)) + continue; + + ATH_MSG_DEBUG("To merge vertices " << Ni << " and " << Nj); + // get all the track particles to fit + + const std::vector<ElementLink<xAOD::TrackParticleContainer>> + tpLinks2 = mergeCand->trackParticleLinks(); + if (tpLinks2.size() < 1) + continue; + + for (const auto& tp_EL : tpLinks2) { + const xAOD::TrackParticle* trk = *tp_EL; + combinedTracks.push_back(trk); + } + + ATH_MSG_DEBUG("Tracks input : " << tpLinks1.size() << " + " + << tpLinks2.size()); + + // call the fitter -> using xAOD::TrackParticle it should set the + // track links for us + xAOD::Vertex* mergedVtx = 0; + // no interface for no constraint and no starting point, so use + // starting point of original vertex + Amg::Vector3D start(0.5 * (vx->position() + mergeCand->position())); + mergedVtx = m_iVertexFitter->fit(combinedTracks, start); + + ATH_MSG_DEBUG("Merged vertices " << mergedVtx->nTrackParticles()); + + remerged[Nj] = true; + remerged[Ni] = true; + newmerge = true; + + // update the decors + float pt1 = sqrt(vx->auxdata<float>("sumPt2")); + float pt2 = sqrt(mergeCand->auxdata<float>("sumPt2")); + float ntrk1 = 1.0 * ((vx->trackParticleLinks()).size()); + float ntrk2 = 1.0 * ((mergeCand->trackParticleLinks()).size()); + float wght1 = + 0.6 * pt1 / (pt1 + pt2) + 0.4 * ntrk1 / (ntrk1 + ntrk2); + float wght2 = + 0.6 * pt2 / (pt1 + pt2) + 0.4 * ntrk2 / (ntrk1 + ntrk2); + + xAOD::VxType::VertexType typ1 = vx->vertexType(); + xAOD::VxType::VertexType typ2 = mergeCand->vertexType(); + float mas1 = vx->auxdata<float>("mass"); + float mas2 = mergeCand->auxdata<float>("mass"); + float e1 = vx->auxdata<float>("ee"); + float e2 = mergeCand->auxdata<float>("ee"); + int inNtrk1 = vx->auxdata<int>("NumInputTrk"); + int inNtrk2 = mergeCand->auxdata<int>("NumInputTrk"); + + int ntrks = 0; + float md1 = 0., md2 = 0., hf1 = 0., hf2 = 0.; + std::vector<float> trkW1, trkW2, doe1, doe2; + if (moreDeco) { + doe1 = vx->auxdataConst<std::vector<float>>("trkDistOverError"); + doe2 = + mergeCand->auxdataConst<std::vector<float>>("trkDistOverError"); + doe2.insert(doe2.end(), doe1.begin(), doe1.end()); + md1 = vx->auxdata<float>("MomentaDirection"); + md2 = mergeCand->auxdata<float>("MomentaDirection"); + hf1 = vx->auxdataConst<float>("radiiPattern"); + hf2 = mergeCand->auxdataConst<float>("radiiPattern"); + trkW1 = vx->auxdata<std::vector<float>>("trkWeight"); + trkW2 = mergeCand->auxdata<std::vector<float>>("trkWeight"); + trkW2.insert(trkW2.end(), trkW1.begin(), trkW1.end()); + ntrks = vx->auxdata<int>("NumTrkAtVtx") + + mergeCand->auxdata<int>("NumTrkAtVtx"); + } + + // delete copy of first vertex and then overwrite with merged vertex + delete vx; + vx = mergedVtx; + + if (wght1 >= wght2) + vx->setVertexType(typ1); + else + vx->setVertexType(typ2); + + if (moreDeco) { + vx->auxdata<std::vector<float>>("trkDistOverError") = doe2; + vx->auxdata<float>("MomentaDirection") = wght1 * md1 + wght2 * md2; + vx->auxdata<float>("radiiPattern") = wght1 * hf1 + wght2 * hf2; + vx->auxdata<std::vector<float>>("trkWeight") = trkW2; + vx->auxdata<int>("NumTrkAtVtx") = ntrks; + } + + mDecor_sumPt2(*vx) = pt1 * pt1 + pt2 * pt2; + mDecor_mass(*vx) = wght1 * mas1 + wght2 * mas2; + mDecor_energy(*vx) = wght1 * e1 + wght2 * e2; + mDecor_nrobbed(*vx) = 0; + mDecor_intrk(*vx) = (int)(wght1 * inNtrk1 + wght1 * inNtrk2); + + } // loop over j + } // if vx found partner in compatibility + + ATH_MSG_DEBUG("Merged sumPt2 " << vx->auxdataConst<float>("sumPt2")); + + // whether we merged or not, can add vx to the container + if (vx != NULL) + NewContainer->push_back(vx); + } + + return std::make_pair(NewContainer, auxNewContainer); } - bool SecVertexMergingTool::checkCompatibility( const xAOD::Vertex * v1, const xAOD::Vertex * v2 ) + bool + SecVertexMergingTool::checkCompatibility(const xAOD::Vertex* v1, + const xAOD::Vertex* v2) const { float sigma = 100 ; diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/src/VertexCollectionSortingTool.cxx b/Tracking/TrkVertexFitter/TrkVertexTools/src/VertexCollectionSortingTool.cxx index f0e2a3970c532f7147832b73579e4126da3bd116..17f9d66ad642962707cc8db5ced66933b10e91cb 100644 --- a/Tracking/TrkVertexFitter/TrkVertexTools/src/VertexCollectionSortingTool.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexTools/src/VertexCollectionSortingTool.cxx @@ -56,7 +56,9 @@ namespace Trk{ return StatusCode::SUCCESS; } - std::pair<xAOD::VertexContainer*,xAOD::VertexAuxContainer*> VertexCollectionSortingTool::sortVertexContainer( const xAOD::VertexContainer& MyVxCont) + std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> + VertexCollectionSortingTool::sortVertexContainer( + const xAOD::VertexContainer& MyVxCont) const { std::vector<Vertex_pair> MyVertex_pairs; diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/src/VertexMergingTool.cxx b/Tracking/TrkVertexFitter/TrkVertexTools/src/VertexMergingTool.cxx index a8559366139be97a835b2acbb10493f9407fc07c..e5d70ddbd017baf1aa2d7b5241552424500ecf9f 100644 --- a/Tracking/TrkVertexFitter/TrkVertexTools/src/VertexMergingTool.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexTools/src/VertexMergingTool.cxx @@ -39,7 +39,8 @@ namespace Trk{ }///EndOfInitialize - std::pair<xAOD::VertexContainer*,xAOD::VertexAuxContainer*> VertexMergingTool::mergeVertexContainer(const xAOD::VertexContainer& MyVxCont) { + std::pair<xAOD::VertexContainer*,xAOD::VertexAuxContainer*> VertexMergingTool::mergeVertexContainer(const xAOD::VertexContainer& MyVxCont) const + { ATH_MSG_DEBUG("Run vertex remerging"); @@ -123,7 +124,7 @@ namespace Trk{ } - bool VertexMergingTool::checkCompatibility( const xAOD::Vertex * vx1, const xAOD::Vertex * vx2 ) { + bool VertexMergingTool::checkCompatibility( const xAOD::Vertex * vx1, const xAOD::Vertex * vx2 ) const { double z1 = vx1->z(); double z2 = vx2->z(); diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/src/VertexStoringTool.cxx b/Tracking/TrkVertexFitter/TrkVertexTools/src/VertexStoringTool.cxx deleted file mode 100644 index c7b006a81174d558b41497cc3f5ca4923798c95a..0000000000000000000000000000000000000000 --- a/Tracking/TrkVertexFitter/TrkVertexTools/src/VertexStoringTool.cxx +++ /dev/null @@ -1,89 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrkVertexTools/VertexStoringTool.h" -#include "xAODTracking/Vertex.h" -#include "xAODTracking/VertexContainer.h" - -namespace Trk{ - - //constructor - VertexStoringTool::VertexStoringTool ( const std::string& t, const std::string& n, const IInterface* p ) - : AthAlgTool ( t,n,p ), - m_key("Unspecified"), - m_container("Unspecified"), - m_aux("Unspecified") - { - declareInterface<IVertexStoringTool> ( this ); - declareProperty("Key", m_key); - } - - //destructor - VertexStoringTool::~VertexStoringTool(){} - -//initialize - StatusCode VertexStoringTool::initialize() - { - // finalize the names of the two StoreGate entries - m_container = SG::WriteHandle<xAOD::VertexContainer>(m_key); - m_aux = SG::WriteHandle<xAOD::VertexAuxContainer>(m_key + "Aux."); - - ATH_MSG_DEBUG("Vertex storing tool initialization successful"); - return StatusCode::SUCCESS; - }///EndOfInitialize - - StatusCode VertexStoringTool::finalize() - { - return StatusCode::SUCCESS; - } - - xAOD::Vertex* VertexStoringTool::storeVertex() - { - if (registerContainer().isFailure()) return NULL; - xAOD::Vertex* s = new xAOD::Vertex(); - m_container->push_back(s); - return s; - } - - xAOD::Vertex* VertexStoringTool::storeVertex(const xAOD::Vertex& myVertex) - { - if (registerContainer().isFailure()) return NULL; - xAOD::Vertex* s = new xAOD::Vertex(myVertex); - m_container->push_back(s); - return s; - } - - xAOD::Vertex* VertexStoringTool::storeVertex(const Amg::Vector3D& myVector) - { - xAOD::Vertex* s = NULL; - if (!(s = storeVertex())) return NULL; - s->setPosition(myVector); - return s; - } - - xAOD::Vertex* VertexStoringTool::storeVertex(const Amg::Vector3D& myVector, const AmgSymMatrix(3)& myMatrix) - { - xAOD::Vertex* s = NULL; - if (!(s = storeVertex(myVector))) return NULL; - s->setCovariancePosition(myMatrix); - return s; - } - - StatusCode VertexStoringTool::registerContainer() - { - if (m_container.isValid() && m_aux.isValid()) return StatusCode::SUCCESS; - m_container = std::make_unique<xAOD::VertexContainer>(); - m_aux = std::make_unique<xAOD::VertexAuxContainer>(); - if (!(m_container.isValid() && m_aux.isValid())) - { - ATH_MSG_ERROR("Unable to initialize " << m_container.key() << " and " << m_aux.key()); - return StatusCode::FAILURE; - } - m_container->setNonConstStore(&(*m_aux)); - ATH_MSG_VERBOSE( m_container.key() << " and " << m_aux.key() << " initialized and linked"); - - return StatusCode::SUCCESS; - } - -}///End trk namespace diff --git a/Tracking/TrkVertexFitter/TrkVertexTools/src/components/TrkVertexTools_entries.cxx b/Tracking/TrkVertexFitter/TrkVertexTools/src/components/TrkVertexTools_entries.cxx index 6dfcbcce1717935f56414417684f48742315bf7f..e13a13eab02b5a72f29ea6297b5070135893b0fc 100644 --- a/Tracking/TrkVertexFitter/TrkVertexTools/src/components/TrkVertexTools_entries.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexTools/src/components/TrkVertexTools_entries.cxx @@ -2,7 +2,6 @@ #include "TrkVertexTools/VertexMergingTool.h" #include "TrkVertexTools/DummyVertexSelectionTool.h" #include "TrkVertexTools/TruthVertexSelectionTool.h" -#include "TrkVertexTools/VertexStoringTool.h" #include "TrkVertexTools/SecVertexMergingTool.h" using namespace Trk; @@ -11,7 +10,6 @@ DECLARE_COMPONENT( VertexCollectionSortingTool ) DECLARE_COMPONENT( VertexMergingTool ) DECLARE_COMPONENT( DummyVertexSelectionTool ) DECLARE_COMPONENT( TruthVertexSelectionTool ) -DECLARE_COMPONENT( VertexStoringTool ) DECLARE_COMPONENT( SecVertexMergingTool ) diff --git a/Trigger/TrigAccel/TrigAccelEvent/CMakeLists.txt b/Trigger/TrigAccel/TrigAccelEvent/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..53821ba33acb37514c9e9ce1de9716f2df0b3bd5 --- /dev/null +++ b/Trigger/TrigAccel/TrigAccelEvent/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################################################ +# Package: TrigAccelEvent +################################################################################ + +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( TrigAccelEvent ) + +# Component(s) in the package: +atlas_add_library( TrigAccelEvent + TrigAccelEvent/*.h + INTERFACE + PUBLIC_HEADERS TrigAccelEvent) diff --git a/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/DataExportBuffer.h b/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/DataExportBuffer.h new file mode 100644 index 0000000000000000000000000000000000000000..97d7d7640de4557ee0a10837671087d3f78409e8 --- /dev/null +++ b/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/DataExportBuffer.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGACCELEVENT_DATAEXPORTBUFFER_H +#define TRIGACCELEVENT_DATAEXPORTBUFFER_H + + +#include <string> +#include <fstream> + +namespace TrigAccel { + + typedef struct DataExportBuffer { + public: + DataExportBuffer() : m_size(0), m_buffer(0) {}; + DataExportBuffer(size_t s) : m_size(s) { + m_buffer = new char[s]; + } + ~DataExportBuffer() {delete[] m_buffer;} + + inline bool fit(size_t s) { + return s<=m_size; + } + + void reallocate(size_t s) { + delete[] m_buffer; + m_buffer = new char[s]; + m_size = s; + } + + void save(const std::string& name) const { + std::ofstream binFile(name, std::ios::binary); + binFile.write(m_buffer, m_size); + binFile.close(); + } + + size_t load(const std::string& name) { + std::ifstream binFile(name, std::ios::binary); + if (!binFile) { + return 0; + } + binFile.seekg(0, binFile.end); + size_t fileSize = binFile.tellg(); + binFile.seekg (0, binFile.beg); + reallocate(fileSize); + binFile.read(m_buffer, m_size); + binFile.close(); + return fileSize; + } + + size_t m_size; + char* m_buffer; + } DATA_EXPORT_BUFFER; +} + +#endif diff --git a/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/OffloadBuffer.h b/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/OffloadBuffer.h new file mode 100644 index 0000000000000000000000000000000000000000..9b8e793ad0755efa1176e2351054fbdf6faf58d5 --- /dev/null +++ b/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/OffloadBuffer.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGACCELEVENT_OFFLOADBUFFER_H +#define TRIGACCELEVENT_OFFLOADBUFFER_H + +#include "DataExportBuffer.h" +#include <cstring> + +namespace TrigAccel { + + class OffloadBuffer { + public: + OffloadBuffer(size_t size) : m_bufferSize(size) { + m_rawBuffer = new unsigned char[m_bufferSize]; + } + + OffloadBuffer(const DATA_EXPORT_BUFFER* pB) { + const size_t bufferOffset = 256; + m_bufferSize = pB->m_size - bufferOffset; + m_rawBuffer = new unsigned char[m_bufferSize]; + memcpy(m_rawBuffer, pB->m_buffer + bufferOffset, m_bufferSize); + } + + virtual ~OffloadBuffer() { + delete[] m_rawBuffer; + } + + unsigned char* get() { + return m_rawBuffer; + } + + size_t m_bufferSize; + unsigned char* m_rawBuffer; + }; +} + +#endif diff --git a/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/TrigInDetAccelCodes.h b/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/TrigInDetAccelCodes.h new file mode 100644 index 0000000000000000000000000000000000000000..44a450b477eb55b77a1ccbfe30df4b35a493abc0 --- /dev/null +++ b/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/TrigInDetAccelCodes.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGACCELEVENT_TRIGINDETACCELCODES_H +#define TRIGACCELEVENT_TRIGINDETACCELCODES_H + +namespace TrigAccel { + + constexpr unsigned int TrigInDetModuleID_CPU = 0x10000000; + + constexpr unsigned int TrigInDetModuleID_CUDA = 0x10100000; + + enum InDetJobControlCode { + PIXBS = 11001, + SCTBS = 12001, + PIX_CL_EXPORT = 11010, + SCT_CL_EXPORT = 12010, + SPS_EXPORT = 13010, + SFS_EXPORT = 13011, + TFS_EXPORT = 13012, + SEED_IMPORT = 13100, + SIL_LAYERS_EXPORT = 10020, + PIX_GEO_EXPORT = 11020, + SCT_GEO_EXPORT = 12020, + ID_CABLING_EXPORT = 10000, + FIND_SEEDS = 14000, + MAKE_SEEDS = 14001, + FIND_TRACKS = 15000 + }; +} + +#endif diff --git a/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/TrigInDetAccelEDM.h b/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/TrigInDetAccelEDM.h new file mode 100644 index 0000000000000000000000000000000000000000..4d7b14228d2cab53f96471c4023caeb269d02202 --- /dev/null +++ b/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/TrigInDetAccelEDM.h @@ -0,0 +1,403 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGACCELEVENT_TRIGINDETACCELEDM_H +#define TRIGACCELEVENT_TRIGINDETACCELEDM_H + +#include<cstdint> + +namespace TrigAccel { + + //A. GPU-accelerated track seeding + + constexpr unsigned int MAX_SILICON_LAYERS = 50; + constexpr unsigned int MAX_NUMBER_PIX_MODULES = 2100; + constexpr unsigned int MAX_NUMBER_SCT_MODULES = 8200; + constexpr unsigned int MAX_NUMBER_SPACEPOINTS = 100000; + constexpr unsigned int MAX_PHI_SLICES = 100; + constexpr unsigned int MAX_NUMBER_OUTPUT_SEEDS = 100000; + + typedef struct SiliconLayer { + public: + int m_subdet;//1 : Pixel, 2 : SCT + int m_type;//0: barrel, +/-n : endcap + float m_refCoord; + int m_nElements; + float m_minBound, m_maxBound; + float m_phiBinWidth, m_rzBinWidth; + int m_nPhiSlices; + + } SILICON_LAYER; + + typedef struct DetectorModel { + public: + int m_nLayers; + int m_nModules; + SILICON_LAYER m_layers[MAX_SILICON_LAYERS]; + int m_hashArray[MAX_NUMBER_PIX_MODULES+MAX_NUMBER_SCT_MODULES]; + float m_minRZ[MAX_NUMBER_PIX_MODULES+MAX_NUMBER_SCT_MODULES]; + float m_maxRZ[MAX_NUMBER_PIX_MODULES+MAX_NUMBER_SCT_MODULES]; + } DETECTOR_MODEL; + + typedef struct SpacePointLayerRange { + public: + int m_layerBegin[MAX_SILICON_LAYERS]; + int m_layerEnd[MAX_SILICON_LAYERS]; + } SPACEPOINT_LAYER_RANGE; + + typedef struct SpacePointStorage { + public: + int m_nSpacepoints; + int m_nPhiSlices; + int m_nLayers; + int m_index[MAX_NUMBER_SPACEPOINTS]; + int m_type[MAX_NUMBER_SPACEPOINTS]; + float m_x[MAX_NUMBER_SPACEPOINTS]; + float m_y[MAX_NUMBER_SPACEPOINTS]; + float m_z[MAX_NUMBER_SPACEPOINTS]; + float m_r[MAX_NUMBER_SPACEPOINTS]; + float m_phi[MAX_NUMBER_SPACEPOINTS]; + float m_covR[MAX_NUMBER_SPACEPOINTS]; + float m_covZ[MAX_NUMBER_SPACEPOINTS]; + SPACEPOINT_LAYER_RANGE m_phiSlices[MAX_PHI_SLICES]; + } SPACEPOINT_STORAGE; + + typedef struct SeedFinderSettings { + public: + unsigned int m_maxBarrelPix, m_minEndcapPix, m_maxEndcapPix, m_maxSiliconLayer; + float m_magFieldZ; + float m_tripletD0Max; + float m_tripletD0_PPS_Max; + float m_tripletPtMin; + int m_tripletDoPSS, m_doubletFilterRZ; + int m_nMaxPhiSlice; + unsigned int m_maxTripletBufferLength; + int m_isFullScan; + float m_zedMinus, m_zedPlus; + + } SEED_FINDER_SETTINGS; + + typedef struct SeedMakingJob { + public: + SEED_FINDER_SETTINGS m_settings; + SPACEPOINT_STORAGE m_data; + } SEED_MAKING_JOB; + + typedef struct OutputSeedStorage { + public: + int m_nSeeds; + int m_nMiddleSps; + int m_nI, m_nO; + int m_nCandidates; + int m_nErrors; + int m_innerIndex[MAX_NUMBER_OUTPUT_SEEDS]; + int m_middleIndex[MAX_NUMBER_OUTPUT_SEEDS]; + int m_outerIndex[MAX_NUMBER_OUTPUT_SEEDS]; + float m_Q[MAX_NUMBER_OUTPUT_SEEDS]; + } OUTPUT_SEED_STORAGE; + + //B. GPU-accelerated track following + + constexpr unsigned int MAX_NUMBER_PIX_HITS = 100000; + constexpr unsigned int MAX_NUMBER_SCT_HITS = 100000; + constexpr unsigned int MAX_NUMBER_INPUT_SEEDS = 50000; + constexpr unsigned int MAX_ROAD_LENGTH = 64; + + typedef struct TrackFinderSettings { + public: + unsigned int m_maxBarrelPix, m_minEndcapPix, m_maxEndcapPix, m_maxSiliconLayer; + float m_magFieldZ; + float m_tripletD0Max; + float m_tripletD0_PPS_Max; + float m_tripletPtMin; + int m_tripletDoPSS, m_doubletFilterRZ; + int m_nMaxPhiSlice; + unsigned int m_maxTripletBufferLength; + int m_isFullScan; + } TRACK_FINDER_SETTINGS; + + typedef struct SiliconPlane{ + public: + double m_Ax[3]; + double m_Ay[3]; + double m_Az[3]; + double m_D[3]; + double m_B[3];//magnetic field in the center + float m_minWidth; + float m_maxWidth; + float m_length; + int m_shape; + } SILICON_PLANE; + + typedef struct SctGeometryStorage { + public: + int m_nModules; + int m_dead[MAX_NUMBER_SCT_MODULES]; + int m_type[MAX_NUMBER_SCT_MODULES]; + SILICON_PLANE m_geoInfo[MAX_NUMBER_SCT_MODULES]; + } SCT_GEO_STORAGE; + + typedef struct PixelGeometryStorage { + public: + int m_nModules; + int m_dead[MAX_NUMBER_PIX_MODULES]; + int m_type[MAX_NUMBER_PIX_MODULES]; + SILICON_PLANE m_geoInfo[MAX_NUMBER_PIX_MODULES]; + } PIXEL_GEO_STORAGE; + + typedef struct PixelClusterStorage { + public: + int m_nModules; + int m_start[MAX_NUMBER_PIX_MODULES]; + int m_end[MAX_NUMBER_PIX_MODULES]; + float m_localX[MAX_NUMBER_PIX_HITS]; + float m_localY[MAX_NUMBER_PIX_HITS]; + float m_covXX[MAX_NUMBER_PIX_HITS]; + float m_covXY[MAX_NUMBER_PIX_HITS]; + float m_covYY[MAX_NUMBER_PIX_HITS]; + } PIXEL_CLUSTER_STORAGE; + + typedef struct SctClusterStorage { + public: + int m_nModules; + int m_start[MAX_NUMBER_SCT_MODULES]; + int m_end[MAX_NUMBER_SCT_MODULES]; + float m_localX[MAX_NUMBER_SCT_HITS]; + float m_covXX[MAX_NUMBER_SCT_HITS]; + } SCT_CLUSTER_STORAGE; + + typedef struct ProtoTrack { + int m_nElements; + int m_nSeedElements; + float m_initialParams[5]; + int m_planeType[MAX_ROAD_LENGTH]; + int m_planeIndex[MAX_ROAD_LENGTH]; + int m_hitIndex[MAX_ROAD_LENGTH]; + int m_seedPlanes[6];//max = 3 SP x 2 clusters + } PROTO_TRACK; + + typedef struct ProtoTrackStorage { + public: + int m_nSeeds; + PROTO_TRACK m_tracks[MAX_NUMBER_INPUT_SEEDS]; + } PROTO_TRACK_STORAGE; + + + typedef struct TrackSeedStorage { + public: + int m_nSeeds; + int m_planeType[MAX_NUMBER_INPUT_SEEDS]; + int m_planeIdx[MAX_NUMBER_INPUT_SEEDS]; + int m_sp1stPlaneIndices[MAX_NUMBER_INPUT_SEEDS][3]; + int m_sp2ndPlaneIndices[MAX_NUMBER_INPUT_SEEDS][3]; + int m_spClusterIndices[MAX_NUMBER_INPUT_SEEDS][6]; + float m_sp1x[MAX_NUMBER_INPUT_SEEDS]; + float m_sp1y[MAX_NUMBER_INPUT_SEEDS]; + float m_sp1z[MAX_NUMBER_INPUT_SEEDS]; + float m_sp2x[MAX_NUMBER_INPUT_SEEDS]; + float m_sp2y[MAX_NUMBER_INPUT_SEEDS]; + float m_sp2z[MAX_NUMBER_INPUT_SEEDS]; + float m_sp3x[MAX_NUMBER_INPUT_SEEDS]; + float m_sp3y[MAX_NUMBER_INPUT_SEEDS]; + float m_sp3z[MAX_NUMBER_INPUT_SEEDS]; + + } TRACK_SEED_STORAGE; + + typedef struct ExtendedTrackStateStruct2 { + float m_par[10]; + float m_cov[55]; + } EXTENDED_TRACK_STATE_TYPE_2; + + typedef struct LocalEstimate { + public: + float m_P[5]; + float m_J[5][5];//jacobian to get to the next plane estimate + float m_path; + } LOCAL_ESTIMATE; + + typedef struct TrackData { + public: + int m_status; + float m_chi2; + int m_ndof; + int m_firstElement; + int m_lastElement; + char m_stat[MAX_ROAD_LENGTH]; + char m_validatedPlanes[MAX_ROAD_LENGTH]; + + LOCAL_ESTIMATE m_E[MAX_ROAD_LENGTH]; + + EXTENDED_TRACK_STATE_TYPE_2 m_ets; + int m_nValidated; + } TRACK_DATA; + + typedef struct SeededOutput { + public: + TRACK_DATA m_data[MAX_NUMBER_INPUT_SEEDS]; + } SEEDED_OUTPUT; + + //C. GPU-accelerated data preparation + + constexpr unsigned int MAX_NUMBER_BS_WORDS = 80000; + constexpr unsigned int MAX_GANGED_PIXELS = 4000; + constexpr unsigned int MAX_GANGED_PIXEL_PER_MODULE = 50; + constexpr unsigned int MAX_PIX_BS_HEADERS = 2048; + constexpr unsigned int MAX_PIX_HASH = 2048; + constexpr unsigned int MAX_SCT_BS_HEADERS = 8500; + constexpr unsigned int MAX_SCT_HASH = 8176; + constexpr unsigned int MAX_BS_ROBF = 200; + constexpr unsigned int MAX_ADJ_HIT_PAIRS = 1024; + constexpr unsigned int SCT_MAX_SP_PER_MODULE = 256; + constexpr unsigned int MAX_PHI_INDEX = 100; + constexpr unsigned int MAX_RZ_INDEX = 300; + constexpr unsigned int MAX_PIX_ROD_INDEX = 200; + constexpr unsigned int MAX_PIX_LINK_INDEX = 8; + constexpr unsigned int MAX_SCT_ROD_INDEX = 90; + constexpr unsigned int MAX_SCT_LINK_INDEX = 96; + + typedef struct SctModuleGeoInfo { + char m_type; + float m_phiPitch; + float m_lorentzShift; + float m_center[3]; + float m_M[3][3]; + //special meaning for endcap + float m_stripLength; + float m_maxRadius; + float m_minRadius; + + } SCT_MODULE_GEO_INFO; + + typedef struct PixelModuleGeoInfo { + char m_type; + char m_bLayer; + float m_phiPitch; + float m_etaPitchLong; + float m_etaPitchNormal; + float m_lorentzShift; + float m_center[3]; + float m_M[3][3]; + float m_halfWidth; + float m_halfLength; + } PIXEL_MODULE_GEO_INFO; + + struct HashQuadruplet { + unsigned short x,y,z,w; + }; + + typedef struct IdCablingInfo { + public: + HashQuadruplet m_pixelRodLinkHashTable[MAX_PIX_ROD_INDEX][MAX_PIX_LINK_INDEX]; + unsigned short m_sctRodLinkHashTable[MAX_SCT_ROD_INDEX][MAX_SCT_LINK_INDEX]; + uint16_t m_pixelModuleInfo[MAX_PIX_HASH]; + uint16_t m_sctModuleInfo[MAX_SCT_HASH]; + PIXEL_MODULE_GEO_INFO m_pixelGeoArray[MAX_PIX_HASH]; + SCT_MODULE_GEO_INFO m_sctGeoArray[MAX_SCT_HASH]; + } ID_CABLING_INFO; + + struct myfloat2 { + float x,y; + }; + + struct myint4 { + int x,y,z,w; + }; + + struct myushort4 { + unsigned short x,y,z,w; + }; + + struct myushort2 { + unsigned short x,y; + }; + + typedef struct InputByteStreamData { + int m_nDataWords; + uint32_t m_rodIds[MAX_NUMBER_BS_WORDS]; + uint32_t m_words[MAX_NUMBER_BS_WORDS]; + float m_xBeamSpot; + float m_yBeamSpot; + } INPUT_BYTESTREAM_DATA; + + + typedef struct DecodedPixelModuleInfo { + int m_headerPositions; + int m_trailerPositions; + int m_gangedStart; + short m_hashIds; + unsigned int m_nClusters; + unsigned int m_nGangedPixels; + } DECODED_PIX_MODULE_INFO; + + typedef struct DecodedPixelHitInfo { + unsigned int m_clusterIds; + unsigned short m_etaIndex; + unsigned short m_phiIndex; + unsigned int m_tot; + } DECODED_PIX_HIT_INFO; + + typedef struct PixelSpacePointType { + float m_position[3]; + unsigned short m_clusterIdx; + } PIXEL_SPACEPOINT_TYPE; + + + typedef struct DecodedPixelData { + public: + int m_nHeaders, m_nTrailers; + int m_nSpacePoints; + + int m_gangedPixelsStart;//initial value = m_nDataWords + int m_nPixels[MAX_PIX_BS_HEADERS];//number of decoded pixels (counting ganged) per module + int m_clusterStarts[MAX_PIX_BS_HEADERS];//for navigation through cluster and SP storage space + DECODED_PIX_MODULE_INFO m_modulesInfo[MAX_PIX_BS_HEADERS]; + unsigned short m_moduleInfoWord[MAX_PIX_BS_HEADERS]; + myfloat2 m_clusterPosition[MAX_NUMBER_BS_WORDS+MAX_GANGED_PIXELS]; + unsigned short m_clusterId[MAX_NUMBER_BS_WORDS+MAX_GANGED_PIXELS]; + DECODED_PIX_HIT_INFO m_hitInfo[MAX_NUMBER_BS_WORDS+MAX_GANGED_PIXELS]; + myint4 m_decodedData[MAX_NUMBER_BS_WORDS+MAX_GANGED_PIXELS]; + + PIXEL_SPACEPOINT_TYPE m_spacePoints[MAX_NUMBER_BS_WORDS+MAX_GANGED_PIXELS]; + + int m_hashToIndex[MAX_PIX_HASH]; + + } DECODED_PIXEL_DATA; + + typedef struct DecodedSctHeaderInfo { + int m_headerPositions; + int m_rdoEnd; + short m_hashIds; + unsigned int m_nClusters; + bool m_condensedMode; + + unsigned int m_nSP; + unsigned int m_spacePointsStart; + } DECODED_SCT_HEADER_INFO; + + typedef struct SctSpacePointStruct { + float m_position[3]; + unsigned short m_clusterIdx[2]; + } SCT_SPACEPOINT_TYPE; + + typedef struct DecodedSctData { + int m_nHeaders; + int m_nTrailers; + int m_nPhiModules; + unsigned int m_nSpacePoints; + + DECODED_SCT_HEADER_INFO m_headersInfo[MAX_SCT_BS_HEADERS]; + unsigned short m_moduleInfoWord[MAX_SCT_BS_HEADERS]; + unsigned short m_headerInfoIndices[MAX_SCT_HASH];//starts from 1 !!! + unsigned short m_phiModuleIndices[MAX_SCT_BS_HEADERS/2]; + unsigned short m_clusterIds[MAX_NUMBER_BS_WORDS*2]; + float m_clusterPosition[MAX_NUMBER_BS_WORDS*2]; + SCT_SPACEPOINT_TYPE m_spacePoints[SCT_MAX_SP_PER_MODULE*MAX_SCT_BS_HEADERS/2]; + myushort4 m_decodedData[MAX_NUMBER_BS_WORDS*2]; + myushort2 m_clusterInfo[MAX_NUMBER_BS_WORDS*2]; + + } DECODED_SCT_DATA; + +} + +#endif diff --git a/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/Work.h b/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/Work.h new file mode 100644 index 0000000000000000000000000000000000000000..f51a73ddd5d63456647061d0e43cdda1e1fbb00a --- /dev/null +++ b/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/Work.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGACCELEVENT_WORK_H +#define TRIGACCELEVENT_WORK_H + +#include<memory> + +#include "OffloadBuffer.h" + +namespace TrigAccel { + + class Work { + + public: + + Work() {}; + virtual ~Work() {}; + virtual std::shared_ptr<OffloadBuffer> getOutput() = 0; + virtual bool run() = 0; + virtual unsigned int getId() const = 0; + + }; +} + +#endif diff --git a/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/WorkFactory.h b/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/WorkFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..077318d166b2585a68c4a35006c450e7c3d59ccb --- /dev/null +++ b/Trigger/TrigAccel/TrigAccelEvent/TrigAccelEvent/WorkFactory.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGACCELEVENT_WORKFACTORY_H +#define TRIGACCELEVENT_WORKFACTORY_H + +#include <iostream> +#include <vector> +#include <memory> + +#include "Work.h" + +namespace TrigAccel { + + class WorkFactory{ + public: + WorkFactory(){}; + virtual ~WorkFactory(){}; + virtual bool configure() = 0; + virtual Work* createWork(int, std::shared_ptr<OffloadBuffer> data) = 0; + virtual const std::vector<int> getProvidedAlgs() = 0; + virtual int getFactoryId() = 0; + }; + +} + +#endif diff --git a/Trigger/TrigAccel/TrigGpuTest/CMakeLists.txt b/Trigger/TrigAccel/TrigGpuTest/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..a66bca42ff1b1832232380b56cfe3f8c7fc5929c --- /dev/null +++ b/Trigger/TrigAccel/TrigGpuTest/CMakeLists.txt @@ -0,0 +1,19 @@ +################################################################################ +# Package: TrigGpuTest +################################################################################ + +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +link_libraries(stdc++fs) + +# Set the name of the package. +atlas_subdir( TrigGpuTest ) + +# External dependencies: + +find_package(TBB) + +atlas_add_executable( trigGpuTest + src/*.cxx + INCLUDE_DIRS ${TBB_INCLUDE_DIRS} + LINK_LIBRARIES TrigAccelEvent ${TBB_LIBRARIES} rt dl) diff --git a/Trigger/TrigAccel/TrigGpuTest/src/trigGpuTest.cxx b/Trigger/TrigAccel/TrigGpuTest/src/trigGpuTest.cxx new file mode 100644 index 0000000000000000000000000000000000000000..83dca524a5a2ac6f215648c5becad1c3729b5c05 --- /dev/null +++ b/Trigger/TrigAccel/TrigGpuTest/src/trigGpuTest.cxx @@ -0,0 +1,155 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <fstream> +#include <cstring> +#include <dlfcn.h> + +#include <experimental/filesystem> +#include "tbb/tick_count.h" + +#include "TrigAccelEvent/WorkFactory.h" +#include "TrigAccelEvent/DataExportBuffer.h" +#include "TrigAccelEvent/TrigInDetAccelEDM.h" +#include "TrigAccelEvent/TrigInDetAccelCodes.h" + +#include <vector> +#include <memory> + +int main(int argc, char* argv[]) { + if(argc < 4) { + std::cout<<"trigGpuTest usage: ./trigGpuTest <geo_file.bin> <data_dir> nevents"<<std::endl; + exit(0); + } + + + //open the factory library + + void* handle = dlopen("libTrigInDetCUDA.so", RTLD_LAZY); + + if(!handle) { + fprintf(stderr, "cannot load the factory library : %s\n", dlerror()); + exit(EXIT_FAILURE); + } + + dlerror(); + + //declare library interface methods + + TrigAccel::WorkFactory* (*getFactory)(); + int (*getFactoryId)(); + void (*deleteFactory)(TrigAccel::WorkFactory*); + + getFactory = (TrigAccel::WorkFactory* (*)()) dlsym(handle, "getFactory"); + getFactoryId = (int (*)()) dlsym(handle, "getFactoryId"); + deleteFactory = (void (*)(TrigAccel::WorkFactory*)) dlsym(handle, "deleteFactory"); + + std::cout<<"factory library id = "<<std::hex<<getFactoryId()<<std::dec<<std::endl; + + TrigAccel::WorkFactory* pW = getFactory(); + + bool cfgResult = pW->configure(); + + if(!cfgResult) { + std::cout<<"Factory config failed"<<std::endl; + exit(-2); + } + + + const size_t bufferOffset = 256; + + TrigAccel::DATA_EXPORT_BUFFER* pBG = new TrigAccel::DATA_EXPORT_BUFFER(); + + std::string geoName(argv[1]); + + std::cout<<"reading geometry from file "<<geoName<<std::endl; + + size_t bSize = pBG->load(geoName); + + std::cout<<"loaded "<<bSize<<" bytes"<<std::endl; + + std::shared_ptr<TrigAccel::OffloadBuffer> pDMBuff = std::make_shared<TrigAccel::OffloadBuffer>(pBG); + + delete pBG; + + std::cout<<"Creating Work item for task "<<TrigAccel::InDetJobControlCode::SIL_LAYERS_EXPORT<<std::endl; + + pW->createWork(TrigAccel::InDetJobControlCode::SIL_LAYERS_EXPORT, pDMBuff); + + + std::string data_path(argv[2]); + std::vector<std::string> event_files; + + for(const auto& entry : std::experimental::filesystem::directory_iterator(data_path)) { + event_files.push_back(entry.path()); + } + + int nEvents = atoi(argv[3]); + + std::cout<<"running the GPU test with "<<nEvents<<" events"<<std::endl; + + TrigAccel::DATA_EXPORT_BUFFER* pB = new TrigAccel::DATA_EXPORT_BUFFER(); + + int fileIdx = 0; + + std::ofstream timeFile("results.csv"); + + timeFile<<"nsp,nseeds,time"<<std::endl; + + for(int iEvent=0;iEvent<nEvents;iEvent++) { + + const std::string& fileName = event_files[fileIdx]; + + fileIdx++; + if(fileIdx >= (int)event_files.size()) { + fileIdx = 0; + } + + std::cout<<"reading event from file "<<fileName<<std::endl; + + bSize = pB->load(fileName); + + TrigAccel::SEED_MAKING_JOB* pJ = reinterpret_cast<TrigAccel::SEED_MAKING_JOB*>(pB->m_buffer + bufferOffset); + + TrigAccel::SPACEPOINT_STORAGE& sps = pJ->m_data; + + tbb::tick_count tzero = tbb::tick_count::now(); + + std::shared_ptr<TrigAccel::OffloadBuffer> pBuff = std::make_shared<TrigAccel::OffloadBuffer>(pB); + + TrigAccel::Work* pJob = pW->createWork(TrigAccel::InDetJobControlCode::MAKE_SEEDS, pBuff); + + if(!pJob) { + std::cout<<"ERROR: cannot create work item"<<std::endl; + exit(-3); + } + + pJob->run(); + + tbb::tick_count tnow=tbb::tick_count::now(); + tbb::tick_count::interval_t duration = tnow - tzero; + std::cout<<"triplet making took "<<duration.seconds()*1000.0<<" ms"<<std::endl; + + std::shared_ptr<TrigAccel::OffloadBuffer> pOB = pJob->getOutput(); + + TrigAccel::OUTPUT_SEED_STORAGE* pOutput = reinterpret_cast<TrigAccel::OUTPUT_SEED_STORAGE *>(pOB->m_rawBuffer); + + std::cout<<"Found "<<pOutput->m_nSeeds<<" triplets"<<std::endl; + timeFile<<sps.m_nSpacepoints<<","<<pOutput->m_nSeeds<<","<<duration.seconds()*1000.0<<std::endl; + + delete pJob; + } + + timeFile.close(); + + delete pB; + + deleteFactory(pW); + + dlclose(handle); + + + +} diff --git a/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/CMakeLists.txt b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..d7b7fa10044d639d9e12f6055dc0bad32e58591b --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/CMakeLists.txt @@ -0,0 +1,26 @@ +################################################################################ +# Package: TrigInDetAccelerationService +################################################################################ + +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: + +atlas_subdir( TrigInDetAccelerationService ) + +# External dependencies: + +find_package( TBB ) + +# Component(s) in the package: +atlas_add_library( TrigInDetAccelerationServiceLib + src/*.cxx + PUBLIC_HEADERS TrigInDetAccelerationService + INCLUDE_DIRS ${TBB_INCLUDE_DIRS} + LINK_LIBRARIES AthenaKernel GaudiKernel AthenaBaseComps StoreGateLib InDetIdentifier PixelReadoutGeometry SCT_ReadoutGeometry TrigAccelEvent ${TBB_LIBRARIES} rt dl) + +atlas_add_component( TrigInDetAccelerationService + src/components/*.cxx + LINK_LIBRARIES TrigInDetAccelerationServiceLib AthenaKernel GaudiKernel AthenaBaseComps StoreGateLib TrigAccelEvent ${TBB_LIBRARIES} rt dl) + +atlas_install_python_modules( python/*.py ) diff --git a/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/TrigInDetAccelerationService/ITrigInDetAccelerationSvc.h b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/TrigInDetAccelerationService/ITrigInDetAccelerationSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..be940bba0cdf3c1bb5890cd26ee1d393dd6d98ed --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/TrigInDetAccelerationService/ITrigInDetAccelerationSvc.h @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETACCELERATIONSERVICE_ITRIGINDETACCELERATIONSVC_H +#define TRIGINDETACCELERATIONSERVICE_ITRIGINDETACCELERATIONSVC_H + +#include "GaudiKernel/IService.h" + +#include "TrigAccelEvent/Work.h" +#include "TrigAccelEvent/OffloadBuffer.h" + +#include<memory> +#include<vector> + + +/// Service Interface for TrigInDetAccelerationSvc class + +class ITrigInDetAccelerationSvc : virtual public IService { + + public: + + /// Interface ID + DeclareInterfaceID(ITrigInDetAccelerationSvc,1,0); + + // main methods + + virtual bool isReady() const = 0; + virtual TrigAccel::Work* createWork(unsigned int, std::shared_ptr<TrigAccel::OffloadBuffer>) const = 0; + + //helper + + virtual const std::vector<short>& getLayerInformation(int) const = 0; + +}; + +#endif + diff --git a/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/python/TrigInDetAccelerationSvcDefault.py b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/python/TrigInDetAccelerationSvcDefault.py new file mode 100644 index 0000000000000000000000000000000000000000..1a5a9f3ed74eb83a29811dc93e9f3c70b885f5b6 --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/python/TrigInDetAccelerationSvcDefault.py @@ -0,0 +1,18 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# default configuration of TrigInDetAccelerationSvc + +# import the base class + +from TrigInDetAccelerationService.TrigInDetAccelerationServiceConf import TrigInDetAccelerationSvc + + +class TrigInDetAccelerationSvcDefault( TrigInDetAccelerationSvc ) : + + def __init__(self, name="TrigInDetAccelerationSvcDefault"): + # call base class constructor + TrigInDetAccelerationSvc.__init__( self, name="TrigInDetAccelerationSvc") + self.NumberOfDCs = 8 + + + diff --git a/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/src/TrigInDetAccelerationSvc.cxx b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/src/TrigInDetAccelerationSvc.cxx new file mode 100644 index 0000000000000000000000000000000000000000..700a080765f4950635dfab4aab1a22d31c64d68e --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/src/TrigInDetAccelerationSvc.cxx @@ -0,0 +1,363 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "InDetIdentifier/SCT_ID.h" +#include "InDetIdentifier/PixelID.h" + +#include "SCT_ReadoutGeometry/SCT_DetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" +#include "InDetReadoutGeometry/SiNumerology.h" +#include "InDetReadoutGeometry/SiDetectorElement.h" + +#include "TrigInDetAccelerationSvc.h" +#include "TrigAccelEvent/TrigInDetAccelCodes.h" +#include "TrigAccelEvent/TrigInDetAccelEDM.h" + +#include <dlfcn.h> + +////////// +/// Constructor +///// + +TrigInDetAccelerationSvc::TrigInDetAccelerationSvc( const std::string& name, ISvcLocator* pSvcLocator) : + base_class( name, pSvcLocator ), + m_nDCs(12), + m_moduleName("libTrigInDetCUDA.so"), + m_libHandle(0), + m_pWF(0), + m_detStore("DetectorStore", name), + m_evtStore("StoreGateSvc",name), + m_factoryConfigured(false) { + + declareProperty( "NumberOfDCs", m_nDCs = 8 ); + declareProperty( "ModuleName", m_moduleName = "libTrigInDetCUDA.so"); +} + + +////////// +/// Initialize +///// + +StatusCode TrigInDetAccelerationSvc::initialize() { + + ATH_MSG_INFO("TrigInDetAccelerationSvc: initialize"); + + ATH_CHECK (m_evtStore.retrieve() ); + ATH_CHECK (m_detStore.retrieve() ); + + //load the OffloadFactory library + + m_libHandle = dlopen(m_moduleName.c_str(), RTLD_LAZY); + + if(!m_libHandle) { + ATH_MSG_INFO("TrigInDetAccelerationSvc: cannot load the factory library, error:"<<dlerror()); + return StatusCode::SUCCESS; + } + + dlerror(); + + //declare library interface methods + + TrigAccel::WorkFactory* (*getFactory)(); + + getFactory = (TrigAccel::WorkFactory* (*)()) dlsym(m_libHandle, "getFactory"); + + m_pWF = getFactory(); + + bool cfgResult = m_pWF->configure(); + + if(!cfgResult) { + ATH_MSG_INFO("OffloadFactory config failed"); + m_factoryConfigured = false; + return StatusCode::SUCCESS; + } + + m_factoryConfigured = true; + + for(int i=0;i<3;i++) m_layerInfo[i].clear(); + + ATH_MSG_INFO("TrigInDetAccelerationSvc: created OffloadFactory, factory id = "<<std::hex<<m_pWF->getFactoryId()<<std::dec); + + /* + * Ask to be informed at the beginning of a new run so that we + * can collect geometry, conditions, etc. and copy them to on-GPU data structures + */ + + IIncidentSvc* incsvc; + StatusCode sc = service("IncidentSvc", incsvc); + int priority = 100; + if( sc.isSuccess() ) { + incsvc->addListener( this, "BeginRun", priority); + } + + return StatusCode::SUCCESS; +} + +///////// +/// Finalize +///// +StatusCode TrigInDetAccelerationSvc::finalize() { + + void (*deleteFactory)(TrigAccel::WorkFactory*); + deleteFactory = (void (*)(TrigAccel::WorkFactory*)) dlsym(m_libHandle, "deleteFactory"); + + deleteFactory(m_pWF); + + dlclose(m_libHandle); + + return StatusCode::SUCCESS; +} + + +///////// +/// OnBeginRun data gathering and export +///// + +void TrigInDetAccelerationSvc::handle(const Incident&) { + + ATH_MSG_INFO("OnBeginRun "); + + std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> > hashMap; + + if(!extractGeometryInformation(hashMap)) { + ATH_MSG_INFO("Geometry extraction failed"); + return; + } + + if(!exportGeometryInformation(hashMap)) { + ATH_MSG_INFO("Geometry export failed"); + } + + return; +} + +TrigAccel::Work* TrigInDetAccelerationSvc::createWork(unsigned int jobCode, std::shared_ptr<TrigAccel::OffloadBuffer> pB) const { + + if(!m_factoryConfigured) return 0; + + return m_pWF->createWork(jobCode, pB); + +} + + +const std::vector<short>& TrigInDetAccelerationSvc::getLayerInformation(int i) const { + if(i<0 || i>2) i = 0; + return m_layerInfo[i]; +} + + +bool TrigInDetAccelerationSvc::exportGeometryInformation(const std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >& hashMap) const { + + const InDetDD::SCT_DetectorManager * sct_mgr; + const InDetDD::PixelDetectorManager * pix_mgr; + + if (m_detStore->retrieve(sct_mgr, "SCT").isFailure()) { + ATH_MSG_WARNING("failed to get SCT Manager"); + return false; + + } + if (m_detStore->retrieve(pix_mgr,"Pixel").isFailure()) { + ATH_MSG_WARNING("failed to get SCT Manager"); + return false; + } + + //export layer structure + + size_t dataTypeSize = sizeof(TrigAccel::DETECTOR_MODEL); + const size_t bufferOffset = 256; + size_t totalSize = bufferOffset + dataTypeSize; + + TrigAccel::DATA_EXPORT_BUFFER* pBG = new TrigAccel::DATA_EXPORT_BUFFER(5000); + + if(!pBG->fit(totalSize)) pBG->reallocate(totalSize); + + TrigAccel::DETECTOR_MODEL* pArray = reinterpret_cast<TrigAccel::DETECTOR_MODEL*>(pBG->m_buffer + bufferOffset); + + memset(pArray,0,dataTypeSize); + + int nLayers = (int)hashMap.size(); + pArray->m_nLayers = nLayers; + pArray->m_nModules=0; + + int layerIdx=0; + + for(std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >::const_iterator it = hashMap.begin();it!=hashMap.end();++it, layerIdx++) { + short subdetid = std::get<0>((*it).first); + short barrel_ec = std::get<1>((*it).first); + + pArray->m_layers[layerIdx].m_nElements = 0; + pArray->m_layers[layerIdx].m_subdet = subdetid; + pArray->m_layers[layerIdx].m_type = barrel_ec; + + std::vector<std::vector<PhiEtaHash>::const_iterator> vStops; + vStops.push_back((*it).second.begin()); + std::vector<PhiEtaHash>::const_iterator firstIt = (*it).second.begin(); + std::vector<PhiEtaHash>::const_iterator nextIt = (*it).second.begin(); + ++nextIt; + + int nPhiSlices=0; + + for(; nextIt!=(*it).second.end();++nextIt, ++firstIt) { + if((*nextIt).m_phiIndex!=(*firstIt).m_phiIndex) { + vStops.push_back(nextIt); + nPhiSlices++; + } + } + + nPhiSlices++; + + vStops.push_back((*it).second.end()); + + float rc=0.0; + float minBound = 100000.0; + float maxBound =-100000.0; + + pArray->m_layers[layerIdx].m_nPhiSlices = nPhiSlices; + + //3. iterating over phi sectors + + for(unsigned int iStops = 1; iStops<vStops.size();iStops++) { + + int nPhiModules = 0; + + bool first = true; + + for(std::vector<PhiEtaHash>::const_iterator hIt = vStops[iStops-1];hIt!=vStops[iStops];++hIt, nPhiModules++) { + + pArray->m_hashArray[pArray->m_nModules] = (*hIt).m_hash; + + const InDetDD::SiDetectorElement *p = (subdetid==1) ? pix_mgr->getDetectorElement((*hIt).m_hash) : sct_mgr->getDetectorElement((*hIt).m_hash); + + if(first) { + first = false; + } + + pArray->m_layers[layerIdx].m_nElements++; + + const Amg::Vector3D& C = p->center(); + if(barrel_ec == 0) { + rc += sqrt(C(0)*C(0)+C(1)*C(1)); + if(p->zMin() < minBound) minBound = p->zMin(); + if(p->zMax() > maxBound) maxBound = p->zMax(); + pArray->m_minRZ[pArray->m_nModules] = p->zMin(); + pArray->m_maxRZ[pArray->m_nModules] = p->zMax(); + } + else { + rc += C(2); + if(p->rMin() < minBound) minBound = p->rMin(); + if(p->rMax() > maxBound) maxBound = p->rMax(); + pArray->m_minRZ[pArray->m_nModules] = p->rMin(); + pArray->m_maxRZ[pArray->m_nModules] = p->rMax(); + } + + pArray->m_nModules++; + } + + } + pArray->m_layers[layerIdx].m_refCoord = rc/pArray->m_layers[layerIdx].m_nElements; + pArray->m_layers[layerIdx].m_minBound = minBound; + pArray->m_layers[layerIdx].m_maxBound = maxBound; + } + + std::shared_ptr<TrigAccel::OffloadBuffer> pDMBuff = std::make_shared<TrigAccel::OffloadBuffer>(pBG); + + delete pBG; + + ATH_MSG_INFO("Creating Work item for task "<<TrigAccel::InDetJobControlCode::SIL_LAYERS_EXPORT); + + TrigAccel::Work* pW = createWork(TrigAccel::InDetJobControlCode::SIL_LAYERS_EXPORT, pDMBuff); + + return pW == 0;//request is actioned immediately, no actual WorkItem is created + +} + + + +bool TrigInDetAccelerationSvc::extractGeometryInformation(std::map<std::tuple<short,short,short>, std::vector<PhiEtaHash> >& hashMap) { + + const PixelID* pixelId; + const SCT_ID* sctId; + + if (m_detStore->retrieve(pixelId, "PixelID").isFailure()) { + ATH_MSG_WARNING("Could not get Pixel ID helper"); + return false; + } + + if (m_detStore->retrieve(sctId, "SCT_ID").isFailure()) { + ATH_MSG_WARNING("Could not get Pixel ID helper"); + return false; + } + + short subdetid = 1; + + for(int hash = 0; hash<(int)pixelId->wafer_hash_max(); hash++) { + + Identifier offlineId = pixelId->wafer_id(hash); + + if(offlineId==0) continue; + + short barrel_ec = pixelId->barrel_ec(offlineId); + if(abs(barrel_ec)>2) continue;//no DBM needed + short layer_disk = pixelId->layer_disk(offlineId); + short phi_index = pixelId->phi_module(offlineId); + short eta_index = pixelId->eta_module(offlineId); + auto t = std::make_tuple(subdetid, barrel_ec, layer_disk); + std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >::iterator it = hashMap.find(t); + if(it==hashMap.end()) + hashMap.insert(std::pair<std::tuple<short,short,short>,std::vector<PhiEtaHash> >(t,std::vector<PhiEtaHash>(1, PhiEtaHash(phi_index, eta_index, hash) ))); + else (*it).second.push_back(PhiEtaHash(phi_index, eta_index, hash)); + } + subdetid = 2; + for(int hash = 0; hash<(int)sctId->wafer_hash_max(); hash++) { + + Identifier offlineId = sctId->wafer_id(hash); + + if(offlineId==0) continue; + + short barrel_ec = sctId->barrel_ec(offlineId); + short layer_disk = sctId->layer_disk(offlineId); + short phi_index = sctId->phi_module(offlineId); + short eta_index = sctId->eta_module(offlineId); + + auto t = std::make_tuple(subdetid, barrel_ec, layer_disk); + std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >::iterator it = hashMap.find(t); + if(it==hashMap.end()) + hashMap.insert(std::pair<std::tuple<short,short,short>,std::vector<PhiEtaHash> >(t,std::vector<PhiEtaHash>(1, PhiEtaHash(phi_index, eta_index, hash)))); + else (*it).second.push_back(PhiEtaHash(phi_index, eta_index, hash)); + } + + m_layerInfo[1].resize(pixelId->wafer_hash_max(), -1); + m_layerInfo[2].resize(sctId->wafer_hash_max(), -1); + + int layerId=0; + + for(std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >::iterator it = hashMap.begin();it!=hashMap.end();++it, layerId++) { + + short subdetId = std::get<0>((*it).first); + short barrel_ec = std::get<1>((*it).first); + + m_layerInfo[0].push_back(barrel_ec); + + if(subdetId == 1) {//pixel + for(std::vector<PhiEtaHash>::iterator hIt = (*it).second.begin();hIt != (*it).second.end();++hIt) { + m_layerInfo[subdetId][(*hIt).m_hash] = layerId; + } + } + if(subdetId == 2) {//SCT + for(std::vector<PhiEtaHash>::iterator hIt = (*it).second.begin();hIt != (*it).second.end();++hIt) { + m_layerInfo[subdetId][(*hIt).m_hash] = layerId; + } + } + } + + + for(std::map<std::tuple<short,short,short>,std::vector<PhiEtaHash> >::iterator it = hashMap.begin();it!=hashMap.end();++it) { + + //sorting along phi first, then along eta + + std::sort((*it).second.begin(), (*it).second.end(), PhiEtaHash::compare()); + + } + return true; +} diff --git a/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/src/TrigInDetAccelerationSvc.h b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/src/TrigInDetAccelerationSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..b778445330d2686743ccd4346210b611cbb17187 --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/src/TrigInDetAccelerationSvc.h @@ -0,0 +1,87 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETACCELERATIONSERVICE_TRIGINDETACCELERATIONSVC_H +#define TRIGINDETACCELERATIONSERVICE_TRIGINDETACCELERATIONSVC_H + +#include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/IIncidentSvc.h" + +#include "TrigInDetAccelerationService/ITrigInDetAccelerationSvc.h" + +#include "AthenaBaseComps/AthService.h" + +#include "GaudiKernel/ServiceHandle.h" + +#include "StoreGate/StoreGateSvc.h" + +#include "TrigAccelEvent/WorkFactory.h" + +#include<vector> +#include<map> +#include<cstring> + +/// Service for creating GPU-accelerated Work items for HLT ID algorithms + +class TrigInDetAccelerationSvc : public extends<AthService, ITrigInDetAccelerationSvc, IIncidentListener> { + + public: + + TrigInDetAccelerationSvc( const std::string&, ISvcLocator*); + + virtual ~TrigInDetAccelerationSvc() override {}; + + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual void handle(const Incident&) override; + + virtual bool isReady() const override { + return m_factoryConfigured; + } + + virtual TrigAccel::Work* createWork(unsigned int, std::shared_ptr<TrigAccel::OffloadBuffer>) const override; + virtual const std::vector<short>& getLayerInformation(int) const override; + + private: + + struct PhiEtaHash { + + struct compare { + public: + bool operator()(const struct PhiEtaHash& p1, const struct PhiEtaHash& p2) { + if(p1.m_phiIndex == p2.m_phiIndex) { + return p1.m_etaIndex < p2.m_etaIndex; + } + else { + return p1.m_phiIndex < p2.m_phiIndex; + } + } + }; + + public: + PhiEtaHash(short phi, short eta, int hash) : m_phiIndex(phi), m_etaIndex(eta), m_hash(hash) {}; + PhiEtaHash(const PhiEtaHash& p) : m_phiIndex(p.m_phiIndex), m_etaIndex(p.m_etaIndex), m_hash(p.m_hash) {}; + short m_phiIndex, m_etaIndex; + int m_hash; + }; + + int m_nDCs; + std::string m_moduleName; + void* m_libHandle; //for OffloadFactory + TrigAccel::WorkFactory* m_pWF; + ServiceHandle<StoreGateSvc> m_detStore; + ServiceHandle<StoreGateSvc> m_evtStore; + + bool m_factoryConfigured; + + bool exportGeometryInformation(const std::map<std::tuple<short,short,short>, std::vector<PhiEtaHash> >&) const; + bool extractGeometryInformation(std::map<std::tuple<short,short,short>, std::vector<PhiEtaHash> >&); + + std::vector<short> m_layerInfo[3]; + +}; + + + +#endif diff --git a/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/src/components/TrigInDetAccelerationService_entries.cxx b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/src/components/TrigInDetAccelerationService_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b9e792b384e2bfe549b65e4ad28a320bbce70f61 --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationService/src/components/TrigInDetAccelerationService_entries.cxx @@ -0,0 +1,9 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "../TrigInDetAccelerationSvc.h" + +DECLARE_COMPONENT( TrigInDetAccelerationSvc ) + + diff --git a/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/CMakeLists.txt b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..094c19a9393dd872daf9cadcba66fca847894635 --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/CMakeLists.txt @@ -0,0 +1,24 @@ +################################################################################ +# Package: TrigInDetAccelerationTool +################################################################################ + +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( TrigInDetAccelerationTool ) + +# Component(s) in the package: + +atlas_add_library( TrigInDetAccelerationToolLib + src/*.cxx + INTERFACE + PUBLIC_HEADERS TrigInDetAccelerationTool + LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetIdentifier TrigInDetEvent TrigSteeringEvent TrigInDetPattRecoTools AthenaBaseComps InDetIdentifier TrigInDetPattRecoEvent TrigAccelEvent TrigInDetAccelerationServiceLib) + +atlas_add_component( TrigInDetAccelerationTool + src/components/*.cxx + LINK_LIBRARIES TrigInDetAccelerationToolLib) + + + + diff --git a/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/TrigInDetAccelerationTool/ITrigInDetAccelerationTool.h b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/TrigInDetAccelerationTool/ITrigInDetAccelerationTool.h new file mode 100644 index 0000000000000000000000000000000000000000..6023fea67bbbc2eedfb2dd6d80f2d7e85ace980a --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/TrigInDetAccelerationTool/ITrigInDetAccelerationTool.h @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETACCELERATIONTOOL_ITRIGINDETACCELERATIONTOOL_H +#define TRIGINDETACCELERATIONTOOL_ITRIGINDETACCELERATIONTOOL_H + +#include <vector> +#include "GaudiKernel/IAlgTool.h" +#include "TrigSteeringEvent/TrigRoiDescriptor.h" +#include "TrigInDetEvent/TrigSiSpacePointBase.h" +#include "TrigInDetPattRecoTools/TrigCombinatorialSettings.h" +#include "TrigAccelEvent/DataExportBuffer.h" + +static const InterfaceID IID_ITrigInDetAccelerationTool("ITrigInDetAccelerationTool", 1 , 0); + +class ITrigInDetAccelerationTool: virtual public IAlgTool +{ + public: + + static const InterfaceID& interfaceID() { + return IID_ITrigInDetAccelerationTool; + } + + virtual size_t exportSeedMakingJob(const TrigCombinatorialSettings&, const IRoiDescriptor*, const std::vector<TrigSiSpacePointBase>&, TrigAccel::DATA_EXPORT_BUFFER&) const = 0; + +}; + +#endif diff --git a/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/src/TrigInDetAccelerationTool.cxx b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/src/TrigInDetAccelerationTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cdc4f5a3d31ab4d989cf99680b4abbc96a2a44ee --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/src/TrigInDetAccelerationTool.cxx @@ -0,0 +1,171 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigInDetAccelerationTool.h" +#include "AthenaBaseComps/AthMsgStreamMacros.h" +#include "AthenaBaseComps/AthCheckMacros.h" +#include "TrigAccelEvent/TrigInDetAccelEDM.h" + +TrigInDetAccelerationTool::TrigInDetAccelerationTool(const std::string& t, + const std::string& n, + const IInterface* p ): AthAlgTool(t,n,p), + m_accelSvc("TrigInDetAccelerationSvc",this->name()) { + + declareInterface< ITrigInDetAccelerationTool >( this ); +} + +StatusCode TrigInDetAccelerationTool::initialize() { + + ATH_CHECK(m_accelSvc.retrieve()); + return StatusCode::SUCCESS; +} + +StatusCode TrigInDetAccelerationTool::finalize() { + return StatusCode::SUCCESS; +} + +size_t TrigInDetAccelerationTool::exportSeedMakingJob(const TrigCombinatorialSettings& tcs, const IRoiDescriptor* roi, const std::vector<TrigSiSpacePointBase>& vsp, TrigAccel::DATA_EXPORT_BUFFER& output) const { + + typedef struct SpIndexPair { + public: + + struct compareZ { + public: + bool operator()(const std::pair<int, const TrigSiSpacePointBase*>& p1, const std::pair<int, const TrigSiSpacePointBase*>& p2) { + return p1.second->z() < p2.second->z(); + } + }; + + struct compareR { + public: + bool operator()(const std::pair<int, const TrigSiSpacePointBase*>& p1, const std::pair<int, const TrigSiSpacePointBase*>& p2) { + return p1.second->r() < p2.second->r(); + } + }; + + } SP_INDEX_PAIR; + + + //0. get InDet geometry information + + const std::vector<short>& pixelLayers = m_accelSvc->getLayerInformation(1); + const std::vector<short>& sctLayers = m_accelSvc->getLayerInformation(2); + const std::vector<short>& layerTypes = m_accelSvc->getLayerInformation(0); + + + //1. check buffer size + + size_t dataTypeSize = sizeof(TrigAccel::SEED_MAKING_JOB); + const size_t bufferOffset = 256; + size_t totalSize = bufferOffset+dataTypeSize;//make room for the header + if(!output.fit(totalSize)) output.reallocate(totalSize); + + TrigAccel::SEED_MAKING_JOB* pJ = reinterpret_cast<TrigAccel::SEED_MAKING_JOB*>(output.m_buffer+bufferOffset); + + memset(pJ,0,dataTypeSize); + + TrigAccel::SEED_FINDER_SETTINGS& sfs = pJ->m_settings; + + sfs.m_maxBarrelPix = tcs.m_maxBarrelPix; + sfs.m_minEndcapPix = tcs.m_minEndcapPix; + sfs.m_maxEndcapPix = tcs.m_maxEndcapPix; + sfs.m_maxSiliconLayer = tcs.m_maxSiliconLayer; + + sfs.m_magFieldZ = tcs.m_magFieldZ; + + sfs.m_tripletD0Max = tcs.m_tripletD0Max; + sfs.m_tripletD0_PPS_Max = tcs.m_tripletD0_PPS_Max; + sfs.m_tripletPtMin = tcs.m_tripletPtMin; + sfs.m_tripletDoPSS = tcs.m_tripletDoPSS ? 1 : 0; + sfs.m_doubletFilterRZ = tcs.m_doubletFilterRZ ? 1 : 0; + sfs.m_nMaxPhiSlice = tcs.m_nMaxPhiSlice; + sfs.m_maxTripletBufferLength = tcs.m_maxTripletBufferLength; + sfs.m_isFullScan = 1; + + sfs.m_zedMinus = roi->zedMinus(); + sfs.m_zedPlus = roi->zedPlus(); + + TrigAccel::SPACEPOINT_STORAGE& sps = pJ->m_data; + + unsigned int nSP = vsp.size(); + if(nSP >= TrigAccel::MAX_NUMBER_SPACEPOINTS) { + nSP = TrigAccel::MAX_NUMBER_SPACEPOINTS-1; + ATH_MSG_WARNING("MAX_NUMBER_SPACEPOINTS exceeded, exported data truncated ..."); + } + + //2. arrange spacepoints into phi/Layer bins + + double phiSliceWidth = 2*M_PI/tcs.m_nMaxPhiSlice; + int nLayers = (int) layerTypes.size(); + int nSlices = (int) tcs.m_nMaxPhiSlice; + + std::vector<std::vector<std::pair<int, const TrigSiSpacePointBase*> > > phiLArray; + phiLArray.resize(nLayers*nSlices); + + for(unsigned int i=0;i<nSP;i++) { + const TrigSiSpacePointBase& sp = vsp[i]; + const std::pair<IdentifierHash, IdentifierHash>& els = sp.offlineSpacePoint()->elementIdList(); + + IdentifierHash hashId = els.first; + short layerId = -1; + if(sp.isPixel()) { + layerId = pixelLayers[hashId]; + } else { + layerId = sctLayers[hashId]; + } + int phiIdx = (sp.phi()+M_PI)/phiSliceWidth; + if (phiIdx >= tcs.m_nMaxPhiSlice) { + phiIdx %= tcs.m_nMaxPhiSlice; + } + else if (phiIdx < 0) { + phiIdx += tcs.m_nMaxPhiSlice; + phiIdx %= tcs.m_nMaxPhiSlice; + } + + std::vector<std::pair<int, const TrigSiSpacePointBase*> >& v = phiLArray[layerId + phiIdx*nLayers]; + v.push_back(std::pair<int, const TrigSiSpacePointBase*>(i,&sp));//storing the original index of spacepoint + } + + //sorting spacepoints in accordance with non-ref coordinate + int layerIdx=0; + for(std::vector<short>::const_iterator it = layerTypes.begin();it!=layerTypes.end();++it, layerIdx++) { + short barrel_ec = (*it);//0-barrel, !=0 - endcap + for(int slice = 0;slice<nSlices;slice++) { + std::vector<std::pair<int, const TrigSiSpacePointBase*> >& v = phiLArray[layerIdx + slice*nLayers]; + if(barrel_ec==0) std::sort(v.begin(), v.end(), SP_INDEX_PAIR::compareZ()); + else std::sort(v.begin(), v.end(), SP_INDEX_PAIR::compareR()); + } + } + + sps.m_nSpacepoints = nSP; + sps.m_nPhiSlices = nSlices; + sps.m_nLayers = nLayers; + + int spIdx=0; + for(int slice = 0;slice<nSlices;slice++) { + for(int layer = 0;layer<nLayers;layer++) { + int layerStart = spIdx; + std::vector<std::pair<int, const TrigSiSpacePointBase*> >& v = phiLArray[layer + slice*nLayers]; + for(std::vector<std::pair<int, const TrigSiSpacePointBase*> >::iterator it = v.begin();it!=v.end();++it) { + const TrigSiSpacePointBase* sp = (*it).second; + sps.m_index[spIdx] = (*it).first; + sps.m_type[spIdx] = sp->isPixel() ? 1 : 2; + sps.m_x[spIdx] = sp->x(); + sps.m_y[spIdx] = sp->y(); + sps.m_z[spIdx] = sp->z(); + sps.m_r[spIdx] = sp->r(); + sps.m_phi[spIdx] = sp->phi(); + sps.m_covR[spIdx] = sp->dr()*sp->dr(); + sps.m_covZ[spIdx] = sp->dz()*sp->dz(); + spIdx++; + } + int layerEnd = spIdx; + sps.m_phiSlices[slice].m_layerBegin[layer] = layerStart; + sps.m_phiSlices[slice].m_layerEnd[layer] = layerEnd; + } + } + + return totalSize; + +} diff --git a/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/src/TrigInDetAccelerationTool.h b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/src/TrigInDetAccelerationTool.h new file mode 100644 index 0000000000000000000000000000000000000000..d50de231983d3bcb1dde6363241db91eb7eb0ef1 --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/src/TrigInDetAccelerationTool.h @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETACCELERATIONTOOL_TRIGINDETACCELERATIONTOOL_H +#define TRIGINDETACCELERATIONTOOL_TRIGINDETACCELERATIONTOOL_H + +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" + +#include "TrigInDetAccelerationTool/ITrigInDetAccelerationTool.h" + +#include "TrigInDetAccelerationService/ITrigInDetAccelerationSvc.h" + +class TrigInDetAccelerationTool: public AthAlgTool, virtual public ITrigInDetAccelerationTool { + + public: + TrigInDetAccelerationTool( const std::string&, const std::string&, const IInterface* ); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + + size_t virtual exportSeedMakingJob(const TrigCombinatorialSettings&, const IRoiDescriptor*, const std::vector<TrigSiSpacePointBase>&, TrigAccel::DATA_EXPORT_BUFFER&) const override; + + private: + + ServiceHandle<ITrigInDetAccelerationSvc> m_accelSvc; +}; + +#endif diff --git a/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/src/components/TrigInDetAccelerationTool_entries.cxx b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/src/components/TrigInDetAccelerationTool_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..89fd2d814a270a1de6ae82bbf539ac6914215a39 --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetAccel/TrigInDetAccelerationTool/src/components/TrigInDetAccelerationTool_entries.cxx @@ -0,0 +1,7 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "../TrigInDetAccelerationTool.h" + +DECLARE_COMPONENT( TrigInDetAccelerationTool ) diff --git a/Trigger/TrigAccel/TrigInDetCUDA/CMakeLists.txt b/Trigger/TrigAccel/TrigInDetCUDA/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..946095f976c5377553fa88ba99758999b3334f38 --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetCUDA/CMakeLists.txt @@ -0,0 +1,26 @@ +################################################################################ +# Package: TrigInDetCUDA +################################################################################ + +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# Set the name of the package. +atlas_subdir( TrigInDetCUDA ) + +# As long as this CUDA code can't be interpreted by a C++ compiler as well, +# this package is not to be built. +if( NOT CMAKE_CUDA_COMPILER ) + message( STATUS "CUDA not found, TrigInDetCUDA is not built" ) + return() +endif() + +# External dependencies: +find_package( TBB ) + +# Add a component library that has some CUDA code in it. +atlas_add_component( TrigInDetCUDA + src/*.h src/*.cuh src/*.cu + INCLUDE_DIRS ${TBB_INCLUDE_DIRS} + LINK_LIBRARIES TrigAccelEvent ${TBB_LIBRARIES}) + + diff --git a/Trigger/TrigAccel/TrigInDetCUDA/src/DoubletCountingKernelCuda.cuh b/Trigger/TrigAccel/TrigInDetCUDA/src/DoubletCountingKernelCuda.cuh new file mode 100644 index 0000000000000000000000000000000000000000..3a3a1f94824091a6de00e08be4b745722c3abf5a --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetCUDA/src/DoubletCountingKernelCuda.cuh @@ -0,0 +1,160 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETCUDA_DOUBLETCOUNTINGKERNELCUDA_CUH +#define TRIGINDETCUDA_DOUBLETCOUNTINGKERNELCUDA_CUH + +#include <cuda_runtime.h> + +#include "SeedMakingDataStructures.h" + +__global__ static void doubletCountingKernel(TrigAccel::SEED_FINDER_SETTINGS* dSettings, + TrigAccel::SPACEPOINT_STORAGE* dSpacepoints, + TrigAccel::DETECTOR_MODEL* dDetModel, + DOUBLET_INFO* d_Info, + int nLayers, int nSlices) { + + __shared__ int spBegin; + __shared__ int spEnd; + __shared__ int nMiddleSPs; + + __shared__ int nInner[NUM_MIDDLE_THREADS]; + __shared__ int nOuter[NUM_MIDDLE_THREADS]; + + const float zTolerance = 3.0; + const float maxEta = 2.7; + const float maxDoubletLength = 200.0; + const float minDoubletLength = 10.0; + const float maxOuterRadius = 550.0; + + const int sliceIdx = blockIdx.x; + const int layerIdx = blockIdx.y; + + if(threadIdx.x == 0 && threadIdx.y == 0) { + const TrigAccel::SPACEPOINT_LAYER_RANGE& slr = dSpacepoints->m_phiSlices[sliceIdx]; + spBegin = slr.m_layerBegin[layerIdx]; + spEnd = slr.m_layerEnd[layerIdx]; + nMiddleSPs = spEnd-spBegin; + } + __syncthreads(); + + if(nMiddleSPs == 0) return; + + const float zMinus = dSettings->m_zedMinus - zTolerance; + const float zPlus = dSettings->m_zedPlus + zTolerance; + const float maxTheta = 2*atan(exp(-maxEta)); + const float maxCtg = cos(maxTheta)/sin(maxTheta); + const bool DoPSS = dSettings->m_tripletDoPSS; + const float minOuterZ = dSettings->m_zedMinus - maxOuterRadius*maxCtg - zTolerance; + const float maxOuterZ = dSettings->m_zedPlus + maxOuterRadius*maxCtg + zTolerance; + + //1. get a tile of middle spacepoints + + for(int spmIdx=threadIdx.x+spBegin;spmIdx<spEnd;spmIdx+=blockDim.x) { + + int spmType = dSpacepoints->m_type[spmIdx]; + float zm = dSpacepoints->m_z[spmIdx]; + float rm = dSpacepoints->m_r[spmIdx]; + + bool isPixel = (spmType == 1); + + if(threadIdx.y ==0) { + nInner[threadIdx.x] = 0; + nOuter[threadIdx.x] = 0; + d_Info->m_nInner[spmIdx] = 0; + d_Info->m_nOuter[spmIdx] = 0; + } + + __syncthreads(); + + //2. loop over other phi-bins / layers + + for(int deltaPhiIdx=-1;deltaPhiIdx<=1;deltaPhiIdx++) { + int nextPhiIdx = sliceIdx + deltaPhiIdx; + if(nextPhiIdx>=nSlices) nextPhiIdx = 0; + if(nextPhiIdx<0) nextPhiIdx=nSlices-1; + const TrigAccel::SPACEPOINT_LAYER_RANGE& next_slr = dSpacepoints->m_phiSlices[nextPhiIdx]; + + for(int nextLayerIdx=0;nextLayerIdx<nLayers;nextLayerIdx++) { + if(nextLayerIdx == layerIdx) continue; + + int next_spBegin = next_slr.m_layerBegin[nextLayerIdx]; + int next_spEnd = next_slr.m_layerEnd[nextLayerIdx]; + + if(next_spEnd == next_spBegin) continue;//no spacepoints in this layer + + const TrigAccel::SILICON_LAYER& layerGeo = dDetModel->m_layers[nextLayerIdx]; + bool isBarrel = (layerGeo.m_type == 0); + float refCoord = layerGeo.m_refCoord; + + if(isBarrel && fabs(refCoord-rm)>maxDoubletLength) continue; + + //boundaries for nextLayer + + float minCoord = 10000.0; + float maxCoord =-10000.0; + + if(isBarrel) { + minCoord = zMinus + refCoord*(zm-zMinus)/rm; + maxCoord = zPlus + refCoord*(zm-zPlus)/rm; + } + else { + minCoord = rm*(refCoord-zMinus)/(zm-zMinus); + maxCoord = rm*(refCoord-zPlus)/(zm-zPlus); + } + + if(minCoord>maxCoord) { + float tmp = maxCoord;maxCoord = minCoord;minCoord = tmp; + } + + if(layerGeo.m_maxBound<minCoord || layerGeo.m_minBound>maxCoord) continue; + + //3. get a tile of inner/outer spacepoints + + for(int spIdx=threadIdx.y+next_spBegin;spIdx<next_spEnd;spIdx+=blockDim.y) { + + float zsp = dSpacepoints->m_z[spIdx]; + float rsp = dSpacepoints->m_r[spIdx]; + + float spCoord = (isBarrel) ? zsp : rsp; + + if(spCoord<minCoord || spCoord>maxCoord) continue; + + bool isPixel2 = (dSpacepoints->m_type[spIdx] == 1); + float dr = rsp - rm; + + if(fabs(dr)>maxDoubletLength || fabs(dr)<minDoubletLength) continue; + + if(!DoPSS && dr<0 && !isPixel && isPixel2) continue; + + float dz = zsp - zm; + float t = dz/dr; + + if(fabs(t)>maxCtg) continue; + //if(dr > 0) {//outer doublet + float outZ = zsp + (maxOuterRadius-rsp)*t; + if(outZ < minOuterZ || outZ > maxOuterZ) continue; + //} + if(dr > 0) + atomicAdd(&nOuter[threadIdx.x],1); + else + atomicAdd(&nInner[threadIdx.x],1); + } + } + } + + __syncthreads(); + + if(threadIdx.y == 0) { + d_Info->m_nInner[spmIdx] = nInner[threadIdx.x]; + d_Info->m_nOuter[spmIdx] = nOuter[threadIdx.x]; + d_Info->m_good[spmIdx] = (nInner[threadIdx.x] > 0 && nOuter[threadIdx.x] > 0) ? 1 : 0; + } + __syncthreads(); + } + __syncthreads(); + +} + +#endif diff --git a/Trigger/TrigAccel/TrigInDetCUDA/src/DoubletMakingKernelCuda.cuh b/Trigger/TrigAccel/TrigInDetCUDA/src/DoubletMakingKernelCuda.cuh new file mode 100644 index 0000000000000000000000000000000000000000..2a5d13614c8caf11771edc3a7305fc9ffcc8d996 --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetCUDA/src/DoubletMakingKernelCuda.cuh @@ -0,0 +1,177 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETCUDA_DOUBLETMAKINGKERNELCUDA_CUH +#define TRIGINDETCUDA_DOUBLETMAKINGKERNELCUDA_CUH + +#include <cuda_runtime.h> +#include "SeedMakingDataStructures.h" + +__global__ static void doubletMakingKernel(TrigAccel::SEED_FINDER_SETTINGS* dSettings, + TrigAccel::SPACEPOINT_STORAGE* dSpacepoints, + TrigAccel::DETECTOR_MODEL* dDetModel, + TrigAccel::OUTPUT_SEED_STORAGE* d_Out, + DOUBLET_INFO* d_Info, + DOUBLET_STORAGE* d_Storage, + int nLayers, int nSlices) { + + __shared__ int spBegin; + __shared__ int spEnd; + __shared__ int nMiddleSPs; + + __shared__ bool hasDoublets; + + __shared__ int outerPos[NUM_MIDDLE_THREADS]; + __shared__ int innerPos[NUM_MIDDLE_THREADS]; + + const float zTolerance = 3.0; + const float maxEta = 2.7; + const float maxDoubletLength = 200.0; + const float minDoubletLength = 10.0; + const float maxOuterRadius = 550.0; + + const int sliceIdx = blockIdx.x; + const int layerIdx = blockIdx.y; + + if(threadIdx.x == 0 && threadIdx.y == 0) { + const TrigAccel::SPACEPOINT_LAYER_RANGE& slr = dSpacepoints->m_phiSlices[sliceIdx]; + spBegin = slr.m_layerBegin[layerIdx]; + spEnd = slr.m_layerEnd[layerIdx]; + nMiddleSPs = spEnd-spBegin; + } + __syncthreads(); + + if(nMiddleSPs == 0) return; + + const float zMinus = dSettings->m_zedMinus - zTolerance; + const float zPlus = dSettings->m_zedPlus + zTolerance; + const float maxTheta = 2*atan(exp(-maxEta)); + const float maxCtg = cos(maxTheta)/sin(maxTheta); + const bool DoPSS = dSettings->m_tripletDoPSS; + const float minOuterZ = dSettings->m_zedMinus - maxOuterRadius*maxCtg - zTolerance; + const float maxOuterZ = dSettings->m_zedPlus + maxOuterRadius*maxCtg + zTolerance; + + //1. get a tile of middle spacepoints + + __syncthreads(); + + for(int spmIdx=threadIdx.x+spBegin;spmIdx<spEnd;spmIdx+=blockDim.x) { + + if(threadIdx.y ==0) { + hasDoublets = d_Info->m_good[spmIdx] == 1; + } + __syncthreads(); + + if(!hasDoublets) continue; + + if(threadIdx.y ==0) {//loading pre-calculated numbers of doublets ... + + int nInner = d_Info->m_nInner[spmIdx]; + int nOuter = d_Info->m_nOuter[spmIdx]; + + outerPos[threadIdx.x] = atomicAdd(&d_Storage->m_nO, nOuter); + innerPos[threadIdx.x] = atomicAdd(&d_Storage->m_nI, nInner); + int k = atomicAdd(&d_Storage->m_nItems, 1); + d_Storage->m_spmIdx[k] = spmIdx; + d_Storage->m_innerStart[k] = innerPos[threadIdx.x]; + d_Storage->m_outerStart[k] = outerPos[threadIdx.x]; + } + + __syncthreads(); + + int spmType = dSpacepoints->m_type[spmIdx]; + float zm = dSpacepoints->m_z[spmIdx]; + float rm = dSpacepoints->m_r[spmIdx]; + bool isPixel = (spmType == 1); + + //2. loop over other phi-bins / layers + + for(int deltaPhiIdx=-1;deltaPhiIdx<=1;deltaPhiIdx++) { + int nextPhiIdx = sliceIdx + deltaPhiIdx; + if(nextPhiIdx>=nSlices) nextPhiIdx = 0; + if(nextPhiIdx<0) nextPhiIdx=nSlices-1; + const TrigAccel::SPACEPOINT_LAYER_RANGE& next_slr = dSpacepoints->m_phiSlices[nextPhiIdx]; + + for(int nextLayerIdx=0;nextLayerIdx<nLayers;nextLayerIdx++) { + + if(nextLayerIdx == layerIdx) continue; + + int next_spBegin = next_slr.m_layerBegin[nextLayerIdx]; + int next_spEnd = next_slr.m_layerEnd[nextLayerIdx]; + + if(next_spEnd == next_spBegin) continue;//no spacepoints in this layer + + const TrigAccel::SILICON_LAYER& layerGeo = dDetModel->m_layers[nextLayerIdx]; + bool isBarrel = (layerGeo.m_type == 0); + float refCoord = layerGeo.m_refCoord; + + if(isBarrel && fabs(refCoord-rm)>maxDoubletLength) continue; + + //boundaries for nextLayer + + float minCoord = 10000.0; + float maxCoord =-10000.0; + + if(isBarrel) { + minCoord = zMinus + refCoord*(zm-zMinus)/rm; + maxCoord = zPlus + refCoord*(zm-zPlus)/rm; + } + else { + minCoord = rm*(refCoord-zMinus)/(zm-zMinus); + maxCoord = rm*(refCoord-zPlus)/(zm-zPlus); + } + + if(minCoord>maxCoord) { + float tmp = maxCoord;maxCoord = minCoord;minCoord = tmp; + } + + if(layerGeo.m_maxBound<minCoord || layerGeo.m_minBound>maxCoord) continue; + + //3. get a tile of inner/outer spacepoints + + for(int spIdx=threadIdx.y+next_spBegin;spIdx<next_spEnd;spIdx+=blockDim.y) { + + float zsp = dSpacepoints->m_z[spIdx]; + float rsp = dSpacepoints->m_r[spIdx]; + + float spCoord = (isBarrel) ? zsp : rsp; + + if(spCoord<minCoord || spCoord>maxCoord) continue; + + bool isPixel2 = (dSpacepoints->m_type[spIdx] == 1); + float dr = rsp - rm; + + if(fabs(dr)>maxDoubletLength || fabs(dr)<minDoubletLength) continue; + + if(!DoPSS && dr<0 && !isPixel && isPixel2) continue; + + float dz = zsp - zm; + float t = dz/dr; + + if(fabs(t)>maxCtg) continue; + //if(dr > 0) {//outer doublet + float outZ = zsp + (maxOuterRadius-rsp)*t; + if(outZ < minOuterZ || outZ > maxOuterZ) continue; + //} + if(dr > 0) { + int k = atomicAdd(&outerPos[threadIdx.x],1); + d_Storage->m_outer[k] = spIdx; + } + else { + int k = atomicAdd(&innerPos[threadIdx.x],1); + d_Storage->m_inner[k] = spIdx; + } + } + } + } + } + __syncthreads(); + + if(threadIdx.x == 0 && threadIdx.y == 0) { + atomicAdd(&d_Out->m_nMiddleSps, nMiddleSPs); + } + +} + +#endif \ No newline at end of file diff --git a/Trigger/TrigAccel/TrigInDetCUDA/src/DoubletMatchingKernelCuda.cuh b/Trigger/TrigAccel/TrigInDetCUDA/src/DoubletMatchingKernelCuda.cuh new file mode 100644 index 0000000000000000000000000000000000000000..4a041c4a5674007a482bec9ec579f46b29f994ae --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetCUDA/src/DoubletMatchingKernelCuda.cuh @@ -0,0 +1,313 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETCUDA_DOUBLETMATCHINGKERNELCUDA_CUH +#define TRIGINDETCUDA_DOUBLETMATCHINGKERNELCUDA_CUH + + +#include <cuda_runtime.h> +#include "SeedMakingDataStructures.h" + + +__global__ static void doubletMatchingKernel(TrigAccel::SEED_FINDER_SETTINGS* dSettings, + TrigAccel::SPACEPOINT_STORAGE* dSpacepoints, + TrigAccel::DETECTOR_MODEL* dDetModel, + DOUBLET_INFO* d_Info, + DOUBLET_STORAGE* d_Storage, + TrigAccel::OUTPUT_SEED_STORAGE* d_Out, int maxItem) { + + __shared__ int nInner; + __shared__ int nOuter; + + __shared__ int innerStart; + __shared__ int outerStart; + + __shared__ int spmIdx; + __shared__ float rm; + + __shared__ float covZ; + __shared__ float covR; + + __shared__ float x0; + __shared__ float y0; + __shared__ float z0; + + __shared__ float cosA; + __shared__ float sinA; + + __shared__ bool isPixel; + + // __shared__ float R2inv_array[MAX_NUMBER_DOUBLETS]; + __shared__ float Rinv_array[MAX_NUMBER_DOUBLETS]; + __shared__ float t_array[MAX_NUMBER_DOUBLETS]; + __shared__ int spIdx_array[MAX_NUMBER_DOUBLETS]; + __shared__ float u_array[MAX_NUMBER_DOUBLETS]; + __shared__ float v_array[MAX_NUMBER_DOUBLETS]; + __shared__ bool isSCT_array[MAX_NUMBER_DOUBLETS]; + + // __shared__ float covZ_array[MAX_NUMBER_DOUBLETS]; + // __shared__ float covR_array[MAX_NUMBER_DOUBLETS]; + + __shared__ float tCov_array[MAX_NUMBER_DOUBLETS]; + + + __shared__ int PairIdx_array[MAX_TRIPLETS]; + __shared__ float Q_array[MAX_TRIPLETS]; + __shared__ int sortedIdx[MAX_TRIPLETS]; + + + __shared__ int iDoublet; + __shared__ int startOfOuter; + __shared__ int nPairs; + __shared__ int nTriplets; + + const double dtCut = 0.25; + const float radLen = 0.036; + const float dp = 13.6/dSettings->m_tripletPtMin; + const float CovMS = dp*dp*radLen; + + + const float ptCoeff = 0.29997*dSettings->m_magFieldZ/2;// ~0.3 + const float minPt2 = dSettings->m_tripletPtMin*dSettings->m_tripletPtMin; + const float ptCoeff2 = ptCoeff*ptCoeff; + const float maxD0 = dSettings->m_tripletD0Max; + const float maxD0_PPS = dSettings->m_tripletD0_PPS_Max; + + + for(int itemIdx = blockIdx.x;itemIdx<maxItem;itemIdx += gridDim.x) { + + if(threadIdx.x==0) { + + nTriplets = 0; + iDoublet=0; + + spmIdx = d_Storage->m_spmIdx[itemIdx]; + nInner = d_Info->m_nInner[spmIdx]; + nOuter = d_Info->m_nOuter[spmIdx]; + + nPairs = nInner*nOuter; + + atomicAdd(&d_Out->m_nO,nOuter); + atomicAdd(&d_Out->m_nI,nInner); + + innerStart = d_Storage->m_innerStart[itemIdx]; + outerStart = d_Storage->m_outerStart[itemIdx]; + + int spmType = dSpacepoints->m_type[spmIdx]; + + rm = dSpacepoints->m_r[spmIdx]; + covZ = dSpacepoints->m_covZ[spmIdx]; + covR = dSpacepoints->m_covR[spmIdx]; + + x0 = dSpacepoints->m_x[spmIdx]; + y0 = dSpacepoints->m_y[spmIdx]; + z0 = dSpacepoints->m_z[spmIdx]; + cosA = x0/rm; + sinA = y0/rm; + isPixel = (spmType == 1); + } + __syncthreads(); + + + for(int innerIdx = threadIdx.x; innerIdx<nInner;innerIdx+=blockDim.x) { + + int k = atomicAdd(&iDoublet,1); + + if(k<MAX_NUMBER_DOUBLETS) { + + int spiIdx = d_Storage->m_inner[innerStart + innerIdx]; + + spIdx_array[k] = spiIdx; + + float dx_inn = dSpacepoints->m_x[spiIdx] - x0; + float dy_inn = dSpacepoints->m_y[spiIdx] - y0; + float dz_inn = dSpacepoints->m_z[spiIdx] - z0; + + float R2inv = 1.0/(dx_inn*dx_inn+dy_inn*dy_inn); + Rinv_array[k] = sqrt(R2inv); + t_array[k] = Rinv_array[k]*dz_inn; + + tCov_array[k] = R2inv*(covZ + dSpacepoints->m_covZ[spiIdx] + t_array[k]*t_array[k]*(covR + dSpacepoints->m_covR[spiIdx])); + + float xn_inn = dx_inn*cosA + dy_inn*sinA; + float yn_inn =-dx_inn*sinA + dy_inn*cosA; + + u_array[k] = xn_inn*R2inv; + v_array[k] = yn_inn*R2inv; + + isSCT_array[k] = (dSpacepoints->m_type[spiIdx] == 2); + } + } + + __syncthreads(); + + if(threadIdx.x==0) { + if(iDoublet>MAX_NUMBER_DOUBLETS) iDoublet = MAX_NUMBER_DOUBLETS; + startOfOuter=iDoublet; + } + + __syncthreads(); + + for(int outerIdx = threadIdx.x; outerIdx<nOuter;outerIdx+=blockDim.x) { + + int k = atomicAdd(&iDoublet,1); + + if(k<MAX_NUMBER_DOUBLETS) { + + int spoIdx = d_Storage->m_outer[outerStart + outerIdx]; + + spIdx_array[k] = spoIdx; + + float dx_out = dSpacepoints->m_x[spoIdx] - x0; + float dy_out = dSpacepoints->m_y[spoIdx] - y0; + float dz_out = -dSpacepoints->m_z[spoIdx] + z0; + + float R2inv = 1.0/(dx_out*dx_out+dy_out*dy_out); + Rinv_array[k] = sqrt(R2inv); + t_array[k] = Rinv_array[k]*dz_out; + + tCov_array[k] = R2inv*(covZ + dSpacepoints->m_covZ[spoIdx] + t_array[k]*t_array[k]*(covR + dSpacepoints->m_covR[spoIdx])); + + float xn_out = dx_out*cosA + dy_out*sinA; + float yn_out =-dx_out*sinA + dy_out*cosA; + + u_array[k] = xn_out*R2inv; + v_array[k] = yn_out*R2inv; + + isSCT_array[k] = (dSpacepoints->m_type[spoIdx] == 2); + } + } + + __syncthreads(); + + for(int pairIdx = threadIdx.x;pairIdx<nPairs;pairIdx += blockDim.x) { + + int doublet_i = pairIdx / nOuter; // inner doublet + int doublet_j = startOfOuter + pairIdx % nOuter; //outer doublet + + if(doublet_i >= MAX_NUMBER_DOUBLETS || doublet_j >=MAX_NUMBER_DOUBLETS ) continue; + + //int spiIdx = spIdx_array[doublet_i]; + //int spoIdx = spIdx_array[doublet_j]; + + //retrieve shared data for doublets doublet_i and doublet_j and apply cut(s) + + //0. dt matching + float t_inn = t_array[doublet_i]; + float t_out = t_array[doublet_j]; + float dt = t_inn - t_out; + if(fabs(dt)>dtCut) continue; + + //1. rz matching + + float t_inn2 = t_inn*t_inn; + float tCov_inn = tCov_array[doublet_i]; + float tCov_out = tCov_array[doublet_j]; + + double dCov = CovMS*(1+t_inn2); + + float covdt = tCov_inn + tCov_out; + covdt += 2*Rinv_array[doublet_i]*Rinv_array[doublet_j]*(t_inn*t_out*covR + covZ); + float dt2 = dt*dt*(1/9.0); + if(dt2 > covdt+dCov) continue;//i.e. 3-sigma cut + + //2. pT estimate + + float u_inn = u_array[doublet_i]; + float v_inn = v_array[doublet_i]; + float u_out = u_array[doublet_j]; + float v_out = v_array[doublet_j]; + + float du = u_out - u_inn; + if(du==0.0) continue; + float A = (v_out - v_inn)/du; + float B = v_inn - A*u_inn; + float pT2 = ptCoeff2*(1+A*A)/(B*B); + if(pT2 < minPt2) continue; + + //3. the 3-sigma cut with estimated pT + + float frac = minPt2/pT2; + if(dt2 > covdt+frac*dCov) continue; + + //4. d0 cut + + float d0 = rm*(B*rm-A); + float fd0 = fabs(d0); + + if(fd0 > maxD0) continue; + + bool isSCT_1 = isSCT_array[doublet_i]; + bool isSCT_3 = isSCT_array[doublet_j]; + + if (isSCT_3 && isPixel && fd0 > maxD0_PPS) continue; + + //Calculate Quality + + float Q = d0*d0; + Q += isSCT_3*(1000.0*isSCT_1 + (1-isSCT_1)*10000.0); + + int l = atomicAdd(&nTriplets, 1); + if(l<MAX_TRIPLETS) { + PairIdx_array[l] = pairIdx; + Q_array[l] = Q; + sortedIdx[l] = 0; + } + + } + + __syncthreads(); + + + if(nTriplets>TRIPLET_BUFFER_DEPTH) {//sorting + + if(threadIdx.x == 0){ + if(nTriplets>MAX_TRIPLETS) { + nTriplets = MAX_TRIPLETS; + } + } + + __syncthreads(); + + for(int tIdx=threadIdx.x;tIdx<nTriplets*nTriplets;tIdx+=blockDim.x) { + int i = tIdx/nTriplets; + int j = tIdx%nTriplets; + int d = (Q_array[i] > Q_array[j]) + (Q_array[i] == Q_array[j])*(j<i); + atomicAdd(&sortedIdx[i],d); + } + } + + __syncthreads(); + + if(threadIdx.x == 0) { + if(nTriplets>0) { + int nT = nTriplets; + if(nT>TRIPLET_BUFFER_DEPTH) {nT = TRIPLET_BUFFER_DEPTH;} + int k = atomicAdd(&d_Out->m_nSeeds, nT); + int nStored=0; + for(int tIdx=0;tIdx<nTriplets;tIdx++) { + if(sortedIdx[tIdx]<TRIPLET_BUFFER_DEPTH) {//store this triplet + + int pairIdx = PairIdx_array[tIdx]; + int doublet_i = pairIdx / nOuter; // inner doublet + int doublet_j = startOfOuter + pairIdx % nOuter; //outer doublet + int spiIdx = spIdx_array[doublet_i]; + int spoIdx = spIdx_array[doublet_j]; + d_Out->m_innerIndex[k+nStored] = dSpacepoints->m_index[spiIdx]; + d_Out->m_middleIndex[k+nStored] = dSpacepoints->m_index[spmIdx]; + d_Out->m_outerIndex[k+nStored] = dSpacepoints->m_index[spoIdx]; + d_Out->m_Q[k+nStored] = Q_array[tIdx]; + nStored++; + } + } + if(nStored!=nT) { + atomicAdd(&d_Out->m_nErrors,1); + } + } + } + __syncthreads(); + } +} + +#endif diff --git a/Trigger/TrigAccel/TrigInDetCUDA/src/SeedMakingDataStructures.h b/Trigger/TrigAccel/TrigInDetCUDA/src/SeedMakingDataStructures.h new file mode 100644 index 0000000000000000000000000000000000000000..5d116496cbd01cb4b7726e73e90aeadfdd23cfbb --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetCUDA/src/SeedMakingDataStructures.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETCUDA_SEEDMAKINGDATASTRUCTURES_H +#define TRIGINDETCUDA_SEEDMAKINGDATASTRUCTURES_H + +constexpr unsigned int MAX_MIDDLE_SP = 100000; +constexpr unsigned int MAX_DOUBLET = 10000000; +constexpr unsigned int NUM_MIDDLE_THREADS = 32; +constexpr unsigned int OUTER_THREADS_MULTIPLIER = 4; // i.e thread block is 32 x 4*192/32 +constexpr unsigned int MAX_NUMBER_DOUBLETS = 1500; +constexpr unsigned int NUM_TRIPLET_BLOCKS = 1024; +constexpr unsigned int NUM_TRIPLET_THREADS = 1024; +constexpr unsigned int NUM_DOUBLET_THREADS = 16; +constexpr unsigned int MAX_TRIPLETS = 300; +constexpr unsigned int TRIPLET_BUFFER_DEPTH = 3; + +typedef struct doubletInfo { +public: + int m_nInner[MAX_MIDDLE_SP]; + int m_nOuter[MAX_MIDDLE_SP]; + char m_good[MAX_MIDDLE_SP]; +} DOUBLET_INFO; + +typedef struct doubletStorage { +public: + int m_nItems; + int m_nI; + int m_nO; + int m_spmIdx[MAX_MIDDLE_SP]; + int m_innerStart[MAX_MIDDLE_SP]; + int m_outerStart[MAX_MIDDLE_SP]; + int m_inner[MAX_DOUBLET]; + int m_outer[MAX_DOUBLET]; +} DOUBLET_STORAGE; + +typedef struct gpuParameters { + int m_nSMX; + int m_nNUM_SMX_CORES; + int m_nNUM_TRIPLET_BLOCKS; +} GPU_PARAMETERS; + + +#endif diff --git a/Trigger/TrigAccel/TrigInDetCUDA/src/SeedMakingWorkCuda.cu b/Trigger/TrigAccel/TrigInDetCUDA/src/SeedMakingWorkCuda.cu new file mode 100644 index 0000000000000000000000000000000000000000..4ade289028e32ee95869662977583e6ca257322b --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetCUDA/src/SeedMakingWorkCuda.cu @@ -0,0 +1,150 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include <cuda.h> +#include <cuda_runtime.h> + +#include "TrigAccelEvent/TrigInDetAccelEDM.h" +#include "SeedMakingWorkCuda.h" + +#include "tbb/tick_count.h" +#include <cstring> +#include <cmath> +#include <iostream> +#include <algorithm> + +#include "DoubletCountingKernelCuda.cuh" +#include "DoubletMakingKernelCuda.cuh" +#include "DoubletMatchingKernelCuda.cuh" + +SeedMakingWorkCuda::SeedMakingWorkCuda(unsigned int id, const SeedMakingWorkContextCuda& ctx, std::shared_ptr<TrigAccel::OffloadBuffer> data, + tbb::concurrent_queue<SeedMakingDeviceContext*>& CQ, tbb::concurrent_vector<WorkTimeStamp>& TL) : + m_workId(id), + m_context(0), + m_input(data), + m_contextQueue(CQ), + m_timeLine(TL) + { + + m_context = new SeedMakingWorkContextCuda(ctx);//make a copy + m_output = std::make_shared<TrigAccel::OffloadBuffer>(sizeof(TrigAccel::OUTPUT_SEED_STORAGE));//output data +} + +SeedMakingWorkCuda::~SeedMakingWorkCuda() { + if(m_context) delete(m_context);//delete the copy +} + +std::shared_ptr<TrigAccel::OffloadBuffer> SeedMakingWorkCuda::getOutput() { + return m_output; +} + +bool SeedMakingWorkCuda::run() { + + m_timeLine.push_back(WorkTimeStamp(m_workId, 0, tbb::tick_count::now())); + + const SeedMakingDeviceContext& p = *(m_context->m_pdc); + + int id = p.m_deviceId; + + TrigAccel::OUTPUT_SEED_STORAGE* ps = reinterpret_cast<TrigAccel::OUTPUT_SEED_STORAGE*>(p.h_outputseeds); + + cudaSetDevice(id); + + checkError(); + + cudaMemcpyAsync(p.d_settings, p.h_settings, sizeof(TrigAccel::SEED_FINDER_SETTINGS), cudaMemcpyHostToDevice, p.m_stream); + + checkError(); + + cudaMemcpyAsync(p.d_spacepoints, p.h_spacepoints, sizeof(TrigAccel::SPACEPOINT_STORAGE), cudaMemcpyHostToDevice, p.m_stream); + + checkError(); + + cudaStreamSynchronize(p.m_stream); + + TrigAccel::SEED_FINDER_SETTINGS* dSettings = reinterpret_cast<TrigAccel::SEED_FINDER_SETTINGS *>(p.d_settings); + TrigAccel::SPACEPOINT_STORAGE* dSpacepoints = reinterpret_cast<TrigAccel::SPACEPOINT_STORAGE *>(p.d_spacepoints); + TrigAccel::DETECTOR_MODEL* dDetModel = reinterpret_cast<TrigAccel::DETECTOR_MODEL*>(p.d_detmodel); + TrigAccel::OUTPUT_SEED_STORAGE* dOutput = reinterpret_cast<TrigAccel::OUTPUT_SEED_STORAGE*>(p.d_outputseeds); + + DOUBLET_INFO* dInfo = reinterpret_cast<DOUBLET_INFO*>(p.d_doubletinfo); + DOUBLET_STORAGE* dStorage = reinterpret_cast<DOUBLET_STORAGE*>(p.d_doubletstorage); + + cudaMemset(p.d_outputseeds,0,10*sizeof(int)); + + checkError(); + + cudaMemset(p.d_doubletstorage,0,3*sizeof(int)); + + checkError(); + + const TrigAccel::SPACEPOINT_STORAGE* pSPS = reinterpret_cast<const TrigAccel::SPACEPOINT_STORAGE *>(p.h_spacepoints); + int nSlices = pSPS->m_nPhiSlices; + int nLayers = pSPS->m_nLayers; + + int nMiddleSp = NUM_MIDDLE_THREADS;//determines size of the doublet/triplet buffers + int nOtherSp = OUTER_THREADS_MULTIPLIER*p.m_gpuParams.m_nNUM_SMX_CORES/NUM_MIDDLE_THREADS;//the size of the spacepoint buffer + + dim3 gridDimensions(nSlices, nLayers); + dim3 blockDimensions(nMiddleSp, nOtherSp); + + cudaMemset(p.d_doubletinfo,0,sizeof(DOUBLET_INFO)); + + checkError(); + + cudaStreamSynchronize(p.m_stream); + + checkError(); + + doubletCountingKernel<<<gridDimensions, blockDimensions, 0, p.m_stream>>>(dSettings, dSpacepoints, dDetModel, dInfo, nLayers, nSlices); + + cudaStreamSynchronize(p.m_stream); + + checkError(); + + doubletMakingKernel<<<gridDimensions, blockDimensions, 0, p.m_stream>>>(dSettings, dSpacepoints, dDetModel, dOutput, + dInfo, dStorage, nLayers, nSlices); + + cudaStreamSynchronize(p.m_stream); + + checkError(); + + int nStats[3]; + + cudaMemcpy(&nStats[0], p.d_doubletstorage, 3*sizeof(int), cudaMemcpyDeviceToHost); + + + doubletMatchingKernel<<<p.m_gpuParams.m_nNUM_TRIPLET_BLOCKS, NUM_TRIPLET_THREADS, 0, p.m_stream>>>(dSettings, dSpacepoints, dDetModel, dInfo, + dStorage, dOutput, nStats[0]); + + cudaStreamSynchronize(p.m_stream); + + checkError(); + + TrigAccel::OUTPUT_SEED_STORAGE* pOutput = reinterpret_cast<TrigAccel::OUTPUT_SEED_STORAGE *>(m_output->m_rawBuffer); + + //Read back GPU results + + pOutput->m_nMiddleSps = 0; + pOutput->m_nSeeds = 0; + pOutput->m_nI = 0; + pOutput->m_nO = 0; + pOutput->m_nCandidates = 0; + + cudaMemcpyAsync(p.h_outputseeds, p.d_outputseeds, sizeof(TrigAccel::OUTPUT_SEED_STORAGE), cudaMemcpyDeviceToHost, p.m_stream); + + checkError(); + + cudaStreamSynchronize(p.m_stream); + + checkError(); + + memcpy(pOutput, ps, sizeof(TrigAccel::OUTPUT_SEED_STORAGE)); + + m_contextQueue.push(m_context->m_pdc); + + m_timeLine.push_back(WorkTimeStamp(m_workId, 1, tbb::tick_count::now())); + + return true; +} diff --git a/Trigger/TrigAccel/TrigInDetCUDA/src/SeedMakingWorkCuda.h b/Trigger/TrigAccel/TrigInDetCUDA/src/SeedMakingWorkCuda.h new file mode 100644 index 0000000000000000000000000000000000000000..cc8a5bb2f0d9774e2a7fed17e17858d6e232f4b8 --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetCUDA/src/SeedMakingWorkCuda.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETCUDA_SEEDMAKINGWORKCUDA_H +#define TRIGINDETCUDA_SEEDMAKINGWORKCUDA_H + +#include <vector> + +#include "tbb/concurrent_queue.h" +#include "tbb/concurrent_vector.h" +#include "TrigInDetDataContexts.h" +#include "TrigAccelEvent/Work.h" +#include "TrigAccelEvent/WorkFactory.h" + + +class SeedMakingWorkCuda : public TrigAccel::Work{ + +public: + SeedMakingWorkCuda(unsigned int, const SeedMakingWorkContextCuda&, std::shared_ptr<TrigAccel::OffloadBuffer> data, + tbb::concurrent_queue<SeedMakingDeviceContext*>&, tbb::concurrent_vector<WorkTimeStamp>&); + ~SeedMakingWorkCuda(); + std::shared_ptr<TrigAccel::OffloadBuffer> getOutput(); + bool run(); + unsigned int getId() const { + return m_workId; + } + +private: + + inline void checkError() const { + cudaError_t error = cudaGetLastError(); + if(error != cudaSuccess) { + printf("CUDA error: %s\n", cudaGetErrorString(error)); + exit(-1); + } + }; + + unsigned int m_workId; + SeedMakingWorkContextCuda* m_context; + std::shared_ptr<TrigAccel::OffloadBuffer> m_input, m_output; + tbb::concurrent_queue<SeedMakingDeviceContext*>& m_contextQueue; + tbb::concurrent_vector<WorkTimeStamp>& m_timeLine; + + float m_CovMS, m_ptCoeff, m_minPt2, m_ptCoeff2, m_maxD0; +}; + +#endif diff --git a/Trigger/TrigAccel/TrigInDetCUDA/src/TrigInDetDataContexts.h b/Trigger/TrigAccel/TrigInDetCUDA/src/TrigInDetDataContexts.h new file mode 100644 index 0000000000000000000000000000000000000000..8ddf837d4802ca9aecc1dfe2118aa9bbc1644f83 --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetCUDA/src/TrigInDetDataContexts.h @@ -0,0 +1,82 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETCUDA_TRIGINDETDATACONTEXTS_H +#define TRIGINDETCUDA_TRIGINDETDATACONTEXTS_H + +#include "TrigAccelEvent/TrigInDetAccelEDM.h" + +#include "SeedMakingDataStructures.h" +#include <cuda_runtime.h> +#include <tbb/tick_count.h> + +class WorkTimeStamp { +public: + WorkTimeStamp(unsigned int id, int ev, const tbb::tick_count& t) : + m_workId(id), m_eventType(ev), m_time(t) {}; + WorkTimeStamp(const WorkTimeStamp& w) : m_workId(w.m_workId), m_eventType(w.m_eventType), m_time(w.m_time) {}; + unsigned int m_workId; + int m_eventType; + tbb::tick_count m_time; +}; + + +class SeedMakingWorkContext {//base class +public: + SeedMakingWorkContext() {}; + SeedMakingWorkContext(const SeedMakingWorkContext& c) {}; +}; + +struct SeedMakingDeviceContext { +public: + SeedMakingDeviceContext() : m_deviceId(-1), h_spacepoints(0), d_spacepoints(0), d_size(0), h_size(0) {}; + size_t hostSize() { return h_size;} + size_t deviceSize() { return d_size;} + + int m_deviceId; + cudaStream_t m_stream; + unsigned char *h_settings; + unsigned char *d_settings; + unsigned char *h_spacepoints; + unsigned char *d_spacepoints; + + unsigned char *d_detmodel; + + unsigned char *h_outputseeds; + unsigned char *d_outputseeds; + + unsigned char *d_doubletstorage; + unsigned char *d_doubletinfo; + + size_t d_size, h_size; + GPU_PARAMETERS m_gpuParams; + +private: + SeedMakingDeviceContext(const SeedMakingDeviceContext& sc) : m_deviceId(sc.m_deviceId) {}; +}; + + + +class SeedMakingWorkContextCuda : public SeedMakingWorkContext { +public: + SeedMakingWorkContextCuda(SeedMakingDeviceContext* pdc, + bool pinm = true, bool wcm = false, bool link = false) : SeedMakingWorkContext(), + m_pdc(pdc), + m_usePinnedMemory(pinm), + m_useWriteCombinedMemory(wcm), + m_linkOutputToShm(link) {}; + + SeedMakingWorkContextCuda(const SeedMakingWorkContextCuda& c) : SeedMakingWorkContext(), + m_pdc(c.m_pdc), + m_usePinnedMemory(c.m_usePinnedMemory), + m_useWriteCombinedMemory(c.m_useWriteCombinedMemory), + m_linkOutputToShm(c.m_linkOutputToShm) {}; + SeedMakingDeviceContext* m_pdc; + bool m_usePinnedMemory; + bool m_useWriteCombinedMemory; + bool m_linkOutputToShm; +}; + + +#endif diff --git a/Trigger/TrigAccel/TrigInDetCUDA/src/TrigInDetModuleCuda.cu b/Trigger/TrigAccel/TrigInDetCUDA/src/TrigInDetModuleCuda.cu new file mode 100644 index 0000000000000000000000000000000000000000..f24815a593a6eb0929bb865a9f1ce63bae1c7403 --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetCUDA/src/TrigInDetModuleCuda.cu @@ -0,0 +1,302 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include <cuda.h> +#include <cuda_runtime.h> +#include <atomic> + +#include "TrigInDetModuleCuda.h" +#include "SeedMakingDataStructures.h" +#include "SeedMakingWorkCuda.h" + +#include "TrigAccelEvent/TrigInDetAccelCodes.h" + +extern "C" TrigAccel::WorkFactory* getFactory() { + return new TrigInDetModuleCuda(); +} + +extern "C" int getFactoryId() { + return TrigAccel::TrigInDetModuleID_CUDA; +} + +extern "C" void deleteFactory(TrigAccel::WorkFactory* c){ + TrigInDetModuleCuda* mod=reinterpret_cast<TrigInDetModuleCuda*>(c); + delete mod; +} + +TrigInDetModuleCuda::TrigInDetModuleCuda() : m_maxNumberOfContexts(12), m_maxDevice(0), m_usePinnedMemory(true), + m_useWriteCombinedMemory(false), m_linkOutputToShm(false), m_dumpTimeLine(false) { + + m_d_detmodels.clear(); + + cudaGetDeviceCount(&m_maxDevice); + + cudaError_t error = cudaGetLastError(); + + if(error != cudaSuccess) { + m_maxDevice = 0; + } + + for(unsigned int i=0;i<getProvidedAlgs().size();i++) { + m_workItemCounters[i] = 0; + } + + m_timeLine.clear(); + +} + +TrigInDetModuleCuda::~TrigInDetModuleCuda() { + + SeedMakingDeviceContext* ps = 0; + + std::cout<<"deleting "<<m_seedMakingDcQueue.unsafe_size()<<" device contexts"<<std::endl; + + while(m_seedMakingDcQueue.try_pop(ps)) deleteSeedMakingContext(ps); + + for(auto dm : m_d_detmodels) { + cudaSetDevice(dm.first); + cudaFree(dm.second); + + } + m_d_detmodels.clear(); + + if(m_dumpTimeLine) { + + std::cout<<"time_line has "<<m_timeLine.size()<<" events"<<std::endl; + if(m_timeLine.size() > 0) { + tbb::tick_count t0 = m_timeLine[0].m_time; + std::ofstream tl("timeLine.csv"); + tl<<"workId,eventType,time"<<std::endl; + tl<<m_timeLine[0].m_workId<<","<<m_timeLine[0].m_eventType<<",0"<<std::endl; + for(unsigned int tIdx = 1;tIdx < m_timeLine.size();++tIdx) { + tbb::tick_count t1 = m_timeLine[tIdx].m_time; + auto duration = t1-t0; + tl<<m_timeLine[tIdx].m_workId<<","<<m_timeLine[tIdx].m_eventType<<","<<1000*duration.seconds()<<std::endl; + } + tl.close(); + } + } +} + +bool TrigInDetModuleCuda::configure() { + + std::vector<int> allowedGPUs, nDeviceContexts; + + allowedGPUs.resize(1,0);//configured for just 1 device with deviceId = 0 + + nDeviceContexts.resize(1,8);//configured for 8 DataContexts + + if(m_maxDevice == 0) { + std::cout<<"No CUDA devices found"<<std::endl; + return false; + } + + if(allowedGPUs.empty() || nDeviceContexts.empty()) return false; + + if(allowedGPUs.size() != nDeviceContexts.size()) return false; + + unsigned int dcIndex=0; + + size_t memTotalSize = 0; + + std::vector< SeedMakingDeviceContext*> vSeedDCs[100];//we do not have that many GPUs + + int nDCTotal=0; + + for(std::vector<int>::iterator devIt = allowedGPUs.begin(); devIt!= allowedGPUs.end();++devIt, dcIndex++) { + + int deviceId = (*devIt); + + if(deviceId<0 || deviceId>=m_maxDevice) continue; + + size_t memTotalSizeOnDevice = 0; + + cudaSetDevice(deviceId); + + checkError(); + + unsigned char* d_detmodel; + + cudaMalloc((void **)&d_detmodel, sizeof(TrigAccel::DETECTOR_MODEL)); + + checkError(); + + m_d_detmodels.insert(std::pair<unsigned int, unsigned char*>(deviceId, d_detmodel)); + + int nDC = nDeviceContexts[dcIndex]; + nDCTotal += nDC; + + memTotalSizeOnDevice += sizeof(TrigAccel::DETECTOR_MODEL); + + for(int dc=0;dc<nDC;dc++) { + SeedMakingDeviceContext* p = createSeedMakingContext(deviceId); + memTotalSizeOnDevice += p->deviceSize(); + vSeedDCs[dcIndex].push_back(p); + } + + memTotalSize += memTotalSizeOnDevice; + + std::cout<<"GPU"<<deviceId<<" allocated data context size = "<<1e-6*memTotalSizeOnDevice<<" MBytes"<<std::endl; + } + + int nDCLeft = nDCTotal; + while(nDCLeft>0) { + for(unsigned int iGPU=0;iGPU<allowedGPUs.size();iGPU++) { + if(vSeedDCs[iGPU].empty()) continue; + m_seedMakingDcQueue.push(vSeedDCs[iGPU].back()); + vSeedDCs[iGPU].pop_back(); + --nDCLeft; + } + } + + std::cout<<"Data context queue : "; + for(tbb::concurrent_queue< SeedMakingDeviceContext*>::const_iterator i(m_seedMakingDcQueue.unsafe_begin()); i!=m_seedMakingDcQueue.unsafe_end(); ++i ) { + std::cout<<(*i)->m_deviceId<<" "; + } + std::cout<<std::endl; + + std::cout<<"Total size of memory allocated on all GPUs = "<<1e-6*memTotalSize<<" MBytes"<<std::endl; + + return true; +} + + +SeedMakingDeviceContext* TrigInDetModuleCuda::createSeedMakingContext(int id) { + + cudaSetDevice(id); + + SeedMakingDeviceContext* p = new SeedMakingDeviceContext; + + p->m_deviceId = id; + + //set stream + + cudaStreamCreate(&p->m_stream); + + //check device property + + cudaDeviceProp deviceProp; + cudaGetDeviceProperties(&deviceProp, id); + + p->m_gpuParams.m_nSMX = deviceProp.multiProcessorCount; + + int ncores = 0; + + if ((deviceProp.minor == 1) || (deviceProp.minor == 2)) ncores = 128; + else if (deviceProp.minor == 0) ncores = 64; + else printf("Cannot determine the number of cores: unknown device type\n"); + + p->m_gpuParams.m_nNUM_SMX_CORES = ncores;//_ConvertSMVer2Cores_local(deviceProp.major, deviceProp.minor); + p->m_gpuParams.m_nNUM_TRIPLET_BLOCKS = NUM_TRIPLET_BLOCKS; + if(deviceProp.maxThreadsPerBlock < p->m_gpuParams.m_nNUM_TRIPLET_BLOCKS) + p->m_gpuParams.m_nNUM_TRIPLET_BLOCKS = deviceProp.maxThreadsPerBlock; + + //Allocate memory + + cudaMalloc((void **)&p->d_settings, sizeof(TrigAccel::SEED_FINDER_SETTINGS)); + cudaMalloc((void **)&p->d_spacepoints, sizeof(TrigAccel::SPACEPOINT_STORAGE)); + + auto dmIt = m_d_detmodels.find(p->m_deviceId); + if(dmIt!=m_d_detmodels.end()) { + p->d_detmodel = (*dmIt).second; + } + + cudaMalloc((void **)&p->d_outputseeds, sizeof(TrigAccel::OUTPUT_SEED_STORAGE)); + cudaMalloc((void **)&p->d_doubletstorage, sizeof(DOUBLET_STORAGE)); + cudaMalloc((void **)&p->d_doubletinfo, sizeof(DOUBLET_INFO)); + + + p->d_size = sizeof(TrigAccel::SEED_FINDER_SETTINGS) + + sizeof(TrigAccel::SPACEPOINT_STORAGE) + sizeof(TrigAccel::OUTPUT_SEED_STORAGE) + sizeof(DOUBLET_STORAGE) + sizeof(DOUBLET_INFO); + + cudaMallocHost((void **)&p->h_settings, sizeof(TrigAccel::SEED_FINDER_SETTINGS)); + cudaMallocHost((void **)&p->h_spacepoints, sizeof(TrigAccel::SPACEPOINT_STORAGE)); + cudaMallocHost((void **)&p->h_outputseeds, sizeof(TrigAccel::OUTPUT_SEED_STORAGE)); + + p->h_size = sizeof(TrigAccel::SEED_FINDER_SETTINGS) + sizeof(TrigAccel::SPACEPOINT_STORAGE) + sizeof(TrigAccel::OUTPUT_SEED_STORAGE); + + return p; +} + +void TrigInDetModuleCuda::deleteSeedMakingContext(SeedMakingDeviceContext* p) { + + int id = p->m_deviceId; + + cudaSetDevice(id); + + cudaStreamDestroy(p->m_stream); + + cudaFree(p->d_settings); + cudaFree(p->d_spacepoints); + + cudaFree(p->d_outputseeds); + cudaFree(p->d_doubletstorage); + cudaFree(p->d_doubletinfo); + + cudaFreeHost(p->h_settings); + cudaFreeHost(p->h_spacepoints); + cudaFreeHost(p->h_outputseeds); + + delete p; + +} + + +TrigAccel::Work* TrigInDetModuleCuda::createWork(int workType, std::shared_ptr<TrigAccel::OffloadBuffer> data){ + + if(workType == TrigAccel::InDetJobControlCode::SIL_LAYERS_EXPORT){ + + for(auto dm : m_d_detmodels) { + + unsigned int deviceId = dm.first; + + cudaSetDevice(deviceId); + + cudaMemcpy(dm.second, (unsigned char*)data->get(), sizeof(TrigAccel::DETECTOR_MODEL), cudaMemcpyHostToDevice); + } + return 0; + } + + if(workType == TrigAccel::InDetJobControlCode::MAKE_SEEDS){ + + SeedMakingDeviceContext* ctx = 0; + + while(!m_seedMakingDcQueue.try_pop(ctx)) { + // std::cout<<"waiting for free device context..."<<std::endl; + }; + + TrigAccel::SEED_MAKING_JOB *pArray = reinterpret_cast<TrigAccel::SEED_MAKING_JOB*>(data->get()); + + //1. copy settings to the context host array + + TrigAccel::SEED_FINDER_SETTINGS* p_settings = reinterpret_cast<TrigAccel::SEED_FINDER_SETTINGS*>(ctx->h_settings); + memcpy(p_settings, &pArray->m_settings, sizeof(TrigAccel::SEED_FINDER_SETTINGS)); + + //2. copy spacepoints to the context host array + + TrigAccel::SPACEPOINT_STORAGE* p_spacePoints = reinterpret_cast<TrigAccel::SPACEPOINT_STORAGE*>(ctx->h_spacepoints); + memcpy(p_spacePoints, &pArray->m_data, sizeof(TrigAccel::SPACEPOINT_STORAGE)); + + unsigned int workNum = m_workItemCounters[0]++;//seed making uses counter #0 + + unsigned int workId = workNum*100; + + SeedMakingWorkCuda* w = new SeedMakingWorkCuda(workId, SeedMakingWorkContextCuda(ctx, m_usePinnedMemory, + m_useWriteCombinedMemory, + m_linkOutputToShm), data, m_seedMakingDcQueue, m_timeLine); + + return w; + } + + return 0; +} + +const std::vector<int> TrigInDetModuleCuda::getProvidedAlgs(){ + std::vector<int> v{ + TrigAccel::InDetJobControlCode::SIL_LAYERS_EXPORT, + TrigAccel::InDetJobControlCode::MAKE_SEEDS + }; + return v; +} + diff --git a/Trigger/TrigAccel/TrigInDetCUDA/src/TrigInDetModuleCuda.h b/Trigger/TrigAccel/TrigInDetCUDA/src/TrigInDetModuleCuda.h new file mode 100644 index 0000000000000000000000000000000000000000..44559910072535e13ce790ea925c774236f39f67 --- /dev/null +++ b/Trigger/TrigAccel/TrigInDetCUDA/src/TrigInDetModuleCuda.h @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGINDETCUDA_TRIGINDETMODULECUDA_H +#define TRIGINDETCUDA_TRIGINDETMODULECUDA_H + +#include <map> +#include <atomic> +#include "TrigAccelEvent/WorkFactory.h" +#include "TrigAccelEvent/TrigInDetAccelEDM.h" +#include "TrigAccelEvent/TrigInDetAccelCodes.h" + +#include "TrigInDetDataContexts.h" + +#include "tbb/concurrent_queue.h" +#include "tbb/concurrent_vector.h" + +class TrigInDetModuleCuda : public TrigAccel::WorkFactory { + + public: + + TrigInDetModuleCuda(); + + ~TrigInDetModuleCuda(); + + bool configure(); + + TrigAccel::Work* createWork(int, std::shared_ptr<TrigAccel::OffloadBuffer>); + + const std::vector<int> getProvidedAlgs(); + + virtual int getFactoryId() { + return TrigAccel::TrigInDetModuleID_CUDA; + } + + private: + + inline void checkError() const { + cudaError_t error = cudaGetLastError(); + if(error != cudaSuccess) { + printf("CUDA error: %s\n", cudaGetErrorString(error)); + exit(-1); + } + }; + + //data structures + + //1. "const" data: managed by the Factory + + std::map<unsigned int, unsigned char*> m_d_detmodels; + + int m_maxNumberOfContexts;//Factory setting + int m_maxDevice; + + bool m_usePinnedMemory; + bool m_useWriteCombinedMemory; + bool m_linkOutputToShm; + + // host / device pairs for each device + + tbb::concurrent_queue<SeedMakingDeviceContext*> m_seedMakingDcQueue; + + // data context allocation / de-allocation + + SeedMakingDeviceContext* createSeedMakingContext(int); + void deleteSeedMakingContext(SeedMakingDeviceContext*); + + bool m_dumpTimeLine; + + std::atomic<unsigned int> m_workItemCounters[100];//atomic counters for unique Work identification + tbb::concurrent_vector<WorkTimeStamp> m_timeLine; + }; + +#endif diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py b/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py index c195fa4f553b988634d44331e2a5ab7a55fc8bf5..a27b7ae466462510bfc4c2ab8e680bd5d85ad8f9 100755 --- a/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py +++ b/Trigger/TrigAlgorithms/TrigCaloRec/python/TrigCaloRecConfig.py @@ -19,6 +19,7 @@ from TrigCaloRec.TrigCaloRecConf import RoIFCalHadCellContMaker from TrigCaloRec.TrigCaloRecConf import FullCaloCellContMaker from TrigCaloRec.TrigCaloRecConf import TrigLArNoisyROAlg from TrigCaloRec.TrigCaloRecConf import TrigL1BSTowerHypo +from TrigCaloRec.TrigCaloRecConf import TrigCaloClusterCalibratorMT from LArRecUtils.LArRecUtilsConf import LArTowerBuilderTool from CaloRec.CaloRecConf import CaloCellContainerCorrectorTool from CaloRec.CaloRecConf import CaloCellContainerFinalizerTool @@ -1767,4 +1768,83 @@ class HLTCaloCellMaker (_HLTCaloCellMaker): self.MonTool = monTool self.monitorCells = monitorCells +class TrigCaloClusterCalibratorMT_LC(TrigCaloClusterCalibratorMT): + """ Class to set up the default configurations for LC calibrations """ + def __init__(self, name="TrigCaloClusterCalibratorMT_LC", **kwargs): + super(TrigCaloClusterCalibratorMT_LC, self).__init__(name, **kwargs) + + from CaloTools.CaloNoiseCondAlg import CaloNoiseCondAlg + from CaloUtils.CaloUtilsConf import CaloLCClassificationTool, CaloLCWeightTool, CaloLCOutOfClusterTool, CaloLCDeadMaterialTool + from CaloClusterCorrection.CaloClusterCorrectionConf import CaloClusterLocalCalib + from AthenaCommon.GlobalFlags import globalflags + + # Need electronic noise for LCWeights + CaloNoiseCondAlg(noisetype="electronicNoise") + + # Figure out the detector version + det_version_is_rome = globalflags.DetDescrVersion().startswith("Rome") + + self.ClusterCorrectionTools = [] + + # Set up the tools + self += CaloClusterLocalCalib( + "TrigLocalCalib", + ClusterRecoStatus = [1, 2]) + self.TrigLocalCalib += CaloLCClassificationTool( + "TrigLCClassify", + ClassificationKey = "EMFracClassify", + UseSpread = False, + MaxProbability = 0.85 if det_version_is_rome else 0.5, + UseNormalizedEnergyDensity = not det_version_is_rome, + StoreClassificationProbabilityInAOD = True) + self.TrigLocalCalib.ClusterClassificationTool = [self.TrigLocalCalib.TrigLCClassify] + self.TrigLocalCalib += CaloLCWeightTool( + "TrigLCWeight", + CorrectionKey = "H1ClusterCellWeights", + SignalOverNoiseCut = 2.0, + UseHadProbability = True) + self.TrigLocalCalib.LocalCalibTools = [self.TrigLocalCalib.TrigLCWeight] + self.ClusterCorrectionTools.append(self.TrigLocalCalib) + + self += CaloClusterLocalCalib( + "TrigOOCCalib", + ClusterRecoStatus = [1, 2]) + self.TrigOOCCalib += CaloLCOutOfClusterTool( + "TrigLCOut", + CorrectionKey = "OOCCorrection", + UseEmProbability = False, + UseHadProbability = True) + self.TrigOOCCalib.LocalCalibTools = [self.TrigOOCCalib.TrigLCOut] + self.ClusterCorrectionTools.append(self.TrigOOCCalib) + + self += CaloClusterLocalCalib( + "TrigOOCPi0Calib", + ClusterRecoStatus = [1, 2]) + self.TrigOOCPi0Calib += CaloLCOutOfClusterTool( + "TrigLCOutPi0", + CorrectionKey = "OOCPi0Correction", + UseEmProbability = True, + UseHadProbability = False) + self.TrigOOCPi0Calib.LocalCalibTools = [self.TrigOOCPi0Calib.TrigLCOutPi0] + self.ClusterCorrectionTools.append(self.TrigOOCPi0Calib) + + self += CaloClusterLocalCalib( + "TrigDMCalib", + ClusterRecoStatus = [1, 2]) + self.TrigDMCalib += CaloLCDeadMaterialTool( + "TrigLCDeadMaterial", + HadDMCoeffKey = "HadDMCoeff2", + ClusterRecoStatus = 0, + WeightModeDM = 2, + UseHadProbability = True) + self.TrigDMCalib.LocalCalibTools = [self.TrigDMCalib.TrigLCDeadMaterial] + self.ClusterCorrectionTools.append(self.TrigDMCalib) + + # Also set up the monitoring + from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool + self.MonTool = GenericMonitoringTool("MonTool") + self.MonTool.defineHistogram('Et', path='EXPERT', type='TH1F', title="Cluster E_T; E_T [ MeV ] ; Number of Clusters", xbins=135, xmin=-200.0, xmax=2500.0) + self.MonTool.defineHistogram('Eta', path='EXPERT', type='TH1F', title="Cluster #eta; #eta ; Number of Clusters", xbins=100, xmin=-2.5, xmax=2.5) + self.MonTool.defineHistogram('Phi', path='EXPERT', type='TH1F', title="Cluster #phi; #phi ; Number of Clusters", xbins=64, xmin=-3.2, xmax=3.2) + self.MonTool.defineHistogram('Eta,Phi', path='EXPERT', type='TH2F', title="Number of Clusters; #eta ; #phi ; Number of Clusters", xbins=100, xmin=-2.5, xmax=2.5, ybins=128, ymin=-3.2, ymax=3.2) diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterCalibratorMT.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterCalibratorMT.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f51a8338597308cfcdd7f9ab20572e219cb8f095 --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterCalibratorMT.cxx @@ -0,0 +1,125 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/******************************************************************** + * + * NAME: TrigCaloClusterCalibratorMT + * PACKAGE: Trigger/TrigAlgorithms/TrigCaloRec + * + * AUTHOR: Jon Burr + * CREATED: 2020/07/10 + * + * Shallow copy an existing cluster container and apply cluster processors to + * it. Largely copied from the TrigCaloClusterMakerMT. + *********************************************************************/ + +#include "AthenaMonitoringKernel/Monitored.h" +#include "TrigCaloClusterCalibratorMT.h" +#include "xAODCore/ShallowCopy.h" +#include "xAODCore/ShallowAuxContainer.h" +#include "StoreGate/ReadHandle.h" +#include "StoreGate/WriteHandle.h" +#include "CaloUtils/CaloClusterStoreHelper.h" +#include <tuple> + +TrigCaloClusterCalibratorMT::TrigCaloClusterCalibratorMT( + const std::string& name, ISvcLocator* pSvcLocator) : + AthReentrantAlgorithm(name, pSvcLocator) +{ +} + +TrigCaloClusterCalibratorMT::~TrigCaloClusterCalibratorMT() +{ +} + +StatusCode TrigCaloClusterCalibratorMT::initialize() +{ + ATH_MSG_INFO("Initialise " << name() ); + + if (!m_monTool.empty() ) + ATH_CHECK(m_monTool.retrieve() ); + else + ATH_MSG_INFO("No monitoring tool configured"); + + ATH_CHECK( m_clusterCorrections.retrieve() ); + ATH_CHECK( m_inputClustersKey.initialize() ); + ATH_CHECK( m_outputClustersKey.initialize() ); + ATH_CHECK( m_outputCellLinksKey.initialize() ); + + return StatusCode::SUCCESS; +} + +StatusCode TrigCaloClusterCalibratorMT::execute(const EventContext& ctx) const +{ + ATH_MSG_DEBUG("Running " << name() ); + auto time_corr = Monitored::Timer("TIME_ClustCorr"); + + // Do the shallow copying + SG::WriteHandle<xAOD::CaloClusterContainer> outputClusters(m_outputClustersKey, ctx); + { + // Make a temporary scope - this means that the unique pointers die at the + // end of the scope (so don't hang around after the move call) + SG::ReadHandle<xAOD::CaloClusterContainer> inputClusters(m_inputClustersKey, ctx); + std::pair<xAOD::CaloClusterContainer*, xAOD::ShallowAuxContainer*> copyPair = + xAOD::shallowCopyContainer(*inputClusters); + // Show that we're taking ownership explicitly + std::unique_ptr<xAOD::CaloClusterContainer> clusters{copyPair.first}; + std::unique_ptr<xAOD::ShallowAuxContainer> clustersAux{copyPair.second}; + // And record + ATH_CHECK( outputClusters.record(std::move(clusters), std::move(clustersAux))); + // We also need to copy across the cell links information. + // To explain: the non-const cell iteration methods use an internal pointer, + // which is only finalized into an element link into the persistent + // container later. Therefore while we have a modifiable cluster, it has to + // have this local pointer present... + for (auto itrPair = std::make_pair(inputClusters->begin(), outputClusters->begin()); + itrPair != std::make_pair(inputClusters->end(), outputClusters->end()); + ++itrPair.first, ++itrPair.second) { + const CaloClusterCellLink* inputLinks = (**itrPair.first).getCellLinks(); + if (!inputLinks) { + ATH_MSG_ERROR("Failed to read the cell links from the input clusters!"); + return StatusCode::FAILURE; + } + (**itrPair.second).addCellLink(std::make_unique<CaloClusterCellLink>(*inputLinks)); + } + } + + time_corr.start(); + for (const ToolHandle<CaloClusterProcessor>& clcorr : m_clusterCorrections) { + for (xAOD::CaloCluster* cl : *outputClusters) { + if (!m_isSW.value() || + (std::abs(cl->eta0()) < 1.45 && clcorr->name().find("37") != std::string::npos) || + (std::abs(cl->eta0()) >= 1.45 && clcorr->name().find("55") != std::string::npos) ) { + ATH_CHECK(clcorr->execute(ctx, cl)); + ATH_MSG_VERBOSE("Executed correction tool " << clcorr->name()); + } + } + } + time_corr.stop(); + + // Now we also have to make the cell links persistent + SG::WriteHandle<CaloClusterCellLinkContainer> cellLinks(m_outputCellLinksKey, ctx); + ATH_CHECK(CaloClusterStoreHelper::finalizeClusters(cellLinks, outputClusters.ptr())); + // After this is done, the non-const cell iteration functions will segfault! + // This means we really shouldn't let anyone retrieve this as a non-const + // container... + ATH_CHECK( outputClusters.setConst() ); + + // fill monitored containers + // Only monitor kinematic quantities which the calibrations may have changed + Monitored::Group(m_monTool, + time_corr, + Monitored::Collection("Et", *outputClusters, &xAOD::CaloCluster::et), + Monitored::Collection("Phi", *outputClusters, &xAOD::CaloCluster::calPhi), + Monitored::Collection("Eta", *outputClusters, &xAOD::CaloCluster::calEta)).fill(); + + // Add REGTEST entries + if (!outputClusters->empty() ) { + ATH_MSG_DEBUG(" REGTEST: Last Cluster Et = " << outputClusters->back()->et()); + ATH_MSG_DEBUG(" REGTEST: Last Cluster eta = " << outputClusters->back()->eta()); + ATH_MSG_DEBUG(" REGTEST: Last Cluster phi = " << outputClusters->back()->phi()); + } + + return StatusCode::SUCCESS; +} diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterCalibratorMT.h b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterCalibratorMT.h new file mode 100644 index 0000000000000000000000000000000000000000..d43a2555aae4feb9993e0bc55c73433213bb62bb --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterCalibratorMT.h @@ -0,0 +1,64 @@ +// Hi Emacs ! this is -* C++ -*- + +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + */ + +/******************************************************************** + * + * NAME: TrigCaloClusterCalibratorMT + * PACKAGE: Trigger/TrigAlgorithms/TrigCaloRec + * + * AUTHOR: Jon Burr + * CREATED: 2020/07/10 + * + * Shallow copy an existing cluster container and apply cluster processors to + * it. Largely copied from the TrigCaloClusterMakerMT. + *********************************************************************/ + +#ifndef TRIGCALOREC_TRIGCALOCLUSTERCALIBRATORMT_H +#define TRIGCALOREC_TRIGCALOCLUSTERCALIBRATORMT_H + +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "xAODCaloEvent/CaloClusterContainer.h" +#include "CaloRec/CaloClusterProcessor.h" +#include "CaloEvent/CaloClusterCellLinkContainer.h" +#include "AthenaMonitoringKernel/GenericMonitoringTool.h" +#include "GaudiKernel/ToolHandle.h" +#include "StoreGate/ReadDecorHandleKey.h" +#include "StoreGate/WriteDecorHandleKey.h" + +class TrigCaloClusterCalibratorMT : public AthReentrantAlgorithm { + public: + TrigCaloClusterCalibratorMT(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~TrigCaloClusterCalibratorMT() override; + + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext& ctx) const override; + + private: + ToolHandleArray<CaloClusterProcessor> m_clusterCorrections + {this, "ClusterCorrectionTools", {}, ""}; + + SG::ReadHandleKey<xAOD::CaloClusterContainer> m_inputClustersKey{ + this, "InputClusters", "", + "The input calocluster container to be shallow copied"}; + + SG::WriteHandleKey<xAOD::CaloClusterContainer> m_outputClustersKey{ + this, "OutputClusters", "", + "The output, calibrated calocluster container"}; + + SG::WriteHandleKey<CaloClusterCellLinkContainer> m_outputCellLinksKey{ + this, "OutputCellLinks", "", + "The output cell links containing the updated weights"}; + + ToolHandle<GenericMonitoringTool> m_monTool{ + this, "MonTool", "", "The monitoring tool"}; + + Gaudi::Property<bool> m_isSW{ + this, "IsSW", false, + "Is this running corrections to 'SW' clusters? If it is, then cluster " + "processors will be run selectively based on the cluster's eta"}; +}; //> end class TrigCaloClusterCalibratorMT + +#endif //> !TRIGCALOREC_TRIGCALOCLUSTERCALIBRATORMT_H diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.cxx index a54bb550af541544408c908ac2a8827129fb83d3..ced013b5b11ef09d0466da6f95cc4f1f853315f6 100644 --- a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.cxx +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.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 */ // ******************************************************************** @@ -60,8 +60,7 @@ class ISvcLocator; ///////////////////////////////////////////////////////////////////// // TrigCaloClusterMakerMT::TrigCaloClusterMakerMT(const std::string& name, ISvcLocator* pSvcLocator) - : AthAlgorithm(name, pSvcLocator), - m_pCaloClusterContainer(NULL) + : AthReentrantAlgorithm(name, pSvcLocator) { } @@ -105,6 +104,28 @@ TrigCaloClusterMakerMT::TrigCaloClusterMakerMT(const std::string& name, ISvcLoca ATH_CHECK( m_outputClustersKey.initialize() ); ATH_CHECK( m_clusterCellLinkOutput.initialize() ); + for (ToolHandle<CaloClusterCollectionProcessor>& clproc : m_clusterMakers) { + // Set the CellsName property on the input tool (why isn't this done in + // python?) + AlgTool* algtool = dynamic_cast<AlgTool*> (clproc.get()); + if (clproc->name().find("CaloTopoClusterMaker") != std::string::npos) { + if (!algtool) { + ATH_MSG_ERROR("Could not cast " << clproc->name() << " to an AlgTool!"); + return StatusCode::FAILURE; + } + ATH_CHECK(algtool->setProperty(StringProperty("CellsName", m_inputCellsKey.key()))); + } + if (clproc->name().find("trigslw") != std::string::npos) + m_isSW = true; + } + + for (ToolHandle<CaloClusterProcessor>& clcorr : m_clusterCorrections) { + ISetCaloCellContainerName* setter = + dynamic_cast<ISetCaloCellContainerName*> (clcorr.get()); + if (setter) + ATH_CHECK(setter->setCaloCellContainerName(m_inputCellsKey.key())); + } + ATH_MSG_DEBUG("Initialization of TrigCaloClusterMakerMT completed successfully"); return StatusCode::SUCCESS; @@ -119,7 +140,7 @@ return StatusCode::SUCCESS; } -StatusCode TrigCaloClusterMakerMT::execute() +StatusCode TrigCaloClusterMakerMT::execute(const EventContext& ctx) const { // Monitoring initialization... auto time_tot = Monitored::Timer("TIME_execute"); @@ -131,10 +152,6 @@ StatusCode TrigCaloClusterMakerMT::execute() ATH_MSG_DEBUG("in TrigCaloClusterMakerMT::execute()" ); - bool isSW=false; - - auto ctx = getContext(); - // We now take care of the Cluster Making... auto clusterContainer = SG::makeHandle (m_outputClustersKey, ctx); ATH_MSG_VERBOSE(" Output Clusters : " << clusterContainer.name()); @@ -183,24 +200,8 @@ StatusCode TrigCaloClusterMakerMT::execute() // ATH_MSG_DEBUG(" Input Towers : " << towers.name() <<" of size "<< towers->size()); #endif - for (ToolHandle<CaloClusterCollectionProcessor>& clproc : m_clusterMakers) { - - // JTB: TO DO: The offline tools should be changed to set declare ReadHandles + for (const ToolHandle<CaloClusterCollectionProcessor>& clproc : m_clusterMakers) { - // We need to set the properties of the offline tools. this way of doing is ugly... - // Abusing of harcoding?? Yes... - - AlgTool* algtool = dynamic_cast<AlgTool*> (clproc.get()); - if(clproc->name().find("CaloTopoClusterMaker") != std::string::npos){ - - - if(!algtool || algtool->setProperty( StringProperty("CellsName",cells.name() )).isFailure()) { - ATH_MSG_ERROR ("ERROR setting the CellsName name in the offline tool" ); - // return HLT::TOOL_FAILURE; - return StatusCode::SUCCESS; - } - - } #if 0 else if(clproc->name().find("trigslw") != std::string::npos){ if(!algtool || algtool->setProperty( StringProperty("CaloCellContainer",cells.name()) ).isFailure()) { @@ -216,13 +217,8 @@ StatusCode TrigCaloClusterMakerMT::execute() } #endif - - if ( (clproc->name()).find("trigslw") != std::string::npos ) isSW=true; - if ( clproc->execute(pCaloClusterContainer).isFailure() ) { - ATH_MSG_ERROR("Error executing tool " << clproc->name() ); - } else { - ATH_MSG_VERBOSE("Executed tool " << clproc->name() ); - } + ATH_CHECK(clproc->execute(ctx, pCaloClusterContainer)); + ATH_MSG_VERBOSE("Executed tool " << clproc->name() ); } time_clusMaker.stop(); @@ -252,34 +248,15 @@ StatusCode TrigCaloClusterMakerMT::execute() time_clusCorr.start(); ATH_MSG_VERBOSE(" Running cluster correction tools"); - for (ToolHandle<CaloClusterProcessor>& clcorr : m_clusterCorrections) { + for (const ToolHandle<CaloClusterProcessor>& clcorr : m_clusterCorrections) { - ATH_MSG_VERBOSE(" Running " << clcorr->name()); - ISetCaloCellContainerName* setter = - dynamic_cast<ISetCaloCellContainerName*> (clcorr.get()); - if (setter) { - if(setter->setCaloCellContainerName(cells.name()) .isFailure()) { - ATH_MSG_ERROR("ERROR setting the CaloCellContainer name in the offline tool" ); - // return HLT::BAD_JOB_SETUP; - return StatusCode::SUCCESS; - } - } - for (xAOD::CaloCluster* cl : *pCaloClusterContainer) { - bool exec = false; - if ( (fabsf(cl->eta0())<1.45) && (clcorr->name().find("37") != std::string::npos ) ) exec=true; - else if ( (fabsf(cl->eta0())>=1.45) && (clcorr->name().find("55") != std::string::npos ) ) exec=true; - else exec = false; - if (!isSW) exec=true; - if ( exec ) { - if ( clcorr->execute(cl).isFailure() ) { - ATH_MSG_ERROR("Error executing correction tool " << clcorr->name() ); - // return HLT::TOOL_FAILURE; - return StatusCode::SUCCESS; - } else { - ATH_MSG_VERBOSE("Executed correction tool " << clcorr->name() ); + if (!m_isSW || + (std::abs(cl->eta0()) < 1.45 && clcorr->name().find("37") != std::string::npos) || + (std::abs(cl->eta0()) >= 1.45 && clcorr->name().find("55") != std::string::npos) ) { + ATH_CHECK(clcorr->execute(ctx, cl) ); + ATH_MSG_VERBOSE("Executed correction tool " << clcorr->name()); } - } // Check conditions } } time_clusCorr.stop(); diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.h b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.h index 106fc930a79e25736692c271446f6ebea3c95f89..3f133f823be4cd685c741833e2ffa16140f937f7 100644 --- a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.h +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMakerMT.h @@ -2,7 +2,7 @@ // Hi 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 */ /******************************************************************** @@ -19,7 +19,7 @@ #ifndef TRIGCALOREC_TRIGCALOCLUSTERMAKERMT_H #define TRIGCALOREC_TRIGCALOCLUSTERMAKERMT_H -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "CaloEvent/CaloClusterContainer.h" #include "CaloRec/CaloClusterCollectionProcessor.h" #include "CaloRec/CaloClusterProcessor.h" @@ -36,7 +36,7 @@ class CaloClusterProcessor; class CaloClusterContainer; class CaloCellLinkContainer; -class TrigCaloClusterMakerMT : public AthAlgorithm { +class TrigCaloClusterMakerMT : public AthReentrantAlgorithm { public: @@ -45,7 +45,7 @@ class TrigCaloClusterMakerMT : public AthAlgorithm { virtual StatusCode initialize() override; virtual StatusCode finalize() override; - virtual StatusCode execute() override; + virtual StatusCode execute(const EventContext& ctx) const override; private: @@ -57,10 +57,6 @@ class TrigCaloClusterMakerMT : public AthAlgorithm { // Following used for testing only : //bool m_useMeaningfullNames; std::string m_clustersOutputName; - - - //Other members - xAOD::CaloClusterContainer* m_pCaloClusterContainer; // double m_Eta; // double m_Phi; @@ -108,10 +104,7 @@ class TrigCaloClusterMakerMT : public AthAlgorithm { "Decor_ncells", // decorator name "nCells", // default value "Decorator containing the number of cells associated to a cluster"}; - -public: - - inline xAOD::CaloClusterContainer* GetClusterContainer() const {return m_pCaloClusterContainer;} + bool m_isSW{false}; }; #endif diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/components/TrigCaloRec_entries.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/components/TrigCaloRec_entries.cxx index 6e37388b7643f2254b48eed1ac844eaf53dffb56..ff5fdf1b4e272f28f5531bdaff48dd8d75fa749e 100644 --- a/Trigger/TrigAlgorithms/TrigCaloRec/src/components/TrigCaloRec_entries.cxx +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/components/TrigCaloRec_entries.cxx @@ -17,6 +17,7 @@ #include "../TrigCaloClusterMakerMT.h" #include "../TrigCaloTowerMakerMT.h" +#include "../TrigCaloClusterCalibratorMT.h" #include "TrigCaloRec/TrigCaloTopoTowerAlgorithm.h" #include "TrigCaloRec/TrigCaloCell2ClusterMapper.h" @@ -24,6 +25,7 @@ #include "../HLTCaloCellSumMaker.h" DECLARE_COMPONENT( TrigCaloTowerMakerMT ) +DECLARE_COMPONENT( TrigCaloClusterCalibratorMT ) DECLARE_COMPONENT( TrigCaloClusterMakerMT ) DECLARE_COMPONENT( TrigCaloCellMaker ) DECLARE_COMPONENT( TrigFullCaloCellMaker ) diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigEFMissingET/CMakeLists.txt index 7af6a493ee1f1565b5cb85d5a0b840bbb4f440eb..9b581540f520dd4150679db8a9c91edf670caa3a 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/CMakeLists.txt @@ -100,4 +100,3 @@ atlas_add_component( TrigEFMissingET # Install files from the package: atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigFastTrackFinder/CMakeLists.txt index eb8283551736d80ee59ce2d56aa32c43e80d1f6d..36f2826c618e36760c606af16e665e9c995a929c 100644 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/CMakeLists.txt @@ -7,7 +7,7 @@ atlas_subdir( TrigFastTrackFinder ) atlas_add_component( TrigFastTrackFinder src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps AthenaMonitoringKernelLib BeamSpotConditionsData CxxUtils GaudiKernel InDetIdentifier InDetPrepRawData InDetRIO_OnTrack InDetRecToolInterfaces SiSPSeededTrackFinderData SiSpacePointsSeed TrigInDetEvent TrigInDetPattRecoEvent TrigInDetPattRecoTools TrigInDetToolInterfacesLib TrigInterfacesLib TrigNavigationLib TrigSteeringEvent TrigTimeAlgsLib TrkEventPrimitives TrkEventUtils TrkParameters TrkRIO_OnTrack TrkToolInterfaces TrkTrack TrkTrackSummary ) + LINK_LIBRARIES AthenaBaseComps AthenaMonitoringKernelLib BeamSpotConditionsData CxxUtils GaudiKernel InDetIdentifier InDetPrepRawData InDetRIO_OnTrack InDetRecToolInterfaces SiSPSeededTrackFinderData SiSpacePointsSeed TrigInDetEvent TrigInDetPattRecoEvent TrigInDetPattRecoTools TrigInDetToolInterfacesLib TrigInterfacesLib TrigNavigationLib TrigSteeringEvent TrigTimeAlgsLib TrkEventPrimitives TrkEventUtils TrkParameters TrkRIO_OnTrack TrkToolInterfaces TrkTrack TrkTrackSummary TrigAccelEvent TrigInDetAccelerationToolLib TrigInDetAccelerationServiceLib) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinder_Config.py b/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinder_Config.py index d58a6beba186f69cecfb59f7535eb8707fb2d860..ccd1794f763d30de8da38944f0733e487fc42c59 100755 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinder_Config.py +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinder_Config.py @@ -185,6 +185,21 @@ class TrigFastTrackFinderBase(TrigFastTrackFinder): self.LayerNumberTool = numberingTool from InDetTrigRecExample.InDetTrigSliceSettings import InDetTrigSliceSettings + + # GPU offloading config begins + + self.useGPU = False + + #if type == "FS" : self.useGPU = True + + if self.useGPU : + from TrigInDetAccelerationTool.TrigInDetAccelerationToolConf import TrigInDetAccelerationTool + accelTool = TrigInDetAccelerationTool(name = "TrigInDetAccelerationTool_FTF") + ToolSvc += accelTool + + + # GPU offloading config ends + self.doResMon = InDetTrigSliceSettings[('doResMon',remapped_type)] # switch between Run-2/3 monitoring diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx index d7fb3422950d514c78c2f4c61a11d29916f211c8..38c0c5cd2b07b8082c4a54f733d0e24a217b979d 100644 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx @@ -61,6 +61,12 @@ #include "TrigInDetToolInterfaces/ITrigZFinder.h" #include "SiSpacePointsSeed/SiSpacePointsSeed.h" + +//for GPU acceleration + +#include "TrigInDetAccelerationTool/ITrigInDetAccelerationTool.h" +#include "TrigInDetAccelerationService/ITrigInDetAccelerationSvc.h" + #include "TrigFastTrackFinder.h" #include "AthenaBaseComps/AthMsgStreamMacros.h" #include "CxxUtils/phihelper.h" @@ -70,6 +76,11 @@ #include "AthenaMonitoringKernel/Monitored.h" #include "GaudiKernel/ThreadLocalContext.h" +//for GPU acceleration + +#include "TrigAccelEvent/TrigInDetAccelEDM.h" +#include "TrigAccelEvent/TrigInDetAccelCodes.h" + TrigFastTrackFinder::TrigFastTrackFinder(const std::string& name, ISvcLocator* pSvcLocator) : HLT::FexAlgo(name, pSvcLocator), @@ -80,6 +91,8 @@ TrigFastTrackFinder::TrigFastTrackFinder(const std::string& name, ISvcLocator* p m_trigInDetTrackFitter("TrigInDetTrackFitter"), m_trigZFinder("TrigZFinder/TrigZFinder", this ), m_trackSummaryTool("Trk::ITrackSummaryTool/ITrackSummaryTool"), + m_accelTool("TrigInDetAccelerationTool"), + m_accelSvc("TrigInDetAccelerationSvc", name), m_doCloneRemoval(true), m_useBeamSpot(true), m_doZFinder(false), @@ -95,7 +108,8 @@ TrigFastTrackFinder::TrigFastTrackFinder(const std::string& name, ISvcLocator* p m_sctId(0), m_idHelper(0), m_particleHypothesis(Trk::pion), - m_useNewLayerNumberScheme(false) + m_useNewLayerNumberScheme(false), + m_useGPU(false) { /** Doublet finding properties. */ @@ -157,6 +171,8 @@ TrigFastTrackFinder::TrigFastTrackFinder(const std::string& name, ISvcLocator* p declareProperty("useNewLayerNumberScheme", m_useNewLayerNumberScheme = false); + declareProperty("useGPU", m_useGPU = false); + // declare monitoring histograms } @@ -279,6 +295,28 @@ HLT::ErrorCode TrigFastTrackFinder::hltInitialize() { ATH_MSG_DEBUG(" Feature set recorded with Key " << m_attachedFeatureName); ATH_MSG_DEBUG(" doResMon " << m_doResMonitoring); + + if(m_useGPU) {//for GPU acceleration + sc = m_accelSvc.retrieve(); + if(sc.isFailure()) { + ATH_MSG_ERROR("Could not retrieve "<<m_accelSvc); + m_useGPU = false; + } + if(!m_accelSvc->isReady()) { + ATH_MSG_INFO("Acceleration service not ready - no GPU found"); + m_useGPU = false; + } + else { + sc = m_accelTool.retrieve(); + if(sc.isFailure()) { + ATH_MSG_ERROR("Could not retrieve "<<m_accelTool); + m_useGPU = false; + } + } + } + + ATH_MSG_INFO("Use GPU acceleration : "<<std::boolalpha<<m_useGPU); + ATH_MSG_DEBUG(" Initialized successfully"); return HLT::OK; } @@ -508,20 +546,31 @@ StatusCode TrigFastTrackFinder::findTracks(InDet::SiTrackMakerEventData_xk &trac mnt_timer_TripletMaking.start(); - TRIG_TRACK_SEED_GENERATOR seedGen(m_tcs); + std::vector<TrigInDetTriplet*> triplets; + + if(!m_useGPU) { - seedGen.loadSpacePoints(convertedSpacePoints); + TRIG_TRACK_SEED_GENERATOR seedGen(m_tcs); - if (m_doZFinder && m_doFastZVseeding) { - seedGen.createSeeds(tmpRoi.get(), vZv); + seedGen.loadSpacePoints(convertedSpacePoints); + + if (m_doZFinder && m_doFastZVseeding) { + seedGen.createSeeds(tmpRoi.get(), vZv); + } + else { + seedGen.createSeeds(tmpRoi.get()); + } + + seedGen.getSeeds(triplets); } else { - seedGen.createSeeds(tmpRoi.get()); - } + //GPU offloading begins ... - std::vector<TrigInDetTriplet*> triplets; - seedGen.getSeeds(triplets); + makeSeedsOnGPU(m_tcs, tmpRoi.get(), convertedSpacePoints, triplets); + //GPU offloading ends ... + } + ATH_MSG_DEBUG("number of triplets: " << triplets.size()); mnt_timer_TripletMaking.stop(); mnt_roi_lastStageExecuted = 4; @@ -1203,3 +1252,48 @@ void TrigFastTrackFinder::runResidualMonitoring(const Trk::Track& track) const { } } +void TrigFastTrackFinder::makeSeedsOnGPU(const TrigCombinatorialSettings& tcs, const IRoiDescriptor* roi, const std +::vector<TrigSiSpacePointBase>& vsp, std::vector<TrigInDetTriplet*>& output) const { + + output.clear(); + + TrigAccel::DATA_EXPORT_BUFFER* dataBuffer = new TrigAccel::DATA_EXPORT_BUFFER(5000);//i.e. 5KB + + size_t actualSize = m_accelTool->exportSeedMakingJob(tcs, roi, vsp, *dataBuffer); + + ATH_MSG_DEBUG("SeedMakingJob is ready, data size for transfer = " <<actualSize); + + std::shared_ptr<TrigAccel::OffloadBuffer> pBuff = std::make_shared<TrigAccel::OffloadBuffer>(dataBuffer); + + TrigAccel::Work* pJob = m_accelSvc->createWork(TrigAccel::InDetJobControlCode::MAKE_SEEDS, pBuff); + + if(pJob) { + ATH_MSG_DEBUG("Work item created for task "<<TrigAccel::InDetJobControlCode::MAKE_SEEDS); + + pJob->run(); + + + std::shared_ptr<TrigAccel::OffloadBuffer> pOB = pJob->getOutput(); + + TrigAccel::OUTPUT_SEED_STORAGE* pOutput = reinterpret_cast<TrigAccel::OUTPUT_SEED_STORAGE *>(pOB->m_rawBuffer); + + ATH_MSG_DEBUG("Found "<<pOutput->m_nSeeds<<" triplets on GPU"); + + int nTriplets = pOutput->m_nSeeds; + + //copy seeds into the output buffer + + output.clear(); + + for(int k=0;k<nTriplets;k++) { + const TrigSiSpacePointBase& SPi = vsp[pOutput->m_innerIndex[k]]; + const TrigSiSpacePointBase& SPm = vsp[pOutput->m_middleIndex[k]]; + const TrigSiSpacePointBase& SPo = vsp[pOutput->m_outerIndex[k]]; + TrigInDetTriplet* t = new TrigInDetTriplet(SPi, SPm, SPo, pOutput->m_Q[k]); + output.push_back(t); + } + } + + delete pJob; + delete dataBuffer; +} diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.h b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.h index 164f2e79b2fd5206bf02117bded7bb6717eaa154..b4e54a9b26e0bec3e6547918436040d82be68b57 100644 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.h +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.h @@ -39,7 +39,10 @@ class ITrigL2ResidualCalculator; class ITrigInDetTrackFitter; class ITrigZFinder; class TrigRoiDescriptor; +class TrigSiSpacePointBase; +class TrigInDetTriplet; class Identifier; + namespace InDet { class ISiTrackMaker; class SiTrackMakerEventData_xk; @@ -54,6 +57,11 @@ class PixelID; class SCT_ID; class AtlasDetectorID; +// for GPU acceleration + +class ITrigInDetAccelerationTool; +class ITrigInDetAccelerationSvc; + class TrigFastTrackFinder : public HLT::FexAlgo { public: @@ -99,6 +107,10 @@ protected: ToolHandle< Trk::ITrackSummaryTool > m_trackSummaryTool; ToolHandle< GenericMonitoringTool > m_monTool { this, "MonTool", "", "Monitoring tool" }; + //for GPU acceleration + ToolHandle<ITrigInDetAccelerationTool> m_accelTool; + ServiceHandle<ITrigInDetAccelerationSvc> m_accelSvc; + //DataHandles SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiCollectionKey; SG::WriteHandleKey<TrackCollection> m_outputTracksKey; @@ -164,6 +176,12 @@ protected: bool m_useNewLayerNumberScheme; + // GPU acceleration + + bool m_useGPU; + + void makeSeedsOnGPU(const TrigCombinatorialSettings&, const IRoiDescriptor*, const std::vector<TrigSiSpacePointBase>&, std::vector<TrigInDetTriplet*>&) const; + }; #endif // not TRIGFASTTRACKFINDER_TRIGFASTTRACKFINDER_H diff --git a/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.cxx b/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.cxx index f52c942bef555299582ec1f972aca1688410ab1a..404db6f58544d7e0240d00e3d61594fc1590e0f6 100644 --- a/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.cxx +++ b/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.cxx @@ -25,7 +25,6 @@ #include "AthenaKernel/Timeout.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" -//#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h" #include "GaudiKernel/ITHistSvc.h" #include <TH1F.h> //#include <TH2F.h> diff --git a/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.h b/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.h index 7726e8ee4a635d6765677650eed9d08b0e8a1bb5..fb76f599d206fb3b3ffbb83b2540dfcf753d9170 100644 --- a/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.h +++ b/Trigger/TrigAlgorithms/TrigGenericAlgs/src/AcceptL1TopoMonitor.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 TRIGGENERICALGS_ACCEPTL1TOPOMONITOR_H @@ -42,7 +42,6 @@ class ITHistSvc; class IROBDataProviderSvc; -class ITrigROBDataProviderSvc; class TH1F; /// for monitoring purposes class TH2F; /// for monitoring purposes class TProfile;/// for monitoring purposes diff --git a/Trigger/TrigAlgorithms/TrigMuSuperEF/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigMuSuperEF/CMakeLists.txt index 4a438dc17806f36449d9b64440e030ef6757f29a..e7469ef16b51e36afe08b1cdb7cf15db35908fcf 100644 --- a/Trigger/TrigAlgorithms/TrigMuSuperEF/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigMuSuperEF/CMakeLists.txt @@ -1,45 +1,15 @@ -################################################################################ -# Package: TrigMuSuperEF -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigMuSuperEF ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PRIVATE - Calorimeter/CaloEvent - Control/AthenaKernel - Event/xAOD/xAODMuon - Event/xAOD/xAODTracking - Event/FourMomUtils - GaudiKernel - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment - MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces - Reconstruction/MuonIdentification/MuidEvent - Reconstruction/MuonIdentification/MuonCombinedEvent - Reconstruction/MuonIdentification/MuonCombinedToolInterfaces - Reconstruction/Particle - Tracking/TrkEvent/TrkSegment - Tracking/TrkTools/TrkToolInterfaces - Trigger/TrigConfiguration/TrigConfHLTData - Trigger/TrigEvent/TrigMuonEvent - Trigger/TrigEvent/TrigNavigation - Trigger/TrigEvent/TrigSteeringEvent - Trigger/TrigSteer/TrigInterfaces - Trigger/TrigT1/TrigT1Interfaces - Trigger/TrigTools/TrigMuonToolInterfaces - Trigger/TrigTools/TrigTimeAlgs ) - -include_directories(src) - # Component(s) in the package: atlas_add_component( TrigMuSuperEF src/*.cxx src/components/*.cxx - LINK_LIBRARIES CaloEvent xAODMuon xAODTracking FourMomUtils GaudiKernel MuonPattern MuonSegment MuonRecToolInterfaces MuidEvent MuonCombinedEvent MuonCombinedToolInterfaces Particle TrkSegment TrkToolInterfaces TrigConfHLTData TrigMuonEvent TrigNavigationLib TrigSteeringEvent TrigInterfacesLib TrigT1Interfaces TrigTimeAlgsLib ) + LINK_LIBRARIES AthenaKernel CaloEvent FourMomUtils GaudiKernel MuidEvent MuonCombinedEvent MuonCombinedToolInterfaces MuonPattern MuonRecToolInterfaces MuonSegment Particle TrigConfHLTData TrigInterfacesLib TrigMuonEvent TrigMuonToolInterfaces TrigNavigationLib TrigSteeringEvent TrigT1Interfaces TrigTimeAlgsLib TrkSegment TrkToolInterfaces xAODMuon xAODTracking ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-extensions=ATL900,ATL901 ) atlas_install_joboptions( share/test_TrigMuSuperEF.py share/TrigMuSuperEF_debug_postOptions.py ) diff --git a/Trigger/TrigAlgorithms/TrigMuSuperEF/python/TrigMuSuperEFConfig.py b/Trigger/TrigAlgorithms/TrigMuSuperEF/python/TrigMuSuperEFConfig.py index 8867e4b0a6feaebbea2e920b7b56d9045a324479..e53436281d36386750727f469276b1b4d8aa2be3 100644 --- a/Trigger/TrigAlgorithms/TrigMuSuperEF/python/TrigMuSuperEFConfig.py +++ b/Trigger/TrigAlgorithms/TrigMuSuperEF/python/TrigMuSuperEFConfig.py @@ -1,18 +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 TriggerJobOpts.TriggerFlags import TriggerFlags from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig from .TrigMuSuperEFMonitoring import TrigMuSuperEFMonitoring,TrigMuSuperEFValidationMonitoring from TrigMuonEF.TrigMuonEFMonitoring import TrigMuonEFStandaloneToolMonitoring,TrigMuonEFCombinerToolMonitoring,TrigMuonEFStandaloneToolValidationMonitoring,TrigMuonEFCombinerToolValidationMonitoring -from TrigMuonEF.TrigMuonEFConf import TrigMuonEFTrackIsolationTool from TrigMuonHypo.TrigMuonHypoConfig import TrigMuonEFCombinerHypoConfig from .TrigMuSuperEFConf import TrigMuSuperEF -from AthenaCommon.BeamFlags import jobproperties from AthenaCommon.CfgGetter import getPublicTool from AthenaCommon import CfgMgr -from AthenaCommon.SystemOfUnits import mm # # Default config: RoI based, Combined, TrigMuonEF only @@ -51,10 +48,7 @@ class TrigMuSuperEFConfig(TrigMuSuperEF): doTrigMuonEF = kwargs["doOutsideIn"] doTrigMuGirl = kwargs["doInsideOut"] doStandaloneOnly = kwargs["StandaloneOnly"] - doFullScan = kwargs["fullScan"] - doCaloTagOnly = kwargs["CaloTagOnly"] combinerOnly = kwargs["CombinerOnly"] - doCosmics = jobproperties.Beam.beamType == 'cosmics' # turn on seeded data decoding by default TriggerFlags.MuonSlice.doEFRoIDrivenAccess = True @@ -284,7 +278,6 @@ def TrigMuSuperEF_TrackDepositInCaloTool(name = "TrigMuSuperEF_TrackDepositInCal return CfgMgr.TrackDepositInCaloTool(name, **kwargs) def TrigMuSuperEF_CaloTrkSelectorTool( name = 'TrigMuSuperEF_CaloTrkSelectorTool', **kwargs): - from AthenaCommon.AppMgr import ToolSvc kwargs.setdefault("pTMin", 5000.) kwargs.setdefault("IPd0Max", 7) diff --git a/Trigger/TrigAlgorithms/TrigMuSuperEF/python/TrigMuSuperEFConfigDb.py b/Trigger/TrigAlgorithms/TrigMuSuperEF/python/TrigMuSuperEFConfigDb.py index 9cb9c3dc53d2f28b8d1d15ae562a9733498f0921..ea3abd9210ae1c4a0719dcaa81c9f1660c88885b 100644 --- a/Trigger/TrigAlgorithms/TrigMuSuperEF/python/TrigMuSuperEFConfigDb.py +++ b/Trigger/TrigAlgorithms/TrigMuSuperEF/python/TrigMuSuperEFConfigDb.py @@ -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 -from AthenaCommon.CfgGetter import addAlgorithm,addTool,addService +from AthenaCommon.CfgGetter import addAlgorithm,addTool # RoI based addAlgorithm("TrigMuSuperEF.TrigMuSuperEFConfig.TrigMuSuperEF","TrigMuSuperEF") diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigMuonEF/CMakeLists.txt index 4666a30d42d0582faaec3002070f68ced0c7afe1..f937005ae5faf71f59b9b0203e7279f12f9f3e39 100644 --- a/Trigger/TrigAlgorithms/TrigMuonEF/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigMuonEF/CMakeLists.txt @@ -1,76 +1,18 @@ -################################################################################ -# Package: TrigMuonEF -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigMuonEF ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Trigger/TrigEvent/TrigMuonEvent - Trigger/TrigEvent/TrigSteeringEvent - PRIVATE - Calorimeter/CaloEvent - Control/AthenaBaseComps - Control/AthenaKernel - Control/CxxUtils - Control/StoreGate - DetectorDescription/IRegionSelector - Event/EventPrimitives - Event/FourMomUtils - Event/xAOD/xAODCaloEvent - Event/xAOD/xAODMuon - Event/xAOD/xAODTrigMuon - Event/xAOD/xAODTracking - GaudiKernel - InnerDetector/InDetRecTools/InDetTrackSelectionTool - MuonSpectrometer/MuonCnv/MuonCnvToolInterfaces - MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry - MuonSpectrometer/MuonIdHelpers - MuonSpectrometer/MuonReconstruction/MuonDataPrep/CscClusterization - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPattern - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment - MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces - MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MuonSegmentCombinerToolInterfaces - MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentMakerToolInterfaces - PhysicsAnalysis/AnalysisCommon/PATCore - Reconstruction/MuonIdentification/MuidInterfaces - Reconstruction/MuonIdentification/MuonCombinedEvent - Reconstruction/MuonIdentification/MuonCombinedToolInterfaces - Reconstruction/Particle - Reconstruction/RecoTools/RecoToolInterfaces - Tracking/TrkEvent/TrkEventPrimitives - Tracking/TrkEvent/TrkParameters - Tracking/TrkEvent/TrkSegment - Tracking/TrkEvent/TrkTrack - Tracking/TrkEvent/TrkTrackSummary - Tracking/TrkTools/TrkToolInterfaces - Trigger/TrigConfiguration/TrigConfHLTData - Trigger/TrigEvent/TrigCaloEvent - Trigger/TrigEvent/TrigInDetEvent - Trigger/TrigEvent/TrigNavigation - Trigger/TrigSteer/DecisionHandling - Trigger/TrigSteer/TrigCompositeUtils - Trigger/TrigSteer/TrigInterfaces - Trigger/TrigTools/TrigMuonToolInterfaces - Trigger/TrigTools/TrigTimeAlgs ) - # External dependencies: find_package( CLHEP ) -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - -include_directories(src) +find_package( ROOT COMPONENTS MathCore ) # Component(s) in the package: atlas_add_component( TrigMuonEF src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} TrigMuonEvent TrigSteeringEvent CaloEvent AthenaBaseComps AthenaKernel StoreGateLib SGtests IRegionSelector EventPrimitives FourMomUtils xAODCaloEvent xAODMuon xAODTracking GaudiKernel MuonReadoutGeometry MuonIdHelpersLib CscClusterizationLib MuonPattern MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonRecToolInterfaces MuidInterfaces MuonCombinedEvent MuonCombinedToolInterfaces Particle PATCoreLib RecoToolInterfaces TrkEventPrimitives TrkParameters TrkSegment TrkTrack TrkTrackSummary TrkToolInterfaces TrigConfHLTData TrigCaloEvent TrigInDetEvent TrigNavigationLib DecisionHandlingLib TrigInterfacesLib TrigTimeAlgsLib TrigCompositeUtilsLib MuonCnvToolInterfacesLib ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${ROOT_LIBRARIES} AthContainers AthenaBaseComps AthenaKernel AthenaMonitoringKernelLib CaloEvent CscClusterizationLib CxxUtils EventPrimitives FourMomUtils GaudiKernel IRegionSelector InDetTrackSelectionToolLib MuidInterfaces MuonCnvToolInterfacesLib MuonCombinedEvent MuonCombinedToolInterfaces MuonIdHelpersLib MuonPattern MuonPrepRawData MuonRIO_OnTrack MuonReadoutGeometry MuonRecToolInterfaces MuonSegment MuonSegmentCombinerToolInterfaces MuonSegmentMakerToolInterfaces Particle RecoToolInterfaces StoreGateLib TrigCompositeUtilsLib TrigConfHLTData TrigInDetEvent TrigInterfacesLib TrigMuonEvent TrigMuonToolInterfaces TrigNavigationLib TrigParticle TrigSteeringEvent TrigTimeAlgsLib TrkEventPrimitives TrkParameters TrkSegment TrkToolInterfaces TrkTrack TrkTrackSummary xAODCaloEvent xAODMuon xAODTracking xAODTrigMuon ) # Install files from the package: -atlas_install_python_modules( python/TrigMuonEFConfig.py python/TrigMuonEFCosmicConfig.py python/TrigMuonEFMonitoring.py python/TrigMuonEFConfigDb.py ) -atlas_install_joboptions( share/test_TrigMuonEF.py ) - +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-extensions=ATL900,ATL901 ) diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py index 943a628ad75a5fa4ba4b369701f1eb1984d58732..5cdf7d0c7dfb4442ae2dc6cbc489e45a734d0031 100755 --- a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py +++ b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfig.py @@ -2,10 +2,9 @@ # TrigMuonEF configurables # -from TrigMuonEF.TrigMuonEFConf import * +from TrigMuonEF import TrigMuonEFConf +from TrigMuonEF import TrigMuonEFMonitoring from TriggerJobOpts.TriggerFlags import TriggerFlags -from TrigMuonEF.TrigMuonEFMonitoring import * -from TriggerJobOpts.TriggerFlags import TriggerFlags from AthenaCommon.AppMgr import ToolSvc from AthenaCommon.AppMgr import ServiceMgr from AthenaCommon import CfgMgr @@ -39,9 +38,7 @@ beamFlags = jobproperties.Beam #ToolSvc += TMEFCaloIsolationTool -from egammaRec.Factories import PublicToolFactory, AlgFactory, getPropertyValue - -from egammaCaloTools.egammaCaloToolsFactories import CaloFillRectangularCluster +from egammaRec.Factories import PublicToolFactory from AthenaCommon.GlobalFlags import globalflags isMC = not globalflags.DataSource()=='data' @@ -50,8 +47,7 @@ IsoCorrectionTool = PublicToolFactory(ICT, name = "NewLeakageCorrTool", IsMC = isMC) -from CaloIdentifier import SUBCALO -from IsolationTool.IsolationToolConf import xAOD__CaloIsolationTool, xAOD__TrackIsolationTool +from IsolationTool.IsolationToolConf import xAOD__CaloIsolationTool # tool to collect topo clusters in cone from ParticlesInConeTools.ParticlesInConeToolsConf import xAOD__CaloClustersInConeTool @@ -113,7 +109,7 @@ def TMEF_TrackSummaryTool(name='TMEF_TrackSummaryTool',**kwargs): kwargs.setdefault("doSharedHits", False) # only add ID tool if ID is on if DetFlags.detdescr.ID_on(): - from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigTrackSummaryHelperTool, InDetTrigHoleSearchTool + from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigTrackSummaryHelperTool kwargs.setdefault("InDetSummaryHelperTool", InDetTrigTrackSummaryHelperTool) kwargs.setdefault("doHolesInDet",True) @@ -152,7 +148,6 @@ def TMEF_iPatFitter(name='TMEF_iPatFitter',**kwargs): def TMEF_iPatSLFitter(name='TMEF_iPatSLFitter',**kwargs): - from MuonRecExample.MuonStandaloneFlags import muonStandaloneFlags kwargs.setdefault("LineFit", True) #kwargs.setdefault("LineMomentum", muonStandaloneFlags.straightLineFitMomentum()) # call the other factory function @@ -183,7 +178,6 @@ def TMEF_TrkMaterialProviderTool(name='TMEF_TrkMaterialProviderTool',**kwargs): def TMEF_CombinedMuonTrackBuilder(name='TMEF_CombinedMuonTrackBuilder',**kwargs): - from MuonRecExample.MuonStandaloneFlags import muonStandaloneFlags kwargs.setdefault("CaloEnergyParam", "TMEF_CaloEnergyTool") kwargs.setdefault("CaloTSOS", "TMEF_CaloTrackStateOnSurface") kwargs.setdefault("CscRotCreator", "") # enabled with special version in Muid offline @@ -392,7 +386,6 @@ def TMEF_MuonClusterSegmentFinder(name="TMEF_MuonClusterSegmentFinder", **kwargs return CfgMgr.Muon__MuonClusterSegmentFinder(name,**kwargs) def TMEF_MuonClusterSegmentFinderTool(name="TMEF_MuonClusterSegmentFinderTool", extraFlags=None,**kwargs): - import MuonCombinedRecExample.CombinedMuonTrackSummary kwargs.setdefault("TrackSummaryTool", "TMEF_TrackSummaryTool") return CfgMgr.Muon__MuonClusterSegmentFinderTool(name,**kwargs) @@ -453,24 +446,28 @@ def TMEF_CombinedStauTrackBuilderFit( name='TMEF_CombinedStauTrackBuilderFit', * def TMEF_MdtRawDataProviderTool(name="TMEF_MdtRawDataProviderTool",**kwargs): kwargs.setdefault("Decoder", "MdtROD_Decoder") + from OverlayCommonAlgs.OverlayFlags import overlayFlags if DetFlags.overlay.MDT_on() and overlayFlags.isDataOverlay(): kwargs.setdefault("RdoLocation",overlayFlags.dataStore()+"+MDTCSM") return CfgMgr.Muon__MDT_RawDataProviderTool(name,**kwargs) def TMEF_RpcRawDataProviderTool(name = "TMEF_RpcRawDataProviderTool",**kwargs): kwargs.setdefault("Decoder", "RpcROD_Decoder") + from OverlayCommonAlgs.OverlayFlags import overlayFlags if DetFlags.overlay.RPC_on() and overlayFlags.isDataOverlay(): kwargs.setdefault("RdoLocation", overlayFlags.dataStore()+"+RPCPAD") return CfgMgr.Muon__RPC_RawDataProviderTool(name,**kwargs) def TMEF_TgcRawDataProviderTool(name = "TMEF_TgcRawDataProviderTool",**kwargs): kwargs.setdefault("Decoder", "TgcROD_Decoder") + from OverlayCommonAlgs.OverlayFlags import overlayFlags if DetFlags.overlay.TGC_on() and overlayFlags.isDataOverlay(): kwargs.setdefault("RdoLocation", overlayFlags.dataStore()+"+TGCRDO") return CfgMgr.Muon__TGC_RawDataProviderTool(name,**kwargs) def TMEF_CscRawDataProviderTool(name = "TMEF_CscRawDataProviderTool",**kwargs): kwargs.setdefault("Decoder", "CscROD_Decoder") + from OverlayCommonAlgs.OverlayFlags import overlayFlags if DetFlags.overlay.CSC_on() and overlayFlags.isDataOverlay(): kwargs.setdefault("RdoLocation", overlayFlags.dataStore()+"+CSCRDO") return CfgMgr.Muon__CSC_RawDataProviderTool(name,**kwargs) @@ -491,7 +488,7 @@ class TrigMuonEFCombinerConfig (): -class TrigMuonEFStandaloneTrackToolConfig (TrigMuonEFStandaloneTrackTool): +class TrigMuonEFStandaloneTrackToolConfig (TrigMuonEFConf.TrigMuonEFStandaloneTrackTool): __slots__ = () def __init__( self, name="TrigMuonEFStandaloneTrackTool", **kwargs ): @@ -606,7 +603,7 @@ class TrigMuonEFStandaloneTrackToolConfig (TrigMuonEFStandaloneTrackTool): self.TrackToTrackParticleConvTool = "MuonParticleCreatorTool" - import MuonCondAlg.MdtCondDbAlgConfig #MDT conditions, needed for the MuonStationIntersectSvc + import MuonCondAlg.MdtCondDbAlgConfig # noqa: F401 (MDT conditions, needed for the MuonStationIntersectSvc) #from MuonRecExample.MuonRecTools import MuonSTEP_Propagator #MuonSTEP_Propagator.OutputLevel=5 @@ -619,7 +616,7 @@ class TrigMuonEFCombinerConfigTRTOnly (): raise RuntimeError("TrigMuonEFCombinerTRTOnly no longer supported - please switch to combiner mode of TrigMuSuperEF") -class TrigMuonEFCaloIsolationConfig (TrigMuonEFCaloIsolation): +class TrigMuonEFCaloIsolationConfig (TrigMuonEFConf.TrigMuonEFCaloIsolation): __slots__ = () def __init__( self, name="TrigMuonEFCaloIsolationConfig" ): @@ -638,13 +635,11 @@ class TrigMuonEFCaloIsolationConfig (TrigMuonEFCaloIsolation): self.CaloTopoClusterIsolationTool = CaloTopoIsolationTool() - from TrigMuonEF.TrigMuonEFMonitoring import TrigMuonEFCaloIsolationValidationMonitoring - # histograms self.HistoPathBase = "" - validation_caloiso = TrigMuonEFCaloIsolationValidationMonitoring() - #online_caloiso = TrigMuonEFCaloIsolationOnlineMonitoring() - #monitoring_caloiso = TrigMuonEFCaloIsolationMonitoring() + validation_caloiso = TrigMuonEFMonitoring.TrigMuonEFCaloIsolationValidationMonitoring() + #online_caloiso = TrigMuonEFMonitoring.TrigMuonEFCaloIsolationOnlineMonitoring() + #monitoring_caloiso = TrigMuonEFMonitoring.TrigMuonEFCaloIsolationMonitoring() self.AthenaMonTools = [validation_caloiso] @@ -662,10 +657,10 @@ def TMEF_TrackIsolationTool(name='TMEF_isolationTool',**kwargs): trkseltool.CutLevel='TightPrimary' log.debug('TMEF_TrackIsolationTool added trackselection tool:\n%s', trkseltool) kwargs.setdefault('TrackSelectionTool',trkseltool) - return TrigMuonEFTrackIsolationTool(name, **kwargs) + return TrigMuonEFConf.TrigMuonEFTrackIsolationTool(name, **kwargs) -class TrigMuonEFTrackIsolationConfig (TrigMuonEFTrackIsolation): +class TrigMuonEFTrackIsolationConfig (TrigMuonEFConf.TrigMuonEFTrackIsolation): __slots__ = () def __init__( self, name="TrigMuonEFTrackIsolationConfig" ): @@ -688,13 +683,13 @@ class TrigMuonEFTrackIsolationConfig (TrigMuonEFTrackIsolation): # histograms self.histoPathBase = "" - validation_trkiso = TrigMuonEFTrackIsolationValidationMonitoring() - online_trkiso = TrigMuonEFTrackIsolationOnlineMonitoring() + validation_trkiso = TrigMuonEFMonitoring.TrigMuonEFTrackIsolationValidationMonitoring() + online_trkiso = TrigMuonEFMonitoring.TrigMuonEFTrackIsolationOnlineMonitoring() self.AthenaMonTools = [ validation_trkiso, online_trkiso ] -class TrigMuonEFMSTrackIsolationConfig (TrigMuonEFTrackIsolation): +class TrigMuonEFMSTrackIsolationConfig (TrigMuonEFConf.TrigMuonEFTrackIsolation): __slots__ = () def __init__( self, name="TrigMuonEFMSTrackIsolationConfig" ): @@ -717,13 +712,13 @@ class TrigMuonEFMSTrackIsolationConfig (TrigMuonEFTrackIsolation): # histograms self.histoPathBase = "" - validation_trkiso = TrigMuonEFTrackIsolationValidationMonitoring() - online_trkiso = TrigMuonEFTrackIsolationOnlineMonitoring() + validation_trkiso = TrigMuonEFMonitoring.TrigMuonEFTrackIsolationValidationMonitoring() + online_trkiso = TrigMuonEFMonitoring.TrigMuonEFTrackIsolationOnlineMonitoring() self.AthenaMonTools = [ validation_trkiso, online_trkiso ] -class TrigMuonEFTrackIsolationVarConfig (TrigMuonEFTrackIsolation): +class TrigMuonEFTrackIsolationVarConfig (TrigMuonEFConf.TrigMuonEFTrackIsolation): __slots__ = () def __init__( self, name="TrigMuonEFTrackIsolationVarConfig" ): @@ -753,8 +748,8 @@ class TrigMuonEFTrackIsolationVarConfig (TrigMuonEFTrackIsolation): # histograms self.histoPathBase = "" - validation_trkiso = TrigMuonEFTrackIsolationValidationMonitoring() - online_trkiso = TrigMuonEFTrackIsolationOnlineMonitoring() + validation_trkiso = TrigMuonEFMonitoring.TrigMuonEFTrackIsolationValidationMonitoring() + online_trkiso = TrigMuonEFMonitoring.TrigMuonEFTrackIsolationOnlineMonitoring() # timing self.doMyTiming = True @@ -771,24 +766,24 @@ def InDetTrkRoiMaker_Muon(name="InDetTrkRoiMaker_Muon",**kwargs): kwargs.setdefault("SeedsEtaMax", 2.5) kwargs.setdefault("SeedsPtMin", 2.0) # GeV kwargs.setdefault("FullEtaRange", 3.0) # MS goes up to 2.7 - kwargs.setdefault("AthenaMonTools", [ InDetTrkRoiMakerMonitoring("Monitoring"), - InDetTrkRoiMakerValidationMonitoring("MonitoringVal"), + kwargs.setdefault("AthenaMonTools", [ TrigMuonEFMonitoring.InDetTrkRoiMakerMonitoring("Monitoring"), + TrigMuonEFMonitoring.InDetTrkRoiMakerValidationMonitoring("MonitoringVal"), TrigTimeHistToolConfig("Time")] ) return CfgMgr.InDetTrkRoiMaker(name,**kwargs) -class TrigMuonEFRoiAggregatorConfig (TrigMuonEFRoiAggregator): +class TrigMuonEFRoiAggregatorConfig (TrigMuonEFConf.TrigMuonEFRoiAggregator): __slots__ = () def __init__( self, name="TrigMuonEFRoiAggregator", **kwargs): - super( TrigMuonEFRoiAggregator, self ).__init__( name ) + super( TrigMuonEFRoiAggregatorConfig, self ).__init__( name ) kwargs.setdefault("CopyTracks", False) self.CopyTracks = True -class TrigMuonEFFSRoiMakerConfig(TrigMuonEFFSRoiMaker): +class TrigMuonEFFSRoiMakerConfig(TrigMuonEFConf.TrigMuonEFFSRoiMaker): __slots__ = () def __init__( self, name="TrigMuonEFFSRoiMaker", **kwargs): @@ -798,11 +793,11 @@ class TrigMuonEFFSRoiMakerConfig(TrigMuonEFFSRoiMaker): self.OutputContName = "MuonEFInfo" self.CreateFSRoI = False - montool = TrigMuonEFFSRoiMakerMonitoring() + montool = TrigMuonEFMonitoring.TrigMuonEFFSRoiMakerMonitoring() self.AthenaMonTools = [ montool ] -class TrigMuonEFFSRoiMakerCaloTagConfig(TrigMuonEFFSRoiMaker): +class TrigMuonEFFSRoiMakerCaloTagConfig(TrigMuonEFConf.TrigMuonEFFSRoiMaker): __slots__ = () def __init__( self, name="TrigMuonEFFSRoiMakerCaloTag", **kwargs): @@ -822,11 +817,11 @@ class TrigMuonEFFSRoiMakerCaloTagConfig(TrigMuonEFFSRoiMaker): self.RoILabel = kwargs["RoILabel"] - montool = TrigMuonEFFSRoiMakerMonitoring() + montool = TrigMuonEFMonitoring.TrigMuonEFFSRoiMakerMonitoring() self.AthenaMonTools = [ montool ] -class TrigMuonEFFSRoiMakerUnseededConfig(TrigMuonEFFSRoiMaker): +class TrigMuonEFFSRoiMakerUnseededConfig(TrigMuonEFConf.TrigMuonEFFSRoiMaker): __slots__ = () def __init__( self, name="TrigMuonEFFSRoiMakerUnseeded", **kwargs): @@ -836,8 +831,6 @@ class TrigMuonEFFSRoiMakerUnseededConfig(TrigMuonEFFSRoiMaker): self.OutputContName = "MuonEFInfo" self.CreateCrackRoI = True - from math import pi - kwargs.setdefault("RoISizeEta", 0.1) kwargs.setdefault("RoISizePhi", 3.14159) kwargs.setdefault("RoILabel", "forID") @@ -846,12 +839,12 @@ class TrigMuonEFFSRoiMakerUnseededConfig(TrigMuonEFFSRoiMaker): self.RoISizePhi = kwargs["RoISizePhi"] self.RoILabel = kwargs["RoILabel"] - montool = TrigMuonEFFSRoiMakerMonitoring() + montool = TrigMuonEFMonitoring.TrigMuonEFFSRoiMakerMonitoring() self.AthenaMonTools = [ montool ] # Python config class for the TrigMuonEDIDTrackRoiMaker c++ algorithm -class TrigMuonEFIDTrackRoiMakerConfig(TrigMuonEFIDTrackRoiMaker): +class TrigMuonEFIDTrackRoiMakerConfig(TrigMuonEFConf.TrigMuonEFIDTrackRoiMaker): __slots__ = () def __init__( self, name="TrigMuonEFIDTrackRoiMaker", **kwargs): @@ -860,12 +853,12 @@ class TrigMuonEFIDTrackRoiMakerConfig(TrigMuonEFIDTrackRoiMaker): # use 12mm z-width for all chains self.Z0Width = 12.0*mm - montool = TrigMuonEFIDTrackRoiMakerMonitoring() + montool = TrigMuonEFMonitoring.TrigMuonEFIDTrackRoiMakerMonitoring() self.AthenaMonTools = [ montool ] -class TrigMuonEFTrackIsolationMTConfig (TrigMuonEFTrackIsolationAlgMT): +class TrigMuonEFTrackIsolationMTConfig (TrigMuonEFConf.TrigMuonEFTrackIsolationAlgMT): __slots__ = () def __init__( self, name="TrigMuonEFTrackIsolationMTConfig" ): diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfigDb.py b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfigDb.py index a9dc42b2f43b5c0358a4130e7c5ef351f0b9c182..af5ddc0daedbd7fc8e2bdf5258b6c94dcf832f37 100644 --- a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfigDb.py +++ b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFConfigDb.py @@ -1,6 +1,6 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -from AthenaCommon.CfgGetter import addAlgorithm,addTool,addService +from AthenaCommon.CfgGetter import addAlgorithm,addTool from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags addTool("TrigMuonEF.TrigMuonEFConfig.TrigMuonEFStandaloneTrackToolConfig", "TrigMuonEFStandaloneTrackTool") diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFCosmicConfig.py b/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFCosmicConfig.py deleted file mode 100755 index 0eba5a3718b1c7450760a79d2ed61618b48be7ac..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigMuonEF/python/TrigMuonEFCosmicConfig.py +++ /dev/null @@ -1,426 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -# -# TrigMuonEF configurables -# -from TrigMuonEF.TrigMuonEFConf import * -from TriggerJobOpts.TriggerFlags import TriggerFlags -from TrigMuonEF.TrigMuonEFMonitoring import * - -# configure calorimeter for track extrapolation and matching -from AthenaCommon.AppMgr import ToolSvc -from AthenaCommon.AppMgr import ServiceMgr -from AthenaCommon.Constants import VERBOSE,DEBUG,ERROR -from AthenaCommon import CfgMgr, CfgGetter - -from MuonRecExample import MuonRecTools -from MuonRecExample.MuonRecFlags import muonRecFlags -from AtlasGeoModel.MuonGMJobProperties import MuonGeometryFlags -#from MuonRecExample.MuonRecUtils import AlgToolFactory,ServiceFactory,ConfiguredBase,getProperty - -from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - -doT0Fit = True - -# (private) storage of tools -#_toolFactory = AlgToolFactory("Tools for Muon Reconstruction", -# tryDefaultPublicTool=True, -# tryDefaultPrivateTool=True) -#getPublicTool = _toolFactory.getPublicTool -#addPublicTool = _toolFactory.addPublicTool - -#from TrkDetDescrSvc.TrkDetDescrSvcConf import TrackingVolumesSvc -#ServiceMgr += TrackingVolumesSvc()# -# -#from MuidCaloEnergyTools.MuidCaloEnergyToolsConf import Rec__MuidCaloEnergyMeas -#TMEFCaloEnergyMeas = Rec__MuidCaloEnergyMeas(name = 'TMEFCaloEnergyMeas', UseCaloNoiseTool = False) -#ToolSvc += TMEFCaloEnergyMeas### - -#from MuidCaloEnergyTools.MuidCaloEnergyToolsConf import Rec__MuidCaloEnergyTool -#TMEFCaloEnergyTool = Rec__MuidCaloEnergyTool(name = 'TMEFCaloEnergyTool', CaloMeasTool = TMEFCaloEnergyMeas, -# EnergyLossMeasurement = False, MopParametrization = True) -#ToolSvc += TMEFCaloEnergyTool# -# -#from MuidCaloScatteringTools.MuidCaloScatteringToolsConf import Rec__MuidCaloTrackStateOnSurface -#TMEFCaloTrackStateOnSurface = Rec__MuidCaloTrackStateOnSurface(name = 'TMEFCaloTrackStateOnSurface', -# CaloEnergyDeposit = TMEFCaloEnergyTool) -#ToolSvc += TMEFCaloTrackStateOnSurface# -# -#from MuidTrackBuilder.MuidTrackBuilderConf import Rec__CombinedMuonTrackBuilder -#TMEFCombinedTrackBuilderCosmic = Rec__CombinedMuonTrackBuilder(name = 'TMEFCombinedTrackBuilderCosmic', -# CaloTSOS = TMEFCaloTrackStateOnSurface, -# CaloEnergyParam = TMEFCaloEnergyTool, -# ReallocateMaterial = False -# ) -#ToolSvc += TMEFCombinedTrackBuilderCosmic# -# - - -from MdtDriftCircleOnTrackCreator.MdtDriftCircleOnTrackCreatorConf import Muon__MdtDriftCircleOnTrackCreator -TMEF_MdtDriftCircleOnTrackCreatorCosmic = Muon__MdtDriftCircleOnTrackCreator("TMEF_MdtDriftCircleOnTrackCreatorCosmic", - TimingMode = 1, - DoFixedError = True, - FixedError = 2.0, - DoTofCorrection = False - ) -ToolSvc += TMEF_MdtDriftCircleOnTrackCreatorCosmic - -TMEF_AdjustableT0Tool = CfgMgr.AdjT0__AdjustableT0Tool("AdjustableT0ToolTMEF", DoTof = 0 ) -ToolSvc += TMEF_AdjustableT0Tool -TMEF_MdtDriftCircleOnTrackCreatorAdjustableT0Cosmic = Muon__MdtDriftCircleOnTrackCreator("TMEF_MdtDriftCircleOnTrackCreatorAdjustableT0Cosmic", - TimingMode = 3, - DoFixedError = True, - FixedError = 2.0, - DoTofCorrection = True - ) -ToolSvc += TMEF_MdtDriftCircleOnTrackCreatorAdjustableT0Cosmic - -from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackCreator -TMEF_MuonRotCreatorCosmic = Trk__RIO_OnTrackCreator("TMEF_MuonRotCreatorCosmic", - ToolMuonDriftCircle = TMEF_MdtDriftCircleOnTrackCreatorCosmic, - ToolMuonCluster = "MuonClusterOnTrackCreator" , - ToolMuonMMCluster = "MMClusterOnTrackCreator" , - Mode = 'muon' - ) - -ToolSvc +=TMEF_MuonRotCreatorCosmic - -from MuonCombinePatternTools.MuonCombinePatternToolsConf import MuonCombinePatternTool -TMEF_MuonCombinePatternToolCosmic = MuonCombinePatternTool("TMEF_MuonCombinePatternToolCosmic", - UseCosmics = True - ) -ToolSvc += TMEF_MuonCombinePatternToolCosmic - -from MuonHoughPatternTools.MuonHoughPatternToolsConf import MuonHoughPatternTool -TMEF_MuonHoughPatternToolCosmic = MuonHoughPatternTool("TMEF_MuonHoughPatternToolCosmic", - UseCosmics = True, - NumberOfMaximaPerIterations = 1 - ) - -ToolSvc += TMEF_MuonHoughPatternToolCosmic - -from DCMathSegmentMaker.DCMathSegmentMakerConf import Muon__MdtMathSegmentFinder -TMEF_MdtMathSegmentFinderCosmic = Muon__MdtMathSegmentFinder("TMEF_MdtMathSegmentFinderCosmic", - AssociationRoadWidth = 15, - SortSegmentWithAllHits = True) -if doT0Fit: - if muonRecFlags.doSegmentT0Fit(): - TMEF_MdtSegmentT0Fitter = MuonRecTools.getPublicTool( "MdtSegmentT0Fitter","TMEF_MdtSegmentT0Fitter" ) - TMEF_MdtMathSegmentFinderCosmic.DCFitProvider = TMEF_MdtSegmentT0Fitter - -ToolSvc += TMEF_MdtMathSegmentFinderCosmic - -from DCMathSegmentMaker.DCMathSegmentMakerConf import Muon__DCMathSegmentMaker -TMEF_DCMathSegmentMakerCosmic = Muon__DCMathSegmentMaker("TMEF_DCMathSegmentMakerCosmic", - SinAngleCut = 0.9, - AddUnassociatedPhiHits = True, - #SortSegmentWithAllHits = True, - CurvedErrorScaling = False, - MdtCreator = TMEF_MdtDriftCircleOnTrackCreatorCosmic, - MdtSegmentFinder = TMEF_MdtMathSegmentFinderCosmic - ) - -if doT0Fit: - if muonRecFlags.doSegmentT0Fit(): - TMEF_DCMathSegmentMakerCosmic.MdtCreator = TMEF_MdtDriftCircleOnTrackCreatorAdjustableT0Cosmic - -ToolSvc += TMEF_DCMathSegmentMakerCosmic - -from MuonPatternSegmentMaker.MuonPatternSegmentMakerConf import Muon__MuonPatternSegmentMaker -TMEF_MuonPatternSegmentMakerCosmic = Muon__MuonPatternSegmentMaker("TMEF_MuonPatternSegmentMakerCosmic", - DropDistance = 100000000., - SegmentMaker = TMEF_DCMathSegmentMakerCosmic, - MdtCreator = TMEF_MdtDriftCircleOnTrackCreatorCosmic - ) - -ToolSvc += TMEF_MuonPatternSegmentMakerCosmic -#? -from DCMathSegmentMaker.DCMathSegmentMakerConf import Muon__DCMathSegmentMaker -TMEF_MCTBDCMathSegmentMakerCosmic = Muon__DCMathSegmentMaker("TMEF_MCTBDCMathSegmentMakerCosmic", - SinAngleCut = 0.9, - AddUnassociatedPhiHits = True, - DoGeometry = False, - MdtCreator = TMEF_MdtDriftCircleOnTrackCreatorCosmic, - MdtSegmentFinder = TMEF_MdtMathSegmentFinderCosmic - ) -ToolSvc += TMEF_MCTBDCMathSegmentMakerCosmic - - -#from MuonCombiTrackMaker.MuonCombiTrackMakerConf import Muon__MuonSeededSegmentFinder -TMEF_MuonSeededSegmentFinderCosmic = CfgMgr.Muon__MuonSeededSegmentFinder( "TMEF_MuonSeededSegmentFinderCosmic", - SegmentMaker = TMEF_MCTBDCMathSegmentMakerCosmic, - SegmentMakerNoHoles = TMEF_DCMathSegmentMakerCosmic - ) -ToolSvc += TMEF_MuonSeededSegmentFinderCosmic - - - -#from MuonSegmentCleaner.MuonSegmentCleanerConf import MuonPhiHitSelector -#TMEF_MuonPhiHitSelectorCosmic = MuonPhiHitSelector("TMEF_MuonPhiHitSelectorCosmic", -# DoCosmics = True, -# MakeClusters = True, -# CompetingRios = True -# ) -#ToolSvc += TMEF_MuonPhiHitSelectorCosmic - -#from MuonSegmentMomentum.MuonSegmentMomentumConf import MuonSegmentMomentum -#TMEF_MuonSegmentMomentumCosmic = MuonSegmentMomentum("TMEF_MuonSegmentMomentumCosmic", -# DoCosmics = True) -#ToolSvc += TMEF_MuonSegmentMomentumCosmic - -#from MuonCurvedSegmentCombiner.MuonCurvedSegmentCombinerConf import Muon__MuonSegmentCombinationCleanerTool -#TMEF_MuonSegmentCombinationCleanerToolCosmic = Muon__MuonSegmentCombinationCleanerTool("TMEF_MuonSegmentCombinationCleanerToolCosmic", -# UpdatePhi = False, -# MuonHitSelector = TMEF_MuonPhiHitSelectorCosmic, -# MuonSegmentMomentum = TMEF_MuonSegmentMomentumCosmic, -# NoInner = True, -# DoMoore = False, -# DoCleaning = False) -#ToolSvc += TMEF_MuonSegmentCombinationCleanerToolCosmic -#MuonRecTools.addToolClone("MCTBExtrapolator","TMEF_MCTBExtrapolator",ResolveMuonStation=False) -MCTBExtrapolator = MuonRecTools.getPublicTool("MCTBExtrapolator") - -from MuonRecExample.MuonRecTools import MuonChi2TrackFitter -TMEF_MCTBSLFitterCosmic = MuonChi2TrackFitter('TMEF_MCTBSLFitterCosmic', - StraightLine = True, - Momentum = 5000., - OutputLevel = ERROR, - RotCreatorTool = TMEF_MuonRotCreatorCosmic, - ExtrapolationTool = MCTBExtrapolator, - ExtrapolatorMaterial = True - ) - -ToolSvc += TMEF_MCTBSLFitterCosmic - -TMEF_MCTBFitterCosmic = MuonChi2TrackFitter('TMEF_MCTBFitterCosmic', - #StraightLine = True,#toroinds off - #OutlierCut = 4.0, - Momentum = 0., - OutputLevel = ERROR, - ExtrapolationTool = MCTBExtrapolator, - RotCreatorTool = TMEF_MuonRotCreatorCosmic, - OutlierCut = 3.0 , - NumericalDerivs = False , - GetMaterialFromTrack = True, - ExtrapolatorMaterial = True - ) - -ToolSvc += TMEF_MCTBFitterCosmic - -from TrkExSTEP_Propagator.TrkExSTEP_PropagatorConf import Trk__STEP_Propagator -TMEF_MuonPropagatorCosmic = Trk__STEP_Propagator("TMEF_MuonPropagatorCosmic", - MaterialEffects = True, - Tolerance = 0.0001, - IncludeBgradients = False - ) -ToolSvc += TMEF_MuonPropagatorCosmic - -#from MuonCombiTrackMaker.MuonCombiTrackMakerConf import Muon__MooTrackFitter -TMEF_MooTrackFitterCosmic = CfgMgr.Muon__MooTrackFitter("TMEF_MooTrackFitterCosmic", - SeedWithAvePhi = True, - SeedWithSegmentTheta = False, - Propagator=TMEF_MuonPropagatorCosmic, - SLFit = False, - ReducedChi2Cut = 20., - Cosmics = True, - Fitter = TMEF_MCTBFitterCosmic, - FitterPreFit = TMEF_MCTBFitterCosmic, - CleanPhiHits = False - ) -ToolSvc += TMEF_MooTrackFitterCosmic - -#from MuonCombiTrackMaker.MuonCombiTrackMakerConf import Muon__MooTrackFitter -TMEF_MooSLTrackFitterCosmic = CfgMgr.Muon__MooTrackFitter("TMEF_MooSLTrackFitterCosmic", - Fitter = TMEF_MCTBSLFitterCosmic, - Cosmics = True, - FitterPreFit=TMEF_MCTBSLFitterCosmic, - Propagator="MuonStraightLinePropagator", - ReducedChi2Cut = 10.0, - SLFit=True, - CleanPhiHits = False, - SeedWithAvePhi = True, - SeedWithSegmentTheta = False - ) - -ToolSvc += TMEF_MooSLTrackFitterCosmic - - -#from MuonCombiTrackMaker.MuonCombiTrackMakerConf import Muon__MuonSegmentTrackBuilder -TMEF_MooTrackBuilderCosmic = CfgMgr.Muon__MooTrackBuilder("TMEF_MooTrackBuilderCosmic", - SeededSegmentFinder = TMEF_MuonSeededSegmentFinderCosmic, - SLFitter = TMEF_MooSLTrackFitterCosmic, - Fitter = TMEF_MooTrackFitterCosmic, - MdtRotCreator = TMEF_MdtDriftCircleOnTrackCreatorCosmic - ) -ToolSvc += TMEF_MooTrackBuilderCosmic - -#from MuonCombiTrackMaker.MuonCombiTrackMakerConf import Muon__MuonChamberHoleRecoveryTool -TMEF_MuonChamberHoleRecoveryToolCosmic = CfgMgr.Muon__MuonChamberHoleRecoveryTool("TMEF_MuonChamberHoleRecoveryToolCosmic", - CscRotCreator = "", - MdtRotCreator = TMEF_MdtDriftCircleOnTrackCreatorCosmic - ) -ToolSvc += TMEF_MuonChamberHoleRecoveryToolCosmic - -#from MuonCurvedSegmentCombiner.MuonCurvedSegmentCombinerConf import Muon__MuonCurvedSegmentCombiner -TMEF_MuonCurvedSegmentCombinerCosmic = CfgMgr.Muon__MuonCurvedSegmentCombiner("TMEF_MuonCurvedSegmentCombinerCosmic", - MissedHitsCut = 100, - AddAll2DCscs = False, - UseCscSegments = False, - DoCosmics = True - ) -ToolSvc += TMEF_MuonCurvedSegmentCombinerCosmic - -TMEF_MCTBFitterTGMatCosmic = MuonChi2TrackFitter('TMEF_MCTBFitterTGMatCosmic', - #StraightLine = True,#toroinds off - #OutlierCut = 4.0, - Momentum = 0., - OutputLevel = ERROR, - ExtrapolationTool = MCTBExtrapolator, - RotCreatorTool = TMEF_MuonRotCreatorCosmic, - GetMaterialFromTrack = True, - ExtrapolatorMaterial = True, - OutlierCut = 3.0, - NumericalDerivs = False - ) - -# for backwards compat. -# In newer verions of Trk::GlobalChi2Fitter the MboyMat property has been removed -try: - TMEF_MCTBFitterTGMatCosmic.MboyMat = False -except AttributeError: - pass - -ToolSvc += TMEF_MCTBFitterTGMatCosmic - - -#from MuonCombiTrackMaker.MuonCombiTrackMakerConf import Muon__MuonTrackScoringTool -TMEF_MuonTrackScoringToolCosmic = CfgMgr.Muon__MuonTrackScoringTool ("TMEF_MuonTrackScoringToolCosmic", - SumHelpTool = "MuonTrackSummaryTool") -ToolSvc += TMEF_MuonTrackScoringToolCosmic - - -#from MuonAmbiTrackSelectionTool.MuonAmbiTrackSelectionToolConf import Muon__MuonAmbiTrackSelectionTool -TMEF_MuonAmbiTrackSelectionToolCosmic = CfgMgr.Muon__MuonAmbiTrackSelectionTool("TMEF_MuonAmbiTrackSelectionToolCosmic") -ToolSvc += TMEF_MuonAmbiTrackSelectionToolCosmic - -import InDetRecExample.TrackingCommon as TrackingCommon -#from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__SimpleAmbiguityProcessorTool -TMEF_MuonAmbiProcessorCosmic = CfgMgr.Trk__SimpleAmbiguityProcessorTool("TMEF_MuonAmbiProcessorCosmic", - Fitter = TMEF_MCTBFitterTGMatCosmic, - AssociationTool = TrackingCommon.getInDetTrigPRDtoTrackMapToolGangedPixels(), - TrackSummaryTool = TrackingCommon.getInDetTrigTrackSummaryTool(), - ScoringTool = TMEF_MuonTrackScoringToolCosmic, - SuppressHoleSearch = True , - SuppressTrackFit = True , - DropDouble = False , - ForceRefit = False , - SelectionTool = TMEF_MuonAmbiTrackSelectionToolCosmic - ) -ToolSvc += TMEF_MuonAmbiProcessorCosmic -#from MuonCombiTrackMaker.MuonCombiTrackMakerConf import Muon__MCTBHitHandler -#TMEF_MCTBHitHandlerCosmic = Muon__MCTBHitHandler( "TMEF_MCTBHitHandlerCosmic", -# CscRotCreator = None, -# MdtRotCreator = "MdtTubeHitOnTrackCreator", -# OutputLevel = ERROR ) -#ToolSvc +=TrigMuonEF_MCTBHitHandler - - -# START SUMMARY TOOL -# particle creation, Analysis::Muon building and CBNT filling need summary helpers -# indet and muon TrackSummaryHelper's: take existing public instances when available -from TrkTrackSummaryTool.TrkTrackSummaryToolConf import Trk__TrackSummaryTool -MuonTrackSummaryHelperTool = MuonRecTools.getPublicTool("MuonTrackSummaryHelperTool") - - -from AthenaCommon.DetFlags import DetFlags - -if not DetFlags.detdescr.ID_on(): - MuidTrackSummaryTool = Trk__TrackSummaryTool( - name = "MuidTrackSummaryTool", - MuonSummaryHelperTool = MuonTrackSummaryHelperTool, - doSharedHits = False) -else: - from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigTrackSummaryHelperTool, InDetTrigHoleSearchTool - from TrkTrackSummaryTool.TrkTrackSummaryToolConf import Trk__TrackSummaryTool - MuidTrackSummaryTool = Trk__TrackSummaryTool(name ="MuidTrackSummaryTool", - InDetSummaryHelperTool = InDetTrigTrackSummaryHelperTool, - MuonSummaryHelperTool = MuonTrackSummaryHelperTool, - doSharedHits = False, - doHolesInDet = True) - -ToolSvc += MuidTrackSummaryTool -#END SUMMARY TOOL - -# TrigMuonEF classes -class TrigMuonEFSegmentFinderCosmicConfig (TrigMuonEFSegmentFinder): - __slots__ = () - - def __init__( self, name="TrigMuonEFSegmentFinderCosmic" ): - super( TrigMuonEFSegmentFinderCosmicConfig, self ).__init__( name ) - - if MuonGeometryFlags.hasCSC(): self.CscClusterProvider = CfgGetter.getPublicTool("CscThresholdClusterBuilderTool") - - from MuonRecExample.MooreTools import MooSegmentCombinationFinder - self.SegmentsFinderTool = MooSegmentCombinationFinder("SegmentsFinderToolCosmic") - - # use seeded decoding - if (TriggerFlags.MuonSlice.doEFRoIDrivenAccess()): - self.useMdtSeededDecoding = True - self.useRpcSeededDecoding = True - self.useTgcSeededDecoding = True - self.useCscSeededDecoding = True - - # use ROB based seeded decoding instead of PRD based - self.useTgcRobDecoding = False # neither available nor needed - self.useCscRobDecoding = False # neither available nor needed - - - self.SegmentsFinderTool.HoughPatternFinder.RecordAll = False - #self.SegmentsFinderTool.HoughPatternFinder.OutputLevel = DEBUG - self.SegmentsFinderTool.HoughPatternFinder.muonHoughPatternTool = TMEF_MuonHoughPatternToolCosmic - self.SegmentsFinderTool.HoughPatternFinder.muonCombinePatternTool = TMEF_MuonCombinePatternToolCosmic - self.SegmentsFinderTool.MdtSegmentMaker = TMEF_MuonPatternSegmentMakerCosmic - self.SegmentsFinderTool.SegmentCombiner = TMEF_MuonCurvedSegmentCombinerCosmic - #self.SegmentsFinderTool.SegmentCombinationCleaner = TMEF_MuonSegmentCombinationCleanerToolCosmic - - #self.SegmentsFinderTool.DoSummary = False - #self.SegmentsFinderTool.SegmentCombiner.DoSummary = True - #self.print_level = 5 - self.histoPathBase = "" - self.useRpcData=muonRecFlags.doRPCs() - self.useTgcData=muonRecFlags.doTGCs() - self.useCscData=muonRecFlags.doCSCs() - # to select barrel(useMdtData=2), endcap(useMdtData=3) - if muonRecFlags.doMDTs(): - self.useMdtData=1 - else: - self.useMdtData=0 - - self.deltaEtaRoI = 1. - self.deltaPhiRoI = 1. - self.useTGCInPriorNextBC = True - - validation_ms = TrigMuonEFSegmentFinderValidationMonitoring() - online_ms = TrigMuonEFSegmentFinderOnlineMonitoring() - cosmic_ms = TrigMuonEFSegmentFinderCosmicMonitoring() - self.AthenaMonTools = [ validation_ms, online_ms, cosmic_ms] - self.doMyTiming = False - time = TrigTimeHistToolConfig("Time") - time.TimerHistLimits = [0, 10000] - time.NumberOfHistBins = 1000 - self.AthenaMonTools += [time] - self.doTimeOutChecks = False - self.doTimeOutGuard = False - self.maxTgcHits = 0 - self.maxCscHits = 0 - self.maxRpcHits = 0 - self.maxMdtHits = 0 - self.doCache = True - -class TrigMuonEFTrackBuilderCosmicConfig (): - __slots__ = () - - def __init__( self, name="TrigMuonEFTrackBuilderCosmic" ): - - raise RuntimeError("TrigMuonEFTrackBuilder no longer supported in release 19 (or later) due to removal of MooTrackSteering from the release.") - diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/share/test_TrigMuonEF.py b/Trigger/TrigAlgorithms/TrigMuonEF/share/test_TrigMuonEF.py deleted file mode 100755 index 8d6e5d6a4aab4ab71dab2eee8aa923010c854e70..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigMuonEF/share/test_TrigMuonEF.py +++ /dev/null @@ -1,182 +0,0 @@ -# -# steering file for testing muon trigger slice with offline supertools -# -from RecExConfig.RecFlags import rec as recFlags -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -from AthenaCommon.GlobalFlags import globalflags - -athenaCommonFlags.PoolRDOInput = ["RDO.pool.root"] - -globalflags.DetDescrVersion = "ATLAS-GEO-16-01-00" - -if not ('EvtMax' in dir()): - theApp.EvtMax = 10 - -# do trigger -recFlags.doTrigger = True -recFlags.doESD = True - -# detector flags -recFlags.doMuon = True -recFlags.doInDet = True -recFlags.doCalo = True -recFlags.doLArg = True -recFlags.doTile = True -recFlags.doLucid = True - -# muon flags -#from MuonRecExample.MuonRecFlags import muonRecFlags -#muonRecFlags.doStandalone = False - -#from MuonRecExample.MuonStandaloneFlags import muonStandaloneFlags -#muonStandaloneFlags.trackBuilder = 'Moore' - -#from TrigMuonSuperEF.TrigMuonFlags import trigMuonFlags -#trigMuonFlags.doStandalone = True -#trigMuonFlags.trackBuilder = 'Moore' - -# don't do unnecessary stuff -recFlags.doMuonCombined = False -recFlags.readESD = False -recFlags.doWriteESD = False -recFlags.doCBNT = False -recFlags.doWriteAOD = False -recFlags.doWriteTAG = False -recFlags.doAOD = False -recFlags.doAODall = False -recFlags.doJiveXML = False - -# physics flags -recFlags.doHeavyIon = False -recFlags.doEgamma = False -recFlags.doTau = False -recFlags.doJetMissingETTag = False - -# monitoring/auditing -recFlags.doPerfMon = False -recFlags.doDetailedPerfMon = False -recFlags.doSemiDetailedPerfMon = False -recFlags.doMonitoring = False -recFlags.doFastPhysMonitoring = False -recFlags.doDetailedAuditor = False -recFlags.doSGAuditor = False - -# algorithms -from RecExConfig.RecAlgsFlags import recAlgs as recAlgsFlags -recAlgsFlags.doTrigger = True -recAlgsFlags.doTrackRecordFilter = True # filter truth muons getting into the spectrometer -recAlgsFlags.doMissingET = False -recAlgsFlags.doMissingETSig = False -recAlgsFlags.doObjMissingET = False -recAlgsFlags.doEFlow = False -recAlgsFlags.doEFlowJet = False -recAlgsFlags.doAtlfast = False -recAlgsFlags.doMuonSpShower = False # needs JetRec -recAlgsFlags.doTileMuID = False -recAlgsFlags.doMuTag = False -recAlgsFlags.doCaloTrkMuId = False -recAlgsFlags.doEgammaBremReco = False -recAlgsFlags.doAtlfast = False - -# disable JetRec (no RecFlags flag for that) -try: - from JetRec.JetRecFlags import jetFlags - jetFlags.Enabled = False -except ImportError: - pass - -# bug in RecExCond does not pass recFlags.doTau() -try: - from tauRec.tauRecFlags import jobproperties - jobproperties.tauRecFlags.Enabled = recFlags.doTau() -except ImportError: - pass - -#----------------------------------------------------------- -include("RecExCond/RecExCommon_flags.py") -#----------------------------------------------------------- - -#### First switch all slices OFF -TriggerFlags.Slices_all_setOff() - -# Enable Muon slice -TriggerFlags.MuonSlice.setAll() - -#TriggerFlags.MuonSlice.signatures = ['mu6', 'mu6_ef', 'mu20i'] -TriggerFlags.MuonSlice.signatures = ['mu15_mu10_EFFS'] - -# main jobOption -include ("RecExCommon/RecExCommon_topOptions.py") - -# from testMuonSliceAthenaModernRDOtoESDAOD.py -TriggerFlags.readHLTconfigFromXML=False -TriggerFlags.readLVL1configFromXML=False - -MessageSvc.debugLimit = 10000 -MessageSvc.Format = "% F%65W%S%7W%R%T %0W%M" -MessageSvc.OutputLevel = INFO - - -# -# here we add the algorithm used for debugging TMEFSegmentFinder and TMEFTrackBuilder -# -L2OutputLvl = 3 -EFOutputLvl = 2 - -topSequence.TrigSteer_EF.TrigMuonEFSegmentFinder.OutputLevel = EFOutputLvl -topSequence.TrigSteer_EF.TrigMuonEFTrackBuilder.OutputLevel = EFOutputLvl -topSequence.TrigSteer_EF.TrigMuonEFExtrapolator.OutputLevel = EFOutputLvl -topSequence.TrigSteer_EF.TrigMuonEFCombiner.OutputLevel = EFOutputLvl - -# activate summaries for offline tools -topSequence.TrigSteer_EF.TrigMuonEFSegmentFinder.SegmentsFinderTool.DoSummary = False -topSequence.TrigSteer_EF.TrigMuonEFTrackBuilder.TrackBuilderTool.DoSummary = False - -# for debug purposes write TrackCollection in StoreGate and use MuonTrackPerformanceAlg -topSequence.TrigSteer_EF.TrigMuonEFSegmentFinder.recordSegmentCombinations = False -topSequence.TrigSteer_EF.TrigMuonEFSegmentFinder.recordPatternCombinations = False -topSequence.TrigSteer_EF.TrigMuonEFTrackBuilder.recordTrackCollection = True - -if topSequence.TrigSteer_EF.TrigMuonEFTrackBuilder.recordTrackCollection: - from MuonTrackPerformance.MuonTrackPerformanceConf import MuonTrackPerformanceAlg - topSequence += MuonTrackPerformanceAlg("MuonTrackPerformanceAlg", - TrackInputLocation = "TrigMuonEFTBTracks", - SegmentCombitLocation = "TrigMuonEFSegments" ) - topSequence.MuonTrackPerformanceAlg.DoSummary = 1 - topSequence.MuonTrackPerformanceAlg.DoTrackDebug = 5 - topSequence.MuonTrackPerformanceAlg.OutputLevel = EFOutputLvl - -#from MuonRdoToPrepData.MuonRdoToPrepDataGenConf import MdtRdoToMdtPrepData -#MdtRdoToMdtPrepData = MdtRdoToMdtPrepData() -#MdtRdoToMdtPrepData.OutputLevel = INFO -#RpcRdoToRpcPrepData.OutputLevel = INFO -#TgcRdoToTgcPrepData.OutputLevel = INFO -#CscRdoToCscPrepData.OutputLevel = INFO - -if TriggerFlags.doMuon() and TriggerFlags.doLVL2() and TriggerFlags.MuonSlice.signatures(): - muFast = topSequence.TrigSteer_L2.allConfigurables.get('muFast_Muon') - muFast.MUlvl1INFO = False - muFast.MUtrackINFO = False - muFast.MUroadsINFO = False - muFast.MUdecoINFO = False - muFast.MUcontINFO = False - muFast.MUfitINFO = False - muFast.MUsagINFO = False - muFast.MUptINFO = True - muFast.TestString = "muFast_Muon REGTEST " - muFast.OutputLevel = L2OutputLvl - muFastHypo6 = topSequence.TrigSteer_L2.allConfigurables.get('MufastHypo_Muon_6GeV_v11a') - muFastHypo6.OutputLevel = L2OutputLvl - muFastHypo20 = topSequence.TrigSteer_L2.allConfigurables.get('MufastHypo_Muon_20GeV_v11a') - muFastHypo20.OutputLevel = L2OutputLvl - muCombHypo6 = topSequence.TrigSteer_L2.allConfigurables.get('MucombHypo_Muon_6GeV') - muCombHypo6.OutputLevel = L2OutputLvl - muCombHypo20 = topSequence.TrigSteer_L2.allConfigurables.get('MucombHypo_Muon_20GeV') - muCombHypo20.OutputLevel = L2OutputLvl - - -print topSequence -print ServiceMgr - -from AthenaCommon.ConfigurationShelve import saveToAscii -saveToAscii("config.txt") diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/share/test_TrigMuonEF_edm.py b/Trigger/TrigAlgorithms/TrigMuonEF/share/test_TrigMuonEF_edm.py deleted file mode 100644 index 426598f19420833782046c7edcf140b2fbafc10d..0000000000000000000000000000000000000000 --- a/Trigger/TrigAlgorithms/TrigMuonEF/share/test_TrigMuonEF_edm.py +++ /dev/null @@ -1,49 +0,0 @@ -import ROOT -if not ('PoolAODInput' in dir()): - PoolAODInput=['/afs/cern.ch/user/t/tbold/public/TDTtest/menu1/AOD.pool.root'] - PoolAODInput=['AOD.pool.root'] - -print 'input file = ', PoolAODInput - -print '... build collection and metadata trees' -from TrigDecisionTool.BuildTransientTrees import BuildTransientTrees -(transientTree, transientMetaDataTree) = BuildTransientTrees(PoolAODInput) - -### instantiate the TrigDecisionToolARA -print '... instantiate TrigDecisionToolARA' -tdt = ROOT.Trig.TrigDecisionToolARA(transientTree, transientMetaDataTree) - -cg = tdt.getChainGroup('EF_mu10') - -nevt = transientTree.GetEntries() - -print '... loop over %i events' % nevt - -for evt in xrange(nevt): - transientTree.GetEntry(evt) - - featcont = cg.features() - - combs = featcont.getCombinations() - - for comb in combs: - - - muefinfo = comb.get('TrigMuonEFInfoContainer')() - - for muefinfofeat in muefinfo: - thecont = muefinfofeat.cptr() - for efinfo in thecont: - print 'EF roi, eta = ', efinfo.EtaPreviousLevel() - - trkcont = efinfo.TrackContainer() - for infotrk in trkcont: - print 'Working on next TrigMuonEF track' - - if infotrk.hasCombinedTrack(): - print 'found combined track' - combtrk = infotrk.CombinedTrack() - print 'comb pt = ', combtrk.pt() - print 'extrap pt = ', infotrk.ExtrapolatedTrack().pt() - if combtrk.getIDTrackParticle()!=0: - print "attached id trk pt = ", combtrk.getIDTrackParticle().pt() diff --git a/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/TrigT2CaloCommonConfig.py b/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/TrigT2CaloCommonConfig.py index 4bb40212b66024fb12df3b07f873c8b93f4c6458..d7362e1066dc07e74a6a70e271017a61a40d1994 100644 --- a/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/TrigT2CaloCommonConfig.py +++ b/Trigger/TrigAlgorithms/TrigT2CaloCommon/python/TrigT2CaloCommonConfig.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 TrigT2CaloCommon.TrigT2CaloCommonConf import TrigDataAccess as _TrigDataAccess from TrigT2CaloCommon.TrigT2CaloCommonConf import TrigCaloDataAccessSvc as _TrigCaloDataAccessSvc @@ -48,8 +48,8 @@ class TrigCaloDataAccessSvc(_TrigCaloDataAccessSvc): log.warning("Not possible to run BCID offset correction with COMP200") else: if TriggerFlags.doCaloOffsetCorrection(): - log.info('Enable HLT calo offset correction') if globalflags.DataSource()=='data' and athenaCommonFlags.isOnline(): + log.info('Enable HLT calo offset correction for data') from IOVDbSvc.CondDB import conddb conddb.addFolder("LAR_ONL","/LAR/ElecCalibFlat/OFC") from LArRecUtils.LArRecUtilsConf import LArFlatConditionSvc @@ -68,16 +68,22 @@ class TrigCaloDataAccessSvc(_TrigCaloDataAccessSvc): LuminosityCondAlgOnlineDefault() from CaloRec.CaloBCIDAvgAlgDefault import CaloBCIDAvgAlgDefault CaloBCIDAvgAlgDefault() - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - if not hasattr(topSequence,"CaloBCIDAvgAlg"): - log.info('Cannot use timer for CaloBCIDAvgAlg') - else: - from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool - monTool = GenericMonitoringTool('MonTool') - monTool.defineHistogram('TIME_exec', path='EXPERT', type='TH1F', title="CaloBCIDAvgAlg execution time; time [ us ] ; Nruns", xbins=80, xmin=0.0, xmax=4000) - topSequence.CaloBCIDAvgAlg.MonTool = monTool - log.info('using timer for CaloBCIDAvgAlg') + else: + log.info('Enable HLT calo offset correction for MC') + from CaloRec.CaloBCIDAvgAlgDefault import CaloBCIDAvgAlgDefault + CaloBCIDAvgAlgDefault() + + from AthenaCommon.AlgSequence import AlgSequence + topSequence = AlgSequence() + if not hasattr(topSequence,"CaloBCIDAvgAlg"): + log.info('Cannot use timer for CaloBCIDAvgAlg') + else: + from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool + monTool = GenericMonitoringTool('MonTool') + monTool.defineHistogram('TIME_exec', path='EXPERT', type='TH1F', title="CaloBCIDAvgAlg execution time; time [ us ] ; Nruns", xbins=80, xmin=0.0, xmax=4000) + topSequence.CaloBCIDAvgAlg.MonTool = monTool + log.info('using timer for CaloBCIDAvgAlg') + else: log.info('Disable HLT calo offset correction') diff --git a/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMergedMT.cxx b/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMergedMT.cxx index 09a76540aa36fa5a334f21f97c290d30cedf0d35..6f55f80e44dafb32541a3d2fe0cd4e750f4b783c 100644 --- a/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMergedMT.cxx +++ b/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMergedMT.cxx @@ -473,17 +473,6 @@ StatusCode TrigTauRecMergedMT::execute(const EventContext& ctx) const ++Ncand; } - - // call eventFinalize on the booked tau tools - for (const auto& tool : m_tools) { - processStatus = tool->eventFinalize(); - if( processStatus != StatusCode :: SUCCESS ) { - ATH_MSG_DEBUG("tool "<< tool->name()<< "failed in eventFinalize"); - return StatusCode::FAILURE; - } - } - ATH_MSG_DEBUG("Tools succeed in eventFinalize"); - //------------------------------------------------------------------------- // all done, register the tau Container in TDS. //------------------------------------------------------------------------- diff --git a/Trigger/TrigAlgorithms/TrigmuIso/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigmuIso/CMakeLists.txt index 9425c1dce18b9f8cd7b1a7b0fd0b8d8c863db838..952af68be44dbdbc789d53eb556633ad69f96f61 100644 --- a/Trigger/TrigAlgorithms/TrigmuIso/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigmuIso/CMakeLists.txt @@ -11,4 +11,3 @@ atlas_add_component( TrigmuIso # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) -atlas_install_joboptions( share/*.py ) diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingToolMT.cxx b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingToolMT.cxx index dda8ae6c3cb2a70e7ff46f25e2ad3a49df083ec0..f299f0a21a37c3fcb60bfe9a942eb36149d2df6d 100644 --- a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingToolMT.cxx +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingToolMT.cxx @@ -11,7 +11,6 @@ #include <typeinfo> #include <string> - using namespace TrigCompositeUtils; using namespace Trig; @@ -65,6 +64,7 @@ std::string TrigEgammaMatchingToolMT::key( std::string key) const bool TrigEgammaMatchingToolMT::match(const xAOD::Egamma *eg,const std::string &trigger, const TrigCompositeUtils::Decision *&dec ) const { + ATH_MSG_DEBUG("Match decec with trigger " << trigger); if(xAOD::EgammaHelpers::isElectron(eg)){ const xAOD::Electron* el =static_cast<const xAOD::Electron*> (eg); @@ -87,6 +87,8 @@ bool TrigEgammaMatchingToolMT::match(const xAOD::Egamma *eg,const std::string &t const xAOD::Photon* ph =static_cast<const xAOD::Photon*> (eg); if( matchL2Photon(ph,trigger,dec) ) return true; } + + if( matchL2Calo(eg,trigger,dec) ) return true; if( matchL1(eg,trigger,dec) ) return true; ATH_MSG_DEBUG("match() failed!"); @@ -160,6 +162,7 @@ bool TrigEgammaMatchingToolMT::matchL1( const xAOD::Egamma* eg, const std::strin double deltaR=0.; auto initRois = tdt()->features<TrigRoiDescriptorCollection>(trigger,TrigDefs::includeFailedDecisions,"", TrigDefs::allFeaturesOfType,"initialRoI"); + if( initRois.size() < 1) return false; for( auto &initRoi: initRois ){ if( !initRoi.link.isValid() ) continue; diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.h b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.h index 6b7e759c1b3b152975463d54760ee3f2d55bddc2..0d08ee8f4346b78755e2c50b76041bd37253b31e 100644 --- a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.h +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.h @@ -51,7 +51,9 @@ class TrigEgammaMatchingToolMT : public asg::AsgTool const xAOD::EmTauRoI* getL1Feature( const TrigCompositeUtils::Decision * ) const; - + + + private: bool matchHLTElectron(const xAOD::Electron *,const std::string &, const TrigCompositeUtils::Decision *&) const; diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.icc b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.icc index 4671ed79eb418c5c4850ca81b69070f4cbc04d08..511c457b6413af800161b9f1a64e1b59f8b48671 100644 --- a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.icc +++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/TrigEgammaMatchingTool/TrigEgammaMatchingToolMT.icc @@ -60,6 +60,8 @@ inline bool TrigEgammaMatchingToolMT::closestObject( const xAOD::Egamma *eg, con { double deltaR=0.; auto vec = tdt()->features<T>(trigger,TrigDefs::includeFailedDecisions ,key); + + for( auto &featLinkInfo : vec ){ if(! featLinkInfo.isValid() ) continue; const auto *feat = *(featLinkInfo.link); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h b/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h index 472fd14474ea8e11640bb38ec039149460f44192..59465c530ffd3cf0573faf1c2103218c2dd9f755 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h @@ -89,6 +89,7 @@ public: bool hasTruth() const { return m_hasTruth; } + void rotate(); public: diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysis/src/Track.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysis/src/Track.cxx index ae262c0a5758b097f9caae8ae1296d97ef7c7911..34e0d2ebc8850fd08006940840933f7c6077b25d 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysis/src/Track.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysis/src/Track.cxx @@ -9,6 +9,7 @@ #include "TrigInDetAnalysis/Track.h" +#include <cmath> ClassImp(TIDA::Track) @@ -59,3 +60,10 @@ TIDA::Track::Track(double eta, double phi, double z0, double a0, double pT, TIDA::Track::~Track() { } + +void TIDA::Track::rotate() { + m_pT *= -1; + m_a0 *= -1; + m_phi -= M_PI; + m_eta *= -1; + } diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h index 53ae3c41e9fb1aa87c991efaa048ffee0425d115..e8134cf46b3f407e9d4c0b7b9bfd6ee122f6adc5 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/AnalysisConfigMT_Ntuple.h @@ -37,7 +37,8 @@ public: 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_ ) + AnalysisConfig_Ntuple( roiInfo, chainNames, outputFileName, tauEtCutOffline, TruthPdgId, keepAllEvents_ ), + m_fiducial_radius(47) { } virtual ~AnalysisConfigMT_Ntuple() { } @@ -46,6 +47,10 @@ protected: virtual void loop(); +private: + + double m_fiducial_radius; + }; diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx index ee7150200eba1e8eb1b99e69a441b4e8473ac6f0..149b90f237e2ad3de5dd5aaeb21250a1a97e5707 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/src/AnalysisConfigMT_Ntuple.cxx @@ -141,6 +141,10 @@ void AnalysisConfigMT_Ntuple::loop() { chainNames.push_back( ChainString(selectChains[iselected]) ); m_provider->msg(MSG::INFO) << "[91;1m" << "Matching chain " << selectChains[iselected] << "[m" << endmsg; + + /// if this has a cosmic chain, set the fiducial radius to be very large to + /// allow the production vertex of the cosmic to be included + if ( selectChains[iselected].find("cosmic")!=std::string::npos ) m_fiducial_radius = 1e10; } @@ -148,8 +152,8 @@ void AnalysisConfigMT_Ntuple::loop() { } m_chainNames = chainNames; - } + } Filter_AcceptAll filter; /// FIXME: should really have hardcoded limits encoded as @@ -163,7 +167,7 @@ void AnalysisConfigMT_Ntuple::loop() { //tau filtering done separately to include mothers if ( m_TruthPdgId!=0 && m_TruthPdgId!=15 ) truthFilter = &filter_pdgIdpTeta; - TrigTrackSelector selectorTruth( truthFilter ); + TrigTrackSelector selectorTruth( truthFilter, m_fiducial_radius ); TrigTrackSelector selectorRef( &filter_etaPT ); TrigTrackSelector selectorTest( &filter ); @@ -306,11 +310,9 @@ void AnalysisConfigMT_Ntuple::loop() { 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")) { @@ -333,6 +335,11 @@ void AnalysisConfigMT_Ntuple::loop() { selectTracks<xAOD::TruthParticleContainer>( &selectorTruth, "TruthParticles" ); foundTruth = true; } + else if (m_provider->evtStore()->contains<xAOD::TruthParticleContainer>("")) { + /// anything else? + selectTracks<xAOD::TruthParticleContainer>( &selectorTruth, "" ); + foundTruth = true; + } else { m_provider->msg(MSG::WARNING) << "Truth not found - none whatsoever!" << endmsg; } @@ -616,7 +623,8 @@ void AnalysisConfigMT_Ntuple::loop() { for ( unsigned ichain=0 ; ichain<m_chainNames.size() ; ichain++ ) { - m_provider->msg(MSG::INFO)<< "chain:\t" << m_chainNames[ichain] << endmsg; + /// keep this printout here, but commented for usefull debug purposes ... + // m_provider->msg(MSG::INFO)<< "chain:\t" << m_chainNames[ichain] << endmsg; /// get the chain, collection and TE names and track index @@ -879,11 +887,11 @@ void AnalysisConfigMT_Ntuple::loop() { 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; + m_provider->msg(MSG::DEBUG) << "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 diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/BinConfig.h b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/BinConfig.h index 71e993ed78fd0b6d3c1b605b88dc006604829131..894b167f190b529c0ed31b7d1dacaadefe55495d 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/BinConfig.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/BinConfig.h @@ -38,7 +38,10 @@ public: phires_NScale(1), d0res_NScale(1), a0res_NScale(1), - z0res_NScale(1) + z0res_NScale(1), + d0Max(30), + a0Max(15), + z0Max(300) { } virtual ~BinConfig() { } @@ -51,6 +54,9 @@ public: r.Set( n+"d0NScale", d0_NScale ); r.Set( n+"a0NScale", a0_NScale ); r.Set( n+"z0NScale", z0_NScale ); + r.Set( n+"d0Max", d0Max ); + r.Set( n+"a0Max", a0Max ); + r.Set( n+"z0Max", z0Max ); } void set( ReadCards& r ) { @@ -75,23 +81,30 @@ public: double a0res_NScale; double z0res_NScale; + double d0Max; + double a0Max; + double z0Max; + }; -inline std::ostream& operator<<( std::ostream& s, const BinConfig& _b ) { - return s << "\n\t[ config: " << _b._name << " Nbins scale factors : " - << "\t pt: " << _b.pt_NScale - << " eta: " << _b.eta_NScale - << " phi: " << _b.phi_NScale - << " d0: " << _b.d0_NScale - << " a0: " << _b.a0_NScale - << " z0: " << _b.z0_NScale +inline std::ostream& operator<<( std::ostream& s, const BinConfig& b ) { + return s << "\n\t[ config: " << b._name << " Nbins scale factors : " + << "\t pt: " << b.pt_NScale + << " eta: " << b.eta_NScale + << " phi: " << b.phi_NScale + << " d0: " << b.d0_NScale + << " a0: " << b.a0_NScale + << " z0: " << b.z0_NScale << "\n\t residuals bins:\n" - << "\t pt: " << _b.ptres_NScale - << " eta: " << _b.etares_NScale - << " phi: " << _b.phires_NScale - << " d0: " << _b.d0res_NScale - << " a0: " << _b.a0res_NScale - << " z0: " << _b.z0res_NScale + << "\t pt: " << b.ptres_NScale + << " eta: " << b.etares_NScale + << " phi: " << b.phires_NScale + << " d0: " << b.d0res_NScale + << " a0: " << b.a0res_NScale + << " z0: " << b.z0res_NScale + << "\n\t ranges:\n" + << " d0: " << b.d0Max + << " a0: " << b.a0Max << " ]"; } diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfAnalysis.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfAnalysis.cxx index bc6f9459e8377386fcb329b5a736e77ec4e3b04d..ed8eb1fd28b0600bbca5cb49727dd800955f1c16 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfAnalysis.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/ConfAnalysis.cxx @@ -45,7 +45,7 @@ void Normalise(TH1* h) { -BinConfig binConfig("standard"); +BinConfig g_binConfig("standard"); BinConfig electronBinConfig("electron"); BinConfig muonBinConfig("muon"); @@ -70,13 +70,13 @@ void ConfAnalysis::initialiseInternal() { // std::cout << "ConfAnalysis::initialise() " << name() << std::endl; - BinConfig& _binConfig = binConfig; + BinConfig& binConfig = g_binConfig; - if ( name().find("_e")!=std::string::npos ) _binConfig = electronBinConfig; - else if ( name().find("_mu")!=std::string::npos ) _binConfig = muonBinConfig; - else if ( name().find("_tau")!=std::string::npos ) _binConfig = tauBinConfig; - else if ( name().find("_b")!=std::string::npos ) _binConfig = bjetBinConfig; - else if ( name().find("cosmic")!=std::string::npos ) _binConfig = cosmicBinConfig; + if ( name().find("_e")!=std::string::npos ) binConfig = electronBinConfig; + else if ( name().find("_mu")!=std::string::npos ) binConfig = muonBinConfig; + else if ( name().find("_tau")!=std::string::npos ) binConfig = tauBinConfig; + else if ( name().find("_b")!=std::string::npos ) binConfig = bjetBinConfig; + else if ( name().find("cosmic")!=std::string::npos ) binConfig = cosmicBinConfig; //+++ pT ranges @@ -85,7 +85,7 @@ void ConfAnalysis::initialiseInternal() { //double tmp_maxPt = 50.; double tmp_absResPt = 0.5; - const int pTResBins = int(100*_binConfig.ptres_NScale); + const int pTResBins = int(100*binConfig.ptres_NScale); //+++ Eta ranges double tmp_maxEta = 3.; @@ -96,32 +96,30 @@ void ConfAnalysis::initialiseInternal() { double tmp_absResPhi = 0.02; // 0.0001; - // std::cout << "ConfAnalysis::initialise() " << name() << " config: " << _binConfig << std::endl; + // std::cout << "ConfAnalysis::initialise() " << name() << " config: " << binConfig << std::endl; - int etaBins = int(30*_binConfig.eta_NScale); - const int etaResBins = int(600*_binConfig.eta_NScale); + int etaBins = int(30*binConfig.eta_NScale); + const int etaResBins = int(600*binConfig.eta_NScale); - const int phiBins = int(30*_binConfig.phi_NScale); - const int phiResBins = int(100*_binConfig.phires_NScale); + const int phiBins = int(30*binConfig.phi_NScale); + const int phiResBins = int(100*binConfig.phires_NScale); - const int zBins = int(100*_binConfig.z0_NScale); - const double zMax = 200; - - + const int zBins = int(150*binConfig.z0_NScale); + const double zMax = binConfig.z0Max; const int zresBins = 100; const double zresMax = 10; - const int d0Bins = int(100*_binConfig.d0_NScale); - const double d0Max = 30; + const int d0Bins = int(100*binConfig.d0_NScale); + const double d0Max = binConfig.d0Max; const int d0resBins = 100; const double d0resMax = 5; // beamspot corrected position - const int a0Bins = int(300*_binConfig.a0_NScale); - const double a0Max = 15; + const int a0Bins = int(300*binConfig.a0_NScale); + const double a0Max = binConfig.a0Max; const int a0resBins = 100; const double a0resMax = 5; @@ -134,9 +132,9 @@ void ConfAnalysis::initialiseInternal() { double pt_a = 1; double pt_b = 1; - // Npt = int(40*_binConfig.pt_NScale); + // Npt = int(40*binConfig.pt_NScale); // pt_a = 3.5; - Npt = int(45*_binConfig.pt_NScale); + Npt = int(45*binConfig.pt_NScale); pt_a = 4; pt_b = 2; // etaBins = 12; @@ -1194,7 +1192,7 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, for ( int i=reftracks.size() ; i-- ; ) { /// fill roi residuals - + if ( groi!=0 ) { // std::cout << "ConfAnalysis::Fill() groi " << *groi << std::endl; @@ -1294,8 +1292,8 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, // hchi2->Fill( chi2t ); double nsctt = reftracks[i]->sctHits(); - double npixt = reftracks[i]->pixelHits(); - double nsit = reftracks[i]->pixelHits() * 0.5 + reftracks[i]->sctHits(); + double npixt = reftracks[i]->pixelHits()*0.5; + double nsit = reftracks[i]->pixelHits()*0.5 + reftracks[i]->sctHits(); double nsctht = reftracks[i]->sctHoles(); double npixht = reftracks[i]->pixelHoles(); @@ -1340,21 +1338,21 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, } - rnpix_eta->Fill( etat, npixt*0.5 ); + rnpix_eta->Fill( etat, npixt*1.0 ); rnsct_eta->Fill( etat, nsctt*1.0 ); rntrt_eta->Fill( etat, nstrawt*1.0 ); - rnsihit_eta->Fill( etat, npixt*0.5 + nsctt*1.); + rnsihit_eta->Fill( etat, npixt + nsctt*1.); - rnpix_phi->Fill( phit, npixt*0.5 ); + rnpix_phi->Fill( phit, npixt*1.0 ); rnsct_phi->Fill( phit, nsctt*1.0 ); rntrt_phi->Fill( phit, nstrawt*1.0 ); - rnpix_pt->Fill( std::fabs(pTt), npixt*0.5 ); + rnpix_pt->Fill( std::fabs(pTt), npixt*1.0 ); rnsct_pt->Fill( std::fabs(pTt), nsctt*1.0 ); rntrt_pt->Fill( std::fabs(pTt), nstrawt*1.0 ); - rnpix_d0->Fill( a0t, npixt*0.5 ); + rnpix_d0->Fill( a0t, npixt*1.0 ); rnsct_d0->Fill( a0t, nsctt*1.0 ); rntrt_d0->Fill( a0t, nstrawt*1.0 ); @@ -1377,7 +1375,7 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, rnpixh_pt->Fill( std::fabs(pTt), npixht ); rnscth_pt->Fill( std::fabs(pTt), nsctht ); - rnpix_lb->Fill( gevent->lumi_block(), npixt*0.5 ); + rnpix_lb->Fill( gevent->lumi_block(), npixt*1.0 ); double etovpt_val = 0; const TrackTrigObject* tobj = 0; @@ -1397,6 +1395,8 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, if ( matchedreco ) { + Nmatched++; + // efficiency histos eff_pt->Fill(std::fabs(pTt)); eff_z0->Fill(z0t); @@ -1425,8 +1425,6 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, m_eff_vs_et->Fill( std::fabs(tobj->pt()*0.001) ); } - Nmatched++; - /// fill residual histos /// kinematics @@ -1480,8 +1478,8 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, // m_lfirst = false; double nsctr = matchedreco->sctHits(); - double npixr = matchedreco->pixelHits(); - double nsir = matchedreco->pixelHits() * 0.5 + matchedreco->sctHits(); + double npixr = matchedreco->pixelHits()*0.5; + double nsir = matchedreco->pixelHits()*0.5 + matchedreco->sctHits(); double nscthr = matchedreco->sctHoles(); double npixhr = matchedreco->pixelHoles(); @@ -1613,16 +1611,16 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, //----- - rnpix_eta_rec->Fill( etat, npixr*0.5 ); + rnpix_eta_rec->Fill( etat, npixr*1.0 ); rnsct_eta_rec->Fill( etat, nsctr*1.0 ); rntrt_eta_rec->Fill( etat, nstrawr*1.0 ); rnsihit_eta_rec->Fill( etat, npixr*0.5 + nsctr*1.0); - rnpix_phi_rec->Fill( phit, npixr*0.5 ); + rnpix_phi_rec->Fill( phit, npixr*1.0 ); rnsct_phi_rec->Fill( phit, nsctr*1.0 ); rntrt_phi_rec->Fill( phit, nstrawr*1.0 ); - rnpix_pt_rec->Fill( std::fabs(pTt), npixr*0.5 ); + rnpix_pt_rec->Fill( std::fabs(pTt), npixr*1.0 ); rnsct_pt_rec->Fill( std::fabs(pTt), nsctr*1.0 ); rntrt_pt_rec->Fill( std::fabs(pTt), nstrawr*1.0 ); @@ -1872,6 +1870,8 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, } + // return; + // for fake/purity histograms, loop over the test tracks // and get the corresponding matched reference tracks from the @@ -1910,8 +1910,8 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, // std::cout << "d0 " << d0r << "\tphi " << phir << "\tx " << m_xBeamTest << "\ty " << m_yBeamTest << std::endl; double nsctr = testtracks[i]->sctHits(); - double npixr = testtracks[i]->pixelHits(); - double nsir = testtracks[i]->pixelHits() * 0.5 + testtracks[i]->sctHits(); + double npixr = testtracks[i]->pixelHits()*0.5; + double nsir = testtracks[i]->pixelHits()*0.5 + testtracks[i]->sctHits(); double ntrtr = testtracks[i]->trHits(); double nstrawr = testtracks[i]->strawHits(); @@ -1938,7 +1938,7 @@ void ConfAnalysis::execute(const std::vector<TIDA::Track*>& reftracks, // z_vs_lb->Fill( rmap[r]+lb, z0r ); z_vs_lb->Fill( ts, z0r ); - // hnpix_v_sct_rec->Fill( nsctr*0.5, npixr*0.5 ); + // hnpix_v_sct_rec->Fill( nsctr*0.5, npixr*1.0 ); if ( h2r ) h2r->Fill( phir, d0r ); if ( h2a0r ) h2a0r->Fill( phir, a0r ); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx index 5961fd9bac31bc1a1e6de07c378c7998848c131f..221d5f3bff1a586558882246bc8149234886d581 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/comparitor.cxx @@ -286,7 +286,8 @@ int usage(const std::string& name, int status, const std::string& err_msg="" ) { s << " -np, --noplots \t do not actually make any plot\n"; s << " -q, --quiet \t make the plots but do not print them out\n\n"; - s << " --unscalepix \t do not scale the number of pixels by 0.5 (scaled by default)\n"; + s << " --unscalepix \t do not scale the number of pixels by 0.5 (unscaled by default)\n"; + s << " --scalepix \t do scale the number of pixels by 0.5 (unscaled by default)\n"; s << " --yrange min max \t use specified y axis range\n"; s << " -xo, --xoffset value \t relative x offset for the key\n"; s << " -yp, --ypos value \t relative yposition for the key\n"; @@ -426,7 +427,7 @@ int main(int argc, char** argv) { bool notitle = true; bool dochi2 = false; bool normref = false; - bool scalepix = true; + bool scalepix = false; bool oldrms = false; bool addchains = false; bool usechainref = false; @@ -524,6 +525,9 @@ int main(int argc, char** argv) { else if ( arg=="--unscalepix" ) { scalepix = false; } + else if ( arg=="--scalepix" ) { + scalepix = true; + } else if ( arg=="-ac" || arg=="--addchains" ) { addchains = true; } diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/rmain.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/rmain.cxx index c99318a83c67324a5a8896e452f72133db3d64da..a2fb73f028aa0c07f21d4d3faf0b3a61eafbe865 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/rmain.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUser/Analysis/src/rmain.cxx @@ -79,7 +79,7 @@ extern bool PRINT_BRESIDUALS; // in BinConfig.cxx -extern BinConfig binConfig; +extern BinConfig g_binConfig; extern BinConfig electronBinConfig; extern BinConfig muonBinConfig; @@ -554,6 +554,11 @@ int main(int argc, char** argv) //bool printflag = false; // JK removed (unused) + + bool rotate_testtracks = false; + + if ( inputdata.isTagDefined("RotateTestTracks") ) rotate_testtracks = ( inputdata.GetValue("RotateTestTracks") ? true : false ); + bool truthMatch = false; if ( inputdata.isTagDefined("TruthMatch") ) truthMatch = ( inputdata.GetValue("TruthMatch") ? true : false ); @@ -897,7 +902,7 @@ int main(int argc, char** argv) if ( binningConfigFile!="" ) binningConfig = new ReadCards( binningConfigFile ); /// set the tags in front of the histogram stuff - binConfig.set( *binningConfig, "" ); + g_binConfig.set( *binningConfig, "" ); electronBinConfig.set( *binningConfig, "e_" ); muonBinConfig.set( *binningConfig, "mu_" ); tauBinConfig.set( *binningConfig, "tau_" ); @@ -2096,8 +2101,9 @@ int main(int argc, char** argv) } else vertices_roi = vertices; - - + + if ( rotate_testtracks ) for ( size_t i=testp.size() ; i-- ; ) testp[i]->rotate(); + foutdir->cd(); // do analysing diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx index e514a67bccb84fdbf58b2be13556f4b9e36bff51..21df911dfef92427c35d3d8c62bbdfd6c77795b1 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisUtils/src/TrigTrackSelector.cxx @@ -395,12 +395,13 @@ bool TrigTrackSelector::selectTrack( const xAOD::TruthParticle* track ) { /// 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; @@ -462,6 +463,7 @@ bool TrigTrackSelector::selectTrack( const xAOD::TruthParticle* track ) { delete t; return false; } + return true; } diff --git a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/CMakeLists.txt b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/CMakeLists.txt index 2a07dcb59fe1162aa0aef32cd3f545eaf704957c..503fcc40d3ef216581b31344c935977907ebd5b0 100644 --- a/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/CMakeLists.txt +++ b/Trigger/TrigAnalysis/TrigMuonCoinHierarchy/CMakeLists.txt @@ -43,6 +43,5 @@ atlas_add_component( TrigMuonCoinHierarchy LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel MuonRDO MuonPrepRawData MuonTrigCoinData AnalysisTriggerEvent EventInfo TGCcablingInterfaceLib MuonReadoutGeometry MuonIdHelpersLib muonEvent PathResolver TrkCompetingRIOsOnTrack TrkEventUtils TrkRIO_OnTrack TrkTrack TrigT1Result TrigMuonCoinHierarchyLib ) # Install files from the package: -atlas_install_joboptions( share/*.py ) atlas_install_runtime( share/mask2/*.txt ) diff --git a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1Connector.h b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1Connector.h index 86afb80cfa44811675385cf3eaaa518051cf28f3..557b3cbbbabbbb18a5d92b7147dc19d27a103f0d 100644 --- a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1Connector.h +++ b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1Connector.h @@ -81,6 +81,8 @@ namespace TrigConf { const TrigConf::TriggerLine & triggerLine( const std::string & lineName ) const; + bool isLegacy() const { return m_isLegacy; } + private: /** Update the internal members */ @@ -89,7 +91,8 @@ namespace TrigConf { ConnectorType m_type; std::vector<TrigConf::TriggerLine> m_triggerLines[2][2]; std::map<std::string, TrigConf::TriggerLine*> m_lineByName; - + + bool m_isLegacy; }; } diff --git a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThrExtraInfo.h b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThrExtraInfo.h index 56e04f47359a5304d9de95cbc301ea9d6c08e9bf..11991abdcda6607993ec3d95b595135eb166603c 100644 --- a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThrExtraInfo.h +++ b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThrExtraInfo.h @@ -17,6 +17,7 @@ namespace TrigConf { class L1ThrExtraInfoBase; class L1ThrExtraInfo_EMTAULegacy; class L1ThrExtraInfo_JETLegacy; + class L1ThrExtraInfo_XSLegacy; class L1ThrExtraInfo_eEMTAU; class L1ThrExtraInfo_jJ; class L1ThrExtraInfo_jTAU; @@ -32,6 +33,7 @@ namespace TrigConf { const L1ThrExtraInfo_EMTAULegacy & EM() const; const L1ThrExtraInfo_EMTAULegacy & TAU() const; const L1ThrExtraInfo_JETLegacy & JET() const; + const L1ThrExtraInfo_XSLegacy & XS() const; const L1ThrExtraInfo_eEMTAU & eEM() const; const L1ThrExtraInfo_eEMTAU & eTAU() const; const L1ThrExtraInfo_jJ & jJ() const; @@ -44,7 +46,7 @@ namespace TrigConf { bool hasInfo(const std::string & typeName) const; private: - // map from threshold type to + // map from threshold type to L1ThrExtraInfo object std::map<std::string, std::shared_ptr<TrigConf::L1ThrExtraInfoBase>> m_thrExtraInfo{}; std::shared_ptr<TrigConf::L1ThrExtraInfoBase> m_emptyInfo{ nullptr }; }; @@ -53,97 +55,144 @@ namespace TrigConf { class L1ThrExtraInfo_EMTAULegacy final : public L1ThrExtraInfoBase { public: - L1ThrExtraInfo_EMTAULegacy(const std::string & thrTypeName, const ptree & data); - virtual ~L1ThrExtraInfo_EMTAULegacy(); - virtual std::string className() const; - unsigned int emScale() const; - unsigned int ptMinToTopo() const; + L1ThrExtraInfo_EMTAULegacy(const std::string & thrTypeName, const ptree & data) : + L1ThrExtraInfoBase(thrTypeName, data) { load(); } + virtual ~L1ThrExtraInfo_EMTAULegacy() = default; + virtual std::string className() const { return "L1ThrExtraInfo_EMTAULegacy"; } + unsigned int emScale() const { return 1000 / resolutionMeV(); } + float ptMinToTopo() const { return m_ptMinToTopoMeV/1000.0f; } + unsigned int ptMinToTopoMeV() const { return m_ptMinToTopoMeV; } + unsigned int ptMinToTopoCounts() const { return energyInCounts( m_ptMinToTopoMeV, resolutionMeV() ); } const IsolationLegacy & isolation(const std::string & thrType, size_t bit) const; private: /** Update the internal members */ - virtual void update(); + void load(); /** EM specific data */ - unsigned int m_emScale{1}; - unsigned int m_ptMinToTopo{0}; + unsigned int m_ptMinToTopoMeV{0}; // in MeV std::map<std::string,std::vector<IsolationLegacy>> m_isolation{}; }; + class L1ThrExtraInfo_JETLegacy final : public L1ThrExtraInfoBase { public: - L1ThrExtraInfo_JETLegacy(const std::string & thrTypeName, const ptree & data); - virtual ~L1ThrExtraInfo_JETLegacy(); - unsigned int jetScale() const; - unsigned int ptMinToTopoLargeWindow() const; - unsigned int ptMinToTopoSmallWindow() const; + L1ThrExtraInfo_JETLegacy(const std::string & thrTypeName, const ptree & data) : + L1ThrExtraInfoBase(thrTypeName, data) { load(); } + virtual ~L1ThrExtraInfo_JETLegacy() = default; + unsigned int jetScale() const { return 1000 / resolutionMeV(); } + float ptMinToTopoLargeWindow() const { return m_ptMinToTopoLargeWindowMeV / 1000.0f; } + float ptMinToTopoSmallWindow() const { return m_ptMinToTopoSmallWindowMeV / 1000.0f; } + unsigned int ptMinToTopoLargeWindowMeV() const { return m_ptMinToTopoLargeWindowMeV; } + unsigned int ptMinToTopoSmallWindowMeV() const { return m_ptMinToTopoSmallWindowMeV; } + unsigned int ptMinToTopoLargeWindowCounts() const { return energyInCounts( m_ptMinToTopoLargeWindowMeV, resolutionMeV() ); } + unsigned int ptMinToTopoSmallWindowCounts() const { return energyInCounts( m_ptMinToTopoSmallWindowMeV, resolutionMeV() ); } private: /** Update the internal members */ - virtual void update(); + void load(); /** JET specific data */ - unsigned int m_jetScale{1}; - unsigned int m_ptMinToTopoLargeWindow{0}; - unsigned int m_ptMinToTopoSmallWindow{0}; + unsigned int m_ptMinToTopoLargeWindowMeV{0}; + unsigned int m_ptMinToTopoSmallWindowMeV{0}; + }; + + + class L1ThrExtraInfo_XSLegacy final : public L1ThrExtraInfoBase { + public: + L1ThrExtraInfo_XSLegacy(const std::string & thrTypeName, const ptree & data) : + L1ThrExtraInfoBase(thrTypeName, data) { load(); } + virtual ~L1ThrExtraInfo_XSLegacy() = default; + unsigned int xeMin() const { return m_xeMin; }; + unsigned int xeMax() const { return m_xeMax; }; + unsigned int teSqrtMin() const { return m_teSqrtMin; }; + unsigned int teSqrtMax() const { return m_teSqrtMax; }; + unsigned int xsSigmaScale() const { return m_xsSigmaScale; }; + unsigned int xsSigmaOffset() const { return m_xsSigmaOffset; }; + private: + /** Update the internal members */ + void load(); + /** XS specific data */ + unsigned int m_xeMin{0}; + unsigned int m_xeMax{0}; + unsigned int m_teSqrtMin{0}; + unsigned int m_teSqrtMax{0}; + unsigned int m_xsSigmaScale{0}; + unsigned int m_xsSigmaOffset{0}; }; /*********************************** * Extra info for new thresholds ***********************************/ - class L1ThrExtraInfo_eEMTAU final : public L1ThrExtraInfoBase { public: - L1ThrExtraInfo_eEMTAU(const std::string & thrTypeName, const ptree & data); - virtual ~L1ThrExtraInfo_eEMTAU(); - unsigned int ptMinToTopo() const; + L1ThrExtraInfo_eEMTAU(const std::string & thrTypeName, const ptree & data) : + L1ThrExtraInfoBase(thrTypeName, data) { load(); } + virtual ~L1ThrExtraInfo_eEMTAU() = default; + float ptMinToTopo() const { return m_ptMinToTopoMeV/1000.0f; } + unsigned int ptMinToTopoMeV() const { return m_ptMinToTopoMeV; } + unsigned int ptMinToTopoCounts() const { return energyInCounts( m_ptMinToTopoMeV, resolutionMeV() ); } const TrigConf::Isolation & isolation(TrigConf::Isolation::WP wp, int eta) const; const ValueWithEtaDependence<TrigConf::Isolation> & isolation(TrigConf::Isolation::WP wp) const; private: /** Update the internal members */ - virtual void update(); + void load(); /** eEM specific data */ - unsigned int m_ptMinToTopo{0}; + unsigned int m_ptMinToTopoMeV{0}; std::map<TrigConf::Isolation::WP, ValueWithEtaDependence<Isolation>> m_isolation{}; }; + class L1ThrExtraInfo_jJ final : public L1ThrExtraInfoBase { public: - L1ThrExtraInfo_jJ(const std::string & thrTypeName, const ptree & data); - virtual ~L1ThrExtraInfo_jJ(); - unsigned int ptMinToTopoSmall(int eta) const; - unsigned int ptMinToTopoLarge(int eta) const; + L1ThrExtraInfo_jJ(const std::string & thrTypeName, const ptree & data) : + L1ThrExtraInfoBase(thrTypeName, data) { load(); } + virtual ~L1ThrExtraInfo_jJ() = default; + float ptMinToTopoLarge(int eta = 0) const { return ptMinToTopoLargeMeV(eta) / 1000.0f; } + float ptMinToTopoSmall(int eta = 0) const { return ptMinToTopoSmallMeV(eta) / 1000.0f; } + unsigned int ptMinToTopoLargeMeV(int eta = 0) const { return m_ptMinToTopoLargeMeV.at(eta); } + unsigned int ptMinToTopoSmallMeV(int eta = 0) const { return m_ptMinToTopoSmallMeV.at(eta); } + unsigned int ptMinToTopoLargeCounts(int eta = 0) const { return energyInCounts( ptMinToTopoLargeMeV(eta), resolutionMeV() ); } + unsigned int ptMinToTopoSmallCounts(int eta = 0) const { return energyInCounts( ptMinToTopoSmallMeV(eta), resolutionMeV() ); } private: /** Update the internal members */ - virtual void update(); + void load(); /** jJ specific data */ - std::map<std::pair<int,int>,unsigned int> m_ptMinToTopoSmall{}; - std::map<std::pair<int,int>,unsigned int> m_ptMinToTopoLarge{}; + ValueWithEtaDependence<unsigned int> m_ptMinToTopoSmallMeV{"jJptMinTopoLarge"}; + ValueWithEtaDependence<unsigned int> m_ptMinToTopoLargeMeV{"jJptMinTopoSmall"}; + //std::map<std::pair<int,int>,unsigned int> m_ptMinToTopoSmallMeV{}; + //std::map<std::pair<int,int>,unsigned int> m_ptMinToTopoLargeMeV{}; }; + class L1ThrExtraInfo_jTAU final : public L1ThrExtraInfoBase { public: - L1ThrExtraInfo_jTAU(const std::string & thrTypeName, const ptree & data); - virtual ~L1ThrExtraInfo_jTAU(); - unsigned int ptMinToTopo() const; + L1ThrExtraInfo_jTAU(const std::string & thrTypeName, const ptree & data) : + L1ThrExtraInfoBase(thrTypeName, data) { load(); } + virtual ~L1ThrExtraInfo_jTAU() = default; + unsigned int ptMinToTopo() const { return m_ptMinToTopo; } private: /** Update the internal members */ - virtual void update(); + void load(); /** jTAU specific data */ unsigned int m_ptMinToTopo{0}; }; + class L1ThrExtraInfo_gXE final : public L1ThrExtraInfoBase { public: - L1ThrExtraInfo_gXE(const std::string & thrTypeName, const ptree & data); - virtual ~L1ThrExtraInfo_gXE(); + L1ThrExtraInfo_gXE(const std::string & thrTypeName, const ptree & data) : + L1ThrExtraInfoBase(thrTypeName, data) { load(); } + virtual ~L1ThrExtraInfo_gXE() = default; private: /** Update the internal members */ - virtual void update(); + void load(); /** gXE specific data */ }; + class L1ThrExtraInfo_MU final : public L1ThrExtraInfoBase { public: - L1ThrExtraInfo_MU(const std::string & thrTypeName, const ptree & data); - virtual ~L1ThrExtraInfo_MU(); + L1ThrExtraInfo_MU(const std::string & thrTypeName, const ptree & data) : + L1ThrExtraInfoBase(thrTypeName, data) { load(); } + virtual ~L1ThrExtraInfo_MU() = default; unsigned int rpcIdxForPt(unsigned int pt) const; unsigned int tgcIdxForPt(unsigned int pt) const; std::vector<unsigned int> knownRpcPtValues() const; @@ -152,7 +201,7 @@ namespace TrigConf { const std::map<std::string, std::vector<unsigned int>> & exlusionList(const std::string & listName) const; private: /** Update the internal members */ - virtual void update(); + void load(); /** MU specific data */ std::map<unsigned int, unsigned int> m_rpcPtMap; // map of pt value (1..~20) to road index (0..5) std::map<unsigned int, unsigned int> m_tgcPtMap; // map of pt value (1..~30) to road index (0..15) diff --git a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1Threshold.h b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1Threshold.h index 0fda494c8b1e43bccab6b95f6578621b2a9cfaae..77cb1167fce7946b51fef8fc54e69f1934645ea2 100644 --- a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1Threshold.h +++ b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1Threshold.h @@ -14,50 +14,127 @@ namespace TrigConf { * L1Calo legacy thresholds * ************************************/ - class L1Threshold_EM final : public L1Threshold { + class L1Threshold_EM final : public L1Threshold_Calo { public: - L1Threshold_EM( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data); + L1Threshold_EM( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : + L1Threshold_Calo(name, type, m_extraInfo, data) { load(); } virtual ~L1Threshold_EM() = default; - unsigned int thrValueCounts(int eta = 0) const override; uint16_t isolationMask(int eta) const { return m_isolationMask.at(eta); } void print(std::ostream & os = std::cout) const override; + protected: + virtual void update() override { + L1Threshold_Calo::update(); + load(); + } private: - virtual void update() override; + void load(); ValueWithEtaDependence<uint16_t> m_isolationMask{""}; }; - class L1Threshold_TAU final : public L1Threshold { + + class L1Threshold_TAU final : public L1Threshold_Calo { public: - L1Threshold_TAU( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data); + L1Threshold_TAU( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : + L1Threshold_Calo(name, type, m_extraInfo, data) { load(); } virtual ~L1Threshold_TAU() = default; + // access functions uint16_t isolationMask() const { return m_isolationMask; } + protected: + virtual void update() override { + L1Threshold_Calo::update(); + load(); + } private: - virtual void update() override; + void load(); uint16_t m_isolationMask; }; + class L1Threshold_XE final : public L1Threshold_Calo { + public: + L1Threshold_XE( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : + L1Threshold_Calo(name, type, m_extraInfo, data) {}; + virtual ~L1Threshold_XE() = default; + }; + + class L1Threshold_XS final : public L1Threshold_Calo { + public: + L1Threshold_XS( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : + L1Threshold_Calo(name, type, m_extraInfo, data) {}; + virtual ~L1Threshold_XS() = default; + }; + + class L1Threshold_TE final : public L1Threshold_Calo { + public: + L1Threshold_TE( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : + L1Threshold_Calo(name, type, m_extraInfo, data) {}; + virtual ~L1Threshold_TE() = default; + }; + + /************************************ + * + * NIM and internal thresholds + * + ************************************/ + + class L1Threshold_NIM final : public L1Threshold { + public: + L1Threshold_NIM( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : + L1Threshold(name, type, m_extraInfo, data) {}; + virtual ~L1Threshold_NIM() = default; + }; + + class L1Threshold_internal final : public L1Threshold { + public: + L1Threshold_internal( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : + L1Threshold(name, type, m_extraInfo, data) {}; + virtual ~L1Threshold_internal() = default; + }; + /************************************ * * New eFEX thresholds * ************************************/ - class L1Threshold_eEM final : public L1Threshold { + class L1Threshold_eEM final : public L1Threshold_Calo { public: - L1Threshold_eEM() = default; - L1Threshold_eEM( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data); + L1Threshold_eEM( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : + L1Threshold_Calo(name, type, m_extraInfo, data) { load(); } virtual ~L1Threshold_eEM() = default; + // access functions Isolation::WP reta() const { return m_reta; } Isolation::WP rhad() const { return m_rhad; } Isolation::WP wstot() const { return m_wstot; } + protected: + virtual void update() override { + L1Threshold_Calo::update(); + load(); + } private: - virtual void update() override; + void load(); // the isolation requirement Isolation::WP m_reta { Isolation::WP::NONE }; Isolation::WP m_rhad { Isolation::WP::NONE }; Isolation::WP m_wstot { Isolation::WP::NONE }; }; + class L1Threshold_eTAU final : public L1Threshold_Calo { + public: + L1Threshold_eTAU( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : + L1Threshold_Calo(name, type, m_extraInfo, data) { load(); } + virtual ~L1Threshold_eTAU() = default; + protected: + virtual void update() override { + L1Threshold_Calo::update(); + load(); + } + private: + void load(); + }; + + + + /************************************ @@ -67,9 +144,12 @@ namespace TrigConf { ************************************/ class L1Threshold_MU final : public L1Threshold { public: - L1Threshold_MU() = default; - L1Threshold_MU( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data); + L1Threshold_MU( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : + L1Threshold(name, type, m_extraInfo, data) { load(); } virtual ~L1Threshold_MU() = default; + + float thrValue(int eta = 0) const override; + unsigned int ptBarrel() const { return m_ptBarrel; } unsigned int ptEndcap() const { return m_ptEndcap; } unsigned int ptForward() const { return m_ptForward; } @@ -79,8 +159,14 @@ namespace TrigConf { const std::string & region() const { return m_region; } const std::string & tgcFlag() const { return m_tgcFlag; } const std::string & rpcExclROIList() const { return m_rpcExclROIList; } + protected: + virtual void update() override { + L1Threshold::update(); + load(); + } private: - virtual void update() override; + void load(); + unsigned int m_ptBarrel{0}; unsigned int m_ptEndcap{0}; unsigned int m_ptForward{0}; diff --git a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThresholdBase.h b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThresholdBase.h index 557958a356edb39fe662ec865525444ee7f003f0..4e75a8441630fad77c5046d8220dad7911052c0c 100644 --- a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThresholdBase.h +++ b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThresholdBase.h @@ -12,6 +12,15 @@ namespace TrigConf { + /** @brief helper funtion to translate energies into counts + * @param energyMeV [in] energy value in MeV + * @param energyResolutionMeV [in] energy resolution in MeV (energy that corresponds to one count + * @return energy counts + * + * The funtion throws a runtime error if the energy value is not a multiple of the resolution + */ + unsigned int energyInCounts(unsigned int energyMeV, unsigned int energyResolutionMeV); + /** class to implement a L1 threshold cut that varies with eta * * A vector of RangeValue objects describes this eta @@ -23,12 +32,20 @@ namespace TrigConf { */ template<class T> class ValueWithEtaDependence { - struct RangeValue { - T value {}; // the value (energy, set of isolation variables) - int etaMin { -49 }; // range boundaries, always inclusive - int etaMax { 49 }; // etaMin is always smaller than etaMax, e.g. on the negative side: etaMin=-49, etaMax=-31 - unsigned int priority {0}; // higher number has higher priority when resolving overlapping regions - bool symmetric { true }; // if true, also applies to the opposity side ( requires etaMax to be positive ) + class RangeValue { + public: + RangeValue(const T & value, int etaMin, int etaMax, unsigned int priority, bool symmetric); + const T & value() const { return m_value; } + int etaMin() const { return m_etaMin; }; + int etaMax() const { return m_etaMax; }; + unsigned int priority() const { return m_priority; } + bool symmetric() const { return m_symmetric; } + private: + T m_value {}; // the value (energy, set of isolation variables) + int m_etaMin { -49 }; // range boundaries, always inclusive + int m_etaMax { 49 }; // etaMin is always smaller than etaMax, e.g. on the negative side: etaMin=-49, etaMax=-31 + unsigned int m_priority {0}; // higher number has higher priority when resolving overlapping regions + bool m_symmetric { true }; // if true, also applies to the opposity side ( requires etaMax to be positive ) }; public: typedef typename std::vector<RangeValue>::const_iterator const_iterator; @@ -53,34 +70,42 @@ namespace TrigConf { static std::unique_ptr<L1ThrExtraInfoBase> createExtraInfo(const std::string & thrTypeName, const ptree & data); - /** Constructors */ + // Constructors L1ThrExtraInfoBase() = delete; L1ThrExtraInfoBase(const L1ThrExtraInfoBase &) = delete; L1ThrExtraInfoBase& operator=(const L1ThrExtraInfoBase&) = delete; L1ThrExtraInfoBase(L1ThrExtraInfoBase&&) = default; L1ThrExtraInfoBase& operator=(L1ThrExtraInfoBase&&) = default; + virtual ~L1ThrExtraInfoBase() = default; - /** Constructor initialized with configuration data - * @param data The data containing the L1 menu - */ + // Constructor initialized with configuration data + // @param data The data containing the L1 menu + // L1ThrExtraInfoBase(const std::string & thrTypeName, const ptree & data); - /** Destructor */ - virtual ~L1ThrExtraInfoBase(); - - virtual std::string className() const; + virtual std::string className() const override { + return "L1ThrExtraInfoBase"; + } const std::string & thresholdTypeName() const; bool hasExtraInfo() const; - protected: + unsigned int resolutionMeV() const { + return m_resolutionMeV; + } + protected: + virtual void upload() { + load(); + } std::map<std::string, DataStructure> m_extraInfo{}; private: - /** Update the internal members */ - virtual void update(); + // load the internal members + void load(); + + unsigned int m_resolutionMeV; }; @@ -93,6 +118,13 @@ namespace TrigConf { class L1Threshold : public DataStructure { public: + /** @brief static method to create type-specific L1Thresholds + * @param name [in] name of the threshold + * @param type [in] type of the threshold (e.g. EM, TAU, JET, XE, TE, eEM, jJ, gXE, ...) + * @param extraInfo [in] link to the extra info for the given type + * @param data [in] the threshold definition (json wrapped into a ptree) + * @return shared ptr of the created threshold (returns ownership) + */ static std::shared_ptr<L1Threshold> createThreshold( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> extraInfo, const ptree & data ); @@ -111,7 +143,7 @@ namespace TrigConf { /** Destructor */ virtual ~L1Threshold() = default; - virtual std::string className() const + virtual std::string className() const override { return "L1Threshold"; } /** Accessor to the threshold type */ @@ -126,28 +158,98 @@ namespace TrigConf { /** Accessor to the threshold value for eta-dependent threholds * @param eta the eta value should be given for potentially eta-dependent thresholds + * must be overwritten by L1Threshold_Calo and L1Threnshold_MU + */ + virtual float thrValue(int eta = 0) const; + + protected: + + /** Update the internal data after modification of the data object */ + virtual void update() override; + + std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo; + + private: + + void load(); + + std::string m_type{""}; ///< threshold type + unsigned int m_mapping{0}; ///< unique identifier amongst thresholds of the same type + }; + + + class L1Threshold_Calo : public L1Threshold { + public: + + /** Constructor */ + L1Threshold_Calo() = delete; + + /** Constructor initialized with configuration data + * @param name threshold name + * @param type threshold type name + * @param extraInfo The information that is specific for this threshold type + * @param data The data containing the L1 threshold + */ + L1Threshold_Calo( const std::string & name, const std::string & type, + std::weak_ptr<L1ThrExtraInfoBase> extraInfo, const ptree & data); + + /** Destructor */ + virtual ~L1Threshold_Calo() = default; + + // Accessors to the threshold value for eta-dependent threholds + + /* @brief Accessor to the threshold value in GeV + * @param eta the eta value should be given for potentially eta-dependent thresholds + * @returns threshold in GeV */ - unsigned int thrValue(int eta = 0) const; + virtual float thrValue(int eta = 0) const; + /* @brief Accessor to the threshold value in energy units + * @param eta the eta value should be given for potentially eta-dependent thresholds + * @returns threshold in energy units + */ virtual unsigned int thrValueCounts(int eta = 0) const; + /* @brief Accessor to the threshold value in MeV + * @param eta the eta value should be given for potentially eta-dependent thresholds + * @returns threshold in MeV + */ + virtual unsigned int thrValueMeV(int eta = 0) const; + + /** access to the list of ThresholdValues in GeV */ + virtual ValueWithEtaDependence<float> thrValues() const; + + /** access to the list of ThresholdValues in MeV */ + virtual const ValueWithEtaDependence<unsigned int> & thrValuesMeV() const; + + /** access to the list of ThresholdValues in energy units */ + virtual ValueWithEtaDependence<unsigned int> thrValuesCounts() const; + protected: /** Update the internal data after modification of the data object */ virtual void update(); std::string m_input{""}; - unsigned int m_thrValue {0}; ///< threshold value in GeV - std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo; - ValueWithEtaDependence<unsigned int> m_etaDepThrValue{""}; - + // internally the threshold cuts are represented in MeV + // - it is human readible + // - integer are preferred over float by the L1Calo/L1Calo firmware experts + // - GeV is not possible as we would like to support cuts with finer granularity than GeV + + unsigned int m_thrValue {0}; ///< threshold value in MeV + + ValueWithEtaDependence<unsigned int> m_etaDepThrValue{""}; ///< eta-dependent threshold value in MeV + private: - std::string m_type{""}; ///< threshold type - unsigned int m_mapping{0}; ///< unique identifier amongst thresholds of the same type + void load(); }; + + + + /****************************************** * Isolation for legacy L1Calo thresholds ******************************************/ diff --git a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThresholdBase.icc b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThresholdBase.icc index 324b3f068eb9ae1ac693ec02bbc26b18add66b5d..b73913f9b29c8e77129690f31dd421e863765c28 100644 --- a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThresholdBase.icc +++ b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/L1ThresholdBase.icc @@ -4,6 +4,13 @@ namespace TrigConf { + + template<class T> + ValueWithEtaDependence<T>::RangeValue::RangeValue(const T & value, int etaMin, int etaMax, unsigned int priority, bool symmetric) : + m_value(value), m_etaMin(etaMin), m_etaMax(etaMax), m_priority(priority), m_symmetric(symmetric) + {} + + template<class T> size_t ValueWithEtaDependence<T>::size() const { return m_rangeValues.size(); @@ -25,11 +32,11 @@ namespace TrigConf { template<class T> void ValueWithEtaDependence<T>::addRangeValue(const T & value, int etaMin, int etaMax, unsigned int priority, bool symmetric) { - RangeValue rv = { value, etaMin, etaMax, priority, symmetric }; + auto rv = RangeValue{ value, etaMin, etaMax, priority, symmetric }; for( const auto & rv : m_rangeValues ) { - if( rv.priority != priority ) + if( rv.priority() != priority ) continue; - if( (etaMax >= rv.etaMin) and (etaMin <= rv.etaMax) ) { // overlaps with existing range of the same priority + if( (etaMax > rv.etaMin()) and (etaMin < rv.etaMax()) ) { // overlaps with existing range of the same priority throw std::runtime_error( "Range eta " + std::to_string(etaMin) + " - " + std::to_string(etaMax) + " (priority " + std::to_string(priority) + ") overlaps with existing range of the same priority"); } @@ -39,19 +46,22 @@ namespace TrigConf { template<class T> const T & ValueWithEtaDependence<T>::at(int eta) const { + // the ranges are by definition such that the lower boundary is inclusive, while the upper boundary is exclusive + // this has been the convention for Run 2 and will remain like this in Run 3 + // this has been agreed upon by L1Calo and L1Topo int current_priority = -1; const T * retVal { nullptr }; for( const auto & rv : m_rangeValues ) { - if(eta>rv.etaMax or eta < rv.etaMin) // outside the window + if( eta >= rv.etaMax() or eta < rv.etaMin()) // outside the window continue; - if(int(rv.priority) < current_priority) + if(int(rv.priority()) < current_priority) continue; - if(int(rv.priority) == current_priority) { - throw std::runtime_error(name() + ": found two values with the same priority " + std::to_string(rv.priority) + if(int(rv.priority()) == current_priority) { + throw std::runtime_error(name() + ": found two values with the same priority " + std::to_string(rv.priority()) + " for eta = " + std::to_string(eta)); } - current_priority = (int)rv.priority; - retVal = & rv.value; + current_priority = (int)rv.priority(); + retVal = & rv.value(); } if( retVal ) { return * retVal; diff --git a/Trigger/TrigConfiguration/TrigConfData/src/L1Connector.cxx b/Trigger/TrigConfiguration/TrigConfData/src/L1Connector.cxx index e502a9f8d12676837b7e195a4d00cab969db61a5..a2108e19e1fd3c85bbc9d7a1139c81c3b1214aa2 100644 --- a/Trigger/TrigConfiguration/TrigConfData/src/L1Connector.cxx +++ b/Trigger/TrigConfiguration/TrigConfData/src/L1Connector.cxx @@ -64,7 +64,8 @@ TrigConf::L1Connector::update() m_lineByName[name] = & m_triggerLines[fpga][clock].back(); } } - } + } + m_isLegacy = getAttribute<bool>("legacy", true, false); } diff --git a/Trigger/TrigConfiguration/TrigConfData/src/L1Menu.cxx b/Trigger/TrigConfiguration/TrigConfData/src/L1Menu.cxx index 97de238cbc1c2493e916d4909b8a64ac460b11fc..5c6d79f08dbb9a4a9c7b4faa1ac92f1cda0a2be8 100644 --- a/Trigger/TrigConfiguration/TrigConfData/src/L1Menu.cxx +++ b/Trigger/TrigConfiguration/TrigConfData/src/L1Menu.cxx @@ -88,7 +88,11 @@ TrigConf::L1Menu::update() for( auto & algo : v ) { m_algorithmsByName[ algo.name() ] = & algo; for( const std::string & output : algo.outputs() ) { - m_algorithmsByOutput[output] = & algo; + // multiplicity outputs (legacy and from multiplicity L1Topo) just have the name of the threshold + // outputs from topo algorithms carry the name of the topo board type (TOPO, R2TOPO, MUTOPO) as it is not guarateed that + // legacy and new topo algorithms define different outputs + auto key = (path == "MULTTOPO") ? output : (path + "_" + output); + m_algorithmsByOutput[key] = & algo; } } diff --git a/Trigger/TrigConfiguration/TrigConfData/src/L1ThrExtraInfo.cxx b/Trigger/TrigConfiguration/TrigConfData/src/L1ThrExtraInfo.cxx index ee76056f83477739e9a55ba453a83ca2fec26ca3..4d1dec2c9b653efadb996f9e0852e5b6ec2de4f6 100644 --- a/Trigger/TrigConfiguration/TrigConfData/src/L1ThrExtraInfo.cxx +++ b/Trigger/TrigConfiguration/TrigConfData/src/L1ThrExtraInfo.cxx @@ -12,24 +12,32 @@ using namespace std; std::unique_ptr<TrigConf::L1ThrExtraInfoBase> TrigConf::L1ThrExtraInfo::createExtraInfo(const std::string & thrTypeName, const boost::property_tree::ptree & data) { std::unique_ptr<TrigConf::L1ThrExtraInfoBase> extraInfo(nullptr); - if( thrTypeName == "EM" ) { - extraInfo = std::make_unique<L1ThrExtraInfo_EMTAULegacy>(thrTypeName, data); - } else if( thrTypeName == "JET" ) { - extraInfo = std::make_unique<L1ThrExtraInfo_JETLegacy>(thrTypeName, data); - } else if( thrTypeName == "MU" ) { - extraInfo = std::make_unique<L1ThrExtraInfo_MU>(thrTypeName, data); - } else if( thrTypeName == "TAU" ) { - extraInfo = std::make_unique<L1ThrExtraInfo_EMTAULegacy>(thrTypeName, data); - } else if( thrTypeName == "eEM" or thrTypeName == "eTAU" ) { - extraInfo = std::make_unique<L1ThrExtraInfo_eEMTAU>(thrTypeName, data); - } else if( thrTypeName == "jJ" ) { - extraInfo = std::make_unique<L1ThrExtraInfo_jJ>(thrTypeName, data); - } else { - L1ThrExtraInfoBase x(thrTypeName, data); - if( x.hasExtraInfo() ) { - extraInfo = std::make_unique<L1ThrExtraInfoBase>(std::move(x)); - } - } + + if( thrTypeName == "EM" ) + return std::make_unique<L1ThrExtraInfo_EMTAULegacy>(thrTypeName, data); + + if( thrTypeName == "TAU" ) + return std::make_unique<L1ThrExtraInfo_EMTAULegacy>(thrTypeName, data); + + if( thrTypeName == "JET" ) + return std::make_unique<L1ThrExtraInfo_JETLegacy>(thrTypeName, data); + + if( thrTypeName == "XS" ) + return std::make_unique<L1ThrExtraInfo_XSLegacy>(thrTypeName, data); + + if( thrTypeName == "MU" ) + return std::make_unique<L1ThrExtraInfo_MU>(thrTypeName, data); + + if( thrTypeName == "eEM" or thrTypeName == "eTAU" ) + return std::make_unique<L1ThrExtraInfo_eEMTAU>(thrTypeName, data); + + if( thrTypeName == "jJ" ) + return std::make_unique<L1ThrExtraInfo_jJ>(thrTypeName, data); + + L1ThrExtraInfoBase x(thrTypeName, data); + if( x.hasExtraInfo() ) + return std::make_unique<L1ThrExtraInfoBase>(std::move(x)); + return extraInfo; } @@ -58,6 +66,11 @@ TrigConf::L1ThrExtraInfo::TAU() const { return dynamic_cast<const TrigConf::L1ThrExtraInfo_EMTAULegacy&>( * m_thrExtraInfo.at("TAU") ); } +const TrigConf::L1ThrExtraInfo_XSLegacy & +TrigConf::L1ThrExtraInfo::XS() const { + return dynamic_cast<const TrigConf::L1ThrExtraInfo_XSLegacy&>( * m_thrExtraInfo.at("XS") ); +} + const TrigConf::L1ThrExtraInfo_JETLegacy & TrigConf::L1ThrExtraInfo::JET() const { return dynamic_cast<const TrigConf::L1ThrExtraInfo_JETLegacy&>( * m_thrExtraInfo.at("JET") ); @@ -105,87 +118,9 @@ TrigConf::L1ThrExtraInfo::thrExtraInfo(const std::string & thrTypeName) const } } - - - - -TrigConf::L1ThrExtraInfoBase::L1ThrExtraInfoBase(const std::string & thrTypeName, const boost::property_tree::ptree & data) - : DataStructure(data) -{ - m_name = thrTypeName; - update(); -} - -TrigConf::L1ThrExtraInfoBase::~L1ThrExtraInfoBase() -{} - -std::string -TrigConf::L1ThrExtraInfoBase::className() const { - return "L1ThrExtraInfoBase"; -} - -void -TrigConf::L1ThrExtraInfoBase::update() -{ - if(! isInitialized() || empty() ) { - return; - } - if( m_name == "internal" ) { // internal trigger have no extra info - return; - } - for( auto & content : data() ) { - if( content.first == "type" || - content.first == "thresholds" ) { - continue; - } - // if there is anything else in the tree we consider it extra info fro this threshold type - m_extraInfo.emplace( std::piecewise_construct, - std::forward_as_tuple(content.first), - std::forward_as_tuple(content.second)); - } -} - -const std::string & -TrigConf::L1ThrExtraInfoBase::thresholdTypeName() const -{ - return m_name; -} - -bool -TrigConf::L1ThrExtraInfoBase::hasExtraInfo() const -{ - return m_extraInfo.size()>0; -} - - - /** * EM legacy extra info */ -TrigConf::L1ThrExtraInfo_EMTAULegacy::L1ThrExtraInfo_EMTAULegacy(const std::string & thrTypeName, const ptree & data) : - L1ThrExtraInfoBase(thrTypeName, data) -{ - update(); -} - -TrigConf::L1ThrExtraInfo_EMTAULegacy::~L1ThrExtraInfo_EMTAULegacy() -{} - -std::string -TrigConf::L1ThrExtraInfo_EMTAULegacy::className() const { - return "L1ThrExtraInfo_EMTAULegacy"; -} - -unsigned int -TrigConf::L1ThrExtraInfo_EMTAULegacy::emScale() const { - return m_emScale; -} - -unsigned int -TrigConf::L1ThrExtraInfo_EMTAULegacy::ptMinToTopo() const { - return m_ptMinToTopo; -} - const TrigConf::IsolationLegacy & TrigConf::L1ThrExtraInfo_EMTAULegacy::isolation(const std::string & thrType, size_t bit) const { @@ -199,13 +134,11 @@ TrigConf::L1ThrExtraInfo_EMTAULegacy::isolation(const std::string & thrType, siz } void -TrigConf::L1ThrExtraInfo_EMTAULegacy::update() +TrigConf::L1ThrExtraInfo_EMTAULegacy::load() { for( auto & x : m_extraInfo ) { - if( x.first == "emscale" ) { - m_emScale = x.second.getValue<unsigned int>(); - } else if( x.first == "ptMinToTopo" ) { - m_ptMinToTopo = x.second.getValue<unsigned int>(); + if( x.first == "ptMinToTopo" ) { + m_ptMinToTopoMeV = std::lround( 1000 * x.second.getValue<float>() ); } else if( x.first == "isolation" ) { for( auto & y : x.second.data() ) { auto & isoV = m_isolation[y.first] = std::vector<IsolationLegacy>(); @@ -220,44 +153,31 @@ TrigConf::L1ThrExtraInfo_EMTAULegacy::update() } - -/** - * JET legacy extra info - */ -TrigConf::L1ThrExtraInfo_JETLegacy::L1ThrExtraInfo_JETLegacy(const std::string & thrTypeName, const ptree & data) : - L1ThrExtraInfoBase(thrTypeName, data) +void +TrigConf::L1ThrExtraInfo_XSLegacy::load() { - update(); -} - -TrigConf::L1ThrExtraInfo_JETLegacy::~L1ThrExtraInfo_JETLegacy() -{} - -unsigned int -TrigConf::L1ThrExtraInfo_JETLegacy::jetScale() const { - return m_jetScale; + auto sig = m_extraInfo["significance"]; + m_xeMin = sig.getAttribute<unsigned int>("xeMin"); + m_xeMax = sig.getAttribute<unsigned int>("xeMax"); + m_teSqrtMin = sig.getAttribute<unsigned int>("teSqrtMin"); + m_teSqrtMax = sig.getAttribute<unsigned int>("teSqrtMax"); + m_xsSigmaScale = sig.getAttribute<unsigned int>("xsSigmaScale"); + m_xsSigmaOffset = sig.getAttribute<unsigned int>("xsSigmaOffset"); } -unsigned int -TrigConf::L1ThrExtraInfo_JETLegacy::ptMinToTopoLargeWindow() const { - return m_ptMinToTopoLargeWindow; -} -unsigned int -TrigConf::L1ThrExtraInfo_JETLegacy::ptMinToTopoSmallWindow() const { - return m_ptMinToTopoSmallWindow; -} +/** + * JET legacy extra info + */ void -TrigConf::L1ThrExtraInfo_JETLegacy::update() +TrigConf::L1ThrExtraInfo_JETLegacy::load() { for( auto & x : m_extraInfo ) { - if( x.first == "jetscale" ) { - m_jetScale = x.second.getValue<unsigned int>(); - } else if( x.first == "ptMinToTopoLargeWindow" ) { - m_ptMinToTopoLargeWindow = x.second.getValue<unsigned int>(); + if( x.first == "ptMinToTopoLargeWindow" ) { + m_ptMinToTopoLargeWindowMeV = std::lround( 1000 * x.second.getValue<float>() ); } else if( x.first == "ptMinToTopoSmallWindow" ) { - m_ptMinToTopoSmallWindow = x.second.getValue<unsigned int>(); + m_ptMinToTopoSmallWindowMeV = std::lround( 1000 * x.second.getValue<float>() ); } } } @@ -272,20 +192,6 @@ TrigConf::L1ThrExtraInfo_JETLegacy::update() /******* * eEM *******/ -TrigConf::L1ThrExtraInfo_eEMTAU::L1ThrExtraInfo_eEMTAU(const std::string & thrTypeName, const ptree & data) : - L1ThrExtraInfoBase(thrTypeName, data) -{ - update(); -} - -TrigConf::L1ThrExtraInfo_eEMTAU::~L1ThrExtraInfo_eEMTAU() -{} - -unsigned int -TrigConf::L1ThrExtraInfo_eEMTAU::ptMinToTopo() const { - return m_ptMinToTopo; -} - const TrigConf::Isolation & TrigConf::L1ThrExtraInfo_eEMTAU::isolation(TrigConf::Isolation::WP wp, int eta) const { @@ -300,11 +206,11 @@ TrigConf::L1ThrExtraInfo_eEMTAU::isolation(TrigConf::Isolation::WP wp) const void -TrigConf::L1ThrExtraInfo_eEMTAU::update() +TrigConf::L1ThrExtraInfo_eEMTAU::load() { for( auto & x : m_extraInfo ) { if( x.first == "ptMinToTopo" ) { - m_ptMinToTopo = x.second.getValue<unsigned int>(); + m_ptMinToTopoMeV = lround(1000 * x.second.getValue<float>()); } else if( x.first == "workingPoints" ) { for( auto & y : x.second.data() ) { auto wp = (y.first == "Loose") ? Isolation::WP::LOOSE : ( (y.first == "Medium") ? Isolation::WP::MEDIUM : Isolation::WP::TIGHT ); @@ -324,51 +230,19 @@ TrigConf::L1ThrExtraInfo_eEMTAU::update() /******* * jJ *******/ -TrigConf::L1ThrExtraInfo_jJ::L1ThrExtraInfo_jJ(const std::string & thrTypeName, const ptree & data) : - L1ThrExtraInfoBase(thrTypeName, data) -{ - update(); -} - -TrigConf::L1ThrExtraInfo_jJ::~L1ThrExtraInfo_jJ() -{} - -unsigned int -TrigConf::L1ThrExtraInfo_jJ::ptMinToTopoSmall(int eta) const { - for(auto & ptmin : m_ptMinToTopoSmall) { - if( (ptmin.first.first<=eta) && (eta<=ptmin.first.second) ) { - return ptmin.second; - } - } - throw std::runtime_error("No ptMinToTopoSmall for jJ at eta=" + std::to_string(eta)); -} - -unsigned int -TrigConf::L1ThrExtraInfo_jJ::ptMinToTopoLarge(int eta) const { - for(auto & ptmin : m_ptMinToTopoLarge) { - if( (ptmin.first.first<=eta) && (eta<=ptmin.first.second) ) { - return ptmin.second; - } - } - throw std::runtime_error("No ptMinToTopoLarge for jJ at eta=" + std::to_string(eta)); -} - void -TrigConf::L1ThrExtraInfo_jJ::update() +TrigConf::L1ThrExtraInfo_jJ::load() { for( auto & x : m_extraInfo ) { if( x.first == "ptMinToTopo" ) { for( auto & k : x.second.data() ) { - unsigned int etamin = k.second.get_child("etamin").get_value<unsigned int>(); - unsigned int etamax = k.second.get_child("etamax").get_value<unsigned int>(); - unsigned int small = k.second.get_child("small").get_value<unsigned int>(); - unsigned int large = k.second.get_child("large").get_value<unsigned int>(); - m_ptMinToTopoSmall.emplace( std::piecewise_construct, - std::forward_as_tuple(etamin,etamax), - std::forward_as_tuple(small)); - m_ptMinToTopoLarge.emplace( std::piecewise_construct, - std::forward_as_tuple(etamin,etamax), - std::forward_as_tuple(large)); + auto etamin = k.second.get_child("etamin").get_value<unsigned int>(); + auto etamax = k.second.get_child("etamax").get_value<unsigned int>(); + auto small = k.second.get_child("small").get_value<float>(); + auto large = k.second.get_child("large").get_value<float>(); + auto priority = k.second.get_optional<unsigned int>("priority").get_value_or(0); + m_ptMinToTopoSmallMeV.addRangeValue( lround(1000*small), etamin, etamax, priority, /*symmetric=*/ false); + m_ptMinToTopoLargeMeV.addRangeValue( lround(1000*large), etamin, etamax, priority, /*symmetric=*/ false); } } } @@ -378,22 +252,8 @@ TrigConf::L1ThrExtraInfo_jJ::update() /******* * jTAU *******/ -TrigConf::L1ThrExtraInfo_jTAU::L1ThrExtraInfo_jTAU(const std::string & thrTypeName, const ptree & data) : - L1ThrExtraInfoBase(thrTypeName, data) -{ - update(); -} - -TrigConf::L1ThrExtraInfo_jTAU::~L1ThrExtraInfo_jTAU() -{} - -unsigned int -TrigConf::L1ThrExtraInfo_jTAU::ptMinToTopo() const { - return m_ptMinToTopo; -} - void -TrigConf::L1ThrExtraInfo_jTAU::update() +TrigConf::L1ThrExtraInfo_jTAU::load() { for( auto & x : m_extraInfo ) { if( x.first == "ptMinToTopo" ) { @@ -405,32 +265,14 @@ TrigConf::L1ThrExtraInfo_jTAU::update() /******* * gXE *******/ -TrigConf::L1ThrExtraInfo_gXE::L1ThrExtraInfo_gXE(const std::string & thrTypeName, const ptree & data) : - L1ThrExtraInfoBase(thrTypeName, data) -{ - update(); -} - -TrigConf::L1ThrExtraInfo_gXE::~L1ThrExtraInfo_gXE() -{} - void -TrigConf::L1ThrExtraInfo_gXE::update() +TrigConf::L1ThrExtraInfo_gXE::load() { } /******* * MU *******/ -TrigConf::L1ThrExtraInfo_MU::L1ThrExtraInfo_MU(const std::string & thrTypeName, const ptree & data) : - L1ThrExtraInfoBase(thrTypeName, data) -{ - update(); -} - -TrigConf::L1ThrExtraInfo_MU::~L1ThrExtraInfo_MU() -{} - unsigned int TrigConf::L1ThrExtraInfo_MU::rpcIdxForPt(unsigned int pt) const { @@ -501,7 +343,7 @@ TrigConf::L1ThrExtraInfo_MU::exlusionList(const std::string & listName) const } void -TrigConf::L1ThrExtraInfo_MU::update() +TrigConf::L1ThrExtraInfo_MU::load() { for( auto & x : m_extraInfo["roads"].getObject("rpc").data() ) { m_rpcPtMap.emplace( boost::lexical_cast<unsigned int, std::string>(x.first), diff --git a/Trigger/TrigConfiguration/TrigConfData/src/L1Threshold.cxx b/Trigger/TrigConfiguration/TrigConfData/src/L1Threshold.cxx index e657fda6c036aa1b1cfd1aa10d6c08ca59576cd1..070e107bae45056866553c2edb5e34d8182269d0 100644 --- a/Trigger/TrigConfiguration/TrigConfData/src/L1Threshold.cxx +++ b/Trigger/TrigConfiguration/TrigConfData/src/L1Threshold.cxx @@ -4,15 +4,17 @@ #include "TrigConfData/L1ThrExtraInfo.h" -TrigConf::L1Threshold_EM::L1Threshold_EM( const std::string & name, const std::string & type, - std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : - L1Threshold(name, type, m_extraInfo, data) -{ - update(); -} - +/****************************************** + * + * Legacy L1Calo thresholds + * + ******************************************/ + +/** + * EM + */ void -TrigConf::L1Threshold_EM::update() +TrigConf::L1Threshold_EM::load() { // read the isolation if( const auto & thrVs = data().get_child_optional("thrValues") ) { @@ -32,35 +34,24 @@ TrigConf::L1Threshold_EM::update() } } -unsigned int -TrigConf::L1Threshold_EM::thrValueCounts(int eta) const { - auto emInfo = std::dynamic_pointer_cast<L1ThrExtraInfo_EMTAULegacy>(m_extraInfo.lock()); - return thrValue(eta) * emInfo->emScale(); -} - void TrigConf::L1Threshold_EM::print(std::ostream & os) const { os << "EM threshold " << name() << " with mapping " << mapping() << std::endl; - for( int eta = 0; eta<=49; eta++ ) { - auto vneg = thrValue(-eta); - auto vpos = thrValue(eta); + for( int eta = -49; eta<49; eta++ ) { + auto value = thrValue(eta); + auto valueMeV = thrValueMeV(eta); auto counts = thrValueCounts(eta); auto iso = isolationMask(eta); - os << " eta = " << eta << " : " << vneg << " " << vpos << (vpos!=vneg ? " !!! " : " ") - << counts << ", isoMaks " << iso << std::endl; + os << " eta = " << eta << " : " << value << " GeV " << valueMeV << " MeV " + << counts << " counts , isoMaks " << iso << std::endl; } } - -TrigConf::L1Threshold_TAU::L1Threshold_TAU( const std::string & name, const std::string & type, - std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : - L1Threshold(name, type, m_extraInfo, data) -{ - update(); -} - +/** + * TAU + */ void -TrigConf::L1Threshold_TAU::update() +TrigConf::L1Threshold_TAU::load() { // read the isolation std::string isobits = getAttribute("isobits"); @@ -71,39 +62,49 @@ TrigConf::L1Threshold_TAU::update() } } +/****************************************** + * + * New L1Calo thresholds + * + ******************************************/ - -TrigConf::L1Threshold_eEM::L1Threshold_eEM( const std::string & name, const std::string & type, - std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : - L1Threshold(name, type, m_extraInfo, data) -{ - update(); -} - +/** + * eEM + */ void -TrigConf::L1Threshold_eEM::update() +TrigConf::L1Threshold_eEM::load() { auto translate = [](const std::string &wp) { return wp=="Loose" ? Isolation::WP::LOOSE : ( wp=="Medium" ? Isolation::WP::MEDIUM : - ( wp=="Medium" ? Isolation::WP::TIGHT : Isolation::WP::NONE ) ); }; + ( wp=="Tight" ? Isolation::WP::TIGHT : Isolation::WP::NONE ) ); }; // read the isolation requirements m_reta = translate(getAttribute("reta")); m_rhad = translate(getAttribute("rhad")); m_wstot = translate(getAttribute("wstot")); } +void +TrigConf::L1Threshold_eTAU::load() +{} +/****************************************** + * + * Muon threshold + * + ******************************************/ -TrigConf::L1Threshold_MU::L1Threshold_MU( const std::string & name, const std::string & type, - std::weak_ptr<L1ThrExtraInfoBase> m_extraInfo, const ptree & data) : - L1Threshold(name, type, m_extraInfo, data) +/** + * this function is only to satisfy the base class interface. It should not be used + */ +float +TrigConf::L1Threshold_MU::thrValue(int) const { - update(); + return static_cast<float>(m_ptBarrel); } void -TrigConf::L1Threshold_MU::update() +TrigConf::L1Threshold_MU::load() { auto muInfo = std::dynamic_pointer_cast<L1ThrExtraInfo_MU>(m_extraInfo.lock()); diff --git a/Trigger/TrigConfiguration/TrigConfData/src/L1ThresholdBase.cxx b/Trigger/TrigConfiguration/TrigConfData/src/L1ThresholdBase.cxx index ef7f82139c65c6d60deac876ffde2fadf1f0adb3..b15e4a057de189731ca443236022c29ad5db9463 100644 --- a/Trigger/TrigConfiguration/TrigConfData/src/L1ThresholdBase.cxx +++ b/Trigger/TrigConfiguration/TrigConfData/src/L1ThresholdBase.cxx @@ -1,78 +1,257 @@ /* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +#include <algorithm> +#include <cmath> + + +#include "TrigConfData/L1ThresholdBase.h" #include "TrigConfData/L1Threshold.h" +/** + * + * L1Threshold base class + * + **/ + +unsigned int +TrigConf::energyInCounts(unsigned int energyMeV, unsigned int energyResolutionMeV) +{ + if ( energyMeV % energyResolutionMeV != 0 ) { + throw std::runtime_error("Energy " + std::to_string(energyMeV) + " MeV is not a multiple of the energy resolution " + std::to_string(energyResolutionMeV)); + } + return energyMeV / energyResolutionMeV; +} + + std::shared_ptr<TrigConf::L1Threshold> TrigConf::L1Threshold::createThreshold( const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> extraInfo, const ptree & data ) { - if( type == "EM" ) { + if( type == "EM" ) return std::make_shared<L1Threshold_EM>( name, type, extraInfo, data ); - } else if( type == "TAU" ) { + + if( type == "TAU" ) return std::make_shared<L1Threshold_TAU>( name, type, extraInfo, data ); - } else if( type == "eEM" ) { + + if( type == "XE" ) + return std::make_shared<L1Threshold_XE>( name, type, extraInfo, data ); + + if( type == "XS" ) + return std::make_shared<L1Threshold_XS>( name, type, extraInfo, data ); + + if( type == "TE" ) + return std::make_shared<L1Threshold_TE>( name, type, extraInfo, data ); + + if( type == "eEM" ) return std::make_shared<L1Threshold_eEM>( name, type, extraInfo, data ); - } else if( type == "MU" ) { + + if( type == "eTAU" ) + return std::make_shared<L1Threshold_eTAU>( name, type, extraInfo, data ); + + if( type == "MU" ) return std::make_shared<L1Threshold_MU>( name, type, extraInfo, data ); - } else { + + static const std::string NIMtypes[] = { "BCM", "BCMCMB", "LUCID", "ZDC", "BPTX", "CALREQ", "MBTS", "MBTSSI", "NIM" }; + bool isNIMtype = std::find(std::begin(NIMtypes), std::end(NIMtypes), type) != + std::end(NIMtypes); + + if( isNIMtype ) + return std::make_shared<L1Threshold_NIM>( name, type, extraInfo, data ); + + if( type == "internal" ) + return std::make_shared<L1Threshold_internal>( name, type, extraInfo, data ); + + static const std::string noSpecialImp[] = { "JET", "XS", "jJ", "gXE", "jXE", "TOPO", "MULTTOPO", "MUTOPO", "R2TOPO", "ZB" }; + bool useBaseClass = std::find(std::begin(noSpecialImp), std::end(noSpecialImp),type) != + std::end(noSpecialImp); + + if( useBaseClass ) return std::make_shared<L1Threshold>( name, type, extraInfo, data ); - } + + throw std::runtime_error("Threshold " + name + " is not of a valid L1 threshold type: " + type); + } -TrigConf::L1Threshold::L1Threshold(const std::string & name, const std::string & type, std::weak_ptr<L1ThrExtraInfoBase> extraInfo, const boost::property_tree::ptree & data) +TrigConf::L1Threshold::L1Threshold( const std::string & name, const std::string & type, + std::weak_ptr<L1ThrExtraInfoBase> extraInfo, const boost::property_tree::ptree & data) : DataStructure(data), m_extraInfo(extraInfo), - m_etaDepThrValue(name + "#" + type + "_value"), m_type(type) { m_name = name; - update(); + load(); +} + +float +TrigConf::L1Threshold::thrValue(int) const { + return 0; } void TrigConf::L1Threshold::update() +{ + load(); +} + +void +TrigConf::L1Threshold::load() { if( type() == "internal" ) { return; } m_name = getAttribute("name", true, m_name); m_type = getAttribute("type", true, m_type); - m_thrValue = getAttribute<unsigned int>("value", true, 0); - m_input = getAttribute("input", true, ""); m_mapping = getAttribute<unsigned int>("mapping"); - try { - if( const auto & thrVs = data().get_child_optional("thrValues") ) { - for( auto & x : thrVs.get() ) { - auto value = x.second.get_child("value").get_value<unsigned int>(); - auto etamin = x.second.get_child("etamin").get_value<int>(); - auto etamax = x.second.get_child("etamax").get_value<int>(); - auto priority = x.second.get_child("priority").get_value<unsigned int>(); - m_etaDepThrValue.addRangeValue(value, etamin, etamax, priority, /*symmetric=*/ false); - } +} + + +TrigConf::L1ThrExtraInfoBase::L1ThrExtraInfoBase(const std::string & thrTypeName, const boost::property_tree::ptree & data) + : DataStructure(data) +{ + m_name = thrTypeName; + load(); +} + +void +TrigConf::L1ThrExtraInfoBase::load() +{ + if(! isInitialized() || empty() ) + return; + + if( m_name == "internal" ) { // internal trigger have no extra info + return; + } + for( auto & content : data() ) { + if( content.first == "type" || + content.first == "thresholds" ) { + continue; } + // if there is anything else in the tree we consider it extra info fro this threshold type + m_extraInfo.emplace( std::piecewise_construct, + std::forward_as_tuple(content.first), + std::forward_as_tuple(content.second)); } - catch(std::exception & ex) { - std::cerr << "Caught exception when reading threshold values for threshold " << m_name << std::endl - << ex.what() << std::endl; - throw; + + m_resolutionMeV = getAttribute<unsigned int>("resolutionMeV", true, 1000); + if( hasAttribute("emscale") ) { // for previous definition of the EM resolution + m_resolutionMeV = 1000 / getAttribute<unsigned int>("emscale"); } } -unsigned int -TrigConf::L1Threshold::thrValue(int eta) const + +const std::string & +TrigConf::L1ThrExtraInfoBase::thresholdTypeName() const +{ + return m_name; +} + +bool +TrigConf::L1ThrExtraInfoBase::hasExtraInfo() const +{ + return m_extraInfo.size()>0; +} + + + + +/** + * + * L1Threshold_Calo base class + * + **/ + +TrigConf::L1Threshold_Calo::L1Threshold_Calo( const std::string & name, const std::string & type, + std::weak_ptr<L1ThrExtraInfoBase> extraInfo, const boost::property_tree::ptree & data) + : L1Threshold(name, type, extraInfo, data), + m_etaDepThrValue(name + "#" + type + "_value") +{ + load(); +} + +void +TrigConf::L1Threshold_Calo::update() +{ + L1Threshold::update(); + load(); +} + +namespace { + unsigned int gev2MeVThrVal(float gevVal) { + unsigned int mev_i = std::lround( 1000 * gevVal ); + if( gevVal != (mev_i / 1000.) ) { + std::runtime_error("Value conversion failed"); + } + return mev_i; + } + +} + + +void +TrigConf::L1Threshold_Calo::load() { - if( m_etaDepThrValue.empty() ) { - return m_thrValue; - } else { - return m_etaDepThrValue.at(eta); + if( type() == "internal" ) { + return; + } + m_thrValue = gev2MeVThrVal( getAttribute<float>("value", true, 0) ); + m_input = getAttribute("input", true, ""); + if( const auto & thrVs = data().get_child_optional("thrValues") ) { + for( auto & x : thrVs.get() ) { + auto value = gev2MeVThrVal( x.second.get_child("value").get_value<float>() ); + auto etamin = x.second.get_child("etamin").get_value<unsigned int>(); + auto etamax = x.second.get_child("etamax").get_value<unsigned int>(); + auto priority = x.second.get_child("priority").get_value<unsigned int>(); + m_etaDepThrValue.addRangeValue(value, etamin, etamax, priority, /*symmetric=*/ false); + } } } +/* + various access methods to the threshold values +*/ + +float +TrigConf::L1Threshold_Calo::thrValue(int eta) const +{ + return thrValueMeV(eta) / 1000.0f; +} + unsigned int -TrigConf::L1Threshold::thrValueCounts(int eta) const { - return thrValue(eta); +TrigConf::L1Threshold_Calo::thrValueCounts(int eta) const { + auto extraInfo = m_extraInfo.lock(); + return energyInCounts( thrValueMeV(eta), extraInfo->resolutionMeV() ); } +unsigned int +TrigConf::L1Threshold_Calo::thrValueMeV(int eta) const { + return m_etaDepThrValue.empty() ? m_thrValue : m_etaDepThrValue.at(eta); +} + +TrigConf::ValueWithEtaDependence<float> +TrigConf::L1Threshold_Calo::thrValues() const { + auto thresholdValuesGeV = ValueWithEtaDependence<float>{ m_etaDepThrValue.name()+"Counts" }; + for( auto & r : m_etaDepThrValue ) { + thresholdValuesGeV.addRangeValue(r.value() / 1000.0f, r.etaMin(), r.etaMax(), r.priority(), r.symmetric()); + } + return thresholdValuesGeV; +} + +const TrigConf::ValueWithEtaDependence<unsigned int> & +TrigConf::L1Threshold_Calo::thrValuesMeV() const { + return m_etaDepThrValue; +} + +TrigConf::ValueWithEtaDependence<unsigned int> +TrigConf::L1Threshold_Calo::thrValuesCounts() const { + auto extraInfo = m_extraInfo.lock(); + auto thrValuesCounts = ValueWithEtaDependence<unsigned int>{ m_etaDepThrValue.name()+"Counts" }; + for( auto & r : m_etaDepThrValue ) { + thrValuesCounts.addRangeValue( energyInCounts( r.value(), extraInfo->resolutionMeV() ), r.etaMin(), r.etaMax(), r.priority(), r.symmetric()); + } + return thrValuesCounts; +} + + TrigConf::IsolationLegacy::IsolationLegacy( const boost::property_tree::ptree & pt ) { diff --git a/Trigger/TrigConfiguration/TrigConfIO/utils/TestTriggerMenuAccess.cxx b/Trigger/TrigConfiguration/TrigConfIO/utils/TestTriggerMenuAccess.cxx index 39cb2b5992ee628fa7bc2550cdaaa030e51da945..71315d8bb0f267db7f33533e658d0b0781ce8d63 100644 --- a/Trigger/TrigConfiguration/TrigConfIO/utils/TestTriggerMenuAccess.cxx +++ b/Trigger/TrigConfiguration/TrigConfIO/utils/TestTriggerMenuAccess.cxx @@ -65,6 +65,7 @@ bool testL1Menu(const string & filename) { << "===== =====" << endl << "==========================" << endl << endl; + TrigConf::L1Menu l1menu; TrigConf::JsonFileLoader fileLoader; fileLoader.loadFile( filename, l1menu); @@ -90,17 +91,34 @@ bool testL1Menu(const string & filename) { // connectors cout << "L1 menu has " << l1menu.connectorNames().size() << " connectors configured" << endl; - for( const string & connName : {"Topo1Opt0", "EM1"} ) { + for( const string & connName : l1menu.connectorNames() ) { auto & conn = l1menu.connector(connName); - cout << "Connector " << connName << " has " << conn.size() << " trigger lines configured:" << endl; - for( auto & tl : conn.triggerLines() ) { - const string & tlName = tl.name(); - if( conn.type() == TrigConf::L1Connector::ConnectorType::CTPIN ) { - cout << " Triggerline " << tlName << " bits=[" << tl.startbit() << ".." << tl.endbit() << "] is a legacy threshold " << endl; - } else { + cout << "Connector " << connName << (conn.isLegacy() ? " (legacy)": "") << " has " << conn.size() << " trigger lines configured:" << endl; + if( connName == "MuCTPiOpt0" ) { + for( auto & tl : conn.triggerLines() ) { + cout << " Triggerline " << tl.name() << " bits=[" << tl.startbit() << ".." << tl.endbit() << "] is a muon threshold " << endl; + } + } else if( conn.type() == TrigConf::L1Connector::ConnectorType::CTPIN ) { + for( auto & tl : conn.triggerLines() ) { + cout << " Triggerline " << tl.name() << " bits=[" << tl.startbit() << ".." << tl.endbit() << "] is a legacy threshold " << endl; + } + } else if( conn.type() == TrigConf::L1Connector::ConnectorType::OPTICAL ) { + for( auto & tl : conn.triggerLines() ) { + const string & tlName = tl.name(); auto & topoAlg = l1menu.algorithmFromOutput(tlName); cout << " Triggerline " << tlName << " bits=[" << tl.startbit() << ".." << tl.endbit() - << "] is being produced by topo algorithm " << topoAlg.name() << endl; + << "] is produced by topo algorithm " << topoAlg.name() << endl; + } + } else if( conn.type() == TrigConf::L1Connector::ConnectorType::ELECTRICAL ) { + for( size_t fpga : { 0 ,1 } ) { + for( size_t clock : { 0 ,1 } ) { + for( auto & tl : conn.triggerLines(fpga, clock) ) { + const string & tlName = tl.name(); + auto & topoAlg = l1menu.algorithmFromOutput(tlName); + cout << " Triggerline " << tlName << " bits=[" << tl.startbit() << ".." << tl.endbit() + << "] is produced by topo algorithm " << topoAlg.name() << endl; + } + } } } } @@ -152,7 +170,7 @@ bool testL1Menu(const string & filename) { { auto & exEM = l1menu.thrExtraInfo().EM(); cout << " EM" << endl; - cout << " emScale " << exEM.emScale() << endl; + cout << " energy resolution (MeV) " << exEM.resolutionMeV() << endl; cout << " ptMinToTopo " << exEM.ptMinToTopo() << endl; for( const std::string & tt : {"HAIsoForEMthr", "EMIsoForEMthr"} ) { cout << " Isolation " << tt << endl; @@ -163,71 +181,101 @@ bool testL1Menu(const string & filename) { } } - auto & exJET = l1menu.thrExtraInfo().JET(); - cout << " JET" << endl; - cout << " jetScale " << exJET.jetScale() << endl; - cout << " ptMinToTopoSmallWindow " << exJET.ptMinToTopoSmallWindow() << endl; - cout << " ptMinToTopoLargeWindow " << exJET.ptMinToTopoLargeWindow() << endl; - - auto & exTAU = l1menu.thrExtraInfo().TAU(); - cout << " TAU" << endl; - cout << " ptMinToTopo " << exTAU.ptMinToTopo() << endl; - cout << " Isolation EMIsoForTAUthr" << endl; - for(size_t bit = 1; bit <= 5; bit++) { - cout << " " << exTAU.isolation("EMIsoForTAUthr", bit) << endl; + { + auto & ex = l1menu.thrExtraInfo().JET(); + cout << " JET" << endl; + cout << " jetScale " << ex.jetScale() << endl; + cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl; + cout << " ptMinToTopoSmallWindow " << ex.ptMinToTopoSmallWindow() << endl; + cout << " ptMinToTopoLargeWindow " << ex.ptMinToTopoLargeWindow() << endl; + cout << " ptMinToTopoSmallWindow (MeV) " << ex.ptMinToTopoSmallWindowMeV() << endl; + cout << " ptMinToTopoLargeWindow (MeV) " << ex.ptMinToTopoLargeWindowMeV() << endl; + cout << " ptMinToTopoSmallWindow (counts) " << ex.ptMinToTopoSmallWindowCounts() << endl; + cout << " ptMinToTopoLargeWindow (counts) " << ex.ptMinToTopoLargeWindowCounts() << endl; } - auto & exeEM = l1menu.thrExtraInfo().eEM(); - cout << " eEM" << endl; - cout << " ptMinToTopo " << exeEM.ptMinToTopo() << endl; - cout << " working point Loose" << endl; - for(auto & iso : exeEM.isolation(TrigConf::Isolation::WP::LOOSE)) { - cout << " range etaMin=" << iso.etaMin << ", etaMax=" << iso.etaMax - << ", priority=" << iso.priority << ", symmetric=" << (iso.symmetric ? "yes" : "no") - << ", isolation=" << iso.value << endl; - } - cout << " working point Medium" << endl; - for(auto & iso : exeEM.isolation(TrigConf::Isolation::WP::MEDIUM)) { - cout << " range etaMin=" << iso.etaMin << ", etaMax=" << iso.etaMax - << ", priority=" << iso.priority << ", symmetric=" << (iso.symmetric ? "yes" : "no") - << ", isolation=" << iso.value << endl; - } - cout << " working point Tight" << endl; - for(auto & iso : exeEM.isolation(TrigConf::Isolation::WP::TIGHT)) { - cout << " range etaMin=" << iso.etaMin << ", etaMax=" << iso.etaMax - << ", priority=" << iso.priority << ", symmetric=" << (iso.symmetric ? "yes" : "no") - << ", isolation=" << iso.value << endl; + { + auto & ex = l1menu.thrExtraInfo().TAU(); + cout << " TAU" << endl; + cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl; + cout << " ptMinToTopo " << ex.ptMinToTopo() << endl; + cout << " ptMinToTopo (MeV) " << ex.ptMinToTopoMeV() << endl; + cout << " ptMinToTopo (counts)" << ex.ptMinToTopoCounts() << endl; + cout << " Isolation EMIsoForTAUthr" << endl; + for(size_t bit = 1; bit <= 5; bit++) { + cout << " " << ex.isolation("EMIsoForTAUthr", bit) << endl; + } } - cout << " working point Medium at eta = 20:" << endl - << exeEM.isolation(TrigConf::Isolation::WP::TIGHT,20) << endl; - - auto & exjJ = l1menu.thrExtraInfo().jJ(); - cout << " jJ" << endl; - cout << " ptMinToTopoSmall at eta=0 " << exjJ.ptMinToTopoSmall(0) << endl; - cout << " ptMinToTopoLarge at eta=0 " << exjJ.ptMinToTopoLarge(0) << endl; - - auto & exeTAU = l1menu.thrExtraInfo().eTAU(); - cout << " eTAU" << endl; - cout << " ptMinToTopo " << exeTAU.ptMinToTopo() << endl; - cout << " working point Loose" << endl; - for(auto & iso : exeTAU.isolation(TrigConf::Isolation::WP::LOOSE)) { - cout << " range etaMin=" << iso.etaMin << ", etaMax=" << iso.etaMax - << ", priority=" << iso.priority << ", symmetric=" << (iso.symmetric ? "yes" : "no") - << ", isolation=" << iso.value << endl; + + { + auto & ex = l1menu.thrExtraInfo().eEM(); + cout << " eEM" << endl; + cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl; + cout << " ptMinToTopo " << ex.ptMinToTopo() << endl; + cout << " ptMinToTopo (MeV) " << ex.ptMinToTopoMeV() << endl; + cout << " ptMinToTopo (counts)" << ex.ptMinToTopoCounts() << endl; + cout << " working point Loose" << endl; + for(auto & iso : ex.isolation(TrigConf::Isolation::WP::LOOSE)) { + cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax() + << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no") + << ", isolation=" << iso.value() << endl; + } + cout << " working point Medium" << endl; + for(auto & iso : ex.isolation(TrigConf::Isolation::WP::MEDIUM)) { + cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax() + << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no") + << ", isolation=" << iso.value() << endl; + } + cout << " working point Tight" << endl; + for(auto & iso : ex.isolation(TrigConf::Isolation::WP::TIGHT)) { + cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax() + << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no") + << ", isolation=" << iso.value() << endl; + } + //cout << " working point Medium at eta = -20:" << ex.isolation(TrigConf::Isolation::WP::MEDIUM,-20) << endl; + cout << " working point Medium at eta = 20:" << ex.isolation(TrigConf::Isolation::WP::MEDIUM,20) << endl; } - cout << " working point Medium" << endl; - for(auto & iso : exeTAU.isolation(TrigConf::Isolation::WP::MEDIUM)) { - cout << " range etaMin=" << iso.etaMin << ", etaMax=" << iso.etaMax - << ", priority=" << iso.priority << ", symmetric=" << (iso.symmetric ? "yes" : "no") - << ", isolation=" << iso.value << endl; + + { + auto & ex = l1menu.thrExtraInfo().jJ(); + cout << " jJ" << endl; + cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl; + cout << " ptMinToTopoSmallWindow " << ex.ptMinToTopoSmall() << endl; + cout << " ptMinToTopoLargeWindow " << ex.ptMinToTopoLarge() << endl; + cout << " ptMinToTopoSmallWindow (MeV) " << ex.ptMinToTopoSmallMeV() << endl; + cout << " ptMinToTopoLargeWindow (MeV) " << ex.ptMinToTopoLargeMeV() << endl; + cout << " ptMinToTopoSmallWindow (counts) " << ex.ptMinToTopoSmallCounts() << endl; + cout << " ptMinToTopoLargeWindow (counts) " << ex.ptMinToTopoLargeCounts() << endl; } - cout << " working point Tight" << endl; - for(auto & iso : exeTAU.isolation(TrigConf::Isolation::WP::TIGHT)) { - cout << " range etaMin=" << iso.etaMin << ", etaMax=" << iso.etaMax - << ", priority=" << iso.priority << ", symmetric=" << (iso.symmetric ? "yes" : "no") - << ", isolation=" << iso.value << endl; + + { + auto & ex = l1menu.thrExtraInfo().eTAU(); + cout << " eTAU" << endl; + cout << " energy resolution (MeV) " << ex.resolutionMeV() << endl; + cout << " ptMinToTopo " << ex.ptMinToTopo() << endl; + cout << " ptMinToTopo (MeV) " << ex.ptMinToTopoMeV() << endl; + cout << " ptMinToTopo (counts)" << ex.ptMinToTopoCounts() << endl; + cout << " working point Loose" << endl; + for(auto & iso : ex.isolation(TrigConf::Isolation::WP::LOOSE)) { + cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax() + << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no") + << ", isolation=" << iso.value() << endl; + } + cout << " working point Medium" << endl; + for(auto & iso : ex.isolation(TrigConf::Isolation::WP::MEDIUM)) { + cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax() + << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no") + << ", isolation=" << iso.value() << endl; + } + cout << " working point Tight" << endl; + for(auto & iso : ex.isolation(TrigConf::Isolation::WP::TIGHT)) { + cout << " range etaMin=" << iso.etaMin() << ", etaMax=" << iso.etaMax() + << ", priority=" << iso.priority() << ", symmetric=" << (iso.symmetric() ? "yes" : "no") + << ", isolation=" << iso.value() << endl; + } } + auto & exMU = l1menu.thrExtraInfo().MU(); cout << " MU" << endl; cout << " known pt values for rpc "; diff --git a/Trigger/TrigCost/EnhancedBiasWeighter/EnhancedBiasWeighter/EnhancedBiasWeighter.h b/Trigger/TrigCost/EnhancedBiasWeighter/EnhancedBiasWeighter/EnhancedBiasWeighter.h index f051cde92806ec5c1261b24367092fff63d4f6ff..0715986c0a589b6cf446934f9cdec9f9a52aaca6 100644 --- a/Trigger/TrigCost/EnhancedBiasWeighter/EnhancedBiasWeighter/EnhancedBiasWeighter.h +++ b/Trigger/TrigCost/EnhancedBiasWeighter/EnhancedBiasWeighter/EnhancedBiasWeighter.h @@ -73,13 +73,20 @@ class EnhancedBiasWeighter: public asg::AsgTool, public virtual IEnhancedBiasWei /** * @return The amount of online walltime contributed by this event - * Fro data, this is based on the LB length and the number of events in the LB + * For data, this is based on the LB length and the number of events in the LB * For MC, this is fixed by the sample cross section, the inelastic cross section and the mu of the current event. * Retrieved from COOL and CVMFS XML or fetched from TRIG1 dAOD */ virtual double getEBLiveTime(const xAOD::EventInfo* eventInfo) const override; virtual double getEBLiveTime(const EventContext& context) const override; + /** + * @return The length of the current LB in seconds. Only for data + * Retrieved from COOL, only for data + */ + virtual double getLBLength(const xAOD::EventInfo* eventInfo) const override; + virtual double getLBLength(const EventContext& context) const override; + /** * @return the instantaneous luminosity for the current event in units of cm-2s-1. * For data, based on the current LB @@ -164,6 +171,7 @@ class EnhancedBiasWeighter: public asg::AsgTool, public virtual IEnhancedBiasWei ToolHandle<Trig::IBunchCrossingTool> m_bcTool; //!< Tool to get distance into bunch train Gaudi::Property<uint32_t> m_runNumber{this, "RunNumber", 0, "Run we're processing (if data), needed at initialize to locate and read in extra configuration."}; + Gaudi::Property<bool> m_errorOnMissingEBWeights{this, "ErrorOnMissingEBWeights", false, "If true, Throws error if EB weights are missing."}; Gaudi::Property<bool> m_calculateWeightingData{this, "CalculateWeightingData", true, "If true, read from COOL, CONDBR2 and XMLs. If false, read directly from decorated TRIG1 dAOD."}; Gaudi::Property<bool> m_enforceEBGRL{this, "EnforceEBGRL", true, "Each Enhanced Bias run has a 'good run list' style veto on some LB. If this flag is true, events in these LB get weight 0"}; Gaudi::Property<bool> m_useBunchCrossingTool{this, "UseBunchCrossingTool", true, "BunchCrossing tool requires CONDBR2 access. Can be disabled here if this is a problem."}; @@ -174,6 +182,7 @@ class EnhancedBiasWeighter: public asg::AsgTool, public virtual IEnhancedBiasWei Gaudi::Property<bool> m_mcIgnoreGeneratorWeights{this, "MCIgnoreGeneratorWeights", false, "If running over MC. Flag to ignore the generator weight."}; Gaudi::Property<double> m_inelasticCrossSection{this, "InelasticCrossSection", 8e-26, "Inelastic cross section in units cm^2. Default 80 mb at 13 TeV."}; + double m_deadtime; //!< Online deadtime to correct for in rate prediction. Currently a constant for the EB period uint32_t m_pairedBunches; //!< Online number of paired bunches. double m_mcModifiedCrossSection; //!< Product of xsec, filter & kfactor. In units of cm diff --git a/Trigger/TrigCost/EnhancedBiasWeighter/EnhancedBiasWeighter/IEnhancedBiasWeighter.h b/Trigger/TrigCost/EnhancedBiasWeighter/EnhancedBiasWeighter/IEnhancedBiasWeighter.h index 14bd03b9f36dd12ffd4738b426d2ae237abeb83d..2e5f0c6e1f61ceabb6f5f976991850e3e00d62e9 100644 --- a/Trigger/TrigCost/EnhancedBiasWeighter/EnhancedBiasWeighter/IEnhancedBiasWeighter.h +++ b/Trigger/TrigCost/EnhancedBiasWeighter/EnhancedBiasWeighter/IEnhancedBiasWeighter.h @@ -27,6 +27,8 @@ class IEnhancedBiasWeighter : public virtual DerivationFramework::IAugmentationT virtual double getEBLiveTime(const EventContext& context) const = 0; virtual double getLBLumi(const xAOD::EventInfo* eventInfo) const = 0; virtual double getLBLumi(const EventContext& context) const = 0; + virtual double getLBLength(const xAOD::EventInfo* eventInfo) const = 0; + virtual double getLBLength(const EventContext& context) const = 0; virtual double getAverageLumi() const = 0; virtual double getAverageMu() const = 0; virtual double getDeadtime() const = 0; diff --git a/Trigger/TrigCost/EnhancedBiasWeighter/Root/EnhancedBiasWeighter.cxx b/Trigger/TrigCost/EnhancedBiasWeighter/Root/EnhancedBiasWeighter.cxx index 67cce83579c800f784a904fcdfc01187b81ded00..37a3d29e16a1c43ded5c23be0df6285f186d21f6 100644 --- a/Trigger/TrigCost/EnhancedBiasWeighter/Root/EnhancedBiasWeighter.cxx +++ b/Trigger/TrigCost/EnhancedBiasWeighter/Root/EnhancedBiasWeighter.cxx @@ -86,16 +86,12 @@ StatusCode EnhancedBiasWeighter::loadWeights() // Construct name std::stringstream fileNameDev, fileName; const uint32_t runNumber = m_runNumber; // This is because Gaudi::Properties have special behaviour with the << operator - fileName << "TrigCostRootAnalysis/EnhancedBiasWeights_" << runNumber << ".xml"; - fileNameDev << "dev/TrigCostRootAnalysis/EnhancedBiasWeights_" << runNumber << ".xml"; + fileName << "TrigCostRootAnalysis/EnhancedBiasWeights_" << runNumber << ".xml"; std::string weightingFile = PathResolverFindCalibFile( fileName.str() ); // Check standard area if (weightingFile == "") { - weightingFile = PathResolverFindCalibFile( fileNameDev.str() ); // Else check DEV area - if (weightingFile == "") { - ATH_MSG_WARNING ("Could not retrieve " << fileName.str() << " or " << fileNameDev.str() << ", cannot perform enhanced bias weighting."); - return StatusCode::FAILURE; - } + msg() << (m_errorOnMissingEBWeights ? MSG::ERROR : MSG::WARNING) << "Could not retrieve " << fileName.str() << ", cannot perform enhanced bias weighting." << endmsg; + return (m_errorOnMissingEBWeights ? StatusCode::FAILURE : StatusCode::SUCCESS); } std::unique_ptr<TXMLEngine> xml(new TXMLEngine() ); @@ -167,16 +163,11 @@ StatusCode EnhancedBiasWeighter::loadLumi() // Construct name std::stringstream fileNameDev, fileName; fileName << "TrigCostRootAnalysis/enhanced_bias_run_" << runNumber << ".xml"; - fileNameDev << "dev/TrigCostRootAnalysis/enhanced_bias_run_" << runNumber << ".xml"; std::string runFile = PathResolverFindCalibFile( fileName.str() ); // Check standard area if (runFile == "") { - runFile = PathResolverFindCalibFile( fileNameDev.str() ); // Else check DEV area - } - - if (runFile == "") { - ATH_MSG_FATAL ("Could not retrieve " << fileName.str() << ", cannot perform enhanced bias weighting."); - return StatusCode::FAILURE; + msg() << (m_errorOnMissingEBWeights ? MSG::ERROR : MSG::WARNING) << "Could not retrieve " << fileName.str() << ", cannot perform enhanced bias weighting." << endmsg; + return (m_errorOnMissingEBWeights ? StatusCode::FAILURE : StatusCode::SUCCESS); } std::unique_ptr<TXMLEngine> xml(new TXMLEngine()); @@ -524,7 +515,9 @@ double EnhancedBiasWeighter::getEBLiveTime(const xAOD::EventInfo* eventInfo) con // Else calculate const auto mapIterator = m_eventsPerLB.find(lumiBlock); if (mapIterator == m_eventsPerLB.end() ) { - ATH_MSG_ERROR( "Couldn't find LB info for LB: " << lumiBlock ); + if (m_errorOnMissingEBWeights) { + ATH_MSG_ERROR( "Couldn't find LB info for LB: " << lumiBlock ); + } return 0; } const int32_t eventsInThisLB = mapIterator->second; @@ -568,8 +561,10 @@ double EnhancedBiasWeighter::getEBLiveTime(const EventContext& context) const // Else calculate const auto mapIterator = m_eventsPerLB.find(lumiBlock); if (mapIterator == m_eventsPerLB.end() ) { - ATH_MSG_ERROR( "Couldn't find LB info for LB: " << lumiBlock ); - return 0; + if (m_errorOnMissingEBWeights) { + ATH_MSG_ERROR( "Couldn't find LB info for LB: " << lumiBlock ); + } + return 0.; } const int32_t eventsInThisLB = mapIterator->second; const double lbLength = m_readLumiBlock.getLumiBlockLength(lumiBlock, msg()); @@ -590,6 +585,40 @@ double EnhancedBiasWeighter::getEBLiveTime(const EventContext& context) const } } +double EnhancedBiasWeighter::getLBLength(const xAOD::EventInfo* eventInfo) const { + if (m_calculateWeightingData) { + if (m_isMC) { + ATH_MSG_ERROR( "getLBLength Does not work for MC."); + return 0.; + } else { + uint32_t lumiBlock = eventInfo->lumiBlock(); + const double lbLength = m_readLumiBlock.getLumiBlockLength(lumiBlock, msg()); + return lbLength; + } // isData + } else { + ATH_MSG_ERROR( "getLBLength Requires CalculateWeightingData=True"); + return 0.; + } +} + + + +double EnhancedBiasWeighter::getLBLength(const EventContext& context) const { + if (m_calculateWeightingData) { + if (m_isMC) { + ATH_MSG_ERROR( "getLBLength Does not work for MC."); + return 0.; + } else { + uint32_t lumiBlock = context.eventID().lumi_block(); + const double lbLength = m_readLumiBlock.getLumiBlockLength(lumiBlock, msg()); + return lbLength; + } // isData + } else { + ATH_MSG_ERROR( "getLBLength Requires CalculateWeightingData=True"); + return 0.; + } +} + bool EnhancedBiasWeighter::isUnbiasedEvent(const xAOD::EventInfo* eventInfo) const { diff --git a/Trigger/TrigCost/EnhancedBiasWeighter/Root/ReadLumiBlock.cxx b/Trigger/TrigCost/EnhancedBiasWeighter/Root/ReadLumiBlock.cxx index 1b0cc8c5024587338c0243b4b9f6f43ac6e357da..3548eb16f297b4b2274a1764348b8b4bcddfb45b 100644 --- a/Trigger/TrigCost/EnhancedBiasWeighter/Root/ReadLumiBlock.cxx +++ b/Trigger/TrigCost/EnhancedBiasWeighter/Root/ReadLumiBlock.cxx @@ -105,7 +105,7 @@ float ReadLumiBlock::getLumiBlockLength(const uint32_t lb, MsgStream& msg) const if (m_lbLength.count(lb) != 1) { msg << MSG::INFO << "Unknown lumiblock number " << lb << endmsg; - return 0; + return 60.0; // Sensible default } return m_lbLength.at(lb) * 1e-9; // Convert from ns } diff --git a/Trigger/TrigCost/TrigCostAnalysis/CMakeLists.txt b/Trigger/TrigCost/TrigCostAnalysis/CMakeLists.txt index 5013d81be7b385d91be92910fca9c4f3179b7b70..a160364d3b812d725112aafc58b30b3332070de1 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/CMakeLists.txt +++ b/Trigger/TrigCost/TrigCostAnalysis/CMakeLists.txt @@ -22,7 +22,7 @@ find_package( Boost ) # Athena algorithm to do cost analysis and produce histograms atlas_add_component( TrigCostAnalysis src/*.cxx src/monitors/*.cxx src/counters/*.cxx src/components/TrigCostAnalysis_entries.cxx - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} GaudiKernel AthAnalysisBaseCompsLib TrigDecisionToolLib EnhancedBiasWeighterLib xAODEventInfo TrigConfData ) + PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} GaudiKernel AthAnalysisBaseCompsLib TrigDecisionToolLib EnhancedBiasWeighterLib xAODEventInfo PathResolver TrigConfData ) # Small helper library used by trigCostHistToCSV atlas_add_library( TrigCostAnalysisLib diff --git a/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructorBase.cxx b/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructorBase.cxx index 8534232a4d09589b7a893f29e450b5e1a6cab6b3..9a2bb154f6a4ce8ae13361f89def6168e7c872eb 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructorBase.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructorBase.cxx @@ -85,6 +85,10 @@ void TableConstructorBase::getHistograms(const std::string& name) { } if (!found) { msg() << MSG::ERROR << "Was not expecting histogram " << obj->GetName() << endmsg; + for (const TString exp : m_expectedHistograms) { + const TString expName = TString(name) + "_" + exp; + msg() << MSG::ERROR << " -- Expected " << expName << endmsg; + } } } else { msg() << MSG::ERROR << "Expecting only Histograms, found " << obj->GetName() << endmsg; diff --git a/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/AlgorithmTableConstructor.cxx b/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/AlgorithmTableConstructor.cxx index edcc6b243d269f8ee6ed5277f7ccea637757a77a..2aa8b1b5fe6df764396a7cc3d8842642dda05989 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/AlgorithmTableConstructor.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/AlgorithmTableConstructor.cxx @@ -13,7 +13,7 @@ AlgorithmTableConstructor::AlgorithmTableConstructor(const std::string& name) : addExpectedHistogram("Time_perEventFractional"); addExpectedHistogram("AlgCalls_perEvent"); - getBaseEntry().addColumn("name", "Name", "Algorithm's name"); + getBaseEntry().addColumn("name", "Name", "Algorithms name"); getBaseEntry().addColumn("events", "Raw Active Events", "Raw underlying statistics on number of events processed with the alg active"); getBaseEntry().addColumn("eventsWeighted", "Active Events", "Total weighted number of events with the alg active"); getBaseEntry().addColumn("callsPerEvent", "Calls/Event", "Mean number of alg calls in events with one or more calls"); @@ -31,18 +31,18 @@ TableEntry AlgorithmTableConstructor::getTableEntry(const std::string name) { TableEntry tableEntry(getBaseEntry()); getHistograms(name); - const float weightedEvents = hist("Time_perEvent")->Integral(); - const float weightedCalls = histGetXWeightedIntegral("AlgCalls_perEvent", false); + const float weightedEvents = hist("AlgCalls_perEvent")->Integral(); // Filled once per event with event weight + const float weightedCalls = histGetXWeightedIntegral("AlgCalls_perEvent", /*isLog*/ false); tableEntry.setEntry("name", name); - tableEntry.setEntry("events", hist("Time_perEvent")->GetEntries()); + tableEntry.setEntry("events", hist("AlgCalls_perEvent")->GetEntries()); tableEntry.setEntry("eventsWeighted", weightedEvents); tableEntry.setEntry("callsPerEvent", hist("AlgCalls_perEvent")->GetMean()); tableEntry.setEntry("callsSlow", hist("Time_perCall")->Integral( hist("Time_perCall")->FindBin(1000.), hist("Time_perCall")->GetNbinsX())); - tableEntry.setEntry("eventRate", weightedEvents); // Needs normalising - tableEntry.setEntry("callRate", weightedCalls); // Needs normalising - tableEntry.setEntry("totalTimeSec", histGetXWeightedIntegral("Time_perCall") * 1e-3); - tableEntry.setEntry("totalTimePerc", 0.0); // Needs post + tableEntry.setEntry("eventRate", weightedEvents); // Needs normalising in tablePostProcessing + tableEntry.setEntry("callRate", weightedCalls); // Needs normalising in tablePostProcessing + tableEntry.setEntry("totalTimeSec", histGetXWeightedIntegral("Time_perCall", /*isLog*/ true) * 1e-3); + //"totalTimePerc" is set in post tableEntry.setEntry("timePerCall", hist("Time_perCall")->GetMean()); tableEntry.setEntry("timePerEvent", hist("Time_perEvent")->GetMean()); diff --git a/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/GlobalTableConstructor.cxx b/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/GlobalTableConstructor.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1b09d3f090d00ba9fd803d2af06e2964d8191863 --- /dev/null +++ b/Trigger/TrigCost/TrigCostAnalysis/Root/TableConstructors/GlobalTableConstructor.cxx @@ -0,0 +1,61 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "../../TrigCostAnalysis/TableConstructors/GlobalTableConstructor.h" + +#include "TH1.h" + +GlobalTableConstructor::GlobalTableConstructor(const std::string& name) : TableConstructorBase(name) { + addExpectedHistogram("AlgTime_perEvent"); + addExpectedHistogram("AlgTime_perCall"); + addExpectedHistogram("AlgCalls_perEvent"); + addExpectedHistogram("SteeringTime_perEvent"); + addExpectedHistogram("LbLength"); + + getBaseEntry().addColumn("name", "Name", "Algorithms name"); + getBaseEntry().addColumn("lbLength", "Lumi Block Length [s]", "Length of this luminosity block or blocks"); + getBaseEntry().addColumn("events", "Raw Active Events", "Raw underlying statistics on number of events processed"); + getBaseEntry().addColumn("eventsWeighted", "Active Events", "Total weighted number of events processed"); + getBaseEntry().addColumn("callsPerEvent", "Alg Calls/Event", "Mean number of alg calls"); + getBaseEntry().addColumn("eventRate", "Event Rate [Hz]", "LB normalised rate of events in the HLT"); + getBaseEntry().addColumn("callRate", "Alg Call Rate [Hz]", "LB normalised rate of alg calls in events in the HLT"); + getBaseEntry().addColumn("steeringTime", "Total Steering Time [s]", "Total weighted integrated steering time"); + getBaseEntry().addColumn("steeringTimePerEvent", "Steering Time/Event [ms]", "Mean integrated steering time per event"); + getBaseEntry().addColumn("totalTimeSec", "Alg Total Time [s]", "Total weighted integrated walltime of all algs"); + getBaseEntry().addColumn("timePerCall", "Alg Time/Call [ms]", "Mean weighted alg time normalised to all alg calls"); + getBaseEntry().addColumn("timePerEvent", "Alg Time/Event [ms]", "Mean weighted alg time normalised to all events"); +} + + +TableEntry GlobalTableConstructor::getTableEntry(const std::string name) { + TableEntry tableEntry(getBaseEntry()); + getHistograms(name); + + const float weightedEvents = hist("SteeringTime_perEvent")->Integral(); // Filled once per event with event weight + const float weightedCalls = histGetXWeightedIntegral("AlgCalls_perEvent", /*isLog*/ false); + const float lbLength = hist("LbLength")->GetBinContent(1); + + tableEntry.setEntry("name", name); + tableEntry.setEntry("lbLength", lbLength); + tableEntry.setEntry("events", hist("SteeringTime_perEvent")->GetEntries()); + tableEntry.setEntry("eventsWeighted", weightedEvents); + + tableEntry.setEntry("callsPerEvent", hist("AlgCalls_perEvent")->GetMean()); + + tableEntry.setEntry("eventRate", weightedEvents / lbLength); + tableEntry.setEntry("callRate", weightedCalls / lbLength); + + tableEntry.setEntry("steeringTime", histGetXWeightedIntegral("SteeringTime_perEvent", /*isLog*/ true) * 1e-3); + tableEntry.setEntry("steeringTimePerEvent", hist("SteeringTime_perEvent")->GetMean()); + + tableEntry.setEntry("totalTimeSec", histGetXWeightedIntegral("AlgTime_perEvent", /*isLog*/ true) * 1e-3); + tableEntry.setEntry("timePerCall", hist("AlgTime_perCall")->GetMean()); + tableEntry.setEntry("timePerEvent", hist("AlgTime_perEvent")->GetMean()); + + return tableEntry; +} + +void GlobalTableConstructor::tablePostProcessing(std::vector<TableEntry>&, const float) { +} + diff --git a/Trigger/TrigCost/TrigCostAnalysis/Root/TableEntry.cxx b/Trigger/TrigCost/TrigCostAnalysis/Root/TableEntry.cxx index 76ba2954552d1d45b9628bf8c6c6a6ff55a8badf..b49ab749176baf2f4dfe52442b05247d1e6d8792 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/Root/TableEntry.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/Root/TableEntry.cxx @@ -34,9 +34,15 @@ void TableEntry::normaliseEntry(const std::string& name, const float denominator void TableEntry::addColumn(const std::string& name, const std::string& header, const std::string& tooltip) { - m_columnName.push_back(name); - m_columnHeader.push_back(header); - m_columnTooltip.push_back(tooltip); + std::string nameCopy(name); + std::string headerCopy(header); + std::string tooltipCopy(tooltip); + nameCopy.erase(std::remove(nameCopy.begin(), nameCopy.end(), '\''), nameCopy.end()); + headerCopy.erase(std::remove(headerCopy.begin(), headerCopy.end(), '\''), headerCopy.end()); + tooltipCopy.erase(std::remove(tooltipCopy.begin(), tooltipCopy.end(), '\''), tooltipCopy.end()); + m_columnName.push_back(nameCopy); + m_columnHeader.push_back(headerCopy); + m_columnTooltip.push_back(tooltipCopy); } diff --git a/Trigger/TrigCost/TrigCostAnalysis/TrigCostAnalysis/TableConstructors/GlobalTableConstructor.h b/Trigger/TrigCost/TrigCostAnalysis/TrigCostAnalysis/TableConstructors/GlobalTableConstructor.h new file mode 100644 index 0000000000000000000000000000000000000000..1e07aafb07f7a2165704b4c8286ac8333d5c43d7 --- /dev/null +++ b/Trigger/TrigCost/TrigCostAnalysis/TrigCostAnalysis/TableConstructors/GlobalTableConstructor.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGCOSTANALYSIS_GLOBALTABLECONSTRUCTOR_H +#define TRIGCOSTANALYSIS_GLOBALTABLECONSTRUCTOR_H 1 + +#include "../TableConstructorBase.h" + +/** + * @class TableConstructorBase + * @brief Construct a CSV table to process the output of a MonitorGlobal + */ +class GlobalTableConstructor : public TableConstructorBase { + public: + /** + * @brief Construct GlobalTableConstructor. + * @param[in] name GlobalTableConstructor's name + */ + GlobalTableConstructor(const std::string& name); + + /** + * @brief Default destructor + */ + virtual ~GlobalTableConstructor() = default; + + protected: + + /** + * @brief Get TableEntry for a Global counter equating to a LB or a range of LB + * @param[in] name Name of LB TDirectory to generate a TableEntry. + * @return TableEntry populated with a row of data for the given TDirectory. + */ + virtual TableEntry getTableEntry(const std::string name) override; + + /** + * @brief Post-processing. Note - not used for this table. + * @param[in,out] tableEntry Mutable vector of TableEntries, each corresponding to a row in the table. + * @param[in] walltime Normalisation parameter. + */ + virtual void tablePostProcessing(std::vector<TableEntry>& tableEntries, const float walltime) override; + +}; + +#endif // TRIGCOSTANALYSIS_GLOBALTABLECONSTRUCTOR_H diff --git a/Trigger/TrigCost/TrigCostAnalysis/share/TrigCostAnalysis_JobOptions.py b/Trigger/TrigCost/TrigCostAnalysis/share/TrigCostAnalysis_JobOptions.py index 1ab28fb21efe52b855b3e77019c951357b34cf28..8451c26f70b0202152cc78b178b53e15f0f00cc9 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/share/TrigCostAnalysis_JobOptions.py +++ b/Trigger/TrigCost/TrigCostAnalysis/share/TrigCostAnalysis_JobOptions.py @@ -9,7 +9,14 @@ from AthenaCommon.AlgSequence import AlgSequence, AthSequencer topSequence = AlgSequence() from AthenaConfiguration.AllConfigFlags import ConfigFlags -ConfigFlags.Input.Files = ["/eos/atlas/atlascerngroupdisk/trig-daq/validation/test_data/data20_test/data_test.00374861.calibration_CostMonitoring.daq.RAW/data_test.00374861.calibration_CostMonitoring.daq.RAW._lb0000._SFO-1._0001.data"] +ConfigFlags.Input.Files = [\ +"/eos/atlas/atlascerngroupdisk/trig-daq/validation/test_data/data20_test/data_test.00379158.calibration_CostMonitoring.daq.RAW/data_test.00379158.calibration_CostMonitoring.daq.RAW._lb0000._SFO-1._0001.data",\ +"/eos/atlas/atlascerngroupdisk/trig-daq/validation/test_data/data20_test/data_test.00379158.calibration_CostMonitoring.daq.RAW/data_test.00379158.calibration_CostMonitoring.daq.RAW._lb0000._SFO-2._0001.data",\ +"/eos/atlas/atlascerngroupdisk/trig-daq/validation/test_data/data20_test/data_test.00379158.calibration_CostMonitoring.daq.RAW/data_test.00379158.calibration_CostMonitoring.daq.RAW._lb0000._SFO-3._0001.data",\ +"/eos/atlas/atlascerngroupdisk/trig-daq/validation/test_data/data20_test/data_test.00379158.calibration_CostMonitoring.daq.RAW/data_test.00379158.calibration_CostMonitoring.daq.RAW._lb0000._SFO-4._0001.data",\ +"/eos/atlas/atlascerngroupdisk/trig-daq/validation/test_data/data20_test/data_test.00379158.calibration_CostMonitoring.daq.RAW/data_test.00379158.calibration_CostMonitoring.daq.RAW._lb0000._SFO-5._0001.data",\ +"/eos/atlas/atlascerngroupdisk/trig-daq/validation/test_data/data20_test/data_test.00379158.calibration_CostMonitoring.daq.RAW/data_test.00379158.calibration_CostMonitoring.daq.RAW._lb0000._SFO-6._0001.data"\ +] # Use new-style config of ByteStream reading and import here into old-style JO from AthenaConfiguration.ComponentAccumulator import CAtoGlobalWrapper @@ -40,23 +47,25 @@ hltConfigSvc = TrigConf__HLTConfigSvc( "HLTConfigSvc" ) hltConfigSvc.ConfigSource = "None" hltConfigSvc.XMLMenuFile = "None" hltConfigSvc.InputType = "file" -hltConfigSvc.JsonFileName = "HLTMenu_PhysicsP1_pp_run3_v1_22.0.10.json" +hltConfigSvc.JsonFileName = "HLTMenu_9.json" theApp.CreateSvc += [ "TrigConf::HLTConfigSvc/HLTConfigSvc" ] ServiceMgr += hltConfigSvc # Cost Monitoring from EnhancedBiasWeighter.EnhancedBiasWeighterConf import EnhancedBiasWeighter enhancedBiasWeighter = EnhancedBiasWeighter() -enhancedBiasWeighter.RunNumber = 360026 +enhancedBiasWeighter.RunNumber = 379158 enhancedBiasWeighter.UseBunchCrossingTool = False from AthenaCommon import CfgMgr trigCostAnalysis = CfgMgr.TrigCostAnalysis() trigCostAnalysis.OutputLevel = DEBUG trigCostAnalysis.RootStreamName = "COSTSTREAM" -trigCostAnalysis.BaseEventWeight = 1.0 +trigCostAnalysis.BaseEventWeight = 10.0 trigCostAnalysis.EnhancedBiasTool = enhancedBiasWeighter trigCostAnalysis.UseEBWeights = False +trigCostAnalysis.MaxFullEventDumps = 100 +trigCostAnalysis.FullEventDumpProbability = 1 # X. Where probability is 1 in X topSequence += trigCostAnalysis from AthenaCommon.AppMgr import ServiceMgr as svcMgr diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/CostData.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/CostData.cxx index 96c20eaf98e5bea41fa58e48999965c3be8ebddc..acb81d5348db7b6045ba0bb52453cc2dbed2e56b 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/CostData.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/CostData.cxx @@ -9,12 +9,17 @@ CostData::CostData() : m_costCollection(nullptr), m_algTotalTime(0.), - m_eventLiveTime(1.) { + m_liveTime(1.), + m_lb(0), + m_slot(0), + m_liveTimeIsPerEvent(false), + m_typeMapPtr(nullptr) { } -StatusCode CostData::set(const xAOD::TrigCompositeContainer* costCollection) { +StatusCode CostData::set(const xAOD::TrigCompositeContainer* costCollection, uint32_t onlineSlot) { m_costCollection = costCollection; + setOnlineSlot( onlineSlot ); ATH_CHECK(cache()); return StatusCode::SUCCESS; } @@ -22,14 +27,30 @@ StatusCode CostData::set(const xAOD::TrigCompositeContainer* costCollection) { StatusCode CostData::cache() { for (const xAOD::TrigComposite* tc : costCollection()) { + if (tc->getDetail<uint32_t>("slot") != onlineSlot()) { + continue; // When monitoring the master slot, ignores algs running in different slots + } m_algTotalTime += (tc->getDetail<uint64_t>("stop") - tc->getDetail<uint64_t>("start")); } return StatusCode::SUCCESS; } +void CostData::setLb(uint32_t lb) { + m_lb = lb; +} + +void CostData::setOnlineSlot(uint32_t slot) { + m_slot = slot; +} -void CostData::setEventLivetime(float time) { - m_eventLiveTime = time; +void CostData::setLivetime(float time, bool liveTimeIsPerEvent) { + m_liveTime = time; + m_liveTimeIsPerEvent = liveTimeIsPerEvent; +} + + +bool CostData::liveTimeIsPerEvent() const { + return m_liveTimeIsPerEvent; } @@ -45,8 +66,37 @@ float CostData::algTotalTimeMilliSec() const { return m_algTotalTime * 1e-3; // microseconds to milliseconds } +uint32_t CostData::lb() const { + return m_lb; +} + +uint32_t CostData::onlineSlot() const { + return m_slot; +} + +bool CostData::isMasterSlot() const { + return (onlineSlot() == 0); +} + -float CostData::eventLiveTime() const { - return m_eventLiveTime; +float CostData::liveTime() const { + return m_liveTime; } + +const std::string& CostData::algNameToClassType(size_t algNameHash) const { + const static std::string unknown = "UNKNOWN_CLASS"; + if (m_typeMapPtr == nullptr) { + return unknown; + } + const auto it = m_typeMapPtr->find(algNameHash); + if (it == m_typeMapPtr->end()) { + return unknown; + } + return it->second; +} + + +void CostData::setTypeMap( const std::unordered_map<uint32_t, std::string>& typeMap ) { + m_typeMapPtr = &typeMap; +} \ No newline at end of file diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/CostData.h b/Trigger/TrigCost/TrigCostAnalysis/src/CostData.h index 002c05ee77bf9be08fb6d448bcac72a5be9cfa35..c8d2213a089395008657aa88a34952809cf34ac3 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/CostData.h +++ b/Trigger/TrigCost/TrigCostAnalysis/src/CostData.h @@ -41,7 +41,7 @@ class CostData { /** * @brief Cache the cost collection, after formally requesting it from storegate. */ - StatusCode set(const xAOD::TrigCompositeContainer* costCollection); + StatusCode set(const xAOD::TrigCompositeContainer* costCollection, uint32_t onlineSlot); /** * @brief Getter of the cached algorithm cost collection pointer. @@ -51,22 +51,65 @@ class CostData { /** * @brief Setter of effective P1 walltime represented by the current event. */ - void setEventLivetime(float time); + void setLb(uint32_t lb); /** - * @brief Getter of effective P1 walltime represented by the current event. + * @brief Setter of the online Slot number of the current event. + */ + void setOnlineSlot(uint32_t slot); + + /** + * @brief Setter of effective P1 walltime represented by the current event, or the current lumi block. As specified by the second parameter + */ + void setLivetime(float time, bool liveTimeIsPerEvent); + + /** + * @brief Getter of effective P1 walltime represented by either the current event, or the current lumi block. + * @return Walltime in seconds. + */ + float liveTime() const; + + /** + * @brief If a call to liveTime() is providing data on a single event or a whole LB * @return Walltime in seconds. */ - float eventLiveTime() const; + bool liveTimeIsPerEvent() const; + + /** + * @brief Current luminosity block number + * @return Luminosity block number. + */ + uint32_t lb() const; + + /** + * @return Online slot number + */ + uint32_t onlineSlot() const; + + /** + * @return True if event was processed in the master slot (0), and hence contains cost data spanning all concurrent slots + */ + bool isMasterSlot() const; /** * @brief Getter of the total algorithm CPU time in the event. * @return Total CPU time in milliseconds. */ float algTotalTimeMilliSec() const; - + /** + * @brief Get the class typename given an algorithm instance name. Name is supplied in serialised hashed form. + * @return Total CPU time in milliseconds. + */ + const std::string& algNameToClassType(size_t algNameHash) const; + + /** + * @brief Set internal type map pointer + * @return Total CPU time in milliseconds. + */ + void setTypeMap( const std::unordered_map<uint32_t, std::string>& typeMap ); + private: /** @@ -77,7 +120,11 @@ class CostData { const xAOD::TrigCompositeContainer* m_costCollection; //!< Cached non-owning pointer to main algorithm cost collection. uint64_t m_algTotalTime; //!< Integrated CPU time of all algorithms in the event. Stored in discrete microseconds. - float m_eventLiveTime; //!< Effective P1 walltime of the event, in seconds. + float m_liveTime; //!< Effective walltime of either the event or the LB, in seconds (@see m_liveTimeIsPerEvent). + uint32_t m_lb; //!< Current luminosity block number + uint32_t m_slot; //!< Current online slot number + bool m_liveTimeIsPerEvent; //!< If the livetime represents a single event of all of the current LB + const std::unordered_map<uint32_t, std::string>* m_typeMapPtr; //!< Cached non-owning pointer mapping algorithm instance names to types }; #endif // TRIGCOSTANALYSIS_COSTDATA_H diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/CounterBase.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/CounterBase.cxx index f0e6a30296a8d4de085e0b8a29ff9f56cf72532d..e7eb273c258d1e62915882164f62735dd4824b1b 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/CounterBase.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/CounterBase.cxx @@ -2,6 +2,7 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ +#include "MonitoredRange.h" #include "MonitorBase.h" #include "CounterBase.h" #include "TH1F.h" @@ -29,7 +30,7 @@ void CounterBase::regHistogram(const std::string& name, const float max, const size_t bins) { - std::string hisSvcName = getName() + "_" + name; + std::string hisSvcName = getParent()->getParent()->getName() + "_" + getParent()->getName() + "_" + getName() + "_" + name; std::unique_ptr<TH1F> hist; if (max <= min || bins == 0) { @@ -97,7 +98,7 @@ StatusCode CounterBase::increment(const std::string& name, float weight) { } -StatusCode CounterBase::endEvent() { +StatusCode CounterBase::endEvent(float) { for (auto& nameVariablePair : m_variables) { ATH_CHECK( nameVariablePair.second.endEvent() ); } @@ -116,6 +117,9 @@ TH1* CounterBase::bookGetPointer(TH1* hist, const std::string& tDir) const { float CounterBase::timeToMilliSec(const uint64_t start, const uint64_t stop) const { + if (stop < start) { + throw std::runtime_error("Asked for a stop time " + std::to_string(stop) + " which is before the start time " + std::to_string(start)); + } const uint64_t difference = stop - start; return (difference * 1e-3); // micro to ms } diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/CounterBase.h b/Trigger/TrigCost/TrigCostAnalysis/src/CounterBase.h index 7d8c2e9f3a773324117d591e59973fba39549010..72f9d826aed59f9a05ae64e1250d6a2fca1027f1 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/CounterBase.h +++ b/Trigger/TrigCost/TrigCostAnalysis/src/CounterBase.h @@ -96,7 +96,7 @@ class CounterBase { /** * @brief Called by the framework. Causes per-Event Variables to fill their histograms with their accumulated data. */ - StatusCode endEvent(); + virtual StatusCode endEvent(float weight = 1.0); /** * @brief Pure virtual interface called by Monitor to instruct this Counter to perform its analysis @@ -104,7 +104,7 @@ class CounterBase { * @param[in] index Index within appropriate event data container which is to be analysed by this Counter * @param[in] weight Global event weight */ - virtual StatusCode newEvent(const CostData& data, size_t index, const float weight = 1.) = 0; + virtual StatusCode newEvent(const CostData& data, size_t index, float weight = 1.0) = 0; protected: diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.cxx index 2ea77a9f4491639c6ed8c6f94673d26f9ed4f6c1..6865e01caafba03d97276f479e6f7de7ba04534b 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.cxx @@ -9,17 +9,20 @@ MonitorBase::MonitorBase(const std::string& name, const MonitoredRange* parent) : m_name(name), m_parent(parent) { } + const std::string& MonitorBase::getName() const { return m_name; } + const MonitoredRange* MonitorBase::getParent() const { return m_parent; } -StatusCode MonitorBase::endEvent() { + +StatusCode MonitorBase::endEvent(float weight) { for (auto& nameCounterPair : m_counters ) { - ATH_CHECK( nameCounterPair.second->endEvent() ); + ATH_CHECK( nameCounterPair.second->endEvent(weight) ); } return StatusCode::SUCCESS; } @@ -35,6 +38,11 @@ TH1* MonitorBase::bookGetPointer(TH1* hist, const std::string& tDir) const { } +bool MonitorBase::counterExists(const std::string& name) const { + return (m_counters.count(name) == 1); +} + + CounterBase* MonitorBase::getCounter(const std::string& name) { auto it = m_counters.find(name); if (it != m_counters.end()) { diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.h b/Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.h index 21a0650e76694dd8a2c398af7a7e06f92ec97b9a..19563840b59f5d0e6812f8e625215d31aeafc892 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.h +++ b/Trigger/TrigCost/TrigCostAnalysis/src/MonitorBase.h @@ -76,6 +76,13 @@ class MonitorBase{ */ TH1* bookGetPointer(TH1* hist, const std::string& tDir = "") const; + /** + * @brief Check if a counter of a given name exists. + * @param[in] name Name of Counter. + * @return True if counter already exists. + */ + bool counterExists(const std::string& name) const; + /** * @brief Retrieve counter by name. If no such counter exists, a new one will be instanced and returned. * @param[in] name Name of Counter. @@ -88,12 +95,12 @@ class MonitorBase{ * @param[in] data Access to event data * @param[in] weight Global event weight */ - virtual StatusCode newEvent(const CostData& data, const float weight = 1.) = 0; + virtual StatusCode newEvent(const CostData& data, float weight = 1.) = 0; /** * @brief Called by the framework. Causes per-Event Variables to fill their histograms with their accumulated data. */ - StatusCode endEvent(); + virtual StatusCode endEvent(float weight = 1.); protected: @@ -105,11 +112,12 @@ class MonitorBase{ */ virtual std::unique_ptr<CounterBase> newCounter(const std::string& name) = 0; + std::unordered_map< std::string, std::unique_ptr<CounterBase> > m_counters; //!< Storage of Monitor's collection of Counters. Keyed by name. + private: const std::string m_name; //!< Monitor's name const MonitoredRange* m_parent; //!< Monitor's parent Range. Cached non-owning const ptr. - std::unordered_map< std::string, std::unique_ptr<CounterBase> > m_counters; //!< Storage of Monitor's collection of Counters. Keyed by name. }; diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/MonitoredRange.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/MonitoredRange.cxx index bec080a7ce27ad4144616c1125995303cb965cd5..12e076e71669832ba986cbf0b21e8a0d26ffa1f2 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/MonitoredRange.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/MonitoredRange.cxx @@ -10,7 +10,8 @@ MonitoredRange::MonitoredRange(const std::string& name, TrigCostAnalysis* parent m_name(name), m_parent(parent), m_cachedLifetimeHistPtr(nullptr), - m_monitors() + m_monitors(), + m_seenLB() { std::string hisSvcName = getName() + "_walltime"; std::unique_ptr<TH1F> hist = std::make_unique<TH1F>(hisSvcName.c_str(), "Walltime;;Seconds", 1, -.5, .5); @@ -52,9 +53,18 @@ StatusCode MonitoredRange::addMonitor(std::unique_ptr<MonitorBase> monitor) { StatusCode MonitoredRange::newEvent(const CostData& data, const float weight) { for (auto& monitor : getMonitors()) { ATH_CHECK(monitor->newEvent(data, weight)); - ATH_CHECK(monitor->endEvent()); + ATH_CHECK(monitor->endEvent(weight)); } ATH_CHECK(m_cachedLifetimeHistPtr != nullptr); - m_cachedLifetimeHistPtr->Fill(0., data.eventLiveTime()); + const bool isNewLB = m_seenLB.insert( data.lb() ).second; // .second is true if a new element was inserted + if (data.liveTimeIsPerEvent() or isNewLB) { + // We have two modes of operation. Either we process an EnhancedBias file where we know exactly how many events to expect + // and can hence fill a per-event live time (meaning that the normalisation is correct, even if we do not run over all events). + // For this case we increment this bin for event event this monitor sees. + // Or, we can process P1 data where we only know the LB length and must assume that all events are collected and processed, + // otherwise the normalisation will be off. For this case we increment this one for every unique LB this monitor sees. + m_cachedLifetimeHistPtr->Fill(0., data.liveTime()); + } + return StatusCode::SUCCESS; } diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/MonitoredRange.h b/Trigger/TrigCost/TrigCostAnalysis/src/MonitoredRange.h index 944abc4dcc213f47571c442abafb422a2f72b588..4bcbdc8434d04b69802c006ac1aa47989d6f0bfc 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/MonitoredRange.h +++ b/Trigger/TrigCost/TrigCostAnalysis/src/MonitoredRange.h @@ -102,6 +102,7 @@ class MonitoredRange{ TrigCostAnalysis* m_parent; //!< Cached ptr to the parent Athena algorithm TH1* m_cachedLifetimeHistPtr; //!< Cached histogram ptr used to store normalisation quantities. std::set< std::unique_ptr<MonitorBase> > m_monitors; //!< Storage of Range's Monitors. Keyed by Monitor's name. + std::set< uint32_t > m_seenLB; //!< Luminosity blocks for which we have seen at least one event }; diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.cxx index 2f1a9b836948e1c3ab5d1b506ad6f85dd8ad4aeb..1d78d0fd65fcb1a83b02f727d684bbe55c8016a2 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.cxx @@ -5,10 +5,15 @@ #include "GaudiKernel/ThreadLocalContext.h" #include "TrigConfHLTData/HLTUtils.h" +#include "PathResolver/PathResolver.h" + #include "TrigCostAnalysis.h" #include "CostData.h" #include "monitors/MonitorAlgorithm.h" +#include "monitors/MonitorAlgorithmClass.h" +#include "monitors/MonitorGlobal.h" +#include "monitors/MonitorThreadOccupancy.h" TrigCostAnalysis::TrigCostAnalysis( const std::string& name, ISvcLocator* pSvcLocator ) : AthHistogramAlgorithm(name, pSvcLocator), @@ -35,8 +40,14 @@ StatusCode TrigCostAnalysis::initialize() { } ATH_CHECK( m_TimeRangeLengthLB > 0 ); - if (m_hashDictionaryFromFile) { - TrigConf::HLTUtils::file2hashes(); + + if (not m_additionalHashMap.empty()) { + std::string hashFile = PathResolverFindCalibFile( m_additionalHashMap ); + if (hashFile.empty()) { + ATH_MSG_WARNING("Could not retrieve " << m_additionalHashMap << ", won't load additional hash maps."); + } else { + TrigConf::HLTUtils::file2hashes(hashFile); + } } return StatusCode::SUCCESS; @@ -57,8 +68,11 @@ StatusCode TrigCostAnalysis::start() { for (const auto& alg : sequencer.second) { // Data stored in Gaudi format of "AlgClassType/AlgInstanceName" size_t breakPoint = alg.second.data().find("/"); - const std::string algType = alg.second.data().substr(0, breakPoint); + std::string algType = alg.second.data().substr(0, breakPoint); const std::string algName = alg.second.data().substr(breakPoint+1, alg.second.data().size()); + while(algType.find(":") != std::string::npos) { + algType.replace(algType.find(":"), 1, "_"); + } m_algTypeMap[ TrigConf::HLTUtils::string2hash(algName, "ALG") ] = algType; ATH_MSG_VERBOSE("AlgType:" << algType << ", AlgName:" << algName ); if (algType.find("EventViewCreatorAlgorithm") != std::string::npos) { @@ -123,24 +137,31 @@ StatusCode TrigCostAnalysis::execute() { ATH_MSG_DEBUG("Not monitoring event"); return StatusCode::SUCCESS; - } else { + } - ATH_MSG_DEBUG("Monitoring event " << context.eventID().event_number() << " in range " << range->getName()); - - SG::ReadHandle<xAOD::TrigCompositeContainer> costDataHandle(m_costDataKey, context); - ATH_CHECK( costDataHandle.isValid() ); + ATH_MSG_DEBUG("Monitoring event " << context.eventID().event_number() << " in LB " << context.eventID().lumi_block() << " in range " << range->getName()); + + SG::ReadHandle<xAOD::TrigCompositeContainer> costDataHandle(m_costDataKey, context); + ATH_CHECK( costDataHandle.isValid() ); - CostData costData; - ATH_CHECK( costData.set(costDataHandle.get()) ); - if (!m_enhancedBiasTool.name().empty()) { - costData.setEventLivetime( m_enhancedBiasTool->getEBLiveTime(context) ); + const uint32_t onlineSlot = getOnlineSlot( costDataHandle.get() ); + CostData costData; + ATH_CHECK( costData.set(costDataHandle.get(), onlineSlot) ); + costData.setLb( context.eventID().lumi_block() ); + costData.setTypeMap( m_algTypeMap ); + if (!m_enhancedBiasTool.name().empty()) { + double liveTime = m_enhancedBiasTool->getEBLiveTime(context); + bool liveTimeIsPerEvent = true; + if (liveTime == 0.0) { // Note: This comes from a direct "return 0.", hence no delta + liveTime = m_enhancedBiasTool->getLBLength(context); + liveTimeIsPerEvent = false; } - - ATH_CHECK( range->newEvent( costData, getWeight(context) ) ); - + costData.setLivetime( liveTime, liveTimeIsPerEvent ); } - if (checkDoFullEventDump(context)) { + ATH_CHECK( range->newEvent( costData, getWeight(context) ) ); + + if (checkDoFullEventDump(context, costData)) { ATH_CHECK( dumpEvent(context) ); } @@ -148,18 +169,13 @@ StatusCode TrigCostAnalysis::execute() { } -bool TrigCostAnalysis::checkDoFullEventDump(const EventContext& context) { - if (m_fullEventDumps < m_maxFullEventDumps) { - const uint64_t start = context.eventID().event_number() - m_fullEventDumpExtraTimeSlices; - const uint64_t stop = context.eventID().event_number() + m_fullEventDumpExtraTimeSlices; - for (uint64_t i = start; i <= stop; ++i ) { - if (i % m_fullEventDumpProbability == 0) { - if (i == context.eventID().event_number()) { - ++m_fullEventDumps; - } - return true; - } - } +bool TrigCostAnalysis::checkDoFullEventDump(const EventContext& context, const CostData& costData) { + if (costData.isMasterSlot() + and m_fullEventDumps < m_maxFullEventDumps + and context.eventID().event_number() % m_fullEventDumpProbability == 0) + { + ++m_fullEventDumps; + return true; } return false; } @@ -168,10 +184,21 @@ bool TrigCostAnalysis::checkDoFullEventDump(const EventContext& context) { StatusCode TrigCostAnalysis::registerMonitors(MonitoredRange* range) { ATH_CHECK(range != nullptr); if (m_doMonitorAlgorithm) { - std::unique_ptr<MonitorAlgorithm> monitor = std::make_unique<MonitorAlgorithm>("Algorithm_HLT", range); - ATH_CHECK( range->addMonitor(std::move(monitor)) ); + ATH_CHECK( range->addMonitor(std::make_unique<MonitorAlgorithm>("Algorithm_HLT", range)) ); ATH_MSG_DEBUG("Registering Algorithm_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size()); } + if (m_doMonitorAlgorithmClass) { + ATH_CHECK( range->addMonitor(std::make_unique<MonitorAlgorithmClass>("Algorithm_Class_HLT", range)) ); + ATH_MSG_DEBUG("Registering Algorithm_Class_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size()); + } + if (m_doMonitorGlobal) { + ATH_CHECK( range->addMonitor(std::make_unique<MonitorGlobal>("Global_HLT", range)) ); + ATH_MSG_DEBUG("Registering Global_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size()); + } + if (m_doMonitorThreadOccupancy) { + ATH_CHECK( range->addMonitor(std::make_unique<MonitorThreadOccupancy>("Thread_Occupancy_HLT", range)) ); + ATH_MSG_DEBUG("Registering Thread_Occupancy_HLT Monitor for range " << range->getName() << ". Size:" << range->getMonitors().size()); + } // if (m_do...) {} return StatusCode::SUCCESS; } @@ -199,8 +226,6 @@ StatusCode TrigCostAnalysis::getRange(const EventContext& context, MonitoredRang std::unordered_map<std::string, std::unique_ptr<MonitoredRange>>::iterator it; it = m_monitoredRanges.find(rangeName); - ATH_MSG_DEBUG("Event's range string is:" << rangeName << ". Already exists? " << (it != m_monitoredRanges.end() ? "Y" : "N")); - // If we don't have a MonitoredRange with this name, try and make one. if (it == m_monitoredRanges.end()) { if (m_monitoredRanges.size() < m_maxTimeRange) { @@ -219,14 +244,32 @@ StatusCode TrigCostAnalysis::getRange(const EventContext& context, MonitoredRang return StatusCode::SUCCESS; } +uint32_t TrigCostAnalysis::getOnlineSlot(const xAOD::TrigCompositeContainer* costCollection) const { + // Online, Slot 0 can be configured as the master-slot. In this mode, events in Slot 0 + // hoover up data about algorithm executions in other slots too. + // This all-slots data stored in the master slot is exploited by dumpEvent, and some specialist monitors. + // Other monitors will want to avoid it for fear of double-counting + if (costCollection->size() == 0) { + return 0; + } + const uint32_t initialSlot = costCollection->at(0)->getDetail<uint32_t>("slot"); + for ( const xAOD::TrigComposite* tc : *costCollection ) { + const uint32_t algSlot = tc->getDetail<uint32_t>("slot"); + if (algSlot == 0 or algSlot != initialSlot) { + return 0; // If we see a zero, or two different slot numbers, then we're in the master slot + } + } + // If we saw exclusivly one non-zero slot, then we're in that slot + return initialSlot; +} + StatusCode TrigCostAnalysis::dumpEvent(const EventContext& context) const { ++m_fullEventDumps; SG::ReadHandle<xAOD::TrigCompositeContainer> costDataHandle(m_costDataKey, context); std::stringstream ss; - size_t algID = 0, threadCounter = 0; - std::unordered_map<uint32_t, size_t> threadToCounterMap; + size_t algID = 0; for ( const xAOD::TrigComposite* tc : *costDataHandle ) { const uint64_t start = tc->getDetail<uint64_t>("start"); // in mus @@ -234,14 +277,10 @@ StatusCode TrigCostAnalysis::dumpEvent(const EventContext& context) const { const uint32_t slot = tc->getDetail<uint32_t>("slot"); const uint64_t start_ms_round = std::llround( start * 1e-3 ); // in ms const uint64_t stop_ms_round = std::llround( stop * 1e-3 ); // in ms - const uint32_t threadID = tc->getDetail<uint32_t>("thread"); - if (threadToCounterMap.count(threadID) == 0) { - threadToCounterMap[threadID] = threadCounter++; - } ss << "{id:" << algID++; - ss << ", group:" << threadToCounterMap[threadID]; + ss << ", group:" << threadID; ss << ", className:'slot" << slot << "'"; ss << ", content:'" << TrigConf::HLTUtils::hash2string( tc->getDetail<TrigConf::HLTHash>("alg"), "ALG"); ss << "<br>" << TrigConf::HLTUtils::hash2string( tc->getDetail<TrigConf::HLTHash>("store"), "STORE") << "'"; diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.h b/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.h index 930ba471b8337c5503fea1aecece55c80885f24b..e822a37cde1cff443e9714e68d3e3ed2e808bc3b 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.h +++ b/Trigger/TrigCost/TrigCostAnalysis/src/TrigCostAnalysis.h @@ -75,6 +75,9 @@ class TrigCostAnalysis: public ::AthHistogramAlgorithm { Gaudi::Property<std::string> m_singleTimeRangeName { this, "SingleTimeRangeName", "All", "Name for single time range" }; + Gaudi::Property<std::string> m_additionalHashMap { this, "AdditionalHashMap", "TrigCostRootAnalysis/hashes2string_08072020.txt", + "Used to load strings corresponding to algorithms which are not explicitly scheduled by chains. To be updated periodically." }; + Gaudi::Property<size_t> m_TimeRangeLengthLB { this, "TimeRangeLengthLB", 50, "Length of each variable length Time Range in LB" }; @@ -82,24 +85,26 @@ class TrigCostAnalysis: public ::AthHistogramAlgorithm { "Maximum number of allowed time ranges" }; Gaudi::Property<bool> m_doMonitorAlgorithm { this, "DoMonitorAlgs", true, - "Monitor individual algorithms" }; + "Monitor individual algorithms by instance name" }; + + Gaudi::Property<bool> m_doMonitorAlgorithmClass { this, "DoMonitorAlgClass", true, + "Monitor individual algorithms by instance class type name" }; + + Gaudi::Property<bool> m_doMonitorGlobal { this, "DoMonitorGlobal", true, + "Monitor global event properties" }; + + Gaudi::Property<bool> m_doMonitorThreadOccupancy { this, "DoMonitorThreadOccupancy", true, + "Monitor algorithm occupancy load of individual threads in an MT execution environment" }; Gaudi::Property<bool> m_useEBWeights { this, "UseEBWeights", true, "Apply Enhanced Bias weights" }; - Gaudi::Property<bool> m_hashDictionaryFromFile { this, "HashDictionaryFromFile", true, - "Obtain hash map from hashes2string.txt rather than TrigConfSvc" }; - Gaudi::Property<size_t> m_maxFullEventDumps { this, "MaxFullEventDumps", 10, "Maximum number of full event summaries which will be dumped" }; - Gaudi::Property<size_t> m_fullEventDumpProbability { this, "FullEventDumpProbability", 10, + Gaudi::Property<uint64_t> m_fullEventDumpProbability { this, "FullEventDumpProbability", 10, "Save a full record of one in every N events, up to MaxFullEventDumps." }; - // TODO - deprecate this now that we have the concept of the "master slot" for monitoring multi-slot processing statistics - Gaudi::Property<size_t> m_fullEventDumpExtraTimeSlices { this, "FullEventDumpExtraTimeSlices", 1, - "Save also the full event record for N events before and after the chosen one" }; - Gaudi::Property<float> m_baseEventWeight { this, "BaseEventWeight", true, "Base events weight, other weights may be multiplied on top of this one." }; @@ -117,9 +122,10 @@ class TrigCostAnalysis: public ::AthHistogramAlgorithm { /** * @brief Check if event dumping should be performed for the current event. * @param[in] context Event context. + * @param[in] costData We only dump the master-slot (slot:0) as these events cary payload data for all slots / all threads. * @return True, if the event should be dumped. */ - bool checkDoFullEventDump(const EventContext& context); + bool checkDoFullEventDump(const EventContext& context, const CostData& costData); /** * @brief Return or construct and return a Range for the Context. Might return nullptr range. @@ -149,6 +155,14 @@ class TrigCostAnalysis: public ::AthHistogramAlgorithm { */ float getWeight(const EventContext& context); + /** + * @brief Return the slot used to process the event online + * @param[in] costCollection Cost data. + * @return Oneline slot number.. + */ + uint32_t getOnlineSlot(const xAOD::TrigCompositeContainer* costCollection) const; + + /** * @brief High watermark for pre-cached string hashes for the SLOT category. Corresponding to SG and View IProxyDict names. * @param[in] max Pre-compute string hashes for View or Slot multiplicities up to this number. diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/Variable.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/Variable.cxx index 3cbbee5be1f67366374b79a4d0c8cf3fb28d56ea..bb7b2dcf901aacf92a52f68e25b53144f07e92c9 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/Variable.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/Variable.cxx @@ -26,6 +26,11 @@ size_t Variable::getCalls() const { } +float Variable::getAccumulator() const { + return m_accumulator; +} + + void Variable::setDenominator(float value) { // Stored as reciprocal so as to be able to check for /0 here if (fabs(value) < 1e-10) { diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/Variable.h b/Trigger/TrigCost/TrigCostAnalysis/src/Variable.h index 50156373f70f2797d0d660562327a36b13264aba..4aa22596cbb5e9e92feb7aa172db235e3ad50590 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/Variable.h +++ b/Trigger/TrigCost/TrigCostAnalysis/src/Variable.h @@ -78,6 +78,12 @@ class Variable { */ size_t getCalls() const; + /** + * @brief Getter for accumulated value of a kPerEvent Variable + * @return Total accumulated payload + */ + float getAccumulator() const; + /** * @brief Fill histogram (per-Call Variable), or add value to internal accumulator (per-Event Variable) to be filled at the end of the event. * @pram[in] value The payload. diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterAlgorithm.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterAlgorithm.cxx index 91fcb32482925694c5bf63ab8bce688803c70aef..9d942f27d495cee52f5ef6f618d0c6a4b057ff8b 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterAlgorithm.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterAlgorithm.cxx @@ -9,11 +9,13 @@ CounterAlgorithm::CounterAlgorithm(const std::string& name, const MonitorBase* parent) : CounterBase(name, parent) { - regHistogram("Time_perCall", "CPU Time/Call;Time [ms];Events", VariableType::kPerCall); + regHistogram("Time_perCall", "CPU Time/Call;Time [ms];Calls", VariableType::kPerCall); regHistogram("FirstTime_perEvent", "First Call CPU Time;Time [ms];Events", VariableType::kPerCall); regHistogram("Time_perEvent", "CPU Time/Event;Time [ms];Events", VariableType::kPerEvent); - regHistogram("Time_perEventFractional", "CPU Time/Event CPU Time;Time [ms];Events", VariableType::kPerEvent, kLinear, 0., 1.); + regHistogram("Time_perEventFractional", "CPU Time/Event CPU Time;Fractional Time;Events", VariableType::kPerEvent, kLinear, 0., 1.); regHistogram("AlgCalls_perEvent", "Calls/Event;Calls;Events", VariableType::kPerEvent, kLinear, -0.5, 49.5); + regHistogram("InEventView_perCall", "In Event View;Yes or No;Calls", VariableType::kPerCall, kLinear, -0.5, 1.5, 2); + regHistogram("RoIID_perCall", "RoI ID;RoI ID;Calls", VariableType::kPerCall, kLinear, -1.5, 20.5, 22); } @@ -38,5 +40,10 @@ StatusCode CounterAlgorithm::newEvent(const CostData& data, size_t index, const ATH_CHECK( increment("AlgCalls_perEvent", weight) ); + const bool globalScope = (TrigConf::HLTUtils::hash2string( alg->getDetail<TrigConf::HLTHash>("store"), "STORE").find("StoreGateSvc") != std::string::npos); + ATH_CHECK( fill("InEventView_perCall", (globalScope ? 0.0 : 1.0), weight) ); + + ATH_CHECK( fill("RoIID_perCall", alg->getDetail<int32_t>("roi"), weight) ); + return StatusCode::SUCCESS; } diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterGlobal.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterGlobal.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ec7ce66a1fc129842081d90f5935c8a26d1b31a7 --- /dev/null +++ b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterGlobal.cxx @@ -0,0 +1,50 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "xAODTrigger/TrigCompositeContainer.h" + +#include "CounterGlobal.h" + +CounterGlobal::CounterGlobal(const std::string& name, const MonitorBase* parent) + : CounterBase(name, parent) +{ + regHistogram("AlgTime_perCall", "Algorithm CPU Time/Call;Time [ms];Events", VariableType::kPerCall); + regHistogram("AlgTime_perEvent", "Algorithm CPU Time/Event;Time [ms];Events", VariableType::kPerEvent); + regHistogram("AlgCalls_perEvent", "Algorithm Calls/Event;Calls;Events", VariableType::kPerEvent, kLinear, -0.5, 499.5); + regHistogram("SteeringTime_perEvent", "Steering Time/Event;Time [ms];Events", VariableType::kPerEvent); + regHistogram("LbLength", "LBLength;Entry;LB Length [s]", VariableType::kPerEvent, kLinear, -0.5, 0.5, 1); +} + + +StatusCode CounterGlobal::newEvent(const CostData& data, size_t incrementWalltime, const float weight) { + + uint64_t lowTimestamp = std::numeric_limits<uint64_t>::max(); + uint64_t highTimestamp = 0; + for (const xAOD::TrigComposite* tc : data.costCollection()) { + const uint32_t slot = tc->getDetail<uint32_t>("slot"); + if (slot != data.onlineSlot()) { + continue; // When monitoring the master slot, this Counter ignores algs running in different slots + } + + const uint64_t start = tc->getDetail<uint64_t>("start"); // in mus + const uint64_t stop = tc->getDetail<uint64_t>("stop"); // in mus + const float cpuTime = timeToMilliSec(start, stop); + ATH_CHECK( fill("AlgTime_perCall", cpuTime, weight) ); + ATH_CHECK( fill("AlgTime_perEvent", cpuTime, weight) ); + ATH_CHECK( increment("AlgCalls_perEvent", weight) ); + lowTimestamp = std::min(lowTimestamp, start); + highTimestamp = std::max(highTimestamp, stop); + } + + const float steeringTime = timeToMilliSec(lowTimestamp, highTimestamp); + ATH_CHECK( fill("SteeringTime_perEvent", steeringTime, weight) ); + + if (incrementWalltime == 1) { + // Note: This accumulator doesn't use the standard weight. + // For P1 data taking it will be filled exactly once per LB + ATH_CHECK( fill("LbLength", 0.0, data.liveTime()) ); + } + + return StatusCode::SUCCESS; +} diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterGlobal.h b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterGlobal.h new file mode 100644 index 0000000000000000000000000000000000000000..dd49071dc7ef9203a7ea347df2fef9e3c1dc0191 --- /dev/null +++ b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterGlobal.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGCOSTANALYSIS_COUNTERGLOBAL_H +#define TRIGCOSTANALYSIS_COUNTERGLOBAL_H 1 + +#include "../CounterBase.h" + +/** + * @class CounterGlobal + * @brief Concrete implimentation of Counter to monitor global properties of the event + */ +class CounterGlobal : public CounterBase { + public: + /** + * @brief Forbid default constructor. + */ + CounterGlobal() = delete; + + /** + * @brief Construct counter. + * @param[in] name Counter's name + * @param[in] parent Counter's parent monitor, cached non-owning pointer. + */ + CounterGlobal(const std::string& name, const MonitorBase* parent); + + /** + * @brief Default destructor. + */ + virtual ~CounterGlobal() = default; + + /** + * @brief Forbid assignment. + */ + CounterGlobal& operator=(const CounterGlobal&) = delete; + + /** + * @brief Forbid copy. + */ + CounterGlobal(const CounterGlobal&) = delete; + + /** + * @brief Concrete implementation. Monitors global properties in a single LB, or over all LB in a Range + * @param[in] data Access to event data + * @param[in] incrementWalltime If 1, we should add the current events wall time to our internal histogram + * @param[in] weight Global event weight + */ + virtual StatusCode newEvent(const CostData& data, size_t incrementWalltime, const float weight = 1.) override; +}; + +#endif // TRIGCOSTANALYSIS_COUNTERGLOBAL_H diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterThread.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterThread.cxx new file mode 100644 index 0000000000000000000000000000000000000000..dca1e7db2db8fcb68449a71ef92abb5103122111 --- /dev/null +++ b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterThread.cxx @@ -0,0 +1,85 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "xAODTrigger/TrigCompositeContainer.h" + +#include "CounterThread.h" + +CounterThread::CounterThread(const std::string& name, const MonitorBase* parent) + : CounterBase(name, parent), m_lowTimestamp(std::numeric_limits<uint64_t>::max()), m_highTimestamp(0), + m_globalLowTimestamp(std::numeric_limits<uint64_t>::max()), m_globalHighTimestamp(0) +{ + regHistogram("AlgTime_perEvent", "Algorithm CPU Time/Event;Time [ms];Events", VariableType::kPerEvent); + regHistogram("FrameworkTime_perEvent", "Framework CPU Tim/Evente;Time [ms];Events", VariableType::kPerEvent); + regHistogram("UnmonitoredTime_perEvent", "Unmonitored CPU Tim/Evente;Time [ms];Events", VariableType::kPerEvent); + + regHistogram("AlgTime_perEventFractional", "Algorithm CPU Time Fractional;Fractional Time;Events", VariableType::kPerEvent, kLinear, 0., 1.); + regHistogram("FrameworTime_perEventFractional", "CPU Time/Event CPU Time Fractional;Fractional Time;Events", VariableType::kPerEvent, kLinear, 0., 1.); + regHistogram("UnmonitoredTime_perEventFractional", "Unmonitored CPU Time Fractional;Fractional Time;Events", VariableType::kPerEvent, kLinear, 0., 1.); + + + regHistogram("AlgCalls_perEvent", "Algorithm Calls/Event;Calls;Events", VariableType::kPerEvent, kLinear, -0.5, 499.5); + regHistogram("AlgSlot_perCall", "Algorithm Slot/Call;Slot;Calls", VariableType::kPerCall, kLinear, -0.5, 20.5, 21); + +} + + +StatusCode CounterThread::newEvent(const CostData& data, size_t index, const float weight) { + const xAOD::TrigComposite* alg = data.costCollection().at(index); + + const uint64_t start = alg->getDetail<uint64_t>("start"); // in mus + const uint64_t stop = alg->getDetail<uint64_t>("stop"); // in mus + const uint32_t slot = alg->getDetail<uint32_t>("slot"); + const float cpuTime = timeToMilliSec(start, stop); + ATH_CHECK( fill("AlgTime_perEvent", cpuTime, weight) ); + ATH_CHECK( fill("AlgTime_perEventFractional", cpuTime, weight) ); + ATH_CHECK( increment("AlgCalls_perEvent", weight) ); + ATH_CHECK( fill("AlgSlot_perCall", slot, weight) ); + m_lowTimestamp = std::min(m_lowTimestamp, start); + m_highTimestamp = std::max(m_highTimestamp, stop); + + return StatusCode::SUCCESS; +} + +StatusCode CounterThread::postProcess(float weight) { + const float eventTime = timeToMilliSec(m_globalLowTimestamp, m_globalHighTimestamp); + float unmonitoredTime = 0; + if (m_highTimestamp > 0) { + unmonitoredTime = timeToMilliSec(m_globalLowTimestamp, m_lowTimestamp) + timeToMilliSec(m_highTimestamp, m_globalHighTimestamp); + } + const float frameWorkTime = eventTime - unmonitoredTime - getVariable("AlgTime_perEvent").getAccumulator(); + + ATH_CHECK( fill("UnmonitoredTime_perEvent", unmonitoredTime, weight) ); + ATH_CHECK( fill("UnmonitoredTime_perEventFractional", unmonitoredTime, weight) ); + + ATH_CHECK( fill("FrameworkTime_perEvent", frameWorkTime, weight) ); + ATH_CHECK( fill("FrameworTime_perEventFractional", frameWorkTime, weight) ); + + ATH_CHECK( setDenominator("AlgTime_perEventFractional", eventTime) ); + ATH_CHECK( setDenominator("FrameworTime_perEventFractional", eventTime) ); + ATH_CHECK( setDenominator("UnmonitoredTime_perEventFractional", eventTime) ); + + m_lowTimestamp = std::numeric_limits<uint64_t>::max(); + m_highTimestamp = 0; + m_globalLowTimestamp = std::numeric_limits<uint64_t>::max(); + m_globalHighTimestamp = 0; + + return StatusCode::SUCCESS; +} + + +uint64_t CounterThread::getLowTimestamp() const { + return m_lowTimestamp; +} + + +uint64_t CounterThread::getHighTimestamp() const { + return m_highTimestamp; +} + + +void CounterThread::setAllThreadsTimestamps(uint64_t low, uint64_t high) { + m_globalLowTimestamp = low; + m_globalHighTimestamp = high; +} diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterThread.h b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterThread.h new file mode 100644 index 0000000000000000000000000000000000000000..ad99d13edee1eb7ded7cc14412e79cda9fd0c578 --- /dev/null +++ b/Trigger/TrigCost/TrigCostAnalysis/src/counters/CounterThread.h @@ -0,0 +1,81 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGCOSTANALYSIS_COUNTERTHREAD_H +#define TRIGCOSTANALYSIS_COUNTERTHREAD_H 1 + +#include "../CounterBase.h" + +/** + * @class CounterThread + * @brief Concrete implimentation of Counter to monitor all algorithms executing on a single thread. + */ +class CounterThread : public CounterBase { + public: + /** + * @brief Forbid default constructor. + */ + CounterThread() = delete; + + /** + * @brief Construct counter. + * @param[in] name Counter's name + * @param[in] parent Counter's parent monitor, cached non-owning pointer. + */ + CounterThread(const std::string& name, const MonitorBase* parent); + + /** + * @brief Default destructor. + */ + virtual ~CounterThread() = default; + + /** + * @brief Forbid assignment. + */ + CounterThread& operator=(const CounterThread&) = delete; + + /** + * @brief Forbid copy. + */ + CounterThread(const CounterThread&) = delete; + + /** + * @brief Concrete implementation. Monitores algorithm at specified index for this counter's thread. + * @param[in] data Access to event data + * @param[in] index Index within appropriate event data container which is to be analysed by this Counter + * @param[in] weight Global event weight + */ + virtual StatusCode newEvent(const CostData& data, size_t index, const float weight = 1.0) override; + + /** + * @brief Apply post-processing to the Counter, before endEvent is called + * @param[in] weight Global event weight + */ + StatusCode postProcess(float weight = 1.0); + + /** + * @brief Get the lowest timestamp of this single thread + */ + uint64_t getLowTimestamp() const; + + /** + * @brief Get the highest timestamp of this single thread + */ + uint64_t getHighTimestamp() const; + + /** + * @brief Set the low and high timestamps over all threads + */ + void setAllThreadsTimestamps(uint64_t low, uint64_t high); + + uint64_t m_lowTimestamp; //!< Records the lowest timestamp seen on this single thread in an event + uint64_t m_highTimestamp; //!< Records the highest timestamp seen on this single thread in an event + + uint64_t m_globalLowTimestamp; //!< Records the lowest timestamp seen over all threads in an event + uint64_t m_globalHighTimestamp; //!< Records the highest timestamp seen over all threads in an event + +}; + + +#endif // TRIGCOSTANALYSIS_COUNTERTHREAD_H diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorAlgorithm.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorAlgorithm.cxx index fe95c94faf6683d56caca4c8a91bc323726882ba..a8e0edb32d50369d974c015ec7b9273f3d3fc9aa 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorAlgorithm.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorAlgorithm.cxx @@ -12,6 +12,10 @@ MonitorAlgorithm::MonitorAlgorithm(const std::string& name, const MonitoredRange StatusCode MonitorAlgorithm::newEvent(const CostData& data, const float weight) { for (const xAOD::TrigComposite* tc : data.costCollection()) { + const uint32_t slot = tc->getDetail<uint32_t>("slot"); + if (slot != data.onlineSlot()) { + continue; // When monitoring the master slot, this Monitor ignores algs running in different slots + } const uint32_t nameHash = tc->getDetail<TrigConf::HLTHash>("alg"); const std::string name = TrigConf::HLTUtils::hash2string(nameHash, "ALG"); ATH_CHECK( getCounter(name)->newEvent(data, tc->index(), weight) ); diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorAlgorithmClass.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorAlgorithmClass.cxx new file mode 100644 index 0000000000000000000000000000000000000000..41d74f3a396e555aa117e138fd85b39512a31849 --- /dev/null +++ b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorAlgorithmClass.cxx @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MonitorAlgorithmClass.h" +#include "../counters/CounterAlgorithm.h" + +MonitorAlgorithmClass::MonitorAlgorithmClass(const std::string& name, const MonitoredRange* parent) + : MonitorBase(name, parent) { +} + +StatusCode MonitorAlgorithmClass::newEvent(const CostData& data, const float weight) { + + for (const xAOD::TrigComposite* tc : data.costCollection()) { + const uint32_t slot = tc->getDetail<uint32_t>("slot"); + if (slot != data.onlineSlot()) { + continue; // When monitoring the master slot, this Monitor ignores algs running in different slots + } + const uint32_t nameHash = tc->getDetail<TrigConf::HLTHash>("alg"); + const std::string& name = data.algNameToClassType(nameHash); + ATH_CHECK( getCounter(name)->newEvent(data, tc->index(), weight) ); + } + + return StatusCode::SUCCESS; +} + + +std::unique_ptr<CounterBase> MonitorAlgorithmClass::newCounter(const std::string& name) { + return std::make_unique<CounterAlgorithm>(name, this); +} diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorAlgorithmClass.h b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorAlgorithmClass.h new file mode 100644 index 0000000000000000000000000000000000000000..14f50ddb4e6df67ad6e45045779be16c2654afdb --- /dev/null +++ b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorAlgorithmClass.h @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGCOSTANALYSIS_MONITORALGORITHMCLASS_H +#define TRIGCOSTANALYSIS_MONITORALGORITHMCLASS_H 1 + +#include "../MonitorBase.h" + +/** + * @class MonitorAlgorithmClass + * @brief Concrete implementation of Monitor to monitor all Algorithm instances in an event, grouped by their instance class. + */ +class MonitorAlgorithmClass : public MonitorBase { + public: + /** + * @brief Forbid default constructor. + */ + MonitorAlgorithmClass() = delete; + + /** + * @brief Construct monitor. + * @param[in] name Monitor's name + * @param[in] parent Monitor's parent Range, cached non-owning pointer. + */ + MonitorAlgorithmClass(const std::string& name, const MonitoredRange* parent); + + /** + * @brief Default destructor. + */ + virtual ~MonitorAlgorithmClass() = default; + + /** + * @brief Forbid assignment. + */ + MonitorAlgorithmClass& operator=(const MonitorAlgorithmClass&) = delete; + + /** + * @brief Forbid copy. + */ + MonitorAlgorithmClass(const MonitorAlgorithmClass&) = delete; + + /** + * @brief Concrete dispatch method. Iterate over all Algorithms in event data and dispatch to owned Counters based on class name lookup + * @param[in] data Access to event data + * @param[in] weight Global event weight + */ + virtual StatusCode newEvent(const CostData& data, const float weight = 1.) override; + + /** + * @brief Concrete counter instantiation. Mints named counter of CounterAlgorithm type. + * @param[in] name Name of Counter to mint. + * @return Owning unique ptr object typed on the CounterBase base class which points to concrete Counter of specialised type. + */ + virtual std::unique_ptr<CounterBase> newCounter(const std::string& name) override; +}; + +#endif // TRIGCOSTANALYSIS_MONITORALGORITHMCLASS_H diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorGlobal.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorGlobal.cxx new file mode 100644 index 0000000000000000000000000000000000000000..029ffc36e888a8371e0a05acf88d7003b1f5f89a --- /dev/null +++ b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorGlobal.cxx @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MonitorGlobal.h" +#include "../counters/CounterGlobal.h" + +MonitorGlobal::MonitorGlobal(const std::string& name, const MonitoredRange* parent) + : MonitorBase(name, parent) { +} + +StatusCode MonitorGlobal::newEvent(const CostData& data, const float weight) { + + std::stringstream ss; + ss << "LumiBlock_" << std::setfill('0') << std::setw(5) << data.lb(); + const size_t incrementWalltime = ( data.liveTimeIsPerEvent() or !counterExists(ss.str()) ) ? 1 : 0; + + ATH_CHECK( getCounter(ss.str())->newEvent(data, incrementWalltime, weight) ); + ATH_CHECK( getCounter("All")->newEvent(data, incrementWalltime, weight) ); + + return StatusCode::SUCCESS; +} + + +std::unique_ptr<CounterBase> MonitorGlobal::newCounter(const std::string& name) { + return std::make_unique<CounterGlobal>(name, this); +} diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorGlobal.h b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorGlobal.h new file mode 100644 index 0000000000000000000000000000000000000000..0f3d068a13540e4941bd2b51abebffa656c3c07f --- /dev/null +++ b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorGlobal.h @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGCOSTANALYSIS_MONITORGLOBAL_H +#define TRIGCOSTANALYSIS_MONITORGLOBAL_H 1 + +#include "../MonitorBase.h" + +/** + * @class MonitorGlobal + * @brief Concrete implementation of Monitor to monitor global properties of event execution + */ +class MonitorGlobal : public MonitorBase { + public: + /** + * @brief Forbid default constructor. + */ + MonitorGlobal() = delete; + + /** + * @brief Construct monitor. + * @param[in] name Monitor's name + * @param[in] parent Monitor's parent Range, cached non-owning pointer. + */ + MonitorGlobal(const std::string& name, const MonitoredRange* parent); + + /** + * @brief Default destructor. + */ + virtual ~MonitorGlobal() = default; + + /** + * @brief Forbid assignment. + */ + MonitorGlobal& operator=(const MonitorGlobal&) = delete; + + /** + * @brief Forbid copy. + */ + MonitorGlobal(const MonitorGlobal&) = delete; + + /** + * @brief Concrete dispatch method. Iterate over all Algorithms in event data and dispatch to owned Counters + * @param[in] data Access to event data + * @param[in] weight Global event weight + */ + virtual StatusCode newEvent(const CostData& data, const float weight = 1.) override; + + /** + * @brief Concrete counter instantiation. Mints named counter of CounterAlgorith type. + * @param[in] name Name of Counter to mint. + * @return Owning unique ptr object typed on the CounterBase base class which points to concrete Counter of specialised type. + */ + virtual std::unique_ptr<CounterBase> newCounter(const std::string& name) override; +}; + +#endif // TRIGCOSTANALYSIS_MONITORGLOBAL_H diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorThreadOccupancy.cxx b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorThreadOccupancy.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3d41ef052d84b6a4eb6e418743fab5cb2d450d19 --- /dev/null +++ b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorThreadOccupancy.cxx @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MonitorThreadOccupancy.h" +#include "../counters/CounterThread.h" + +MonitorThreadOccupancy::MonitorThreadOccupancy(const std::string& name, const MonitoredRange* parent) + : MonitorBase(name, parent), + m_threadToCounterMap(), + m_threadCounter(0) {} + + +StatusCode MonitorThreadOccupancy::newEvent(const CostData& data, const float weight) { + + // Only look at events in the master slot + if (not data.isMasterSlot()) { + return StatusCode::SUCCESS; + } + + for (const xAOD::TrigComposite* tc : data.costCollection()) { + const uint32_t threadID = tc->getDetail<uint32_t>("thread"); + if (m_threadToCounterMap.count(threadID) == 0) { + std::stringstream threadIDStr; + threadIDStr << "Thread_" << std::setfill('0') << std::setw(5) << threadID; + m_threadToCounterMap[threadID] = threadIDStr.str(); + } + ATH_CHECK( getCounter(m_threadToCounterMap[threadID])->newEvent(data, tc->index(), weight) ); + } + + ATH_CHECK( postProcess(weight) ); + + + return StatusCode::SUCCESS; +} + + +StatusCode MonitorThreadOccupancy::postProcess(float weight) { + uint64_t lowTimestamp = std::numeric_limits<uint64_t>::max(); + uint64_t highTimestamp = 0; + for (const auto& nameCounterPair : m_counters) { + const CounterThread* ptr = dynamic_cast<const CounterThread*>(nameCounterPair.second.get()); + lowTimestamp = std::min(lowTimestamp, ptr->getLowTimestamp()); + highTimestamp = std::max(highTimestamp, ptr->getHighTimestamp()); + } + for (auto& nameCounterPair : m_counters) { + CounterThread* ptr = dynamic_cast<CounterThread*>(nameCounterPair.second.get()); + ptr->setAllThreadsTimestamps(lowTimestamp, highTimestamp); + ATH_CHECK( ptr->postProcess(weight) ); + } + return StatusCode::SUCCESS; +} + + +std::unique_ptr<CounterBase> MonitorThreadOccupancy::newCounter(const std::string& name) { + return std::make_unique<CounterThread>(name, this); +} diff --git a/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorThreadOccupancy.h b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorThreadOccupancy.h new file mode 100644 index 0000000000000000000000000000000000000000..84309795bb9c8f4c6fb832f77ab72ca11a726585 --- /dev/null +++ b/Trigger/TrigCost/TrigCostAnalysis/src/monitors/MonitorThreadOccupancy.h @@ -0,0 +1,66 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGCOSTANALYSIS_MONITORTHREADOCCUPANCY_H +#define TRIGCOSTANALYSIS_MONITORTHREADOCCUPANCY_H 1 + +#include "../MonitorBase.h" + +/** + * @class MonitorThreadOccupancy + * @brief Concrete implementation of Monitor to monitor utilisation of individual threads in a MT job + */ +class MonitorThreadOccupancy : public MonitorBase { + public: + /** + * @brief Forbid default constructor. + */ + MonitorThreadOccupancy() = delete; + + /** + * @brief Construct monitor. + * @param[in] name Monitor's name + * @param[in] parent Monitor's parent Range, cached non-owning pointer. + */ + MonitorThreadOccupancy(const std::string& name, const MonitoredRange* parent); + + /** + * @brief Default destructor. + */ + virtual ~MonitorThreadOccupancy() = default; + + /** + * @brief Forbid assignment. + */ + MonitorThreadOccupancy& operator=(const MonitorThreadOccupancy&) = delete; + + /** + * @brief Forbid copy. + */ + MonitorThreadOccupancy(const MonitorThreadOccupancy&) = delete; + + /** + * @brief Concrete dispatch method. Iterate over all Algorithms in event data and dispatch to owned Counters + * @param[in] data Access to event data + * @param[in] weight Global event weight + */ + virtual StatusCode newEvent(const CostData& data, const float weight = 1.) override; + + /** + * @brief Concrete counter instantiation. Mints named counter of CounterThread type. + * @param[in] name Name of Counter to mint. + * @return Owning unique ptr object typed on the CounterBase base class which points to concrete Counter of specialised type. + */ + virtual std::unique_ptr<CounterBase> newCounter(const std::string& name) override; + + /** + * @brief Get the global start and stop timestamps over all threads and sync these to the individual threads. + */ + StatusCode postProcess(float weight); + + std::unordered_map<uint32_t, std::string> m_threadToCounterMap; //!< Map thread's hash ID to a counting numeral embedded in a string + size_t m_threadCounter; //!< Count how many unique thread ID we have seen +}; + +#endif // TRIGCOSTANALYSIS_MONITORTHREADOCCUPANCY_H diff --git a/Trigger/TrigCost/TrigCostAnalysis/util/trigCostHistToCSV.cxx b/Trigger/TrigCost/TrigCostAnalysis/util/trigCostHistToCSV.cxx index ee91e09086de7dc692515ff360e11a7d0058b293..21b01af8e4f28393b0c9c66129452ff62aab3e87 100644 --- a/Trigger/TrigCost/TrigCostAnalysis/util/trigCostHistToCSV.cxx +++ b/Trigger/TrigCost/TrigCostAnalysis/util/trigCostHistToCSV.cxx @@ -12,6 +12,7 @@ #include <sstream> #include "TrigCostAnalysis/TableConstructors/AlgorithmTableConstructor.h" +#include "TrigCostAnalysis/TableConstructors/GlobalTableConstructor.h" #include "TFile.h" #include "TString.h" @@ -51,12 +52,14 @@ void exportDirectory(TFile* file, const std::vector<TString>& dir, float walltim TString exportName = constructCSVName(dir); msg() << MSG::DEBUG << " Do Histo for " << exportName << endmsg; - AlgorithmTableConstructor atc("Algorithm_HLT"); std::string table; - const TString rootDir = dir.at(0) + "/" + dir.at(1) + "/"; if (dir.at(1) == "Algorithm_HLT") { + AlgorithmTableConstructor atc("Algorithm_HLT"); table = atc.getTable(file, rootDir, walltime); + } else if (dir.at(1) == "Global_HLT") { + GlobalTableConstructor gtc("Global_HLT"); + table = gtc.getTable(file, rootDir, walltime); } std::ofstream fstream(exportName.Data()); @@ -104,6 +107,7 @@ void exploreTree(TFile* file, const size_t level = 0, std::vector<TString> dir = exploreTree(file, level + 1, dir); } else { exportDirectory(file, dir, walltime); + dir.pop_back(); } } else if (name.First("_walltime") != kNPOS) { // This is fine diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/CMakeLists.txt b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/CMakeLists.txt deleted file mode 100644 index 04deb38b4e36a5673096c58bc958563185c55cbb..0000000000000000000000000000000000000000 --- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration - -# Declare the package name: -atlas_subdir( TrigROBDataProviderSvc ) - -# External dependencies: -find_package( ROOT COMPONENTS Hist ) -find_package( tdaq-common ) - -# Component(s) in the package: -atlas_add_library( TrigROBDataProviderSvcLib - src/*.cxx - PUBLIC_HEADERS TrigROBDataProviderSvc - INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ByteStreamCnvSvcBaseLib ByteStreamData GaudiKernel TrigDataAccessMonitoringLib TrigSteeringEvent - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaMonitoringKernelLib CxxUtils StoreGateLib ) - -atlas_add_component( TrigROBDataProviderSvc - src/components/*.cxx - LINK_LIBRARIES TrigROBDataProviderSvcLib ) - -# Install files from the package: -atlas_install_joboptions( share/*.py ) -atlas_install_scripts( python/scripts/*.py ) - diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h deleted file mode 100755 index a961547179ef1d4917ca3780d3ac68b2f0684049..0000000000000000000000000000000000000000 --- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ITrigROBDataProviderSvc_H -#define ITrigROBDataProviderSvc_H -#include "GaudiKernel/IInterface.h" -#include "ByteStreamData/RawEvent.h" -#include <inttypes.h> -#include <vector> -#include <map> -#include <string> -#include <string_view> - -// Declaration of the interface ID ( interface id, major version, minor version) -static const InterfaceID IID_ITrigROBDataProviderSvc("ITrigROBDataProviderSvc", 2 , 0); - -/** @class ITrigROBDataProviderSvc - @brief Interface class with additional methods to interface IROBDataProviderSvc for managing ROBs in online. -*/ -class ITrigROBDataProviderSvc : virtual public IInterface { - -public: - typedef OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF; - - //--------------------------------------------------- - // Methods to access the data in the online ROB cache - //--------------------------------------------------- - - /// Retrieve interface ID - static const InterfaceID& interfaceID() { return IID_ITrigROBDataProviderSvc; } - - /// Return vector with all ROBFragments stored in the cache - virtual void getAllROBData(std::vector<const ROBF*>&) = 0; - - /// Dump the internal ROB cache - virtual std::string dumpROBcache() const = 0; - - /// Return size of ROBFragments cache - virtual int sizeROBCache() = 0; - - /// iterators over cache entries - virtual std::map<uint32_t, ROBF>::iterator beginROBCache() = 0; - virtual std::map<uint32_t, ROBF>::iterator endROBCache() = 0; - - //-------------------------------------------------------------------------------------------------- - // Methods for the merged L2/EF system to initiate or check the retrieval of the complete event data - //-------------------------------------------------------------------------------------------------- - - /// Check if complete event data are already in cache - virtual bool isEventComplete() = 0; - - /// Collect all data for an event from the ROS and put them into the cache - /// Return value: number of ROBs which were retrieved to complete the event - /// Optinonally the name of the caller of this method can be specified for cost monitoring - virtual int collectCompleteEventData(const std::string_view callerName="UNKNOWN") = 0; - - //------------------------------------- - // Methods useful for (cost) monitoring - //------------------------------------- - - /// set the name of the program which uses the ROBDataProviderSvc - virtual void setCallerName(const std::string_view) = 0; - - /// get the name of the program which is presently registered in the ROBDataProviderSvc - virtual std::string getCallerName() = 0; -}; - -#endif diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/TrigROBDataProviderSvc/ITrigROBDataProviderSvcPrefetch.h b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/TrigROBDataProviderSvc/ITrigROBDataProviderSvcPrefetch.h deleted file mode 100755 index cfb3435c1d7b4e98a9c1864da15570d166dae623..0000000000000000000000000000000000000000 --- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/TrigROBDataProviderSvc/ITrigROBDataProviderSvcPrefetch.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ITrigROBDataProviderSvcPrefetch_H -#define ITrigROBDataProviderSvcPrefetch_H -#include "GaudiKernel/IInterface.h" - -// Declaration of the interface ID ( interface id, major version, minor version) -static const InterfaceID IID_ITrigROBDataProviderSvcPrefetch("ITrigROBDataProviderSvcPrefetch", 1 , 0); - -namespace HLT { - class RobRequestInfo; -} - -/** @class ITrigROBDataProviderSvcPrefetch - @brief Interface class with additional methods to interface IROBDataProviderSvc for prefetching ROBs in online. -*/ -class ITrigROBDataProviderSvcPrefetch : virtual public IInterface { - -public: - - /// Retrieve interface ID - static const InterfaceID& interfaceID() { return IID_ITrigROBDataProviderSvcPrefetch; } - - //----------------------------------- - // Methods useful for ROB prefetching - //----------------------------------- - - // Set access to ROB prefetching information from steering - virtual void setRobRequestInfo(HLT::RobRequestInfo*) = 0; - - // Get access to ROB prefetching information from steering - virtual HLT::RobRequestInfo* robRequestInfo() const = 0; -}; -#endif diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/TrigROBDataProviderSvc/ITrigROBDataProviderSvc_RTT.h b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/TrigROBDataProviderSvc/ITrigROBDataProviderSvc_RTT.h deleted file mode 100755 index 3a98ebc1e02787a6cbd0b23eb188a679ba5863ad..0000000000000000000000000000000000000000 --- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/TrigROBDataProviderSvc/ITrigROBDataProviderSvc_RTT.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ITrigROBDataProviderSvc_RTT_H -#define ITrigROBDataProviderSvc_RTT_H -#include "GaudiKernel/IInterface.h" - -#include <inttypes.h> -#include <vector> -#include <map> - -// Declaration of the interface ID ( interface id, major version, minor version) -static const InterfaceID IID_ITrigROBDataProviderSvc_RTT("ITrigROBDataProviderSvc_RTT", 1 , 0); - -/** @class ITrigROBDataProviderSvc_RTT - @brief Interface class with additional methods to interface ITrigROBDataProviderSvc for managing ROBs -*/ -class ITrigROBDataProviderSvc_RTT : virtual public IInterface { - -public: - - /// Retrieve interface ID - static const InterfaceID& interfaceID() { return IID_ITrigROBDataProviderSvc_RTT; } - - //return status of prefecthing - virtual bool isMissingPrefetching() = 0; - - // return setup of pre-fetching - virtual bool isPrefetchingAtAlgoLevel() = 0; - -}; - -#endif diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/python/scripts/generate-rob-ros-map-from-data.py b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/python/scripts/generate-rob-ros-map-from-data.py deleted file mode 100755 index ed77fe55333f11dbdfb09034b144c7336dd7bba5..0000000000000000000000000000000000000000 --- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/python/scripts/generate-rob-ros-map-from-data.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -# -# author: Werner Wiedenmann <Werner.Wiedenmann@cern.ch> -# -import sys -import os -import datetime - -def random(hits, n): - """Places all ROB hits randomly in 'n' ROSs. - - This function will take the hits found in the list given as first parameter - and will randomly place all ROB identifiers over the 'n' available ROSs as - defined by the second parameter (which, btw, defaults to 1). - """ - from random import randint,seed - - seed(0) # make it random, but no so random! - retval = {} - for h in hits: retval[h] = randint(1,n) - return retval - -def my_conf(argv): - """Runs the dumping routines""" - import logging - from EventApps import myopt - - option = {} - option['ignore'] = {'short': 'v', 'arg': True, - 'default': '0x007[3589abc].+|0x007[67]0001', - 'description': 'A (python) regular expression of ROB hexadecimal numbers to ignore when making the robmap list. The comparision is done on a string basis, as a result of parsing each hit in a 0x%08x printf-like format'} - - option['verbosity'] = {'short': 'V', 'arg': True, - 'default': logging.INFO, - 'description': 'From which level to print system messages [%d, %d]. For details please consult the documentation of python\'s "logging" module' % (logging.NOTSET, logging.CRITICAL)} - - parser = myopt.Parser(extra_args=True) - for (k,v) in option.items(): - parser.add_option(k, v['short'], v['description'], v['arg'], v['default']) - - if len(sys.argv) == 1: - print parser.usage('global "%s" options:' % sys.argv[0]) - sys.exit(1) - - #process the global options - (kwargs, extra) = parser.parse(sys.argv[1:], prefix='global "%s" options:' % sys.argv[0]) - - #now the things which require global defaults - logging.getLogger('').setLevel(kwargs['verbosity']) - # os.environ['TDAQ_ERS_DEBUG_LEVEL'] = str(kwargs['debug']) - import eformat - - stream = eformat.istream(extra) - rob_list = set() - sys.stderr.write('Processing %s events' % len(stream)) - for event in stream: - sys.stderr.write('.') - sys.stderr.flush() - for rob in event: rob_list.add(rob.source_id().code()) - sys.stderr.write('\n') - - print "# This ROB-ROS map was generated by %s" % \ - os.path.basename(sys.argv[0]) - print "# Current date and time is", datetime.datetime(1,1,1).now() - print "#" - - keys = list(rob_list) - keys.sort() - - # checks if we need to apply filtering... - if len(kwargs['ignore'].strip()) != 0: - import re - ignore = re.compile(kwargs['ignore'].strip()) - keys = [k for k in keys if not ignore.match('0x%08x' % k)] - - print "# These unique identifiers were extracted from:" - for k in extra: print "# %s" % k - print "#" - print "svcMgr.ROBDataProviderSvc.RobRosMapping = {" - print "#" - print "# ROB id : ROS id = SubDetector Id " - print "#" - - ros_count=0 - old_sub_det=0 - for k in keys: - if old_sub_det != eformat.helper.SourceIdentifier(k).subdetector_id().real: - old_sub_det = eformat.helper.SourceIdentifier(k).subdetector_id().real - ros_count = ros_count + 1 - print "# %02i : Sub Detector = %s" % (ros_count, eformat.helper.SourceIdentifier(k).subdetector_id()) - print " %s : %s ," % (hex(k), hex(eformat.helper.SourceIdentifier(k).subdetector_id().real)) - print "}" - -if __name__ == "__main__": - my_conf(sys.argv) diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/share/TrigROBDataProviderSvc.py b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/share/TrigROBDataProviderSvc.py deleted file mode 100755 index 5261ce9ca2b40b2f5d67f67b2b2b5caefe9a046e..0000000000000000000000000000000000000000 --- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/share/TrigROBDataProviderSvc.py +++ /dev/null @@ -1,57 +0,0 @@ -#************************************************************** -# -# TrigROBDataProviderSvc job options fragment -# -#============================================================== -from AthenaCommon.AppMgr import theApp -from AthenaCommon.AppMgr import ServiceMgr as svcMgr -from AthenaCommon import CfgMgr - -# remove old ROBDataProviderSvc definition -if hasattr(svcMgr, 'ROBDataProviderSvc'): - if theApp.__dict__[ 'CreateSvc' ].count( svcMgr.ROBDataProviderSvc.getFullName() ): - theApp.__dict__[ 'CreateSvc' ].remove( svcMgr.ROBDataProviderSvc.getFullName() ) - del svcMgr.allConfigurables['ROBDataProviderSvc'] - del svcMgr.ROBDataProviderSvc - if dir().count('ROBDataProviderSvc'): - del ROBDataProviderSvc - -# configure the offline monitoring ROBDataProviderSvc -svcMgr += CfgMgr.TrigROBDataProviderSvc("ROBDataProviderSvc") -theApp.CreateSvc += [ svcMgr.ROBDataProviderSvc.getFullName() ] -ROBDataProviderSvc = svcMgr.ROBDataProviderSvc - -# switch on algorithm auditing in case it is not yet done -theApp.AuditAlgorithms = True -theApp.AuditServices = True -theApp.AuditTools = True -# -# TrigROBDataProviderSvc specific options -# -# provide histograms -svcMgr.ROBDataProviderSvc.doMonitoring = False -# provide cost monitoring information from ROBs -svcMgr.ROBDataProviderSvc.doDetailedROBMonitoring = True -# simulate online like data access, -# if = True: ROBs need to be registered before they can be retrieved as in online running -# if = False: Full event fragment is available as in offline running -svcMgr.ROBDataProviderSvc.SimulateOnlineDataAccess = True -# use a ROB-ROS mapping file to simulate ROS access -# (for the simulation of online running this should be True -# and a ROB-ROS mapping should be provided. A simple ROB-ROS mapping file -# can be generated with the tool generate-rob-ros-map-from-data.py in the -# directory python/scripts of this package) -svcMgr.ROBDataProviderSvc.UseROSmappingForROBRetrieval = True -# -# svcMgr.ROBDataProviderSvc.RobRosMapping = {} -# -# for finding modules which make a ROB request in getROBData to a -# not registered ROB it is possible to obtain a complete backtrace -# if this option is switched on. The output may be however big. -svcMgr.ROBDataProviderSvc.PrintStackTraceGetROBData = True -# -#============================================================== -# -# End of TrigROBDataProviderSvc job options fragment -# -#************************************************************** diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/share/TrigROBDataProviderSvc_RTT.py b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/share/TrigROBDataProviderSvc_RTT.py deleted file mode 100755 index 47f86ac55a11972f6cd306adb3b701bea016a12f..0000000000000000000000000000000000000000 --- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/share/TrigROBDataProviderSvc_RTT.py +++ /dev/null @@ -1,64 +0,0 @@ -#************************************************************** -# -# TrigROBDataProviderSvc_RTT job options fragment -# -#============================================================== -from AthenaCommon.AppMgr import theApp -from AthenaCommon.AppMgr import ServiceMgr as svcMgr -from AthenaCommon import CfgMgr - -# remove old ROBDataProviderSvc definition -if hasattr(svcMgr, 'ROBDataProviderSvc'): - if theApp.__dict__[ 'CreateSvc' ].count( svcMgr.ROBDataProviderSvc.getFullName() ): - theApp.__dict__[ 'CreateSvc' ].remove( svcMgr.ROBDataProviderSvc.getFullName() ) - del svcMgr.allConfigurables['ROBDataProviderSvc'] - del svcMgr.ROBDataProviderSvc - if dir().count('ROBDataProviderSvc'): - del ROBDataProviderSvc - -# configure the offline monitoring ROBDataProviderSvc -svcMgr += CfgMgr.TrigROBDataProviderSvc_RTT("ROBDataProviderSvc") -theApp.CreateSvc += [ svcMgr.ROBDataProviderSvc.getFullName() ] -ROBDataProviderSvc = svcMgr.ROBDataProviderSvc - -# switch on algorithm auditing in case it is not yet done -theApp.AuditAlgorithms = True -theApp.AuditServices = True -theApp.AuditTools = True -# -# TrigROBDataProviderSvc_RTT specific options -# -# provide histograms -svcMgr.ROBDataProviderSvc.doMonitoring = True -#False -# provide cost monitoring information from ROBs -svcMgr.ROBDataProviderSvc.doDetailedROBMonitoring = True -# simulate online like data access, -# if = True: ROBs need to be registered before they can be retrieved as in online running -# if = False: Full event fragment is available as in offline running -svcMgr.ROBDataProviderSvc.SimulateOnlineDataAccess = True -# use a ROB-ROS mapping file to simulate ROS access -# (for the simulation of online running this should be True -# and a ROB-ROS mapping should be provided. A simple ROB-ROS mapping file -# can be generated with the tool generate-rob-ros-map-from-data.py in the -# directory python/scripts of this package) -svcMgr.ROBDataProviderSvc.UseROSmappingForROBRetrieval = True -# -# svcMgr.ROBDataProviderSvc.RobRosMapping = {} -# -# for finding modules which make a ROB request in getROBData to a -# not registered ROB it is possible to obtain a complete backtrace -# if this option is switched on. The output may be however big. -svcMgr.ROBDataProviderSvc.PrintStackTraceGetROBData = False -#True -# -# for enabling the pre-fetching at algorithm level, debugging prefetching -svcMgr.ROBDataProviderSvc.enablePrefetchingAtAlgoLevel = True -# -#svcMgr.ROBDataProviderSvc.OutputLevel=DEBUG -print svcMgr.ROBDataProviderSvc -#============================================================== -# -# End of TrigROBDataProviderSvc_RTT job options fragment -# -#************************************************************** diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.cxx b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.cxx deleted file mode 100755 index 759aace6abe2b1ea378dfe5541256a1179e1bc16..0000000000000000000000000000000000000000 --- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.cxx +++ /dev/null @@ -1,1637 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//=================================================================== -// Implementation of TrigROBDataProviderSvc -// -// For valid ROB Source Ids, Sub Det Ids and ROB Status elements see the event format -// document ATL-D-ES-0019 (EDMS) -// -//=================================================================== - -// Include files. -#include "TrigROBDataProviderSvc.h" -#include "AthenaMonitoringKernel/OHLockedHist.h" -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/ITHistSvc.h" -#include "GaudiKernel/IJobOptionsSvc.h" -#include "GaudiKernel/Property.h" -#include "GaudiKernel/IIncidentSvc.h" -#include "GaudiKernel/IAlgContextSvc.h" -#include "GaudiKernel/IAlgorithm.h" - -#include "CxxUtils/excepts.h" - -#include <iostream> -#include <sstream> -#include <iomanip> -#include <cassert> -#include <bitset> -#include <TH1F.h> -#include <TH2F.h> - -// Constructor. -TrigROBDataProviderSvc::TrigROBDataProviderSvc(const std::string& name, ISvcLocator* svcloc) - :ROBDataProviderSvc(name,svcloc), - m_callerName("UNKNOWN"), - m_algContextSvc(0), - m_storeGateSvc( "StoreGateSvc", name ), - m_onlineRunning(false), - m_removeEmptyROB(false), - m_maskL2EFModuleID(false), - m_isEventComplete(false), - m_msg(0), - m_RobRequestInfo(0), - m_histProp_requestedROBsPerCall(Gaudi::Histo1DDef("RequestedROBsPerCall" ,0,300,50)), - m_histProp_receivedROBsPerCall(Gaudi::Histo1DDef("ReceivedROBsPerCall" ,0,300,50)), - m_histProp_timeROBretrieval(Gaudi::Histo1DDef("TimeForROBretrieval" ,0.,500.,50)), - m_histProp_retrievedROBsPerAlgo(Gaudi::Histo1DDef("RetrievedROBsPerAlgo" ,0.,1.,1)), - m_histProp_ROSRequest(Gaudi::Histo1DDef("ROSRequests" ,0.,1.,1)), - m_hist_requestedROBsPerCall(0), - m_hist_receivedROBsPerCall(0), - m_hist_retrievedROBsPerAlgo(0), - m_hist_timeROBretrieval(0), - m_hist_genericStatusForROB(0), - m_hist_specificStatusForROB(0), - m_hist_ROSRequest(0) -{ - declareProperty("ignoreROB", m_ignoreROB,"List of ROBs to ignore for retrieval"); - declareProperty("enabledROBs", m_enabledROBs,"List of enabled detector ROBs"); - declareProperty("LArMetROBs", m_enabledLArMetROBs,"List of enabled LAr MET ROBs"); - declareProperty("TileMetROBs", m_enabledTileMetROBs,"List of enabled Tile MET ROBs"); - declareProperty("RobRosMapping", m_rob_ros_map,"Mapping of ROBs to ROSes"); - declareProperty("readROBfromOKS", m_readROBfromOKS=false,"Read enabled ROBs from OKS"); - declareProperty("doMonitoring", m_doMonitoring=false,"Enable histograms"); - declareProperty("doDetailedROBMonitoring", m_doDetailedROBMonitoring=false,"Produce ROB cost data"); - declareProperty("ROBDataMonitorCollectionSGName", m_ROBDataMonitorCollection_SG_Name="ROBDataMonitorCollection","Name of cost monitoring collection in SG"); - declareProperty("HistRequestedROBsPerCall", m_histProp_requestedROBsPerCall,"Number of ROBs requested"); - declareProperty("HistReceivedROBsPerCall", m_histProp_receivedROBsPerCall,"Number of ROBs received"); - declareProperty("HistTimeROBretrieval", m_histProp_timeROBretrieval,"Timing for ROB retrieval"); - declareProperty("HistRetrievedROBsPerAlgo", m_histProp_retrievedROBsPerAlgo,"Number of ROB retrieval per Algo"); - declareProperty("ModuleIDGenericLArMetROB", m_genericLArMetModuleID=0xffff,"Generic module id for LAr MET ROB retrieval"); - declareProperty("ModuleIDGenericTileMetROB", m_genericTileMetModuleID=0xffff,"Generic module id for Tile MET ROB retrieval"); - declareProperty("SeparateMETandDetROBRetrieval", m_separateMETandDetROBRetrieval=true,"Separate retrieval of MET and detector ROBs"); - declareProperty("UseROSmappingForROBRetrieval", m_useROSmappingForROBRetrieval=true,"Use a ROB-ROS mapping for ROB prefetching"); - - declareProperty("SimulateOnlineDataAccess", m_simulateOnlineDataAccess=true,"Simulate online ROB data access"); - declareProperty("PrintStackTraceGetROBData", m_printStackTraceGetROBData=false,"Print a stck trace for failed ROB requests"); - - // fill map with generic status codes - m_map_GenericStatus[eformat::UNCLASSIFIED] = "UNCLASSIFIED"; - m_map_GenericStatus[eformat::BCID_CHECK_FAIL] = "BCID_CHECK_FAIL"; - m_map_GenericStatus[eformat::LVL1ID_CHECK_FAIL] = "LVL1ID_CHECK_FAIL"; - m_map_GenericStatus[eformat::TIMEOUT] = "TIMEOUT"; - m_map_GenericStatus[eformat::DATA_CORRUPTION] = "DATA_CORRUPTION"; - m_map_GenericStatus[eformat::INTERNAL_OVERFLOW] = "INTERNAL_OVERFLOW"; - - // fill vector with specific status codes - m_vec_SpecificStatus.reserve(16); - m_vec_SpecificStatus.push_back("TRIGGER_TYPE_SYNC_ERROR"); - m_vec_SpecificStatus.push_back("FRAGMENT_SIZE_ERROR"); - m_vec_SpecificStatus.push_back("DATABLOCK_ERROR"); - m_vec_SpecificStatus.push_back("CTRL_WORD_ERROR"); - m_vec_SpecificStatus.push_back("MISSING_BOF"); - m_vec_SpecificStatus.push_back("MISSING_EOF"); - m_vec_SpecificStatus.push_back("INVALID_HEADER_MARKER"); - m_vec_SpecificStatus.push_back("FORMAT_ERROR"); - m_vec_SpecificStatus.push_back("DUPLICATE_EVENT"); - m_vec_SpecificStatus.push_back("SEQUENCE_ERROR"); - m_vec_SpecificStatus.push_back("TRANSMISSION_ERROR"); - m_vec_SpecificStatus.push_back("TRUNCATION"); - m_vec_SpecificStatus.push_back("SHORT_FRAGMENT"); - m_vec_SpecificStatus.push_back("FRAGMENT_LOST"); - m_vec_SpecificStatus.push_back("FRAGMENT_PENDING"); - m_vec_SpecificStatus.push_back("ROL_DISABLED"); -} - -// Destructor. -TrigROBDataProviderSvc::~TrigROBDataProviderSvc() -{ -} - -// Initialization -StatusCode TrigROBDataProviderSvc::initialize() -{ - StatusCode sc = ROBDataProviderSvc::initialize(); - - // set message stream - m_msg = new MsgStream( msgSvc(), name() ); - - m_callerName = "UNKNOWN"; - - IntegerProperty baseOutputLevel; - baseOutputLevel.assign(ROBDataProviderSvc::getProperty("OutputLevel")) ; - if (m_msg) m_msg->setLevel( baseOutputLevel.value() ); - - logStream() << MSG::INFO << " ---> TrigROBDataProviderSvc = " << name() << " initialize " - << " - package version " << PACKAGE_VERSION << endmsg ; - - // get Property filterEmptyROB from base class - if ( !sc.isSuccess() ) { - logStream() << MSG::ERROR << " ROBDataProviderSvc::initialize() failed." << endmsg; - return sc; - } else { - BooleanProperty filterEmptyROB; - filterEmptyROB.setName("filterEmptyROB"); - if (filterEmptyROB.assign(getProperty("filterEmptyROB"))) { - m_removeEmptyROB = filterEmptyROB.value() ; - logStream() << MSG::INFO << " ---> getProperty('filterEmptyROB') = " << filterEmptyROB << endmsg; - } else { - logStream() << MSG::WARNING << " ROBDataProviderSvc::getProperty('filterEmptyROB') failed." << endmsg; - } - } - - // intialize L1 ROBIds - m_l1_ROB_ids.reserve(49); - - m_l1_ROB_ids.push_back(0x910081); // TDAQ_CALO_TOPO_PROC ROBs - m_l1_ROB_ids.push_back(0x910091); - - // ROBs from ROIB - m_l1_ROB_ids.push_back(0x770001); // CTP - m_l1_ROB_ids.push_back(0x760001); // muCTPi - m_l1_ROB_ids.push_back(0x76000b); // L1Muctpi_on_RDO - - m_l1_ROB_ids.push_back(0x7300a8); // Calo cluster RoI - m_l1_ROB_ids.push_back(0x7300a9); // Calo cluster RoI - m_l1_ROB_ids.push_back(0x7300aa); // Calo cluster RoI - m_l1_ROB_ids.push_back(0x7300ab); // Calo cluster RoI - m_l1_ROB_ids.push_back(0x7500ac); // Calo Jet/Energy RoI - m_l1_ROB_ids.push_back(0x7500ad); // Calo Jet/Energy RoI - - // ROBs from CPMSim/CPCMX -24 - m_l1_ROB_ids.push_back(0x720008); - m_l1_ROB_ids.push_back(0x720018); - m_l1_ROB_ids.push_back(0x720028); - m_l1_ROB_ids.push_back(0x720038); - m_l1_ROB_ids.push_back(0x720009); - m_l1_ROB_ids.push_back(0x720019); - m_l1_ROB_ids.push_back(0x720029); - m_l1_ROB_ids.push_back(0x720039); - m_l1_ROB_ids.push_back(0x72000a); - m_l1_ROB_ids.push_back(0x72001a); - m_l1_ROB_ids.push_back(0x72002a); - m_l1_ROB_ids.push_back(0x72003a); - m_l1_ROB_ids.push_back(0x72000b); - m_l1_ROB_ids.push_back(0x72001b); - m_l1_ROB_ids.push_back(0x72002b); - m_l1_ROB_ids.push_back(0x72003b); - m_l1_ROB_ids.push_back(0x730088); - m_l1_ROB_ids.push_back(0x730098); - m_l1_ROB_ids.push_back(0x730089); - m_l1_ROB_ids.push_back(0x730099); - m_l1_ROB_ids.push_back(0x73008a); - m_l1_ROB_ids.push_back(0x73009a); - m_l1_ROB_ids.push_back(0x73008b); - m_l1_ROB_ids.push_back(0x73009b); - - // ROBs from JEMJetSim/JEMEnergySim -12 - m_l1_ROB_ids.push_back(0x74000c); - m_l1_ROB_ids.push_back(0x74001c); - m_l1_ROB_ids.push_back(0x74002c); - m_l1_ROB_ids.push_back(0x74003c); - m_l1_ROB_ids.push_back(0x74000d); - m_l1_ROB_ids.push_back(0x74001d); - m_l1_ROB_ids.push_back(0x74002d); - m_l1_ROB_ids.push_back(0x74003d); - m_l1_ROB_ids.push_back(0x75008c); - m_l1_ROB_ids.push_back(0x75009c); - m_l1_ROB_ids.push_back(0x75008d); - m_l1_ROB_ids.push_back(0x75009d); - - // ROBs from DAQ - m_l1_ROB_ids.push_back(0x770000); // CTP DAQ - m_l1_ROB_ids.push_back(0x760000); // muCTPi DAQ - // preload also L2 result, when available - m_l1_ROB_ids.push_back(0x7b0000); // L2 HLT result - - - // get the list of enabled ROBs from OKS - bool robOKSconfigFound = false; - bool robLArMetOKSconfigFound = false; - bool robTileMetOKSconfigFound = false; - bool robRosOKSconfigFound = false; - - if ( m_readROBfromOKS.value() ) { - ServiceHandle<IJobOptionsSvc> p_jobOptionsSvc("JobOptionsSvc", name()); - if ((p_jobOptionsSvc.retrieve()).isFailure()) { - logStream() << MSG::ERROR << "Could not find JobOptionsSvc" << endmsg; - } else { - const std::vector<const Property*>* dataFlowProps = p_jobOptionsSvc->getProperties("DataFlowConfig"); - if (dataFlowProps) { - for ( std::vector<const Property*>::const_iterator cur = dataFlowProps->begin(); - cur != dataFlowProps->end(); cur++) { - // the enabled ROB list is found - if ( (*cur)->name() == "DF_Enabled_ROB_IDs" ) { - if (m_enabledROBs.assign(**cur)) { - robOKSconfigFound = true; - logStream() << MSG::INFO << " ---> Read from OKS = " << m_enabledROBs.value().size() << " enabled ROB IDs." << endmsg; - } else { - logStream() << MSG::WARNING << " Could not set Property 'enabledROBs' from OKS." << endmsg; - } - } - - // the LAr MET ROB list is found - if ( (*cur)->name() == "DF_LAr_MET_ROB_IDs" ) { - if (m_enabledLArMetROBs.assign(**cur)) { - robLArMetOKSconfigFound = true; - logStream() << MSG::INFO << " ---> Read from OKS = " << m_enabledLArMetROBs.value().size() << " LAr MET ROB IDs." << endmsg; - } else { - logStream() << MSG::WARNING << " Could not set Property 'LArMetROBs' from OKS." << endmsg; - } - } - - // the Tile MET ROB list is found - if ( (*cur)->name() == "DF_Tile_MET_ROB_IDs" ) { - if (m_enabledTileMetROBs.assign(**cur)) { - robTileMetOKSconfigFound = true; - logStream() << MSG::INFO << " ---> Read from OKS = " << m_enabledTileMetROBs.value().size() << " Tile MET ROB IDs." << endmsg; - } else { - logStream() << MSG::WARNING << " Could not set Property 'TileMetROBs' from OKS." << endmsg; - } - } - - // the ROB-ROS mapping is found - if ( (*cur)->name() == "DF_ROB_ROS_Mapping" ) { - if (m_rob_ros_map.assign(**cur)) { - robRosOKSconfigFound = true; - logStream() << MSG::INFO << " ---> Read from OKS = " << m_rob_ros_map.value().size() << " ROB/ROS mapping values." << endmsg; - } else { - logStream() << MSG::WARNING << " Could not set Property 'RobRosMapping' from OKS." << endmsg; - } - } - } - } else { - logStream() << MSG::WARNING << " No 'DataFlowConfig' properties available in JobOptionsSvc " << endmsg; - } - p_jobOptionsSvc.release().ignore(); - } - } - - logStream() << MSG::INFO << " ---> TrigROBDataProviderSvc = " << name() << " special properties <---" << endmsg; - logStream() << MSG::INFO << " ---> Filter out empty ROB fragments = " << m_removeEmptyROB << endmsg; - logStream() << MSG::INFO << " ---> Fill monitoring histograms = " << m_doMonitoring << endmsg; - logStream() << MSG::INFO << " Hist:RequestedROBsPerCall = " << m_histProp_requestedROBsPerCall << endmsg; - logStream() << MSG::INFO << " Hist:ReceivedROBsPerCall = " << m_histProp_receivedROBsPerCall << endmsg; - logStream() << MSG::INFO << " Hist:TimeROBretrieval = " << m_histProp_timeROBretrieval << endmsg; - logStream() << MSG::INFO << " Hist:RetrievedROBsPerAlgo = " << m_histProp_retrievedROBsPerAlgo << endmsg; - logStream() << MSG::INFO << " Hist:ROSRequest = " << m_histProp_ROSRequest << endmsg; - logStream() << MSG::INFO << " ---> Do detailed ROB monitoring = " << m_doDetailedROBMonitoring << endmsg; - logStream() << MSG::INFO << " ---> SG name for ROB monitoring collect. = " << m_ROBDataMonitorCollection_SG_Name << endmsg; - logStream() << MSG::INFO << " ---> Read list of enabled ROBs from OKS = " << m_readROBfromOKS << endmsg; - if (m_enabledROBs.value().size() == 0) { - logStream() << MSG::INFO << " ---> The list of enabled ROBs has size = 0. No check will be performed " << endmsg; - } else { - if (m_readROBfromOKS.value() && robOKSconfigFound) { - logStream() << MSG::INFO << " ---> The list of enabled ROBs has size = " << m_enabledROBs.value().size() - << ". It was read from the partition database." << endmsg; - } else { - logStream() << MSG::INFO << " ---> The list of enabled ROBs has size = " << m_enabledROBs.value().size() - << ". It was read from job options." << endmsg; - } - } - - logStream() << MSG::INFO << " ---> Generic Module ID for LAr MET ROB = " << m_genericLArMetModuleID << endmsg; - if (m_enabledLArMetROBs.value().size() == 0) { - logStream() << MSG::INFO << " ---> The list of LAr MET ROBs has size = 0. No LAr MET ROB access will be done." << endmsg; - } else { - if (m_readROBfromOKS.value() && robLArMetOKSconfigFound) { - logStream() << MSG::INFO << " ---> The list of LAr MET ROBs has size = " << m_enabledLArMetROBs.value().size() - << ". It was read from the partition database." << endmsg; - } else { - logStream() << MSG::INFO << " ---> The list of LAr MET ROBs has size = " << m_enabledLArMetROBs.value().size() - << ". It was read from job options." << endmsg; - } - } - - logStream() << MSG::INFO << " ---> Generic Module ID for Tile MET ROB = " << m_genericTileMetModuleID << endmsg; - if (m_enabledTileMetROBs.value().size() == 0) { - logStream() << MSG::INFO << " ---> The list of Tile MET ROBs has size = 0. No Tile MET ROB access will be done." << endmsg; - } else { - if (m_readROBfromOKS.value() && robTileMetOKSconfigFound) { - logStream() << MSG::INFO << " ---> The list of Tile MET ROBs has size = " << m_enabledTileMetROBs.value().size() - << ". It was read from the partition database." << endmsg; - } else { - logStream() << MSG::INFO << " ---> The list of Tile MET ROBs has size = " << m_enabledTileMetROBs.value().size() - << ". It was read from job options." << endmsg; - } - } - - logStream() << MSG::INFO << " ---> Separate MET and Det ROB Retrieval = " << m_separateMETandDetROBRetrieval << endmsg; - - if (m_rob_ros_map.value().size() == 0) { - logStream() << MSG::INFO << " ---> The mapping of ROBs to ROSes has size = 0. No ROB/ROS mapping will be used for ROB prefetching." << endmsg; - m_useROSmappingForROBRetrieval = false; // reset the job property - } else { - if (m_readROBfromOKS.value() && robRosOKSconfigFound) { - logStream() << MSG::INFO << " ---> The ROB/ROS mapping has size = " << m_rob_ros_map.value().size() - << ". It was read from the partition database." << endmsg; - } else { - logStream() << MSG::INFO << " ---> The ROB/ROS mapping has size = " << m_rob_ros_map.value().size() - << ". It was read from job options." << endmsg; - } - } - - logStream() << MSG::INFO << " ---> Use ROB/ROS mapping for ROB prefetching/retrieval = " << m_useROSmappingForROBRetrieval << endmsg; - - if (m_ignoreROB.value().size() == 0) { - logStream() << MSG::INFO << " ---> The list of ROBs to ignore has size = 0. No check will be performed " << endmsg; - } else { - logStream() << MSG::INFO << " ---> The list of ROBs to ignore has size = " << m_ignoreROB.value().size() << endmsg; - } - - for (unsigned int i=0; i<m_ignoreROB.value().size(); i++) { - logStream() << MSG::INFO << " ---> do not retrieve ROB[" << i << "]: hex(id)=0x" - << MSG::hex << m_ignoreROB.value()[i]<<MSG::dec - << " dec(id)="<< m_ignoreROB.value()[i] << endmsg; - } - - logStream() << MSG::INFO << " ---> Simulate online ROB data access (Network access) = " << m_simulateOnlineDataAccess << endmsg; - if (m_simulateOnlineDataAccess.value() && !m_useROSmappingForROBRetrieval.value()) { - logStream() << MSG::ERROR << " +-----------------------------------------------------------------------------------------------+ " << endmsg; - logStream() << MSG::ERROR << " | Simulate online data access is switched on but no ROB-ROS mapping is provided. | " << endmsg; - logStream() << MSG::ERROR << " | Online simulation is not meainigful in this case. | " << endmsg; - logStream() << MSG::ERROR << " | Set 'UseROSmappingForROBRetrieval' to True and provide a ROB-ROS mapping with 'RobRosMapping' | " << endmsg; - logStream() << MSG::ERROR << " | A simple ROB-ROS mapping can be generated from the Bytestream input file with the scipt | " << endmsg; - logStream() << MSG::ERROR << " | 'generate-rob-ros-map-from-data.py' in the TrigROBDataProviderSvc package. | " << endmsg; - logStream() << MSG::ERROR << " +-----------------------------------------------------------------------------------------------+ " << endmsg; - return StatusCode::FAILURE; - } - - logStream() << MSG::INFO << " ---> Print Stack Trace for failed ROB access (DEBUG) = " << m_printStackTraceGetROBData << endmsg; - - // register incident handler for begin run - ServiceHandle<IIncidentSvc> incidentSvc("IncidentSvc", name()); - if ((incidentSvc.retrieve()).isFailure()) { - logStream() << MSG::ERROR << "Unable to locate IncidentSvc" << endmsg; - incidentSvc.release().ignore(); - return StatusCode::FAILURE; - } - long int pri=100; - incidentSvc->addListener(this,"BeginRun",pri); - incidentSvc.release().ignore(); - - // Setup the StoreGateSvc - ATH_CHECK( m_storeGateSvc.retrieve() ); - - return sc; -} - -// Initialization -StatusCode TrigROBDataProviderSvc::finalize() -{ - StatusCode sc = ROBDataProviderSvc::finalize(); - logStream() << MSG::DEBUG << "finalize()" << endmsg; - if ( !sc.isSuccess() ) { - logStream() << MSG::ERROR << " ROBDataProviderSvc::finalize() failed." << endmsg; - } - - // delete message stream - if ( m_msg ) delete m_msg; - - // release the AlgContextSvc if used - if ( m_algContextSvc ) m_algContextSvc->release(); - - return sc; -} - -/// Query interface -StatusCode TrigROBDataProviderSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) -{ - if ( IROBDataProviderSvc::interfaceID().versionMatch(riid) ) { - *ppvInterface = (IROBDataProviderSvc*)this; - } else if ( ITrigROBDataProviderSvc::interfaceID().versionMatch(riid) ) { - *ppvInterface = (ITrigROBDataProviderSvc*)this; - } else if ( ITrigROBDataProviderSvcPrefetch::interfaceID().versionMatch(riid) ) { - *ppvInterface = (ITrigROBDataProviderSvcPrefetch*)this; - } else if ( IIncidentListener::interfaceID().versionMatch(riid) ) { - *ppvInterface = (IIncidentListener*)this; - } else { - return Service::queryInterface(riid, ppvInterface); - } - addRef(); - return StatusCode::SUCCESS; -} - -/** - in online add ROB fragments for given ROB ids to the map - call the DataCollector to retrieve the ROB fragments - - - in offline only check that given ROB ids are in the map, issue an - error if not -*/ -void TrigROBDataProviderSvc::addROBData(const std::vector<uint32_t>& robIds, const std::string_view callerName) -{ - //------------------- - // remove empty calls - //------------------- - if (robIds.size() == 0) return; - - //-------------------- - // set the caller name - //-------------------- - setCallerName(callerName); - - //-------------------- - // make unique ROB IDs - //-------------------- - std::vector<uint32_t>::iterator remove_duplicate; - std::vector<uint32_t> robIdsUnique(robIds); - - sort(robIdsUnique.begin(), robIdsUnique.end()); - remove_duplicate = unique(robIdsUnique.begin(), robIdsUnique.end()); - robIdsUnique.erase(remove_duplicate, robIdsUnique.end()); - - //------------------------------------------------------------------ - // Replace the generic MET ROB ID with the full list of all MET ROBs - //------------------------------------------------------------------ - // LAr MET ROBs - uint32_t generic_LAr_MET_id = eformat::helper::SourceIdentifier(eformat::TDAQ_LAR_MET,m_genericLArMetModuleID.value()).code(); - std::vector<uint32_t>::iterator rob_LAr_Met_it = std::find(robIdsUnique.begin(), robIdsUnique.end(), generic_LAr_MET_id); - if (rob_LAr_Met_it != robIdsUnique.end()) { - robIdsUnique.erase(rob_LAr_Met_it); - if (m_enabledLArMetROBs.value().size() != 0) robIdsUnique.insert(robIdsUnique.end(),m_enabledLArMetROBs.value().begin(),m_enabledLArMetROBs.value().end()); - } - - // Tile MET ROBs - uint32_t generic_Tile_MET_id = eformat::helper::SourceIdentifier(eformat::TDAQ_TILE_MET,m_genericTileMetModuleID.value()).code(); - std::vector<uint32_t>::iterator rob_Tile_Met_it = std::find(robIdsUnique.begin(), robIdsUnique.end(), generic_Tile_MET_id); - if (rob_Tile_Met_it != robIdsUnique.end()) { - robIdsUnique.erase(rob_Tile_Met_it); - if (m_enabledTileMetROBs.value().size() != 0) robIdsUnique.insert(robIdsUnique.end(),m_enabledTileMetROBs.value().begin(),m_enabledTileMetROBs.value().end()); - } - - //------------------- - //--- offline running - //------------------- - if (!m_onlineRunning) { - - // for offline running all requested ROBs should be found in cache - // if not issue error - ROBDataProviderSvc::addROBData(robIdsUnique); - //------------------ - //--- online running - //------------------ - } else { - // detailed ROB monitoring - //------------------------ - // Create a ROB monitoring collection and register it to StoreGate - ROBDataMonitorCollection* p_robMonCollection(0); - if ( m_doDetailedROBMonitoring.value() ) { - if ( !(m_storeGateSvc->transientContains<ROBDataMonitorCollection>(m_ROBDataMonitorCollection_SG_Name.value())) ) { - p_robMonCollection = new ROBDataMonitorCollection; - if ( p_robMonCollection ) { - p_robMonCollection->reserve( 10 ) ; - if ( (m_storeGateSvc->record(p_robMonCollection, m_ROBDataMonitorCollection_SG_Name.value(), true)).isFailure() ) { - logStream() << MSG::WARNING << " Registering ROB Monitoring collection in StoreGate failed." << endmsg; - delete p_robMonCollection; - p_robMonCollection = 0; - } - } - } else { - if ( m_storeGateSvc->retrieve(p_robMonCollection).isFailure() ) { - logStream() << MSG::WARNING << " Retrieval of ROB Monitoring collection from StoreGate failed." << endmsg; - p_robMonCollection = 0; - } - } - } - - // create a new ROBDataMonitorStruct and fill it - robmonitor::ROBDataMonitorStruct* p_robMonStruct(0); - if ( p_robMonCollection ) { - // initialize new ROBDataMonitorStruct - p_robMonStruct = new robmonitor::ROBDataMonitorStruct(lvl1_id(), robIdsUnique, m_callerName); - } - - // for online running the requested ROBs should be not found in cache - // ------------------------------------------------------------------ - // vector with missing ROB ids for DataCollector - std::vector<uint32_t> vRobIds; - vRobIds.reserve( robIdsUnique.size() ) ; - - // find missing ROB ids which should be retrieved - if(logLevel() <= MSG::DEBUG) - logStream() << MSG::DEBUG << " ---> addROBData for "<<m_callerName<<": Number of ROB Ids requested : " << robIdsUnique.size() << endmsg; - - for(std::vector<uint32_t>::const_iterator it=robIdsUnique.begin(); it!=robIdsUnique.end(); ++it){ - uint32_t id = (*it); - // mask off the module ID for L2 and EF result for Run 1 data - if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_LVL2) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - if (!m_maskL2EFModuleID) { - ATH_MSG_ERROR("Inconsistent flag for masking L2/EF module IDs"); - m_maskL2EFModuleID=true; - } - } else if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_EVENT_FILTER) && - (m_maskL2EFModuleID) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - } - // check if ROB is already in cache - ONLINE_ROBMAP::iterator map_it = m_online_robmap.find(id) ; - if(map_it != m_online_robmap.end()) { - if(logLevel() <= MSG::DEBUG) - logStream() << MSG::DEBUG << " ---> addROBData for "<<m_callerName<<": Found ROB Id : 0x" << MSG::hex << (*map_it).second.source_id() << MSG::dec - <<" in cache "<< endmsg; - //* detailed monitoring - if ( p_robMonStruct ) { - (p_robMonStruct->requested_ROBs)[id].rob_history = robmonitor::CACHED; - (p_robMonStruct->requested_ROBs)[id].rob_size = ((*map_it).second).fragment_size_word(); - if ( (*map_it).second.nstatus() != 0 ) { - const uint32_t* it_status; - (*map_it).second.status(it_status); - for (uint32_t k=0; k < (*map_it).second.nstatus(); k++) { - (p_robMonStruct->requested_ROBs)[id].rob_status_words.push_back( *(it_status+k) ); - } - } - } - continue; - } - - // check if ROB should be ignored - if (m_ignoreROB.value().size() != 0) { - std::vector<uint32_t>::const_iterator rob_ignore_it = - std::find(m_ignoreROB.value().begin(), m_ignoreROB.value().end(),id); - if(rob_ignore_it != m_ignoreROB.value().end()) { - if(logLevel() <= MSG::DEBUG) - logStream() << MSG::DEBUG << " ---> addROBData for "<<m_callerName<<": ROB Id : 0x" << MSG::hex << id << MSG::dec - << " will be not retrieved, since it is on the veto list."<< endmsg; - //* detailed monitoring - if ( p_robMonStruct ) { - (p_robMonStruct->requested_ROBs)[id].rob_history = robmonitor::IGNORED; - } - continue; - } - } - - // check if ROB is actually enabled for readout - // do not perform this check for MET ROBs - if ( (m_enabledROBs.value().size() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() != eformat::TDAQ_LAR_MET) && - (eformat::helper::SourceIdentifier(id).subdetector_id() != eformat::TDAQ_TILE_MET) ){ - std::vector<uint32_t>::const_iterator rob_enabled_it = - std::find(m_enabledROBs.value().begin(), m_enabledROBs.value().end(),id); - if(rob_enabled_it == m_enabledROBs.value().end()) { - if(logLevel() <= MSG::DEBUG) - logStream() << MSG::DEBUG << " ---> addROBData for "<<m_callerName<<": ROB Id : 0x" << MSG::hex << id << MSG::dec - << " will be not retrieved, since it is not on the list of enabled ROBs."<< endmsg; - //* detailed monitoring - if ( p_robMonStruct ) { - (p_robMonStruct->requested_ROBs)[id].rob_history = robmonitor::DISABLED; - } - continue; - } - } - - // check that ROB is not already on the list - std::vector<uint32_t>::const_iterator rob_duplicate_it = std::find(vRobIds.begin(), vRobIds.end(),id); - if(rob_duplicate_it != vRobIds.end()) { - if(logLevel() <= MSG::DEBUG) - logStream() << MSG::DEBUG << " ---> addROBData for "<<m_callerName<<": ROB Id : 0x" << MSG::hex << id << MSG::dec - << " found multiple times on list. Only one copy will be retrieved."<< endmsg; - continue; - } - - // in case a ROB-ROS mapping is used, check that the id is present in the ROB-ROS map - if ( (m_useROSmappingForROBRetrieval.value()) && (m_rob_ros_map.value().find(id) == m_rob_ros_map.value().end()) ) { - logStream() << MSG::WARNING << " ---> addROBData for "<<m_callerName<<": ROB Id : 0x" << MSG::hex << id << MSG::dec - <<" is not found in the ROB-ROS mapping. ROB can not be scheduled for retrieval. Check ROB-ROS mapping." - << endmsg; - continue; - } - - // the ROB should be retrieved from the ROS - if (logLevel() <= MSG::VERBOSE) - logStream() << MSG::VERBOSE << " ---> addROBData for "<<m_callerName<<": Request ROB Id : 0x" << MSG::hex << id << MSG::dec - <<" from ROS "<< endmsg; - vRobIds.push_back( *it ) ; - if ( (m_useROSmappingForROBRetrieval.value()) && (m_Det_Robs_for_retrieval.find(id)==m_Det_Robs_for_retrieval.end()) ) { - m_Det_Robs_for_retrieval[ *it ] = m_rob_ros_map.value().find(id)->second ; - } - } // end loop over requested input ROBs - - if (vRobIds.size() == 0) { - if(logLevel() <= MSG::DEBUG) - logStream() << MSG::DEBUG - << " ---> addROBData for "<<m_callerName<<": either all requested ROBs are found in cache for running mode ONLINE, \n" - << " or input ROB Id list was empty, \n" - << " or all requested ROBs were not retrieved due to the veto list.\n" - << " Number of requested ROB Ids = " << robIdsUnique.size() << "\n" - << " Lvl1 id = " << lvl1_id() - << endmsg; - // Set ROB request time also in the case when no DataCollector request is necessary - // to allow correlation with RoI request times - // start and stop times will be equal - if ( p_robMonStruct ) { - struct timeval time_start; - struct timeval time_stop; - - gettimeofday(&time_start, 0); - gettimeofday(&time_stop, 0); - - p_robMonStruct->start_time_of_ROB_request = time_start; - p_robMonStruct->end_time_of_ROB_request = time_stop; - } - } else { - // - // Either no ROS/ROB mapping is available or it should not be used - // add the requested ROBs already here to the ROB cache - // --------------------------------------------------------------- - // - if (!m_useROSmappingForROBRetrieval.value()) { - std::vector<uint32_t> retrievedRobIds; - retrievedRobIds.reserve( vRobIds.size() ); - addROBDataToCache(vRobIds, retrievedRobIds, p_robMonStruct); - } else { // ROS/ROB mapping will be used, print the ROB ids for prefetching - //* detailed monitoring - if ( p_robMonStruct ) { - for (std::map<uint32_t,int>::const_iterator map_it=m_Det_Robs_for_retrieval.begin(); map_it!=m_Det_Robs_for_retrieval.end(); ++map_it){ - uint32_t id =(*map_it).first; - (p_robMonStruct->requested_ROBs)[id].rob_history = robmonitor::SCHEDULED; - (p_robMonStruct->requested_ROBs)[id].rob_size = 1; - } - } - if(logLevel() <= MSG::DEBUG) { - std::ostringstream ost; - ost << " Number of scheduled ROB Ids = " << m_Det_Robs_for_retrieval.size() << "\n" ; - unsigned int rob_counter = 1; - for (std::map<uint32_t,int>::const_iterator map_it=m_Det_Robs_for_retrieval.begin(); map_it!=m_Det_Robs_for_retrieval.end(); ++map_it,++rob_counter){ - ost << " # = "<< std::setw(5) << rob_counter << " ROB id = 0x" << std::hex << (*map_it).first << std::dec - << " ROS id = 0x" << std::hex << (*map_it).second << std::dec << "\n"; - } - - logStream() << MSG::DEBUG - << " ---> addROBData for "<<m_callerName<<": A ROB/ROS mapping is available the following ROB Ids are scheduled for retrieval in getROBData: \n" - << " Lvl1 id = " << lvl1_id() << "\n" - << ost.str() - << endmsg; - } - } // end if (!m_useROSmappingForROBRetrieval.value()) - } - - // add the ROB monitoring structure to the collection - if ( p_robMonCollection && p_robMonStruct ) p_robMonCollection->push_back( p_robMonStruct ); - - } // end online running - return; -} - -uint32_t TrigROBDataProviderSvc::lvl1_id() { - return getEvent()->lvl1_id(); -} - -/** - in online add the LVL1/LVL2 result - - rebuild the map - - set flag for online running -*/ - -void TrigROBDataProviderSvc::setNextEvent(const std::vector<ROBF>& result) -{ - // clear the ROB map - m_online_robmap.clear(); - //m_currentLvl1ID = 0; - - // clear the maps used for prefetching - m_Det_Robs_for_retrieval.clear(); - - // set the online flag - m_onlineRunning = true ; - - // set the complete event flag - m_isEventComplete = false; - - // clear the ROB info object from steering - if (m_RobRequestInfo) m_RobRequestInfo->clearRequestScheduledRobIDs(); - - if ( result.size() == 0 ) { - logStream()<<MSG::ERROR<< " ---> setNextEvent online for "<< name() - <<" failed: Size of received vector of ROB fragments = " << result.size() - <<endmsg; - return; - } - - // set the LVL1 id - uint32_t currentLvl1ID = result[0].rod_lvl1_id(); - - // add fragments to map - std::vector<ROBF>::const_iterator it_robf = result.begin(); - std::vector<ROBF>::const_iterator it_robf_end = result.end(); - - for(; it_robf!=it_robf_end; ++it_robf) { - uint32_t id = it_robf->source_id() ; - // check current L1 ID against CTP fragment when possible - if ( (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_CTP) && - ( it_robf->rod_lvl1_id() != currentLvl1ID ) ) { - logStream() << MSG::ERROR << " ---> Lvl1 ID mismatch for CTP fragment with SourceId = 0x" << MSG::hex << id << MSG::dec - << " and L1 Id = " << it_robf->rod_lvl1_id() - << " to currently used L1 Id = " << currentLvl1ID - << " -> Use CTP version from now on."<< endmsg; - // currentLvl1ID = it_robf->rod_lvl1_id(); // TB is this ERROR real or some past history - } - // remove empty ROB fragments or ones with bad status, if requested - if ((it_robf->rod_ndata() == 0) && (m_removeEmptyROB)) { - if(logLevel() <= MSG::DEBUG) { - logStream() << MSG::DEBUG << " ---> Empty ROB Id = 0x" << MSG::hex << id << MSG::dec - << " removed for L1 Id = " << currentLvl1ID << endmsg; - } - } else if ( ROBDataProviderSvc::filterRobWithStatus(&*it_robf) ) { - if ((logLevel() <= MSG::DEBUG) && (it_robf->nstatus() > 0)) { - const uint32_t* it_status; - it_robf->status(it_status); - eformat::helper::Status tmpstatus( (*it_status) ) ; - logStream() << MSG::DEBUG << " ---> ROB Id = 0x" << MSG::hex << id - << std::setfill( '0' ) - << " with Generic Status Code = 0x" << std::setw(4) << tmpstatus.generic() - << " and Specific Status Code = 0x" << std::setw(4) << tmpstatus.specific() - << MSG::dec - << " removed for L1 Id = " << currentLvl1ID << endmsg; - } - } else { - // mask off the module ID for L2 and EF result for Run 1 data - if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_LVL2) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - if (!m_maskL2EFModuleID) { - ATH_MSG_ERROR("Inconsistent flag for masking L2/EF module IDs"); - m_maskL2EFModuleID=true; - } - } else if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_EVENT_FILTER) && - (m_maskL2EFModuleID) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - } - m_online_robmap[id]= (*it_robf) ; - } - - //* fill monitoring histogram for ROB generic status - if ( ( m_hist_genericStatusForROB ) && ( it_robf->nstatus() != 0 ) ) { - const uint32_t* it_status; - it_robf->status(it_status); - if ((*it_status) != 0) { - oh_scoped_lock_histogram lock; - m_hist_genericStatusForROB->Fill(eformat::helper::SourceIdentifier(it_robf->source_id()).human_detector().c_str(), - m_map_GenericStatus[eformat::helper::Status(*it_status).generic()].c_str(),1.); - } - } - - //* fill monitoring histogram for ROB specific status - if ( ( m_hist_specificStatusForROB ) && ( it_robf->nstatus() != 0 ) ) { - const uint32_t* it_status; - it_robf->status(it_status); - if ((*it_status) != 0) { - oh_scoped_lock_histogram lock; - std::bitset<16> specificBits(eformat::helper::Status(*it_status).specific()); - for (unsigned int index=0; index < 16; ++index) { - if (specificBits[index]) m_hist_specificStatusForROB->Fill(eformat::helper::SourceIdentifier(it_robf->source_id()).human_detector().c_str(), - m_vec_SpecificStatus[index].c_str(),1.); - } - } - } - } - - if(logLevel() <= MSG::DEBUG) { - logStream()<<MSG::DEBUG<< " ---> setNextEvent online for "<< name()<<endmsg; - logStream()<<MSG::DEBUG<< " online running = " << m_onlineRunning <<endmsg; - logStream()<<MSG::DEBUG<< " current LVL1 id = " << currentLvl1ID <<endmsg; - logStream()<<MSG::DEBUG<< " # LVL1 ROBs = " << result.size() <<endmsg; - logStream()<<MSG::DEBUG<< " size of ROB cache = " << m_online_robmap.size() <<endmsg; - logStream()<<MSG::DEBUG<< dumpROBcache() <<endmsg; - } - return; -} - -/** - add a new Raw event - - rebuild the map - - set flag for offline running -*/ -void TrigROBDataProviderSvc::setNextEvent(const RawEvent* re) -{ - // set the offline flag - m_onlineRunning = false ; - - // set the event complete flag - m_isEventComplete = true ; - - ROBDataProviderSvc::setNextEvent(re); - // set flag for masking L2/EF module ID, this is only necessary for the separate L2 and EF systems from Run 1 - m_maskL2EFModuleID = ROBDataProviderSvc::m_maskL2EFModuleID; - - if (m_simulateOnlineDataAccess.value()) { - // now get L1 result - std::vector<const ROBF*> l1_ROB_fragments; - ROBDataProviderSvc::getROBData(m_l1_ROB_ids, l1_ROB_fragments); - - std::vector<ROBF> l1_result; - l1_result.reserve(l1_ROB_fragments.size()); - - for(std::vector<const ROBF*>::const_iterator it=l1_ROB_fragments.begin(); it != l1_ROB_fragments.end(); ++it) { - l1_result.push_back(**it); - if (eformat::helper::SourceIdentifier( (*it)->source_id() ).subdetector_id() == eformat::TDAQ_LVL2) m_maskL2EFModuleID = true; - } - setNextEvent(l1_result); - } - - return ; -} - -/** return ROBData for ROBID - */ -void TrigROBDataProviderSvc::getROBData(const std::vector<uint32_t>& robIds, std::vector<const ROBF*>& robFragments, std::string_view callerName) -{ - - //-------------------- - // set the caller name - //-------------------- - setCallerName(callerName); - - //------------------- - //--- offline running - //------------------- - if (!m_onlineRunning) { - ROBDataProviderSvc::getROBData(robIds,robFragments); - //------------------ - //--- online running - //------------------ - } else { - // --------------------------------------------------------------------------------------------- - // make sure that all ROB prefetching information is taken into account before the ROB retrieval - // --------------------------------------------------------------------------------------------- - if (m_RobRequestInfo) { - // add ROBs in the info object to the prefetching list - addROBData(m_RobRequestInfo->requestScheduledRobIDs()); - m_RobRequestInfo->clearRequestScheduledRobIDs(); - } - - //-------------------- - // make unique ROB IDs - //-------------------- - std::vector<uint32_t>::iterator remove_duplicate; - std::vector<uint32_t> robIdsUnique(robIds); - - sort(robIdsUnique.begin(), robIdsUnique.end()); - remove_duplicate = unique(robIdsUnique.begin(), robIdsUnique.end()); - robIdsUnique.erase(remove_duplicate, robIdsUnique.end()); - - //------------------------------------------------------------------ - // Replace the generic MET ROB ID with the full list of all MET ROBs - //------------------------------------------------------------------ - // LAr MET ROBs - uint32_t generic_LAr_MET_id = eformat::helper::SourceIdentifier(eformat::TDAQ_LAR_MET,m_genericLArMetModuleID.value()).code(); - std::vector<uint32_t>::iterator rob_LAr_Met_it = std::find(robIdsUnique.begin(), robIdsUnique.end(), generic_LAr_MET_id); - if (rob_LAr_Met_it != robIdsUnique.end()) { - robIdsUnique.erase(rob_LAr_Met_it); - if (m_enabledLArMetROBs.value().size() != 0) robIdsUnique.insert(robIdsUnique.end(),m_enabledLArMetROBs.value().begin(),m_enabledLArMetROBs.value().end()); - } - - // Tile MET ROBs - uint32_t generic_Tile_MET_id = eformat::helper::SourceIdentifier(eformat::TDAQ_TILE_MET,m_genericTileMetModuleID.value()).code(); - std::vector<uint32_t>::iterator rob_Tile_Met_it = std::find(robIdsUnique.begin(), robIdsUnique.end(), generic_Tile_MET_id); - if (rob_Tile_Met_it != robIdsUnique.end()) { - robIdsUnique.erase(rob_Tile_Met_it); - if (m_enabledTileMetROBs.value().size() != 0) robIdsUnique.insert(robIdsUnique.end(),m_enabledTileMetROBs.value().begin(),m_enabledTileMetROBs.value().end()); - } - - //------------------------------------------------------------------ - // If a ROB/ROS mapping is used and a requested ROB is found on the - // list of ROB Ids which are scheduled for retrieval then update - // first the internal ROB cache with all scheduled ROBs in the same - // ROS - //------------------------------------------------------------------ - if ( (m_useROSmappingForROBRetrieval.value()) && (m_Det_Robs_for_retrieval.size()!=0) ) { - std::vector<uint32_t> robIdsForRetrieval, retrievedRobIds ; - - // create map ROS->vector<ROB Ids> - std::map<int, std::vector<uint32_t> > ros_rob_map_for_retrieval; - for (std::map<uint32_t,int>::const_iterator rob_ros_it=m_Det_Robs_for_retrieval.begin();rob_ros_it!=m_Det_Robs_for_retrieval.end();++rob_ros_it) { - ros_rob_map_for_retrieval[ rob_ros_it->second ].push_back( rob_ros_it->first ); - } - - // find ROBs which are requested and which are on the list of scheduled ROBs - // in case one ROB is found on the list all other scheduled ROBs on this list which are in the same ROS are retrieved - for (std::vector<uint32_t>::const_iterator requested_rob_it=robIdsUnique.begin(); requested_rob_it!=robIdsUnique.end();++requested_rob_it) { - std::map<uint32_t,int>::const_iterator rob_ros_it=m_Det_Robs_for_retrieval.find(*requested_rob_it); - if ((rob_ros_it!=m_Det_Robs_for_retrieval.end()) && (ros_rob_map_for_retrieval[ rob_ros_it->second ].size()!=0)) { - // put all ROBs in the same ROS on the retrieval list - robIdsForRetrieval.insert(robIdsForRetrieval.end(),ros_rob_map_for_retrieval[ rob_ros_it->second ].begin(),ros_rob_map_for_retrieval[ rob_ros_it->second ].end()); - // empty the retrieval list for this ROS, that it is not used multiple times - ros_rob_map_for_retrieval[ rob_ros_it->second ].clear(); - } - } - - // detailed ROB monitoring - //------------------------ - // Create a ROB monitoring collection and register it to StoreGate - ROBDataMonitorCollection* p_robMonCollection(0); - if ((m_doDetailedROBMonitoring.value()) && (robIdsForRetrieval.size() != 0)) { - if ( !(m_storeGateSvc->transientContains<ROBDataMonitorCollection>(m_ROBDataMonitorCollection_SG_Name.value())) ) { - p_robMonCollection = new ROBDataMonitorCollection; - if ( p_robMonCollection ) { - p_robMonCollection->reserve( 10 ) ; - if ( (m_storeGateSvc->record(p_robMonCollection, m_ROBDataMonitorCollection_SG_Name.value(), true)).isFailure() ) { - logStream() << MSG::WARNING << " getROBData: Registering ROB Monitoring collection in StoreGate failed." << endmsg; - delete p_robMonCollection; - p_robMonCollection = 0; - } - } - } else { - if ( m_storeGateSvc->retrieve(p_robMonCollection).isFailure() ) { - logStream() << MSG::WARNING << " getROBData: Retrieval of ROB Monitoring collection from StoreGate failed." << endmsg; - p_robMonCollection = 0; - } - } - } - - // create a new ROBDataMonitorStruct and fill it - robmonitor::ROBDataMonitorStruct* p_robMonStruct(0); - if ( p_robMonCollection ) { - // initialize new ROBDataMonitorStruct - p_robMonStruct = new robmonitor::ROBDataMonitorStruct(lvl1_id(), robIdsForRetrieval, m_callerName); - } - - // update internal ROB cache - retrievedRobIds.reserve( robIdsForRetrieval.size() ); - addROBDataToCache(robIdsForRetrieval, retrievedRobIds, p_robMonStruct); - - // remove successfully retrieved ROBs from the list of scheduled ROBs - for (std::vector<uint32_t>::const_iterator rob_it = retrievedRobIds.begin(); rob_it!=retrievedRobIds.end(); ++rob_it) { - m_Det_Robs_for_retrieval.erase( *rob_it ); - } - - // add the ROB monitoring structure to the collection - if ( p_robMonCollection && p_robMonStruct ) p_robMonCollection->push_back( p_robMonStruct ); - // std::cout <<(*p_robMonStruct)<<std::endl; - - } // end if (m_useROSmappingForROBRetrieval.value()) - - //------------------------------------------------------------------ - // Return requested ROBs from internal cache - //------------------------------------------------------------------ - for(std::vector<uint32_t>::const_iterator it = robIdsUnique.begin(); it != robIdsUnique.end(); ++it){ - uint32_t id = (*it); - - // mask off the module ID for L2 and EF result for Run 1 data - if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_LVL2) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - if (!m_maskL2EFModuleID) { - ATH_MSG_ERROR("Inconsistent flag for masking L2/EF module IDs"); - m_maskL2EFModuleID=true; - } - } else if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_EVENT_FILTER) && - (m_maskL2EFModuleID) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - } - - // exclude check on L1 ROBs - if (std::find(m_l1_ROB_ids.begin(), m_l1_ROB_ids.end(), id)!=m_l1_ROB_ids.end()) { - continue; - } - - ONLINE_ROBMAP::iterator map_it = m_online_robmap.find(id) ; - if(map_it != m_online_robmap.end()) { - robFragments.push_back( &((*map_it).second) ); - } else { - - if(logLevel() <= MSG::WARNING) { - logStream()<<MSG::WARNING<<" ---> getROBData: Failed to find ROB for id 0x" - <<MSG::hex<< id <<MSG::dec<<endmsg; - if (m_Det_Robs_for_retrieval.find(id)!=m_Det_Robs_for_retrieval.end()) { - logStream()<<MSG::WARNING<<" getROBData: The ROB id 0x" - <<MSG::hex<< id <<MSG::dec<<" was put on the prefetching list, but never arrived on the processor."<<endmsg; - } else { - logStream()<<MSG::WARNING<<" getROBData: The ROB id 0x" - <<MSG::hex<< id <<MSG::dec<<" was never put on the prefetching list."<<endmsg; - } - - // caller name of this method - std::vector<IAlgorithm*> knownAlgs; - if ( m_algContextSvc ) { - knownAlgs = m_algContextSvc->algorithms(); - } - logStream()<<MSG::WARNING<<" getROBData was called by : " << m_callerName << endmsg; - // Print all known algorithms - if(logLevel() <= MSG::DEBUG) { - logStream()<<MSG::DEBUG<<" getROBData known algorithms : \n" ; - int i=0; - for (std::vector<IAlgorithm*>::const_iterator itr=knownAlgs.begin(); itr!=knownAlgs.end(); ++itr) { - logStream() << std::setw(2) << i << " : " << (*itr)->name() << "\n"; - ++i; - } - logStream()<<endmsg; - } - - // Optionally provide caller backtrace - if (m_printStackTraceGetROBData.value()) { - static const int TRACE_DEPTH=64; - void * array[TRACE_DEPTH]; - int nSize = backtrace(array, TRACE_DEPTH); - char ** symbols = backtrace_symbols(array, nSize); - logStream()<<MSG::WARNING<<" getROBData: Printing stacktrace: Found " << nSize << " backtrace symbols.\n"; - for (int i = 0; i < nSize; i++) { - if (i==1) { logStream() << "-->" << std::setw(2) << i << " : " << symbols[i] << "\n"; } - else { logStream() << std::setw(5) << i << " : " << symbols[i] << "\n"; } - } - logStream() << endmsg; - free(symbols); - } - - // Print contents of ROB cache - if(logLevel() <= MSG::VERBOSE) { logStream()<<MSG::VERBOSE<< dumpROBcache() <<endmsg; } - } - } - } - } - - return ; -} - -/// Retrieve the whole event. -const RawEvent* TrigROBDataProviderSvc::getEvent(){ - // if (m_onlineRunning) return 0; - return ROBDataProviderSvc::getEvent(); -} - -/// Return vector with all ROBFragments stored in the cache -void TrigROBDataProviderSvc::getAllROBData(std::vector<const ROBF*>& robFragments) -{ - //------------------ - //--- online running - //------------------ - if (m_onlineRunning) { - for(ONLINE_ROBMAP::iterator it=m_online_robmap.begin(); it!=m_online_robmap.end(); ++it) { - robFragments.push_back( &((*it).second) ); - } - } - return ; -} - -// Dump ROB cache -std::string TrigROBDataProviderSvc::dumpROBcache() const { - - ONLINE_ROBMAP::const_iterator cache_it = m_online_robmap.begin() ; - ONLINE_ROBMAP::const_iterator cache_end = m_online_robmap.end() ; - int nrob = 0; - - std::ostringstream ost; - ost << " --- Dump of ROB cache ids --- total size = " - << m_online_robmap.size() <<"\n"; - for(; cache_it!=cache_end; ++cache_it){ - ++nrob; - ost <<" # = "<< std::setw(5) << nrob << " cache id = 0x" << std::hex << (*cache_it).first - << " hex: source id = 0x" << std::hex << (*cache_it).second.source_id() - << std::dec << " decimal: source id = " << (*cache_it).second.source_id() << "\n"; - } - std::string ret(ost.str()); - return ret; -} - -/// Collect all data for an event from the ROS and put them into the cache -/// Return value: number of ROBs which were retrieved to complete event -int TrigROBDataProviderSvc::collectCompleteEventData(const std::string_view callerName) { - - // return if call was already issued - if (m_isEventComplete) return 0; - - //-------------------- - // set the caller name - //-------------------- - setCallerName(callerName); - - std::vector<uint32_t> robIdsForRetrieval, retrievedRobIds; - robIdsForRetrieval.reserve(2048); - - struct timeval time_start; - struct timeval time_stop; - if ( m_doMonitoring || m_doDetailedROBMonitoring.value() ) gettimeofday(&time_start, 0); - - const EventContext context{ Gaudi::Hive::currentContext() }; - const ROBMAP& robmap = m_eventsCache.get(context)->robmap; - - // Get ROB Fragments to complete event from offline ROBDataProviderSvc - for(ROBDataProviderSvc::ROBMAP::const_iterator offline_rob_map_it=robmap.begin(); - offline_rob_map_it != robmap.end(); ++offline_rob_map_it) { - uint32_t id = (*offline_rob_map_it).first; - ONLINE_ROBMAP::iterator map_it = m_online_robmap.find(id); - if (map_it == m_online_robmap.end()) robIdsForRetrieval.push_back(id); - } - - if ( m_doMonitoring || m_doDetailedROBMonitoring.value() ) gettimeofday(&time_stop, 0); - - // detailed ROB monitoring - //------------------------ - // Create a ROB monitoring collection and register it to StoreGate - ROBDataMonitorCollection* p_robMonCollection(0); - if ( m_doDetailedROBMonitoring.value() ) { - if ( !(m_storeGateSvc->transientContains<ROBDataMonitorCollection>(m_ROBDataMonitorCollection_SG_Name.value())) ) { - p_robMonCollection = new ROBDataMonitorCollection; - if ( p_robMonCollection ) { - p_robMonCollection->reserve( 10 ) ; - if ( (m_storeGateSvc->record(p_robMonCollection, m_ROBDataMonitorCollection_SG_Name.value(), true)).isFailure() ) { - logStream() << MSG::WARNING << " Registering ROB Monitoring collection in StoreGate failed." << endmsg; - delete p_robMonCollection; - p_robMonCollection = 0; - } - } - } else { - if ( m_storeGateSvc->retrieve(p_robMonCollection).isFailure() ) { - logStream() << MSG::WARNING << " Retrieval of ROB Monitoring collection from StoreGate failed." << endmsg; - p_robMonCollection = 0; - } - } - } - - // create a new ROBDataMonitorStruct and fill it - robmonitor::ROBDataMonitorStruct* p_robMonStruct(0); - if ( p_robMonCollection ) { - // initialize new ROBDataMonitorStruct - p_robMonStruct = new robmonitor::ROBDataMonitorStruct( lvl1_id(), robIdsForRetrieval, m_callerName); - } - - if ( m_doMonitoring || p_robMonStruct ) { - int secs = 0 ; - if (time_stop.tv_sec >= time_start.tv_sec) - secs = time_stop.tv_sec - time_start.tv_sec; - - int usecs = time_stop.tv_usec - time_start.tv_usec; - float mtime = static_cast<float>(secs)*1000 + static_cast<float>(usecs)/1000; - - //* timing histogram - if (m_hist_timeROBretrieval) { - oh_scoped_lock_histogram lock; - m_hist_timeROBretrieval->Fill(mtime); - m_hist_timeROBretrieval->LabelsDeflate("X"); - } - //* number of received ROBs - if ( m_hist_receivedROBsPerCall ) { - oh_scoped_lock_histogram lock; - m_hist_receivedROBsPerCall->Fill(retrievedRobIds.size()); - m_hist_receivedROBsPerCall->LabelsDeflate("X"); - } - - //* detailed monitoring - if ( p_robMonStruct ) { - p_robMonStruct->start_time_of_ROB_request = time_start; - p_robMonStruct->end_time_of_ROB_request = time_stop; - } - } - - // update internal ROB cache - retrievedRobIds.reserve( robIdsForRetrieval.size() ); - addROBDataToCache(robIdsForRetrieval, retrievedRobIds, p_robMonStruct); - - // clear list of scheduled ROBs, all ROBs are available now, no new retrieval - m_Det_Robs_for_retrieval.clear(); - - // add the ROB monitoring structure to the collection - if ( p_robMonCollection && p_robMonStruct ) p_robMonCollection->push_back( p_robMonStruct ); - - if (logLevel() <= MSG::DEBUG) { - logStream() << MSG::DEBUG - << " ---> collectCompleteEventData: The following ROB Ids were received from DataCollector : \n" - << " Lvl1 id = " << lvl1_id() << "\n" - << " Number of actually received ROB Ids = " << retrievedRobIds.size() - << endmsg; - } - if (logLevel() <= MSG::VERBOSE) { - std::ostringstream ost; - unsigned int rob_counter = 1; - for (std::vector<uint32_t>::const_iterator rob_it = retrievedRobIds.begin(); rob_it != retrievedRobIds.end(); ++rob_it,++rob_counter) - ost << " # = "<< std::setw(5) << rob_counter << " ROB id = 0x" << std::hex << *rob_it << std::dec << "\n" ; - logStream() << MSG::VERBOSE << "\n" << ost.str() << endmsg; - } - - // update event complete flag - m_isEventComplete = true; - - return retrievedRobIds.size(); -} // end int collectCompleteEventData(...) - -int TrigROBDataProviderSvc::collectCompleteEventData(const EventContext&, - const std::string_view callerName) -{ - return collectCompleteEventData (callerName); -} - -/// set the name of the program which uses the ROBDataProviderSvc -void TrigROBDataProviderSvc::setCallerName(std::string_view callerName) -{ - // caller name of this method - std::string caller_name("UNKNOWN"); - if (callerName != caller_name) { - caller_name = callerName; - }else{ - IAlgorithm* alg(0); - if ( m_algContextSvc ) { - alg = m_algContextSvc->currentAlg(); - caller_name = (alg ? alg->name() : "<NONE>"); - } - } - m_callerName=caller_name; - // logStream() << MSG::DEBUG << "TrigROBDataProviderSvc::setCallerName : " << m_callerName <<endmsg; - return; -} - - -// handler for BeginRun -void TrigROBDataProviderSvc::handle(const Incident& incident) { - if (incident.type()!="BeginRun") return; - if(logLevel() <= MSG::DEBUG) - logStream() <<MSG::DEBUG << "In BeginRun incident." << endmsg; - - // if detailed ROB monitoring is requested, check if the AlgContextSvc is running, - // if yes use it to obtain the calling algorithm name - if ( m_doDetailedROBMonitoring.value() ) { - if ( service("AlgContextSvc", m_algContextSvc, /*createIf=*/ false).isFailure() ) { - logStream() << MSG::ERROR << "Error retrieving AlgContextSvc." - << "Calling algorithm name not available in detailed ROB monitoring" << endmsg; - m_algContextSvc=0; - } - } - - // define histograms if monitoring is requested - if ( !m_doMonitoring.value() ) return; - - // find histogramming service - ServiceHandle<ITHistSvc> rootHistSvc("THistSvc", name()); - if ((rootHistSvc.retrieve()).isFailure()) { - logStream() << MSG::ERROR << "Unable to locate THistSvc" << endmsg; - rootHistSvc.release().ignore(); - return; - } - - // *-- booking path - std::string path = std::string("/EXPERT/")+name()+"/"; - - // *-- number of bins for sub detector plots (55 SubDet max.) - uint32_t n_bins_partEBSubDet = eformat::helper::SubDetectorDictionary.size(); - - // *-- number of requested ROBs per call - m_hist_requestedROBsPerCall = new TH1F (m_histProp_requestedROBsPerCall.value().title().c_str(), - (m_histProp_requestedROBsPerCall.value().title()+";number of ROBs").c_str(), - m_histProp_requestedROBsPerCall.value().bins(), - m_histProp_requestedROBsPerCall.value().lowEdge(), - m_histProp_requestedROBsPerCall.value().highEdge()); - if (m_hist_requestedROBsPerCall) { - m_hist_requestedROBsPerCall->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_requestedROBsPerCall->GetName(), m_hist_requestedROBsPerCall).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_requestedROBsPerCall->GetName() << endmsg; - } - } - - // *-- number of received ROBs per call - m_hist_receivedROBsPerCall = new TH1F (m_histProp_receivedROBsPerCall.value().title().c_str(), - (m_histProp_receivedROBsPerCall.value().title()+";number of ROBs").c_str(), - m_histProp_receivedROBsPerCall.value().bins(), - m_histProp_receivedROBsPerCall.value().lowEdge(), - m_histProp_receivedROBsPerCall.value().highEdge()); - if (m_hist_receivedROBsPerCall) { - m_hist_receivedROBsPerCall->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_receivedROBsPerCall->GetName(), m_hist_receivedROBsPerCall).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_receivedROBsPerCall->GetName() << endmsg; - } - } - - // *-- timing of ROB retrieval - m_hist_timeROBretrieval = new TH1F (m_histProp_timeROBretrieval.value().title().c_str(), - (m_histProp_timeROBretrieval.value().title()+";time [ms]").c_str(), - m_histProp_timeROBretrieval.value().bins(), - m_histProp_timeROBretrieval.value().lowEdge(), - m_histProp_timeROBretrieval.value().highEdge()); - if (m_hist_timeROBretrieval) { - m_hist_timeROBretrieval->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_timeROBretrieval->GetName(), m_hist_timeROBretrieval).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_timeROBretrieval->GetName() << endmsg; - } - } - - // *-- number of retrievd ROBs per Algo - m_hist_retrievedROBsPerAlgo = new TH1F (m_histProp_retrievedROBsPerAlgo.value().title().c_str(), - (m_histProp_retrievedROBsPerAlgo.value().title()+";number of retrieved ROBs").c_str(), - m_histProp_retrievedROBsPerAlgo.value().bins(), - m_histProp_retrievedROBsPerAlgo.value().lowEdge(), - m_histProp_retrievedROBsPerAlgo.value().highEdge()); - if (m_hist_retrievedROBsPerAlgo) { - m_hist_retrievedROBsPerAlgo->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_retrievedROBsPerAlgo->GetName(), m_hist_retrievedROBsPerAlgo).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_retrievedROBsPerAlgo->GetName() << endmsg; - } - } - - - // *-- number of ROS requests - - m_hist_ROSRequest = new TH2F (m_histProp_ROSRequest.value().title().c_str(), - (m_histProp_ROSRequest.value().title()+";ROS id").c_str(), - m_histProp_ROSRequest.value().bins(), - m_histProp_ROSRequest.value().lowEdge(), - m_histProp_ROSRequest.value().highEdge(), - n_bins_partEBSubDet,0.,(float) n_bins_partEBSubDet); - if (m_hist_ROSRequest) { - uint32_t n_tmp_bin = 1; - for (eformat::helper::EnumClass<eformat::SubDetector>::const_iterator it_sub=eformat::helper::SubDetectorDictionary.begin(); - it_sub != eformat::helper::SubDetectorDictionary.end(); it_sub++ ) { - m_hist_ROSRequest->GetYaxis()->SetBinLabel( n_tmp_bin, (it_sub->second).c_str() ); - n_tmp_bin++; - } - - m_hist_ROSRequest->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_ROSRequest->GetName(), m_hist_ROSRequest).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_ROSRequest->GetName() << endmsg; - } - } - - - // *-- Generic Status for ROBs per sub detector - m_hist_genericStatusForROB = new TH2F ("GenericStatusForROBsFromSubDetectors", - "GenericStatusForROBsFromSubDetectors;;", - n_bins_partEBSubDet,0.,(float) n_bins_partEBSubDet, - m_map_GenericStatus.size(),0., (float) m_map_GenericStatus.size()); - if (m_hist_genericStatusForROB) { - uint32_t n_tmp_bin = 1; - for (eformat::helper::EnumClass<eformat::SubDetector>::const_iterator it_sub=eformat::helper::SubDetectorDictionary.begin(); - it_sub != eformat::helper::SubDetectorDictionary.end(); it_sub++ ) { - m_hist_genericStatusForROB->GetXaxis()->SetBinLabel( n_tmp_bin, (it_sub->second).c_str() ); - n_tmp_bin++; - } - - n_tmp_bin = 1; - for (std::map<eformat::GenericStatus, std::string>::const_iterator it = m_map_GenericStatus.begin();it != m_map_GenericStatus.end();++it) { - m_hist_genericStatusForROB->GetYaxis()->SetBinLabel( n_tmp_bin, (*it).second.c_str() ); - n_tmp_bin++; - } - if( rootHistSvc->regHist(path + m_hist_genericStatusForROB->GetName(), m_hist_genericStatusForROB).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_genericStatusForROB->GetName() << endmsg; - } - } - - // *-- Specific Status Bits for ROBs per sub detector - m_hist_specificStatusForROB = new TH2F ("SpecificStatusBitsForROBsFromSubDetectors", - "SpecificStatusBitsForROBsFromSubDetectors;;", - n_bins_partEBSubDet,0.,(float) n_bins_partEBSubDet, - m_vec_SpecificStatus.size(),0., (float) m_vec_SpecificStatus.size()); - if (m_hist_specificStatusForROB) { - uint32_t n_tmp_bin = 1; - for (eformat::helper::EnumClass<eformat::SubDetector>::const_iterator it_sub=eformat::helper::SubDetectorDictionary.begin(); - it_sub != eformat::helper::SubDetectorDictionary.end(); it_sub++ ) { - m_hist_specificStatusForROB->GetXaxis()->SetBinLabel( n_tmp_bin, (it_sub->second).c_str() ); - n_tmp_bin++; - } - - n_tmp_bin = 1; - for (std::vector<std::string>::const_iterator it = m_vec_SpecificStatus.begin();it != m_vec_SpecificStatus.end();++it) { - m_hist_specificStatusForROB->GetYaxis()->SetBinLabel( n_tmp_bin, (*it).c_str() ); - n_tmp_bin++; - } - if( rootHistSvc->regHist(path + m_hist_specificStatusForROB->GetName(), m_hist_specificStatusForROB).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_specificStatusForROB->GetName() << endmsg; - } - } - - // release histogramming service - rootHistSvc.release().ignore(); -} - -// helper function to retrieve ROB fragments over the network and to add them to the cache -void TrigROBDataProviderSvc::addROBDataToCache(std::vector<uint32_t>& robIdsForRetrieval, - std::vector<uint32_t>& retrievedRobIds, - robmonitor::ROBDataMonitorStruct* p_robMonStruct) { - - struct timeval time_start; - struct timeval time_stop; - - retrievedRobIds.clear(); - - if(logLevel() <= MSG::DEBUG) - logStream() << MSG::DEBUG << " ---> addROBDataToCache for "<<m_callerName<<": Number of ROB Ids requested for retrieval : " << robIdsForRetrieval.size() - << ", Lvl1 id = " << lvl1_id() << endmsg; - - // return if no ROBs are requested - if (robIdsForRetrieval.size() == 0) return; - - std::vector<uint32_t> vRobIds, vMETRobIds; - vRobIds.reserve( robIdsForRetrieval.size() ); - - - - // separate MET and detector ROBs if requested - if (m_separateMETandDetROBRetrieval.value()) { - vMETRobIds.reserve( robIdsForRetrieval.size() ); - for (std::vector<uint32_t>::const_iterator rob_it=robIdsForRetrieval.begin(); rob_it!=robIdsForRetrieval.end(); ++rob_it) { - if ( (eformat::helper::SourceIdentifier(*rob_it).subdetector_id() == eformat::TDAQ_LAR_MET) || - (eformat::helper::SourceIdentifier(*rob_it).subdetector_id() == eformat::TDAQ_TILE_MET) ) { - vMETRobIds.push_back( *rob_it ) ; - } else { - vRobIds.push_back( *rob_it ); - } - } - } else { - vRobIds=robIdsForRetrieval; - } - - std::vector<const ROBF*> vRobFragments ; - vRobFragments.reserve( vRobIds.size() ) ; - - // Get ROB Fragments with DataCollector - if ( m_doMonitoring || p_robMonStruct ) gettimeofday(&time_start, 0); - ROBDataProviderSvc::getROBData(vRobIds,vRobFragments); - - // Check that received ROB IDs are on the list of requested ROB IDs - for (std::vector<const ROBF*>::const_iterator it_robf = vRobFragments.begin(); - it_robf != vRobFragments.end(); ++it_robf) { - uint32_t id = (*it_robf)->source_id() ; - retrievedRobIds.push_back(id); - if ( (eformat::helper::SourceIdentifier(id).subdetector_id() != eformat::TDAQ_LVL2) && - (eformat::helper::SourceIdentifier(id).subdetector_id() != eformat::TDAQ_EVENT_FILTER) - ) { - if (std::find(vRobIds.begin(), vRobIds.end(), id) == vRobIds.end()) { - logStream() << MSG::ERROR << " ---> addROBDataToCache for "<<m_callerName<<": Received ROB Id : 0x" << MSG::hex << id << MSG::dec - <<" from ROS is not on the list of requested ROB Ids."<< endmsg; - } - } - } - - // Do a separate data collect call for MET ROBs if required - if ( (m_separateMETandDetROBRetrieval.value()) && (vMETRobIds.size() != 0) ) { - std::vector<const ROBF*> vMETRobFragments ; - vMETRobFragments.reserve( vMETRobIds.size() ) ; - // retrieve MET ROBs - ROBDataProviderSvc::getROBData(vMETRobIds,vMETRobFragments); - - // Check that received ROB IDs are on the list of requested ROB IDs - for (std::vector<const ROBF*>::const_iterator it_robf = vMETRobFragments.begin(); - it_robf != vMETRobFragments.end(); ++it_robf) { - uint32_t id = (*it_robf)->source_id() ; - retrievedRobIds.push_back(id); - if ( (eformat::helper::SourceIdentifier(id).subdetector_id() != eformat::TDAQ_LVL2) && - (eformat::helper::SourceIdentifier(id).subdetector_id() != eformat::TDAQ_EVENT_FILTER) - ) { - if (std::find(vMETRobIds.begin(), vMETRobIds.end(), id) == vMETRobIds.end()) { - logStream() << MSG::ERROR << " ---> addROBDataToCache for "<<m_callerName<<": Received MET ROB Id : 0x" << MSG::hex << id << MSG::dec - <<" from ROS is not on the list of requested ROB Ids."<< endmsg; - } - } - } - - // add MET ROBs to Det ROBs - vRobFragments.insert( vRobFragments.end(), vMETRobFragments.begin(), vMETRobFragments.end() ); - } - - if(logLevel() <= MSG::DEBUG) { - std::ostringstream ost; - unsigned int rob_counter = 1; - for (std::vector<uint32_t>::const_iterator rob_it=retrievedRobIds.begin(); rob_it!=retrievedRobIds.end(); ++rob_it,++rob_counter) - ost << " # = "<< std::setw(5) << rob_counter << " ROB id = 0x" << std::hex << (*rob_it) << std::dec << "\n" ; - logStream() << MSG::DEBUG - << " ---> addROBDataToCache for "<<m_callerName<<": The following ROB Ids were received from DataCollector : \n" - << " Lvl1 id = " << lvl1_id() << "\n" - << " Number of detector ROB Ids requested for retrieval = " << vRobIds.size() << "\n" - << " Number of MET ROB Ids requested for retrieval = " << vMETRobIds.size() << "\n" - << " Number of actually received ROB Ids = " << retrievedRobIds.size() << "\n" - << ost.str() - << endmsg; - } - - if ( m_doMonitoring || p_robMonStruct ) { - gettimeofday(&time_stop, 0); - int secs = 0 ; - if (time_stop.tv_sec >= time_start.tv_sec) - secs = time_stop.tv_sec - time_start.tv_sec; - - int usecs = time_stop.tv_usec - time_start.tv_usec; - float mtime = static_cast<float>(secs)*1000 + static_cast<float>(usecs)/1000; - - //* timing histogram - if (m_hist_timeROBretrieval) { - oh_scoped_lock_histogram lock; - m_hist_timeROBretrieval->Fill(mtime); - m_hist_timeROBretrieval->LabelsDeflate("X"); - } - - //* detailed monitoring - if ( p_robMonStruct ) { - p_robMonStruct->start_time_of_ROB_request = time_start; - p_robMonStruct->end_time_of_ROB_request = time_stop; - } - } - - //* histograms for number of requested/received ROBs - if ( m_hist_requestedROBsPerCall ) { - oh_scoped_lock_histogram lock; - m_hist_requestedROBsPerCall->Fill(robIdsForRetrieval.size()); - m_hist_requestedROBsPerCall->LabelsDeflate("X"); - } - if ( m_hist_receivedROBsPerCall ) { - oh_scoped_lock_histogram lock; - m_hist_receivedROBsPerCall->Fill(vRobFragments.size()); - m_hist_receivedROBsPerCall->LabelsDeflate("X"); - } - - //* fill monitoring histogram for ROB requests - if ( m_hist_retrievedROBsPerAlgo ) { - oh_scoped_lock_histogram lock; - m_hist_retrievedROBsPerAlgo->Fill(m_callerName.c_str(), vRobFragments.size()); - m_hist_retrievedROBsPerAlgo->LabelsDeflate("X"); - } - - - // add ROBs to cache - std::vector<const ROBF*>::const_iterator it_robf = vRobFragments.begin(); - std::vector<const ROBF*>::const_iterator it_robf_end = vRobFragments.end(); - std::vector <uint32_t> ROSRequest; - for(; it_robf!=it_robf_end; ++it_robf) { - uint32_t id = (*it_robf)->source_id() ; - if (((*it_robf)->rod_ndata() == 0) && (m_removeEmptyROB)) { - if(logLevel() <= MSG::DEBUG) { - logStream() << MSG::DEBUG << " ---> addROBDataToCache for "<<m_callerName<<": Empty ROB Id = 0x" << MSG::hex << id << MSG::dec - << " removed for L1 Id = " << lvl1_id() << endmsg; - } - } else if ( ROBDataProviderSvc::filterRobWithStatus(&*(*it_robf)) ) { - if ((logLevel() <= MSG::DEBUG) && ((*it_robf)->nstatus() > 0)) { - const uint32_t* it_status; - (*it_robf)->status(it_status); - eformat::helper::Status tmpstatus( (*it_status) ) ; - logStream() << MSG::DEBUG << " ---> addROBDataToCache for "<<m_callerName<<": ROB Id = 0x" << MSG::hex << id - << std::setfill( '0' ) - << " with Generic Status Code = 0x" << std::setw(4) << tmpstatus.generic() - << " and Specific Status Code = 0x" << std::setw(4) << tmpstatus.specific() - << MSG::dec - << " removed for L1 Id = " <<lvl1_id() << endmsg; - } - } else { - // mask off the module ID for L2 and EF result for Run 1 data - if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_LVL2) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - if (!m_maskL2EFModuleID) { - ATH_MSG_ERROR("Inconsistent flag for masking L2/EF module IDs"); - m_maskL2EFModuleID=true; - } - } else if ( (eformat::helper::SourceIdentifier(id).module_id() != 0) && - (eformat::helper::SourceIdentifier(id).subdetector_id() == eformat::TDAQ_EVENT_FILTER) && - (m_maskL2EFModuleID) ) { - id = eformat::helper::SourceIdentifier(eformat::helper::SourceIdentifier(id).subdetector_id(),0).code(); - } - m_online_robmap[id]= (**it_robf) ; - } - - //* fill monitoring histogram for ROB generic status - if ( ( m_hist_genericStatusForROB ) && ( (*it_robf)->nstatus() != 0 ) ) { - const uint32_t* it_status; - (*it_robf)->status(it_status); - if ((*it_status) != 0) { - oh_scoped_lock_histogram lock; - m_hist_genericStatusForROB->Fill(eformat::helper::SourceIdentifier((*it_robf)->source_id()).human_detector().c_str(), - m_map_GenericStatus[eformat::helper::Status(*it_status).generic()].c_str(),1.); - } - } - - - - //* fill monitoring histogram for ROB specific status - if ( ( m_hist_specificStatusForROB ) && ( (*it_robf)->nstatus() != 0 ) ) { - const uint32_t* it_status; - (*it_robf)->status(it_status); - if ((*it_status) != 0) { - oh_scoped_lock_histogram lock; - std::bitset<16> specificBits(eformat::helper::Status(*it_status).specific()); - for (unsigned int index=0; index < 16; ++index) { - if (specificBits[index]) m_hist_specificStatusForROB->Fill(eformat::helper::SourceIdentifier((*it_robf)->source_id()).human_detector().c_str(), - m_vec_SpecificStatus[index].c_str(),1.); - } - } - } - - //* detailed monitoring - if ( p_robMonStruct ) { - (p_robMonStruct->requested_ROBs)[id].rob_history = robmonitor::RETRIEVED; - (p_robMonStruct->requested_ROBs)[id].rob_size = (*it_robf)->fragment_size_word(); - if ( (*it_robf)->nstatus() != 0 ) { - const uint32_t* it_status; - (*it_robf)->status(it_status); - for (uint32_t k=0; k < (*it_robf)->nstatus(); k++) { - (p_robMonStruct->requested_ROBs)[id].rob_status_words.push_back( *(it_status+k) ); - } - } - } // end detailed monitoring - - - // ROS requests - std::map<uint32_t,int>::const_iterator it=m_Det_Robs_for_retrieval.find(id); - if (it != m_Det_Robs_for_retrieval.end()){ - uint32_t ROSid=(*it).second; - if (find(ROSRequest.begin(), ROSRequest.end(),ROSid) == ROSRequest.end()){// new ROS id - if(m_hist_ROSRequest){ - oh_scoped_lock_histogram lock; - m_hist_ROSRequest->Fill( m_callerName.c_str(), eformat::helper::SourceIdentifier((*it_robf)->source_id()).human_detector().c_str(),1.); - m_hist_ROSRequest->LabelsDeflate("X"); - logStream() << MSG::INFO << " ---> addROBDataToCache for "<<m_callerName<<": request to ROS 0x"<<std::hex<<ROSid<<std::dec <<" " <<eformat::helper::SourceIdentifier((*it_robf)->source_id()).human_detector().c_str()<< std::endl; - } - ROSRequest.push_back(ROSid); - } - } - } // end loop over retrieved fragments - return; -} // end void addROBDataToCache(...) diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.h b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.h deleted file mode 100755 index 8eccb1f80408d4873b89976e762af540ce2676f5..0000000000000000000000000000000000000000 --- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc.h +++ /dev/null @@ -1,270 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGL2SERVICES_TRIGROBDATAPROVIDERSVC_H -#define TRIGL2SERVICES_TRIGROBDATAPROVIDERSVC_H - -/** =============================================================== - * TrigROBDataProviderSvc.h - * =============================================================== - * Description: ROBDataProvider class for simulating the ROB data - * access offline in the merged L2/EF system after LS1. - * - * In contrast to the normal offline data access the - * the event data are retrieved incrementally online - * over the network and in general the complete event - * fragment is not available. - * All ROB data which are required for processing have - * to be pre-registered for retrieval with a call to - * - * addROBData(const std::vector<uint32_t>& robIds) - * - * before they can be used with - * - * getROBData(const std::vector<uint32_t>& robIds, - * std::vector<const ROBF*>& robFragments). - * - * - * Created: Mar 1, 2013 - * By: Werner Wiedenmann - * Modified: Feb. 03, 2014 (implement complete hltinterface definitions) - * By: Werner Wiedenmann - */ -#include "GaudiKernel/Service.h" -#include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/StatusCode.h" -#include "GaudiKernel/IIncidentListener.h" -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/HistoProperty.h" -#include "GaudiKernel/Property.h" -#include "ByteStreamCnvSvcBase/ROBDataProviderSvc.h" -#include "ByteStreamData/RawEvent.h" -#include "TrigDataAccessMonitoring/ROBDataMonitor.h" -#include "TrigSteeringEvent/RobRequestInfo.h" -#include "eformat/Status.h" -#include <vector> -#include <map> - -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h" -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvcPrefetch.h" - -// Forward declarations -class StoreGateSvc; -class IAlgContextSvc; -class TH1F; /// for monitoring purposes -class TH2F; /// for monitoring purposes - -class TrigROBDataProviderSvc : public ROBDataProviderSvc, - virtual public ITrigROBDataProviderSvc, - virtual public ITrigROBDataProviderSvcPrefetch, - virtual public IIncidentListener -{ -public: - - typedef OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF ; - - TrigROBDataProviderSvc(const std::string& name, ISvcLocator* svcloc); - - virtual ~TrigROBDataProviderSvc(void); - - virtual StatusCode initialize() override; - - virtual StatusCode finalize() override; - - virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ) override; - - /// --- Implementation of IROBDataProviderSvc interface --- - - /// Add ROBFragments to cache for given ROB ids, ROB fragments may be retrieved with DataCollector - using ROBDataProviderSvc::addROBData; - virtual void addROBData(const std::vector<uint32_t>& robIds, - const std::string_view callerName="UNKNOWN") override; - - /// Add a given LVL1 ROBFragment to cache - using ROBDataProviderSvc::setNextEvent; - virtual void setNextEvent(const std::vector<ROBF>& result) override; - - - /// Add all ROBFragments of a RawEvent to cache - virtual void setNextEvent(const RawEvent* re) override; - - /// Retrieve ROBFragments for given ROB ids from cache - using ROBDataProviderSvc::getROBData; - virtual void getROBData(const std::vector<uint32_t>& robIds, - std::vector<const ROBF*>& robFragments, - const std::string_view callerName="UNKNOWN") override; - - /// Retrieve the whole event. - using ROBDataProviderSvc::getEvent; - virtual const RawEvent* getEvent() override; - - /// --- Implementation of ITrigROBDataProviderSvc interface --- - - /// Return vector with all ROBFragments stored in the cache - virtual void getAllROBData(std::vector<const ROBF*>& robFragments) override; - - // Dump ROB cache - virtual std::string dumpROBcache() const override; - - /// Return size of ROBFragments cache - virtual int sizeROBCache() override { return m_online_robmap.size(); } - - /// iterators over cache entries - virtual std::map<uint32_t, ROBF>::iterator beginROBCache() override { return m_online_robmap.begin(); } - virtual std::map<uint32_t, ROBF>::iterator endROBCache() override { return m_online_robmap.end(); } - - /// Check if complete event data are already in cache - virtual bool isEventComplete() override { return m_isEventComplete; } - virtual bool isEventComplete() const { return m_isEventComplete; } - virtual bool isEventComplete(const EventContext&) const override - { return m_isEventComplete; } - - /// Collect all data for an event from the ROS and put them into the cache - /// Return value: number of ROBs which were retrieved to complete the event - virtual int collectCompleteEventData(const std::string_view callerName="UNKNOWN") override; - virtual int collectCompleteEventData(const EventContext&, const std::string_view callerName="UNKNOWN") override; - - /// set the name of the program which uses the ROBDataProviderSvc - virtual void setCallerName(const std::string_view) override; - - /// get the name of the program which is presently registered in the ROBDataProviderSvc - virtual std::string getCallerName() override { return m_callerName; }; - - /// --- Implementation of ITrigROBDataProviderSvcPrefetch interface --- - - /// Set access to ROB prefetching information from steering - virtual void setRobRequestInfo(HLT::RobRequestInfo* robInfo) override { m_RobRequestInfo = robInfo; } ; - - /// Get access to ROB prefetching information from steering - virtual HLT::RobRequestInfo* robRequestInfo() const override { return m_RobRequestInfo; }; - - /// --- Implementation of IIncidentListener interface --- - - // handler for BeginRun actions - void handle(const Incident& incident) override; - -protected: - /** - * @brief Accessor method for the MsgStream. - * @return handle to the MsgStream. - */ - inline MsgStream& logStream() const { return *m_msg; } - - /** - * @brief Accessor method for the message level variable. - * @return value of the message level for this algorithm. - */ - inline MSG::Level logLevel() const { return (m_msg != 0) ? m_msg->level() : MSG::NIL; } - - - // name of the program which presently uses the ROBDataProviderSvc - std::string m_callerName; - - BooleanProperty m_doDetailedROBMonitoring; - - BooleanProperty m_doMonitoring; - - /// Pointer to AlgContextSvc - IAlgContextSvc* m_algContextSvc; - - /// vector of Source ids to be ignored for the ROB map clear - std::vector<uint32_t> m_l1_ROB_ids; - - /// lvl1 id of CTP fragment - uint32_t lvl1_id(); -private: - typedef ServiceHandle<StoreGateSvc> StoreGateSvc_t; - /// Reference to StoreGateSvc; - StoreGateSvc_t m_storeGateSvc; - - - typedef SimpleProperty< std::vector<uint32_t> > Uint32ArrayProperty; - typedef SimpleProperty< std::map<int,int> > IntegerMapProperty; - - // flag indicates if running in online/offline - bool m_onlineRunning ; - - // read enabled ROBs from OKS when possible - BooleanProperty m_readROBfromOKS; - - // list of all enabled ROBs which can be retrieved - Uint32ArrayProperty m_enabledROBs; - - // list of ROBs which should be ignored for retrieval - Uint32ArrayProperty m_ignoreROB; - - // list of all LAr MET ROBs which can be retrieved - Uint32ArrayProperty m_enabledLArMetROBs ; - UnsignedIntegerProperty m_genericLArMetModuleID ; - - // list of all Tile MET ROBs which can be retrieved - Uint32ArrayProperty m_enabledTileMetROBs; - UnsignedIntegerProperty m_genericTileMetModuleID ; - - // Separate data collector calls to ROS for normal ROBs and MET ROBs - BooleanProperty m_separateMETandDetROBRetrieval ; - - // Filter out empty ROB fragments which are send by the ROS - bool m_removeEmptyROB; - - // flag which tells if module IDs from the L2 and EF result should be masked off - bool m_maskL2EFModuleID; - - - - // ROS-ROB mapping - IntegerMapProperty m_rob_ros_map ; - BooleanProperty m_useROSmappingForROBRetrieval ; - std::map< uint32_t, int > m_Det_Robs_for_retrieval ; // internal map of ROB->ROS for retrieval - - // map for all the ROB fragments (cache for ROB data so that they are - // not deleted when local containers go out of scope) - typedef std::map<uint32_t, ROBF> ONLINE_ROBMAP; - ONLINE_ROBMAP m_online_robmap; - - // helper function to retrieve ROB fragments over the network and to add them to the cache - void addROBDataToCache(std::vector<uint32_t>& robIdsForRetrieval, // vector of ROBs to retrieve - std::vector<uint32_t>& retrievedRobIds, // vector of received ROB ids - robmonitor::ROBDataMonitorStruct* p_robMonStruct); // pointer to ROB monitoring structure for retrieval - - - // Flag to indicate if all event data are already in the cache - bool m_isEventComplete; - - /** @brief Pointer to MsgStream.*/ - MsgStream* m_msg; - - // ROB prefetching info - HLT::RobRequestInfo* m_RobRequestInfo; - - // monitoring - std::map<eformat::GenericStatus, std::string> m_map_GenericStatus; - std::vector<std::string> m_vec_SpecificStatus; - - - StringProperty m_ROBDataMonitorCollection_SG_Name; - - Histo1DProperty m_histProp_requestedROBsPerCall; - Histo1DProperty m_histProp_receivedROBsPerCall; - Histo1DProperty m_histProp_timeROBretrieval; - Histo1DProperty m_histProp_retrievedROBsPerAlgo; - Histo1DProperty m_histProp_ROSRequest; - - TH1F* m_hist_requestedROBsPerCall; - TH1F* m_hist_receivedROBsPerCall; - TH1F* m_hist_retrievedROBsPerAlgo; - TH1F* m_hist_timeROBretrieval; - TH2F* m_hist_genericStatusForROB; - TH2F* m_hist_specificStatusForROB; - TH2F* m_hist_ROSRequest; - - // online simulation - BooleanProperty m_simulateOnlineDataAccess; - BooleanProperty m_printStackTraceGetROBData; - std::map<uint32_t, int> m_map_Failed_ROBs_not_preloaded; - std::map<uint32_t, int> m_map_Failed_ROBs_preloaded_not_arrived; -}; - -#endif diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc_RTT.cxx b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc_RTT.cxx deleted file mode 100644 index 0abb8c7b2e7f97db79a3a9ac39fad0f7bb4f9f8e..0000000000000000000000000000000000000000 --- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc_RTT.cxx +++ /dev/null @@ -1,816 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigROBDataProviderSvc_RTT.h" - -#include "GaudiKernel/ITHistSvc.h" -#include "GaudiKernel/IJobOptionsSvc.h" -#include "GaudiKernel/Property.h" -#include "GaudiKernel/IAlgContextSvc.h" -#include "GaudiKernel/IAlgorithm.h" - -#include "StoreGate/StoreGateSvc.h" - -#include "CxxUtils/excepts.h" - -#include <TH1F.h> -#include <TH2F.h> - -TrigROBDataProviderSvc_RTT::TrigROBDataProviderSvc_RTT(const std::string& name, ISvcLocator* svcloc) - : TrigROBDataProviderSvc(name,svcloc), - m_enablePrefetchingAtAlgoLevel(true), - // hit properties - m_histProp_requestedROBsPerAlgo(Gaudi::Histo1DDef("RequestedROBsPerAlgo" ,0.,1.,1)), - m_histProp_requestPerAlgo(Gaudi::Histo1DDef("RequestPerAlgo" ,0.,1.,1)), - m_histProp_callerPerEvent(Gaudi::Histo1DDef("CallerPerEvent" ,0.,1.,1)), - m_histProp_nocachedRequestedROBsPerAlgo(Gaudi::Histo1DDef("NoCachedRequestedROBsPerAlgo" ,0.,1.,1)), - m_histProp_nocachedRequestPerAlgo(Gaudi::Histo1DDef("NoCachedRequestPerAlgo" ,0.,1.,1)), - m_histProp_declaredROBsPerAlgo(Gaudi::Histo1DDef("DeclaredROBsPerAlgo" ,0.,1.,1)), - m_histProp_prefetchedROBsPerAlgo(Gaudi::Histo1DDef("PrefetchedROBsPerAlgo" ,0.,1.,1)), - m_histProp_missingRequestedROBsPerAlgo(Gaudi::Histo1DDef("MissingRequestedROBsPerAlgo" ,0.,1.,1)), - m_histProp_missingRequestPerAlgo(Gaudi::Histo1DDef("MissingRequestPerAlgo" ,0.,1.,1)), - m_histProp_missingRequestedROBsPerCall(Gaudi::Histo1DDef("MissingRequestedROBsPerCall" ,0.,100.,100)), - m_histProp_missingRequestedROBsPerAlgo_pref(Gaudi::Histo1DDef("MissingRequestedROBsPerAlgo_pref" ,0.,1.,1)), - m_histProp_missingRequestPerAlgo_pref(Gaudi::Histo1DDef("MissingRequestPerAlgo_pref" ,0.,1.,1)), - m_histProp_missingRequestedROBsPerCall_pref(Gaudi::Histo1DDef("MissingRequestedROBsPerCall_pref" ,0.,100.,100)), - m_histProp_missingRequestedROBsPerAlgoButCached(Gaudi::Histo1DDef("MissingRequestedROBsPerAlgoButCached" ,0.,1.,1)), - m_histProp_missingRequestPerAlgoButCached(Gaudi::Histo1DDef("MissingRequestPerAlgoButCached" ,0.,1.,1)), - m_histProp_missingRequestedROBsPerCallButCached(Gaudi::Histo1DDef("MissingRequestedROBsPerCallButCached" ,0.,100.,100)), - m_histProp_missingRequestedROBsPerAlgoButCached_pref(Gaudi::Histo1DDef("MissingRequestedROBsPerAlgoButCached_pref" ,0.,1.,1)), - m_histProp_missingRequestPerAlgoButCached_pref(Gaudi::Histo1DDef("MissingRequestPerAlgoButCached_pref" ,0.,1.,1)), - m_histProp_missingRequestedROBsPerCallButCached_pref(Gaudi::Histo1DDef("MissingRequestedROBsPerCallButCached_pref" ,0.,100.,100)), - - //hist init - m_hist_requestedROBsPerAlgo(0), - m_hist_requestedROBsPerCallPerAlgo(0), - m_hist_requestPerAlgo(0), - m_hist_callerPerEvent(0), - m_hist_nocachedRequestedROBsPerAlgo(0), - m_hist_nocachedRequestPerAlgo(0), - m_hist_declaredROBsPerAlgo(0), - m_hist_prefetchedROBsPerAlgo(0), - m_hist_missingRequestedROBsPerAlgo(0), - m_hist_missingRequestPerAlgo(0), - m_hist_missingRequestedROBsPerCall(0), - m_hist_missingRequestedROBsPerAlgo_pref(0), - m_hist_missingRequestPerAlgo_pref(0), - m_hist_missingRequestedROBsPerCall_pref(0), - m_hist_missingRequestedROBsPerAlgoButCached(0), - m_hist_missingRequestPerAlgoButCached(0), - m_hist_missingRequestedROBsPerCallButCached(0), - m_hist_missingRequestedROBsPerAlgoButCached_pref(0), - m_hist_missingRequestPerAlgoButCached_pref(0), - m_hist_missingRequestedROBsPerCallButCached_pref(0) - - { - declareProperty("enablePrefetchingAtAlgoLevel", m_enablePrefetchingAtAlgoLevel=true, "Enables pre-fetching at algorithm level"); - declareProperty("HistMissingRequestedROBsPerCall", m_histProp_missingRequestedROBsPerCall,"Number of missing ROBs pre-requests per call"); - declareProperty("HistMissingRequestedROBsPerAlgo", m_histProp_missingRequestedROBsPerAlgo,"Number of missing ROBs pre-requests per algo"); - declareProperty("HistMissingRequestPerAlgo", m_histProp_missingRequestPerAlgo,"Number of missing pre-requests per algo"); - declareProperty("HistMissingRequestedROBsPerCall_pref", m_histProp_missingRequestedROBsPerCall_pref,"Number of missing ROBs pre-fetches per call"); - declareProperty("HistMissingRequestedROBsPerAlgo_pref", m_histProp_missingRequestedROBsPerAlgo_pref,"Number of missing ROBs pre-fetches per algo"); - declareProperty("HistMissingRequestPerAlgo_pref", m_histProp_missingRequestPerAlgo_pref,"Number of missing pre-fetches per algo"); - declareProperty("HistRequestedROBsPerAlgo", m_histProp_requestedROBsPerAlgo,"Number of requested ROBs per algo"); - declareProperty("HistRequestPerAlgo", m_histProp_requestPerAlgo,"Number of ROB requests per algo"); - declareProperty("HistCallerPerEvent", m_histProp_callerPerEvent,"Number of events the Algo requests ROBs"); - declareProperty("HistNoCachedRequestPerAlgo", m_histProp_nocachedRequestPerAlgo,"Number of no-cached ROB requests per algo"); - declareProperty("HistNoCachedRequestedROBsPerAlgo", m_histProp_nocachedRequestedROBsPerAlgo,"Number of no-cached requested ROBs per algo"); - declareProperty("HistDeclaredROBsPerAlgo", m_histProp_declaredROBsPerAlgo,"Number of declared ROBs per algo"); - declareProperty("HistPrefetchedROBsPerAlgo", m_histProp_prefetchedROBsPerAlgo,"Number of prefetched ROBs per algo"); -} - -/// Query interface -StatusCode TrigROBDataProviderSvc_RTT::queryInterface(const InterfaceID& riid, void** ppvInterface) -{ - if ( IROBDataProviderSvc::interfaceID().versionMatch(riid) ) { - *ppvInterface = (IROBDataProviderSvc*)this; - } else if ( ITrigROBDataProviderSvc::interfaceID().versionMatch(riid) ) { - *ppvInterface = (ITrigROBDataProviderSvc*)this; - } else if ( ITrigROBDataProviderSvc_RTT::interfaceID().versionMatch(riid) ) { - *ppvInterface = (ITrigROBDataProviderSvc_RTT*)this; - } else if ( IIncidentListener::interfaceID().versionMatch(riid) ) { - *ppvInterface = (IIncidentListener*)this; - } else { - return Service::queryInterface(riid, ppvInterface); - } - addRef(); - return StatusCode::SUCCESS; -} - - -StatusCode TrigROBDataProviderSvc_RTT::initialize() -{ - StatusCode sc = TrigROBDataProviderSvc::initialize(); - - logStream() << MSG::INFO << " ---> TrigROBDataProviderSvc_RTT = " << name() << " initialize " - << " - package version " << PACKAGE_VERSION << endmsg ; - return sc; -} - - -void TrigROBDataProviderSvc_RTT::print(std::ostream& os) const -{ - CALLER_ROBMAP::const_iterator it; - std::vector <uint32_t> robIds; - os << "TrigROBDataProviderSvc_RTT::print():\n"; - for (it= m_caller_robmap.begin(); it!= m_caller_robmap.end(); ++it){ - os << (*it).first << " => "; - robIds = (*it).second; - os << "("<<robIds.size()<<") "; - for(std::vector<uint32_t>::const_iterator rit = robIds.begin(); rit != robIds.end(); ++rit){ - os << (*rit) <<", "; - } - os << '\n'; - } - os <<"--------------------------------------\n"; - return; -} - -std::ostream& operator << (std::ostream& os, const TrigROBDataProviderSvc_RTT& c) -{ - c.print(os); - return os; -} - -void TrigROBDataProviderSvc_RTT::setNextEvent(const std::vector<ROBF>& result) -{ - TrigROBDataProviderSvc::setNextEvent(result) ; - logStream() << MSG::DEBUG <<"TrigROBDataProviderSvc_RTT::setNextEvent map size is " << m_caller_robmap.size() <<". Now reset it"<< endmsg; - logStream() << MSG::DEBUG << *this << endmsg;// print out the content of the map - FillEvent(); - m_caller_robmap.clear(); - m_callerName = "UNKNOWN"; - return; -} - - -void TrigROBDataProviderSvc_RTT::setNextEvent(const RawEvent* re) -{ - TrigROBDataProviderSvc::setNextEvent(re) ; - logStream() << MSG::DEBUG << "TrigROBDataProviderSvc_RTT::setNextEvent map size is " << m_caller_robmap.size() <<". Now reset it"<<endmsg; - logStream() << MSG::DEBUG << *this << endmsg; // print out the content of the map - FillEvent(); - m_caller_robmap.clear(); - m_callerName = "UNKNOWN"; - return; -} - - -void TrigROBDataProviderSvc_RTT::FillEvent(){ - // fill the caller per event - if (!m_caller_robmap.empty()){ - std::string caller; - for (CALLER_ROBMAP::iterator map_it= m_caller_robmap.begin(); map_it!= m_caller_robmap.end(); ++map_it){ - caller=map_it->first; - m_hist_callerPerEvent->Fill(caller.c_str(),1); - m_hist_callerPerEvent->LabelsDeflate("X"); - // std::cout <<"FPP setNextEvent lvl1="<< m_currentLvl1ID <<": caller "<< caller <<" executed in this event with ROBId size=" << (map_it->second).size()<<std::endl; - } - } -} - -void TrigROBDataProviderSvc_RTT::setCallerName(std::string_view callerName) -{ - return TrigROBDataProviderSvc::setCallerName(callerName); -} - - - -void TrigROBDataProviderSvc_RTT::addROBData(const std::vector<uint32_t>& robIds, std::string_view callerName) -{ - //call the base class method - TrigROBDataProviderSvc:: addROBData(robIds, callerName); - - std::vector<uint32_t> all_robIds; - //if the caller already declared other ROBs, just retrieve them and update uniquely - if (robIds.size() != 0){ - CALLER_ROBMAP::iterator map_it = m_caller_robmap.find(m_callerName) ; - //not found (new caller) - if(map_it == m_caller_robmap.end()) { - m_caller_robmap.insert(std::pair<std::string, std::vector <uint32_t> >(m_callerName,robIds) ); - } - else{ - all_robIds = (*map_it).second; - all_robIds.insert (all_robIds.end(), robIds.begin(), robIds.end()); - - std::vector<uint32_t>::iterator remove_duplicate; - sort(all_robIds.begin(), all_robIds.end()); - remove_duplicate = unique(all_robIds.begin(), all_robIds.end()); - all_robIds.erase(remove_duplicate, all_robIds.end()); - - // replace the list of ROBs - map_it->second = all_robIds; - // - } - } - - //monitor pre-fetched ROBs - if (m_callerName.find("_pref") != std::string::npos){ - if ( m_hist_prefetchedROBsPerAlgo ) { - m_hist_prefetchedROBsPerAlgo->Fill(m_callerName.c_str(), robIds.size()); - m_hist_prefetchedROBsPerAlgo->LabelsDeflate("X"); - } - } - else { - // monitor the pre-declared ROBs - if ( m_hist_declaredROBsPerAlgo ) { - m_hist_declaredROBsPerAlgo->Fill(m_callerName.c_str(), robIds.size()); - m_hist_declaredROBsPerAlgo->LabelsDeflate("X"); - } - } - - return; -} - - - -void TrigROBDataProviderSvc_RTT::getROBData(const std::vector<uint32_t>& robIds, std::vector<const ROBF*>& robFragments, - const std::string_view callerName) - -{ - //call the base class method - TrigROBDataProviderSvc:: getROBData(robIds, robFragments, callerName); - - // skip L1 ROBIds - unsigned int foundL1=0; - for(std::vector<uint32_t>::const_iterator it = robIds.begin(); it != robIds.end(); ++it){ - if (std::find(m_l1_ROB_ids.begin(), m_l1_ROB_ids.end(), (*it))!=m_l1_ROB_ids.end()) { - foundL1++; - } - } - if (robIds.size() == foundL1) return; - - - if (foundL1 !=0) - logStream() << MSG::WARNING <<"TrigROBDataProviderSvc_RTT::getROBData. Algo " <<m_callerName<<" called some L1 ROBIds. Is this an error?" <<endmsg; - - // monitor the requested ROBs - if ( m_hist_requestedROBsPerAlgo ) { - m_hist_requestedROBsPerAlgo->Fill(m_callerName.c_str(), robIds.size()); - m_hist_requestedROBsPerAlgo->LabelsDeflate("X"); - } - - // monitor the requested ROBs per Algo - if ( m_hist_requestedROBsPerCallPerAlgo ) { - m_hist_requestedROBsPerCallPerAlgo->Fill(m_callerName.c_str(), robIds.size(), 1.); - m_hist_requestedROBsPerCallPerAlgo->LabelsDeflate("X"); - } - - // monitor the requests, just one per caller - if ( m_hist_requestPerAlgo ) { - m_hist_requestPerAlgo->Fill(m_callerName.c_str(), 1.); - m_hist_requestPerAlgo->LabelsDeflate("X"); - } - - - //compare the ROBs retrieved now with the requested ones: - int missingRequestedROBsPerCall = 0; - int missingRequestedROBsPerCall_pref = 0; - int missingRequestedROBsPerCallButCached = 0; - int missingRequestedROBsPerCallButCached_pref = 0; - - - std::string pref_name = m_callerName + "_pref"; - std::pair <CALLER_ROBMAP::iterator, CALLER_ROBMAP::iterator> algo_rob_it = m_caller_robmap.equal_range(m_callerName); - std::pair <CALLER_ROBMAP::iterator, CALLER_ROBMAP::iterator> algo_rob_pref_it = m_caller_robmap.equal_range(pref_name); - - logStream() << MSG::DEBUG << "TrigROBDataProviderSvc_RTT::getROBData. ROBs of algo "<<m_callerName<<": requested "<< robIds.size() <<" ROBIDs " - <<". Found " << ( (m_caller_robmap.count(pref_name)>0) ? (m_caller_robmap.find(pref_name)->second).size() : 0 ) - <<" pre-fetched, "<< ( (m_caller_robmap.count(m_callerName)>0)? (m_caller_robmap.find(m_callerName)->second).size(): 0) << " pre-declared" << endmsg; - - - bool found = false; - bool found_pref = false; - bool found_cached = false; - bool found_another_pref = false; - - std::vector<uint32_t> requested_robIds; - std::vector<uint32_t> requested_pref_robIds; - std::vector<uint32_t> cached_robIds; - - std::vector<uint32_t> not_prefetched_robIds; - std::vector<uint32_t> not_predeclared_robIds; - - // compare the vectors of declared and required ROBIds - for(std::vector<uint32_t>::const_iterator it = robIds.begin(); it != robIds.end(); ++it){ - - // eclude L1 ROBs, may be removed - if (std::find(m_l1_ROB_ids.begin(), m_l1_ROB_ids.end(), (*it))!=m_l1_ROB_ids.end()) { - continue; - } - - found = false; - found_pref = false; - found_cached=false; - found_another_pref=false; - - // check if ROBId is already in cache - ////////////////////////////////////////////// - std::string cached_caller; - for (CALLER_ROBMAP::iterator map_it= m_caller_robmap.begin(); map_it!= m_caller_robmap.end(); ++map_it){ - cached_robIds=map_it->second; - for(std::vector<uint32_t>::const_iterator rit = cached_robIds.begin(); rit != cached_robIds.end(); ++rit){ - if (*rit == *it) { - found_cached=true; - cached_caller = map_it->first; - break; - } - } - } - - // monitor not cached ROBIds - if ( m_hist_nocachedRequestedROBsPerAlgo ) { - m_hist_nocachedRequestedROBsPerAlgo->Fill(m_callerName.c_str(), (!found_cached)*robIds.size()); - m_hist_nocachedRequestedROBsPerAlgo->LabelsDeflate("X"); - } - - if ( m_hist_nocachedRequestPerAlgo ) { - m_hist_nocachedRequestPerAlgo->Fill(m_callerName.c_str(), (!found_cached)); - m_hist_nocachedRequestPerAlgo->LabelsDeflate("X"); - } - - //1: search among the predeclared in the prefetching phase - ////////////////////////////////////////////// - for (CALLER_ROBMAP::iterator iit=algo_rob_pref_it.first; iit!=algo_rob_pref_it.second; ++iit){//loop over the calls of this algo - requested_pref_robIds = iit->second; - for(std::vector<uint32_t>::const_iterator rit = requested_pref_robIds.begin(); rit != requested_pref_robIds.end(); ++rit){ - if (*rit == *it) { - found_pref=true; - break; - } - } - } - - - if (!found_pref) { - // search if another algorithm has predeclared it: - CALLER_ROBMAP::const_iterator callit; - std::vector <uint32_t> robIds_pre; - std::string prefetching_caller=""; - for (callit= m_caller_robmap.begin(); callit!= m_caller_robmap.end(); ++callit){ - prefetching_caller = (*callit).first; - if (prefetching_caller.find("_pref") == std::string::npos) continue;// only prefetching algo - // if (m_callerName == prefetching_caller) continue;//not needed - robIds_pre = (*callit).second; - if (std::find(robIds_pre.begin(), robIds_pre.end(), (*it))!=robIds_pre.end()) { - found_another_pref=true; - break; - } - } - - if ((found_another_pref) && (m_callerName != prefetching_caller)){ - missingRequestedROBsPerCallButCached_pref++;// count the missing ROBs in this call during the pre-fetching, but data are cached by other algorithm - logStream() << MSG::DEBUG <<"TrigROBDataProviderSvc_RTT::getROBData: algo "<< m_callerName <<" ROB id 0x" << std::hex << (*it) << " was NOT predeclared in the PRE-FETCHING, but pre-declared by different algorithm " << prefetching_caller << std::dec << endmsg; - } - else {// this is the error - // count the missing ROBs in this call during the pre-fetching, not cached or cached by this algo (meaning that the algo retrieved data without prefcthing) - not_prefetched_robIds.push_back(*it); - missingRequestedROBsPerCall_pref++; - logStream() << MSG::DEBUG <<"TrigROBDataProviderSvc_RTT::getROBData: RTTerrors algo "<< m_callerName <<" ROB id 0x" << std::hex << (*it) << " was NOT predeclared in the PRE-FETCHING!"<< std::dec << endmsg; - } - // check if the same algo prefetcehd any ROBIds - if (m_caller_robmap.count(pref_name) != 0 ) { - // print the already declared ROBSId by this algo - logStream() << MSG::DEBUG <<"TrigROBDataProviderSvc_RTT::getROBData: algo "<< m_callerName <<" predeclared in pre-fetching these ROBIds:" << endmsg; - for (CALLER_ROBMAP::iterator iit=algo_rob_pref_it.first; iit!=algo_rob_pref_it.second; ++iit){//loop over the calls of this algo - requested_pref_robIds = iit->second; - for(std::vector<uint32_t>::const_iterator rit = requested_pref_robIds.begin(); rit != requested_pref_robIds.end(); ++rit){ - logStream() << MSG::DEBUG << (*rit) <<", "; - } - logStream() << MSG::DEBUG << endmsg; - } - } - } - - //2: search among the predeclared during the execution - ////////////////////////////////////////////// - for (CALLER_ROBMAP::iterator iit=algo_rob_it.first; iit!=algo_rob_it.second; ++iit){//loop over the calls of this algo - requested_robIds = iit->second; - for(std::vector<uint32_t>::const_iterator rit = requested_robIds.begin(); rit != requested_robIds.end(); ++rit){ - if (*rit == *it) { - found=true; - break; - } - } - } - - if (!found && !found_pref){ - if (found_cached && ( m_callerName != cached_caller)){ - missingRequestedROBsPerCallButCached++; - logStream() << MSG::DEBUG <<"TrigROBDataProviderSvc_RTT::getROBData: algo "<< m_callerName <<" ROB id 0x" << std::hex << (*it) << " was NOT predeclared, but cached by different algorithm " << cached_caller << std::dec << endmsg; - } - else { - not_predeclared_robIds.push_back(*it); - missingRequestedROBsPerCall++; // count the missing ROBs in this call, not cached or cached by the same algo - if (found_cached && ( m_callerName == cached_caller)){ - logStream() << MSG::DEBUG <<"TrigROBDataProviderSvc_RTT::getROBData: algo "<< m_callerName <<" ROB id 0x" << std::hex << (*it) << " was NOT predeclared, but cached " << std::dec << endmsg; - } - else { - logStream() << MSG::DEBUG <<"TrigROBDataProviderSvc_RTT::getROBData: algo "<< m_callerName <<" ROB id 0x" << std::hex << (*it) << " NOT predeclared (and not cached)!"<< std::dec << endmsg; - } - } - if (m_caller_robmap.count(m_callerName) != 0 ) { - // print the already declared ROBSId by this algo - logStream() << MSG::DEBUG <<"getROBData: algo "<< m_callerName <<" predeclared these ROBIds:" << endmsg; - for (CALLER_ROBMAP::iterator iit=algo_rob_it.first; iit!=algo_rob_it.second; ++iit){//loop over the calls of this algo - requested_robIds = iit->second; - for(std::vector<uint32_t>::const_iterator rit = requested_pref_robIds.begin(); rit != requested_pref_robIds.end(); ++rit){ - logStream() << MSG::DEBUG << (*rit) <<", "; - } - logStream() << MSG::DEBUG<< endmsg; - } - } - - } - } - - - //monitor: prefetching - if (missingRequestedROBsPerCall_pref>0){ - logStream() << MSG::WARNING << "getROBData: ---> RTTerrors in the PRE-FETCHING: algo " << m_callerName << " missed to declare " - << missingRequestedROBsPerCall_pref << " ROBs in this call, " - << missingRequestedROBsPerCallButCached_pref <<" ROBs are declared by other algorithm"<< endmsg; - logStream() << MSG::DEBUG <<"getROBData: ---> in the PRE-FETCHING: These are the missing ROBS: "<< std::hex; - for(std::vector<uint32_t>::const_iterator rit = not_prefetched_robIds.begin(); rit != not_prefetched_robIds.end(); ++rit){ - logStream() << MSG::DEBUG << "0x" << (*rit) <<", "; - } - logStream() << MSG::DEBUG << std::dec <<endmsg; - } - - if ( m_hist_missingRequestedROBsPerCall_pref ) { - m_hist_missingRequestedROBsPerCall_pref->Fill(missingRequestedROBsPerCall_pref); - } - - if ( m_hist_missingRequestedROBsPerAlgo_pref ) { - m_hist_missingRequestedROBsPerAlgo_pref->Fill(m_callerName.c_str(), missingRequestedROBsPerCall_pref); - m_hist_missingRequestedROBsPerAlgo_pref->LabelsDeflate("X"); - } - - if ( m_hist_missingRequestPerAlgo_pref ) { - bool nodeclared = (missingRequestedROBsPerCall_pref>0 && m_caller_robmap.count( pref_name ) == 0 ); - m_hist_missingRequestPerAlgo_pref->Fill(m_callerName.c_str(), nodeclared); - m_hist_missingRequestPerAlgo_pref->LabelsDeflate("X"); - } - - //monitor: prefetching, with caching - if ( m_hist_missingRequestedROBsPerCallButCached_pref ) { - m_hist_missingRequestedROBsPerCallButCached_pref->Fill(missingRequestedROBsPerCallButCached_pref); - } - - if ( m_hist_missingRequestedROBsPerAlgoButCached_pref ) { - m_hist_missingRequestedROBsPerAlgoButCached_pref->Fill(m_callerName.c_str(), missingRequestedROBsPerCallButCached_pref); - m_hist_missingRequestedROBsPerAlgoButCached_pref->LabelsDeflate("X"); - } - - if ( m_hist_missingRequestPerAlgoButCached_pref ) { - bool nodeclared = (missingRequestedROBsPerCallButCached_pref>0 && m_caller_robmap.count( pref_name ) == 0 ); - m_hist_missingRequestPerAlgoButCached_pref->Fill(m_callerName.c_str(), nodeclared); - m_hist_missingRequestPerAlgoButCached_pref->LabelsDeflate("X"); - } - - //monitor: executiuon - if (missingRequestedROBsPerCall>0) { - logStream() << MSG::WARNING << "getROBData: ---> RTTerrors in the EXECUTION: algo " << m_callerName << " missed to declare " - << missingRequestedROBsPerCall << " ROBs in this call , " - << missingRequestedROBsPerCallButCached <<" ROBs are not declared, but cached by other algorithm "<< endmsg; - logStream() << MSG::DEBUG <<"getROBData: ---> in the EXECUTION: These are the missing ROBS: "<< std::hex; - for(std::vector<uint32_t>::const_iterator rit = not_predeclared_robIds.begin(); rit != not_predeclared_robIds.end(); ++rit){ - logStream() << MSG::DEBUG << "0x"<<(*rit) <<", "; - } - logStream() << MSG::DEBUG <<std::dec <<endmsg; - } - if ( m_hist_missingRequestedROBsPerCall ) { - m_hist_missingRequestedROBsPerCall->Fill(missingRequestedROBsPerCall); - } - - if ( m_hist_missingRequestedROBsPerAlgo ) { - m_hist_missingRequestedROBsPerAlgo->Fill(m_callerName.c_str(), missingRequestedROBsPerCall); - m_hist_missingRequestedROBsPerAlgo->LabelsDeflate("X"); - } - - if ( m_hist_missingRequestPerAlgo ) { - bool nodeclared = (missingRequestedROBsPerCall>0 && m_caller_robmap.count(m_callerName) == 0); - m_hist_missingRequestPerAlgo->Fill(m_callerName.c_str(), nodeclared); - m_hist_missingRequestPerAlgo->LabelsDeflate("X"); - } - - //monitor execution, cached - if ( m_hist_missingRequestedROBsPerCallButCached ) { - m_hist_missingRequestedROBsPerCallButCached->Fill(missingRequestedROBsPerCallButCached); - } - - if ( m_hist_missingRequestedROBsPerAlgoButCached ) { - m_hist_missingRequestedROBsPerAlgoButCached->Fill(m_callerName.c_str(), missingRequestedROBsPerCallButCached); - m_hist_missingRequestedROBsPerAlgoButCached->LabelsDeflate("X"); - } - - if ( m_hist_missingRequestPerAlgoButCached ) { - bool nodeclared = (missingRequestedROBsPerCallButCached>0 && m_caller_robmap.count(m_callerName) == 0); - m_hist_missingRequestPerAlgoButCached->Fill(m_callerName.c_str(), nodeclared); - m_hist_missingRequestPerAlgoButCached->LabelsDeflate("X"); - } - - - return; -} - - - -// handler for BeginRun - -void TrigROBDataProviderSvc_RTT::handle(const Incident& incident) -{ - //base class method - TrigROBDataProviderSvc::handle(incident); - - if (incident.type()!="BeginRun") return; - if(logLevel() <= MSG::DEBUG) - logStream() <<MSG::DEBUG << "In BeginRun incident." << endmsg; - - // if detailed ROB monitoring is requested, check if the AlgContextSvc is running, - // if yes use it to obtain the calling algorithm name - if ( m_doDetailedROBMonitoring.value() ) { - if ( service("AlgContextSvc", m_algContextSvc, /*createIf=*/ false).isFailure() ) { - logStream() << MSG::ERROR << "Error retrieving AlgContextSvc." - << "Calling algorithm name not available in detailed ROB monitoring" << endmsg; - m_algContextSvc=0; - } - } - - // define histograms if monitoring is requested - if ( !m_doMonitoring.value() ) return; - - // find histogramming service - ServiceHandle<ITHistSvc> rootHistSvc("THistSvc", name()); - if ((rootHistSvc.retrieve()).isFailure()) { - logStream() << MSG::ERROR << "Unable to locate THistSvc" << endmsg; - rootHistSvc.release().ignore(); - return; - } - - - // *-- booking path - std::string path = std::string("/EXPERT/")+name()+"/"; - // - m_hist_missingRequestedROBsPerAlgo = new TH1F (m_histProp_missingRequestedROBsPerAlgo.value().title().c_str(), - (m_histProp_missingRequestedROBsPerAlgo.value().title()+";").c_str(), - m_histProp_missingRequestedROBsPerAlgo.value().bins(), - m_histProp_missingRequestedROBsPerAlgo.value().lowEdge(), - m_histProp_missingRequestedROBsPerAlgo.value().highEdge()); - if (m_hist_missingRequestedROBsPerAlgo) { - m_hist_missingRequestedROBsPerAlgo->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_missingRequestedROBsPerAlgo->GetName(), m_hist_missingRequestedROBsPerAlgo).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_missingRequestedROBsPerAlgo->GetName() << endmsg; - } - } - - // - m_hist_missingRequestPerAlgo = new TH1F (m_histProp_missingRequestPerAlgo.value().title().c_str(), - (m_histProp_missingRequestPerAlgo.value().title()+";").c_str(), - m_histProp_missingRequestPerAlgo.value().bins(), - m_histProp_missingRequestPerAlgo.value().lowEdge(), - m_histProp_missingRequestPerAlgo.value().highEdge()); - if (m_hist_missingRequestPerAlgo) { - m_hist_missingRequestPerAlgo->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_missingRequestPerAlgo->GetName(), m_hist_missingRequestPerAlgo).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_missingRequestPerAlgo->GetName() << endmsg; - } - } - - - // - m_hist_missingRequestedROBsPerCall = new TH1F (m_histProp_missingRequestedROBsPerCall.value().title().c_str(), - (m_histProp_missingRequestedROBsPerCall.value().title()+";Number of non-predeclared ROBs").c_str(), - m_histProp_missingRequestedROBsPerCall.value().bins(), - m_histProp_missingRequestedROBsPerCall.value().lowEdge(), - m_histProp_missingRequestedROBsPerCall.value().highEdge()); - if (m_hist_missingRequestedROBsPerCall) { - if( rootHistSvc->regHist(path + m_hist_missingRequestedROBsPerCall->GetName(), m_hist_missingRequestedROBsPerCall).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_missingRequestedROBsPerCall->GetName() << endmsg; - } - } - - - // - m_hist_missingRequestedROBsPerAlgoButCached = new TH1F (m_histProp_missingRequestedROBsPerAlgoButCached.value().title().c_str(), - (m_histProp_missingRequestedROBsPerAlgoButCached.value().title()+";").c_str(), - m_histProp_missingRequestedROBsPerAlgoButCached.value().bins(), - m_histProp_missingRequestedROBsPerAlgoButCached.value().lowEdge(), - m_histProp_missingRequestedROBsPerAlgoButCached.value().highEdge()); - if (m_hist_missingRequestedROBsPerAlgoButCached) { - m_hist_missingRequestedROBsPerAlgoButCached->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_missingRequestedROBsPerAlgoButCached->GetName(), m_hist_missingRequestedROBsPerAlgoButCached).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_missingRequestedROBsPerAlgoButCached->GetName() << endmsg; - } - } - - // - m_hist_missingRequestPerAlgoButCached = new TH1F (m_histProp_missingRequestPerAlgoButCached.value().title().c_str(), - (m_histProp_missingRequestPerAlgoButCached.value().title()+";").c_str(), - m_histProp_missingRequestPerAlgoButCached.value().bins(), - m_histProp_missingRequestPerAlgoButCached.value().lowEdge(), - m_histProp_missingRequestPerAlgoButCached.value().highEdge()); - if (m_hist_missingRequestPerAlgoButCached) { - m_hist_missingRequestPerAlgoButCached->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_missingRequestPerAlgoButCached->GetName(), m_hist_missingRequestPerAlgoButCached).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_missingRequestPerAlgoButCached->GetName() << endmsg; - } - } - - - // - m_hist_missingRequestedROBsPerCallButCached = new TH1F (m_histProp_missingRequestedROBsPerCallButCached.value().title().c_str(), - (m_histProp_missingRequestedROBsPerCallButCached.value().title()+";Number of non-predeclared ROBs").c_str(), - m_histProp_missingRequestedROBsPerCallButCached.value().bins(), - m_histProp_missingRequestedROBsPerCallButCached.value().lowEdge(), - m_histProp_missingRequestedROBsPerCallButCached.value().highEdge()); - if (m_hist_missingRequestedROBsPerCallButCached) { - if( rootHistSvc->regHist(path + m_hist_missingRequestedROBsPerCallButCached->GetName(), m_hist_missingRequestedROBsPerCallButCached).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_missingRequestedROBsPerCallButCached->GetName() << endmsg; - } - } - - // - m_hist_requestPerAlgo = new TH1F (m_histProp_requestPerAlgo.value().title().c_str(), - (m_histProp_requestPerAlgo.value().title()+";").c_str(), - m_histProp_requestPerAlgo.value().bins(), - m_histProp_requestPerAlgo.value().lowEdge(), - m_histProp_requestPerAlgo.value().highEdge()); - if (m_hist_requestPerAlgo) { - m_hist_requestPerAlgo->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_requestPerAlgo->GetName(), m_hist_requestPerAlgo).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_requestPerAlgo->GetName() << endmsg; - } - } - - // - m_hist_callerPerEvent = new TH1F (m_histProp_callerPerEvent.value().title().c_str(), - (m_histProp_callerPerEvent.value().title()+";").c_str(), - m_histProp_callerPerEvent.value().bins(), - m_histProp_callerPerEvent.value().lowEdge(), - m_histProp_callerPerEvent.value().highEdge()); - if (m_hist_callerPerEvent) { - m_hist_callerPerEvent->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_callerPerEvent->GetName(), m_hist_callerPerEvent).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_callerPerEvent->GetName() << endmsg; - } - } - - // - m_hist_requestedROBsPerAlgo = new TH1F (m_histProp_requestedROBsPerAlgo.value().title().c_str(), - (m_histProp_requestedROBsPerAlgo.value().title()+";").c_str(), - m_histProp_requestedROBsPerAlgo.value().bins(), - m_histProp_requestedROBsPerAlgo.value().lowEdge(), - m_histProp_requestedROBsPerAlgo.value().highEdge()); - if (m_hist_requestedROBsPerAlgo) { - m_hist_requestedROBsPerAlgo->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_requestedROBsPerAlgo->GetName(), m_hist_requestedROBsPerAlgo).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_requestedROBsPerAlgo->GetName() << endmsg; - } - } - - // - m_hist_requestedROBsPerCallPerAlgo = new TH2F ("RequestedROBsPerCallPerAlgo","RequestedROBsPerCallPerAlgo;", 1, 0., 1., 100, 0., 2000.); - if (m_hist_requestedROBsPerCallPerAlgo) { - m_hist_requestedROBsPerCallPerAlgo->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_requestedROBsPerCallPerAlgo->GetName(), m_hist_requestedROBsPerCallPerAlgo).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_requestedROBsPerCallPerAlgo->GetName() << endmsg; - } - } - - // - m_hist_nocachedRequestPerAlgo = new TH1F (m_histProp_nocachedRequestPerAlgo.value().title().c_str(), - (m_histProp_nocachedRequestPerAlgo.value().title()+";").c_str(), - m_histProp_nocachedRequestPerAlgo.value().bins(), - m_histProp_nocachedRequestPerAlgo.value().lowEdge(), - m_histProp_nocachedRequestPerAlgo.value().highEdge()); - if (m_hist_nocachedRequestPerAlgo) { - m_hist_nocachedRequestPerAlgo->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_nocachedRequestPerAlgo->GetName(), m_hist_nocachedRequestPerAlgo).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_nocachedRequestPerAlgo->GetName() << endmsg; - } - } - - // - m_hist_nocachedRequestedROBsPerAlgo = new TH1F (m_histProp_nocachedRequestedROBsPerAlgo.value().title().c_str(), - (m_histProp_nocachedRequestedROBsPerAlgo.value().title()+";").c_str(), - m_histProp_nocachedRequestedROBsPerAlgo.value().bins(), - m_histProp_nocachedRequestedROBsPerAlgo.value().lowEdge(), - m_histProp_nocachedRequestedROBsPerAlgo.value().highEdge()); - if (m_hist_nocachedRequestedROBsPerAlgo) { - m_hist_nocachedRequestedROBsPerAlgo->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_nocachedRequestedROBsPerAlgo->GetName(), m_hist_nocachedRequestedROBsPerAlgo).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_nocachedRequestedROBsPerAlgo->GetName() << endmsg; - } - } - - - // - m_hist_missingRequestedROBsPerAlgo_pref = new TH1F (m_histProp_missingRequestedROBsPerAlgo_pref.value().title().c_str(), - (m_histProp_missingRequestedROBsPerAlgo_pref.value().title()+";").c_str(), - m_histProp_missingRequestedROBsPerAlgo_pref.value().bins(), - m_histProp_missingRequestedROBsPerAlgo_pref.value().lowEdge(), - m_histProp_missingRequestedROBsPerAlgo_pref.value().highEdge()); - if (m_hist_missingRequestedROBsPerAlgo_pref) { - m_hist_missingRequestedROBsPerAlgo_pref->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_missingRequestedROBsPerAlgo_pref->GetName(), m_hist_missingRequestedROBsPerAlgo_pref).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_missingRequestedROBsPerAlgo_pref->GetName() << endmsg; - } - } - - // - m_hist_missingRequestPerAlgo_pref = new TH1F (m_histProp_missingRequestPerAlgo_pref.value().title().c_str(), - (m_histProp_missingRequestPerAlgo_pref.value().title()+";").c_str(), - m_histProp_missingRequestPerAlgo_pref.value().bins(), - m_histProp_missingRequestPerAlgo_pref.value().lowEdge(), - m_histProp_missingRequestPerAlgo_pref.value().highEdge()); - if (m_hist_missingRequestPerAlgo_pref) { - m_hist_missingRequestPerAlgo_pref->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_missingRequestPerAlgo_pref->GetName(), m_hist_missingRequestPerAlgo_pref).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_missingRequestPerAlgo_pref->GetName() << endmsg; - } - } - - // - m_hist_missingRequestedROBsPerCall_pref = new TH1F (m_histProp_missingRequestedROBsPerCall_pref.value().title().c_str(), - (m_histProp_missingRequestedROBsPerCall_pref.value().title()+";Number of non-predeclared ROBs").c_str(), - m_histProp_missingRequestedROBsPerCall_pref.value().bins(), - m_histProp_missingRequestedROBsPerCall_pref.value().lowEdge(), - m_histProp_missingRequestedROBsPerCall_pref.value().highEdge()); - if (m_hist_missingRequestedROBsPerCall_pref) { - if( rootHistSvc->regHist(path + m_hist_missingRequestedROBsPerCall_pref->GetName(), m_hist_missingRequestedROBsPerCall_pref).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_missingRequestedROBsPerCall_pref->GetName() << endmsg; - } - } - -// - m_hist_missingRequestedROBsPerAlgoButCached_pref = new TH1F (m_histProp_missingRequestedROBsPerAlgoButCached_pref.value().title().c_str(), - (m_histProp_missingRequestedROBsPerAlgoButCached_pref.value().title()+";").c_str(), - m_histProp_missingRequestedROBsPerAlgoButCached_pref.value().bins(), - m_histProp_missingRequestedROBsPerAlgoButCached_pref.value().lowEdge(), - m_histProp_missingRequestedROBsPerAlgoButCached_pref.value().highEdge()); - if (m_hist_missingRequestedROBsPerAlgoButCached_pref) { - m_hist_missingRequestedROBsPerAlgoButCached_pref->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_missingRequestedROBsPerAlgoButCached_pref->GetName(), m_hist_missingRequestedROBsPerAlgoButCached_pref).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_missingRequestedROBsPerAlgoButCached_pref->GetName() << endmsg; - } - } - - // - m_hist_missingRequestPerAlgoButCached_pref = new TH1F (m_histProp_missingRequestPerAlgoButCached_pref.value().title().c_str(), - (m_histProp_missingRequestPerAlgoButCached_pref.value().title()+";").c_str(), - m_histProp_missingRequestPerAlgoButCached_pref.value().bins(), - m_histProp_missingRequestPerAlgoButCached_pref.value().lowEdge(), - m_histProp_missingRequestPerAlgoButCached_pref.value().highEdge()); - if (m_hist_missingRequestPerAlgoButCached_pref) { - m_hist_missingRequestPerAlgoButCached_pref->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_missingRequestPerAlgoButCached_pref->GetName(), m_hist_missingRequestPerAlgoButCached_pref).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_missingRequestPerAlgoButCached_pref->GetName() << endmsg; - } - } - - // - m_hist_missingRequestedROBsPerCallButCached_pref = new TH1F (m_histProp_missingRequestedROBsPerCallButCached_pref.value().title().c_str(), - (m_histProp_missingRequestedROBsPerCallButCached_pref.value().title()+";Number of non-predeclared ROBs").c_str(), - m_histProp_missingRequestedROBsPerCallButCached_pref.value().bins(), - m_histProp_missingRequestedROBsPerCallButCached_pref.value().lowEdge(), - m_histProp_missingRequestedROBsPerCallButCached_pref.value().highEdge()); - if (m_hist_missingRequestedROBsPerCallButCached_pref) { - if( rootHistSvc->regHist(path + m_hist_missingRequestedROBsPerCallButCached_pref->GetName(), m_hist_missingRequestedROBsPerCallButCached_pref).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_missingRequestedROBsPerCallButCached_pref->GetName() << endmsg; - } - } - - - // - - m_hist_declaredROBsPerAlgo = new TH1F (m_histProp_declaredROBsPerAlgo.value().title().c_str(), - (m_histProp_declaredROBsPerAlgo.value().title()+";").c_str(), - m_histProp_declaredROBsPerAlgo.value().bins(), - m_histProp_declaredROBsPerAlgo.value().lowEdge(), - m_histProp_declaredROBsPerAlgo.value().highEdge()); - if (m_hist_declaredROBsPerAlgo) { - m_hist_declaredROBsPerAlgo->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_declaredROBsPerAlgo->GetName(), m_hist_declaredROBsPerAlgo).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_declaredROBsPerAlgo->GetName() << endmsg; - } - } - - // - m_hist_prefetchedROBsPerAlgo = new TH1F (m_histProp_prefetchedROBsPerAlgo.value().title().c_str(), - (m_histProp_prefetchedROBsPerAlgo.value().title()+";").c_str(), - m_histProp_prefetchedROBsPerAlgo.value().bins(), - m_histProp_prefetchedROBsPerAlgo.value().lowEdge(), - m_histProp_prefetchedROBsPerAlgo.value().highEdge()); - if (m_hist_prefetchedROBsPerAlgo) { - m_hist_prefetchedROBsPerAlgo->SetCanExtend(TH1::kAllAxes); - if( rootHistSvc->regHist(path + m_hist_prefetchedROBsPerAlgo->GetName(), m_hist_prefetchedROBsPerAlgo).isFailure() ) { - logStream() << MSG::WARNING << "Can not register monitoring histogram: " << m_hist_prefetchedROBsPerAlgo->GetName() << endmsg; - } - } - - // release histogramming service - rootHistSvc.release().ignore(); -} - diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc_RTT.h b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc_RTT.h deleted file mode 100644 index 912731206e739c4f358797cea4e93e88d40d04a0..0000000000000000000000000000000000000000 --- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/TrigROBDataProviderSvc_RTT.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGL2SERVICES_TRIGROBDATAPROVIDERSVC_RTT_H -#define TRIGL2SERVICES_TRIGROBDATAPROVIDERSVC_RTT_H - -/** =============================================================== - * TrigROBDataProviderSvc_RTT.h - * =============================================================== - * Description: ROBDataProvider class for simulating the ROB data - * access offline in the merged L2/EF system after LS1. - * - * This class allows to monitor the behaviour of single algorithms - * creating a map between the Algorithm name and the ROBIds - * that have been declared with addROBData - * If this is done during the pre-fetching phase, the algorithm - * name is added with the string "_pref". - * - * Created: Mar 27, 2014 - * By: F. Pastore - */ -#include "GaudiKernel/Service.h" -#include "GaudiKernel/ISvcLocator.h" -#include "GaudiKernel/StatusCode.h" -#include "GaudiKernel/IIncidentListener.h" -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/HistoProperty.h" -#include "GaudiKernel/Property.h" -#include "ByteStreamCnvSvcBase/ROBDataProviderSvc.h" -#include "ByteStreamData/RawEvent.h" -#include "TrigDataAccessMonitoring/ROBDataMonitor.h" -#include "src/TrigROBDataProviderSvc.h" -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc_RTT.h" - - -#include <vector> -#include <map> -#include <iostream> - -// Forward declarations -class StoreGateSvc; -class IAlgContextSvc; -class TH1F; -class TH2F; - -class TrigROBDataProviderSvc_RTT : public TrigROBDataProviderSvc, - virtual public ITrigROBDataProviderSvc_RTT, - virtual public IIncidentListener -{ - public: - typedef OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF ; - - TrigROBDataProviderSvc_RTT(const std::string& name, ISvcLocator* svcloc) ; - - ~TrigROBDataProviderSvc_RTT(void){}; - - virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ) override; - - virtual StatusCode initialize() override; - - // fill histograms per event - void FillEvent(); - - /// set the name of the program which uses the ROBDataProviderSvc - virtual void setCallerName(const std::string_view) override; - - //declare ROBdata // inherited from base class - using ROBDataProviderSvc::addROBData; - virtual void addROBData(const std::vector<uint32_t>& robIds, - const std::string_view callerName="UNKNOWN") override; - - /// Retrieve ROBFragments for given ROB ids from cache - using ROBDataProviderSvc::getROBData; - virtual void getROBData(const std::vector<uint32_t>& robIds, - std::vector<const ROBF*>& robFragments, - const std::string_view callerName="UNKNOWN") override; - - /// Add a given LVL1 ROBFragment to cache - using ROBDataProviderSvc::setNextEvent; - virtual void setNextEvent(const std::vector<ROBF>& result) override; - - /// Add all ROBFragments of a RawEvent to cache - virtual void setNextEvent(const RawEvent* re) override; - - - virtual void handle(const Incident& incident) override; - - /// Check if complete event data are already in cache - virtual bool isEventComplete() override { return TrigROBDataProviderSvc::isEventComplete(); } - virtual bool isEventComplete() const override { return TrigROBDataProviderSvc::isEventComplete(); } - virtual bool isEventComplete(const EventContext& ctx) const override - { return TrigROBDataProviderSvc::isEventComplete(ctx); } - - /// Collect all data for an event from the ROS and put them into the cache - /// Return value: number of ROBs which were retrieved to complete the event - /// Optinonally the name of the caller of this method can be specified for cost monitoring - virtual int collectCompleteEventData(const std::string_view callerName="UNKNOWN") override - { return TrigROBDataProviderSvc::collectCompleteEventData (callerName); } - virtual int collectCompleteEventData(const EventContext& ctx, const std::string_view callerName="UNKNOWN") override - { return TrigROBDataProviderSvc::collectCompleteEventData (ctx, callerName); } - - virtual bool isMissingPrefetching() override { return 0;};// m_missingPrefetchingPerEvent; }; - - virtual bool isPrefetchingAtAlgoLevel() override { return m_enablePrefetchingAtAlgoLevel;}; - - void print(std::ostream& os) const; - - friend std::ostream& operator << (std::ostream&, const TrigROBDataProviderSvc_RTT&); - - private: - - // parameter to enable the prefetching at Algorithm level - bool m_enablePrefetchingAtAlgoLevel; - - typedef std::multimap<std::string, std::vector <uint32_t> > CALLER_ROBMAP;// map between each algo call and its ROBIds - CALLER_ROBMAP m_caller_robmap; - - - // histogram prperties - Histo1DProperty m_histProp_requestedROBsPerAlgo; - Histo1DProperty m_histProp_requestPerAlgo; - Histo1DProperty m_histProp_callerPerEvent; - Histo1DProperty m_histProp_nocachedRequestedROBsPerAlgo; - Histo1DProperty m_histProp_nocachedRequestPerAlgo; - Histo1DProperty m_histProp_declaredROBsPerAlgo; - Histo1DProperty m_histProp_prefetchedROBsPerAlgo; - - Histo1DProperty m_histProp_missingRequestedROBsPerAlgo; - Histo1DProperty m_histProp_missingRequestPerAlgo; - Histo1DProperty m_histProp_missingRequestedROBsPerCall; - - Histo1DProperty m_histProp_missingRequestedROBsPerAlgo_pref; - Histo1DProperty m_histProp_missingRequestPerAlgo_pref; - Histo1DProperty m_histProp_missingRequestedROBsPerCall_pref; - - Histo1DProperty m_histProp_missingRequestedROBsPerAlgoButCached; - Histo1DProperty m_histProp_missingRequestPerAlgoButCached; - Histo1DProperty m_histProp_missingRequestedROBsPerCallButCached; - - Histo1DProperty m_histProp_missingRequestedROBsPerAlgoButCached_pref; - Histo1DProperty m_histProp_missingRequestPerAlgoButCached_pref; - Histo1DProperty m_histProp_missingRequestedROBsPerCallButCached_pref; - - //histograms - TH1F* m_hist_requestedROBsPerAlgo; - TH2F* m_hist_requestedROBsPerCallPerAlgo; - TH1F* m_hist_requestPerAlgo; - TH1F* m_hist_callerPerEvent; - - TH1F* m_hist_nocachedRequestedROBsPerAlgo; - TH1F* m_hist_nocachedRequestPerAlgo; - - TH1F* m_hist_declaredROBsPerAlgo; - TH1F* m_hist_prefetchedROBsPerAlgo; - - // histogrmas for missing declarations - TH1F* m_hist_missingRequestedROBsPerAlgo; - TH1F* m_hist_missingRequestPerAlgo; - TH1F* m_hist_missingRequestedROBsPerCall; - - //hitogrmas for missing declarations during prefetching - TH1F* m_hist_missingRequestedROBsPerAlgo_pref; - TH1F* m_hist_missingRequestPerAlgo_pref; - TH1F* m_hist_missingRequestedROBsPerCall_pref; - - // histogrmas for missing declarations, but cached - TH1F* m_hist_missingRequestedROBsPerAlgoButCached; - TH1F* m_hist_missingRequestPerAlgoButCached; - TH1F* m_hist_missingRequestedROBsPerCallButCached; - - //hitogrmas for missing declarations during prefetching, but cached - TH1F* m_hist_missingRequestedROBsPerAlgoButCached_pref; - TH1F* m_hist_missingRequestPerAlgoButCached_pref; - TH1F* m_hist_missingRequestedROBsPerCallButCached_pref; - - -}; -#endif diff --git a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/components/TrigROBDataProviderSvc_entries.cxx b/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/components/TrigROBDataProviderSvc_entries.cxx deleted file mode 100644 index 9277d777a0ae22190e63188fab6b80126cd1784f..0000000000000000000000000000000000000000 --- a/Trigger/TrigDataAccess/TrigROBDataProviderSvc/src/components/TrigROBDataProviderSvc_entries.cxx +++ /dev/null @@ -1,6 +0,0 @@ -#include "../TrigROBDataProviderSvc.h" -#include "../TrigROBDataProviderSvc_RTT.h" - -DECLARE_COMPONENT( TrigROBDataProviderSvc ) -DECLARE_COMPONENT( TrigROBDataProviderSvc_RTT ) - diff --git a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/TrigSerializeCnvSvc/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/TrigSerializeCnvSvc/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..1b4bcea9094a15c41728429f9440ce39635a37ea --- /dev/null +++ b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/TrigSerializeCnvSvc/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigDataAccess/TrigSerializeCnvSvc diff --git a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/TrigSerializeCnvSvc/TrigSerializeCnvSvc.h b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/TrigSerializeCnvSvc/TrigSerializeCnvSvc.h index 4bddf0102fbdff31914d9d6efafdbf89e82847a5..3f8e78c4560f21b7a5ac7fc03ec9906f643e1438 100755 --- a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/TrigSerializeCnvSvc/TrigSerializeCnvSvc.h +++ b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/TrigSerializeCnvSvc/TrigSerializeCnvSvc.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 TRIGSERIALIZECONVERSIONSVC_H @@ -7,24 +7,20 @@ #include "GaudiKernel/IService.h" #include "GaudiKernel/ConversionSvc.h" -template <class TYPE> class SvcFactory; - +#include "TrigSerializeCnvSvc/TrigStreamAddress.h" -static const InterfaceID IID_TrigSerializeCnvSvc("TrigSerializeCnvSvc", 0, 1); +template <class TYPE> class SvcFactory; class TrigSerializeCnvSvc : public ConversionSvc { public: - static long int storageType(); - virtual long int repSvcType() const; + static long int storageType() { return TrigStreamAddress::storageType(); } + virtual long int repSvcType() const override { return storageType(); } - static const InterfaceID& interfaceID() { return IID_TrigSerializeCnvSvc; } - virtual StatusCode initialize(); + virtual StatusCode initialize() override; TrigSerializeCnvSvc(const std::string &name, ISvcLocator* svc) : - ConversionSvc(name,svc,storageType()) { } - - virtual ~TrigSerializeCnvSvc() {}; + ConversionSvc(name,svc,storageType()) {} }; diff --git a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/TrigSerializeCnvSvc/TrigStreamAddress.h b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/TrigSerializeCnvSvc/TrigStreamAddress.h index 8ef74d1c8cb3c68078246072323ca1b07c076dda..4ac14481b2809d1fa6944a4c3cf612670dae668b 100755 --- a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/TrigSerializeCnvSvc/TrigStreamAddress.h +++ b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/TrigSerializeCnvSvc/TrigStreamAddress.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 TRIGSTREAMCNVSVCBASE_TRIGSTREAMADDRESS_H @@ -27,10 +27,11 @@ public: virtual ~TrigStreamAddress() {}; TrigStreamAddress(const CLID& clid, const std::string& fname, - const std::string& cname, int p1=0,int p2=0 ); + const std::string& cname, int p1=0,int p2=0 ); TrigStreamAddress(const CLID& clid ) ; + static constexpr long storageType() { return 0x51; } void add(const std::vector<uint32_t> &a); const std::vector<uint32_t> & get() const; const std::string sgkey() const { return m_key;} diff --git a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigSerializeCnvSvc.cxx b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigSerializeCnvSvc.cxx index 794ff9ba9f35890542cf3bf31eedcd7c9035d052..ecf6d3d1fcb0e6c2bb6e2595e135e9521ac62166 100755 --- a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigSerializeCnvSvc.cxx +++ b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigSerializeCnvSvc.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 "TrigSerializeCnvSvc/TrigSerializeCnvSvc.h" @@ -24,14 +24,3 @@ StatusCode TrigSerializeCnvSvc::initialize(){ */ return StatusCode::SUCCESS; } - - -long int -TrigSerializeCnvSvc::storageType() { - static long type(0x51); - return type; -} - -long int TrigSerializeCnvSvc::repSvcType() const { - return storageType(); -} diff --git a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigSerializeGuidHelper.cxx b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigSerializeGuidHelper.cxx index de447405b3bf9904435f3a341b3c34f8854064b4..fb0658c145215e7dd3e0bc71698b541231e0a44b 100644 --- a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigSerializeGuidHelper.cxx +++ b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigSerializeGuidHelper.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 "TrigSerializeGuidHelper.h" @@ -30,7 +30,7 @@ StatusCode TrigSerializeGuidHelper::ClassNameToInts(const std::string &clname, u std::string cl = TrigSerializeResult::remapToDictName(clname); - RootType t = RootType::ByName(cl); + RootType t = RootType::ByNameNoQuiet(cl); RootPropertyList pl = t.Properties(); if (pl.HasProperty("ClassID")){ std::string gecko = pl.PropertyAsString("ClassID"); diff --git a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigStreamAddress.cxx b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigStreamAddress.cxx index f569167753466b23e4d39c3a65b99e8d13694829..51278d9408df9ccbbd9247ffb0c585c4974ca992 100755 --- a/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigStreamAddress.cxx +++ b/Trigger/TrigDataAccess/TrigSerializeCnvSvc/src/TrigStreamAddress.cxx @@ -1,29 +1,24 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //==================================================================== // TrigStreamAddress - based on ByteStreamAddress //==================================================================== -//own #include "TrigSerializeCnvSvc/TrigStreamAddress.h" -// Framework include files - -long TrigStream_StorageType(0x51); - /// Standard Constructor TrigStreamAddress::TrigStreamAddress(const CLID& clid, -const std::string& fname , const std::string& cname, int p1, int p2) - : GenericAddress(TrigStream_StorageType, clid,fname,cname, p1, p2 ) + const std::string& fname, const std::string& cname, int p1, int p2) + : GenericAddress(storageType(), clid, fname, cname, p1, p2 ) { m_key = fname; } TrigStreamAddress::TrigStreamAddress(const CLID& clid) - : GenericAddress(TrigStream_StorageType, clid,"","") + : GenericAddress(storageType(), clid, "", "") { } diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/CMakeLists.txt b/Trigger/TrigDataAccess/TrigSerializeResult/CMakeLists.txt index 1cb063e60120692401710d70b2e93c10de0d3a3b..b184ca91016534ceabc75c95f1157d7f6c85a095 100644 --- a/Trigger/TrigDataAccess/TrigSerializeResult/CMakeLists.txt +++ b/Trigger/TrigDataAccess/TrigSerializeResult/CMakeLists.txt @@ -12,7 +12,7 @@ atlas_add_library( TrigSerializeResultLib src/*.cxx PUBLIC_HEADERS TrigSerializeResult PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel StoreGateLib + LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} CxxUtils DataModelRoot PathResolver ) atlas_add_component( TrigSerializeResult diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..938784488dbf8a47cc3257313b6ea566d7742810 --- /dev/null +++ b/Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigDataAccess/TrigSerializeResult diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.h b/Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.h index bd90f9f40b035e36fdda7810db8404ec44404f9f..76114fb70446b21bd580464b8647ee7bd8cb3971 100755 --- a/Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.h +++ b/Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.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 TRIGSERIALIZERESULT_STRINGSERIALIZER_H @@ -76,6 +76,6 @@ private: std::ostringstream m_ostream; //!< sstream used in serialization std::istringstream m_istream; //!< sstream used in de-serialization - static const char* s_delimiter; //!< default delimeter which is put between strings from the input vector while serialization happens + static const char* const s_delimiter; //!< default delimeter which is put between strings from the input vector while serialization happens }; #endif // TRIGSERIALIZERESULT_STRINGSERIALIZER_H diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/src/StringSerializer.cxx b/Trigger/TrigDataAccess/TrigSerializeResult/src/StringSerializer.cxx index a4c89e13cf48fc836c5f8c1f36d2cada48a14637..0383e6b66786a3d7ed1817964ea22b94cf4c87a7 100755 --- a/Trigger/TrigDataAccess/TrigSerializeResult/src/StringSerializer.cxx +++ b/Trigger/TrigDataAccess/TrigSerializeResult/src/StringSerializer.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 */ #include <cstring> #include "TrigSerializeResult/StringSerializer.h" -const char* StringSerializer::s_delimiter = "\n"; +const char* const StringSerializer::s_delimiter = "\n"; void StringSerializer::serialize (const std::vector<std::string>& strings, std::vector<uint32_t>& storage ) { diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.cxx b/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.cxx index a5f2467491387d5db9a37e11dc2342fe4dbbc32d..9bec24cdebb414d08f4aef2d04bb53b3ed4dc032 100755 --- a/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.cxx +++ b/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.cxx @@ -69,7 +69,7 @@ const Int_t kMapOffset = 2; // first 2 map entries are taken by null // Work around ROOT-8367 -class TBufferFileWorkaround +class ATLAS_NOT_THREAD_SAFE TBufferFileWorkaround : public TBufferFile { public: diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.h b/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.h index 37290d66f14f44871745164128a8b5dd3a9d9698..6cc839379137124639226412d6e38d535c8d30e5 100755 --- a/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.h +++ b/Trigger/TrigDataAccess/TrigSerializeResult/src/TrigTSerializer.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 */ @@ -15,6 +15,7 @@ #define TRIGTSERIALIZER_H #include "AthenaBaseComps/AthAlgTool.h" +#include "CxxUtils/checker_macros.h" #include "TrigSerializeResult/ITrigSerializerToolBase.h" #include "RVersion.h" #include "Rtypes.h" @@ -31,7 +32,7 @@ typedef RootType Type; typedef RootDataMember Member; -class TrigTSerializer : virtual public ITrigSerializerToolBase, public AthAlgTool { +class ATLAS_NOT_THREAD_SAFE TrigTSerializer : virtual public ITrigSerializerToolBase, public AthAlgTool { public: TrigTSerializer(const std::string& name, const std::string& type, const IInterface* parent); diff --git a/Trigger/TrigEvent/TrigSteeringEvent/CMakeLists.txt b/Trigger/TrigEvent/TrigSteeringEvent/CMakeLists.txt index adfbe9dc9fb3d5c36f5949ab7887101f3ce8a448..cb0a27f8fa8e1579e7882dbf99e9400fde30f1a8 100644 --- a/Trigger/TrigEvent/TrigSteeringEvent/CMakeLists.txt +++ b/Trigger/TrigEvent/TrigSteeringEvent/CMakeLists.txt @@ -8,13 +8,13 @@ if( XAOD_STANDALONE ) atlas_add_library( TrigSteeringEvent TrigSteeringEvent/*.h Root/*.cxx PUBLIC_HEADERS TrigSteeringEvent - LINK_LIBRARIES AthContainers AsgTools RoiDescriptor xAODCore + LINK_LIBRARIES AthContainers AsgTools CxxUtils RoiDescriptor xAODCore TrigConfHLTData ) elseif( XAOD_ANALYSIS ) atlas_add_library( TrigSteeringEvent TrigSteeringEvent/*.h Root/*.cxx src/*.cxx PUBLIC_HEADERS TrigSteeringEvent - LINK_LIBRARIES AthContainers AsgTools AthenaKernel RoiDescriptor + LINK_LIBRARIES AthContainers AsgTools AthenaKernel CxxUtils RoiDescriptor xAODCore GaudiKernel TrigConfHLTData ) atlas_add_dictionary( TrigSteeringEventDict @@ -30,7 +30,7 @@ else() TrigSteeringEvent/*.h Root/*.cxx src/*.cxx PUBLIC_HEADERS TrigSteeringEvent INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AsgTools AthContainers AthenaBaseComps AthenaKernel GaudiKernel RoiDescriptor TrigConfHLTData xAODCore + LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AsgTools AthContainers AthenaBaseComps AthenaKernel CxxUtils GaudiKernel RoiDescriptor TrigConfHLTData xAODCore PRIVATE_LINK_LIBRARIES TrigT1Interfaces xAODTrigger TrigNavigationLib ) atlas_add_dictionary( TrigSteeringEventDict diff --git a/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..1e90b5884096f49cda84c9efa2cc7972c5f6e10f --- /dev/null +++ b/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigEvent/TrigSteeringEvent diff --git a/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/Chain.h b/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/Chain.h index 892d94bc0cfb074a9f64e5b823860e4f00b0df9b..b06062a6a31eb13d9eda909955847115016d0b89 100644 --- a/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/Chain.h +++ b/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/Chain.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 */ #pragma once @@ -15,7 +15,6 @@ * moved from TrigSteering package * * File and Version Information: - * $Id: Chain.h,v 1.44 2009-02-16 15:47:04 tbold Exp $ **********************************************************************************/ #ifndef TRIGSTEERINGEVENT_CHAIN_H @@ -47,7 +46,7 @@ class TrigTimer; namespace HLT { - static std::string no_config = "no config"; + static const std::string no_config = "no config"; // taht is for backward compatibility of TDT, once new TDT will be available it can be removed from steering enum ChainStatus { ChainInvalid=0, ConfigOnlyChain, ChainOK }; diff --git a/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/HLTResult.h b/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/HLTResult.h index d3a5e4a72eed53e0511ae42f14e139ff87303826..1af1bc3a6e9b86731cf74cd416424c3134adbdef 100644 --- a/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/HLTResult.h +++ b/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/HLTResult.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 */ #pragma once @@ -20,8 +20,8 @@ #include "TrigSteeringEvent/Enums.h" #include "TrigSteeringEvent/GenericResult.h" #include "AthenaKernel/IClassIDSvc.h" - #include "AthenaKernel/CLASS_DEF.h" +#include "CxxUtils/checker_macros.h" /**************************************************************************************** * (June 2006; comments on documentation to: Andreas.Hoecker@cern.ch) @@ -304,7 +304,7 @@ namespace HLT { * @brief Return object representing the extra payload */ HLTExtraData& getExtraData(); - inline const HLTExtraData& getExtraData() const { + inline const HLTExtraData& getExtraData ATLAS_NOT_THREAD_SAFE () const { return const_cast<HLTResult*>(this)->getExtraData(); } @@ -483,11 +483,11 @@ namespace HLT { std::map<unsigned int, std::set<std::pair<CLID, std::string> > > m_modID_id_name; // map from rob module ID to class ID and collection name - mutable std::vector<unsigned int> m_navigationResultCuts; + std::vector<unsigned int> m_navigationResultCuts; - mutable std::vector<unsigned int> m_navigationResultCuts_DSonly; + std::vector<unsigned int> m_navigationResultCuts_DSonly; - mutable HLTExtraData* m_extraData; //!< object for m_extras deserialization (on demand) + HLTExtraData* m_extraData; //!< object for m_extras deserialization (on demand) }; diff --git a/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/StringSerializer.h b/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/StringSerializer.h index c940e313fce2d5857cb41fef87c68e8f4f22c291..0d763461e4e8d91a96f31f74c3968b8250e63495 100755 --- a/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/StringSerializer.h +++ b/Trigger/TrigEvent/TrigSteeringEvent/TrigSteeringEvent/StringSerializer.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 TRIGSTEERINGEVENT_STRINGSERIALIZER_H @@ -79,7 +79,7 @@ private: std::ostringstream m_ostream; //!< sstream used in serialization std::istringstream m_istream; //!< sstream used in de-serialization - static const char* s_delimiter; //!< default delimeter which is put between strings from the input vector while serialization happens + static const char * const s_delimiter; //!< default delimeter which is put between strings from the input vector while serialization happens }; diff --git a/Trigger/TrigEvent/TrigSteeringEvent/src/StringSerializer.cxx b/Trigger/TrigEvent/TrigSteeringEvent/src/StringSerializer.cxx index 041e02ae578ba5fa95dbe5f8d59afe8718d5c9da..64935cb0531704c2e67b0e0970150af6cf9e7ffa 100755 --- a/Trigger/TrigEvent/TrigSteeringEvent/src/StringSerializer.cxx +++ b/Trigger/TrigEvent/TrigSteeringEvent/src/StringSerializer.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 <cstring> @@ -9,7 +9,7 @@ namespace TrigSteeringEvent { -const char* StringSerializer::s_delimiter = "\n"; +const char* const StringSerializer::s_delimiter = "\n"; void StringSerializer::serialize (const std::vector<std::string>& strings, std::vector<uint32_t>& storage ) { diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..c583baa660c3b54acd2cce00d302512acc5d3754 --- /dev/null +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigEvent/TrigSteeringEventAthenaPool diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/HLTResultCnv.cxx b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/HLTResultCnv.cxx index 9f4beae66b16fa6c73bf85c7d6e09528785ca545..94482743a401bf12906998d12a851bae87bf3430 100644 --- a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/HLTResultCnv.cxx +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/HLTResultCnv.cxx @@ -23,7 +23,6 @@ HLTResultCnv::~HLTResultCnv() HLTResult_PERS* HLTResultCnv::createPersistent(HLT::HLTResult* transCont) { MsgStream mlog(msgSvc(), "HLTResultConverter" ); - mlog << MSG::DEBUG << "HLTResultCnv::createPersistent " << endmsg; HLTResult_PERS* persObj = m_TPConverter->createPersistent( transCont, mlog ); @@ -34,20 +33,17 @@ HLTResult_PERS* HLTResultCnv::createPersistent(HLT::HLTResult* transCont) HLT::HLTResult* HLTResultCnv::createTransient() { MsgStream mlog(msgSvc(), "HLTResultConverter" ); - mlog << MSG::DEBUG << "HLTResultCnv::createTransient " << endmsg; - static pool::Guid p1_guid("9567573D-F35E-4D5E-9A1A-A43B07D3CF3B"); - static pool::Guid p0_guid("559D6CB9-9A54-4284-A03D-9C745352281D"); + static const pool::Guid p1_guid("9567573D-F35E-4D5E-9A1A-A43B07D3CF3B"); + static const pool::Guid p0_guid("559D6CB9-9A54-4284-A03D-9C745352281D"); if ( compareClassGuid(p1_guid) ) { - mlog << MSG::DEBUG << "HLTResult::reading p1 persistent object" << endmsg; // using unique_ptr ensures deletion of the persistent object std::unique_ptr< HLT::HLTResult_p1 > col_vect( poolReadObject< HLT::HLTResult_p1 >() ); return m_TPConverter->createTransient( col_vect.get(), mlog ); } else if( compareClassGuid(p0_guid) ){ - mlog << MSG::DEBUG << "HLTResult::reading p0 persistent object" << endmsg; // old version from before TP separation, just return it return this->poolReadObject<HLT::HLTResult>(); } diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/Lvl1ResultCnv.cxx b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/Lvl1ResultCnv.cxx index c0ce592833136920413b8536becfabc04c5919cf..bfc471ef90376ee51820bd23467bc86bcb4aad24 100644 --- a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/Lvl1ResultCnv.cxx +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/Lvl1ResultCnv.cxx @@ -31,7 +31,6 @@ Lvl1ResultCnv::~Lvl1ResultCnv() Lvl1Result_PERS* Lvl1ResultCnv::createPersistent(LVL1CTP::Lvl1Result* transCont) { MsgStream mlog(msgSvc(), "Lvl1ResultConverter" ); - mlog << MSG::DEBUG << "Lvl1ResultCnv::createPersistent " << endmsg; Lvl1Result_PERS* persObj = m_impl->m_TPConverter_p2.createPersistent( transCont, mlog ); @@ -42,23 +41,19 @@ Lvl1Result_PERS* Lvl1ResultCnv::createPersistent(LVL1CTP::Lvl1Result* transCont) LVL1CTP::Lvl1Result* Lvl1ResultCnv::createTransient() { MsgStream mlog(msgSvc(), "Lvl1ResultConverter" ); - mlog << MSG::DEBUG << "Lvl1ResultCnv::createTransient " << endmsg; - static pool::Guid p2_guid("F4208CCF-9FAA-4F01-9C0B-26E9E59CE49F"); - static pool::Guid p1_guid("226FF990-4D6A-4957-AAAD-42172D174773"); - static pool::Guid p0_guid("18DE165E-3DB5-4EAC-867D-807DA3E217C0"); + static const pool::Guid p2_guid("F4208CCF-9FAA-4F01-9C0B-26E9E59CE49F"); + static const pool::Guid p1_guid("226FF990-4D6A-4957-AAAD-42172D174773"); + static const pool::Guid p0_guid("18DE165E-3DB5-4EAC-867D-807DA3E217C0"); if ( compareClassGuid(p1_guid) ) { - mlog << MSG::DEBUG << "Lvl1Result::createTransient reading p1 persistent object" << endmsg; // using unique_ptr ensures deletion of the persistent object std::unique_ptr< LVL1CTP::Lvl1Result_p1 > col_vect( poolReadObject< LVL1CTP::Lvl1Result_p1 >() ); return m_impl->m_TPConverter_p1.createTransient( col_vect.get(), mlog ); } else if( compareClassGuid(p0_guid) ){ - mlog << MSG::DEBUG << "Lvl1Result::createTransient reading p0 persistent object" << endmsg; // old version from before TP separation, just return it return this->poolReadObject<LVL1CTP::Lvl1Result>(); } else if ( compareClassGuid(p2_guid) ) { - mlog << MSG::DEBUG << "Lvl1Result::createTransient reading p2 persistent object" << endmsg; // using unique_ptr ensures deletion of the persistent object std::unique_ptr< LVL1CTP::Lvl1Result_p2 > col_vect( poolReadObject< LVL1CTP::Lvl1Result_p2 >() ); return m_impl->m_TPConverter_p2.createTransient( col_vect.get(), mlog ); diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigOperationalInfoCnv.cxx b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigOperationalInfoCnv.cxx index abcc27a8a5b42cd144d962155d5dbdb7e50763f9..bba20f0ad5fed0cbeb34ec2eb682ce4e7d076d60 100644 --- a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigOperationalInfoCnv.cxx +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigOperationalInfoCnv.cxx @@ -19,7 +19,6 @@ TrigOperationalInfoCnv::~TrigOperationalInfoCnv() TrigOperationalInfo_PERS* TrigOperationalInfoCnv::createPersistent(TrigOperationalInfo* transObj) { MsgStream mlog(msgSvc(), "TrigOperationalInfoConverter" ); - mlog << MSG::DEBUG << "TrigOperationalInfoCnv_p1::createPersistent" << endmsg; TrigOperationalInfo_PERS *persObj = m_TPConverter->createPersistent( transObj, mlog ); @@ -30,16 +29,13 @@ TrigOperationalInfo_PERS* TrigOperationalInfoCnv::createPersistent(TrigOperation TrigOperationalInfo* TrigOperationalInfoCnv::createTransient() { MsgStream mlog(msgSvc(), "TrigOperationalInfoConverter" ); - mlog << MSG::DEBUG << "TrigOperationalInfoCnv_p1::createTransient " << endmsg; - - static pool::Guid p1_guid("765F0281-801B-4F5C-8C4C-5BE7E7DB5E42"); - + static const pool::Guid p1_guid("765F0281-801B-4F5C-8C4C-5BE7E7DB5E42"); + TrigOperationalInfo *trans_obj(0); if( compareClassGuid(p1_guid) ) { - mlog << MSG::DEBUG << "TrigOperationalInfoCnv::reading p1 persistent object" << endmsg; std::unique_ptr< TrigOperationalInfo_p1 > col_vect( this->poolReadObject< TrigOperationalInfo_p1 >() ); trans_obj = m_TPConverter->createTransient( col_vect.get(), mlog ); } else { diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigOperationalInfoCollectionCnv.cxx b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigOperationalInfoCollectionCnv.cxx index c4787641e79d21e47319bf0079a04c48d3aff312..a39cff26128713279ba14a70cf946cc7e1db8c82 100644 --- a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigOperationalInfoCollectionCnv.cxx +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigOperationalInfoCollectionCnv.cxx @@ -26,7 +26,6 @@ TrigOperationalInfoCollectionCnv::~TrigOperationalInfoCollectionCnv() TrigOperationalInfoCollection_PERS* TrigOperationalInfoCollectionCnv::createPersistent(TrigOperationalInfoCollection* transObj) { MsgStream mlog(msgSvc(), "TrigOperationalInfoCollectionConverter" ); - mlog << MSG::DEBUG << "TrigOperationalInfoCollectionCnv::createPersistent" << endmsg; TrigOperationalInfoCollection_PERS *persObj = m_impl->m_TPConverter_tlp1.createPersistent( transObj, mlog ); @@ -37,26 +36,21 @@ TrigOperationalInfoCollection_PERS* TrigOperationalInfoCollectionCnv::createPers TrigOperationalInfoCollection* TrigOperationalInfoCollectionCnv::createTransient() { MsgStream mlog(msgSvc(), "TrigOperationalInfoCollectionConverter" ); - mlog << MSG::DEBUG << "TrigOperationalInfoCollectionCnv::createTransient " << endmsg; - - static pool::Guid tlp1_guid("7D5A0227-E28B-4228-83C5-22F8BBB90BBF"); - static pool::Guid p1_guid("B6C95F89-C1B9-4B9D-A533-F6F4B57BD277"); + + static const pool::Guid tlp1_guid("7D5A0227-E28B-4228-83C5-22F8BBB90BBF"); + static const pool::Guid p1_guid("B6C95F89-C1B9-4B9D-A533-F6F4B57BD277"); TrigOperationalInfoCollection *trans_obj(0); if( compareClassGuid(tlp1_guid) ) { - mlog << MSG::DEBUG << "TrigOperationalInfoCollectionCnv::reading tlp1 persistent object" << endmsg; std::unique_ptr< TrigOperationalInfoCollection_tlp1 > col_vect( this->poolReadObject< TrigOperationalInfoCollection_tlp1 >() ); - mlog << MSG::DEBUG << "TrigOperationalInfoCollectionCnv::reading tlp1 persistent object pointer" << col_vect.get() << endmsg; trans_obj = m_impl->m_TPConverter_tlp1.createTransient( col_vect.get(), mlog ); } else if( compareClassGuid(p1_guid) ) { - mlog << MSG::DEBUG << "TrigOperationalInfoCollectionCnv::reading p1 persistent object" << endmsg; std::unique_ptr< TrigOperationalInfoCollection_p1 > col_vect( this->poolReadObject< TrigOperationalInfoCollection_p1 >() ); - mlog << MSG::DEBUG << "TrigOperationalInfoCollectionCnv::reading p1 persistent object pointer" << col_vect.get() << endmsg; trans_obj = m_impl->m_TPConverter.createTransient( col_vect.get(), mlog ); } diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassBitsCnv.cxx b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassBitsCnv.cxx index 9e0b367f60556f492b564fac35020529c65eb114..aa760f3a6913ed52631d35918827a5f40718ae72 100644 --- a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassBitsCnv.cxx +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassBitsCnv.cxx @@ -13,8 +13,6 @@ TrigPassBitsCnv::~TrigPassBitsCnv(){} TrigPassBits_PERS* TrigPassBitsCnv::createPersistent(TrigPassBits* transObj) { MsgStream mlog(msgSvc(), "TrigPassBitsConverter" ); - mlog << MSG::DEBUG << "TrigPassBitsCnv::createPersistent" << endmsg; - TrigPassBitsCnv_p1 converter; TrigPassBits_PERS *persObj = converter.createPersistent( transObj, mlog ); @@ -25,10 +23,7 @@ TrigPassBits_PERS* TrigPassBitsCnv::createPersistent(TrigPassBits* transObj) { TrigPassBits* TrigPassBitsCnv::createTransient() { MsgStream mlog(msgSvc(), "TrigPassBitsConverter" ); - mlog << MSG::DEBUG << "TrigPassBitsCnv::createTransient " << endmsg; - - static pool::Guid p1_guid("391FFE21-5D82-471E-9FFC-B77150142B8F"); - + static const pool::Guid p1_guid("391FFE21-5D82-471E-9FFC-B77150142B8F"); if( compareClassGuid(p1_guid) ) { diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassBitsCollectionCnv.cxx b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassBitsCollectionCnv.cxx index 15dc6689ae0186ed8163f861b9bf076994b45cc5..06c60d692e2fc0960a6df7dbb1fbc4af19cae1a9 100644 --- a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassBitsCollectionCnv.cxx +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassBitsCollectionCnv.cxx @@ -6,16 +6,24 @@ #include "TrigSteeringEventTPCnv/TrigPassBitsCollection_p1.h" #include "TrigSteeringEventTPCnv/TrigPassBitsCollectionCnv_p1.h" -static TrigPassBitsCollectionCnv_p1 TPconverter1; +struct TrigPassBitsCollection_impl +{ + TrigPassBitsCollectionCnv_p1 m_TPconverter_p1; +}; + +TrigPassBitsCollectionCnv::TrigPassBitsCollectionCnv( ISvcLocator *svcloc ) : + TrigPassBitsCollectionCnvBase(svcloc), + m_impl(std::make_unique<TrigPassBitsCollection_impl>()) +{} + +TrigPassBitsCollectionCnv::~TrigPassBitsCollectionCnv() = default; //createPersistent TrigPassBitsCollection_PERS * TrigPassBitsCollectionCnv::createPersistent( TrigPassBitsCollection *transObj) { MsgStream mlog(msgSvc(), "TrigPassBitsCollectionConverter" ); - mlog << MSG::DEBUG << "TrigPassBitsCollectionCnv::createPersistent called" << endmsg; - - TrigPassBitsCollection_PERS * p_cont = TPconverter1.createPersistent( transObj, mlog ); + TrigPassBitsCollection_PERS * p_cont = m_impl->m_TPconverter_p1.createPersistent( transObj, mlog ); return p_cont; @@ -27,16 +35,13 @@ TrigPassBitsCollection * TrigPassBitsCollectionCnv::createTransient() { MsgStream mlog(msgSvc(), "TrigPassBitsCollectionConverter" ); - mlog << MSG::DEBUG << "TrigPassBitsCollectionCnv::createTransient called" << endmsg; - - static pool::Guid p1_guid( "E6E4F396-D696-4C1C-A0C4-7766E0AF9BB5" ); + static const pool::Guid p1_guid( "E6E4F396-D696-4C1C-A0C4-7766E0AF9BB5" ); // TrigPassBitsCollection *p_collection = 0; if( compareClassGuid( p1_guid ) ) { std::unique_ptr< TrigPassBitsCollection_p1 > col_vect( poolReadObject< TrigPassBitsCollection_p1 >() ); - // std::cout << "Reading MFC p1" << std::endl; - return TPconverter1.createTransient( col_vect.get(), mlog ) ; + return m_impl->m_TPconverter_p1.createTransient( col_vect.get(), mlog ) ; } else throw std::runtime_error( "Unsupported persistent version of TrigPassBitsCollection" ); diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassBitsCollectionCnv.h b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassBitsCollectionCnv.h index d116ef8dc9bbd23f9821c0520ac8b70e9038ae75..373c9654a058080187fe79cd421c0a348d133c25 100644 --- a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassBitsCollectionCnv.h +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassBitsCollectionCnv.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 TRIGEVENTATHENAPOOL_TRIGPASSBITSCONTAINER_CNV_H @@ -9,23 +9,27 @@ #include "TrigSteeringEvent/TrigPassBitsCollection.h" #include "TrigSteeringEventTPCnv/TrigPassBitsCollection_p1.h" -typedef TrigPassBitsCollection_p1 TrigPassBitsCollection_PERS; +#include <memory> +typedef TrigPassBitsCollection_p1 TrigPassBitsCollection_PERS; typedef T_AthenaPoolCustomCnv<TrigPassBitsCollection, TrigPassBitsCollection_PERS> TrigPassBitsCollectionCnvBase; +struct TrigPassBitsCollection_impl; class TrigPassBitsCollectionCnv : public TrigPassBitsCollectionCnvBase { friend class CnvFactory<TrigPassBitsCollectionCnv>; - protected: - public: - TrigPassBitsCollectionCnv( ISvcLocator *svcloc ): TrigPassBitsCollectionCnvBase(svcloc){} -protected: + TrigPassBitsCollectionCnv( ISvcLocator *svcloc ); + ~TrigPassBitsCollectionCnv(); + +protected: virtual TrigPassBitsCollection_PERS *createPersistent( TrigPassBitsCollection *transObj); virtual TrigPassBitsCollection *createTransient(); +private: + std::unique_ptr<TrigPassBitsCollection_impl> m_impl; }; #endif //TRIGPASSBITSCONTAINER_CNV_H diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassFlagsCnv.cxx b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassFlagsCnv.cxx index 616d2796d4a4d95a8887461924c7f89d86eb1af4..ff4b29621f2db63bbdc37f8f636c39719f708e9e 100644 --- a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassFlagsCnv.cxx +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassFlagsCnv.cxx @@ -28,7 +28,7 @@ TrigPassFlags* TrigPassFlagsCnv::createTransient() { if(mlog.level()<=MSG::DEBUG) mlog << MSG::DEBUG << "TrigPassFlagsCnv::createTransient " << endmsg; - static pool::Guid p1_guid("1FA7E531-B1F9-4EC5-9BD1-FD19CE7368B6"); + static const pool::Guid p1_guid("1FA7E531-B1F9-4EC5-9BD1-FD19CE7368B6"); if( compareClassGuid(p1_guid) ) { diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassFlagsCollectionCnv.cxx b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassFlagsCollectionCnv.cxx index 08e27d202305466777eb57d82c33c399df34b0ef..85948d4cc05b6df19517bd27119aeb71fb62c09e 100644 --- a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassFlagsCollectionCnv.cxx +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassFlagsCollectionCnv.cxx @@ -6,16 +6,24 @@ #include "TrigSteeringEventTPCnv/TrigPassFlagsCollection_p1.h" #include "TrigSteeringEventTPCnv/TrigPassFlagsCollectionCnv_p1.h" -static TrigPassFlagsCollectionCnv_p1 TPconverter1; +struct TrigPassFlagsCollectionCnv_impl +{ + TrigPassFlagsCollectionCnv_p1 m_TPconverter_p1; +}; + +TrigPassFlagsCollectionCnv::TrigPassFlagsCollectionCnv( ISvcLocator *svcloc ) : + TrigPassFlagsCollectionCnvBase(svcloc), + m_impl(std::make_unique<TrigPassFlagsCollectionCnv_impl>()) +{} + +TrigPassFlagsCollectionCnv::~TrigPassFlagsCollectionCnv() = default; //createPersistent TrigPassFlagsCollection_PERS * TrigPassFlagsCollectionCnv::createPersistent( TrigPassFlagsCollection *transObj) { MsgStream mlog(msgSvc(), "TrigPassFlagsCollectionConverter" ); - mlog << MSG::DEBUG << "TrigPassFlagsCollectionCnv::createPersistent called" << endmsg; - - TrigPassFlagsCollection_PERS * p_cont = TPconverter1.createPersistent( transObj, mlog ); + TrigPassFlagsCollection_PERS * p_cont = m_impl->m_TPconverter_p1.createPersistent( transObj, mlog ); return p_cont; @@ -27,16 +35,13 @@ TrigPassFlagsCollection * TrigPassFlagsCollectionCnv::createTransient() { MsgStream mlog(msgSvc(), "TrigPassFlagsCollectionConverter" ); - mlog << MSG::DEBUG << "TrigPassFlagsCollectionCnv::createTransient called" << endmsg; - - static pool::Guid p1_guid( "7DE670AF-A256-4E8E-BC44-1CA30810F294" ); + static const pool::Guid p1_guid( "7DE670AF-A256-4E8E-BC44-1CA30810F294" ); // TrigPassFlagsCollection *p_collection = 0; if( compareClassGuid( p1_guid ) ) { std::unique_ptr< TrigPassFlagsCollection_p1 > col_vect( poolReadObject< TrigPassFlagsCollection_p1 >() ); - // std::cout << "Reading MFC p1" << std::endl; - return TPconverter1.createTransient( col_vect.get(), mlog ) ; + return m_impl->m_TPconverter_p1.createTransient( col_vect.get(), mlog ) ; } else throw std::runtime_error( "Unsupported persistent version of TrigPassFlagsCollection" ); diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassFlagsCollectionCnv.h b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassFlagsCollectionCnv.h index 22cad33605218b29561e6e6a919eb17223dbfb5b..69bfe2005d63ef14fe35b3a37d98df45a3d67a55 100644 --- a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassFlagsCollectionCnv.h +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigPassFlagsCollectionCnv.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 TRIGEVENTATHENAPOOL_TRIGPASSFLAGSCONTAINER_CNV_H @@ -9,23 +9,26 @@ #include "TrigSteeringEvent/TrigPassFlagsCollection.h" #include "TrigSteeringEventTPCnv/TrigPassFlagsCollection_p1.h" -typedef TrigPassFlagsCollection_p1 TrigPassFlagsCollection_PERS; +#include <memory> +typedef TrigPassFlagsCollection_p1 TrigPassFlagsCollection_PERS; typedef T_AthenaPoolCustomCnv<TrigPassFlagsCollection, TrigPassFlagsCollection_PERS> TrigPassFlagsCollectionCnvBase; +struct TrigPassFlagsCollectionCnv_impl; class TrigPassFlagsCollectionCnv : public TrigPassFlagsCollectionCnvBase { friend class CnvFactory<TrigPassFlagsCollectionCnv>; - protected: - public: - TrigPassFlagsCollectionCnv( ISvcLocator *svcloc ): TrigPassFlagsCollectionCnvBase(svcloc){} + TrigPassFlagsCollectionCnv( ISvcLocator *svcloc ); + ~TrigPassFlagsCollectionCnv(); protected: virtual TrigPassFlagsCollection_PERS *createPersistent( TrigPassFlagsCollection *transObj); virtual TrigPassFlagsCollection *createTransient(); +private: + std::unique_ptr<TrigPassFlagsCollectionCnv_impl> m_impl; }; #endif //TRIGPASSBITSCONTAINER_CNV_H diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigRoiDescriptorCnv.cxx b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigRoiDescriptorCnv.cxx index 6c3a0a8e9f04ef86e5c2c09880fe6dc4dbc67bb7..15dd82952150ae0f8d833a35186e139ec3faba3f 100644 --- a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigRoiDescriptorCnv.cxx +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigRoiDescriptorCnv.cxx @@ -33,7 +33,6 @@ TrigRoiDescriptorCnv::~TrigRoiDescriptorCnv() TrigRoiDescriptor_PERS* TrigRoiDescriptorCnv::createPersistent(TrigRoiDescriptor* transObj) { MsgStream mlog(msgSvc(), "TrigRoiDescriptorConverter" ); - mlog << MSG::DEBUG << "TrigRoiDescriptorCnv::createPersistent" << endmsg; TrigRoiDescriptor_PERS *persObj = m_TPConverters->p3.createPersistent( transObj, mlog ); @@ -44,39 +43,34 @@ TrigRoiDescriptor_PERS* TrigRoiDescriptorCnv::createPersistent(TrigRoiDescriptor TrigRoiDescriptor* TrigRoiDescriptorCnv::createTransient() { MsgStream mlog(msgSvc(), "TrigRoiDescriptorConverter" ); - mlog << MSG::DEBUG << "TrigRoiDescriptorCnv::createTransient " << endmsg; - - static pool::Guid p3_guid("28F5BCC8-1F3D-47B1-8286-087F1B298F0A"); - static pool::Guid p2_guid("D53CE59B-99A8-4B25-87D5-C08D1AF4BA8A"); - static pool::Guid p1_guid("391FFE21-5D82-471E-9FFC-B77150142B8F"); - static pool::Guid p0_guid("B2C86E23-8421-4F34-8014-AE4A7E4BA0A7"); + + static const pool::Guid p3_guid("28F5BCC8-1F3D-47B1-8286-087F1B298F0A"); + static const pool::Guid p2_guid("D53CE59B-99A8-4B25-87D5-C08D1AF4BA8A"); + static const pool::Guid p1_guid("391FFE21-5D82-471E-9FFC-B77150142B8F"); + static const pool::Guid p0_guid("B2C86E23-8421-4F34-8014-AE4A7E4BA0A7"); TrigRoiDescriptor *trans_obj(0); if( compareClassGuid(p3_guid) ) { - mlog << MSG::DEBUG << "TrigRoiDescriptorCnv::reading p3 persistent object" << endmsg; std::unique_ptr< TrigRoiDescriptor_p3 > col_vect( this->poolReadObject< TrigRoiDescriptor_p3 >() ); trans_obj = m_TPConverters->p3.createTransient( col_vect.get(), mlog ); } else if( compareClassGuid(p2_guid) ) { - mlog << MSG::DEBUG << "TrigRoiDescriptorCnv::reading p2 persistent object" << endmsg; std::unique_ptr< TrigRoiDescriptor_p2 > col_vect( this->poolReadObject< TrigRoiDescriptor_p2 >() ); trans_obj = m_TPConverters->p2.createTransient( col_vect.get(), mlog ); } else if( compareClassGuid(p1_guid) ) { - mlog << MSG::DEBUG << "TrigRoiDescriptorCnv::reading p1 persistent object" << endmsg; std::unique_ptr< TrigRoiDescriptor_p1 > col_vect( this->poolReadObject< TrigRoiDescriptor_p1 >() ); trans_obj = m_TPConverters->p1.createTransient( col_vect.get(), mlog ); } else if( compareClassGuid(p0_guid) ) { - mlog << MSG::DEBUG << "TrigRoiDescriptorCnv::reading p0 persistent object" << endmsg; // old version from before TP separation, just return it trans_obj = this->poolReadObject<TrigRoiDescriptor>(); diff --git a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigRoiDescriptorCollectionCnv.cxx b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigRoiDescriptorCollectionCnv.cxx index 0a580ed98a40556bea2d9a11f214baf767cd53d8..e6b71241b178fa85f06ff04a571e3b115178ff58 100644 --- a/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigRoiDescriptorCollectionCnv.cxx +++ b/Trigger/TrigEvent/TrigSteeringEventAthenaPool/src/TrigRoiDescriptorCollectionCnv.cxx @@ -40,7 +40,6 @@ TrigRoiDescriptorCollectionCnv::~TrigRoiDescriptorCollectionCnv() TrigRoiDescriptorCollection_PERS* TrigRoiDescriptorCollectionCnv::createPersistent(TrigRoiDescriptorCollection* transObj) { MsgStream mlog(msgSvc(), "TrigRoiDescriptorCollectionConverter" ); - mlog << MSG::DEBUG << "TrigRoiDescriptorCollectionCnv::createPersistent" << endmsg; TrigRoiDescriptorCollection_PERS *persObj = m_impl->m_TPConverter_p3.createPersistent( transObj, mlog ); @@ -51,36 +50,31 @@ TrigRoiDescriptorCollection_PERS* TrigRoiDescriptorCollectionCnv::createPersiste TrigRoiDescriptorCollection* TrigRoiDescriptorCollectionCnv::createTransient() { MsgStream mlog(msgSvc(), "TrigRoiDescriptorCollectionConverter" ); - mlog << MSG::DEBUG << "TrigRoiDescriptorCollectionCnv::createTransient " << endmsg; - - static pool::Guid p3_guid("615418EF-EEFB-4E87-A396-7313E67C547E"); - static pool::Guid p2_guid("D1A44F23-416C-4AB6-BFFA-2EA280565D4E"); - static pool::Guid p1_guid("D0A0B6E7-9E0C-484E-AE8C-AC57B5111EA0"); - static pool::Guid tlp1_guid("CE80FC4E-B16B-40B2-9D9E-EB4916B663B0"); + + static const pool::Guid p3_guid("615418EF-EEFB-4E87-A396-7313E67C547E"); + static const pool::Guid p2_guid("D1A44F23-416C-4AB6-BFFA-2EA280565D4E"); + static const pool::Guid p1_guid("D0A0B6E7-9E0C-484E-AE8C-AC57B5111EA0"); + static const pool::Guid tlp1_guid("CE80FC4E-B16B-40B2-9D9E-EB4916B663B0"); TrigRoiDescriptorCollection *trans_obj(0); if( compareClassGuid(p3_guid) ) { - mlog << MSG::DEBUG << "TrigRoiDescriptorCollectionCnv::reading p3 persistent object" << endmsg; std::unique_ptr< TrigRoiDescriptorCollection_p3 > col_vect( this->poolReadObject< TrigRoiDescriptorCollection_p3 >() ); trans_obj = m_impl->m_TPConverter_p3.createTransient( col_vect.get(), mlog ); } else if( compareClassGuid(p2_guid) ) { - mlog << MSG::DEBUG << "TrigRoiDescriptorCollectionCnv::reading p2 persistent object" << endmsg; std::unique_ptr< TrigRoiDescriptorCollection_p2 > col_vect( this->poolReadObject< TrigRoiDescriptorCollection_p2 >() ); trans_obj = m_impl->m_TPConverter_p2.createTransient( col_vect.get(), mlog ); } else if( compareClassGuid(tlp1_guid) ) { - mlog << MSG::DEBUG << "TrigRoiDescriptorCollectionCnv::reading tlp1 persistent object" << endmsg; std::unique_ptr< TrigRoiDescriptorCollection_tlp1 > col_vect( this->poolReadObject< TrigRoiDescriptorCollection_tlp1 >() ); trans_obj = m_impl->m_TPConverter_tlp1.createTransient( col_vect.get(), mlog ); } else if( compareClassGuid(p1_guid) ) { - mlog << MSG::DEBUG << "TrigRoiDescriptorCollectionCnv::reading p1 persistent object" << endmsg; std::unique_ptr< TrigRoiDescriptorCollection_p1 > col_vect( this->poolReadObject< TrigRoiDescriptorCollection_p1 >() ); trans_obj = m_impl->m_TPConverter_p1.createTransient( col_vect.get(), mlog ); } diff --git a/Trigger/TrigEvent/TrigSteeringEventTPCnv/CMakeLists.txt b/Trigger/TrigEvent/TrigSteeringEventTPCnv/CMakeLists.txt index eff7eb87b8b31d7f873f6987ea0d2e2baf40dfbd..1fe49fed227c0b6b6f368f799fe7f9db1e345b42 100644 --- a/Trigger/TrigEvent/TrigSteeringEventTPCnv/CMakeLists.txt +++ b/Trigger/TrigEvent/TrigSteeringEventTPCnv/CMakeLists.txt @@ -25,7 +25,7 @@ function( _add_test test ) atlas_add_test( ${test} SOURCES test/${test}.cxx - LINK_LIBRARIES TestTools TrigSteeringEventTPCnv ) + LINK_LIBRARIES CxxUtils TestTools TrigSteeringEventTPCnv ) endfunction() _add_test( HLTResultCnv_p1_test ) diff --git a/Trigger/TrigEvent/TrigSteeringEventTPCnv/TrigSteeringEventTPCnv/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigEvent/TrigSteeringEventTPCnv/TrigSteeringEventTPCnv/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..becb4f6a9f616fc72a9c3152ef20301f5504de23 --- /dev/null +++ b/Trigger/TrigEvent/TrigSteeringEventTPCnv/TrigSteeringEventTPCnv/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigEvent/TrigSteeringEventTPCnv diff --git a/Trigger/TrigEvent/TrigSteeringEventTPCnv/test/TrigPassFlagsCnv_p1_test.cxx b/Trigger/TrigEvent/TrigSteeringEventTPCnv/test/TrigPassFlagsCnv_p1_test.cxx index 5aa77ae0bf5661f05126682240a5bb3b3ab2b957..048f0ff2ea0b37501ca66a2fbfa61b959ebb0288 100644 --- a/Trigger/TrigEvent/TrigSteeringEventTPCnv/test/TrigPassFlagsCnv_p1_test.cxx +++ b/Trigger/TrigEvent/TrigSteeringEventTPCnv/test/TrigPassFlagsCnv_p1_test.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 */ // $Id$ @@ -13,6 +13,7 @@ #undef NDEBUG #include "TrigSteeringEventTPCnv/TrigPassFlagsCnv_p1.h" +#include "CxxUtils/checker_macros.h" #include "TestTools/random.h" #include "TestTools/leakcheck.h" #include "GaudiKernel/MsgStream.h" @@ -42,7 +43,7 @@ void testit (const TrigPassFlags& trans1) } -void test1() +void test1 ATLAS_NOT_REENTRANT () { std::cout << "test1\n"; Athena_test::Leakcheck check; @@ -60,7 +61,7 @@ void test1() } -int main() +int main ATLAS_NOT_REENTRANT () { test1(); return 0; diff --git a/Trigger/TrigEvent/TrigStorageDefinitions/TrigStorageDefinitions/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigEvent/TrigStorageDefinitions/TrigStorageDefinitions/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..e23ee3103773998b6258b9716dce1e3df53d761e --- /dev/null +++ b/Trigger/TrigEvent/TrigStorageDefinitions/TrigStorageDefinitions/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigEvent/TrigStorageDefinitions diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetOnlineMonitoringMTConfig.py b/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetOnlineMonitoringMTConfig.py index d5a95be024df5819901771b2a6d6227ac96274b2..e2a2b792ecce8160a0e8d7b1501927abbe39743c 100755 --- a/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetOnlineMonitoringMTConfig.py +++ b/Trigger/TrigHypothesis/TrigBjetHypo/python/TrigBjetOnlineMonitoringMTConfig.py @@ -6,27 +6,30 @@ class TrigBjetOnlineMonitoring(GenericMonitoringTool): super(TrigBjetOnlineMonitoring, self).__init__(name) self.name = "TrigBjetOnlineMonitoring" self.HistPath = self.name - default_bin_count = 20 + default_bin_count = 100 + TH1F_opts = { 'type':'TH1F', 'path':'EXPERT' } # Event Histograms - self.defineHistogram('track_count', path='EXPERT', type='TH1F', title="Number of Tracks", xbins = 50, xmin=0, xmax=50) - self.defineHistogram('jet_count', path='EXPERT', type='TH1F', title="Number of Jets", xbins = 20, xmin=0, xmax=20) - self.defineHistogram('vertex_count', path='EXPERT', type='TH1F', title="Number of Vertices", xbins = 50, xmin=0, xmax=50) + self.defineHistogram('track_count', title="Number of Tracks", xbins = 100, xmin=0, xmax=100, **TH1F_opts) + self.defineHistogram('jet_count', title="Number of Jets", xbins = 20, xmin=0, xmax=20, **TH1F_opts) + self.defineHistogram('vertex_count', title="Number of Vertices", xbins = 200, xmin=0, xmax=200, **TH1F_opts) ## Track Histograms - self.defineHistogram('track_Et', path='EXPERT', type='TH1F', title="Track Transverse Energy", xbins = default_bin_count, xmin=0, xmax=800000) - self.defineHistogram('track_eta', path='EXPERT', type='TH1F', title="Track Eta", xbins = default_bin_count, xmin=-5, xmax=5) - self.defineHistogram('track_phi', path='EXPERT', type='TH1F', title="Track Phi", xbins = default_bin_count, xmin=-4, xmax=4) - self.defineHistogram('track_eta,track_phi', path='EXPERT', type='TH2F', title="Track Eta vs Phi", - xbins = default_bin_count, xmin=-5, xmax=5, ybins = default_bin_count, ymin=-4, ymax=4) - self.defineHistogram('track_d0', path='EXPERT', type='TH1F', title="Track D0", xbins = default_bin_count, xmin=0, xmax=10) - self.defineHistogram('track_d0err', path='EXPERT', type='TH1F', title="Track D0 Error", xbins = default_bin_count, xmin=0, xmax=10) - self.defineHistogram('track_d0sig', path='EXPERT', type='TH1F', title="Track D0 Significance", xbins = default_bin_count, xmin=0, xmax=1000) - self.defineHistogram('track_z0', path='EXPERT', type='TH1F', title="Track Z0", xbins = default_bin_count, xmin=0, xmax=100) - self.defineHistogram('track_z0err', path='EXPERT', type='TH1F', title="Track Z0 Error", xbins = default_bin_count, xmin=0, xmax=10) - self.defineHistogram('track_z0sig', path='EXPERT', type='TH1F', title="Track Z0 Significance", xbins = default_bin_count, xmin=0, xmax=10000) + self.defineHistogram('track_Et', title="Track Transverse Energy;E_{T} (GeV)", xbins = default_bin_count, xmin=0, xmax=200, **TH1F_opts) + self.defineHistogram('track_eta', title="Track #eta;#eta", xbins = default_bin_count, xmin=-5, xmax=5, **TH1F_opts) + self.defineHistogram('track_phi', title="Track #phi;#phi", xbins = default_bin_count, xmin=-3.5, xmax=3.5, **TH1F_opts) + self.defineHistogram('track_eta,track_phi', path='EXPERT', type='TH2F', title="Track #eta vs #phi;#eta;#phi", + xbins = default_bin_count, xmin=-5, xmax=5, ybins = default_bin_count, ymin=-4, ymax=4) + self.defineHistogram('track_d0', title="Track d_{0};d_{0} (mm)", xbins = default_bin_count, xmin=-5, xmax=5, **TH1F_opts) + self.defineHistogram('track_d0err', title="Track d_{0} Error;d_{0} Error (mm)", xbins = default_bin_count, xmin=0, xmax=10, **TH1F_opts) + self.defineHistogram('track_d0sig', title="Track d_{0} Significance;d_{0} #sigma", xbins = default_bin_count, xmin=-100, xmax=100, **TH1F_opts) + self.defineHistogram('track_z0', title="Track z_{0};z_{0} (mm)", xbins = default_bin_count, xmin=-100, xmax=100, **TH1F_opts) + self.defineHistogram('track_z0err', title="Track z_{0} Error;z_{0} Error (mm)", xbins = default_bin_count, xmin=0, xmax=10, **TH1F_opts) + self.defineHistogram('track_z0sig', title="Track z_{0} Significance;z_{0} #sigma", xbins = default_bin_count, xmin=-1000, xmax=1000, **TH1F_opts) # Jet Histograms - self.defineHistogram('jet_pt', path='EXPERT', type='TH1F', title="Jet PT", xbins = default_bin_count, xmin=0, xmax=800000) - self.defineHistogram('jet_eta', path='EXPERT', type='TH1F', title="Jet Eta", xbins = default_bin_count, xmin=-5, xmax=5) - self.defineHistogram('jet_phi', path='EXPERT', type='TH1F', title="Jet Phi", xbins = default_bin_count, xmin=-3.5, xmax=3.5) + self.defineHistogram('jet_pt', title="Jet Transverse Momentum;p_{T} (GeV)", xbins = default_bin_count, xmin=0, xmax=200, **TH1F_opts) + self.defineHistogram('jet_eta', title="Jet #eta;#eta", xbins = default_bin_count, xmin=-5, xmax=5, **TH1F_opts) + self.defineHistogram('jet_phi', title="Jet #phi;#phi", xbins = default_bin_count, xmin=-3.5, xmax=3.5, **TH1F_opts) + self.defineHistogram('jet_eta,jet_phi', path='EXPERT', type='TH2F', title="Jet #eta vs #phi;#eta;#phi", + xbins = default_bin_count, xmin=-5, xmax=5, ybins = default_bin_count, ymin=-4, ymax=4) diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoAlgMT.cxx index 442816043076f4c1bd311514a5d0dd6871398bc2..f0448c9b4126c9837d83fcaaae2e6516a3acac72 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoAlgMT.cxx +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBjetBtagHypoAlgMT.cxx @@ -3,6 +3,7 @@ */ #include "TrigBjetBtagHypoAlgMT.h" +#include "EventPrimitives/EventPrimitivesHelpers.h" TrigBjetBtagHypoAlgMT::TrigBjetBtagHypoAlgMT( const std::string& name, @@ -195,7 +196,7 @@ StatusCode TrigBjetBtagHypoAlgMT::execute( const EventContext& context ) const { StatusCode TrigBjetBtagHypoAlgMT::monitor_jets( const ElementLinkVector<xAOD::JetContainer >& jetELs ) const { auto monitor_for_jet_pt = Monitored::Collection( "jet_pt", jetELs, - [](const ElementLink< xAOD::JetContainer >& jetLink) { return (*jetLink)->pt(); } ); + [](const ElementLink< xAOD::JetContainer >& jetLink) { return (*jetLink)->pt() / 1000.0 /*Gev*/; } ); auto monitor_for_jet_eta = Monitored::Collection( "jet_eta", jetELs, [](const ElementLink< xAOD::JetContainer >& jetLink) { return (*jetLink)->eta(); } ); auto monitor_for_jet_phi = Monitored::Collection( "jet_phi", jetELs, @@ -211,7 +212,7 @@ StatusCode TrigBjetBtagHypoAlgMT::monitor_jets( const ElementLinkVector<xAOD::Je StatusCode TrigBjetBtagHypoAlgMT::monitor_tracks( const ElementLinkVector< xAOD::TrackParticleContainer >& trackELs ) const { auto monitor_for_track_Et = Monitored::Collection( "track_Et", trackELs, - [](const ElementLink< xAOD::TrackParticleContainer >& trackLink) { return (*trackLink)->p4().Et(); } ); + [](const ElementLink< xAOD::TrackParticleContainer >& trackLink) { return (*trackLink)->p4().Et() / 1000.0 /*Gev*/; } ); auto monitor_for_track_eta = Monitored::Collection( "track_eta", trackELs, [](const ElementLink< xAOD::TrackParticleContainer >& trackLink) { return (*trackLink)->eta(); } ); auto monitor_for_track_phi = Monitored::Collection( "track_phi", trackELs, @@ -223,12 +224,12 @@ StatusCode TrigBjetBtagHypoAlgMT::monitor_tracks( const ElementLinkVector< xAOD: auto monitor_for_track_d0err = Monitored::Collection( "track_d0err", trackELs, [](const ElementLink< xAOD::TrackParticleContainer >& trackLink) { - return (*trackLink)->definingParametersCovMatrix()( Trk::d0, Trk::d0 ); + return Amg::error( (*trackLink)->definingParametersCovMatrix(), 0); } ); auto monitor_for_track_d0sig = Monitored::Collection( "track_d0sig", trackELs, [](const ElementLink< xAOD::TrackParticleContainer >& trackLink) { - return (*trackLink)->d0() / (*trackLink)->definingParametersCovMatrix()( Trk::d0, Trk::d0 ); + return (*trackLink)->d0() / Amg::error( (*trackLink)->definingParametersCovMatrix(), 0); } ); auto monitor_for_track_z0 = Monitored::Collection( "track_z0", trackELs, @@ -236,12 +237,12 @@ StatusCode TrigBjetBtagHypoAlgMT::monitor_tracks( const ElementLinkVector< xAOD: auto monitor_for_track_z0err = Monitored::Collection( "track_z0err", trackELs, [](const ElementLink< xAOD::TrackParticleContainer >& trackLink) { - return (*trackLink)->definingParametersCovMatrix()( Trk::z0, Trk::z0 ); + return Amg::error( (*trackLink)->definingParametersCovMatrix(), 1); } ); auto monitor_for_track_z0sig = Monitored::Collection( "track_z0sig", trackELs, [](const ElementLink< xAOD::TrackParticleContainer >& trackLink) { - return (*trackLink)->z0() / (*trackLink)->definingParametersCovMatrix()( Trk::z0, Trk::z0 ); + return (*trackLink)->z0() / Amg::error( (*trackLink)->definingParametersCovMatrix(), 1); } ); auto monitor_group_for_tracks = Monitored::Group( m_monTool, diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFexMT.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFexMT.cxx deleted file mode 100755 index ca2fa96e72d4b89a867c1ff1d3445d10d55c9c64..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFexMT.cxx +++ /dev/null @@ -1,163 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -// ************************************************ -// -// NAME: TrigBtagFexMT.cxx -// PACKAGE: Trigger/TrigHypothesis/TrigBjetHypo -// -// ************************************************ - -#include "src/TrigBtagFexMT.h" - -// ONLINE INFRASTRUCTURE -#include "TrigSteeringEvent/TrigRoiDescriptor.h" - -// EDM - -#include "xAODBase/IParticle.h" - -#include "xAODJet/Jet.h" -#include "xAODJet/JetContainer.h" - -#include "xAODTracking/TrackParticleContainer.h" - -#include "xAODTracking/Vertex.h" -#include "xAODTracking/VertexContainer.h" -#include "xAODTracking/VertexAuxContainer.h" - -#include "xAODBTagging/BTagging.h" -#include "xAODBTagging/BTaggingContainer.h" -#include "xAODBTagging/BTaggingAuxContainer.h" - -#include "xAODBTagging/BTagVertex.h" -#include "xAODBTagging/BTagVertexContainer.h" -#include "xAODBTagging/BTagVertexAuxContainer.h" - -#include "BTagging/BTagTrackAssociation.h" -#include "BTagging/BTagSecVertexing.h" -#include "BTagging/BTagTool.h" - -// ----------------------------------------------------------------------------------------------------------------- - - -TrigBtagFexMT::TrigBtagFexMT(const std::string& name, ISvcLocator* pSvcLocator) : - AthAlgorithm(name, pSvcLocator) { -} - - -// ----------------------------------------------------------------------------------------------------------------- - -TrigBtagFexMT::~TrigBtagFexMT() {} - -// ----------------------------------------------------------------------------------------------------------------- - -StatusCode TrigBtagFexMT::initialize() { - - // Get message service - ATH_MSG_INFO( "Initializing TrigBtagFexMT, version " << PACKAGE_VERSION ); - - // declareProperty overview - ATH_MSG_DEBUG( "declareProperty review:" ); - /* - ATH_MSG_DEBUG( " " << m_useBeamSpotFlag ); - ATH_MSG_DEBUG( " " << m_TaggerBaseNames ); - ATH_MSG_DEBUG( " " << m_JetContainerKey ); - ATH_MSG_DEBUG( " " << m_VertexContainerKey ); - ATH_MSG_DEBUG( " " << m_BackUpVertexContainerKey ); - ATH_MSG_DEBUG( " " << m_TrackParticleContainerKey ); - ATH_MSG_DEBUG( " " << m_outputBTaggingContainerKey ); - ATH_MSG_DEBUG( " " << m_outputVertexContainerKey ); - ATH_MSG_DEBUG( " " << m_outputBtagVertexContainerKey ); - */ - - ATH_MSG_DEBUG( "Initialising ReadHandleKeys" ); - ATH_CHECK( m_JetContainerKey.initialize() ); - ATH_CHECK( m_VertexContainerKey.initialize() ); - ATH_CHECK( m_trkContainerKey.initialize() ); - - ATH_CHECK( m_outputBTaggingContainerKey.initialize() ); - - return StatusCode::SUCCESS; -} - - -// ----------------------------------------------------------------------------------------------------------------- - -StatusCode TrigBtagFexMT::execute() { - ATH_MSG_DEBUG( "Executing " << name() << "... " ); - - const EventContext& ctx = getContext(); - - // Test retrieval of JetContainer - ATH_MSG_DEBUG( "Attempting to retrieve JetContainer with key " << m_JetContainerKey.key() ); - SG::ReadHandle< xAOD::JetContainer > jetContainerHandle = SG::makeHandle< xAOD::JetContainer >( m_JetContainerKey,ctx ); - CHECK( jetContainerHandle.isValid() ); - const xAOD::JetContainer *jetContainer = jetContainerHandle.get(); - ATH_MSG_DEBUG( "Retrieved " << jetContainer->size() << " jets" ); - - for ( const xAOD::Jet* jet : *jetContainer ) { - ATH_MSG_DEBUG( " BTAGFEX: ** pt=" << jet->pt() << " eta=" << jet->eta() << " phi=" << jet->phi() ); - } - - - // Test retrieval of Track Particles - ATH_MSG_DEBUG( "Attempting to retrieve TrackParticleContainer with key " << m_trkContainerKey.key() ); - SG::ReadHandle< xAOD::TrackParticleContainer > trkContainerHandle = SG::makeHandle< xAOD::TrackParticleContainer >( m_trkContainerKey,ctx ); - CHECK( trkContainerHandle.isValid() ); - const xAOD::TrackParticleContainer *trkContainer = trkContainerHandle.get(); - ATH_MSG_DEBUG("Retrieved " << trkContainerHandle->size() << " Tracks"); - - for ( const xAOD::TrackParticle *trk : *trkContainer ) { - ATH_MSG_DEBUG( " *** pt=" << trk->p4().Et() * 1e-3 << " eta=" << trk->eta() << " phi=" << trk->phi() ); - } - - // Test retrieval of VertexContainer - ATH_MSG_DEBUG( "Attempting to retrieve VertexContainer with key " << m_VertexContainerKey.key() ); - SG::ReadHandle< xAOD::VertexContainer > vxContainerHandle = SG::makeHandle< xAOD::VertexContainer >( m_VertexContainerKey, ctx ); - CHECK( vxContainerHandle.isValid() ); - const xAOD::VertexContainer* vxContainer = vxContainerHandle.get(); - ATH_MSG_DEBUG( "Retrieved " << vxContainer->size() <<" vertices..." ); - - for ( const xAOD::Vertex *pv : *vxContainer ) { - ATH_MSG_DEBUG( " ** PV x=" << pv->x()<< " y=" << pv->y() << " z=" << pv->z() ); - } - - // Creating dummy B-Tagging container in order to avoid - // warnings from the SGInputLoader - std::unique_ptr< xAOD::BTaggingContainer > outputBtagging = std::make_unique< xAOD::BTaggingContainer >(); - std::unique_ptr< xAOD::BTaggingAuxContainer > outputBtaggingAux = std::make_unique< xAOD::BTaggingAuxContainer >(); - outputBtagging->setStore( outputBtaggingAux.get() ); - - xAOD::BTagging *toAdd = new xAOD::BTagging(); - outputBtagging->push_back( toAdd ); - - SG::WriteHandle< xAOD::BTaggingContainer > btaggingHandle = SG::makeHandle( m_outputBTaggingContainerKey,ctx ); - CHECK( btaggingHandle.record( std::move( outputBtagging ),std::move( outputBtaggingAux ) ) ); - ATH_MSG_DEBUG( "Exiting with " << btaggingHandle->size() << " btagging objects" ); - - return StatusCode::SUCCESS; -} - - -// ----------------------------------------------------------------------------------------------------------------- - - -StatusCode TrigBtagFexMT::finalize() { - ATH_MSG_INFO( "Finalizing TrigBtagFex" ); - return StatusCode::SUCCESS; -} - -const xAOD::Vertex* TrigBtagFexMT::getPrimaryVertex(const xAOD::VertexContainer* vertexContainer) { - // vertex types are listed on L328 of - // https://svnweb.cern.ch/trac/atlasoff/browser/Event/xAOD/xAODTracking/trunk/xAODTracking/TrackingPrimitives.h - - for( auto vtx_itr : *vertexContainer ) { - if(vtx_itr->vertexType() != xAOD::VxType::VertexType::PriVtx) { continue; } - return vtx_itr; - } - ATH_MSG_WARNING( "No primary vertex found." ); - return nullptr; -} - diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFexMT.h b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFexMT.h deleted file mode 100755 index 9e97b71f6c696ba8c5f4119de7b07d9567f90eb4..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFexMT.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -// ************************************************ -// -// NAME: TrigBtagFexMT.h -// PACKAGE: Trigger/TrigHypothesis/TrigBjetHypo -// -// AUTHOR: Carlo Varni -// EMAIL: carlo.varni@ge.infn.it -// -// ************************************************ - -#ifndef TRIGBTAGFEX_MT_H -#define TRIGBTAGFEX_MT_H - -#include <vector> -#include <string> - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" - -#include "TrigInterfaces/FexAlgo.h" - -#include "TrigBjetHypo/TrigBjetTagger.h" -#include "TrigBjetHypo/TuningLikelihood.h" -#include "TrigBjetHypo/TrigBjetDataHelper.h" - -#include "TrigInDetToolInterfaces/ITrigTrackJetFinderTool.h" -#include "VxSecVertex/VxSecVertexInfo.h" - - - -namespace Analysis { - class IBTagTool; - class IBTagTrackAssociation; - class IBTagSecVertexing; -} - -/** - * @brief FEX class for the b-jet weight construction using offline tools - * - * @author Jeff Hetherly <jhetherly @ mail.smu.edu> - * - * This is the base feature extraction class for the HLT b-jet slice. - * It computes jet light/charm/beauty probabilities using offline b-tagging tools. - */ - - -class TrigBtagFexMT: public AthAlgorithm { - public: - /** @brief For monitoring purposes the TrigBjetTagger class has been declared as friend */ - friend class TrigBjetTagger; - - /** @brief Constructor */ - TrigBtagFexMT(const std::string&, ISvcLocator*); - /** @brief Destructor */ - ~TrigBtagFexMT(); - - StatusCode initialize(); - StatusCode finalize(); - StatusCode execute(); - - private: - const xAOD::Vertex* getPrimaryVertex(const xAOD::VertexContainer* vertexContainer); - - private: -// // TOOLS -// /** @brief Offline BTag tool */ -// PublicToolHandle< Analysis::IBTagTool > m_bTagTool {this,"BTagTool","Analysis/IBTagTool","Offline BTag tool"}; -// /** @brief Offline TrackAssociation tool */ -// PublicToolHandle< Analysis::IBTagTrackAssociation > m_bTagTrackAssocTool {this,"BTagTrackAssocTool","Analysis/BTagTrackAssociation","Offline TrackAssociation tool"}; -// /** @brief Offline SecondaryVertexing tool */ -// PublicToolHandle< Analysis::IBTagSecVertexing > m_bTagSecVtxTool {this,"BTagSecVertexing","Analysis/BTagSecVertexing","Offline SecondaryVertexing tool"}; - - // DATA - /** @brief List of xAOD tagger basenames */ - Gaudi::Property< std::vector< std::string > > m_TaggerBaseNames {this,"TaggerBaseNames",std::vector< std::string >(),"List of xAOD tagger basenames"}; - - // PROPERTIES - /** @brief Switch for offline tools */ - Gaudi::Property< bool > m_setupOfflineTools {this,"setupOfflineTools",false,"Switch for offline tools"}; - /** @brief to check the beam spot flag status and start track selection accordingly. */ - Gaudi::Property< bool > m_useBeamSpotFlag {this,"UseBeamSpotFlag",false,"check the beam spot flag status and start track selection accordingly"}; - /** @brief Use backup algorithm for retrieving Prim Vtx. */ - Gaudi::Property< bool > m_usePriVtxKeyBackup {this,"UsePriVtxKeyBackup",true,"Use backup algorithm for retrieving Prim Vtx"}; - - - // ////////////////////// - // //* for monitoring *// - // ////////////////////// - - private: - SG::ReadHandleKey< xAOD::JetContainer > m_JetContainerKey {this,"JetKey","SplitJet","Key for input jets"}; - SG::ReadHandleKey< xAOD::VertexContainer > m_VertexContainerKey {this,"PriVtxKey","xPrimVx","Key of primary vertexes"}; - // SG::ReadHandleKey< xAOD::VertexContainer > m_BackUpVertexContainerKey {this,"PriVtxKeyBackup","EFHistoPrmVtx","Back-Up Key of primary vertexes"}; - SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trkContainerKey {this,"TracksKey","tracks__COLL","Key for track particle container"}; - - SG::WriteHandleKey< xAOD::BTaggingContainer > m_outputBTaggingContainerKey {this,"OutputBTagging","Undefined","Output Btagging Container Key"}; - // SG::WriteHandleKey< xAOD::VertexContainer > m_outputVertexContainerKey {this,"OutputVtxKey","HLT_BjetVertexFex","Output Vertex Container Key"}; - // SG::WriteHandleKey< xAOD::BTagVertexContainer > m_outputBtagVertexContainerKey {this,"OutputBtagVtxKey","HLT_BjetSecondaryVertexFex","Output Btag Vertex Container Key"}; -}; - -#endif - diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/components/TrigBjetHypo_entries.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/components/TrigBjetHypo_entries.cxx index c8322b1074ef98de5ab9656c4c06e6a7bd3568e7..81ec7720944c5dd75d6fe34ccb5a92c2b9cc925b 100644 --- a/Trigger/TrigHypothesis/TrigBjetHypo/src/components/TrigBjetHypo_entries.cxx +++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/components/TrigBjetHypo_entries.cxx @@ -16,7 +16,6 @@ #include "../TrigBjetEtHypoTool.h" #include "../TrigBjetBtagHypoTool.h" -#include "../TrigBtagFexMT.h" #include "../TrigSuperRoIBuilderMT.h" DECLARE_COMPONENT( TrigBjetHypoAllTE ) @@ -38,5 +37,4 @@ DECLARE_COMPONENT( TrigBjetBtagHypoAlgMT ) DECLARE_COMPONENT( TrigBjetEtHypoTool ) DECLARE_COMPONENT( TrigBjetBtagHypoTool ) -DECLARE_COMPONENT( TrigBtagFexMT ) DECLARE_COMPONENT( TrigSuperRoIBuilderMT ) diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/CMakeLists.txt b/Trigger/TrigHypothesis/TrigBphysHypo/CMakeLists.txt index 9716986b9ab24a5a0fe69a5400b82c6567564569..aefaf75e0895d8345e208ce8f2b3f18f8e330dbe 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/CMakeLists.txt +++ b/Trigger/TrigHypothesis/TrigBphysHypo/CMakeLists.txt @@ -13,8 +13,6 @@ atlas_depends_on_subdirs( PRIVATE Control/AthViews Control/CxxUtils Control/StoreGate - DetectorDescription/GeoPrimitives - Event/EventInfo Event/FourMomUtils Event/xAOD/xAODEventInfo Event/xAOD/xAODBase @@ -25,19 +23,11 @@ atlas_depends_on_subdirs( PRIVATE Event/xAOD/xAODTrigger GaudiKernel LumiBlock/LumiBlockComps - PhysicsAnalysis/AnalysisCommon/PATCore - Generators/GeneratorObjects InnerDetector/InDetConditions/BeamSpotConditionsData - InnerDetector/InDetConditions/InDetBeamSpotService InnerDetector/InDetRecTools/InDetConversionFinderTools PhysicsAnalysis/ElectronPhotonID/ElectronPhotonSelectorTools - Reconstruction/Particle - Tracking/TrkEvent/TrkParameters - Tracking/TrkEvent/TrkTrack - Tracking/TrkEvent/VxVertex Tracking/TrkVertexFitter/TrkVKalVrtFitter Trigger/TrigEvent/TrigBphysicsEvent - Trigger/TrigEvent/TrigCaloEvent Trigger/TrigEvent/TrigInDetEvent Trigger/TrigEvent/TrigMuonEvent Trigger/TrigEvent/TrigNavigation @@ -46,21 +36,19 @@ atlas_depends_on_subdirs( PRIVATE Trigger/TrigSteer/TrigInterfaces Trigger/TrigT1/TrigT1Interfaces Trigger/TrigTools/TrigInDetToolInterfaces - Trigger/TrigTools/TrigTimeAlgs Trigger/TrigSteer/DecisionHandling Trigger/TrigSteer/TrigCompositeUtils) # External dependencies: -find_package( CLHEP ) -find_package( Eigen ) -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) # Component(s) in the package: atlas_add_component( TrigBphysHypo 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 AthLinks BeamSpotConditionsData InDetConversionFinderToolsLib DecisionHandlingLib FourMomUtils StoreGateLib SGtests GeoPrimitives EventInfo xAODEventInfo xAODMuon xAODTracking xAODTrigBphys xAODTrigMuon GaudiKernel GeneratorObjects Particle ElectronPhotonSelectorToolsLib TrkParameters TrkTrack VxVertex TrkVKalVrtFitterLib TrigBphysicsEvent TrigCaloEvent TrigInDetEvent TrigMuonEvent TrigNavigationLib TrigParticle TrigSteeringEvent TrigInterfacesLib TrigT1Interfaces TrigTimeAlgsLib AthViews TrigCompositeUtilsLib ) + INCLUDE_DIRS + LINK_LIBRARIES AthenaBaseComps AthenaKernel AthLinks BeamSpotConditionsData ElectronPhotonSelectorToolsLib InDetConversionFinderToolsLib DecisionHandlingLib FourMomUtils StoreGateLib xAODEventInfo xAODMuon xAODTracking xAODTrigBphys xAODTrigMuon GaudiKernel TrkVKalVrtFitterLib TrigBphysicsEvent TrigInDetEvent TrigMuonEvent TrigNavigationLib TrigSteeringEvent TrigInterfacesLib TrigTimeAlgsLib AthViews TrigCompositeUtilsLib TrigT1Interfaces TrigParticle) + +#TrigParticle is needed for linking getRecentFeaturesLinks for some reason # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/BtrigUtils.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/BtrigUtils.cxx index 5fd07ce25298088aed37fb9de434e6d025508e01..71246290460602babd506785a1698dfd4f916f52 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/BtrigUtils.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/BtrigUtils.cxx @@ -12,7 +12,6 @@ #include "TrigInDetEvent/TrigInDetTrackFitPar.h" #include "TrigSteeringEvent/Enums.h" -#include "TrkParameters/TrackParameters.h" #include "xAODMuon/Muon.h" #include "xAODTracking/TrackParticle.h" @@ -23,7 +22,7 @@ //---------------------------------------------- // pT calculation using Trk::Track. //---------------------------------------------- - +/* double PtVal(const std::vector<const Trk::Track*> & tracks) { std::vector<const Trk::Track*>::const_iterator trkItr = tracks.begin(); @@ -42,7 +41,7 @@ double PtVal(const std::vector<const Trk::Track*> & tracks) { if ( pt2 < 0 ) return 0; else return sqrt(pt2); } - +*/ //---------------------------------------------- // pT calculation using xAOD::TrackParticle. //---------------------------------------------- @@ -160,7 +159,7 @@ double InvMass(const std::vector<const TrigInDetTrackFitPar*> & tracks, const st //-------------------------------------------------------- // Invariant mass calculations using Trk::MeasuredPerigee. //-------------------------------------------------------- - +/* double InvMass(const std::vector<const Trk::TrackParameters*> & tracks, const std::vector<double> & massHypo) { std::vector<const Trk::TrackParameters*>::const_iterator trkItr = tracks.begin(); @@ -176,7 +175,7 @@ double InvMass(const std::vector<const Trk::TrackParameters*> & tracks, const st return InvMass(px, py, pz, massHypo); } - +*/ //-------------------------------------------------------- // Invariant mass calculations using Trk::Perigee. //-------------------------------------------------------- @@ -200,7 +199,7 @@ double InvMass(const std::vector<const Trk::Perigee*> & tracks, const std::vecto //---------------------------------------------- // Invariant mass calculations using Trk::Track. //---------------------------------------------- - +/* double InvMass(const std::vector<const Trk::Track*> & tracks, const std::vector<double> & massHypo) { std::vector<const Trk::Track*>::const_iterator trkItr = tracks.begin(); @@ -221,7 +220,7 @@ double InvMass(const std::vector<const Trk::Track*> & tracks, const std::vector< return InvMass(px, py, pz, massHypo); } - +*/ double fabsDeltaPhi(double phi1, double phi2) { double dPhi=fabs(phi1 - phi2); if (dPhi > M_PI) dPhi = 2.*M_PI - dPhi; diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/BtrigUtils.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/BtrigUtils.h index e22bec9526e6eb65b0acd34b86ec38f76e064216..b6f86ffc01764f14d9e3aa4a1a06c20afa56e8e8 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/BtrigUtils.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/BtrigUtils.h @@ -7,19 +7,16 @@ #include <vector> -#include "GaudiKernel/MsgStream.h" - #include "TrigInDetEvent/TrigInDetTrack.h" #include "TrigInDetEvent/TrigInDetTrackFitPar.h" //#include "TrigMuonEvent/TrigMuonEFInfoContainer.h" #include "TrigSteeringEvent/Enums.h" -#include "TrkTrack/Track.h" // xAOD edm #include "xAODMuon/MuonContainer.h" -double PtVal(const std::vector<const Trk::Track*>&); +//double PtVal(const std::vector<const Trk::Track*>&); double PtVal(const std::vector<const xAOD::TrackParticle*>&); double LxyVal(const double, const double, const Amg::Vector3D, const Amg::Vector3D); @@ -27,7 +24,7 @@ double LxyVal(const double, const double, const Amg::Vector3D, const Amg::Vector double InvMass(const std::vector<const TrigInDetTrack*> & , const std::vector<double>&); double InvMass(const std::vector<const TrigInDetTrackFitPar*>&, const std::vector<double>&); double InvMass(const std::vector<const Trk::TrackParameters*>&, const std::vector<double>&); -double InvMass(const std::vector<const Trk::Track*> &, const std::vector<double>&); +//double InvMass(const std::vector<const Trk::Track*> &, const std::vector<double>&); double InvMass(const std::vector<const Trk::Perigee*> &, const std::vector<double>&); // JW new methods to help simplify the algorithms diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigBphysElectronCounter.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigBphysElectronCounter.h index cc9c7868dc852162d32f629fa2dfdd5be9ad5b73..ab36be4fd711da2bd80931db6735d7913587dd2f 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigBphysElectronCounter.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigBphysElectronCounter.h @@ -20,8 +20,6 @@ // standard stuff #include <string> -#include <map> -#include <cmath> #include <algorithm> #include "TrigInterfaces/AllTEAlgo.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigBphysHelperUtilsTool.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigBphysHelperUtilsTool.cxx index 09dfcd8ba0efa84b25b4e810e754863d55eb2696..8fcabff24e5b5660bae38756b6e5a43b107cb938 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigBphysHelperUtilsTool.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigBphysHelperUtilsTool.cxx @@ -16,10 +16,6 @@ // FrameWork includes - -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" - #include "xAODTrigMuon/L2StandAloneMuon.h" @@ -239,20 +235,10 @@ StatusCode TrigBphysHelperUtilsTool::getRunEvtLb(uint32_t & run, uint32_t & evt, evt = ~0; lb = ~0; // JW - Try to get the xAOD event info - const EventInfo* pEventInfo(0); const xAOD::EventInfo *evtInfo(0); if ( evtStore()->retrieve(evtInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get xAOD::EventInfo " ); + ATH_MSG_WARNING("Failed to get xAOD::EventInfo " ); // now try the old event ifo - if ( evtStore()->retrieve(pEventInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get EventInfo " ); - return StatusCode::FAILURE; - } else { - run = pEventInfo->event_ID()->run_number(); - evt = pEventInfo->event_ID()->event_number(); - lb = pEventInfo->event_ID()->lumi_block(); - ATH_MSG_DEBUG(" Run " << run << " Event " << evt ); - }// found old event info }else { // found the xAOD event info run = evtInfo->runNumber(); evt = evtInfo->eventNumber(); diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigBphysHelperUtilsTool.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigBphysHelperUtilsTool.h index c680bd19bd994ab54a5a1204c5864e91b980cecb..3bb9958f82141793952187b4e96335f6b49d2dd4 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigBphysHelperUtilsTool.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigBphysHelperUtilsTool.h @@ -17,8 +17,6 @@ // FrameWork includes #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" #include "xAODEventInfo/EventInfo.h" #include "xAODMuon/Muon.h" #include "xAODTrigBphys/TrigBphys.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBEEXFex.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBEEXFex.cxx index 2d433ffa5a56fd40d8e03cde8f759138c22d1077..cd07c6b8f41a2ad1b7afe587a085a71114a47ee7 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBEEXFex.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBEEXFex.cxx @@ -23,8 +23,6 @@ #include "TrigEFBEEXFex.h" #include <math.h> -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" #include "TrigTimeAlgs/TrigTimerSvc.h" #include "AthenaKernel/Timeout.h" @@ -386,26 +384,16 @@ HLT::ErrorCode TrigEFBEEXFex::hltExecute(HLT::TEConstVec& inputTE, HLT::TriggerE ATH_MSG_VERBOSE("AcceptAll is set to : " << (m_acceptAll ? "True, taking all events " : "False, applying selection" )); // Retrieve event info - int IdRun = 0; +// int IdRun = 0; int IdEvent = 0; // JW - Try to get the xAOD event info - const EventInfo* pEventInfo(0); const xAOD::EventInfo *evtInfo(0); if ( store()->retrieve(evtInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get xAOD::EventInfo " ); - // now try the old event ifo - if ( store()->retrieve(pEventInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get EventInfo " ); - m_mon_Errors.push_back( ERROR_No_EventInfo ); - } else { - IdRun = pEventInfo->event_ID()->run_number(); - IdEvent = pEventInfo->event_ID()->event_number(); - ATH_MSG_DEBUG(" Run " << IdRun << " Event " << IdEvent << " using algo " << "m_lepAlgo"); - }// found old event info + ATH_MSG_WARNING("Failed to get xAOD::EventInfo " ); }else { // found the xAOD event info ATH_MSG_DEBUG(" Run " << evtInfo->runNumber() << " Event " << evtInfo->eventNumber() << " using algo m_lepAlgo" ); - IdRun = evtInfo->runNumber(); +// IdRun = evtInfo->runNumber(); IdEvent = evtInfo->eventNumber(); } // get event info diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBEEXFex.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBEEXFex.h index a0b9830449584db42026957f61d76bd2c6fac81e..9fde079ee80583e01c42a9a0efbf9f74155fb279 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBEEXFex.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBEEXFex.h @@ -22,26 +22,10 @@ // standard stuff #include <string> -#include <map> -#include <cmath> -// general athena stuff -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" -#include "GaudiKernel/StatusCode.h" -#include "StoreGate/StoreGateSvc.h" // trigger includes #include "TrigInterfaces/ComboAlgo.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" #include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" -#include "TrigParticle/TrigEFBphys.h" -#include "TrigParticle/TrigEFBphysContainer.h" - -//Ntuples -#include "GaudiKernel/INTupleSvc.h" -#include "GaudiKernel/NTuple.h" - -//#include "TrigTimeAlgs/TrigTimerSvc.h" -//#include "TrigTimeAlgs/TrigTimer.h" #include "Constants.h" #include "BtrigUtils.h" @@ -51,11 +35,7 @@ #include "xAODTracking/TrackParticle.h" #include "xAODEgamma/Electron.h" #include "xAODEgamma/ElectronContainer.h" -#include "xAODTrigBphys/TrigBphys.h" -#include "xAODTrigBphys/TrigBphysContainer.h" -#include "xAODTrigBphys/TrigBphysAuxContainer.h" -class StoreGateSvc; class TriggerElement; class Electron; diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuHypo.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuHypo.cxx index 2a117a5f29bc7d7adfe841e47f2b50ba17c3198b..54fe1e0ba407ca3341b356726ee2817e9efb216d 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuHypo.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuHypo.cxx @@ -23,8 +23,6 @@ #include "TrigEFBMuMuHypo.h" #include <math.h> -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" #include "xAODTrigger/TrigPassBits.h" #include "TrigNavigation/Navigation.h" @@ -128,19 +126,9 @@ HLT::ErrorCode TrigEFBMuMuHypo::hltExecute(const HLT::TriggerElement* outputTE, int IdEvent = 0; // JW - Try to get the xAOD event info - const EventInfo* pEventInfo(0); const xAOD::EventInfo *evtInfo(0); if ( store()->retrieve(evtInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get xAOD::EventInfo " ); - // now try the old event ifo - if ( store()->retrieve(pEventInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get EventInfo " ); - //m_mon_Errors.push_back( ERROR_No_EventInfo ); - } else { - IdRun = pEventInfo->event_ID()->run_number(); - IdEvent = pEventInfo->event_ID()->event_number(); - ATH_MSG_DEBUG(" Run " << IdRun << " Event " << IdEvent ); - }// found old event info + ATH_MSG_WARNING("Failed to get xAOD::EventInfo " ); }else { // found the xAOD event info ATH_MSG_DEBUG(" Run " << evtInfo->runNumber() << " Event " << evtInfo->eventNumber() ); IdRun = evtInfo->runNumber(); diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuHypo.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuHypo.h index 581623ab58d206d83257e090f3a254adb97d5089..ce88e25bb429f6e57d9166bbb2f7d3f05eb301a9 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuHypo.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuHypo.h @@ -22,13 +22,8 @@ // standard stuff #include <string> // general athena stuff -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" -#include "GaudiKernel/StatusCode.h" #include "TrigInterfaces/HypoAlgo.h" -#include "TrigParticle/TrigEFBphys.h" -#include "TrigParticle/TrigEFBphysContainer.h" #include "BeamSpotConditionsData/BeamSpotData.h" #include "Constants.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXFex.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXFex.cxx index c9042a6dd671a14e7e5205bd8b0c5df69ede9187..26b31d7a149ed650cc3c8311380422a72b45ca60 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXFex.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXFex.cxx @@ -33,8 +33,6 @@ #include <math.h> -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" #include "TrigTimeAlgs/TrigTimerSvc.h" @@ -763,26 +761,16 @@ HLT::ErrorCode TrigEFBMuMuXFex::hltExecute(HLT::TEConstVec& inputTE, HLT::Trigge ATH_MSG_VERBOSE("AcceptAll is set to : " << (m_acceptAll ? "True, taking all events " : "False, applying selection" )); // Retrieve event info - int IdRun = 0; +// int IdRun = 0; int IdEvent = 0; // JW - Try to get the xAOD event info - const EventInfo* pEventInfo(0); const xAOD::EventInfo *evtInfo(0); if ( store()->retrieve(evtInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get xAOD::EventInfo " ); - // now try the old event ifo - if ( store()->retrieve(pEventInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get EventInfo " ); - m_mon_Errors.push_back( ERROR_No_EventInfo ); - } else { - IdRun = pEventInfo->event_ID()->run_number(); - IdEvent = pEventInfo->event_ID()->event_number(); - ATH_MSG_DEBUG(" Run " << IdRun << " Event " << IdEvent << " using algo " << "m_muonAlgo"); - }// found old event info + ATH_MSG_WARNING("Failed to get xAOD::EventInfo " ); }else { // found the xAOD event info ATH_MSG_DEBUG(" Run " << evtInfo->runNumber() << " Event " << evtInfo->eventNumber() << " using algo m_muonAlgo" ); - IdRun = evtInfo->runNumber(); +// IdRun = evtInfo->runNumber(); IdEvent = evtInfo->eventNumber(); } // get event info diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXFex.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXFex.h index a2f9b1e2077b09f7e62fe1cd0500a6244e9a5781..37fefad3c983b49926b00583d68c7567a911b55f 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXFex.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXFex.h @@ -27,26 +27,10 @@ // standard stuff #include <string> -#include <map> -#include <cmath> -// general athena stuff -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" -#include "GaudiKernel/StatusCode.h" -#include "StoreGate/StoreGateSvc.h" // trigger includes #include "TrigInterfaces/ComboAlgo.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" #include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" -#include "TrigParticle/TrigEFBphys.h" -#include "TrigParticle/TrigEFBphysContainer.h" -//#include "TrigMuonEvent/TrigMuonEF.h" -//Ntuples -#include "GaudiKernel/INTupleSvc.h" -#include "GaudiKernel/NTuple.h" - -//#include "TrigTimeAlgs/TrigTimerSvc.h" -//#include "TrigTimeAlgs/TrigTimer.h" #include "Constants.h" #include "BtrigUtils.h" @@ -60,7 +44,6 @@ #include "xAODTrigBphys/TrigBphysContainer.h" #include "xAODTrigBphys/TrigBphysAuxContainer.h" -class StoreGateSvc; class TriggerElement; class CombinedMuonFeature; diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXHypo.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXHypo.cxx index 76b097ce3c93000e6c8dd44a577fc89f533c74dd..9bc75c8d0905cfe37ba4c414dd28459368e447a5 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXHypo.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXHypo.cxx @@ -25,11 +25,6 @@ //#include "TrigMuonEvent/CombinedMuonFeature.h" #include "TrigEFBMuMuXHypo.h" -#include "TrigParticle/TrigEFBphysContainer.h" - -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" -// #include "TrigSteeringEvent/TrigPassBits.h" #include "xAODTrigger/TrigPassBits.h" // additions of xAOD objects @@ -193,19 +188,10 @@ HLT::ErrorCode TrigEFBMuMuXHypo::hltExecute(const HLT::TriggerElement* outputTE, int IdEvent = 0; // JW - Try to get the xAOD event info - const EventInfo* pEventInfo(0); const xAOD::EventInfo *evtInfo(0); if ( store()->retrieve(evtInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get xAOD::EventInfo " ); + ATH_MSG_WARNING("Failed to get xAOD::EventInfo " ); // now try the old event ifo - if ( store()->retrieve(pEventInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get EventInfo " ); - //mon_Errors.push_back( ERROR_No_EventInfo ); - } else { - IdRun = pEventInfo->event_ID()->run_number(); - IdEvent = pEventInfo->event_ID()->event_number(); - ATH_MSG_DEBUG(" Run " << IdRun << " Event " << IdEvent ); - }// found old event info }else { // found the xAOD event info ATH_MSG_DEBUG(" Run " << evtInfo->runNumber() << " Event " << evtInfo->eventNumber() ); IdRun = evtInfo->runNumber(); diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXHypo.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXHypo.h index 17af30024abe50f5ff221519a7c11fb7f052551a..d083329d9419ba779b9b6620ef58425191711af5 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXHypo.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXHypo.h @@ -25,13 +25,8 @@ // standard stuff #include <string> // general athena stuff -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" -#include "GaudiKernel/StatusCode.h" #include "TrigInterfaces/HypoAlgo.h" #include "TrigInDetEvent/TrigVertexCollection.h" -//#include "TrigParticle/TrigEFBphys.h" -//#include "TrigParticle/TrigEFBphysContainer.h" #include "Constants.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFMultiMuHypo.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFMultiMuHypo.cxx index a883f2553e9392677b78064f44d32c3a021a76b4..32866c609f2f62b6d28f4ad8e92df290d3c8ab59 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFMultiMuHypo.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFMultiMuHypo.cxx @@ -20,9 +20,6 @@ #include "TrigEFMultiMuHypo.h" #include <math.h> -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" -//#include "TrigSteeringEvent/TrigPassBits.h" #include "xAODTrigger/TrigPassBits.h" @@ -117,26 +114,16 @@ HLT::ErrorCode TrigEFMultiMuHypo::hltExecute(const HLT::TriggerElement* outputTE m_mon_FitChi2 = -1; m_mon_MuMumass = -1; // Retrieve event info - int IdRun = 0; +// int IdRun = 0; int IdEvent = 0; // JW - Try to get the xAOD event info - const EventInfo* pEventInfo(0); const xAOD::EventInfo *evtInfo(0); if ( store()->retrieve(evtInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get xAOD::EventInfo " ); - // now try the old event ifo - if ( store()->retrieve(pEventInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get EventInfo " ); - //m_mon_Errors.push_back( ERROR_No_EventInfo ); - } else { - IdRun = pEventInfo->event_ID()->run_number(); - IdEvent = pEventInfo->event_ID()->event_number(); - ATH_MSG_DEBUG(" Run " << IdRun << " Event " << IdEvent ); - }// found old event info + ATH_MSG_WARNING("Failed to get xAOD::EventInfo " ); }else { // found the xAOD event info ATH_MSG_DEBUG(" Run " << evtInfo->runNumber() << " Event " << evtInfo->eventNumber() ); - IdRun = evtInfo->runNumber(); +// IdRun = evtInfo->runNumber(); IdEvent = evtInfo->eventNumber(); } // get event ifo diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFMultiMuHypo.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFMultiMuHypo.h index 0d28066f65472aef89908ee1e1686e7b3ac2f3e3..423b7cdc43640ac798cd531feb103b5baabdbff3 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFMultiMuHypo.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFMultiMuHypo.h @@ -22,14 +22,8 @@ // standard stuff #include <string> // general athena stuff -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IToolSvc.h" -#include "GaudiKernel/StatusCode.h" #include "TrigInterfaces/HypoAlgo.h" -#include "TrigParticle/TrigEFBphys.h" -#include "TrigParticle/TrigEFBphysContainer.h" - #include "Constants.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFTrkMassFex.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFTrkMassFex.h index 48c734df80b7314d436370c9763756fab61b5d10..4e74d78a8a0e1713ff29bad746a1d4cfd7c7847e 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFTrkMassFex.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFTrkMassFex.h @@ -16,8 +16,6 @@ #include "TrigInterfaces/FexAlgo.h" -#include "GaudiKernel/ToolHandle.h" - #include "xAODMuon/Muon.h" #include "xAODMuon/MuonContainer.h" #include "xAODTrigBphys/TrigBphys.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFTrkMassHypo.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFTrkMassHypo.cxx index 1e9223a5da654f33ed8753d45ad11ce3a9443a43..9e1cbed9a0bc64dea88c9fdd4ac816c5ec0bef08 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFTrkMassHypo.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFTrkMassHypo.cxx @@ -24,8 +24,6 @@ #include <math.h> -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" //#include "TrigSteeringEvent/TrigPassBits.h" #include "xAODTrigger/TrigPassBits.h" @@ -90,26 +88,16 @@ HLT::ErrorCode TrigEFTrkMassHypo::hltExecute(const HLT::TriggerElement* outputTE m_mon_cutCounter = -1; // Retrieve event info - int IdRun = 0; +// int IdRun = 0; int IdEvent = 0; // JW - Try to get the xAOD event info - const EventInfo* pEventInfo(0); const xAOD::EventInfo *evtInfo(0); if ( store()->retrieve(evtInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get xAOD::EventInfo " ); - // now try the old event ifo - if ( store()->retrieve(pEventInfo).isFailure() ) { - ATH_MSG_DEBUG("Failed to get EventInfo " ); - //m_mon_Errors.push_back( ERROR_No_EventInfo ); - } else { - IdRun = pEventInfo->event_ID()->run_number(); - IdEvent = pEventInfo->event_ID()->event_number(); - ATH_MSG_DEBUG(" Run " << IdRun << " Event " << IdEvent ); - }// found old event info + ATH_MSG_WARNING("Failed to get xAOD::EventInfo " ); }else { // found the xAOD event info ATH_MSG_DEBUG(" Run " << evtInfo->runNumber() << " Event " << evtInfo->eventNumber() ); - IdRun = evtInfo->runNumber(); +// IdRun = evtInfo->runNumber(); IdEvent = evtInfo->eventNumber(); } // get event ifo diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFTrkMassHypo.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFTrkMassHypo.h index f5044cd2e3e08129136cc89f68312a5b3bb1b18f..e659b78e51922e8ed8849639cd512303c275508d 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFTrkMassHypo.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFTrkMassHypo.h @@ -7,8 +7,6 @@ #define TRIGEFTRKMASSHYPO_H #include "TrigInterfaces/HypoAlgo.h" -#include "TrigT1Interfaces/RecMuonRoI.h" - #include "Constants.h" class TriggerElement; @@ -36,7 +34,6 @@ private: unsigned int m_countTotalRoI; unsigned int m_countPassedEvents; unsigned int m_countPassedRoIs; -// StoreGateSvc * m_pStoreGate; void handle(const Incident &); /* monitored variables */ diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuFex.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuFex.cxx index a8d9de3bc7de32470bc3acdbb89ff9f353c6c410..84c4d7aac4d65549b23e3b3946aa202cff217168 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuFex.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuFex.cxx @@ -12,10 +12,6 @@ #include <math.h> -#include "GaudiKernel/StatusCode.h" - -#include "EventInfo/EventInfo.h" - //#include "TrigMuonEvent/CombinedMuonFeature.h" #include "TrigL2BMuMuFex.h" @@ -28,8 +24,6 @@ #include "TrigInDetToolInterfaces/ITrigVertexingTool.h" #include "TrigInDetEvent/TrigL2Vertex.h" -#include "TrigParticle/TrigL2Bphys.h" - #include "Constants.h" #include "BtrigUtils.h" @@ -1209,4 +1203,4 @@ ElementLink<xAOD::IParticleContainer> TrigL2BMuMuFex::remap_container(const Elem // if here, then no match was found; // best to return the original object return iptlELold; // this is the old link to the IParticle -} // remap_container \ No newline at end of file +} // remap_container diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuFex.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuFex.h index 65c8bd41cca34301d92565739ebd99f32825272e..82b5ec43b369dae8f550d1b2e2202609ed1beef9 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuFex.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuFex.h @@ -15,8 +15,6 @@ #include <string> -#include "GaudiKernel/ToolHandle.h" - #include "TrigInterfaces/ComboAlgo.h" #include "TrigInDetEvent/TrigVertexCollection.h" @@ -24,9 +22,6 @@ #include "TrigInDetToolInterfaces/ITrigL2VertexFitter.h" //#include "TrigParticle/TrigL2BphysContainer.h" -#include "xAODTrigBphys/TrigBphysContainer.h" -#include "xAODTrigBphys/TrigBphysAuxContainer.h" -#include "xAODTrigBphys/TrigBphys.h" #include "xAODTrigMuon/L2CombinedMuon.h" #include "xAODTrigMuon/L2CombinedMuonContainer.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuHypo.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuHypo.h index 6712e64ec96f779369663b35ac27f937c789a7cf..4c5ba40fd230424c4f69cd9a2e8261511077fbc7 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuHypo.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuHypo.h @@ -22,9 +22,6 @@ // standard stuff #include <string> // general athena stuff -//#include "GaudiKernel/MsgStream.h" -//#include "GaudiKernel/IToolSvc.h" -//#include "GaudiKernel/StatusCode.h" #include "TrigInterfaces/HypoAlgo.h" //#include "TrigTimeAlgs/TrigTimerSvc.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuXFex.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuXFex.cxx index 717dfe6be2536af1066967348a8788283ee967c9..ad614f39898ab5397d7f854509d9e001726c2133 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuXFex.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuXFex.cxx @@ -29,25 +29,16 @@ #include "Constants.h" -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" - #include "TrigTimeAlgs/TrigTimerSvc.h" #include "AthenaKernel/Timeout.h" -//#include "TrigMuonEvent/TrigCombDiMuonContainer.h" -//#include "TrigMuonEvent/CombinedMuonFeature.h" - #include "TrigSteeringEvent/TrigRoiDescriptor.h" #include "TrigInDetEvent/TrigInDetTrackCollection.h" -#include "TrigInDetToolInterfaces/TrigParticleTable.h" -#include "TrigInDetToolInterfaces/ITrigL2VertexFitter.h" +#include "TrigInDetToolInterfaces/ITrigL2VertexFitter.h" #include "TrigInDetEvent/TrigL2Vertex.h" -#include "TrigParticle/TrigL2BphysContainer.h" - // additions of xAOD objects #include "xAODEventInfo/EventInfo.h" #include "TrigBphysHelperUtilsTool.h" @@ -412,10 +403,6 @@ TrigL2BMuMuXFex::TrigL2BMuMuXFex(const std::string & name, ISvcLocator* pSvcLoca m_trigBphysColl_bxAOD = NULL; m_VertexColl = NULL; // temporary - m_trigBphysColl_kStar = NULL; - m_trigBphysColl_phi = NULL; - m_trigBphysColl_lambda = NULL; - m_trigBphysColl_ds = NULL; m_trigBphysColl_kStarxAOD = NULL; m_trigBphysColl_phixAOD = NULL; m_trigBphysColl_lambdaxAOD = NULL; @@ -427,12 +414,7 @@ TrigL2BMuMuXFex::TrigL2BMuMuXFex(const std::string & name, ISvcLocator* pSvcLoca /*----------------------------------------*/ TrigL2BMuMuXFex::~TrigL2BMuMuXFex() { - if(m_trigBphysColl_b!=NULL) delete m_trigBphysColl_b; if(m_VertexColl!=NULL) delete m_VertexColl; - if(m_trigBphysColl_kStar) delete m_trigBphysColl_kStar; - if(m_trigBphysColl_phi) delete m_trigBphysColl_phi; - if(m_trigBphysColl_lambda) delete m_trigBphysColl_lambda; - if(m_trigBphysColl_ds) delete m_trigBphysColl_ds; // if(m_trigBphysColl_kSplus) delete m_trigBphysColl_kSplus; } diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuXFex.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuXFex.h index 4a7406e7ac8f64e80d39054cd1e12c933473776a..d21a9b46fc994707e7f3d17be2ab48d1de9b4e16 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuXFex.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuXFex.h @@ -22,7 +22,6 @@ #ifndef TrigL2BMuMuXFex_h #define TrigL2BMuMuXFex_h -#include "GaudiKernel/StatusCode.h" #include "TrigInterfaces/ComboAlgo.h" #include "BtrigUtils.h" @@ -36,8 +35,6 @@ #include "TrigInDetToolInterfaces/ITrigL2VertexFitter.h" #include "TrigInDetEvent/TrigVertexCollection.h" -#include "TrigParticle/TrigL2BphysContainer.h" -#include "TrigParticle/TrigL2Bphys.h" #include "xAODTrigBphys/TrigBphysContainer.h" #include "xAODTrigBphys/TrigBphysAuxContainer.h" @@ -238,10 +235,10 @@ class TrigL2BMuMuXFex: public HLT::ComboAlgo TrigVertexCollection* m_VertexColl; // temporary - TrigL2BphysContainer* m_trigBphysColl_kStar; - TrigL2BphysContainer* m_trigBphysColl_phi; - TrigL2BphysContainer* m_trigBphysColl_lambda; - TrigL2BphysContainer* m_trigBphysColl_ds; +// TrigL2BphysContainer* m_trigBphysColl_kStar; +// TrigL2BphysContainer* m_trigBphysColl_phi; +// TrigL2BphysContainer* m_trigBphysColl_lambda; +// TrigL2BphysContainer* m_trigBphysColl_ds; xAOD::TrigBphysContainer* m_trigBphysColl_kStarxAOD; xAOD::TrigBphysContainer* m_trigBphysColl_phixAOD; diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuXHypo.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuXHypo.h index 54aab41ccf08f1ed6a062b306bb69e828f82e106..ae11481d5ff83025d95eaebfe445424874b8db31 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuXHypo.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2BMuMuXHypo.h @@ -19,7 +19,6 @@ #ifndef TrigL2BMuMuXHypo_h #define TrigL2BMuMuXHypo_h -#include "GaudiKernel/StatusCode.h" #include "TrigInterfaces/HypoAlgo.h" #include "Constants.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2DiMuXFex.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2DiMuXFex.h deleted file mode 100644 index 247e784e10dc513452ea98eb232acb5802e68096..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2DiMuXFex.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - - /************************************************************************** - ** - ** File: Trigger/TrigHypothesis/TrigBphysHypo/TrigL2DiMuXFex.h - ** - ** Description: L2 hypothesis algorithms for B+ -> K+ mu+ mu- - ** Create TrigL2Bphys - ** - ** Author: C. Adorisio (Cristina.Adorisio@cern.ch) - ** - ** Created: 08.10.2007 - ** Modified: 25.02.2008(new TrigDiMuon class) - ** 07.03.2008(monitoring histograms added) - ** - **************************************************************************/ - -#ifndef TRIG_TrigL2DiMuXFex_H -#define TRIG_TrigL2DiMuXFex_H - -#include "GaudiKernel/StatusCode.h" -#include "GaudiKernel/ToolHandle.h" -#include "TrigInterfaces/FexAlgo.h" - -#include "TrigInDetEvent/TrigInDetTrackFitPar.h" -#include "TrigInDetEvent/TrigInDetTrackCollection.h" - -#include "TrigParticle/TrigL2Bphys.h" -#include "TrigParticle/TrigL2BphysContainer.h" -#include "TrigInDetEvent/TrigVertexCollection.h" - -#include "TrigInDetToolInterfaces/ITrigL2VertexFitter.h" -#include "TrigInDetToolInterfaces/ITrigVertexingTool.h" -#include "TrigInDetToolInterfaces/ITrigVertexFitter.h" - -#include "Constants.h" -#include "xAODTrigBphys/TrigBphysContainer.h" - -class TrigBphysHelperUtilsTool; - -class TrigL2DiMuXFex: public HLT::FexAlgo -{ - public: - TrigL2DiMuXFex(const std::string & name, ISvcLocator* pSvcLocator); - ~TrigL2DiMuXFex(); - HLT::ErrorCode hltInitialize(); - HLT::ErrorCode hltFinalize(); - HLT::ErrorCode hltExecute(const HLT::TriggerElement* inputTE, HLT::TriggerElement* outputTE); - - private: - ToolHandle <TrigBphysHelperUtilsTool> m_bphysHelperTool; - - // to set Accept-All mode: should be done with force-accept when possible - BooleanProperty m_acceptAll; - BooleanProperty m_doVertexFit; - - // Mass window cuts - float m_lowerMuMuMassCut; - float m_upperMuMuMassCut; - float m_lowerKplusMuMuMassCut; - float m_upperKplusMuMuMassCut; - - //Counters - int m_lastEvent; - int m_lastEvent_DiMu; - unsigned int m_lastEventPassed; - unsigned int m_lastEventPassedMuMu; - unsigned int m_lastEventPassedKMuMu; - - unsigned int m_countTotalEvents; - unsigned int m_countTotalRoI; - unsigned int m_countTotalEvents_DiMu; - unsigned int m_countTotalRoI_DiMu; - - unsigned int m_countPassedEvents; - unsigned int m_countPassedRoIs; - unsigned int m_countPassedEventsMuMu; - unsigned int m_countPassedEventsKMuMu; - - unsigned int m_countPassedMuMuMassCut; - unsigned int m_countPassedKMuMuMassCut; - unsigned int m_countPassedKMuMuVertexCut; - - xAOD::TrigBphysContainer* m_trigBphysColl; - //TrigVertexCollection* m_VertexColl; - - ToolHandle<ITrigL2VertexFitter> m_L2vertFitter; - ToolHandle<ITrigVertexingTool> m_vertexingTool; - - TrigTimer* m_TotTimer; - TrigTimer* m_VtxFitTimer; - - /* monitored variables*/ - std::vector<float> mon_dimumass; - std::vector<float> mon_kdimumass; -}; - -#endif diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2MultiMuFex.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2MultiMuFex.cxx index d75bf038479ab75a697e3b6181e5c797fe4ee2fd..12f80ddaa6a9b3fb1cf4d7d3ad38168b4063bfc0 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2MultiMuFex.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2MultiMuFex.cxx @@ -12,13 +12,6 @@ #include <math.h> -#include "GaudiKernel/StatusCode.h" - -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" - -//#include "TrigMuonEvent/CombinedMuonFeature.h" - #include "TrigL2MultiMuFex.h" #include "TrigInDetEvent/TrigInDetTrackCollection.h" @@ -30,8 +23,6 @@ #include "TrigInDetToolInterfaces/ITrigVertexingTool.h" #include "TrigInDetEvent/TrigL2Vertex.h" -#include "TrigParticle/TrigL2Bphys.h" - #include "Constants.h" #include "BtrigUtils.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2MultiMuFex.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2MultiMuFex.h index c0b325edd8605bbe2264a99b6340caffab59f06d..52128dc642a23e8a686cdaebe73c8f529db437bb 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2MultiMuFex.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2MultiMuFex.h @@ -15,8 +15,6 @@ #include <string> -#include "GaudiKernel/ToolHandle.h" - #include "TrigInterfaces/ComboAlgo.h" #include "TrigInDetEvent/TrigVertexCollection.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2MultiMuHypo.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2MultiMuHypo.h index 2edca750af1e3a5bb380002003ee906c97869aae..91fcf53621f22bb39ee20d15020d4c6e2c3abde5 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2MultiMuHypo.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2MultiMuHypo.h @@ -21,10 +21,6 @@ // standard stuff #include <string> -// general athena stuff -//#include "GaudiKernel/MsgStream.h" -//#include "GaudiKernel/IToolSvc.h" -//#include "GaudiKernel/StatusCode.h" #include "TrigInterfaces/HypoAlgo.h" ////#include "TrigTimeAlgs/TrigTimerSvc.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2TrkMassFex.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2TrkMassFex.cxx index b46647b157aadfb3c3b3ae992e4a1a5086bec7ac..d88335918518db2285b863e767ec09565d8df3b3 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2TrkMassFex.cxx +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2TrkMassFex.cxx @@ -12,8 +12,6 @@ #include <math.h> -#include "GaudiKernel/StatusCode.h" - #include "TrigL2TrkMassFex.h" @@ -24,8 +22,6 @@ #include "TrigInDetToolInterfaces/ITrigVertexingTool.h" #include "TrigInDetEvent/TrigL2Vertex.h" -#include "TrigParticle/TrigL2Bphys.h" - #include "Constants.h" #include "BtrigUtils.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2TrkMassFex.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2TrkMassFex.h index 46c322a685d02167acdeb09d250ea00e275e4b73..5af2c10de9660865c5c9746fd3a00a976a5c1ef3 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2TrkMassFex.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2TrkMassFex.h @@ -15,8 +15,6 @@ #include <string> -#include "GaudiKernel/ToolHandle.h" - #include "TrigInterfaces/FexAlgo.h" #include "TrigInDetEvent/TrigVertexCollection.h" diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2TrkMassHypo.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2TrkMassHypo.h index 81a8771b58fad6155b947e7726cf4429965a67ad..bde77bb7ed012cdb836830fd4a3e04450e6e8fbc 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2TrkMassHypo.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigL2TrkMassHypo.h @@ -7,8 +7,6 @@ #define TRIGL2TRKMASSHYPO_H #include "TrigInterfaces/HypoAlgo.h" -#include "TrigT1Interfaces/RecMuonRoI.h" - #include "Constants.h" class TriggerElement; diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypo.h b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypo.h index 69a65e5abce830f17d54abd0cdf0917aa90ff2d9..80315771043cb201a18e25fd4323fee52ec4fc16 100644 --- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypo.h +++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigMultiTrkComboHypo.h @@ -17,9 +17,7 @@ #include <string> #include <vector> -#include <utility> -#include "GaudiKernel/Property.h" #include "xAODTracking/TrackParticleContainer.h" #include "xAODMuon/MuonContainer.h" #include "xAODTrigger/TrigComposite.h" diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/CMakeLists.txt b/Trigger/TrigHypothesis/TrigEgammaHypo/CMakeLists.txt index 32ff89c5af045076ceaae0ccd3cfba7535556814..cb1664f37bbf5629ec8aa68917830635b94e6e96 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/CMakeLists.txt +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/CMakeLists.txt @@ -19,14 +19,14 @@ atlas_add_component( TrigEgammaHypo atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-extensions=ATL900,ATL901 ) # Unit tests: -atlas_add_test( TrigL2CaloHypoToolConfig - SCRIPT python -m TrigEgammaHypo.TrigL2CaloHypoTool +atlas_add_test( TrigEgammaFastCaloHypoToolConfig + SCRIPT python -m TrigEgammaHypo.TrigEgammaFastCaloHypoTool POST_EXEC_SCRIPT nopost.sh ) -atlas_add_test( TrigL2ElectronHypoToolConfig - SCRIPT python -m TrigEgammaHypo.TrigL2ElectronHypoTool +atlas_add_test( TrigEgammaFastElectronHypoToolConfig + SCRIPT python -m TrigEgammaHypo.TrigEgammaFastElectronHypoTool POST_EXEC_SCRIPT nopost.sh ) -atlas_add_test( TrigL2PhotonHypoToolConfig - SCRIPT python -m TrigEgammaHypo.TrigL2PhotonHypoTool +atlas_add_test( TrigEgammaFastPhotonHypoToolConfig + SCRIPT python -m TrigEgammaHypo.TrigEgammaFastPhotonHypoTool POST_EXEC_SCRIPT nopost.sh ) diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoTool.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastCaloHypoTool.py similarity index 92% rename from Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoTool.py rename to Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastCaloHypoTool.py index 5db4c76063479d63301224334a444fda400b2bd1..00ad67a5637381118c757d708b2f187fc5c19cf7 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2CaloHypoTool.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastCaloHypoTool.py @@ -13,7 +13,7 @@ _possibleSel = { 'tight':'Tight', 'medium':'Medium', 'loose':'Loose', 'vloose': from AthenaCommon.Logging import logging -log = logging.getLogger('TrigL2CaloHypoTool') +log = logging.getLogger('TrigEgammaFastCaloHypoTool') def _GetPath( cand, sel, basepath = 'RingerSelectorTools/TrigL2_20180903_v9' ): @@ -39,7 +39,7 @@ def _IncTool(name, cand, threshold, sel): possibleSel = L2CaloCutMaps( threshold ).MapsHADETthr.keys() from AthenaConfiguration.ComponentFactory import CompFactory - tool = CompFactory.TrigL2CaloHypoToolInc( name ) + tool = CompFactory.TrigEgammaFastCaloHypoToolInc( name ) tool.AcceptAll = False tool.UseRinger = False @@ -164,11 +164,11 @@ def _IncTool(name, cand, threshold, sel): def _MultTool(name): from AthenaConfiguration.ComponentFactory import CompFactory - return CompFactory.TrigL2CaloHypoToolMult( name ) + return CompFactory.TrigEgammaFastCaloHypoToolMult( name ) -def TrigL2CaloHypoToolFromDict( d ): +def TrigEgammaFastCaloHypoToolFromDict( d ): """ Use menu decoded chain dictionary to configure the tool """ cparts = [i for i in d['chainParts'] if ((i['signature']=='Electron') or (i['signature']=='Photon'))] @@ -202,38 +202,38 @@ def TrigL2CaloHypoToolFromDict( d ): return _IncTool( name, __cand( cparts[0]), __th( cparts[0]), __sel( cparts[0])) -def TrigL2CaloHypoToolFromName( name, conf ): +def TrigEgammaFastCaloHypoToolFromName( name, conf ): """ To be phased out """ """ set the name of the HypoTool (name=chain) and figure out the threshold and selection from conf """ from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import dictFromChainName decodedDict = dictFromChainName(conf) - return TrigL2CaloHypoToolFromDict( decodedDict ) + return TrigEgammaFastCaloHypoToolFromDict( decodedDict ) if __name__ == "__main__": TriggerFlags.enableMonitoring=['Validation'] - t = TrigL2CaloHypoToolFromName( "HLT_e10_etcut_L1EM3","HLT_e10_etcut_L1EM3" ) + t = TrigEgammaFastCaloHypoToolFromName( "HLT_e10_etcut_L1EM3","HLT_e10_etcut_L1EM3" ) assert t, "cant configure EtCut" - t = TrigL2CaloHypoToolFromName( "HLT_2e5_etcut_L12EM3", "HLT_2e5_etcut_L12EM3" ) + t = TrigEgammaFastCaloHypoToolFromName( "HLT_2e5_etcut_L12EM3", "HLT_2e5_etcut_L12EM3" ) assert t, "cant configure symmetric selection" assert len(t.SubTools) == 2, "Sub-tools not configured" - t = TrigL2CaloHypoToolFromName( "HLT_3e5_etcut_L13EM3", "HLT_3e5_etcut_L13EM3" ) + t = TrigEgammaFastCaloHypoToolFromName( "HLT_3e5_etcut_L13EM3", "HLT_3e5_etcut_L13EM3" ) assert t, "cant configure symmetric selection" assert len(t.SubTools) == 3, "Sub-tools not configured" # Asymmetric chais not working with this. Commenting out for now - # t = TrigL2CaloHypoToolFromName( "HLT_e3_etcut_e5_etcut_L12EM3", "HLT_e3_etcut_e5_etcut_L12EM3" ) + # t = TrigEgammaFastCaloHypoToolFromName( "HLT_e3_etcut_e5_etcut_L12EM3", "HLT_e3_etcut_e5_etcut_L12EM3" ) # assert t, "cant configure asymmetric selection" # assert len(t.SubTools) == 2, "Sub-tools not configured" - t = TrigL2CaloHypoToolFromName( "HLT_e3_etcut_e5_etcut_mu6_L1EM3_MU3", "HLT_e3_etcut_e5_etcut_L1EM3_MU3" ) + t = TrigEgammaFastCaloHypoToolFromName( "HLT_e3_etcut_e5_etcut_mu6_L1EM3_MU3", "HLT_e3_etcut_e5_etcut_L1EM3_MU3" ) assert t, "cant configure asymmetric selection for combined chains" assert len(t.SubTools) == 2, "Sub-tools not configured" - log.info("TrigL2CaloHypoToolFromName ALL OK" ) + log.info("TrigEgammaFastCaloHypoToolFromName ALL OK" ) diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronFexMTConfig.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastElectronFexMTConfig.py similarity index 54% rename from Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronFexMTConfig.py rename to Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastElectronFexMTConfig.py index 5bf6d921356a4019f821af5e70edc6051cb1d5c9..07891a3f43df48c0c9ec4f88055915e985131db8 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronFexMTConfig.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastElectronFexMTConfig.py @@ -1,6 +1,6 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2ElectronFexMT +from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaFastElectronFexMT from AthenaCommon.SystemOfUnits import GeV, mm from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool @@ -11,10 +11,10 @@ ParticleCaloExtensionTool= Trk__ParticleCaloExtensionTool(Extrapolator = AtlasEx # --------------------------------------------------------------- # class for common setups (like monitoring) -class L2ElectronFexBase(TrigL2ElectronFexMT): +class EgammaFastElectronFexBase(TrigEgammaFastElectronFexMT): __slots__ = [] def __init__(self, name): - super(L2ElectronFexBase,self).__init__(name) + super(EgammaFastElectronFexBase,self).__init__(name) # Tracking cuts self.TrackPt = 1.0 * GeV @@ -33,26 +33,26 @@ class L2ElectronFexBase(TrigL2ElectronFexMT): from TriggerJobOpts.TriggerFlags import TriggerFlags if 'Validation' in TriggerFlags.enableMonitoring() or 'Online' in TriggerFlags.enableMonitoring(): monTool = GenericMonitoringTool('MonTool') - monTool.defineHistogram('CaloTrackdEta', path='EXPERT', type='TH1F', title="L2Electron Hypo #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) - monTool.defineHistogram('CaloTrackdPhi', path='EXPERT', type='TH1F', title="L2Electron Hypo #Delta #phi between cluster and track;#Delta #phi;Nevents", xbins=80, xmin=-0.4, xmax=0.4) - monTool.defineHistogram('CaloTrackEoverP', path='EXPERT', type='TH1F', title="L2Electron Hypo E/p;E/p;Nevents", xbins=120, xmin=0, xmax=12) - monTool.defineHistogram('PtTrack', path='EXPERT', type='TH1F', title="L2Electron Hypo p_{T}^{track} [MeV];p_{T}^{track} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) - monTool.defineHistogram('PtCalo', path='EXPERT', type='TH1F', title="L2Electron Hypo p_{T}^{calo} [MeV];p_{T}^{calo} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) - monTool.defineHistogram('CaloEta',path='EXPERT', type='TH1F', title="L2Electron Hypo #eta^{calo} ; #eta^{calo};Nevents", xbins=200, xmin=-2.5, xmax=2.5) - monTool.defineHistogram('CaloPhi', path='EXPERT', type='TH1F', title="L2Electron Hypo #phi^{calo} ; #phi^{calo};Nevents", xbins=320, xmin=-3.2, xmax=3.2) - monTool.defineHistogram('CaloTrackdEtaNoExtrapMon', path='EXPERT',type='TH1F', title="L2Electron Fex #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) + monTool.defineHistogram('CaloTrackdEta', path='EXPERT', type='TH1F', title="FastElectron Hypo #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) + monTool.defineHistogram('CaloTrackdPhi', path='EXPERT', type='TH1F', title="FastElectron Hypo #Delta #phi between cluster and track;#Delta #phi;Nevents", xbins=80, xmin=-0.4, xmax=0.4) + monTool.defineHistogram('CaloTrackEoverP', path='EXPERT', type='TH1F', title="FastElectron Hypo E/p;E/p;Nevents", xbins=120, xmin=0, xmax=12) + monTool.defineHistogram('PtTrack', path='EXPERT', type='TH1F', title="FastElectron Hypo p_{T}^{track} [MeV];p_{T}^{track} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) + monTool.defineHistogram('PtCalo', path='EXPERT', type='TH1F', title="FastElectron Hypo p_{T}^{calo} [MeV];p_{T}^{calo} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) + monTool.defineHistogram('CaloEta',path='EXPERT', type='TH1F', title="FastElectron Hypo #eta^{calo} ; #eta^{calo};Nevents", xbins=200, xmin=-2.5, xmax=2.5) + monTool.defineHistogram('CaloPhi', path='EXPERT', type='TH1F', title="FastElectron Hypo #phi^{calo} ; #phi^{calo};Nevents", xbins=320, xmin=-3.2, xmax=3.2) + monTool.defineHistogram('CaloTrackdEtaNoExtrapMon', path='EXPERT',type='TH1F', title="FastElectron Fex #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) self.MonTool = monTool # --------------------------------------------------------------- -# TrigL2ElectronFex configurations +# TrigEgammaFastElectronFex configurations # --------------------------------------------------------------- -class L2ElectronFex_all(L2ElectronFexBase): +class EgammaFastElectronFex_all(EgammaFastElectronFexBase): __slots__ = [] - def __init__(self,name="L2ElectronFex_all"): - super(L2ElectronFex_all, self).__init__(name) + def __init__(self,name="EgammaFastElectronFex_all"): + super(EgammaFastElectronFex_all, self).__init__(name) # AcceptAll flag: if true take events regardless of cuts self.AcceptAll = False @@ -61,30 +61,30 @@ class L2ElectronFex_all(L2ElectronFexBase): self.RCalBarrelFace = 1470.0*mm self.ZCalEndcapFace = 3800.0*mm -class L2ElectronFex_1(L2ElectronFex_all): +class EgammaFastElectronFex_1(EgammaFastElectronFex_all): __slots__ = [] - def __init__(self,name="L2ElectronFex_1"): - super(L2ElectronFex_1, self).__init__(name) + def __init__(self,name="EgammaFastElectronFex_1"): + super(EgammaFastElectronFex_1, self).__init__(name) self.AcceptAll = True -class L2ElectronFex_Clean(L2ElectronFex_all): +class EgammaFastElectronFex_Clean(EgammaFastElectronFex_all): __slots__ = [] - def __init__(self,name="L2ElectronFex_Clean"): - super(L2ElectronFex_Clean, self).__init__(name) + def __init__(self,name="EgammaFastElectronFex_Clean"): + super(EgammaFastElectronFex_Clean, self).__init__(name) self.AcceptAll = False self.CaloTrackdETA = 0.2 self.CaloTrackdPHI = 0.3 -class L2ElectronFex_LowPt(L2ElectronFex_all): +class EgammaFastElectronFex_LowPt(EgammaFastElectronFex_all): __slots__ = [] - def __init__(self,name="L2ElectronFex_LowPt"): - super(L2ElectronFex_1, self).__init__(name) + def __init__(self,name="EgammaFastElectronFex_LowPt"): + super(EgammaFastElectronFex_1, self).__init__(name) self.AcceptAll = False -class L2ElectronFex_HighPt(L2ElectronFex_all): +class EgammaFastElectronFex_HighPt(EgammaFastElectronFex_all): __slots__ = [] - def __init__(self,name="L2ElectronFex_HighPt"): - super(L2ElectronFex_1, self).__init__(name) + def __init__(self,name="EgammaFastElectronFex_HighPt"): + super(EgammaFastElectronFex_1, self).__init__(name) self.AcceptAll = False self.TrackPt = 2.0 * GeV diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoTool.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastElectronHypoTool.py similarity index 68% rename from Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoTool.py rename to Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastElectronHypoTool.py index c2eb94a1b687776c26ceabf946a46fa437bd0e1d..abbc46d60ad1938286433b9dcb9c92ae31307542 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoTool.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastElectronHypoTool.py @@ -8,9 +8,9 @@ from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool -log = logging.getLogger('TrigL2ElectronHypoTool') +log = logging.getLogger('TrigEgammaFastElectronHypoTool') -def TrigL2ElectronHypoToolFromDict( chainDict ): +def TrigEgammaFastElectronHypoToolFromDict( chainDict ): """ Use menu decoded chain dictionary to configure the tool """ cparts = [i for i in chainDict['chainParts'] if i['signature']=='Electron'] @@ -18,19 +18,19 @@ def TrigL2ElectronHypoToolFromDict( chainDict ): name = chainDict['chainName'] from AthenaConfiguration.ComponentFactory import CompFactory - tool = CompFactory.TrigL2ElectronHypoTool(name) + tool = CompFactory.TrigEgammaFastElectronHypoTool(name) monTool = GenericMonitoringTool("MonTool"+name) - monTool.defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="L2Electron Hypo Cut Counter;Cut Counter", xbins=8, xmin=-1.5, xmax=7.5, opt="kCumulative") - monTool.defineHistogram('CaloTrackdEta', type='TH1F', path='EXPERT', title="L2Electron Hypo #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) - monTool.defineHistogram('CaloTrackdPhi', type='TH1F', path='EXPERT', title="L2Electron Hypo #Delta #phi between cluster and track;#Delta #phi;Nevents", xbins=80, xmin=-0.4, xmax=0.4) - monTool.defineHistogram('CaloTrackEoverP', type='TH1F', path='EXPERT', title="L2Electron Hypo E/p;E/p;Nevents", xbins=120, xmin=0, xmax=12) - monTool.defineHistogram('PtTrack', type='TH1F', path='EXPERT', title="L2Electron Hypo p_{T}^{track} [MeV];p_{T}^{track} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) - monTool.defineHistogram('PtCalo', type='TH1F', path='EXPERT', title="L2Electron Hypo p_{T}^{calo} [MeV];p_{T}^{calo} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) - monTool.defineHistogram('CaloEta', type='TH1F', path='EXPERT', title="L2Electron Hypo #eta^{calo} ; #eta^{calo};Nevents", xbins=200, xmin=-2.5, xmax=2.5) - monTool.defineHistogram('CaloPhi', type='TH1F', path='EXPERT', title="L2Electron Hypo #phi^{calo} ; #phi^{calo};Nevents", xbins=320, xmin=-3.2, xmax=3.2) - - monTool.HistPath = 'L2ElectronHypo/'+tool.getName() + monTool.defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="FastElectron Hypo Cut Counter;Cut Counter", xbins=8, xmin=-1.5, xmax=7.5, opt="kCumulative") + monTool.defineHistogram('CaloTrackdEta', type='TH1F', path='EXPERT', title="FastElectron Hypo #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4) + monTool.defineHistogram('CaloTrackdPhi', type='TH1F', path='EXPERT', title="FastElectron Hypo #Delta #phi between cluster and track;#Delta #phi;Nevents", xbins=80, xmin=-0.4, xmax=0.4) + monTool.defineHistogram('CaloTrackEoverP', type='TH1F', path='EXPERT', title="FastElectron Hypo E/p;E/p;Nevents", xbins=120, xmin=0, xmax=12) + monTool.defineHistogram('PtTrack', type='TH1F', path='EXPERT', title="FastElectron Hypo p_{T}^{track} [MeV];p_{T}^{track} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) + monTool.defineHistogram('PtCalo', type='TH1F', path='EXPERT', title="FastElectron Hypo p_{T}^{calo} [MeV];p_{T}^{calo} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) + monTool.defineHistogram('CaloEta', type='TH1F', path='EXPERT', title="FastElectron Hypo #eta^{calo} ; #eta^{calo};Nevents", xbins=200, xmin=-2.5, xmax=2.5) + monTool.defineHistogram('CaloPhi', type='TH1F', path='EXPERT', title="FastElectron Hypo #phi^{calo} ; #phi^{calo};Nevents", xbins=320, xmin=-3.2, xmax=3.2) + + monTool.HistPath = 'FastElectronHypo/'+tool.getName() tool.MonTool = monTool nt = len( thresholds ) @@ -58,7 +58,7 @@ def TrigL2ElectronHypoToolFromDict( chainDict ): return tool -def TrigL2ElectronHypoToolFromName( name, conf ): +def TrigEgammaFastElectronHypoToolFromName( name, conf ): """ provides configuration of the hypo tool giben the chain name The argument will be replaced by "parsed" chain dict. For now it only serves simplest chain HLT_eXYZ. """ @@ -66,15 +66,15 @@ def TrigL2ElectronHypoToolFromName( name, conf ): decodedDict = dictFromChainName(conf) - return TrigL2ElectronHypoToolFromDict( decodedDict ) + return TrigEgammaFastElectronHypoToolFromDict( decodedDict ) if __name__ == "__main__": - tool = TrigL2ElectronHypoToolFromName("HLT_e3_etcut_L1EM3", "HLT_e3_etcut_L1EM3") + tool = TrigEgammaFastElectronHypoToolFromName("HLT_e3_etcut_L1EM3", "HLT_e3_etcut_L1EM3") assert tool, "Not configured simple tool" - tool = TrigL2ElectronHypoToolFromName("HLT_2e3_etcut_L1E2M3", "HLT_2e3_etcut_L12EM3") + tool = TrigEgammaFastElectronHypoToolFromName("HLT_2e3_etcut_L1E2M3", "HLT_2e3_etcut_L12EM3") assert tool, "Not configured simple tool" assert len(tool.TrackPt) == 2, "Multiplicity missonfigured, set "+ str( len( tool.TrackPt ) ) diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastPhotonFexMTConfig.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastPhotonFexMTConfig.py new file mode 100755 index 0000000000000000000000000000000000000000..becae055a8634861ab7307b75470118f41a9cf99 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastPhotonFexMTConfig.py @@ -0,0 +1,14 @@ +# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + +from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaFastPhotonFexMT + + +# basic cut +class EgammaFastPhotonFex_1 (TrigEgammaFastPhotonFexMT): + __slots__ = [] + def __init__(self, name = "EgammaFastPhotonFex_1"): + super( EgammaFastPhotonFex_1, self ).__init__( name ) + + + + diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2PhotonHypoTool.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastPhotonHypoTool.py similarity index 71% rename from Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2PhotonHypoTool.py rename to Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastPhotonHypoTool.py index 25b409716746dcc2367d71daf74f1a124959e3a6..2bdbe772d45406dbebf1dbe2ddb2d8aef0784900 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2PhotonHypoTool.py +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigEgammaFastPhotonHypoTool.py @@ -6,23 +6,23 @@ from AthenaCommon.Include import Include # flake8: noqa from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool from AthenaCommon.Logging import logging -log = logging.getLogger('TrigL2PhotonHypoTool') +log = logging.getLogger('TrigEgammaFastPhotonHypoTool') -def TrigL2PhotonHypoToolFromDict( chainDict ): +def TrigEgammaFastPhotonHypoToolFromDict( chainDict ): """ Use menu decoded chain dictionary to configure the tool """ thresholds = sum([ [cpart['threshold']]*int(cpart['multiplicity']) for cpart in chainDict['chainParts']], []) name = chainDict['chainName'] from AthenaConfiguration.ComponentFactory import CompFactory - tool = CompFactory.TrigL2PhotonHypoTool(name) + tool = CompFactory.TrigEgammaFastPhotonHypoTool(name) monTool = GenericMonitoringTool("MonTool"+name) - monTool.defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="L2Photon Hypo Cut Counter;Cut Counter", xbins=8, xmin=-1.5, xmax=7.5, opt="kCumulative") - monTool.defineHistogram('PtCalo', type='TH1F', path='EXPERT', title="L2Photon Hypo p_{T}^{calo} [MeV];p_{T}^{calo} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) - monTool.defineHistogram('CaloEta', type='TH1F', path='EXPERT', title="L2Photon Hypo #eta^{calo} ; #eta^{calo};Nevents", xbins=200, xmin=-2.5, xmax=2.5) - monTool.defineHistogram('CaloPhi', type='TH1F', path='EXPERT', title="L2Photon Hypo #phi^{calo} ; #phi^{calo};Nevents", xbins=320, xmin=-3.2, xmax=3.2) + monTool.defineHistogram('CutCounter', type='TH1I', path='EXPERT', title="FastPhoton Hypo Cut Counter;Cut Counter", xbins=8, xmin=-1.5, xmax=7.5, opt="kCumulative") + monTool.defineHistogram('PtCalo', type='TH1F', path='EXPERT', title="FastPhoton Hypo p_{T}^{calo} [MeV];p_{T}^{calo} [MeV];Nevents", xbins=50, xmin=0, xmax=100000) + monTool.defineHistogram('CaloEta', type='TH1F', path='EXPERT', title="FastPhoton Hypo #eta^{calo} ; #eta^{calo};Nevents", xbins=200, xmin=-2.5, xmax=2.5) + monTool.defineHistogram('CaloPhi', type='TH1F', path='EXPERT', title="FastPhoton Hypo #phi^{calo} ; #phi^{calo};Nevents", xbins=320, xmin=-3.2, xmax=3.2) - monTool.HistPath = 'L2PhotonHypo/'+tool.getName() + monTool.HistPath = 'FastPhotonHypo/'+tool.getName() tool.MonTool = monTool nt = len( thresholds ) @@ -40,7 +40,7 @@ def TrigL2PhotonHypoToolFromDict( chainDict ): return tool -def TrigL2PhotonHypoToolFromName( name, conf ): +def TrigEgammaFastPhotonHypoToolFromName( name, conf ): """ provides configuration of the hypo tool giben the chain name The argument will be replaced by "parsed" chain dict. For now it only serves simplest chain HLT_eXYZ. """ @@ -48,11 +48,11 @@ def TrigL2PhotonHypoToolFromName( name, conf ): from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import dictFromChainName decodedDict = dictFromChainName(conf) - return TrigL2PhotonHypoToolFromDict( decodedDict ) + return TrigEgammaFastPhotonHypoToolFromDict( decodedDict ) if __name__ == "__main__": - tool = TrigL2PhotonHypoToolFromName("HLT_g5_etcut_L1EM3", "HLT_g5_etcut_L1EM3") + tool = TrigEgammaFastPhotonHypoToolFromName("HLT_g5_etcut_L1EM3", "HLT_g5_etcut_L1EM3") assert tool, "Not configured simple tool" log.info("ALL OK") diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2PhotonFexMTConfig.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2PhotonFexMTConfig.py deleted file mode 100755 index 9d637340019a5d0b4a1fe9f99ab64ee2b7c0290b..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2PhotonFexMTConfig.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2PhotonFexMT - - -# basic cut -class L2PhotonFex_1 (TrigL2PhotonFexMT): - __slots__ = [] - def __init__(self, name = "L2PhotonFex_1"): - super( L2PhotonFex_1, self ).__init__( name ) - - - - diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigL2CaloHypoTool.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaFastCaloHypoTool.h similarity index 73% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigL2CaloHypoTool.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaFastCaloHypoTool.h index 2ca149136a12e2b69671cdc72048ceb99f838b1b..4aa30e5ee9a95142bf6a21401acfe5b96f2db6a2 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigL2CaloHypoTool.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/ITrigEgammaFastCaloHypoTool.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_ITRIGL2CALOHYPOTOOL_H -#define TRIGEGAMMAHYPO_ITRIGL2CALOHYPOTOOL_H 1 +#ifndef TRIGEGAMMAHYPO_ITRIGEGAMMAFASTCALOHYPOTOOL_H +#define TRIGEGAMMAHYPO_ITRIGEGAMMAFASTCALOHYPOTOOL_H 1 #include "GaudiKernel/IAlgTool.h" #include "AthenaBaseComps/AthAlgTool.h" @@ -16,20 +16,20 @@ /** - * @class Base for tools dooing L2 Calo Hypo selection + * @class Base for tools dooing Egamma Fast Calo Hypo selection * @brief **/ -class ITrigL2CaloHypoTool +class ITrigEgammaFastCaloHypoTool : virtual public ::IAlgTool { public: - DeclareInterfaceID(ITrigL2CaloHypoTool, 1, 0); - virtual ~ITrigL2CaloHypoTool(){} + DeclareInterfaceID(ITrigEgammaFastCaloHypoTool, 1, 0); + virtual ~ITrigEgammaFastCaloHypoTool(){} - struct ClusterInfo { - ClusterInfo( TrigCompositeUtils::Decision* d, + struct FastClusterInfo { + FastClusterInfo( TrigCompositeUtils::Decision* d, const TrigRoiDescriptor* r, const xAOD::TrigEMCluster* c, const xAOD::TrigRingerRings* ring, @@ -56,13 +56,13 @@ class ITrigL2CaloHypoTool * There will be many tools called often to perform this quick operation and we do not want to pay for polymorphism which we do not need to use. * Will actually see when N obj hypos will enter the scene **/ - virtual StatusCode decide( std::vector<ClusterInfo>& input ) const = 0; + virtual StatusCode decide( std::vector<FastClusterInfo>& input ) const = 0; /** * @brief Makes a decision for a single object * The decision needs to be returned **/ - virtual bool decide( const ClusterInfo& i ) const = 0; + virtual bool decide( const FastClusterInfo& i ) const = 0; protected: @@ -70,4 +70,4 @@ class ITrigL2CaloHypoTool }; -#endif //> !TRIGEGAMMAHYPO_ITRIGL2CALOHYPOTOOL_H +#endif //> !TRIGEGAMMAHYPO_ITRIGEGAMMAFASTCALOHYPOTOOL_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.cxx similarity index 90% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoAlgMT.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.cxx index 64f2f24875319fd66cd1ae6c8f5e5e26c6f2e0d5..e8358950217edbb0aae7fd81ef974dda67e68a06 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoAlgMT.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.cxx @@ -3,19 +3,19 @@ */ #include "GaudiKernel/Property.h" -#include "TrigL2CaloHypoAlgMT.h" +#include "TrigEgammaFastCaloHypoAlgMT.h" #include "TrigCompositeUtils/HLTIdentifier.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" #include "AthViews/ViewHelper.h" using namespace TrigCompositeUtils; -TrigL2CaloHypoAlgMT::TrigL2CaloHypoAlgMT( const std::string& name, +TrigEgammaFastCaloHypoAlgMT::TrigEgammaFastCaloHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ) : ::HypoBase( name, pSvcLocator ) {} -StatusCode TrigL2CaloHypoAlgMT::initialize() { +StatusCode TrigEgammaFastCaloHypoAlgMT::initialize() { ATH_CHECK( m_hypoTools.retrieve() ); @@ -29,7 +29,7 @@ StatusCode TrigL2CaloHypoAlgMT::initialize() { } -StatusCode TrigL2CaloHypoAlgMT::execute( const EventContext& context ) const { +StatusCode TrigEgammaFastCaloHypoAlgMT::execute( const EventContext& context ) const { ATH_MSG_DEBUG ( "Executing " << name() << "..." ); auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context ); ATH_CHECK( previousDecisionsHandle.isValid() ); @@ -43,7 +43,7 @@ StatusCode TrigL2CaloHypoAlgMT::execute( const EventContext& context ) const { auto decisions = outputHandle.ptr(); // input for decision - std::vector<ITrigL2CaloHypoTool::ClusterInfo> toolInput; + std::vector<ITrigEgammaFastCaloHypoTool::FastClusterInfo> toolInput; // loop over previous decisions size_t counter=0; diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoAlgMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.h similarity index 66% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoAlgMT.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.h index e9a531eee86357387cfd1e7fbb047919f8ab0454..abdb96f47518f2ec73bb5eb15f561450848cd000 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoAlgMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoAlgMT.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_TRIGL2CALOHYPOALGMT_H -#define TRIGEGAMMAHYPO_TRIGL2CALOHYPOALGMT_H 1 +#ifndef TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOALGMT_H +#define TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOALGMT_H 1 #include <string> @@ -16,25 +16,25 @@ #include "xAODTrigRinger/TrigRingerRingsContainer.h" -#include "ITrigL2CaloHypoTool.h" +#include "ITrigEgammaFastCaloHypoTool.h" /** - * @class TrigL2CaloHypoAlgMT + * @class TrigEgammaFastCaloHypoAlgMT * @brief Implements egamma calo selection for the new HLT framework **/ -class TrigL2CaloHypoAlgMT : public ::HypoBase { +class TrigEgammaFastCaloHypoAlgMT : public ::HypoBase { public: - TrigL2CaloHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ); + TrigEgammaFastCaloHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ); virtual StatusCode initialize() override; virtual StatusCode execute( const EventContext& context ) const override; private: - ToolHandleArray< ITrigL2CaloHypoTool > m_hypoTools { this, "HypoTools", {}, "Hypo tools" }; + ToolHandleArray< ITrigEgammaFastCaloHypoTool > m_hypoTools { this, "HypoTools", {}, "Hypo tools" }; SG::ReadHandleKey< xAOD::TrigEMClusterContainer > m_clustersKey { this, "CaloClusters", "CaloClusters", "CaloClusters in view" }; SG::ReadHandleKey<xAOD::TrigRingerRingsContainer> m_ringsKey { this, "RingerKey","HLT_FastCaloRinger","Point to RingerKey"}; }; -#endif //> !TRIGEGAMMAHYPO_TESTTRIGL2CALOHYPOALG_H +#endif //> !TRIGEGAMMAHYPO_TESTTRIGEGAMMAFASTCALOHYPOALG_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2b541103c942e83229c1f1c1efe13be031f7ca50 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.cxx @@ -0,0 +1,403 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include <algorithm> +#include "TrigCompositeUtils/HLTIdentifier.h" +#include "TrigCompositeUtils/Combinators.h" +#include "AthenaMonitoringKernel/Monitored.h" +#include "GaudiKernel/SystemOfUnits.h" + +#include "TrigEgammaFastCaloHypoToolInc.h" + + +using namespace TrigCompositeUtils; + +TrigEgammaFastCaloHypoToolInc::TrigEgammaFastCaloHypoToolInc( const std::string& type, + const std::string& name, + const IInterface* parent ) + : base_class( type, name, parent ), + m_selectorTool(), + m_lumiBlockMuTool("LumiBlockMuTool/LumiBlockMuTool"), + m_decisionId( HLT::Identifier::fromToolName( name ) ) +{ +declareProperty("LumiBlockMuTool", m_lumiBlockMuTool, "Luminosity Tool" ); +} + +StatusCode TrigEgammaFastCaloHypoToolInc::initialize() { + +ATH_MSG_DEBUG("Name: "<<name()<<" UseRinger: "<<m_useRinger); + +if (m_useRinger){ + m_selectorTool.setConstantsCalibPath( m_constantsCalibPath ); + m_selectorTool.setThresholdsCalibPath( m_thresholdsCalibPath ); + + if(m_selectorTool.initialize().isFailure()) + return StatusCode::FAILURE; + + if (m_lumiBlockMuTool.retrieve().isFailure()) + return StatusCode::FAILURE; + + ATH_MSG_INFO("TrigEgammaFastCaloRingerHypo initialization completed successfully."); + +} + ATH_MSG_DEBUG( "Initialization completed successfully" ); + ATH_MSG_DEBUG( "AcceptAll = " << ( m_acceptAll==true ? "True" : "False" ) ); + ATH_MSG_DEBUG( "EtaBins = " << m_etabin ); + ATH_MSG_DEBUG( "ETthr = " << m_eTthr << "( lo )/" << m_eT2thr << "( hi )" ); + ATH_MSG_DEBUG( "HADETthr = " << m_hadeTthr << "( lo )/" << m_hadeT2thr << "( hi )" ); + ATH_MSG_DEBUG( "CARCOREthr = " << m_carcorethr ); + ATH_MSG_DEBUG( "CAERATIOthr = " << m_caeratiothr ); + ATH_MSG_DEBUG( "dPHICLUSTERthr = " << m_dphicluster ); + ATH_MSG_DEBUG( "dETACLUSTERthr = " << m_detacluster ); + ATH_MSG_DEBUG( "WETA2thr = " << m_WETA2thr ); + ATH_MSG_DEBUG( "WSTOTthr = " << m_WSTOTthr ); + ATH_MSG_DEBUG( "F3thr = " << m_F3thr ); + + if ( m_etabin.size() == 0 ) { + ATH_MSG_ERROR( " There are no cuts set (EtaBins property is an empty list)" ); + return StatusCode::FAILURE; + } + + unsigned int nEtaBin = m_etabin.size(); +#define CHECK_SIZE( __n) if ( m_##__n.size() != (nEtaBin - 1) ) \ + { ATH_MSG_DEBUG(" __n size is " << m_##__n.size() << " but needs to be " << (nEtaBin - 1) ); return StatusCode::FAILURE; } + + CHECK_SIZE( eTthr ); + CHECK_SIZE( eT2thr ); + CHECK_SIZE( hadeTthr ); + CHECK_SIZE( hadeT2thr ); + CHECK_SIZE( carcorethr ); + CHECK_SIZE( caeratiothr ); + CHECK_SIZE( WETA2thr ); + CHECK_SIZE( WSTOTthr ); + CHECK_SIZE( F3thr ); +#undef CHECK_SIZE + + ATH_MSG_DEBUG( "Tool configured for chain/id: " << m_decisionId ); + + if ( not m_monTool.name().empty() ) + CHECK( m_monTool.retrieve() ); + + return StatusCode::SUCCESS; +} + + + +TrigEgammaFastCaloHypoToolInc::~TrigEgammaFastCaloHypoToolInc(){} + +int TrigEgammaFastCaloHypoToolInc::findCutIndex( float eta ) const { + const float absEta = std::abs(eta); + + auto binIterator = std::adjacent_find( m_etabin.begin(), m_etabin.end(), [=](float left, float right){ return left < absEta and absEta < right; } ); + if ( binIterator == m_etabin.end() ) { + return -1; + } + return binIterator - m_etabin.begin(); +} + +StatusCode TrigEgammaFastCaloHypoToolInc::decide( std::vector<FastClusterInfo>& input ) const { + for ( auto& i: input ) { + if ( passed ( m_decisionId.numeric(), i.previousDecisionIDs ) ) { + if ( decide( i ) ) { + addDecisionID( m_decisionId, i.decision ); + } + } + } + return StatusCode::SUCCESS; +} + +bool TrigEgammaFastCaloHypoToolInc::decide( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& input ) const { + // ringer selection + if (m_useRinger){ + return decide_ringer( input ); + } + // cutbased selection + else{ + return decide_cutbased( input ); + } +} + +bool TrigEgammaFastCaloHypoToolInc::decide_cutbased( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& input ) const { + + bool pass = false; + + auto dEta = Monitored::Scalar( "dEta", -1. ); + auto dPhi = Monitored::Scalar( "dPhi", -1. ); + auto eT_T2Calo = Monitored::Scalar( "Et_em" , -1.0 ); + auto hadET_T2Calo = Monitored::Scalar( "Et_had", -1.0 ); + auto rCore = Monitored::Scalar( "RCore" , -1.0 ); + auto energyRatio = Monitored::Scalar( "ERatio" , -1.0 ); + auto etaBin = Monitored::Scalar( "EtaBin", -1. ); + auto monEta = Monitored::Scalar( "Eta", -99. ); + auto monPhi = Monitored::Scalar( "Phi", -99. ); + auto F1 = Monitored::Scalar( "F1" , -1.0 ); + auto Weta2 = Monitored::Scalar( "Weta2" , -1.0 ); + auto Wstot = Monitored::Scalar( "Wstot" , -1.0 ); + auto F3 = Monitored::Scalar( "F3" , -1.0 ); + auto PassedCuts = Monitored::Scalar<int>( "CutCounter", -1 ); + auto monitorIt = Monitored::Group( m_monTool, + dEta, dPhi, eT_T2Calo, hadET_T2Calo, + rCore, energyRatio, etaBin, monEta, + monPhi, F1, Weta2, Wstot, F3, PassedCuts ); + // when leaving scope it will ship data to monTool + PassedCuts = PassedCuts + 1; //got called (data in place) + + if ( m_acceptAll ) { + pass = true; + ATH_MSG_DEBUG( "AcceptAll property is set: taking all events" ); + } else { + pass = false; + ATH_MSG_DEBUG( "AcceptAll property not set: applying selection" ); + } + + auto roiDescriptor = input.roi; + + if ( fabs( roiDescriptor->eta() ) > 2.6 ) { + ATH_MSG_DEBUG( "REJECT The cluster had eta coordinates beyond the EM fiducial volume : " << roiDescriptor->eta() << "; stop the chain now" ); + pass=false; // special case + return pass; + } + + ATH_MSG_DEBUG( "; RoI ID = " << roiDescriptor->roiId() + << ": Eta = " << roiDescriptor->eta() + << ", Phi = " << roiDescriptor->phi() ); + + // fill local variables for RoI reference position + double etaRef = roiDescriptor->eta(); + double phiRef = roiDescriptor->phi(); + // correct phi the to right range ( probably not needed anymore ) + if ( fabs( phiRef ) > M_PI ) phiRef -= 2*M_PI; // correct phi if outside range + + auto pClus = input.cluster; + float absEta = fabs( pClus->eta() ); + etaBin = -1; + monEta = pClus->eta(); + monPhi = pClus->phi(); + const int cutIndex = findCutIndex( absEta ); + + // find if electron is in calorimeter crack + bool inCrack = ( absEta > 2.37 || ( absEta > 1.37 && absEta < 1.52 ) ); + dEta = pClus->eta() - etaRef; + + // Deal with angle diferences greater than Pi + dPhi = fabs( pClus->phi() - phiRef ); + dPhi = ( dPhi < M_PI ? dPhi : 2*M_PI - dPhi ); // TB why only < + + // calculate cluster quantities // definition taken from TrigElectron constructor + if ( pClus->emaxs1() + pClus->e2tsts1() > 0 ) + energyRatio = ( pClus->emaxs1() - pClus->e2tsts1() ) / ( pClus->emaxs1() + pClus->e2tsts1() ); + + // ( VD ) here the definition is a bit different to account for the cut of e277 @ EF + if ( pClus->e277()!= 0. ) rCore = pClus->e237() / pClus->e277(); + + //fraction of energy deposited in 1st sampling + if ( fabs( pClus->energy() ) > 0.00001 ) F1 = ( pClus->energy( CaloSampling::EMB1 )+pClus->energy( CaloSampling::EME1 ) )/pClus->energy(); + eT_T2Calo = pClus->et(); + if ( eT_T2Calo!=0 && pClus->eta()!=0 ) hadET_T2Calo = pClus->ehad1()/cosh( fabs( pClus->eta() ) )/eT_T2Calo; + + //extract Weta2 varable + Weta2 = pClus->weta2(); + + //extract Wstot varable + Wstot = pClus->wstot(); + + //extract F3 ( backenergy i EM calorimeter + float e0 = pClus->energy( CaloSampling::PreSamplerB ) + pClus->energy( CaloSampling::PreSamplerE ); + float e1 = pClus->energy( CaloSampling::EMB1 ) + pClus->energy( CaloSampling::EME1 ); + float e2 = pClus->energy( CaloSampling::EMB2 ) + pClus->energy( CaloSampling::EME2 ); + float e3 = pClus->energy( CaloSampling::EMB3 ) + pClus->energy( CaloSampling::EME3 ); + float eallsamples = e0+e1+e2+e3; + F3 = fabs( eallsamples )>0. ? e3/eallsamples : 0.; + + // apply cuts: DeltaEta( clus-ROI ) + ATH_MSG_DEBUG( "TrigEMCluster: eta=" << pClus->eta() + << " roi eta=" << etaRef << " DeltaEta=" << dEta + << " cut: <" << m_detacluster ); + + if ( fabs( pClus->eta() - etaRef ) > m_detacluster ) { + ATH_MSG_DEBUG("REJECT Cluster dEta cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //Deta + + // DeltaPhi( clus-ROI ) + ATH_MSG_DEBUG( ": phi=" << pClus->phi() + << " roi phi="<< phiRef << " DeltaPhi="<< dPhi + << " cut: <" << m_dphicluster ); + + if( dPhi > m_dphicluster ) { + ATH_MSG_DEBUG("REJECT Clsuter dPhi cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //DPhi + + // eta range + if ( cutIndex == -1 ) { // VD + ATH_MSG_DEBUG( "Cluster eta: " << absEta << " outside eta range " << m_etabin[m_etabin.size()-1] ); + return pass; + } + else { + ATH_MSG_DEBUG( "eta bin used for cuts " << cutIndex ); + } + PassedCuts = PassedCuts + 1; // passed eta cut + + // Rcore + ATH_MSG_DEBUG ( "TrigEMCluster: Rcore=" << rCore + << " cut: >" << m_carcorethr[cutIndex] ); + if ( rCore < m_carcorethr[cutIndex] ) { + ATH_MSG_DEBUG("REJECT rCore cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //Rcore + + // Eratio + ATH_MSG_DEBUG( " cut: >" << m_caeratiothr[cutIndex] ); + if ( inCrack || F1 < m_F1thr[0] ) { + ATH_MSG_DEBUG ( "TrigEMCluster: InCrack= " << inCrack << " F1=" << F1 ); + } + else { + if ( energyRatio < m_caeratiothr[cutIndex] ) { + ATH_MSG_DEBUG("REJECT e ratio cut failed"); + return pass; + } + } + PassedCuts = PassedCuts + 1; //Eratio + if( inCrack ) energyRatio = -1; //Set default value in crack for monitoring. + + // ET_em + ATH_MSG_DEBUG( "TrigEMCluster: ET_em=" << eT_T2Calo << " cut: >" << m_eTthr[cutIndex] ); + if ( eT_T2Calo < m_eTthr[cutIndex] ) { + ATH_MSG_DEBUG("REJECT et cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; // ET_em + + float hadET_cut = 0.0; + // find which ET_had to apply : this depends on the ET_em and the eta bin + if ( eT_T2Calo > m_eT2thr[cutIndex] ) { + hadET_cut = m_hadeT2thr[cutIndex] ; + ATH_MSG_DEBUG ( "ET_em>" << m_eT2thr[cutIndex] << ": use high ET_had cut: <" << hadET_cut ); + } + else { + hadET_cut = m_hadeTthr[cutIndex]; + ATH_MSG_DEBUG ( "ET_em<" << m_eT2thr[cutIndex] << ": use low ET_had cut: <" << hadET_cut ); + } + + // ET_had + ATH_MSG_DEBUG ( "TrigEMCluster: ET_had=" << hadET_T2Calo << " cut: <" << hadET_cut ); + if ( hadET_T2Calo > hadET_cut ) { + ATH_MSG_DEBUG("REJECT et had cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //ET_had + + // F1 + ATH_MSG_DEBUG ( "TrigEMCluster: F1=" << F1 << " cut: >" << m_F1thr[0] ); + PassedCuts = PassedCuts + 1; //F1 + + //Weta2 + ATH_MSG_DEBUG ( "TrigEMCluster: Weta2=" << Weta2 << " cut: <" << m_WETA2thr[cutIndex] ); + if ( Weta2 > m_WETA2thr[cutIndex] ) { + ATH_MSG_DEBUG("REJECT weta 2 cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //Weta2 + + //Wstot + ATH_MSG_DEBUG ( "TrigEMCluster: Wstot=" <<Wstot << " cut: <" << m_WSTOTthr[cutIndex] ); + if ( Wstot >= m_WSTOTthr[cutIndex] ) { + ATH_MSG_DEBUG("REJECT wstot cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //Wstot + + //F3 + ATH_MSG_DEBUG( "TrigEMCluster: F3=" << F3 << " cut: <" << m_F3thr[cutIndex] ); + if ( F3 > m_F3thr[cutIndex] ) { + ATH_MSG_DEBUG("REJECT F3 cut failed"); + return pass; + } + PassedCuts = PassedCuts + 1; //F3 + + // got this far => passed! + pass = true; + + // Reach this point successfully + ATH_MSG_DEBUG( "pass = " << pass ); + + return pass; + +} + +bool TrigEgammaFastCaloHypoToolInc::decide_ringer ( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& input) const{ + + auto etMon = Monitored::Scalar("Et",-100); + auto monEta = Monitored::Scalar("Eta",-100); + auto monPhi = Monitored::Scalar("Phi",-100); + auto rnnOutMon = Monitored::Scalar("RnnOut",-100); + auto total_time = Monitored::Timer("TIME_total"); + auto propagate_time = Monitored::Timer("TIME_propagate"); + auto preproc_time = Monitored::Timer("TIME_preproc"); + auto decide_time = Monitored::Timer("TIME_decide"); + auto mon = Monitored::Group(m_monTool,etMon,monEta,monPhi,rnnOutMon, + total_time,propagate_time,preproc_time,decide_time); + + + if ( m_acceptAll ) { + ATH_MSG_DEBUG( "AcceptAll property is set: taking all events" ); + return true; + } else { + ATH_MSG_DEBUG( "AcceptAll property not set: applying selection" ); + } + + total_time.start(); + auto ringerShape = input.ringerShape; + const xAOD::TrigEMCluster *emCluster = 0; + if(ringerShape){ + emCluster = ringerShape->emCluster(); + //emCluster= input.cluster; + if(!emCluster){ + ATH_MSG_WARNING( "There is no link to xAOD::TrigEMCluster into the Ringer object."); + return false; + } + } + else{ + ATH_MSG_WARNING( "There is no xAOD::TrigRingerRings link into the rnnOutput object."); + return false; + } + + float eta = std::fabs(emCluster->eta()); + float et = emCluster->et() / Gaudi::Units::GeV; + float avgmu = m_lumiBlockMuTool->averageInteractionsPerCrossing(); + + if(eta>2.50) eta=2.50;///fix for events out of the ranger + + // make sure that monitoring histogram will plotting only the events of chain. + ///Et threshold + if(et < m_emEtCut/Gaudi::Units::GeV){ + ATH_MSG_DEBUG( "Event reproved by Et threshold. Et = " << et << ", EtCut = " << m_emEtCut/Gaudi::Units::GeV); + return false; + } + + monEta = emCluster->eta(); + etMon = emCluster->et(); + monPhi = emCluster->phi(); + + const std::vector<float> rings = ringerShape->rings(); + std::vector<float> refRings(rings.size()); + refRings.assign(rings.begin(), rings.end()); + + ATH_MSG_DEBUG("Et = "<< et << " Eta = "<<eta << " mu = " << avgmu << "rsize = "<< refRings.size()); + + auto output = m_selectorTool.calculate( refRings, et, eta, avgmu, propagate_time, preproc_time ); + rnnOutMon = output; + ATH_MSG_DEBUG(name()<< " generate as NN output " << output ); + + decide_time.start(); + bool accept = m_selectorTool.accept(output, et,eta,avgmu); + decide_time.stop(); + + total_time.stop(); + return accept; +} \ No newline at end of file diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.h similarity index 76% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.h index a8b2aacc89e76c284cae402dbe52d24a62dc12d9..700726b977b70f6f745d86b4e7fdb4d73e6bf3d9 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolInc.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOLINC_H -#define TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOLINC_H 1 +#ifndef TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOTOOLINC_H +#define TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOTOOLINC_H 1 //#include "GaudiKernel/IAlgTool.h" #include "CLHEP/Units/SystemOfUnits.h" @@ -17,25 +17,29 @@ #include "AthenaMonitoringKernel/GenericMonitoringTool.h" #include "TrigCompositeUtils/HLTIdentifier.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" -#include "ITrigL2CaloHypoTool.h" +#include "ITrigEgammaFastCaloHypoTool.h" /** * @class Implementation of the Egamma selection for CaloClusters * @brief **/ -class TrigL2CaloHypoToolInc : public extends<AthAlgTool, ITrigL2CaloHypoTool> { +class TrigEgammaFastCaloHypoToolInc : public extends<AthAlgTool, ITrigEgammaFastCaloHypoTool> { public: - TrigL2CaloHypoToolInc( const std::string& type, + TrigEgammaFastCaloHypoToolInc( const std::string& type, const std::string& name, const IInterface* parent ); - virtual ~TrigL2CaloHypoToolInc(); + virtual ~TrigEgammaFastCaloHypoToolInc(); virtual StatusCode initialize() override; - virtual StatusCode decide( std::vector<ITrigL2CaloHypoTool::ClusterInfo>& input ) const override; + virtual StatusCode decide( std::vector<ITrigEgammaFastCaloHypoTool::FastClusterInfo>& input ) const override; - virtual bool decide( const ITrigL2CaloHypoTool::ClusterInfo& i ) const override; + virtual bool decide( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& i ) const override; + + // ringer and cutbased selectors + virtual bool decide_cutbased( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& i ) const; + virtual bool decide_ringer( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& i ) const; private: Ringer::RingerSelectorTool m_selectorTool; @@ -67,4 +71,4 @@ class TrigL2CaloHypoToolInc : public extends<AthAlgTool, ITrigL2CaloHypoTool> { int findCutIndex( float eta ) const; }; -#endif //> !TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOL_H +#endif //> !TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOTOOLINC_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolMult.cxx similarity index 80% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolMult.cxx index 591827f69aa1d91d9d3eeca373fe0e89f642049f..014f74cc6c1d39149296c37c8b727277a8c41c47 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolMult.cxx @@ -3,18 +3,18 @@ */ #include "TrigCompositeUtils/Combinators.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" -#include "TrigL2CaloHypoToolMult.h" +#include "TrigEgammaFastCaloHypoToolMult.h" using namespace TrigCompositeUtils; -TrigL2CaloHypoToolMult::TrigL2CaloHypoToolMult( const std::string& type, +TrigEgammaFastCaloHypoToolMult::TrigEgammaFastCaloHypoToolMult( const std::string& type, const std::string& name, const IInterface* parent ) : base_class( type, name, parent ), m_decisionId( HLT::Identifier::fromToolName( name ) ) {} -TrigL2CaloHypoToolMult::~TrigL2CaloHypoToolMult() {} +TrigEgammaFastCaloHypoToolMult::~TrigEgammaFastCaloHypoToolMult() {} -StatusCode TrigL2CaloHypoToolMult::initialize() { +StatusCode TrigEgammaFastCaloHypoToolMult::initialize() { if( m_subTools.size() <= 1 ) { ATH_MSG_ERROR( "Number of sub tools " << m_subTools.size() << ", while it has to be > 1, otherwise this is not a multiplicity selection" ); return StatusCode::FAILURE; @@ -23,7 +23,7 @@ StatusCode TrigL2CaloHypoToolMult::initialize() { return StatusCode::SUCCESS; } -StatusCode TrigL2CaloHypoToolMult::decide( std::vector<ITrigL2CaloHypoTool::ClusterInfo>& input ) const { +StatusCode TrigEgammaFastCaloHypoToolMult::decide( std::vector<ITrigEgammaFastCaloHypoTool::FastClusterInfo>& input ) const { HLT::Index2DVec passingSelection( m_subTools.size() ); ATH_MSG_DEBUG( "Applying selection of multiplicity " << m_subTools.size() ); diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolMult.h similarity index 52% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolMult.h index c3e3ea7e17511d5a3a082ab5b10e5be52774ebb5..1cfbb0d1c0570b1cab89de5dbaed367291cb9963 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastCaloHypoToolMult.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOLMULT_H -#define TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOLMULT_H 1 +#ifndef TRIGEGAMMAHYPO_TRIGEGAMMFASTCALOHYPOTOOLMULT_H +#define TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOTOOLMULT_H 1 //#include "GaudiKernel/IAlgTool.h" #include "CLHEP/Units/SystemOfUnits.h" @@ -12,7 +12,7 @@ #include "AthenaMonitoringKernel/GenericMonitoringTool.h" #include "TrigCompositeUtils/HLTIdentifier.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" -#include "ITrigL2CaloHypoTool.h" +#include "ITrigEgammaFastCaloHypoTool.h" @@ -21,18 +21,18 @@ * @brief **/ -class TrigL2CaloHypoToolMult : public extends<AthAlgTool, ITrigL2CaloHypoTool> { +class TrigEgammaFastCaloHypoToolMult : public extends<AthAlgTool, ITrigEgammaFastCaloHypoTool> { public: - TrigL2CaloHypoToolMult( const std::string& type, + TrigEgammaFastCaloHypoToolMult( const std::string& type, const std::string& name, const IInterface* parent ); - virtual ~TrigL2CaloHypoToolMult(); + virtual ~TrigEgammaFastCaloHypoToolMult(); virtual StatusCode initialize() override; - virtual StatusCode decide( std::vector<ITrigL2CaloHypoTool::ClusterInfo>& input ) const override; + virtual StatusCode decide( std::vector<ITrigEgammaFastCaloHypoTool::FastClusterInfo>& input ) const override; - virtual bool decide( const ITrigL2CaloHypoTool::ClusterInfo& ) const override { + virtual bool decide( const ITrigEgammaFastCaloHypoTool::FastClusterInfo& ) const override { REPORT_MESSAGE(MSG::ERROR) << "this method should never be called"; return false; } @@ -40,8 +40,8 @@ class TrigL2CaloHypoToolMult : public extends<AthAlgTool, ITrigL2CaloHypoTool> { private: HLT::Identifier m_decisionId; - ToolHandleArray<ITrigL2CaloHypoTool> m_subTools { this, "SubTools", {}, "Sub tools performing cuts" }; + ToolHandleArray<ITrigEgammaFastCaloHypoTool> m_subTools { this, "SubTools", {}, "Sub tools performing cuts" }; }; -#endif //> !TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOLMULT_H +#endif //> !TRIGEGAMMAHYPO_TRIGEgammaFastCALOHYPOTOOLMULT_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronFexMT.cxx similarity index 96% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronFexMT.cxx index d1f204304658def3134ffc3903a350b96bd9f838..92d9fea388cb9a4bc8c770d6487ada55e652ebbe 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronFexMT.cxx @@ -20,7 +20,7 @@ **************************************************************************/ #include "TrkCaloExtension/CaloExtensionHelpers.h" -#include "TrigL2ElectronFexMT.h" +#include "TrigEgammaFastElectronFexMT.h" #include "xAODTrigCalo/TrigEMClusterContainer.h" #include "xAODTrigCalo/TrigEMClusterAuxContainer.h" #include "AthenaMonitoringKernel/Monitored.h" @@ -32,7 +32,7 @@ inline const DataVector<xAOD::TrigElectron>** dvec_cast(SRC** ptr) { } -TrigL2ElectronFexMT::TrigL2ElectronFexMT(const std::string & name, ISvcLocator* pSvcLocator) +TrigEgammaFastElectronFexMT::TrigEgammaFastElectronFexMT(const std::string & name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) { @@ -40,11 +40,11 @@ TrigL2ElectronFexMT::TrigL2ElectronFexMT(const std::string & name, ISvcLocator* } -TrigL2ElectronFexMT::~TrigL2ElectronFexMT() +TrigEgammaFastElectronFexMT::~TrigEgammaFastElectronFexMT() {} -StatusCode TrigL2ElectronFexMT::initialize() +StatusCode TrigEgammaFastElectronFexMT::initialize() { ATH_MSG_DEBUG("Initialization:"); @@ -85,7 +85,7 @@ ATH_CHECK( m_outputElectronsKey.initialize() ); } -StatusCode TrigL2ElectronFexMT::finalize() +StatusCode TrigEgammaFastElectronFexMT::finalize() { if (m_extrapolator_failed) ATH_MSG_INFO("track extrapolation failed " << m_extrapolator_failed << " times"); @@ -94,7 +94,7 @@ StatusCode TrigL2ElectronFexMT::finalize() } -StatusCode TrigL2ElectronFexMT::execute() { +StatusCode TrigEgammaFastElectronFexMT::execute() { using namespace xAOD; ATH_MSG_DEBUG( "Executing " <<name()); @@ -301,7 +301,7 @@ StatusCode TrigL2ElectronFexMT::execute() { return StatusCode::SUCCESS; } -bool TrigL2ElectronFexMT::extrapolate(const xAOD::TrigEMCluster *clus, const xAOD::TrackParticle *trk, double &etaAtCalo, double &phiAtCalo){ +bool TrigEgammaFastElectronFexMT::extrapolate(const xAOD::TrigEMCluster *clus, const xAOD::TrackParticle *trk, double &etaAtCalo, double &phiAtCalo){ CaloExtensionHelpers::LayersToSelect layersToSelect; layersToSelect.insert(CaloSampling::CaloSample::EMB2); layersToSelect.insert(CaloSampling::CaloSample::EME2); diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronFexMT.h similarity index 92% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronFexMT.h index 51f8352966e12c62cd582410a3c85912d74cda48..a074822965cd3559b861de98e4480c3905881795 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronFexMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronFexMT.h @@ -18,8 +18,8 @@ ** Created: 27 Jul 2017 **************************************************************************/ -#ifndef TRIG_TrigL2ElectronFexMT_H -#define TRIG_TrigL2ElectronFexMT_H +#ifndef TRIG_TrigEgammaFastElectronFexMT_H +#define TRIG_TrigEgammaFastElectronFexMT_H // standard stuff #include <vector> @@ -52,23 +52,23 @@ //{ class IParticleCaloExtensionTool; } /** - * \class TrigL2ElectronFexMT - * \brief TrigL2ElectronFexMT is a Trigger Fex Algorithm that retrieves the L2 TrigEMCluster + * \class TrigEgammaFastElectronFexMT + * \brief TrigEgammaFastElectronFexMT is a Trigger Fex Algorithm that retrieves the L2 TrigEMCluster * container and the L2 TrackCollection containers and then creates a TrigElectron Container * with a subset of calorimeter-ID selection variables that are calculated (eg. E/p) * TrigL2ElectronFexMT will apply some very loose selection cuts to the TrigElectronContainer created * which is of TrigParticle type TrigElectron - * The TrigElectron conatiner will then be retrieved by the hypothesis algorithm TrigL2ElectronHypo + * The TrigElectron conatiner will then be retrieved by the hypothesis algorithm TrigEgammaFastElectronHypo * that will perform the corresponding L2 electron selection * */ -class TrigL2ElectronFexMT : public AthAlgorithm { +class TrigEgammaFastElectronFexMT : public AthAlgorithm { public: - TrigL2ElectronFexMT(const std::string & name, ISvcLocator* pSvcLocator); - ~TrigL2ElectronFexMT(); + TrigEgammaFastElectronFexMT(const std::string & name, ISvcLocator* pSvcLocator); + ~TrigEgammaFastElectronFexMT(); virtual StatusCode initialize() override; virtual StatusCode finalize() override; diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoAlgMT.cxx similarity index 89% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoAlgMT.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoAlgMT.cxx index 7b49b7f03b6dcd09e34a90c98101d4436e3d0310..44a064fd9ee6066e073224e803d267dee89162b4 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoAlgMT.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoAlgMT.cxx @@ -3,7 +3,7 @@ */ #include <map> #include "GaudiKernel/Property.h" -#include "TrigL2ElectronHypoAlgMT.h" +#include "TrigEgammaFastElectronHypoAlgMT.h" #include "AthViews/ViewHelper.h" @@ -19,12 +19,12 @@ using TrigCompositeUtils::featureString; using TrigCompositeUtils::findLink; using TrigCompositeUtils::LinkInfo; -TrigL2ElectronHypoAlgMT::TrigL2ElectronHypoAlgMT( const std::string& name, +TrigEgammaFastElectronHypoAlgMT::TrigEgammaFastElectronHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ) : ::HypoBase( name, pSvcLocator ) {} -StatusCode TrigL2ElectronHypoAlgMT::initialize() { +StatusCode TrigEgammaFastElectronHypoAlgMT::initialize() { CHECK( m_hypoTools.retrieve() ); CHECK( m_electronsKey.initialize() ); @@ -33,7 +33,7 @@ StatusCode TrigL2ElectronHypoAlgMT::initialize() { return StatusCode::SUCCESS; } -StatusCode TrigL2ElectronHypoAlgMT::execute( const EventContext& context ) const { +StatusCode TrigEgammaFastElectronHypoAlgMT::execute( const EventContext& context ) const { ATH_MSG_DEBUG ( "Executing " << name() << "..." ); auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context ); ATH_CHECK( previousDecisionsHandle.isValid() ); @@ -60,7 +60,7 @@ StatusCode TrigL2ElectronHypoAlgMT::execute( const EventContext& context ) const ATH_MSG_DEBUG( "Cluster ptr to decision map has size " << clusterToIndexMap.size() ); // prepare imput for tools - std::vector<TrigL2ElectronHypoTool::ElectronInfo> hypoToolInput; + std::vector<TrigEgammaFastElectronHypoTool::ElectronInfo> hypoToolInput; for ( auto previousDecision: *previousDecisionsHandle ) { // get View @@ -93,7 +93,7 @@ StatusCode TrigL2ElectronHypoAlgMT::execute( const EventContext& context ) const DecisionIDContainer clusterDecisionIDs; decisionIDs( previousDecisionsHandle->at( origCluster->second ), clusterDecisionIDs ); - hypoToolInput.emplace_back( TrigL2ElectronHypoTool::ElectronInfo{ d, *electronIter, origCluster->first, clusterDecisionIDs } ); + hypoToolInput.emplace_back( TrigEgammaFastElectronHypoTool::ElectronInfo{ d, *electronIter, origCluster->first, clusterDecisionIDs } ); } } diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoAlgMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoAlgMT.h similarity index 61% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoAlgMT.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoAlgMT.h index e2bdab66c170ab5264bf7f28c4cc9b86b56c6789..50e6206c871bfb653dba0aa62fcb7cc27f0cde56 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoAlgMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoAlgMT.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_TRIGL2ELECTRONHYPOALGMT_H -#define TRIGEGAMMAHYPO_TRIGL2ELECTRONHYPOALGMT_H 1 +#ifndef TRIGEGAMMAHYPO_TRIGEGAMMAFASTELECTRONHYPOALGMT_H +#define TRIGEGAMMAHYPO_TRIGEGAMMAFASTELECTRONHYPOALGMT_H 1 #include <string> @@ -11,30 +11,30 @@ #include "TrigCompositeUtils/TrigCompositeUtils.h" #include "AthViews/View.h" -#include "TrigL2ElectronHypoTool.h" +#include "TrigEgammaFastElectronHypoTool.h" #include "xAODTrigCalo/TrigEMClusterContainer.h" #include "DecisionHandling/HypoBase.h" /** - * @class TrigL2ElectronHypoAlgMT + * @class TrigEgammaFastElectronHypoAlgMT * @brief Implements Hypo selection on L2 electrons **/ -class TrigL2ElectronHypoAlgMT : public ::HypoBase +class TrigEgammaFastElectronHypoAlgMT : public ::HypoBase { public: - TrigL2ElectronHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ); + TrigEgammaFastElectronHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ); virtual StatusCode initialize() override; virtual StatusCode execute(const EventContext& context) const override; private: - ToolHandleArray< TrigL2ElectronHypoTool > m_hypoTools {this, "HypoTools", {}, "Tools to perfrom selection"}; + ToolHandleArray< TrigEgammaFastElectronHypoTool > m_hypoTools {this, "HypoTools", {}, "Tools to perfrom selection"}; Gaudi::Property< bool > m_runInView { this, "RunInView", false , "Set input DH for running in views" }; // internally used to getch from views SG::ReadHandleKey< xAOD::TrigElectronContainer > m_electronsKey {this, "Electrons", "L2ElectronContainer", "Input"}; }; -#endif //> !TRIGEGAMMAHYPO_TRIGL2ELECTRONHYPOALGMT_H +#endif //> !TRIGEGAMMAHYPO_TRIGEGAMMAFASTELECTRONHYPOALGMT_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoTool.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoTool.cxx similarity index 89% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoTool.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoTool.cxx index eb65eabc6df7cba8dc24c3e632ef2e9eeb48844f..b9f4af0006df3f2ad3a4c6da2a7a714070ff25b7 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoTool.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoTool.cxx @@ -7,17 +7,17 @@ #include "TrigCompositeUtils/Combinators.h" #include "AthenaMonitoringKernel/Monitored.h" -#include "TrigL2ElectronHypoTool.h" +#include "TrigEgammaFastElectronHypoTool.h" using namespace TrigCompositeUtils; -TrigL2ElectronHypoTool::TrigL2ElectronHypoTool( const std::string& type, +TrigEgammaFastElectronHypoTool::TrigEgammaFastElectronHypoTool( const std::string& type, const std::string& name, const IInterface* parent ) : AthAlgTool( type, name, parent ), m_decisionId( HLT::Identifier::fromToolName( name ) ) {} -StatusCode TrigL2ElectronHypoTool::initialize() { +StatusCode TrigEgammaFastElectronHypoTool::initialize() { if ( !m_monTool.empty() ) CHECK( m_monTool.retrieve() ); @@ -46,9 +46,9 @@ StatusCode TrigL2ElectronHypoTool::initialize() { } -TrigL2ElectronHypoTool::~TrigL2ElectronHypoTool() {} +TrigEgammaFastElectronHypoTool::~TrigEgammaFastElectronHypoTool() {} -bool TrigL2ElectronHypoTool::decideOnSingleObject( const xAOD::TrigElectron* electron, +bool TrigEgammaFastElectronHypoTool::decideOnSingleObject( const xAOD::TrigElectron* electron, size_t cutIndex ) const { auto cutCounter = Monitored::Scalar<int>( "CutCounter", -1 ); auto cutIndexM = Monitored::Scalar<int>( "CutIndex", cutIndex ); // one can do 2D plots for each cut independently @@ -122,7 +122,7 @@ bool TrigL2ElectronHypoTool::decideOnSingleObject( const xAOD::TrigElectron* ele } -StatusCode TrigL2ElectronHypoTool::inclusiveSelection( std::vector<ElectronInfo>& input ) const { +StatusCode TrigEgammaFastElectronHypoTool::inclusiveSelection( std::vector<ElectronInfo>& input ) const { for ( auto i: input ) { if ( i.previousDecisionIDs.count( m_decisionId.numeric() ) == 0 ) continue; // the decision was negative or not even made in previous stage @@ -135,7 +135,7 @@ StatusCode TrigL2ElectronHypoTool::inclusiveSelection( std::vector<ElectronInfo> } -StatusCode TrigL2ElectronHypoTool::markPassing( std::vector<ElectronInfo>& input, const std::set<size_t>& passing ) const { +StatusCode TrigEgammaFastElectronHypoTool::markPassing( std::vector<ElectronInfo>& input, const std::set<size_t>& passing ) const { for ( auto idx: passing ) addDecisionID( m_decisionId.numeric(), input[idx].decision ); @@ -143,7 +143,7 @@ StatusCode TrigL2ElectronHypoTool::markPassing( std::vector<ElectronInfo>& input } -StatusCode TrigL2ElectronHypoTool::multiplicitySelection( std::vector<ElectronInfo>& input ) const { +StatusCode TrigEgammaFastElectronHypoTool::multiplicitySelection( std::vector<ElectronInfo>& input ) const { HLT::Index2DVec passingSelection( m_multiplicity ); for ( size_t cutIndex = 0; cutIndex < m_multiplicity; ++ cutIndex ) { @@ -186,7 +186,7 @@ StatusCode TrigL2ElectronHypoTool::multiplicitySelection( std::vector<ElectronIn return markPassing( input, passingIndices ); } -StatusCode TrigL2ElectronHypoTool::decide( std::vector<ElectronInfo>& input ) const { +StatusCode TrigEgammaFastElectronHypoTool::decide( std::vector<ElectronInfo>& input ) const { // handle the simplest and most common case ( multiplicity == 1 ) in easiest possible manner if ( m_trackPt.size() == 1 ) { return inclusiveSelection( input ); diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoTool.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoTool.h similarity index 90% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoTool.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoTool.h index 736ad8808692d73d00cefa71eed43c0a65463688..d44c13333af7634945b2d778adba35a9d919c962 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2ElectronHypoTool.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastElectronHypoTool.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_TRIGL2ELECTRONHYPOTOOL_H -#define TRIGEGAMMAHYPO_TRIGL2ELECTRONHYPOTOOL_H 1 +#ifndef TRIGEGAMMAHYPO_TRIGEGAMMAFASTELECTRONHYPOTOOL_H +#define TRIGEGAMMAHYPO_TRIGEGAMMAFASTELECTRONHYPOTOOL_H 1 #include "GaudiKernel/Property.h" #include "CLHEP/Units/SystemOfUnits.h" @@ -19,14 +19,14 @@ * @brief **/ -class TrigL2ElectronHypoTool : virtual public ::AthAlgTool +class TrigEgammaFastElectronHypoTool : virtual public ::AthAlgTool { public: - TrigL2ElectronHypoTool( const std::string& type, + TrigEgammaFastElectronHypoTool( const std::string& type, const std::string& name, const IInterface* parent ); - virtual ~TrigL2ElectronHypoTool(); + virtual ~TrigEgammaFastElectronHypoTool(); virtual StatusCode initialize() override; @@ -85,4 +85,4 @@ class TrigL2ElectronHypoTool : virtual public ::AthAlgTool ToolHandle<GenericMonitoringTool> m_monTool{ this, "MonTool", "", "Monitoring tool" }; }; -#endif //> !TRIGEGAMMAHYPO_TRIGL2CALOHYPOTOOL_H +#endif //> !TRIGEGAMMAHYPO_TRIGEGAMMAFASTCALOHYPOTOOL_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonFexMT.cxx similarity index 90% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonFexMT.cxx index e79ee6c4bae4ce3a747219e0569350cc60d57914..f1bfab73af981c85b63bb9b7a20e235ddbb242ae 100755 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonFexMT.cxx @@ -11,7 +11,7 @@ **************************************************************************/ -#include "TrigL2PhotonFexMT.h" +#include "TrigEgammaFastPhotonFexMT.h" #include "xAODTrigCalo/TrigEMClusterContainer.h" #include "xAODTrigCalo/TrigEMClusterAuxContainer.h" #include "xAODTrigEgamma/TrigPhotonContainer.h" @@ -20,27 +20,27 @@ class ISvcLocator; -TrigL2PhotonFexMT::TrigL2PhotonFexMT(const std::string & name, ISvcLocator* pSvcLocator) +TrigEgammaFastPhotonFexMT::TrigEgammaFastPhotonFexMT(const std::string & name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator) { } -TrigL2PhotonFexMT::~TrigL2PhotonFexMT() +TrigEgammaFastPhotonFexMT::~TrigEgammaFastPhotonFexMT() {} -StatusCode TrigL2PhotonFexMT::initialize() +StatusCode TrigEgammaFastPhotonFexMT::initialize() { ATH_CHECK( m_roiCollectionKey.initialize() ); ATH_CHECK( m_TrigEMClusterContainerKey.initialize() ); - ATH_CHECK(m_outputPhotonsKey.initialize()); + ATH_CHECK( m_outputPhotonsKey.initialize() ); return StatusCode::SUCCESS; } -StatusCode TrigL2PhotonFexMT::execute() +StatusCode TrigEgammaFastPhotonFexMT::execute() { using namespace xAOD; auto ctx = getContext(); @@ -118,7 +118,4 @@ StatusCode TrigL2PhotonFexMT::execute() } return StatusCode::SUCCESS; -} - - - +} \ No newline at end of file diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonFexMT.h similarity index 84% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonFexMT.h index 8630e8caba1510e636bb39f19f001455afc89e6d..7bc3beeac2a0a30ac340787c41b90f8d81acd573 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonFexMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonFexMT.h @@ -4,8 +4,8 @@ -#ifndef TRIG_TrigL2PhotonFexMT_H -#define TRIG_TrigL2PhotonFexMT_H +#ifndef TRIG_TrigEgammaFastPhotonFexMT_H +#define TRIG_TrigEgammaFastPhotonFexMT_H // athena stuff #include "GaudiKernel/IToolSvc.h" @@ -35,20 +35,20 @@ /** - * \class TrigL2PhotonFexMT - * \brief TrigL2PhotonFex is an HLT Fex Algorithm that creates TrigPhotons + * \class TrigEgammaFastPhotonFexMT + * \brief TrigEgammaFastPhotonFex is an HLT Fex Algorithm that creates TrigPhotons * from the the L2 TrigEMClusters that passed the TrigL2CaloHypo. * The TrigPhotons will then be retrieved by the hypothesis algorithm TrigL2PhotonHypo * that will perform the corresponding L2 photon selection * */ -class TrigL2PhotonFexMT : public AthAlgorithm { +class TrigEgammaFastPhotonFexMT : public AthAlgorithm { public: - TrigL2PhotonFexMT(const std::string & name, ISvcLocator* pSvcLocator); - ~TrigL2PhotonFexMT(); + TrigEgammaFastPhotonFexMT(const std::string & name, ISvcLocator* pSvcLocator); + ~TrigEgammaFastPhotonFexMT(); virtual StatusCode initialize() override; virtual StatusCode execute() override; diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoAlgMT.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonHypoAlgMT.cxx similarity index 89% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoAlgMT.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonHypoAlgMT.cxx index 3f9bbd29a638ee799b4d09b134dab44d6a8b0d64..a57e30b492740a2158f2aabb996e9db308fd5b79 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoAlgMT.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonHypoAlgMT.cxx @@ -3,7 +3,7 @@ */ #include "GaudiKernel/Property.h" -#include "TrigL2PhotonHypoAlgMT.h" +#include "TrigEgammaFastPhotonHypoAlgMT.h" #include "AthViews/ViewHelper.h" @@ -17,12 +17,12 @@ using TrigCompositeUtils::linkToPrevious; using TrigCompositeUtils::viewString; using TrigCompositeUtils::featureString; -TrigL2PhotonHypoAlgMT::TrigL2PhotonHypoAlgMT( const std::string& name, +TrigEgammaFastPhotonHypoAlgMT::TrigEgammaFastPhotonHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ) : ::HypoBase( name, pSvcLocator ) {} -StatusCode TrigL2PhotonHypoAlgMT::initialize() { +StatusCode TrigEgammaFastPhotonHypoAlgMT::initialize() { ATH_CHECK( m_hypoTools.retrieve() ); ATH_CHECK( m_photonsKey.initialize() ); @@ -31,7 +31,7 @@ StatusCode TrigL2PhotonHypoAlgMT::initialize() { return StatusCode::SUCCESS; } -StatusCode TrigL2PhotonHypoAlgMT::execute( const EventContext& context ) const { +StatusCode TrigEgammaFastPhotonHypoAlgMT::execute( const EventContext& context ) const { ATH_MSG_DEBUG ( "Executing " << name() << "..." ); auto previousDecisionsHandle = SG::makeHandle( decisionInput(), context ); ATH_CHECK( previousDecisionsHandle.isValid() ); @@ -61,7 +61,7 @@ StatusCode TrigL2PhotonHypoAlgMT::execute( const EventContext& context ) const { SG::WriteHandle<DecisionContainer> outputHandle = createAndStore(decisionOutput(), context ); auto decisions = outputHandle.ptr(); - std::vector<TrigL2PhotonHypoTool::PhotonInfo> hypoToolInput; + std::vector<TrigEgammaFastPhotonHypoTool::PhotonInfo> hypoToolInput; for ( auto previousDecision: *previousDecisionsHandle ) { //previousDecision->objectLink< ViewContainer >( "view" ); @@ -96,7 +96,7 @@ StatusCode TrigL2PhotonHypoAlgMT::execute( const EventContext& context ) const { DecisionIDContainer clusterDecisionIDs; decisionIDs( previousDecisionsHandle->at( origCluster->second ), clusterDecisionIDs ); - hypoToolInput.emplace_back( TrigL2PhotonHypoTool::PhotonInfo{ d, *photonIter, origCluster->first, clusterDecisionIDs } ); + hypoToolInput.emplace_back( TrigEgammaFastPhotonHypoTool::PhotonInfo{ d, *photonIter, origCluster->first, clusterDecisionIDs } ); } } @@ -108,6 +108,4 @@ StatusCode TrigL2PhotonHypoAlgMT::execute( const EventContext& context ) const { ATH_CHECK( hypoBaseOutputProcessing(outputHandle) ); return StatusCode::SUCCESS; -} - - +} \ No newline at end of file diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoAlgMT.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonHypoAlgMT.h similarity index 63% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoAlgMT.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonHypoAlgMT.h index 124f35255033a619ffe0082661e854398d7ed5bb..b1c73d121c400d573811a9b9d9a78227ad7e52ff 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoAlgMT.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonHypoAlgMT.h @@ -2,8 +2,8 @@ Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_TRIGL2PHOTONHYPOALGMT_H -#define TRIGEGAMMAHYPO_TRIGL2PHOTONHYPOALGMT_H 1 +#ifndef TRIGEGAMMAHYPO_TRIGEGAMMAFASTPHOTONHYPOALGMT_H +#define TRIGEGAMMAHYPO_TRIGEGAMMAFASTPHOTONHYPOALGMT_H 1 #include <string> @@ -13,32 +13,32 @@ #include "AthViews/View.h" #include "TrigSteeringEvent/TrigRoiDescriptorCollection.h" -#include "TrigL2PhotonHypoTool.h" +#include "TrigEgammaFastPhotonHypoTool.h" #include "xAODTrigCalo/TrigEMClusterContainer.h" #include "DecisionHandling/HypoBase.h" -#include "ITrigL2CaloHypoTool.h" +#include "ITrigEgammaFastCaloHypoTool.h" /** - * @class TrigL2PhotonHypoAlgoMT + * @class TrigEgammaFastPhotonHypoAlgoMT * @brief Implements Hypo selection on L2 photons **/ -class TrigL2PhotonHypoAlgMT : public ::HypoBase +class TrigEgammaFastPhotonHypoAlgMT : public ::HypoBase { public: - TrigL2PhotonHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ); + TrigEgammaFastPhotonHypoAlgMT( const std::string& name, ISvcLocator* pSvcLocator ); virtual StatusCode initialize() override; virtual StatusCode execute(const EventContext& context) const override; private: - ToolHandleArray< TrigL2PhotonHypoTool > m_hypoTools {this, "HypoTools", {}, "Tools to perfrom selection"}; + ToolHandleArray< TrigEgammaFastPhotonHypoTool > m_hypoTools {this, "HypoTools", {}, "Tools to perfrom selection"}; Gaudi::Property< bool > m_runInView { this, "RunInView", false , "Set input DH for running in views" }; // internally used to getch from views SG::ReadHandleKey< xAOD::TrigPhotonContainer > m_photonsKey {this, "Photons", "L2PhotonContainer", "Input"}; }; -#endif //> !TRIGEGAMMAHYPO_TRIGL2PHOTONHYPOALGMT_H +#endif //> !TRIGEGAMMAHYPO_TRIGEGAMMAFASTPHOTONHYPOALGMT_H diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoTool.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonHypoTool.cxx similarity index 89% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoTool.cxx rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonHypoTool.cxx index 1c64645a76d0fc68e3edc7c45429b844616a4ec6..5a0cf3129bc4b2b89a907ced4e862dde5b1d13fb 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoTool.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonHypoTool.cxx @@ -8,17 +8,17 @@ #include "TrigCompositeUtils/Combinators.h" #include "AthenaMonitoringKernel/Monitored.h" -#include "TrigL2PhotonHypoTool.h" +#include "TrigEgammaFastPhotonHypoTool.h" using namespace TrigCompositeUtils; -TrigL2PhotonHypoTool::TrigL2PhotonHypoTool( const std::string& type, +TrigEgammaFastPhotonHypoTool::TrigEgammaFastPhotonHypoTool( const std::string& type, const std::string& name, const IInterface* parent ) : AthAlgTool( type, name, parent ), m_decisionId( HLT::Identifier::fromToolName( name ) ) {} -StatusCode TrigL2PhotonHypoTool::initialize() { +StatusCode TrigEgammaFastPhotonHypoTool::initialize() { // if ( !m_monTool.empty() ) CHECK( m_monTool.rerthrieve() ); @@ -36,7 +36,9 @@ StatusCode TrigL2PhotonHypoTool::initialize() { ATH_MSG_DEBUG( "dETACLUSTERthr = " << m_detacluster ); - std::vector<size_t> sizes( {m_eTthr.size(), m_eT2thr.size(), m_hadeTthr.size(), m_hadeT2thr.size(), m_carcorethr.size(), m_caeratiothr.size() } ); + std::vector<size_t> sizes( {m_eTthr.size(), m_eT2thr.size(), + m_hadeTthr.size(), m_hadeT2thr.size(), + m_carcorethr.size(), m_caeratiothr.size() } ); if ( *std::min_element( sizes.begin(), sizes.end() ) != *std::max_element( sizes.begin(), sizes.end() ) ) { ATH_MSG_ERROR( "Missconfiguration, cut properties listed above ( when DEBUG ) have different dimensions shortest: " << *std::min_element( sizes.begin(), sizes.end() ) << " longest " << *std::max_element( sizes.begin(), sizes.end() ) ); @@ -46,10 +48,10 @@ if ( *std::min_element( sizes.begin(), sizes.end() ) != *std::max_element( sizes } -TrigL2PhotonHypoTool::~TrigL2PhotonHypoTool() {} +TrigEgammaFastPhotonHypoTool::~TrigEgammaFastPhotonHypoTool() {} -bool TrigL2PhotonHypoTool::decideOnSingleObject( const xAOD::TrigPhoton* photon,size_t cutIndex ) const { +bool TrigEgammaFastPhotonHypoTool::decideOnSingleObject( const xAOD::TrigPhoton* photon,size_t cutIndex ) const { auto cutCounter = Monitored::Scalar<int>( "CutCounter", -1 ); auto cutIndexM = Monitored::Scalar<int>( "CutIndex", cutIndex ); @@ -184,7 +186,7 @@ bool TrigL2PhotonHypoTool::decideOnSingleObject( const xAOD::TrigPhoton* photon, } -StatusCode TrigL2PhotonHypoTool::inclusiveSelection( std::vector<PhotonInfo>& input ) const { +StatusCode TrigEgammaFastPhotonHypoTool::inclusiveSelection( std::vector<PhotonInfo>& input ) const { for ( auto i: input ) { if ( i.previousDecisionIDs.count( m_decisionId.numeric() ) == 0 ) continue; // the decision was negative or not even made in previous stage @@ -197,7 +199,7 @@ StatusCode TrigL2PhotonHypoTool::inclusiveSelection( std::vector<PhotonInfo>& in } -StatusCode TrigL2PhotonHypoTool::markPassing( std::vector<PhotonInfo>& input, const std::set<size_t>& passing ) const { +StatusCode TrigEgammaFastPhotonHypoTool::markPassing( std::vector<PhotonInfo>& input, const std::set<size_t>& passing ) const { for ( auto idx: passing ) addDecisionID( m_decisionId.numeric(), input[idx].decision ); @@ -205,7 +207,7 @@ StatusCode TrigL2PhotonHypoTool::markPassing( std::vector<PhotonInfo>& input, co } -StatusCode TrigL2PhotonHypoTool::decide( std::vector<PhotonInfo>& input ) const { +StatusCode TrigEgammaFastPhotonHypoTool::decide( std::vector<PhotonInfo>& input ) const { if ( m_multiplicity == 1 ) { return inclusiveSelection( input ); diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoTool.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonHypoTool.h similarity index 91% rename from Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoTool.h rename to Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonHypoTool.h index 4915b43ab7931b864eae8548aa554363e75578c2..1803c1e56cc10a9d8f300f603085f0b9aa0d48ae 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypoTool.h +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEgammaFastPhotonHypoTool.h @@ -1,8 +1,8 @@ /* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration */ -#ifndef TRIGEGAMMAHYPO_TRIGL2PHOTONHYPOTOOL_H -#define TRIGEGAMMAHYPO_TRIGL2PHOTONHYPOTOOL_H 1 +#ifndef TRIGEGAMMAHYPO_TRIGEGAMMAFASTPHOTONHYPOTOOL_H +#define TRIGEGAMMAHYPO_TRIGEGAMMAFASTPHOTONHYPOTOOL_H 1 #include "GaudiKernel/Property.h" #include "CLHEP/Units/SystemOfUnits.h" @@ -19,18 +19,16 @@ * @brief **/ -class TrigL2PhotonHypoTool : virtual public ::AthAlgTool +class TrigEgammaFastPhotonHypoTool : virtual public ::AthAlgTool { public: - TrigL2PhotonHypoTool( const std::string& type, + TrigEgammaFastPhotonHypoTool( const std::string& type, const std::string& name, const IInterface* parent ); - virtual ~TrigL2PhotonHypoTool(); + virtual ~TrigEgammaFastPhotonHypoTool(); virtual StatusCode initialize() override; - - struct PhotonInfo { TrigCompositeUtils::Decision* decision; const xAOD::TrigPhoton* photon; @@ -49,10 +47,6 @@ class TrigL2PhotonHypoTool : virtual public ::AthAlgTool StatusCode markPassing( std::vector<PhotonInfo>& input, const std::set<size_t>& passing ) const; - - - - private: HLT::Identifier m_decisionId; diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.cxx deleted file mode 100644 index 1d7cdc08f704cd943c0725e107735d12c45bd400..0000000000000000000000000000000000000000 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolInc.cxx +++ /dev/null @@ -1,399 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include <algorithm> -#include "TrigCompositeUtils/HLTIdentifier.h" -#include "TrigCompositeUtils/Combinators.h" -#include "AthenaMonitoringKernel/Monitored.h" -#include "GaudiKernel/SystemOfUnits.h" - -#include "TrigL2CaloHypoToolInc.h" - - -using namespace TrigCompositeUtils; - -TrigL2CaloHypoToolInc::TrigL2CaloHypoToolInc( const std::string& type, - const std::string& name, - const IInterface* parent ) - : base_class( type, name, parent ), - m_selectorTool(), - m_lumiBlockMuTool("LumiBlockMuTool/LumiBlockMuTool"), - m_decisionId( HLT::Identifier::fromToolName( name ) ) -{ -declareProperty("LumiBlockMuTool", m_lumiBlockMuTool, "Luminosity Tool" ); -} - -StatusCode TrigL2CaloHypoToolInc::initialize() { - -ATH_MSG_DEBUG("Name: "<<name()<<" UseRinger: "<<m_useRinger); - -if (m_useRinger){ - m_selectorTool.setConstantsCalibPath( m_constantsCalibPath ); - m_selectorTool.setThresholdsCalibPath( m_thresholdsCalibPath ); - - if(m_selectorTool.initialize().isFailure()) - return StatusCode::FAILURE; - - if (m_lumiBlockMuTool.retrieve().isFailure()) - return StatusCode::FAILURE; - - ATH_MSG_INFO("TrigL2CaloRingerHypo initialization completed successfully."); - -} - ATH_MSG_DEBUG( "Initialization completed successfully" ); - ATH_MSG_DEBUG( "AcceptAll = " << ( m_acceptAll==true ? "True" : "False" ) ); - ATH_MSG_DEBUG( "EtaBins = " << m_etabin ); - ATH_MSG_DEBUG( "ETthr = " << m_eTthr << "( lo )/" << m_eT2thr << "( hi )" ); - ATH_MSG_DEBUG( "HADETthr = " << m_hadeTthr << "( lo )/" << m_hadeT2thr << "( hi )" ); - ATH_MSG_DEBUG( "CARCOREthr = " << m_carcorethr ); - ATH_MSG_DEBUG( "CAERATIOthr = " << m_caeratiothr ); - ATH_MSG_DEBUG( "dPHICLUSTERthr = " << m_dphicluster ); - ATH_MSG_DEBUG( "dETACLUSTERthr = " << m_detacluster ); - ATH_MSG_DEBUG( "WETA2thr = " << m_WETA2thr ); - ATH_MSG_DEBUG( "WSTOTthr = " << m_WSTOTthr ); - ATH_MSG_DEBUG( "F3thr = " << m_F3thr ); - - if ( m_etabin.size() == 0 ) { - ATH_MSG_ERROR( " There are no cuts set (EtaBins property is an empty list)" ); - return StatusCode::FAILURE; - } - - unsigned int nEtaBin = m_etabin.size(); -#define CHECK_SIZE( __n) if ( m_##__n.size() != (nEtaBin - 1) ) \ - { ATH_MSG_DEBUG(" __n size is " << m_##__n.size() << " but needs to be " << (nEtaBin - 1) ); return StatusCode::FAILURE; } - - CHECK_SIZE( eTthr ); - CHECK_SIZE( eT2thr ); - CHECK_SIZE( hadeTthr ); - CHECK_SIZE( hadeT2thr ); - CHECK_SIZE( carcorethr ); - CHECK_SIZE( caeratiothr ); - CHECK_SIZE( WETA2thr ); - CHECK_SIZE( WSTOTthr ); - CHECK_SIZE( F3thr ); -#undef CHECK_SIZE - - ATH_MSG_DEBUG( "Tool configured for chain/id: " << m_decisionId ); - - if ( not m_monTool.name().empty() ) - CHECK( m_monTool.retrieve() ); - - return StatusCode::SUCCESS; -} - - - -TrigL2CaloHypoToolInc::~TrigL2CaloHypoToolInc(){} - - -bool TrigL2CaloHypoToolInc::decide( const ITrigL2CaloHypoTool::ClusterInfo& input ) const { - - bool pass = false; - - if ( m_acceptAll ) { - pass = true; - ATH_MSG_DEBUG( "AcceptAll property is set: taking all events" ); - } else { - pass = false; - ATH_MSG_DEBUG( "AcceptAll property not set: applying selection" ); - } - - // TB Not sure if anything else than the CutCounter should monitored it in every cut tool, - // Should quantitities be filled only after the succesful selection? - - auto monEta = Monitored::Scalar("Eta",-100); - auto monPhi = Monitored::Scalar("Phi",-100); - - if(m_useRinger){ - auto etMon = Monitored::Scalar("Et",-100); - auto rnnOutMon = Monitored::Scalar("RnnOut",-100); - auto total_time = Monitored::Timer("TIME_total"); - auto propagate_time = Monitored::Timer("TIME_propagate"); - auto preproc_time = Monitored::Timer("TIME_preproc"); - auto decide_time = Monitored::Timer("TIME_decide"); - auto mon = Monitored::Group(m_monTool,etMon,monEta,monPhi,rnnOutMon,total_time,propagate_time,preproc_time,decide_time); - - total_time.start(); - auto ringerShape = input.ringerShape; - const xAOD::TrigEMCluster *emCluster = 0; - if(ringerShape){ - emCluster = ringerShape->emCluster(); - //emCluster= input.cluster; - if(!emCluster){ - ATH_MSG_WARNING( "There is no link to xAOD::TrigEMCluster into the Ringer object."); - return false; - } - } - else{ - ATH_MSG_WARNING( "There is no xAOD::TrigRingerRings link into the rnnOutput object."); - return false; - } - - float eta = std::fabs(emCluster->eta()); - float et = emCluster->et() / Gaudi::Units::GeV; - float avgmu = m_lumiBlockMuTool->averageInteractionsPerCrossing(); - - if(eta>2.50) eta=2.50;///fix for events out of the ranger - - // make sure that monitoring histogram will plotting only the events of chain. - ///Et threshold - if(et < m_emEtCut/Gaudi::Units::GeV){ - ATH_MSG_DEBUG( "Event reproved by Et threshold. Et = " << et << ", EtCut = " << m_emEtCut/Gaudi::Units::GeV); - return false; - } - - monEta = emCluster->eta(); - etMon = emCluster->et(); - monPhi = emCluster->phi(); - - const std::vector<float> rings = ringerShape->rings(); - std::vector<float> refRings(rings.size()); - refRings.assign(rings.begin(), rings.end()); - - ATH_MSG_DEBUG("Et = "<< et << " Eta = "<<eta << " mu = " << avgmu << "rsize = "<< refRings.size()); - - auto output = m_selectorTool.calculate( refRings, et, eta, avgmu, propagate_time, preproc_time ); - rnnOutMon = output; - ATH_MSG_DEBUG(name()<< " generate as NN output " << output ); - - decide_time.start(); - bool accept = m_selectorTool.accept(output, et,eta,avgmu); - decide_time.stop(); - - total_time.stop(); - return accept; - } - - else{ - auto dEta = Monitored::Scalar( "dEta", -1. ); - auto dPhi = Monitored::Scalar( "dPhi", -1. ); - auto eT_T2Calo = Monitored::Scalar( "Et_em" , -1.0 ); - auto hadET_T2Calo = Monitored::Scalar( "Et_had", -1.0 ); - auto rCore = Monitored::Scalar( "RCore" , -1.0 ); - auto energyRatio = Monitored::Scalar( "ERatio" , -1.0 ); - auto etaBin = Monitored::Scalar( "EtaBin", -1. ); - auto monEta = Monitored::Scalar( "Eta", -99. ); - auto monPhi = Monitored::Scalar( "Phi", -99. ); - auto F1 = Monitored::Scalar( "F1" , -1.0 ); - auto Weta2 = Monitored::Scalar( "Weta2" , -1.0 ); - auto Wstot = Monitored::Scalar( "Wstot" , -1.0 ); - auto F3 = Monitored::Scalar( "F3" , -1.0 ); - auto PassedCuts = Monitored::Scalar<int>( "CutCounter", -1 ); - auto monitorIt = Monitored::Group( m_monTool, - dEta, dPhi, eT_T2Calo, hadET_T2Calo, - rCore, energyRatio, etaBin, monEta, - monPhi, F1, Weta2, Wstot, F3, PassedCuts ); - // when leaving scope it will ship data to monTool - PassedCuts = PassedCuts + 1; //got called (data in place) - - auto roiDescriptor = input.roi; - - - if ( fabs( roiDescriptor->eta() ) > 2.6 ) { - ATH_MSG_DEBUG( "REJECT The cluster had eta coordinates beyond the EM fiducial volume : " << roiDescriptor->eta() << "; stop the chain now" ); - pass=false; // special case - return pass; - } - - ATH_MSG_DEBUG( "; RoI ID = " << roiDescriptor->roiId() - << ": Eta = " << roiDescriptor->eta() - << ", Phi = " << roiDescriptor->phi() ); - - // fill local variables for RoI reference position - double etaRef = roiDescriptor->eta(); - double phiRef = roiDescriptor->phi(); - // correct phi the to right range ( probably not needed anymore ) - if ( fabs( phiRef ) > M_PI ) phiRef -= 2*M_PI; // correct phi if outside range - - auto pClus = input.cluster; - - float absEta = fabs( pClus->eta() ); - etaBin = -1; - monEta = pClus->eta(); - monPhi = pClus->phi(); - - const int cutIndex = findCutIndex( absEta ); - - // find if electron is in calorimeter crack - bool inCrack = ( absEta > 2.37 || ( absEta > 1.37 && absEta < 1.52 ) ); - - - dEta = pClus->eta() - etaRef; - // Deal with angle diferences greater than Pi - dPhi = fabs( pClus->phi() - phiRef ); - dPhi = ( dPhi < M_PI ? dPhi : 2*M_PI - dPhi ); // TB why only < - - - // calculate cluster quantities // definition taken from TrigElectron constructor - if ( pClus->emaxs1() + pClus->e2tsts1() > 0 ) - energyRatio = ( pClus->emaxs1() - pClus->e2tsts1() ) / ( pClus->emaxs1() + pClus->e2tsts1() ); - - // ( VD ) here the definition is a bit different to account for the cut of e277 @ EF - if ( pClus->e277()!= 0. ) rCore = pClus->e237() / pClus->e277(); - - //fraction of energy deposited in 1st sampling - - if ( fabs( pClus->energy() ) > 0.00001 ) F1 = ( pClus->energy( CaloSampling::EMB1 )+pClus->energy( CaloSampling::EME1 ) )/pClus->energy(); - - eT_T2Calo = pClus->et(); - - if ( eT_T2Calo!=0 && pClus->eta()!=0 ) hadET_T2Calo = pClus->ehad1()/cosh( fabs( pClus->eta() ) )/eT_T2Calo; - - - //extract Weta2 varable - Weta2 = pClus->weta2(); - - //extract Wstot varable - Wstot = pClus->wstot(); - - //extract F3 ( backenergy i EM calorimeter - float e0 = pClus->energy( CaloSampling::PreSamplerB ) + pClus->energy( CaloSampling::PreSamplerE ); - float e1 = pClus->energy( CaloSampling::EMB1 ) + pClus->energy( CaloSampling::EME1 ); - float e2 = pClus->energy( CaloSampling::EMB2 ) + pClus->energy( CaloSampling::EME2 ); - float e3 = pClus->energy( CaloSampling::EMB3 ) + pClus->energy( CaloSampling::EME3 ); - float eallsamples = e0+e1+e2+e3; - F3 = fabs( eallsamples )>0. ? e3/eallsamples : 0.; - - // apply cuts: DeltaEta( clus-ROI ) - ATH_MSG_DEBUG( "TrigEMCluster: eta=" << pClus->eta() - << " roi eta=" << etaRef << " DeltaEta=" << dEta - << " cut: <" << m_detacluster ); - - if ( fabs( pClus->eta() - etaRef ) > m_detacluster ) { - ATH_MSG_DEBUG("REJECT Cluster dEta cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //Deta - - // DeltaPhi( clus-ROI ) - ATH_MSG_DEBUG( ": phi=" << pClus->phi() - << " roi phi="<< phiRef << " DeltaPhi="<< dPhi - << " cut: <" << m_dphicluster ); - - if( dPhi > m_dphicluster ) { - ATH_MSG_DEBUG("REJECT Clsuter dPhi cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //DPhi - - // eta range - if ( cutIndex == -1 ) { // VD - ATH_MSG_DEBUG( "Cluster eta: " << absEta << " outside eta range " << m_etabin[m_etabin.size()-1] ); - return pass; - } - else { - ATH_MSG_DEBUG( "eta bin used for cuts " << cutIndex ); - } - PassedCuts = PassedCuts + 1; // passed eta cut - - // Rcore - ATH_MSG_DEBUG ( "TrigEMCluster: Rcore=" << rCore - << " cut: >" << m_carcorethr[cutIndex] ); - if ( rCore < m_carcorethr[cutIndex] ) { - ATH_MSG_DEBUG("REJECT rCore cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //Rcore - - // Eratio - ATH_MSG_DEBUG( " cut: >" << m_caeratiothr[cutIndex] ); - if ( inCrack || F1 < m_F1thr[0] ) { - ATH_MSG_DEBUG ( "TrigEMCluster: InCrack= " << inCrack << " F1=" << F1 ); - } - else { - if ( energyRatio < m_caeratiothr[cutIndex] ) { - ATH_MSG_DEBUG("REJECT e ratio cut failed"); - return pass; - } - } - PassedCuts = PassedCuts + 1; //Eratio - if( inCrack ) energyRatio = -1; //Set default value in crack for monitoring. - - // ET_em - ATH_MSG_DEBUG( "TrigEMCluster: ET_em=" << eT_T2Calo << " cut: >" << m_eTthr[cutIndex] ); - if ( eT_T2Calo < m_eTthr[cutIndex] ) { - ATH_MSG_DEBUG("REJECT et cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; // ET_em - - float hadET_cut = 0.0; - // find which ET_had to apply : this depends on the ET_em and the eta bin - if ( eT_T2Calo > m_eT2thr[cutIndex] ) { - hadET_cut = m_hadeT2thr[cutIndex] ; - ATH_MSG_DEBUG ( "ET_em>" << m_eT2thr[cutIndex] << ": use high ET_had cut: <" << hadET_cut ); - } - else { - hadET_cut = m_hadeTthr[cutIndex]; - ATH_MSG_DEBUG ( "ET_em<" << m_eT2thr[cutIndex] << ": use low ET_had cut: <" << hadET_cut ); - } - - // ET_had - ATH_MSG_DEBUG ( "TrigEMCluster: ET_had=" << hadET_T2Calo << " cut: <" << hadET_cut ); - - if ( hadET_T2Calo > hadET_cut ) { - ATH_MSG_DEBUG("REJECT et had cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //ET_had - - // F1 - ATH_MSG_DEBUG ( "TrigEMCluster: F1=" << F1 << " cut: >" << m_F1thr[0] ); - PassedCuts = PassedCuts + 1; //F1 - - //Weta2 - ATH_MSG_DEBUG ( "TrigEMCluster: Weta2=" << Weta2 << " cut: <" << m_WETA2thr[cutIndex] ); - if ( Weta2 > m_WETA2thr[cutIndex] ) { - ATH_MSG_DEBUG("REJECT weta 2 cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //Weta2 - - //Wstot - ATH_MSG_DEBUG ( "TrigEMCluster: Wstot=" <<Wstot << " cut: <" << m_WSTOTthr[cutIndex] ); - if ( Wstot >= m_WSTOTthr[cutIndex] ) { - ATH_MSG_DEBUG("REJECT wstot cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //Wstot - - //F3 - ATH_MSG_DEBUG( "TrigEMCluster: F3=" << F3 << " cut: <" << m_F3thr[cutIndex] ); - if ( F3 > m_F3thr[cutIndex] ) { - ATH_MSG_DEBUG("REJECT F3 cut failed"); - return pass; - } - PassedCuts = PassedCuts + 1; //F3 - - // got this far => passed! - pass = true; - - // Reach this point successfully - ATH_MSG_DEBUG( "pass = " << pass ); - - return pass; - } -} - -int TrigL2CaloHypoToolInc::findCutIndex( float eta ) const { - const float absEta = std::abs(eta); - - auto binIterator = std::adjacent_find( m_etabin.begin(), m_etabin.end(), [=](float left, float right){ return left < absEta and absEta < right; } ); - if ( binIterator == m_etabin.end() ) { - return -1; - } - return binIterator - m_etabin.begin(); -} - - -StatusCode TrigL2CaloHypoToolInc::decide( std::vector<ClusterInfo>& input ) const { - for ( auto& i: input ) { - if ( passed ( m_decisionId.numeric(), i.previousDecisionIDs ) ) { - if ( decide( i ) ) { - addDecisionID( m_decisionId, i.decision ); - } - } - } - return StatusCode::SUCCESS; -} diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/components/TrigEgammaHypo_entries.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/components/TrigEgammaHypo_entries.cxx index 0c90140201c07b771fbc7aab1f6e8aebf644c66d..da14c5524812d5eec4f86bc5a307c31425c3858d 100644 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/components/TrigEgammaHypo_entries.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/components/TrigEgammaHypo_entries.cxx @@ -2,7 +2,7 @@ #include "TrigEgammaHypo/TrigL2ElectronFex.h" #include "TrigEgammaHypo/TrigL2PhotonFex.h" #include "TrigEgammaHypo/TrigL2ElectronHypo.h" -#include "../TrigL2PhotonFexMT.h" +#include "../TrigEgammaFastPhotonFexMT.h" #include "TrigEgammaHypo/TrigL2PhotonHypo.h" #include "TrigEgammaHypo/TrigEFDielectronMassHypo.h" #include "TrigEgammaHypo/TrigEFDielectronMassFex.h" @@ -13,17 +13,17 @@ #include "TrigEgammaHypo/TrigEFPhotonHypo.h" #include "TrigEgammaHypo/TrigEFTrackHypo.h" #include "TrigEgammaHypo/TrigL2CaloLayersHypo.h" -#include "../TrigL2CaloHypoAlgMT.h" -#include "../TrigL2CaloHypoToolInc.h" +#include "../TrigEgammaFastCaloHypoAlgMT.h" +#include "../TrigEgammaFastCaloHypoToolInc.h" #include "../TrigEgammaPrecisionCaloHypoToolInc.h" #include "../TrigEgammaPrecisionPhotonHypoToolInc.h" #include "../TrigEgammaPrecisionElectronHypoToolInc.h" -#include "../TrigL2CaloHypoToolMult.h" -#include "../TrigL2ElectronHypoTool.h" -#include "../TrigL2ElectronFexMT.h" -#include "../TrigL2ElectronHypoAlgMT.h" -#include "../TrigL2PhotonHypoAlgMT.h" -#include "../TrigL2PhotonHypoTool.h" +#include "../TrigEgammaFastCaloHypoToolMult.h" +#include "../TrigEgammaFastElectronHypoTool.h" +#include "../TrigEgammaFastElectronFexMT.h" +#include "../TrigEgammaFastElectronHypoAlgMT.h" +#include "../TrigEgammaFastPhotonHypoAlgMT.h" +#include "../TrigEgammaFastPhotonHypoTool.h" #include "../TrigEgammaPrecisionCaloHypoAlgMT.h" #include "../TrigEgammaPrecisionCaloHypoToolMult.h" #include "../TrigEgammaPrecisionPhotonHypoAlgMT.h" @@ -35,7 +35,7 @@ DECLARE_COMPONENT( TrigL2CaloHypo ) DECLARE_COMPONENT( TrigL2ElectronFex ) DECLARE_COMPONENT( TrigL2PhotonFex ) DECLARE_COMPONENT( TrigL2ElectronHypo ) -DECLARE_COMPONENT( TrigL2PhotonFexMT ) +DECLARE_COMPONENT( TrigEgammaFastPhotonFexMT ) DECLARE_COMPONENT( TrigL2PhotonHypo ) DECLARE_COMPONENT( TrigEFDielectronMassHypo ) DECLARE_COMPONENT( TrigEFDielectronMassFex ) @@ -46,17 +46,17 @@ DECLARE_COMPONENT( TrigEFElectronHypo ) DECLARE_COMPONENT( TrigEFPhotonHypo ) DECLARE_COMPONENT( TrigEFTrackHypo ) DECLARE_COMPONENT( TrigL2CaloLayersHypo ) -DECLARE_COMPONENT( TrigL2CaloHypoAlgMT ) -DECLARE_COMPONENT( TrigL2ElectronHypoAlgMT ) -DECLARE_COMPONENT( TrigL2PhotonHypoAlgMT ) -DECLARE_COMPONENT( TrigL2CaloHypoToolInc ) +DECLARE_COMPONENT( TrigEgammaFastCaloHypoAlgMT ) +DECLARE_COMPONENT( TrigEgammaFastElectronHypoAlgMT ) +DECLARE_COMPONENT( TrigEgammaFastPhotonHypoAlgMT ) +DECLARE_COMPONENT( TrigEgammaFastCaloHypoToolInc ) DECLARE_COMPONENT( TrigEgammaPrecisionCaloHypoToolInc ) DECLARE_COMPONENT( TrigEgammaPrecisionPhotonHypoToolInc ) DECLARE_COMPONENT( TrigEgammaPrecisionElectronHypoToolInc ) -DECLARE_COMPONENT( TrigL2CaloHypoToolMult ) -DECLARE_COMPONENT( TrigL2ElectronHypoTool ) -DECLARE_COMPONENT( TrigL2ElectronFexMT ) -DECLARE_COMPONENT( TrigL2PhotonHypoTool ) +DECLARE_COMPONENT( TrigEgammaFastCaloHypoToolMult ) +DECLARE_COMPONENT( TrigEgammaFastElectronHypoTool ) +DECLARE_COMPONENT( TrigEgammaFastElectronFexMT ) +DECLARE_COMPONENT( TrigEgammaFastPhotonHypoTool ) DECLARE_COMPONENT( TrigEgammaPrecisionCaloHypoAlgMT ) DECLARE_COMPONENT( TrigEgammaPrecisionCaloHypoToolMult ) DECLARE_COMPONENT( TrigEgammaPrecisionPhotonHypoAlgMT ) diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.h b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.h index 790c5cb9f2ccd595c172751b235c76cfdd075d20..d5ad83573d558d25d9f5c953cf41360bca911be1 100755 --- a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.h +++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/HLTBjetMonTool.h @@ -66,7 +66,7 @@ class HLTBjetMonTool : public IHLTMonTool { std::map<std::string,std::string> m_Chain2Dir; std::vector<std::string> m_Shifter_jSplit, m_Expert_jSplit, m_Shifter_jUnSplit, m_Expert_jUnSplit, m_Shifter_mujet, m_Expert_mujet; - Gaudi::Property<std::string> m_onlineBjetContainerKey {this,"OnlineBJetContainerKey","HLT_GSCJet", + Gaudi::Property<std::string> m_onlineBjetContainerKey {this,"OnlineBJetContainerKey","HLT_bJets", "The SG key of the online BJet container from the TriggerEDMRun3"}; SG::ReadHandleKey<xAOD::VertexContainer> m_offlineVertexContainerKey {this,"OfflineVertexContainerName","PrimaryVertices","Key of offline primary vertexes"}; diff --git a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.h b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.h index 565bae13e0d6fa10e7588a92948fe96754dbd669..d23758c0211bd4bbddbf6cf878337b42f2cc5db6 100644 --- a/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigBjetMonitoring/src/TrigBjetMonitorAlgorithm.h @@ -25,7 +25,7 @@ class TrigBjetMonitorAlgorithm : public AthMonitorAlgorithm { private: // Gaudi::Property<bool> m_doRandom {this,"RandomHist",false}; Gaudi::Property<bool> m_doRandom {this,"RandomHist",true}; - Gaudi::Property<std::string> m_onlineBjetContainerKey {this,"OnlineBJetContainerKey","HLT_GSCJet", + Gaudi::Property<std::string> m_onlineBjetContainerKey {this,"OnlineBJetContainerKey","HLT_bJets", "The SG key of the online BJet container from the TriggerEDMRun3"}; // const std::vector<std::string> m_allChains; std::vector<std::string> m_allChains; diff --git a/Trigger/TrigMonitoring/TrigCostMonitor/python/TrigCostMonitorConfig.py b/Trigger/TrigMonitoring/TrigCostMonitor/python/TrigCostMonitorConfig.py index 16a0099c20c9a2cee04c8ed3e76a37e5a9b368d3..a1403b2efe15647a66cd8e5902e5ca36e5559628 100644 --- a/Trigger/TrigMonitoring/TrigCostMonitor/python/TrigCostMonitorConfig.py +++ b/Trigger/TrigMonitoring/TrigCostMonitor/python/TrigCostMonitorConfig.py @@ -416,13 +416,13 @@ def configSteeringOPI(topSeq, name, config, log): trigSteer.LvlConverterTool.Lvl1ResultAccessTool.ignorePrescales=True log.info('Set '+name+'.LvlConverterTool.Lvl1ResultAccessTool.ignorePrescales=True') - if trigSteer.LvlConverterTool.properties().has_key('ignoreL1Prescales'): + if 'ignoreL1Prescales' in trigSteer.LvlConverterTool.properties(): trigSteer.LvlConverterTool.ignoreL1Prescales = True log.info('Set '+name+'.LvlConverterTool.ignoreL1Prescales = True') else: log.info('Missing property: '+name+'.LvlConverterTool.ignoreL1Prescales') - if trigSteer.properties().has_key('OPITools'): + if 'OPITools' in trigSteer.properties(): for tool in trigSteer.OPITools: if tool.getType().count('TrigCostTool'): tool.writeAlways = True @@ -484,7 +484,7 @@ def setSteerDebug(name, option, log): if hasattr(topSeq, name): trigSteer = getattr(topSeq, name) - if not trigSteer.properties().has_key('OPITools'): + if not 'OPITools' in trigSteer.properties(): return for tool in trigSteer.OPITools: @@ -562,13 +562,13 @@ def postSetupOnlineCost(): topSeq.TrigSteer_L2.doOperationalInfo=steeringL2_online_doOperationalInfo log.info('Set TrigSteer_L2.doOperationalInfo='+str(topSeq.TrigSteer_L2.doOperationalInfo)) - if topSeq.TrigSteer_L2.properties().has_key('OPITools'): + if 'OPITools' in topSeq.TrigSteer_L2.properties(): for tool in topSeq.TrigSteer_L2.OPITools: if tool.getType().count('TrigCostTool'): tool.doOperationalInfo = steeringL2_online_doOperationalInfo log.info('Set '+tool.name()+'.doOperationalInfo='+str(topSeq.TrigSteer_L2.doOperationalInfo)) - if svcMgr.ROBDataProviderSvc.properties().has_key('doDetailedROBMonitoring'): + if 'doDetailedROBMonitoring' in svcMgr.ROBDataProviderSvc.properties(): svcMgr.ROBDataProviderSvc.doDetailedROBMonitoring = True log.info('Set ROBDataProviderSvc.doDetailedROBMonitoring=True') @@ -576,7 +576,7 @@ def postSetupOnlineCost(): topSeq.TrigSteer_EF.doOperationalInfo=steeringEF_online_doOperationalInfo log.info('Set TrigSteer_EF.doOperationalInfo='+str(topSeq.TrigSteer_EF.doOperationalInfo)) - if topSeq.TrigSteer_EF.properties().has_key('OPITools'): + if 'OPITools' in topSeq.TrigSteer_EF.properties(): for tool in topSeq.TrigSteer_EF.OPITools: if tool.getType().count('TrigCostTool'): tool.doOperationalInfo = steeringEF_online_doOperationalInfo @@ -586,13 +586,13 @@ def postSetupOnlineCost(): topSeq.TrigSteer_HLT.doOperationalInfo=steeringHLT_online_doOperationalInfo log.info('Set TrigSteer_HLT.doOperationalInfo='+str(topSeq.TrigSteer_HLT.doOperationalInfo)) - if topSeq.TrigSteer_HLT.properties().has_key('OPITools'): + if 'OPITools' in topSeq.TrigSteer_HLT.properties(): for tool in topSeq.TrigSteer_HLT.OPITools: if tool.getType().count('TrigCostTool'): tool.doOperationalInfo = steeringHLT_online_doOperationalInfo log.info('Set '+tool.name()+'.doOperationalInfo='+str(topSeq.TrigSteer_HLT.doOperationalInfo)) - if svcMgr.ROBDataProviderSvc.properties().has_key('doDetailedROBMonitoring'): + if 'doDetailedROBMonitoring' in svcMgr.ROBDataProviderSvc.properties(): svcMgr.ROBDataProviderSvc.doDetailedROBMonitoring = True log.info('Set ROBDataProviderSvc.doDetailedROBMonitoring=True') else: @@ -628,7 +628,7 @@ def postSetupCostForCAF(): topSeq = AlgSequence() if hasattr(topSeq, 'TrigSteer_L2'): - if topSeq.TrigSteer_L2.properties().has_key('OPITools'): + if 'OPITools' in topSeq.TrigSteer_L2.properties(): for tool in topSeq.TrigSteer_L2.OPITools: if tool.getType().count('TrigCostTool'): tool.writeAlways = True @@ -636,7 +636,7 @@ def postSetupCostForCAF(): log.info('Set '+tool.name()+'.writeAlways = True') if hasattr(topSeq, 'TrigSteer_EF'): - if topSeq.TrigSteer_EF.properties().has_key('OPITools'): + if 'OPITools' in topSeq.TrigSteer_EF.properties(): for tool in topSeq.TrigSteer_EF.OPITools: if tool.getType().count('TrigCostTool'): tool.writeAlways = True @@ -644,7 +644,7 @@ def postSetupCostForCAF(): log.info('Set '+tool.name()+'.writeAlways = True') if hasattr(topSeq, 'TrigSteer_HLT'): - if topSeq.TrigSteer_HLT.properties().has_key('OPITools'): + if 'OPITools' in topSeq.TrigSteer_HLT.properties(): for tool in topSeq.TrigSteer_HLT.OPITools: if tool.getType().count('TrigCostTool'): tool.writeAlways = True @@ -661,21 +661,21 @@ def postSetupEBWeighting(): topSeq = AlgSequence() if hasattr(topSeq, 'TrigSteer_L2'): - if topSeq.TrigSteer_L2.properties().has_key('OPITools'): + if 'OPITools' in topSeq.TrigSteer_L2.properties(): for tool in topSeq.TrigSteer_L2.OPITools: if tool.getType().count('TrigCostTool'): tool.doEBWeight = True log.info('Set '+tool.name()+'.doEBWeight = True') if hasattr(topSeq, 'TrigSteer_EF'): - if topSeq.TrigSteer_EF.properties().has_key('OPITools'): + if 'OPITools' in topSeq.TrigSteer_EF.properties(): for tool in topSeq.TrigSteer_EF.OPITools: if tool.getType().count('TrigCostTool'): tool.doEBWeight = True log.info('Set '+tool.name()+'.doEBWeight = True') if hasattr(topSeq, 'TrigSteer_HLT'): - if topSeq.TrigSteer_HLT.properties().has_key('OPITools'): + if 'OPITools' in topSeq.TrigSteer_HLT.properties(): for tool in topSeq.TrigSteer_HLT.OPITools: if tool.getType().count('TrigCostTool'): tool.doEBWeight = True diff --git a/Trigger/TrigMonitoring/TrigCostMonitor/share/offlineROSCost2012.py b/Trigger/TrigMonitoring/TrigCostMonitor/share/offlineROSCost2012.py deleted file mode 100644 index db385bef8bd9fe2b28aa13cbb2252e01c7fe22cb..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigCostMonitor/share/offlineROSCost2012.py +++ /dev/null @@ -1,1639 +0,0 @@ -### This is a temp include to get ROS cost from offline running of the trigger with 2012 data. When we have a map for 2015 data, we will integrate this -### into the cost infrastructure such that it becomes automatic - -try: - from AthenaCommon.Logging import logging - log = logging.getLogger('offlineROSCost2012.py') - log.info('Enabling offline ROS cost monitoring for run 1 data.') - - from AthenaCommon.Include import include, IncludeError - include("TrigROBDataProviderSvc/TrigROBDataProviderSvc.py") - svcMgr.ROBDataProviderSvc.PrintStackTraceGetROBData = False - - # This ROB-ROS map was generated by generate-rob-ros-map-from-data.py - # Current date and time is 2014-11-10 11:23:52.444569 - # - # These unique identifiers were extracted from: - # root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/trig-daq/validation/test_data/data12_8TeV.00212967.physics_eb_zee_zmumu_cc._0001.data - # - svcMgr.ROBDataProviderSvc.RobRosMapping = { - # - # ROB id : ROS id = SubDetector Id - # - # 01 : Sub Detector = PIXEL_BARREL - 0x111705 : 0x11 , - 0x111706 : 0x11 , - 0x111707 : 0x11 , - 0x111708 : 0x11 , - 0x111709 : 0x11 , - 0x111710 : 0x11 , - 0x111711 : 0x11 , - 0x111712 : 0x11 , - 0x111714 : 0x11 , - 0x111715 : 0x11 , - 0x111716 : 0x11 , - 0x111717 : 0x11 , - 0x111718 : 0x11 , - 0x111719 : 0x11 , - 0x111720 : 0x11 , - 0x111721 : 0x11 , - 0x111805 : 0x11 , - 0x111806 : 0x11 , - 0x111807 : 0x11 , - 0x111808 : 0x11 , - 0x111809 : 0x11 , - 0x111810 : 0x11 , - 0x111811 : 0x11 , - 0x111812 : 0x11 , - 0x111814 : 0x11 , - 0x111815 : 0x11 , - 0x111816 : 0x11 , - 0x111817 : 0x11 , - 0x111818 : 0x11 , - 0x111819 : 0x11 , - 0x111820 : 0x11 , - 0x111821 : 0x11 , - 0x112405 : 0x11 , - 0x112406 : 0x11 , - 0x112407 : 0x11 , - 0x112408 : 0x11 , - 0x112409 : 0x11 , - 0x112410 : 0x11 , - 0x112411 : 0x11 , - 0x112412 : 0x11 , - 0x112414 : 0x11 , - 0x112415 : 0x11 , - 0x112416 : 0x11 , - 0x112417 : 0x11 , - 0x112418 : 0x11 , - 0x112419 : 0x11 , - 0x112420 : 0x11 , - 0x112421 : 0x11 , - 0x112505 : 0x11 , - 0x112506 : 0x11 , - 0x112507 : 0x11 , - 0x112508 : 0x11 , - 0x112509 : 0x11 , - 0x112510 : 0x11 , - 0x112511 : 0x11 , - 0x112512 : 0x11 , - 0x112514 : 0x11 , - 0x112515 : 0x11 , - 0x112516 : 0x11 , - 0x112517 : 0x11 , - 0x112518 : 0x11 , - 0x112519 : 0x11 , - 0x112520 : 0x11 , - 0x112521 : 0x11 , - # 02 : Sub Detector = PIXEL_DISK_SIDE - 0x120205 : 0x12 , - 0x120206 : 0x12 , - 0x120207 : 0x12 , - 0x120208 : 0x12 , - 0x120209 : 0x12 , - 0x120210 : 0x12 , - 0x120211 : 0x12 , - 0x120212 : 0x12 , - 0x120214 : 0x12 , - 0x120215 : 0x12 , - 0x120216 : 0x12 , - 0x120217 : 0x12 , - 0x120218 : 0x12 , - 0x120219 : 0x12 , - 0x120220 : 0x12 , - 0x120221 : 0x12 , - 0x121609 : 0x12 , - 0x121610 : 0x12 , - 0x121611 : 0x12 , - 0x121612 : 0x12 , - 0x121614 : 0x12 , - 0x121615 : 0x12 , - 0x121616 : 0x12 , - 0x121617 : 0x12 , - # 03 : Sub Detector = PIXEL_B_LAYER - 0x130005 : 0x13 , - 0x130006 : 0x13 , - 0x130007 : 0x13 , - 0x130008 : 0x13 , - 0x130009 : 0x13 , - 0x130010 : 0x13 , - 0x130011 : 0x13 , - 0x130012 : 0x13 , - 0x130014 : 0x13 , - 0x130015 : 0x13 , - 0x130016 : 0x13 , - 0x130017 : 0x13 , - 0x130018 : 0x13 , - 0x130019 : 0x13 , - 0x130020 : 0x13 , - 0x130021 : 0x13 , - 0x130105 : 0x13 , - 0x130106 : 0x13 , - 0x130107 : 0x13 , - 0x130108 : 0x13 , - 0x130109 : 0x13 , - 0x130110 : 0x13 , - 0x130111 : 0x13 , - 0x130112 : 0x13 , - 0x130114 : 0x13 , - 0x130115 : 0x13 , - 0x130116 : 0x13 , - 0x130117 : 0x13 , - 0x130118 : 0x13 , - 0x130119 : 0x13 , - 0x130120 : 0x13 , - 0x130121 : 0x13 , - 0x130307 : 0x13 , - 0x130308 : 0x13 , - 0x130309 : 0x13 , - 0x130310 : 0x13 , - 0x130311 : 0x13 , - 0x130312 : 0x13 , - 0x130314 : 0x13 , - 0x130315 : 0x13 , - 0x130316 : 0x13 , - 0x130317 : 0x13 , - 0x130318 : 0x13 , - 0x130319 : 0x13 , - # 04 : Sub Detector = SCT_BARREL_A_SIDE - 0x210000 : 0x21 , - 0x210001 : 0x21 , - 0x210002 : 0x21 , - 0x210003 : 0x21 , - 0x210004 : 0x21 , - 0x210005 : 0x21 , - 0x210006 : 0x21 , - 0x210007 : 0x21 , - 0x210008 : 0x21 , - 0x210009 : 0x21 , - 0x21000a : 0x21 , - 0x210100 : 0x21 , - 0x210101 : 0x21 , - 0x210102 : 0x21 , - 0x210103 : 0x21 , - 0x210104 : 0x21 , - 0x210105 : 0x21 , - 0x210106 : 0x21 , - 0x210107 : 0x21 , - 0x210108 : 0x21 , - 0x210109 : 0x21 , - 0x21010a : 0x21 , - # 05 : Sub Detector = SCT_BARREL_C_SIDE - 0x220000 : 0x22 , - 0x220001 : 0x22 , - 0x220002 : 0x22 , - 0x220003 : 0x22 , - 0x220004 : 0x22 , - 0x220005 : 0x22 , - 0x220006 : 0x22 , - 0x220007 : 0x22 , - 0x220008 : 0x22 , - 0x220009 : 0x22 , - 0x22000a : 0x22 , - 0x220100 : 0x22 , - 0x220101 : 0x22 , - 0x220102 : 0x22 , - 0x220103 : 0x22 , - 0x220104 : 0x22 , - 0x220105 : 0x22 , - 0x220106 : 0x22 , - 0x220107 : 0x22 , - 0x220108 : 0x22 , - 0x220109 : 0x22 , - 0x22010a : 0x22 , - # 06 : Sub Detector = SCT_ENDCAP_A_SIDE - 0x230000 : 0x23 , - 0x230001 : 0x23 , - 0x230002 : 0x23 , - 0x230003 : 0x23 , - 0x230004 : 0x23 , - 0x230005 : 0x23 , - 0x230006 : 0x23 , - 0x230007 : 0x23 , - 0x230008 : 0x23 , - 0x230009 : 0x23 , - 0x23000a : 0x23 , - 0x230100 : 0x23 , - 0x230101 : 0x23 , - 0x230102 : 0x23 , - 0x230103 : 0x23 , - 0x230104 : 0x23 , - 0x230105 : 0x23 , - 0x230106 : 0x23 , - 0x230107 : 0x23 , - 0x230108 : 0x23 , - 0x230109 : 0x23 , - 0x23010a : 0x23 , - 0x23010b : 0x23 , - # 07 : Sub Detector = SCT_ENDCAP_C_SIDE - 0x240000 : 0x24 , - 0x240001 : 0x24 , - 0x240002 : 0x24 , - 0x240003 : 0x24 , - 0x240004 : 0x24 , - 0x240005 : 0x24 , - 0x240006 : 0x24 , - 0x240007 : 0x24 , - 0x240008 : 0x24 , - 0x240009 : 0x24 , - 0x24000a : 0x24 , - 0x24000b : 0x24 , - 0x240100 : 0x24 , - 0x240101 : 0x24 , - 0x240102 : 0x24 , - 0x240103 : 0x24 , - 0x240104 : 0x24 , - 0x240105 : 0x24 , - 0x240106 : 0x24 , - 0x240107 : 0x24 , - 0x240108 : 0x24 , - 0x240109 : 0x24 , - 0x24010a : 0x24 , - # 08 : Sub Detector = TRT_BARREL_A_SIDE - 0x310100 : 0x31 , - 0x310200 : 0x31 , - 0x310300 : 0x31 , - 0x310400 : 0x31 , - 0x310500 : 0x31 , - 0x310600 : 0x31 , - 0x310700 : 0x31 , - 0x310800 : 0x31 , - 0x310900 : 0x31 , - 0x310a00 : 0x31 , - 0x310b00 : 0x31 , - 0x310c00 : 0x31 , - 0x310d00 : 0x31 , - 0x310e00 : 0x31 , - 0x310f00 : 0x31 , - 0x311000 : 0x31 , - 0x311100 : 0x31 , - 0x311200 : 0x31 , - 0x311300 : 0x31 , - 0x311400 : 0x31 , - 0x311500 : 0x31 , - 0x311600 : 0x31 , - 0x311700 : 0x31 , - 0x311800 : 0x31 , - 0x311900 : 0x31 , - 0x311a00 : 0x31 , - 0x311b00 : 0x31 , - 0x311c00 : 0x31 , - 0x311d00 : 0x31 , - 0x311e00 : 0x31 , - 0x311f00 : 0x31 , - 0x312000 : 0x31 , - # 09 : Sub Detector = TRT_BARREL_C_SIDE - 0x320100 : 0x32 , - 0x320200 : 0x32 , - 0x320300 : 0x32 , - 0x320400 : 0x32 , - 0x320500 : 0x32 , - 0x320600 : 0x32 , - 0x320700 : 0x32 , - 0x320800 : 0x32 , - 0x320900 : 0x32 , - 0x320a00 : 0x32 , - 0x320b00 : 0x32 , - 0x320c00 : 0x32 , - 0x320d00 : 0x32 , - 0x320e00 : 0x32 , - 0x320f00 : 0x32 , - 0x321000 : 0x32 , - 0x321100 : 0x32 , - 0x321200 : 0x32 , - 0x321300 : 0x32 , - 0x321400 : 0x32 , - 0x321500 : 0x32 , - 0x321600 : 0x32 , - 0x321700 : 0x32 , - 0x321800 : 0x32 , - 0x321900 : 0x32 , - 0x321a00 : 0x32 , - 0x321b00 : 0x32 , - 0x321c00 : 0x32 , - 0x321d00 : 0x32 , - 0x321e00 : 0x32 , - 0x321f00 : 0x32 , - 0x322000 : 0x32 , - # 10 : Sub Detector = TRT_ENDCAP_A_SIDE - 0x330101 : 0x33 , - 0x330102 : 0x33 , - 0x330201 : 0x33 , - 0x330202 : 0x33 , - 0x330301 : 0x33 , - 0x330302 : 0x33 , - 0x330401 : 0x33 , - 0x330402 : 0x33 , - 0x330501 : 0x33 , - 0x330502 : 0x33 , - 0x330601 : 0x33 , - 0x330602 : 0x33 , - 0x330701 : 0x33 , - 0x330702 : 0x33 , - 0x330801 : 0x33 , - 0x330802 : 0x33 , - 0x330901 : 0x33 , - 0x330902 : 0x33 , - 0x330a01 : 0x33 , - 0x330a02 : 0x33 , - 0x330b01 : 0x33 , - 0x330b02 : 0x33 , - 0x330c01 : 0x33 , - 0x330c02 : 0x33 , - 0x330d01 : 0x33 , - 0x330d02 : 0x33 , - 0x330e01 : 0x33 , - 0x330e02 : 0x33 , - 0x330f01 : 0x33 , - 0x330f02 : 0x33 , - 0x331001 : 0x33 , - 0x331002 : 0x33 , - 0x331101 : 0x33 , - 0x331102 : 0x33 , - 0x331201 : 0x33 , - 0x331202 : 0x33 , - 0x331301 : 0x33 , - 0x331302 : 0x33 , - 0x331401 : 0x33 , - 0x331402 : 0x33 , - 0x331501 : 0x33 , - 0x331502 : 0x33 , - 0x331601 : 0x33 , - 0x331602 : 0x33 , - 0x331701 : 0x33 , - 0x331702 : 0x33 , - 0x331801 : 0x33 , - 0x331802 : 0x33 , - 0x331901 : 0x33 , - 0x331902 : 0x33 , - 0x331a01 : 0x33 , - 0x331a02 : 0x33 , - 0x331b01 : 0x33 , - 0x331b02 : 0x33 , - 0x331c01 : 0x33 , - 0x331c02 : 0x33 , - 0x331d01 : 0x33 , - 0x331d02 : 0x33 , - 0x331e01 : 0x33 , - 0x331e02 : 0x33 , - 0x331f01 : 0x33 , - 0x331f02 : 0x33 , - 0x332001 : 0x33 , - 0x332002 : 0x33 , - # 11 : Sub Detector = TRT_ENDCAP_C_SIDE - 0x340101 : 0x34 , - 0x340102 : 0x34 , - 0x340201 : 0x34 , - 0x340202 : 0x34 , - 0x340301 : 0x34 , - 0x340302 : 0x34 , - 0x340401 : 0x34 , - 0x340402 : 0x34 , - 0x340501 : 0x34 , - 0x340502 : 0x34 , - 0x340601 : 0x34 , - 0x340602 : 0x34 , - 0x340701 : 0x34 , - 0x340702 : 0x34 , - 0x340801 : 0x34 , - 0x340802 : 0x34 , - 0x340901 : 0x34 , - 0x340902 : 0x34 , - 0x340a01 : 0x34 , - 0x340a02 : 0x34 , - 0x340b01 : 0x34 , - 0x340b02 : 0x34 , - 0x340c01 : 0x34 , - 0x340c02 : 0x34 , - 0x340d01 : 0x34 , - 0x340d02 : 0x34 , - 0x340e01 : 0x34 , - 0x340e02 : 0x34 , - 0x340f01 : 0x34 , - 0x340f02 : 0x34 , - 0x341001 : 0x34 , - 0x341002 : 0x34 , - 0x341101 : 0x34 , - 0x341102 : 0x34 , - 0x341201 : 0x34 , - 0x341202 : 0x34 , - 0x341301 : 0x34 , - 0x341302 : 0x34 , - 0x341401 : 0x34 , - 0x341402 : 0x34 , - 0x341501 : 0x34 , - 0x341502 : 0x34 , - 0x341601 : 0x34 , - 0x341602 : 0x34 , - 0x341701 : 0x34 , - 0x341702 : 0x34 , - 0x341801 : 0x34 , - 0x341802 : 0x34 , - 0x341901 : 0x34 , - 0x341902 : 0x34 , - 0x341a01 : 0x34 , - 0x341a02 : 0x34 , - 0x341b01 : 0x34 , - 0x341b02 : 0x34 , - 0x341c01 : 0x34 , - 0x341c02 : 0x34 , - 0x341d01 : 0x34 , - 0x341d02 : 0x34 , - 0x341e01 : 0x34 , - 0x341e02 : 0x34 , - 0x341f01 : 0x34 , - 0x341f02 : 0x34 , - 0x342001 : 0x34 , - 0x342002 : 0x34 , - # 12 : Sub Detector = LAR_EM_BARREL_A_SIDE - 0x410000 : 0x41 , - 0x410001 : 0x41 , - 0x410002 : 0x41 , - 0x410003 : 0x41 , - 0x410004 : 0x41 , - 0x410005 : 0x41 , - 0x410006 : 0x41 , - 0x410007 : 0x41 , - 0x410008 : 0x41 , - 0x410009 : 0x41 , - 0x41000a : 0x41 , - 0x41000b : 0x41 , - 0x41000c : 0x41 , - 0x41000d : 0x41 , - 0x41000e : 0x41 , - 0x41000f : 0x41 , - 0x410010 : 0x41 , - 0x410011 : 0x41 , - 0x410012 : 0x41 , - 0x410013 : 0x41 , - 0x410014 : 0x41 , - 0x410015 : 0x41 , - 0x410016 : 0x41 , - 0x410017 : 0x41 , - 0x410018 : 0x41 , - 0x410019 : 0x41 , - 0x41001a : 0x41 , - 0x41001b : 0x41 , - 0x41001c : 0x41 , - 0x41001d : 0x41 , - 0x41001e : 0x41 , - 0x41001f : 0x41 , - 0x410020 : 0x41 , - 0x410021 : 0x41 , - 0x410022 : 0x41 , - 0x410023 : 0x41 , - 0x410024 : 0x41 , - 0x410025 : 0x41 , - 0x410026 : 0x41 , - 0x410027 : 0x41 , - 0x410028 : 0x41 , - 0x410029 : 0x41 , - 0x41002a : 0x41 , - 0x41002b : 0x41 , - 0x41002c : 0x41 , - 0x41002d : 0x41 , - 0x41002e : 0x41 , - 0x41002f : 0x41 , - 0x410030 : 0x41 , - 0x410031 : 0x41 , - 0x410032 : 0x41 , - 0x410033 : 0x41 , - 0x410034 : 0x41 , - 0x410035 : 0x41 , - 0x410036 : 0x41 , - 0x410037 : 0x41 , - 0x410038 : 0x41 , - 0x410039 : 0x41 , - 0x41003a : 0x41 , - 0x41003b : 0x41 , - 0x41003c : 0x41 , - 0x41003d : 0x41 , - 0x41003e : 0x41 , - 0x41003f : 0x41 , - 0x410040 : 0x41 , - 0x410041 : 0x41 , - 0x410042 : 0x41 , - 0x410043 : 0x41 , - 0x410044 : 0x41 , - 0x410045 : 0x41 , - 0x410046 : 0x41 , - 0x410047 : 0x41 , - 0x410048 : 0x41 , - 0x410049 : 0x41 , - 0x41004a : 0x41 , - 0x41004b : 0x41 , - 0x41004c : 0x41 , - 0x41004d : 0x41 , - 0x41004e : 0x41 , - 0x41004f : 0x41 , - 0x410050 : 0x41 , - 0x410051 : 0x41 , - 0x410052 : 0x41 , - 0x410053 : 0x41 , - 0x410054 : 0x41 , - 0x410055 : 0x41 , - 0x410056 : 0x41 , - 0x410057 : 0x41 , - 0x410058 : 0x41 , - 0x410059 : 0x41 , - 0x41005a : 0x41 , - 0x41005b : 0x41 , - 0x41005c : 0x41 , - 0x41005d : 0x41 , - 0x41005e : 0x41 , - 0x41005f : 0x41 , - 0x410060 : 0x41 , - 0x410061 : 0x41 , - 0x410062 : 0x41 , - 0x410063 : 0x41 , - 0x410064 : 0x41 , - 0x410065 : 0x41 , - 0x410066 : 0x41 , - 0x410067 : 0x41 , - 0x410068 : 0x41 , - 0x410069 : 0x41 , - 0x41006a : 0x41 , - 0x41006b : 0x41 , - 0x41006c : 0x41 , - 0x41006d : 0x41 , - 0x41006e : 0x41 , - 0x41006f : 0x41 , - 0x410070 : 0x41 , - 0x410071 : 0x41 , - 0x410072 : 0x41 , - 0x410073 : 0x41 , - 0x410074 : 0x41 , - 0x410075 : 0x41 , - 0x410076 : 0x41 , - 0x410077 : 0x41 , - 0x410078 : 0x41 , - 0x410079 : 0x41 , - 0x41007a : 0x41 , - 0x41007b : 0x41 , - 0x41007c : 0x41 , - 0x41007d : 0x41 , - 0x41007e : 0x41 , - 0x41007f : 0x41 , - 0x410080 : 0x41 , - 0x410081 : 0x41 , - 0x410082 : 0x41 , - 0x410083 : 0x41 , - 0x410084 : 0x41 , - 0x410085 : 0x41 , - 0x410086 : 0x41 , - 0x410087 : 0x41 , - 0x410088 : 0x41 , - 0x410089 : 0x41 , - 0x41008a : 0x41 , - 0x41008b : 0x41 , - 0x41008c : 0x41 , - 0x41008d : 0x41 , - 0x41008e : 0x41 , - 0x41008f : 0x41 , - 0x410090 : 0x41 , - 0x410091 : 0x41 , - 0x410092 : 0x41 , - 0x410093 : 0x41 , - 0x410094 : 0x41 , - 0x410095 : 0x41 , - 0x410096 : 0x41 , - 0x410097 : 0x41 , - 0x410098 : 0x41 , - 0x410099 : 0x41 , - 0x41009a : 0x41 , - 0x41009b : 0x41 , - 0x41009c : 0x41 , - 0x41009d : 0x41 , - 0x41009e : 0x41 , - 0x41009f : 0x41 , - 0x4100a0 : 0x41 , - 0x4100a1 : 0x41 , - 0x4100a2 : 0x41 , - 0x4100a3 : 0x41 , - 0x4100a4 : 0x41 , - 0x4100a5 : 0x41 , - 0x4100a6 : 0x41 , - 0x4100a7 : 0x41 , - 0x4100a8 : 0x41 , - 0x4100a9 : 0x41 , - 0x4100aa : 0x41 , - 0x4100ab : 0x41 , - 0x4100ac : 0x41 , - 0x4100ad : 0x41 , - 0x4100ae : 0x41 , - 0x4100af : 0x41 , - 0x4100b0 : 0x41 , - 0x4100b1 : 0x41 , - 0x4100b2 : 0x41 , - 0x4100b3 : 0x41 , - 0x4100b4 : 0x41 , - 0x4100b5 : 0x41 , - 0x4100b6 : 0x41 , - 0x4100b7 : 0x41 , - 0x4100b8 : 0x41 , - 0x4100b9 : 0x41 , - 0x4100ba : 0x41 , - 0x4100bb : 0x41 , - 0x4100bc : 0x41 , - 0x4100bd : 0x41 , - 0x4100be : 0x41 , - 0x4100bf : 0x41 , - 0x4100c0 : 0x41 , - 0x4100c1 : 0x41 , - 0x4100c2 : 0x41 , - 0x4100c3 : 0x41 , - 0x4100c4 : 0x41 , - 0x4100c5 : 0x41 , - 0x4100c6 : 0x41 , - 0x4100c7 : 0x41 , - 0x4100c8 : 0x41 , - 0x4100c9 : 0x41 , - 0x4100ca : 0x41 , - 0x4100cb : 0x41 , - 0x4100cc : 0x41 , - 0x4100cd : 0x41 , - 0x4100ce : 0x41 , - 0x4100cf : 0x41 , - 0x4100d0 : 0x41 , - 0x4100d1 : 0x41 , - 0x4100d2 : 0x41 , - 0x4100d3 : 0x41 , - 0x4100d4 : 0x41 , - 0x4100d5 : 0x41 , - 0x4100d6 : 0x41 , - 0x4100d7 : 0x41 , - 0x4100d8 : 0x41 , - 0x4100d9 : 0x41 , - 0x4100da : 0x41 , - 0x4100db : 0x41 , - 0x4100dc : 0x41 , - 0x4100dd : 0x41 , - 0x4100de : 0x41 , - 0x4100df : 0x41 , - # 13 : Sub Detector = LAR_EM_BARREL_C_SIDE - 0x420000 : 0x42 , - 0x420001 : 0x42 , - 0x420002 : 0x42 , - 0x420003 : 0x42 , - 0x420004 : 0x42 , - 0x420005 : 0x42 , - 0x420006 : 0x42 , - 0x420007 : 0x42 , - 0x420008 : 0x42 , - 0x420009 : 0x42 , - 0x42000a : 0x42 , - 0x42000b : 0x42 , - 0x42000c : 0x42 , - 0x42000d : 0x42 , - 0x42000e : 0x42 , - 0x42000f : 0x42 , - 0x420010 : 0x42 , - 0x420011 : 0x42 , - 0x420012 : 0x42 , - 0x420013 : 0x42 , - 0x420014 : 0x42 , - 0x420015 : 0x42 , - 0x420016 : 0x42 , - 0x420017 : 0x42 , - 0x420018 : 0x42 , - 0x420019 : 0x42 , - 0x42001a : 0x42 , - 0x42001b : 0x42 , - 0x42001c : 0x42 , - 0x42001d : 0x42 , - 0x42001e : 0x42 , - 0x42001f : 0x42 , - 0x420020 : 0x42 , - 0x420021 : 0x42 , - 0x420022 : 0x42 , - 0x420023 : 0x42 , - 0x420024 : 0x42 , - 0x420025 : 0x42 , - 0x420026 : 0x42 , - 0x420027 : 0x42 , - 0x420028 : 0x42 , - 0x420029 : 0x42 , - 0x42002a : 0x42 , - 0x42002b : 0x42 , - 0x42002c : 0x42 , - 0x42002d : 0x42 , - 0x42002e : 0x42 , - 0x42002f : 0x42 , - 0x420030 : 0x42 , - 0x420031 : 0x42 , - 0x420032 : 0x42 , - 0x420033 : 0x42 , - 0x420034 : 0x42 , - 0x420035 : 0x42 , - 0x420036 : 0x42 , - 0x420037 : 0x42 , - 0x420038 : 0x42 , - 0x420039 : 0x42 , - 0x42003a : 0x42 , - 0x42003b : 0x42 , - 0x42003c : 0x42 , - 0x42003d : 0x42 , - 0x42003e : 0x42 , - 0x42003f : 0x42 , - 0x420040 : 0x42 , - 0x420041 : 0x42 , - 0x420042 : 0x42 , - 0x420043 : 0x42 , - 0x420044 : 0x42 , - 0x420045 : 0x42 , - 0x420046 : 0x42 , - 0x420047 : 0x42 , - 0x420048 : 0x42 , - 0x420049 : 0x42 , - 0x42004a : 0x42 , - 0x42004b : 0x42 , - 0x42004c : 0x42 , - 0x42004d : 0x42 , - 0x42004e : 0x42 , - 0x42004f : 0x42 , - 0x420050 : 0x42 , - 0x420051 : 0x42 , - 0x420052 : 0x42 , - 0x420053 : 0x42 , - 0x420054 : 0x42 , - 0x420055 : 0x42 , - 0x420056 : 0x42 , - 0x420057 : 0x42 , - 0x420058 : 0x42 , - 0x420059 : 0x42 , - 0x42005a : 0x42 , - 0x42005b : 0x42 , - 0x42005c : 0x42 , - 0x42005d : 0x42 , - 0x42005e : 0x42 , - 0x42005f : 0x42 , - 0x420060 : 0x42 , - 0x420061 : 0x42 , - 0x420062 : 0x42 , - 0x420063 : 0x42 , - 0x420064 : 0x42 , - 0x420065 : 0x42 , - 0x420066 : 0x42 , - 0x420067 : 0x42 , - 0x420068 : 0x42 , - 0x420069 : 0x42 , - 0x42006a : 0x42 , - 0x42006b : 0x42 , - 0x42006c : 0x42 , - 0x42006d : 0x42 , - 0x42006e : 0x42 , - 0x42006f : 0x42 , - 0x420070 : 0x42 , - 0x420071 : 0x42 , - 0x420072 : 0x42 , - 0x420073 : 0x42 , - 0x420074 : 0x42 , - 0x420075 : 0x42 , - 0x420076 : 0x42 , - 0x420077 : 0x42 , - 0x420078 : 0x42 , - 0x420079 : 0x42 , - 0x42007a : 0x42 , - 0x42007b : 0x42 , - 0x42007c : 0x42 , - 0x42007d : 0x42 , - 0x42007e : 0x42 , - 0x42007f : 0x42 , - 0x420080 : 0x42 , - 0x420081 : 0x42 , - 0x420082 : 0x42 , - 0x420083 : 0x42 , - 0x420084 : 0x42 , - 0x420085 : 0x42 , - 0x420086 : 0x42 , - 0x420087 : 0x42 , - 0x420088 : 0x42 , - 0x420089 : 0x42 , - 0x42008a : 0x42 , - 0x42008b : 0x42 , - 0x42008c : 0x42 , - 0x42008d : 0x42 , - 0x42008e : 0x42 , - 0x42008f : 0x42 , - 0x420090 : 0x42 , - 0x420091 : 0x42 , - 0x420092 : 0x42 , - 0x420093 : 0x42 , - 0x420094 : 0x42 , - 0x420095 : 0x42 , - 0x420096 : 0x42 , - 0x420097 : 0x42 , - 0x420098 : 0x42 , - 0x420099 : 0x42 , - 0x42009a : 0x42 , - 0x42009b : 0x42 , - 0x42009c : 0x42 , - 0x42009d : 0x42 , - 0x42009e : 0x42 , - 0x42009f : 0x42 , - 0x4200a0 : 0x42 , - 0x4200a1 : 0x42 , - 0x4200a2 : 0x42 , - 0x4200a3 : 0x42 , - 0x4200a4 : 0x42 , - 0x4200a5 : 0x42 , - 0x4200a6 : 0x42 , - 0x4200a7 : 0x42 , - 0x4200a8 : 0x42 , - 0x4200a9 : 0x42 , - 0x4200aa : 0x42 , - 0x4200ab : 0x42 , - 0x4200ac : 0x42 , - 0x4200ad : 0x42 , - 0x4200ae : 0x42 , - 0x4200af : 0x42 , - 0x4200b0 : 0x42 , - 0x4200b1 : 0x42 , - 0x4200b2 : 0x42 , - 0x4200b3 : 0x42 , - 0x4200b4 : 0x42 , - 0x4200b5 : 0x42 , - 0x4200b6 : 0x42 , - 0x4200b7 : 0x42 , - 0x4200b8 : 0x42 , - 0x4200b9 : 0x42 , - 0x4200ba : 0x42 , - 0x4200bb : 0x42 , - 0x4200bc : 0x42 , - 0x4200bd : 0x42 , - 0x4200be : 0x42 , - 0x4200bf : 0x42 , - 0x4200c0 : 0x42 , - 0x4200c1 : 0x42 , - 0x4200c2 : 0x42 , - 0x4200c3 : 0x42 , - 0x4200c4 : 0x42 , - 0x4200c5 : 0x42 , - 0x4200c6 : 0x42 , - 0x4200c7 : 0x42 , - 0x4200c8 : 0x42 , - 0x4200c9 : 0x42 , - 0x4200ca : 0x42 , - 0x4200cb : 0x42 , - 0x4200cc : 0x42 , - 0x4200cd : 0x42 , - 0x4200ce : 0x42 , - 0x4200cf : 0x42 , - 0x4200d0 : 0x42 , - 0x4200d1 : 0x42 , - 0x4200d2 : 0x42 , - 0x4200d3 : 0x42 , - 0x4200d4 : 0x42 , - 0x4200d5 : 0x42 , - 0x4200d6 : 0x42 , - 0x4200d7 : 0x42 , - 0x4200d8 : 0x42 , - 0x4200d9 : 0x42 , - 0x4200da : 0x42 , - 0x4200db : 0x42 , - 0x4200dc : 0x42 , - 0x4200dd : 0x42 , - 0x4200de : 0x42 , - 0x4200df : 0x42 , - # 14 : Sub Detector = LAR_EM_ENDCAP_A_SIDE - 0x430000 : 0x43 , - 0x430001 : 0x43 , - 0x430002 : 0x43 , - 0x430003 : 0x43 , - 0x430004 : 0x43 , - 0x430005 : 0x43 , - 0x430006 : 0x43 , - 0x430007 : 0x43 , - 0x430008 : 0x43 , - 0x430009 : 0x43 , - 0x43000a : 0x43 , - 0x43000b : 0x43 , - 0x43000c : 0x43 , - 0x43000d : 0x43 , - 0x43000e : 0x43 , - 0x43000f : 0x43 , - 0x430010 : 0x43 , - 0x430011 : 0x43 , - 0x430012 : 0x43 , - 0x430013 : 0x43 , - 0x430014 : 0x43 , - 0x430015 : 0x43 , - 0x430016 : 0x43 , - 0x430017 : 0x43 , - 0x430018 : 0x43 , - 0x430019 : 0x43 , - 0x43001a : 0x43 , - 0x43001b : 0x43 , - 0x43001c : 0x43 , - 0x43001d : 0x43 , - 0x43001e : 0x43 , - 0x43001f : 0x43 , - 0x430020 : 0x43 , - 0x430021 : 0x43 , - 0x430022 : 0x43 , - 0x430023 : 0x43 , - 0x430024 : 0x43 , - 0x430025 : 0x43 , - 0x430026 : 0x43 , - 0x430027 : 0x43 , - 0x430028 : 0x43 , - 0x430029 : 0x43 , - 0x43002a : 0x43 , - 0x43002b : 0x43 , - 0x43002c : 0x43 , - 0x43002d : 0x43 , - 0x43002e : 0x43 , - 0x43002f : 0x43 , - 0x430030 : 0x43 , - 0x430031 : 0x43 , - 0x430032 : 0x43 , - 0x430033 : 0x43 , - 0x430034 : 0x43 , - 0x430035 : 0x43 , - 0x430036 : 0x43 , - 0x430037 : 0x43 , - 0x430038 : 0x43 , - 0x430039 : 0x43 , - 0x43003a : 0x43 , - 0x43003b : 0x43 , - 0x43003c : 0x43 , - 0x43003d : 0x43 , - 0x43003e : 0x43 , - 0x43003f : 0x43 , - 0x430040 : 0x43 , - 0x430041 : 0x43 , - 0x430042 : 0x43 , - 0x430043 : 0x43 , - 0x430044 : 0x43 , - 0x430045 : 0x43 , - 0x430046 : 0x43 , - 0x430047 : 0x43 , - 0x430048 : 0x43 , - 0x430049 : 0x43 , - 0x43004a : 0x43 , - 0x43004b : 0x43 , - 0x43004c : 0x43 , - 0x43004d : 0x43 , - 0x43004e : 0x43 , - 0x43004f : 0x43 , - 0x430050 : 0x43 , - 0x430051 : 0x43 , - 0x430052 : 0x43 , - 0x430053 : 0x43 , - 0x430054 : 0x43 , - 0x430055 : 0x43 , - 0x430056 : 0x43 , - 0x430057 : 0x43 , - 0x430058 : 0x43 , - 0x430059 : 0x43 , - 0x43005a : 0x43 , - 0x43005b : 0x43 , - 0x43005c : 0x43 , - 0x43005d : 0x43 , - 0x43005e : 0x43 , - 0x43005f : 0x43 , - 0x430060 : 0x43 , - 0x430061 : 0x43 , - 0x430062 : 0x43 , - 0x430063 : 0x43 , - 0x430064 : 0x43 , - 0x430065 : 0x43 , - 0x430066 : 0x43 , - 0x430067 : 0x43 , - 0x430068 : 0x43 , - 0x430069 : 0x43 , - 0x43006a : 0x43 , - 0x43006b : 0x43 , - 0x43006c : 0x43 , - 0x43006d : 0x43 , - 0x43006e : 0x43 , - 0x43006f : 0x43 , - 0x430070 : 0x43 , - 0x430071 : 0x43 , - 0x430072 : 0x43 , - 0x430073 : 0x43 , - 0x430074 : 0x43 , - 0x430075 : 0x43 , - 0x430076 : 0x43 , - 0x430077 : 0x43 , - 0x430078 : 0x43 , - 0x430079 : 0x43 , - 0x43007a : 0x43 , - 0x43007b : 0x43 , - 0x43007c : 0x43 , - 0x43007d : 0x43 , - 0x43007e : 0x43 , - 0x43007f : 0x43 , - 0x430080 : 0x43 , - 0x430081 : 0x43 , - 0x430082 : 0x43 , - 0x430083 : 0x43 , - 0x430084 : 0x43 , - 0x430085 : 0x43 , - 0x430086 : 0x43 , - 0x430087 : 0x43 , - 0x430088 : 0x43 , - 0x430089 : 0x43 , - # 15 : Sub Detector = LAR_EM_ENDCAP_C_SIDE - 0x440000 : 0x44 , - 0x440001 : 0x44 , - 0x440002 : 0x44 , - 0x440003 : 0x44 , - 0x440004 : 0x44 , - 0x440005 : 0x44 , - 0x440006 : 0x44 , - 0x440007 : 0x44 , - 0x440008 : 0x44 , - 0x440009 : 0x44 , - 0x44000a : 0x44 , - 0x44000b : 0x44 , - 0x44000c : 0x44 , - 0x44000d : 0x44 , - 0x44000e : 0x44 , - 0x44000f : 0x44 , - 0x440010 : 0x44 , - 0x440011 : 0x44 , - 0x440012 : 0x44 , - 0x440013 : 0x44 , - 0x440014 : 0x44 , - 0x440015 : 0x44 , - 0x440016 : 0x44 , - 0x440017 : 0x44 , - 0x440018 : 0x44 , - 0x440019 : 0x44 , - 0x44001a : 0x44 , - 0x44001b : 0x44 , - 0x44001c : 0x44 , - 0x44001d : 0x44 , - 0x44001e : 0x44 , - 0x44001f : 0x44 , - 0x440020 : 0x44 , - 0x440021 : 0x44 , - 0x440022 : 0x44 , - 0x440023 : 0x44 , - 0x440024 : 0x44 , - 0x440025 : 0x44 , - 0x440026 : 0x44 , - 0x440027 : 0x44 , - 0x440028 : 0x44 , - 0x440029 : 0x44 , - 0x44002a : 0x44 , - 0x44002b : 0x44 , - 0x44002c : 0x44 , - 0x44002d : 0x44 , - 0x44002e : 0x44 , - 0x44002f : 0x44 , - 0x440030 : 0x44 , - 0x440031 : 0x44 , - 0x440032 : 0x44 , - 0x440033 : 0x44 , - 0x440034 : 0x44 , - 0x440035 : 0x44 , - 0x440036 : 0x44 , - 0x440037 : 0x44 , - 0x440038 : 0x44 , - 0x440039 : 0x44 , - 0x44003a : 0x44 , - 0x44003b : 0x44 , - 0x44003c : 0x44 , - 0x44003d : 0x44 , - 0x44003e : 0x44 , - 0x44003f : 0x44 , - 0x440040 : 0x44 , - 0x440041 : 0x44 , - 0x440042 : 0x44 , - 0x440043 : 0x44 , - 0x440044 : 0x44 , - 0x440045 : 0x44 , - 0x440046 : 0x44 , - 0x440047 : 0x44 , - 0x440048 : 0x44 , - 0x440049 : 0x44 , - 0x44004a : 0x44 , - 0x44004b : 0x44 , - 0x44004c : 0x44 , - 0x44004d : 0x44 , - 0x44004e : 0x44 , - 0x44004f : 0x44 , - 0x440050 : 0x44 , - 0x440051 : 0x44 , - 0x440052 : 0x44 , - 0x440053 : 0x44 , - 0x440054 : 0x44 , - 0x440055 : 0x44 , - 0x440056 : 0x44 , - 0x440057 : 0x44 , - 0x440058 : 0x44 , - 0x440059 : 0x44 , - 0x44005a : 0x44 , - 0x44005b : 0x44 , - 0x44005c : 0x44 , - 0x44005d : 0x44 , - 0x44005e : 0x44 , - 0x44005f : 0x44 , - 0x440060 : 0x44 , - 0x440061 : 0x44 , - 0x440062 : 0x44 , - 0x440063 : 0x44 , - 0x440064 : 0x44 , - 0x440065 : 0x44 , - 0x440066 : 0x44 , - 0x440067 : 0x44 , - 0x440068 : 0x44 , - 0x440069 : 0x44 , - 0x44006a : 0x44 , - 0x44006b : 0x44 , - 0x44006c : 0x44 , - 0x44006d : 0x44 , - 0x44006e : 0x44 , - 0x44006f : 0x44 , - 0x440070 : 0x44 , - 0x440071 : 0x44 , - 0x440072 : 0x44 , - 0x440073 : 0x44 , - 0x440074 : 0x44 , - 0x440075 : 0x44 , - 0x440076 : 0x44 , - 0x440077 : 0x44 , - 0x440078 : 0x44 , - 0x440079 : 0x44 , - 0x44007a : 0x44 , - 0x44007b : 0x44 , - 0x44007c : 0x44 , - 0x44007d : 0x44 , - 0x44007e : 0x44 , - 0x44007f : 0x44 , - 0x440080 : 0x44 , - 0x440081 : 0x44 , - 0x440082 : 0x44 , - 0x440083 : 0x44 , - 0x440084 : 0x44 , - 0x440085 : 0x44 , - 0x440086 : 0x44 , - 0x440087 : 0x44 , - 0x440088 : 0x44 , - 0x440089 : 0x44 , - # 16 : Sub Detector = LAR_HAD_ENDCAP_A_SIDE - 0x450000 : 0x45 , - 0x450001 : 0x45 , - 0x450002 : 0x45 , - 0x450003 : 0x45 , - 0x450004 : 0x45 , - 0x450005 : 0x45 , - 0x450006 : 0x45 , - 0x450007 : 0x45 , - 0x450008 : 0x45 , - 0x450009 : 0x45 , - 0x45000a : 0x45 , - 0x45000b : 0x45 , - # 17 : Sub Detector = LAR_HAD_ENDCAP_C_SIDE - 0x460000 : 0x46 , - 0x460001 : 0x46 , - 0x460002 : 0x46 , - 0x460003 : 0x46 , - 0x460004 : 0x46 , - 0x460005 : 0x46 , - 0x460006 : 0x46 , - 0x460007 : 0x46 , - 0x460008 : 0x46 , - 0x460009 : 0x46 , - 0x46000a : 0x46 , - 0x46000b : 0x46 , - # 18 : Sub Detector = LAR_FCAL_A_SIDE - 0x470000 : 0x47 , - 0x470001 : 0x47 , - 0x470002 : 0x47 , - 0x470003 : 0x47 , - 0x470004 : 0x47 , - 0x470005 : 0x47 , - 0x470006 : 0x47 , - # 19 : Sub Detector = LAR_FCAL_C_SIDE - 0x480000 : 0x48 , - 0x480001 : 0x48 , - 0x480002 : 0x48 , - 0x480003 : 0x48 , - 0x480004 : 0x48 , - 0x480005 : 0x48 , - 0x480006 : 0x48 , - # 20 : Sub Detector = TILECAL_BARREL_A_SIDE - 0x510000 : 0x51 , - 0x510001 : 0x51 , - 0x510002 : 0x51 , - 0x510003 : 0x51 , - 0x510004 : 0x51 , - 0x510005 : 0x51 , - 0x510006 : 0x51 , - 0x510007 : 0x51 , - 0x510008 : 0x51 , - 0x510009 : 0x51 , - 0x51000a : 0x51 , - 0x51000b : 0x51 , - 0x51000c : 0x51 , - 0x51000d : 0x51 , - 0x51000e : 0x51 , - 0x51000f : 0x51 , - # 21 : Sub Detector = TILECAL_BARREL_C_SIDE - 0x520000 : 0x52 , - 0x520001 : 0x52 , - 0x520002 : 0x52 , - 0x520003 : 0x52 , - 0x520004 : 0x52 , - 0x520005 : 0x52 , - 0x520006 : 0x52 , - 0x520007 : 0x52 , - 0x520008 : 0x52 , - 0x520009 : 0x52 , - 0x52000a : 0x52 , - 0x52000b : 0x52 , - 0x52000c : 0x52 , - 0x52000d : 0x52 , - 0x52000e : 0x52 , - 0x52000f : 0x52 , - 0x520010 : 0x52 , - # 22 : Sub Detector = TILECAL_EXT_A_SIDE - 0x530000 : 0x53 , - 0x530001 : 0x53 , - 0x530002 : 0x53 , - 0x530003 : 0x53 , - 0x530004 : 0x53 , - 0x530005 : 0x53 , - 0x530006 : 0x53 , - 0x530007 : 0x53 , - 0x530008 : 0x53 , - 0x530009 : 0x53 , - 0x53000a : 0x53 , - 0x53000b : 0x53 , - 0x53000c : 0x53 , - 0x53000d : 0x53 , - 0x53000e : 0x53 , - 0x53000f : 0x53 , - # 23 : Sub Detector = TILECAL_EXT_C_SIDE - 0x540000 : 0x54 , - 0x540001 : 0x54 , - 0x540002 : 0x54 , - 0x540003 : 0x54 , - 0x540004 : 0x54 , - 0x540005 : 0x54 , - 0x540006 : 0x54 , - 0x540007 : 0x54 , - 0x540008 : 0x54 , - 0x540009 : 0x54 , - 0x54000a : 0x54 , - 0x54000b : 0x54 , - 0x54000c : 0x54 , - 0x54000d : 0x54 , - 0x54000e : 0x54 , - 0x54000f : 0x54 , - # 24 : Sub Detector = MUON_MDT_BARREL_A_SIDE - 0x610000 : 0x61 , - 0x610001 : 0x61 , - 0x610002 : 0x61 , - 0x610003 : 0x61 , - 0x610004 : 0x61 , - 0x610005 : 0x61 , - 0x610006 : 0x61 , - 0x610007 : 0x61 , - 0x610008 : 0x61 , - 0x610009 : 0x61 , - 0x61000a : 0x61 , - 0x61000b : 0x61 , - 0x61000c : 0x61 , - 0x61000d : 0x61 , - 0x61000e : 0x61 , - 0x61000f : 0x61 , - 0x610010 : 0x61 , - 0x610011 : 0x61 , - 0x610012 : 0x61 , - 0x610013 : 0x61 , - 0x610014 : 0x61 , - 0x610015 : 0x61 , - 0x610016 : 0x61 , - 0x610017 : 0x61 , - 0x610018 : 0x61 , - 0x610019 : 0x61 , - 0x61001a : 0x61 , - 0x61001b : 0x61 , - 0x61001c : 0x61 , - 0x61001d : 0x61 , - 0x61001e : 0x61 , - 0x61001f : 0x61 , - 0x610020 : 0x61 , - 0x610021 : 0x61 , - 0x610022 : 0x61 , - 0x610023 : 0x61 , - 0x610024 : 0x61 , - 0x610025 : 0x61 , - 0x610026 : 0x61 , - 0x610027 : 0x61 , - 0x610028 : 0x61 , - 0x610029 : 0x61 , - 0x61002a : 0x61 , - 0x61002b : 0x61 , - 0x61002c : 0x61 , - 0x61002d : 0x61 , - 0x61002e : 0x61 , - 0x61002f : 0x61 , - 0x610030 : 0x61 , - 0x610031 : 0x61 , - # 25 : Sub Detector = MUON_MDT_BARREL_C_SIDE - 0x620000 : 0x62 , - 0x620001 : 0x62 , - 0x620002 : 0x62 , - 0x620003 : 0x62 , - 0x620004 : 0x62 , - 0x620005 : 0x62 , - 0x620006 : 0x62 , - 0x620007 : 0x62 , - 0x620008 : 0x62 , - 0x620009 : 0x62 , - 0x62000a : 0x62 , - 0x62000b : 0x62 , - 0x62000c : 0x62 , - 0x62000d : 0x62 , - 0x62000e : 0x62 , - 0x62000f : 0x62 , - 0x620010 : 0x62 , - 0x620011 : 0x62 , - 0x620012 : 0x62 , - 0x620013 : 0x62 , - 0x620014 : 0x62 , - 0x620015 : 0x62 , - 0x620016 : 0x62 , - 0x620017 : 0x62 , - 0x620018 : 0x62 , - 0x620019 : 0x62 , - 0x62001a : 0x62 , - 0x62001b : 0x62 , - 0x62001c : 0x62 , - 0x62001d : 0x62 , - 0x62001e : 0x62 , - 0x62001f : 0x62 , - 0x620020 : 0x62 , - 0x620021 : 0x62 , - 0x620022 : 0x62 , - 0x620023 : 0x62 , - 0x620024 : 0x62 , - 0x620025 : 0x62 , - 0x620026 : 0x62 , - 0x620027 : 0x62 , - 0x620028 : 0x62 , - 0x620029 : 0x62 , - 0x62002a : 0x62 , - 0x62002b : 0x62 , - 0x62002c : 0x62 , - 0x62002d : 0x62 , - 0x62002e : 0x62 , - 0x62002f : 0x62 , - 0x620030 : 0x62 , - 0x620031 : 0x62 , - # 26 : Sub Detector = MUON_MDT_ENDCAP_A_SIDE - 0x630000 : 0x63 , - 0x630001 : 0x63 , - 0x630002 : 0x63 , - 0x630003 : 0x63 , - 0x630004 : 0x63 , - 0x630005 : 0x63 , - 0x630006 : 0x63 , - 0x630007 : 0x63 , - 0x630008 : 0x63 , - 0x630009 : 0x63 , - 0x63000a : 0x63 , - 0x63000b : 0x63 , - 0x63000c : 0x63 , - 0x63000d : 0x63 , - 0x63000e : 0x63 , - 0x63000f : 0x63 , - 0x630010 : 0x63 , - 0x630011 : 0x63 , - 0x630012 : 0x63 , - 0x630013 : 0x63 , - 0x630014 : 0x63 , - 0x630015 : 0x63 , - 0x630016 : 0x63 , - 0x630017 : 0x63 , - 0x630018 : 0x63 , - 0x630019 : 0x63 , - 0x63001a : 0x63 , - 0x63001b : 0x63 , - 0x63001c : 0x63 , - 0x63001d : 0x63 , - 0x63001e : 0x63 , - 0x63001f : 0x63 , - 0x630020 : 0x63 , - 0x630021 : 0x63 , - 0x630022 : 0x63 , - 0x630023 : 0x63 , - 0x630024 : 0x63 , - 0x630025 : 0x63 , - 0x630026 : 0x63 , - 0x630027 : 0x63 , - 0x630028 : 0x63 , - 0x630029 : 0x63 , - 0x63002a : 0x63 , - 0x63002b : 0x63 , - 0x63002c : 0x63 , - 0x63002d : 0x63 , - 0x63002e : 0x63 , - 0x63002f : 0x63 , - 0x630030 : 0x63 , - 0x630031 : 0x63 , - 0x630032 : 0x63 , - 0x630033 : 0x63 , - # 27 : Sub Detector = MUON_MDT_ENDCAP_C_SIDE - 0x640000 : 0x64 , - 0x640001 : 0x64 , - 0x640002 : 0x64 , - 0x640003 : 0x64 , - 0x640004 : 0x64 , - 0x640005 : 0x64 , - 0x640006 : 0x64 , - 0x640007 : 0x64 , - 0x640008 : 0x64 , - 0x640009 : 0x64 , - 0x64000a : 0x64 , - 0x64000b : 0x64 , - 0x64000c : 0x64 , - 0x64000d : 0x64 , - 0x64000e : 0x64 , - 0x64000f : 0x64 , - 0x640010 : 0x64 , - 0x640011 : 0x64 , - 0x640012 : 0x64 , - 0x640013 : 0x64 , - 0x640014 : 0x64 , - 0x640015 : 0x64 , - 0x640016 : 0x64 , - 0x640017 : 0x64 , - 0x640018 : 0x64 , - 0x640019 : 0x64 , - 0x64001a : 0x64 , - 0x64001b : 0x64 , - 0x64001c : 0x64 , - 0x64001d : 0x64 , - 0x64001e : 0x64 , - 0x64001f : 0x64 , - 0x640020 : 0x64 , - 0x640021 : 0x64 , - 0x640022 : 0x64 , - 0x640023 : 0x64 , - 0x640024 : 0x64 , - 0x640025 : 0x64 , - 0x640026 : 0x64 , - 0x640027 : 0x64 , - 0x640028 : 0x64 , - 0x640029 : 0x64 , - 0x64002a : 0x64 , - 0x64002b : 0x64 , - 0x64002c : 0x64 , - 0x64002d : 0x64 , - 0x64002e : 0x64 , - 0x64002f : 0x64 , - 0x640030 : 0x64 , - 0x640031 : 0x64 , - 0x640032 : 0x64 , - 0x640033 : 0x64 , - # 28 : Sub Detector = MUON_RPC_BARREL_A_SIDE - 0x650000 : 0x65 , - 0x650001 : 0x65 , - 0x650002 : 0x65 , - 0x650003 : 0x65 , - 0x650004 : 0x65 , - 0x650005 : 0x65 , - 0x650006 : 0x65 , - 0x650007 : 0x65 , - 0x650008 : 0x65 , - 0x650009 : 0x65 , - 0x65000a : 0x65 , - 0x65000b : 0x65 , - 0x65000c : 0x65 , - 0x65000d : 0x65 , - 0x65000e : 0x65 , - 0x65000f : 0x65 , - # 29 : Sub Detector = MUON_RPC_BARREL_C_SIDE - 0x660000 : 0x66 , - 0x660001 : 0x66 , - 0x660002 : 0x66 , - 0x660003 : 0x66 , - 0x660004 : 0x66 , - 0x660005 : 0x66 , - 0x660006 : 0x66 , - 0x660007 : 0x66 , - 0x660008 : 0x66 , - 0x660009 : 0x66 , - 0x66000a : 0x66 , - 0x66000b : 0x66 , - 0x66000c : 0x66 , - 0x66000d : 0x66 , - 0x66000e : 0x66 , - 0x66000f : 0x66 , - # 30 : Sub Detector = MUON_TGC_ENDCAP_A_SIDE - 0x670001 : 0x67 , - 0x670002 : 0x67 , - 0x670003 : 0x67 , - 0x670004 : 0x67 , - 0x670005 : 0x67 , - 0x670006 : 0x67 , - 0x670007 : 0x67 , - 0x670008 : 0x67 , - 0x670009 : 0x67 , - 0x67000a : 0x67 , - 0x67000b : 0x67 , - 0x67000c : 0x67 , - # 31 : Sub Detector = MUON_TGC_ENDCAP_C_SIDE - 0x680001 : 0x68 , - 0x680002 : 0x68 , - 0x680003 : 0x68 , - 0x680004 : 0x68 , - 0x680005 : 0x68 , - 0x680006 : 0x68 , - 0x680007 : 0x68 , - 0x680008 : 0x68 , - 0x680009 : 0x68 , - 0x68000a : 0x68 , - 0x68000b : 0x68 , - 0x68000c : 0x68 , - # 32 : Sub Detector = MUON_CSC_ENDCAP_A_SIDE - 0x690005 : 0x69 , - 0x690007 : 0x69 , - 0x690009 : 0x69 , - 0x690011 : 0x69 , - 0x690015 : 0x69 , - 0x690017 : 0x69 , - 0x690019 : 0x69 , - 0x690021 : 0x69 , - # 33 : Sub Detector = MUON_CSC_ENDCAP_C_SIDE - 0x6a0005 : 0x6a , - 0x6a0007 : 0x6a , - 0x6a0009 : 0x6a , - 0x6a0011 : 0x6a , - 0x6a0015 : 0x6a , - 0x6a0017 : 0x6a , - 0x6a0019 : 0x6a , - 0x6a0021 : 0x6a , - # 34 : Sub Detector = TDAQ_CALO_PREPROC - 0x710000 : 0x71 , - 0x710001 : 0x71 , - 0x710002 : 0x71 , - 0x710003 : 0x71 , - 0x710004 : 0x71 , - 0x710005 : 0x71 , - 0x710006 : 0x71 , - 0x710007 : 0x71 , - 0x710010 : 0x71 , - 0x710011 : 0x71 , - 0x710012 : 0x71 , - 0x710013 : 0x71 , - 0x710014 : 0x71 , - 0x710015 : 0x71 , - 0x710016 : 0x71 , - 0x710017 : 0x71 , - 0x710020 : 0x71 , - 0x710021 : 0x71 , - 0x710022 : 0x71 , - 0x710023 : 0x71 , - 0x710024 : 0x71 , - 0x710025 : 0x71 , - 0x710026 : 0x71 , - 0x710027 : 0x71 , - 0x710030 : 0x71 , - 0x710031 : 0x71 , - 0x710032 : 0x71 , - 0x710033 : 0x71 , - 0x710034 : 0x71 , - 0x710035 : 0x71 , - 0x710036 : 0x71 , - 0x710037 : 0x71 , - # 35 : Sub Detector = TDAQ_CALO_CLUSTER_PROC_DAQ - 0x720008 : 0x72 , - 0x720009 : 0x72 , - 0x72000a : 0x72 , - 0x72000b : 0x72 , - 0x720028 : 0x72 , - 0x720029 : 0x72 , - 0x72002a : 0x72 , - 0x72002b : 0x72 , - # 36 : Sub Detector = TDAQ_CALO_JET_PROC_DAQ - 0x74000c : 0x74 , - 0x74000d : 0x74 , - 0x74001c : 0x74 , - 0x74001d : 0x74 , - 0x74002c : 0x74 , - 0x74002d : 0x74 , - 0x74003c : 0x74 , - 0x74003d : 0x74 , - # 37 : Sub Detector = TDAQ_MUON_CTP_INTERFACE - 0x760000 : 0x76 , - # 38 : Sub Detector = TDAQ_CTP - 0x770000 : 0x77 , - # 39 : Sub Detector = FORWARD_BCM - 0x81000a : 0x81 , - 0x81000c : 0x81 , - 0x81004a : 0x81 , - 0x81004c : 0x81 , - # 40 : Sub Detector = FORWARD_LUCID - 0x820000 : 0x82 , - } -except: - print ' Cannot use full TrigROBDataProviderSvc - Trigger Cost Monitoring will not have ROS monitoring.' - - diff --git a/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostMTSvc.cxx b/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostMTSvc.cxx index 0ad970083cb8b4048817764ba9bade0a17b8460b..4ae5460b558cdd9bf93c4a4c26fe66ad0cc8c683 100644 --- a/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostMTSvc.cxx +++ b/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostMTSvc.cxx @@ -19,7 +19,9 @@ m_eventMonitored(), m_slotMutex(), m_algStartInfo(), m_algStopTime(), -m_threadToAlgMap() +m_threadToAlgMap(), +m_threadToCounterMap(), +m_threadCounter(0) { ATH_MSG_DEBUG("TrigCostMTSvc regular constructor"); } @@ -191,6 +193,32 @@ StatusCode TrigCostMTSvc::endEvent(const EventContext& context, SG::WriteHandle< // we can now perform whole-map inspection of this event's TrigCostDataStores without the danger that it will be changed further + // Let's start by getting the global STOP time we just wrote + uint64_t eventStopTime = 0; + { + const AlgorithmIdentifier myAi = AlgorithmIdentifierMaker::make(context, m_decisionSummaryMakerAlgName, msg()); + ATH_CHECK( myAi.isValid() ); + tbb::concurrent_hash_map<AlgorithmIdentifier, TrigTimeStamp, AlgorithmIdentifierHashCompare>::const_accessor stopTimeAcessor; + if (m_algStopTime.retrieve(myAi, stopTimeAcessor).isFailure()) { + ATH_MSG_ERROR("No end time for '" << myAi.m_caller << "', '" << myAi.m_store << "'"); // Error as we JUST entered this info! + } else { // retrieve was a success + eventStopTime = stopTimeAcessor->second.microsecondsSinceEpoch(); + } + } + + // And the global START time for the event + uint64_t eventStartTime = 0; + { + const AlgorithmIdentifier l1DecoderAi = AlgorithmIdentifierMaker::make(context, m_l1DecoderName, msg()); + ATH_CHECK( l1DecoderAi.isValid() ); + tbb::concurrent_hash_map<AlgorithmIdentifier, AlgorithmPayload, AlgorithmIdentifierHashCompare>::const_accessor startAcessor; + if (m_algStartInfo.retrieve(l1DecoderAi, startAcessor).isFailure()) { + ATH_MSG_ERROR("No alg info for '" << l1DecoderAi.m_caller << "', '" << l1DecoderAi.m_store << "'"); // Error as we know this info must be present + } else { // retrieve was a success + eventStartTime = startAcessor->second.m_algStartTime.microsecondsSinceEpoch(); + } + } + // Read payloads. Write to persistent format tbb::concurrent_hash_map< AlgorithmIdentifier, AlgorithmPayload, AlgorithmIdentifierHashCompare>::const_iterator beginIt; tbb::concurrent_hash_map< AlgorithmIdentifier, AlgorithmPayload, AlgorithmIdentifierHashCompare>::const_iterator endIt; @@ -202,9 +230,10 @@ StatusCode TrigCostMTSvc::endEvent(const EventContext& context, SG::WriteHandle< for (it = beginIt; it != endIt; ++it) { const AlgorithmIdentifier& ai = it->first; const AlgorithmPayload& ap = it->second; + uint64_t startTime = ap.m_algStartTime.microsecondsSinceEpoch(); - // Can we find the end time for this alg? - uint64_t stopTime = 0; + // Can we find the end time for this alg? If not, it is probably still running. Hence we use "now" as the default time. + uint64_t stopTime = eventStopTime; { tbb::concurrent_hash_map<AlgorithmIdentifier, TrigTimeStamp, AlgorithmIdentifierHashCompare>::const_accessor stopTimeAcessor; if (m_algStopTime.retrieve(ai, stopTimeAcessor).isFailure()) { @@ -215,19 +244,62 @@ StatusCode TrigCostMTSvc::endEvent(const EventContext& context, SG::WriteHandle< // stopTimeAcessor goes out of scope - lock released } + // It is possible (when in the master-slot) to catch just the END of an Alg's exec from another slot, and then the START of the same + // alg executing in the next event in that same other-slot. + // This gives us an end time which is before the start time. Disregard these entries. + if (startTime > stopTime) { + ATH_MSG_VERBOSE("Disregard start-time:" << startTime << " > stop-time:" << stopTime + << " for " << TrigConf::HLTUtils::hash2string( ai.callerHash(), "ALG") << " in slot " << ap.m_slot << ", this is slot " << context.slot()); + continue; + } + + // Lock the start and stop times to be no later than eventStopTime. + // E.g. it's possible for an alg in another slot to start or stop running after 'processAlg(context, m_decisionSummaryMakerAlgName, AuditType::After))' + // but before 'lockUnique( m_slotMutex[ context.slot() ] )', creating a timestamp after the nominal end point for this event. + // If the alg starts afterwards, we disregard it in lieu of setting to have zero walltime. + // If the alg stops afterwards, we truncate its stop time to be no later than eventStopTime + if (startTime > eventStopTime) { + ATH_MSG_VERBOSE("Disregard " << TrigConf::HLTUtils::hash2string( ai.callerHash(), "ALG") << " as it started after endEvent() was finished being called" ); + continue; + } + if (stopTime > eventStopTime) { + ATH_MSG_VERBOSE(TrigConf::HLTUtils::hash2string( ai.callerHash(), "ALG") << " stopped after endEvent() was called, but before the cost container was locked," + << " truncating its ending time stamp from " << stopTime << " to " << eventStopTime); + stopTime = eventStopTime; + } + + // Do the same, locking the start and stop times to be no earlier than eventStartTime + // If the alg stops before eventStartTime, we disregard it in lieu of setting it to have zero walltime + // If the alg starts before eventStartTime, we truncate its start time to be no later than eventStopTime + if (stopTime < eventStartTime) { + ATH_MSG_VERBOSE("Disregard " << TrigConf::HLTUtils::hash2string( ai.callerHash(), "ALG") << " as it stopped before startEvent() was finished being called" ); + continue; + } + if (startTime < eventStartTime) { + ATH_MSG_VERBOSE(TrigConf::HLTUtils::hash2string( ai.callerHash(), "ALG") << " started just after the cost container was unlocked, but before the L1Decoder record was written." + << " truncating its starting time stamp from " << startTime << " to " << eventStartTime); + startTime = eventStartTime; + } + // Make a new TrigComposite to persist monitoring payload for this alg xAOD::TrigComposite* tc = new xAOD::TrigComposite(); outputHandle->push_back( tc ); // tc is now owned by storegate and, and has an aux store provided by the TrigCompositeCollection + // Reminder: we are under a unique mutex here + const uint32_t threadID = static_cast<uint32_t>( std::hash< std::thread::id >()(ap.m_algThreadID) ); + if (m_threadToCounterMap.count(threadID) == 0) { + m_threadToCounterMap[threadID] = m_threadCounter++; + } + bool result = true; result &= tc->setDetail("alg", ai.callerHash()); result &= tc->setDetail("store", ai.storeHash()); result &= tc->setDetail("view", ai.m_viewID); - result &= tc->setDetail("thread", static_cast<uint32_t>( std::hash< std::thread::id >()(ap.m_algThreadID) )); + result &= tc->setDetail("thread", m_threadToCounterMap[threadID]); result &= tc->setDetail("slot", ap.m_slot); result &= tc->setDetail("roi", ap.m_algROIID); - result &= tc->setDetail("start", ap.m_algStartTime.microsecondsSinceEpoch()); + result &= tc->setDetail("start", startTime); result &= tc->setDetail("stop", stopTime); if (!result) ATH_MSG_WARNING("Failed to append one or more details to trigger cost TC"); } diff --git a/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostMTSvc.h b/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostMTSvc.h index 11f6bf4f11ed77bbd1d79786f4d727c5c061f67d..a81b27025df440fbda2abdd9e2e74b2a9625241b 100644 --- a/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostMTSvc.h +++ b/Trigger/TrigMonitoring/TrigCostMonitorMT/src/TrigCostMTSvc.h @@ -129,6 +129,9 @@ class TrigCostMTSvc : public extends <AthService, ITrigCostMTSvc> { tbb::concurrent_hash_map<std::thread::id, AlgorithmIdentifier, ThreadHashCompare> m_threadToAlgMap; //!< Keeps track of what is running right now in each thread. + std::unordered_map<uint32_t, uint32_t> m_threadToCounterMap; //!< Map thread's hash ID to a counting numeral + size_t m_threadCounter; //!< Count how many unique thread ID we have seen + Gaudi::Property<bool> m_monitorAllEvents{this, "MonitorAllEvents", false, "Monitor every HLT event, e.g. for offline validation."}; Gaudi::Property<bool> m_enableMultiSlot{this, "EnableMultiSlot", true, "Monitored events in the MasterSlot collect data from events running in other slots."}; Gaudi::Property<bool> m_saveHashes{this, "SaveHashes", false, "Store a copy of the hash dictionary for easier debugging"}; @@ -136,6 +139,8 @@ class TrigCostMTSvc : public extends <AthService, ITrigCostMTSvc> { Gaudi::Property<std::string> m_l1DecoderName{this, "L1DecoderName", "L1Decoder", "The name of the Gaudi Configurable of type L1Decoder"}; Gaudi::Property<std::string> m_decisionSummaryMakerAlgName{this, "DecisionSummaryMakerAlgName", "DecisionSummaryMakerAlg", "The name of the Gaudi Configurable of type DecisionSummaryMakerAlg"}; + + }; #endif // TRIGCOSTMONITORMT_TRIGCOSTMTSVC_H diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorAlgorithm.py index 0964efc7e06d3851e9aee52c4150b13495f5591e..4795740792dc79f06235e975fa23516482229706 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitorAlgorithm.py @@ -24,7 +24,7 @@ def TrigEgammaMonConfig(inputFlags): helper = AthMonitorCfgHelper(inputFlags,'TrigEgammaAthMonitorCfg') # configure alg and ana tools from TrigEgammaMonitoring.TrigEgammaMonitoringMTConfig import TrigEgammaMonAlgBuilder - monAlgCfg = TrigEgammaMonAlgBuilder( helper, '2018', detailedHistogram=True ) # Using 2018 e/g tunings + monAlgCfg = TrigEgammaMonAlgBuilder( helper, '2018', detailedHistograms=True ) # Using 2018 e/g tunings # build monitor and book histograms monAlgCfg.configure() diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py index df57fba3030fe00f7d5ffb4bcbd923e688bb6e98..b199a1d8490e8e7007e2441afc690550a9320836 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/python/TrigEgammaMonitoringMTConfig.py @@ -106,7 +106,8 @@ class TrigEgammaMonAlgBuilder: self.activate_electron=True self.activate_photon=True - + + def configure(self): self.setProperties() self.configureMonitor() @@ -114,8 +115,6 @@ class TrigEgammaMonAlgBuilder: - - def get_monitoring_mode(self): # Implementation of https://its.cern.ch/jira/browse/ATR-13200 @@ -178,6 +177,7 @@ class TrigEgammaMonAlgBuilder: self.electronList = monitoring_electron self.photonList = monitoring_photon self.tpList = monitoringTP_electron + self.jpsiList = [] self.tagItems = [] #monitoring_tags self.jpsitagItems = [] #monitoring_jpsitags @@ -361,34 +361,77 @@ class TrigEgammaMonAlgBuilder: self.__logger.info( "Booking all histograms for alg: %s", monAlg.name ) for trigger in triggers: - self.bookL1CaloDistributions( monAlg, trigger ) - self.bookL2CaloDistributions( monAlg, trigger ) - self.bookL2ElectronDistributions( monAlg, trigger ) - self.bookEFCaloDistributions( monAlg, trigger ) - self.bookShowerShapesAndTrackingDistributions( monAlg, trigger, online=True ) - self.bookShowerShapesAndTrackingDistributions( monAlg, trigger, online=False ) - self.bookEfficiencies( monAlg, trigger, "L1Calo" ) - self.bookEfficiencies( monAlg, trigger, "L2Calo" ) - self.bookEfficiencies( monAlg, trigger, "L2" ) - self.bookEfficiencies( monAlg, trigger, "EFCalo" ) - self.bookEfficiencies( monAlg, trigger, "HLT" ) - - if self.detailedHistograms: - for pid in self.isemnames + self.lhnames: - self.bookEfficiencies( monAlg, trigger, "HLT", pid ) - self.bookEfficiencies( monAlg, trigger, "HLT", pid+"Iso" ) + + info = self.getTrigInfo(trigger) + + if info.isL1Item(): + self.bookL1CaloDistributions( monAlg, trigger ) + self.bookEfficiencies( monAlg, trigger, "L1Calo" ) + self.bookL1CaloResolutions( monAlg, trigger ) + self.bookL1CaloAbsResolutions( monAlg, trigger ) + + else: + # + # Distributions + # + self.bookL1CaloDistributions( monAlg, trigger ) + self.bookL2CaloDistributions( monAlg, trigger ) + self.bookEFCaloDistributions( monAlg, trigger ) + + self.bookL1CaloResolutions( monAlg, trigger ) + self.bookL1CaloAbsResolutions( monAlg, trigger ) + self.bookL2CaloResolutions( monAlg, trigger ) + self.bookHLTResolutions( monAlg, trigger ) + + if info.isElectron(): + self.bookL2ElectronDistributions( monAlg, trigger ) + # Offline and HLT + self.bookShowerShapesDistributions( monAlg, trigger, online=True ) + self.bookShowerShapesDistributions( monAlg, trigger, online=False ) + self.bookTrackingDistributions( monAlg, trigger, online=True ) + self.bookTrackingDistributions( monAlg, trigger, online=False ) + self.bookHLTElectronResolutions( monAlg, trigger, info.isIsolated() ) + + elif info.isPhoton(): + # Should we include L2 for photon in the future? + self.bookShowerShapesDistributions( monAlg, trigger, online=True ) + self.bookShowerShapesDistributions( monAlg, trigger, online=False ) + self.bookHLTPhotonResolutions( monAlg, trigger, info.isIsolated() ) + + + # + # Efficiecies + # + self.bookEfficiencies( monAlg, trigger, "L1Calo" ) + self.bookEfficiencies( monAlg, trigger, "L2Calo" ) + self.bookEfficiencies( monAlg, trigger, "L2" ) + self.bookEfficiencies( monAlg, trigger, "EFCalo" ) + self.bookEfficiencies( monAlg, trigger, "HLT" ) + + if self.detailedHistograms: + for pid in self.isemnames + self.lhnames: + self.bookEfficiencies( monAlg, trigger, "HLT", pid ) + self.bookEfficiencies( monAlg, trigger, "HLT", pid+"Iso" ) + + - + + def bookEvent(self, monAlg, analysis): - #cutLabels = ["Events","LAr","RetrieveElectrons","TwoElectrons","PassTrigger","EventWise","Success"] - #probeLabels=["Electrons","NotTag","OS","SS","ZMass","HasTrack","HasCluster","Eta","Et","IsGoodOQ","GoodPid","NearbyJet","Isolated"] + cutLabels = ["Events","LAr","RetrieveElectrons","TwoElectrons","PassTrigger","EventWise","Success"] + probeLabels=["Electrons","NotTag","OS","SS","ZMass","HasTrack","HasCluster","Eta","Et","IsGoodOQ","GoodPid","NearbyJet","Isolated"] + tagLabels=["Electrons","HasTrack","HasCluster","GoodPid","Et","Eta","IsGoodOQ","PassTrigger","MatchTrigger"] + # Create mon group. The group name should be the path name for map monGroup = self.addGroup( monAlg, 'Event', self.basePath+'/Expert/Event' ) - monGroup.defineHistogram(analysis+"_CutCounter", type='TH1I', path='/', title="Event Selection; Cut ; Count",xbins=6, xmin=0, xmax=6) - monGroup.defineHistogram(analysis+"_TagCutCounter", type='TH1F', path='', title="Number of Probes; Cut ; Count",xbins=12, xmin=0, xmax=12) - monGroup.defineHistogram(analysis+"_ProbeCutCounter", type='TH1F', path='', title="Number of Probes; Cut ; Count",xbins=12, xmin=0, xmax=12) + monGroup.defineHistogram(analysis+"_CutCounter", type='TH1I', path='/', title="Event Selection; Cut ; Count", + xbins=len(cutLabels), xmin=0, xmax=len(cutLabels), xlabels=cutLabels) + monGroup.defineHistogram(analysis+"_TagCutCounter", type='TH1F', path='', title="Number of Probes; Cut ; Count", + xbins=len(tagLabels), xmin=0, xmax=len(tagLabels), xlabels=tagLabels) + monGroup.defineHistogram(analysis+"_ProbeCutCounter", type='TH1F', path='', title="Number of Probes; Cut ; Count", + xbins=len(probeLabels), xmin=0, xmax=len(probeLabels), xlabels=probeLabels) monGroup.defineHistogram(analysis+"_Mee", type='TH1F', path='/', title="Offline M(ee); m_ee [GeV] ; Count",xbins=50, xmin=monAlg.ZeeLowerMass, xmax=monAlg.ZeeUpperMass) @@ -459,7 +502,7 @@ class TrigEgammaMonAlgBuilder: # # Book Shower shapes # - def bookShowerShapesAndTrackingDistributions( self, monAlg, trigger, online=True ): + def bookShowerShapesDistributions( self, monAlg, trigger, online=True ): from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F monGroup = self.addGroup( monAlg, trigger+'_Distributions_' + ("HLT" if online else "Offline"), @@ -486,6 +529,16 @@ class TrigEgammaMonAlgBuilder: self.addHistogram(monGroup, TH1F("topoetcone40_shift_rel", "(topoetcone40-2.45 GeV)/pt; (topoetcone40-2.45 GeV)/pt ; Count", 100, -0.5, 0.5)) + # + # Book Tracking + # + def bookTrackingDistributions( self, monAlg, trigger, online=True ): + + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F + monGroup = self.addGroup( monAlg, trigger+'_Distributions_' + ("HLT" if online else "Offline"), + self.basePath+'/'+trigger+'/Distributions/' + ("HLT" if online else "Offline") ) + + # Tracking quantities self.addHistogram(monGroup, TH1F("deta1", "deta1; deta1 ; Count", 40, -0.01, 0.01)) self.addHistogram(monGroup, TH1F("deta1_EMECA", "deta1 EMEC-A; deta1 ; Count", 40, -0.01, 0.01)) @@ -518,8 +571,6 @@ class TrigEgammaMonAlgBuilder: monGroup = self.addGroup( monAlg, trigger+'_Efficiency_'+level+'_'+subgroup, self.basePath+'/'+trigger+'/Efficiency/'+level+'/'+subgroup ) else: monGroup = self.addGroup( monAlg, trigger+'_Efficiency_'+level, self.basePath+'/'+trigger+'/Efficiency/'+level ) - - # Numerator self.addHistogram(monGroup, TH1F("match_pt", "Trigger Matched Offline p_{T}; p_{T} [GeV] ; Count", self._nEtbins, self._etbins)) @@ -550,11 +601,276 @@ class TrigEgammaMonAlgBuilder: + def bookL1CaloResolutions(self, monAlg, trigger): + + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F, TH2F + monGroup = self.addGroup( monAlg, trigger+'_Resolutions_L1Calo', self.basePath+'/'+trigger+'/Resolutions/L1Calo' ) + self.addHistogram(monGroup, TH1F("res_et", "E_{T} resolution; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("eta", "eta; eta ; Count", 50, -2.47, 2.47)) + + if self.detailedHistograms: + self.addHistogram(monGroup, TH2F("eta,res_et", "E_{T} resolution as function of #eta; #eta; (E_{T}(on)-E_{T}(off))/E_{T}(off); Count",50, -2.47, 2.47,50, -0.1, 0.1)) + + + + def bookL1CaloAbsResolutions(self, monAlg, trigger): + + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F, TH2F + monGroup = self.addGroup( monAlg, trigger+'_AbsResolutions_L1Calo', self.basePath+'/'+trigger+'/AbsResolutions/L1Calo' ) + self.addHistogram(monGroup, TH1F("eta", "#eta; #eta ; Count", 50, -2.47, 2.47)) + self.addHistogram(monGroup, TH1F("res_et", "E_{T} resolution; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 100, -0.1, 0.1)) + if self.detailedHistograms: + self.addHistogram(monGroup, TH2F("eta,res_et", "E_{T} resolution as function of #eta; #eta; (E_{T}(on)-E_{T}(off))/E_{T}(off); Count",50, -2.47, 2.47,50, -0.1, 0.1)) + def bookL2CaloResolutions(self, monAlg, trigger): - # + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F, TH2F + monGroup = self.addGroup( monAlg, trigger+'_Resolutions_L2Calo', self.basePath+'/'+trigger+'/Resolutions/L2Calo' ) + + # online values used to fill all 2d histograms + self.addHistogram(monGroup, TH1F("et", "E_{T}; E_{T}[GeV] ; Count", 50, 0.0, 100.)) + self.addHistogram(monGroup, TH1F("eta", "#eta; #eta ; Count", 50, -2.47, 2.47)) + + + self.addHistogram(monGroup, TH1F("res_et", "E_{T} resolution; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_eta", "#eta resolution; (#eta(on)-#eta(off))/#eta(off) ; Count", 40, -0.001, 0.001)) + self.addHistogram(monGroup, TH1F("res_phi", "#phi resolution; (#phi(on)-#phi(off))/#phi(off) ; Count", 40, -0.001, 0.001)) + self.addHistogram(monGroup, TH1F("res_ethad", "ethad resolution; (ethad(on)-ethad(off))/ethad(off) ; Count", 20, -5, 5)) + self.addHistogram(monGroup, TH1F("res_ethad1", "ethad1 resolution; (ethad1(on)-ethad1(off))/ethad1(off) ; Count", 20, -5, 5)) + self.addHistogram(monGroup, TH1F("res_Rhad", "Rhad resolution; (Rhad(on)-Rhad(off))/Rhad(off) ; Count", 20, -10., 10.)) + self.addHistogram(monGroup, TH1F("res_Rhad1", "Rhad1; Rhad1 resolution; (Rhad1(on)-Rhad1(off))/Rhad1(off)", 20, -10., 10.)) + self.addHistogram(monGroup, TH1F("res_Reta", "Reta resolution; (Reta(on)-Reta(off))/Reta(off) ; Count", 20, -0.01, 0.01)) + self.addHistogram(monGroup, TH1F("res_Rphi", "Rphi resolution; (Rphi(on)-Rphi(off))/Rphi(off) ; Count", 20, -0.01, 0.01)) + self.addHistogram(monGroup, TH1F("res_weta2", "weta2 resolution; (weta2(on)-weta2(off))/weta2(off) ; Count", 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH1F("res_f1", "f1 resolution; (f1(on)-f1(off))/f1(off) ; Count", 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH1F("res_f3", "f3 resolution; (f3(on)-f3(off))/f3(off) ; Count", 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH1F("res_eratio", "eratio resolution; (eratio(on)-eratio(off))/eratio(off) ; Count", 20, -0.001, 0.001)) + + if self.detailedHistograms: + # Book all 2D histograms + self.addHistogram(monGroup, TH2F("et,res_etVsEt", "E_{T} resolution as function of E_{T}; E_{T} [GeV]; (E_{T}(on)-E_{T}(off))/E_{T}(off); Count", + 50, 0., 100., + 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("eta,res_et", "E_{T} resolution as function of #eta; #eta; (E_{T}(on)-E_{T}(off))/E_{T}(off); Count", + 50, -2.47, 2.47, + 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("eta,res_f3", "L2Calo f3 resolution as function of #eta; #eta; (f3(on)-f3(off))/f3(off); Count", + 50, -2.47, 2.47, + 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH2F("et,res_f3", "L2Calo f3 resolution as function of E_{T}; E_{T} [GeV]; (f3(on)-f3(off))/f3(off); Count", + 50, 0., 100., + 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH2F("eta,res_f1", "L2Calo f1 resolution as function of #eta; #eta; (f1(on)-f1(off))/f1(off); Count", + 50, -2.47, 2.47, + 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH2F("et,res_f1", "L2Calo f1 resolution as function of E_{T}; E_{T} [GeV]; (f1(on)-f1(off))/f1(off); Count", + 50, 0., 100., + 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH2F("eta,res_weta2", "L2Calo weta2 resolution as function of #eta; #eta; (weta2(on)-weta2(off))/weta2(off); Count", + 50, -2.47, 2.47, + 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH2F("et,res_weta2", "L2Calo weta2 resolution as function of E_{T}; E_{T} [GeV]; (weta2(on)-weta2(off))/weta2(off); Count", + 50, 0., 100., + 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH2F("eta,res_Reta", "L2Calo Reta resolution as function of #eta; #eta; (Reta(on)-Reta(off))/Reta(off); Count", + 50, -2.47, 2.47, + 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH2F("et,res_Reta", "L2Calo Reta resolution as function of E_{T}; E_{T} [GeV]; (Reta(on)-Reta(off))/Reta(off); Count", + 50, 0., 100., + 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH2F("eta,res_Rhad1", "L2Calo E_{T} Rhad1 resolution as function of #eta; #eta; (Rhad1(on)-Rhad1(off))/Rhad1(off); Count", + 50, -2.47, 2.47, + 20, -10, 10)) + self.addHistogram(monGroup, TH2F("et,res_Rhad1", "L2Calo E_{T} RHad1 resolution as function of E_{T}; E_{T} [GeV]; (Rhad1(on)-Rhad1(off))/Rhad1(off); Count", + 50, 0., 100., + 20, -10, 10)) + self.addHistogram(monGroup, TH2F("eta,res_Rhad", "L2Calo E_{T} Rhad resolution as function of #eta; #eta; (Rhad(on)-Rhad(off))/Rhad(off); Count", + 50, -2.47, 2.47, + 20, -10, 10)) + self.addHistogram(monGroup, TH2F("et,res_Rhad", "L2Calo E_{T} RHad resolution as function of E_{T}; E_{T} [GeV]; (Rhad(on)-Rhad(off))/Rhad(off); Count", + 50, 0., 100., + 20, -10, 10)) + self.addHistogram(monGroup, TH2F("eta,res_ethad1", "L2Calo E_{T} Had1 resolution as function of #eta; #eta; (ethad1(on)-ethad1(off))/ethad1(off); Count", + 50, -2.47, 2.47, + 20, -0.5, 0.5)) + self.addHistogram(monGroup, TH2F("et,res_ethad1", "L2Calo E_{T} Had1 resolution as function of E_{T}; E_{T} [GeV]; (ethad1(on)-ethad1(off))/ethad1(off); Count", + 50, 0., 100., + 20, -0.5, 0.5)) + self.addHistogram(monGroup, TH2F("eta,res_ethad", "L2Calo E_{T} Had resolution as function of #eta; #eta; (ethad(on)-ethad(off))/ethad(off); Count", + 50, -2.47, 2.47, + 20, -0.5, 0.5)) + self.addHistogram(monGroup, TH2F("et,res_ethad", "L2Calo E_{T} Had resolution as function of E_{T}; E_{T} [GeV]; (ethad(on)-ethad(off))/ethad(off); Count", + 50, 0., 100., + 20, -0.5, 0.5)) + self.addHistogram(monGroup, TH2F("eta,res_eratio", "L2Calo eratio resolution as function of #eta; #eta; (eratio(on)-eratio(off))/eratio(off); Count", + 50, -2.47, 2.47, + 20, -0.001, 0.001)) + self.addHistogram(monGroup, TH2F("et,res_eratio", "L2Calo eratio resolution as function of E_{T}; E_{T} [GeV]; (eratio(on)-eratio(off))/eratio(off); Count", + 50, 0., 100., + 50, -0.001, 0.001)) + + + + + def bookHLTResolutions(self, monAlg, trigger): + + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F, TH2F + monGroup = self.addGroup( monAlg, trigger+'_Resolutions_HLT', self.basePath+'/'+trigger+'/Resolutions/HLT' ) + + # online values used to fill all 2d histograms + self.addHistogram(monGroup, TH1F("et", "E_{T}; E_{T}[GeV] ; Count", 50, 0.0, 100.)) + self.addHistogram(monGroup, TH1F("eta", "#eta; #eta ; Count", 50, -2.47, 2.47)) + self.addHistogram(monGroup, TH1F("mu", "#mu; #mu ; Count", 50, 0, 100)) + + + self.addHistogram(monGroup, TH1F("res_et", "E_{T} resolution; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_eta", "#eta resolution; (#eta(on)-#eta(off))/#eta(off) ; Count", 40, -0.001, 0.001)) + self.addHistogram(monGroup, TH1F("res_phi", "#phi resolution; (#phi(on)-#phi(off))/#phi(off) ; Count", 40, -0.001, 0.001)) + self.addHistogram(monGroup, TH1F("res_ethad", "ethad resolution; (ethad(on)-ethad(off))/ethad(off) ; Count", 20, -5, 5)) + self.addHistogram(monGroup, TH1F("res_ethad1", "ethad1 resolution; (ethad1(on)-ethad1(off))/ethad1(off) ; Count", 20, -5, 5)) + self.addHistogram(monGroup, TH1F("res_Rhad", "Rhad resolution; (Rhad(on)-Rhad(off))/Rhad(off) ; Count", 20, -10., 10.)) + self.addHistogram(monGroup, TH1F("res_Rhad1", "Rhad1; Rhad1 resolution; (Rhad1(on)-Rhad1(off))/Rhad1(off)", 20, -10., 10.)) + self.addHistogram(monGroup, TH1F("res_Reta", "Reta resolution; (Reta(on)-Reta(off))/Reta(off) ; Count", 20, -0.01, 0.01)) + self.addHistogram(monGroup, TH1F("res_Rphi", "Rphi resolution; (Rphi(on)-Rphi(off))/Rphi(off) ; Count", 20, -0.01, 0.01)) + self.addHistogram(monGroup, TH1F("res_weta1", "weta1 resolution; (weta1(on)-weta1(off))/weta1(off) ; Count", 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH1F("res_weta2", "weta2 resolution; (weta2(on)-weta2(off))/weta2(off) ; Count", 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH1F("res_f1", "f1 resolution; (f1(on)-f1(off))/f1(off) ; Count", 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH1F("res_f3", "f3 resolution; (f3(on)-f3(off))/f3(off) ; Count", 20, -0.05, 0.05)) + self.addHistogram(monGroup, TH1F("res_eratio", "eratio resolution; (eratio(on)-eratio(off))/eratio(off) ; Count", 20, -0.001, 0.001)) + + + self.addHistogram(monGroup, TH1F("res_etInEta0", "HLT E_{T} resolution in #eta = [0#div1.37]; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_etInEta1", "HLT E_{T} resolution in #eta = [1.37#div1.52]; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_etInEta2", "HLT E_{T} resolution in #eta = [1.55#div1.8]; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_etInEta3", "HLT E_{T} resolution in #eta = [1.8#div2.45]; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + + if self.detailedHistograms: + self.addHistogram(monGroup, TH2F("eta,res_et", "E_{T} resolution as function of #eta; #eta; (E_{T}(on)-E_{T}(off))/E_{T}(off); Count",50, -2.47, 2.47,100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("et,res_et", "E_{T} resolution as function of E_{T}; E_{T} [GeV]; (E_{T}(on)-E_{T}(off))/E_{T}(off); Count",50, 0., 100.,100, -0.1, 0.1)) + + + + def bookHLTElectronResolutions(self, monAlg, trigger, isolated=False): + + + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F, TH2F + monGroup = self.addGroup( monAlg, trigger+'_Resolutions_HLT', self.basePath+'/'+trigger+'/Resolutions/HLT' ) + + self.addHistogram(monGroup, TH1F("res_pt", "p_{T} resolution; (p_{T}(on)-p_{T}(off))/p_{T}(off) ; Count", 120, -1.5, 1.5)) + self.addHistogram(monGroup, TH1F("res_deta1", "deta1; deta1 ; (deta1(on)-deta1(off))/deta1(off)", 100, -1., 1.)) + self.addHistogram(monGroup, TH1F("res_deta2", "deta2; deta2 ; (deta2(on)-deta2(off))/deta2(off)", 100, -1., 1.)) + self.addHistogram(monGroup, TH1F("res_dphi2", "dphi2; dphi2 ; (dphi2(on)-dphi2(off))/dphi2(off)", 100, -1., 1.)) + self.addHistogram(monGroup, TH1F("res_dphiresc", "dphiresc; (dphires(on)-dphires(off))/dphires(off) ; Count", 100, -1., 1.)) + self.addHistogram(monGroup, TH1F("res_d0", "resolution d0; (d0(on)-d0(off)) ; Count", 100, -0.5, 0.5)) + self.addHistogram(monGroup, TH1F("res_d0sig", "resolution d0sig; (d0sig(on)-d0sig(off)) ; Count", 50, -10, 10)) + self.addHistogram(monGroup, TH1F("res_eprobht","resolution eProbHT; (eProbHT(on)-eProbHT(off)); Count",50, -1, 1)) + self.addHistogram(monGroup, TH1F("res_nscthits","resolution nSCTHit; (nSCTHits(on)-nSCTHits(off); Count",20, -10, 10)) + self.addHistogram(monGroup, TH1F("res_npixhits","resolution nPixHit; (nPixHits(on)-nPixHits(off)); Count",10, -5, 5)) + + self.addHistogram(monGroup, TH1F("pt", "online p_{T}; p_{T}; Count", 50, 0., 100.)) + + if self.detailedHistograms: + self.addHistogram(monGroup, TH2F("pt,res_eprobht", "eProbHT resolution as function of p_{T}; p_{T} [GeV]; (eprobHT(on)-eprobHT(off)); Count", + 50, 0., 100., + 50, -1., 1.)) + + + + if isolated: + self.addHistogram(monGroup, TH1F("res_ptcone20", "resolution ptcone20; ptcone20 (on-off)/off; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_ptcone20_rel", "resolution ptcone20/pt; ptcone20/pt (on-off)/off; Count", 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("eta,res_ptcone20_rel", "HLT ptcone20/pt resolution as function of #eta; #eta; (on-off)/off; Count", + 50, -2.47, 2.47, + 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("et,res_ptcone20_rel", "HLT ptcone20/pt resolution as function of E_{T}; E_{T} [GeV]; (on-off)/off; Count", + 50, 0., 100., + 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("mu,res_ptcone20", "HLT ptcone20 resolution as function of avg #mu; #mu; (on-off)/off; Count", + 50, 0, 100, + 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("mu,res_ptcone20_rel", "HLT ptcone20/pt resolution as function of avg #mu; #mu; (on-off)/off; Count", + 50, 0, 100, + 100, -0.1, 0.1)) + + self.addHistogram(monGroup, TH1F("res_ptvarcone20", "resolution ptvarcone20; ptvarcone20 (on-off)/off; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_ptvarcone20_rel", "resolution ptvarcone20/pt; ptvarcone20/pt (on-off)/off; Count", 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("eta,res_ptvarcone20_rel", "HLT ptvarcone20/pt resolution as function of #eta; #eta; (on-off)/off; Count", + 50, -2.47, 2.47, + 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("et,res_ptvarcone20_rel", "HLT ptvarcone20/pt resolution as function of E_{T}; E_{T} [GeV]; (on-off)/off; Count", + 50, 0., 100., + 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("mu,res_ptvarcone20", "HLT ptvarcone20 resolution as function of avg #mu; #mu; (on-off)/off; Count", + 50, 0, 100, + 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("mu,res_ptvarcone20_rel", "HLT ptvarcone20/pt resolution as function of avg #mu; #mu; (on-off)/off; Count", + 50, 0, 100, + 100, -0.1, 0.1)) + + + def bookHLTPhotonResolutions(self, monAlg, trigger, isolated=False): + + + from TrigEgammaMonitoring.TrigEgammaMonitorHelper import TH1F, TH2F + monGroup = self.addGroup( monAlg, trigger+'_Resolutions_HLT', self.basePath+'/'+trigger+'/Resolutions/HLT' ) + + self.addHistogram(monGroup, TH1F("res_et_cnv", "HLT E_{T} resolution for converted Photons; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_et_uncnv", "HLT E_{T} resolution for unconverted Photons; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_cnv_etInEta0", "HLT E_{T} resolution in #eta = [0#div1.37]; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_cnv_etInEta1", "HLT E_{T} resolution in #eta = [1.37#div1.52]; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_cnv_etInEta2", "HLT E_{T} resolution in #eta = [1.55#div1.8]; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_cnv_etInEta3", "HLT E_{T} resolution in #eta = [1.8#div2.45]; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_uncnv_etInEta0", "HLT E_{T} resolution in #eta = [0#div1.37]; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_uncnv_etInEta1", "HLT E_{T} resolution in #eta = [1.37#div1.52]; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_uncnv_etInEta2", "HLT E_{T} resolution in #eta = [1.55#div1.8]; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_uncnv_etInEta3", "HLT E_{T} resolution in #eta = [1.8#div2.45]; (E_{T}(on)-E_{T}(off))/E_{T}(off) ; Count", 200, -0.1, 0.1)) + + if self.detailedHistograms: + self.addHistogram(monGroup, TH2F("eta,res_cnv_et", + "HLT E_{T} resolution as function of #eta for converted Photons; #eta; (E_{T}(on)-E_{T}(off))/E_{T}(off); Count", + 50, -2.47, 2.47, + 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("et,res_cnv_et", + "HLT E_{T} resolution as function of E_{T} for converted Photons; E_{T} [GeV]; (E_{T}(on)-E_{T}(off))/E_{T}(off); Count", + 50, 0., 100., + 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("eta,res_uncnv_et", + "HLT E_{T} resolution as function of #eta for unconverted Photons; #eta; (E_{T}(on)-E_{T}(off))/E_{T}(off); Count", + 50, -2.47, 2.47, + 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("et,res_uncnv_et", + "HLT E_{T} resolution as function of E_{T} for unconverted Photons; E_{T} [GeV]; (E_{T}(on)-E_{T}(off))/E_{T}(off); Count", + 50, 0., 100., + 200, -0.1, 0.1)) + + if isolated: + + self.addHistogram(monGroup, TH1F("res_topoetcone20", "resolution topoetcone20; ptcone20 (on-off)/off; Count", 200, -0.1, 0.1)) + self.addHistogram(monGroup, TH1F("res_topoetcone20_rel", "resolution topoetcone20/pt; ptcone20/pt (on-off)/off; Count", 100, -0.1, 0.1)) + + if self.detailedHistograms: + self.addHistogram(monGroup, TH2F("eta,res_topoetcone20_rel", "HLT topoetcone20/pt resolution as function of #eta; #eta; (on-off)/off; Count", + 50, -2.47, 2.47, + 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("et,res_topoetcone20_rel", "HLT topoetcone20/pt resolution as function of E_{T}; E_{T} [GeV]; (on-off)/off; Count", + 50, 0., 100., + 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("mu,res_topoetcone20", "HLT topoetcone20 resolution as function of avg #mu; #mu; (on-off)/off; Count", + 50, 0, 100, + 100, -0.1, 0.1)) + self.addHistogram(monGroup, TH2F("mu,res_topoetcone20_rel", "HLT topoetcone20/pt resolution as function of avg #mu; #mu; (on-off)/off; Count", + 50, 0, 100, + 100, -0.1, 0.1)) + + + + + + + + # # Set binning # def setBinning(self, doJpsiee=False): @@ -632,5 +948,13 @@ class TrigEgammaMonAlgBuilder: def pidname(self): return self.chain().split('_')[2] + def isIsolated(self): + for part_name in ['iloose', 'ivarloose', 'icaloloose', 'icalovloose', 'icalotight']: + if part_name in self.chain(): + return True + return False + + + return TrigEgammaInfo(trigger) diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.cxx index 6cf0aed54ff4e4904d53773377da72809864a4c8..19b477ba66ae40f91bd7329282d2f63c4e3fa2eb 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.cxx @@ -53,11 +53,11 @@ void TrigEgammaMonitorAnalysisAlgorithm::fillEfficiencies( std::vector< std::pai if(pairObj.first->type()==xAOD::Type::Electron){ const xAOD::Electron* el = static_cast<const xAOD::Electron *> (pairObj.first); - float et = getEt(el)/1e3; + float et = getEt(el)/Gaudi::Units::GeV; if(et < info.trigThrHLT-5.0) continue; }else if(pairObj.first->type()==xAOD::Type::Photon){ - float et = getCluster_et(pairObj.first)/1e3; + float et = getCluster_et(pairObj.first)/Gaudi::Units::GeV; if(et < info.trigThrHLT-5.0) continue; if(boost::contains(info.trigName,"icalovloose")) { @@ -162,13 +162,13 @@ void TrigEgammaMonitorAnalysisAlgorithm::fillEfficiency( const std::string &subg const xAOD::Electron* el =static_cast<const xAOD::Electron*> (eg); pid=el->auxdecor<bool>(pidword); ATH_MSG_DEBUG("Electron pid " << pid); - et = getEt(el)/1e3; + et = getEt(el)/Gaudi::Units::GeV; } - else et=eg->caloCluster()->et()/1e3; + else et=eg->caloCluster()->et()/Gaudi::Units::GeV; float eta = eg->caloCluster()->etaBE(2); float phi = eg->phi(); - float pt = eg->pt()/1e3; + float pt = eg->pt()/Gaudi::Units::GeV; float avgmu=lbAverageInteractionsPerCrossing( Gaudi::Hive::currentContext() ); float npvtx=0.0; @@ -428,10 +428,10 @@ void TrigEgammaMonitorAnalysisAlgorithm::fillL1Calo( const std::string &trigger, if(!l1) continue; eta_vec.push_back( l1->eta() ); phi_vec.push_back( l1->phi() ); - energy_vec.push_back( l1->emClus()/1.e3 ); - roi_et_vec.push_back( l1->eT()/1.e3 ); - emIso_vec.push_back( l1->emIsol()/1.e3 ); - hadCore_vec.push_back( l1->hadCore()/1.e3 ); + energy_vec.push_back( l1->emClus()/Gaudi::Units::GeV ); + roi_et_vec.push_back( l1->eT()/Gaudi::Units::GeV ); + emIso_vec.push_back( l1->emIsol()/Gaudi::Units::GeV ); + hadCore_vec.push_back( l1->hadCore()/Gaudi::Units::GeV ); } fill( monGroup, eta_col, phi_col, energy_col, roi_et_col, emIso_col, hadCore_col ); @@ -455,7 +455,7 @@ void TrigEgammaMonitorAnalysisAlgorithm::fillL2Calo(const std::string &trigger, for ( auto emCluster : emCluster_vec ) { if(!emCluster) continue; - et_vec.push_back( emCluster->et()/1.e3 ); + et_vec.push_back( emCluster->et()/Gaudi::Units::GeV ); eta_vec.push_back( emCluster->eta() ); phi_vec.push_back( emCluster->phi() ); } @@ -481,7 +481,7 @@ void TrigEgammaMonitorAnalysisAlgorithm::fillL2Electron(const std::string &trigg for ( auto el : el_vec ) { if(!el) continue; - et_vec.push_back( el->pt()/1.e3 ); + et_vec.push_back( el->pt()/Gaudi::Units::GeV ); eta_vec.push_back( el->eta() ); phi_vec.push_back( el->phi() ); } @@ -520,12 +520,12 @@ void TrigEgammaMonitorAnalysisAlgorithm::fillEFCalo(const std::string &trigger, if(!clus->retrieveMoment(xAOD::CaloCluster::PHICALOFRAME,tmpphi)) tmpphi=-999.; - energyBE0_vec.push_back( clus->energyBE(0)/1.e3 ); - energyBE1_vec.push_back( clus->energyBE(1)/1.e3 ); - energyBE2_vec.push_back( clus->energyBE(2)/1.e3 ); - energyBE3_vec.push_back( clus->energyBE(3)/1.e3 ); - energy_vec.push_back( clus->e()/1.e3 ); - et_vec.push_back( clus->et()/1.e3 ); + energyBE0_vec.push_back( clus->energyBE(0)/Gaudi::Units::GeV ); + energyBE1_vec.push_back( clus->energyBE(1)/Gaudi::Units::GeV ); + energyBE2_vec.push_back( clus->energyBE(2)/Gaudi::Units::GeV ); + energyBE3_vec.push_back( clus->energyBE(3)/Gaudi::Units::GeV ); + energy_vec.push_back( clus->e()/Gaudi::Units::GeV ); + et_vec.push_back( clus->et()/Gaudi::Units::GeV ); eta_vec.push_back( clus->eta() ); phi_vec.push_back( clus->phi() ); eta_calo_vec.push_back( tmpeta ); @@ -577,8 +577,8 @@ void TrigEgammaMonitorAnalysisAlgorithm::fillShowerShapes(const std::string &tri if(!eg) continue; - ethad_vec.push_back( getShowerShape_ethad(eg)/1e3); - ethad1_vec.push_back( getShowerShape_ethad1(eg)/1e3); + ethad_vec.push_back( getShowerShape_ethad(eg)/Gaudi::Units::GeV); + ethad1_vec.push_back( getShowerShape_ethad1(eg)/Gaudi::Units::GeV); Rhad_vec.push_back( getShowerShape_Rhad(eg)); Rhad1_vec.push_back( getShowerShape_Rhad(eg)); Reta_vec.push_back( getShowerShape_Reta(eg)); @@ -588,12 +588,12 @@ void TrigEgammaMonitorAnalysisAlgorithm::fillShowerShapes(const std::string &tri f1_vec.push_back( getShowerShape_f1(eg)); f3_vec.push_back( getShowerShape_f3(eg)); eratio_vec.push_back( getShowerShape_Eratio(eg)); - et_vec.push_back( eg->pt()/1e3); - highet_vec.push_back( eg->pt()/1e3); + et_vec.push_back( eg->pt()/Gaudi::Units::GeV); + highet_vec.push_back( eg->pt()/Gaudi::Units::GeV); eta_vec.push_back( eg->eta()); phi_vec.push_back( eg->phi()); - topoetcone20_vec.push_back( getIsolation_topoetcone20(eg)/1e3); - topoetcone40_shift_vec.push_back( (getIsolation_topoetcone40(eg)-2450)/1e3 ); + topoetcone20_vec.push_back( getIsolation_topoetcone20(eg)/Gaudi::Units::GeV); + topoetcone40_shift_vec.push_back( (getIsolation_topoetcone40(eg)-2450)/Gaudi::Units::GeV ); if (eg->pt() > 0) { topoetcone20_rel_vec.push_back( getIsolation_topoetcone20(eg)/eg->pt()); @@ -667,14 +667,14 @@ void TrigEgammaMonitorAnalysisAlgorithm::fillTracking(const std::string &trigger npixhits_vec.push_back( getTrackSummary_numberOfPixelHits(eg)); nscthits_vec.push_back( getTrackSummary_numberOfSCTHits(eg)); charge_vec.push_back( eg->charge()); - ptcone20_vec.push_back( getIsolation_ptcone20(eg)/1e3); - ptvarcone20_vec.push_back( getIsolation_ptvarcone20(eg)/1e3); + ptcone20_vec.push_back( getIsolation_ptcone20(eg)/Gaudi::Units::GeV); + ptvarcone20_vec.push_back( getIsolation_ptvarcone20(eg)/Gaudi::Units::GeV); // Quantities directly from tracks ATH_MSG_DEBUG("Get track Quantities"); d0_vec.push_back( getTrack_d0(eg)); d0sig_vec.push_back(getD0sig(eg)); - pt_vec.push_back( getTrack_pt(eg)/1e3); + pt_vec.push_back( getTrack_pt(eg)/Gaudi::Units::GeV); if (eg->pt() > 0) { ptcone20_rel_vec.push_back( getIsolation_ptcone20(eg)/eg->pt()); @@ -687,9 +687,1000 @@ void TrigEgammaMonitorAnalysisAlgorithm::fillTracking(const std::string &trigger fill( monGroup, deta1_col, deta1_EMECA_col, deta1_EMECC_col, deta1_EMEBA_col, deta1_EMEBC_col, deta2_col, dphi2_col, dphiresc_col, eprobht_col, npixhits_col, nscthits_col, charge_col, ptcone20_col, ptvarcone20_col, d0_col, d0sig_col, pt_col, ptcone20_rel_col, ptvarcone20_rel_col); +} + + + +//!***********************************************************************************************************************8 +// +// + + +void TrigEgammaMonitorAnalysisAlgorithm::fillResolutions( std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pairObjs, + const TrigInfo info ) const +{ + + std::vector< std::pair< const xAOD::Egamma*, const xAOD::EmTauRoI * >> pair_l1_vec; + std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pair_eg_vec; + const std::string trigger = info.trigName; + bool filliso=false; + if(boost::contains(info.trigName,"iloose") || boost::contains(info.trigName,"ivarloose")) filliso=true; + if(boost::contains(info.trigName,"icaloloose") || boost::contains(info.trigName,"icalovloose") || boost::contains(info.trigName,"icalotight")) filliso=true; + + + for( auto pairObj : pairObjs ){ + + const xAOD::Egamma* eg = pairObj.first; + const auto *feat = pairObj.second; + + if (feat){ + if (info.trigL1){ + // Get l1 for all level one objects found for each off object + auto l1 = match()->getL1Feature( feat ); + if(l1){ + pair_l1_vec.push_back( std::make_pair(eg,l1) ); + } + }else{ + // + // Get only off and l1 where the offline object passed by the offline pid selector + // + auto l1 = match()->getL1Feature( feat ); + if(eg->type()==xAOD::Type::Electron){ + const xAOD::Electron* el = static_cast<const xAOD::Electron*>(eg); + float et = getEt(el)/Gaudi::Units::GeV; + if( et < info.trigThrHLT-5.0) continue; + if(!eg->auxdecor<bool>(info.trigPidDecorator)) continue; + pair_eg_vec.push_back(std::make_pair(el,feat)); + if(l1) pair_l1_vec.push_back( std::make_pair(eg,l1) ); + } + else if(eg->type()==xAOD::Type::Photon){ + float et = getCluster_et(eg)/Gaudi::Units::GeV; + if( et < info.trigThrHLT-5.0) continue; + pair_eg_vec.push_back(std::make_pair(eg,feat)); + if(l1) pair_l1_vec.push_back( std::make_pair(eg,l1) ); + } + } + + } + } + + + if (info.trigL1){ + fillL1CaloResolution( trigger, pair_l1_vec ); + fillL1CaloAbsResolution( trigger, pair_l1_vec ); + }else{ + + // Fill L1Calo for all level 1 objects found + fillL1CaloResolution( trigger, pair_l1_vec ); + fillL1CaloAbsResolution( trigger, pair_l1_vec ); + fillL2CaloResolution( trigger, pair_eg_vec ); + + // Fill HLT electron for all onl objects found + if ( info.trigType=="electron"){ + fillHLTElectronResolution( trigger, pair_eg_vec, filliso ); + } + + else if ( info.trigType=="photon"){ + fillHLTPhotonResolution( trigger, pair_eg_vec, filliso ); + } + + + } + +} + + + + +void TrigEgammaMonitorAnalysisAlgorithm::fillL1CaloResolution(const std::string &trigger, + std::vector< std::pair< const xAOD::Egamma*, const xAOD::EmTauRoI * >> pairObjs ) const +{ + auto monGroup = getGroup( trigger + "_Resolutions_L1Calo" ); + + std::vector<float> eta_vec, res_et_vec; + + auto eta_col = Monitored::Collection( "eta" , eta_vec ); + auto res_et_col = Monitored::Collection( "res_et" , res_et_vec ); + + + for (auto& pairObj : pairObjs){ + auto off = pairObj.first; + auto l1 = pairObj.second; + ATH_MSG_DEBUG("Fill L1CaloResolution"); + if(off->type()==xAOD::Type::Electron){ + const xAOD::Electron* eloff =static_cast<const xAOD::Electron*> (off); + eta_vec.push_back( l1->eta() ); + res_et_vec.push_back( (l1->emClus()-getEt(eloff))/getEt(eloff) ) ; + + } + } + + fill( monGroup, eta_col, res_et_col ); +} + + + + + +void TrigEgammaMonitorAnalysisAlgorithm::fillL1CaloAbsResolution(const std::string &trigger, + std::vector< std::pair< const xAOD::Egamma*, const xAOD::EmTauRoI * >> pairObjs ) const +{ + auto monGroup = getGroup( trigger + "_AbsResolutions_L1Calo" ); + + std::vector<float> eta_vec, res_et_vec; + + auto eta_col = Monitored::Collection( "eta" , eta_vec ); + auto res_et_col = Monitored::Collection( "res_et" , res_et_vec ); + + + for (auto& pairObj : pairObjs){ + auto off = pairObj.first; + auto l1 = pairObj.second; + ATH_MSG_DEBUG("Fill L1CaloAbsResolution"); + if(off->type()==xAOD::Type::Electron){ + const xAOD::Electron* eloff =static_cast<const xAOD::Electron*> (off); + eta_vec.push_back( l1->eta() ); + res_et_vec.push_back( (l1->emClus()-getEt(eloff))/Gaudi::Units::GeV ) ; + } + } + + fill( monGroup, eta_col, res_et_col ); +} + + + + +void TrigEgammaMonitorAnalysisAlgorithm::fillHLTElectronResolution(const std::string &trigger, + std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pairObjs, + bool filliso) const +{ + + auto monGroup = getGroup( trigger + "_Resolutions_HLT" ); + + std::vector<float> res_pt_vec, res_et_vec, res_phi_vec, res_eta_vec, res_deta1_vec, res_deta2_vec, res_dphi2_vec, res_dphiresc_vec, + res_d0_vec, res_d0sig_vec, res_eprobht_vec, res_npixhits_vec, res_nscthits_vec, res_Rhad_vec, res_Rhad1_vec, res_Reta_vec, + res_Rphi_vec, res_weta1_vec, res_weta2_vec, res_wtots1_vec, res_f1_vec, res_f3_vec, res_eratio_vec, res_ethad_vec, res_ethad1_vec, + et_vec, eta_vec, mu_vec; + std::vector<float> res_ptcone20_vec, res_ptcone20_rel_vec, res_ptvarcone20_vec, res_ptvarcone20_rel_vec; + std::vector<float> res_etInEta0_vec, res_etInEta1_vec, res_etInEta2_vec, res_etInEta3_vec; + + + auto et_col = Monitored::Collection( "et" , et_vec ); + auto eta_col = Monitored::Collection( "eta" , eta_vec ); + auto mu_col = Monitored::Collection( "mu" , mu_vec ); + + // For calo + auto res_et_col = Monitored::Collection( "res_et" , res_et_vec ); + auto res_eta_col = Monitored::Collection( "res_eta" , res_eta_vec ); + auto res_phi_col = Monitored::Collection( "res_phi" , res_phi_vec ); + auto res_ethad_col = Monitored::Collection( "res_ethad" , res_ethad_vec ); + auto res_ethad1_col = Monitored::Collection( "res_ethad1" , res_ethad1_vec ); + auto res_Rhad_col = Monitored::Collection( "res_Rhad" , res_Rhad_vec ); + auto res_Rhad1_col = Monitored::Collection( "res_Rhad1" , res_Rhad1_vec ); + auto res_Reta_col = Monitored::Collection( "res_Reta" , res_Reta_vec ); + auto res_Rphi_col = Monitored::Collection( "res_Rphi" , res_Rphi_vec ); + auto res_weta1_col = Monitored::Collection( "res_weta1" , res_weta1_vec ); + auto res_weta2_col = Monitored::Collection( "res_weta2" , res_weta2_vec ); + auto res_wtots1_col = Monitored::Collection( "res_wtots1" , res_wtots1_vec ); + auto res_f1_col = Monitored::Collection( "res_f1" , res_f1_vec ); + auto res_f3_col = Monitored::Collection( "res_f3" , res_f3_vec ); + auto res_eratio_col = Monitored::Collection( "res_eratio" , res_eratio_vec ); + + auto res_etInEta0_col = Monitored::Collection( "res_etInEta0" , res_etInEta0_vec ); + auto res_etInEta1_col = Monitored::Collection( "res_etInEta1" , res_etInEta1_vec ); + auto res_etInEta2_col = Monitored::Collection( "res_etInEta2" , res_etInEta2_vec ); + auto res_etInEta3_col = Monitored::Collection( "res_etInEta3" , res_etInEta3_vec ); + + // For electron + auto res_pt_col = Monitored::Collection( "res_pt" , res_pt_vec ); + auto res_deta1_col = Monitored::Collection( "res_deta1" , res_deta1_vec ); + auto res_deta2_col = Monitored::Collection( "res_deta2" , res_deta2_vec ); + auto res_dphi2_col = Monitored::Collection( "res_dphi2" , res_dphi2_vec ); + auto res_dphiresc_col = Monitored::Collection( "res_dphiresc" , res_dphiresc_vec ); + auto res_d0_col = Monitored::Collection( "res_d0" , res_d0_vec ); + auto res_d0sig_col = Monitored::Collection( "res_d0sig" , res_d0sig_vec ); + auto res_eprobht_col = Monitored::Collection( "res_eprobht" , res_eprobht_vec ); + auto res_npixhits_col = Monitored::Collection( "res_npixhits" , res_npixhits_vec ); + auto res_nscthits_col = Monitored::Collection( "res_nscthits" , res_nscthits_vec ); + auto res_ptcone20_col = Monitored::Collection( "res_ptcone20" , res_ptcone20_vec ); + auto res_ptcone20_rel_col = Monitored::Collection( "res_ptcone20_rel" , res_ptcone20_rel_vec ); + auto res_ptvarcone20_col = Monitored::Collection( "res_ptvarcone20" , res_ptvarcone20_vec ); + auto res_ptvarcone20_rel_col = Monitored::Collection( "res_ptvarcone20_rel" , res_ptvarcone20_rel_vec ); + + + + + // Check for zero before filling + ATH_MSG_DEBUG("Fill Resolution"); + + + + for ( auto& pairObj : pairObjs ){ + + const xAOD::Electron *off = static_cast<const xAOD::Electron*>(pairObj.first); + const xAOD::Electron *onl=nullptr; + + + { // Get the closest electron object from the trigger starting with deltaR = 0.15 + float maxDeltaR=0.05; + auto vec = tdt()->features<xAOD::ElectronContainer>(trigger,TrigDefs::Physics ,match()->key("Electron") ); + for(auto &featLinkInfo : vec ){ + if(! featLinkInfo.isValid() ) continue; + const auto *feat = *(featLinkInfo.link); + if(!feat) continue; + float deltaR = dR( off->eta(), off->phi(), feat->eta(), feat->phi() ); + if( deltaR < maxDeltaR){ + maxDeltaR=deltaR; + onl=feat; + } + } + } + + if(!onl) continue; + + float val_off=0.; + const float onl_eta=onl->eta(); + const float feta = abs(onl_eta); + const float onl_et = getEt(onl)/Gaudi::Units::GeV; + const float avgmu=lbAverageInteractionsPerCrossing( Gaudi::Hive::currentContext() ); + const float dummy=dummy; + + eta_vec.push_back( onl_eta ); + et_vec.push_back( onl_et ); + mu_vec.push_back( avgmu ); + + val_off=getTrack_pt(off); + if(val_off!=0.){ + res_pt_vec.push_back( (getTrack_pt(off)-val_off)/val_off ); + }else{ + } + + + val_off=getEt(off); + if(val_off!=0.){ + res_et_vec.push_back( (getEt(onl)-val_off)/val_off ); + if( feta < 1.37 ) + res_etInEta0_vec.push_back((getEt(onl)-val_off)/val_off); + else if( feta >=1.37 && feta <= 1.52 ) + res_etInEta1_vec.push_back((getEt(onl)-val_off)/val_off); + else if( feta >= 1.55 && feta < 1.8 ) + res_etInEta2_vec.push_back((getEt(onl)-val_off)/val_off); + else if( feta >= 1.8 && feta < 2.45 ) + res_etInEta3_vec.push_back((getEt(onl)-val_off)/val_off); + } + + val_off=off->eta(); + if(val_off!=0.){ + res_eta_vec.push_back( (onl_eta-val_off)/val_off ); + }else{ + res_eta_vec.push_back( dummy ); + } + + val_off=off->phi(); + if(val_off!=0.){ + res_phi_vec.push_back( (onl->phi()-val_off)/val_off ); + }else{ + res_phi_vec.push_back(dummy ); + } + + val_off=getShowerShape_ethad(off); + if(val_off!=0.) { + res_ethad_vec.push_back((getShowerShape_ethad(onl)-val_off)/val_off); + }else{ + res_ethad_vec.push_back( dummy ); + } + + val_off=getShowerShape_ethad1(off); + if(val_off!=0){ + res_ethad1_vec.push_back((getShowerShape_ethad1(onl)-val_off)/val_off); + }else{ + res_ethad1_vec.push_back( dummy); + } + + val_off=getShowerShape_Rhad(off); + if(val_off!=0.){ + res_Rhad_vec.push_back( (getShowerShape_Rhad(onl)-val_off)/val_off ); + }else{ + res_Rhad_vec.push_back( dummy ); + } + + val_off=getShowerShape_Rhad1(off); + if(val_off!=0.){ + res_Rhad1_vec.push_back( (getShowerShape_Rhad1(onl)-val_off)/val_off ); + }else{ + res_Rhad1_vec.push_back( dummy ); + } + + val_off=getShowerShape_Reta(off); + if(val_off!=0.){ + res_Reta_vec.push_back( (getShowerShape_Reta(onl)-val_off)/val_off ); + }else{ + res_Reta_vec.push_back( dummy ); + } + + val_off=getShowerShape_Rphi(off); + if(val_off!=0.){ + res_Rphi_vec.push_back( (getShowerShape_Rphi(onl)-val_off)/val_off ); + }else{ + res_Rphi_vec.push_back( (getShowerShape_Rphi(onl)-val_off)/val_off ); + } + + val_off=getShowerShape_weta1(off); + if(val_off!=0.){ + res_weta1_vec.push_back( (getShowerShape_weta1(onl)-val_off)/val_off ); + }else{ + res_weta1_vec.push_back( dummy ); + } + + val_off=getShowerShape_weta2(off); + if(val_off!=0.){ + res_weta2_vec.push_back( (getShowerShape_weta2(onl)-val_off)/val_off ); + }else{ + res_weta2_vec.push_back( dummy ); + } + + val_off=getShowerShape_wtots1(off); + if(val_off!=0.){ + res_wtots1_vec.push_back( (getShowerShape_wtots1(onl)-val_off)/val_off ); + }else{ + res_wtots1_vec.push_back( dummy ); + } + + val_off=getShowerShape_f1(off); + if(val_off!=0.){ + res_f1_vec.push_back( (getShowerShape_f1(onl)-val_off)/val_off ); + }else{ + res_f1_vec.push_back(dummy ); + } + + val_off=getShowerShape_f3(off); + if(val_off!=0.){ + res_f3_vec.push_back( (getShowerShape_f3(onl)-val_off)/val_off ); + }else{ + res_f3_vec.push_back( dummy ); + } + + val_off=getShowerShape_Eratio(off); + if(val_off!=0.){ + res_eratio_vec.push_back( (getShowerShape_Eratio(onl)-val_off)/val_off ); + }else{ + res_eratio_vec.push_back( dummy ); + } + + + // + // Track variables + // + + val_off=getTrack_pt(off); + if(val_off!=0.){ + res_pt_vec.push_back( (getTrack_pt(onl)-val_off)/val_off ); + }else{ + res_pt_vec.push_back( dummy ); + } + + val_off=getEt(off); + if(val_off!=0.) { + res_et_vec.push_back( (getEt(onl)-val_off)/val_off ); + }else{ + res_et_vec.push_back( dummy ); + } + + val_off=getCaloTrackMatch_deltaEta1(off); + if(val_off!=0.) { + res_deta1_vec.push_back( (getCaloTrackMatch_deltaEta1(onl)-val_off)/val_off ); + }else{ + res_deta1_vec.push_back( dummy ); + } + + val_off=getCaloTrackMatch_deltaEta2(off); + res_deta2_vec.push_back( (getCaloTrackMatch_deltaEta2(onl)-val_off)/val_off ); + val_off=getCaloTrackMatch_deltaPhi2(off); + if(val_off!=0.) { + res_dphi2_vec.push_back( (getCaloTrackMatch_deltaPhi2(onl)-val_off)/val_off ); + }else{ + res_dphi2_vec.push_back(dummy ); + } + + val_off=getCaloTrackMatch_deltaPhiRescaled2(off); + res_dphiresc_vec.push_back( (getCaloTrackMatch_deltaPhiRescaled2(onl)-val_off)/val_off ); + // Absolute resolution for impact parameter + val_off=getTrack_d0(off); + if(val_off!=0.) { + res_d0_vec.push_back( getTrack_d0(onl)-val_off ); + }else{ + res_d0_vec.push_back( dummy ); + } + + val_off=getD0sig(off); + if(val_off!=0.) { + res_d0sig_vec.push_back( getD0sig(onl)-val_off ); + }else{ + res_d0sig_vec.push_back( dummy ); + } + + // Absolute resolution on track summary ints/floats + val_off=getTrackSummaryFloat_eProbabilityHT(off); + res_eprobht_vec.push_back( (getTrackSummaryFloat_eProbabilityHT(onl)-val_off) ); + res_npixhits_vec.push_back( getTrackSummary_numberOfPixelHits(onl)-getTrackSummary_numberOfPixelHits(onl) ); + res_nscthits_vec.push_back( getTrackSummary_numberOfSCTHits(onl)-getTrackSummary_numberOfSCTHits(onl) ); + + + + + if(filliso){ + + float val_off=getIsolation_ptcone20(off); + if (val_off > 0.) { + res_ptcone20_vec.push_back((getIsolation_ptcone20(onl)-val_off)/val_off); + if (getEt(onl) > 0. && getEt(off) > 0.) { + const float reliso_onl=getIsolation_ptcone20(onl)/getEt(onl); + const float reliso_off=getIsolation_ptcone20(off)/getEt(off); + res_ptcone20_rel_vec.push_back((reliso_onl-reliso_off)/reliso_off); + }else{ + res_ptcone20_rel_vec.push_back(dummy); + } + }else{ + res_ptcone20_vec.push_back(dummy); + res_ptcone20_rel_vec.push_back(dummy); + } + + // ptvarcone20 isolation + val_off=getIsolation_ptvarcone20(off); + if (val_off > 0.) { + if (getEt(onl) > 0. && getEt(off) > 0.) { + res_ptvarcone20_vec.push_back((getIsolation_ptvarcone20(onl)-val_off)/val_off); + const float reliso_onl=getIsolation_ptvarcone20(onl)/getEt(onl); + const float reliso_off=getIsolation_ptvarcone20(off)/getEt(off); + res_ptvarcone20_rel_vec.push_back((reliso_onl-reliso_off)/reliso_off); + }else{ + res_ptvarcone20_rel_vec.push_back(dummy); + } + }else{ + res_ptvarcone20_vec.push_back(dummy); + res_ptvarcone20_rel_vec.push_back(dummy); + } + + } + + + + + + } // Loop over all offline objects + + // Fill everything + fill( monGroup , + et_col , + eta_col , + mu_col , + res_pt_col , + res_et_col , + res_eta_col , + res_phi_col , + res_deta1_col , + res_deta2_col , + res_dphi2_col , + res_dphiresc_col, + res_d0_col , + res_d0sig_col , + res_eprobht_col , + res_npixhits_col, + res_nscthits_col, + res_ethad_col , + res_ethad1_col , + res_Rhad_col , + res_Rhad1_col , + res_Reta_col , + res_Rphi_col , + res_weta1_col , + res_weta2_col , + res_wtots1_col , + res_f1_col , + res_f3_col , + res_eratio_col , + res_ptcone20_col , + res_ptcone20_rel_col , + res_ptvarcone20_col , + res_ptvarcone20_rel_col , + res_etInEta0_col, + res_etInEta1_col, + res_etInEta2_col, + res_etInEta3_col ); + + + +} + + + + + +void TrigEgammaMonitorAnalysisAlgorithm::fillHLTPhotonResolution(const std::string &trigger, + std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pairObjs, + bool filliso) const +{ + + auto monGroup = getGroup( trigger + "_Resolutions_HLT" ); + + std::vector<float> res_phi_vec, res_eta_vec, res_Rhad_vec, res_Rhad1_vec, res_Reta_vec, res_ethad_vec, res_ethad1_vec, + res_Rphi_vec, res_weta1_vec, res_weta2_vec, res_wtots1_vec, res_f1_vec, res_f3_vec, res_eratio_vec, et_vec, eta_vec, mu_vec; + + std::vector<float> res_et_vec, res_et_cnv_vec, res_et_uncnv_vec; + std::vector<float> res_etInEta0_vec, res_etInEta1_vec, res_etInEta2_vec, res_etInEta3_vec; + std::vector<float> res_cnv_etInEta0_vec, res_cnv_etInEta1_vec, res_cnv_etInEta2_vec, res_cnv_etInEta3_vec; + std::vector<float> res_uncnv_etInEta0_vec, res_uncnv_etInEta1_vec, res_uncnv_etInEta2_vec, res_uncnv_etInEta3_vec; + + + + std::vector<float> res_topoetcone20_vec, res_topoetcone20_rel_vec; + + auto et_col = Monitored::Collection( "et" , et_vec ); + auto eta_col = Monitored::Collection( "eta" , eta_vec ); + auto mu_col = Monitored::Collection( "mu" , mu_vec ); + + // For calo + auto res_eta_col = Monitored::Collection( "res_eta" , res_eta_vec ); + auto res_phi_col = Monitored::Collection( "res_phi" , res_phi_vec ); + auto res_ethad_col = Monitored::Collection( "res_ethad" , res_ethad_vec ); + auto res_ethad1_col = Monitored::Collection( "res_ethad1" , res_ethad1_vec ); + auto res_Rhad_col = Monitored::Collection( "res_Rhad" , res_Rhad_vec ); + auto res_Rhad1_col = Monitored::Collection( "res_Rhad1" , res_Rhad1_vec ); + auto res_Reta_col = Monitored::Collection( "res_Reta" , res_Reta_vec ); + auto res_Rphi_col = Monitored::Collection( "res_Rphi" , res_Rphi_vec ); + auto res_weta1_col = Monitored::Collection( "res_weta1" , res_weta1_vec ); + auto res_weta2_col = Monitored::Collection( "res_weta2" , res_weta2_vec ); + auto res_wtots1_col = Monitored::Collection( "res_wtots1" , res_wtots1_vec ); + auto res_f1_col = Monitored::Collection( "res_f1" , res_f1_vec ); + auto res_f3_col = Monitored::Collection( "res_f3" , res_f3_vec ); + auto res_eratio_col = Monitored::Collection( "res_eratio" , res_eratio_vec ); + + + auto res_et_col = Monitored::Collection( "res_et" , res_et_vec ); + auto res_et_cnv_col = Monitored::Collection( "res_et_cnv" , res_et_cnv_vec ); + auto res_et_uncnv_col = Monitored::Collection( "res_et_uncnv" , res_et_uncnv_vec ); + auto res_etInEta0_col = Monitored::Collection( "res_etInEta0" , res_etInEta0_vec ); + auto res_etInEta1_col = Monitored::Collection( "res_etInEta1" , res_etInEta1_vec ); + auto res_etInEta2_col = Monitored::Collection( "res_etInEta2" , res_etInEta2_vec ); + auto res_etInEta3_col = Monitored::Collection( "res_etInEta3" , res_etInEta3_vec ); + auto res_cnv_etInEta0_col = Monitored::Collection( "res_cnv_etInEta0" , res_cnv_etInEta0_vec ); + auto res_cnv_etInEta1_col = Monitored::Collection( "res_cnv_etInEta1" , res_cnv_etInEta1_vec ); + auto res_cnv_etInEta2_col = Monitored::Collection( "res_cnv_etInEta2" , res_cnv_etInEta2_vec ); + auto res_cnv_etInEta3_col = Monitored::Collection( "res_cnv_etInEta3" , res_cnv_etInEta3_vec ); + auto res_uncnv_etInEta0_col = Monitored::Collection( "res_uncnv_etInEta0" , res_uncnv_etInEta0_vec); + auto res_uncnv_etInEta1_col = Monitored::Collection( "res_uncnv_etInEta1" , res_uncnv_etInEta1_vec); + auto res_uncnv_etInEta2_col = Monitored::Collection( "res_uncnv_etInEta2" , res_uncnv_etInEta2_vec); + auto res_uncnv_etInEta3_col = Monitored::Collection( "res_uncnv_etInEta3" , res_uncnv_etInEta3_vec); + + // For photon + auto res_topoetcone20_col = Monitored::Collection( "res_topoetcone20" , res_topoetcone20_vec ); + auto res_topoetcone20_rel_col = Monitored::Collection( "res_topoetcone20_rel" , res_topoetcone20_rel_vec ); + + + + + // Check for zero before filling + ATH_MSG_DEBUG("Fill Resolution"); + + + + for ( auto& pairObj : pairObjs ){ + + const xAOD::Photon *off = static_cast<const xAOD::Photon*>(pairObj.first); + const xAOD::Photon *onl=nullptr; + + + { // Get the closest electron object from the trigger starting with deltaR = 0.15 + float maxDeltaR=0.05; + auto vec = tdt()->features<xAOD::PhotonContainer>(trigger,TrigDefs::Physics ,match()->key("Photon") ); + for(auto &featLinkInfo : vec ){ + if(! featLinkInfo.isValid() ) continue; + const auto *feat = *(featLinkInfo.link); + if(!feat) continue; + float deltaR = dR( off->eta(), off->phi(), feat->eta(), feat->phi() ); + if( deltaR < maxDeltaR){ + maxDeltaR=deltaR; + onl=feat; + } + } + } + + // If not found, skip this off object! + if(!onl) continue; + + float val_off=0.; + const float onl_eta=onl->eta(); + const float feta = abs(onl_eta); + const float onl_et = getCluster_et(onl)/Gaudi::Units::GeV; + const float dummy=dummy; + + const float avgmu=lbAverageInteractionsPerCrossing( Gaudi::Hive::currentContext() ); + et_vec.push_back( onl_et ); + eta_vec.push_back( onl_eta ); + mu_vec.push_back( avgmu ); + + + val_off=getCluster_et(off); + if(val_off!=0.){ + res_et_vec.push_back( (getCluster_et(onl)-val_off)/val_off ); + if( feta < 1.37 ) + res_etInEta0_vec.push_back((getCluster_et(onl)-val_off)/val_off); + else if( feta >=1.37 && feta <= 1.52 ) + res_etInEta1_vec.push_back((getCluster_et(onl)-val_off)/val_off); + else if( feta >= 1.55 && feta < 1.8 ) + res_etInEta2_vec.push_back((getCluster_et(onl)-val_off)/val_off); + else if( feta >= 1.8 && feta < 2.45 ) + res_etInEta3_vec.push_back((getCluster_et(onl)-val_off)/val_off); + + if(xAOD::EgammaHelpers::isConvertedPhoton(off)){ + res_et_cnv_vec.push_back((getCluster_et(onl)-val_off)/val_off); + if( feta < 1.37 ) + res_cnv_etInEta0_vec.push_back((getCluster_et(onl)-val_off)/val_off); + else if( feta >=1.37 && feta <= 1.52 ) + res_cnv_etInEta1_vec.push_back((getCluster_et(onl)-val_off)/val_off); + else if( feta >= 1.55 && feta < 1.8 ) + res_cnv_etInEta2_vec.push_back((getCluster_et(onl)-val_off)/val_off); + else if( feta >= 1.8 && feta < 2.45 ) + res_cnv_etInEta3_vec.push_back((getCluster_et(onl)-val_off)/val_off); + }else{ + res_et_uncnv_vec.push_back((getCluster_et(onl)-val_off)/val_off); + if( feta < 1.37 ) + res_uncnv_etInEta0_vec.push_back((getCluster_et(onl)-val_off)/val_off); + else if( feta >=1.37 && feta <= 1.52 ) + res_uncnv_etInEta1_vec.push_back((getCluster_et(onl)-val_off)/val_off); + else if( feta >= 1.55 && feta < 1.8 ) + res_uncnv_etInEta2_vec.push_back((getCluster_et(onl)-val_off)/val_off); + else if( feta >= 1.8 && feta < 2.45 ) + res_uncnv_etInEta3_vec.push_back((getCluster_et(onl)-val_off)/val_off); + } + } + + val_off=off->eta(); + if(val_off!=0.){ + res_eta_vec.push_back( (onl_eta-val_off)/val_off ) ; + }else{ + res_eta_vec.push_back( dummy ) ; + } + + val_off=off->phi(); + if(val_off!=0.){ + res_phi_vec.push_back( (onl->phi()-val_off)/val_off ); + }else{ + res_phi_vec.push_back(dummy ); + } + + val_off=getShowerShape_ethad(off); + if(val_off!=0.) { + res_ethad_vec.push_back((getShowerShape_ethad(onl)-val_off)/val_off); + }else{ + res_ethad_vec.push_back(dummy); + } + + val_off=getShowerShape_ethad1(off); + if(val_off!=0){ + res_ethad1_vec.push_back((getShowerShape_ethad1(onl)-val_off)/val_off); + }else{ + res_ethad1_vec.push_back(dummy); + } + + val_off=getShowerShape_Rhad(off); + if(val_off!=0.){ + res_Rhad_vec.push_back( (getShowerShape_Rhad(onl)-val_off)/val_off ); + }else{ + res_Rhad_vec.push_back(dummy ); + } + + val_off=getShowerShape_Rhad1(off); + if(val_off!=0.){ + res_Rhad1_vec.push_back( (getShowerShape_Rhad1(onl)-val_off)/val_off ); + }else{ + res_Rhad1_vec.push_back(dummy ); + } + + val_off=getShowerShape_Reta(off); + if(val_off!=0.){ + res_Reta_vec.push_back( (getShowerShape_Reta(onl)-val_off)/val_off ); + }else{ + res_Reta_vec.push_back( dummy ); + } + + val_off=getShowerShape_Rphi(off); + if(val_off!=0.){ + res_Rphi_vec.push_back( (getShowerShape_Rphi(onl)-val_off)/val_off ); + }else{ + res_Rphi_vec.push_back(dummy ); + } + + val_off=getShowerShape_weta1(off); + if(val_off!=0.){ + res_weta1_vec.push_back( (getShowerShape_weta1(onl)-val_off)/val_off ); + }else{ + res_weta1_vec.push_back( dummy ); + } + + val_off=getShowerShape_weta2(off); + if(val_off!=0.){ + res_weta2_vec.push_back( (getShowerShape_weta2(onl)-val_off)/val_off ); + }else{ + res_weta2_vec.push_back(dummy); + } + + val_off=getShowerShape_wtots1(off); + if(val_off!=0.){ + res_wtots1_vec.push_back( (getShowerShape_wtots1(onl)-val_off)/val_off ); + }else{ + res_wtots1_vec.push_back( dummy ); + } + + val_off=getShowerShape_f1(off); + if(val_off!=0.){ + res_f1_vec.push_back( (getShowerShape_f1(onl)-val_off)/val_off ); + }else{ + res_f1_vec.push_back( dummy ); + } + + val_off=getShowerShape_f3(off); + if(val_off!=0.){ + res_f3_vec.push_back( (getShowerShape_f3(onl)-val_off)/val_off ); + }else{ + res_f3_vec.push_back( dummy ); + } + + val_off=getShowerShape_Eratio(off); + if(val_off!=0.){ + res_eratio_vec.push_back( (getShowerShape_Eratio(onl)-val_off)/val_off); + }else{ + res_eratio_vec.push_back( dummy); + } + + if( filliso ){ + // topoetcone20 isolation + float val_off=getIsolation_topoetcone20(off); + float etonl=onl->pt(); + float etoff=off->pt(); + if (val_off > 0.) { + res_topoetcone20_vec.push_back((getIsolation_topoetcone20(onl)-val_off)/val_off); + if (etonl > 0. && etoff > 0.) { + const float reliso_onl=getIsolation_topoetcone20(onl)/etonl; + const float reliso_off=getIsolation_topoetcone20(off)/etoff; + res_topoetcone20_rel_vec.push_back((reliso_onl-reliso_off)/reliso_off); + }else{ + res_topoetcone20_rel_vec.push_back(dummy); + } + }else{ + res_topoetcone20_vec.push_back(dummy); + res_topoetcone20_rel_vec.push_back(dummy); + } + } + + + + } // Loop over all offline objects + + // Fill everything + fill( monGroup , + et_col , + eta_col , + mu_col , + res_et_col , + res_eta_col , + res_phi_col , + res_ethad_col , + res_ethad1_col , + res_Rhad_col , + res_Rhad1_col , + res_Reta_col , + res_Rphi_col , + res_weta1_col , + res_weta2_col , + res_wtots1_col , + res_f1_col , + res_f3_col , + res_eratio_col , + res_topoetcone20_col , + res_topoetcone20_rel_col , + res_etInEta0_col, + res_etInEta1_col, + res_etInEta2_col, + res_etInEta3_col, + res_et_uncnv_col, + res_cnv_etInEta0_col, + res_cnv_etInEta1_col, + res_cnv_etInEta2_col, + res_cnv_etInEta3_col, + res_et_cnv_col, + res_uncnv_etInEta0_col, + res_uncnv_etInEta1_col, + res_uncnv_etInEta2_col, + res_uncnv_etInEta3_col + ); + } +void TrigEgammaMonitorAnalysisAlgorithm::fillL2CaloResolution(const std::string &trigger, + std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pairObjs ) const + +{ + ATH_MSG_DEBUG("Fill L2Calo Resolution"); + + auto monGroup = getGroup( trigger + "_Resolutions_L2Calo" ); + + std::vector<float> res_et_vec, res_phi_vec, res_eta_vec, res_Rhad_vec, res_Rhad1_vec, res_Reta_vec, res_ethad_vec, res_ethad1_vec, + res_Rphi_vec, res_weta2_vec, res_f1_vec, res_f3_vec, res_eratio_vec, et_vec, eta_vec; + + + auto et_col = Monitored::Collection( "et" , et_vec ); + auto eta_col = Monitored::Collection( "eta" , eta_vec ); + auto res_et_col = Monitored::Collection( "res_et" , res_et_vec ); + auto res_eta_col = Monitored::Collection( "res_eta" , res_eta_vec ); + auto res_phi_col = Monitored::Collection( "res_phi" , res_phi_vec ); + auto res_ethad_col = Monitored::Collection( "res_ethad" , res_ethad_vec ); + auto res_ethad1_col = Monitored::Collection( "res_ethad1" , res_ethad1_vec ); + auto res_Rhad_col = Monitored::Collection( "res_Rhad" , res_Rhad_vec ); + auto res_Rhad1_col = Monitored::Collection( "res_Rhad1" , res_Rhad1_vec ); + auto res_Reta_col = Monitored::Collection( "res_Reta" , res_Reta_vec ); + auto res_Rphi_col = Monitored::Collection( "res_Rphi" , res_Rphi_vec ); + auto res_weta2_col = Monitored::Collection( "res_weta2" , res_weta2_vec ); + auto res_f1_col = Monitored::Collection( "res_f1" , res_f1_vec ); + auto res_f3_col = Monitored::Collection( "res_f3" , res_f3_vec ); + auto res_eratio_col = Monitored::Collection( "res_eratio" , res_eratio_vec ); + + + for ( auto& pairObj : pairObjs ){ + + + const xAOD::Egamma *off = pairObj.first; + const xAOD::TrigEMCluster *onl=nullptr; + + { // Get the closest electron object from the trigger starting with deltaR = 0.15 + float maxDeltaR=0.05; + auto vec = tdt()->features<xAOD::TrigEMClusterContainer>(trigger,TrigDefs::Physics ,match()->key("L2Calo") ); + for(auto &featLinkInfo : vec ){ + if(! featLinkInfo.isValid() ) continue; + const auto *feat = *(featLinkInfo.link); + if(!feat) continue; + float deltaR = dR( off->eta(), off->phi(), feat->eta(), feat->phi() ); + if( deltaR < maxDeltaR){ + maxDeltaR=deltaR; + onl=feat; + } + } + } + + if(!onl) continue; + + et_vec.push_back(onl->et()*1e-3); + eta_vec.push_back(onl->eta()); + const float dummy=-999; + + float val_off=0.; + + val_off=off->caloCluster()->et(); + if(val_off!=0.){ + res_et_vec.push_back(((onl->et())-val_off)/val_off); + }else{ + res_et_vec.push_back(dummy); + } + + val_off=off->caloCluster()->eta(); + if(val_off!=0.){ + res_eta_vec.push_back((onl->eta()-val_off)/val_off); + }else{ + res_eta_vec.push_back(dummy); + } + + val_off=off->caloCluster()->phi(); + if(val_off!=0.){ + res_phi_vec.push_back((onl->phi()-val_off)/val_off); + }else{ + res_phi_vec.push_back((onl->phi()-val_off)/val_off); + } + + float elonl_ethad = onl->energy( CaloSampling::HEC0 ); elonl_ethad += onl->energy( CaloSampling::HEC1 ); + elonl_ethad += onl->energy( CaloSampling::HEC2 ); elonl_ethad += onl->energy( CaloSampling::HEC3 ); + elonl_ethad += onl->energy( CaloSampling::TileBar0 ); elonl_ethad += onl->energy( CaloSampling::TileExt0 ); + elonl_ethad += onl->energy( CaloSampling::TileBar1 ); elonl_ethad += onl->energy( CaloSampling::TileExt1 ); + elonl_ethad += onl->energy( CaloSampling::TileBar2 ); elonl_ethad += onl->energy( CaloSampling::TileExt2 ); + elonl_ethad /= TMath::CosH(onl->eta() ); + val_off=getShowerShape_ethad(off); + if(val_off!=0.){ + res_ethad_vec.push_back((elonl_ethad-val_off)/val_off); + }else{ + res_ethad_vec.push_back(dummy); + } + + val_off=getShowerShape_ethad1(off); + if(val_off!=0.){ + res_ethad1_vec.push_back(( (onl->ehad1()/TMath::Abs(onl->eta()) )-val_off)/val_off); + }else{ + res_ethad1_vec.push_back(dummy); + } + + float elonl_Rhad = elonl_ethad / onl->energy() ; + val_off=getShowerShape_Rhad(off); + if(val_off!=0.){ + res_Rhad_vec.push_back(( elonl_Rhad-val_off)/val_off); + }else{ + res_Rhad_vec.push_back(dummy); + } + + float elonl_Rhad1 = onl->ehad1() / onl->energy() ; + val_off=getShowerShape_Rhad1(off); + if(val_off!=0.){ + res_Rhad1_vec.push_back(( elonl_Rhad1-val_off)/val_off); + }else{ + res_Rhad1_vec.push_back(dummy); + } + + float onl_reta= 999.0; + if ( fabsf ( onl->e277() ) > 0.01 ) onl_reta = onl->e237() / onl->e277(); + val_off=getShowerShape_Reta(off); + if(val_off!=0.){ + res_Reta_vec.push_back( (onl_reta -val_off)/val_off); + }else{ + res_Reta_vec.push_back(dummy); + } + + val_off=getShowerShape_weta2(off); + if(val_off!=0.){ + res_weta2_vec.push_back(( (onl->weta2())-val_off)/val_off); + }else{ + res_weta2_vec.push_back(dummy); + } + + float onl_f1 = onl->energy(CaloSampling::EMB1)+onl->energy(CaloSampling::EME1); + onl_f1 /= onl->energy(); + val_off=getShowerShape_f1(off); + if(val_off!=0.){ + res_f1_vec.push_back(( (onl_f1)-val_off)/val_off); + }else{ + res_f1_vec.push_back(dummy); + } + + float onl_f3 = onl->energy(CaloSampling::EMB3)+onl->energy(CaloSampling::EME3); + onl_f3 /= onl->energy(); + val_off=getShowerShape_f3(off); + if(val_off!=0.){ + res_f3_vec.push_back(( (onl_f3)-val_off)/val_off); + }else{ + res_f3_vec.push_back(dummy); + } + + float onl_eratio = 999.0; + if ( fabsf(onl->emaxs1() + onl->e2tsts1()) > 0.01 ) + onl_eratio = (onl->emaxs1() - onl->e2tsts1()) / (onl->emaxs1() + onl->e2tsts1()); + val_off=getShowerShape_Eratio(off); + if(val_off!=0.){ + res_eratio_vec.push_back(( (onl_eratio)-val_off)/val_off); + }else{ + res_eratio_vec.push_back(dummy); + } + + }// Loop over all pair objects + + + // Fill everything + fill( monGroup , + et_col , + eta_col , + res_et_col , + res_eta_col , + res_phi_col , + res_ethad_col , + res_ethad1_col , + res_Rhad_col , + res_Rhad1_col , + res_Reta_col , + res_Rphi_col , + res_weta2_col , + res_f1_col , + res_f3_col , + res_eratio_col + ); + +} + diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.h b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.h index 20e465d1187471ed3fab68fb93c7fb060fe414fe..67b3711d3076f722191ee7548a1ba91b770d9342 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.h +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorAnalysisAlgorithm.h @@ -21,15 +21,19 @@ class TrigEgammaMonitorAnalysisAlgorithm: public TrigEgammaMonitorBaseAlgorithm protected: void fillLabel( const ToolHandle<GenericMonitoringTool>& groupHandle, const std::string &histname, const std::string &label ) const; + void fillEfficiencies( std::vector< std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*> > , TrigInfo ) const; + void fillDistributions( std::vector< std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*> > , TrigInfo ) const; + void fillResolutions( std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pairObjs, const TrigInfo info ) const; + + private: // Efficiency monitoring - void fillEfficiencies( std::vector< std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*> > , TrigInfo ) const; void fillEfficiency( const std::string &subgroup, const std::string &level, const std::string &pidword, const TrigInfo info, std::vector< std::pair< const xAOD::Egamma *, const TrigCompositeUtils::Decision* >> pairObjs) const; - void fillDistributions( std::vector< std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*> > , TrigInfo ) const; + // Disribution monitoring void fillL1Calo( const std::string &trigger, std::vector< const xAOD::EmTauRoI* > l1_vec ) const; void fillL2Calo(const std::string &trigger, std::vector< const xAOD::TrigEMCluster*> emCluster_vec ) const; void fillL2Electron(const std::string &trigger, std::vector<const xAOD::TrigElectron*> el_vec) const; @@ -38,6 +42,13 @@ class TrigEgammaMonitorAnalysisAlgorithm: public TrigEgammaMonitorBaseAlgorithm void fillTracking(const std::string &trigger, std::vector<const xAOD::Electron *> eg_vec, bool online ) const; + // Resolution monitoring + void fillL1CaloResolution(const std::string &trigger, std::vector< std::pair< const xAOD::Egamma*, const xAOD::EmTauRoI * >> pairObjs ) const; + void fillL1CaloAbsResolution(const std::string &trigger, std::vector< std::pair< const xAOD::Egamma*, const xAOD::EmTauRoI * >> pairObjs ) const; + void fillL2CaloResolution(const std::string &trigger, std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pairObjs ) const; + void fillHLTElectronResolution(const std::string &trigger, std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pairObjs , bool) const; + void fillHLTPhotonResolution(const std::string &trigger, std::vector< std::pair< const xAOD::Egamma*, const TrigCompositeUtils::Decision * >> pairObjs , bool) const; + }; #endif diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.cxx index 3e4b5b5e088bc8763daf9081d68f2f98ee8b4cfa..a3b0cffeca07b72352ec71f21abbde3153655dca 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorBaseAlgorithm.cxx @@ -143,7 +143,7 @@ asg::AcceptData TrigEgammaMonitorBaseAlgorithm::setAccept( const TrigCompositeUt for(const auto cut:m_trigLevel) accept.addCut(cut,cut); asg::AcceptData acceptData (&accept); - + bool passedL1Calo=false; bool passedL2Calo=false; bool passedEFCalo=false; @@ -151,6 +151,8 @@ asg::AcceptData TrigEgammaMonitorBaseAlgorithm::setAccept( const TrigCompositeUt bool passedEFTrk=false; bool passedEF=false; + + auto trigger = info.trigName; passedL1Calo = match()->ancestorPassed<TrigRoiDescriptorCollection>( dec , trigger , "initialRois"); diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.cxx index 52b9dae1a9cabf735ed75dcd25561fbe8402a86b..914408c551b37eaa315a37f5b7e4d20704e3508b 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorElectronAlgorithm.cxx @@ -4,7 +4,6 @@ #include "TrigEgammaMonitorElectronAlgorithm.h" - using namespace Trig; @@ -61,7 +60,6 @@ StatusCode TrigEgammaMonitorElectronAlgorithm::fillHistograms( const EventContex std::vector< std::pair<const xAOD::Egamma*, const TrigCompositeUtils::Decision*>> pairObjs; - if ( executeNavigation( ctx, info.trigName,info.trigThrHLT,info.trigPidType, pairObjs).isFailure() ) { ATH_MSG_WARNING("executeNavigation Fails"); @@ -70,15 +68,14 @@ StatusCode TrigEgammaMonitorElectronAlgorithm::fillHistograms( const EventContex - fillDistributions( pairObjs, info ); fillEfficiencies( pairObjs, info ); + fillResolutions( pairObjs, info ); ATH_MSG_DEBUG("End Chain Analysis ============================= " << trigger); } // End loop over trigger list - return StatusCode::SUCCESS; } diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx index cee8d2319df122c632b21dd772bf11ca4dfb916c..78f5a2655640cc1b796af7781352dd60590e1fd5 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorPhotonAlgorithm.cxx @@ -69,6 +69,7 @@ StatusCode TrigEgammaMonitorPhotonAlgorithm::fillHistograms( const EventContext& fillDistributions( pairObjs, info ); fillEfficiencies( pairObjs, info ); + fillResolutions( pairObjs, info ); ATH_MSG_DEBUG("End Chain Analysis ============================= " << trigger); diff --git a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx index 165c25862711f6f28ce435e3d11ddf4f4912b5d7..732925f052bfd5d65afa0ac6ed769957608f05a8 100644 --- a/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigEgammaMonitoring/src/TrigEgammaMonitorTagAndProbeAlgorithm.cxx @@ -114,6 +114,7 @@ StatusCode TrigEgammaMonitorTagAndProbeAlgorithm::fillHistograms( const EventCon fillDistributions( pairObjs, info ); fillEfficiencies( pairObjs, info ); + fillResolutions( pairObjs, info ); @@ -265,7 +266,7 @@ bool TrigEgammaMonitorTagAndProbeAlgorithm::executeTandP( const EventContext& ct probeElectrons.push_back(selProbe); - auto mon_count_probe= Monitored::Scalar<std::string>(m_anatype+"_PorbeCutCounter","GoodProbe"); + auto mon_count_probe= Monitored::Scalar<std::string>(m_anatype+"_ProbeCutCounter","GoodProbe"); auto mon_mee = Monitored::Scalar<float>(m_anatype+"_Mee" , tpPairMass/1.e3 ); fill( monGroup , mon_count_probe, mon_mee ); } diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitorAlgorithm.py index 771517fe91f97ff53d3336e94f0f4ec391d05ca1..9263af6fac91baf69471558b29e7fccd68eec200 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/TrigHLTMonitorAlgorithm.py @@ -22,6 +22,7 @@ def createHLTDQConfigFlags(): acf.addFlag('DQ.Steering.HLT.doMuon', True) acf.addFlag('DQ.Steering.HLT.doBphys', True) acf.addFlag('DQ.Steering.HLT.doMinBias', True) + acf.addFlag('DQ.Steering.HLT.doTau', True) return acf @@ -74,6 +75,9 @@ def TrigHLTMonTopConfig(inputFlags): from TrigMinBiasMonitoring.TrigMinBiasMonitoringMT import TrigMinBias result.merge(TrigMinBias(inputFlags)) + if inputFlags.DQ.Steering.HLT.doTau: + from TrigTauMonitoring.TrigTauMonitorAlgorithm import TrigTauMonConfig + result.merge(TrigTauMonConfig(inputFlags)) return result diff --git a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDPhysValMonitoringConfig.py b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDPhysValMonitoringConfig.py index f08a8b013d43287ba3f9a28a48ea6aaf427a776d..1fc3ac1d3b0ff4064af328641f301137e1c5c23e 100644 --- a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDPhysValMonitoringConfig.py +++ b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDPhysValMonitoringConfig.py @@ -123,7 +123,9 @@ def TrigIDPhysValMonitoringTool( legacy_monitoring=False ): if mt_chains: chainnames = [ "HLT_mu.*idperf.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon", - "HLT_mu.*idperf.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon" + "HLT_mu.*idperf.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuonForEF", + "HLT_mu.*idperf.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon", + "HLT_mu.*idperf.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuonForEF" ] else: chainnames = [ diff --git a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py index 48ebb4505f53451c9e6c1566dc954ed22271c012..55bd062918373294cd0de0d2bd72cab802146d23 100644 --- a/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py +++ b/Trigger/TrigMonitoring/TrigIDtrkMonitoring/python/TrigIDtrkMonitoringConfig.py @@ -178,10 +178,9 @@ def TrigIDtrkMonitoringTool( legacy_monitoring=False ): tidamuon.ntupleChainNames += [ "Offline", "HLT_mu.*idperf.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuon", + "HLT_mu.*idperf.*:key=HLT_IDTrack_Muon_FTF:roi=HLT_Roi_L2SAMuonForEF", "HLT_mu.*idperf.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuon", - "HLT_mu.*idperf.*:key=HLT_IDTrack_MuonIso_FTF", - "HLT_mu.*idperf.*:key=HLT_IDTrack_MuonIso_IDTrig", - "HLT_mu.*idperf.*:key=HLT_IDTrack_MuonLate_IDTrig" + "HLT_mu.*idperf.*:key=HLT_IDTrack_Muon_IDTrig:roi=HLT_Roi_L2SAMuonForEF" ] else: tidamuon.ntupleChainNames += [ diff --git a/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py index d5abafd7da39a67824a1b1584093318eefffc5eb..d7a0bce9ca4d6512b899638f85288e9070abf790 100644 --- a/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigJetMonitoring/python/TrigJetMonitorAlgorithm.py @@ -63,7 +63,7 @@ Chain2JetCollDict['Legacy'] = { 'HLT_3j200' : 'HLT_xAOD__JetContainer_a4tcemsubjesISFS', } -from JetMonitoring.JetMonitoringConfig import JetMonAlgSpec, HistoSpec, SelectSpec, ToolSpec +from JetMonitoring.JetMonitoringConfig import JetMonAlgSpec, HistoSpec, EventHistoSpec, SelectSpec, ToolSpec from AthenaConfiguration.AllConfigFlags import ConfigFlags def TrigJetMonConfig(inputFlags): @@ -157,6 +157,9 @@ def basicJetMonAlgSpec(jetcoll,isOnline,athenaMT): SelectSpec( 'forward', '3.2<|eta|', path, FillerTools = ["pt","et","m"] ), SelectSpec( 'lowmu', 'avgMu<30', path, isEventVariable=True, FillerTools = ["pt","et","m","phi","eta"]), SelectSpec( 'highmu', '30<avgMu', path, isEventVariable=True, FillerTools = ["pt","et","m","phi","eta"]), + EventHistoSpec('njets', (20,0,20), title='NJets;NJets;Entries' ), + EventHistoSpec('njetsPt20', (20,0,20), title='NJetsPt20;NJetsPt20;Entries' ), + EventHistoSpec('njetsEt40Eta1_2', (10,0,10), title='NJetsEt40Eta1_2;NJetsEt40Eta1_2;Entries' ), # TProfile2D : just use 3 variables. For now the sytem will automatically # interpret it as a TProfile2D (the 3rd variable being profiled) #"phi;eta;e", # --> Average Energy vs pt and eta @@ -235,7 +238,7 @@ def jetMonitoringConfig(inputFlags,jetcoll,athenaMT): for hist in ExtraOfflineHists: conf.appendHistos(hist) if 'pf' in jetcoll or 'PF' in jetcoll: conf.appendHistos("SumPtChargedPFOPt500[0]") - conf.appendHistos("fCharge") + conf.appendHistos("fCharged") return conf diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/CMakeLists.txt b/Trigger/TrigMonitoring/TrigSteerMonitor/CMakeLists.txt index 16eb2e800adbfc69aa89eba4cfadb3beff856e81..52b3e148fb277d4bea632881e4279dbc6e67e477 100644 --- a/Trigger/TrigMonitoring/TrigSteerMonitor/CMakeLists.txt +++ b/Trigger/TrigMonitoring/TrigSteerMonitor/CMakeLists.txt @@ -1,4 +1,3 @@ -# $Id: CMakeLists.txt 780092 2016-10-24 15:34:49Z krasznaa $ ################################################################################ # Package: TrigSteerMonitor ################################################################################ @@ -52,4 +51,3 @@ atlas_add_component( TrigSteerMonitor # Install files from the package: atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitorAlgorithm.py new file mode 100644 index 0000000000000000000000000000000000000000..a1a4ec34618ef8e37f6e7e6ba1369537279cc1a7 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitorAlgorithm.py @@ -0,0 +1,63 @@ +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# + +def TrigTauMonConfig(inputFlags): + '''Function to configures some algorithms in the monitoring system.''' + + # The following class will make a sequence, configure algorithms, and link + # them to GenericMonitoringTools + from AthenaMonitoring import AthMonitorCfgHelper + helper = AthMonitorCfgHelper(inputFlags,'TrigTauAthMonitorCfg') + + from TrigTauMonitoring.TrigTauMonitoringConfigMT import TrigTauMonAlgBuilder + monAlgCfg = TrigTauMonAlgBuilder( helper, '2018', detailedHistogram=True ) # Using 2018 e/g tunings + # build monitor and book histograms + monAlgCfg.configure() + + ### STEP 6 ### + # 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 + # just return directly (and not create "result" above) + return helper.result() + +if __name__=='__main__': + # Setup the Run III behavior + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = 1 + + # Setup logs + from AthenaCommon.Logging import log + from AthenaCommon.Constants import DEBUG + log.setLevel(DEBUG) + + # Set the Athena configuration flags + from AthenaConfiguration.AllConfigFlags import ConfigFlags + nightly = '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/' + file = 'data16_13TeV.00311321.physics_Main.recon.AOD.r9264/AOD.11038520._000001.pool.root.1' + ConfigFlags.Input.Files = [nightly+file] + ConfigFlags.Input.isMC = False + ConfigFlags.Output.HISTFileName = 'TrigTauMonitorOutput.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)) + + trigTauMonitorAcc = TrigTauMonConfig(ConfigFlags) + cfg.merge(trigTauMonitorAcc) + + # If you want to turn on more detailed messages ... + #trigJetMonitorAcc.getEventAlgo('TrigTauMonAlg').OutputLevel = 2 # DEBUG + cfg.printConfig(withDetails=True) # set True for exhaustive info + + sc = cfg.run() #use cfg.run(20) to only run on first 20 events + if not sc.isSuccess(): + import sys + sys.exit("Execution failed") + + diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitoringConfigMT.py b/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitoringConfigMT.py new file mode 100644 index 0000000000000000000000000000000000000000..39bb1eb68b9ecf35e8ef9ada2ffdaad95e1a1f45 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/python/TrigTauMonitoringConfigMT.py @@ -0,0 +1,172 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +from AthenaConfiguration.ComponentFactory import CompFactory + +if 'DQMonFlags' not in dir(): + from AthenaMonitoring.DQMonFlags import DQMonFlags as dqflags + +class TrigTauMonAlgBuilder: + + _configured = False + _get_monitoring_mode_success = False + + data_type = '' + pp_mode = False + cosmic_mode = False + mc_mode = False + activate_tau = False + tauList = [] + + # Add a flag to enable emulation + __acceptable_keys_list=['derivation','emulation','detailedHistograms','basePath'] + emulation = False + derivation = False + detailedHistograms = False + basePath = 'HLT/TauMon' + + + def __init__(self, helper, runflag, **kwargs): + + from AthenaCommon.Logging import logging + self.__logger = logging.getLogger( 'TrigTauMonAlgBuilder' ) + self.runFlag = runflag + self.helper = helper + if not self._configured: + for key,value in kwargs.items(): + if key in self.__acceptable_keys_list: + setattr(self,key,value) + self.configureMode() + + def configureMode(self): + + self.__logger.info("TrigTauMonToolBuilder.configureMode()") + self._get_monitoring_mode_success = self.get_monitoring_mode() + if self._get_monitoring_mode_success is False: + self.__logger.warning("HLTMonTriggerList: Error getting monitoring mode, default monitoring lists will be used.") + else: + self.__logger.info("Configuring for %s", self.data_type) + + # Since we load the tools by name below + # Need to ensure the correct tools are configured + # for each monitoring mode + if self.mc_mode is True or self.pp_mode is True: + if(self.derivation is True or self.emulation is True): + self.activate_tau = True + else: + self.activate_tau=True + else: + self.activate_tau=True + """ self.activate_jpsiee=True + self.activate_electron=True + self.activate_photon=True + elif self.HI_mode is True or self.pPb_mode is True or self.cosmic_mode is True: + self.activate_electron=True + self.activate_photon=True + else: + self.activate_zee=True + self.activate_jpsiee=True + self.activate_electron=True + self.activate_photon=True""" + + + def configure(self): + self.setProperties() + self.configureMonitor() + self.configureHistograms() + + + + + + def get_monitoring_mode(self): + + self.__logger.info("TrigTauMonToolBuilder.get_monitoring_mode()") + self.data_type = dqflags.monManDataType() + if self.data_type == 'monteCarlo': + self.mc_mode = True + return True + elif self.data_type == 'collisions': + self.pp_mode = True + return True + elif self.data_type == 'cosmics': + self.cosmic_mode = True + return True + else: + return False + + + def setProperties(self): + + self.__logger.info("TrigTauMonToolBuilder.setProperties()") + self.basePath = 'HLT/TauMon' + + if self.pp_mode is True: + self.setDefaultProperties() + elif self.cosmic_mode is True: + # This should be change in future + self.setDefaultProperties() + elif self.mc_mode is True: + # This should be change in future + self.setDefaultProperties() + else: + self.__logger.info('No monitoring mode configured, use default') + self.setDefaultProperties() + + + self.__logger.info('Configuring tau chains %s',self.tauList) + + + def setDefaultProperties(self): + + # This will be removed for future. + monitoring_tau = ['HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM'] + + self.tauList = monitoring_tau + + # + # Create all minitor algorithms + # + def configureMonitor( self ): + + if self.activate_tau: + + self.__logger.info( "Creating the Tau monitor algorithm...") + self.tauMonAlg = self.helper.addAlgorithm( CompFactory.TrigTauMonitorAlgorithm, "TrigTauMonAlg" ) + self.tauMonAlg.TriggerList=self.tauList + + + + def configureHistograms(self): + + if self.activate_tau and self.tauMonAlg: + self.bookExpertHistograms( self.tauMonAlg, self.tauMonAlg.TriggerList ) + + # + # Booking all histograms + # + def bookExpertHistograms( self, monAlg, triggers ): + + self.__logger.info( "Booking all histograms for alg: %s", monAlg.name ) + + for trigger in triggers: + self.bookRNNInputVars( monAlg, trigger, online=True ) + self.bookRNNInputVars( monAlg, trigger, online=False ) + + + # + # Book Shower shapes + # + def bookRNNInputVars( self, monAlg, trigger, online=True ): + + monGroup = self.helper.addGroup( monAlg, trigger+'_RNNInputVars_' + ("HLT" if online else "Offline"), + self.basePath+'/'+trigger+'/RNNInputVars/' + ("HLT" if online else "Offline") ) + + monGroup.defineHistogram('centFrac', title='Centrality Fraction (1Prong); centFrac; Events',xbins=50,xmin=-0.05,xmax=1.2) + monGroup.defineHistogram('etOverPtLeadTrk', title='etOverPtLeadTrk log (1Prong); etOverPtLeadTrk_log; Events',xbins=60,xmin=-3.,xmax=3.) + monGroup.defineHistogram('dRmax', title='max dR of associated tracks (1Prong); dRmax; Events',xbins=50,xmin=-0.1,xmax=0.3) + monGroup.defineHistogram('absipSigLeadTrk', title='AbsIpSigLeadTrk (1Prong); absipSigLeadTrk; Events',xbins=25,xmin=0.0,xmax=20.0) + monGroup.defineHistogram('sumPtTrkFrac', title='SumPtTrkFrac (1Prong); SumPtTrkFrac; Events',xbins=50,xmin=-0.5,xmax=1.1) + monGroup.defineHistogram('emPOverTrkSysP', title='EMPOverTrkSysP log (1Prong); EMPOverTrkSysP_log; Events',xbins=50,xmin=-5.,xmax=3.) + monGroup.defineHistogram('ptRatioEflowApprox', title='ptRatioEflowApprox (1Prong); ptRatioEflowApprox; Events',xbins=50,xmin=0.0,xmax=2.0) + monGroup.defineHistogram('mEflowApprox', title='mEflowApprox log (1Prong); mEflowApprox_log; Events',xbins=50,xmin=0.,xmax=5.) + monGroup.defineHistogram('ptDetectorAxis', title='ptDetectorAxis log (1Prong); ptDetectorAxis_log; Events',xbins=50,xmin=0.,xmax=5.) diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7655152a5ba654e1ea2868892008c6b988d0f159 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.cxx @@ -0,0 +1,171 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigTauMonitorAlgorithm.h" + +TrigTauMonitorAlgorithm::TrigTauMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) + : AthMonitorAlgorithm(name,pSvcLocator) +{} + + +TrigTauMonitorAlgorithm::~TrigTauMonitorAlgorithm() {} + + +StatusCode TrigTauMonitorAlgorithm::initialize() { + + ATH_CHECK( m_offlineTauJetKey.initialize() ); + ATH_CHECK( m_l1TauRoIKey.initialize() ); + ATH_CHECK( m_hltTauJetKey.initialize() ); + ATH_CHECK( m_hltTauJetPrecisionKey.initialize() ); + ATH_CHECK( m_hltTauJetPreselKey.initialize() ); + ATH_CHECK( m_hltTauJetCaloOnlyMVAKey.initialize() ); + ATH_CHECK( m_hltTauJetCaloOnlyKey.initialize() ); + ATH_CHECK( m_trigDecTool.retrieve() ); + + return AthMonitorAlgorithm::initialize(); +} + + +StatusCode TrigTauMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const { + //using namespace Monitored; + + ATH_MSG_DEBUG("Executing TrigTauMonitorAlgorithm"); + + if(m_trigDecTool->ExperimentalAndExpertMethods()->isHLTTruncated()){ + ATH_MSG_WARNING("HLTResult truncated, skip trigger analysis"); + return StatusCode::SUCCESS; + } + + ATH_MSG_DEBUG("Chains for Analysis " << m_trigInputList); + + std::vector< std::pair<const xAOD::TauJet*, const TrigCompositeUtils::Decision*>> pairObjs; + + for(const auto trigger : m_trigInputList){ + + if ( executeNavigation( ctx, trigger,25,"mediumRNN", pairObjs).isFailure() ) + { + ATH_MSG_WARNING("executeNavigation failed"); + return StatusCode::SUCCESS; + } + + fillDistributions( pairObjs, trigger ); + } + + return StatusCode::SUCCESS; +} + + +StatusCode TrigTauMonitorAlgorithm::executeNavigation( const EventContext& ctx, + const std::string trigItem, + float etthr, + const std::string pidname, + std::vector<std::pair<const xAOD::TauJet*, const TrigCompositeUtils::Decision* >> &pairObjs) const +{ + + ATH_MSG_DEBUG("Apply navigation selection "); + + SG::ReadHandle<xAOD::TauJetContainer> offTaus(m_offlineTauJetKey, ctx); + + const double thresholdOffset{10.0}; + + if(!offTaus.isValid()) + { + ATH_MSG_WARNING("Failed to retrieve offline Taus "); + return StatusCode::FAILURE; + } + + for(const auto& Tau : *offTaus ){ + + const TrigCompositeUtils::Decision *dec=nullptr; + + if( !( Tau->p4().Pt() > (etthr-thresholdOffset)*1.e3) ) continue; + + if((pidname.find("mediumRNN") != std::string::npos) && !Tau->isTau(xAOD::TauJetParameters::JetRNNSigMedium)) continue; + + auto vec = m_trigDecTool->features<xAOD::TauJetContainer>(trigItem,TrigDefs::includeFailedDecisions ,"HLT_TrigTauRecMerged_MVA"); + for( auto &featLinkInfo : vec ){ + if(! featLinkInfo.isValid() ) continue; + const auto *feat = *(featLinkInfo.link); + if(!feat) continue; + float deltaR = dR(Tau->eta(),Tau->phi(), feat->eta(),feat->phi()); + if(deltaR < 0.4){ + dec = featLinkInfo.source; + } + } + + + std::pair< const xAOD::TauJet*, const TrigCompositeUtils::Decision * > pair(Tau,dec); + pairObjs.push_back(pair); + + } + + ATH_MSG_DEBUG("BaseToolMT::Tau TEs " << pairObjs.size() << " found."); + return StatusCode::SUCCESS; +} + +void TrigTauMonitorAlgorithm::fillDistributions(std::vector< std::pair< const xAOD::TauJet*, const TrigCompositeUtils::Decision * >> pairObjs, std::string trigger) const +{ + + // Offline + std::vector<const xAOD::TauJet*> tau_vec; + for( auto pairObj: pairObjs ) + { + tau_vec.push_back(pairObj.first); + } + + // Offline + fillRNNInputVars( trigger, tau_vec, false ); + +} + +void TrigTauMonitorAlgorithm::fillRNNInputVars(const std::string trigger, std::vector<const xAOD::TauJet*> tau_vec, bool online) const +{ + ATH_MSG_DEBUG("Fill RNN input variables: " << trigger); + + auto monGroup = getGroup(trigger+( online ? "_RNNInputVars_HLT" : "_RNNInputVars_Offline")); + + auto centFrac = Monitored::Collection("centFrac", tau_vec, [] (const xAOD::TauJet* tau){ + float detail = -999; + if (tau->detail(xAOD::TauJetParameters::centFrac, detail)){ + detail = std::min(detail, 1.0f); + } return detail;}); + auto etOverPtLeadTrk = Monitored::Collection("etOverPtLeadTrk", tau_vec, [] (const xAOD::TauJet* tau){ + float detail = -999; + if (tau->detail(xAOD::TauJetParameters::etOverPtLeadTrk, detail)){ + detail = TMath::Log10(std::max(detail, 0.1f)); + } return detail;}); + auto dRmax = Monitored::Collection("dRmax", tau_vec, [] (const xAOD::TauJet* tau){ + float detail = -999; + if (tau->detail(xAOD::TauJetParameters::dRmax, detail)){ + } return detail;}); + auto absipSigLeadTrk = Monitored::Collection("absipSigLeadTrk", tau_vec, [] (const xAOD::TauJet* tau){ + float detail = -999; + if (tau->detail(xAOD::TauJetParameters::ipSigLeadTrk, detail)){ + detail = std::min(TMath::Abs(detail), 30.0f); + } return detail;}); + auto sumPtTrkFrac = Monitored::Collection("sumPtTrkFrac", tau_vec, [] (const xAOD::TauJet* tau){ + float detail = -999; + if (tau->detail(xAOD::TauJetParameters::SumPtTrkFrac, detail)){ + } return detail;}); + auto emPOverTrkSysP = Monitored::Collection("emPOverTrkSysP", tau_vec, [] (const xAOD::TauJet* tau){ + float detail = -999; + if (tau->detail(xAOD::TauJetParameters::EMPOverTrkSysP, detail)){ + detail = TMath::Log10(std::max(detail, 1e-3f)); + } return detail;}); + auto ptRatioEflowApprox = Monitored::Collection("ptRatioEflowApprox", tau_vec, [] (const xAOD::TauJet* tau){ + float detail = -999; + if (tau->detail(xAOD::TauJetParameters::ptRatioEflowApprox, detail)){ + detail = std::min(detail, 4.0f); + } return detail;}); + auto mEflowApprox = Monitored::Collection("mEflowApprox", tau_vec, [] (const xAOD::TauJet* tau){ + float detail = -999; + if (tau->detail(xAOD::TauJetParameters::mEflowApprox, detail)){ + detail = TMath::Log10(std::max(detail, 140.0f)); + }return detail;}); + auto ptDetectorAxis = Monitored::Collection("ptDetectorAxis", tau_vec, [] (const xAOD::TauJet* tau){ + return TMath::Log10(std::min(tau->ptDetectorAxis() / 1000.0, 100.0));}); + + fill(monGroup, centFrac,etOverPtLeadTrk,dRmax,absipSigLeadTrk,sumPtTrkFrac,emPOverTrkSysP,ptRatioEflowApprox,mEflowApprox,ptDetectorAxis); + +} diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.h b/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..1e38d15898d16a6cd58dce85b6f0b536e735ef13 --- /dev/null +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/src/TrigTauMonitorAlgorithm.h @@ -0,0 +1,56 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGTAUMONITORING_TRIGTAUMONITORALGORITHM_H +#define TRIGTAUMONITORING_TRIGTAUMONITORALGORITHM_H + + +#include "xAODTau/TauJet.h" +#include "xAODTau/TauxAODHelpers.h" +#include "xAODTau/TauJetContainer.h" + + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoringKernel/Monitored.h" + +#include "CxxUtils/phihelper.h" + +class TrigTauMonitorAlgorithm : public AthMonitorAlgorithm { + public: + TrigTauMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ); + virtual ~TrigTauMonitorAlgorithm(); + virtual StatusCode initialize() override; + virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + + private: + + /*! List of triggers from menu */ + Gaudi::Property<std::vector<std::string>> m_trigInputList{this, "TriggerList", {}}; + + /*! navigation method called by executeNavigation */ + StatusCode executeNavigation(const EventContext& ctx, const std::string trigItem,float, const std::string, + std::vector<std::pair<const xAOD::TauJet*, const TrigCompositeUtils::Decision*>> &) const; + + void fillRNNInputVars(const std::string trigger, std::vector<const xAOD::TauJet*> tau_vec, bool online) const; + + void fillDistributions(std::vector< std::pair< const xAOD::TauJet*, const TrigCompositeUtils::Decision * >> pairObjs, const std::string trigger) const; + + inline double dR(const double eta1, const double phi1, const double eta2, const double phi2) const + { + double deta = std::fabs(eta1 - eta2); + double dphi = std::fabs(CxxUtils::wrapToPi(phi1-phi2)); + return sqrt(deta*deta + dphi*dphi); + }; + + + SG::ReadHandleKey< xAOD::TauJetContainer> m_offlineTauJetKey { this, "offlineTauJetKey", "TauJets", "Offline taujet container key" }; + SG::ReadHandleKey< xAOD::EmTauRoIContainer > m_l1TauRoIKey { this, "l1TauRoIKey","LVL1EmTauRoIs","Tau L1 RoI key"}; + SG::ReadHandleKey< xAOD::TauJetContainer> m_hltTauJetKey { this, "hltTauJetKey", "HLT_TrigTauRecMerged_MVA", "HLT taujet container key" }; + SG::ReadHandleKey< xAOD::TauJetContainer> m_hltTauJetPrecisionKey { this, "hltTauJetPrecisionKey", "HLT_TrigTauRecMerged_Precision", "HLT taujet container key" }; + SG::ReadHandleKey< xAOD::TauJetContainer> m_hltTauJetPreselKey { this, "hltTauJetPreselKey", "HLT_TrigTauRecMerged_Presel", "HLT taujet container key" }; + SG::ReadHandleKey< xAOD::TauJetContainer> m_hltTauJetCaloOnlyMVAKey { this, "hltTauJetCaloOnlyMVAKey", "HLT_TrigTauRecMerged_CaloOnlyMVA", "HLT taujet container key" }; + SG::ReadHandleKey< xAOD::TauJetContainer> m_hltTauJetCaloOnlyKey { this, "hltTauJetCaloOnlyKey", "HLT_TrigTauRecMerged_CaloOnly", "HLT taujet container key" }; + +}; +#endif diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/src/components/TrigTauMonitoring_entries.cxx b/Trigger/TrigMonitoring/TrigTauMonitoring/src/components/TrigTauMonitoring_entries.cxx index 7ed4c7c0b3bff8dfa84483957c4d23d416ef7932..b1c354d31282dec3bf04c08bbe9ec6d015e8bd5e 100644 --- a/Trigger/TrigMonitoring/TrigTauMonitoring/src/components/TrigTauMonitoring_entries.cxx +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/src/components/TrigTauMonitoring_entries.cxx @@ -1,6 +1,6 @@ #include "../HLTTauMonTool.h" - +#include "../TrigTauMonitorAlgorithm.h" DECLARE_COMPONENT( HLTTauMonTool ) - +DECLARE_COMPONENT( TrigTauMonitorAlgorithm ) diff --git a/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt b/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt index f8965dddb8030200d62a8e397ff3972f5ef14040..dd2b5d91ab064eb4abb32e3d6adf47364bc1a94b 100644 --- a/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt +++ b/Trigger/TrigSteer/DecisionHandling/CMakeLists.txt @@ -7,7 +7,6 @@ atlas_add_library( DecisionHandlingLib src/ComboHypo.cxx src/ComboHypoToolBase.cxx src/DumpDecisions.cxx - src/HLTIdentifier.cxx src/HypoBase.cxx src/InputMakerBase.cxx PUBLIC_HEADERS DecisionHandling diff --git a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx index a5775365246c8f1726071837f5f7c752df58f1ce..ecb012901a29d84399e670888d8512770cb15304 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.cxx @@ -18,7 +18,7 @@ using TrigCompositeUtils::newDecisionIn; RoRSeqFilter::RoRSeqFilter( const std::string& name, ISvcLocator* pSvcLocator ) : - ::AthAlgorithm( name, pSvcLocator ) + ::AthReentrantAlgorithm( name, pSvcLocator ) {} @@ -71,15 +71,17 @@ StatusCode RoRSeqFilter::initialize() } -StatusCode RoRSeqFilter::execute() { +StatusCode RoRSeqFilter::execute(const EventContext& ctx) const { ATH_MSG_DEBUG ( "Executing " << name() << "..." ); - auto inputHandles = m_inputKeys.makeHandles(); - auto outputHandles = m_outputKeys.makeHandles(); + auto inputHandles = m_inputKeys.makeHandles(ctx); + auto outputHandles = m_outputKeys.makeHandles(ctx); std::vector<std::string> inputNames({"exec", "anyvalid"}); std::vector<bool> inputStats({true, false}); // position 0 for number of execs, always true, bool at position 1 is set later + inputNames.reserve(inputHandles.size() + 2); + inputStats.reserve(inputHandles.size() + 2); bool validInputs = false; - for ( auto inputHandle: inputHandles ) { + for ( auto& inputHandle: inputHandles ) { inputNames.push_back(inputHandle.name()); if( inputHandle.isValid() ) {// this is because input is implicit validInputs = true; @@ -94,7 +96,7 @@ StatusCode RoRSeqFilter::execute() { Monitored::Group( m_monTool, inputStat, inputName ); if (!validInputs) { - setFilterPassed(false); + setFilterPassed(false, ctx); ATH_MSG_DEBUG ( "No valid inputs found, filter failed. Return...." ); return StatusCode::SUCCESS; } @@ -108,25 +110,23 @@ StatusCode RoRSeqFilter::execute() { ATH_MSG_DEBUG( "Recording " << m_outputKeys[ 0 ].key() ); createAndStore(outputHandles[0]); DecisionContainer* output = outputHandles[0].ptr(); - for ( auto inputKey: m_inputKeys ) { - auto inputHandle = SG::makeHandle( inputKey ); - if( inputHandle.isValid() ) + for ( auto& inputHandle: inputHandles) { + if( inputHandle.isValid() ) { passCounter += copyPassing( *inputHandle, *output ); + } } outputIndex++; } else { // Not merging inputs - for ( auto inputKey: m_inputKeys ) { - // already made handles, so this code could be simplified to a loop over inputHandles. - auto inputHandle = SG::makeHandle( inputKey ); + for ( auto& inputHandle: inputHandles ) { if( not inputHandle.isValid() ) { - ATH_MSG_DEBUG( "InputHandle "<< inputKey.key() <<" not present" ); + ATH_MSG_DEBUG( "InputHandle "<< inputHandle.key() <<" not present" ); } else if ( inputHandle->empty() ) { - ATH_MSG_DEBUG( "InputHandle "<< inputKey.key() <<" contains all rejected decisions, skipping" ); + ATH_MSG_DEBUG( "InputHandle "<< inputHandle.key() <<" contains all rejected decisions, skipping" ); } else { - ATH_MSG_DEBUG( "Checking inputHandle: "<< inputKey.key() <<" has " << inputHandle->size() <<" elements"); + ATH_MSG_DEBUG( "Checking inputHandle: "<< inputHandle.key() <<" has " << inputHandle->size() <<" elements"); createAndStore(outputHandles[outputIndex]); DecisionContainer* output = outputHandles[outputIndex].ptr(); passCounter += copyPassing( *inputHandle, *output ); @@ -134,13 +134,12 @@ StatusCode RoRSeqFilter::execute() { } outputIndex++; // Keep the mapping of inputKey<->outputKey correct } - } - setFilterPassed( passCounter != 0 ); - ATH_MSG_DEBUG( "Filter " << ( filterPassed() ? "passed" : "rejected") <<"; creating "<< outputIndex<<" valid outDecisions DH:"); + setFilterPassed( passCounter != 0, ctx ); + ATH_MSG_DEBUG( "Filter " << ( filterPassed(ctx) ? "passed" : "rejected") <<"; creating "<< outputIndex<<" valid outDecisions DH:"); if (msgLvl(MSG::DEBUG)){ - for (auto output: outputHandles){ + for (auto& output: outputHandles){ if( output.isValid() ) ATH_MSG_DEBUG(" "<<output.key()); } } diff --git a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.h b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.h index cfb712abc0bcbcac2fd0c344e0d5ee5f2cc685ed..ac24edb149317fb1dd4986f82cfd09575b60de35 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.h +++ b/Trigger/TrigSteer/DecisionHandling/src/RoRSeqFilter.h @@ -7,7 +7,7 @@ #include <string> #include <set> -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "AthContainers/ConstDataVector.h" #include "TrigCompositeUtils/TrigCompositeUtils.h" #include "TrigCompositeUtils/HLTIdentifier.h" @@ -44,7 +44,7 @@ **/ class RoRSeqFilter - : public ::AthAlgorithm + : public ::AthReentrantAlgorithm { public: RoRSeqFilter( const std::string& name, ISvcLocator* pSvcLocator ); @@ -58,7 +58,7 @@ class RoRSeqFilter * @brief Apply this filter in-between Steps of trigger execution. Fully implicit inputs, requires Control Flow to unlock. * will signal a negative filter result to the Scheduler if zero chains remain active upon termination. **/ - virtual StatusCode execute() override; + virtual StatusCode execute(const EventContext& ctx) const override; private: RoRSeqFilter(); diff --git a/Trigger/TrigSteer/L1Decoder/CMakeLists.txt b/Trigger/TrigSteer/L1Decoder/CMakeLists.txt index a193a908806b6d10b83728166639d8cb0fe4d7f7..721cd807f4a53391ced76e492c30b73c7d7bb16c 100644 --- a/Trigger/TrigSteer/L1Decoder/CMakeLists.txt +++ b/Trigger/TrigSteer/L1Decoder/CMakeLists.txt @@ -17,16 +17,9 @@ atlas_add_component( L1Decoder INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} LINK_LIBRARIES ${CLHEP_LIBRARIES} AthViews AthenaBaseComps AthenaKernel AthenaMonitoringKernelLib GaudiKernel L1DecoderLib StoreGateLib TrigCompositeUtilsLib TrigConfData TrigConfHLTData TrigConfInterfaces TrigConfL1Data TrigCostMonitorMTLib TrigSteeringEvent TrigT1Interfaces TrigT1Result TrigTimeAlgsLib xAODEventInfo xAODTrigger ) -atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) - # Install files from the package: -atlas_install_joboptions( share/*.py ) -atlas_install_scripts( test/test* ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) # Tests: atlas_add_test( L1DecoderNJOTest SCRIPT python -m L1Decoder.L1DecoderConfig PROPERTIES TIMEOUT 300 ) - -atlas_add_test( L1DecoderTest - SCRIPT test/test_l1decoder.sh - PROPERTIES TIMEOUT 1200 ) diff --git a/Trigger/TrigSteer/L1Decoder/share/AccumulatorTest.ref b/Trigger/TrigSteer/L1Decoder/share/AccumulatorTest.ref deleted file mode 100644 index a99ab2187cd7dcb2a170c2173af138278fd8269f..0000000000000000000000000000000000000000 --- a/Trigger/TrigSteer/L1Decoder/share/AccumulatorTest.ref +++ /dev/null @@ -1,28 +0,0 @@ - Flag Name : Value - LAr.doAlign : [function] - GeoModel.AtlasVersion : 'ATLAS-R2-2016-01-00-01' - Calo.Noise.fixedLumiForNoise : -1 -Calo.TopoCluster.doTreatEnergyCutAsAbsol : False - Trigger.inputLVL1ConfigFile : 'UNSPECIFIED' - Calo.TopoCluster.doTwoGaussianNoise : True - global.ProjectName : 'data17_13TeV' - global.GeoLayout : 'atlas' - global.estimatedLuminosity : [function] - global.NumberOfCollisions : 0 - global.BeamEnergy : 7000000.0 - LAr.doHVCorr : [function] - IOVDb.GlobalTag : 'CONDBR2-BLKPA-2017-05' - global.isOnline : False - global.InputFiles : ['_ATHENA_GENERIC_INPUTFILE_NAME_'] - Trigger.L1Decoder.forceEnableAllChains : True - Trigger.L1Decoder.doMuon : True - Trigger.L1Decoder.doCalo : True - IOVDb.DatabaseInstance : [function] - global.BunchSpacing : 25 - global.BeamType : 'collisions' - global.isMC : True - Calo.Noise.useCaloNoiseLumi : True - LAr.doCellEmMisCalib : [function] -ComponentAccumulator.py:addConfig INFO Excuting configuration function TrigConfigSvcCfg -Py:ConfigurableDb INFO Read module info for 2838 configurables from 2 genConfDb files -Py:ConfigurableDb INFO No duplicates have been found: that's good ! diff --git a/Trigger/TrigSteer/L1Decoder/share/testL1Decoder.py b/Trigger/TrigSteer/L1Decoder/share/testL1Decoder.py deleted file mode 100644 index ccab99250e5f8b201528442502fb0c7d05e2855c..0000000000000000000000000000000000000000 --- a/Trigger/TrigSteer/L1Decoder/share/testL1Decoder.py +++ /dev/null @@ -1,41 +0,0 @@ -from __future__ import print_function - -doWriteRDOTrigger = False -doWriteBS = False -include("TriggerJobOpts/runHLT_standalone.py") - - -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - - -topSequence.L1Decoder.ctpUnpacker.OutputLevel=DEBUG -for unpack in topSequence.L1Decoder.roiUnpackers: - unpack.OutputLevel=DEBUG - print (unpack) - - -# from TriggerMenuMT.HLTMenuConfig.Menu.TriggerConfigHLT import TriggerConfigHLT -# from TriggerMenuMT.HLTMenuConfig.Menu.ChainDefInMenu import ChainProp -# c = ChainProp( name="HLT_j85_L1J20" ) -# from TriggerMenuMT.HLTMenuConfig.Menu.DictFromChainName import dictFromChainName -# from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import Chain - -# chainConfig = Chain( name="HLT_j85_L1J20", L1Thresholds=['J20'], ChainSteps=[] ) -# TriggerConfigHLT.registerChain( dictFromChainName( c ), chainConfig ) - -from TriggerMenuMT.HLTMenuConfig.Menu.HLTMenuJSON import generateJSON -generateJSON() - -print (topSequence.L1Decoder) - -#from TrigUpgradeTest.jetDefs import jetRecoSequence -#(recoSequence, sequenceOut) = jetRecoSequence("FSRoI") -#topSequence += recoSequence - -from TriggerJobOpts.TriggerFlags import TriggerFlags -hltJsonFile = TriggerFlags.inputHLTconfigFile().replace(".xml",".json").replace("HLTconfig","HLTmenu") -from TrigConfigSvc.TrigConfigSvcConfig import HLTConfigSvc, findFileInXMLPATH -hltJsonFile = findFileInXMLPATH(hltJsonFile) -svcMgr += HLTConfigSvc() -svcMgr.HLTConfigSvc.JsonFileName = hltJsonFile diff --git a/Trigger/TrigSteer/L1Decoder/test/test_l1decoder.sh b/Trigger/TrigSteer/L1Decoder/test/test_l1decoder.sh deleted file mode 100755 index 0baa8ad104982b6409cbfc9f2cf58c69a94d3124..0000000000000000000000000000000000000000 --- a/Trigger/TrigSteer/L1Decoder/test/test_l1decoder.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -# art-type: build -# art-ci: master -# art-include: master/Athena - -athena --threads=1 --skipEvents=5 --evtMax=20 --filesInput="/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/TrigP1Test/data17_13TeV.00327265.physics_EnhancedBias.merge.RAW._lb0100._SFO-1._0001.1" L1Decoder/testL1Decoder.py diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/HLTEDMCreator.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/HLTEDMCreator.cxx index e201d1df9949a36f258e60002fd7a7fe6d6a2674..5e6d421213f59c0ed9d202a08fab7893f2ac8338 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/HLTEDMCreator.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/HLTEDMCreator.cxx @@ -94,6 +94,7 @@ StatusCode HLTEDMCreator::initialize() INIT_XAOD( VertexContainer ); INIT_XAOD( TrigBphysContainer ); INIT_XAOD( BTaggingContainer ); + INIT_XAOD( BTagVertexContainer ); INIT_XAOD( CaloClusterContainer ); @@ -362,6 +363,7 @@ StatusCode HLTEDMCreator::createOutput(const EventContext& context) const { CREATE_XAOD( VertexContainer,VertexAuxContainer ); CREATE_XAOD( TrigBphysContainer, TrigBphysAuxContainer ); CREATE_XAOD( BTaggingContainer,BTaggingAuxContainer ); + CREATE_XAOD( BTagVertexContainer,BTagVertexAuxContainer ); ATH_CHECK( fixLinks() ); diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/HLTEDMCreator.h b/Trigger/TrigSteer/TrigOutputHandling/src/HLTEDMCreator.h index bed802d14a4206e15f1fe5625cffef015cfc259c..0e700a28e6a158f93d55a0269950d9b315984a77 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/HLTEDMCreator.h +++ b/Trigger/TrigSteer/TrigOutputHandling/src/HLTEDMCreator.h @@ -61,6 +61,8 @@ #include "xAODTrigBphys/TrigBphysAuxContainer.h" #include "xAODBTagging/BTaggingContainer.h" #include "xAODBTagging/BTaggingAuxContainer.h" +#include "xAODBTagging/BTagVertexContainer.h" +#include "xAODBTagging/BTagVertexAuxContainer.h" #include "xAODCaloEvent/CaloClusterContainer.h" #include "xAODTrigCalo/CaloClusterTrigAuxContainer.h" @@ -137,6 +139,7 @@ class HLTEDMCreator: public extends<AthAlgTool, IHLTOutputTool> { DEF_XAOD_KEY( JetContainer ); DEF_XAOD_KEY( VertexContainer ); DEF_XAOD_KEY( BTaggingContainer ); + DEF_XAOD_KEY( BTagVertexContainer ); DEF_XAOD_KEY( TrigBphysContainer ); #undef DEF_VIEWS #undef DEF_KEY diff --git a/Trigger/TrigSteer/TrigSteering/CMakeLists.txt b/Trigger/TrigSteer/TrigSteering/CMakeLists.txt index ad998b910f415fd881093d0bcd899694a23f3bf6..068ea781f60e4efc4e6bae438043b34292b9e513 100644 --- a/Trigger/TrigSteer/TrigSteering/CMakeLists.txt +++ b/Trigger/TrigSteer/TrigSteering/CMakeLists.txt @@ -18,7 +18,6 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigConfiguration/TrigConfBase Trigger/TrigConfiguration/TrigConfHLTData Trigger/TrigConfiguration/TrigConfInterfaces - Trigger/TrigDataAccess/TrigROBDataProviderSvc Trigger/TrigEvent/TrigSteeringEvent Trigger/TrigT1/L1Topo/L1TopoAlgorithms Trigger/TrigT1/L1Topo/L1TopoCoreSim @@ -58,25 +57,25 @@ atlas_add_library( TrigSteeringLib PUBLIC_HEADERS TrigSteering PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES AthenaBaseComps AthenaKernel AthContainers EventInfo xAODEventInfo GaudiKernel TrigConfBase TrigConfHLTData TrigSteeringEvent L1TopoAlgorithms L1TopoCoreSim L1TopoEvent TrigT1CaloToolInterfaces TrigT1Result AthenaMonitoringLib StoreGateLib SGtests TrigROBDataProviderSvcLib L1TopoSimulationLib TrigT1CaloEventLib TrigTimeAlgsLib ByteStreamCnvSvcBaseLib TrigSerializeResultLib TrigNavigationLib TrigMonitorBaseLib TrigInterfacesLib + LINK_LIBRARIES AthenaBaseComps AthenaKernel AthContainers EventInfo xAODEventInfo GaudiKernel TrigConfBase TrigConfHLTData TrigSteeringEvent L1TopoAlgorithms L1TopoCoreSim L1TopoEvent TrigT1CaloToolInterfaces TrigT1Result AthenaMonitoringLib StoreGateLib SGtests L1TopoSimulationLib TrigT1CaloEventLib TrigTimeAlgsLib ByteStreamCnvSvcBaseLib TrigSerializeResultLib TrigNavigationLib TrigMonitorBaseLib TrigInterfacesLib PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} TestTools xAODTrigger TrigConfL1Data TrigStorageDefinitions L1TopoCommon L1TopoConfig TrigT1Interfaces ) atlas_add_component( TrigSteering src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringLib AthContainers StoreGateLib SGtests EventInfo xAODEventInfo GaudiKernel TrigConfBase TrigConfHLTData TrigROBDataProviderSvcLib TrigSteeringEvent L1TopoAlgorithms L1TopoCoreSim L1TopoEvent L1TopoSimulationLib TrigT1CaloEventLib TrigT1CaloToolInterfaces TrigT1Result TrigTimeAlgsLib TestTools ByteStreamCnvSvcBaseLib xAODTrigger TrigConfL1Data TrigSerializeResultLib TrigNavigationLib TrigStorageDefinitions TrigMonitorBaseLib TrigInterfacesLib L1TopoCommon L1TopoConfig TrigT1Interfaces TrigSteeringLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringLib AthContainers StoreGateLib SGtests EventInfo xAODEventInfo GaudiKernel TrigConfBase TrigConfHLTData TrigSteeringEvent L1TopoAlgorithms L1TopoCoreSim L1TopoEvent L1TopoSimulationLib TrigT1CaloEventLib TrigT1CaloToolInterfaces TrigT1Result TrigTimeAlgsLib TestTools ByteStreamCnvSvcBaseLib xAODTrigger TrigConfL1Data TrigSerializeResultLib TrigNavigationLib TrigStorageDefinitions TrigMonitorBaseLib TrigInterfacesLib L1TopoCommon L1TopoConfig TrigT1Interfaces TrigSteeringLib ) atlas_add_dictionary( TrigSteeringDict TrigSteering/TrigSteeringDict.h TrigSteering/selection.xml INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} -LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringLib AthContainers StoreGateLib SGtests EventInfo xAODEventInfo GaudiKernel TrigConfBase TrigConfHLTData TrigROBDataProviderSvcLib TrigSteeringEvent L1TopoAlgorithms L1TopoCoreSim L1TopoEvent L1TopoSimulationLib TrigT1CaloEventLib TrigT1CaloToolInterfaces TrigT1Result TrigTimeAlgsLib TestTools ByteStreamCnvSvcBaseLib xAODTrigger TrigConfL1Data TrigSerializeResultLib TrigNavigationLib TrigStorageDefinitions TrigMonitorBaseLib TrigInterfacesLib L1TopoCommon L1TopoConfig TrigT1Interfaces TrigSteeringLib ) +LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringLib AthContainers StoreGateLib SGtests EventInfo xAODEventInfo GaudiKernel TrigConfBase TrigConfHLTData TrigSteeringEvent L1TopoAlgorithms L1TopoCoreSim L1TopoEvent L1TopoSimulationLib TrigT1CaloEventLib TrigT1CaloToolInterfaces TrigT1Result TrigTimeAlgsLib TestTools ByteStreamCnvSvcBaseLib xAODTrigger TrigConfL1Data TrigSerializeResultLib TrigNavigationLib TrigStorageDefinitions TrigMonitorBaseLib TrigInterfacesLib L1TopoCommon L1TopoConfig TrigT1Interfaces TrigSteeringLib ) atlas_add_test( Signature_test SOURCES test/Signature_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringLib AthContainers StoreGateLib SGtests EventInfo xAODEventInfo GaudiKernel TrigConfBase TrigConfHLTData TrigROBDataProviderSvcLib TrigSteeringEvent L1TopoAlgorithms L1TopoCoreSim L1TopoEvent L1TopoSimulationLib TrigT1CaloEventLib TrigT1CaloToolInterfaces TrigT1Result TrigTimeAlgsLib TestTools ByteStreamCnvSvcBaseLib xAODTrigger TrigConfL1Data TrigSerializeResultLib TrigNavigationLib TrigStorageDefinitions TrigMonitorBaseLib TrigInterfacesLib L1TopoCommon L1TopoConfig TrigT1Interfaces TrigSteeringLib + LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringLib AthContainers StoreGateLib SGtests EventInfo xAODEventInfo GaudiKernel TrigConfBase TrigConfHLTData TrigSteeringEvent L1TopoAlgorithms L1TopoCoreSim L1TopoEvent L1TopoSimulationLib TrigT1CaloEventLib TrigT1CaloToolInterfaces TrigT1Result TrigTimeAlgsLib TestTools ByteStreamCnvSvcBaseLib xAODTrigger TrigConfL1Data TrigSerializeResultLib TrigNavigationLib TrigStorageDefinitions TrigMonitorBaseLib TrigInterfacesLib L1TopoCommon L1TopoConfig TrigT1Interfaces TrigSteeringLib POST_EXEC_SCRIPT nopost.sh ) @@ -84,7 +83,7 @@ atlas_add_test( SteeringChain_test SOURCES test/SteeringChain_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringLib AthContainers StoreGateLib SGtests EventInfo xAODEventInfo GaudiKernel TrigConfBase TrigConfHLTData TrigROBDataProviderSvcLib TrigSteeringEvent L1TopoAlgorithms L1TopoCoreSim L1TopoEvent L1TopoSimulationLib TrigT1CaloEventLib TrigT1CaloToolInterfaces TrigT1Result TrigTimeAlgsLib TestTools ByteStreamCnvSvcBaseLib xAODTrigger TrigConfL1Data TrigSerializeResultLib TrigNavigationLib TrigStorageDefinitions TrigMonitorBaseLib TrigInterfacesLib L1TopoCommon L1TopoConfig TrigT1Interfaces TrigSteeringLib + LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel AthenaMonitoringLib AthContainers StoreGateLib SGtests EventInfo xAODEventInfo GaudiKernel TrigConfBase TrigConfHLTData TrigSteeringEvent L1TopoAlgorithms L1TopoCoreSim L1TopoEvent L1TopoSimulationLib TrigT1CaloEventLib TrigT1CaloToolInterfaces TrigT1Result TrigTimeAlgsLib TestTools ByteStreamCnvSvcBaseLib xAODTrigger TrigConfL1Data TrigSerializeResultLib TrigNavigationLib TrigStorageDefinitions TrigMonitorBaseLib TrigInterfacesLib L1TopoCommon L1TopoConfig TrigT1Interfaces TrigSteeringLib POST_EXEC_SCRIPT nopost.sh ) diff --git a/Trigger/TrigSteer/TrigSteering/TrigSteering/Sequence.h b/Trigger/TrigSteer/TrigSteering/TrigSteering/Sequence.h index d9f1fc00949d34171c775c8a3ac460fc782e9ccf..17bca21445f79d0adf0b44ba1b0555ffa2d32b67 100755 --- a/Trigger/TrigSteer/TrigSteering/TrigSteering/Sequence.h +++ b/Trigger/TrigSteer/TrigSteering/TrigSteering/Sequence.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 */ /********************************************************************************** @@ -14,7 +14,6 @@ * @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN * * File and Version Information: - * $Id: Sequence.h,v 1.20 2008-12-08 13:22:18 tbold Exp $ **********************************************************************************/ #ifndef TRIGSTEERING_SEQUENCE_H @@ -25,7 +24,6 @@ #include "GaudiKernel/SmartIF.h" #include "AthenaBaseComps/AthService.h" -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc_RTT.h" //used for ROS data access test #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" class TrigTimer; @@ -136,7 +134,6 @@ namespace HLT { TrigTimer *m_timer; ServiceHandle<IROBDataProviderSvc> m_robDataProvider; //!< ROB data provider (for ROB pre-fetching) - SmartIF <ITrigROBDataProviderSvc_RTT> m_trigROBDataProviderRTT; //!< ROB data provider with extensions for RTT tests }; } diff --git a/Trigger/TrigSteer/TrigSteering/TrigSteering/TrigSteer.h b/Trigger/TrigSteer/TrigSteering/TrigSteering/TrigSteer.h index 2f2e4b29cfd034fc711f655130c78e639c0695e0..4b5cae3743abfe09e376e858b00745dbf1f665be 100755 --- a/Trigger/TrigSteer/TrigSteering/TrigSteering/TrigSteer.h +++ b/Trigger/TrigSteer/TrigSteering/TrigSteering/TrigSteer.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 */ /********************************************************************************** @@ -38,8 +38,6 @@ #include "TrigConfInterfaces/ITrigConfigSvc.h" #include "AthenaMonitoring/IMonitorToolBase.h" -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h" -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvcPrefetch.h" #include "GaudiKernel/SmartIF.h" #include "EventInfo/TriggerInfo.h" #include "AthenaKernel/Timeout.h" @@ -221,9 +219,6 @@ namespace HLT { ServiceHandle<TrigConf::ITrigConfigSvc> m_configSvc; //!< TrigConfiguration Service ServiceHandle<TrigConf::IL1TopoConfigSvc> m_l1topoConfigSvc; //!< TrigConfiguration Service of L1Topo ServiceHandle<IROBDataProviderSvc> m_robDataProvider; //!< ROB data provider (for ROB pre-fetching) - SmartIF <ITrigROBDataProviderSvc> m_trigROBDataProvider; //!< Trig ROB data provider (for Event Building) - SmartIF <ITrigROBDataProviderSvcPrefetch> m_trigROBDataProviderPrefetch; //!< Trig ROB data provider with ROB prefetching interface - ToolHandle<Navigation> m_navigation; //!< HLT Navigation, taking care of all TriggerElements and the links etc. ServiceHandle<IScalerSvc> m_scalerSvc; //!< Scaler manager, to produce scaler objects to use in chain prescale/passthrough. diff --git a/Trigger/TrigSteer/TrigSteering/src/Sequence.cxx b/Trigger/TrigSteer/TrigSteering/src/Sequence.cxx index 9ca0d442a3b616acc178f227b9f12282e241f8a8..c83f076aa10ed576b4c015c5015f68cdb8d0ebf3 100755 --- a/Trigger/TrigSteer/TrigSteering/src/Sequence.cxx +++ b/Trigger/TrigSteer/TrigSteering/src/Sequence.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 */ /********************************************************************************** @@ -14,7 +14,6 @@ * @author Nicolas Berger <Nicolas.Berger@cern.ch> - CERN * * File and Version Information: - * $Id: Sequence.cxx,v 1.31 2009-02-26 12:52:52 tbold Exp $ **********************************************************************************/ #include "TrigSteering/Sequence.h" @@ -91,13 +90,8 @@ Sequence::Sequence(std::vector<unsigned int> inputTypes, // Get TrigROBDataProvider_RTT for data pre-fetch test if( m_robDataProvider.retrieve().isFailure() ) { m_config->getMsgStream() << MSG::ERROR << "can't get ROBDataProviderSvc" << endmsg; - } else{ - m_trigROBDataProviderRTT = SmartIF<ITrigROBDataProviderSvc_RTT>( &*m_robDataProvider ); - if (m_trigROBDataProviderRTT.isValid()) { - if (m_config && m_config->getMsgLvl() <= MSG::DEBUG) - m_config->getMsgStream() << MSG::DEBUG << "A ROBDataProviderSvc implementing the trig interface ITrigROBDataProviderSvc_RTT was found."<< endmsg; - } } + return; } @@ -356,9 +350,6 @@ HLT::ErrorCode Sequence::execute() */ HLT::ErrorCode Sequence::prepareRobRequests() { - // this variable enables the monitor of the pre-fetching with the trigROBDataProviderSvc - bool do_prefetching_test = m_trigROBDataProviderRTT.isValid() && m_trigROBDataProviderRTT->isPrefetchingAtAlgoLevel(); - // in case this sequence was executed before if (m_prepRobReqAlreadyExecuted) { // print some debug info @@ -461,11 +452,6 @@ HLT::ErrorCode Sequence::prepareRobRequests() m_config->getMsgStream() << MSG::DEBUG << " calling processRobRequests of TECreateAlgo '" << te_create_alg->name() << "' with outputTE = " << teName << endmsg; } - //test of the pre-fetching: clear the pre-fetching list - if (do_prefetching_test){ - m_config->robRequestInfo()->clearRequestScheduledRobIDs(); - } - ErrorCode ec = te_create_alg->processRobRequests( m_inputTeTypes ); m_prepRobReqErrorCode = std::max(m_prepRobReqErrorCode, ec); @@ -480,13 +466,6 @@ HLT::ErrorCode Sequence::prepareRobRequests() << "Sequence got error back while executing algo->processRobRequests(..): " << te_create_alg->name() << " " << HLT::strErrorCode( m_prepRobReqErrorCode ) << endmsg; - //test of the pretching: fill the pre-fetching list - if (do_prefetching_test && m_robDataProvider.isValid()){ - std::string pref_name = alg->name() + "_pref"; - if (m_config->getMsgLvl() <=MSG::INFO) m_config->getMsgStream() << MSG::INFO <<"Forcing trigROBDataProvider_RTT.addROBData: Algorithm "<< te_create_alg->name() <<" scheduled "<<m_config->robRequestInfo()->requestScheduledRobIDs().size() <<" ROBs"<<endmsg; - m_robDataProvider->addROBData(m_config->robRequestInfo()->requestScheduledRobIDs(),pref_name); - } - // Check if event timeout was reached if ( Athena::Timeout::instance().reached() ) { if (m_config->getMsgLvl() <= MSG::DEBUG) diff --git a/Trigger/TrigSteer/TrigSteering/src/TrigSteer.cxx b/Trigger/TrigSteer/TrigSteering/src/TrigSteer.cxx index 0d9fe9877db01c0b0c0b6dfbd3ae78459ca32a9b..b0515f0b78e7d868bb5cb6c2b8bce20329a5b725 100755 --- a/Trigger/TrigSteer/TrigSteering/src/TrigSteer.cxx +++ b/Trigger/TrigSteer/TrigSteering/src/TrigSteer.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 */ /********************************************************************************** @@ -69,7 +69,6 @@ #include "GaudiKernel/StatusCode.h" #include "TrigSteeringEvent/TrigOperationalInfo.h" -#include "TrigROBDataProviderSvc/ITrigROBDataProviderSvc.h" #include "L1TopoCoreSim/TopoSteering.h" #include "L1TopoConfig/L1TopoMenu.h" @@ -152,23 +151,6 @@ StatusCode TrigSteer::initialize() ATH_MSG_DEBUG("start initialize"); CHECK( m_robDataProvider.retrieve()); - - // Setup the HLT ROB Data Provider Service when configured - ATH_MSG_INFO(" Enable ROB prefetching = " << m_enableRobRequestPreparation); - if ( m_robDataProvider.isValid() ) { - m_trigROBDataProvider = SmartIF<ITrigROBDataProviderSvc>( &*m_robDataProvider ); - if (m_trigROBDataProvider.isValid()) { - ATH_MSG_INFO(" A ROBDataProviderSvc implementing the HLT interface ITrigROBDataProviderSvc was found."); - } else { - ATH_MSG_INFO(" No ROBDataProviderSvc implementing the HLT interface ITrigROBDataProviderSvc was found."); - } - m_trigROBDataProviderPrefetch = SmartIF<ITrigROBDataProviderSvcPrefetch>( &*m_robDataProvider ); - if (m_trigROBDataProviderPrefetch.isValid()) { - ATH_MSG_INFO(" A ROBDataProviderSvc implementing the HLT interface ITrigROBDataProviderSvcPrefetch was found."); - } else { - ATH_MSG_INFO(" No ROBDataProviderSvc implementing the HLT interface ITrigROBDataProviderSvcPrefetch was found."); - } - } // get the navigation tool CHECK(m_navigation.retrieve()); @@ -184,8 +166,6 @@ StatusCode TrigSteer::initialize() m_config->setStoreGate(&*evtStore()); m_config->setSteeringOPILevel(m_doOperationalInfo); m_config->setRobRequestInfo(new RobRequestInfo()); - // allow the ROBDataProviderSvc access to the RobRequestInfo object - if (m_trigROBDataProviderPrefetch.isValid()) m_trigROBDataProviderPrefetch->setRobRequestInfo( m_config->robRequestInfo() ); // set the trigger level of this instance if (m_hltLevel == "L2") m_config->setHLTLevel(HLT::L2); @@ -428,9 +408,6 @@ StatusCode TrigSteer::finalize() m_algos.clear(); ATH_MSG_DEBUG("finalized sequences"); - // reset the Robrequestinfo object in the ROB data provider - if (m_trigROBDataProviderPrefetch.isValid()) m_trigROBDataProviderPrefetch->setRobRequestInfo( 0 ); - delete m_config; m_config=0; return AthLegacySequence::finalize(); @@ -717,8 +694,8 @@ void TrigSteer::doPrefetching(bool &secondPass, bool& noError){ // skip if the event is already in cache - if (m_trigROBDataProvider.isValid()) { - if (m_trigROBDataProvider->isEventComplete()){ // this is return always treu for offline running + if (m_robDataProvider.isValid()) { + if (m_robDataProvider->isEventComplete(Gaudi::Hive::currentContext())){ // this is return always treu for offline running ATH_MSG_DEBUG("Event is complete"); if ( m_strategyEB == 0){ // return for online, do the prefetching for testing EBstrategy=1 ATH_MSG_DEBUG("Event is complete; do not pre-fetch data for online running"); @@ -910,12 +887,11 @@ void TrigSteer::runChains(bool secondPass) { void TrigSteer::issueEventBuildingRequest(int step) { - // issue the EB request through the TrigROBDataProviderSvc + // issue the EB request // only if not already requested - // for offline running, just set the EB step, doing nothing else // check if complete event has been already requested (by DCM or Steering) - if (m_trigROBDataProvider.isValid() && m_trigROBDataProvider->isEventComplete()) { + if (m_robDataProvider->isEventComplete(Gaudi::Hive::currentContext())) { if ( m_stepForEB == 0 ){ // record this step as negative, in case EB is not called by the steering m_stepForEB = (-1.) * step; if (m_config->getMsgLvl() <=MSG::DEBUG) @@ -932,17 +908,10 @@ void TrigSteer::issueEventBuildingRequest(int step) { if (m_doTiming) m_timerCallEB->stop(); m_stepForEB = step; - // return if running is offline - if (!m_trigROBDataProvider.isValid()) { - if (m_config->getMsgLvl() <=MSG::DEBUG) - ATH_MSG_DEBUG("Request of Event Building is issued for offline running at step " << m_stepForEB); - return; - } - // issue the EB if (m_config->getMsgLvl() <=MSG::DEBUG) ATH_MSG_DEBUG("Going to issue Event Building at step " << m_stepForEB); - m_trigROBDataProvider->collectCompleteEventData(name()); + m_robDataProvider->collectCompleteEventData(Gaudi::Hive::currentContext(), name()); return; } diff --git a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx index f41904b66e48df74ff8989eac352c181ef0825ee..6aef7b4add61658c9c67b8a9cc133e7182bc51f7 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoSimulation/src/L1TopoSimulation.cxx @@ -311,9 +311,11 @@ L1TopoSimulation::execute() { // TODO: get the output combination data and put into SG // fill histograms - for (auto mt : m_monitors ) - if ( ! mt->preSelector() ) - mt->fillHists().ignore(); + // Commenting out temporarily to avoid crash + //when L1TopoSimulation run without menu confifuration. + //for (auto mt : m_monitors ) + // if ( ! mt->preSelector() ) + // mt->fillHists().ignore(); return StatusCode::SUCCESS; } diff --git a/Trigger/TrigT1/TrigT1CaloCalibConditions/share/L1CaloCalibConditionsMC_jobOptions.py b/Trigger/TrigT1/TrigT1CaloCalibConditions/share/L1CaloCalibConditionsMC_jobOptions.py index f2e42db442778063d98f3c93ae3f059e308fcb1a..5e73701b56984973d2e97358e455a3a858fb12ce 100644 --- a/Trigger/TrigT1/TrigT1CaloCalibConditions/share/L1CaloCalibConditionsMC_jobOptions.py +++ b/Trigger/TrigT1/TrigT1CaloCalibConditions/share/L1CaloCalibConditionsMC_jobOptions.py @@ -1,5 +1,5 @@ include.block ( "TrigT1CaloCalibConditions/L1CaloCalibConditionsMC_jobOptions.py" ) -if globalflags.DataSource() is not "data": +if globalflags.DataSource() != "data": _L1CaloFolderList = [ "/TRIGGER/L1Calo/V2/Calibration/Physics/PprChanCalib", "/TRIGGER/L1Calo/V2/Calibration/PpmDeadChannels", diff --git a/Trigger/TrigT1/TrigT1CaloMappingTools/CMakeLists.txt b/Trigger/TrigT1/TrigT1CaloMappingTools/CMakeLists.txt index b93a3aaa75019078ec894d6c41798ebb94dbc0c1..e20905e1ac95427c476e58cccdfbab44aeb679cf 100644 --- a/Trigger/TrigT1/TrigT1CaloMappingTools/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1CaloMappingTools/CMakeLists.txt @@ -11,6 +11,7 @@ atlas_depends_on_subdirs( PRIVATE Calorimeter/CaloTriggerTool Control/AthenaBaseComps Control/StoreGate + Control/CxxUtils DetectorDescription/Identifier GaudiKernel Trigger/TrigT1/TrigT1CaloToolInterfaces ) @@ -19,5 +20,5 @@ atlas_depends_on_subdirs( PRIVATE atlas_add_component( TrigT1CaloMappingTools src/*.cxx src/components/*.cxx - LINK_LIBRARIES CaloIdentifier CaloTriggerToolLib AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel ) + LINK_LIBRARIES CxxUtils CaloIdentifier CaloTriggerToolLib AthenaBaseComps StoreGateLib SGtests Identifier GaudiKernel ) diff --git a/Trigger/TrigT1/TrigT1CaloMappingTools/src/CpmMappingTool.cxx b/Trigger/TrigT1/TrigT1CaloMappingTools/src/CpmMappingTool.cxx index 38eefc95c06d6592d3249f8d56a01ad189c6736d..0a58ccc4e1a8d343d5f06ec9c446331d605f2d0e 100644 --- a/Trigger/TrigT1/TrigT1CaloMappingTools/src/CpmMappingTool.cxx +++ b/Trigger/TrigT1/TrigT1CaloMappingTools/src/CpmMappingTool.cxx @@ -23,18 +23,6 @@ const int CpmMappingTool::s_etaBinsPerRow; const double CpmMappingTool::s_etaGran = 0.1; const double CpmMappingTool::s_phiGran = M_PI/32.; -CpmMappingTool::CpmMappingTool(const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type, name, parent) -{ - declareInterface<IL1CaloMappingTool>(this); -} - -CpmMappingTool::~CpmMappingTool() -{ -} - // Initialise the mappings #ifndef PACKAGE_VERSION @@ -58,7 +46,7 @@ StatusCode CpmMappingTool::finalize() // Return eta, phi and layer mapping for given crate/module/channel bool CpmMappingTool::mapping(const int crate, const int module, - const int channel, double& eta, double& phi, int& layer) + const int channel, double& eta, double& phi, int& layer) const { if (crate < 0 || crate >= s_crates || module < 1 || module > s_modules || channel < 0 || channel >= s_channels) return false; @@ -99,7 +87,7 @@ bool CpmMappingTool::mapping(const int crate, const int module, // Return crate, module and channel mapping for given eta/phi/layer bool CpmMappingTool::mapping(const double /*eta*/, const double /*phi*/, - const int /*layer*/, int& crate, int& module, int& channel) + const int /*layer*/, int& crate, int& module, int& channel) const { // Not implemented crate = 0; diff --git a/Trigger/TrigT1/TrigT1CaloMappingTools/src/CpmMappingTool.h b/Trigger/TrigT1/TrigT1CaloMappingTools/src/CpmMappingTool.h index d6fc878ffc59567dc80a66ff8979f155a6fe61f9..d300818a102c743960134dc0221f1c8715423007 100644 --- a/Trigger/TrigT1/TrigT1CaloMappingTools/src/CpmMappingTool.h +++ b/Trigger/TrigT1/TrigT1CaloMappingTools/src/CpmMappingTool.h @@ -29,24 +29,21 @@ namespace LVL1 { * @author Peter Faulkner */ -class CpmMappingTool : virtual public IL1CaloMappingTool, - public AthAlgTool { - +class CpmMappingTool : public extends<AthAlgTool, IL1CaloMappingTool> +{ public: + + using base_class::base_class; - CpmMappingTool(const std::string& type, const std::string& name, - const IInterface* parent); - virtual ~CpmMappingTool(); - - virtual StatusCode initialize(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; /// Return eta, phi and layer mapping for given crate/module/channel virtual bool mapping(int crate, int module, int channel, - double& eta, double& phi, int& layer); + double& eta, double& phi, int& layer) const override; /// Return crate, module and channel mapping for given eta/phi/layer virtual bool mapping(double eta, double phi, int layer, - int& crate, int& module, int& channel); + int& crate, int& module, int& channel) const override; private: diff --git a/Trigger/TrigT1/TrigT1CaloMappingTools/src/JemMappingTool.cxx b/Trigger/TrigT1/TrigT1CaloMappingTools/src/JemMappingTool.cxx index 307270f96bd48351e6d61737a55110e6a37259d6..02cf7ebe08eed7f5632a03b0c70088a6b2c656e4 100644 --- a/Trigger/TrigT1/TrigT1CaloMappingTools/src/JemMappingTool.cxx +++ b/Trigger/TrigT1/TrigT1CaloMappingTools/src/JemMappingTool.cxx @@ -27,18 +27,6 @@ const double JemMappingTool::s_etaGran = 0.2; const double JemMappingTool::s_phiGran = M_PI/16.; -JemMappingTool::JemMappingTool(const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type, name, parent) -{ - declareInterface<IL1CaloMappingTool>(this); -} - -JemMappingTool::~JemMappingTool() -{ -} - // Initialise the mappings #ifndef PACKAGE_VERSION @@ -84,7 +72,7 @@ StatusCode JemMappingTool::finalize() // Return eta, phi and layer mapping for given crate/module/channel bool JemMappingTool::mapping(const int crate, const int module, - const int channel, double& eta, double& phi, int& layer) + const int channel, double& eta, double& phi, int& layer) const { if (crate < 0 || crate >= s_crates || module < 0 || module >= s_modules || channel < 0 || channel >= s_channels) return false; @@ -132,7 +120,7 @@ bool JemMappingTool::mapping(const int crate, const int module, // Return crate, module and channel mapping for given eta/phi/layer bool JemMappingTool::mapping(const double /*eta*/, const double /*phi*/, - const int /*layer*/, int& crate, int& module, int& channel) + const int /*layer*/, int& crate, int& module, int& channel) const { // Not implemented crate = 0; diff --git a/Trigger/TrigT1/TrigT1CaloMappingTools/src/JemMappingTool.h b/Trigger/TrigT1/TrigT1CaloMappingTools/src/JemMappingTool.h index b6466a239c1e1b4d32eb0f481c86c5fd09ab8ea1..5641ab7fe20e35b61ad2cf77913826903310a89d 100644 --- a/Trigger/TrigT1/TrigT1CaloMappingTools/src/JemMappingTool.h +++ b/Trigger/TrigT1/TrigT1CaloMappingTools/src/JemMappingTool.h @@ -31,24 +31,22 @@ namespace LVL1 { * @author Peter Faulkner */ -class JemMappingTool : virtual public IL1CaloMappingTool, - public AthAlgTool { +class JemMappingTool : public extends<AthAlgTool, IL1CaloMappingTool> +{ public: - JemMappingTool(const std::string& type, const std::string& name, - const IInterface* parent); - virtual ~JemMappingTool(); + using base_class::base_class; - virtual StatusCode initialize(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; /// Return eta, phi and layer mapping for given crate/module/channel virtual bool mapping(int crate, int module, int channel, - double& eta, double& phi, int& layer); + double& eta, double& phi, int& layer) const override; /// Return crate, module and channel mapping for given eta/phi/layer virtual bool mapping(double eta, double phi, int layer, - int& crate, int& module, int& channel); + int& crate, int& module, int& channel) const override; private: diff --git a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolMappingTool.cxx b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolMappingTool.cxx index 182b296046d96eb6b59d0f94c34510c3723e941c..a81b48b24b709d8de415327b5f204115100d9f01 100644 --- a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolMappingTool.cxx +++ b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolMappingTool.cxx @@ -13,7 +13,6 @@ #include "CaloIdentifier/CaloID_Exception.h" #include "CaloIdentifier/CaloLVL1_ID.h" #include "CaloIdentifier/TTOnlineID.h" -#include "CaloTriggerTool/CaloTriggerTowerService.h" #include "Identifier/Identifier.h" #include "Identifier/HWIdentifier.h" @@ -24,22 +23,6 @@ namespace LVL1 { const int PpmCoolMappingTool::s_maxTableEntries; -PpmCoolMappingTool::PpmCoolMappingTool(const std::string& type, - const std::string& name, const IInterface* parent) - : AthAlgTool(type, name, parent), - m_ttSvc("CaloTriggerTowerService"), - m_lvl1Helper(0), m_l1ttonlineHelper(0) -{ - declareInterface<IL1CaloMappingTool>(this); - - declareProperty("CaloTriggerTowerService", m_ttSvc); - -} - -PpmCoolMappingTool::~PpmCoolMappingTool() -{ -} - // Initialise the mappings #ifndef PACKAGE_VERSION @@ -108,12 +91,55 @@ StatusCode PpmCoolMappingTool::finalize() void PpmCoolMappingTool::handle(const Incident& inc) { + // FIXME: not thread safe --- won't work if there's more than one run + // in the input. if (inc.type()=="BeginRun") { if (msgLvl(MSG::DEBUG)) { msg(MSG::DEBUG) << "Resetting mapping table at start of run" << endmsg; } - m_idTable.clear(); + bool verbose = msgLvl(MSG::VERBOSE); + m_idTable.resize (s_maxTableEntries); + for (int index = 0; index < s_maxTableEntries; ++index) { + const int channel = index & 0x3f; + const int module = (index >> 6) & 0x0f; + const int crate = index >> 10; + const int slot = module + 5; + const int pin = channel % 16; + const int asic = channel / 16; + + Identifier ttId(0); + Identifier invalidId(0); + try { + if (verbose) { + msg(MSG::VERBOSE) << "crate/module/channel " << crate << "/" + << module << "/" << channel + << " maps to crate/slot/pin/asic " << crate << "/" + << slot << "/" << pin << "/" << asic << endmsg; + } + const HWIdentifier id = m_l1ttonlineHelper->channelId(crate, slot, pin, + asic); + if (verbose) { + msg(MSG::VERBOSE) << "hardware_id: " << id << endmsg; + } + ttId = m_ttSvc->cnvToIdentifier(id, true); + if (verbose) { + msg(MSG::VERBOSE) << "tower_id: " << ttId << endmsg; + } + } + catch (const CaloID_Exception&) { ttId = invalidId; } + if (ttId == invalidId) { + m_idTable[index] = 0; + } + else { + const int side = (m_lvl1Helper->pos_neg_z(ttId) == 1) ? 1 : 2; + const int sample = m_lvl1Helper->sampling(ttId); + const int region = m_lvl1Helper->region(ttId); + const int ieta = m_lvl1Helper->eta(ttId); + const int iphi = m_lvl1Helper->phi(ttId); + m_idTable[index] = (side<<14)+(sample<<13)+(region<<11)+(ieta<<6)+iphi; + } + } } return; } @@ -121,7 +147,7 @@ void PpmCoolMappingTool::handle(const Incident& inc) // Return eta, phi and layer mapping for given crate/module/channel bool PpmCoolMappingTool::mapping(const int crate, const int module, - const int channel, double& eta, double& phi, int& layer) + const int channel, double& eta, double& phi, int& layer) const { if (crate < 0 || crate >= 8 || module < 0 || module >= 16 || channel < 0 || channel >= 64) return false; @@ -131,43 +157,8 @@ bool PpmCoolMappingTool::mapping(const int crate, const int module, bool verbose = msgLvl(MSG::VERBOSE); - if (m_idTable.empty()) { - m_idTable.reserve(s_maxTableEntries); - m_idTable.assign(s_maxTableEntries, 0); - } - if (m_idTable[index] == 0) { - const int slot = module + 5; - const int pin = channel % 16; - const int asic = channel / 16; - - Identifier ttId(0); - Identifier invalidId(0); - try { - if (verbose) { - msg(MSG::VERBOSE) << "crate/module/channel " << crate << "/" - << module << "/" << channel - << " maps to crate/slot/pin/asic " << crate << "/" - << slot << "/" << pin << "/" << asic << endmsg; - } - const HWIdentifier id = m_l1ttonlineHelper->channelId(crate, slot, pin, - asic); - if (verbose) { - msg(MSG::VERBOSE) << "hardware_id: " << id << endmsg; - } - ttId = m_ttSvc->cnvToIdentifier(id, true); - if (verbose) { - msg(MSG::VERBOSE) << "tower_id: " << ttId << endmsg; - } - } - catch (const CaloID_Exception&) { ttId = invalidId; } - if (ttId == invalidId) return false; - - const int side = (m_lvl1Helper->pos_neg_z(ttId) == 1) ? 1 : 2; - const int sample = m_lvl1Helper->sampling(ttId); - const int region = m_lvl1Helper->region(ttId); - const int ieta = m_lvl1Helper->eta(ttId); - const int iphi = m_lvl1Helper->phi(ttId); - m_idTable[index] = (side<<14)+(sample<<13)+(region<<11)+(ieta<<6)+iphi; + if (index >= static_cast<int>(m_idTable.size()) || m_idTable[index] == 0) { + return false; } const unsigned int entry = m_idTable[index]; const int side = ((entry>>14) == 1) ? 1 : -1; @@ -194,7 +185,7 @@ bool PpmCoolMappingTool::mapping(const int crate, const int module, // Return crate, module and channel mapping for given eta/phi/layer bool PpmCoolMappingTool::mapping(const double eta, const double phi, - const int layer, int& crate, int& module, int& channel) + const int layer, int& crate, int& module, int& channel) const { if (eta <= -4.9 || eta >= 4.9 || phi <= 0. || phi >= 2.*M_PI) return false; diff --git a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolMappingTool.h b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolMappingTool.h index 6afbbfe036d923058e6894fe7ecaf4649671b9e2..686bfbd8ceff6374fa020396da044524e1aa5d3b 100644 --- a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolMappingTool.h +++ b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolMappingTool.h @@ -12,10 +12,10 @@ #include "GaudiKernel/Incident.h" #include "GaudiKernel/ToolHandle.h" +#include "CaloTriggerTool/CaloTriggerTowerService.h" #include "TrigT1CaloToolInterfaces/IL1CaloMappingTool.h" class CaloLVL1_ID; -class CaloTriggerTowerService; class IInterface; class StatusCode; class TTOnlineID; @@ -30,33 +30,30 @@ namespace LVL1 { * @author Peter Faulkner */ -class PpmCoolMappingTool : virtual public IL1CaloMappingTool, - public IIncidentListener, - public AthAlgTool { - +class PpmCoolMappingTool : public extends<AthAlgTool, IL1CaloMappingTool, IIncidentListener> +{ public: - PpmCoolMappingTool(const std::string& type, const std::string& name, - const IInterface* parent); - virtual ~PpmCoolMappingTool(); + using base_class::base_class; - virtual StatusCode initialize(); - virtual StatusCode finalize(); - virtual void handle(const Incident&); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual void handle(const Incident&) override; /// Return eta, phi and layer mapping for given crate/module/channel virtual bool mapping(int crate, int module, int channel, - double& eta, double& phi, int& layer); + double& eta, double& phi, int& layer) const override; /// Return crate, module and channel mapping for given eta/phi/layer virtual bool mapping(double eta, double phi, int layer, - int& crate, int& module, int& channel); + int& crate, int& module, int& channel) const override; private: // Tools and helpers - ToolHandle<CaloTriggerTowerService> m_ttSvc; - const CaloLVL1_ID* m_lvl1Helper; - const TTOnlineID* m_l1ttonlineHelper; + ToolHandle<CaloTriggerTowerService> m_ttSvc + { this, "CaloTriggerTowerService", "CaloTriggerTowerService" }; + const CaloLVL1_ID* m_lvl1Helper = nullptr; + const TTOnlineID* m_l1ttonlineHelper = nullptr; /// Mapping lookup table std::vector<unsigned int> m_idTable; diff --git a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolOrBuiltinMappingTool.cxx b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolOrBuiltinMappingTool.cxx index 2b02417fc6a0ead68af73e41dcd2533ca3f1c0b0..58a2187b891dfe1dd7985d2c831016b782b72cc8 100644 --- a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolOrBuiltinMappingTool.cxx +++ b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolOrBuiltinMappingTool.cxx @@ -13,24 +13,6 @@ namespace LVL1 { -PpmCoolOrBuiltinMappingTool::PpmCoolOrBuiltinMappingTool(const std::string& type, - const std::string& name, const IInterface* parent) - : AthAlgTool(type, name, parent), - m_coolTool("LVL1::PpmCoolMappingTool/PpmCoolMappingTool"), - m_builtinTool("LVL1::PpmMappingTool/PpmMappingTool"), - m_coolCheckDone(false) -{ - declareInterface<IL1CaloMappingTool>(this); - - declareProperty("CoolMappingTool", m_coolTool); - declareProperty("BuiltinMappingTool", m_builtinTool); - -} - -PpmCoolOrBuiltinMappingTool::~PpmCoolOrBuiltinMappingTool() -{ -} - // Initialise the mappings #ifndef PACKAGE_VERSION @@ -68,7 +50,7 @@ StatusCode PpmCoolOrBuiltinMappingTool::finalize() // Return eta, phi and layer mapping for given crate/module/channel bool PpmCoolOrBuiltinMappingTool::mapping(const int crate, const int module, - const int channel, double& eta, double& phi, int& layer) + const int channel, double& eta, double& phi, int& layer) const { bool rc = false; if (coolWorks()) { @@ -82,7 +64,7 @@ bool PpmCoolOrBuiltinMappingTool::mapping(const int crate, const int module, // Return crate, module and channel mapping for given eta/phi/layer bool PpmCoolOrBuiltinMappingTool::mapping(const double eta, const double phi, - const int layer, int& crate, int& module, int& channel) + const int layer, int& crate, int& module, int& channel) const { bool rc = false; if (coolWorks()) { @@ -95,35 +77,37 @@ bool PpmCoolOrBuiltinMappingTool::mapping(const double eta, const double phi, // Check if COOL mappings are working -bool PpmCoolOrBuiltinMappingTool::coolWorks() +bool PpmCoolOrBuiltinMappingTool::coolWorks() const { - if ( !m_coolCheckDone ) { + // FIXME: This should be determined during initialization! + + if (!m_coolCheck.isValid()) { const double testEta = 3.8375; const double testPhi = M_PI/16.; const int testLayer = 1; int crate = 0; int module = 0; int channel = 0; - m_coolCheckResult = ((m_coolTool->mapping(testEta, testPhi, testLayer, - crate, module, channel)) && - !(crate == 4 && module == 8 && channel == 48)); - if (m_coolCheckResult) { + bool result = ((m_coolTool->mapping(testEta, testPhi, testLayer, + crate, module, channel)) && + !(crate == 4 && module == 8 && channel == 48)); + if (result) { const double tolerance = 0.01; double eta = 0.; double phi = 0.; int layer = 0; - m_coolCheckResult = ((m_coolTool->mapping(crate, module, channel, - eta, phi, layer)) && - (fabs(eta-testEta) < tolerance) && - (fabs(phi-testPhi) < tolerance) && - (layer == testLayer)); + result = ((m_coolTool->mapping(crate, module, channel, + eta, phi, layer)) && + (fabs(eta-testEta) < tolerance) && + (fabs(phi-testPhi) < tolerance) && + (layer == testLayer)); } - m_coolCheckDone = true; - if (m_coolCheckResult) { + if (result) { msg(MSG::INFO) << "COOL mappings selected" << endmsg; } else msg(MSG::INFO) << "Built-in mappings selected" << endmsg; + m_coolCheck.set (result); } - return m_coolCheckResult; + return *m_coolCheck.ptr(); } } // end namespace diff --git a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolOrBuiltinMappingTool.h b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolOrBuiltinMappingTool.h index fc8cb0ba1e27940757f1b6f0e8a50b3c5606b491..1ddbc055b02c24aedfbe8233b7346e06ff723f61 100644 --- a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolOrBuiltinMappingTool.h +++ b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmCoolOrBuiltinMappingTool.h @@ -11,6 +11,7 @@ #include "GaudiKernel/ToolHandle.h" #include "TrigT1CaloToolInterfaces/IL1CaloMappingTool.h" +#include "CxxUtils/CachedValue.h" class IInterface; class StatusCode; @@ -25,40 +26,36 @@ namespace LVL1 { * @author Peter Faulkner */ -class PpmCoolOrBuiltinMappingTool : virtual public IL1CaloMappingTool, - public AthAlgTool { - +class PpmCoolOrBuiltinMappingTool : public extends<AthAlgTool, IL1CaloMappingTool> +{ public: - PpmCoolOrBuiltinMappingTool(const std::string& type, const std::string& name, - const IInterface* parent); - virtual ~PpmCoolOrBuiltinMappingTool(); + using base_class::base_class; - virtual StatusCode initialize(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; /// Return eta, phi and layer mapping for given crate/module/channel virtual bool mapping(int crate, int module, int channel, - double& eta, double& phi, int& layer); + double& eta, double& phi, int& layer) const override; /// Return crate, module and channel mapping for given eta/phi/layer virtual bool mapping(double eta, double phi, int layer, - int& crate, int& module, int& channel); + int& crate, int& module, int& channel) const override; private: /// Check if COOL mappings are working - bool coolWorks(); + bool coolWorks() const; /// COOL mapping tool - ToolHandle<IL1CaloMappingTool> m_coolTool; + ToolHandle<IL1CaloMappingTool> m_coolTool + { this, "CoolMappingTool", "LVL1::PpmCoolMappingTool/PpmCoolMappingTool" }; /// Built-in mapping tool - ToolHandle<IL1CaloMappingTool> m_builtinTool; + ToolHandle<IL1CaloMappingTool> m_builtinTool + { this, "BuiltinMappingTool", "LVL1::PpmMappingTool/PpmMappingTool" }; /// COOL mapping check done flag - bool m_coolCheckDone; - /// COOL mapping check result - bool m_coolCheckResult; - + mutable CxxUtils::CachedValue<bool> m_coolCheck; }; } // end namespace diff --git a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmMappingTool.cxx b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmMappingTool.cxx index e4e7f3ea82c897975511781d87802ec907afada8..3715f4b63978064030439a0863905a1bc8c09fec 100644 --- a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmMappingTool.cxx +++ b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmMappingTool.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 <cmath> @@ -18,20 +18,6 @@ const int PpmMappingTool::s_crates; const int PpmMappingTool::s_modules; const int PpmMappingTool::s_channels; -PpmMappingTool::PpmMappingTool(const std::string& type, - const std::string& name, - const IInterface* parent) - : AthAlgTool(type, name, parent), - m_crateInfo(0), m_currentMap(0), - m_etaPhiMap(0) -{ - declareInterface<IL1CaloMappingTool>(this); -} - -PpmMappingTool::~PpmMappingTool() -{ -} - #ifndef PACKAGE_VERSION #define PACKAGE_VERSION "unknown" #endif @@ -40,57 +26,41 @@ StatusCode PpmMappingTool::initialize() { msg(MSG::INFO) << "Initializing " << name() << " - package version " << PACKAGE_VERSION << endmsg; + setupMap(); + setupInverseMap(); return StatusCode::SUCCESS; } StatusCode PpmMappingTool::finalize() { - std::vector<CoordinateMap*>::iterator pos; - for (pos = m_coordMaps.begin(); pos != m_coordMaps.end(); ++pos) { - delete *pos; - } - delete m_crateInfo; - delete m_etaPhiMap; - return StatusCode::SUCCESS; } // Return eta, phi and layer mapping for given crate/module/channel bool PpmMappingTool::mapping(const int crate, const int module, - const int channel, double& eta, double& phi, int& layer) + const int channel, double& eta, double& phi, int& layer) const { if (crate < 0 || crate >= s_crates || module < 0 || module >= s_modules || channel < 0 || channel >= s_channels) return false; - if (!m_currentMap || crate != m_currentCrate || module != m_currentModule) { - - // Find the relevant mapping - - if ( !m_crateInfo ) setupMap(); - CrateMap::const_iterator cpos = m_crateInfo->find(crate); - if (cpos == m_crateInfo->end()) return false; - const ModuleMap& modMap(cpos->second); - ModuleMap::const_iterator mpos = modMap.find(module); - if (mpos == modMap.end()) return false; - const ModuleInfo modInfo(mpos->second); - const Offsets etaPhiOff = modInfo.first; - m_currentMap = modInfo.second; - m_etaOffset = etaPhiOff.first; - m_phiOffset = etaPhiOff.second; - m_currentCrate = crate; - m_currentModule = module; - } + const ModuleMap& modMap = m_crateInfo[crate]; + const ModuleInfo& modInfo = modMap[module]; + const double etaOffset = modInfo.first.first; + const double phiOffset = modInfo.first.second; + const CoordinateMap* currentMap = modInfo.second; + + if (!currentMap) return false; // Set the output - CoordinateMap::const_iterator pos = m_currentMap->find(channel); - if (pos == m_currentMap->end()) return false; - ChannelCoordinate relCoord(pos->second); - relCoord.setEta(relCoord.eta() + m_etaOffset); + ChannelCoordinate relCoord = (*currentMap)[channel]; + if (relCoord.layer() == ChannelCoordinate::NONE) return false; + + relCoord.setEta(relCoord.eta() + etaOffset); eta = etaSim(relCoord); - phi = relCoord.phi() + m_phiOffset; + phi = relCoord.phi() + phiOffset; layer = (relCoord.layer() == ChannelCoordinate::EM) ? 0 : 1; return true; } @@ -98,14 +68,13 @@ bool PpmMappingTool::mapping(const int crate, const int module, // Return crate, module and channel mapping for given eta/phi/layer bool PpmMappingTool::mapping(const double eta, const double phi, - const int layer, int& crate, int& module, int& channel) + const int layer, int& crate, int& module, int& channel) const { const unsigned int invalidChanId = s_crates*s_modules*s_channels; - if ( !m_etaPhiMap ) setupInverseMap(); const unsigned int key = etaPhiKey(eta, phi); - EtaPhiMap::iterator iter = m_etaPhiMap->find(key); - if (iter == m_etaPhiMap->end()) { + EtaPhiMap::const_iterator iter = m_etaPhiMap.find(key); + if (iter == m_etaPhiMap.end()) { msg(MSG::WARNING) << "Invalid eta/phi: " << eta << "/" << phi << endmsg; return false; @@ -126,8 +95,6 @@ bool PpmMappingTool::mapping(const double eta, const double phi, void PpmMappingTool::setupMap() { - m_crateInfo = new CrateMap; - // Input to Output channel mappings. // Inputs are numbered 1-16 (x4) and outputs 0-63 // There are four output sets obtained by adding 0,4,8,12 to out @@ -265,155 +232,155 @@ void PpmMappingTool::setupMap() // Construct coordinate maps for each module type // Four blocks of each type make up the complete map - for (int i = 0; i < 12; ++i) m_coordMaps.push_back(new CoordinateMap); + for (int i = 0; i < 12; ++i) m_coordMaps.push_back(std::make_unique<CoordinateMap>()); for (int block = 0; block < 4; ++block) { const int incr = block * 4; - std::vector<CoordinateMap*>::iterator pos = m_coordMaps.begin(); + std::vector<std::unique_ptr<CoordinateMap> >::iterator pos = m_coordMaps.begin(); // Map 0 : Type 1 EM addCoords(4,4,0.1,M_PI/32.,0.,block*M_PI/8.,in1,out,incr, - ChannelCoordinate::EM, *pos); + ChannelCoordinate::EM, **pos); ++pos; // Map 1 : Type 1 Had addCoords(4,4,0.1,M_PI/32.,0.,block*M_PI/8.,in1,out,incr, - ChannelCoordinate::HAD, *pos); + ChannelCoordinate::HAD, **pos); ++pos; // Map 2 : Type 2 EM addCoords(4,1,0.1,M_PI/32.,0.0,block*M_PI/8.,in2a,out,incr, - ChannelCoordinate::EM, *pos); + ChannelCoordinate::EM, **pos); addCoords(2,2,0.2,M_PI/16.,0.1,block*M_PI/8.,in2b,out,incr, - ChannelCoordinate::EM, *pos); + ChannelCoordinate::EM, **pos); ++pos; // Map 3 : Type 2 Had addCoords(4,1,0.1,M_PI/32.,0.0,block*M_PI/8.,in2a,out,incr, - ChannelCoordinate::HAD, *pos); + ChannelCoordinate::HAD, **pos); addCoords(2,2,0.2,M_PI/16.,0.1,block*M_PI/8.,in2b,out,incr, - ChannelCoordinate::HAD, *pos); + ChannelCoordinate::HAD, **pos); ++pos; // Map 4 : Type 3 EM addCoords(2,2,0.2,M_PI/16.,0.0,block*M_PI/8.,in3a,out,incr, - ChannelCoordinate::EM, *pos); + ChannelCoordinate::EM, **pos); addCoords(4,1,0.1,M_PI/32.,0.4,block*M_PI/8.,in3b,out,incr, - ChannelCoordinate::EM, *pos); + ChannelCoordinate::EM, **pos); ++pos; // Map 5 : Type 3 Had addCoords(2,2,0.2,M_PI/16.,0.0,block*M_PI/8.,in3a,out,incr, - ChannelCoordinate::HAD, *pos); + ChannelCoordinate::HAD, **pos); addCoords(4,1,0.1,M_PI/32.,0.4,block*M_PI/8.,in3b,out,incr, - ChannelCoordinate::HAD, *pos); + ChannelCoordinate::HAD, **pos); ++pos; // Map 6 : Type 4 EM positive eta addCoords(4,1,0.2,M_PI/16.,0.0,block*M_PI/4.,in4a,out,incr, - ChannelCoordinate::EM, *pos); + ChannelCoordinate::EM, **pos); addCoords(4,1,0.1,M_PI/16.,0.2,block*M_PI/4.,in4b,out,incr, - ChannelCoordinate::EM, *pos); + ChannelCoordinate::EM, **pos); ++pos; // Map 7 : Type 4 Had positive eta addCoords(4,1,0.2,M_PI/16.,0.0,block*M_PI/4.,in4a,out,incr, - ChannelCoordinate::HAD, *pos); + ChannelCoordinate::HAD, **pos); addCoords(4,1,0.1,M_PI/16.,0.2,block*M_PI/4.,in4b,out,incr, - ChannelCoordinate::HAD, *pos); + ChannelCoordinate::HAD, **pos); ++pos; // Map 8 : Type 4 EM negative eta addCoords(4,1,0.1,M_PI/16.,0.0,block*M_PI/4.,in4a,out,incr, - ChannelCoordinate::EM, *pos); + ChannelCoordinate::EM, **pos); addCoords(4,1,0.2,M_PI/16.,0.1,block*M_PI/4.,in4b,out,incr, - ChannelCoordinate::EM, *pos); + ChannelCoordinate::EM, **pos); ++pos; // Map 9 : Type 4 Had negative eta addCoords(4,1,0.1,M_PI/16.,0.0,block*M_PI/4.,in4a,out,incr, - ChannelCoordinate::HAD, *pos); + ChannelCoordinate::HAD, **pos); addCoords(4,1,0.2,M_PI/16.,0.1,block*M_PI/4.,in4b,out,incr, - ChannelCoordinate::HAD, *pos); + ChannelCoordinate::HAD, **pos); ++pos; // Map 10 : Type 5 EM FCAL addCoords(4,4,0.425,M_PI/8.,0.0,block*M_PI/2.,in5,out,incr, - ChannelCoordinate::EM, *pos); + ChannelCoordinate::EM, **pos); ++pos; // Map 11 : Type 6 Had FCAL2 and FCAL3 addCoords(4,2,0.85,M_PI/8.,0.0,block*M_PI/2.,in6a,out,incr, - ChannelCoordinate::FCAL2, *pos); + ChannelCoordinate::FCAL2, **pos); addCoords(4,2,0.85,M_PI/8.,0.0,block*M_PI/2.,in6b,out,incr, - ChannelCoordinate::FCAL3, *pos); + ChannelCoordinate::FCAL3, **pos); } // Fill crate map - std::vector<CoordinateMap*>::const_iterator pos = m_coordMaps.begin(); + std::vector<std::unique_ptr<CoordinateMap> >::const_iterator pos = m_coordMaps.begin(); // Map 0 : all of crates 0,1 // crate 2 modules 1,2,5,6,9,10,13,14 // crate 3 modules 2,3,6,7,10,11,14,15 - addMods(0,0,4,4, 0.0,0.0,0.4,M_PI/2.,*pos); - addMods(1,0,4,4,-1.6,0.0,0.4,M_PI/2.,*pos); - addMods(2,1,4,2, 1.6,0.0,0.4,M_PI/2.,*pos); - addMods(3,2,4,2,-2.4,0.0,0.4,M_PI/2.,*pos); + addMods(0,0,4,4, 0.0,0.0,0.4,M_PI/2.,pos->get()); + addMods(1,0,4,4,-1.6,0.0,0.4,M_PI/2.,pos->get()); + addMods(2,1,4,2, 1.6,0.0,0.4,M_PI/2.,pos->get()); + addMods(3,2,4,2,-2.4,0.0,0.4,M_PI/2.,pos->get()); ++pos; // Map 1 : crate 4 modules 1,2,5,6,9,10,13,14 // crate 5 modules 2,3,6,7,10,11,14,15 // all of crates 6,7 - addMods(4,1,4,2, 1.6,0.0,0.4,M_PI/2.,*pos); - addMods(5,2,4,2,-2.4,0.0,0.4,M_PI/2.,*pos); - addMods(6,0,4,4, 0.0,0.0,0.4,M_PI/2.,*pos); - addMods(7,0,4,4,-1.6,0.0,0.4,M_PI/2.,*pos); + addMods(4,1,4,2, 1.6,0.0,0.4,M_PI/2.,pos->get()); + addMods(5,2,4,2,-2.4,0.0,0.4,M_PI/2.,pos->get()); + addMods(6,0,4,4, 0.0,0.0,0.4,M_PI/2.,pos->get()); + addMods(7,0,4,4,-1.6,0.0,0.4,M_PI/2.,pos->get()); ++pos; // Map 2 : crate 2 modules 3,7,11,15 - addMods(2,3,4,1, 2.4,0.0,0.5,M_PI/2.,*pos); + addMods(2,3,4,1, 2.4,0.0,0.5,M_PI/2.,pos->get()); ++pos; // Map 3 : crate 4 modules 3,7,11,15 - addMods(4,3,4,1, 2.4,0.0,0.5,M_PI/2.,*pos); + addMods(4,3,4,1, 2.4,0.0,0.5,M_PI/2.,pos->get()); ++pos; // Map 4 : crate 3 modules 1,5,9,13 - addMods(3,1,4,1,-2.9,0.0,0.5,M_PI/2.,*pos); + addMods(3,1,4,1,-2.9,0.0,0.5,M_PI/2.,pos->get()); ++pos; // Map 5 : crate 5 modules 1,5,9,13 - addMods(5,1,4,1,-2.9,0.0,0.5,M_PI/2.,*pos); + addMods(5,1,4,1,-2.9,0.0,0.5,M_PI/2.,pos->get()); ++pos; // Map 6 : crate 2 modules 4,12 - addMods(2, 4,1,1, 2.9,0.0,0.3,M_PI,*pos); - addMods(2,12,1,1, 2.9,M_PI,0.3,M_PI,*pos); + addMods(2, 4,1,1, 2.9,0.0,0.3,M_PI,pos->get()); + addMods(2,12,1,1, 2.9,M_PI,0.3,M_PI,pos->get()); ++pos; // Map 7 : crate 4 modules 4,12 - addMods(4, 4,1,1, 2.9,0.0,0.3,M_PI,*pos); - addMods(4,12,1,1, 2.9,M_PI,0.3,M_PI,*pos); + addMods(4, 4,1,1, 2.9,0.0,0.3,M_PI,pos->get()); + addMods(4,12,1,1, 2.9,M_PI,0.3,M_PI,pos->get()); ++pos; // Map 8 : crate 3 modules 4,12 - addMods(3, 4,1,1,-3.2,0.0,0.3,M_PI,*pos); - addMods(3,12,1,1,-3.2,M_PI,0.3,M_PI,*pos); + addMods(3, 4,1,1,-3.2,0.0,0.3,M_PI,pos->get()); + addMods(3,12,1,1,-3.2,M_PI,0.3,M_PI,pos->get()); ++pos; // Map 9 : crate 5 modules 4,12 - addMods(5, 4,1,1,-3.2,0.0,0.3,M_PI,*pos); - addMods(5,12,1,1,-3.2,M_PI,0.3,M_PI,*pos); + addMods(5, 4,1,1,-3.2,0.0,0.3,M_PI,pos->get()); + addMods(5,12,1,1,-3.2,M_PI,0.3,M_PI,pos->get()); ++pos; // Map 10 : crate 4 module 0, crate 5 module 0 - addMods(4,0,1,1, 3.2,0.0,1.7,2*M_PI,*pos); - addMods(5,0,1,1,-4.9,0.0,1.7,2*M_PI,*pos); + addMods(4,0,1,1, 3.2,0.0,1.7,2*M_PI,pos->get()); + addMods(5,0,1,1,-4.9,0.0,1.7,2*M_PI,pos->get()); ++pos; // Map 11 : crate 4 module 8, crate 5 module 8 - addMods(4,8,1,1, 3.2,0.0,1.7,2*M_PI,*pos); - addMods(5,8,1,1,-4.9,0.0,1.7,2*M_PI,*pos); + addMods(4,8,1,1, 3.2,0.0,1.7,2*M_PI,pos->get()); + addMods(5,8,1,1,-4.9,0.0,1.7,2*M_PI,pos->get()); } // Set up eta/phi map @@ -422,7 +389,6 @@ void PpmMappingTool::setupInverseMap() { const unsigned int invalidChanId = s_crates*s_modules*s_channels; - m_etaPhiMap = new EtaPhiMap; for (int cr = 0; cr < s_crates; ++cr) { for (int mod = 0; mod < s_modules; ++mod) { for (int chan = 0; chan < s_channels; ++chan) { @@ -431,12 +397,12 @@ void PpmMappingTool::setupInverseMap() if (mapping(cr, mod, chan, tmpEta, tmpPhi, tmpLayer)) { const unsigned int key = etaPhiKey(tmpEta, tmpPhi); const unsigned int chanId = (cr * s_modules + mod) * s_channels + chan; - EtaPhiMap::iterator iter = m_etaPhiMap->find(key); - if (iter == m_etaPhiMap->end()) { + EtaPhiMap::iterator iter = m_etaPhiMap.find(key); + if (iter == m_etaPhiMap.end()) { ChannelIds ids(invalidChanId, invalidChanId); if (tmpLayer == 0) ids.first = chanId; else ids.second = chanId; - m_etaPhiMap->insert(std::make_pair(key, ids)); + m_etaPhiMap.insert(std::make_pair(key, ids)); } else { ChannelIds& ids(iter->second); if (tmpLayer == 0) ids.first = chanId; @@ -453,15 +419,15 @@ void PpmMappingTool::setupInverseMap() void PpmMappingTool::addCoords(const int nrows, const int ncols, const double etaGran, const double phiGran, const double etaOffset, const double phiOffset, const int* in, const int* out, const int incr, - const ChannelCoordinate::CaloLayer layer, CoordinateMap* coordMap) + const ChannelCoordinate::CaloLayer layer, CoordinateMap& coordMap) { for (int row = 0; row < nrows; ++row) { const double phi = (double(row) + 0.5) * phiGran + phiOffset; for (int col = 0; col < ncols; ++col) { const double eta = (double(col) + 0.5) * etaGran + etaOffset; const int channel = out[in[row*ncols+col]-1] + incr; - coordMap->insert(std::make_pair(channel, - ChannelCoordinate(layer, eta, phi, etaGran, phiGran))); + assert (channel < s_channels); + coordMap[channel] = ChannelCoordinate(layer, eta, phi, etaGran, phiGran); } } } @@ -473,22 +439,15 @@ void PpmMappingTool::addMods(const int crate, const int modOffset, const double phiBase, const double etaRange, const double phiRange, const CoordinateMap* coordMap) { + assert (crate < static_cast<int>(m_crateInfo.size())); + ModuleMap& modMap = m_crateInfo[crate]; for (int row = 0; row < nrows; ++row) { for (int col = 0; col < ncols; ++col) { const int module = row*4 + col + modOffset; const double etaOffset = etaRange * double(col) + etaBase; const double phiOffset = phiRange * double(row) + phiBase; Offsets off(etaOffset, phiOffset); - ModuleInfo modInfo(off, coordMap); - CrateMap::iterator cpos = m_crateInfo->find(crate); - if (cpos != m_crateInfo->end()) { - ModuleMap& modMap(cpos->second); - modMap.insert(std::make_pair(module, modInfo)); - } else { - ModuleMap modMap; - modMap.insert(std::make_pair(module, modInfo)); - m_crateInfo->insert(std::make_pair(crate, modMap)); - } + modMap[module] = ModuleInfo (off, coordMap); } } } diff --git a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmMappingTool.h b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmMappingTool.h index 0321ec2e05e25f08d79efa1b569d4b76a50c0acf..ce33e76c3caf39ee9f824b0cacc15ef5ece60b15 100644 --- a/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmMappingTool.h +++ b/Trigger/TrigT1/TrigT1CaloMappingTools/src/PpmMappingTool.h @@ -9,6 +9,7 @@ #include <string> #include <utility> #include <vector> +#include <array> #include "AthenaBaseComps/AthAlgTool.h" @@ -32,32 +33,33 @@ namespace LVL1 { * @author Peter Faulkner */ -class PpmMappingTool : virtual public IL1CaloMappingTool, - public AthAlgTool { - +class PpmMappingTool : public extends<AthAlgTool, IL1CaloMappingTool> +{ public: - PpmMappingTool(const std::string& type, const std::string& name, - const IInterface* parent); - virtual ~PpmMappingTool(); + using base_class::base_class; - virtual StatusCode initialize(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; /// Return eta, phi and layer mapping for given crate/module/channel virtual bool mapping(int crate, int module, int channel, - double& eta, double& phi, int& layer); + double& eta, double& phi, int& layer) const override; /// Return crate, module and channel mapping for given eta/phi/layer virtual bool mapping(double eta, double phi, int layer, - int& crate, int& module, int& channel); + int& crate, int& module, int& channel) const override; private: + static const int s_crates = 8; + static const int s_modules = 16; + static const int s_channels = 64; + // Crate/module map constituents typedef std::pair< double, double > Offsets; - typedef std::map< int, ChannelCoordinate > CoordinateMap; + typedef std::array< ChannelCoordinate, s_channels> CoordinateMap; typedef std::pair< Offsets, const CoordinateMap* > ModuleInfo; - typedef std::map< int, ModuleInfo > ModuleMap; - typedef std::map< int, ModuleMap > CrateMap; + typedef std::array< ModuleInfo, s_modules > ModuleMap; + typedef std::array< ModuleMap, s_crates > CrateMap; // Inverse map constituents typedef std::pair< unsigned int, unsigned int > ChannelIds; typedef std::map< unsigned int, ChannelIds > EtaPhiMap; @@ -70,7 +72,7 @@ class PpmMappingTool : virtual public IL1CaloMappingTool, void addCoords(int nrows, int ncols, double etaGran, double phiGran, double etaOffset, double phiOffset, const int* in, const int* out, int incr, - ChannelCoordinate::CaloLayer layer, CoordinateMap* coordMap); + ChannelCoordinate::CaloLayer layer, CoordinateMap& coordMap); /// Add a block of similar modules to a crate void addMods(int crate, int modOffset, int nrows, int ncols, double etaBase, double phiBase, double etaRange, double phiRange, @@ -81,26 +83,11 @@ class PpmMappingTool : virtual public IL1CaloMappingTool, unsigned int etaPhiKey(double eta, double phi) const; /// Pointer to crate/module map - CrateMap* m_crateInfo; + std::array<ModuleMap, s_crates> m_crateInfo; /// Vector of CoordinateMaps - std::vector<CoordinateMap*> m_coordMaps; - /// Current Coordinate map - mutable const CoordinateMap* m_currentMap; - /// Current module eta offset - mutable double m_etaOffset; - /// Current module phi offset - mutable double m_phiOffset; - /// Current crate - mutable int m_currentCrate; - /// Current module - mutable int m_currentModule; + std::vector<std::unique_ptr<CoordinateMap> > m_coordMaps; /// Pointer to inverse map - EtaPhiMap* m_etaPhiMap; - - static const int s_crates = 8; - static const int s_modules = 16; - static const int s_channels = 64; - + EtaPhiMap m_etaPhiMap; }; } // end namespace diff --git a/Trigger/TrigT1/TrigT1CaloMonitoring/python/LVL1CaloMonitoringConfig.py b/Trigger/TrigT1/TrigT1CaloMonitoring/python/LVL1CaloMonitoringConfig.py index 04d66e715e0bce43ad098956e782a229950dad5b..4cf615e6d1e13a1d70adbf3cd694e3148d413885 100644 --- a/Trigger/TrigT1/TrigT1CaloMonitoring/python/LVL1CaloMonitoringConfig.py +++ b/Trigger/TrigT1/TrigT1CaloMonitoring/python/LVL1CaloMonitoringConfig.py @@ -14,11 +14,15 @@ def LVL1CaloMonitoringConfig(flags): result = ComponentAccumulator() + isData = not flags.Input.isMC + # monitoring algorithm configs - # do not run in RAW->ESD, or AOD-only - if flags.DQ.Environment not in ('tier0Raw', 'AOD'): + # do not run on MC or RAW->ESD(tier0), or AOD-only + if isData and flags.DQ.Environment not in ('tier0Raw', 'AOD'): from TrigT1CaloMonitoring.CpmMonitorAlgorithm import CpmMonitoringConfig - result.merge(CpmMonitoringConfig(flags)) + from TrigT1CaloMonitoring.PprMonitorAlgorithm import PprMonitoringConfig + result.merge(CpmMonitoringConfig(flags)) + result.merge(PprMonitoringConfig(flags)) return result diff --git a/Trigger/TrigT1/TrigT1CaloMonitoring/python/PprMonitorAlgorithm.py b/Trigger/TrigT1/TrigT1CaloMonitoring/python/PprMonitorAlgorithm.py new file mode 100644 index 0000000000000000000000000000000000000000..e45055c60fd38d68c7325a3e925f72e1bf23c6f0 --- /dev/null +++ b/Trigger/TrigT1/TrigT1CaloMonitoring/python/PprMonitorAlgorithm.py @@ -0,0 +1,157 @@ +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# + +def PprMonitoringConfig(inputFlags): + '''Function to configure LVL1 Ppr algorithm in the monitoring system.''' + + import math + # get the component factory - used for getting the algorithms + from AthenaConfiguration.ComponentFactory import CompFactory + from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator + result = ComponentAccumulator() + + # any things that need setting up for job e.g. + #from AtlasGeoModel.AtlasGeoModelConfig import AtlasGeometryCfg + #result.merge(AtlasGeometryCfg(inputFlags)) + + # make the athena monitoring helper + from AthenaMonitoring import AthMonitorCfgHelper + helper = AthMonitorCfgHelper(inputFlags,'PprMonitoringCfg') + + # get any algorithms + PprMonAlg = helper.addAlgorithm(CompFactory.PprMonitorAlgorithm,'PprMonAlg') + + # add any steering + groupName = 'PprMonitor' # the monitoring group name is also used for the package name + PprMonAlg.PackageName = groupName + + # Steering properties + threshADC = 50 + PprMonAlg.TT_ADC_HitMap_Thresh = threshADC # ADC cut for hit maps + + # Histogram paths + mainDir = 'L1Calo' + trigPath = 'PPM/' + + # add monitoring algorithm to group, with group name and main directory + myGroup = helper.addGroup(PprMonAlg, groupName , mainDir) + + + # Trigger tower plots: eta-phi granularity + etabins = [-4.9,-4.475,-4.050,-3.625,-3.2,-3.1,-2.9, + -2.7,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9, + -1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1, + -1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3, + -0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7, + 0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7, + 1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9, + 3.1,3.2,3.625,4.050,4.475,4.9] + phibins = 64 + phimin = 0 + phimax_2d = 64 + phimax_1d = 2.*math.pi + maxEnergyRange = 256 + + + ####################### + # PPM inputs (LUT-CP) # + ####################### + histPath = trigPath+'/LUT-CP' + + # EM distributions + myGroup.defineHistogram('etaTT_EM;h_ppm_em_1d_tt_lutcp_Eta', title='EM LUT-CP: Distribution of peak in #eta; #eta', type='TH1F', path=histPath+'/Distributions', xbins=etabins, cutmask='mask_EM_cpET_0_noPhi') + + myGroup.defineHistogram('phiTT_1d_EM;h_ppm_em_1d_tt_lutcp_Phi', title='EM LUT-CP: Distribution of peak in #phi; #phi', type='TH1F', path=histPath+'/Distributions', xbins=phibins, xmin=phimin, xmax=phimax_1d, cutmask='mask_EM_cpET_0_phiBins') + + myGroup.defineHistogram('cpET_EM;h_ppm_em_1d_tt_lutcp_Et', title='EM LUT-CP: Distribution of peak; EM LUT peak [GeV/2]', type='TH1F', path=histPath+'/Distributions', xbins=maxEnergyRange-1, xmin=1, xmax=maxEnergyRange, cutmask='mask_EM_cpET_0_noPhi') + + + # Eta-phi maps + myGroup.defineHistogram('etaTT_EM,phiTT_2d_EM;h_ppm_em_2d_etaPhi_tt_lutcp_AverageEt', title='EM Average LUT-CP Et for Et > 5 GeV/2', type='TH2F', path=histPath+'/EtaPhiMaps', xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax_2d, cutmask='mask_EM_cpET_5_phiBins', weight='cpET_EM') + + + ######################## + # PPM inputs (LUT-JEP) # + ######################## + histPath = trigPath+'/LUT-JEP' + + # EM distributions + myGroup.defineHistogram('etaTT_EM;h_ppm_em_1d_tt_lutjep_Eta', title='EM LUT-JEP: Distribution of peak in #eta', type='TH1F', path=histPath+'/Distributions', xbins=etabins, cutmask='mask_EM_jepET_0_noPhi') + + myGroup.defineHistogram('phiTT_1d_EM;h_ppm_em_1d_tt_lutjep_Phi', title='EM LUT-JEP: Distribution of peak in #phi; #phi', type='TH1F', path=histPath+'/Distributions', xbins=phibins, xmin=phimin, xmax=phimax_1d, cutmask='mask_EM_jepET_0_phiBins') + + myGroup.defineHistogram('jepET_EM;h_ppm_em_1d_tt_lutjep_Et', title='EM LUT-JEP: Distribution of peak; EM LUT peak [GeV]', type='TH1F', path=histPath+'/Distributions', xbins=maxEnergyRange-1, xmin=1, xmax=maxEnergyRange, cutmask='mask_EM_jepET_0_noPhi') + + # Eta-phi maps + myGroup.defineHistogram('etaTT_EM,phiTT_2d_EM;h_ppm_em_2d_etaPhi_tt_lutjep_AverageEt', title='EM Average LUT-JEP Et for Et > 5 GeV', type='TH2F', path=histPath+'/EtaPhiMaps', xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax_2d, cutmask='mask_EM_jepET_5_phiBins', weight='jepET_EM') + + + + #################### + # PPM inputs (ADC) # + #################### + histPath = trigPath+'/ADC' + + # EM tower maps + myGroup.defineHistogram('etaTT_EM,phiTT_2d_EM;h_ppm_em_2d_etaPhi_tt_adc_HitMap', title='#eta - #phi map of EM FADC > ' +str(threshADC)+ ' for triggered timeslice; Tower #eta; Tower #phi', type='TH2F', path=histPath+'/EtaPhiMaps', xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax_2d, cutmask='mask_EM_timeslice') + + myGroup.defineHistogram('etaTT_EM,phiTT_2d_EM;h_ppm_em_2d_etaPhi_tt_adc_ProfileHitMap', title='#eta - #phi profile map of EM FADC > ' +str(threshADC)+ ' for triggered timeslice; Tower #eta; Tower #phi', type='TH2F', path=histPath+'/EtaPhiMaps', xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax_2d, cutmask='mask_EM_timeslice', weight='emTT_ADC') + + + # HAD tower maps + myGroup.defineHistogram('etaTT_HAD,phiTT_2d_HAD;h_ppm_had_2d_etaPhi_tt_adc_HitMap', title='#eta - #phi map of HAD FADC > ' +str(threshADC)+ ' for triggered timeslice; Tower #eta; Tower #phi', type='TH2F', path=histPath+'/EtaPhiMaps', xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax_2d, cutmask='mask_HAD_timeslice') + + myGroup.defineHistogram('etaTT_HAD,phiTT_2d_HAD;h_ppm_had_2d_etaPhi_tt_adc_ProfileHitMap', title='#eta - #phi profile map of HAD FADC > ' +str(threshADC)+ ' for triggered timeslice; Tower #eta; Tower #phi', type='TH2F', path=histPath+'/EtaPhiMaps', xbins=etabins, ybins=phibins, ymin=phimin, ymax=phimax_2d, cutmask='mask_HAD_timeslice', weight='hadTT_ADC') + + + + acc = helper.result() + result.merge(acc) + return result + + +if __name__=='__main__': + # For direct tests + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = 1 + + # set debug level for whole job + from AthenaCommon.Logging import log + from AthenaCommon.Constants import INFO #DEBUG + log.setLevel(INFO) + + # set input file and config options + from AthenaConfiguration.AllConfigFlags import ConfigFlags + import glob + + inputs = glob.glob('/eos/atlas/atlascerngroupdisk/data-art/build-output/master/Athena/x86_64-centos7-gcc8-opt/2020-04-06T2139/TrigP1Test/test_trigP1_v1PhysP1_T0Mon_build/ESD.pool.root') + + ConfigFlags.Input.Files = inputs + ConfigFlags.Output.HISTFileName = 'ExampleMonitorOutput_LVL1.root' + + ConfigFlags.lock() + ConfigFlags.dump() # print all the configs + + from AthenaCommon.AppMgr import ServiceMgr + ServiceMgr.Dump = False + + from AthenaConfiguration.MainServicesConfig import MainServicesSerialCfg + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + cfg = MainServicesSerialCfg() + cfg.merge(PoolReadCfg(ConfigFlags)) + + PprMonitorCfg = PprMonitoringConfig(ConfigFlags) + cfg.merge(PprMonitorCfg) + + # message level for algorithm + PprMonitorCfg.getEventAlgo('PprMonAlg').OutputLevel = 2 # 1/2 INFO/DEBUG + # options - print all details of algorithms, very short summary + cfg.printConfig(withDetails=False, summariseProps = True) + + nevents=-1 + status = cfg.run(nevents) + if status.isFailure(): + import sys + sys.exit(-1) + diff --git a/Trigger/TrigT1/TrigT1CaloMonitoring/src/PprMonitorAlgorithm.cxx b/Trigger/TrigT1/TrigT1CaloMonitoring/src/PprMonitorAlgorithm.cxx new file mode 100644 index 0000000000000000000000000000000000000000..9ec864201c7db8aa10af47dda8fef25717b3a0be --- /dev/null +++ b/Trigger/TrigT1/TrigT1CaloMonitoring/src/PprMonitorAlgorithm.cxx @@ -0,0 +1,307 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// L1 objects +#include "TrigT1CaloEvent/TriggerTowerCollection.h" +#include "TrigT1CaloEvent/TriggerTower_ClassDEF.h" +#include "TrigT1CaloUtils/DataError.h" +#include "TrigT1Interfaces/TrigT1CaloDefs.h" + +// xAOD +#include "xAODTrigL1Calo/TriggerTowerContainer.h" +// ============================================= + +#include "PprMonitorAlgorithm.h" + + +PprMonitorAlgorithm::PprMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ) + : AthMonitorAlgorithm(name,pSvcLocator) +{ +} + +StatusCode PprMonitorAlgorithm::initialize() { + + ATH_MSG_DEBUG("PprMonitorAlgorith::initialize"); + ATH_MSG_DEBUG("Package Name "<< m_packageName); + ATH_MSG_DEBUG("m_xAODTriggerTowerContainerName "<< m_xAODTriggerTowerContainerName); + ATH_MSG_DEBUG("m_TT_ADC_HitMap_Thresh " << m_TT_ADC_HitMap_Thresh); + + // we initialise all the containers that we need + ATH_CHECK(m_xAODTriggerTowerContainerName.initialize()); + + // retrieve any tools if needed + //ATH_CHECK(myTool.retrieve()); + + + return AthMonitorAlgorithm::initialize(); +} + +StatusCode PprMonitorAlgorithm::fillHistograms( const EventContext& ctx ) const { + + ATH_MSG_DEBUG("PprMonitorAlgorithm::fillHistograms"); + + + // Contains the variables to monitor + std::vector<std::reference_wrapper<Monitored::IMonitoredVariable>> variables; + + + //Retrieve Trigger Towers from SG + SG::ReadHandle<xAOD::TriggerTowerContainer> triggerTowerTES(m_xAODTriggerTowerContainerName, ctx); + if(!triggerTowerTES.isValid()){ + ATH_MSG_ERROR("No Trigger Tower container found in TES "<< m_xAODTriggerTowerContainerName); + return StatusCode::FAILURE; + } + + + // Create a vector of trigger towers with quantities to be monitored + std::vector<MonitorTT> vecMonTT_EM; // EM towers + std::vector<MonitorTT> vecMonTT_HAD; // HAD towers + std::vector<MonitorTT> vecMonTT; // All towers + + // Loop over trigger tower container + for (const auto& tt : *triggerTowerTES) { + + // Create the trigger tower objects and calculate scaled phi + // Fill the required number of phi bins based on tower granularity + ATH_CHECK( fillPPMTowerEtaPhi(tt, vecMonTT_EM, vecMonTT_HAD, vecMonTT) ); + + } // End of loop over triggerTowerTES container + + + // Variables to monitor + + // EM towers + // eta for 2-d eta-phi maps (contains "duplicate" entries to account for granularity of multiple phi bins in forward region) + auto etaTT_EM = Monitored::Collection("etaTT_EM", vecMonTT_EM, []( const auto &emTower ){return emTower.tower->eta();}); + variables.push_back(etaTT_EM); + + auto phiTT_2d_EM = Monitored::Collection("phiTT_2d_EM", vecMonTT_EM, []( const auto &emTower ){return emTower.phiScaled;}); + variables.push_back(phiTT_2d_EM); + + auto phiTT_1d_EM = Monitored::Collection("phiTT_1d_EM", vecMonTT_EM, []( const auto &emTower ){return emTower.phi1d;}); + variables.push_back(phiTT_1d_EM); + + auto cpET_EM = Monitored::Collection("cpET_EM", vecMonTT_EM, []( const auto &emTower ){return emTower.tower->cpET();}); + variables.push_back(cpET_EM); + + auto jepET_EM = Monitored::Collection("jepET_EM", vecMonTT_EM, []( const auto &emTower ){return emTower.jepET;}); + variables.push_back(jepET_EM); + + // HAD towers + auto etaTT_HAD = Monitored::Collection("etaTT_HAD", vecMonTT_HAD, []( const auto &hadTower ){return hadTower.tower->eta();}); + variables.push_back(etaTT_HAD); + + auto phiTT_2d_HAD = Monitored::Collection("phiTT_2d_HAD", vecMonTT_HAD, []( const auto &hadTower ){return hadTower.phiScaled;}); + variables.push_back(phiTT_2d_HAD); + + auto phiTT_1d_HAD = Monitored::Collection("phiTT_1d_HAD", vecMonTT_HAD, []( const auto &hadTower ){return hadTower.phi1d;}); + variables.push_back(phiTT_1d_HAD); + + // Cutmasks + std::vector<int> vec_EM_timeslice = {}; + std::vector<int> vec_EM_cpET_0 = {}; // includes "duplicate" towers for phi maps + std::vector<int> vec_EM_cpET_0_noDuplicates = {}; // no duplicates: for plots not binned in phi + std::vector<int> vec_EM_cpET_5 = {}; + std::vector<int> vec_EM_cpET_5_noDuplicates = {}; + std::vector<int> vec_EM_jepET_0 = {}; + std::vector<int> vec_EM_jepET_0_noDuplicates = {}; + std::vector<int> vec_EM_jepET_5 = {}; + std::vector<int> vec_EM_jepET_5_noDuplicates = {}; + + // Weights + std::vector<int> vec_EM_ADC = {}; + + + for (auto& emTower : vecMonTT_EM) { + + + + // -------- LUT -------- + int cpET = (emTower.tower)->cpET(); + int jepET = emTower.jepET; + bool isDuplicate = emTower.isDuplicate; + + ATH_MSG_DEBUG("cpET: " << cpET << " jepET: " << jepET); + + // Fill the cutmasks for EM LUT-CP and LUT-JEP energy distributions + vec_EM_cpET_0.push_back(cpET > 0); // For phi distributions / maps + vec_EM_cpET_0_noDuplicates.push_back((cpET > 0) && !isDuplicate); // For plots not binned in phi + vec_EM_cpET_5.push_back(cpET > 5); + vec_EM_cpET_5_noDuplicates.push_back((cpET > 5) && !isDuplicate); + vec_EM_jepET_0.push_back(jepET > 0); + vec_EM_jepET_0_noDuplicates.push_back((jepET > 0) && !isDuplicate); + vec_EM_jepET_5.push_back(jepET > 5); + vec_EM_jepET_5_noDuplicates.push_back((jepET > 5) && !isDuplicate); + + + // -------- ADC hitmaps per timeslice -------- + unsigned int tslice = (emTower.tower)->adcPeak(); + unsigned int adcSize = ((emTower.tower)->adc()).size(); + + ATH_MSG_DEBUG("tslice: " << tslice << " adcSize: " << adcSize); + + if (tslice < adcSize) { + const int ADC = ((emTower.tower)->adc())[tslice]; + vec_EM_timeslice.push_back(ADC > m_TT_ADC_HitMap_Thresh); + vec_EM_ADC.push_back(ADC); + ATH_MSG_DEBUG("ADC: " << ADC); + } + else { + vec_EM_timeslice.push_back(0); + vec_EM_ADC.push_back(0); + } + ATH_MSG_DEBUG(" mask: " << vec_EM_timeslice.back()); + + } // End loop over vector of EM towers + + // HAD cutmasks + std::vector<int> vec_HAD_timeslice = {}; + + // HAD weights + std::vector<int> vec_HAD_ADC = {}; + + for (auto& hadTower : vecMonTT_HAD) { + + // Timeslice + unsigned int tslice = (hadTower.tower)->adcPeak(); + unsigned int adcSize = ((hadTower.tower)->adc()).size(); + + ATH_MSG_DEBUG("tslice: " << tslice << " adcSize: " << adcSize); + + if (tslice < adcSize) { + const int ADC = ((hadTower.tower)->adc())[tslice]; + vec_HAD_timeslice.push_back(ADC > m_TT_ADC_HitMap_Thresh); + vec_HAD_ADC.push_back(ADC); + ATH_MSG_DEBUG("ADC: " << ADC); + } + else { + vec_HAD_timeslice.push_back(0); + vec_HAD_ADC.push_back(0); + } + ATH_MSG_DEBUG(" mask: " << vec_HAD_timeslice.back()); + + } // End loop over vector of HAD towers + + + // Define the cutmasks (EM) + auto mask_EM_timeslice = Monitored::Collection("mask_EM_timeslice", vec_EM_timeslice); + variables.push_back(mask_EM_timeslice); + + auto emTT_ADC = Monitored::Collection("emTT_ADC", vec_EM_ADC); + variables.push_back(emTT_ADC); + + auto mask_EM_cpET_0_phiBins = Monitored::Collection("mask_EM_cpET_0_phiBins", vec_EM_cpET_0); + variables.push_back(mask_EM_cpET_0_phiBins); + + auto mask_EM_cpET_0_noPhi = Monitored::Collection("mask_EM_cpET_0_noPhi", vec_EM_cpET_0_noDuplicates); + variables.push_back(mask_EM_cpET_0_noPhi); + + auto mask_EM_cpET_5_phiBins = Monitored::Collection("mask_EM_cpET_5_phiBins", vec_EM_cpET_5); + variables.push_back(mask_EM_cpET_5_phiBins); + + auto mask_EM_cpET_5_noPhi = Monitored::Collection("mask_EM_cpET_5_noPhi", vec_EM_cpET_5_noDuplicates); + variables.push_back(mask_EM_cpET_5_noPhi); + + auto mask_EM_jepET_0_phiBins = Monitored::Collection("mask_EM_jepET_0_phiBins", vec_EM_jepET_0); + variables.push_back(mask_EM_jepET_0_phiBins); + + auto mask_EM_jepET_0_noPhi = Monitored::Collection("mask_EM_jepET_0_noPhi", vec_EM_jepET_0_noDuplicates); + variables.push_back(mask_EM_jepET_0_noPhi); + + auto mask_EM_jepET_5_phiBins = Monitored::Collection("mask_EM_jepET_5_phiBins", vec_EM_jepET_5); + variables.push_back(mask_EM_jepET_5_phiBins); + + auto mask_EM_jepET_5_noPhi = Monitored::Collection("mask_EM_jepET_5_noPhi", vec_EM_jepET_5_noDuplicates); + variables.push_back(mask_EM_jepET_5_noPhi); + + + // Define the cutmasks (HAD) + auto mask_HAD_timeslice = Monitored::Collection("mask_HAD_timeslice", vec_HAD_timeslice); + variables.push_back(mask_HAD_timeslice); + + auto hadTT_ADC = Monitored::Collection("hadTT_ADC", vec_HAD_ADC); + variables.push_back(hadTT_ADC); + + fill(m_packageName, variables); + variables.clear(); + return StatusCode::SUCCESS; +} + +StatusCode PprMonitorAlgorithm::fillPPMTowerEtaPhi( const xAOD::TriggerTower_v2* tt, + std::vector<MonitorTT> &vecMonTT_EM, + std::vector<MonitorTT> &vecMonTT_HAD, + std::vector<MonitorTT> &vecMonTT) const +{ + + const int layer = tt->layer(); // 0 = EM, 1 = HAD + const double eta = tt->eta(); + const double absEta = std::fabs(eta); + const double phi = tt->phi(); + double phiMod = phi * m_phiScaleTT; + int jepET = 0; + const std::vector<uint_least8_t> jepETvec = tt->lut_jep(); + if (jepETvec.size() > 0) jepET = tt->jepET(); + bool isDuplicate = false; + + // Offsets for filling multiple phi bins depending on TT granularity in eta + std::vector<double> offset32 = {1.5, 0.5, -0.5, -1.5}; + std::vector<double> offset25 = {0.5, -0.5}; + + // Offsets for filling 1D phi plots + double phi1d = phi; + + if (absEta > 3.2) { + + phiMod = std::floor(phiMod/4)*4. + 2.; + // Fill four bins in phi + for (int i = 0; i < 4; i++) { + MonitorTT monTT; + monTT.tower = tt; + monTT.phiScaled = phiMod + offset32[i]; + monTT.phi1d = phi + offset32[i]/m_phiScaleTT; + monTT.jepET = jepET; + if(i != 0) isDuplicate = true; + monTT.isDuplicate = isDuplicate; + + vecMonTT.push_back(monTT); + if (layer == 0) vecMonTT_EM.push_back(monTT); + if (layer == 1) vecMonTT_HAD.push_back(monTT); + + ATH_MSG_DEBUG("layer: " << layer << " eta: " << eta << " phi: " << phi << " scaled phi: " << monTT.phiScaled << " 1d phi: " << phi1d << " duplicate: " << monTT.isDuplicate); + } + } + else if (absEta > 2.5) { + phiMod = std::floor(phiMod/2)*2. + 1.; + // Fill two bins in phi + for (int i = 0; i < 2; i++) { + MonitorTT monTT; + monTT.tower = tt; + monTT.phiScaled = phiMod + offset25[i]; + monTT.phi1d = phi + offset25[i] / m_phiScaleTT; + monTT.jepET = jepET; + if(i != 0) isDuplicate = true; + monTT.isDuplicate = isDuplicate; + + vecMonTT.push_back(monTT); + if (layer == 0) vecMonTT_EM.push_back(monTT); + if (layer == 1) vecMonTT_HAD.push_back(monTT); + ATH_MSG_DEBUG("layer: " << layer << " eta: " << eta << " phi: " << phi << " scaled phi: " << monTT.phiScaled << " 1d phi: " << phi1d << " duplicate: " << monTT.isDuplicate); + } + } + else { + // Fill one phi bin + MonitorTT monTT; + monTT.tower = tt; + monTT.phiScaled = phiMod; + monTT.phi1d = phi; + monTT.jepET = jepET; + monTT.isDuplicate = false; + vecMonTT.push_back(monTT); + if (layer == 0) vecMonTT_EM.push_back(monTT); + if (layer == 1) vecMonTT_HAD.push_back(monTT); + ATH_MSG_DEBUG("layer: " << layer << " eta: " << eta << " phi: " << phi << " scaled phi: " << monTT.phiScaled << " 1d phi: " << phi1d << " duplicate: " << monTT.isDuplicate); + } + + return StatusCode::SUCCESS; +} diff --git a/Trigger/TrigT1/TrigT1CaloMonitoring/src/PprMonitorAlgorithm.h b/Trigger/TrigT1/TrigT1CaloMonitoring/src/PprMonitorAlgorithm.h new file mode 100644 index 0000000000000000000000000000000000000000..8e2d10fc6acc76a1e17b6911a71fe901e71e092b --- /dev/null +++ b/Trigger/TrigT1/TrigT1CaloMonitoring/src/PprMonitorAlgorithm.h @@ -0,0 +1,47 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef TRIGT1CALOMONITORING_PPRMONITORALGORITHM_H +#define TRIGT1CALOMONITORING_PPRMONITORALGORITHM_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoringKernel/Monitored.h" +#include "StoreGate/ReadHandleKey.h" + +class PprMonitorAlgorithm : public AthMonitorAlgorithm { +public:PprMonitorAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ); + virtual ~PprMonitorAlgorithm()=default; + virtual StatusCode initialize() override; + virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + + /// Struct to contain PPM trigger tower info + struct MonitorTT { + const xAOD::TriggerTower_v2* tower; + double phiScaled; /// phi for 2d maps with integer bins (taking into account granularity in eta) + double phi1d; /// phi for 1d phi distributions (taking into account granularity in eta) + int jepET; + bool isDuplicate; /// Bookkeeping of multiple bins in phi for a given eta bin in the forward region + }; + + +private: + + StringProperty m_packageName{this,"PackageName","PprMonitor","group name for histogramming"}; + + /// container keys including steering parameter and description + SG::ReadHandleKey<xAOD::TriggerTowerContainer> m_xAODTriggerTowerContainerName{this, "BS_xAODTriggerTowerContainer",LVL1::TrigT1CaloDefs::xAODTriggerTowerLocation,"Trigger Tower Container"}; + + + /// Properties + Gaudi::Property<double> m_phiScaleTT{this, "phiScaleTT", 32./M_PI, "Scale factor to convert trigger tower phi to integer binning"}; + Gaudi::Property<int> m_TT_ADC_HitMap_Thresh{this, "TT_ADC_HitMap_Thresh", 50, "ADC cut for hit maps"}; + + + /// Helper functions + StatusCode fillPPMTowerEtaPhi( const xAOD::TriggerTower_v2* tt, + std::vector<MonitorTT> &vecMonTT_EM, + std::vector<MonitorTT> &vecMonTT_HAD, + std::vector<MonitorTT> &vecMonTT) const; + +}; +#endif diff --git a/Trigger/TrigT1/TrigT1CaloMonitoring/src/components/TrigT1CaloMonitoring_entries.cxx b/Trigger/TrigT1/TrigT1CaloMonitoring/src/components/TrigT1CaloMonitoring_entries.cxx index 22a5bd4ca7d188b0dd987abf1bad225ba17b6bfd..a9dbe5a125b43c3189d7146b073bf3cd8abe47f4 100644 --- a/Trigger/TrigT1/TrigT1CaloMonitoring/src/components/TrigT1CaloMonitoring_entries.cxx +++ b/Trigger/TrigT1/TrigT1CaloMonitoring/src/components/TrigT1CaloMonitoring_entries.cxx @@ -2,7 +2,7 @@ #include "../CpmMonitorAlgorithm.h" //#include "../CpmSimMonitorAlgorithm.h" //#include "../PpmSimBsMonitorAlgorithm.h" -//#include "../PprMonitorAlgorithm.h" +#include "../PprMonitorAlgorithm.h" //#include "../PprSpareMonitorAlgorithm.h" //#include "../PprStabilityMonitorAlgorithm.h" @@ -37,7 +37,7 @@ DECLARE_COMPONENT( CpmMonitorAlgorithm ) //DECLARE_COMPONENT( CpmSimMonitorAlgorithm ) //DECLARE_COMPONENT( PpmSimBsMonitorAlgorithm ) -//DECLARE_COMPONENT( PprMonitorAlgorithm ) +DECLARE_COMPONENT( PprMonitorAlgorithm ) //DECLARE_COMPONENT( PprSpareMonitorAlgorithm ) //DECLARE_COMPONENT( PprStabilityMonitorAlgorithm ) diff --git a/Trigger/TrigT1/TrigT1CaloToolInterfaces/TrigT1CaloToolInterfaces/IL1CaloMappingTool.h b/Trigger/TrigT1/TrigT1CaloToolInterfaces/TrigT1CaloToolInterfaces/IL1CaloMappingTool.h index 3a744a208b007e77a1602a1b4ea82ca6c86a9dae..52851c5cfdaa2e97985c9494ab6334a773f777f7 100644 --- a/Trigger/TrigT1/TrigT1CaloToolInterfaces/TrigT1CaloToolInterfaces/IL1CaloMappingTool.h +++ b/Trigger/TrigT1/TrigT1CaloToolInterfaces/TrigT1CaloToolInterfaces/IL1CaloMappingTool.h @@ -10,25 +10,18 @@ namespace LVL1 { -static const InterfaceID IID_IL1CaloMappingTool("LVL1::IL1CaloMappingTool", 1, 0); - class IL1CaloMappingTool : virtual public IAlgTool { - public: - static const InterfaceID& interfaceID(); +public: + DeclareInterfaceID (IL1CaloMappingTool, 1, 0); virtual bool mapping(int crate, int module, int channel, - double& eta, double& phi, int& layer) = 0; + double& eta, double& phi, int& layer) const = 0; virtual bool mapping(double eta, double phi, int layer, - int& crate, int& module, int& channel) = 0; + int& crate, int& module, int& channel) const = 0; }; -inline const InterfaceID& IL1CaloMappingTool::interfaceID() -{ - return IID_IL1CaloMappingTool; -} - } // end of namespace #endif diff --git a/Trigger/TrigT1/TrigT1MuctpiPhase1/CMakeLists.txt b/Trigger/TrigT1/TrigT1MuctpiPhase1/CMakeLists.txt index 4a27c2201fa047d04d3b2244a44567a2968be1ec..394e17c2262fd4f1d3b7422cc8f5807e083961e4 100644 --- a/Trigger/TrigT1/TrigT1MuctpiPhase1/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1MuctpiPhase1/CMakeLists.txt @@ -34,5 +34,3 @@ atlas_add_component( TrigT1MuctpiPhase1 # Install files from the package: atlas_install_headers( TrigT1MuctpiPhase1 ) atlas_install_python_modules( python/*.py ) -atlas_install_xmls( data/*.xml ) - diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_struct.h b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_struct.h index 4caa6cb6baaac53ecd210b6025ab3a67f314b376..b26e025512ae752d66adfe0bc91ae67f836efaaf 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_struct.h +++ b/Trigger/TrigT1/TrigT1NSWSimTools/TrigT1NSWSimTools/MMT_struct.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 MM_STRUCT_H @@ -353,7 +353,6 @@ struct evInf_entry{ struct hitData_key{ hitData_key(int bct=0, double t=0, double gt=0, int vmm=-1,int ev=-1); - hitData_key(const hitData_key& key){BC_time=key.BC_time;time=key.time;gtime=key.gtime;VMM_chip=key.VMM_chip;event=key.event;} //for these operators, "less" means what you think it means //with precedence of quantities the same as order in the constructor //in the context of "earlier," it might make sense to say that a hit is earlier if, @@ -405,7 +404,6 @@ struct evAna_entry{ struct hitData_info{ hitData_info(int plane,int station_eta,int strip,MMT_Parameters *par,const TVector3& tru,double tpos,double ppos); hitData_info(int the_pl=0,double the_y=0,double the_z=-999); - hitData_info(const hitData_info& info){plane=info.plane;y=info.y;z=info.z;slope=info.slope;} double mis_dy(int pl,MMT_Parameters *m_par,double tpos,double ppos)const; std::string hdr()const; std::string str()const; diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/PadTriggerLogicOfflineTool.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/PadTriggerLogicOfflineTool.cxx index a391a8ae1550bbb272d180f645323c5a9d616d37..e2493c304b6ab989516c4b083b7f192d5ad414c4 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/PadTriggerLogicOfflineTool.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/PadTriggerLogicOfflineTool.cxx @@ -175,7 +175,7 @@ StatusCode PadTriggerLogicOfflineTool::compute_pad_triggers(const std::vector<st { ATH_MSG_DEBUG(" <N> receiving "<<pads.size()<<" pad data"); ATH_MSG_DEBUG("calling compute_pad_triggers() (pads.size() "<<pads.size()<<")"); - for(const auto pad : pads){ + for(const auto& pad : pads){ ATH_MSG_DEBUG(" <N> building trig from pad " <<" side "<<pad->sideId()<<"" <<", sector "<<pad->sectorId() diff --git a/Trigger/TrigT1/TrigT1NSWSimTools/src/PadTriggerLookupTool.cxx b/Trigger/TrigT1/TrigT1NSWSimTools/src/PadTriggerLookupTool.cxx index 4236e9ace4a290abe708b9633c60c4770cac19bd..95f030ef7db736b7c61399cd4a645e8c4ac63761 100644 --- a/Trigger/TrigT1/TrigT1NSWSimTools/src/PadTriggerLookupTool.cxx +++ b/Trigger/TrigT1/TrigT1NSWSimTools/src/PadTriggerLookupTool.cxx @@ -79,8 +79,8 @@ StatusCode PadTriggerLookupTool::lookup_pad_triggers(const std::vector<std::shar ); //use only active sectors selected by the pads / event - for(const size_t &side : activeSides){//0:C 1:A - for(const size_t §or : activeSectors){//{1...16} odd:L even:S + for(const int &side : activeSides){//0:C 1:A + for(const int §or : activeSectors){//{1...16} odd:L even:S ATH_CHECK( LookupSectorTriggers(pads,side,sector,triggers)); } } diff --git a/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py b/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py index 6b60e639d94d67a92bd1e1634a73fde4366ae25f..59ca78ff70efa492beedb0d068ca77f1018fd444 100644 --- a/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py +++ b/Trigger/TrigTools/TrigInDetConfig/python/InDetSetup.py @@ -56,12 +56,19 @@ def makeInDetAlgs( whichSignature='', separateTrackParticleCreator='', rois = 'E ( 'SpacePointCache' , InDetCacheNames.SpacePointCachePix ), ( 'SpacePointCache' , InDetCacheNames.SpacePointCacheSCT ), ( 'IDCInDetBSErrContainer_Cache' , InDetCacheNames.SCTBSErrCacheKey ), - ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] + ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ), + ( 'TagInfo' , 'DetectorStore+ProcessingTags' )] + viewAlgs.append( ViewDataVerifier ) # Load RDOs if we aren't loading bytestream from AthenaCommon.AlgSequence import AlgSequence topSequence = AlgSequence() + + topSequence.SGInputLoader.Load += [ ( 'TagInfo' , 'DetectorStore+ProcessingTags' ) ] + + + if not globalflags.InputFormat.is_bytestream(): ViewDataVerifier.DataObjects += [( 'PixelRDO_Container' , InDetKeys.PixelRDOs() ), ( 'SCT_RDO_Container' , InDetKeys.SCT_RDOs() ), diff --git a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py index f8f2b730e845c2d4d787019bf36a20492314e57e..95240ef8f7bc03946c2746a1d6dfc9083abd08b4 100644 --- a/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py +++ b/Trigger/TrigTools/TrigInDetConfig/python/TrigInDetConfig.py @@ -122,7 +122,7 @@ def TrigInDetCondConfig( flags ): PixelConfigCondAlgCfg, PixelChargeCalibCondAlgCfg, PixelDCSCondHVAlgCfg, PixelDCSCondTempAlgCfg, PixelAlignCondAlgCfg, PixelDetectorElementCondAlgCfg, PixelHitDiscCnfgAlgCfg, PixelReadoutSpeedAlgCfg, PixelCablingCondAlgCfg, - PixelDCSCondStateAlgCfg, PixelDCSCondStatusAlgCfg, PixelTDAQCondAlgCfg, + PixelDCSCondStateAlgCfg, PixelDCSCondStatusAlgCfg, PixelDistortionAlgCfg, PixelOfflineCalibCondAlgCfg # NEW FOR RUN3 PixelDeadMapCondAlgCfg, PixelChargeLUTCalibCondAlgCfg ) @@ -158,7 +158,6 @@ def TrigInDetCondConfig( flags ): acc.merge(PixelDCSCondStateAlgCfg(flags)) acc.merge(PixelDCSCondStatusAlgCfg(flags)) # NEW FOR RUN3 acc.merge(PixelDeadMapCondAlgCfg(flags)) - acc.merge(PixelTDAQCondAlgCfg(flags)) # offline calibration acc.merge(PixelDistortionAlgCfg(flags)) acc.merge(PixelOfflineCalibCondAlgCfg(flags)) diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/CMakeLists.txt b/Trigger/TrigTools/TrigT2CaloCalibration/CMakeLists.txt index 35e749ec9c54840b6e26b6d427b7be62d2c13557..a2a432f5c0aae5a4096f10a80defe0983b725342 100644 --- a/Trigger/TrigTools/TrigT2CaloCalibration/CMakeLists.txt +++ b/Trigger/TrigTools/TrigT2CaloCalibration/CMakeLists.txt @@ -1,58 +1,18 @@ -################################################################################ -# Package: TrigT2CaloCalibration -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( TrigT2CaloCalibration ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( PUBLIC - Calorimeter/CaloClusterCorrection - Calorimeter/CaloConditions - Calorimeter/CaloGeoHelpers - Calorimeter/CaloRec - Calorimeter/CaloUtils - Control/AthenaBaseComps - Control/AthenaKernel - Control/StoreGate - Database/AthenaPOOL/AthenaPoolUtilities - Event/xAOD/xAODTrigCalo - GaudiKernel - Trigger/TrigEvent/TrigCaloEvent - PRIVATE - Calorimeter/CaloDetDescr - Database/AthenaPOOL/AthenaPoolCnvSvc - Database/RegistrationServices - Event/EventInfo ) - -# External dependencies: -find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) - # Component(s) in the package: atlas_add_library( TrigT2CaloCalibrationLib - src/*.cxx + TrigT2CaloCalibration/*.h + INTERFACE PUBLIC_HEADERS TrigT2CaloCalibration - PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES CaloConditions CaloGeoHelpers AthenaBaseComps AthenaKernel AthenaPoolUtilities xAODTrigCalo GaudiKernel TrigCaloEvent CaloClusterCorrectionLib CaloRecLib CaloUtilsLib StoreGateLib SGtests CaloDetDescrLib AthenaPoolCnvSvcLib RegistrationServicesLib - PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} EventInfo ) + LINK_LIBRARIES GaudiKernel xAODTrigCalo ) atlas_add_component( TrigT2CaloCalibration - src/components/*.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} TrigT2CaloCalibrationLib ) - -atlas_add_poolcnv_library( TrigT2CaloCalibrationPoolCnv - FILES TrigT2CaloCalibration/T2CaloJetCalib_dBObj.h - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} TrigT2CaloCalibrationLib ) - -atlas_add_dictionary( TrigT2CaloCalibrationDict - TrigT2CaloCalibration/TrigT2CaloCalibrationDict.h - TrigT2CaloCalibration/selection.xml - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} TrigT2CaloCalibrationLib ) + src/*.cxx src/components/*.cxx + LINK_LIBRARIES LINK_LIBRARIES AthenaBaseComps CaloClusterCorrectionLib CaloConditions CaloDetDescrLib CaloGeoHelpers CaloUtilsLib TrigT2CaloCalibrationLib ) # 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} ) diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..bcc870e4181b14efe773266b3744c42ed77f05a1 --- /dev/null +++ b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigTools/TrigT2CaloCalibration diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/IT2HadCalibTool.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/IT2HadCalibTool.h deleted file mode 100755 index e980769ec0a53751b0c250d1075f64e076f75bc1..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/IT2HadCalibTool.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// ******************************************************************** -// -// NAME: IT2HadCalibTool.h -// PACKAGE: Trigger/TrigTools/TrigT2CaloCalibration -// -// AUTHORS: C. Osuna <Carlos.Osuna@ifae.es> -// P. Conde <Patricia,Conde.Muino@cern.ch> -// -// Interface for T2Calibration tools. -// -// ******************************************************************** - -#ifndef TRIGT2CALOCALIBRATION_IT2HADCALIBTOOL_H -#define TRIGT2CALOCALIBRATION_IT2HADCALIBTOOL_H - -#include "GaudiKernel/IAlgTool.h" - -class IT2HadCalibTool : virtual public IAlgTool { - public: - /**interface ID*/ - DeclareInterfaceID( IT2HadCalibTool, 1, 0 ); - - /**virtual method to be defined in the inherited class for*/ - virtual double c_energy(double EMenergy,double HADenergy,double eta) = 0; - virtual double c_febenergy(double EMenergy,double HADenergy,double eta) = 0; -}; - -#endif diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2CaloJetCalib_dBObj.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2CaloJetCalib_dBObj.h deleted file mode 100644 index b9ed207740463eb2ab47fb5d793f5f1ae93d3b5f..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2CaloJetCalib_dBObj.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef T2CALOJETCALIB_DBOBJ_H -#define T2CALOJETCALIB_DBOBJ_H - -#include "AthenaKernel/CLASS_DEF.h" -#include<string> - -/** @class T2CaloJetCalib_dBObj - - LVL 2 jet calibration dB data objects - Contains the weights, eta range, and energy cuts - - @author Malachi Schram - */ -class T2CaloJetCalib_dBObj{ - - public: - /** Constructor */ - T2CaloJetCalib_dBObj(); - - /** Destructor */ - ~T2CaloJetCalib_dBObj(); - - //Define lvl2 data type typedef - typedef std::vector<double> calib_dt; - - /*----------------------------------------------------------------*/ - /*------------------------ S E T T E R ---------------------------*/ - /*----------------------------------------------------------------*/ - /** Set the calibration weight */ - void set_calib_weights(calib_dt this_calib_dt); - - /** Retrieves the energy cuts */ - void set_ve_cuts(calib_dt this_calib_dt); - - /** Retrieves the eta range of the weights */ - void set_eta_ranges(calib_dt this_calib_dt); - - /*----------------------------------------------------------------*/ - /*------------------------ G E T T E R ---------------------------*/ - /*----------------------------------------------------------------*/ - /** Retrieves the calibration weight */ - inline calib_dt calib_weights() const{ - return m_calib_weights; - } - - /** Retrieves the energy cuts */ - inline calib_dt ve_cuts() const { - return m_ve_cuts; - } - - /** Retrieves the eta range of the weights */ - inline calib_dt eta_ranges() const { - return m_eta_ranges; - } - - private: - calib_dt m_calib_weights; - calib_dt m_ve_cuts; - calib_dt m_eta_ranges; - /** String variable used to id the set of weights */ - //std::string m_db_tag; -}; - -CLASS_DEF(T2CaloJetCalib_dBObj, 63773719, 1) - -#endif - diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2GSCalibTool.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2GSCalibTool.h deleted file mode 100755 index 3f8cd50b14c0ec965889c47791a85a11ff7dd58b..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2GSCalibTool.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// ******************************************************************** -// -// NAME: T2GSCalibTool.h -// PACKAGE: Trigger/TrigTools/TrigT2CaloCalibration -// -// AUTHOR: N. Anjos <nuno.anjos@cern.ch> -// -// Tool to apply Global Sequential Calibration for L2 trigger jets. -// It is based in JetCalibTools/JetPropertyInvertResponseTool. -// Correction factors are defined through jobO. -// -// ******************************************************************** - -#ifndef TRIGT2CALOCALIBRATION_T2GSCALIBTOOL_H -#define TRIGT2CALOCALIBRATION_T2GSCALIBTOOL_H - -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/Algorithm.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/Property.h" - -#include "CaloUtils/ToolWithConstants.h" - -#include "TrigT2CaloCalibration/IT2HadCalibTool.h" - -#include <vector> -#include <math.h> - -class T2GSCalibTool : - public extends<CaloUtils::ToolWithConstants<AthAlgTool>, - IT2HadCalibTool> -{ - public: - /** Constructor */ - T2GSCalibTool(const std::string&,const std::string&,const IInterface*); - /** Destructor */ - virtual ~T2GSCalibTool(); - /** athena initialize method */ - virtual StatusCode initialize() override; - /** athena finalize method */ - virtual StatusCode finalize() override; - - /** @brief Returns the response for each calo layer - * @param[in] Fraction of jet energy deposited in the layer - * @param[in] Jet energy after JES calibration - * @param[in] Eta position of the jet - */ - virtual double c_energy(double fLayer,double jetEnergy,double eta) override; - virtual double c_febenergy(double fLayer,double jetEnergy,double eta) override; - - private: - - MsgStream m_log; - - Constant<CxxUtils::Array<3> > m_calibConstants { this, "CalibConstants"}; - std::vector<double> m_etaBins; - std::vector<std::vector<double> > m_ptBins; - std::vector<std::vector<double> > m_propertyBins; - - double m_etaMin; - double m_etaMax; - double m_etaGapMin; - double m_etaGapMax; - double m_ptMin; - double m_ptMax; - - double CalculateCorrection(double jetProperty, - double pT, double eta); - - double interpolate(double pT, double jetProperty, - std::vector<double> ptBins, - std::vector<double> propertyBins, - CaloRec::Array<2> responseValue); - - double extrapolate(double pT, double jetProperty, - std::vector<double> ptBins, - std::vector<double> propertyBins, - CaloRec::Array<2> responseValue); - - double bilinearInterpolation(double x1, double y1, - double x2, double y2, - double z11,double z12, - double z21,double z22, - double x, double y); - - double linearInterpolation(double x1, double x2, - double z1,double z2, - double x); - -}; - -#endif diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2JESCalibTool.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2JESCalibTool.h deleted file mode 100755 index 19f65c8b6306b136efcc125f27f7267e36ce2559..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2JESCalibTool.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// ******************************************************************** -// -// NAME: T2JESCalibTool.h -// PACKAGE: Trigger/TrigTools/TrigT2CaloCalibration -// -// AUTHOR: N. Anjos <nuno.anjos@cern.ch> -// -// Tool to apply a JES calibration for L2 trigger jets. -// It is based in JetCalibTools/EtaMassEnergyCorr. -// Correction factors are defined through jobO. -// -// ******************************************************************** - -#ifndef TRIGT2CALOCALIBRATION_T2JESCALIBTOOL_H -#define TRIGT2CALOCALIBRATION_T2JESCALIBTOOL_H - -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/Algorithm.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/Property.h" - -#include "CaloUtils/ToolWithConstants.h" - -#include "TrigT2CaloCalibration/IT2HadCalibTool.h" - -#include <vector> -#include <math.h> - -class T2JESCalibTool : - public extends<CaloUtils::ToolWithConstants<AthAlgTool>, - IT2HadCalibTool> -{ - public: - /** Constructor */ - T2JESCalibTool(const std::string&,const std::string&,const IInterface*); - /** Destructor */ - virtual ~T2JESCalibTool(); - /** athena initialize method */ - virtual StatusCode initialize() override; - /** athena finalize method */ - virtual StatusCode finalize() override; - - // both energy arguments must be transverse energy in MeV - /** @brief Returns a calibrated energy using JES correction - * @param[in] Sum of energy for all EM samplings (except sampling 3) - * @param[in] Sum of energy for all HAD samplings (+ EM sampling 3) - * @param[in] Eta position of the cluster - */ - virtual double c_energy(double EMenergy,double HADenergy,double eta) override; - virtual double c_febenergy(double EMenergy,double HADenergy,double eta) override; - - private: - - MsgStream m_log; - - Constant<CxxUtils::Array<2> > m_EnergyCorrConstants { this, "JES_Factors" }; - FloatProperty m_etcut { this, "MinEtCut", 10 }; // Non-standard... in GeV! - - int GetEtaBin(double jet_eta); - double PolLogE(const CaloRec::Array<2> &constants, unsigned bin, double E); - double GetJES(double jet_e, double jet_eta); - -}; - -#endif diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2SampCalibTool.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2SampCalibTool.h deleted file mode 100755 index 7a0dcb1a5297d11c1cdb5aea09c2ee1c13f6b264..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/T2SampCalibTool.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// ******************************************************************** -// -// NAME: T2SampCalibTool.h -// PACKAGE: Trigger/TrigTools/TrigT2CaloCalibration -// -// AUTHORS: C. Osuna <Carlos.Osuna@ifae.es> -// P. Conde <Patricia,Conde.Muino@cern.ch> -// -// MODIFIED: M. Schram <malachi.schram@cern.ch> -// -// Tool to apply a sampling calibration for jets/taus. -// It is based on what is done in JetCalib package for offline. -// Weights are being specified through jobO. -// -// New conditional database functionality added via DataHandle & handle() method -// -// ******************************************************************** - -#ifndef TRIGT2CALOCALIBRATION_T2SAMPCALIBTOOL_H -#define TRIGT2CALOCALIBRATION_T2SAMPCALIBTOOL_H - -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/Algorithm.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/Property.h" -#include "StoreGate/DataHandle.h" - -#include "GaudiKernel/IIncidentListener.h" - -#include "TrigT2CaloCalibration/IT2HadCalibTool.h" -#include "TrigT2CaloCalibration/T2CaloJetCalib_dBObj.h" - -#include <vector> -#include <math.h> - -class IAthenaOutputStreamTool;//Needed to write to POOL/root file -class IIOVRegistrationSvc;//Needed for register with COOL - -class T2SampCalibTool : virtual public IT2HadCalibTool, public AthAlgTool, virtual public IIncidentListener { - public: - /** Constructor */ - T2SampCalibTool(const std::string&,const std::string&,const IInterface*); - /** Destructor */ - ~T2SampCalibTool(); - /** athena initialize method */ - StatusCode initialize(); - /** athena finalize method */ - StatusCode finalize(); - - // both energy arguments must be transverse energy in MeV - /** @brief Returns a calibrated energy using Sampling calibration - * @param[in] Sum of energy for all EM samplings (except sampling 3) - * @param[in] Sum of energy for all HAD samplings (+ EM sampling 3) - * @param[in] Eta position of the cluster - */ - double c_energy(double EMenergy,double HADenergy,double eta); - double c_febenergy(double EMenergy,double HADenergy,double eta); - - private: - - MsgStream m_log; - - void get_weight(double e, double CaloWeight[2]); - - std::vector<double> m_etareg; - std::vector<double> m_vecut; - std::vector<double> m_Weights; - double m_wt[52][2][4]; - - int m_nbin_eta; - int m_ient; - int m_ieta; - int m_nreg; - int m_nSamp; - int m_nEReg; - double m_ecut; - double m_etcut; - double m_etmid; - - //What I think I need to create object to dB (April 9th 2008) - bool m_createDbObj; - bool m_printDbObj; - bool m_readFromDb; - - std::string m_obj_key; - const DataHandle<T2CaloJetCalib_dBObj> m_lvl2_calib_handle; - - //Global dB object for reading - T2CaloJetCalib_dBObj* m_lvl2_calib; - - - /////////////////////////////////// - // Methods used to write dB info // - /////////////////////////////////// - StatusCode createCondObject(); - - ////////////////////////////////// - // Methods used to read dB info // - ////////////////////////////////// - StatusCode readFromDb(); - StatusCode assignWeights(); - virtual void handle(const Incident& incident); - - ///////////////////////////////// - // Method to print out dB info // - ///////////////////////////////// - StatusCode printCondObjects(); - -}; - -#endif diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/TrigT2CaloCalibrationDict.h b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/TrigT2CaloCalibrationDict.h deleted file mode 100644 index bc5c9acb273e0f55f914463cb02bc8974a8c09f4..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/TrigT2CaloCalibrationDict.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGT2CALOJETDB_DICT_H -#define TRIGT2CALOJETDB_DICT_H - -#include "TrigT2CaloCalibration/T2CaloJetCalib_dBObj.h" - - -#endif diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/selection.xml b/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/selection.xml deleted file mode 100644 index 33d738870f8a7f1bcd0d7d389582e808cd883386..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/selection.xml +++ /dev/null @@ -1,3 +0,0 @@ -<lcgdict> - <class name="T2CaloJetCalib_dBObj" id="D3DB6DC9-3E56-4582-B2CF-57037097204A" /> -</lcgdict> diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/doc/packagedoc.h b/Trigger/TrigTools/TrigT2CaloCalibration/doc/packagedoc.h deleted file mode 100644 index eec65109c20b9bdb53244115eccd49749a2db8ca..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/doc/packagedoc.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - -@page TrigT2CaloCalibration_page -@author Carlos Osuna -@author Patricia Conde - -@section TrigT2CaloCalibration_TrigT2CaloCalibrationOverview Overview -This package provides classes and methods to perform a Sampling Calibration -for L2 trigger. With EM energy, HAD energy and eta as input, it provides -a fast calibration suitable for hadronic objects. - - - -*/ diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/share/T2SampCalibration_jobOptions.py b/Trigger/TrigTools/TrigT2CaloCalibration/share/T2SampCalibration_jobOptions.py deleted file mode 100755 index 5053bf5bbe0423b5b5ec98fc6afbefeb5aaca04c..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/share/T2SampCalibration_jobOptions.py +++ /dev/null @@ -1,2 +0,0 @@ -theApp.Dlls += [ "TrigT2CaloCalibration" ] - diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaGapCalibration.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaGapCalibration.cxx index 2b12ec00df431d5250eb751d874033931dd95936..3f02cf3ff29b7550b171fda7ee6b10500d4da135 100644 --- a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaGapCalibration.cxx +++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaGapCalibration.cxx @@ -15,7 +15,7 @@ // // ******************************************************************** -#include "TrigT2CaloCalibration/EgammaGapCalibration.h" +#include "EgammaGapCalibration.h" //#include "TrigCaloEvent/TrigEMCluster.h" #include "xAODTrigCalo/TrigEMCluster.h" #include "GaudiKernel/MsgStream.h" diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaGapCalibration.h b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaGapCalibration.h similarity index 100% rename from Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaGapCalibration.h rename to Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaGapCalibration.h diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsCalibration.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsCalibration.cxx index 05646e5ea3104cd735ae4000d2bf8a1d27a57518..0eb84fb02c11e6cf0fbfc9ace212680f59db2a39 100644 --- a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsCalibration.cxx +++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsCalibration.cxx @@ -16,7 +16,7 @@ // // ******************************************************************** -#include "TrigT2CaloCalibration/EgammaHitsCalibration.h" +#include "EgammaHitsCalibration.h" //#include "TrigCaloEvent/TrigEMCluster.h" #include "xAODTrigCalo/TrigEMCluster.h" #include "GaudiKernel/MsgStream.h" diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsCalibration.h b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsCalibration.h similarity index 97% rename from Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsCalibration.h rename to Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsCalibration.h index 11c27e5ba267c237f6b3239272c32ce1bbe799ae..74d6d0b760bf023ef63ef7aac10a11724288f339 100644 --- a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsCalibration.h +++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsCalibration.h @@ -6,7 +6,7 @@ #define TRIGT2CALOCALIBRATION_EGAMMAHITSCALIBRATION #include "TrigT2CaloCalibration/IEgammaCalibration.h" -#include "TrigT2CaloCalibration/EgammaHitsShowerDepth.h" +#include "EgammaHitsShowerDepth.h" #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/MsgStream.h" diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsShowerDepth.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsShowerDepth.cxx index 8dcd0829554a249a3be7ad3a6503dc8a49418521..34315e72bc4bd9132813b965407c9b9d6d14b4f0 100644 --- a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsShowerDepth.cxx +++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsShowerDepth.cxx @@ -17,7 +17,7 @@ // ******************************************************************** -#include "TrigT2CaloCalibration/EgammaHitsCalibration.h" +#include "EgammaHitsCalibration.h" //#include "TrigCaloEvent/TrigEMCluster.h" #include "xAODTrigCalo/TrigEMCluster.h" #include "GaudiKernel/MsgStream.h" diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsShowerDepth.h b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsShowerDepth.h similarity index 100% rename from Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaHitsShowerDepth.h rename to Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaHitsShowerDepth.h diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaLWCalibration.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaLWCalibration.cxx index 43f0a1106c1bddf80914ccee827c918e2c5133c2..2ae457fd7b613d564f20b85d713f2c39b27264f4 100644 --- a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaLWCalibration.cxx +++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaLWCalibration.cxx @@ -14,7 +14,7 @@ // // ******************************************************************** -#include "TrigT2CaloCalibration/EgammaLWCalibration.h" +#include "EgammaLWCalibration.h" //#include "TrigCaloEvent/TrigEMCluster.h" #include "xAODTrigCalo/TrigEMCluster.h" #include "GaudiKernel/MsgStream.h" diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaLWCalibration.h b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaLWCalibration.h similarity index 100% rename from Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaLWCalibration.h rename to Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaLWCalibration.h diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaSshapeCalibration.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaSshapeCalibration.cxx index cb7337262af5fb39d0eb276cd4139c9c42a5a108..4405f3db542a93e7687051110a0c5ea6830faf31 100644 --- a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaSshapeCalibration.cxx +++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaSshapeCalibration.cxx @@ -2,7 +2,7 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "TrigT2CaloCalibration/EgammaSshapeCalibration.h" +#include "EgammaSshapeCalibration.h" //#include "TrigCaloEvent/TrigEMCluster.h" #include "xAODTrigCalo/TrigEMCluster.h" #include "CaloDetDescr/CaloDetDescrElement.h" diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaSshapeCalibration.h b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaSshapeCalibration.h similarity index 100% rename from Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaSshapeCalibration.h rename to Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaSshapeCalibration.h diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaTransitionRegions.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaTransitionRegions.cxx index 714220607c6c4136dc2f59325032f1f93e836fff..a497710eb762c0c1431db1f854f6c648b737aed8 100644 --- a/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaTransitionRegions.cxx +++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaTransitionRegions.cxx @@ -15,8 +15,8 @@ // // ******************************************************************** -#include "TrigT2CaloCalibration/EgammaTransitionRegions.h" -#include "TrigT2CaloCalibration/EgammaHitsShowerDepth.h" +#include "EgammaTransitionRegions.h" +#include "EgammaHitsShowerDepth.h" #include "xAODTrigCalo/TrigEMCluster.h" #include "GaudiKernel/MsgStream.h" // Need Cosh diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaTransitionRegions.h b/Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaTransitionRegions.h similarity index 100% rename from Trigger/TrigTools/TrigT2CaloCalibration/TrigT2CaloCalibration/EgammaTransitionRegions.h rename to Trigger/TrigTools/TrigT2CaloCalibration/src/EgammaTransitionRegions.h diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/T2CaloJetCalib_dBObj.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/T2CaloJetCalib_dBObj.cxx deleted file mode 100644 index 8bd56d9c2aeefa68ad3bcc6276b38c7865859839..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/src/T2CaloJetCalib_dBObj.cxx +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigT2CaloCalibration/T2CaloJetCalib_dBObj.h" - -/** @class T2CaloJetCalib_dBObj - - LVL 2 jet calibration dB data objects - Contains the weights, eta range, and energy cuts - - @author Malachi Schram - */ - -// Constructor -T2CaloJetCalib_dBObj::T2CaloJetCalib_dBObj() - : m_calib_weights(0), m_ve_cuts(0), m_eta_ranges(0) -{} - -//Destructor -T2CaloJetCalib_dBObj::~T2CaloJetCalib_dBObj(){} - -// Set the calibration weight -void T2CaloJetCalib_dBObj::set_calib_weights(calib_dt this_calib_dt){ - m_calib_weights=this_calib_dt; -} - -// Retrieves the energy cuts -void T2CaloJetCalib_dBObj::set_ve_cuts(calib_dt this_calib_dt){ - m_ve_cuts=this_calib_dt; -} - -// Retrieves the eta range of the weights -void T2CaloJetCalib_dBObj::set_eta_ranges(calib_dt this_calib_dt){ - m_eta_ranges=this_calib_dt; -} diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/T2GSCalibTool.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/T2GSCalibTool.cxx deleted file mode 100755 index 88b79852f61f87659c7b95126746d68896b9a461..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/src/T2GSCalibTool.cxx +++ /dev/null @@ -1,359 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// ******************************************************************** -// -// NAME: T2GSCalibTool.cxx -// PACKAGE: Trigger/TrigTools/TrigT2CaloCalibration -// -// AUTHOR: N. Anjos <nuno.anjos@cern.ch> -// -// Tool to apply a Glogbal Sequential Calibration for L2 trigger jets. -// It is based in JetCalibTools/JetPropertyInvertResponseTool. -// Correction factors are defined through jobO. -// -// ******************************************************************** - -#include "TrigT2CaloCalibration/T2GSCalibTool.h" -#include <cmath> - - -T2GSCalibTool::T2GSCalibTool(const std::string& t, const std::string& n, - const IInterface* p ) - : base_class(t,n,p), - m_log(msgSvc(), n) -{ - declareProperty("EtaBins", m_etaBins); - declareProperty("EtaMin", m_etaMin); - declareProperty("EtaMax", m_etaMax); - declareProperty("EtaGapMin", m_etaGapMin = 0); - declareProperty("EtaGapMax", m_etaGapMax = 0); - declareProperty("PtBins", m_ptBins); - declareProperty("PtMin", m_ptMin = 10.*1000); - declareProperty("PtMax", m_ptMax = 2.*1000*1000); - declareProperty("JetPropertyBins", m_propertyBins); - -} - - -T2GSCalibTool::~T2GSCalibTool() { -} - - -StatusCode T2GSCalibTool::initialize() -{ - // Initialize MsgStream - m_log.setLevel(msgLevel()); - ATH_CHECK( base_class::initialize() ); - return StatusCode::SUCCESS; -} - - -StatusCode T2GSCalibTool::finalize() -{ - return StatusCode::SUCCESS; -} - - -double T2GSCalibTool::c_energy(double fLayer,double jetEnergy,double eta) -{ - double et = jetEnergy/cosh(eta); - double response = CalculateCorrection(fLayer, et, eta); - return response; -} - - -double T2GSCalibTool::c_febenergy(double fLayer,double jetEnergy,double eta) -{ - return c_energy(fLayer,jetEnergy,eta); -} - - -double T2GSCalibTool::CalculateCorrection(double jetProperty, - double pT, double eta) -{ - // Say hello - if (msgLevel() <= MSG::VERBOSE) m_log << MSG::VERBOSE - << "In JetPropertyInvertResponseTool::CalculateCorrection" << endmsg; - - int eta_index = -1; - double corr = 0; - - if(eta<m_etaMin || eta>m_etaMax - || (eta>m_etaGapMin && eta<m_etaGapMax) - || pT<m_ptMin || pT>m_ptMax) return 1.; - - // This correction can be asymmetric in eta, so go across the whole range - if (msgLevel() <= MSG::VERBOSE) m_log << MSG::VERBOSE - << "Looking up jet eta position in table" << endmsg; - for(unsigned int i=0; i < m_etaBins.size() - 1; i++) { - if (eta < m_etaBins.at(0)) eta_index = 0; - else if (eta >= m_etaBins.at(m_etaBins.size()-1)) eta_index = m_etaBins.size(); - else if (eta >= m_etaBins.at(i) && eta < m_etaBins.at(i+1)) { - eta_index = i+1; - break; - } - } - - // Checking if the correction can be interpolated or extrapolated - if (msgLevel() <= MSG::VERBOSE) m_log << MSG::VERBOSE << "Checking if pT and fraction are in the range of the correction" << endmsg; - // if (outputLevel() <= MSG::VERBOSE) m_log << MSG::VERBOSE << " m_ptbins size"<< m_ptBins.size() << " " << m_propertyBins.size() << endmsg; - // if (outputLevel() <= MSG::VERBOSE) m_log << MSG::VERBOSE << " eta_index"<< eta_index << " " << m_ptBins[eta_index].size()-1 << endmsg; - - double maxX = (m_ptBins[eta_index][m_ptBins[eta_index].size()-1] - +m_ptBins[eta_index][m_ptBins[eta_index].size()-2])/2; - double maxY = (m_propertyBins[eta_index][m_propertyBins[eta_index].size()-1] - +m_propertyBins[eta_index][m_propertyBins[eta_index].size()-2])/2; - - double minX = m_ptBins[eta_index][0]; - double minY = m_propertyBins[eta_index][0]; - - if(pT<minX || jetProperty<minY) return 1.; - - bool interp = !(pT>maxX || jetProperty>maxY); - - corr = interp - ? interpolate(pT, jetProperty, - m_ptBins[eta_index], - m_propertyBins[eta_index], - m_calibConstants()[eta_index]) - : 0; - if(corr == 0){ - corr = extrapolate(pT, jetProperty, - m_ptBins[eta_index], - m_propertyBins[eta_index], - m_calibConstants()[eta_index]); - - - } - if (msgLevel() <= MSG::VERBOSE) m_log << MSG::VERBOSE << "Obtained correction value" << endmsg; - - // Print out some info for debugging - if(msgLevel() <= MSG::DEBUG) m_log << MSG::DEBUG - << " eta: " << eta - << " index: " << eta_index - << " property value: " << jetProperty -// << " property: " << m_propertyName - << " response = " << corr - << endmsg; - - return corr; -} - - -double T2GSCalibTool::interpolate(double pT, double jetProperty, - std::vector<double> ptBins, - std::vector<double> propertyBins, - CaloRec::Array<2> responseValue) -{ - int pt_low_index = -1; - int prop_low_index = -1; - - for(unsigned int i=0; i < ptBins.size() - 1; i++) { - if (pT >= ptBins.at(i) && pT < ptBins.at(i+1)) { - pt_low_index = (int) i; - break; - } - } - - for(unsigned int i=0; i < propertyBins.size() - 1; i++) { - if (jetProperty >= propertyBins.at(i) && jetProperty < propertyBins.at(i+1)) { - prop_low_index = (int) i; - break; - } - } - - if ((msgLevel() <= MSG::VERBOSE) && (pt_low_index == -1)){ - m_log << MSG::VERBOSE << "Problem in interpolation pt_low_index == -1" << endmsg; - return 1; - } - if ((msgLevel() <= MSG::VERBOSE) && (prop_low_index == -1)){ - m_log << MSG::VERBOSE << "Problem in interpolation prop_low_index == -1" << endmsg; - return 1; - } - - //calculate with respect to bin centers, not bin edges - - if(pT<(ptBins[pt_low_index]+ptBins[pt_low_index+1])/2.) - pt_low_index--; - if(jetProperty<(propertyBins[prop_low_index]+propertyBins[prop_low_index+1])/2.) - prop_low_index--; - - if(pt_low_index == (int) ptBins.size()-2 - && pT>=(ptBins[pt_low_index]+ptBins[pt_low_index+1])/2.) - pt_low_index++; - - if(prop_low_index == (int) propertyBins.size()-2 - && jetProperty>=(propertyBins[prop_low_index]+propertyBins[prop_low_index+1])/2.) - prop_low_index++; - - - double response = 1; - if(pt_low_index != -1 && prop_low_index != -1 - && pt_low_index != (int) ptBins.size()-1 - && prop_low_index != (int) propertyBins.size()-1){ - - //perform bilinear interpolation - - double x1, x2, y1, y2, z11, z12, z21, z22; - - x1 = (ptBins[pt_low_index]+ptBins[pt_low_index+1])/2.; - x2 = (ptBins[pt_low_index+1]+ptBins[pt_low_index+2])/2.; - - y1 = (propertyBins[prop_low_index]+propertyBins[prop_low_index+1])/2.; - y2 = (propertyBins[prop_low_index+1]+propertyBins[prop_low_index+2])/2.; - - z11 = responseValue[pt_low_index][prop_low_index]; - z12 = responseValue[pt_low_index][prop_low_index+1]; - z21 = responseValue[pt_low_index+1][prop_low_index]; - z22 = responseValue[pt_low_index+1][prop_low_index+1]; - - response = bilinearInterpolation(x1, y1, x2, y2, z11, z12, z21, z22, pT, jetProperty); - - }else if((pt_low_index == -1 || pt_low_index == (int) ptBins.size()-1) && - (prop_low_index == -1 || prop_low_index == (int) propertyBins.size()-1)){ - - //No interpolation possible - //Just return the value of the corresponding bin - int binx = pt_low_index == -1 ? 0 : pt_low_index-1; - int biny = prop_low_index == -1 ? 0 : prop_low_index-1; - - response = responseValue[binx][biny]; - }else{ - - //interpolation possible in one direction. - //do linear interpolation - double x1, x2, z1, z2, x; - - if(pt_low_index == -1 || pt_low_index == (int) ptBins.size()-1){ - - x1 = (propertyBins[prop_low_index]+propertyBins[prop_low_index+1])/2.; - x2 = (propertyBins[prop_low_index+1]+propertyBins[prop_low_index+2])/2.; - x = jetProperty; - - int binx = pt_low_index == -1 ? 0 : pt_low_index-1; - - z1 = responseValue[binx][prop_low_index]; - z2 = responseValue[binx][prop_low_index+1]; - - }else{ - - x1 = (ptBins[pt_low_index] +ptBins[pt_low_index+1])/2.; - x2 = (ptBins[pt_low_index+1]+ptBins[pt_low_index+2])/2.; - x = pT; - - int biny = prop_low_index == -1 ? 0 : prop_low_index; - - z1 = responseValue[pt_low_index][biny]; - z2 = responseValue[pt_low_index+1][biny]; - - } - - response = linearInterpolation(x1, x2, z1, z2, x); - } - - - - //if (msgLevel() <= MSG::VERBOSE) m_log << MSG::VERBOSE << "Interpolated value " << pT << " " << pt_low_index << " " << ptBins.at(pt_low_index) << " " << ptBins.at(pt_low_index+1) << " " << jetProperty << " " << prop_low_index << " " << propertyBins.at(prop_low_index) << " " << propertyBins.at(prop_low_index+1) << endmsg; - return response; - -} - - -double T2GSCalibTool::extrapolate(double pT, double jetProperty, - std::vector<double> ptBins, - std::vector<double> propertyBins, - CaloRec::Array<2> responseValue) -{ - //find closest point and take that one - int indx = -1; - int indy = -1; - double tempDR = 1e7; - double dR = 1e7; - - double maxX = (ptBins[ptBins.size()-1]+ptBins[ptBins.size()-2])/2.; - double maxY = (propertyBins[propertyBins.size()-1]+propertyBins[propertyBins.size()-2])/2; - - double minX = ptBins[0]; - double minY = propertyBins[0]; - - double extrapolated = 1; - - for(int i = 0; i<(int) ptBins.size()-1; i++){ - for(int j = 0; j<(int) propertyBins.size()-1; j++){ - double xs, ys; - xs = (ptBins[i+1]+ptBins[i])/2; - ys = (propertyBins[j+1]+propertyBins[j])/2; - //distance calculated differently for different cases - //find closest on the lower part - if(pT>=maxX){ - tempDR=jetProperty-ys > 0 ? jetProperty-ys : 1e7; - }else if(jetProperty>=maxY){ - tempDR= pT-xs > 0 ? pT-xs : 1e7; - }else{ - tempDR = sqrt(pow((pT-xs)/(maxX-minX),2) - +pow((jetProperty-ys)/(maxY-minY),2)); - } - if(tempDR<dR){ - dR = tempDR; - indx = i; - indy = j; - } - } - } - - if(pT>=maxX) indx = ptBins.size()-2; - if(jetProperty>=maxY) indy = propertyBins.size()-2; - - if(indx == -1) indx = 0; - if(indy == -1) indy = 0; - - if(indx == (int) ptBins.size()-2 && indy == (int) propertyBins.size()-2){ - extrapolated = responseValue[indx][indy]; - }else{ - double x1, x2, z1, z2, x; - if(indx == (int) ptBins.size()-2){ - x1 = (propertyBins[indy] +propertyBins[indy+1])/2; - x2 = (propertyBins[indy+1]+propertyBins[indy+2])/2; - x = jetProperty; - z1 = responseValue[indx][indy]; - z2 = responseValue[indx][indy+1]; - }else{ - x1 = (ptBins[indx] +ptBins[indx+1])/2; - x2 = (ptBins[indx+1]+ptBins[indx+2])/2; - x = pT; - z1 = responseValue[indx][indy]; - z2 = responseValue[indx+1][indy]; - } - extrapolated = linearInterpolation(x1, x2, z1, z2, x); - } - - if (msgLevel() <= MSG::VERBOSE) m_log << MSG::VERBOSE << "Extrapolated correction value " << extrapolated << " " << indx << " " << indy << " " << jetProperty << endmsg; - - return extrapolated; - -} - - -double T2GSCalibTool::bilinearInterpolation(double x1, double y1, - double x2, double y2, - double z11,double z12, - double z21,double z22, - double x, double y) -{ - double zInt1 = z11+(z21-z11)*(x-x1)/(x2-x1); - double zInt2 = z12+(z22-z12)*(x-x1)/(x2-x1); - - double zInt = zInt1+(zInt2-zInt1)*(y-y1)/(y2-y1); - return zInt; -} - - -double T2GSCalibTool::linearInterpolation(double x1, double x2, - double z1,double z2, - double x) -{ - return z1+(z2-z1)*(x-x1)/(x2-x1); -} - diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/T2JESCalibTool.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/T2JESCalibTool.cxx deleted file mode 100755 index d95b4ee3778ce5dbdac000b93d23527be00e9e14..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/src/T2JESCalibTool.cxx +++ /dev/null @@ -1,119 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -// ******************************************************************** -// -// NAME: T2JESCalibTool.cxx -// PACKAGE: Trigger/TrigTools/TrigT2CaloCalibration -// -// AUTHOR: N. Anjos <nuno.anjos@cern.ch> -// -// Tool to apply a JES calibration for L2 trigger jets. -// It is based in JetCalibTools/EtaMassEnergyCorr. -// Correction factors are defined through jobO. -// -// Energy arguments to public function, c_energy, must be specified -// as transverse energy in MeV. -// -// ******************************************************************** - -#include "TrigT2CaloCalibration/T2JESCalibTool.h" -#include <cmath> - - -T2JESCalibTool::T2JESCalibTool(const std::string& t, const std::string& n, - const IInterface* p ) - : base_class(t,n,p), - m_log(msgSvc(), n) -{ -} - - -T2JESCalibTool::~T2JESCalibTool() { -} - - -StatusCode T2JESCalibTool::initialize() -{ - // Initialize MsgStream - m_log.setLevel(msgLevel()); - ATH_CHECK( base_class::initialize() ); - return StatusCode::SUCCESS; -} - - -StatusCode T2JESCalibTool::finalize() -{ - return StatusCode::SUCCESS; -} - - -double T2JESCalibTool::c_energy(double EMe,double HADe,double eta) -{ -// Internally we must work in GeV -// but the function arguments are specified in MeV -// and the returned value as well in MeV - - double GeV=1000; - double EMscale_e = (EMe + HADe)/GeV; - double etf = 1./cosh(eta); - double EMscale_et = etf * EMscale_e; - - if ( EMscale_et < m_etcut ) { - if ( msgLevel() <= MSG::DEBUG ) - m_log << MSG::DEBUG << "Cluster transv. energy :" << EMscale_et - << ", below threshold :" << m_etcut << endmsg; - return 0.0; - } - - double JES_weight = GetJES(EMscale_e,eta); - return JES_weight*EMscale_e*GeV; - -} - - -double T2JESCalibTool::c_febenergy(double EMe,double HADe,double eta) -{ - return c_energy(EMe,HADe,eta); -} - - -double T2JESCalibTool::GetJES(double jet_e, double jet_eta) -{ - double E = jet_e; - if ( E < m_etcut*cosh(jet_eta) ) - E= m_etcut*cosh(jet_eta); - - // Get the eta bin index - unsigned ieta = GetEtaBin(jet_eta); - - // Calculate the jet response and then the JES as 1/R - double R=PolLogE(m_EnergyCorrConstants(),ieta,E); - return 1.0/R; -} - - -double T2JESCalibTool::PolLogE(const CaloRec::Array<2> &constants, - unsigned bin, double E) -{ - //up to 7 parameter for the pol-fit - unsigned Npar=7; - double logE=log(E); - double y=0; - for (unsigned i=0;i<Npar;++i) - y += constants[bin][i]*pow(logE,i); - return y; -} - - -int T2JESCalibTool::GetEtaBin(double jet_eta) -{ - //90 eta bins - int ieta=int(jet_eta*10)+45; - if (jet_eta<0) ieta-=1; - if ( ieta < 0 ) return 0; - if ( ieta > 89 ) return 89; - return ieta; -} - diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/T2SampCalibTool.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/T2SampCalibTool.cxx deleted file mode 100755 index 698d5fb28b39cff426a51c5343ffcbbd8c86ad74..0000000000000000000000000000000000000000 --- a/Trigger/TrigTools/TrigT2CaloCalibration/src/T2SampCalibTool.cxx +++ /dev/null @@ -1,485 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// ******************************************************************** -// -// NAME: T2SampCalibTool.cxx -// PACKAGE: Trigger/TrigTools/TrigT2CaloCalibration -// -// AUTHORS: C. Osuna <Carlos.Osuna@ifae.es> -// P. Conde <Patricia,Conde.Muino@cern.ch> -// MODIFIED: M. Schram <malachi.schram@cern.ch> -// COMMENT: Code need to be modified and made more dynamic! -// -// Tool to apply a sampling calibration for jets/taus. -// It is based on what is done in JetCalib package for offline. -// Weights are being specified through jobO. -// -// Energy arguments to public function, c_energy, must be specified -// as transverse energy in MeV. -// -// New conditional database functionality added via DataHandle & handle() method -// ******************************************************************** - -#include "TrigT2CaloCalibration/T2SampCalibTool.h" -#include "TrigT2CaloCalibration/T2CaloJetCalib_dBObj.h" -#include <cmath> - -// Athena includes -#include "StoreGate/StoreGate.h" -#include "AthenaKernel/IAthenaOutputStreamTool.h" - -// Gaudi includes -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/IIncidentSvc.h" -#include "GaudiKernel/GaudiException.h" -#include "GaudiKernel/IToolSvc.h" -#include "GaudiKernel/Property.h" - -// Needed to register dB object -#include "RegistrationServices/IIOVRegistrationSvc.h" - -T2SampCalibTool::T2SampCalibTool(const std::string& t, const std::string& n, - const IInterface* p ) : AthAlgTool(t,n,p), m_log(msgSvc(), n) -{ - - declareInterface<IT2HadCalibTool>(this); - m_nbin_eta = 44; - m_etcut = 5; - m_etmid = 35.; - m_nreg = 0; - m_ient = 0; - m_ieta = 0; - m_nSamp = 2; - m_nEReg = 4; - m_createDbObj = false; - m_printDbObj = false; - m_readFromDb = false; - declareProperty("nEtaBin", m_nbin_eta); - declareProperty("EtaReg", m_etareg ); - declareProperty("VECut", m_vecut ); - declareProperty("Weights", m_Weights); - declareProperty("MinEtCut",m_etcut); - declareProperty("EtRegionLimit", m_etmid); - //New dB variables - declareProperty("CreateDbObject",m_createDbObj); - declareProperty("PrintDbObject",m_printDbObj); - declareProperty("ReadFromDB",m_readFromDb); - declareProperty("L2CalibDbObjectKey", m_obj_key="T2CaloJetCalib"); -} - -T2SampCalibTool::~T2SampCalibTool() { -} - - -StatusCode T2SampCalibTool::initialize() -{ - StatusCode sc; - - // Initialize MsgStream - m_log.setLevel(msgLevel()); - - ///////////////////////////////////////// - // Setup in Svc/Tools needed to use dB // - ///////////////////////////////////////// - - //Create dB object needed for POOL/root - if(m_createDbObj){ - sc = createCondObject(); - //Read dB object info. - if (sc.isFailure()) { - m_log << MSG::ERROR - << " Failed to create T2SampCalibTool dB object " - << endmsg; - return StatusCode::FAILURE; - } - } - //End of move (Nov 22th '09) - if(m_readFromDb){ - sc = readFromDb(); - if (sc.isFailure()) { - m_log << MSG::ERROR - << " Failed to read T2SampCalibTool dB object " - << endmsg; - //return StatusCode::FAILURE; - } - } - - - - IIncidentSvc* incSvc; - sc = service( "IncidentSvc", incSvc ); - if (sc.isFailure()) { - m_log << MSG::ERROR << "Unable to get the IncidentSvc" << endmsg; - return StatusCode::FAILURE; - } - incSvc->addListener(this, "BeginRun"); - - - return StatusCode::SUCCESS; -} - - -//Allows the calibration weights to be assigned before the first event at "initialize" -void T2SampCalibTool::handle(const Incident& inc) { - if (inc.type()=="BeginRun") { - StatusCode sc; - //Read dB object info. - /*if(m_readFromDb){ - sc = readFromDb(); - if (sc.isFailure()) { - m_log << MSG::ERROR - << " Failed to read T2SampCalibTool dB object " - << endmsg; - //return StatusCode::FAILURE; - } - }*/ - //Assign weights - sc = assignWeights(); - if (sc.isFailure()) { - m_log << MSG::ERROR - << " Failed to assign T2SampCalibTool calibration weights " - << endmsg; - //return StatusCode::FAILURE; - } - } -} - -StatusCode T2SampCalibTool::finalize() -{ - return StatusCode::SUCCESS; -} - - -double T2SampCalibTool::c_energy(double EMe,double HADe, double eta) -{ - - //AssignWeights during the running - ///if(m_readFromDb){assignWeights();} - -// Internally we must work in GeV -// but the function arguments are specified in MeV -// and the returned value as well in MeV - - - double EMenergy = EMe / 1000.; - double HADenergy = HADe / 1000.; - -// double etf = 1./( (exp(eta)+exp(-eta))/2. ); - double etf = 1./cosh(eta); - - double eR = EMenergy + HADenergy; - double etR = etf * eR; - - if ( etR < m_etcut ) { - if ( msgLevel() <= MSG::DEBUG ) - m_log << MSG::DEBUG << "Cluster transv. energy :" << etR << ", below threshold :" - << m_etcut << endmsg; - return 0.0; - } - m_ieta = -1; - for(int i=0; i < m_nbin_eta;++i) { - if( fabs(eta) >= m_etareg[i] && fabs(eta) < m_etareg[i+1] ) { - m_ieta = i; - break; - } - } - m_nreg = 2; - - // Remove difference between FCal and other detector jets - //if(m_ieta > 31) m_nreg = 1; - - m_ecut = m_vecut[m_ieta]; - - - double e2c = m_etmid / etf; - - double f = 1.0; - int count = 0; - m_ient = -1; - double eC = 0; - double CaloWeight[2] ; - - do - { - if ( eR < e2c ) m_ient = 0; - if ( eR >= e2c ) m_ient = 1; - - get_weight( eR , CaloWeight ) ; - - eC = 0; - if ( m_nreg == 2) - eC += CaloWeight[0] * EMenergy + CaloWeight[1] * HADenergy; - else - eC += CaloWeight[0] * (EMenergy + HADenergy); - - - f = std::fabs(eC - eR ) /eR; - eR = eC; - if( eR < m_ecut || etf*eR < m_etcut) { - if ( msgLevel() <= MSG::DEBUG ) - m_log << MSG::DEBUG << "At iteration: " << count << ", cluster transv. energy :" - << etR << ", below threshold :" << m_etcut << endmsg; - - return 0.0; - } - ++count; - - } while ( f > 0.005 && count < 10 ); - - return eR * 1000.; //return in MeV - - -} - -double T2SampCalibTool::c_febenergy(double EMe,double HADe, - double eta) -{ - - //AssignWeights during the running - // if(m_readFromDb){assignWeights();} - // assignWeights(); -// Internally we must work in GeV -// but the function arguments are specified in MeV -// and the returned value as well in MeV - - - double EMenergy = EMe / 1000.; - double HADenergy = HADe / 1000.; - - double etf = 1./( (exp(eta)+exp(-eta))/2. ); - - double eR = EMenergy + HADenergy; - double etR = etf * eR; - - if ( etR < m_etcut ) { - if ( msgLevel() <= MSG::DEBUG ) - m_log << MSG::DEBUG << "Cluster transv. energy :" << etR << ", below threshold :" - << m_etcut << endmsg; - return 0.0; - } - m_ieta = -1; - for(int i=0; i < m_nbin_eta;++i) { - if( fabs(eta) >= m_etareg[i] && fabs(eta) < m_etareg[i+1] ) { - m_ieta = i; - break; - } - } - m_nreg = 2; - - // Remove difference between FCal and other detector jets - //if(m_ieta > 31) m_nreg = 1; - - m_ecut = m_vecut[m_ieta]; - - - double e2c = m_etmid / etf; - - double f = 1.0; - int count = 0; - m_ient = -1; - double eC = 0; - double CaloWeight[2] ; - - do - { - if ( (eR < e2c) && (fabs(eta)<1.4) ) m_ient = 0; - if ( (eR >= e2c) && (fabs(eta)<1.4) ) m_ient = 1; - if ( fabs(eta) > 1.4 ) m_ient = 2; - - get_weight( eR , CaloWeight ) ; - - eC = 0; - if ( m_nreg == 2) - eC += CaloWeight[0] * EMenergy + CaloWeight[1] * HADenergy; - else - eC += CaloWeight[0] * (EMenergy + HADenergy); - - - f = fabs(eC - eR ) /eR; - eR = eC; - if( eR < m_ecut || etf*eR < m_etcut) { - if ( msgLevel() <= MSG::DEBUG ) - m_log << MSG::DEBUG << "At iteration: " << count << ", cluster transv. energy :" - << etR << ", below threshold :" << m_etcut << endmsg; - - return 0.0; - } - ++count; - - } while ( f > 0.005 && count < 10 ); - - return eR * 1000.; //return in MeV - - -} -void T2SampCalibTool::get_weight(double e, double CaloWeight[2]) -{ - //AssignWeights during the running - //if(m_readFromDb){assignWeights();} - - double w=1; - - for( int i=0; i< m_nreg;++i) - { - if (m_ient == 0) w = m_wt[m_ieta][i][0] + (m_wt[m_ieta][i][1])*log(e/m_ecut); - if ( m_ient == 1 ) w = m_wt[m_ieta][i][2] + (m_wt[m_ieta][i][3])*log(e/m_ecut); - if ( m_ient == 2 ) w = m_wt[m_ieta][i][2]; -// if (m_ient == 0) w = m_Weights[m_ieta*m_nSamp*m_nEReg + i*m_nEReg + 0] + -// (m_Weights[m_ieta*m_nSamp*m_nEReg + i*m_nEReg + 1])*log(e/m_ecut); -// if (m_ient == 1) w = m_Weights[m_ieta*m_nSamp*m_nEReg + i*m_nEReg + 2] + -// (m_Weights[m_ieta*m_nSamp*m_nEReg + i*m_nEReg + 3])*log(e/m_ecut); - - if ( e < m_ecut ) w = 1.0; - - CaloWeight[i] = w; - - } - - - -} - -StatusCode T2SampCalibTool::readFromDb(){ - StatusCode status; - - m_log << MSG::DEBUG <<"T2SampCalibTool::Reading from dB..." <<endmsg; - - //Register DataHandle - status = detStore()->regHandle(m_lvl2_calib_handle, m_obj_key); - if (status.isFailure()) { - m_log << MSG::ERROR <<"Could not retrieve DataHandle for T2CaloJetCalib_dBObj" <<endmsg; - return( StatusCode::FAILURE); - } else { - m_log << MSG::INFO << "Retrieved DataHandle for T2CaloJetCalib_dBObj " << endmsg; - } - return StatusCode::SUCCESS; -} - -//Method used to create the calibration dB object -StatusCode T2SampCalibTool::createCondObject(){ - StatusCode sc; - - m_log << MSG::INFO <<"Creating T2SampCalibTool dB object" <<endmsg; - - ///////////////////////////////// - // Create T2CaloJetCalib_dBObj // - ///////////////////////////////// - T2CaloJetCalib_dBObj* lvl2_calib = new T2CaloJetCalib_dBObj(); - //Fill obj - m_log << MSG::INFO << "Setup T2CaloJetCalib_dBObj... " << endmsg; - //Use info from job option to fill dB objects - lvl2_calib->set_eta_ranges(m_etareg); - lvl2_calib->set_ve_cuts(m_vecut); - lvl2_calib->set_calib_weights(m_Weights); - //Provide a key which is used as the name to create the folder - sc = detStore()->record(lvl2_calib, m_obj_key); - if (sc.isFailure()) { - m_log <<MSG::ERROR <<"Could not record T2CaloJetCalib_dBObj" <<endmsg; - return( StatusCode::FAILURE); - } - return StatusCode::SUCCESS; -} - -//Method used to print out dB info -StatusCode T2SampCalibTool::printCondObjects(){ - StatusCode sc; - - m_log << MSG::INFO << "Printing T2SampCalibTool dB Calibration Info." << endmsg; - - //Retrieve T2CaloJetCalib_dBObj - sc = detStore()->retrieve(m_lvl2_calib, m_obj_key); - if (sc.isFailure()) { - m_log << MSG::ERROR <<"Could not retrieve T2CaloJetCalib_dBObj" <<endmsg; - return( StatusCode::FAILURE); - } else { - m_log << MSG::INFO << "Retrieved T2CaloJetCalib_dBObj " << endmsg; - } - if (m_lvl2_calib==0) { - m_log <<MSG::ERROR <<"T2CaloJetCalib_dBObj ptr is 0" <<endmsg; - return( StatusCode::FAILURE); - } - if(msgLevel() <= MSG::DEBUG){ - int eta_size=(m_lvl2_calib->eta_ranges().size()); - m_log << MSG::DEBUG << "T2SampCalibTool::Number of eta bins: " << eta_size << endmsg; - for(int i=0;i<eta_size;++i){ - m_log << MSG::DEBUG << "T2SampCalibTool::EtaRange["<<i<<"]: " - << (m_lvl2_calib->eta_ranges()).at(i) - << endmsg; - } - int ve_size=(m_lvl2_calib->ve_cuts().size()); - m_log << MSG::DEBUG << "T2SampCalibTool::Number of ve bins: " << ve_size << endmsg; - for(int i=0;i<ve_size;++i){ - m_log << MSG::DEBUG << "T2SampCalibTool::VECut["<<i<<"]: " - << (m_lvl2_calib->ve_cuts()).at(i) - << endmsg; - } - int weight_size=(m_lvl2_calib->calib_weights().size()); - m_log << MSG::DEBUG << "T2SampCalibTool::Number of ve bins: " << ve_size << endmsg; - for(int i=0;i<weight_size;++i){ - m_log << MSG::DEBUG << "T2SampCalibTool::Weights["<<i<<"]: " - << (m_lvl2_calib->calib_weights()).at(i) - << endmsg; - } - } - - delete m_lvl2_calib; - return StatusCode::SUCCESS; -} - -StatusCode T2SampCalibTool::assignWeights(){ - - //////////////////////////// - // Print calibration data // - //////////////////////////// - if(m_readFromDb){ - if(msgLevel() <= MSG::INFO){ - int eta_size=(m_lvl2_calib_handle->eta_ranges().size()); - m_etareg.resize(eta_size,0); - for(int i=0;i<eta_size;++i){ - m_etareg.at(i)=(m_lvl2_calib_handle->eta_ranges()).at(i); - m_log << MSG::DEBUG << "T2SampCalibTool::EtaRanges["<<i<<"]: " - << (m_lvl2_calib_handle->eta_ranges()).at(i) - << endmsg; - } - int ve_size=(m_lvl2_calib_handle->ve_cuts().size()); - m_vecut.resize(ve_size,0); - for(int i=0;i<ve_size;++i){ - m_vecut.at(i) = (m_lvl2_calib_handle->ve_cuts()).at(i); - m_log << MSG::DEBUG << "T2SampCalibTool::VECuts["<<i<<"]: " - << (m_lvl2_calib_handle->ve_cuts()).at(i) - << endmsg; - } - int weight_size=(m_lvl2_calib_handle->calib_weights().size()); - m_Weights.resize(weight_size,0); - for(int i=0;i<weight_size;++i){ - m_Weights.at(i) = (m_lvl2_calib_handle->calib_weights()).at(i); - m_log << MSG::DEBUG << "T2SampCalibTool::Weights["<<i<<"]: " - << (m_lvl2_calib_handle->calib_weights()).at(i) - << endmsg; - } - } - } - - if(msgLevel() <= MSG::DEBUG) - m_log << MSG::DEBUG << "T2SampCalib Weights: " << endmsg; - - for(int i=0; i<m_nbin_eta; ++i) - { - for(int j=0; j<m_nSamp; ++j) - { - for(int k=0;k<m_nEReg; ++k) - { - m_wt[i][j][k]=m_Weights[i*m_nSamp*m_nEReg + j*m_nEReg + k]; - if(msgLevel() <= MSG::DEBUG) - m_log << MSG::DEBUG << " m_wt["<<i<<"]["<<j<<"]["<<k<<"] =" << m_wt[i][j][k]; - } - if(msgLevel() <= MSG::DEBUG) - m_log << MSG::DEBUG << endmsg; - } - if(msgLevel() <= MSG::DEBUG) - m_log << MSG::DEBUG << endmsg; - } - return StatusCode::SUCCESS; -} diff --git a/Trigger/TrigTools/TrigT2CaloCalibration/src/components/TrigT2CaloCalibration_entries.cxx b/Trigger/TrigTools/TrigT2CaloCalibration/src/components/TrigT2CaloCalibration_entries.cxx index c367190ca018a97fb4a24f367348de5e30ef6d91..14ceac6a859866d93a2abcf650cdb05c9b82b51c 100644 --- a/Trigger/TrigTools/TrigT2CaloCalibration/src/components/TrigT2CaloCalibration_entries.cxx +++ b/Trigger/TrigTools/TrigT2CaloCalibration/src/components/TrigT2CaloCalibration_entries.cxx @@ -1,15 +1,9 @@ -#include "TrigT2CaloCalibration/T2JESCalibTool.h" -#include "TrigT2CaloCalibration/T2GSCalibTool.h" -#include "TrigT2CaloCalibration/T2SampCalibTool.h" -#include "TrigT2CaloCalibration/EgammaHitsCalibration.h" -#include "TrigT2CaloCalibration/EgammaLWCalibration.h" -#include "TrigT2CaloCalibration/EgammaGapCalibration.h" -#include "TrigT2CaloCalibration/EgammaSshapeCalibration.h" -#include "TrigT2CaloCalibration/EgammaTransitionRegions.h" +#include "../EgammaHitsCalibration.h" +#include "../EgammaLWCalibration.h" +#include "../EgammaGapCalibration.h" +#include "../EgammaSshapeCalibration.h" +#include "../EgammaTransitionRegions.h" -DECLARE_COMPONENT( T2JESCalibTool ) -DECLARE_COMPONENT( T2GSCalibTool ) -DECLARE_COMPONENT( T2SampCalibTool ) DECLARE_COMPONENT( EgammaHitsCalibration ) DECLARE_COMPONENT( EgammaLWCalibration ) DECLARE_COMPONENT( EgammaGapCalibration ) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref index dcc3d0bbb2bdb08087fb52c131c5a49cf3777b50..12963c515b75b2918681edc3afa7032c18b91931 100644 --- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref +++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_mt1_build.ref @@ -653,8 +653,8 @@ TrigSignatureMoniMT INFO HLT_xe100_pfsum_L1XE50 # TrigSignatureMoniMT INFO -- #1890237897 Events 10 10 2 - - - - - 2 TrigSignatureMoniMT INFO -- #1890237897 Features 2 - - - - - TrigSignatureMoniMT INFO HLT_xe100_tcpufit_L1XE50 #2803198799 -TrigSignatureMoniMT INFO -- #2803198799 Events 10 10 3 - - - - - 3 -TrigSignatureMoniMT INFO -- #2803198799 Features 3 - - - - - +TrigSignatureMoniMT INFO -- #2803198799 Events 10 10 6 - - - - - 6 +TrigSignatureMoniMT INFO -- #2803198799 Features 6 - - - - - TrigSignatureMoniMT INFO HLT_xe100_trkmht_L1XE50 #1055916731 TrigSignatureMoniMT INFO -- #1055916731 Events 10 10 4 - - - - - 4 TrigSignatureMoniMT INFO -- #1055916731 Features 4 - - - - - @@ -665,14 +665,14 @@ TrigSignatureMoniMT INFO HLT_xe110_tc_em_L1XE50 # TrigSignatureMoniMT INFO -- #607113828 Events 10 10 5 - - - - - 5 TrigSignatureMoniMT INFO -- #607113828 Features 5 - - - - - TrigSignatureMoniMT INFO HLT_xe110_tcpufit_L1XE50 #892853397 -TrigSignatureMoniMT INFO -- #892853397 Events 10 10 3 - - - - - 3 -TrigSignatureMoniMT INFO -- #892853397 Features 3 - - - - - +TrigSignatureMoniMT INFO -- #892853397 Events 10 10 6 - - - - - 6 +TrigSignatureMoniMT INFO -- #892853397 Features 6 - - - - - TrigSignatureMoniMT INFO HLT_xe30_cell_L1XE10 #1649696554 TrigSignatureMoniMT INFO -- #1649696554 Events 19 19 17 - - - - - 17 TrigSignatureMoniMT INFO -- #1649696554 Features 17 - - - - - TrigSignatureMoniMT INFO HLT_xe30_cell_xe30_tcpufit_L1XE10 #3768353779 -TrigSignatureMoniMT INFO -- #3768353779 Events 19 19 15 - - - - - 15 -TrigSignatureMoniMT INFO -- #3768353779 Features 15 - - - - - +TrigSignatureMoniMT INFO -- #3768353779 Events 19 19 14 - - - - - 14 +TrigSignatureMoniMT INFO -- #3768353779 Features 14 - - - - - TrigSignatureMoniMT INFO HLT_xe30_mht_L1XE10 #3626903018 TrigSignatureMoniMT INFO -- #3626903018 Events 19 19 19 - - - - - 19 TrigSignatureMoniMT INFO -- #3626903018 Features 19 - - - - - @@ -680,8 +680,8 @@ TrigSignatureMoniMT INFO HLT_xe30_pfsum_L1XE10 #9 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 -- #1583719916 Events 19 19 14 - - - - - 14 +TrigSignatureMoniMT INFO -- #1583719916 Features 14 - - - - - TrigSignatureMoniMT INFO HLT_xe30_trkmht_L1XE10 #2468872349 TrigSignatureMoniMT INFO -- #2468872349 Events 19 19 17 - - - - - 17 TrigSignatureMoniMT INFO -- #2468872349 Features 17 - - - - - @@ -689,5 +689,5 @@ TrigSignatureMoniMT INFO HLT_xe65_cell_L1XE50 #53 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 - - - - - +TrigSignatureMoniMT INFO -- #115518400 Events 10 10 5 - - - - - 5 +TrigSignatureMoniMT INFO -- #115518400 Features 5 - - - - - diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_grid.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_grid.py index 3e57c07903e9fd7b302902f7334c74b081a31b67..ad5e54d785513008a52f6d33eef553b206c31de0 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_grid.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_grid.py @@ -63,6 +63,7 @@ if not os.path.exists('PHYSVAL_WEB'): pv=[] +pv.append(['Jet','JetMon']) pv.append(['Tau','TauMon']) pv.append(['Muon','MuonMon']) pv.append(['ID','IDMon']) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_mt1_compLegacy_grid.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_mt1_compLegacy_grid.py new file mode 100755 index 0000000000000000000000000000000000000000..c7314633b91bdde0d0f912f49e14adc7705731b8 --- /dev/null +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_mt1_compLegacy_grid.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python + +# art-description: Test of transform RDO->RDO_TRIG->ESD->AOD with AthenaMT and AOD->NTUP_PHYSVAL with serial athena to produce webdisplay (comparing with legacy 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* +# 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.threads = 1 +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(['Jet','JetMon']) +pv.append(['Tau','TauMon']) +pv.append(['Muon','MuonMon']) +pv.append(['ID','IDMon']) +pv.append(['Bphys','BphysMon']) +pv.append(['HLTCalo','HLTCaloESD']) +pv.append(['Result','ResultMon']) +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/TrigAnalysisTest/test/test_trigAna_PhysValWeb_mt1_grid.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_mt1_grid.py index f6885daae64063e7068b172465886017c9186cb2..4b6491272d040944e7949398babe8904747c772d 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_mt1_grid.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_PhysValWeb_mt1_grid.py @@ -54,7 +54,7 @@ test.check_steps = CheckSteps.default_check_steps(test) download=CheckSteps.DownloadRefStep() download.artpackage = 'TrigAnalysisTest' -download.artjobname = 'test_trigAna_PhysValWeb_grid.py' +download.artjobname = 'test_trigAna_PhysValWeb_mt1_grid.py' download.required=True test.check_steps.append(download) @@ -64,6 +64,7 @@ if not os.path.exists('PHYSVAL_WEB'): pv=[] +pv.append(['Jet','JetMon']) pv.append(['Tau','TauMon']) pv.append(['Muon','MuonMon']) pv.append(['ID','IDMon']) diff --git a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py index 26a68945148ec8315f3e6eab5275246a42236f24..ca007442f22cb7a44199a2d12a8f4b6188882598 100644 --- a/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py +++ b/Trigger/TrigValidation/TrigInDetValidation/python/TrigInDetArtSteps.py @@ -11,6 +11,7 @@ import os from TrigAnalysisTest.TrigAnalysisSteps import AthenaCheckerStep from TrigValTools.TrigValSteering.Step import Step +from TrigValTools.TrigValSteering.CheckSteps import RefComparisonStep ################################################## # Additional exec (athena) steps @@ -52,14 +53,14 @@ class TrigInDetdictStep(Step): super(TrigInDetdictStep, self).configure(test) -class TrigInDetCompStep(Step): +class TrigInDetCompStep(RefComparisonStep): ''' Execute TIDAcomparitor for data.root files. ''' def __init__(self, name='TrigInDetComp'): super(TrigInDetCompStep, self).__init__(name) self.input_file = 'data-hists.root' - self.ref_file = 'data-hists.root' #### need to add reference file here +# self.ref_file = 'data-hists.root' #### need to add reference file here self.output_dir = 'HLT-plots' self.chains = ' ' self.args = '' @@ -68,6 +69,34 @@ class TrigInDetCompStep(Step): self.executable = 'TIDAcomparitor' def configure(self, test): - self.args += self.input_file+' '+self.ref_file+' '+self.chains+' -d '+self.output_dir + if (self.reference == None): + # if no referenc found, use input file as reference + self.args += self.input_file+' '+self.input_file+' '+self.chains+' -d '+self.output_dir + else: + self.args += self.input_file+' '+self.ref_file+' '+self.chains+' -d '+self.output_dir super(TrigInDetCompStep, self).configure(test) + +class TrigInDetCpuCostStep(RefComparisonStep): + ''' + Execute TIDAcpucost for expert-monitoring.root files. + ''' + def __init__(self, name='TrigInDetCpuCost'): + super(TrigInDetCpuCostStep, self).__init__(name) + self.input_file = 'expert-monitoring.root' +## self.ref_file = 'expert-monitoring.root' #### need to add reference file here + self.output_dir = 'times' + self.args = '--auto ' + self.auto_report_result = True + self.required = True + self.executable = 'TIDAcpucost' + + def configure(self, test): + #self.args += self.input_file+' '+self.ref_file+' '+' -o '+self.output_dir + if (self.reference == None): + # if not reference found, run with "--noref" option + self.args += ' {} --noref -o {} '.format(self.input_file,self.output_dir) + else: + self.args += ' {} {} -o {} '.format(self.input_file,self.reference,self.output_dir) + super(TrigInDetCpuCostStep, self).configure(test) + diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py index 6296778a638eb8180289c34123061d35d367eaac..ea582118a42bb7af56d2da79ac9693df055ef556 100644 --- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py +++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py @@ -162,7 +162,7 @@ if ( True ) : "HLT_tau.*_idperf.*:HLT_IDTrack_TauCore_FTF", "HLT_tau.*_idperf.*:HLT_IDTrack_TauIso_FTF", - "HLT_tau.*_idperf.*:HLT_IDTrack_Tau_IDTrig" + "HLT_tau.*_idperf.*:HLT_IDTrack_Tau_IDTrig", "HLT_tau.*_idperf.*:HLT_IDTrack_Tau_FTF" ] diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_grid.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_grid.py index 26428b0dda938944730424cd77641262d7be2460..88499f733101b676d551cb3dae2cd1cb7de63343 100755 --- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_grid.py +++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_grid.py @@ -28,7 +28,7 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps -from TrigInDetValidation.TrigInDetArtSteps import TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep +from TrigInDetValidation.TrigInDetArtSteps import TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep import sys,getopt @@ -150,6 +150,20 @@ comp4.chains='HLT_e5_etcut_L1EM3:HLT_IDTrack_Electron_FTF HLT_e5_etcut_L1EM3:HLT comp4.output_dir = 'HLT-plots-el-IDTrig' test.check_steps.append(comp4) +comp5=TrigInDetCompStep('CompareStep5') +comp5.chains='HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_TauCore_FTF HLT_tau25_idperf_tracktwo_L1TAU12IM:HLT_IDTrack_Tau_IDTrig' +comp4.output_dir = 'HLT-plots-tau-IDTrig' +test.check_steps.append(comp5) + + +cpucost=TrigInDetCpuCostStep('CpuCostStep1') +test.check_steps.append(cpucost) + +cpucost2=TrigInDetCpuCostStep('CpuCostStep2') +cpucost2.args += ' -p FastTrack' +cpucost2.output_dir = 'times-FTF' +test.check_steps.append(cpucost2) + import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_mp_grid.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_mt_grid.py similarity index 97% rename from Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_mp_grid.py rename to Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_mt_grid.py index e417f55a46a1345fbc3f1c68199573342220fb0a..19ba137045c02c905eac2614fc66a40403af595d 100755 --- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_mp_grid.py +++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_all_ttbar_pu80_mt_grid.py @@ -92,9 +92,8 @@ preexec_all = ';'.join([ rdo2aod = ExecStep.ExecStep() rdo2aod.type = 'Reco_tf' rdo2aod.max_events = 1000 # TODO: 2000 events -#rdo2aod.threads = 1 # TODO: change to 4 -#rdo2aod.concurrent_events = 1 # TODO: change to 4 -rdo2aod.forks = 4 +rdo2aod.threads = 1 # TODO: change to 4 +rdo2aod.concurrent_events = 4 rdo2aod.perfmon = False rdo2aod.args = '--outputAODFile=AOD.pool.root --steering="doRDO_TRIG" ' if local: diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_build.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_build.py index ad49f8eb66872724c4775b8b82b71604f0235ab0..46b519195f92cb7a4a9fc1b45f38fbbed56d1e06 100755 --- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_build.py +++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_build.py @@ -24,7 +24,7 @@ for opt,arg in opts: from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps -from TrigInDetValidation.TrigInDetArtSteps import TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep +from TrigInDetValidation.TrigInDetArtSteps import TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep chains = [ 'HLT_mu6_idperf_L1MU6', @@ -98,6 +98,14 @@ comp2.chains='HLT_mu24_idperf_InDetTrigTrackingxAODCnv_Muon_FTF HLT_mu24_idperf_ comp2.output_dir = 'HLT-plots-IDTrig' test.check_steps.append(comp2) +cpucost=TrigInDetCpuCostStep('CpuCostStep1') +test.check_steps.append(cpucost) + +cpucost2=TrigInDetCpuCostStep('CpuCostStep2') +cpucost2.args += ' -p FastTrack' +cpucost2.output_dir = 'times-FTF' +test.check_steps.append(cpucost2) + import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_grid.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_grid.py index 6b2d2171eef7fcbb7e42d2b4ff3746d975f16449..c2e327c3dfa4d54f06a733e08b92a58ee6548a78 100755 --- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_grid.py +++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_mu_zmumu_pu40_grid.py @@ -28,7 +28,7 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps -from TrigInDetValidation.TrigInDetArtSteps import TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep +from TrigInDetValidation.TrigInDetArtSteps import TrigInDetAna, TrigInDetdictStep, TrigInDetCompStep, TrigInDetCpuCostStep import sys,getopt @@ -136,5 +136,13 @@ comp2.output_dir = 'HLT-plots-IDTrig' test.check_steps.append(comp2) +cpucost=TrigInDetCpuCostStep('CpuCostStep1') +test.check_steps.append(cpucost) + +cpucost2=TrigInDetCpuCostStep('CpuCostStep2') +cpucost2.args += ' -p FastTrack' +cpucost2.output_dir = 'times-FTF' +test.check_steps.append(cpucost2) + import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigP1Test/share/BeamSpot.ref b/Trigger/TrigValidation/TrigP1Test/share/BeamSpot.ref index fe6ff158cc589b03e5dd4f38c18a7ce332cef975..b86956fa3b05943d8364b3f535dc07f7830c4f2a 100644 --- a/Trigger/TrigValidation/TrigP1Test/share/BeamSpot.ref +++ b/Trigger/TrigValidation/TrigP1Test/share/BeamSpot.ref @@ -1,135 +1,136 @@ -BeamSpotCondAlg DEBUG Property update for OutputLevel : new value = 2 -BeamSpotCondAlg INFO Initializing BeamSpotCondAlg... -BeamSpotCondAlg DEBUG input handles: 1 -BeamSpotCondAlg DEBUG output handles: 1 -BeamSpotCondAlg DEBUG Data Deps for BeamSpotCondAlg -BeamSpotCondAlg INFO Finalizing BeamSpotCondAlg... -BeamSpotCondAlg 1 0 DEBUG Executing BeamSpotCondAlg... -BeamSpotCondAlg 1 0 INFO Read from condDB status 4 pos (0.06,1.06,-4.6) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 -BeamSpotCondAlg 1 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[1,l:0] - [360026,l:2]} into conditions store. -InDet::InDetBeamSpotReader 1 0 INFO In event [360026,629039520,t:1536151928.146430545,l:1,b:2129] -InDet::InDetBeamSpotReader 1 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 2 0 INFO In event [360026,629048329,t:1536151928.249735590,l:1,b:1121] -InDet::InDetBeamSpotReader 2 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 3 0 INFO In event [360026,629066479,t:1536151928.462784645,l:1,b:564] -InDet::InDetBeamSpotReader 3 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 4 0 INFO In event [360026,629057458,t:1536151928.357131985,l:1,b:146] -InDet::InDetBeamSpotReader 4 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 5 0 INFO In event [360026,629052742,t:1536151928.301033315,l:1,b:653] -InDet::InDetBeamSpotReader 5 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -BeamSpotCondAlg 6 0 DEBUG Executing BeamSpotCondAlg... -BeamSpotCondAlg 6 0 INFO Read from condDB status 4 pos (0.06,1.06,-4.6) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 -BeamSpotCondAlg 6 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[1,l:0] - [360026,l:3]} into conditions store. -InDet::InDetBeamSpotReader 6 0 INFO In event [360026,629052355,t:1536151928.296812820,l:2,b:2572] -InDet::InDetBeamSpotReader 6 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 7 0 INFO In event [360026,629059899,t:1536151928.385647935,l:2,b:2556] -InDet::InDetBeamSpotReader 7 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 8 0 INFO In event [360026,629093183,t:1536151928.773460355,l:2,b:3075] -InDet::InDetBeamSpotReader 8 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 9 0 INFO In event [360026,629089049,t:1536151928.724931515,l:2,b:469] -InDet::InDetBeamSpotReader 9 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 10 0 INFO In event [360026,629087976,t:1536151928.712184980,l:2,b:2817] -InDet::InDetBeamSpotReader 10 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -BeamSpotCondAlg 11 0 DEBUG Executing BeamSpotCondAlg... -BeamSpotCondAlg 11 0 INFO Read from condDB status 4 pos (0.06,1.06,-4.6) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 -BeamSpotCondAlg 11 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[1,l:0] - [360026,l:4]} into conditions store. -InDet::InDetBeamSpotReader 11 0 INFO In event [360026,629100991,t:1536151928.864075730,l:3,b:3130] -InDet::InDetBeamSpotReader 11 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 12 0 INFO In event [360026,629070167,t:1536151928.505791985,l:3,b:2842] -InDet::InDetBeamSpotReader 12 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 13 0 INFO In event [360026,629105268,t:1536151928.913411500,l:3,b:2437] -InDet::InDetBeamSpotReader 13 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 14 0 INFO In event [360026,629049972,t:1536151928.268858385,l:3,b:1283] -InDet::InDetBeamSpotReader 14 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 15 0 INFO In event [360026,629096494,t:1536151928.811415320,l:3,b:2443] -InDet::InDetBeamSpotReader 15 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -BeamSpotCondAlg 16 0 DEBUG Executing BeamSpotCondAlg... -BeamSpotCondAlg 16 0 INFO Read from condDB status 4 pos (0.04,1.04,-4.4) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 -BeamSpotCondAlg 16 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:4] - [360026,l:5]} into conditions store. -InDet::InDetBeamSpotReader 16 0 INFO In event [360026,629096759,t:1536151928.814699960,l:4,b:2220] -InDet::InDetBeamSpotReader 16 0 INFO BeamSpot Position: 0.04 1.04 -4.4, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 17 0 INFO In event [360026,629111207,t:1536151928.982501350,l:4,b:2259] -InDet::InDetBeamSpotReader 17 0 INFO BeamSpot Position: 0.04 1.04 -4.4, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 18 0 INFO In event [360026,629084836,t:1536151928.675204265,l:4,b:3292] -InDet::InDetBeamSpotReader 18 0 INFO BeamSpot Position: 0.04 1.04 -4.4, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 19 0 INFO In event [360026,629062407,t:1536151928.414880245,l:4,b:1601] -InDet::InDetBeamSpotReader 19 0 INFO BeamSpot Position: 0.04 1.04 -4.4, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -InDet::InDetBeamSpotReader 20 0 INFO In event [360026,629120223,t:1536151929.085827650,l:4,b:2103] -InDet::InDetBeamSpotReader 20 0 INFO BeamSpot Position: 0.04 1.04 -4.4, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 -BeamSpotCondAlg 21 0 DEBUG Executing BeamSpotCondAlg... -BeamSpotCondAlg 21 0 INFO Read from condDB status 7 pos (0.05,1.05,-4.5) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 -BeamSpotCondAlg 21 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:5] - [360026,l:6]} into conditions store. -InDet::InDetBeamSpotReader 21 0 INFO In event [360026,629066532,t:1536151928.463263200,l:5,b:1924] -InDet::InDetBeamSpotReader 21 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 22 0 INFO In event [360026,629076629,t:1536151928.580524515,l:5,b:721] -InDet::InDetBeamSpotReader 22 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 23 0 INFO In event [360026,629048362,t:1536151928.250148200,l:5,b:3402] -InDet::InDetBeamSpotReader 23 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 24 0 INFO In event [360026,629139478,t:1536151929.310496390,l:5,b:367] -InDet::InDetBeamSpotReader 24 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 25 0 INFO In event [360026,629124505,t:1536151929.136043310,l:5,b:1035] -InDet::InDetBeamSpotReader 25 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -BeamSpotCondAlg 26 0 DEBUG Executing BeamSpotCondAlg... -BeamSpotCondAlg 26 0 INFO Read from condDB status 7 pos (0.05,1.05,-4.5) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 -BeamSpotCondAlg 26 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:5] - [360026,l:7]} into conditions store. -InDet::InDetBeamSpotReader 26 0 INFO In event [360026,629075402,t:1536151928.566334730,l:6,b:2249] -InDet::InDetBeamSpotReader 26 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 27 0 INFO In event [360026,629071419,t:1536151928.519986085,l:6,b:1487] -InDet::InDetBeamSpotReader 27 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 28 0 INFO In event [360026,629138679,t:1536151929.301762310,l:6,b:3150] -InDet::InDetBeamSpotReader 28 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 29 0 INFO In event [360026,629120878,t:1536151929.093977385,l:6,b:848] -InDet::InDetBeamSpotReader 29 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 30 0 INFO In event [360026,629126139,t:1536151929.155032420,l:6,b:2967] -InDet::InDetBeamSpotReader 30 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -BeamSpotCondAlg 31 0 DEBUG Executing BeamSpotCondAlg... -BeamSpotCondAlg 31 0 INFO Read from condDB status 7 pos (0.05,1.05,-4.5) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 -BeamSpotCondAlg 31 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:5] - [360026,l:8]} into conditions store. -InDet::InDetBeamSpotReader 31 0 INFO In event [360026,629045067,t:1536151928.211407135,l:7,b:1040] -InDet::InDetBeamSpotReader 31 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 32 0 INFO In event [360026,629093793,t:1536151928.780718675,l:7,b:1733] -InDet::InDetBeamSpotReader 32 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 33 0 INFO In event [360026,629142691,t:1536151929.348842560,l:7,b:1158] -InDet::InDetBeamSpotReader 33 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 34 0 INFO In event [360026,629074617,t:1536151928.557165085,l:7,b:1831] -InDet::InDetBeamSpotReader 34 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 35 0 INFO In event [360026,629119079,t:1536151929.072327955,l:7,b:2777] -InDet::InDetBeamSpotReader 35 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -BeamSpotCondAlg 36 0 DEBUG Executing BeamSpotCondAlg... -BeamSpotCondAlg 36 0 INFO Read from condDB status 7 pos (0.05,1.05,-4.5) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 -BeamSpotCondAlg 36 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:5] - [360026,l:9]} into conditions store. -InDet::InDetBeamSpotReader 36 0 INFO In event [360026,629152854,t:1536151929.464222515,l:8,b:2960] -InDet::InDetBeamSpotReader 36 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 37 0 INFO In event [360026,629170606,t:1536151929.667925770,l:8,b:2053] -InDet::InDetBeamSpotReader 37 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 38 0 INFO In event [360026,629175601,t:1536151929.725177615,l:8,b:1432] -InDet::InDetBeamSpotReader 38 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 39 0 INFO In event [360026,629145750,t:1536151929.383336610,l:8,b:812] -InDet::InDetBeamSpotReader 39 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 40 0 INFO In event [360026,629048911,t:1536151928.256455795,l:8,b:3160] -InDet::InDetBeamSpotReader 40 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -BeamSpotCondAlg 41 0 DEBUG Executing BeamSpotCondAlg... -BeamSpotCondAlg 41 0 INFO Read from condDB status 7 pos (0.09,1.09,-4.9) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 -BeamSpotCondAlg 41 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:9] - [360026,l:10]} into conditions store. -InDet::InDetBeamSpotReader 41 0 INFO In event [360026,629176383,t:1536151929.734118510,l:9,b:3374] -InDet::InDetBeamSpotReader 41 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 42 0 INFO In event [360026,629170901,t:1536151929.671492005,l:9,b:2424] -InDet::InDetBeamSpotReader 42 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 43 0 INFO In event [360026,629188660,t:1536151929.878164350,l:9,b:2903] -InDet::InDetBeamSpotReader 43 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 44 0 INFO In event [360026,629191687,t:1536151929.913558395,l:9,b:2988] -InDet::InDetBeamSpotReader 44 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 45 0 INFO In event [360026,629183449,t:1536151929.816825975,l:9,b:120] -InDet::InDetBeamSpotReader 45 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -BeamSpotCondAlg 46 0 DEBUG Executing BeamSpotCondAlg... -BeamSpotCondAlg 46 0 INFO Read from condDB status 7 pos (0.09,1.09,-4.9) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 -BeamSpotCondAlg 46 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:9] - [360026,l:11]} into conditions store. -InDet::InDetBeamSpotReader 46 0 INFO In event [360026,629142575,t:1536151929.347510190,l:10,b:1218] -InDet::InDetBeamSpotReader 46 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 47 0 INFO In event [360026,629182674,t:1536151929.807812320,l:10,b:2390] -InDet::InDetBeamSpotReader 47 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 48 0 INFO In event [360026,629186765,t:1536151929.856277135,l:10,b:2430] -InDet::InDetBeamSpotReader 48 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -InDet::InDetBeamSpotReader 49 0 INFO In event [360026,629138697,t:1536151929.301969950,l:10,b:780] -InDet::InDetBeamSpotReader 49 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 -BeamSpotCondAlg 50 0 INFO Finalizing BeamSpotCondAlg... +BeamSpotCondAlg DEBUG Property update for OutputLevel : new value = 2 +BeamSpotCondAlg INFO Initializing BeamSpotCondAlg... +BeamSpotCondAlg DEBUG input handles: 1 +BeamSpotCondAlg DEBUG output handles: 1 +BeamSpotCondAlg DEBUG Data Deps for BeamSpotCondAlg +BeamSpotCondAlg INFO Finalizing BeamSpotCondAlg... +BeamSpotCondAlg 1 0 DEBUG Executing BeamSpotCondAlg... +BeamSpotCondAlg 1 0 INFO Read from condDB status 4 pos (0.06,1.06,-4.6) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 +BeamSpotCondAlg 1 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[1,l:0] - [360026,l:2]} into conditions store. +InDet::InDetBeamSpotReader 1 0 INFO In event [360026,629039520,t:1536151928.146430545,l:1,b:2129] +InDet::InDetBeamSpotReader 1 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 2 0 INFO In event [360026,629048329,t:1536151928.249735590,l:1,b:1121] +InDet::InDetBeamSpotReader 2 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 3 0 INFO In event [360026,629066479,t:1536151928.462784645,l:1,b:564] +InDet::InDetBeamSpotReader 3 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 4 0 INFO In event [360026,629057458,t:1536151928.357131985,l:1,b:146] +InDet::InDetBeamSpotReader 4 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 5 0 INFO In event [360026,629052742,t:1536151928.301033315,l:1,b:653] +InDet::InDetBeamSpotReader 5 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +BeamSpotCondAlg 6 0 DEBUG Executing BeamSpotCondAlg... +BeamSpotCondAlg 6 0 INFO Read from condDB status 4 pos (0.06,1.06,-4.6) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 +BeamSpotCondAlg 6 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[1,l:0] - [360026,l:3]} into conditions store. +InDet::InDetBeamSpotReader 6 0 INFO In event [360026,629052355,t:1536151928.296812820,l:2,b:2572] +InDet::InDetBeamSpotReader 6 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 7 0 INFO In event [360026,629059899,t:1536151928.385647935,l:2,b:2556] +InDet::InDetBeamSpotReader 7 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 8 0 INFO In event [360026,629093183,t:1536151928.773460355,l:2,b:3075] +InDet::InDetBeamSpotReader 8 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 9 0 INFO In event [360026,629089049,t:1536151928.724931515,l:2,b:469] +InDet::InDetBeamSpotReader 9 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 10 0 INFO In event [360026,629087976,t:1536151928.712184980,l:2,b:2817] +InDet::InDetBeamSpotReader 10 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +BeamSpotCondAlg 11 0 DEBUG Executing BeamSpotCondAlg... +BeamSpotCondAlg 11 0 INFO Read from condDB status 4 pos (0.06,1.06,-4.6) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 +BeamSpotCondAlg 11 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[1,l:0] - [360026,l:4]} into conditions store. +InDet::InDetBeamSpotReader 11 0 INFO In event [360026,629100991,t:1536151928.864075730,l:3,b:3130] +InDet::InDetBeamSpotReader 11 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 12 0 INFO In event [360026,629070167,t:1536151928.505791985,l:3,b:2842] +InDet::InDetBeamSpotReader 12 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 13 0 INFO In event [360026,629105268,t:1536151928.913411500,l:3,b:2437] +InDet::InDetBeamSpotReader 13 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 14 0 INFO In event [360026,629049972,t:1536151928.268858385,l:3,b:1283] +InDet::InDetBeamSpotReader 14 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 15 0 INFO In event [360026,629096494,t:1536151928.811415320,l:3,b:2443] +InDet::InDetBeamSpotReader 15 0 INFO BeamSpot Position: 0.06 1.06 -4.6, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +BeamSpotCondAlg 16 0 DEBUG Executing BeamSpotCondAlg... +BeamSpotCondAlg 16 0 INFO Read from condDB status 4 pos (0.04,1.04,-4.4) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 +BeamSpotCondAlg 16 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:4] - [360026,l:5]} into conditions store. +InDet::InDetBeamSpotReader 16 0 INFO In event [360026,629096759,t:1536151928.814699960,l:4,b:2220] +InDet::InDetBeamSpotReader 16 0 INFO BeamSpot Position: 0.04 1.04 -4.4, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 17 0 INFO In event [360026,629111207,t:1536151928.982501350,l:4,b:2259] +InDet::InDetBeamSpotReader 17 0 INFO BeamSpot Position: 0.04 1.04 -4.4, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 18 0 INFO In event [360026,629084836,t:1536151928.675204265,l:4,b:3292] +InDet::InDetBeamSpotReader 18 0 INFO BeamSpot Position: 0.04 1.04 -4.4, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 19 0 INFO In event [360026,629062407,t:1536151928.414880245,l:4,b:1601] +InDet::InDetBeamSpotReader 19 0 INFO BeamSpot Position: 0.04 1.04 -4.4, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +InDet::InDetBeamSpotReader 20 0 INFO In event [360026,629120223,t:1536151929.085827650,l:4,b:2103] +InDet::InDetBeamSpotReader 20 0 INFO BeamSpot Position: 0.04 1.04 -4.4, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 4 +BeamSpotCondAlg 21 0 DEBUG Executing BeamSpotCondAlg... +BeamSpotCondAlg 21 0 INFO Read from condDB status 7 pos (0.05,1.05,-4.5) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 +BeamSpotCondAlg 21 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:5] - [360026,l:6]} into conditions store. +InDet::InDetBeamSpotReader 21 0 INFO In event [360026,629066532,t:1536151928.463263200,l:5,b:1924] +InDet::InDetBeamSpotReader 21 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 22 0 INFO In event [360026,629076629,t:1536151928.580524515,l:5,b:721] +InDet::InDetBeamSpotReader 22 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 23 0 INFO In event [360026,629048362,t:1536151928.250148200,l:5,b:3402] +InDet::InDetBeamSpotReader 23 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 24 0 INFO In event [360026,629139478,t:1536151929.310496390,l:5,b:367] +InDet::InDetBeamSpotReader 24 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 25 0 INFO In event [360026,629124505,t:1536151929.136043310,l:5,b:1035] +InDet::InDetBeamSpotReader 25 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +BeamSpotCondAlg 26 0 DEBUG Executing BeamSpotCondAlg... +BeamSpotCondAlg 26 0 INFO Read from condDB status 7 pos (0.05,1.05,-4.5) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 +BeamSpotCondAlg 26 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:5] - [360026,l:7]} into conditions store. +InDet::InDetBeamSpotReader 26 0 INFO In event [360026,629075402,t:1536151928.566334730,l:6,b:2249] +InDet::InDetBeamSpotReader 26 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 27 0 INFO In event [360026,629071419,t:1536151928.519986085,l:6,b:1487] +InDet::InDetBeamSpotReader 27 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 28 0 INFO In event [360026,629138679,t:1536151929.301762310,l:6,b:3150] +InDet::InDetBeamSpotReader 28 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 29 0 INFO In event [360026,629120878,t:1536151929.093977385,l:6,b:848] +InDet::InDetBeamSpotReader 29 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 30 0 INFO In event [360026,629126139,t:1536151929.155032420,l:6,b:2967] +InDet::InDetBeamSpotReader 30 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +BeamSpotCondAlg 31 0 DEBUG Executing BeamSpotCondAlg... +BeamSpotCondAlg 31 0 INFO Read from condDB status 7 pos (0.05,1.05,-4.5) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 +BeamSpotCondAlg 31 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:5] - [360026,l:8]} into conditions store. +InDet::InDetBeamSpotReader 31 0 INFO In event [360026,629045067,t:1536151928.211407135,l:7,b:1040] +InDet::InDetBeamSpotReader 31 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 32 0 INFO In event [360026,629093793,t:1536151928.780718675,l:7,b:1733] +InDet::InDetBeamSpotReader 32 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 33 0 INFO In event [360026,629142691,t:1536151929.348842560,l:7,b:1158] +InDet::InDetBeamSpotReader 33 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 34 0 INFO In event [360026,629074617,t:1536151928.557165085,l:7,b:1831] +InDet::InDetBeamSpotReader 34 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 35 0 INFO In event [360026,629119079,t:1536151929.072327955,l:7,b:2777] +InDet::InDetBeamSpotReader 35 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +BeamSpotCondAlg 36 0 DEBUG Executing BeamSpotCondAlg... +BeamSpotCondAlg 36 0 INFO Read from condDB status 7 pos (0.05,1.05,-4.5) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 +BeamSpotCondAlg 36 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:5] - [360026,l:9]} into conditions store. +InDet::InDetBeamSpotReader 36 0 INFO In event [360026,629152854,t:1536151929.464222515,l:8,b:2960] +InDet::InDetBeamSpotReader 36 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 37 0 INFO In event [360026,629170606,t:1536151929.667925770,l:8,b:2053] +InDet::InDetBeamSpotReader 37 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 38 0 INFO In event [360026,629175601,t:1536151929.725177615,l:8,b:1432] +InDet::InDetBeamSpotReader 38 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 39 0 INFO In event [360026,629145750,t:1536151929.383336610,l:8,b:812] +InDet::InDetBeamSpotReader 39 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 40 0 INFO In event [360026,629048911,t:1536151928.256455795,l:8,b:3160] +InDet::InDetBeamSpotReader 40 0 INFO BeamSpot Position: 0.05 1.05 -4.5, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +BeamSpotCondAlg 41 0 DEBUG Executing BeamSpotCondAlg... +BeamSpotCondAlg 41 0 INFO Read from condDB status 7 pos (0.09,1.09,-4.9) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 +BeamSpotCondAlg 41 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:9] - [360026,l:10]} into conditions store. +InDet::InDetBeamSpotReader 41 0 INFO In event [360026,629176383,t:1536151929.734118510,l:9,b:3374] +InDet::InDetBeamSpotReader 41 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 42 0 INFO In event [360026,629170901,t:1536151929.671492005,l:9,b:2424] +InDet::InDetBeamSpotReader 42 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 43 0 INFO In event [360026,629188660,t:1536151929.878164350,l:9,b:2903] +InDet::InDetBeamSpotReader 43 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 44 0 INFO In event [360026,629191687,t:1536151929.913558395,l:9,b:2988] +InDet::InDetBeamSpotReader 44 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 45 0 INFO In event [360026,629183449,t:1536151929.816825975,l:9,b:120] +InDet::InDetBeamSpotReader 45 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +BeamSpotCondAlg 46 0 DEBUG Executing BeamSpotCondAlg... +BeamSpotCondAlg 46 0 INFO Read from condDB status 7 pos (0.09,1.09,-4.9) sigma (0.015,0.015,53) tilt (0,0) sigmaXY 0 +BeamSpotCondAlg 46 0 INFO Recorded new InDet::BeamSpotData to BeamSpotData with range {[360026,l:9] - [360026,l:11]} into conditions store. +InDet::InDetBeamSpotReader 46 0 INFO In event [360026,629142575,t:1536151929.347510190,l:10,b:1218] +InDet::InDetBeamSpotReader 46 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 47 0 INFO In event [360026,629182674,t:1536151929.807812320,l:10,b:2390] +InDet::InDetBeamSpotReader 47 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 48 0 INFO In event [360026,629186765,t:1536151929.856277135,l:10,b:2430] +InDet::InDetBeamSpotReader 48 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 49 0 INFO In event [360026,629138697,t:1536151929.301969950,l:10,b:780] +InDet::InDetBeamSpotReader 49 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 +InDet::InDetBeamSpotReader 50 0 INFO In event [360026,629151184,t:1536151929.445275770,l:10,b:2726] +InDet::InDetBeamSpotReader 50 0 INFO BeamSpot Position: 0.09 1.09 -4.9, Sigma: 0.015 0.015 53, Tilt: 0 0, Status: 7 diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_build.py index 5de739c82b59a8d2726d9e4e8bbe05659b709e05..36508b956e0d4b51fb74224ba0e427c77b6e1a4d 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_build.py @@ -18,5 +18,8 @@ test.art_type = 'build' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) +# Make RootComp step required +test.get_step('RootComp').required = True + import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_build.py index ab02ca5b8487d897d6af31f854e35f6ba69b8b8b..2e842357485b6420fa432b60674fb94c11358185 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_build.py @@ -22,5 +22,8 @@ test.art_type = 'build' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) +# Make RootComp step required +test.get_step('RootComp').required = True + import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_grid.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_grid.py index c707e93f549a5f299298b83a8131f44d61c7068a..6b42cdbc2d9787dc37aa3914f9fe927e4f8d7654 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_grid.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_concurrent_grid.py @@ -34,5 +34,8 @@ test.art_type = 'grid' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) +# Make RootComp step required +test.get_step('RootComp').required = True + import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_forkAndMT_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_forkAndMT_build.py deleted file mode 100755 index ba97113d99ee0a46a56e8f687f38b24a8ac64a25..0000000000000000000000000000000000000000 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_forkAndMT_build.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env python - -# art-description: CalibPeb test with forks=2, threads=2, concurrent_events=2 -# 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 = 'athenaHLT' -ex.job_options = 'TrigExPartialEB/MTCalibPeb.py' -ex.input = 'data' -ex.forks = 2 -ex.threads = 2 -ex.concurrent_events = 2 - -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/TrigP1Test/test/test_trigP1_CalibPeb_highForkAndMT_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_highForkAndMT_build.py index 7f7f51359d6d5fa429003de30510f4b056e5e0dc..dbb65dda3667a3ef9d1315e2ef8bc07b65417721 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_highForkAndMT_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_CalibPeb_highForkAndMT_build.py @@ -21,5 +21,8 @@ test.art_type = 'build' test.exec_steps = [ex] test.check_steps = CheckSteps.default_check_steps(test) +# Make RootComp step required +test.get_step('RootComp').required = True + import sys sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigValTools/bin/rootcomp.py b/Trigger/TrigValidation/TrigValTools/bin/rootcomp.py index 8bd362668c10bbf319a4f44e50483b744808c63f..ad13c7842a8f22fb6110e90bf55625455dbf0248 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/rootcomp.py +++ b/Trigger/TrigValidation/TrigValTools/bin/rootcomp.py @@ -158,6 +158,7 @@ def main(): opts.skip += ["Average Hlt Result size for physics streams"] # ATR-14330 opts.skip += ["HltEDMSizes:Events_Without_Truncation"] # ATR-14330 opts.skip += ["Trig.*CaloCellMaker.*/TCRec_"] # timing histograms in TrigCaloCellMaker + opts.skip += ["HLTFramework/ROBDataProviderSvc"] # RDP histograms differ in MT due to caching # Default thresholds if not opts.threshold: diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref index d585523117b459303c9bc4b2cf2949be7fdcbe39..433726019e0c508237f4d795a8d5f609071d2896 100644 --- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref +++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref @@ -9,7 +9,7 @@ TrigSignatureMoniMT INFO -- #1767768251 Events TrigSignatureMoniMT INFO -- #1767768251 Features 0 0 0 0 - - TrigSignatureMoniMT INFO HLT_2e3_etcut_L12EM3 #2613484113 TrigSignatureMoniMT INFO -- #2613484113 Events 20 20 13 13 13 - - - 13 -TrigSignatureMoniMT INFO -- #2613484113 Features 92 310 172 - - - +TrigSignatureMoniMT INFO -- #2613484113 Features 92 322 178 - - - TrigSignatureMoniMT INFO HLT_2g20_tight_L12EM20VH #2426612258 TrigSignatureMoniMT INFO -- #2426612258 Events 20 20 0 0 0 0 - - 0 TrigSignatureMoniMT INFO -- #2426612258 Features 0 0 0 0 - - @@ -108,7 +108,7 @@ TrigSignatureMoniMT INFO -- #140779220 Events TrigSignatureMoniMT INFO -- #140779220 Features 0 0 0 0 - - TrigSignatureMoniMT INFO HLT_e26_etcut_L1EM22VHI #1703681121 TrigSignatureMoniMT INFO -- #1703681121 Events 20 20 1 1 0 - - - 0 -TrigSignatureMoniMT INFO -- #1703681121 Features 1 3 0 - - - +TrigSignatureMoniMT INFO -- #1703681121 Features 1 2 0 - - - TrigSignatureMoniMT INFO HLT_e26_lhtight_L1EM22VHI #1995263521 TrigSignatureMoniMT INFO -- #1995263521 Events 20 20 0 0 0 0 - - 0 TrigSignatureMoniMT INFO -- #1995263521 Features 0 0 0 0 - - @@ -129,22 +129,22 @@ TrigSignatureMoniMT INFO -- #2086577378 Events TrigSignatureMoniMT INFO -- #2086577378 Features 0 - - - - - TrigSignatureMoniMT INFO HLT_e3_etcut_L1EM3 #683953566 TrigSignatureMoniMT INFO -- #683953566 Events 20 20 15 14 14 - - - 14 -TrigSignatureMoniMT INFO -- #683953566 Features 48 156 87 - - - +TrigSignatureMoniMT INFO -- #683953566 Features 48 162 90 - - - TrigSignatureMoniMT INFO HLT_e5_etcut_L1EM3 #324908483 TrigSignatureMoniMT INFO -- #324908483 Events 20 20 13 13 13 - - - 13 -TrigSignatureMoniMT INFO -- #324908483 Features 41 141 47 - - - +TrigSignatureMoniMT INFO -- #324908483 Features 41 147 49 - - - TrigSignatureMoniMT INFO HLT_e5_lhloose_noringer_L1EM3 #1053337356 TrigSignatureMoniMT INFO -- #1053337356 Events 20 20 10 10 10 1 - - 1 -TrigSignatureMoniMT INFO -- #1053337356 Features 15 48 29 1 - - +TrigSignatureMoniMT INFO -- #1053337356 Features 15 48 31 1 - - TrigSignatureMoniMT INFO HLT_e5_lhmedium_noringer_L1EM3 #176627878 TrigSignatureMoniMT INFO -- #176627878 Events 20 20 9 9 9 0 - - 0 -TrigSignatureMoniMT INFO -- #176627878 Features 13 49 28 0 - - +TrigSignatureMoniMT INFO -- #176627878 Features 13 51 30 0 - - TrigSignatureMoniMT INFO HLT_e5_lhtight_noringer_L1EM3 #2758326765 TrigSignatureMoniMT INFO -- #2758326765 Events 20 20 9 9 9 0 - - 0 -TrigSignatureMoniMT INFO -- #2758326765 Features 13 49 28 0 - - +TrigSignatureMoniMT INFO -- #2758326765 Features 13 51 30 0 - - TrigSignatureMoniMT INFO HLT_e5_lhtight_noringer_nod0_L1EM3 #1690619419 TrigSignatureMoniMT INFO -- #1690619419 Events 20 20 9 9 9 0 - - 0 -TrigSignatureMoniMT INFO -- #1690619419 Features 13 49 28 0 - - +TrigSignatureMoniMT INFO -- #1690619419 Features 13 51 30 0 - - TrigSignatureMoniMT INFO HLT_e60_lhmedium_L1EM22VHI #298591874 TrigSignatureMoniMT INFO -- #298591874 Events 20 20 0 0 0 0 - - 0 TrigSignatureMoniMT INFO -- #298591874 Features 0 0 0 0 - - @@ -153,7 +153,7 @@ TrigSignatureMoniMT INFO -- #4115486024 Events TrigSignatureMoniMT INFO -- #4115486024 Features 0 0 0 0 - - TrigSignatureMoniMT INFO HLT_e7_etcut_L1EM3 #1959043579 TrigSignatureMoniMT INFO -- #1959043579 Events 20 20 13 13 11 - - - 11 -TrigSignatureMoniMT INFO -- #1959043579 Features 26 90 20 - - - +TrigSignatureMoniMT INFO -- #1959043579 Features 26 96 21 - - - TrigSignatureMoniMT INFO HLT_e7_lhmedium_mu24_L1MU20 #2970063918 TrigSignatureMoniMT INFO -- #2970063918 Events 20 20 0 0 0 0 - - 0 TrigSignatureMoniMT INFO -- #2970063918 Features 0 0 0 0 - - @@ -248,8 +248,8 @@ TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS TrigSignatureMoniMT INFO -- #2938374624 Events 20 20 5 - - - - - 5 TrigSignatureMoniMT INFO -- #2938374624 Features 5 - - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_059jvt_L1J15 #1593009344 -TrigSignatureMoniMT INFO -- #1593009344 Events 20 20 4 - - - - - 4 -TrigSignatureMoniMT INFO -- #1593009344 Features 4 - - - - - +TrigSignatureMoniMT INFO -- #1593009344 Events 20 20 5 - - - - - 5 +TrigSignatureMoniMT INFO -- #1593009344 Features 5 - - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 #3341539267 TrigSignatureMoniMT INFO -- #3341539267 Events 20 20 6 - - - - - 6 TrigSignatureMoniMT INFO -- #3341539267 Features 6 - - - - - @@ -264,7 +264,7 @@ TrigSignatureMoniMT INFO -- #761060030 Events TrigSignatureMoniMT INFO -- #761060030 Features 5 - - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_L1J15 #1509925407 TrigSignatureMoniMT INFO -- #1509925407 Events 20 20 6 - - - - - 6 -TrigSignatureMoniMT INFO -- #1509925407 Features 6 - - - - - +TrigSignatureMoniMT INFO -- #1509925407 Features 7 - - - - - TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_pf_L1J20 #4012311417 TrigSignatureMoniMT INFO -- #4012311417 Events 20 20 5 - - - - - 5 TrigSignatureMoniMT INFO -- #4012311417 Features 5 - - - - - @@ -594,52 +594,52 @@ TrigSignatureMoniMT INFO -- #554271976 Events TrigSignatureMoniMT INFO -- #554271976 Features 4 4 - - - - TrigSignatureMoniMT INFO HLT_tau25_idperf_tracktwoMVA_L1TAU12IM #988149859 TrigSignatureMoniMT INFO -- #988149859 Events 20 20 3 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #988149859 Features 4 3 3 - - - +TrigSignatureMoniMT INFO -- #988149859 Features 4 4 4 - - - TrigSignatureMoniMT INFO HLT_tau25_idperf_tracktwo_L1TAU12IM #3346942453 TrigSignatureMoniMT INFO -- #3346942453 Events 20 20 3 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #3346942453 Features 4 3 3 - - - +TrigSignatureMoniMT INFO -- #3346942453 Features 4 4 4 - - - TrigSignatureMoniMT INFO HLT_tau25_looseRNN_tracktwoMVA_L1TAU12IM #169452969 TrigSignatureMoniMT INFO -- #169452969 Events 20 20 3 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #169452969 Features 4 3 3 - - - +TrigSignatureMoniMT INFO -- #169452969 Features 4 4 4 - - - TrigSignatureMoniMT INFO HLT_tau25_looseRNN_tracktwo_L1TAU12IM #2490017573 TrigSignatureMoniMT INFO -- #2490017573 Events 20 20 3 3 0 - - - 0 -TrigSignatureMoniMT INFO -- #2490017573 Features 4 3 0 - - - +TrigSignatureMoniMT INFO -- #2490017573 Features 4 4 0 - - - TrigSignatureMoniMT INFO HLT_tau25_medium1_tracktwoEF_L1TAU12IM #506456080 TrigSignatureMoniMT INFO -- #506456080 Events 20 20 3 3 0 - - - 0 -TrigSignatureMoniMT INFO -- #506456080 Features 4 3 0 - - - +TrigSignatureMoniMT INFO -- #506456080 Features 4 4 0 - - - TrigSignatureMoniMT INFO HLT_tau25_medium1_tracktwoMVA_L1TAU12IM #4055280067 TrigSignatureMoniMT INFO -- #4055280067 Events 20 20 3 3 0 - - - 0 -TrigSignatureMoniMT INFO -- #4055280067 Features 4 3 0 - - - +TrigSignatureMoniMT INFO -- #4055280067 Features 4 4 0 - - - TrigSignatureMoniMT INFO HLT_tau25_medium1_tracktwo_L1TAU12IM #1433975745 -TrigSignatureMoniMT INFO -- #1433975745 Events 20 20 3 3 1 - - - 1 -TrigSignatureMoniMT INFO -- #1433975745 Features 4 3 1 - - - +TrigSignatureMoniMT INFO -- #1433975745 Events 20 20 3 3 2 - - - 2 +TrigSignatureMoniMT INFO -- #1433975745 Features 4 4 2 - - - TrigSignatureMoniMT INFO HLT_tau25_mediumRNN_tracktwoMVA_L1TAU12IM #2222894847 -TrigSignatureMoniMT INFO -- #2222894847 Events 20 20 3 3 2 - - - 2 -TrigSignatureMoniMT INFO -- #2222894847 Features 4 3 2 - - - +TrigSignatureMoniMT INFO -- #2222894847 Events 20 20 3 3 3 - - - 3 +TrigSignatureMoniMT INFO -- #2222894847 Features 4 4 3 - - - TrigSignatureMoniMT INFO HLT_tau25_mediumRNN_tracktwo_L1TAU12IM #698603885 TrigSignatureMoniMT INFO -- #698603885 Events 20 20 3 3 0 - - - 0 -TrigSignatureMoniMT INFO -- #698603885 Features 4 3 0 - - - +TrigSignatureMoniMT INFO -- #698603885 Features 4 4 0 - - - TrigSignatureMoniMT INFO HLT_tau25_perf_tracktwoMVA_L1TAU12IM #112814536 TrigSignatureMoniMT INFO -- #112814536 Events 20 20 3 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #112814536 Features 4 3 3 - - - +TrigSignatureMoniMT INFO -- #112814536 Features 4 4 4 - - - TrigSignatureMoniMT INFO HLT_tau25_perf_tracktwo_L1TAU12IM #1129072492 TrigSignatureMoniMT INFO -- #1129072492 Events 20 20 3 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #1129072492 Features 4 3 3 - - - +TrigSignatureMoniMT INFO -- #1129072492 Features 4 4 4 - - - TrigSignatureMoniMT INFO HLT_tau25_tightRNN_tracktwoMVA_L1TAU12IM #2472860683 -TrigSignatureMoniMT INFO -- #2472860683 Events 20 20 3 3 1 - - - 1 -TrigSignatureMoniMT INFO -- #2472860683 Features 4 3 1 - - - +TrigSignatureMoniMT INFO -- #2472860683 Events 20 20 3 3 2 - - - 2 +TrigSignatureMoniMT INFO -- #2472860683 Features 4 4 2 - - - TrigSignatureMoniMT INFO HLT_tau25_tightRNN_tracktwo_L1TAU12IM #2537544560 TrigSignatureMoniMT INFO -- #2537544560 Events 20 20 3 3 0 - - - 0 -TrigSignatureMoniMT INFO -- #2537544560 Features 4 3 0 - - - +TrigSignatureMoniMT INFO -- #2537544560 Features 4 4 0 - - - TrigSignatureMoniMT INFO HLT_tau25_verylooseRNN_tracktwoMVA_L1TAU12IM #2992830434 TrigSignatureMoniMT INFO -- #2992830434 Events 20 20 3 3 3 - - - 3 -TrigSignatureMoniMT INFO -- #2992830434 Features 4 3 3 - - - +TrigSignatureMoniMT INFO -- #2992830434 Features 4 4 4 - - - TrigSignatureMoniMT INFO HLT_tau25_verylooseRNN_tracktwo_L1TAU12IM #1275052132 TrigSignatureMoniMT INFO -- #1275052132 Events 20 20 3 3 0 - - - 0 -TrigSignatureMoniMT INFO -- #1275052132 Features 4 3 0 - - - +TrigSignatureMoniMT INFO -- #1275052132 Features 4 4 0 - - - TrigSignatureMoniMT INFO HLT_tau35_mediumRNN_tracktwoMVA_L1TAU12IM #2456480859 -TrigSignatureMoniMT INFO -- #2456480859 Events 20 20 3 3 2 - - - 2 -TrigSignatureMoniMT INFO -- #2456480859 Features 4 3 2 - - - +TrigSignatureMoniMT INFO -- #2456480859 Events 20 20 3 3 3 - - - 3 +TrigSignatureMoniMT INFO -- #2456480859 Features 4 4 3 - - - TrigSignatureMoniMT INFO HLT_tilecalib_laser_TilePEB_L1CALREQ2 #1063154655 TrigSignatureMoniMT INFO -- #1063154655 Events 20 20 20 - - - - - 20 TrigSignatureMoniMT INFO -- #1063154655 Features 20 - - - - - @@ -671,20 +671,20 @@ TrigSignatureMoniMT INFO HLT_xe30_cell_L1XE10 #1 TrigSignatureMoniMT INFO -- #1649696554 Events 20 20 3 - - - - - 3 TrigSignatureMoniMT INFO -- #1649696554 Features 3 - - - - - TrigSignatureMoniMT INFO HLT_xe30_cell_xe30_tcpufit_L1XE10 #3768353779 -TrigSignatureMoniMT INFO -- #3768353779 Events 20 20 2 - - - - - 2 -TrigSignatureMoniMT INFO -- #3768353779 Features 2 - - - - - +TrigSignatureMoniMT INFO -- #3768353779 Events 20 20 3 - - - - - 3 +TrigSignatureMoniMT INFO -- #3768353779 Features 3 - - - - - TrigSignatureMoniMT INFO HLT_xe30_mht_L1XE10 #3626903018 TrigSignatureMoniMT INFO -- #3626903018 Events 20 20 16 - - - - - 16 TrigSignatureMoniMT INFO -- #3626903018 Features 16 - - - - - TrigSignatureMoniMT INFO HLT_xe30_pfsum_L1XE10 #998713382 -TrigSignatureMoniMT INFO -- #998713382 Events 20 20 3 - - - - - 3 -TrigSignatureMoniMT INFO -- #998713382 Features 3 - - - - - +TrigSignatureMoniMT INFO -- #998713382 Events 20 20 4 - - - - - 4 +TrigSignatureMoniMT INFO -- #998713382 Features 4 - - - - - TrigSignatureMoniMT INFO HLT_xe30_tcpufit_L1XE10 #1583719916 -TrigSignatureMoniMT INFO -- #1583719916 Events 20 20 2 - - - - - 2 -TrigSignatureMoniMT INFO -- #1583719916 Features 2 - - - - - +TrigSignatureMoniMT INFO -- #1583719916 Events 20 20 6 - - - - - 6 +TrigSignatureMoniMT INFO -- #1583719916 Features 6 - - - - - TrigSignatureMoniMT INFO HLT_xe30_trkmht_L1XE10 #2468872349 -TrigSignatureMoniMT INFO -- #2468872349 Events 20 20 6 - - - - - 6 -TrigSignatureMoniMT INFO -- #2468872349 Features 6 - - - - - +TrigSignatureMoniMT INFO -- #2468872349 Events 20 20 5 - - - - - 5 +TrigSignatureMoniMT INFO -- #2468872349 Features 5 - - - - - TrigSignatureMoniMT INFO HLT_xe65_cell_L1XE50 #531141817 TrigSignatureMoniMT INFO -- #531141817 Events 20 20 0 - - - - - 0 TrigSignatureMoniMT INFO -- #531141817 Features 0 - - - - - diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py index 235f6af57abc37b174a10eafba5028cb98047fa0..ac18b4c3eae5066c8dca8445c8c334106dbd4a6c 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py @@ -65,6 +65,19 @@ JetVarsToKeep = ['ActiveArea', 'ActiveArea4vec_eta', 'ActiveArea4vec_m', 'Active 'Jvt', 'JVFCorr', 'NumTrkPt500', 'NumTrkPt1000', 'SizeParameter', 'SumPtTrkPt500', 'SumPtTrkPt1000', 'TrackWidthPt1000',] JetVars = '.'.join(JetVarsToKeep) +BTagOutput = ['SV1_TrackParticleLinks','IP2D_TrackParticleLinks','IP3D_TrackParticleLinks','BTagTrackToJetAssociator','Muons', + 'JetFitter_N2Tpair','JetFitter_JFvertices','JetFitter_fittedPosition','JetFitter_fittedCov','JetFitter_tracksAtPVchi2', + 'JetFitter_tracksAtPVndf','JetFitter_tracksAtPVlinks','JetFitter_massUncorr','JetFitter_chi2','JetFitter_ndof','JetFitter_dRFlightDir', + 'JetFitter_nVTX','JetFitter_nSingleTracks','JetFitter_nTracksAtVtx','JetFitter_mass','JetFitter_energyFraction','JetFitter_significance3d', + 'JetFitter_deltaeta','JetFitter_deltaphi','SV1_vertices','SV1_energyTrkInJet','SV1_dstToMatLay','SV1_masssvx','SV1_efracsvx','SV1_N2Tpair', + 'SV1_NGTinSvx','SV1_badTracksIP','IP2D_sigD0wrtPVofTracks','IP2D_weightBofTracks','IP2D_weightUofTracks','IP2D_weightCofTracks', + 'IP2D_flagfromV0ofTracks','IP2D_gradeOfTracks','trkSum_ntrk','trkSum_SPt','trkSum_VPt','trkSum_VEta','IP3D_valD0wrtPVofTracks', + 'IP3D_valZ0wrtPVofTracks','IP3D_sigD0wrtPVofTracks','IP3D_sigZ0wrtPVofTracks','IP3D_weightBofTracks','IP3D_weightUofTracks', + 'IP3D_weightCofTracks','IP3D_flagfromV0ofTracks','IP3D_gradeOfTracks','SV1_normdist','SV1_significance3d','SV1_deltaR','SV1_Lxy','SV1_L3d', + 'MV2c10_discriminant','MV2c100_discriminant','jetLink',] +BTagVars = '.'.join(BTagOutput) + + TriggerHLTListRun3 = [ # framework/steering @@ -370,13 +383,21 @@ TriggerHLTListRun3 = [ # FIXME: add vertex tracks # bjet jets - ('xAOD::JetContainer#HLT_GSCJet', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet', 'inViews:BTagViews'), - ('xAOD::JetAuxContainer#HLT_GSCJetAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet'), + ('xAOD::JetContainer#HLT_bJets', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet', 'inViews:BTagViews'), + ('xAOD::JetAuxContainer#HLT_bJetsAux.btaggingLink', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet'), + + # secvertex for b-jets + ('xAOD::VertexContainer#HLT_BTagging_SecVtx', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet', 'inViews:BTagViews'), + ('xAOD::VertexAuxContainer#HLT_BTagging_SecVtxAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet'), + # btagvertex for b-jets + ('xAOD::BTagVertexContainer#HLT_BTagging_JFVtx', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet', 'inViews:BTagViews'), + ('xAOD::BTagVertexAuxContainer#HLT_BTagging_JFVtxAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet'), + # bjet b-tagging ('xAOD::BTaggingContainer#HLT_BTagging', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet', 'inViews:BTagViews'), - ('xAOD::BTaggingAuxContainer#HLT_BTaggingAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet'), + ('xAOD::BTaggingAuxContainer#HLT_BTaggingAux.'+BTagVars, 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Bjet'), # MinBias diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py index beb53063b7a6694bdafa103a80888da9a0ac69f4..6794393247cb09762dded97b37abc6c358f9cb6f 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1SimulationConfig.py @@ -139,6 +139,9 @@ def Lvl1SimulationSequence( flags = None ): muctpi = L1Muctpi() muctpi.LVL1ConfigSvc = svcMgr.LVL1ConfigSvc + # Sets up and configures the muon alignment and detector manager + from MuonRecExample import MuonAlignConfig # noqa: F401 + l1MuonSim = seqAND("l1MuonSim", [ MuonRdoToMuonDigit( "MuonRdoToMuonDigit", diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py index cba0667f1904392e43f18f5ad59aff5b3d14515b..efb1cee05c4eb259832f45adb963aed938a9d35f 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py @@ -131,6 +131,7 @@ if len(athenaCommonFlags.FilesInput())>0: af = athFile.fopen(athenaCommonFlags.FilesInput()[0]) globalflags.InputFormat = 'bytestream' if af.fileinfos['file_type']=='bs' else 'pool' globalflags.DataSource = 'data' if af.fileinfos['evt_type'][0]=='IS_DATA' else 'geant4' + ConfigFlags.Input.isMC = False if globalflags.DataSource=='data' else True # Set isOnline=False for MC inputs unless specified in the options if globalflags.DataSource() != 'data' and 'isOnline' not in globals(): log.info("Setting isOnline = False for MC input") @@ -146,6 +147,7 @@ if len(athenaCommonFlags.FilesInput())>0: else: # athenaHLT globalflags.InputFormat = 'bytestream' globalflags.DataSource = 'data' if not opt.setupForMC else 'data' + ConfigFlags.Input.isMC = False if '_run_number' not in dir(): import PyUtils.AthFile as athFile from AthenaCommon.AthenaCommonFlags import athenaCommonFlags @@ -161,12 +163,16 @@ else: # athenaHLT # Set final Cond/Geo tag based on input file, command line or default globalflags.DetDescrVersion = opt.setDetDescr or TriggerFlags.OnlineGeoTag() +ConfigFlags.GeoModel.AtlasVersion = globalflags.DetDescrVersion() globalflags.ConditionsTag = opt.setGlobalTag or TriggerFlags.OnlineCondTag() +ConfigFlags.IOVDb.GlobalTag = globalflags.ConditionsTag() # Other defaults jobproperties.Beam.beamType = 'collisions' +ConfigFlags.Beam.Type = jobproperties.Beam.beamType() jobproperties.Beam.bunchSpacing = 25 globalflags.DatabaseInstance='CONDBR2' if opt.useCONDBR2 else 'COMP200' +ConfigFlags.IOVDb.DatabaseInstance=globalflags.DatabaseInstance() athenaCommonFlags.isOnline.set_Value_and_Lock(opt.isOnline) log.info('Configured the following global flags:') @@ -562,6 +568,13 @@ ConfigFlags.lock() from TriggerJobOpts.TriggerConfig import triggerIDCCacheCreatorsCfg CAtoGlobalWrapper(triggerIDCCacheCreatorsCfg,ConfigFlags) + +# B-jet output +if opt.doBjetSlice or opt.forceEnableAllChains: + from JetTagCalibration.JetTagCalibConfig import JetTagCalibCfg + alias = ["HLT_b->HLT_b,AntiKt4EMTopo"] #"HLT_bJets" is the name of the b-jet JetContainer + topSequence += JetTagCalibCfg(ConfigFlags, scheme="Trig", TaggerList=ConfigFlags.BTagging.TrigTaggersList, NewChannel = alias) + #------------------------------------------------------------- # Output configuration #------------------------------------------------------------- diff --git a/Trigger/TriggerCommon/TriggerJobOpts/test/test_TriggerFlags_autoconf.py b/Trigger/TriggerCommon/TriggerJobOpts/test/test_TriggerFlags_autoconf.py index 56c6284a37625a0b2524568ccd5afe26161310da..0952c3564deda3f63654ffe1e47d1d3a03d262aa 100755 --- a/Trigger/TriggerCommon/TriggerJobOpts/test/test_TriggerFlags_autoconf.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/test/test_TriggerFlags_autoconf.py @@ -64,7 +64,7 @@ if __name__=="__main__": log.info("{} {} input file: {}".format(run, source, inputfiles[sample])) try: test_TriggerFlags(sample) - except AssertionError as e: + except AssertionError: sys.exit(1) log.info("Done with test") diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetDef.py index 552deeec80fa6ce6d28128fbb1af337914567b78..07e528d660e5a49f03bca4172ffdcc0dbf86303c 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetDef.py @@ -72,7 +72,7 @@ class BjetChainConfiguration(ChainConfigurationBase): - - - + + + diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetFlavourTaggingConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetFlavourTaggingConfiguration.py index f3b65cff314bf25f4efe98a1a9d7bb611ed6a367..9219b742c39c5c7d0b79d0c1937a6475cf4c6347 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetFlavourTaggingConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetFlavourTaggingConfiguration.py @@ -1,18 +1,61 @@ -# Copyright (C) 2002-2020 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 TrigEDMConfig.TriggerEDMRun3 import recordable -#from AthenaCommon.Constants import DEBUG +from AthenaConfiguration.AllConfigFlags import ConfigFlags def getFlavourTagging( inputJets, inputVertex, inputTracks ): - algSequence = [] + + acc = ComponentAccumulator() + + kwargs = {} + + from AthenaConfiguration.ComponentFactory import CompFactory + Analysis__BTagTrackAugmenterAlg=CompFactory.Analysis.BTagTrackAugmenterAlg + bTagTrackAugmenter = Analysis__BTagTrackAugmenterAlg( "Analysis__BTagTrackAugmenterAlg" ) + bTagTrackAugmenter.TrackContainer = inputTracks + bTagTrackAugmenter.PrimaryVertexContainer = inputVertex + acc.addEventAlgo(bTagTrackAugmenter) + + from BTagging.JetParticleAssociationAlgConfig import JetParticleAssociationAlgCfg + from BTagging.JetSecVtxFindingAlgConfig import JetSecVtxFindingAlgCfg + from BTagging.JetSecVertexingAlgConfig import JetSecVertexingAlgCfg + from BTagging.JetBTaggingAlgConfig import JetBTaggingAlgCfg + + + TrackToJetAssociators = ['BTagTrackToJetAssociator', 'BTagTrackToJetAssociatorBB'] + kwargs['Release'] = '22' + acc.merge(JetParticleAssociationAlgCfg(ConfigFlags, inputJets.replace("Jets",""), inputTracks, 'BTagTrackToJetAssociator', **kwargs)) + kwargs['Release'] = '21' + acc.merge(JetParticleAssociationAlgCfg(ConfigFlags, inputJets.replace("Jets",""), inputTracks, 'BTagTrackToJetAssociatorBB', **kwargs)) + del kwargs['Release'] + + btagname = "HLT_BTagging" + btagname_JFVtx = btagname + "_JFVtx" + btagname_SecVtx = btagname + "_SecVtx" + btagname_jetLink = btagname + ".jetLink" + + SecVertexingAndAssociators = {'JetFitter':'BTagTrackToJetAssociator','SV1':'BTagTrackToJetAssociator'} + for k, v in SecVertexingAndAssociators.items(): + if v not in TrackToJetAssociators: + raise RuntimeError( v + ' is not configured') + acc.merge(JetSecVtxFindingAlgCfg(ConfigFlags, inputJets.replace("Jets",""), inputVertex, k, v)) + JetSecVertexingAlg = JetSecVertexingAlgCfg(ConfigFlags, inputJets.replace("Jets",""), inputVertex, k, v) + SecVertexingAlg = JetSecVertexingAlg.getEventAlgo(inputJets.replace("Jets","").lower() + "_" + k.lower() + "_secvtx") + if k == "JetFitter": + SecVertexingAlg.BTagJFVtxCollectionName = recordable( btagname_JFVtx ) + elif k == "SV1": + SecVertexingAlg.BTagSVCollectionName = recordable( btagname_SecVtx ) + acc.merge(JetSecVertexingAlg) - from TrigBjetHypo.TrigBjetHypoConf import TrigBtagFexMT - bTagFex = TrigBtagFexMT( "TrigBtagFexMT" ) - bTagFex.JetKey = inputJets - bTagFex.PriVtxKey = inputVertex - bTagFex.TracksKey = inputTracks - bTagFex.OutputBTagging = recordable( "HLT_BTagging" ) - algSequence.append( bTagFex ) - - return [algSequence,bTagFex.OutputBTagging] + JetBTaggingAlg = JetBTaggingAlgCfg(ConfigFlags, JetCollection = inputJets.replace("Jets",""), PrimaryVertexCollectionName=inputVertex, TaggerList = ConfigFlags.BTagging.TrigTaggersList, SetupScheme = "Trig", SVandAssoc = SecVertexingAndAssociators, **kwargs) + BTaggingAlg = JetBTaggingAlg.getEventAlgo((ConfigFlags.BTagging.OutputFiles.Prefix + inputJets.replace("Jets","") + ConfigFlags.BTagging.GeneralToolSuffix).lower()) #Defined in JetBTaggingAlgConfig.py; Ends up to be "btagging_hlt_b(Jets)" + BTaggingAlg.BTaggingCollectionName = recordable( btagname ) + BTaggingAlg.BTagJFVtxCollectionName = btagname_JFVtx + BTaggingAlg.BTagSVCollectionName = btagname_SecVtx + BTaggingAlg.JetLinkName = btagname_jetLink + acc.merge(JetBTaggingAlg) + + + return [acc,btagname] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py index 53a1a5e9058f3f8a7c479724779852282f7fe45c..9d34dd8a56ded7fe9547aec2b2d4a04a42c62719 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Bjet/BjetSequenceSetup.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 # # menu components @@ -47,7 +47,7 @@ def bJetStep2Sequence(): InputMakerAlg.ViewFallThrough = True # BJet specific InputMakerAlg.PlaceJetInView = True - InputMakerAlg.InViewJets = recordable( "HLT_GSCJet" ) # Temporary name, To converge on this in the next future + InputMakerAlg.InViewJets = recordable( "HLT_bJets" ) # Prepare data objects for view verifier @@ -59,16 +59,29 @@ def bJetStep2Sequence(): from TriggerMenuMT.HLTMenuConfig.Bjet.BjetTrackingConfiguration import getSecondStageBjetTracking secondStageAlgs, PTTrackParticles = getSecondStageBjetTracking( inputRoI=InputMakerAlg.InViewRoIs, dataObjects=viewDataObjects ) + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior=1 + # Flavour Tagging from TriggerMenuMT.HLTMenuConfig.Bjet.BjetFlavourTaggingConfiguration import getFlavourTagging - flavourTaggingAlgs,bTaggingContainerName = getFlavourTagging( inputJets=InputMakerAlg.InViewJets, inputVertex=prmVtxKey, inputTracks=PTTrackParticles[0] ) - - bJetBtagSequence = seqAND( "bJetBtagSequence", secondStageAlgs + flavourTaggingAlgs ) + acc_flavourTaggingAlgs,bTaggingContainerName = getFlavourTagging( inputJets=InputMakerAlg.InViewJets, inputVertex=prmVtxKey, inputTracks=PTTrackParticles[0] ) + + Configurable.configurableRun3Behavior=0 + + #Conversion of flavour-tagging algorithms from new to old-style + from AthenaCommon.CFElements import findAllAlgorithms + from AthenaConfiguration.ComponentAccumulator import conf2toConfigurable + AllFlavourTaggingAlgs = [] + for alg in findAllAlgorithms(acc_flavourTaggingAlgs.getSequence("AthAlgSeq")): + AllFlavourTaggingAlgs.append(conf2toConfigurable(alg)) + + acc_flavourTaggingAlgs.wasMerged() #Needed to remove error message; Next we add all algorithms to sequence so this is kind of an old-style merge + bJetBtagSequence = seqAND( "bJetBtagSequence", secondStageAlgs + AllFlavourTaggingAlgs ) InputMakerAlg.ViewNodeName = "bJetBtagSequence" - + # Sequence BjetAthSequence = seqAND( "BjetAthSequence_step2",[InputMakerAlg,bJetBtagSequence] ) - + from TrigBjetHypo.TrigBjetHypoConf import TrigBjetBtagHypoAlgMT hypo = TrigBjetBtagHypoAlgMT( "TrigBjetBtagHypoAlg" ) # keys @@ -87,5 +100,9 @@ def bJetStep2Sequence(): return MenuSequence( Sequence = BjetAthSequence, Maker = InputMakerAlg, Hypo = hypo, - HypoToolGen = TrigBjetBtagHypoToolFromDict ) + HypoToolGen = TrigBjetBtagHypoToolFromDict) + + + + diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py index 7fb58f4d339851c02d63ef3e8ac89ca0ff0b97be..416d23ad7d36d25f14ee9a3a8e482a22ec431a58 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CalibCosmicMon/BeamspotChainConfiguration.py @@ -49,12 +49,6 @@ def allTE_trkfast( signature="FS" ): topSequence = AlgSequence() topSequence.SGInputLoader.Load += [( 'TagInfo' , 'DetectorStore+ProcessingTags' )] - # These objects must be loaded from SGIL if not from CondInputLoader - from IOVDbSvc.CondDB import conddb - if not conddb.folderRequested( '/TDAQ/Resources/ATLAS/PIXEL/Modules' ): - viewVerify.DataObjects += [( 'CondAttrListCollection', 'ConditionStore+/TDAQ/Resources/ATLAS/PIXEL/Modules' )] - topSequence.SGInputLoader.Load += [( 'CondAttrListCollection', 'ConditionStore+/TDAQ/Resources/ATLAS/PIXEL/Modules' )] - beamspotSequence = seqAND( "beamspotSequence_"+signature, viewAlgs+[vertexAlg] ) inputMakerAlg.ViewNodeName = beamspotSequence.name() beamspotViewsSequence = seqAND( "beamspotViewsSequence"+signature, [ inputMakerAlg, beamspotSequence ]) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/CaloSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/CaloSequenceSetup.py index 33dc07b7a24bb9d8cb85fdc51d293a8bb468f7cc..3a99da4be12d9e320b668a050d0723ccc2909487 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/CaloSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/CaloSequenceSetup.py @@ -2,7 +2,8 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import RecoFragmentsPool, MenuSequence -from AthenaCommon.CFElements import seqAND +from AthenaCommon.CFElements import seqAND, parOR +from TrigEDMConfig.TriggerEDMRun3 import recordable class CaloMenuDefs(object): @@ -12,8 +13,9 @@ class CaloMenuDefs(object): + def fastCaloSequence(doRinger): - """ Creates L2 Fast Calo sequence""" + """ Creates Fast Calo sequence""" # EV creator from TrigT2CaloCommon.CaloDef import fastCaloEVCreator (fastCaloViewsMaker, InViewRoIs) = fastCaloEVCreator() @@ -28,20 +30,66 @@ def fastCaloSequence(doRinger): def fastCaloMenuSequence(name, doRinger): - """ Creates L2 Fast Calo MENU sequence + """ Creates Egamma Fast Calo MENU sequence The Hypo name changes depending on name, so for different implementations (Electron, Gamma,....) The doRinger flag is to use or not the Ringer hypo """ (sequence, fastCaloViewsMaker, sequenceOut) = RecoFragmentsPool.retrieve(fastCaloSequence, {'doRinger' : doRinger}) # check if use Ringer and are electron because there aren't ringer for photons yet: # hypo - from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2CaloHypoAlgMT - theFastCaloHypo = TrigL2CaloHypoAlgMT(name+"L2CaloHypo") + from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaFastCaloHypoAlgMT + theFastCaloHypo = TrigEgammaFastCaloHypoAlgMT(name+"EgammaFastCaloHypo") theFastCaloHypo.CaloClusters = sequenceOut CaloMenuDefs.L2CaloClusters = sequenceOut - from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict + from TrigEgammaHypo.TrigEgammaFastCaloHypoTool import TrigEgammaFastCaloHypoToolFromDict return MenuSequence( Sequence = sequence, Maker = fastCaloViewsMaker, Hypo = theFastCaloHypo, - HypoToolGen = TrigL2CaloHypoToolFromDict ) + HypoToolGen = TrigEgammaFastCaloHypoToolFromDict ) + + +def cellRecoSequence(flags, name="HLTCaloCellMakerFS", RoIs="FSJETRoI", outputName="CaloCellsFS"): + """ Produce the full scan cell collection """ + if not RoIs: + from L1Decoder.L1DecoderConfig import mapThresholdToL1RoICollection + RoIs = mapThresholdToL1RoICollection("FSNOSEED") + from TrigT2CaloCommon.CaloDef import setMinimalCaloSetup + setMinimalCaloSetup() + from AthenaCommon.AppMgr import ServiceMgr as svcMgr + from TrigCaloRec.TrigCaloRecConfig import HLTCaloCellMaker + alg = HLTCaloCellMaker(name) + alg.RoIs=RoIs + alg.TrigDataAccessMT=svcMgr.TrigCaloDataAccessSvc + alg.CellsName=outputName + return parOR(name+"RecoSequence", [alg]), alg.CellsName + +def caloClusterRecoSequence( + flags, name="HLTCaloClusterMakerFS", RoIs="FSJETRoI", + outputName="HLT_TopoCaloClustersFS"): + """ Create the EM-level fullscan clusters """ + cell_sequence, cells_name = RecoFragmentsPool.retrieve(cellRecoSequence, flags=None, RoIs=RoIs) + from TrigCaloRec.TrigCaloRecConfig import TrigCaloClusterMakerMT_topo + alg = TrigCaloClusterMakerMT_topo( + name, + doMoments=True, + doLC=False, + cells=cells_name) + alg.CaloClusters = recordable(outputName) + return parOR(name+"RecoSequence", [cell_sequence, alg]), alg.CaloClusters + +def LCCaloClusterRecoSequence( + flags, name="HLTCaloClusterCalibratorLCFS", RoIs="FSJETRoI", + outputName="HLT_TopoCaloClustersLCFS"): + """ Create the LC calibrated fullscan clusters + + The clusters will be created as a shallow copy of the EM level clusters + """ + em_sequence, em_clusters = RecoFragmentsPool.retrieve(caloClusterRecoSequence, flags=None, RoIs=RoIs) + from TrigCaloRec.TrigCaloRecConfig import TrigCaloClusterCalibratorMT_LC + alg = TrigCaloClusterCalibratorMT_LC( + name, + InputClusters = em_clusters, + OutputClusters = outputName, + OutputCellLinks = outputName+"_cellLinks") + return parOR(name+"RecoSequence", [em_sequence, alg]), alg.OutputClusters diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/EventBuildingSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/EventBuildingSequenceSetup.py index 153952c628ebb64b549531652e36e9437146abad..2f5ed63c63a25f5a18de84de963cc0a44b6bd9b3 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/EventBuildingSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/CommonSequences/EventBuildingSequenceSetup.py @@ -88,6 +88,11 @@ def pebInfoWriterTool(name, eventBuildType): SubDetector.TDAQ_CALO_JET_PROC_DAQ, # = 0x74 SubDetector.TDAQ_CALO_JET_PROC_ROI # = 0x75 ]) + elif 'AlfaPEB' in eventBuildType: + tool = StaticPEBInfoWriterToolCfg(name) + tool.addSubDets([SubDetector.FORWARD_ALPHA, + SubDetector.TDAQ_CTP + ]) elif eventBuildType in DataScoutingInfo.getAllDataScoutingIdentifiers(): # Pure DataScouting configuration tool = StaticPEBInfoWriterToolCfg(name) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py index 89fc2377eeb04b19b27b4c85fc4a433f5d3ca8d6..ba95dae7fbeab2cbbba94228631e3527f0451133 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/ElectronSequenceSetup.py @@ -39,8 +39,8 @@ def fastElectronSequence(ConfigFlags): if "InDetTrigTrackParticleCreatorAlg" in viewAlg.name(): TrackParticlesName = viewAlg.TrackParticlesName - from TrigEgammaHypo.TrigL2ElectronFexMTConfig import L2ElectronFex_1 - theElectronFex= L2ElectronFex_1() + from TrigEgammaHypo.TrigEgammaFastElectronFexMTConfig import EgammaFastElectronFex_1 + theElectronFex= EgammaFastElectronFex_1() theElectronFex.TrigEMClusterName = CaloMenuDefs.L2CaloClusters theElectronFex.TrackParticlesName = TrackParticlesName theElectronFex.ElectronsName=recordable("HLT_L2Electrons") @@ -71,16 +71,16 @@ def fastElectronMenuSequence(): (electronAthSequence, l2ElectronViewsMaker, sequenceOut) = RecoFragmentsPool.retrieve(fastElectronSequence, ConfigFlags) # make the Hypo - from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2ElectronHypoAlgMT - theElectronHypo = TrigL2ElectronHypoAlgMT() + from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaFastElectronHypoAlgMT + theElectronHypo = TrigEgammaFastElectronHypoAlgMT() theElectronHypo.Electrons = sequenceOut theElectronHypo.RunInView=True - from TrigEgammaHypo.TrigL2ElectronHypoTool import TrigL2ElectronHypoToolFromDict + from TrigEgammaHypo.TrigEgammaFastElectronHypoTool import TrigEgammaFastElectronHypoToolFromDict return MenuSequence( Maker = l2ElectronViewsMaker, Sequence = electronAthSequence, Hypo = theElectronHypo, - HypoToolGen = TrigL2ElectronHypoToolFromDict ) + HypoToolGen = TrigEgammaFastElectronHypoToolFromDict ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py index 3924b8bbb3f923ce9a22846a75c18931e86c9d12..c52532fcbf3e6304f85024758f16e6459bdcfbb2 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonDef.py @@ -87,7 +87,7 @@ class PhotonChainConfiguration(ChainConfigurationBase): return self.getStep(1,stepName,[ fastPhotonCaloSequenceCfg]) def getFastPhoton(self): - stepName = "L2Photon" + stepName = "FastPhoton" return self.getStep(2,stepName,[ fastPhotonSequenceCfg]) def getPrecisionCaloPhoton(self): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonSequenceSetup.py index 0f379090ce77e2b8320eae5f06dc4af0934a5cd1..e6345aa497f6c0888d8a75229277a8c1a1d03eab 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Egamma/PhotonSequenceSetup.py @@ -21,8 +21,8 @@ def fastPhotonMenuSequence(): ViewVerify.DataObjects = [( 'xAOD::TrigEMClusterContainer' , 'StoreGateSvc+' + CaloMenuDefs.L2CaloClusters ), ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+EMIDRoIs' )] - from TrigEgammaHypo.TrigL2PhotonFexMTConfig import L2PhotonFex_1 - thePhotonFex= L2PhotonFex_1() + from TrigEgammaHypo.TrigEgammaFastPhotonFexMTConfig import EgammaFastPhotonFex_1 + thePhotonFex= EgammaFastPhotonFex_1() thePhotonFex.TrigEMClusterName = CaloMenuDefs.L2CaloClusters thePhotonFex.PhotonsName=recordable("HLT_L2Photons") #thePhotonFex.RoIs="EMIDRoIs" @@ -44,8 +44,8 @@ def fastPhotonMenuSequence(): l2PhotonViewsMaker.ViewNodeName = "photonInViewAlgs" - from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2PhotonHypoAlgMT - thePhotonHypo = TrigL2PhotonHypoAlgMT() + from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaFastPhotonHypoAlgMT + thePhotonHypo = TrigEgammaFastPhotonHypoAlgMT() thePhotonHypo.Photons = thePhotonFex.PhotonsName thePhotonHypo.RunInView=True @@ -53,13 +53,13 @@ def fastPhotonMenuSequence(): #electronDecisionsDumper = DumpDecisions("electronDecisionsDumper", Decisions = theElectronHypo.Output ) photonAthSequence = seqAND("photonAthSequence", [l2PhotonViewsMaker, photonInViewAlgs] ) - from TrigEgammaHypo.TrigL2PhotonHypoTool import TrigL2PhotonHypoToolFromDict + from TrigEgammaHypo.TrigEgammaFastPhotonHypoTool import TrigEgammaFastPhotonHypoToolFromDict return MenuSequence( Maker=l2PhotonViewsMaker, Sequence=photonAthSequence, Hypo=thePhotonHypo, - HypoToolGen=TrigL2PhotonHypoToolFromDict) + HypoToolGen=TrigEgammaFastPhotonHypoToolFromDict) def precisionPhotonSequence(ConfigFlags): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/ElectronRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/ElectronRecoSequences.py index c7e2f37c3f319a6c14c9a09981b2ce889fba8321..58f41575ca5ed854629d109ca3e7aae46f6b91bb 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/ElectronRecoSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/ElectronRecoSequences.py @@ -14,7 +14,7 @@ def l2CaloRecoCfg( flags ): def l2CaloHypoCfg( flags, name="UNSPECIFIED", CaloClusters="UNSPECIFIED" ): from AthenaConfiguration.ComponentFactory import CompFactory - l2CaloHypo = CompFactory.TrigL2CaloHypoAlgMT( name ) + l2CaloHypo = CompFactory.TrigEgammaFastCaloHypoAlgMT( name ) l2CaloHypo.CaloClusters = CaloClusters return l2CaloHypo diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py index 2ef3bef8109971e8f0322e1ee3173338e6b07cbd..b4469d313425d51723a3419e8356dacca2dd7206 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Electron/generateElectron.py @@ -4,7 +4,7 @@ from TriggerMenuMT.HLTMenuConfig.Electron.ElectronRecoSequences import l2CaloRec from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CAMenuSequence, \ ChainStep, Chain, getChainStepName, createStepView -from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict +from TrigEgammaHypo.TrigEgammaFastCaloHypoTool import TrigEgammaFastCaloHypoToolFromDict from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from TrigEDMConfig.TriggerEDMRun3 import recordable from AthenaConfiguration.ComponentFactory import CompFactory @@ -35,7 +35,7 @@ def generateChains( flags, chainDict ): fastCaloSequence = CAMenuSequence( Sequence = l2CaloReco.sequence(), Maker = l2CaloReco.inputMaker(), Hypo = l2CaloHypo, - HypoToolGen = TrigL2CaloHypoToolFromDict, + HypoToolGen = TrigEgammaFastCaloHypoToolFromDict, CA = accCalo) fastCaloSequence.createHypoTools(chainDict) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py index bed06937ac70fdf526d51bf84f326da05947231d..9edd076d045650f6098e7d0b81df3700de9cb5c6 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoSequences.py @@ -110,8 +110,16 @@ def jetRecoSequence( dummyFlags, dataSource, RoIs = 'FSJETRoI', **jetRecoDict): # Start by adding the topocluster reco sequence # This makes EM clusters! - from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence - (topoClusterSequence, clustersKey) = RecoFragmentsPool.retrieve(HLTFSTopoRecoSequence,RoIs) + from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import ( + caloClusterRecoSequence, LCCaloClusterRecoSequence) + if jetRecoDict["calib"] == "em": + topoClusterSequence, clustersKey = RecoFragmentsPool.retrieve( + caloClusterRecoSequence, flags=None, RoIs=RoIs) + elif jetRecoDict["calib"] == "lcw": + topoClusterSequence, clustersKey = RecoFragmentsPool.retrieve( + LCCaloClusterRecoSequence, flags=None, RoIs=RoIs) + else: + raise ValueError("Invalid value for calib: '{}'".format(jetRecoDict["calib"])) recoSeq += topoClusterSequence # Set up tracking sequence -- may need to reorganise or relocate diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py index 8b4318d8a45d55ebd10ef76b653a60188786ea45..e5653ddbab2bfd56b39501fd1e1f99b54d67bbc0 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py @@ -36,9 +36,10 @@ class CellConfig(AlgConfig): def __init__(self, **recoDict): super(CellConfig, self).__init__(**recoDict) - from TrigT2CaloCommon.CaloDef import HLTFSCellMakerRecoSequence + from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import cellRecoSequence from TrigEFMissingET.TrigEFMissingETConf import HLT__MET__CellFex - (cellMakerSeq, cellName) = HLTFSCellMakerRecoSequence() + cellMakerSeq, cellName = RecoFragmentsPool.retrieve( + cellRecoSequence, flags=None, RoIs=self.inputMaker.RoIs) self.inputs = [cellMakerSeq] self.fexAlg = self._make_fex_alg( @@ -50,14 +51,18 @@ class TCConfig(AlgConfig): def algType(cls): return "tc" - def __init__(self, **recoDict): - super(TCConfig, self).__init__(**recoDict) - from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence + def __init__(self, calib, **recoDict): + super(TCConfig, self).__init__(calib=calib, **recoDict) + from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import ( + caloClusterRecoSequence, LCCaloClusterRecoSequence) from TrigEFMissingET.TrigEFMissingETConf import HLT__MET__TCFex - # TODO - cluster calibration RoIs = self.inputMaker.RoIs - tcSeq, clusterName = RecoFragmentsPool.retrieve( - HLTFSTopoRecoSequence, RoIs) + if calib == "em": + tcSeq, clusterName = RecoFragmentsPool.retrieve( + caloClusterRecoSequence, flags = None, RoIs=RoIs) + elif calib == "lcw": + tcSeq, clusterName = RecoFragmentsPool.retrieve( + LCCaloClusterRecoSequence, flag = None, RoIs=RoIs) self.inputs = [tcSeq] self.fexAlg = self._make_fex_alg( @@ -69,13 +74,18 @@ class TCPufitConfig(AlgConfig): def algType(cls): return "tcpufit" - def __init__(self, **recoDict): - super(TCPufitConfig, self).__init__(**recoDict) - from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence + def __init__(self, calib, **recoDict): + super(TCPufitConfig, self).__init__(calib=calib, **recoDict) + from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import ( + caloClusterRecoSequence, LCCaloClusterRecoSequence) from TrigEFMissingET.TrigEFMissingETConf import HLT__MET__TCPufitFex RoIs = self.inputMaker.RoIs - tcSeq, clusterName = RecoFragmentsPool.retrieve( - HLTFSTopoRecoSequence, RoIs) + if calib == "em": + tcSeq, clusterName = RecoFragmentsPool.retrieve( + caloClusterRecoSequence, flags=None, RoIs=RoIs) + elif calib == "lcw": + tcSeq, clusterName = RecoFragmentsPool.retrieve( + LCCaloClusterRecoSequence, flags=None, RoIs=RoIs) self.inputs = [tcSeq] self.fexAlg = self._make_fex_alg( @@ -146,7 +156,8 @@ class PFSumConfig(AlgConfig): def __init__(self, **recoDict): super(PFSumConfig, self).__init__(**recoDict) - from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence + from TriggerMenuMT.HLTMenuConfig.CommonSequences.CaloSequenceSetup import ( + caloClusterRecoSequence) from eflowRec.PFHLTSequence import PFHLTSequence from ..Jet.JetRecoConfiguration import defineJetConstit from TrigEFMissingET.TrigEFMissingETConf import HLT__MET__PFSumFex @@ -156,7 +167,7 @@ class PFSumConfig(AlgConfig): RoIs = self.inputMaker.RoIs tcSeq, clusterName = RecoFragmentsPool.retrieve( - HLTFSTopoRecoSequence, RoIs) + caloClusterRecoSequence, flags=None, RoIs=RoIs) pfseq, pfoPrefix = RecoFragmentsPool.retrieve( PFHLTSequence, None, clustersin = clusterName, tracktype="ftf") constit = defineJetConstit(jetRecoDict, pfoPrefix=pfoPrefix) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/EventBuildingInfo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/EventBuildingInfo.py index 1e42d4694a78a33b33e0887b73f4e5a3fcf39a6b..5ba898dd6b84c3c3335393e4b065c074fcb5722c 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/EventBuildingInfo.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/EventBuildingInfo.py @@ -28,7 +28,8 @@ PartialEventBuildingIdentifiers = [ 'LArPEB', 'RPCPEBSecondaryReadout', 'SCTPEB', - 'TilePEB' + 'TilePEB', + 'AlfaPEB' ] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py index 97ac82c26bd6d749de1b994f1e988a76083dc2e3..47a6454491ced45d4e776327de2dc8d260564210 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py @@ -243,7 +243,9 @@ def setupMenu(): # ChainProp(name='HLT_mb_sp400_trk40_hmt_L1RD0_FILLED', l1SeedThresholds=['FSNOSEED'], stream=[PhysicsStream], groups=MinBiasGroup), # ChainProp(name='HLT_mb_sp600_trk45_hmt_L1RD0_FILLED', l1SeedThresholds=['FSNOSEED'], stream=[PhysicsStream], groups=MinBiasGroup), ] - TriggerFlags.CalibSlice.signatures = TriggerFlags.CalibSlice.signatures() + [] + TriggerFlags.CalibSlice.signatures = TriggerFlags.CalibSlice.signatures() + [ + ChainProp(name='HLT_alfacalib_AlfaPEB_L1ALFA_ANY', l1SeedThresholds=['FSNOSEED'], stream=['ALFACalib'], groups=['RATE:ALFACalibration','BW:Detector']) + ] TriggerFlags.CosmicSlice.signatures = TriggerFlags.CosmicSlice.signatures() + [ ] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py index 399d7df8bf223146e123570f311350876848466e..f275bb3bbfecb92f496e70ff86b7a49b1e51a075 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/StreamInfo.py @@ -43,6 +43,7 @@ _all_streams = [ StreamInfo('CostMonitoring','calibration', False, False), StreamInfo('SCTNoise','calibration',False,False), StreamInfo('Tile','calibration',False,False), + StreamInfo('ALFACalib','calibration',False,False), # HI STREAMS StreamInfo('HardProbes', 'physics', True, True), StreamInfo('MinBias', 'physics', True, True), diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py index d75ae3ddd79acec33180c39ca5f0947402398b55..3af50555d5633b5d9f3b00f9f04169a819193611 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MinBias/MinBiasChainConfiguration.py @@ -66,9 +66,6 @@ class MinBiasChainConfig(ChainConfigurationBase): ( 'TagInfo' , 'DetectorStore+ProcessingTags' )] from IOVDbSvc.CondDB import conddb - if not conddb.folderRequested( '/TDAQ/Resources/ATLAS/PIXEL/Modules' ): - verifier.DataObjects += [( 'CondAttrListCollection', 'ConditionStore+/TDAQ/Resources/ATLAS/PIXEL/Modules' )] - topSequence.SGInputLoader.Load += [( 'CondAttrListCollection', 'ConditionStore+/TDAQ/Resources/ATLAS/PIXEL/Modules' )] if not conddb.folderRequested( '/PIXEL/DCS/FSMSTATE' ): verifier.DataObjects += [( 'CondAttrListCollection' , 'ConditionStore+/PIXEL/DCS/FSMSTATE' )] topSequence.SGInputLoader.Load += [( 'CondAttrListCollection' , 'ConditionStore+/PIXEL/DCS/FSMSTATE' )] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py index c589c013d67249380c32653a8b0dc1296a31aa62..19bbc092b6f02992294cffe3518aee841dc3132d 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py @@ -126,7 +126,7 @@ def muCombAlgSequence(ConfigFlags): muCombRecoSequence, sequenceOut = muCombRecoSequence( l2muCombViewsMaker.InViewRoIs, "FTF" ) #Filter algorithm to run muComb only if non-Bphysics muon chains are active - from TrigMuonEF.TrigMuonEFConfig import MuonChainFilterAlg + from TrigMuonEF.TrigMuonEFConf import MuonChainFilterAlg from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponentsNaming import CFNaming muonChainFilter = MuonChainFilterAlg("FilterBphysChains") bphysChains =getBphysChainNames() @@ -274,7 +274,7 @@ def muEFCBAlgSequence(ConfigFlags): #By default the EFCB sequence will run both outside-in and #(if zero muons are found) inside-out reconstruction - from TrigMuonEF.TrigMuonEFConfig import MuonFilterAlg, MergeEFMuonsAlg + from TrigMuonEF.TrigMuonEFConf import MuonFilterAlg, MergeEFMuonsAlg from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muEFCBRecoSequence, muEFInsideOutRecoSequence efcbViewsMaker = EventViewCreatorAlgorithm("IMefcbtotal") diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/PhotonRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/PhotonRecoSequences.py index 1dc014e4c47fc18d304bdbae045a889f602d2d59..d15c10cfe6e8b5c8f4e57e8f4e8fc5b71a1d6606 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/PhotonRecoSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/PhotonRecoSequences.py @@ -82,7 +82,7 @@ def l2PhotonAlgCfg( flags ): #from TrigEgammaHypo.TrigL2PhotonFexMTConfig import L2PhotonFex_1 from AthenaConfiguration.ComponentFactory import CompFactory - photonFex= CompFactory.TrigL2PhotonFexMT("L2PhotonFex_1") + photonFex= CompFactory.TrigEgammaFastPhotonFexMT("EgammaFastPhotonFex_1") #photonFex= L2PhotonFex_1() photonFex.TrigEMClusterName = recordable("HLT_L2CaloEMClusters") photonFex.PhotonsName = recordable("HLT_L2Photons") @@ -112,7 +112,7 @@ def l2PhotonRecoCfg( flags ): def l2PhotonHypoCfg( flags, Photons='Unspecified', RunInView=True): from AthenaConfiguration.ComponentFactory import CompFactory - l2PhotonHypo = CompFactory.TrigL2PhotonHypoAlgMT() + l2PhotonHypo = CompFactory.TrigEgammaFastPhotonHypoAlgMT() l2PhotonHypo.Photons = Photons l2PhotonHypo.RunInView = RunInView @@ -124,9 +124,9 @@ def generatePhotonsCfg( flags ): acc = ComponentAccumulator() from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import MenuSequence, ChainStep, Chain, RecoFragmentsPool - from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict - from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2CaloHypoAlgMT - l2CaloHypo = TrigL2CaloHypoAlgMT("L2PhotonCaloHypo") + from TrigEgammaHypo.TrigEgammaFastCaloHypoTool import TrigEgammaFastCaloHypoToolFromDict + from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaFastCaloHypoAlgMT + l2CaloHypo = TrigEgammaFastCaloHypoAlgMT("EgammaFastPhotonCaloHypo") l2CaloHypo.CaloClusters = 'L2CaloEMClusters' @@ -139,7 +139,7 @@ def generatePhotonsCfg( flags ): fastCaloSequence = MenuSequence( Sequence = l2CaloReco.sequence(), Maker = l2CaloReco.inputMaker(), Hypo = l2CaloHypo, - HypoToolGen = TrigL2CaloHypoToolFromDict ) + HypoToolGen = TrigEgammaFastCaloHypoToolFromDict ) fastCaloStep = ChainStep( "Photon_step1", [fastCaloSequence] ) @@ -148,17 +148,17 @@ def generatePhotonsCfg( flags ): l2PhotonReco = RecoFragmentsPool.retrieve( l2PhotonRecoCfg, flags ) acc.merge( l2PhotonReco ) - from TrigEgammaHypo.TrigEgammaHypoConf import TrigL2PhotonHypoAlgMT - l2PhotonHypo = TrigL2PhotonHypoAlgMT() + from TrigEgammaHypo.TrigEgammaHypoConf import TrigEgammaFastPhotonHypoAlgMT + l2PhotonHypo = TrigEgammaFastPhotonHypoAlgMT() l2PhotonHypo.Photons = "L2Photons" l2PhotonHypo.RunInView=True - from TrigEgammaHypo.TrigL2PhotonHypoTool import TrigL2PhotonHypoToolFromDict + from TrigEgammaHypo.TrigEgammaFastPhotonHypoTool import TrigEgammaFastPhotonHypoToolFromDict l2PhotonSequence = MenuSequence( Sequence = l2PhotonReco.sequence(), Maker = l2PhotonReco.inputMaker(), Hypo = l2PhotonHypo, - HypoToolGen = TrigL2PhotonHypoToolFromDict ) + HypoToolGen = TrigEgammaFastPhotonHypoToolFromDict ) l2PhotonStep = ChainStep( "Photon_step2", [ l2PhotonSequence] ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py index c75dc472186dbed007ac2394ba4945540dfc2ce3..4d7f974abef4c99378402506aa497b37009726e4 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Photon/generatePhoton.py @@ -6,8 +6,8 @@ from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import CAMenuSequence, \ ChainStep, Chain, getChainStepName, createStepView from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -from TrigEgammaHypo.TrigL2CaloHypoTool import TrigL2CaloHypoToolFromDict -from TrigEgammaHypo.TrigL2PhotonHypoTool import TrigL2PhotonHypoToolFromDict +from TrigEgammaHypo.TrigEgammaFastCaloHypoTool import TrigEgammaFastCaloHypoToolFromDict +from TrigEgammaHypo.TrigEgammaFastPhotonHypoTool import TrigEgammaFastPhotonHypoToolFromDict from TrigEDMConfig.TriggerEDMRun3 import recordable import pprint @@ -34,7 +34,7 @@ def generateChains(flags, chainDict): fastCaloSequence = CAMenuSequence( Sequence = l2CaloReco.sequence(), Maker = l2CaloReco.inputMaker(), Hypo = l2CaloHypo, - HypoToolGen = TrigL2CaloHypoToolFromDict, + HypoToolGen = TrigEgammaFastCaloHypoToolFromDict, CA = accCalo ) fastCaloSequence.createHypoTools(chainDict) @@ -60,7 +60,7 @@ def generateChains(flags, chainDict): l2PhotonSequence = CAMenuSequence( Sequence = l2PhotonReco.sequence(), Maker = l2PhotonReco.inputMaker(), Hypo = l2PhotonHypo, - HypoToolGen = TrigL2PhotonHypoToolFromDict, + HypoToolGen = TrigEgammaFastPhotonHypoToolFromDict, CA = accPhoton ) l2PhotonSequence.createHypoTools(chainDict) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/Thresholds.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/Thresholds.py index 42a021f2584b319ef72e15262f8133dd32c12cad..e2948d0dc93029cabc9da8984524c289ddf8e997 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/Thresholds.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/Thresholds.py @@ -246,6 +246,7 @@ class LegacyThreshold( Threshold ): ("etamax", thrV.etamax), ("phimin", thrV.phimax), ("phimax", thrV.phimin), + ("window", thrV.window), ("priority", thrV.priority) ]) ) elif self.ttype == ThrType.TE: @@ -616,7 +617,7 @@ class ThresholdValue(object): for rv in listOfThrValues: if rv.priority != self.priority: continue - if (self.etamax >= rv.etamin) and (self.etamin <= rv.etamax): + if (self.etamax > rv.etamin) and (self.etamin < rv.etamax): # overlaps with existing range of the same priority raise RuntimeError( "ThresholdValue %s: Range eta %i - %i (priority %i) overlaps with existing range of the same priority" % \ (self.name, self.etamin, self.etamax, self.priority) ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/TopoAlgos.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/TopoAlgos.py index 9dbf59dfbf449d626c72553e173cbbf251c3793b..0c065499e90f1622642c324e29d64f81126f1f9a 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/TopoAlgos.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Base/TopoAlgos.py @@ -56,9 +56,9 @@ class TopoAlgo(object): confObj["algId"] = self.algoId return confObj - def getEnergyScaleEM(self): + def getScaleToCountsEM(self): tw = self.menuThr.typeWideThresholdConfig(ThrType["EM"]) - return tw["emscale"] + return 1000 / tw["resolutionMeV"] class Variable(object): def __init__(self, name, selection, value): @@ -108,7 +108,7 @@ class SortingAlgo(TopoAlgo): confObj["fixedParameters"]["generics"][genParm.name] = odict([("value", genParm.value), ("position", pos)]) confObj["variableParameters"] = list() - _emscale_for_decision = self.getEnergyScaleEM() + _emscale_for_decision = self.getScaleToCountsEM() _mu_for_decision=1 # MU4->3GeV, MU6->5GeV, MU10->9GeV for (pos, variable) in enumerate(self.variables): # adjust MinET if outputs match with EM or TAU or MU ==> this is a terrible hack that won't fly in Run 3 @@ -185,7 +185,7 @@ class DecisionAlgo(TopoAlgo): # variable parameters confObj["variableParameters"] = list() - _emscale_for_decision = self.getEnergyScaleEM() + _emscale_for_decision = self.getScaleToCountsEM() _mu_for_decision = 1 # MU4->3GeV, MU6->5GeV, MU10->9GeV for (pos, variable) in enumerate(self.variables): # scale MinET if inputs match with EM or TAU @@ -276,6 +276,7 @@ class MultiplicityAlgo(TopoAlgo): def json(self): from collections import OrderedDict as odict confObj = odict() + confObj["type"] = self.classtype confObj["threshold"] = self.threshold confObj["input"] = self.input confObj["output"] = self.outputs @@ -284,7 +285,7 @@ class MultiplicityAlgo(TopoAlgo): class EMMultiplicityAlgo(MultiplicityAlgo): - def __init__(self, classtype, name, algoId, threshold, nbits): + def __init__(self, name, algoId, threshold, nbits, classtype = "EMMultiplicity" ): super(EMMultiplicityAlgo, self).__init__(classtype=classtype, name=name, algoId=algoId, threshold = threshold, @@ -295,7 +296,7 @@ class EMMultiplicityAlgo(MultiplicityAlgo): class TauMultiplicityAlgo(MultiplicityAlgo): - def __init__(self, classtype, name, algoId, threshold, nbits): + def __init__(self, name, algoId, threshold, nbits, classtype = "TauMultiplicity" ): super(TauMultiplicityAlgo, self).__init__(classtype=classtype, name=name, algoId=algoId, threshold = threshold, @@ -303,7 +304,7 @@ class TauMultiplicityAlgo(MultiplicityAlgo): nbits=nbits) class JetMultiplicityAlgo(MultiplicityAlgo): - def __init__(self, classtype, name, algoId, threshold, nbits): + def __init__(self, name, algoId, threshold, nbits, classtype = "JetMultiplicity" ): super(JetMultiplicityAlgo, self).__init__(classtype=classtype, name=name, algoId=algoId, threshold = threshold, @@ -311,7 +312,7 @@ class JetMultiplicityAlgo(MultiplicityAlgo): nbits=nbits) class XEMultiplicityAlgo(MultiplicityAlgo): - def __init__(self, classtype, name, algoId, threshold, nbits): + def __init__(self, name, algoId, threshold, nbits, classtype = "EnergyThreshold"): super(XEMultiplicityAlgo, self).__init__( classtype = classtype, name=name, algoId = algoId, threshold = threshold, diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ItemDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ItemDef.py index 55703e7679e1be114911abae12a11c701eb61f67..be4581032ca5195c64db46373b3b5994edc6453f 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ItemDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ItemDef.py @@ -35,11 +35,12 @@ class ItemDef: def registerItems(tc, menuName): """Register L1 items for further use""" + # dear Menu Experts, please note that it is only necessary to + # check the menu name if a certain item needs to be defined + # differently in different menus + # define local flag for menu version - isV6 = '_v6' in menuName - isV7 = '_v7' in menuName isV8 = '_v8' in menuName or 'LS2_v1'==menuName or 'run3_v1' in menuName - isHI = '_HI' in menuName and 'HI_run3_v1' not in menuName isHIV5 = 'HI_v5' in menuName isPhaseII = '_PhaseII' in menuName @@ -87,80 +88,56 @@ class ItemDef: MenuItem.currentPartition = 1 - # E/gamma ctpid=[0:0x1f] MenuItem('L1_EM3' ).setLogic( d.EM3 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM3HI' ).setLogic( d.EM3HI & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM4' ).setLogic( d.EM4 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM5' ).setLogic( d.EM5 & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM7' ).setLogic( d.EM7 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM10' ).setLogic( d.EM10 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM24VHI' ).setLogic( d.EM24VHI & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM8' ).setLogic( d.EM8 & physcond).setTriggerType( TT.calo ) - if not isV8: - MenuItem('L1_EM8I' ).setLogic( d.EM8I & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM12' ).setLogic( d.EM12 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM14' ).setLogic( d.EM14 & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM15' ).setLogic( d.EM15 & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM15_BGRP7').setLogic( d.EM15 & bgrp7cond).setTriggerType( TT.calo ) - if not isV8: - MenuItem('L1_EM15I' ).setLogic( d.EM15 & d.EM8I & physcond).setTriggerType( TT.calo ) - if not isHI: - MenuItem('L1_eEM3' ).setLogic( d.eEM3 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_eEM8' ).setLogic( d.eEM8 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_eEM10' ).setLogic( d.eEM10 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_eEM15' ).setLogic( d.eEM15 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI' ).setLogic( d.EM15VHI & physcond).setTriggerType( TT.calo ) - MenuItem('L1_eEM20' ).setLogic( d.eEM20 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM22VH' ).setLogic( d.EM22VH & physcond).setTriggerType( TT.calo ) - MenuItem('L1_eEM22' ).setLogic( d.eEM22 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_eEM22VHI' ).setLogic( d.eEM22VHI & physcond).setTriggerType( TT.calo ) - MenuItem('L1_eEM20VH' ).setLogic( d.eEM20VH & physcond).setTriggerType( TT.calo ) - MenuItem('L1_eEM20VHI' ).setLogic( d.eEM20VHI & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM24VHIM' ).setLogic( d.EM24VHIM & physcond).setTriggerType( TT.calo ) - else: - MenuItem('L1_EM15HI' ).setLogic( d.EM15HI & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM26VHI' ).setLogic( d.EM26VHI & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM18VH' ).setLogic( d.EM18VH & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM16' ).setLogic( d.EM16 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15I' ).setLogic( d.EM15 & d.EM8I & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI' ).setLogic( d.EM15HI & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM8VH' ).setLogic( d.EM8VH & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM10VH' ).setLogic( d.EM10VH & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM20A' ).setLogic( d.EM20A & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM20C' ).setLogic( d.EM20C & physcond).setTriggerType( TT.calo ) - if isHI: - MenuItem('L1_EM13VH' ).setLogic( d.EM13VH & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM15VH' ).setLogic( d.EM15VH & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM18' ).setLogic( d.EM18 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM18VHI' ).setLogic( d.EM18VHI & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM20' ).setLogic( d.EM20 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM18VH' ).setLogic( d.EM18VH & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM20VH' ).setLogic( d.EM20VH & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM18VHI' ).setLogic( d.EM18VHI & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM20VHI' ).setLogic( d.EM20VHI & physcond).setTriggerType( TT.calo ) # isolation not yet defined - MenuItem('L1_EM22' ).setLogic( d.EM22 & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM22VHI' ).setLogic( d.EM22VHI & physcond).setTriggerType( TT.calo ) # isolation not yet defined + MenuItem('L1_EM24VHI' ).setLogic( d.EM24VHI & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM26VHI' ).setLogic( d.EM26VHI & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM30VHI' ).setLogic( d.EM30VHI & physcond).setTriggerType( TT.calo ) # isolation not yet defined - MenuItem('L1_EM50V' ).setLogic( d.EM50V & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM24VHIM' ).setLogic( d.EM24VHIM & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM20A' ).setLogic( d.EM20A & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM20C' ).setLogic( d.EM20C & physcond).setTriggerType( TT.calo ) + + MenuItem('L1_eEM3' ).setLogic( d.eEM3 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_eEM8' ).setLogic( d.eEM8 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_eEM10' ).setLogic( d.eEM10 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_eEM15' ).setLogic( d.eEM15 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI' ).setLogic( d.EM15VHI & physcond).setTriggerType( TT.calo ) + MenuItem('L1_eEM20' ).setLogic( d.eEM20 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM22VH' ).setLogic( d.EM22VH & physcond).setTriggerType( TT.calo ) + MenuItem('L1_eEM22' ).setLogic( d.eEM22 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_eEM22VHI' ).setLogic( d.eEM22VHI & physcond).setTriggerType( TT.calo ) + MenuItem('L1_eEM20VH' ).setLogic( d.eEM20VH & physcond).setTriggerType( TT.calo ) + MenuItem('L1_eEM20VHI' ).setLogic( d.eEM20VHI & physcond).setTriggerType( TT.calo ) + # 2xEM, 3xEM MenuItem('L1_2EM3' ).setLogic( d.EM3.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_2EM5' ).setLogic( d.EM5.x(2) & physcond).setTriggerType( TT.calo ) MenuItem('L1_2EM7' ).setLogic( d.EM7.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_2EM10' ).setLogic( d.EM10.x(2) & physcond).setTriggerType( TT.calo ) MenuItem('L1_2EM10VH' ).setLogic( d.EM10VH.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_2eEM15VHI' ).setLogic( d.eEM15VHI.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_2eEM20VH' ).setLogic( d.eEM20VH.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_2eEM8' ).setLogic( d.eEM8.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_2eEM10' ).setLogic( d.eEM10.x(2) & physcond).setTriggerType( TT.calo ) - if not isV8: - MenuItem('L1_2EM8I').setLogic( d.EM8I.x(2) & physcond).setTriggerType(TT.calo) - if isV6 or isHI: - MenuItem('L1_2EM13VH' ).setLogic( d.EM13VH.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_2EM18VH' ).setLogic( d.EM18VH.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_2eEM15VHI' ).setLogic( d.eEM15VHI.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_2eEM20VH' ).setLogic( d.eEM20VH.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_2eEM8' ).setLogic( d.eEM8.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_2eEM10' ).setLogic( d.eEM10.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_2EM8I' ).setLogic( d.EM8I.x(2) & physcond).setTriggerType(TT.calo) + MenuItem('L1_2EM13VH' ).setLogic( d.EM13VH.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_2EM18VH' ).setLogic( d.EM18VH.x(2) & physcond).setTriggerType( TT.calo ) MenuItem('L1_2EM12' ).setLogic( d.EM12.x(2) & physcond).setTriggerType( TT.calo ) MenuItem('L1_2EM15' ).setLogic( d.EM15.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_2EM16' ).setLogic( d.EM16.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_2EM22' ).setLogic( d.EM22.x(2) & physcond).setTriggerType( TT.calo ) MenuItem('L1_2EM15VH' ).setLogic( d.EM15VH.x(2) & physcond).setTriggerType( TT.calo ) - if not isV6 and not isHI: - MenuItem('L1_2EM15VHI' ).setLogic( d.EM15VHI.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_2EM15VHI' ).setLogic( d.EM15VHI.x(2) & physcond).setTriggerType( TT.calo ) MenuItem('L1_2EM20VH' ).setLogic( d.EM20VH.x(2) & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM7_2EM3' ).setLogic( d.EM7 & d.EM3.x(2) & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM12_2EM3' ).setLogic( d.EM12 & d.EM3.x(2) & physcond).setTriggerType( TT.calo ) @@ -169,20 +146,14 @@ class ItemDef: MenuItem('L1_EM20VH_3EM10VH' ).setLogic( d.EM20VH & d.EM10VH.x(3) & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM20VH_2EM10VH_3EM8VH' ).setLogic( d.EM20VH & d.EM10VH.x(2) & d.EM8VH.x(3) & physcond).setTriggerType( TT.calo ) - #ATR-19302 - if isV8: - MenuItem('L1_EM10VHI') .setLogic( d.EM10VHI & physcond).setTriggerType( TT.calo ) - MenuItem('L1_2EM10VHI').setLogic( d.EM10VHI.x(2) & physcond).setTriggerType( TT.calo ) - # 4xEM MenuItem('L1_EM15VH_3EM7' ).setLogic( d.EM15VH & d.EM7.x(3) & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM15VH_3EM8VH' ).setLogic( d.EM15VH & d.EM8VH.x(3) & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM15VH_3EM10VH' ).setLogic( d.EM15VH & d.EM10VH.x(3) & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM15VH_2EM10VH_3EM7' ).setLogic( d.EM15VH & d.EM10VH.x(2) & d.EM7.x(3) & physcond).setTriggerType( TT.calo ) MenuItem('L1_eEM20VH_3eEM10VH' ).setLogic( d.eEM20VH & d.eEM10VH.x(3) & physcond).setTriggerType( TT.calo ) - if isV6 or isHI: - MenuItem('L1_EM18VH_3EM8VH' ).setLogic( d.EM18VH & d.EM8VH.x(3) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM18VH_2EM10VH_3EM7' ).setLogic( d.EM18VH & d.EM10VH.x(2) & d.EM7.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM18VH_3EM8VH' ).setLogic( d.EM18VH & d.EM8VH.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM18VH_2EM10VH_3EM7' ).setLogic( d.EM18VH & d.EM10VH.x(2) & d.EM7.x(3) & physcond).setTriggerType( TT.calo ) # EM and MU MenuItem('L1_2eEM8VH_MU10' ).setLogic( d.eEM8VH.x(2) & d.MU10 & physcond).setTriggerType( TT.calo ) @@ -222,9 +193,8 @@ class ItemDef: MenuItem('L1_2EM3_VTE70').setLogic( d.EM3.x(2) & Not(d.TE70) & physcond).setTriggerType(TT.calo) MenuItem('L1_2EM3_VTE50').setLogic( d.EM3.x(2) & Not(d.TE50) & physcond).setTriggerType(TT.calo) - if not isV8: - MenuItem('L1_2EM8I_J50').setLogic( d.EM8I.x(2) & d.J50 & physcond).setTriggerType(TT.calo) - MenuItem('L1_2EM8I_J75').setLogic( d.EM8I.x(2) & d.J75 & physcond).setTriggerType(TT.calo) + MenuItem('L1_2EM8I_J50').setLogic( d.EM8I.x(2) & d.J50 & physcond).setTriggerType(TT.calo) + MenuItem('L1_2EM8I_J75').setLogic( d.EM8I.x(2) & d.J75 & physcond).setTriggerType(TT.calo) # HI MenuItem('L1_EM3_NZ' ).setLogic( d.EM3 & Not(d.ZDC_AND) & physcond).setTriggerType( TT.calo ) @@ -339,22 +309,13 @@ class ItemDef: MenuItem('L1_MU4_TE120' ).setLogic( d.MU4 & d.TE120 & physcond).setTriggerType(TT.muon) MenuItem('L1_MU4_TE160' ).setLogic( d.MU4 & d.TE160 & physcond).setTriggerType(TT.muon) - if isV8 or isV7 or isHIV5 or isPhaseII: - MenuItem('L1_MU4_TE10.24ETA49' ).setLogic( d.MU4 & d.TE1024ETA49 & physcond).setTriggerType(TT.muon) - MenuItem('L1_MU4_TE15.24ETA49' ).setLogic( d.MU4 & d.TE1524ETA49 & physcond).setTriggerType(TT.muon) - MenuItem('L1_MU4_TE20.24ETA49' ).setLogic( d.MU4 & d.TE2024ETA49 & physcond).setTriggerType(TT.muon) - MenuItem('L1_MU4_TE25.24ETA49' ).setLogic( d.MU4 & d.TE2524ETA49 & physcond).setTriggerType(TT.muon) - MenuItem('L1_MU4_TE30.24ETA49' ).setLogic( d.MU4 & d.TE3024ETA49 & physcond).setTriggerType(TT.muon) - MenuItem('L1_MU4_TE35.24ETA49' ).setLogic( d.MU4 & d.TE3524ETA49 & physcond).setTriggerType(TT.muon) - MenuItem('L1_MU4_TE40.24ETA49' ).setLogic( d.MU4 & d.TE4024ETA49 & physcond).setTriggerType(TT.muon) - else: - MenuItem('L1_MU4_TE10.0ETA24' ).setLogic( d.MU4 & d.TE100ETA24 & physcond).setTriggerType(TT.muon) - MenuItem('L1_MU4_TE15.0ETA24' ).setLogic( d.MU4 & d.TE150ETA24 & physcond).setTriggerType(TT.muon) - MenuItem('L1_MU4_TE20.0ETA24' ).setLogic( d.MU4 & d.TE200ETA24 & physcond).setTriggerType(TT.muon) - MenuItem('L1_MU4_TE25.0ETA24' ).setLogic( d.MU4 & d.TE250ETA24 & physcond).setTriggerType(TT.muon) - MenuItem('L1_MU4_TE30.0ETA24' ).setLogic( d.MU4 & d.TE300ETA24 & physcond).setTriggerType(TT.muon) - MenuItem('L1_MU4_TE35.0ETA24' ).setLogic( d.MU4 & d.TE350ETA24 & physcond).setTriggerType(TT.muon) - MenuItem('L1_MU4_TE40.0ETA24' ).setLogic( d.MU4 & d.TE400ETA24 & physcond).setTriggerType(TT.muon) + MenuItem('L1_MU4_TE10.24ETA49' ).setLogic( d.MU4 & d.TE1024ETA49 & physcond).setTriggerType(TT.muon) + MenuItem('L1_MU4_TE15.24ETA49' ).setLogic( d.MU4 & d.TE1524ETA49 & physcond).setTriggerType(TT.muon) + MenuItem('L1_MU4_TE20.24ETA49' ).setLogic( d.MU4 & d.TE2024ETA49 & physcond).setTriggerType(TT.muon) + MenuItem('L1_MU4_TE25.24ETA49' ).setLogic( d.MU4 & d.TE2524ETA49 & physcond).setTriggerType(TT.muon) + MenuItem('L1_MU4_TE30.24ETA49' ).setLogic( d.MU4 & d.TE3024ETA49 & physcond).setTriggerType(TT.muon) + MenuItem('L1_MU4_TE35.24ETA49' ).setLogic( d.MU4 & d.TE3524ETA49 & physcond).setTriggerType(TT.muon) + MenuItem('L1_MU4_TE40.24ETA49' ).setLogic( d.MU4 & d.TE4024ETA49 & physcond).setTriggerType(TT.muon) MenuItem('L1_MU0_VTE50').setLogic( d.MU0 & Not(d.TE50) & physcond).setTriggerType(TT.muon) MenuItem('L1_MU4_VTE50').setLogic( d.MU4 & Not(d.TE50) & physcond).setTriggerType(TT.muon) @@ -389,7 +350,6 @@ class ItemDef: MenuItem('L1_MU21_FIRSTEMPTY' ).setLogic( d.MU21 & firstempty).setTriggerType(TT.muon) # EM and MU - MenuItem('L1_EM6_MU10' ).setLogic( d.EM6 & d.MU10 & physcond).setTriggerType(TT.muon) MenuItem('L1_EM7_MU10' ).setLogic( d.EM7 & d.MU10 & physcond).setTriggerType(TT.muon) MenuItem('L1_EM7_MU15' ).setLogic( d.EM7 & d.MU15 & physcond).setTriggerType(TT.muon) MenuItem('L1_EM8VH_MU15' ).setLogic( d.EM8VH & d.MU15 & physcond).setTriggerType(TT.muon) @@ -399,8 +359,7 @@ class ItemDef: MenuItem('L1_EM7_MU11' ).setLogic( d.EM7 & d.MU11 & physcond).setTriggerType(TT.muon) MenuItem('L1_EM8_MU10' ).setLogic( d.EM8 & d.MU10 & physcond).setTriggerType(TT.muon) MenuItem('L1_EM8I_MU10' ).setLogic( d.EM8I & d.MU10 & physcond).setTriggerType(TT.muon) - if not isV8: - MenuItem('L1_EM15I_MU4' ).setLogic( d.EM15 & d.EM8I & d.MU4 & physcond).setTriggerType(TT.muon) + MenuItem('L1_EM15I_MU4' ).setLogic( d.EM15 & d.EM8I & d.MU4 & physcond).setTriggerType(TT.muon) MenuItem('L1_EM15VH_MU10').setLogic( d.EM15VH & d.MU10 & physcond).setTriggerType(TT.muon) MenuItem('L1_EM3_MU20' ).setLogic( d.EM3 & d.MU20 & physcond).setTriggerType(TT.muon) MenuItem('L1_2EM8VH_MU10').setLogic( d.EM8VH.x(2) & d.MU10 & physcond).setTriggerType(TT.muon) @@ -424,8 +383,7 @@ class ItemDef: MenuItem('L1_TAU12IL').setLogic( d.HA12IL & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU12IM').setLogic( d.HA12IM & physcond).setTriggerType( TT.calo ) - if not isV8 : - MenuItem('L1_TAU12IT').setLogic( d.HA12IT & physcond).setTriggerType( TT.calo ) + MenuItem('L1_TAU12IT').setLogic( d.HA12IT & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU12I').setLogic( d.HA12I & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU15' ).setLogic( d.HA15 & physcond).setTriggerType( TT.calo ) @@ -433,23 +391,19 @@ class ItemDef: MenuItem('L1_TAU20' ).setLogic( d.HA20 & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU20IL' ).setLogic( d.HA20IL & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU20IM' ).setLogic( d.HA20IM & physcond).setTriggerType( TT.calo ) - if not isV8 : - MenuItem('L1_TAU20IT' ).setLogic( d.HA20IT & physcond).setTriggerType( TT.calo ) + MenuItem('L1_TAU20IT' ).setLogic( d.HA20IT & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU20A' ).setLogic( d.HA20A & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU20C' ).setLogic( d.HA20C & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU25' ).setLogic( d.HA25 & physcond).setTriggerType( TT.calo ) - if isV6 or isHI: - MenuItem('L1_TAU25IT' ).setLogic( d.HA25IT & physcond).setTriggerType( TT.calo ) - else: - MenuItem('L1_TAU25IM' ).setLogic( d.HA25IM & physcond).setTriggerType( TT.calo ) + MenuItem('L1_TAU25IT' ).setLogic( d.HA25IT & physcond).setTriggerType( TT.calo ) + MenuItem('L1_TAU25IM' ).setLogic( d.HA25IM & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU30' ).setLogic( d.HA30 & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU40' ).setLogic( d.HA40 & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU60' ).setLogic( d.HA60 & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU100' ).setLogic( d.HA100 & physcond).setTriggerType( TT.calo ) - if isV8 : - MenuItem('L1_TAU90' ).setLogic( d.HA90 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_TAU90' ).setLogic( d.HA90 & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU8_UNPAIRED_ISO' ).setLogic( d.HA8 & unpaired_isocond ).setTriggerType( TT.calo ) @@ -491,25 +445,23 @@ class ItemDef: MenuItem('L1_EM15_TAU40_2TAU15' ).setLogic( d.EM15 & d.HA40 & d.HA15.x(2) & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM15_2TAU12_J25_2J15_3J12' ).setLogic( d.EM15 & d.HA12.x(2) & d.J25 & d.J15.x(2) & d.J12.x(3) & physcond).setTriggerType( TT.calo ) - if not isV6 and not isHI: - MenuItem('L1_EM15VHI_2TAU12' ).setLogic( d.EM15VHI & d.HA12.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI_2TAU12IL' ).setLogic( d.EM15VHI & d.HA12IL.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI_2TAU12IM' ).setLogic( d.EM15VHI & d.HA12IM.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI_TAU40_2TAU15' ).setLogic( d.EM15VHI & d.HA40 & d.HA15.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI_2TAU12I_J25_2J15_3J12' ).setLogic( d.EM15VHI & d.HA12I.x(2) & d.J25 & d.J15.x(2) & d.J12.x(3) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI_2TAU12IM_J25_3J12' ).setLogic( d.EM15VHI & d.HA12IM.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI_2TAU12IL_J25_3J12' ).setLogic( d.EM15VHI & d.HA12IL.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI_2TAU12_J25_3J12' ).setLogic( d.EM15VHI & d.HA12.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI_2TAU12IM_4J12' ).setLogic( d.EM15VHI & d.HA12IM.x(2) & d.J12.x(4) & physcond).setTriggerType( TT.calo ) - else: - MenuItem('L1_EM15HI_2TAU12' ).setLogic( d.EM15HI & d.HA12.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15HI_2TAU12IL' ).setLogic( d.EM15HI & d.HA12IL.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15HI_2TAU12IM' ).setLogic( d.EM15HI & d.HA12IM.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15HI_TAU40_2TAU15' ).setLogic( d.EM15HI & d.HA40 & d.HA15.x(2) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15HI_2TAU12I_J25_2J15_3J12' ).setLogic( d.EM15HI & d.HA12I.x(2) & d.J25 & d.J15.x(2) & d.J12.x(3) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15HI_2TAU12IM_J25_3J12' ).setLogic( d.EM15HI & d.HA12IM.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15HI_2TAU12IL_J25_3J12' ).setLogic( d.EM15HI & d.HA12IL.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15HI_2TAU12_J25_3J12' ).setLogic( d.EM15HI & d.HA12.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_2TAU12' ).setLogic( d.EM15VHI & d.HA12.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_2TAU12IL' ).setLogic( d.EM15VHI & d.HA12IL.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_2TAU12IM' ).setLogic( d.EM15VHI & d.HA12IM.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_TAU40_2TAU15' ).setLogic( d.EM15VHI & d.HA40 & d.HA15.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_2TAU12I_J25_2J15_3J12' ).setLogic( d.EM15VHI & d.HA12I.x(2) & d.J25 & d.J15.x(2) & d.J12.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_2TAU12IM_J25_3J12' ).setLogic( d.EM15VHI & d.HA12IM.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_2TAU12IL_J25_3J12' ).setLogic( d.EM15VHI & d.HA12IL.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_2TAU12_J25_3J12' ).setLogic( d.EM15VHI & d.HA12.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_2TAU12IM_4J12' ).setLogic( d.EM15VHI & d.HA12IM.x(2) & d.J12.x(4) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI_2TAU12' ).setLogic( d.EM15HI & d.HA12.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI_2TAU12IL' ).setLogic( d.EM15HI & d.HA12IL.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI_2TAU12IM' ).setLogic( d.EM15HI & d.HA12IM.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI_TAU40_2TAU15' ).setLogic( d.EM15HI & d.HA40 & d.HA15.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI_2TAU12I_J25_2J15_3J12' ).setLogic( d.EM15HI & d.HA12I.x(2) & d.J25 & d.J15.x(2) & d.J12.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI_2TAU12IM_J25_3J12' ).setLogic( d.EM15HI & d.HA12IM.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI_2TAU12IL_J25_3J12' ).setLogic( d.EM15HI & d.HA12IL.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI_2TAU12_J25_3J12' ).setLogic( d.EM15HI & d.HA12.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) MenuItem('L1_MU10_TAU12' ).setLogic( d.MU10 & d.HA12 & physcond).setTriggerType( TT.calo ) MenuItem('L1_MU10_TAU12I' ).setLogic( d.MU10 & d.HA12I & physcond).setTriggerType( TT.calo ) @@ -529,22 +481,19 @@ class ItemDef: MenuItem('L1_MU10_TAU12IM_J25_2J12' ).setLogic( d.MU10 & d.HA12IM & d.J25 & d.J12.x(2) & physcond).setTriggerType( TT.calo ) MenuItem('L1_MU10_TAU12IL_J25_2J12' ).setLogic( d.MU10 & d.HA12IL & d.J25 & d.J12.x(2) & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU12I_MU10_J20.31ETA49' ).setLogic( d.HA12I & d.MU10 & d.J2031ETA49 & physcond).setTriggerType( TT.calo ) - if not isV6 and not isHI: - MenuItem('L1_MU10_TAU12IM_3J12' ).setLogic( d.MU10 & d.HA12IM & d.J12.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_MU10_TAU12IM_3J12' ).setLogic( d.MU10 & d.HA12IM & d.J12.x(3) & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU20_2TAU12I_J25_2J15_3J12' ).setLogic( d.HA20 & d.HA12I.x(2) & d.J25 & d.J15.x(2) & d.J12.x(3) & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU20_2TAU12_J25_2J20_3J12' ).setLogic( d.HA20 & d.HA12.x(2) & d.J25 & d.J20.x(2) & d.J12.x(3) & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU20IM_2TAU12IM_J25_2J20_3J12').setLogic( d.HA20IM & d.HA12IM.x(2) & d.J25 & d.J20.x(2) & d.J12.x(3) & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU20IL_2TAU12IL_J25_2J20_3J12').setLogic( d.HA20IL & d.HA12IL.x(2) & d.J25 & d.J20.x(2) & d.J12.x(3) & physcond).setTriggerType( TT.calo ) - if isV6 or isHI: - MenuItem('L1_TAU25IT_2TAU12IT_2J25_3J12').setLogic( d.HA25IT & d.HA12IT.x(2) & d.J25.x(2) & d.J12.x(3) & physcond).setTriggerType( TT.calo ) - else: - MenuItem('L1_TAU25IM_2TAU12IM_J25_3J12' ).setLogic( d.HA25IM & d.HA12IM.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_TAU25IM_2TAU20IM_2J25_3J20').setLogic( d.HA25IM & d.HA20IM.x(2) & d.J25.x(2) & d.J20.x(3) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_TAU20IM_2TAU12IM_4J12').setLogic( d.HA20IM & d.HA12IM.x(2) & d.J12.x(4) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_TAU20IM_2TAU12IM_4J12.0ETA23').setLogic( d.HA20IM & d.HA12IM.x(2) & d.J120ETA23.x(4) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_TAU60_2TAU40').setLogic( d.HA60 & d.HA40.x(2) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_TAU25IT_2TAU12IT_2J25_3J12').setLogic( d.HA25IT & d.HA12IT.x(2) & d.J25.x(2) & d.J12.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_TAU25IM_2TAU12IM_J25_3J12' ).setLogic( d.HA25IM & d.HA12IM.x(2) & d.J25 & d.J12.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_TAU25IM_2TAU20IM_2J25_3J20').setLogic( d.HA25IM & d.HA20IM.x(2) & d.J25.x(2) & d.J20.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_TAU20IM_2TAU12IM_4J12').setLogic( d.HA20IM & d.HA12IM.x(2) & d.J12.x(4) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_TAU20IM_2TAU12IM_4J12.0ETA23').setLogic( d.HA20IM & d.HA12IM.x(2) & d.J120ETA23.x(4) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_TAU60_2TAU40').setLogic( d.HA60 & d.HA40.x(2) & physcond).setTriggerType( TT.calo ) MenuItem('L1_2TAU12I_TAU20_J25_2J15_3J12' ).setLogic( d.HA12I.x(2) & d.HA20 & d.J25 & d.J15.x(2) & d.J12.x(3) & physcond).setTriggerType( TT.calo ) ####### MenuItem('L1_2TAU20IM_3J20' ).setLogic( d.HA20IM.x(2) & d.J20.x(3) & physcond).setTriggerType( TT.calo ) @@ -559,8 +508,7 @@ class ItemDef: MenuItem('L1_TAU20_2TAU12_XE35' ).setLogic( d.HA20 & d.HA12.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU20IM_2TAU12IM_XE35' ).setLogic( d.HA20IM & d.HA12IM.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU20IL_2TAU12IL_XE35' ).setLogic( d.HA20IL & d.HA12IL.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) - if not isV8 : - MenuItem('L1_TAU20IT_2TAU12IT_XE35' ).setLogic( d.HA20IT & d.HA12IT.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_TAU20IT_2TAU12IT_XE35' ).setLogic( d.HA20IT & d.HA12IT.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU20IM_2TAU12IM_XE40' ).setLogic( d.HA20IM & d.HA12IM.x(2) & d.XE40 & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU40_2TAU12IM_XE40' ).setLogic( d.HA40 & d.HA12IM.x(2) & d.XE40 & physcond).setTriggerType( TT.calo ) MenuItem('L1_EM20VHI_TAU20IM_2TAU20_J25_3J20' ).setLogic( d.EM20VHI & d.HA20IM & d.HA20.x(2) & d.J25 & d.J20.x(3) & physcond).setTriggerType( TT.calo ) @@ -568,8 +516,7 @@ class ItemDef: MenuItem('L1_MU10_TAU12_XE35' ).setLogic( d.MU10 & d.HA12 & d.XE35 & physcond).setTriggerType( TT.calo ) MenuItem('L1_MU10_TAU12IL_XE35' ).setLogic( d.MU10 & d.HA12IL & d.XE35 & physcond).setTriggerType( TT.calo ) MenuItem('L1_MU10_TAU12IM_XE35' ).setLogic( d.MU10 & d.HA12IM & d.XE35 & physcond).setTriggerType( TT.calo ) - if not isV8 : - MenuItem('L1_MU10_TAU12IT_XE35' ).setLogic( d.MU10 & d.HA12IT & d.XE35 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_MU10_TAU12IT_XE35' ).setLogic( d.MU10 & d.HA12IT & d.XE35 & physcond).setTriggerType( TT.calo ) MenuItem('L1_MU10_TAU12IM_XE40' ).setLogic( d.MU10 & d.HA12IM & d.XE40 & physcond).setTriggerType( TT.calo ) MenuItem('L1_MU10_eTAU12IM_gXERHO35' ).setLogic( d.MU10 & d.eTAU12IM & d.gXERHO35 & physcond).setTriggerType( TT.calo ) MenuItem('L1_TAU20I_2TAU12I_XE35' ).setLogic( d.HA20I & d.HA12I.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) @@ -579,18 +526,17 @@ class ItemDef: MenuItem('L1_eTAU40_2eTAU12IM_gXERHO40' ).setLogic( d.eTAU40 & d.eTAU12IM.x(2) & d.gXERHO40 & physcond).setTriggerType( TT.calo ) MenuItem('L1_eTAU60_2eTAU40' ).setLogic( d.eTAU60 & d.eTAU40.x(2) & physcond).setTriggerType( TT.calo ) - if not isV6 and not isHI: - MenuItem('L1_EM15VHI_TAU20IM_2TAU15_J25_2J20_3J15' ).setLogic( d.EM15VHI & d.HA20IM & d.HA15.x(2) & d.J25 & d.J20.x(2) & d.J15.x(3) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI_2TAU12I_XE35' ).setLogic( d.EM15VHI & d.HA12I.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI_2TAU12IM_XE35' ).setLogic( d.EM15VHI & d.HA12IM.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI_2TAU12IL_XE35' ).setLogic( d.EM15VHI & d.HA12IL.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15VHI_2TAU12_XE35' ).setLogic( d.EM15VHI & d.HA12.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) - else: - MenuItem('L1_EM15HI_TAU20IM_2TAU15_J25_2J20_3J15' ).setLogic( d.EM15HI & d.HA20IM & d.HA15.x(2) & d.J25 & d.J20.x(2) & d.J15.x(3) & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15HI_2TAU12I_XE35' ).setLogic( d.EM15HI & d.HA12I.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15HI_2TAU12IM_XE35' ).setLogic( d.EM15HI & d.HA12IM.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15HI_2TAU12IL_XE35' ).setLogic( d.EM15HI & d.HA12IL.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) - MenuItem('L1_EM15HI_2TAU12_XE35' ).setLogic( d.EM15HI & d.HA12.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_TAU20IM_2TAU15_J25_2J20_3J15' ).setLogic( d.EM15VHI & d.HA20IM & d.HA15.x(2) & d.J25 & d.J20.x(2) & d.J15.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_2TAU12I_XE35' ).setLogic( d.EM15VHI & d.HA12I.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_2TAU12IM_XE35' ).setLogic( d.EM15VHI & d.HA12IM.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_2TAU12IL_XE35' ).setLogic( d.EM15VHI & d.HA12IL.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15VHI_2TAU12_XE35' ).setLogic( d.EM15VHI & d.HA12.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) + + MenuItem('L1_EM15HI_TAU20IM_2TAU15_J25_2J20_3J15').setLogic( d.EM15HI & d.HA20IM & d.HA15.x(2) & d.J25 & d.J20.x(2) & d.J15.x(3) & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI_2TAU12I_XE35' ).setLogic( d.EM15HI & d.HA12I.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI_2TAU12IM_XE35' ).setLogic( d.EM15HI & d.HA12IM.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI_2TAU12IL_XE35' ).setLogic( d.EM15HI & d.HA12IL.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) + MenuItem('L1_EM15HI_2TAU12_XE35' ).setLogic( d.EM15HI & d.HA12.x(2) & d.XE35 & physcond).setTriggerType( TT.calo ) # JET ctpid=[0x60:0x7f] MenuItem('L1_J5' ).setLogic( d.J5 & physcond).setTriggerType(TT.calo) @@ -733,13 +679,11 @@ class ItemDef: MenuItem('L1_3J15.0ETA25_XE40').setLogic( d.J150ETA25.x(3) & d.XE40 & physcond).setTriggerType(TT.calo) # combined em - jet - if not isV6 and not isHI: - MenuItem('L1_EM18VHI_3J20' ).setLogic( d.EM18VHI & d.J20.x(3) & physcond).setTriggerType(TT.calo) - MenuItem('L1_EM20VH_3J20' ).setLogic( d.EM20VH & d.J20.x(3) & physcond).setTriggerType(TT.calo) - else: - MenuItem('L1_EM13VH_3J20' ).setLogic( d.EM13VH & d.J20.x(3) & physcond).setTriggerType(TT.calo) - ### ATR-15524 - MenuItem('L1_EM18VH_3J20' ).setLogic( d.EM18VH & d.J20.x(3) & physcond).setTriggerType(TT.calo) + MenuItem('L1_EM18VHI_3J20' ).setLogic( d.EM18VHI & d.J20.x(3) & physcond).setTriggerType(TT.calo) + MenuItem('L1_EM20VH_3J20' ).setLogic( d.EM20VH & d.J20.x(3) & physcond).setTriggerType(TT.calo) + MenuItem('L1_EM13VH_3J20' ).setLogic( d.EM13VH & d.J20.x(3) & physcond).setTriggerType(TT.calo) + ### ATR-15524 + MenuItem('L1_EM18VH_3J20' ).setLogic( d.EM18VH & d.J20.x(3) & physcond).setTriggerType(TT.calo) # combined mu - jet MenuItem('L1_MU4_J12' ).setLogic( d.MU4 & d.J12 & physcond).setTriggerType(TT.calo) @@ -1550,31 +1494,24 @@ class ItemDef: #ATR-19355 - if isV8: - MenuItem('L1_BPH-0M10-3MU4' ).setLogic( d.TOPO_0INVM10_3MU4ab & physcond) + MenuItem('L1_BPH-0M10-3MU4' ).setLogic( d.TOPO_0INVM10_3MU4ab & physcond) #ATR-18815 - if isV8: - MenuItem('L1_LFV-EM8I-MU11' ).setLogic( d.TOPO_0INVM10_0DR15_EM8abi_MU10ab & d.MU11 & physcond) - MenuItem('L1_LFV-EM12I-MU6' ).setLogic( d.TOPO_0INVM10_0DR15_EM12abi_MU6ab & physcond) + MenuItem('L1_LFV-EM8I-MU11' ).setLogic( d.TOPO_0INVM10_0DR15_EM8abi_MU10ab & d.MU11 & physcond) + MenuItem('L1_LFV-EM12I-MU6' ).setLogic( d.TOPO_0INVM10_0DR15_EM12abi_MU6ab & physcond) #ATR-18824 - if isV8: - MenuItem('L1_ZAFB-04DPHI-EM15I' ).setLogic( d.TOPO_60INVM9999_04DPHI32_EM15abhi_FJj15s623ETA49 & physcond) - MenuItem('L1_ZAFB-25DPHI-EM15I' ).setLogic( d.TOPO_60INVM9999_25DPHI32_EM15abhi_FJj15s623ETA49 & physcond) - MenuItem('L1_ZAFB-25DPHI-EM18I' ).setLogic( d.TOPO_60INVM9999_25DPHI32_EM15abhi_FJj15s623ETA49 & d.EM18VHI & physcond) + MenuItem('L1_ZAFB-04DPHI-EM15I' ).setLogic( d.TOPO_60INVM9999_04DPHI32_EM15abhi_FJj15s623ETA49 & physcond) + MenuItem('L1_ZAFB-25DPHI-EM15I' ).setLogic( d.TOPO_60INVM9999_25DPHI32_EM15abhi_FJj15s623ETA49 & physcond) + MenuItem('L1_ZAFB-25DPHI-EM18I' ).setLogic( d.TOPO_60INVM9999_25DPHI32_EM15abhi_FJj15s623ETA49 & d.EM18VHI & physcond) #ATR-19302: - if isV8: - MenuItem('L1_DPHI-M70-2EM10I' ).setLogic( d.TOPO_0INVM70_27DPHI32_EM10his1_EM10his6 & physcond) - MenuItem('L1_DPHI-M70-2EM12I' ).setLogic( d.TOPO_0INVM70_27DPHI32_EM12his1_EM12his6 & physcond) + MenuItem('L1_DPHI-M70-2EM10I' ).setLogic( d.TOPO_0INVM70_27DPHI32_EM10his1_EM10his6 & physcond) + MenuItem('L1_DPHI-M70-2EM12I' ).setLogic( d.TOPO_0INVM70_27DPHI32_EM12his1_EM12his6 & physcond) #ATR-19510 - if isV8: - MenuItem('L1_DY-BOX-2MU4' ).setLogic( d.TOPO_5DETA99_5DPHI99_2MU4ab & d.MU4.x(2) & physcond) - + MenuItem('L1_DY-BOX-2MU4' ).setLogic( d.TOPO_5DETA99_5DPHI99_2MU4ab & d.MU4.x(2) & physcond) - #now also HI jets try: ### NOT WORKING due to accepted number of bits in TOPO1 MenuItem("L1_2MU4-BO" ).setLogic( d.R2TOPO_MULT_CMU4ab.x(2) & physcond) @@ -1633,54 +1570,49 @@ class ItemDef: MenuItem("L1_JPSI-1M5-EM7" ).setLogic( d.TOPO_1INVM5_EM7s1_EMs6 & physcond) MenuItem("L1_JPSI-1M5-EM12").setLogic( d.TOPO_1INVM5_EM12s1_EMs6 & physcond) - if not isV8: - MenuItem("L1_W-05DPHI-JXE-0" ).setLogic( d.TOPO_05MINDPHI_AJj10s6_XE0 & physcond) - MenuItem("L1_W-10DPHI-JXE-0" ).setLogic( d.TOPO_10MINDPHI_AJj10s6_XE0 & physcond) - MenuItem("L1_W-15DPHI-JXE-0" ).setLogic( d.TOPO_15MINDPHI_AJj10s6_XE0 & physcond) - MenuItem("L1_W-05DPHI-EMXE-1" ).setLogic( d.TOPO_05MINDPHI_EM12s6_XE0 & physcond) - MenuItem("L1_W-05DPHI-EM15XE-1" ).setLogic( d.TOPO_05MINDPHI_EM15s6_XE0 & physcond) - MenuItem("L1_W-15DPHI-EM15XE-1" ).setLogic( d.TOPO_15MINDPHI_EM15s6_XE0 & physcond) - MenuItem("L1_W-15DPHI-EMXE-1" ).setLogic( d.TOPO_15MINDPHI_EM12s6_XE0 & physcond) + #MenuItem("L1_W-05DPHI-JXE-0" ).setLogic( d.TOPO_05MINDPHI_AJj10s6_XE0 & physcond) + #MenuItem("L1_W-10DPHI-JXE-0" ).setLogic( d.TOPO_10MINDPHI_AJj10s6_XE0 & physcond) + #MenuItem("L1_W-15DPHI-JXE-0" ).setLogic( d.TOPO_15MINDPHI_AJj10s6_XE0 & physcond) + #MenuItem("L1_W-05DPHI-EMXE-1" ).setLogic( d.TOPO_05MINDPHI_EM12s6_XE0 & physcond) + #MenuItem("L1_W-05DPHI-EM15XE-1").setLogic( d.TOPO_05MINDPHI_EM15s6_XE0 & physcond) + #MenuItem("L1_W-15DPHI-EM15XE-1").setLogic( d.TOPO_15MINDPHI_EM15s6_XE0 & physcond) + #MenuItem("L1_W-15DPHI-EMXE-1" ).setLogic( d.TOPO_15MINDPHI_EM12s6_XE0 & physcond) + MenuItem("L1_W-05RO-XEHT-0" ).setLogic( d.R2TOPO_05RATIO_XE0_HT0_AJj15allETA49 & physcond) MenuItem("L1_W-90RO2-XEHT-0" ).setLogic( d.R2TOPO_90RATIO2_XE0_HT0_AJj15allETA49 & physcond) MenuItem("L1_W-250RO2-XEHT-0" ).setLogic( d.R2TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & physcond) MenuItem("L1_W-HT20-JJ15.ETA49").setLogic( d.R2TOPO_HT20_AJj15allETA49 & physcond) - if not isV8 and not isV7 and not isHIV5 and not isPhaseII: - MenuItem("L1_W-NOMATCH" ).setLogic( d.TOPO_NOT_02MATCH_EM10s1_AJj15allETA49 & physcond) - if not isV8: - MenuItem("L1_EM12_W-MT25").setLogic( d.TOPO_25MT_EM12s6_XE0 & d.EM12 & physcond) - MenuItem("L1_EM15_W-MT35").setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & physcond) - - MenuItem("L1_EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM15s6_XE0 & physcond) - MenuItem("L1_EM15_W-MT35_XS60_W-05DPHI-JXE-0_W-05DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.XS60 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM15s6_XE0 & physcond) - MenuItem("L1_EM15_W-MT35_XS40_W-05DPHI-JXE-0_W-05DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.XS40 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM15s6_XE0 & physcond) - MenuItem("L1_EM15_W-MT35_XS60").setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.XS60 & physcond) - - MenuItem("L1_EM15VH_W-MT35_XS60").setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15VH & d.XS60 & physcond) - MenuItem("L1_EM20VH_W-MT35_XS60").setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM20VH & d.XS60 & physcond) - MenuItem("L1_EM22VHI_W-MT35_XS40").setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM22VHI & d.XS40 & physcond) - - MenuItem("L1_EM12_W-MT35_XS40_W-05DPHI-JXE-0_W-05DPHI-EMXE" ).setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM12 & d.XS40 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM12s6_XE0 & physcond) - MenuItem("L1_EM12_W-MT35").setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM12 & physcond) - MenuItem("L1_EM12_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EMXE" ).setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM12 & d.TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM12s6_XE0 & physcond) - MenuItem("L1_EM12_W-MT35_XS50").setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM12 & d.XS50 & physcond) - MenuItem("L1_EM10VH_W-MT35_XS50").setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM10VH & d.XS50 & physcond) - MenuItem("L1_W-15DPHI-EM15XE-0" ).setLogic( d.TOPO_15MINDPHI_EM15s6_XE0 & physcond) - MenuItem("L1_EM15_W-MT35_W-250RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM15s6_XE0 & physcond) - MenuItem("L1_EM15_W-MT35_XS60_W-15DPHI-JXE-0_W-15DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.XS60 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM15s6_XE0 & physcond) - MenuItem("L1_EM15_W-MT35_XS40_W-15DPHI-JXE-0_W-15DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.XS40 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM15s6_XE0 & physcond) - MenuItem("L1_W-15DPHI-EMXE-0" ).setLogic( d.TOPO_15MINDPHI_EM12s6_XE0 & physcond) - MenuItem("L1_EM12_W-MT35_XS30_W-15DPHI-JXE-0_W-15DPHI-EMXE" ).setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM12 & d.XS30 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM12s6_XE0 & physcond) - MenuItem("L1_EM12_W-MT35_W-90RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EMXE" ).setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM12 & d.TOPO_90RATIO2_XE0_HT0_AJj15allETA49 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM12s6_XE0 & physcond) - # Old - MenuItem("L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_W-90RO2-XEHT-0" ).setLogic( d.TOPO_25MT_EM12s6_XE0 & d.EM12 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM12s6_XE0 & d.TOPO_90RATIO2_XE0_HT0_AJj15allETA49 & physcond) - MenuItem("L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS30" ).setLogic( d.TOPO_25MT_EM12s6_XE0 & d.EM12 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM12s6_XE0 & d.XS30 & physcond) - MenuItem("L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS20" ).setLogic( d.TOPO_25MT_EM12s6_XE0 & d.EM12 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM12s6_XE0 & d.XS20 & physcond) - MenuItem("L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE" ).setLogic( d.TOPO_25MT_EM12s6_XE0 & d.EM12 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM12s6_XE0 & physcond) - - - MenuItem("L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM15s6_XE0 & d.XS30 & physcond) - MenuItem("L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM15s6_XE0 & physcond) + + #MenuItem("L1_W-NOMATCH").setLogic( d.TOPO_NOT_02MATCH_EM10s1_AJj15allETA49 & physcond) + + #MenuItem("L1_EM12_W-MT25").setLogic( d.TOPO_25MT_EM12s6_XE0 & d.EM12 & physcond) + #MenuItem("L1_EM15_W-MT35").setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & physcond) + #MenuItem("L1_EM15_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM15s6_XE0 & physcond) + #MenuItem("L1_EM15_W-MT35_XS60_W-05DPHI-JXE-0_W-05DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.XS60 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM15s6_XE0 & physcond) + #MenuItem("L1_EM15_W-MT35_XS40_W-05DPHI-JXE-0_W-05DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.XS40 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM15s6_XE0 & physcond) + #MenuItem("L1_EM15_W-MT35_XS60").setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.XS60 & physcond) + #MenuItem("L1_EM15VH_W-MT35_XS60").setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15VH & d.XS60 & physcond) + #MenuItem("L1_EM20VH_W-MT35_XS60").setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM20VH & d.XS60 & physcond) + #MenuItem("L1_EM22VHI_W-MT35_XS40").setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM22VHI & d.XS40 & physcond) + #MenuItem("L1_EM12_W-MT35_XS40_W-05DPHI-JXE-0_W-05DPHI-EMXE" ).setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM12 & d.XS40 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM12s6_XE0 & physcond) + #MenuItem("L1_EM12_W-MT35").setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM12 & physcond) + #MenuItem("L1_EM12_W-MT35_W-250RO2-XEHT-0_W-05DPHI-JXE-0_W-05DPHI-EMXE" ).setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM12 & d.TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM12s6_XE0 & physcond) + #MenuItem("L1_EM12_W-MT35_XS50").setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM12 & d.XS50 & physcond) + #MenuItem("L1_EM10VH_W-MT35_XS50").setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM10VH & d.XS50 & physcond) + #MenuItem("L1_W-15DPHI-EM15XE-0" ).setLogic( d.TOPO_15MINDPHI_EM15s6_XE0 & physcond) + #MenuItem("L1_EM15_W-MT35_W-250RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.TOPO_250RATIO2_XE0_HT0_AJj15allETA49 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM15s6_XE0 & physcond) + #MenuItem("L1_EM15_W-MT35_XS60_W-15DPHI-JXE-0_W-15DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.XS60 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM15s6_XE0 & physcond) + #MenuItem("L1_EM15_W-MT35_XS40_W-15DPHI-JXE-0_W-15DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.XS40 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM15s6_XE0 & physcond) + #MenuItem("L1_W-15DPHI-EMXE-0" ).setLogic( d.TOPO_15MINDPHI_EM12s6_XE0 & physcond) + #MenuItem("L1_EM12_W-MT35_XS30_W-15DPHI-JXE-0_W-15DPHI-EMXE" ).setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM12 & d.XS30 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM12s6_XE0 & physcond) + #MenuItem("L1_EM12_W-MT35_W-90RO2-XEHT-0_W-15DPHI-JXE-0_W-15DPHI-EMXE" ).setLogic( d.TOPO_35MT_EM12s6_XE0 & d.EM12 & d.TOPO_90RATIO2_XE0_HT0_AJj15allETA49 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM12s6_XE0 & physcond) + ## Old + #MenuItem("L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_W-90RO2-XEHT-0" ).setLogic( d.TOPO_25MT_EM12s6_XE0 & d.EM12 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM12s6_XE0 & d.TOPO_90RATIO2_XE0_HT0_AJj15allETA49 & physcond) + #MenuItem("L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS30" ).setLogic( d.TOPO_25MT_EM12s6_XE0 & d.EM12 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM12s6_XE0 & d.XS30 & physcond) + #MenuItem("L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE_XS20" ).setLogic( d.TOPO_25MT_EM12s6_XE0 & d.EM12 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM12s6_XE0 & d.XS20 & physcond) + #MenuItem("L1_EM12_W-MT25_W-15DPHI-JXE-0_W-15DPHI-EMXE" ).setLogic( d.TOPO_25MT_EM12s6_XE0 & d.EM12 & d.TOPO_15MINDPHI_AJj10s6_XE0 & d.TOPO_15MINDPHI_EM12s6_XE0 & physcond) + #MenuItem("L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE_XS30" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM15s6_XE0 & d.XS30 & physcond) + #MenuItem("L1_EM15_W-MT35_W-05DPHI-JXE-0_W-05DPHI-EM15XE" ).setLogic( d.TOPO_35MT_EM15s6_XE0 & d.EM15 & d.TOPO_05MINDPHI_AJj10s6_XE0 & d.TOPO_05MINDPHI_EM15s6_XE0 & physcond) ##Combined L1Top MenuItem('L1_DR-MU10TAU12I_TAU12I-J25').setLogic( d.TOPO_0DR28_MU10ab_TAU12abi & d.TOPO_1DISAMB_TAU12abi_J25ab & d.MU10 & physcond) @@ -1707,12 +1639,10 @@ class ItemDef: MenuItem('L1_XE35_MJJ-200').setLogic( d.XE35 & d.R2TOPO_200INVM9999_AJ30s6_AJ20s6 & physcond) ### ATR-15062 - if not isV6 and not isHI: - MenuItem('L1_EM18VHI_MJJ-300').setLogic( d.EM18VHI & d.TOPO_300INVM9999_AJ30s6_AJ20s6 & physcond) - else: - MenuItem('L1_EM18VH_MJJ-300').setLogic( d.EM18VH & d.TOPO_300INVM9999_AJ30s6_AJ20s6 & physcond) - # CTP items for L1Topo streamers + MenuItem('L1_EM18VHI_MJJ-300').setLogic( d.EM18VHI & d.TOPO_300INVM9999_AJ30s6_AJ20s6 & physcond) + MenuItem('L1_EM18VH_MJJ-300').setLogic( d.EM18VH & d.TOPO_300INVM9999_AJ30s6_AJ20s6 & physcond) + # CTP items for L1Topo streamers MenuItem('L1_DY-DR-2MU4').setLogic( d.R2TOPO_2DR99_2MU4ab & physcond) MenuItem('L1_DY-BOX-MU6MU4').setLogic( d.TOPO_5DETA99_5DPHI99_MU6ab_MU4ab & d.MU6 & physcond) MenuItem('L1_DY-BOX-2MU6').setLogic( d.TOPO_5DETA99_5DPHI99_2MU6ab & d.MU6.x(2) & physcond) @@ -1720,14 +1650,14 @@ class ItemDef: MenuItem('L1_LFV-MU11').setLogic( d.TOPO_0DR15_2MU6ab & d.MU11 & d.MU6.x(2) & physcond) MenuItem('L1_LFV-MU6').setLogic( d.TOPO_0DR15_2MU6ab & d.MU6.x(2) & physcond) MenuItem('L1_LFV-MU').setLogic( d.R2TOPO_0DR10_MU10ab_MU6ab & d.MU10 & d.MU6.x(2) & physcond) - if not isV8 and not isV7 and not isHIV5 and not isPhaseII: - MenuItem('L1_LFV-EM8I').setLogic( d.TOPO_0DETA04_0DPHI03_EM8abi_MU10ab & physcond) - else: + + if isV8 or isHIV5 or isPhaseII: MenuItem('L1_LFV-EM8I').setLogic( d.TOPO_0DETA04_EM8abi_MU10ab & d.TOPO_0DPHI03_EM8abi_MU10ab & d.MU10 & physcond) #ATR-14282 - if not isV8 and not isV7 and not isHIV5 and not isPhaseII: - MenuItem('L1_LFV-EM15I').setLogic( d.TOPO_0DETA04_0DPHI03_EM15abi_MUab & physcond) - else: MenuItem('L1_LFV-EM15I').setLogic( d.TOPO_0DETA04_EM15abi_MUab & d.TOPO_0DPHI03_EM15abi_MUab & physcond) #ATR-14282 + else: + MenuItem('L1_LFV-EM8I').setLogic( d.TOPO_0DETA04_0DPHI03_EM8abi_MU10ab & physcond) + MenuItem('L1_LFV-EM15I').setLogic( d.TOPO_0DETA04_0DPHI03_EM15abi_MUab & physcond) + MenuItem('L1_DPHI-J20s2XE50').setLogic( d.TOPO_10MINDPHI_J20s2_XE50 & physcond) MenuItem('L1_DPHI-J20XE50').setLogic( d.R2TOPO_10MINDPHI_J20ab_XE50 & physcond) MenuItem('L1_DPHI-CJ20XE50').setLogic( d.R2TOPO_10MINDPHI_CJ20ab_XE50 & physcond) @@ -1739,19 +1669,19 @@ class ItemDef: MenuItem('L1_MJJ-300').setLogic( d.TOPO_300INVM9999_AJ30s6_AJ20s6 & physcond) MenuItem('L1_MJJ-200').setLogic( d.R2TOPO_200INVM9999_AJ30s6_AJ20s6 & physcond) MenuItem('L1_MJJ-100').setLogic( d.R2TOPO_100INVM9999_AJ30s6_AJ20s6 & physcond) - if isV8 or isV7 or isHIV5 or isPhaseII: - MenuItem('L1_MJJ-600-NFF').setLogic( d.R2TOPO_600INVM9999_J30s6_AJ20s6 & physcond) - MenuItem('L1_MJJ-500-NFF').setLogic( d.TOPO_500INVM9999_J30s6_AJ20s6 & physcond) - MenuItem('L1_MJJ-400-NFF').setLogic( d.R2TOPO_400INVM9999_J30s6_AJ20s6 & physcond) - MenuItem('L1_MJJ-200-NFF').setLogic( d.R2TOPO_200INVM9999_J30s6_AJ20s6 & physcond) - MenuItem('L1_63DETA-J30J15').setLogic( d.R2TOPO_63DETA127_FJ20s1_FJ20s2 & physcond) - MenuItem('L1_J50_DETA20-J50J').setLogic( d.J50 & d.TOPO_0DETA20_J50s1_Js2 & physcond) - MenuItem('L1_DPHI-2EM3').setLogic( d.TOPO_27DPHI32_EMs1_EMs6 & physcond) - MenuItem('L1_DPHI-2EM3_VTE5.24ETA49').setLogic( d.TOPO_27DPHI32_EMs1_EMs6 & Not(d.TE524ETA49) & physcond).setTriggerType(TT.calo) - MenuItem('L1_DPHI-2EM3_VTE5.24ETA49_ALFA_EINE').setLogic( d.TOPO_27DPHI32_EMs1_EMs6 & Not(d.TE524ETA49) & ALFA_EINE & physcond).setTriggerType(TT.alfa) - MenuItem('L1_DPHI-2EM3_VTE10').setLogic( d.TOPO_27DPHI32_EMs1_EMs6 & Not(d.TE10) & physcond).setTriggerType(TT.calo) - MenuItem('L1_DPHI-2EM7_VTE50').setLogic( d.EM7.x(2) & d.TOPO_27DPHI32_EMs1_EMs6 & Not(d.TE50) & physcond).setTriggerType(TT.calo) + MenuItem('L1_MJJ-600-NFF').setLogic( d.R2TOPO_600INVM9999_J30s6_AJ20s6 & physcond) + MenuItem('L1_MJJ-500-NFF').setLogic( d.TOPO_500INVM9999_J30s6_AJ20s6 & physcond) + MenuItem('L1_MJJ-400-NFF').setLogic( d.R2TOPO_400INVM9999_J30s6_AJ20s6 & physcond) + MenuItem('L1_MJJ-200-NFF').setLogic( d.R2TOPO_200INVM9999_J30s6_AJ20s6 & physcond) + MenuItem('L1_63DETA-J30J15').setLogic( d.R2TOPO_63DETA127_FJ20s1_FJ20s2 & physcond) + MenuItem('L1_J50_DETA20-J50J').setLogic( d.J50 & d.TOPO_0DETA20_J50s1_Js2 & physcond) + MenuItem('L1_DPHI-2EM3').setLogic( d.TOPO_27DPHI32_EMs1_EMs6 & physcond) + MenuItem('L1_DPHI-2EM3_VTE5.24ETA49').setLogic( d.TOPO_27DPHI32_EMs1_EMs6 & Not(d.TE524ETA49) & physcond).setTriggerType(TT.calo) + MenuItem('L1_DPHI-2EM3_VTE5.24ETA49_ALFA_EINE').setLogic( d.TOPO_27DPHI32_EMs1_EMs6 & Not(d.TE524ETA49) & ALFA_EINE & physcond).setTriggerType(TT.alfa) + MenuItem('L1_DPHI-2EM3_VTE10').setLogic( d.TOPO_27DPHI32_EMs1_EMs6 & Not(d.TE10) & physcond).setTriggerType(TT.calo) + MenuItem('L1_DPHI-2EM7_VTE50').setLogic( d.EM7.x(2) & d.TOPO_27DPHI32_EMs1_EMs6 & Not(d.TE50) & physcond).setTriggerType(TT.calo) + MenuItem('L1_HT150-JJ15.ETA49').setLogic( d.R2TOPO_HT150_AJj15allETA49 & physcond) MenuItem('L1_HT150-JJ15.ETA49_MJJ-400').setLogic( d.R2TOPO_HT150_AJj15allETA49 & d.R2TOPO_400INVM9999_AJ30s6_AJ20s6 & physcond) @@ -1774,29 +1704,23 @@ class ItemDef: MenuItem('L1_MJJ-400-CF').setLogic( d.TOPO_400INVM9999_AJ30s6ETA31_AJ20s631ETA49 & physcond) MenuItem('L1_DR-TAU20ITAU12I').setLogic( d.TOPO_0DR28_TAU20abi_TAU12abi & physcond) MenuItem('L1_BOX-TAU20ITAU12I').setLogic( d.R2TOPO_0DETA20_0DPHI20_TAU20abi_TAU12abi & physcond) + if isV8: MenuItem('L1_DR-TAU20ITAU12I-J25').setLogic( d.TOPO_2DISAMB_J25ab_0DR28_TAU20abi_TAU12abi & physcond) else: MenuItem('L1_DR-TAU20ITAU12I-J25').setLogic( d.TOPO_1DISAMB_J25ab_0DR28_TAU20abi_TAU12abi & physcond) + MenuItem('L1_DR25-TAU20ITAU12I-J25').setLogic( d.R2TOPO_1DISAMB_J25ab_0DR25_TAU20abi_TAU12abi & physcond) MenuItem('L1_LAR-EM').setLogic( d.R2TOPO_LAR_EM20shi1 & physcond).setTriggerType( TT.lardemo ) # LAr demo (ATR-11897) MenuItem('L1_LAR-J').setLogic( d.R2TOPO_LAR_J100s1 & physcond).setTriggerType( TT.lardemo ) # LAr demo (ATR-11897) - if isV8 or isV7 or isHIV5 or isPhaseII: - MenuItem('L1_LAR-ZEE').setLogic( d.R2TOPO_ZEE_EM20shi2 & physcond).setTriggerType( TT.calo ) # LAr demo (ATR-11897) - MenuItem('L1_LAR-ZEE_LAR-EM').setLogic( d.R2TOPO_ZEE_EM20shi2 & d.R2TOPO_LAR_EM20shi1 &physcond).setTriggerType( TT.lardemo ) - if not isV8: - MenuItem('L1_KF-XE40').setLogic( d.TOPO_KF_XE40_AJall & physcond) - MenuItem('L1_KF-XE50').setLogic( d.TOPO_KF_XE50_AJall & physcond) - MenuItem('L1_KF-XE55').setLogic( d.TOPO_KF_XE55_AJall & physcond) - MenuItem('L1_KF-XE60').setLogic( d.TOPO_KF_XE60_AJall & physcond) - MenuItem('L1_KF-XE65').setLogic( d.TOPO_KF_XE65_AJall & physcond) - MenuItem('L1_KF-XE75').setLogic( d.TOPO_KF_XE75_AJall & physcond) - if isV8: - MenuItem('L1_MJJ-400-NFF-0DPHI20').setLogic( d.TOPO_400INVM9999_0DPHI20_J30s6_AJ20s6 & physcond) - MenuItem('L1_MJJ-400-NFF-0DPHI22').setLogic( d.TOPO_400INVM9999_0DPHI22_J30s6_AJ20s6 & physcond) - MenuItem('L1_MJJ-400-NFF-0DPHI24').setLogic( d.TOPO_400INVM9999_0DPHI24_J30s6_AJ20s6 & physcond) - MenuItem('L1_MJJ-400-NFF-0DPHI26').setLogic( d.TOPO_400INVM9999_0DPHI26_J30s6_AJ20s6 & physcond) + MenuItem('L1_LAR-ZEE').setLogic( d.R2TOPO_ZEE_EM20shi2 & physcond).setTriggerType( TT.calo ) # LAr demo (ATR-11897) + MenuItem('L1_LAR-ZEE_LAR-EM').setLogic( d.R2TOPO_ZEE_EM20shi2 & d.R2TOPO_LAR_EM20shi1 &physcond).setTriggerType( TT.lardemo ) + + MenuItem('L1_MJJ-400-NFF-0DPHI20').setLogic( d.TOPO_400INVM9999_0DPHI20_J30s6_AJ20s6 & physcond) + MenuItem('L1_MJJ-400-NFF-0DPHI22').setLogic( d.TOPO_400INVM9999_0DPHI22_J30s6_AJ20s6 & physcond) + MenuItem('L1_MJJ-400-NFF-0DPHI24').setLogic( d.TOPO_400INVM9999_0DPHI24_J30s6_AJ20s6 & physcond) + MenuItem('L1_MJJ-400-NFF-0DPHI26').setLogic( d.TOPO_400INVM9999_0DPHI26_J30s6_AJ20s6 & physcond) MenuItem('L1_BPH-2M8-2MU4_BPH-0DR15-2MU4' ).setLogic( d.R2TOPO_2INVM8_2MU4ab & d.R2TOPO_0DR15_2MU4ab & physcond) # 78% for Bs,J/psi MenuItem('L1_BPH-2M9-2MU4_BPH-0DR15-2MU4' ).setLogic( d.R2TOPO_2INVM9_2MU4ab & d.R2TOPO_0DR15_2MU4ab & physcond) # 78% for Bs,J/psi @@ -1805,12 +1729,11 @@ class ItemDef: MenuItem('L1_BPH-2M9-MU6MU4_BPH-0DR15-MU6MU4' ).setLogic( d.R2TOPO_2INVM9_MU6ab_MU4ab & d.R2TOPO_0DR15_MU6ab_MU4ab & d.MU6 & physcond) #ATR-19720 - if isV8: - MenuItem('L1_BPH-8M15-0DR22-2MU6' ).setLogic( d.TOPO_8INVM15_0DR22_2MU6ab & d.MU6.x(2) & physcond) - MenuItem('L1_BPH-2M9-2DR15-2MU6' ).setLogic( d.TOPO_2INVM9_2DR15_2MU6ab & d.MU6.x(2) & physcond) - MenuItem('L1_BPH-2M9-0DR15-MU6MU4' ).setLogic( d.TOPO_2INVM9_0DR15_MU6ab_MU4ab & d.MU6 & physcond) - MenuItem('L1_BPH-8M15-0DR22-MU6MU4-BO').setLogic( d.TOPO_8INVM15_0DR22_MU6ab_MU4ab & d.R2TOPO_MULT_CMU4ab.x(2) & d.R2TOPO_MULT_CMU6ab & d.MU6 & physcond) - MenuItem('L1_BPH-2M9-0DR15-2MU4' ).setLogic( d.TOPO_2INVM9_0DR15_2MU4ab & physcond) + MenuItem('L1_BPH-8M15-0DR22-2MU6' ).setLogic( d.TOPO_8INVM15_0DR22_2MU6ab & d.MU6.x(2) & physcond) + MenuItem('L1_BPH-2M9-2DR15-2MU6' ).setLogic( d.TOPO_2INVM9_2DR15_2MU6ab & d.MU6.x(2) & physcond) + MenuItem('L1_BPH-2M9-0DR15-MU6MU4' ).setLogic( d.TOPO_2INVM9_0DR15_MU6ab_MU4ab & d.MU6 & physcond) + MenuItem('L1_BPH-8M15-0DR22-MU6MU4-BO').setLogic( d.TOPO_8INVM15_0DR22_MU6ab_MU4ab & d.R2TOPO_MULT_CMU4ab.x(2) & d.R2TOPO_MULT_CMU6ab & d.MU6 & physcond) + MenuItem('L1_BPH-2M9-0DR15-2MU4' ).setLogic( d.TOPO_2INVM9_0DR15_2MU4ab & physcond) MenuItem('L1_BPH-8M15-MU6MU4_BPH-0DR22-MU6MU4').setLogic( d.R2TOPO_8INVM15_MU6ab_MU4ab & d.R2TOPO_0DR22_MU6ab_MU4ab & d.MU6 & physcond) # 86% for Upsi MenuItem('L1_BPH-2M9-2MU6_BPH-2DR15-2MU6' ).setLogic( d.R2TOPO_2INVM9_2MU6ab & d.R2TOPO_2DR15_2MU6ab & d.MU6.x(2) & physcond) # 96% for Bs,J/psi @@ -1818,13 +1741,12 @@ class ItemDef: MenuItem('L1_BPH-8M15-2MU6_BPH-0DR22-2MU6' ).setLogic( d.R2TOPO_8INVM15_2MU6ab & d.R2TOPO_0DR22_2MU6ab & d.MU6.x(2) & physcond) # 96% for Upsi -# Barrel and BarrelOnly items w/o topo selection + # Barrel and BarrelOnly items w/o topo selection MenuItem('L1_2MU4-B' ).setLogic( d.MU4.x(2) & d.R2TOPO_MULT_CMU4ab & physcond) # 2MU4_Barrel MenuItem('L1_2MU6-B' ).setLogic( d.MU6.x(2) & d.R2TOPO_MULT_CMU6ab & physcond) # 2MU6_Barrel MenuItem('L1_MU6_2MU4-B').setLogic( d.MU6 & d.MU4.x(2) & d.R2TOPO_MULT_CMU4ab & physcond) # MU6_2MU4_Barrel, -# Barrel and BarrelOnly variants of L1Topo items - + # Barrel and BarrelOnly variants of L1Topo items MenuItem('L1_BPH-2M8-2MU4-B_BPH-0DR15-2MU4' ).setLogic( d.R2TOPO_2INVM8_CMU4ab_MU4ab & d.R2TOPO_0DR15_2MU4ab & physcond) # 78% for Bs,J/psi + OneBarrel MenuItem('L1_BPH-7M15-2MU4_BPH-0DR24-2MU4-B' ).setLogic( d.R2TOPO_7INVM15_2MU4ab & d.R2TOPO_0DR24_2MU4ab & d.R2TOPO_MULT_CMU4ab & physcond) # 78% for Upsi + OneBarrel MenuItem('L1_BPH-7M15-2MU4_BPH-0DR24-2MU4-BO' ).setLogic( d.R2TOPO_7INVM15_2MU4ab & d.R2TOPO_0DR24_2CMU4ab & physcond) # 78% for Upsi + BarrelOnly @@ -1832,39 +1754,33 @@ class ItemDef: MenuItem('L1_BPH-8M15-MU6MU4_BPH-0DR22-MU6MU4-B').setLogic( d.R2TOPO_8INVM15_MU6ab_MU4ab & d.R2TOPO_0DR22_MU6ab_MU4ab & d.R2TOPO_MULT_CMU4ab & d.MU6 & physcond) MenuItem('L1_BPH-8M15-MU6MU4_BPH-0DR22-MU6MU4-BO').setLogic( d.R2TOPO_8INVM15_MU6ab_MU4ab & d.R2TOPO_0DR22_MU6ab_MU4ab & d.R2TOPO_MULT_CMU4ab.x(2) & d.R2TOPO_MULT_CMU6ab & d.MU6 & physcond) + MenuItem('L1_BPH-2M8-2MU4').setLogic( d.R2TOPO_2INVM8_2MU4ab & physcond) # backup 71% for Bs,J/psi + MenuItem('L1_BPH-8M15-MU6MU4').setLogic( d.R2TOPO_8INVM15_MU6ab_MU4ab & d.MU6 & physcond) # backup 71% for Upsi + MenuItem('L1_BPH-8M15-2MU6').setLogic( d.R2TOPO_8INVM15_2MU6ab & d.MU6.x(2) & physcond) # backup 95% for Upsi - MenuItem('L1_BPH-2M8-2MU4' ).setLogic( d.R2TOPO_2INVM8_2MU4ab & physcond) # backup 71% for Bs,J/psi - MenuItem('L1_BPH-8M15-MU6MU4' ).setLogic( d.R2TOPO_8INVM15_MU6ab_MU4ab & d.MU6 & physcond) # backup 71% for Upsi - MenuItem('L1_BPH-8M15-2MU6' ).setLogic( d.R2TOPO_8INVM15_2MU6ab & d.MU6.x(2) & physcond) # backup 95% for Upsi - - if isV8 or isV7 or isHIV5 or isPhaseII: - MenuItem('L1_BPH-0M9-EM7-EM5' ).setLogic( d.TOPO_0INVM9_EM7ab_EMab & physcond) - MenuItem('L1_BPH-0DR3-EM7J15').setLogic( d.TOPO_0DR03_EM7ab_CJ15ab & physcond) - MenuItem('L1_BPH-0M9-EM7-EM5_MU6' ).setLogic( d.MU6 & d.TOPO_0INVM9_EM7ab_EMab & physcond) - MenuItem('L1_BPH-0DR3-EM7J15_MU6').setLogic( d.MU6 &d.TOPO_0DR03_EM7ab_CJ15ab & physcond) - MenuItem('L1_BPH-0M9-EM7-EM5_2MU4' ).setLogic( d.MU4.x(2) & d.TOPO_0INVM9_EM7ab_EMab & physcond) - MenuItem('L1_BPH-0DR3-EM7J15_2MU4').setLogic( d.MU4.x(2) & d.TOPO_0DR03_EM7ab_CJ15ab & physcond) - MenuItem('L1_BPH-0M9-EM7-EM5_MU4' ).setLogic( d.MU4 & d.TOPO_0INVM9_EM7ab_EMab & physcond) - MenuItem('L1_BPH-0DR3-EM7J15_MU4').setLogic( d.MU4 &d.TOPO_0DR03_EM7ab_CJ15ab & physcond) - -#SX end ATR-12789 + MenuItem('L1_BPH-0M9-EM7-EM5').setLogic( d.TOPO_0INVM9_EM7ab_EMab & physcond) + MenuItem('L1_BPH-0DR3-EM7J15').setLogic( d.TOPO_0DR03_EM7ab_CJ15ab & physcond) + MenuItem('L1_BPH-0M9-EM7-EM5_MU6').setLogic( d.MU6 & d.TOPO_0INVM9_EM7ab_EMab & physcond) + MenuItem('L1_BPH-0DR3-EM7J15_MU6').setLogic( d.MU6 &d.TOPO_0DR03_EM7ab_CJ15ab & physcond) + MenuItem('L1_BPH-0M9-EM7-EM5_2MU4').setLogic( d.MU4.x(2) & d.TOPO_0INVM9_EM7ab_EMab & physcond) + MenuItem('L1_BPH-0DR3-EM7J15_2MU4').setLogic( d.MU4.x(2) & d.TOPO_0DR03_EM7ab_CJ15ab & physcond) + MenuItem('L1_BPH-0M9-EM7-EM5_MU4').setLogic( d.MU4 & d.TOPO_0INVM9_EM7ab_EMab & physcond) + MenuItem('L1_BPH-0DR3-EM7J15_MU4').setLogic( d.MU4 &d.TOPO_0DR03_EM7ab_CJ15ab & physcond) + #SX end ATR-12789 MenuItem('L1_LATE-MU10_XE50').setLogic( d.TOPO_LATE_MU10s1 & d.XE50 & physcond) MenuItem('L1_LATE-MU10_XE40').setLogic( d.TOPO_LATE_MU10s1 & d.XE40 & physcond) MenuItem('L1_LATE-MU10_J50').setLogic( d.TOPO_LATE_MU10s1 & d.J50 & physcond) - if isV8 or isV7 or isHIV5 or isPhaseII: - MenuItem('L1_SC111-CJ15').setLogic( d.TOPO_SC111_CJ15abETA26 & physcond) - MenuItem('L1_SC85-CJ15').setLogic( d.R2TOPO_SC85_CJ15abETA26 & physcond) - else: - MenuItem('L1_SC111').setLogic( d.TOPO_SC111_CJ15abETA26 & physcond) - MenuItem('L1_SC85').setLogic( d.TOPO_SC85_CJ15abETA26 & physcond) + MenuItem('L1_SC111-CJ15').setLogic( d.TOPO_SC111_CJ15abETA26 & physcond) + MenuItem('L1_SC85-CJ15').setLogic( d.R2TOPO_SC85_CJ15abETA26 & physcond) + + MenuItem('L1_TAU60_DR-TAU20ITAU12I' ).setLogic( d.HA60 & d.TOPO_0DR28_TAU20abi_TAU12abi & physcond) + + MenuItem('L1_CEP-CJ60').setLogic( d.TOPO_CEP_CJ60s6 & physcond ) + MenuItem('L1_CEP-CJ50').setLogic( d.TOPO_CEP_CJ50s6 & physcond ) + MenuItem('L1_CEP-CJ50.ETA21').setLogic( d.TOPO_CEP_CJ50s6ETA21 & physcond ) - x = MenuItem('L1_TAU60_DR-TAU20ITAU12I' ).setLogic( d.HA60 & d.TOPO_0DR28_TAU20abi_TAU12abi & physcond) - if isV8: - MenuItem('L1_CEP-CJ60').setLogic( d.TOPO_CEP_CJ60s6 & physcond ) - MenuItem('L1_CEP-CJ50').setLogic( d.TOPO_CEP_CJ50s6 & physcond ) - MenuItem('L1_CEP-CJ50.ETA21').setLogic( d.TOPO_CEP_CJ50s6ETA21 & physcond ) except NameError as ex: exc_type, exc_value, exc_traceback = sys.exc_info() fn,ln,_,_ = traceback.extract_tb(exc_traceback)[0] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ThresholdDefLegacy.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ThresholdDefLegacy.py index ff0dde5e44b457e68b76ca6f59a8f81f89032d71..5ba79fdd298a463e06004c976c3b1ad4a7f5d100 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ThresholdDefLegacy.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/ThresholdDefLegacy.py @@ -11,230 +11,205 @@ class ThresholdDefLegacy: @staticmethod def registerThresholds(tc, menuName): - isV6 = '_v6' in menuName - isV8 = '_v8' in menuName or 'LS2_v1' == menuName or 'run3_v1' in menuName - isHI = '_HI' in menuName and 'HI_run3_v1' not in menuName - + # dear Menu Experts, please note that it is only necessary to + # check the menu name if a certain threshold has different + # definitions in different menus if ThresholdDefLegacy.alreadyExecuted: return ThresholdDefLegacy.alreadyExecuted = True - # EM + # EM + ThresholdValue.setDefaults('EM',{'isobits' : '00000', 'use_relIso' : True }) - for thrV in [3, 4, 5, 6, 7, 8, 10, 12, 14, 15, 16, 18, 20, 22, 30, 50]: + for thrV in [3, 5, 7, 8, 10, 12, 14, 15, 16, 18, 20, 22]: LegacyThreshold('EM%i' % thrV, 'EM').addThrValue(thrV) # for beam splashes: - #ThresholdValue.setDefaults('EM', {'etamin' : 16,'etamax' : 20, 'phimin' : 0,'phimax' : 64, 'isobits' : '00000', 'use_relIso' : True }) - LegacyThreshold('EM20A', 'EM').addThrValue(255, priority=1)\ - .addThrValue(20,16,20,priority=2) - - #ThresholdValue.setDefaults('EM', {'etamin' : -20,'etamax' : -16, 'phimin' : 0,'phimax' : 64, 'isobits' : '00000', 'use_relIso' : True }) - LegacyThreshold('EM20C', 'EM').addThrValue(255, priority=1)\ - .addThrValue(20,-20,-16,priority=2) - - + LegacyThreshold('EM20A', 'EM').addThrValue(255, priority=1).addThrValue(20,16,20,priority=2) + LegacyThreshold('EM20C', 'EM').addThrValue(255, priority=1).addThrValue(20,-20,-16,priority=2) # variable thresholds (V) # hadronic isolation (H) had_isolation=1GeV # em isolation (I) - # V section - - LegacyThreshold( 'EM50V', 'EM').addThrValue(52, priority=1)\ - .addThrValue(51, -12, -8, priority=2).addThrValue(51, 8, 12, priority=2)\ - .addThrValue(50, -16, -13, priority=2).addThrValue(50, 13, 16, priority=2)\ - .addThrValue(51, -20, -17, priority=2).addThrValue(51, 17, 20, priority=2) + # I section + + ThresholdValue.setDefaults('EM', {'isobits' : '00010', 'use_relIso' : True }) + + for thrV in [8]: + LegacyThreshold('EM%iI' % thrV, 'EM').addThrValue(thrV) # VH section ThresholdValue.setDefaults('EM', {'isobits' : '00001', 'use_relIso' : True }) LegacyThreshold( 'EM8VH', 'EM').addThrValue(9, priority=1)\ - .addThrValue(9, -8, 8, priority=2)\ - .addThrValue(7, -11, -9, priority=2).addThrValue(7, 9, 11, priority=2)\ - .addThrValue(6, -14, -12, priority=2).addThrValue(6, 12, 14, priority=2)\ - .addThrValue(5, -15, -15, priority=2).addThrValue(5, 15, 15, priority=2)\ - .addThrValue(7, -18, -16, priority=2).addThrValue(7, 16, 18, priority=2)\ - .addThrValue(8, -25, -19, priority=2).addThrValue(8, 19, 25, priority=2) - - LegacyThreshold( 'EM10VH', 'EM').addThrValue(11, priority=1)\ - .addThrValue(11, -8, 8, priority=2)\ - .addThrValue(9, -11, -9, priority=2).addThrValue(9, 9, 11, priority=2)\ - .addThrValue(8, -14, -12, priority=2).addThrValue(8, 12, 14, priority=2)\ - .addThrValue(7, -15, -15, priority=2).addThrValue(7, 15, 15, priority=2)\ - .addThrValue(9, -18, -16, priority=2).addThrValue(9, 16, 18, priority=2)\ - .addThrValue(10, -25, -19, priority=2).addThrValue(10, 19, 25, priority=2) - - #ATR-19302 - if isV8: - LegacyThreshold( 'EM10VHI', 'EM').addThrValue(11, priority=1)\ - .addThrValue(11, -8, 8, priority=2)\ - .addThrValue(9, -11, -9, priority=2).addThrValue(9, 9, 11, priority=2)\ - .addThrValue(8, -14, -12, priority=2).addThrValue(8, 12, 14, priority=2)\ - .addThrValue(7, -15, -15, priority=2).addThrValue(7, 15, 15, priority=2)\ - .addThrValue(9, -18, -16, priority=2).addThrValue(9, 16, 18, priority=2)\ - .addThrValue(10, -25, -19, priority=2).addThrValue(10, 19, 25, priority=2) - - LegacyThreshold( 'EM13VH', 'EM').addThrValue(15, priority=1)\ - .addThrValue(15, -7, 7, priority=2)\ - .addThrValue(14, -9, -8, priority=2).addThrValue(14, 8, 9, priority=2)\ - .addThrValue(13, -12, -10, priority=2).addThrValue(13, 10, 12, priority=2)\ - .addThrValue(12, -14, -13, priority=2).addThrValue(12, 13, 14, priority=2)\ - .addThrValue(11, -15, -15, priority=2).addThrValue(11, 15, 15, priority=2)\ - .addThrValue(13, -17, -16, priority=2).addThrValue(13, 16, 17, priority=2)\ - .addThrValue(14, -25, -18, priority=2).addThrValue(14, 18, 25, priority=2) - - LegacyThreshold( 'EM15VH', 'EM').addThrValue(17, priority=1)\ - .addThrValue(17, -7, 7, priority=2)\ - .addThrValue(16, -9, -8, priority=2).addThrValue(16, 8, 9, priority=2)\ - .addThrValue(15, -12, -10, priority=2).addThrValue(15, 10, 12, priority=2)\ - .addThrValue(14, -14, -13, priority=2).addThrValue(14, 13, 14, priority=2)\ - .addThrValue(13, -15, -15, priority=2).addThrValue(13, 15, 15, priority=2)\ - .addThrValue(15, -17, -16, priority=2).addThrValue(15, 16, 17, priority=2)\ - .addThrValue(16, -25, -18, priority=2).addThrValue(16, 18, 25, priority=2) - - LegacyThreshold( 'EM18VH', 'EM').addThrValue(20, priority=1)\ - .addThrValue(20, -7, 7, priority=2)\ - .addThrValue(19, -8, -8, priority=2).addThrValue(19, 8, 8, priority=2)\ - .addThrValue(18, -11, -9, priority=2).addThrValue(18, 9, 11, priority=2)\ - .addThrValue(17, -13, -12, priority=2).addThrValue(17, 12, 13, priority=2)\ - .addThrValue(16, -14, -14, priority=2).addThrValue(16, 14, 14, priority=2)\ - .addThrValue(15, -15, -15, priority=2).addThrValue(15, 15, 15, priority=2)\ - .addThrValue(17, -17, -16, priority=2).addThrValue(17, 16, 17, priority=2)\ - .addThrValue(19, -25, -18, priority=2).addThrValue(19, 18, 25, priority=2) - - LegacyThreshold( 'EM20VH', 'EM').addThrValue(22, priority=1)\ - .addThrValue(22, -7, 7, priority=2)\ - .addThrValue(21, -8, -8, priority=2).addThrValue(21, 8, 8, priority=2)\ - .addThrValue(20, -11, -9, priority=2).addThrValue(20, 9, 11, priority=2)\ - .addThrValue(19, -13, -12, priority=2).addThrValue(19, 12, 13, priority=2)\ - .addThrValue(18, -14, -14, priority=2).addThrValue(18, 14, 14, priority=2)\ - .addThrValue(17, -15, -15, priority=2).addThrValue(17, 15, 15, priority=2)\ - .addThrValue(19, -17, -16, priority=2).addThrValue(19, 16, 17, priority=2)\ - .addThrValue(21, -25, -18, priority=2).addThrValue(21, 18, 25, priority=2) + .addThrValue(8, -25, -18, priority=2).addThrValue(7, -18, -15, priority=2)\ + .addThrValue(5, -15, -14, priority=2).addThrValue(6, -14, -11, priority=2)\ + .addThrValue(7, -11, -8, priority=2).addThrValue(9, -8, 0, priority=2)\ + .addThrValue(9, 0, 8, priority=2).addThrValue(7, 8, 11, priority=2)\ + .addThrValue(6, 11, 14, priority=2).addThrValue(5, 14, 15, priority=2)\ + .addThrValue(7, 15, 18, priority=2).addThrValue(8, 18, 25, priority=2) + LegacyThreshold( 'EM10VH', 'EM').addThrValue(11, priority=1)\ + .addThrValue(10, -25, -18, priority=2).addThrValue(9, -18, -15, priority=2)\ + .addThrValue(7, -15, -14, priority=2).addThrValue(8, -14, -11, priority=2)\ + .addThrValue(9, -11, -8, priority=2).addThrValue(11, -8, 0, priority=2)\ + .addThrValue(11, 0, 8, priority=2).addThrValue(9, 8, 11, priority=2)\ + .addThrValue(8, 11, 14, priority=2).addThrValue(7, 14, 15, priority=2)\ + .addThrValue(9, 15, 18, priority=2).addThrValue(10, 18, 25, priority=2) - # I section - - ThresholdValue.setDefaults('EM', {'isobits' : '00010', 'use_relIso' : True }) + LegacyThreshold( 'EM13VH', 'EM').addThrValue(15, priority=1)\ + .addThrValue(14, -25, -17, priority=2).addThrValue(13, -17, -15, priority=2)\ + .addThrValue(11, -15, -14, priority=2).addThrValue(12, -14, -12, priority=2)\ + .addThrValue(13, -12, -9, priority=2).addThrValue(14, -9, -7, priority=2)\ + .addThrValue(15, -7, 0, priority=2).addThrValue(15, 0, 7, priority=2)\ + .addThrValue(14, 7, 9, priority=2).addThrValue(13, 9, 12, priority=2)\ + .addThrValue(12, 12, 14, priority=2).addThrValue(11, 14, 15, priority=2)\ + .addThrValue(13, 15, 17, priority=2).addThrValue(14, 17, 25, priority=2) - for thrV in [8]: - LegacyThreshold('EM%iI' % thrV, 'EM').addThrValue(thrV) + LegacyThreshold( 'EM15VH', 'EM').addThrValue(17, priority=1)\ + .addThrValue(16, -25, -17, priority=2).addThrValue(15, -17, -15, priority=2)\ + .addThrValue(13, -15, -14, priority=2).addThrValue(14, -14, -12, priority=2)\ + .addThrValue(15, -12, -9, priority=2).addThrValue(16, -9, -7, priority=2)\ + .addThrValue(17, -7, 0, priority=2).addThrValue(17, 0, 7, priority=2)\ + .addThrValue(16, 7, 9, priority=2).addThrValue(15, 9, 12, priority=2)\ + .addThrValue(14, 12, 14, priority=2).addThrValue(13, 14, 15, priority=2)\ + .addThrValue(15, 15, 17, priority=2).addThrValue(16, 17, 25, priority=2) + LegacyThreshold( 'EM18VH', 'EM').addThrValue(20, priority=1)\ + .addThrValue(19, -25, -17, priority=2).addThrValue(17, -17, -15, priority=2)\ + .addThrValue(15, -15, -14, priority=2).addThrValue(16, -14, -13, priority=2)\ + .addThrValue(17, -13, -11, priority=2).addThrValue(18, -11, -8, priority=2)\ + .addThrValue(19, -8, -7, priority=2).addThrValue(20, -7, 0, priority=2)\ + .addThrValue(20, 0, 7, priority=2).addThrValue(19, 7, 8, priority=2)\ + .addThrValue(18, 8, 11, priority=2).addThrValue(17, 11, 13, priority=2)\ + .addThrValue(16, 13, 14, priority=2).addThrValue(15, 14, 15, priority=2)\ + .addThrValue(17, 15, 17, priority=2).addThrValue(19, 17, 25, priority=2) + LegacyThreshold( 'EM20VH', 'EM').addThrValue(22, priority=1)\ + .addThrValue(21, -25, -17, priority=2).addThrValue(19, -17, -15, priority=2)\ + .addThrValue(17, -15, -14, priority=2).addThrValue(18, -14, -13, priority=2)\ + .addThrValue(19, -13, -11, priority=2).addThrValue(20, -11, -8, priority=2)\ + .addThrValue(21, -8, -7, priority=2).addThrValue(22, -7, 0, priority=2)\ + .addThrValue(22, 0, 7, priority=2).addThrValue(21, 7, 8, priority=2)\ + .addThrValue(20, 8, 11, priority=2).addThrValue(19, 11, 13, priority=2)\ + .addThrValue(18, 13, 14, priority=2).addThrValue(17, 14, 15, priority=2)\ + .addThrValue(19, 15, 17, priority=2).addThrValue(21, 17, 25, priority=2) + + LegacyThreshold( 'EM22VH', 'EM').addThrValue(24, priority=1)\ + .addThrValue(23, -25, -17, priority=2).addThrValue(21, -17, -15, priority=2)\ + .addThrValue(19, -15, -14, priority=2).addThrValue(20, -14, -13, priority=2)\ + .addThrValue(21, -13, -11, priority=2).addThrValue(22, -11, -8, priority=2)\ + .addThrValue(23, -8, -7, priority=2).addThrValue(24, -7, 0, priority=2)\ + .addThrValue(24, 0, 7, priority=2).addThrValue(23, 7, 8, priority=2)\ + .addThrValue(22, 8, 11, priority=2).addThrValue(21, 11, 13, priority=2)\ + .addThrValue(20, 13, 14, priority=2).addThrValue(19, 14, 15, priority=2)\ + .addThrValue(21, 15, 17, priority=2).addThrValue(23, 17, 25, priority=2) # (V)HI section - # new egamma v7 menu (ATR-16089) - if not isV6 and not isHI: - - ThresholdValue.setDefaults('EM', {'isobits' : '00001', 'use_relIso' : True }) - LegacyThreshold( 'EM22VH', 'EM').addThrValue(24, priority=1)\ - .addThrValue(24, -6, 6, priority=2)\ - .addThrValue(23, -8, -7, priority=2).addThrValue(23, 7, 8, priority=2)\ - .addThrValue(22, -11, -9, priority=2).addThrValue(22, 9, 11, priority=2)\ - .addThrValue(21, -13, -12, priority=2).addThrValue(21, 12, 13, priority=2)\ - .addThrValue(20, -14, -14, priority=2).addThrValue(20, 14, 14, priority=2)\ - .addThrValue(19, -15, -15, priority=2).addThrValue(19, 15, 15, priority=2)\ - .addThrValue(21, -17, -16, priority=2).addThrValue(21, 16, 17, priority=2)\ - .addThrValue(23, -25, -18, priority=2).addThrValue(23, 18, 25, priority=2) - - ThresholdValue.setDefaults('EM', {'isobits' : '01000', 'use_relIso' : True }) - LegacyThreshold( 'EM24VHIM', 'EM').addThrValue(24, priority=1)\ - .addThrValue(26, -7, 7, priority=2)\ - .addThrValue(25, -8, -8, priority=2).addThrValue(25, 8, 8, priority=2)\ - .addThrValue(24, -11, -9, priority=2).addThrValue(24, 9, 11, priority=2)\ - .addThrValue(23, -13, -12, priority=2).addThrValue(23, 12, 13, priority=2)\ - .addThrValue(22, -14, -14, priority=2).addThrValue(22, 14, 14, priority=2)\ - .addThrValue(21, -15, -15, priority=2).addThrValue(21, 15, 15, priority=2)\ - .addThrValue(23, -17, -16, priority=2).addThrValue(23, 16, 17, priority=2)\ - .addThrValue(25, -25, -18, priority=2).addThrValue(25, 18, 25, priority=2) - - ThresholdValue.setDefaults('EM', {'isobits' : '00100', 'use_relIso' : True }) - if not isV6 and not isHI: - LegacyThreshold( 'EM15VHI', 'EM').addThrValue(17, priority=1)\ - .addThrValue(17, -7, 7, priority=2)\ - .addThrValue(16, -9, -8, priority=2).addThrValue(16, 8, 9, priority=2)\ - .addThrValue(15, -12, -10, priority=2).addThrValue(15, 10, 12, priority=2)\ - .addThrValue(14, -14, -13, priority=2).addThrValue(14, 13, 14, priority=2)\ - .addThrValue(13, -15, -15, priority=2).addThrValue(13, 15, 15, priority=2)\ - .addThrValue(15, -17, -16, priority=2).addThrValue(15, 16, 17, priority=2)\ - .addThrValue(16, -25, -18, priority=2).addThrValue(16, 18, 25, priority=2) - for thrV in [15]: - LegacyThreshold('EM%iHI' % thrV, 'EM').addThrValue(thrV) + LegacyThreshold('EM%iHI' % thrV, 'EM').addThrValue(thrV) - LegacyThreshold( 'EM18VHI', 'EM').addThrValue(20, priority=1)\ - .addThrValue(20, -7, 7, priority=2)\ - .addThrValue(19, -8, -8, priority=2).addThrValue(19, 8, 8, priority=2)\ - .addThrValue(18, -11, -9, priority=2).addThrValue(18, 9, 11, priority=2)\ - .addThrValue(17, -13, -12, priority=2).addThrValue(17, 12, 13, priority=2)\ - .addThrValue(16, -14, -14, priority=2).addThrValue(16, 14, 14, priority=2)\ - .addThrValue(15, -15, -15, priority=2).addThrValue(15, 15, 15, priority=2)\ - .addThrValue(17, -17, -16, priority=2).addThrValue(17, 16, 17, priority=2)\ - .addThrValue(19, -25, -18, priority=2).addThrValue(19, 18, 25, priority=2) + LegacyThreshold( 'EM15VHI', 'EM').addThrValue(17, priority=1)\ + .addThrValue(16, -25, -17, priority=2).addThrValue(15, -17, -15, priority=2)\ + .addThrValue(13, -15, -14, priority=2).addThrValue(14, -14, -12, priority=2)\ + .addThrValue(15, -12, -9, priority=2).addThrValue(16, -9, -7, priority=2)\ + .addThrValue(17, -7, 0, priority=2).addThrValue(17, 0, 7, priority=2)\ + .addThrValue(16, 7, 9, priority=2).addThrValue(15, 9, 12, priority=2)\ + .addThrValue(14, 12, 14, priority=2).addThrValue(13, 14, 15, priority=2)\ + .addThrValue(15, 15, 17, priority=2).addThrValue(16, 17, 25, priority=2) + LegacyThreshold( 'EM18VHI', 'EM').addThrValue(20, priority=1)\ + .addThrValue(19, -25, -17, priority=2).addThrValue(17, -17, -15, priority=2)\ + .addThrValue(15, -15, -14, priority=2).addThrValue(16, -14, -13, priority=2)\ + .addThrValue(17, -13, -11, priority=2).addThrValue(18, -11, -8, priority=2)\ + .addThrValue(19, -8, -7, priority=2).addThrValue(20, -7, 0, priority=2)\ + .addThrValue(20, 0, 7, priority=2).addThrValue(19, 7, 8, priority=2)\ + .addThrValue(18, 8, 11, priority=2).addThrValue(17, 11, 13, priority=2)\ + .addThrValue(16, 13, 14, priority=2).addThrValue(15, 14, 15, priority=2)\ + .addThrValue(17, 15, 17, priority=2).addThrValue(19, 17, 25, priority=2) + + LegacyThreshold( 'EM20VHI', 'EM').addThrValue(22, priority=1)\ - .addThrValue(22, -6, 6, priority=2)\ - .addThrValue(21, -8, -7, priority=2).addThrValue(21, 7, 8, priority=2)\ - .addThrValue(20, -11, -9, priority=2).addThrValue(20, 9, 11, priority=2)\ - .addThrValue(19, -13, -12, priority=2).addThrValue(19, 12, 13, priority=2)\ - .addThrValue(18, -14, -14, priority=2).addThrValue(18, 14, 14, priority=2)\ - .addThrValue(17, -15, -15, priority=2).addThrValue(17, 15, 15, priority=2)\ - .addThrValue(19, -17, -16, priority=2).addThrValue(19, 16, 17, priority=2)\ - .addThrValue(21, -25, -18, priority=2).addThrValue(21, 18, 25, priority=2) + .addThrValue(21, -25, -17, priority=2).addThrValue(19, -17, -15, priority=2)\ + .addThrValue(17, -15, -14, priority=2).addThrValue(18, -14, -13, priority=2)\ + .addThrValue(19, -13, -11, priority=2).addThrValue(20, -11, -8, priority=2)\ + .addThrValue(21, -8, -7, priority=2).addThrValue(22, -7, 0, priority=2)\ + .addThrValue(22, 0, 7, priority=2).addThrValue(21, 7, 8, priority=2)\ + .addThrValue(20, 8, 11, priority=2).addThrValue(19, 11, 13, priority=2)\ + .addThrValue(18, 13, 14, priority=2).addThrValue(17, 14, 15, priority=2)\ + .addThrValue(19, 15, 17, priority=2).addThrValue(21, 17, 25, priority=2) LegacyThreshold( 'EM22VHI', 'EM').addThrValue(24, priority=1)\ - .addThrValue(24, -6, 6, priority=2)\ - .addThrValue(23, -8, -7, priority=2).addThrValue(23, 7, 8, priority=2)\ - .addThrValue(22, -11, -9, priority=2).addThrValue(22, 9, 11, priority=2)\ - .addThrValue(21, -12, -12, priority=2).addThrValue(21, 12, 12, priority=2)\ - .addThrValue(20, -13, -13, priority=2).addThrValue(20, 13, 13, priority=2)\ - .addThrValue(19, -14, -14, priority=2).addThrValue(19, 14, 14, priority=2)\ - .addThrValue(21, -16, -15, priority=2).addThrValue(21, 15, 16, priority=2)\ - .addThrValue(23, -25, -17, priority=2).addThrValue(23, 17, 25, priority=2) - + .addThrValue(23, -25, -17, priority=2).addThrValue(21, -17, -15, priority=2)\ + .addThrValue(19, -15, -14, priority=2).addThrValue(20, -14, -13, priority=2)\ + .addThrValue(21, -13, -11, priority=2).addThrValue(22, -11, -8, priority=2)\ + .addThrValue(23, -8, -7, priority=2).addThrValue(24, -7, 0, priority=2)\ + .addThrValue(24, 0, 7, priority=2).addThrValue(23, 7, 8, priority=2)\ + .addThrValue(22, 8, 11, priority=2).addThrValue(21, 11, 13, priority=2)\ + .addThrValue(20, 13, 14, priority=2).addThrValue(19, 14, 15, priority=2)\ + .addThrValue(21, 15, 17, priority=2).addThrValue(23, 17, 25, priority=2) + LegacyThreshold( 'EM24VHI', 'EM').addThrValue(24, priority=1)\ - .addThrValue(26, -7, 7, priority=2)\ - .addThrValue(25, -8, -8, priority=2).addThrValue(25, 8, 8, priority=2)\ - .addThrValue(24, -11, -9, priority=2).addThrValue(24, 9, 11, priority=2)\ - .addThrValue(23, -13, -12, priority=2).addThrValue(23, 12, 13, priority=2)\ - .addThrValue(22, -14, -14, priority=2).addThrValue(22, 14, 14, priority=2)\ - .addThrValue(21, -15, -15, priority=2).addThrValue(21, 15, 15, priority=2)\ - .addThrValue(23, -17, -16, priority=2).addThrValue(23, 16, 17, priority=2)\ - .addThrValue(25, -25, -18, priority=2).addThrValue(25, 18, 25, priority=2) - + .addThrValue(25, -25, -17, priority=2).addThrValue(23, -17, -15, priority=2)\ + .addThrValue(21, -15, -14, priority=2).addThrValue(22, -14, -13, priority=2)\ + .addThrValue(23, -13, -11, priority=2).addThrValue(24, -11, -8, priority=2)\ + .addThrValue(25, -8, -7, priority=2).addThrValue(26, -7, 0, priority=2)\ + .addThrValue(26, 0, 7, priority=2).addThrValue(25, 7, 8, priority=2)\ + .addThrValue(24, 8, 11, priority=2).addThrValue(23, 11, 13, priority=2)\ + .addThrValue(22, 13, 14, priority=2).addThrValue(21, 14, 15, priority=2)\ + .addThrValue(23, 15, 17, priority=2).addThrValue(25, 17, 25, priority=2) + LegacyThreshold( 'EM26VHI', 'EM').addThrValue(26, priority=1)\ - .addThrValue(28, -7, 7, priority=2)\ - .addThrValue(27, -8, -8, priority=2).addThrValue(27, 8, 8, priority=2)\ - .addThrValue(26, -11, -9, priority=2).addThrValue(26, 9, 11, priority=2)\ - .addThrValue(25, -13, -12, priority=2).addThrValue(25, 12, 13, priority=2)\ - .addThrValue(24, -14, -14, priority=2).addThrValue(24, 14, 14, priority=2)\ - .addThrValue(23, -15, -15, priority=2).addThrValue(23, 15, 15, priority=2)\ - .addThrValue(25, -17, -16, priority=2).addThrValue(25, 16, 17, priority=2)\ - .addThrValue(27, -25, -18, priority=2).addThrValue(27, 18, 25, priority=2) - - LegacyThreshold( 'EM30VHI', 'EM').addThrValue(30, priority=1)\ - .addThrValue(32, -7, 7, priority=2)\ - .addThrValue(31, -8, -8, priority=2).addThrValue(31, 8, 8, priority=2)\ - .addThrValue(30, -11, -9, priority=2).addThrValue(30, 9, 11, priority=2)\ - .addThrValue(29, -13, -12, priority=2).addThrValue(29, 12, 13, priority=2)\ - .addThrValue(28, -14, -14, priority=2).addThrValue(28, 14, 14, priority=2)\ - .addThrValue(27, -15, -15, priority=2).addThrValue(27, 15, 15, priority=2)\ - .addThrValue(29, -17, -16, priority=2).addThrValue(29, 16, 17, priority=2)\ - .addThrValue(31, -29, -18, priority=2).addThrValue(31, 18, 29, priority=2) + .addThrValue(27, -25, -17, priority=2).addThrValue(25, -17, -15, priority=2)\ + .addThrValue(23, -15, -14, priority=2).addThrValue(24, -14, -13, priority=2)\ + .addThrValue(25, -13, -11, priority=2).addThrValue(26, -11, -8, priority=2)\ + .addThrValue(27, -8, -7, priority=2).addThrValue(28, -7, 0, priority=2)\ + .addThrValue(28, 0, 7, priority=2).addThrValue(27, 7, 8, priority=2)\ + .addThrValue(26, 8, 11, priority=2).addThrValue(25, 11, 13, priority=2)\ + .addThrValue(24, 13, 14, priority=2).addThrValue(23, 14, 15, priority=2)\ + .addThrValue(25, 15, 17, priority=2).addThrValue(27, 17, 25, priority=2) + LegacyThreshold( 'EM30VHI', 'EM').addThrValue(30, priority=1)\ + .addThrValue(31, -29, -17, priority=2).addThrValue(29, -17, -15, priority=2)\ + .addThrValue(27, -15, -14, priority=2).addThrValue(28, -14, -13, priority=2)\ + .addThrValue(29, -13, -11, priority=2).addThrValue(30, -11, -8, priority=2)\ + .addThrValue(31, -8, -7, priority=2).addThrValue(32, -7, 0, priority=2)\ + .addThrValue(32, 0, 7, priority=2).addThrValue(31, 7, 8, priority=2)\ + .addThrValue(30, 8, 11, priority=2).addThrValue(29, 11, 13, priority=2)\ + .addThrValue(28, 13, 14, priority=2).addThrValue(27, 14, 15, priority=2)\ + .addThrValue(29, 15, 17, priority=2).addThrValue(31, 17, 29, priority=2) + + + # VHIM section + + ThresholdValue.setDefaults('EM', {'isobits' : '01000', 'use_relIso' : True }) + + LegacyThreshold( 'EM24VHIM', 'EM').addThrValue(24, priority=1)\ + .addThrValue(25, -25, -17, priority=2).addThrValue(23, -17, -15, priority=2)\ + .addThrValue(21, -15, -14, priority=2).addThrValue(22, -14, -13, priority=2)\ + .addThrValue(23, -13, -11, priority=2).addThrValue(24, -11, -8, priority=2)\ + .addThrValue(25, -8, -7, priority=2).addThrValue(26, -7, 0, priority=2)\ + .addThrValue(26, 0, 7, priority=2).addThrValue(25, 7, 8, priority=2)\ + .addThrValue(24, 8, 11, priority=2).addThrValue(23, 11, 13, priority=2)\ + .addThrValue(22, 13, 14, priority=2).addThrValue(21, 14, 15, priority=2)\ + .addThrValue(23, 15, 17, priority=2).addThrValue(25, 17, 25, priority=2) - LegacyThreshold( 'EM3HI', 'EM').addThrValue(3, priority=1) + ThresholdValue.setDefaults('EM', {'isobits' : '00100', 'use_relIso' : True }) ThresholdValue.setDefaults('EM', {}) + + + + # TAU ThresholdValue.setDefaults('TAU',{'isobits' : '00000', 'use_relIso' : True }) @@ -252,12 +227,8 @@ class ThresholdDefLegacy: LegacyThreshold('HA%iIL' % thrV, 'TAU').addThrValue(thrV) ThresholdValue.setDefaults('TAU', {'isobits' : '00010', 'use_relIso' : True }) - if isV6 or isHI: - for thrV in [12,20]: - LegacyThreshold('HA%iIM' % thrV, 'TAU').addThrValue(thrV) - else: - for thrV in [12,20,25]: - LegacyThreshold('HA%iIM' % thrV, 'TAU').addThrValue(thrV) + for thrV in [12,20,25]: + LegacyThreshold('HA%iIM' % thrV, 'TAU').addThrValue(thrV) ThresholdValue.setDefaults('TAU', {'isobits' : '00100', 'use_relIso' : True }) for thrV in [12,20,25]: diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TopoAlgoDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TopoAlgoDef.py index 0276461d26f3f31b51006c4a16af347d2efd2069..838d14f797beb6875bc539e4f58872f87f5e5ced 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TopoAlgoDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TopoAlgoDef.py @@ -25,7 +25,7 @@ class TopoAlgoDef: log.debug("usev7 %r", usev7) log.debug("usev8 %r", usev8) - _emscale_for_decision = getTypeWideThresholdConfig("EM")["emscale"] + _emscale_for_decision = 1000 / getTypeWideThresholdConfig("EM")["resolutionMeV"] alg = AlgConf.ClusterNoSort( name = 'EMall', inputs = 'ClusterTobArray', outputs = 'EMall', algoId = currentAlgoId) currentAlgoId += 1 diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TopoAlgoDefLegacy.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TopoAlgoDefLegacy.py index 4da56a4ec697406a9eab1555fdd7ef93853746d8..a2c5b910aaf98259fe0675776744e30bdd84dca6 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TopoAlgoDefLegacy.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TopoAlgoDefLegacy.py @@ -23,7 +23,7 @@ class TopoAlgoDefLegacy: log.debug("usev7 %r", usev7) log.debug("usev8 %r", usev8) - _emscale_for_decision = getTypeWideThresholdConfig("EM")["emscale"] + _emscale_for_decision = 1000 / getTypeWideThresholdConfig("EM")["resolutionMeV"] alg = AlgConf.ClusterNoSort( name = 'EMall', inputs = 'ClusterTobArray', outputs = 'EMall', algoId = currentAlgoId) currentAlgoId += 1 diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TopoMultiplicityAlgoDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TopoMultiplicityAlgoDef.py index f24d115bb3c26daa4255954f93cbfef134d0175a..e2f15f87278c9ed704d15a7285ecb22fc675c479 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TopoMultiplicityAlgoDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TopoMultiplicityAlgoDef.py @@ -20,9 +20,8 @@ class TopoMultiplicityAlgoDef(object): ] for em in emThresholds: - alg = EMMultiplicityAlgo( classtype = "ThresholdMult", - name = "Mult_%s" % em, - algoId = currentAlgoId, + alg = EMMultiplicityAlgo( name = "Mult_%s" % em, + algoId = currentAlgoId, threshold = em, nbits = 3) tm.registerTopoAlgo(alg) @@ -31,9 +30,8 @@ class TopoMultiplicityAlgoDef(object): tauThresholds = [ "eTAU12", "eTAU12IM", "eTAU20", "eTAU20IM", "eTAU25IM", "eTAU40", "eTAU60", "eTAU100" ] for tau in tauThresholds: - alg = TauMultiplicityAlgo( classtype = "ThresholdMult", - name = "Mult_%s" % tau, - algoId = currentAlgoId, + alg = TauMultiplicityAlgo( name = "Mult_%s" % tau, + algoId = currentAlgoId, threshold = tau, nbits = 3) tm.registerTopoAlgo(alg) @@ -42,9 +40,8 @@ class TopoMultiplicityAlgoDef(object): "jJ35.0ETA23", "jJ40.0ETA25", "jJ40", "jJ50", "jJ85", "jJ100", "jJ15.31ETA49", "jJ20.31ETA49", "jJ75.31ETA49" ] for jJet in jJThresholds: - alg = JetMultiplicityAlgo( classtype = "ThresholdMult", - name = "Mult_%s" % jJet, - algoId = currentAlgoId, + alg = JetMultiplicityAlgo( name = "Mult_%s" % jJet, + algoId = currentAlgoId, threshold = jJet, nbits = 3) tm.registerTopoAlgo(alg) @@ -53,9 +50,8 @@ class TopoMultiplicityAlgoDef(object): gXEThresholds = [ "gXERHO20", "gXERHO30", "gXERHO35", "gXERHO40", "gXERHO45", "gXERHO50", "gXEPUFIT20", "gXEPUFIT50", "gXE50" ] for gXE in gXEThresholds: - alg = XEMultiplicityAlgo( classtype = "ThresholdMult", - name = "Mult_%s" % gXE, - algoId = currentAlgoId, + alg = XEMultiplicityAlgo( name = "Mult_%s" % gXE, + algoId = currentAlgoId, threshold = gXE, nbits = 1) tm.registerTopoAlgo(alg) @@ -64,9 +60,8 @@ class TopoMultiplicityAlgoDef(object): jXEThresholds = [ "jXE50" ] for jXE in jXEThresholds: - alg = XEMultiplicityAlgo( classtype = "ThresholdMult", - name = "Mult_%s" % jXE, - algoId = currentAlgoId, + alg = XEMultiplicityAlgo( name = "Mult_%s" % jXE, + algoId = currentAlgoId, threshold = jXE, nbits = 1) tm.registerTopoAlgo(alg) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py index 14c5443d379bc965865281f142937f8612eefc5e..1609bb0130d1da8eb24b97f098db924eeeb76a8a 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Config/TypeWideThresholdConfig.py @@ -26,6 +26,8 @@ def getTypeWideThresholdConfig(ttype): return getConfig_TAU() if ttype == ThrType.JET: return getConfig_JET() + if ttype == ThrType.XS: + return getConfig_XS() return odict() @@ -46,18 +48,19 @@ def getConfig_eEM(): confObj = odict() confObj["workingPoints"] = odict() confObj["workingPoints"]["Loose"] = [ - odict([("etamin",0),("etamax",20), ("reta", 16), ("wstot", 15), ("had", 30)]), + odict([("etamin",0),("etamax",21), ("reta", 16), ("wstot", 15), ("had", 30)]), odict([("etamin",21),("etamax",49), ("reta", 20), ("wstot", 25), ("had", 35)]) ] confObj["workingPoints"]["Medium"] = [ - odict([("etamin",0),("etamax",20), ("reta", 17), ("wstot", 20), ("had", 30)]), + odict([("etamin",0),("etamax",21), ("reta", 17), ("wstot", 20), ("had", 30)]), odict([("etamin",21),("etamax",49), ("reta", 21), ("wstot", 25), ("had", 35)]) ] confObj["workingPoints"]["Tight"] = [ - odict([("etamin",0),("etamax",20), ("reta", 18), ("wstot", 22), ("had", 30)]), + odict([("etamin",0),("etamax",21), ("reta", 18), ("wstot", 22), ("had", 30)]), odict([("etamin",21),("etamax",49), ("reta", 22), ("wstot", 25), ("had", 35)]) ] confObj["ptMinToTopo"] = 3 + confObj["resolutionMeV"] = 100 return confObj @@ -65,18 +68,19 @@ def getConfig_eTAU(): confObj = odict() confObj["workingPoints"] = odict() confObj["workingPoints"]["Loose"] = [ - odict([("etamin",0),("etamax",20), ("reta", 16), ("wstot", 15), ("had", 30)]), + odict([("etamin",0),("etamax",21), ("reta", 16), ("wstot", 15), ("had", 30)]), odict([("etamin",21),("etamax",49), ("reta", 20), ("wstot", 25), ("had", 35)]) ] confObj["workingPoints"]["Medium"] = [ - odict([("etamin",0),("etamax",20), ("reta", 17), ("wstot", 20), ("had", 30)]), + odict([("etamin",0),("etamax",21), ("reta", 17), ("wstot", 20), ("had", 30)]), odict([("etamin",21),("etamax",49), ("reta", 21), ("wstot", 25), ("had", 35)]) ] confObj["workingPoints"]["Tight"] = [ - odict([("etamin",0),("etamax",20), ("reta", 18), ("wstot", 22), ("had", 30)]), + odict([("etamin",0),("etamax",21), ("reta", 18), ("wstot", 22), ("had", 30)]), odict([("etamin",21),("etamax",49), ("reta", 22), ("wstot", 25), ("had", 35)]) ] confObj["ptMinToTopo"] = 6 + confObj["resolutionMeV"] = 100 return confObj @@ -108,7 +112,7 @@ def getConfig_EM(): odict([ ("etamax", 49), ("etamin", -49), ("isobit", 5), ("mincut", 15), ("offset", -18), ("priority", 0), ("slope", 80), ("upperlimit", 50)]), ] confObj["ptMinToTopo"] = 3 - confObj["emscale"] = 2 + confObj["resolutionMeV"] = 500 return confObj @@ -123,7 +127,8 @@ def getConfig_TAU(): odict([ ("etamax", 49), ("etamin", -49), ("isobit", 4), ("mincut", 0), ("offset", 40), ("priority", 0), ("slope", 0), ("upperlimit", 124)]), odict([ ("etamax", 49), ("etamin", -49), ("isobit", 5), ("mincut", 0), ("offset", 30), ("priority", 0), ("slope", 100), ("upperlimit", 60)]) ] - confObj["ptMinToTopo"] = 5 + confObj["ptMinToTopo"] = 8 + confObj["resolutionMeV"] = 500 return confObj @@ -131,7 +136,17 @@ def getConfig_JET(): confObj = odict() confObj["ptMinToTopoLargeWindow"] = 12 confObj["ptMinToTopoSmallWindow"] = 12 - confObj["jetscale"] = 1 return confObj +def getConfig_XS(): + confObj = odict() + confObj["significance"] = odict() + confObj["significance"]["xeMin"] = 11 + confObj["significance"]["xeMax"] = 63 + confObj["significance"]["teSqrtMin"] = 4 + confObj["significance"]["teSqrtMax"] = 63 + confObj["significance"]["xsSigmaScale"] = 1150 + confObj["significance"]["xsSigmaOffset"] = 1640 + return confObj + diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_LS2_v1.py index 18683a84cca46e40f472562586f275f4e57da2ad..3ccc35a1ff29868aaa97695948fea1b9ac163dd2 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_LS2_v1.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/LVL1MenuConfig/LVL1Menu/Menu_LS2_v1.py @@ -839,7 +839,7 @@ def defineMenu(): # 'L1_ALFA_SHOWSYST5', # 'L1_ALFA_SYST9' ,'L1_ALFA_SYST10','L1_ALFA_SYST11','L1_ALFA_SYST12', # 'L1_ALFA_SYST17','L1_ALFA_SYST18', -# 'L1_ALFA_ANY', + 'L1_ALFA_ANY', # 'L1_ALFA_ANY_EMPTY','L1_ALFA_ANY_FIRSTEMPTY','L1_ALFA_ANY_UNPAIRED_ISO','L1_ALFA_ANY_UNPAIRED_NONISO', # 'L1_ALFA_ANY_BGRP10','L1_ALFA_ANY_ABORTGAPNOTCALIB','L1_ALFA_ANY_CALIB', 'L1_ALFA_B7L1U','L1_ALFA_B7L1L','L1_ALFA_A7L1U','L1_ALFA_A7L1L','L1_ALFA_A7R1U','L1_ALFA_A7R1L','L1_ALFA_B7R1U','L1_ALFA_B7R1L', @@ -1483,7 +1483,7 @@ def defineMenu(): # 'L1_ALFA_SYST12' : 478, # 'L1_ALFA_SYST17' : 479, # 'L1_ALFA_SYST18' : 480, -# 'L1_ALFA_ANY' : 481, + 'L1_ALFA_ANY' : 481, # 'L1_ALFA_ANY_EMPTY' : 482, # 'L1_ALFA_ANY_FIRSTEMPTY' : 483, # 'L1_ALFA_ANY_UNPAIRED_ISO' : 484, diff --git a/graphics/VP1/VP1Gui/CMakeLists.txt b/graphics/VP1/VP1Gui/CMakeLists.txt index 3a52f61b291c9ca248065f5d590857ab36b09f0d..f22b57b391e933f5d957a0f592351a7e03e8fcd6 100644 --- a/graphics/VP1/VP1Gui/CMakeLists.txt +++ b/graphics/VP1/VP1Gui/CMakeLists.txt @@ -36,8 +36,3 @@ atlas_add_library( VP1Gui VP1Gui/*.h src/*.h src/*.cxx src/*.qrc Qt5::PrintSupport PRIVATE_LINK_LIBRARIES ${COIN3D_LIBRARIES} ${SOQT_LIBRARIES} PathResolver xAODBase xAODRootAccess xAODEventInfo xAODRootAccessInterfaces Qt5::Network ) - -# Install files from the package: -##atlas_install_scripts( share/* ) # installs into bin/ -atlas_install_runtime( share/* ) # install into share/ //TODO: check if we still need this! - diff --git a/graphics/VP1/VP1Gui/src/VP1EventDisplayEditor.cxx b/graphics/VP1/VP1Gui/src/VP1EventDisplayEditor.cxx index 52a3afd57c3b2dd605203393042e4c90eeb0ba1e..b980ad44ceff5249ff15523b600c1e01936f7884 100644 --- a/graphics/VP1/VP1Gui/src/VP1EventDisplayEditor.cxx +++ b/graphics/VP1/VP1Gui/src/VP1EventDisplayEditor.cxx @@ -617,45 +617,45 @@ void VP1EventDisplayEditor::addLogo() // load the right version of the ATLAS logo if ( m_d->ui.radioButton_300px->isChecked() ) { - if ( m_d->ui.radioButton_gray->isChecked() ) + if ( m_d->ui.radioButton_logo_white->isChecked() ) pix.load(":/vp1/images/images/ATLAS-Logo-New_300pixels.png"); - if (m_d->ui.radioButton_blue->isChecked() ) - pix.load(":/vp1/images/images/ATLAS-chrome-logo-URL-blue_300px.png"); + if ( m_d->ui.radioButton_logo_main->isChecked() ) + pix.load(":/vp1/images/images/ATLAS-Logo-Ref-RGB-transpBkg-300px.png"); name = "logo_300px"; } else if ( m_d->ui.radioButton_450px->isChecked() ) { - if ( m_d->ui.radioButton_gray->isChecked() ) + if ( m_d->ui.radioButton_logo_white->isChecked() ) pix.load(":/vp1/images/images/ATLAS-Logo-New_450pixels.png"); - if (m_d->ui.radioButton_blue->isChecked() ) - pix.load(":/vp1/images/images/ATLAS-chrome-logo-URL-blue_450px.png"); + if ( m_d->ui.radioButton_logo_main->isChecked() ) + pix.load(":/vp1/images/images/ATLAS-Logo-Ref-RGB-transpBkg-450px.png"); name = "logo_450px"; } else if ( m_d->ui.radioButton_600px->isChecked() ) { - if ( m_d->ui.radioButton_gray->isChecked() ) + if ( m_d->ui.radioButton_logo_white->isChecked() ) pix.load(":/vp1/images/images/ATLAS-Logo-New_600pixels.png"); - if (m_d->ui.radioButton_blue->isChecked() ) - pix.load(":/vp1/images/images/ATLAS-chrome-logo-URL-blue_600px.png"); + if ( m_d->ui.radioButton_logo_main->isChecked() ) + pix.load(":/vp1/images/images/ATLAS-Logo-Ref-RGB-transpBkg-600px.png"); name = "logo_600px"; } else if ( m_d->ui.radioButton_800px->isChecked() ) { - if ( m_d->ui.radioButton_gray->isChecked() ) + if ( m_d->ui.radioButton_logo_white->isChecked() ) pix.load(":/vp1/images/images/ATLAS-Logo-New_800pixels.png"); -// if (m_d->ui.radioButton_blue->isChecked() ) -// pix.load(":/vp1/images/images/ATLAS-chrome-logo-URL-blue_600px.png"); + if ( m_d->ui.radioButton_logo_main->isChecked() ) + pix.load(":/vp1/images/images/ATLAS-Logo-Ref-RGB-transpBkg-800px.png"); name = "logo_800px"; } else if ( m_d->ui.radioButton_1000px->isChecked() ) { - if ( m_d->ui.radioButton_gray->isChecked() ) + if ( m_d->ui.radioButton_logo_white->isChecked() ) pix.load(":/vp1/images/images/ATLAS-Logo-New_1000pixels.png"); -// if (m_d->ui.radioButton_blue->isChecked() ) -// pix.load(":/vp1/images/images/ATLAS-chrome-logo-URL-blue_600px.png"); + if ( m_d->ui.radioButton_logo_main->isChecked() ) + pix.load(":/vp1/images/images/ATLAS-Logo-Ref-RGB-transpBkg-1000px.png"); name = "logo_1000px"; } else if ( m_d->ui.radioButton_1200px->isChecked() ) { - if ( m_d->ui.radioButton_gray->isChecked() ) + if ( m_d->ui.radioButton_logo_white->isChecked() ) pix.load(":/vp1/images/images/ATLAS-Logo-New_1200pixels.png"); -// if (m_d->ui.radioButton_blue->isChecked() ) -// pix.load(":/vp1/images/images/ATLAS-chrome-logo-URL-blue_600px.png"); + if ( m_d->ui.radioButton_logo_main->isChecked() ) + pix.load(":/vp1/images/images/ATLAS-Logo-Ref-RGB-transpBkg-1200px.png"); name = "logo_1200px"; } diff --git a/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-1000px.png b/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-1000px.png new file mode 100644 index 0000000000000000000000000000000000000000..3b789c4b1ae1a8a05f3b8fb8a471b643f465559e Binary files /dev/null and b/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-1000px.png differ diff --git a/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-1200px.png b/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-1200px.png new file mode 100644 index 0000000000000000000000000000000000000000..8d9cf9eab234993428a9eb90ece8420d46d444ca Binary files /dev/null and b/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-1200px.png differ diff --git a/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-300px.png b/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-300px.png new file mode 100644 index 0000000000000000000000000000000000000000..3f9d0cf5497f012ee9eec61f34d6112fe13437e9 Binary files /dev/null and b/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-300px.png differ diff --git a/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-450px.png b/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-450px.png new file mode 100644 index 0000000000000000000000000000000000000000..cb8f2b562d61e7eb4e0105f284d0a778406c5f60 Binary files /dev/null and b/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-450px.png differ diff --git a/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-600px.png b/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-600px.png new file mode 100644 index 0000000000000000000000000000000000000000..359f50bd797b413dd01928534828b6554b3e98f4 Binary files /dev/null and b/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-600px.png differ diff --git a/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-800px.png b/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-800px.png new file mode 100644 index 0000000000000000000000000000000000000000..7f32ccf27c2bac54f1e6d8aa2a3acec3d0816146 Binary files /dev/null and b/graphics/VP1/VP1Gui/src/images/ATLAS-Logo-Ref-RGB-transpBkg-800px.png differ diff --git a/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL-blue_300px.png b/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL-blue_300px.png deleted file mode 100644 index c4077a1d0d6c9543e6990e3a4605f0488c936dc4..0000000000000000000000000000000000000000 Binary files a/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL-blue_300px.png and /dev/null differ diff --git a/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL-blue_450px.png b/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL-blue_450px.png deleted file mode 100644 index ff530faae81eaa6b08e9681479c6455e065d7013..0000000000000000000000000000000000000000 Binary files a/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL-blue_450px.png and /dev/null differ diff --git a/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL-blue_600px.png b/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL-blue_600px.png deleted file mode 100644 index 70004ee0931a8200a17e8f66493a57afefe3c9c4..0000000000000000000000000000000000000000 Binary files a/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL-blue_600px.png and /dev/null differ diff --git a/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL_300px.png b/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL_300px.png deleted file mode 100644 index 717c1c6ca15e44398a52b5ae1ddac2d6bf665c13..0000000000000000000000000000000000000000 Binary files a/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL_300px.png and /dev/null differ diff --git a/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL_450px.png b/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL_450px.png deleted file mode 100644 index 81b8ac75abbd09073501dc48a7515b977a9620b3..0000000000000000000000000000000000000000 Binary files a/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL_450px.png and /dev/null differ diff --git a/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL_600px.png b/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL_600px.png deleted file mode 100644 index 362f722a5f95b86c64fc1590a4449c532c1b0d47..0000000000000000000000000000000000000000 Binary files a/graphics/VP1/VP1Gui/src/images/ATLAS-chrome-logo-URL_600px.png and /dev/null differ diff --git a/graphics/VP1/VP1Gui/src/vp1.qrc b/graphics/VP1/VP1Gui/src/vp1.qrc index 8ef40a3b2800f169ec7176291c6d6bc651ccbcd8..4015343a1030d5f7d5f7d66cf7845669b0488812 100644 --- a/graphics/VP1/VP1Gui/src/vp1.qrc +++ b/graphics/VP1/VP1Gui/src/vp1.qrc @@ -45,17 +45,17 @@ <file>icons/camera.png</file> </qresource> <qresource prefix="/vp1/images"> - <file>images/ATLAS-chrome-logo-URL-blue_600px.png</file> - <file>images/ATLAS-chrome-logo-URL-blue_450px.png</file> - <file>images/ATLAS-chrome-logo-URL-blue_300px.png</file> - <file>images/ATLAS-chrome-logo-URL_600px.png</file> - <file>images/ATLAS-chrome-logo-URL_450px.png</file> - <file>images/ATLAS-chrome-logo-URL_300px.png</file> <file>images/ATLAS-Logo-New_1200pixels.png</file> <file>images/ATLAS-Logo-New_1000pixels.png</file> <file>images/ATLAS-Logo-New_800pixels.png</file> <file>images/ATLAS-Logo-New_600pixels.png</file> <file>images/ATLAS-Logo-New_450pixels.png</file> <file>images/ATLAS-Logo-New_300pixels.png</file> + <file>images/ATLAS-Logo-Ref-RGB-transpBkg-1000px.png</file> + <file>images/ATLAS-Logo-Ref-RGB-transpBkg-1200px.png</file> + <file>images/ATLAS-Logo-Ref-RGB-transpBkg-300px.png</file> + <file>images/ATLAS-Logo-Ref-RGB-transpBkg-450px.png</file> + <file>images/ATLAS-Logo-Ref-RGB-transpBkg-600px.png</file> + <file>images/ATLAS-Logo-Ref-RGB-transpBkg-800px.png</file> </qresource> </RCC> diff --git a/graphics/VP1/VP1Gui/src/vp1eventdisplayeditor.ui b/graphics/VP1/VP1Gui/src/vp1eventdisplayeditor.ui index 1829e697a90fc98761c64b92aa9fbd2b199e3a1c..ebf9dfcb2548c2b387bb5d9753118e36bb0af8de 100644 --- a/graphics/VP1/VP1Gui/src/vp1eventdisplayeditor.ui +++ b/graphics/VP1/VP1Gui/src/vp1eventdisplayeditor.ui @@ -116,9 +116,9 @@ </property> <layout class="QVBoxLayout" name="verticalLayout_8"> <item> - <widget class="QRadioButton" name="radioButton_gray"> + <widget class="QRadioButton" name="radioButton_logo_white"> <property name="text"> - <string>Gray</string> + <string>White (for black background)</string> </property> <property name="checked"> <bool>true</bool> @@ -126,12 +126,12 @@ </widget> </item> <item> - <widget class="QRadioButton" name="radioButton_blue"> + <widget class="QRadioButton" name="radioButton_logo_main"> <property name="enabled"> - <bool>false</bool> + <bool>true</bool> </property> <property name="text"> - <string>Blue</string> + <string>Blue (for transparent background)</string> </property> </widget> </item> diff --git a/graphics/VP1/VP1Plugins/VP1GeometryPlugin/CMakeLists.txt b/graphics/VP1/VP1Plugins/VP1GeometryPlugin/CMakeLists.txt index 0e3c4df140c8b0f4f8b2f49e87a35fcdb676b605..1bd7581411b7545f248d8c242c5f30ae33143c56 100644 --- a/graphics/VP1/VP1Plugins/VP1GeometryPlugin/CMakeLists.txt +++ b/graphics/VP1/VP1Plugins/VP1GeometryPlugin/CMakeLists.txt @@ -19,16 +19,6 @@ find_package( Qt5 COMPONENTS Core Gui Widgets ) # Generate MOC files automatically: set( CMAKE_AUTOMOC TRUE ) -# Build the library. -#<<<<<<< HEAD -#atlas_add_library( ${pkgName} ${pkgName}/*.h src/*.cxx src/*.qrc -# PUBLIC_HEADERS ${pkgName} -# INCLUDE_DIRS ${SOQT_INCLUDE_DIRS} ${COIN3D_INCLUDE_DIRS} ${QT5_INCLUDE_DIRS} -# PRIVATE_INCLUDE_DIRS tmpqt_extraheaders/ ${CMAKE_CURRENT_BINARY_DIR} ${ROOT_INCLUDE_DIRS} -# LINK_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets ${SOQT_LIBRARIES} ${COIN3D_LIBRARIES} GeoPrimitives TFPersistification -# PRIVATE_LINK_LIBRARIES VP1GuideLineSystems VP1GeometrySystems -#) -#======= atlas_add_library( VP1GeometryPlugin VP1GeometryPlugin/*.h src/*.cxx src/*.qrc PUBLIC_HEADERS VP1GeometryPlugin diff --git a/graphics/VP1/VP1Systems/VP1AODSystems/CMakeLists.txt b/graphics/VP1/VP1Systems/VP1AODSystems/CMakeLists.txt index ff40e66988cb2642e9cfefdd41643a3603a464d5..8612f2e279805df69b6c7b05844065f9a03d2097 100644 --- a/graphics/VP1/VP1Systems/VP1AODSystems/CMakeLists.txt +++ b/graphics/VP1/VP1Systems/VP1AODSystems/CMakeLists.txt @@ -62,4 +62,4 @@ else() endif() # Install files from the package: -atlas_install_runtime( textures/*.png ) +atlas_install_runtime( textures/*.jpg )