diff --git a/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilder.cxx b/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilder.cxx index a1c927350e470431133a438899e123da59e900fb..e8e30e959a0daadd32a6ed61a745a30defa4067c 100755 --- a/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilder.cxx +++ b/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilder.cxx @@ -1070,12 +1070,12 @@ const Trk::TrackingGeometry* Calo::CaloTrackingGeometryBuilder::trackingGeometry // the Tile Crack volume (TileGap3, enum 17) inserted here // binned material for Crack : steering in binEta // TODO turn into 2D binned array - std::vector<const Trk::IdentifiedMaterial*> matCrack; + std::vector<Trk::IdentifiedMaterial> matCrack; // layer material can be adjusted here int baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 17; - matCrack.push_back(new std::pair<const Trk::Material*,int>(mScint,baseID)); - matCrack.push_back(new std::pair<const Trk::Material*,int>(m_caloMaterial,-1)); - matCrack.push_back(new std::pair<const Trk::Material*,int>(mAl,-1)); + matCrack.emplace_back(mScint,baseID); + matCrack.emplace_back(m_caloMaterial,-1); + matCrack.emplace_back(mAl,-1); // Trk::BinUtility* bun = new Trk::BinUtility(3,-1.8,-1.2,Trk::open,Trk::binEta); Trk::BinUtility* bup = new Trk::BinUtility(3, 1.2,1.8,Trk::open,Trk::binEta); diff --git a/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilderCond.cxx b/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilderCond.cxx index f2a4f973f7f2ed37e952e29681258fd0d7898819..dfbf0cdb8da00ba21371cb25af927a951e2104a2 100755 --- a/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilderCond.cxx +++ b/Calorimeter/CaloTrackingGeometry/src/CaloTrackingGeometryBuilderCond.cxx @@ -1080,12 +1080,12 @@ std::pair<EventIDRange, const Trk::TrackingGeometry*> Calo::CaloTrackingGeometry // the Tile Crack volume (TileGap3, enum 17) inserted here // binned material for Crack : steering in binEta // TODO turn into 2D binned array - std::vector<const Trk::IdentifiedMaterial*> matCrack; + std::vector<Trk::IdentifiedMaterial> matCrack; // layer material can be adjusted here int baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 17; - matCrack.push_back(new std::pair<const Trk::Material*,int>(mScint,baseID)); - matCrack.push_back(new std::pair<const Trk::Material*,int>(m_caloMaterial,-1)); - matCrack.push_back(new std::pair<const Trk::Material*,int>(mAl,-1)); + matCrack.emplace_back(mScint,baseID); + matCrack.emplace_back(m_caloMaterial,-1); + matCrack.emplace_back(mAl,-1); // Trk::BinUtility* bun = new Trk::BinUtility(3,-1.8,-1.2,Trk::open,Trk::binEta); Trk::BinUtility* bup = new Trk::BinUtility(3, 1.2,1.8,Trk::open,Trk::binEta); diff --git a/Control/AthenaBaseComps/AthenaBaseComps/AthHistogramFilterAlgorithm.h b/Control/AthenaBaseComps/AthenaBaseComps/AthHistogramFilterAlgorithm.h deleted file mode 100644 index e2e8faf1c5ba864a9c6f18625854e9d95c821390..0000000000000000000000000000000000000000 --- a/Control/AthenaBaseComps/AthenaBaseComps/AthHistogramFilterAlgorithm.h +++ /dev/null @@ -1,115 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2017, 2019 CERN for the benefit of the ATLAS collaboration -*/ - -/// @class AthHistogramFilterAlgorithm.h -/// Header file for AthHistogramAlgorithm -/// @author: Karsten Koeneke (karsten.koeneke@cern.ch) -/////////////////////////////////////////////////////////////////// -#ifndef ATHENABASECOMPS_ATHHISTOGRAMFILTERALGORITHM_H -#define ATHENABASECOMPS_ATHHISTOGRAMFILTERALGORITHM_H 1 - -// STL includes -#include <string> - -// Framework includes -#include "AthenaBaseComps/AthFilterAlgorithm.h" -#include "AthenaBaseComps/AthHistogramming.h" -#include "GaudiKernel/ServiceHandle.h" - - -// Some needed forward declarations -class ITHistSvc; - - - - -class AthHistogramFilterAlgorithm - : public ::AthFilterAlgorithm, - public ::AthHistogramming -{ - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// -public: - - /// Constructor with parameters: - AthHistogramFilterAlgorithm( const std::string& name, ISvcLocator* pSvcLocator ); - - /// Destructor: - virtual ~AthHistogramFilterAlgorithm(); - - /** Initialization method invoked by the framework. This method is responsible - * for any bookkeeping of initialization required by the framework itself. - * It will in turn invoke the initialize() method of the derived algorithm, - * and of any sub-algorithms which it creates. - */ - virtual StatusCode sysInitialize(); - - - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /** @brief The standard @c THistSvc (for writing histograms and TTrees - * and more to a root file) - * Returns (kind of) a pointer to the @c THistSvc - */ - const ServiceHandle<ITHistSvc>& histSvc() const; - - - - /////////////////////////////////////////////////////////////////// - // Private methods: - /////////////////////////////////////////////////////////////////// -private: - /// Default constructor: - ///AthHistogramFilterAlgorithm(); - - - - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// -private: - - /// a handle on the Hist/TTree registration service - ServiceHandle<ITHistSvc> m_histSvc; - - - /// Name of the ROOT output stream (file) - std::string m_prefix; - - /// Name of the ROOT directory - std::string m_rootDir; - - /// The prefix for the histogram THx name - std::string m_histNamePrefix; - - /// The postfix for the histogram THx name - std::string m_histNamePostfix; - - /// The prefix for the histogram THx title - std::string m_histTitlePrefix; - - /// The postfix for the histogram THx title - std::string m_histTitlePostfix; - - - -}; - -// I/O operators -////////////////////// - -// For the THistSvc -inline const ServiceHandle<ITHistSvc>& AthHistogramFilterAlgorithm::histSvc() const -{ - return m_histSvc; -} - -#endif //> !ATHENABASECOMPS_ATHHISTOGRAMFILTERALGORITHM_H diff --git a/Control/AthenaBaseComps/AthenaBaseComps/AthHistogramTool.h b/Control/AthenaBaseComps/AthenaBaseComps/AthHistogramTool.h deleted file mode 100644 index 84e091ae716b6dfe0e2595ff62e34bfe26483a89..0000000000000000000000000000000000000000 --- a/Control/AthenaBaseComps/AthenaBaseComps/AthHistogramTool.h +++ /dev/null @@ -1,113 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// AthHistogramTool.h -// Header file for class AthHistogramTool -// Author: Karsten Koeneke -/////////////////////////////////////////////////////////////////// -#ifndef ATHENABASECOMPS_ATHHISTOGRAMTOOL_H -#define ATHENABASECOMPS_ATHHISTOGRAMTOOL_H 1 - -// STL includes -#include <string> - -// Framework includes -#include "AthenaBaseComps/AthAlgTool.h" -#include "AthenaBaseComps/AthHistogramming.h" -#include "GaudiKernel/ServiceHandle.h" - - -// Some needed forward declarations -class ITHistSvc; - - - -class AthHistogramTool - : public ::AthAlgTool, - public ::AthHistogramming -{ - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// -public: - - /// Constructor with parameters: - AthHistogramTool( const std::string& type, - const std::string& name, - const IInterface* parent ); - - - /// Destructor: - virtual ~AthHistogramTool(); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /** @brief The standard @c THistSvc (for writing histograms and TTrees - * and more to a root file) - * Returns (kind of) a pointer to the @c THistSvc - */ - const ServiceHandle<ITHistSvc>& histSvc() const; - - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - - /** Initialization method invoked by the framework. This method is responsible - * for any bookkeeping of initialization required by the framework itself. - * It will in turn invoke the initialize() method of the derived algorithm, - * and of any sub-algorithms which it creates. - */ - virtual StatusCode sysInitialize(); - - - - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// -protected: - - /// Pointer to the THistSvc (event store by default) - ServiceHandle<ITHistSvc> m_histSvc; - - - /// Name of the ROOT output stream (file) - std::string m_prefix; - - /// Name of the ROOT directory - std::string m_rootDir; - - /// The prefix for the histogram THx name - std::string m_histNamePrefix; - - /// The postfix for the histogram THx name - std::string m_histNamePostfix; - - /// The prefix for the histogram THx title - std::string m_histTitlePrefix; - - /// The postfix for the histogram THx title - std::string m_histTitlePostfix; - - -}; - - -/////////////////////////////////////////////////////////////////// -// Inline methods: -/////////////////////////////////////////////////////////////////// - -// For the THistSvc -inline const ServiceHandle<ITHistSvc>& AthHistogramTool::histSvc() const -{ - return m_histSvc; -} - - -#endif //> !ATHENABASECOMPS_ATHHISTOGRAMTOOL_H diff --git a/Control/AthenaBaseComps/src/AthFilterAlgorithm.cxx b/Control/AthenaBaseComps/src/AthFilterAlgorithm.cxx index 73e0009f1e1590a273a498159084bd247bafbbc4..07a2196ae92543c859aeb86960d1a425f4b76713 100644 --- a/Control/AthenaBaseComps/src/AthFilterAlgorithm.cxx +++ b/Control/AthenaBaseComps/src/AthFilterAlgorithm.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 */ // AthFilterAlgorithm.cxx @@ -74,10 +74,10 @@ AthFilterAlgorithm::sysInitialize() if ( Gaudi::StateMachine::INITIALIZED <= FSMState() ) return StatusCode::SUCCESS; // Set the Algorithm's properties - ATH_CHECK(setProperties()); + bindPropertiesTo( serviceLocator()->getOptsSvc() ); // Bypass the initialization if the algorithm is disabled. - // Need to do this after setProperties. + // Need to do this after bindPropertiesTo. if ( !isEnabled( ) ) return StatusCode::SUCCESS; // ---- stolen from GaudiKernel/Algorithm::sysInitialize ------- END --- diff --git a/Control/AthenaBaseComps/src/AthHistogramAlgorithm.cxx b/Control/AthenaBaseComps/src/AthHistogramAlgorithm.cxx index dbdb3798d05db55564dd17648acba2beed6bb4da..6fff2f3b478afe42b8a53bd1fee50e625d0cba13 100644 --- a/Control/AthenaBaseComps/src/AthHistogramAlgorithm.cxx +++ b/Control/AthenaBaseComps/src/AthHistogramAlgorithm.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 */ /// @class AthHistogramAlgorithm.h @@ -80,10 +80,10 @@ StatusCode AthHistogramAlgorithm::sysInitialize() if ( Gaudi::StateMachine::INITIALIZED <= FSMState() ) return StatusCode::SUCCESS; // Set the Algorithm's properties - ATH_CHECK(setProperties()); + bindPropertiesTo( serviceLocator()->getOptsSvc() ); // Bypass the initialization if the algorithm is disabled. - // Need to do this after setProperties. + // Need to do this after bindPropertiesTo. if ( !isEnabled( ) ) return StatusCode::SUCCESS; // ---- stolen from GaudiKernel/Algorithm::sysInitialize ------- END --- diff --git a/Control/AthenaBaseComps/src/AthHistogramFilterAlgorithm.cxx b/Control/AthenaBaseComps/src/AthHistogramFilterAlgorithm.cxx deleted file mode 100644 index a3298420a3ff94b00db862a8a33c1941f3258060..0000000000000000000000000000000000000000 --- a/Control/AthenaBaseComps/src/AthHistogramFilterAlgorithm.cxx +++ /dev/null @@ -1,114 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/// @class AthHistogramFilterAlgorithm.h -/// Header file for class AthHistogramAlgorithm -/// @author: Karsten Koeneke (karsten.koeneke@cern.ch) -/////////////////////////////////////////////////////////////////// - -// This class' header file -#include "AthenaBaseComps/AthHistogramFilterAlgorithm.h" - -// STL includes -#include <string> - -// Framework includes -#include "Gaudi/Property.h" -#include "GaudiKernel/ITHistSvc.h" - - - -/////////////////////////////////////////////////////////////////// -// Public methods: -/////////////////////////////////////////////////////////////////// - -// Constructors -//////////////// -AthHistogramFilterAlgorithm::AthHistogramFilterAlgorithm( const std::string& name, - ISvcLocator* pSvcLocator ) : - ::AthFilterAlgorithm( name, pSvcLocator ), - ::AthHistogramming( name ), - m_histSvc ( "THistSvc/THistSvc", name ) -{ - // - // Property declaration - // - // The histogram service - declareProperty("THistSvc", - m_histSvc = ServiceHandle<ITHistSvc>("THistSvc/THistSvc", name), - "Handle to a THistSvc instance: it will be used to write " - "ROOT objects to ROOT files" ); - - //declareProperty("THistService", m_histSvc, "The THistSvc" ); - declareProperty("RootStreamName", m_prefix = "/ANALYSIS", "Name of the output ROOT stream (file) that the THistSvc uses"); - declareProperty("RootDirName", m_rootDir = "", - "Name of the ROOT directory inside the ROOT file where the histograms will go"); - - declareProperty( "HistNamePrefix", m_histNamePrefix = "", "The prefix for the histogram THx name" ); - declareProperty( "HistNamePostfix", m_histNamePostfix = "", "The postfix for the histogram THx name" ); - - declareProperty( "HistTitlePrefix", m_histTitlePrefix = "", "The prefix for the histogram THx title" ); - declareProperty( "HistTitlePostfix", m_histTitlePostfix = "", "The postfix for the histogram THx title" ); -} - - - - -// Destructor -/////////////// -AthHistogramFilterAlgorithm::~AthHistogramFilterAlgorithm() -{ - ATH_MSG_DEBUG ("Calling destructor"); -} - - - -/** Initialization method invoked by the framework. This method is responsible - * for any bookkeeping of initialization required by the framework itself. - * It will in turn invoke the initialize() method of the derived algorithm, - * and of any sub-algorithms which it creates. - */ -StatusCode AthHistogramFilterAlgorithm::sysInitialize() -{ - // ---- stolen from GaudiKernel/Algorithm::sysInitialize ------- - // Bypass the initialization if the algorithm - // has already been initialized. - if ( Gaudi::StateMachine::INITIALIZED <= FSMState() ) return StatusCode::SUCCESS; - - // Set the Algorithm's properties - ATH_CHECK(setProperties()); - - // Bypass the initialization if the algorithm is disabled. - // Need to do this after setProperties. - if ( !isEnabled( ) ) return StatusCode::SUCCESS; - - // ---- stolen from GaudiKernel/Algorithm::sysInitialize ------- END --- - - - // Get the THistSvc - ATH_CHECK ( histSvc().retrieve() ); - - // Configure the underlying AthHistogramming helper - ATH_CHECK ( AthHistogramming::configAthHistogramming( histSvc(), - m_prefix, m_rootDir, - m_histNamePrefix, m_histNamePostfix, - m_histTitlePrefix, m_histTitlePostfix ) ); - - // Print some setup information into the log file - ATH_MSG_DEBUG ("Initializing " << name() << "..."); - ATH_MSG_DEBUG (" using THistService = " << m_histSvc ); - ATH_MSG_DEBUG (" using RootStreamName = " << m_prefix ); - ATH_MSG_DEBUG (" using RootDirName = " << m_rootDir ); - ATH_MSG_DEBUG (" using HistNamePrefix = " << m_histNamePrefix ); - ATH_MSG_DEBUG (" using HistNamePostfix = " << m_histNamePostfix ); - ATH_MSG_DEBUG (" using HistTitlePrefix = " << m_histTitlePrefix ); - ATH_MSG_DEBUG (" using HistTitlePostfix = " << m_histTitlePostfix ); - - - // re-direct to base class... - return AthFilterAlgorithm::sysInitialize(); -} - diff --git a/Control/AthenaBaseComps/src/AthHistogramTool.cxx b/Control/AthenaBaseComps/src/AthHistogramTool.cxx deleted file mode 100644 index 707641e5233e9e98534471c6065a3d4e7a9726b0..0000000000000000000000000000000000000000 --- a/Control/AthenaBaseComps/src/AthHistogramTool.cxx +++ /dev/null @@ -1,114 +0,0 @@ -///////////////////////// -*- C++ -*- ///////////////////////////// - -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// AthHistogramTool.cxx -// Implementation file for class AthHistogramTool -// Author: Karsten Koeneke -/////////////////////////////////////////////////////////////////// - -// This class' header includes -#include "AthenaBaseComps/AthHistogramTool.h" - -// STL includes -#include <string> - -// Framework includes -#include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/ITHistSvc.h" - - - - -/////////////////////////////////////////////////////////////////// -// Public methods: -/////////////////////////////////////////////////////////////////// - -// Constructors -//////////////// -AthHistogramTool::AthHistogramTool( const std::string& type, - const std::string& name, - const IInterface* parent ) : - ::AthAlgTool( type, name, parent ), - ::AthHistogramming( name ), - m_histSvc ( "THistSvc/THistSvc", name ) -{ - // Properties go here - declareProperty("THistSvc", - m_histSvc = ServiceHandle<ITHistSvc>("THistSvc/THistSvc", name), - "Handle to a THistSvc instance: it will be used to write " - "ROOT objects to ROOT files" ); - - declareProperty("RootStreamName", m_prefix = "/ANALYSIS", "Name of the output ROOT stream (file) that the THistSvc uses"); - declareProperty("RootDirName", m_rootDir = "", - "Name of the ROOT directory inside the ROOT file where the histograms will go"); - - declareProperty( "HistNamePrefix", m_histNamePrefix = "", "The prefix for the histogram THx name" ); - declareProperty( "HistNamePostfix", m_histNamePostfix = "", "The postfix for the histogram THx name" ); - - declareProperty( "HistTitlePrefix", m_histTitlePrefix = "", "The prefix for the histogram THx title" ); - declareProperty( "HistTitlePostfix", m_histTitlePostfix = "", "The postfix for the histogram THx title" ); -} - - - - -// Destructor -/////////////// -AthHistogramTool::~AthHistogramTool() -{ - ATH_MSG_DEBUG ("Calling destructor"); -} - - -/////////////////////////////////////////////////////////////////// -// Non-const methods: -/////////////////////////////////////////////////////////////////// - - -//============================================================================= -// Athena initialize method -//============================================================================= -StatusCode AthHistogramTool::sysInitialize() -{ - /* - // ---- stolen from GaudiKernel/Algorithm::sysInitialize ------- - // Bypass the initialization if the algorithm - // has already been initialized. - if ( Gaudi::StateMachine::INITIALIZED <= FSMState() ) return StatusCode::SUCCESS; - - // Set the Algorithm's properties - ATH_CHECK(setProperties()); - - // Bypass the initialization if the algorithm is disabled. - // Need to do this after setProperties. - if ( !isEnabled( ) ) return StatusCode::SUCCESS; - - // ---- stolen from GaudiKernel/Algorithm::sysInitialize ------- END --- - */ - - // Get the THistSvc - ATH_CHECK ( histSvc().retrieve() ); - - // Configure the underlying AthHistogramming helper - ATH_CHECK ( AthHistogramming::configAthHistogramming( histSvc(), - m_prefix, m_rootDir, - m_histNamePrefix, m_histNamePostfix, - m_histTitlePrefix, m_histTitlePostfix ) ); - - // Print some setup information into the log file - ATH_MSG_DEBUG ("Initializing " << name() << "..."); - ATH_MSG_DEBUG (" using THistService = " << m_histSvc ); - ATH_MSG_DEBUG (" using RootStreamName = " << m_prefix ); - ATH_MSG_DEBUG (" using RootDirName = " << m_rootDir ); - ATH_MSG_DEBUG (" using HistNamePrefix = " << m_histNamePrefix ); - ATH_MSG_DEBUG (" using HistNamePostfix = " << m_histNamePostfix ); - ATH_MSG_DEBUG (" using HistTitlePrefix = " << m_histTitlePrefix ); - ATH_MSG_DEBUG (" using HistTitlePostfix = " << m_histTitlePostfix ); - - - // re-direct to base class... - return AthAlgTool::sysInitialize(); -} diff --git a/Control/AthenaBaseComps/test/AthAlgTool_test.cxx b/Control/AthenaBaseComps/test/AthAlgTool_test.cxx index 681a9368d143a2b8dde46d61c3f247a705a230a8..bbf45192f95bc3988b3620a2d744c6a7fe37bba0 100644 --- a/Control/AthenaBaseComps/test/AthAlgTool_test.cxx +++ b/Control/AthenaBaseComps/test/AthAlgTool_test.cxx @@ -1,8 +1,7 @@ /* - * Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration. + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration. */ -// $Id$ /** * @file AthenaBaseComps/test/AthAlgTool_test.cxx * @author scott snyder <snyder@bnl.gov> @@ -137,7 +136,7 @@ void test1 (ISvcLocator* svcloc) MyAlg alg ("toolalg", svcloc); alg.addRef(); MyAlgTool tool ("MyAlgTool", "tool2", &alg); tool.addRef(); - assert (tool.setProperties().isSuccess()); + tool.bindPropertiesTo(svcloc->getOptsSvc()); assert (tool.sysInitialize().isSuccess()); assert (tool.rkey.clid() == 293847295); @@ -210,14 +209,14 @@ void test2 (ISvcLocator* svcLoc) MyAlg alg ("arralg", svcLoc); alg.addRef(); MyArrAlgTool tool ("MyAlgTool", "arrtool", &alg); tool.addRef(); - assert (tool.setProperties().isSuccess()); + tool.bindPropertiesTo(svcLoc->getOptsSvc()); assert (tool.sysInitialize().isSuccess()); comphandles (tool.inputHandles(),{"StoreGateSvc+raa", "StoreGateSvc+rbb", "StoreGateSvc+rcc", "StoreGateSvc+rdd", "StoreGateSvc+ree", "StoreGateSvc+rff", "StoreGateSvc+rrr"}); comphandles (tool.outputHandles(),{"StoreGateSvc+waa", "StoreGateSvc+wbb", "StoreGateSvc+wcc", "StoreGateSvc+wdd", "StoreGateSvc+wee", "StoreGateSvc+wff", "StoreGateSvc+www"}); // Test that circular dependency detection worksd. MyArrAlgTool tool2 ("MyArrAlgTool", "arrtool2", &alg); tool2.addRef(); - assert (tool2.setProperties().isSuccess()); + tool2.bindPropertiesTo(svcLoc->getOptsSvc()); assert (tool2.sysInitialize().isFailure()); } diff --git a/Control/AthenaBaseComps/test/AthAlgorithm_test.cxx b/Control/AthenaBaseComps/test/AthAlgorithm_test.cxx index 9ae1da40c34af54f9ec0965d9da07f2cf11e7132..323fc19036086d8cc7c37e4441a2cc4d5f6c048d 100644 --- a/Control/AthenaBaseComps/test/AthAlgorithm_test.cxx +++ b/Control/AthenaBaseComps/test/AthAlgorithm_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$ @@ -117,7 +117,6 @@ void test1 (ISvcLocator* svcLoc) std::cout << "test1\n"; MyAlg alg ("ralg", svcLoc); alg.addRef(); - //assert (alg.setProperties().isSuccess()); assert (alg.sysInitialize().isSuccess()); assert (alg.rkey.clid() == 293847295); diff --git a/Control/AthenaBaseComps/test/AthReentrantAlgorithm_test.cxx b/Control/AthenaBaseComps/test/AthReentrantAlgorithm_test.cxx index a0489f7549f66ac55aa3bd3902e3070958e6fb96..19f881f05c4e1066dadb6be13a5bc94f3963d26f 100644 --- a/Control/AthenaBaseComps/test/AthReentrantAlgorithm_test.cxx +++ b/Control/AthenaBaseComps/test/AthReentrantAlgorithm_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id$ @@ -114,7 +114,6 @@ void test1 (ISvcLocator* svcLoc) std::cout << "test1\n"; MyAlg alg ("ralg", svcLoc); alg.addRef(); - //assert (alg.setProperties().isSuccess()); assert (alg.sysInitialize().isSuccess()); assert (alg.rkey.clid() == 293847295); diff --git a/Control/AthenaBaseComps/test/propertyHandling_test.cxx b/Control/AthenaBaseComps/test/propertyHandling_test.cxx index 82bb2e66550cc3fa55514f535b2490f2a7792ba0..05dbdebd0377e3e913716170bd7162813e04fdd2 100644 --- a/Control/AthenaBaseComps/test/propertyHandling_test.cxx +++ b/Control/AthenaBaseComps/test/propertyHandling_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$ @@ -218,7 +218,6 @@ void test1 (ISvcLocator* svcLoc) std::cout << "test1\n"; MyAthAlgorithm alg ("alg", svcLoc); alg.addRef(); - //assert (alg.setProperties().isSuccess()); assert (alg.sysInitialize().isSuccess()); assert (alg.rkey.clid() == 293847295); @@ -315,7 +314,7 @@ void test2 (ISvcLocator* svcLoc) MyAthAlgorithm alg ("alg", svcLoc); alg.addRef(); MyAthAlgTool tool ("MyAthAlgTool", "tool", &alg); tool.addRef(); - assert (tool.setProperties().isSuccess()); + tool.bindPropertiesTo(svcLoc->getOptsSvc()); assert (tool.sysInitialize().isSuccess()); assert (tool.rkey.clid() == 293847295); diff --git a/Control/AthenaConfiguration/python/AutoConfigFlags.py b/Control/AthenaConfiguration/python/AutoConfigFlags.py index b18ebd491b5880941135c1d867e4f99ccda54f41..cc58a4fb4b8a4e48c1f70bb960b5d66a69ebd7a8 100644 --- a/Control/AthenaConfiguration/python/AutoConfigFlags.py +++ b/Control/AthenaConfiguration/python/AutoConfigFlags.py @@ -37,20 +37,21 @@ def _initializeGeometryParameters(geoTag): dbGeomCursor = AtlasGeoDBInterface(geoTag) dbGeomCursor.ConnectAndBrowseGeoDB() - # FIXME: geometry parameter names need to be unique across systems! - params = {} - params.update(CommonGeoDB.InitializeGeometryParameters(dbGeomCursor)) - params.update(PixelGeoDB.InitializeGeometryParameters(dbGeomCursor)) - params.update(LArGeoDB.InitializeGeometryParameters(dbGeomCursor)) - params.update(MuonGeoDB.InitializeGeometryParameters(dbGeomCursor)) + params = { 'Common' : CommonGeoDB.InitializeGeometryParameters(dbGeomCursor), + 'Pixel' : PixelGeoDB.InitializeGeometryParameters(dbGeomCursor), + 'LAr' : LArGeoDB.InitializeGeometryParameters(dbGeomCursor), + 'Muon' : MuonGeoDB.InitializeGeometryParameters(dbGeomCursor) } return params @lru_cache(maxsize=4) # maxsize=1 should be enough for most jobs -def GetDetDescrInfo(geoTag): - """Query geometry DB for detector description""" +def DetDescrInfo(geoTag): + """Query geometry DB for detector description. Returns dictionary with + detector description. Queries DB for each tag only once. + geoTag: gemometry tag (e.g. ATLAS-R2-2016-01-00-01) + """ detDescrInfo = _initializeGeometryParameters(geoTag) detDescrInfo["geomTag"] = geoTag return detDescrInfo diff --git a/Control/AthenaConfiguration/python/DetectorConfigFlags.py b/Control/AthenaConfiguration/python/DetectorConfigFlags.py index 5960b079514a9e85b78a0e8e7eb4f6c9985c6055..886c1dadb2ba26121368cc6f1138182692bff239 100644 --- a/Control/AthenaConfiguration/python/DetectorConfigFlags.py +++ b/Control/AthenaConfiguration/python/DetectorConfigFlags.py @@ -1,9 +1,7 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from __future__ import print_function - from AthenaConfiguration.AthConfigFlags import AthConfigFlags -from AthenaConfiguration.AutoConfigFlags import GetDetDescrInfo +from AthenaConfiguration.AutoConfigFlags import DetDescrInfo # This module is based upon Control/AthenaCommon/python/DetFlags.py # Only some flags have been migrated. A full list of what the old # DetFlags provided is given for reference below: @@ -56,13 +54,13 @@ def createDetectorConfigFlags(): dcf.addFlag('Detector.GeometryLAr', False) # Add separate em HEC and FCAL flags? dcf.addFlag('Detector.GeometryTile', False) - dcf.addFlag('Detector.GeometryCalo', lambda prevFlags : (prevFlags.Detector.GeometryLAr or prevFlags.Detector.GeometryTile)) - dcf.addFlag('Detector.GeometryCSC', lambda prevFlags : GetDetDescrInfo(prevFlags.GeoModel.AtlasVersion).get('HasCSC',"True")) + dcf.addFlag('Detector.GeometryCalo', lambda prevFlags : (prevFlags.Detector.GeometryLAr or prevFlags.Detector.GeometryTile)) + dcf.addFlag('Detector.GeometryCSC', lambda prevFlags : DetDescrInfo(prevFlags.GeoModel.AtlasVersion)['Muon']['HasCSC']) dcf.addFlag('Detector.GeometryMDT', False) dcf.addFlag('Detector.GeometryRPC', False) dcf.addFlag('Detector.GeometryTGC', False) - dcf.addFlag('Detector.GeometrysTGC', lambda prevFlags : GetDetDescrInfo(prevFlags.GeoModel.AtlasVersion).get('HasSTGC',"True")) # Set default according to prevFlags.GeoModel.Run? - dcf.addFlag('Detector.GeometryMM', lambda prevFlags : GetDetDescrInfo(prevFlags.GeoModel.AtlasVersion).get('HasMM',"True")) # Set default according to prevFlags.GeoModel.Run? + dcf.addFlag('Detector.GeometrysTGC', lambda prevFlags : DetDescrInfo(prevFlags.GeoModel.AtlasVersion)['Muon']['HasSTGC']) + dcf.addFlag('Detector.GeometryMM', lambda prevFlags : DetDescrInfo(prevFlags.GeoModel.AtlasVersion)['Muon']['HasMM']) dcf.addFlag('Detector.GeometryMuon', lambda prevFlags : (prevFlags.Detector.GeometryCSC or prevFlags.Detector.GeometryMDT or prevFlags.Detector.GeometryRPC or prevFlags.Detector.GeometryTGC or prevFlags.Detector.GeometrysTGC or prevFlags.Detector.GeometryMM)) diff --git a/Control/AthenaConfiguration/python/GeoModelConfigFlags.py b/Control/AthenaConfiguration/python/GeoModelConfigFlags.py index 077dde3dfd56635d44c254c140d5d5cbea41733c..1c81c50711c90ff6275847f8559edbae2d32da7b 100644 --- a/Control/AthenaConfiguration/python/GeoModelConfigFlags.py +++ b/Control/AthenaConfiguration/python/GeoModelConfigFlags.py @@ -1,15 +1,35 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.AthConfigFlags import AthConfigFlags -from AthenaConfiguration.AutoConfigFlags import GetFileMD, GetDetDescrInfo +from AthenaConfiguration.AutoConfigFlags import GetFileMD, DetDescrInfo def createGeoModelConfigFlags(): gcf=AthConfigFlags() + gcf.addFlag('GeoModel.Layout', 'atlas') # replaces global.GeoLayout - gcf.addFlag("GeoModel.AtlasVersion", lambda prevFlags : (prevFlags.Input.Files and prevFlags.Input.Files != ["_ATHENA_GENERIC_INPUTFILE_NAME_"] and GetFileMD(prevFlags.Input.Files).get("GeoAtlas",None)) or "ATLAS-R2-2016-01-00-01") # - gcf.addFlag("GeoModel.Align.Dynamic", lambda prevFlags : (not prevFlags.Detector.Simulate and not prevFlags.Input.isMC)) - gcf.addFlag("GeoModel.StripGeoType", lambda prevFlags : GetDetDescrInfo(prevFlags.GeoModel.AtlasVersion).get('StripGeoType',"GMX")) # Based on CommonGeometryFlags.StripGeoType - gcf.addFlag("GeoModel.Run", lambda prevFlags : GetDetDescrInfo(prevFlags.GeoModel.AtlasVersion).get('Run',"RUN2")) # Based on CommonGeometryFlags.Run (InDetGeometryFlags.isSLHC replaced by GeoModel.Run=="RUN4") - gcf.addFlag("GeoModel.Type", lambda prevFlags : GetDetDescrInfo(prevFlags.GeoModel.AtlasVersion).get('GeoType',"UNDEFINED")) # Geometry type in {ITKLoI, ITkLoI-VF, etc...} - gcf.addFlag("GeoModel.IBLLayout", lambda prevFlags : GetDetDescrInfo(prevFlags.GeoModel.AtlasVersion).get('IBLlayout',"UNDEFINED")) # IBL layer layout in {"planar", "3D", "noIBL", "UNDEFINED"} + + gcf.addFlag("GeoModel.AtlasVersion", + lambda prevFlags : ((prevFlags.Input.Files and + prevFlags.Input.Files != ["_ATHENA_GENERIC_INPUTFILE_NAME_"] and + GetFileMD(prevFlags.Input.Files).get("GeoAtlas",None)) + or "ATLAS-R2-2016-01-00-01")) + + gcf.addFlag("GeoModel.Align.Dynamic", + lambda prevFlags : not prevFlags.Detector.Simulate and not prevFlags.Input.isMC) + + gcf.addFlag("GeoModel.StripGeoType", + lambda prevFlags : DetDescrInfo(prevFlags.GeoModel.AtlasVersion)['Common']['StripGeoType']) + + gcf.addFlag("GeoModel.Run", + lambda prevFlags : DetDescrInfo(prevFlags.GeoModel.AtlasVersion)['Common']['Run']) + # Based on CommonGeometryFlags.Run (InDetGeometryFlags.isSLHC replaced by GeoModel.Run=="RUN4") + + gcf.addFlag("GeoModel.Type", + lambda prevFlags : DetDescrInfo(prevFlags.GeoModel.AtlasVersion)['Common']['GeoType']) + # Geometry type in {ITKLoI, ITkLoI-VF, etc...} + + gcf.addFlag("GeoModel.IBLLayout", + lambda prevFlags : DetDescrInfo(prevFlags.GeoModel.AtlasVersion)['Pixel']['IBLlayout']) + # IBL layer layout in {"planar", "3D", "noIBL"} + return gcf diff --git a/Control/Navigation/Navigation/NavWrapper.h b/Control/Navigation/Navigation/NavWrapper.h index e0b0f25a700a8470dd4d32f696465efd0f8f3e5a..a49987719980be6b209ba901a859ba9d8508e2ae 100644 --- a/Control/Navigation/Navigation/NavWrapper.h +++ b/Control/Navigation/Navigation/NavWrapper.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 NAVIGATION_NAVWRAPPER_H @@ -201,9 +201,9 @@ class NavWrapper<NavigableTerminalNode> public: /*! \brief Default constructor */ - NavWrapper<NavigableTerminalNode>() { }; + NavWrapper() { }; /*! \brief Base class destructor */ - virtual ~NavWrapper<NavigableTerminalNode>() { }; + virtual ~NavWrapper() { }; /*!{ \brief Do-nothing visitor */ virtual void fillToken(INavigationToken& /*rToken*/) const { }; diff --git a/Control/PerformanceMonitoring/PerfMonComps/python/PerfMonFlags.py b/Control/PerformanceMonitoring/PerfMonComps/python/PerfMonFlags.py index 6dddf2c60f60dfaa2152ed5a94d214bb8a46d619..565bb21ad05de13700d44ffabe18b094df03554a 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/python/PerfMonFlags.py +++ b/Control/PerformanceMonitoring/PerfMonComps/python/PerfMonFlags.py @@ -135,22 +135,22 @@ class doMonitoringMT(JobProperty): svcMgr += PerfMonMTSvc("PerfMonMTSvc") # Setup PerfMonAlg from AthenaCommon.AlgSequence import AthSequencer - topSequence = AthSequencer("AthAlgSeq") - if not hasattr(topSequence, "PerfMonMTAlg"): + algSeq = AthSequencer("AthAlgSeq") + if not hasattr(algSeq, "PerfMonMTAlg"): from PerfMonComps.PerfMonCompsConf import PerfMonMTAlg - topSequence += PerfMonMTAlg("PerfMonMTAlg") + algSeq += PerfMonMTAlg("PerfMonMTAlg") return def _undo_action(self): # Uninstall the service and the algorithm from AthenaCommon.AppMgr import ServiceMgr as svcMgr from AthenaCommon.AlgSequence import AthSequencer - topSequence = AthSequencer("AthAlgSeq") + algSeq = AthSequencer("AthAlgSeq") if hasattr(svcMgr, 'PerfMonMTSvc'): del svcMgr.PerfMonMTSvc - if hasattr(topSequence, 'PerfMonMTAlg'): - del topSequence.PerfMonMTAlg + if hasattr(algSeq, 'PerfMonMTAlg'): + del algSeq.PerfMonMTAlg return # class doFastMonMT(JobProperty): diff --git a/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_jobOptions.py b/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_jobOptions.py index 486cddda601a4f4533e3cdc61f9753fb4c48c69a..b8adada555d2b950e92575b9950033913c317ff6 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_jobOptions.py +++ b/Control/PerformanceMonitoring/PerfMonComps/share/PerfMonMTSvc_jobOptions.py @@ -31,8 +31,9 @@ if not hasattr(svcMgr, 'PerfMonMTSvc'): # Load PerfMonMTAlg ############################### from AthenaCommon.AlgSequence import AthSequencer -topSequence = AthSequencer("AthAlgSeq") -if not hasattr(topSequence, "PerfMonMTAlg"): +algSeq = AthSequencer("AthAlgSeq") +if not hasattr(algSeq, "PerfMonMTAlg"): from PerfMonComps.PerfMonCompsConf import PerfMonMTAlg - topSequence += PerfMonMTAlg("PerfMonMTAlg") + algSeq += PerfMonMTAlg("PerfMonMTAlg") pass +del algSeq diff --git a/Database/APR/RootStorageSvc/src/RootTreeContainer.cpp b/Database/APR/RootStorageSvc/src/RootTreeContainer.cpp index 362130e87f7f1fe2d9a149407a0a74b8d103b4ae..4da3bf9813c50361f3fad42490a81b514d4c4aa4 100755 --- a/Database/APR/RootStorageSvc/src/RootTreeContainer.cpp +++ b/Database/APR/RootStorageSvc/src/RootTreeContainer.cpp @@ -430,7 +430,7 @@ RootTreeContainer::loadObject(void** obj_p, ShapeH /*shape*/, Token::OID_t& oid) ::strcpy(q.c_str, p.c_str); break; case DbColumn::BLOB: - q.blob->adopt((char*)s_char_Blob.m_buffer,s_char_Blob.m_size); + p.blob->adopt((char*)s_char_Blob.m_buffer,s_char_Blob.m_size); s_char_Blob.release(false); break; case DbColumn::POINTER: diff --git a/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.h b/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.h index 40be6a51c67e055926a2947f5b7a40e33853ec05..b078bc2b93d9dc4d82dea95ddb836681f2f3d77d 100755 --- a/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.h +++ b/DetectorDescription/GeoModel/GeoModelSvc/src/GeoModelSvc.h @@ -27,24 +27,24 @@ class GeoModelSvc : public AthService, virtual public IGeoModelSvc, { public: - virtual StatusCode initialize(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; // Query the interfaces. // Input: riid, Requested interface ID // ppvInterface, Pointer to requested interface // Return: StatusCode indicating SUCCESS or FAILURE. // N.B. Don't forget to release the interface after use!!! - virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ); + virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ) override; /// Callback from TagInfoMgr on TagInfo change virtual void tagInfoUpdated() override final; StatusCode compareTags(); - virtual const IGeoModelTool* getTool(std::string toolName) const; + virtual const IGeoModelTool* getTool(std::string toolName) const override; - virtual StatusCode clear(); + virtual StatusCode clear() override; friend class SvcFactory<GeoModelSvc>; @@ -98,32 +98,32 @@ private: int m_supportedGeometry; // Supported geometry flag is set in jobOpt and is equal to major release version bool m_ignoreTagSupport; // If true then don't check SUPPORT flag for ATLAS tag - const std::string & atlasVersion() const {return m_AtlasVersion; } - const std::string & inDetVersionOverride() const {return m_InDetVersionOverride ;} - const std::string & pixelVersionOverride() const {return m_PixelVersionOverride ;} - const std::string & SCT_VersionOverride() const {return m_SCT_VersionOverride ;} - const std::string & TRT_VersionOverride() const {return m_TRT_VersionOverride ;} - const std::string & LAr_VersionOverride() const {return m_LAr_VersionOverride ;} - const std::string & tileVersionOverride() const {return m_TileVersionOverride ;} - const std::string & muonVersionOverride() const {return m_MuonVersionOverride ;} - const std::string & caloVersionOverride() const {return m_CaloVersionOverride ;} - const std::string & magFieldVersionOverride() const {return m_MagFieldVersionOverride ;} - const std::string & cavernInfraVersionOverride() const {return m_CavernInfraVersionOverride ;} - const std::string & forwardDetectorsVersionOverride() const {return m_ForwardDetectorsVersionOverride ;} - - const std::string & inDetVersion() const {return m_geoDbTagSvc->inDetVersion(); } - const std::string & pixelVersion() const {return m_geoDbTagSvc->pixelVersion(); } - const std::string & SCT_Version() const {return m_geoDbTagSvc->SCT_Version(); } - const std::string & TRT_Version() const {return m_geoDbTagSvc->TRT_Version(); } - const std::string & LAr_Version() const {return m_geoDbTagSvc->LAr_Version(); } - const std::string & tileVersion() const {return m_geoDbTagSvc->tileVersion(); } - const std::string & muonVersion() const {return m_geoDbTagSvc->muonVersion(); } - const std::string & caloVersion() const {return m_geoDbTagSvc->caloVersion(); } - const std::string & magFieldVersion() const {return m_geoDbTagSvc->magFieldVersion(); } - const std::string & cavernInfraVersion() const {return m_geoDbTagSvc->cavernInfraVersion(); } - const std::string & forwardDetectorsVersion() const {return m_geoDbTagSvc->forwardDetectorsVersion(); } - - GeoModel::GeoConfig geoConfig() const {return m_geoDbTagSvc->geoConfig();} + virtual const std::string & atlasVersion() const override {return m_AtlasVersion; } + virtual const std::string & inDetVersionOverride() const override {return m_InDetVersionOverride ;} + virtual const std::string & pixelVersionOverride() const override {return m_PixelVersionOverride ;} + virtual const std::string & SCT_VersionOverride() const override {return m_SCT_VersionOverride ;} + virtual const std::string & TRT_VersionOverride() const override {return m_TRT_VersionOverride ;} + virtual const std::string & LAr_VersionOverride() const override {return m_LAr_VersionOverride ;} + virtual const std::string & tileVersionOverride() const override {return m_TileVersionOverride ;} + virtual const std::string & muonVersionOverride() const override {return m_MuonVersionOverride ;} + virtual const std::string & caloVersionOverride() const override {return m_CaloVersionOverride ;} + virtual const std::string & magFieldVersionOverride() const override {return m_MagFieldVersionOverride ;} + virtual const std::string & cavernInfraVersionOverride() const override {return m_CavernInfraVersionOverride ;} + virtual const std::string & forwardDetectorsVersionOverride() const override {return m_ForwardDetectorsVersionOverride ;} + + virtual const std::string & inDetVersion() const override {return m_geoDbTagSvc->inDetVersion(); } + virtual const std::string & pixelVersion() const override {return m_geoDbTagSvc->pixelVersion(); } + virtual const std::string & SCT_Version() const override {return m_geoDbTagSvc->SCT_Version(); } + virtual const std::string & TRT_Version() const override {return m_geoDbTagSvc->TRT_Version(); } + virtual const std::string & LAr_Version() const override {return m_geoDbTagSvc->LAr_Version(); } + virtual const std::string & tileVersion() const override {return m_geoDbTagSvc->tileVersion(); } + virtual const std::string & muonVersion() const override {return m_geoDbTagSvc->muonVersion(); } + virtual const std::string & caloVersion() const override {return m_geoDbTagSvc->caloVersion(); } + virtual const std::string & magFieldVersion() const override {return m_geoDbTagSvc->magFieldVersion(); } + virtual const std::string & cavernInfraVersion() const override {return m_geoDbTagSvc->cavernInfraVersion(); } + virtual const std::string & forwardDetectorsVersion() const override {return m_geoDbTagSvc->forwardDetectorsVersion(); } + + virtual GeoModel::GeoConfig geoConfig() const override {return m_geoDbTagSvc->geoConfig();} StatusCode geoInit (); StatusCode fillTagInfo() const; diff --git a/Event/ByteStreamCnvSvc/ByteStreamCnvSvc/ByteStreamCnvSvc.h b/Event/ByteStreamCnvSvc/ByteStreamCnvSvc/ByteStreamCnvSvc.h index ff91d1b3428342200885e8d7f6246a726bc36b37..1d22d1e27b5a55c616b6e7e3cd247682ed80cb9a 100644 --- a/Event/ByteStreamCnvSvc/ByteStreamCnvSvc/ByteStreamCnvSvc.h +++ b/Event/ByteStreamCnvSvc/ByteStreamCnvSvc/ByteStreamCnvSvc.h @@ -78,15 +78,6 @@ private: /// Services for writing output std::map<std::string, ByteStreamOutputSvc*> m_ioSvcMap; - /// flags for Simulation EventType - Gaudi::Property<bool> m_isSimulation; - /// flags for TestBeam EventType - Gaudi::Property<bool> m_isTestbeam; - /// flags for Calibration EventType - Gaudi::Property<bool> m_isCalibration; - /// flags for getting Detector Mask from COOL - Gaudi::Property<bool> m_getDetectorMask; - /// Event store. ServiceHandle<StoreGateSvc> m_evtStore; diff --git a/Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx b/Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx index 59184f2add55b5ab952c9df2ece362cfee42d0de..49eb3d47afe78e31f5a3bea10b3ffc5ea47a709b 100644 --- a/Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx +++ b/Event/ByteStreamCnvSvc/src/ByteStreamCnvSvc.cxx @@ -36,10 +36,6 @@ ByteStreamCnvSvc::ByteStreamCnvSvc(const std::string& name, ISvcLocator* pSvcLoc m_evtStore ("StoreGateSvc", name) { declareProperty("ByteStreamOutputSvc", m_ioSvcName); - declareProperty("IsSimulation", m_isSimulation = false); - declareProperty("IsTestbeam", m_isTestbeam = false); - declareProperty("IsCalibration", m_isCalibration= false); - declareProperty("GetDetectorMask", m_getDetectorMask = false); declareProperty("UserType", m_userType = "RawEvent"); declareProperty("EventStore", m_evtStore); } diff --git a/Event/ByteStreamCnvSvc/src/EventInfoByteStreamAuxCnv.cxx b/Event/ByteStreamCnvSvc/src/EventInfoByteStreamAuxCnv.cxx index 3eeaf3b09b8732fac25b68d5a2b19fdf53c138c0..ce03636f5f12886552b7ffd022fb9f01c8d08df4 100644 --- a/Event/ByteStreamCnvSvc/src/EventInfoByteStreamAuxCnv.cxx +++ b/Event/ByteStreamCnvSvc/src/EventInfoByteStreamAuxCnv.cxx @@ -3,7 +3,7 @@ */ #include "EventInfoByteStreamAuxCnv.h" -#include "ByteStreamCnvSvc/ByteStreamCnvSvc.h" +#include "ByteStreamCnvSvcBase/ByteStreamCnvSvcBase.h" #include "ByteStreamCnvSvcBase/ByteStreamAddress.h" #include "ByteStreamCnvSvcBase/IROBDataProviderSvc.h" #include "ByteStreamCnvSvc/ByteStreamInputSvc.h" @@ -62,9 +62,9 @@ StatusCode EventInfoByteStreamAuxCnv::initialize() ATH_MSG_ERROR("Cannot get ByteStreamCnvSvc "); return sc; } - m_ByteStreamCnvSvc = dynamic_cast<ByteStreamCnvSvc*>(svc); + m_ByteStreamCnvSvc = dynamic_cast<ByteStreamCnvSvcBase*>(svc); if (!m_ByteStreamCnvSvc) { - ATH_MSG_ERROR("Cannot cast to ByteStreamCnvSvc"); + ATH_MSG_ERROR("Cannot cast to ByteStreamCnvSvcBase"); return StatusCode::FAILURE; } diff --git a/Event/ByteStreamCnvSvc/src/EventInfoByteStreamAuxCnv.h b/Event/ByteStreamCnvSvc/src/EventInfoByteStreamAuxCnv.h index 3f0c988f133bbcf501e854646d41d10ec76c52a0..70e7c0aee0d5de991506990a02dc3553ba6b25d9 100644 --- a/Event/ByteStreamCnvSvc/src/EventInfoByteStreamAuxCnv.h +++ b/Event/ByteStreamCnvSvc/src/EventInfoByteStreamAuxCnv.h @@ -19,7 +19,7 @@ #include "GaudiKernel/ServiceHandle.h" #include "AthenaBaseComps/AthMessaging.h" -class ByteStreamCnvSvc; +class ByteStreamCnvSvcBase; class IROBDataProviderSvc; class StoreGateSvc; @@ -47,7 +47,7 @@ class EventInfoByteStreamAuxCnv : public Converter, public AthMessaging private: std::string ascTime(unsigned int t); //!< convert timestamp to ascii time. - ByteStreamCnvSvc* m_ByteStreamCnvSvc; //!< pointer to BS CnvSvc + ByteStreamCnvSvcBase* m_ByteStreamCnvSvc; //!< pointer to BS CnvSvc ServiceHandle<IROBDataProviderSvc> m_robDataProvider; //!< RODDataProviderSvc handle ServiceHandle<StoreGateSvc> m_mdSvc; //!< TDS handle diff --git a/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase.h b/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase.h index d05293b33992bdd8b62ee0ce127a718485d2be50..ea564f11670f66b0d3bfbd2b4b7bd6979989ea8d 100755 --- a/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase.h +++ b/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase.h @@ -11,13 +11,9 @@ #include "ByteStreamData/RawEvent.h" /** - @class ByteStreamCnvSvcBase - @brief base class for ByteStream conversion service. - - description - This class is used as a conversion service in online HLT - and it is the base class for offline bytestream conversion service. -*/ + * @class ByteStreamCnvSvcBase + * @brief The base class for offline and HLT ByteStream conversion services + */ class ByteStreamCnvSvcBase : public ::AthCnvSvc, public virtual IIncidentListener, public virtual IByteStreamEventAccess { @@ -43,6 +39,20 @@ public: protected: // data std::vector<std::string> m_initCnvs; std::vector<std::string> m_ROD2ROBmap; + +private: + /** @name Flags which are not used by this service. + * It only serves as an entity storing these values and some other components read it from here. + * TODO: Remove this solution and move the properties where they are needed. + */ + ///@{ + /// flags for Simulation EventType + Gaudi::Property<bool> m_isSimulation{this, "IsSimulation", false}; + /// flags for TestBeam EventType + Gaudi::Property<bool> m_isTestbeam{this, "IsTestbeam", false}; + /// flags for Calibration EventType + Gaudi::Property<bool> m_isCalibration{this, "IsCalibration", false}; + ///@} }; #endif diff --git a/Event/ByteStreamData/src/ROBData_t.cxx b/Event/ByteStreamData/src/ROBData_t.cxx index f40385b1987604439de6591e798e1ac42f1d08a2..f26894feb9e4869088b26798167b03bbc4e8f50f 100644 --- a/Event/ByteStreamData/src/ROBData_t.cxx +++ b/Event/ByteStreamData/src/ROBData_t.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -11,12 +11,10 @@ namespace ByteStreamDataTest { - void ROBDataT() { + void ROBDataT(OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment* robFrag) { - typedef OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF; typedef ROBData::iterator IT; - ROBF* robFrag = 0; ROBData* robData = new ROBData(robFrag); ROBData robData2 = *robData; diff --git a/Event/xAOD/xAODMissingET/Root/MissingETAssociation_v1.cxx b/Event/xAOD/xAODMissingET/Root/MissingETAssociation_v1.cxx index 9e4a626858ee930986a15c477821415d447b363e..dc9bb0683a5f4d9aab8fc7e4806f45f4fe8faeb7 100644 --- a/Event/xAOD/xAODMissingET/Root/MissingETAssociation_v1.cxx +++ b/Event/xAOD/xAODMissingET/Root/MissingETAssociation_v1.cxx @@ -17,6 +17,25 @@ using std::vector; namespace xAOD { + // Static accessors + const SG::AuxElement::Accessor<std::vector<float> > MissingETAssociation_v1::m_acc_calpx("calpx"); + const SG::AuxElement::Accessor<std::vector<float> > MissingETAssociation_v1::m_acc_calpy("calpy"); + const SG::AuxElement::Accessor<std::vector<float> > MissingETAssociation_v1::m_acc_calpz("calpz"); + const SG::AuxElement::Accessor<std::vector<float> > MissingETAssociation_v1::m_acc_cale("cale"); + const SG::AuxElement::Accessor<std::vector<float> > MissingETAssociation_v1::m_acc_calsumpt("calsumpt"); + + const SG::AuxElement::Accessor<std::vector<float> > MissingETAssociation_v1::m_acc_trkpx("trkpx"); + const SG::AuxElement::Accessor<std::vector<float> > MissingETAssociation_v1::m_acc_trkpy("trkpy"); + const SG::AuxElement::Accessor<std::vector<float> > MissingETAssociation_v1::m_acc_trkpz("trkpz"); + const SG::AuxElement::Accessor<std::vector<float> > MissingETAssociation_v1::m_acc_trke("trke"); + const SG::AuxElement::Accessor<std::vector<float> > MissingETAssociation_v1::m_acc_trksumpt("trksumpt"); + + const SG::AuxElement::Accessor<float> MissingETAssociation_v1::m_acc_jettrkpx("jettrkpx"); + const SG::AuxElement::Accessor<float> MissingETAssociation_v1::m_acc_jettrkpy("jettrkpy"); + const SG::AuxElement::Accessor<float> MissingETAssociation_v1::m_acc_jettrkpz("jettrkpz"); + const SG::AuxElement::Accessor<float> MissingETAssociation_v1::m_acc_jettrke("jettrke"); + const SG::AuxElement::Accessor<float> MissingETAssociation_v1::m_acc_jettrksumpt("jettrksumpt"); + MissingETBase::Types::bitmask_t getObjMask(size_t objIndex) { if(objIndex==MissingETBase::Numerical::invalidIndex()) return 0; diff --git a/Event/xAOD/xAODMissingET/Root/MissingET_v1.cxx b/Event/xAOD/xAODMissingET/Root/MissingET_v1.cxx index 9b40d5bcacd68950e29dc1330e8f7e4dbbda367d..c76ee8387db53126a4f16830dfb07090558b25a4 100644 --- a/Event/xAOD/xAODMissingET/Root/MissingET_v1.cxx +++ b/Event/xAOD/xAODMissingET/Root/MissingET_v1.cxx @@ -8,6 +8,11 @@ using namespace xAOD; +// Static accessors +const SG::AuxElement::Accessor<float> MissingET_v1::m_acc_mpx("mpx"); +const SG::AuxElement::Accessor<float> MissingET_v1::m_acc_mpy("mpy"); +const SG::AuxElement::Accessor<float> MissingET_v1::m_acc_sumet("sumet"); + MissingET_v1::MissingET_v1( bool createStore ) : SG::AuxElement() { diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.h b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.h index 65691c9afc91bd4eb1f1fe9965d2ef6a4c18f85d..dae8f083d1756d0696d5ece50558126dcf334173 100644 --- a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.h +++ b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.h @@ -426,6 +426,24 @@ namespace xAOD private: std::map<const IParticle*,ConstVec> m_override; + static const SG::AuxElement::Accessor<std::vector<float> > m_acc_calpx; + static const SG::AuxElement::Accessor<std::vector<float> > m_acc_calpy; + static const SG::AuxElement::Accessor<std::vector<float> > m_acc_calpz; + static const SG::AuxElement::Accessor<std::vector<float> > m_acc_cale; + static const SG::AuxElement::Accessor<std::vector<float> > m_acc_calsumpt; + + static const SG::AuxElement::Accessor<std::vector<float> > m_acc_trkpx; + static const SG::AuxElement::Accessor<std::vector<float> > m_acc_trkpy; + static const SG::AuxElement::Accessor<std::vector<float> > m_acc_trkpz; + static const SG::AuxElement::Accessor<std::vector<float> > m_acc_trke; + static const SG::AuxElement::Accessor<std::vector<float> > m_acc_trksumpt; + + static const SG::AuxElement::Accessor<float> m_acc_jettrkpx; + static const SG::AuxElement::Accessor<float> m_acc_jettrkpy; + static const SG::AuxElement::Accessor<float> m_acc_jettrkpz; + static const SG::AuxElement::Accessor<float> m_acc_jettrke; + static const SG::AuxElement::Accessor<float> m_acc_jettrksumpt; + }; // MissingETAssociation_v1 } diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.icc b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.icc index 983d8490ff3b9d88efd792c864ec5c4dca9f0db1..e40baac1d6f6cd38cd533c75d76969a8e1ca2c6b 100644 --- a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.icc +++ b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingETAssociation_v1.icc @@ -101,72 +101,72 @@ inline MissingETBase::Types::objlink_vector_t& xAOD::MissingETAssociation_v1::f_ // ---------------------------------------------------------- constituent vectors inline const std::vector<float>& xAOD::MissingETAssociation_v1::calpx() const -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calpx"); return acc(*this); } +{ return m_acc_calpx(*this); } inline float xAOD::MissingETAssociation_v1::calpx(const IParticle* pPart) const { return this->calpx(this->findIndex(pPart)); } inline const std::vector<float>& xAOD::MissingETAssociation_v1::calpy() const -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calpy"); return acc(*this); } +{ return m_acc_calpy(*this); } inline const std::vector<float>& xAOD::MissingETAssociation_v1::calpz() const -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calpz"); return acc(*this); } +{ return m_acc_calpz(*this); } inline const std::vector<float>& xAOD::MissingETAssociation_v1::cale() const -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("cale"); return acc(*this); } +{ return m_acc_cale(*this); } inline const std::vector<float>& xAOD::MissingETAssociation_v1::calsumpt() const -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calsumpt"); return acc(*this); } +{ return m_acc_calsumpt(*this); } inline std::vector<float>& xAOD::MissingETAssociation_v1::f_calpx() -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calpx"); return acc(*this); } +{ return m_acc_calpx(*this); } inline std::vector<float>& xAOD::MissingETAssociation_v1::f_calpy() -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calpy"); return acc(*this); } +{ return m_acc_calpy(*this); } inline std::vector<float>& xAOD::MissingETAssociation_v1::f_calpz() -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calpz"); return acc(*this); } +{ return m_acc_calpz(*this); } inline std::vector<float>& xAOD::MissingETAssociation_v1::f_cale() -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("cale"); return acc(*this); } +{ return m_acc_cale(*this); } inline std::vector<float>& xAOD::MissingETAssociation_v1::f_calsumpt() -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("calsumpt"); return acc(*this); } +{ return m_acc_calsumpt(*this); } inline const std::vector<float>& xAOD::MissingETAssociation_v1::trkpx() const -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trkpx"); return acc(*this); } +{ return m_acc_trkpx(*this); } inline const std::vector<float>& xAOD::MissingETAssociation_v1::trkpy() const -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trkpy"); return acc(*this); } +{ return m_acc_trkpy(*this); } inline const std::vector<float>& xAOD::MissingETAssociation_v1::trkpz() const -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trkpz"); return acc(*this); } +{ return m_acc_trkpz(*this); } inline const std::vector<float>& xAOD::MissingETAssociation_v1::trke() const -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trke"); return acc(*this); } +{ return m_acc_trke(*this); } inline const std::vector<float>& xAOD::MissingETAssociation_v1::trksumpt() const -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trksumpt"); return acc(*this); } +{ return m_acc_trksumpt(*this); } inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trkpx() -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trkpx"); return acc(*this); } +{ return m_acc_trkpx(*this); } inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trkpy() -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trkpy"); return acc(*this); } +{ return m_acc_trkpy(*this); } inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trkpz() -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trkpz"); return acc(*this); } +{ return m_acc_trkpz(*this); } inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trke() -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trke"); return acc(*this); } +{ return m_acc_trke(*this); } inline std::vector<float>& xAOD::MissingETAssociation_v1::f_trksumpt() -{ static const SG::AuxElement::Accessor<std::vector<float> > acc("trksumpt"); return acc(*this); } +{ return m_acc_trksumpt(*this); } inline float xAOD::MissingETAssociation_v1::jettrkpx() const -{ static const SG::AuxElement::Accessor<float > acc("jettrkpx"); return acc(*this); } +{ return m_acc_jettrkpx(*this); } inline float xAOD::MissingETAssociation_v1::jettrkpy() const -{ static const SG::AuxElement::Accessor<float > acc("jettrkpy"); return acc(*this); } +{ return m_acc_jettrkpy(*this); } inline float xAOD::MissingETAssociation_v1::jettrkpz() const -{ static const SG::AuxElement::Accessor<float > acc("jettrkpz"); return acc(*this); } +{ return m_acc_jettrkpz(*this); } inline float xAOD::MissingETAssociation_v1::jettrke() const -{ static const SG::AuxElement::Accessor<float > acc("jettrke"); return acc(*this); } +{ return m_acc_jettrke(*this); } inline float xAOD::MissingETAssociation_v1::jettrksumpt() const -{ static const SG::AuxElement::Accessor<float > acc("jettrksumpt"); return acc(*this); } +{ return m_acc_jettrksumpt(*this); } inline float& xAOD::MissingETAssociation_v1::f_jettrkpx() -{ static const SG::AuxElement::Accessor<float > acc("jettrkpx"); return acc(*this); } +{ return m_acc_jettrkpx(*this); } inline float& xAOD::MissingETAssociation_v1::f_jettrkpy() -{ static const SG::AuxElement::Accessor<float > acc("jettrkpy"); return acc(*this); } +{ return m_acc_jettrkpy(*this); } inline float& xAOD::MissingETAssociation_v1::f_jettrkpz() -{ static const SG::AuxElement::Accessor<float > acc("jettrkpz"); return acc(*this); } +{ return m_acc_jettrkpz(*this); } inline float& xAOD::MissingETAssociation_v1::f_jettrke() -{ static const SG::AuxElement::Accessor<float > acc("jettrke"); return acc(*this); } +{ return m_acc_jettrke(*this); } inline float& xAOD::MissingETAssociation_v1::f_jettrksumpt() -{ static const SG::AuxElement::Accessor<float > acc("jettrksumpt"); return acc(*this); } +{ return m_acc_jettrksumpt(*this); } // --------------------------------------------------------- misc association flag inline bool xAOD::MissingETAssociation_v1::isMisc() const diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.h b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.h index 58e83cf9d96fdb3fffff9479f7d7689d8957cc94..c11056709e94508f23e417d3d45f70287852834e 100644 --- a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.h +++ b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.h @@ -114,6 +114,10 @@ namespace xAOD private: std::size_t m_nameHash;/*!< @brief Stores the hash for the current f_name string */ + + static const SG::AuxElement::Accessor<float> m_acc_mpx; + static const SG::AuxElement::Accessor<float> m_acc_mpy; + static const SG::AuxElement::Accessor<float> m_acc_sumet; }; } diff --git a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.icc b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.icc index b7edcdda604231a6e3fb2174380a3d6b9d0d05ba..5dbe64ade328efe712c289957836859af299ef0d 100644 --- a/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.icc +++ b/Event/xAOD/xAODMissingET/xAODMissingET/versions/MissingET_v1.icc @@ -11,9 +11,9 @@ inline float xAOD::MissingET_v1::met() const { return sqrt(this->mpx()*this->mpx()+this->mpy()*this->mpy()); } inline float xAOD::MissingET_v1::phi() const { return atan2(this->mpy(),this->mpx()); } -inline float xAOD::MissingET_v1::mpx() const { static const SG::AuxElement::Accessor<float> acc("mpx"); return acc(*this); } -inline float xAOD::MissingET_v1::mpy() const { static const SG::AuxElement::Accessor<float> acc("mpy"); return acc(*this); } -inline float xAOD::MissingET_v1::sumet() const { static const SG::AuxElement::Accessor<float> acc("sumet"); return acc(*this); } +inline float xAOD::MissingET_v1::mpx() const { return m_acc_mpx(*this); } +inline float xAOD::MissingET_v1::mpy() const { return m_acc_mpy(*this); } +inline float xAOD::MissingET_v1::sumet() const { return m_acc_sumet(*this); } inline const std::string& xAOD::MissingET_v1::name() const { static const SG::AuxElement::Accessor<std::string> acc("name"); return acc(*this); } inline std::size_t xAOD::MissingET_v1::nameHash() const { return m_nameHash; } @@ -23,9 +23,9 @@ inline MissingETBase::Types::bitmask_t xAOD::MissingET_v1::source() const { st // MissingET_v1 Inline Functions: Setters // //////////////////////////////////////////// -inline float& xAOD::MissingET_v1::f_mpx() { static const SG::AuxElement::Accessor<float> acc("mpx"); return acc(*this); } -inline float& xAOD::MissingET_v1::f_mpy() { static const SG::AuxElement::Accessor<float> acc("mpy"); return acc(*this); } -inline float& xAOD::MissingET_v1::f_sumet() { static const SG::AuxElement::Accessor<float> acc("sumet"); return acc(*this); } +inline float& xAOD::MissingET_v1::f_mpx() { return m_acc_mpx(*this); } +inline float& xAOD::MissingET_v1::f_mpy() { return m_acc_mpy(*this); } +inline float& xAOD::MissingET_v1::f_sumet() { return m_acc_sumet(*this); } inline std::string& xAOD::MissingET_v1::f_name() { static const SG::AuxElement::Accessor<std::string> acc("name"); return acc(*this); } inline const std::string& xAOD::MissingET_v1::f_nameConst() { static const SG::AuxElement::ConstAccessor<std::string> acc("name"); return acc(*this); } diff --git a/Event/xAOD/xAODTau/Root/TauJet_v3.cxx b/Event/xAOD/xAODTau/Root/TauJet_v3.cxx index b6f641c4e37126a3787074cb9d13afdd0fdbf1ed..ec71140fae76dfc090615eeae8bc7d074fcde206 100644 --- a/Event/xAOD/xAODTau/Root/TauJet_v3.cxx +++ b/Event/xAOD/xAODTau/Root/TauJet_v3.cxx @@ -19,13 +19,6 @@ #include "TauJetAccessors_v3.h" #include "xAODCaloEvent/CaloVertexedTopoCluster.h" -namespace{ - bool - inRange(const double val, const double lo, const double hi){ - return (val>=lo) and (val<=hi); - } - -} namespace xAOD { @@ -112,9 +105,7 @@ namespace xAOD { TauJet_v3::FourMom_t TauJet_v3::p4() const { FourMom_t p4{}; - bool validAnswer = inRange(eta(),-10,10); - validAnswer&= inRange(phi(),-M_PI,+M_PI); - if (validAnswer) p4.SetPtEtaPhiM( pt(), eta(), phi(),m()); + p4.SetPtEtaPhiM( pt(), eta(), phi(),m()); return p4; } diff --git a/ForwardDetectors/ZDC/ZdcConditions/CMakeLists.txt b/ForwardDetectors/ZDC/ZdcConditions/CMakeLists.txt index 881a4389073a92f3cc468d326c657e08ddb45c57..e189131f11ce53c4914ee85b7586bed8f8274876 100644 --- a/ForwardDetectors/ZDC/ZdcConditions/CMakeLists.txt +++ b/ForwardDetectors/ZDC/ZdcConditions/CMakeLists.txt @@ -7,5 +7,5 @@ atlas_subdir( ZdcConditions ) atlas_add_library( ZdcConditions src/*.cxx PUBLIC_HEADERS ZdcConditions - LINK_LIBRARIES AthenaBaseComps AthenaKernel Identifier ZdcIdentifier GaudiKernel StoreGateLib - PRIVATE_LINK_LIBRARIES GeoModelInterfaces ) + LINK_LIBRARIES Identifier ZdcIdentifier + PRIVATE_LINK_LIBRARIES StoreGateLib ) diff --git a/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingService.h b/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingService.h index 3cfead95fcbab866bc76e549322252aa08737cd1..3f44a8c2e84334c18abec1818a151f00dc303c9e 100755 --- a/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingService.h +++ b/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingService.h @@ -17,12 +17,6 @@ class ZdcCablingService { - //friend class ZdcInfoLoader; - //friend class ZdcDetectorTool; - //friend class ZdcDetectorFactory; - friend class ZdcCablingSvc; - //friend class ZdcROD_Decoder; - public: /** get pointer to service instance*/ diff --git a/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingSvc.h b/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingSvc.h deleted file mode 100755 index 4b715e65f8801f7c0cac5949b268d1ab3a31bec6..0000000000000000000000000000000000000000 --- a/ForwardDetectors/ZDC/ZdcConditions/ZdcConditions/ZdcCablingSvc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ZDCCONDITIONS_ZDCCABLINGSVC_H -#define ZDCCONDITIONS_ZDCCABLINGSVC_H - -//#include "GaudiKernel/Service.h" -#include "AthenaBaseComps/AthService.h" -#include "ZdcConditions/ZdcCablingService.h" -#include "AthenaKernel/IOVSvcDefs.h" -#include "GaudiKernel/ServiceHandle.h" -#include "StoreGate/StoreGateSvc.h" - -template <class TYPE> class SvcFactory; -//NGO This is a quick hack to make ZdcCablingService self contained, i.e. this -//NGO wrapper tool takes care of the initialization. -//NGO At some point ZdcCablingService should be made a tool, but this will introduce -//NGO many upstream code changes. - -class ZdcCablingSvc : public AthService -{ - friend class SvcFactory<ZdcCablingSvc>; - - public: - static const InterfaceID& interfaceID(); - ZdcCablingSvc(const std::string& name, ISvcLocator* pSvcLocator); - virtual ~ZdcCablingSvc(){} - - StatusCode initialize(); - StatusCode finalize(); - StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface); - - const ZdcCablingService* cablingService() const { return m_cablingService; } - - private: - - const ZdcCablingService* m_cablingService; - - ServiceHandle<StoreGateSvc> m_detStore; - - int m_cablingType; -}; - -#endif diff --git a/ForwardDetectors/ZDC/ZdcConditions/src/ZdcCablingSvc.cxx b/ForwardDetectors/ZDC/ZdcConditions/src/ZdcCablingSvc.cxx deleted file mode 100755 index 5a732eea9bcf1238b871e369f44b52eeb3395b1a..0000000000000000000000000000000000000000 --- a/ForwardDetectors/ZDC/ZdcConditions/src/ZdcCablingSvc.cxx +++ /dev/null @@ -1,175 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "ZdcConditions/ZdcCablingSvc.h" -#include "GaudiKernel/MsgStream.h" -#include "StoreGate/StoreGateSvc.h" -#include <cstdlib> -#include "GeoModelInterfaces/IGeoModelSvc.h" - -// -//____________________________________________________________________ -static const InterfaceID IID_ZdcCablingSvc("ZdcCablingSvc", 1, 0); -const InterfaceID& ZdcCablingSvc::interfaceID() -{ - return IID_ZdcCablingSvc; -} - -// -//_____________________________________________________________________________ -ZdcCablingSvc::ZdcCablingSvc(const std::string& name, ISvcLocator* pSvcLocator) : - AthService(name, pSvcLocator), - m_cablingService(0), - m_detStore("DetectorStore", name) -{ - declareProperty("CablingType", m_cablingType = 0, "Cabling type: 0 - simulation, 1 - 2009"); -} - -// -//_____________________________________________________________________________ -StatusCode -ZdcCablingSvc::queryInterface(const InterfaceID& riid, void** ppvInterface) -{ - if ( ZdcCablingSvc::interfaceID().versionMatch(riid) ) { - *ppvInterface = dynamic_cast<ZdcCablingSvc*>(this); - } - else { - return Service::queryInterface(riid, ppvInterface); - } - addRef(); - return StatusCode::SUCCESS; -} - -// -//_____________________________________________________________________________ -StatusCode -ZdcCablingSvc::initialize() -{ - MsgStream log(msgSvc(),name()); - log <<MSG::DEBUG <<"In initialize() " << endmsg; - - //=== initialize base class - if(Service::initialize().isFailure()){ - log << MSG::ERROR << "Unable to initialize base class" << endmsg; - } - - //=== set properties - if(setProperties().isFailure()){ - log << MSG::ERROR << "Unable to set properties" << endmsg; - } - - //=== - if(m_detStore.retrieve().isFailure()){ - log << MSG::ERROR << "Unable to retrieve " << m_detStore << endmsg; - return StatusCode::FAILURE; - } - //=== retrieve all helpers from detector store - - /* - const ZdcLVL1_ID* zdcL1ID(0); - if(m_detStore->retrieve(caloID).isFailure()){ - log << MSG::ERROR << "Unable to retrieve ZdcLVL1_ID helper from DetectorStore" << endmsg; - return StatusCode::FAILURE; - } - */ - - //=== Initialize ZdcCablingService singleton - m_cablingService = ZdcCablingService::getInstance(); - if(!m_cablingService){ - log << MSG::ERROR << "Cannot get instance of ZdcCablingService"<< endmsg ; - return StatusCode::FAILURE ; - } - - IGeoModelSvc *geoModel=0; - StatusCode sc = service("GeoModelSvc", geoModel); - if(sc.isFailure()) - { - log << MSG::ERROR << "Could not locate GeoModelSvc" << endmsg; - } else { - // check the DetDescr version - std::string atlasVersion = geoModel->atlasVersion(); - int geo = atlasVersion.compare(0,9,"ATLAS-GEO"); - int ibl = atlasVersion.compare(0,9,"ATLAS-IBL"); - int slhc = atlasVersion.compare(0,10,"ATLAS-SLHC"); - int comm = atlasVersion.compare(0,10,"ATLAS-Comm"); - - if (geo == 0 || ibl == 0 || slhc == 0) { - log << MSG::INFO << "New ATLAS geometry detected: " << atlasVersion << endmsg; - m_cablingType = 2; - } else if (comm == 0) { - log << MSG::INFO << "ATLAS Commissioning geometry detected: " << atlasVersion << endmsg; - m_cablingType = 2; - } else { - log << MSG::INFO << "Old ATLAS geometry detected: " << atlasVersion << endmsg; - // in this case change cabling type only if it is not set via jobOptions - if (m_cablingType < -1 || m_cablingType > 3) - m_cablingType = 0; - else - log << MSG::INFO << "Using cabling type from jobOptions " << endmsg; - } - } - - MSG::Level logLevel = log.level(); - if (logLevel <= MSG::VERBOSE) { - - // checking all HWIDs - std::cout << "===============================" << std::endl; - - // should do something similar for zdc - /* - for (int ros=1; ros<5; ++ros) { - for (int drawer=0; drawer<64; ++drawer) { - for (int channel=0; channel<48; ++channel) { - - HWIdentifier hwid1 = tileHWID->channel_id(ros,drawer,channel); - std::cout << " hw1=" << tileHWID->to_string(hwid1,-1); - Identifier id1 = m_cablingService->h2s_pmt_id(hwid1); - std::cout << " id1=" << tileID->to_string(id1,-1); - HWIdentifier hwid2 = m_cablingService->s2h_channel_id(id1); - if (hwid2 != hwid1) std::cout << " hw1!=hw2=" << tileHWID->to_string(hwid2,-1); - Identifier id2 = m_cablingService->h2s_pmt_id(hwid2); - if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2,-1); - std::cout << std::endl; - } - } - } - */ - - // check all ID's - /* - std::cout << "===============================" << std::endl; - - for (int side=-1; side<2; side+=2) { - for (int module=0; module<64; ++module) { - for (int tower=13; tower<16; tower+=2) { - - Identifier id1 = tileID->pmt_id(3, side, module, tower, 3, 0); - std::cout << " id1=" << tileID->to_string(id1,-1); - HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1); - std::cout << " hw1=" << tileHWID->to_string(hw1,-1); - Identifier id2 = m_cablingService->h2s_pmt_id(hw1); - if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2,-1); - HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2); - if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2,-1); - std::cout << std::endl; - } - } - } - */ - - } - - return StatusCode::SUCCESS; -} - -// -//_____________________________________________________________________________ -StatusCode -ZdcCablingSvc::finalize() -{ - MsgStream log(msgSvc(),name()); - log << MSG::DEBUG << "finalize called, deleting ZdcCablingService instance" << endmsg; - m_cablingService->deleteInstance(); - return StatusCode::SUCCESS; -} diff --git a/Generators/TrackRecordGenerator/src/TrackRecordGenerator.cxx b/Generators/TrackRecordGenerator/src/TrackRecordGenerator.cxx index dc65128f35d4496d1e7dc948b399d4cbecddecd7..d8680020ac33206ba97e0430507671e5a4a4ef97 100644 --- a/Generators/TrackRecordGenerator/src/TrackRecordGenerator.cxx +++ b/Generators/TrackRecordGenerator/src/TrackRecordGenerator.cxx @@ -86,8 +86,8 @@ StatusCode TrackRecordGenerator::callGenerator() { double dPhi = std::atan2( m_smearTR, R ); dPhi = CLHEP::RandFlat::shoot( &randomEngine(), -dPhi, dPhi ); double theta = std::atan2( particle4Position.x() , particle4Position.y() ); - particle4Position.setX( R*sin( theta + dPhi ) ); - particle4Position.setY( R*cos( theta + dPhi ) ); + particle4Position.setX( R*std::sin( theta + dPhi ) ); + particle4Position.setY( R*std::cos( theta + dPhi ) ); } ATH_MSG_DEBUG( "Shifted track record to " << particle4Position ); } @@ -182,11 +182,11 @@ StatusCode TrackRecordGenerator::fillEvt(HepMC::GenEvent* event) { // event is responsible for those pointers. // Create the particle, and specify its polarization. - HepMC::GenParticle* particle = new HepMC::GenParticle( m_fourMom[v], m_pdgCode[v], 1); - particle->set_polarization( m_polarization[v] ); + HepMC::GenParticlePtr particle = HepMC::newGenParticlePtr( HepMC::FourVector(m_fourMom[v].x(),m_fourMom[v].y(),m_fourMom[v].z(),m_fourMom[v].t()), m_pdgCode[v], 1); + HepMC::set_polarization(particle, m_polarization[v]); // Create the vertex, and add the particle to the vertex. - HepMC::GenVertex* vertex = new HepMC::GenVertex(m_fourPos[v]); + HepMC::GenVertexPtr vertex = HepMC::newGenVertexPtr(HepMC::FourVector(m_fourPos[v].x(),m_fourPos[v].y(),m_fourPos[v].z(),m_fourPos[v].t())); vertex->add_particle_out( particle ); // Add the vertex to the event. diff --git a/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamCnvSvc.cxx b/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamCnvSvc.cxx index 56b749809ac314e6b3f8f5b91bb09ec3bd45c899..1d947bebe7bcbedafca88bf45ba6817e9ae0b2a4 100644 --- a/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamCnvSvc.cxx +++ b/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamCnvSvc.cxx @@ -84,7 +84,7 @@ namespace { // Standard constructor // ============================================================================= TrigByteStreamCnvSvc::TrigByteStreamCnvSvc(const std::string& name, ISvcLocator* svcLoc) -: ByteStreamCnvSvc(name, svcLoc) {} +: ByteStreamCnvSvcBase(name, svcLoc) {} // ============================================================================= // Standard destructor @@ -96,7 +96,7 @@ TrigByteStreamCnvSvc::~TrigByteStreamCnvSvc() {} // ============================================================================= StatusCode TrigByteStreamCnvSvc::initialize() { ATH_MSG_VERBOSE("start of " << __FUNCTION__); - ATH_CHECK(ByteStreamCnvSvc::initialize()); + ATH_CHECK(ByteStreamCnvSvcBase::initialize()); ATH_CHECK(m_evtStore.retrieve()); ATH_CHECK(m_robDataProviderSvc.retrieve()); if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve()); @@ -114,7 +114,7 @@ StatusCode TrigByteStreamCnvSvc::finalize() { if (m_evtStore.release().isFailure()) ATH_MSG_WARNING("Failed to release service " << m_evtStore.typeAndName()); ATH_MSG_VERBOSE("end of " << __FUNCTION__); - ATH_CHECK(ByteStreamCnvSvc::finalize()); + ATH_CHECK(ByteStreamCnvSvcBase::finalize()); return StatusCode::SUCCESS; } @@ -122,22 +122,19 @@ StatusCode TrigByteStreamCnvSvc::finalize() { // Implementation of IConversionSvc::connectOutput // The argument outputFile is not used // ============================================================================= -StatusCode TrigByteStreamCnvSvc::connectOutput(const std::string& /*outputFile*/) { - ATH_MSG_VERBOSE("start of " << __FUNCTION__); +StatusCode TrigByteStreamCnvSvc::connectOutput(const std::string& outputFile) { + const EventContext* eventContext = currentContext(); + if (eventContext == nullptr) return StatusCode::FAILURE; + return connectOutput(outputFile, *eventContext); +} - // Get the EventContext via event store because the interface doesn't allow passing it explicitly as an argument - // and we don't want to use ThreadLocalContext. Don't use ReadHandle here because it calls ThreadLocalContext if - // not given a context (which we want to retrieve). - const EventContext* eventContext = nullptr; - if (m_evtStore->retrieve(eventContext).isFailure()) { - ATH_MSG_ERROR("Failed to retrieve EventContext from the event store"); - return StatusCode::FAILURE; - } +StatusCode TrigByteStreamCnvSvc::connectOutput(const std::string& /*outputFile*/, const EventContext& eventContext) { + ATH_MSG_VERBOSE("start of " << __FUNCTION__); - ATH_MSG_DEBUG("Creating new RawEventWrite for EventContext = " << *eventContext); + ATH_MSG_DEBUG("Creating new RawEventWrite for EventContext = " << eventContext); // Create a new RawEventWrite and copy the header from the input RawEvent - RawEventWrite* re = setRawEvent (std::make_unique<RawEventWrite>()); - const uint32_t* inputRawEvent = m_robDataProviderSvc->getEvent(*eventContext)->start(); + RawEventWrite* re = setRawEvent(std::make_unique<RawEventWrite>(), eventContext); + const uint32_t* inputRawEvent = m_robDataProviderSvc->getEvent(eventContext)->start(); if (!inputRawEvent) { ATH_MSG_ERROR("Input RawEvent is nullptr, cannot create output"); return StatusCode::FAILURE; @@ -163,12 +160,18 @@ StatusCode TrigByteStreamCnvSvc::connectOutput(const std::string& outputFile, co // The arguments outputFile and do_commit are not used // NOTE: In online HLT, m_rawEventWrite is not a full event, it contains only the HLTResult ROBFragments // ============================================================================= -StatusCode TrigByteStreamCnvSvc::commitOutput(const std::string& /*outputFile*/, bool /*do_commit*/) { +StatusCode TrigByteStreamCnvSvc::commitOutput(const std::string& outputFile, bool do_commit) { + const EventContext* eventContext = currentContext(); + if (eventContext == nullptr) return StatusCode::FAILURE; + return commitOutput(outputFile, do_commit, *eventContext); +} + +StatusCode TrigByteStreamCnvSvc::commitOutput(const std::string& /*outputFile*/, bool /*do_commit*/, const EventContext& eventContext) { ATH_MSG_VERBOSE("start of " << __FUNCTION__); - if (msgLvl(MSG::DEBUG)) printRawEvent(); + if (msgLvl(MSG::DEBUG)) printRawEvent(eventContext); - RawEventWrite* re = getRawEvent(); + RawEventWrite* re = getRawEvent(eventContext); // Serialise the output FullEventFragment std::unique_ptr<uint32_t[]> rawEventPtr; @@ -184,10 +187,12 @@ StatusCode TrigByteStreamCnvSvc::commitOutput(const std::string& /*outputFile*/, } catch (const std::exception& e) { ATH_MSG_ERROR("FullEventFragment serialisation failed, caught an unexpected std::exception " << e.what()); + clearRawEvent(eventContext); return StatusCode::FAILURE; } catch (...) { ATH_MSG_ERROR("FullEventFragment serialisation failed, caught an unexpected exception"); + clearRawEvent(eventContext); return StatusCode::FAILURE; } @@ -215,12 +220,48 @@ StatusCode TrigByteStreamCnvSvc::commitOutput(const std::string& /*outputFile*/, result = StatusCode::FAILURE; } - setRawEvent (std::unique_ptr<RawEventWrite>()); + clearRawEvent(eventContext); ATH_MSG_VERBOSE("end of " << __FUNCTION__); return result; } +// ============================================================================= +const EventContext* TrigByteStreamCnvSvc::currentContext() const { + // Get the EventContext via event store because the base class doesn't allow passing it explicitly as an argument + // and we don't want to use ThreadLocalContext. Don't use ReadHandle here because it calls ThreadLocalContext if + // not given a context (which we want to retrieve). This relies on IHiveWhiteBoard::selectStore being called on the + // current thread before we arrive here (it is done in HltEventLoopMgr). + const EventContext* eventContext = nullptr; + if (m_evtStore->retrieve(eventContext).isFailure()) { + ATH_MSG_ERROR("Failed to retrieve EventContext from the event store"); + } + return eventContext; +} + +// ============================================================================= +RawEventWrite* TrigByteStreamCnvSvc::getRawEvent() { + const EventContext* eventContext = currentContext(); + if (eventContext == nullptr) return nullptr; + return getRawEvent(*eventContext); +} + +// ============================================================================= +RawEventWrite* TrigByteStreamCnvSvc::getRawEvent(const EventContext& eventContext) const { + return m_rawEventWriteCache.get(eventContext)->get(); +} + +// ============================================================================= +RawEventWrite* TrigByteStreamCnvSvc::setRawEvent(std::unique_ptr<RawEventWrite>&& rawEventWrite, const EventContext& eventContext) { + *(m_rawEventWriteCache.get(eventContext)) = std::move(rawEventWrite); + return getRawEvent(eventContext); +} + +// ============================================================================= +void TrigByteStreamCnvSvc::clearRawEvent(const EventContext& eventContext) { + m_rawEventWriteCache.get(eventContext)->reset(); +} + // ============================================================================= void TrigByteStreamCnvSvc::monitorRawEvent(const std::unique_ptr<uint32_t[]>& rawEventPtr) const { // Create a read fragment from the pointer @@ -346,8 +387,8 @@ void TrigByteStreamCnvSvc::monitorRawEvent(const std::unique_ptr<uint32_t[]>& ra } // ============================================================================= -void TrigByteStreamCnvSvc::printRawEvent() { - RawEventWrite* re = getRawEvent(); +void TrigByteStreamCnvSvc::printRawEvent(const EventContext& eventContext) const { + RawEventWrite* re = getRawEvent(eventContext); if (!re) { ATH_MSG_WARNING("RawEventWrite pointer is null"); diff --git a/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamCnvSvc.h b/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamCnvSvc.h index 55e6e0d026e72b8f855d191427a97fddff0c2717..3f3cb49387bf81b1664ea6bc843c60815983e52f 100644 --- a/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamCnvSvc.h +++ b/HLT/Event/TrigByteStreamCnvSvc/src/TrigByteStreamCnvSvc.h @@ -5,8 +5,9 @@ #ifndef TRIGBYTESTREAMCNVSVC_H #define TRIGBYTESTREAMCNVSVC_H -#include "ByteStreamCnvSvc/ByteStreamCnvSvc.h" +#include "ByteStreamCnvSvcBase/ByteStreamCnvSvcBase.h" #include "AthenaMonitoringKernel/Monitored.h" +#include "AthenaKernel/SlotSpecificObj.h" // Forward declarations class StoreGateSvc; @@ -17,11 +18,8 @@ class IROBDataProviderSvc; * * It overrides the connectOutput and commitOutput methods of the base class. In this implementation, they create * the specific online HLT output and send it out directly to the TDAQ infrastructure without using an output service. - * - * It needs to inherit from ByteStreamCnvSvc rather than ByteStreamCnvSvcBase, because some elements of the athena - * framework (particularly converters) rely on the properties or functionality of the offline ByteStreamCnvSvc. **/ -class TrigByteStreamCnvSvc : public ByteStreamCnvSvc { +class TrigByteStreamCnvSvc : public ByteStreamCnvSvcBase { public: /// Standard constructor TrigByteStreamCnvSvc(const std::string& name, ISvcLocator* svcLoc); @@ -34,24 +32,42 @@ public: // ------------------------- IConversionSvc methods -------------------------- /// In the case of online BS data, this method creates the output FullEventFragment and fills its header - using ByteStreamCnvSvcBase::connectOutput; virtual StatusCode connectOutput(const std::string& outputFile) override; + /// In the case of online BS data, this method creates the output FullEventFragment and fills its header + StatusCode connectOutput(const std::string& outputFile, const EventContext& eventContext); /// This overload is kept only for interface compatibility virtual StatusCode connectOutput(const std::string& outputFile, const std::string& openMode) override; /// In the case of online BS data, this method binds and sends out the output FullEventFragment virtual StatusCode commitOutput(const std::string& outputFile, bool do_commit) override; + /// In the case of online BS data, this method binds and sends out the output FullEventFragment + StatusCode commitOutput(const std::string& outputFile, bool do_commit, const EventContext& eventContext); + + // ------------------------- IByteStreamEventAccess methods ------------------ + /// Return a pointer to the raw event for the current event context + virtual RawEventWrite* getRawEvent() override; + /// Return a pointer to the raw event for the given event context + RawEventWrite* getRawEvent(const EventContext& eventContext) const; private: // ------------------------- Helper methods ---------------------------------- - /// Print contents of m_rawEventWrite - void printRawEvent(); + /// Store new raw event in the cache + RawEventWrite* setRawEvent(std::unique_ptr<RawEventWrite>&& rawEventWrite, const EventContext& eventContext); + /// Delete raw event from the cache + void clearRawEvent(const EventContext& eventContext); + /// Print contents of the raw event + void printRawEvent(const EventContext& eventContext) const; /// Fill histograms from contents of a FullEventFragment void monitorRawEvent(const std::unique_ptr<uint32_t[]>& rawEventPtr) const; + /// Hack used in HLT to avoid using ThreadLocalContext, see explanation in the implementation + const EventContext* currentContext() const; // ------------------------- Service / Tool handles -------------------------- ServiceHandle<StoreGateSvc> m_evtStore {this, "EventStore", "StoreGateSvc"}; ServiceHandle<IROBDataProviderSvc> m_robDataProviderSvc {this, "ROBDataProvider", "ROBDataProviderSvc"}; ToolHandle<GenericMonitoringTool> m_monTool {this, "MonTool", "" , "Monitoring tool"}; + + // ------------------------- Other private members --------------------------- + SG::SlotSpecificObj<std::unique_ptr<RawEventWrite>> m_rawEventWriteCache; }; #endif // TRIGBYTESTREAMCNVSVC_H diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py index 3ab63159c016aa58e473287a7e1cb4ac07a31311..f26f7beab959df653de0e9843790f9620c82cdb7 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/python/PixelConditionsConfig.py @@ -53,16 +53,23 @@ def PixelConfigCondAlgCfg(flags, name="PixelConfigCondAlg", **kwargs): #==================================================================================== # Run-dependent SIMULATION(digitization) parameters: #==================================================================================== - # RUN2 2015/2016 + # RUN2 2015/2016 (mc16a) + # The pixel conditions are matched with 2016 data (mc16a) at L=17.3fb-1 (run#303638). CondArgs.update( - BarrelToTThreshold2016 = [ -1, 5, 5, 5], - FEI3BarrelLatency2016 = [ 0, 151, 256, 256], - FEI3BarrelHitDuplication2016 = [False,False,False,False], - FEI3BarrelSmallHitToT2016 = [ -1, -1, -1, -1], - FEI3BarrelTimingSimTune2016 = [ -1, 2015, 2015, 2015], - BarrelCrossTalk2016 = [ 0.30, 0.06, 0.06, 0.06], - BarrelNoiseOccupancy2016 = [ 5e-8, 5e-8, 5e-8, 5e-8], - BarrelDisableProbability2016 = [ 9e-3, 9e-3, 9e-3, 9e-3], + BarrelToTThreshold2016 = [ -1, 5, 5, 5], + FEI3BarrelLatency2016 = [ 0, 151, 256, 256], + FEI3BarrelHitDuplication2016 = [ False, False, False, False], + FEI3BarrelSmallHitToT2016 = [ -1, -1, -1, -1], + FEI3BarrelTimingSimTune2016 = [ -1, 2015, 2015, 2015], + BarrelCrossTalk2016 = [ 0.30, 0.06, 0.06, 0.06], + BarrelNoiseOccupancy2016 = [ 5e-8, 5e-8, 5e-8, 5e-8], + BarrelDisableProbability2016 = [ 9e-3, 9e-3, 9e-3, 9e-3], + DefaultBarrelBiasVoltage2016 = [ 80.0, 350.0, 200.0, 150.0], + BarrelFluence2016 = [0.80e14,1.61e14,0.71e14,0.48e14], + BarrelFluenceMap2016 = ["PixelDigitization/maps_IBL_PL_80V_fl0_8e14.root", + "PixelDigitization/maps_PIX_350V_fl1_61e14.root", + "PixelDigitization/maps_PIX_200V_fl0_71e14.root", + "PixelDigitization/maps_PIX_150V_fl0_48e14.root"], EndcapToTThreshold2016 = [ 5, 5, 5], FEI3EndcapLatency2016 = [ 256, 256, 256], FEI3EndcapHitDuplication2016 = [False,False,False], @@ -85,16 +92,23 @@ def PixelConfigCondAlgCfg(flags, name="PixelConfigCondAlg", **kwargs): # [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1735, 0.3380, 0.4733, 0.5829, 0.6730, 0.7516, 0.8234, 0.8916, 0.9595, 1.0]] ) #==================================================================================== - # RUN2 2017 + # RUN2 2017 (mc16d) + # The pixel conditions are matched with 2017 data (mc16d) at L=69.0fb-1 (run#336506). CondArgs.update( - BarrelToTThreshold2017 = [ -1, 5, 5, 5], - FEI3BarrelLatency2017 = [ 0, 151, 256, 256], - FEI3BarrelHitDuplication2017 = [False,False,False,False], - FEI3BarrelSmallHitToT2017 = [ -1, -1, -1, -1], - FEI3BarrelTimingSimTune2017 = [ -1, 2018, 2018, 2018], - BarrelCrossTalk2017 = [ 0.30, 0.06, 0.06, 0.06], - BarrelNoiseOccupancy2017 = [ 5e-8, 5e-8, 5e-8, 5e-8], - BarrelDisableProbability2017 = [ 9e-3, 9e-3, 9e-3, 9e-3], + BarrelToTThreshold2017 = [ -1, 5, 5, 5], + FEI3BarrelLatency2017 = [ 0, 151, 256, 256], + FEI3BarrelHitDuplication2017 = [ False, False, False, False], + FEI3BarrelSmallHitToT2017 = [ -1, -1, -1, -1], + FEI3BarrelTimingSimTune2017 = [ -1, 2018, 2018, 2018], + BarrelCrossTalk2017 = [ 0.30, 0.06, 0.06, 0.06], + BarrelNoiseOccupancy2017 = [ 5e-8, 5e-8, 5e-8, 5e-8], + BarrelDisableProbability2017 = [ 9e-3, 9e-3, 9e-3, 9e-3], + DefaultBarrelBiasVoltage2017 = [ 350.0, 350.0, 200.0, 150.0], + BarrelFluence2017 = [3.18e14,3.42e14,1.50e14,1.01e14], + BarrelFluenceMap2017 = ["PixelDigitization/maps_IBL_PL_350V_fl3_18e14.root", + "PixelDigitization/maps_PIX_350V_fl3_42e14.root", + "PixelDigitization/maps_PIX_200V_fl1_5e14.root", + "PixelDigitization/maps_PIX_150V_fl1_01e14.root"], EndcapToTThreshold2017 = [ 5, 5, 5], FEI3EndcapLatency2017 = [ 256, 256, 256], FEI3EndcapHitDuplication2017 = [False,False,False], @@ -112,16 +126,23 @@ def PixelConfigCondAlgCfg(flags, name="PixelConfigCondAlg", **kwargs): PixelNoiseShape2017 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0], ) #==================================================================================== - # RUN2 2018 + # RUN2 2018 (mc16e) + # The pixel conditions are matched with 2018 data (mc16e) at L=119.4fb-1 (run#357193). CondArgs.update( - BarrelToTThreshold2018 = [ -1, 3, 5, 5], - FEI3BarrelLatency2018 = [ 0, 151, 256, 256], - FEI3BarrelHitDuplication2018 = [False,False,False,False], - FEI3BarrelSmallHitToT2018 = [ -1, -1, -1, -1], - FEI3BarrelTimingSimTune2018 = [ -1, 2018, 2018, 2018], - BarrelCrossTalk2018 = [ 0.30, 0.06, 0.06, 0.06], - BarrelNoiseOccupancy2018 = [ 5e-8, 5e-8, 5e-8, 5e-8], - BarrelDisableProbability2018 = [ 9e-3, 9e-3, 9e-3, 9e-3], + BarrelToTThreshold2018 = [ -1, 3, 5, 5], + FEI3BarrelLatency2018 = [ 0, 151, 256, 256], + FEI3BarrelHitDuplication2018 = [ False, False, False, False], + FEI3BarrelSmallHitToT2018 = [ -1, -1, -1, -1], + FEI3BarrelTimingSimTune2018 = [ -1, 2018, 2018, 2018], + BarrelCrossTalk2018 = [ 0.30, 0.06, 0.06, 0.06], + BarrelNoiseOccupancy2018 = [ 5e-8, 5e-8, 5e-8, 5e-8], + BarrelDisableProbability2018 = [ 9e-3, 9e-3, 9e-3, 9e-3], + DefaultBarrelBiasVoltage2018 = [ 400.0, 400.0, 250.0, 250.0], + BarrelFluence2018 = [5.50e14,5.19e14,2.28e14,1.53e14], + BarrelFluenceMap2018 = ["PixelDigitization/maps_IBL_PL_400V_fl5_5e14.root", + "PixelDigitization/maps_PIX_400V_fl5_19e14.root", + "PixelDigitization/maps_PIX_250V_fl2_28e14.root", + "PixelDigitization/maps_PIX_250V_fl1_53e14.root"], EndcapToTThreshold2018 = [ 5, 5, 5], FEI3EndcapLatency2018 = [ 256, 256, 256], FEI3EndcapHitDuplication2018 = [False,False,False], @@ -141,14 +162,19 @@ def PixelConfigCondAlgCfg(flags, name="PixelConfigCondAlg", **kwargs): #==================================================================================== # RUN1 CondArgs.update( - BarrelToTThresholdRUN1 = [ 3, 3, 3], - FEI3BarrelLatencyRUN1 = [ 256, 256, 256], - FEI3BarrelHitDuplicationRUN1 = [ True, True, True], - FEI3BarrelSmallHitToTRUN1 = [ 7, 7, 7], - FEI3BarrelTimingSimTuneRUN1 = [ 2009, 2009, 2009], - BarrelCrossTalkRUN1 = [ 0.06, 0.06, 0.06], - BarrelNoiseOccupancyRUN1 = [ 5e-8, 5e-8, 5e-8], - BarrelDisableProbabilityRUN1 = [ 9e-3, 9e-3, 9e-3], + BarrelToTThresholdRUN1 = [ 3, 3, 3], + FEI3BarrelLatencyRUN1 = [ 256, 256, 256], + FEI3BarrelHitDuplicationRUN1 = [ True, True, True], + FEI3BarrelSmallHitToTRUN1 = [ 7, 7, 7], + FEI3BarrelTimingSimTuneRUN1 = [ 2009, 2009, 2009], + BarrelCrossTalkRUN1 = [ 0.06, 0.06, 0.06], + BarrelNoiseOccupancyRUN1 = [ 5e-8, 5e-8, 5e-8], + BarrelDisableProbabilityRUN1 = [ 9e-3, 9e-3, 9e-3], + DefaultBarrelBiasVoltageRUN1 = [ 150.0, 150.0, 150.0], + BarrelFluenceRUN1 = [1.01e14,0.44e14,0.30e14], + BarrelFluenceMapRUN1 = ["PixelDigitization/maps_PIX_250V_fl1_01e14.root", + "PixelDigitization/maps_PIX_150V_fl0_44e14.root", + "PixelDigitization/maps_PIX_150V_fl0_3e14.root"], EndcapToTThresholdRUN1 = [ 3, 3, 3], FEI3EndcapLatencyRUN1 = [ 256, 256, 256], FEI3EndcapHitDuplicationRUN1 = [ True, True, True], @@ -163,10 +189,17 @@ def PixelConfigCondAlgCfg(flags, name="PixelConfigCondAlg", **kwargs): #==================================================================================== # ITK CondArgs.update( - BarrelToTThresholdITK = [ 3, 3, 3, 3, 3], - BarrelCrossTalkITK = [ 0.06, 0.06, 0.06, 0.06, 0.06], - BarrelNoiseOccupancyITK = [ 5e-8, 5e-8, 5e-8, 5e-8, 5e-8], - BarrelDisableProbabilityITK = [ 9e-3, 9e-3, 9e-3, 9e-3, 9e-3], + BarrelToTThresholdITK = [ 3, 3, 3, 3, 3], + BarrelCrossTalkITK = [ 0.06, 0.06, 0.06, 0.06, 0.06], + BarrelNoiseOccupancyITK = [ 5e-8, 5e-8, 5e-8, 5e-8, 5e-8], + BarrelDisableProbabilityITK = [ 9e-3, 9e-3, 9e-3, 9e-3, 9e-3], + DefaultBarrelBiasVoltageITK = [ 150.0, 150.0, 150.0, 150.0, 150.0], + BarrelFluenceITK = [0.0e14,0.0e14,0.0e14,0.0e14,0.0e14], + BarrelFluenceMapITK = ["PixelDigitization/maps_IBL_PL_80V_fl0e14.root", + "PixelDigitization/maps_IBL_PL_80V_fl0e14.root", + "PixelDigitization/maps_IBL_PL_80V_fl0e14.root", + "PixelDigitization/maps_IBL_PL_80V_fl0e14.root", + "PixelDigitization/maps_IBL_PL_80V_fl0e14.root"], EndcapToTThresholdITK = [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3], EndcapCrossTalkITK = [ 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06], EndcapNoiseOccupancyITK = [ 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8], @@ -181,8 +214,6 @@ def PixelConfigCondAlgCfg(flags, name="PixelConfigCondAlg", **kwargs): DefaultCalibrationParameterA=70.2, DefaultCalibrationParameterE=-3561.25, DefaultCalibrationParameterC=26000.0 -# IBLChargeScale=1.0, -# IBLSpecificCorrection=False ) # DCS parameters CondArgs.update( diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx index 6a8c82ca2f37bfc59cb37f1318f75fad09b3efb3..db1962721e3ff97aad9fbb85b89adfb705091b3e 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.cxx @@ -8,6 +8,10 @@ #include <memory> #include <sstream> +#include "PathResolver/PathResolver.h" +#include "TFile.h" + + PixelConfigCondAlg::PixelConfigCondAlg(const std::string& name, ISvcLocator* pSvcLocator): ::AthReentrantAlgorithm(name, pSvcLocator) { @@ -167,6 +171,9 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setCablingMapToFile(m_cablingMapToFile); writeCdo -> setCablingMapFileName(m_cablingMapFileName); + // mapping files for radiation damage simulation + std::vector<std::string> mapsPath_list; + int currentRunNumber = ctx.eventID().run_number(); if (currentRunNumber<222222) { writeCdo -> setBarrelToTThreshold(m_BarrelToTThresholdRUN1); @@ -177,6 +184,7 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalkRUN1); writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancyRUN1); writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbabilityRUN1); + writeCdo -> setDefaultBarrelBiasVoltage(m_BarrelBiasVoltageRUN1); writeCdo -> setEndcapToTThreshold(m_EndcapToTThresholdRUN1); writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatencyRUN1); @@ -186,6 +194,7 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalkRUN1); writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancyRUN1); writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbabilityRUN1); + writeCdo -> setDefaultEndcapBiasVoltage(m_EndcapBiasVoltageRUN1); // This is ad-hoc solution. for (size_t i=0; i<m_BLayerNoiseShapeRUN1.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_BLayerNoiseShapeRUN1[i]); } @@ -196,8 +205,14 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { for (size_t i=0; i<m_PixelNoiseShapeRUN1.size(); i++) { for (size_t layer:{0,1,2}) { writeCdo->setEndcapNoiseShape(layer,m_PixelNoiseShapeRUN1[i]); } } + + // Radiation damage simulation + writeCdo -> setFluenceLayer(m_BarrelFluenceRUN1); + for (size_t i=0; i<m_BarrelFluenceMapRUN1.size(); i++) { + mapsPath_list.push_back(PathResolverFindCalibFile(m_BarrelFluenceMapRUN1[i])); + } } - else if (currentRunNumber<240000) { // RUN2 + else if (currentRunNumber<240000) { // RUN2 (mc15) writeCdo -> setBarrelToTThreshold(m_BarrelToTThreshold2016); writeCdo -> setFEI3BarrelLatency(m_FEI3BarrelLatency2016); writeCdo -> setFEI3BarrelHitDuplication(m_FEI3BarrelHitDuplication2016); @@ -206,6 +221,7 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalk2016); writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancy2016); writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbability2016); + writeCdo -> setDefaultBarrelBiasVoltage(m_BarrelBiasVoltage2016); writeCdo -> setEndcapToTThreshold(m_EndcapToTThreshold2016); writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatency2016); @@ -215,11 +231,13 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalk2016); writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancy2016); writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbability2016); + writeCdo -> setDefaultEndcapBiasVoltage(m_EndcapBiasVoltage2016); writeCdo -> setDBMToTThreshold(m_DBMToTThreshold2016); writeCdo -> setDBMCrossTalk(m_DBMCrossTalk2016); writeCdo -> setDBMNoiseOccupancy(m_DBMNoiseOccupancy2016); writeCdo -> setDBMDisableProbability(m_DBMDisableProbability2016); + writeCdo -> setDefaultDBMBiasVoltage(m_DBMBiasVoltage2016); /* So far, Gaudi::Property does not support 2D vector. @@ -244,17 +262,25 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { for (size_t i=0; i<m_IBLNoiseShape2016.size(); i++) { for (size_t layer:{0,1,2}) { writeCdo->setDBMNoiseShape(layer,m_IBLNoiseShape2016[i]); } } + + // Radiation damage simulation + writeCdo -> setFluenceLayer(m_BarrelFluence2016); + for (size_t i=0; i<m_BarrelFluenceMap2016.size(); i++) { + mapsPath_list.push_back(PathResolverFindCalibFile(m_BarrelFluenceMap2016[i])); + } } else if (currentRunNumber<250000) { // RUN4 writeCdo -> setBarrelToTThreshold(m_BarrelToTThresholdITK); writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalkITK); writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancyITK); writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbabilityITK); + writeCdo -> setDefaultBarrelBiasVoltage(m_BarrelBiasVoltageITK); writeCdo -> setEndcapToTThreshold(m_EndcapToTThresholdITK); writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalkITK); writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancyITK); writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbabilityITK); + writeCdo -> setDefaultEndcapBiasVoltage(m_EndcapBiasVoltageITK); // This is ad-hoc solution. for (size_t i=0; i<m_InnermostNoiseShapeITK.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_InnermostNoiseShapeITK[i]); } @@ -266,8 +292,15 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { for (size_t i=0; i<m_EndcapToTThresholdITK.size(); i++) { for (size_t j=0; j<m_PixelNoiseShapeITK.size(); j++) { writeCdo->setEndcapNoiseShape(i,m_PixelNoiseShapeITK[j]); } } + + // Radiation damage simulation + writeCdo -> setFluenceLayer(m_BarrelFluenceITK); + for (size_t i=0; i<m_BarrelFluenceMapITK.size(); i++) { + mapsPath_list.push_back(PathResolverFindCalibFile(m_BarrelFluenceMapITK[i])); + } + } - else if (currentRunNumber<300000) { // RUN2 2015/2016 + else if (currentRunNumber<300000) { // RUN2 2015/2016 (mc16a) writeCdo -> setBarrelToTThreshold(m_BarrelToTThreshold2016); writeCdo -> setFEI3BarrelLatency(m_FEI3BarrelLatency2016); writeCdo -> setFEI3BarrelHitDuplication(m_FEI3BarrelHitDuplication2016); @@ -276,6 +309,7 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalk2016); writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancy2016); writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbability2016); + writeCdo -> setDefaultBarrelBiasVoltage(m_BarrelBiasVoltage2016); writeCdo -> setEndcapToTThreshold(m_EndcapToTThreshold2016); writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatency2016); @@ -285,11 +319,13 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalk2016); writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancy2016); writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbability2016); + writeCdo -> setDefaultEndcapBiasVoltage(m_EndcapBiasVoltage2016); writeCdo -> setDBMToTThreshold(m_DBMToTThreshold2016); writeCdo -> setDBMCrossTalk(m_DBMCrossTalk2016); writeCdo -> setDBMNoiseOccupancy(m_DBMNoiseOccupancy2016); writeCdo -> setDBMDisableProbability(m_DBMDisableProbability2016); + writeCdo -> setDefaultDBMBiasVoltage(m_DBMBiasVoltage2016); // This is ad-hoc solution. for (size_t i=0; i<m_IBLNoiseShape2016.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_IBLNoiseShape2016[i]); } @@ -305,8 +341,14 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { for (size_t i=0; i<m_IBLNoiseShape2016.size(); i++) { for (size_t layer:{0,1,2}) { writeCdo->setDBMNoiseShape(layer,m_IBLNoiseShape2016[i]); } } + + // Radiation damage simulation + writeCdo -> setFluenceLayer(m_BarrelFluence2016); + for (size_t i=0; i<m_BarrelFluenceMap2016.size(); i++) { + mapsPath_list.push_back(PathResolverFindCalibFile(m_BarrelFluenceMap2016[i])); + } } - else if (currentRunNumber<310000) { // RUN2 2017 + else if (currentRunNumber<310000) { // RUN2 2017 (mc16d) writeCdo -> setBarrelToTThreshold(m_BarrelToTThreshold2017); writeCdo -> setFEI3BarrelLatency(m_FEI3BarrelLatency2017); writeCdo -> setFEI3BarrelHitDuplication(m_FEI3BarrelHitDuplication2017); @@ -315,6 +357,7 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalk2017); writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancy2017); writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbability2017); + writeCdo -> setDefaultBarrelBiasVoltage(m_BarrelBiasVoltage2017); writeCdo -> setEndcapToTThreshold(m_EndcapToTThreshold2017); writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatency2017); @@ -324,11 +367,13 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalk2017); writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancy2017); writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbability2017); + writeCdo -> setDefaultEndcapBiasVoltage(m_EndcapBiasVoltage2017); writeCdo -> setDBMToTThreshold(m_DBMToTThreshold2017); writeCdo -> setDBMCrossTalk(m_DBMCrossTalk2017); writeCdo -> setDBMNoiseOccupancy(m_DBMNoiseOccupancy2017); writeCdo -> setDBMDisableProbability(m_DBMDisableProbability2017); + writeCdo -> setDefaultDBMBiasVoltage(m_DBMBiasVoltage2017); // This is ad-hoc solution. for (size_t i=0; i<m_IBLNoiseShape2017.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_IBLNoiseShape2017[i]); } @@ -344,8 +389,14 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { for (size_t i=0; i<m_IBLNoiseShape2017.size(); i++) { for (size_t layer:{0,1,2}) { writeCdo->setDBMNoiseShape(layer,m_IBLNoiseShape2017[i]); } } + + // Radiation damage simulation + writeCdo -> setFluenceLayer(m_BarrelFluence2017); + for (size_t i=0; i<m_BarrelFluenceMap2017.size(); i++) { + mapsPath_list.push_back(PathResolverFindCalibFile(m_BarrelFluenceMap2017[i])); + } } - else { // RUN2 2018 + else { // RUN2 2018 (mc16e) writeCdo -> setBarrelToTThreshold(m_BarrelToTThreshold2018); writeCdo -> setFEI3BarrelLatency(m_FEI3BarrelLatency2018); writeCdo -> setFEI3BarrelHitDuplication(m_FEI3BarrelHitDuplication2018); @@ -354,6 +405,7 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setBarrelCrossTalk(m_BarrelCrossTalk2018); writeCdo -> setBarrelNoiseOccupancy(m_BarrelNoiseOccupancy2018); writeCdo -> setBarrelDisableProbability(m_BarrelDisableProbability2018); + writeCdo -> setDefaultBarrelBiasVoltage(m_BarrelBiasVoltage2018); writeCdo -> setEndcapToTThreshold(m_EndcapToTThreshold2018); writeCdo -> setFEI3EndcapLatency(m_FEI3EndcapLatency2018); @@ -363,11 +415,13 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { writeCdo -> setEndcapCrossTalk(m_EndcapCrossTalk2018); writeCdo -> setEndcapNoiseOccupancy(m_EndcapNoiseOccupancy2018); writeCdo -> setEndcapDisableProbability(m_EndcapDisableProbability2018); + writeCdo -> setDefaultEndcapBiasVoltage(m_EndcapBiasVoltage2018); writeCdo -> setDBMToTThreshold(m_DBMToTThreshold2018); writeCdo -> setDBMCrossTalk(m_DBMCrossTalk2018); writeCdo -> setDBMNoiseOccupancy(m_DBMNoiseOccupancy2018); writeCdo -> setDBMDisableProbability(m_DBMDisableProbability2018); + writeCdo -> setDefaultDBMBiasVoltage(m_DBMBiasVoltage2018); // This is ad-hoc solution. for (size_t i=0; i<m_IBLNoiseShape2018.size(); i++) { writeCdo->setBarrelNoiseShape(0,m_IBLNoiseShape2018[i]); } @@ -383,8 +437,50 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { for (size_t i=0; i<m_IBLNoiseShape2018.size(); i++) { for (size_t layer:{0,1,2}) { writeCdo->setDBMNoiseShape(layer,m_IBLNoiseShape2018[i]); } } + + // Radiation damage simulation + writeCdo -> setFluenceLayer(m_BarrelFluence2018); + for (size_t i=0; i<m_BarrelFluenceMap2018.size(); i++) { + mapsPath_list.push_back(PathResolverFindCalibFile(m_BarrelFluenceMap2018[i])); + } } + std::vector<TH3F*> ramoPotentialMap; + std::vector<TH2F*> lorentzMap_e; + std::vector<TH2F*> lorentzMap_h; + std::vector<TH2F*> distanceMap_e; + std::vector<TH2F*> distanceMap_h; + + for (unsigned int i=0; i<mapsPath_list.size(); i++) { + ATH_MSG_INFO("Using maps located in: "<<mapsPath_list.at(i) << " for layer No." << i); + std::unique_ptr<TFile> mapsFile(new TFile((mapsPath_list.at(i)).c_str())); //this is the ramo potential. + + //Setup ramo weighting field map + TH3F* ramoPotentialMap_hold = 0; + ramoPotentialMap_hold = (TH3F*)mapsFile->Get("hramomap1"); + if (ramoPotentialMap_hold==0) { ramoPotentialMap_hold=(TH3F*)mapsFile->Get("ramo3d"); } + if (ramoPotentialMap_hold==0) { + ATH_MSG_FATAL("Did not find a Ramo potential map and an approximate form is available yet. Exit..."); + return StatusCode::FAILURE; + } + ramoPotentialMap.push_back(ramoPotentialMap_hold); + + std::unique_ptr<TH2F> lorentzMap_e_hold((TH2F*)mapsFile->Get("lorentz_map_e")); + std::unique_ptr<TH2F> lorentzMap_h_hold((TH2F*)mapsFile->Get("lorentz_map_h")); + std::unique_ptr<TH2F> distanceMap_h_hold((TH2F*)mapsFile->Get("edistance")); + std::unique_ptr<TH2F> distanceMap_e_hold((TH2F*)mapsFile->Get("hdistance")); + + lorentzMap_e.push_back(lorentzMap_e_hold.get()); + lorentzMap_h.push_back(lorentzMap_h_hold.get()); + distanceMap_e.push_back(distanceMap_e_hold.get()); + distanceMap_h.push_back(distanceMap_h_hold.get()); + } + writeCdo -> setLorentzMap_e(lorentzMap_e); + writeCdo -> setLorentzMap_h(lorentzMap_h); + writeCdo -> setDistanceMap_e(distanceMap_e); + writeCdo -> setDistanceMap_h(distanceMap_h); + writeCdo -> setRamoPotentialMap(ramoPotentialMap); + //======================= // Combine time interval //======================= @@ -405,3 +501,4 @@ StatusCode PixelConfigCondAlg::execute(const EventContext& ctx) const { return StatusCode::SUCCESS; } + diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h index 2f22aa8a4a8fee954cae3e047d89088be4a6f435..458eb01203751236cf324404dc2997b48c893e1b 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelConfigCondAlg.h @@ -12,6 +12,7 @@ #define PIXELCONFIGCONDALG #include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "GaudiKernel/ToolHandle.h" #include "StoreGate/ReadCondHandleKey.h" #include "AthenaPoolUtilities/CondAttrListCollection.h" @@ -87,7 +88,9 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { // // MC Project: RUN1 RUN2 mc16a RUN2 mc16d RUN2 mc16e // Year: - 2014 2015/2016 2017 2018 - // Run Number: <222222 284500 300000 310000 + // MC Run Number: <222222 284500 300000 310000 + // Reference run#: --- 303638 336506 357193 + // Luminosity(fb-1): 17.3 69.0 119.4 // // Barrel: // ToT: [ 3, 3, 3] [ -1, 5, 5, 5] [ -1, 5, 5, 5] [ -1, 3, 5, 5] @@ -99,7 +102,9 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { // NoiseOcc.: [5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8,5e-8] // DisalbePix: [9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3,9e-3] // NoiseShape: [2018,2018,2018] [2018,2018,2018,2018] [2018,2018,2018,2018] [2018,2018,2018,2018] - // + // BiasVoltage: [ 150, 150, 150] [ 80, 350, 200, 150] [ 350, 350, 200, 150] [ 400, 400, 250, 250] + // Fluence(e14):[1.01,0.44,0.30] [0.80,1.61,0.71,0.48] [3.18,3.42,1.50,1.01] [5.50,5.19,2.28,1.53] + // // Endcap: // ToT: [ 3, 3, 3] [ 5, 5, 5] [ 5, 5, 5] [ 5, 5, 5] // Latency: [ 256, 256, 256] [ 256, 256, 256] [ 256, 256, 256] [ 256, 256, 256] @@ -110,12 +115,15 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { // NoiseOcc.: [5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8] // DisalbePix: [9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3] // NoiseShape: [2018,2018,2018] [2018,2018,2018] [2018,2018,2018] [2018,2018,2018] - // + // BiasVoltage: [ 150, 150, 150] [ 150, 150, 150] [ 150, 150, 150] [ 250, 250, 250] + // Fluence(e14):[ n/a, n/a, n/a] [ n/a, n/a, n/a] [ n/a, n/a, n/a] [ n/a, n/a, n/a] + // // DBM: // ToT: [N/A] [ -1, -1, -1] [ -1, -1, -1] [ -1, -1, -1] // CrossTalk: [N/A] [0.06,0.06,0.06] [0.06,0.06,0.06] [0.06,0.06,0.06] // NoiseOcc.: [N/A] [5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8] [5e-8,5e-8,5e-8] // DisalbePix: [N/A] [9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3] [9e-3,9e-3,9e-3] + // BiasVoltage: [N/A] [ 500, 500, 500] [ 500, 500, 500] [ 500, 500, 500] // // See https://twiki.cern.ch/twiki/bin/view/Atlas/PixelConditionsRUN2 // for further details. @@ -133,6 +141,8 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { // NoiseOcc.: [5e-8,5e-8,5e-8,5e-8,5e-8] // DisalbePix: [9e-3,9e-3,9e-3,9e-3,9e-3] // NoiseShape: [2018,2018,2018,2018,2018] + // BiasVoltage: [ 150, 150, 150, 150, 150] + // Fluence(e14):[ 0.0, 0.0, 0.0, 0.0, 0.0] // // Endcap: // ToT: [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3] @@ -140,15 +150,29 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { // NoiseOcc.: [5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8,5e-8] // DisalbePix: [9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3,9e-3] // NoiseShape: [2018,2018,2018,2018,2018,2018,2018,2018,2018,2018,2018,2018,2018,2018] + // BiasVoltage: [ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150] + // Fluence(e14):[ n/a, n/a, n/a, n/a, n/a, n/a, n/a, n/a, n/a, n/a, n/a, n/a, n/a, n/a] // //==================================================================================== - // Variable definition is a bit ugly here... //==================================================================================== // Barrel RUN2 2015/2016 Gaudi::Property<std::vector<int>> m_BarrelToTThreshold2016 {this, "BarrelToTThreshold2016", {-1, 5, 5, 5}, "ToT thresholds for barrel pixel layers in 2015/2016"}; + Gaudi::Property<std::vector<float>> m_BarrelBiasVoltage2016 + {this, "DefaultBarrelBiasVoltage2016", {80.0,350.0,200.0,150.0}, "Default barrel bias voltage in 2015/2016"}; + + Gaudi::Property<std::vector<double>> m_BarrelFluence2016 + {this, "BarrelFluence2016", {0.80e14, 1.61e14, 0.71e14, 0.48e14}, "Barrel fluence for radiation damage in 2016"}; + + Gaudi::Property<std::vector<std::string>> m_BarrelFluenceMap2016 + {this, "BarrelFluenceMap2016", {"PixelDigitization/maps_IBL_PL_80V_fl0_8e14.root", + "PixelDigitization/maps_PIX_350V_fl1_61e14.root", + "PixelDigitization/maps_PIX_200V_fl0_71e14.root", + "PixelDigitization/maps_PIX_150V_fl0_48e14.root"}, + "Barrel fluence map for radiation damage in 2016"}; + Gaudi::Property<std::vector<int>> m_FEI3BarrelLatency2016 {this, "FEI3BarrelLatency2016", { 0,151,256,256}, "FEI3 latency for barrel pixel layers in 2015/2016"}; @@ -188,6 +212,9 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_EndcapToTThreshold2016 {this, "EndcapToTThreshold2016", { 5, 5, 5}, "ToT thresholds for endcap pixel layers in 2015/2016"}; + Gaudi::Property<std::vector<float>> m_EndcapBiasVoltage2016 + {this, "DefaultEndcapBiasVoltage2016", {150.0,150.0,150.0}, "Default endcap bias voltage in 2015/2016"}; + Gaudi::Property<std::vector<int>> m_FEI3EndcapLatency2016 {this, "FEI3EndcapLatency2016", {256,256,256}, "FEI3 latency for endcap pixel layers in 2015/2016"}; @@ -213,6 +240,9 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_DBMToTThreshold2016 {this, "DBMToTThreshold2016", {-1,-1,-1}, "ToT thresholds for DBM layers in 2015/2016"}; + Gaudi::Property<std::vector<float>> m_DBMBiasVoltage2016 + {this, "DefaultDBMBiasVoltage2016", {500.0,500.0,500.0}, "Default DBM bias voltage in 2015/2016"}; + Gaudi::Property<std::vector<double>> m_DBMCrossTalk2016 {this, "DBMCrossTalk2016", {0.06,0.06,0.06}, "Cross-talk fraction of barrel DBM layers in 2015/2016"}; @@ -227,6 +257,19 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_BarrelToTThreshold2017 {this, "BarrelToTThreshold2017", {-1, 5, 5, 5}, "ToT thresholds for barrel pixel layers in 2017"}; + Gaudi::Property<std::vector<float>> m_BarrelBiasVoltage2017 + {this, "DefaultBarrelBiasVoltage2017", {350.0,350.0,200.0,150.0}, "Default barrel bias voltage in 2017"}; + + Gaudi::Property<std::vector<double>> m_BarrelFluence2017 + {this, "BarrelFluence2017", {3.18e14, 3.42e14, 1.50e14, 1.01e14}, "Barrel fluence for radiation damage in 2017"}; + + Gaudi::Property<std::vector<std::string>> m_BarrelFluenceMap2017 + {this, "BarrelFluenceMap2017", {"PixelDigitization/maps_IBL_PL_350V_fl3_18e14.root", + "PixelDigitization/maps_PIX_350V_fl3_42e14.root", + "PixelDigitization/maps_PIX_200V_fl1_5e14.root", + "PixelDigitization/maps_PIX_150V_fl1_01e14.root"}, + "Barrel fluence map for radiation damage in 2017"}; + Gaudi::Property<std::vector<int>> m_FEI3BarrelLatency2017 {this, "FEI3BarrelLatency2017", { 0,151,256,256}, "FEI3 latency for barrel pixel layers in 2017"}; @@ -262,6 +305,9 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_EndcapToTThreshold2017 {this, "EndcapToTThreshold2017", { 5, 5, 5}, "ToT thresholds for endcap pixel layers in 2017"}; + Gaudi::Property<std::vector<float>> m_EndcapBiasVoltage2017 + {this, "DefaultEndcapBiasVoltage2017", {150.0,150.0,150.0}, "Default endcap bias voltage in 2017"}; + Gaudi::Property<std::vector<int>> m_FEI3EndcapLatency2017 {this, "FEI3EndcapLatency2017", {256,256,256}, "FEI3 latency for endcap pixel layers in 2017"}; @@ -287,6 +333,9 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_DBMToTThreshold2017 {this, "DBMToTThreshold2017", {-1,-1,-1}, "ToT thresholds for DBM layers in 2017"}; + Gaudi::Property<std::vector<float>> m_DBMBiasVoltage2017 + {this, "DefaultDBMBiasVoltage2017", {500.0,500.0,500.0}, "Default DBM bias voltage in 2017"}; + Gaudi::Property<std::vector<double>> m_DBMCrossTalk2017 {this, "DBMCrossTalk2017", {0.06,0.06,0.06}, "Cross-talk fraction of barrel DBM layers in 2017"}; @@ -301,6 +350,19 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_BarrelToTThreshold2018 {this, "BarrelToTThreshold2018", {-1, 3, 5, 5}, "ToT thresholds for barrel pixel layers in 2018"}; + Gaudi::Property<std::vector<float>> m_BarrelBiasVoltage2018 + {this, "DefaultBarrelBiasVoltage2018", {400.0,400.0,250.0,250.0}, "Default barrel bias voltage in 2018"}; + + Gaudi::Property<std::vector<double>> m_BarrelFluence2018 + {this, "BarrelFluence2018", {5.50e14, 5.19e14, 2.28e14, 1.53e14}, "Barrel fluence for radiation damage in 2018"}; + + Gaudi::Property<std::vector<std::string>> m_BarrelFluenceMap2018 + {this, "BarrelFluenceMap2018", {"PixelDigitization/maps_IBL_PL_400V_fl5_5e14.root", + "PixelDigitization/maps_PIX_400V_fl5_19e14.root", + "PixelDigitization/maps_PIX_250V_fl2_28e14.root", + "PixelDigitization/maps_PIX_250V_fl1_53e14.root"}, + "Barrel fluence map for radiation damage in 2018"}; + Gaudi::Property<std::vector<int>> m_FEI3BarrelLatency2018 {this, "FEI3BarrelLatency2018", { 0,151,256,256}, "FEI3 latency for barrel pixel layers in 2018"}; @@ -336,6 +398,9 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_EndcapToTThreshold2018 {this, "EndcapToTThreshold2018", { 5, 5, 5}, "ToT thresholds for endcap pixel layers in 2018"}; + Gaudi::Property<std::vector<float>> m_EndcapBiasVoltage2018 + {this, "DefaultEndcapBiasVoltage2018", {250.0,250.0,250.0}, "Default endcap bias voltage in 2018"}; + Gaudi::Property<std::vector<int>> m_FEI3EndcapLatency2018 {this, "FEI3EndcapLatency2018", {256,256,256}, "FEI3 latency for endcap pixel layers in 2018"}; @@ -361,6 +426,9 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_DBMToTThreshold2018 {this, "DBMToTThreshold2018", {-1,-1,-1}, "ToT thresholds for DBM layers in 2018"}; + Gaudi::Property<std::vector<float>> m_DBMBiasVoltage2018 + {this, "DefaultDBMBiasVoltage2018", {500.0,500.0,500.0}, "Default DBM bias voltage in 2018"}; + Gaudi::Property<std::vector<double>> m_DBMCrossTalk2018 {this, "DBMCrossTalk2018", {0.06,0.06,0.06}, "Cross-talk fraction of barrel DBM layers in 2018"}; @@ -375,6 +443,18 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_BarrelToTThresholdRUN1 {this, "BarrelToTThresholdRUN1", {3, 3, 3}, "ToT thresholds for barrel pixel layers in RUN1"}; + Gaudi::Property<std::vector<float>> m_BarrelBiasVoltageRUN1 + {this, "DefaultBarrelBiasVoltageRUN1", {150.0,150.0,150.0}, "Default barrel bias voltage in RUN1"}; + + Gaudi::Property<std::vector<double>> m_BarrelFluenceRUN1 + {this, "BarrelFluenceRUN1", {1.01e14, 0.44e14, 0.30e14}, "Barrel fluence for radiation damage in RUN1"}; + + Gaudi::Property<std::vector<std::string>> m_BarrelFluenceMapRUN1 + {this, "BarrelFluenceMapRUN1", {"PixelDigitization/maps_PIX_250V_fl1_01e14.root", // this needs to be updated + "PixelDigitization/maps_PIX_150V_fl0_44e14.root", + "PixelDigitization/maps_PIX_150V_fl0_3e14.root"}, + "Barrel fluence map for radiation damage in RUN1"}; + Gaudi::Property<std::vector<int>> m_FEI3BarrelLatencyRUN1 {this, "FEI3BarrelLatencyRUN1", {256,256,256}, "FEI3 latency for barrel pixel layers in RUN1"}; @@ -407,6 +487,9 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_EndcapToTThresholdRUN1 {this, "EndcapToTThresholdRUN1", { 3, 3, 3}, "ToT thresholds for endcap pixel layers in RUN1"}; + Gaudi::Property<std::vector<float>> m_EndcapBiasVoltageRUN1 + {this, "DefaultEndcapBiasVoltageRUN1", {150.0,150.0,150.0}, "Default endcap bias voltage in RUN1"}; + Gaudi::Property<std::vector<int>> m_FEI3EndcapLatencyRUN1 {this, "FEI3EndcapLatencyRUN1", {256,256,256}, "FEI3 latency for endcap pixel layers in RUN1"}; @@ -433,6 +516,20 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_BarrelToTThresholdITK {this, "BarrelToTThresholdITK", {3,3,3,3,3}, "ToT thresholds for barrel pixel layers in ITK"}; + Gaudi::Property<std::vector<float>> m_BarrelBiasVoltageITK + {this, "DefaultBarrelBiasVoltageITK", {150.0,150.0,150.0,150.0,150.0}, "Default barrel bias voltage in ITK"}; + + Gaudi::Property<std::vector<double>> m_BarrelFluenceITK + {this, "BarrelFluenceITK", {0.0e14, 0.0e14, 0.0e14, 0.0e14, 0.0e14}, "Barrel fluence for radiation damage in ITK"}; + + Gaudi::Property<std::vector<std::string>> m_BarrelFluenceMapITK + {this, "BarrelFluenceMapITK", {"PixelDigitization/maps_IBL_PL_80V_fl0e14.root", // this needs to be updated + "PixelDigitization/maps_IBL_PL_80V_fl0e14.root", + "PixelDigitization/maps_IBL_PL_80V_fl0e14.root", + "PixelDigitization/maps_IBL_PL_80V_fl0e14.root", + "PixelDigitization/maps_IBL_PL_80V_fl0e14.root"}, + "Barrel fluence map for radiation damage in ITK"}; + Gaudi::Property<std::vector<double>> m_BarrelCrossTalkITK {this, "BarrelCrossTalkITK", {0.06,0.06,0.06,0.06,0.06}, "Cross-talk fraction of barrel pixel layers in ITK"}; @@ -456,6 +553,9 @@ class PixelConfigCondAlg : public AthReentrantAlgorithm { Gaudi::Property<std::vector<int>> m_EndcapToTThresholdITK {this, "EndcapToTThresholdITK", {3,3,3,3,3,3,3,3,3,3,3,3,3,3}, "ToT thresholds for endcap pixel layers in ITK"}; + Gaudi::Property<std::vector<float>> m_EndcapBiasVoltageITK + {this, "DefaultEndcapBiasVoltageITK", {150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0}, "Default endcap bias voltage in ITK"}; + Gaudi::Property<std::vector<double>> m_EndcapCrossTalkITK {this, "EndcapCrossTalkITK", {0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06,0.06}, "Cross-talk fraction of barrel endcap layers in ITK"}; diff --git a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h index 06f32bd7addfc29daa2632f0f4ed559735e847a3..be5a24afc8a43c6c923beb43104c8d61b6e69426 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h +++ b/InnerDetector/InDetConditions/PixelConditionsData/PixelConditionsData/PixelModuleData.h @@ -15,6 +15,9 @@ #include <map> #include "AthenaKernel/CondCont.h" +#include "TH1.h" +#include "TH2.h" +#include "TH3.h" class PixelModuleData { public: @@ -140,6 +143,11 @@ class PixelModuleData { void setDefaultBiasVoltage(float biasVoltage); float getDefaultBiasVoltage() const; + void setDefaultBarrelBiasVoltage(std::vector<float> BarrelBiasVoltage); + void setDefaultEndcapBiasVoltage(std::vector<float> EndcapBiasVoltage); + void setDefaultDBMBiasVoltage(std::vector<float> DBMBiasVoltage); + float getDefaultBiasVoltage(int bec, int layer) const; + void setDefaultTemperature(float temperature); float getDefaultTemperature() const; @@ -150,6 +158,23 @@ class PixelModuleData { void setCablingMapFileName(std::string cablingMapFileName); std::string getCablingMapFileName() const; + // Map for radiation damage simulation + void setFluenceLayer(std::vector<double> fluenceLayer); + double getFluenceLayer(int layer) const; + + void setLorentzMap_e(std::vector<TH2F*> lorentzMap_e); + void setLorentzMap_h(std::vector<TH2F*> lorentzMap_h); + TH2F* getLorentzMap_e(int layer) const; + TH2F* getLorentzMap_h(int layer) const; + + void setDistanceMap_e(std::vector<TH2F*> distanceMap_e); + void setDistanceMap_h(std::vector<TH2F*> distanceMap_h); + TH2F* getDistanceMap_e(int layer) const; + TH2F* getDistanceMap_h(int layer) const; + + void setRamoPotentialMap(std::vector<TH3F*> ramoPotentialMap); + TH3F* getRamoPotentialMap(int layer) const; + // Distortion parameters void setDistortionInputSource(int distortionInputSource); int getDistortionInputSource() const; @@ -261,9 +286,20 @@ class PixelModuleData { float m_biasVoltage; float m_temperature; + std::vector<float> m_BarrelBiasVoltage; + std::vector<float> m_EndcapBiasVoltage; + std::vector<float> m_DBMBiasVoltage; + bool m_cablingMapToFile; std::string m_cablingMapFileName; + std::vector<double> m_fluenceLayer; + std::vector<TH2F*> m_lorentzMap_e; + std::vector<TH2F*> m_lorentzMap_h; + std::vector<TH2F*> m_distanceMap_e; + std::vector<TH2F*> m_distanceMap_h; + std::vector<TH3F*> m_ramoPotentialMap; + int m_distortionInputSource; int m_distortionVersion; double m_distortionR1; diff --git a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx index 0877f64ae306aa81dcbab238ddeafe389c192653..558bca2c312d1b7e1b3d39068040964fdbc1c16c 100644 --- a/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsData/src/PixelModuleData.cxx @@ -284,6 +284,17 @@ float PixelModuleData::getDefaultQ2TotC() const { return m_paramC; } void PixelModuleData::setDefaultBiasVoltage(float biasVoltage) { m_biasVoltage=biasVoltage; } float PixelModuleData::getDefaultBiasVoltage() const { return m_biasVoltage; } +void PixelModuleData::setDefaultBarrelBiasVoltage(std::vector<float> BarrelBiasVoltage) { m_BarrelBiasVoltage = BarrelBiasVoltage; } +void PixelModuleData::setDefaultEndcapBiasVoltage(std::vector<float> EndcapBiasVoltage) { m_EndcapBiasVoltage = EndcapBiasVoltage; } +void PixelModuleData::setDefaultDBMBiasVoltage(std::vector<float> DBMBiasVoltage) { m_DBMBiasVoltage = DBMBiasVoltage; } +float PixelModuleData::getDefaultBiasVoltage(int bec, int layer) const { + float biasVoltage = 0.0; + if (std::abs(bec)==0 && layer<(int)m_BarrelBiasVoltage.size()) { biasVoltage=m_BarrelBiasVoltage.at(layer); } + if (std::abs(bec)==2 && layer<(int)m_EndcapBiasVoltage.size()) { biasVoltage=m_EndcapBiasVoltage.at(layer); } + if (std::abs(bec)==4 && layer<(int)m_DBMBiasVoltage.size()) { biasVoltage=m_DBMBiasVoltage.at(layer); } + return biasVoltage; +} + void PixelModuleData::setDefaultTemperature(float temperature) { m_temperature=temperature; } float PixelModuleData::getDefaultTemperature() const { return m_temperature; } @@ -294,6 +305,23 @@ bool PixelModuleData::getCablingMapToFile() const { return m_cablingMapToFile; } void PixelModuleData::setCablingMapFileName(std::string cablingMapFileName) { m_cablingMapFileName = cablingMapFileName; } std::string PixelModuleData::getCablingMapFileName() const { return m_cablingMapFileName; } +// Map for radiation damage simulation +void PixelModuleData::setFluenceLayer(std::vector<double> fluenceLayer) { m_fluenceLayer = fluenceLayer; } +double PixelModuleData::getFluenceLayer(int layer) const { return m_fluenceLayer.at(layer); } + +void PixelModuleData::setLorentzMap_e(std::vector<TH2F*> lorentzMap_e) { m_lorentzMap_e = lorentzMap_e; } +void PixelModuleData::setLorentzMap_h(std::vector<TH2F*> lorentzMap_h) { m_lorentzMap_h = lorentzMap_h; } +TH2F* PixelModuleData::getLorentzMap_e(int layer) const { return m_lorentzMap_e.at(layer); } +TH2F* PixelModuleData::getLorentzMap_h(int layer) const { return m_lorentzMap_h.at(layer); } + +void PixelModuleData::setDistanceMap_e(std::vector<TH2F*> distanceMap_e) { m_distanceMap_e = distanceMap_e; } +void PixelModuleData::setDistanceMap_h(std::vector<TH2F*> distanceMap_h) { m_distanceMap_h = distanceMap_h; } +TH2F* PixelModuleData::getDistanceMap_e(int layer) const { return m_distanceMap_e.at(layer); } +TH2F* PixelModuleData::getDistanceMap_h(int layer) const { return m_distanceMap_h.at(layer); } + +void PixelModuleData::setRamoPotentialMap(std::vector<TH3F*> ramoPotentialMap) { m_ramoPotentialMap = ramoPotentialMap; } +TH3F* PixelModuleData::getRamoPotentialMap(int layer) const { return m_ramoPotentialMap.at(layer); } + // Distortion parameters void PixelModuleData::setDistortionInputSource(int distortionInputSource) { m_distortionInputSource = distortionInputSource; } int PixelModuleData::getDistortionInputSource() const { return m_distortionInputSource; } diff --git a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_BarrelElement.h b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_BarrelElement.h index 8338c8bbd418df665d4438eef3b2e41af8990a99..0a1cc4360326fb6fa8356163f301088ae02a916b 100755 --- a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_BarrelElement.h +++ b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_BarrelElement.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 */ /////////////////////////////////////////////////////////////////// @@ -131,12 +131,12 @@ namespace InDetDD { const TRT_BarrelElement& operator=(const TRT_BarrelElement& right) = delete; /** These transforms are effectively to the local coord system of a straw derived from GeoModel -> hence CLHEP */ - HepGeom::Transform3D calculateStrawTransform(int straw) const; + virtual HepGeom::Transform3D calculateStrawTransform(int straw) const override; HepGeom::Transform3D calculateLocalStrawTransform(int straw) const; /** return the surface of the element */ - const Trk::Surface & elementSurface() const; + virtual const Trk::Surface & elementSurface() const override; /** create the cache for the element */ - void createSurfaceCache() const; + virtual void createSurfaceCache() const override; std::unique_ptr<SurfaceCache> createSurfaceCacheHelper() const; // Private Member data: diff --git a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_EndcapElement.h b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_EndcapElement.h index 27fffa85bed58402e28ffc86ac24637c85650a82..0da3d309b493eddb226aabb14d88235a6598d89a 100755 --- a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_EndcapElement.h +++ b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/TRT_ReadoutGeometry/TRT_EndcapElement.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 */ /////////////////////////////////////////////////////////////////// @@ -67,7 +67,7 @@ namespace InDetDD { virtual HepGeom::Transform3D defStrawTransform(int straw) const override final; /** Active straw length */ - virtual const double & strawLength() const; + virtual const double & strawLength() const override; /** StrawDirection. +1 if axis is in same direction as local coordinate, -1 otherwise. */ virtual int strawDirection() const override final; @@ -103,14 +103,14 @@ namespace InDetDD { private: /** These transforms are effectively to the local coord system of a straw derived from GeoModel -> hence CLHEP */ - HepGeom::Transform3D calculateStrawTransform(int straw) const; + virtual HepGeom::Transform3D calculateStrawTransform(int straw) const override; HepGeom::Transform3D calculateLocalStrawTransform(int straw) const; /** return the surface of the element */ - const Trk::Surface & elementSurface() const; + virtual const Trk::Surface & elementSurface() const override; /** create the cache for the element */ - void createSurfaceCache() const; + virtual void createSurfaceCache() const override; std::unique_ptr<SurfaceCache> createSurfaceCacheHelper() const; /** create the cache for the straw of identifier id */ void createSurfaceCache(Identifier id) const; diff --git a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_BarrelElement.cxx b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_BarrelElement.cxx index 80e442aedac65df71aa655b4189846a51a9d958e..dd611ab2f1ede6e6fe19ee20ce242ed4ad4ca06d 100755 --- a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_BarrelElement.cxx +++ b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_BarrelElement.cxx @@ -197,7 +197,7 @@ void TRT_BarrelElement::createSurfaceCache() const { // create the surface cache if (!m_surfaceCache) { - m_surfaceCache.set(std::move(createSurfaceCacheHelper())); + m_surfaceCache.set(createSurfaceCacheHelper()); } // creaete the surface (only if needed, links are still ok even if cache // update) diff --git a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_EndcapElement.cxx b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_EndcapElement.cxx index 7f13cc04c67238e674d0bfa3b9ed2db28265b229..122ae59933a35c0244ed35951ff4a0837d65a036 100755 --- a/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_EndcapElement.cxx +++ b/InnerDetector/InDetDetDescr/TRT_ReadoutGeometry/src/TRT_EndcapElement.cxx @@ -244,7 +244,7 @@ void TRT_EndcapElement::createSurfaceCache() const { if (!m_surfaceCache) { - m_surfaceCache.set(std::move(createSurfaceCacheHelper())); + m_surfaceCache.set(createSurfaceCacheHelper()); } // create the surface if needed if (!m_surface) { diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/share/SiSmearing_noPU_CompletedjO.py b/InnerDetector/InDetDigitization/FastSiDigitization/share/SiSmearing_noPU_CompletedjO.py deleted file mode 100644 index ee3d95e8ff6a5bf17630da58cc843a6ea5db4caa..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDigitization/FastSiDigitization/share/SiSmearing_noPU_CompletedjO.py +++ /dev/null @@ -1,560 +0,0 @@ -#-------------------------------------------------------------------- -# Perfmon configuration -#-------------------------------------------------------------------- -from PerfMonComps.PerfMonFlags import jobproperties -jobproperties.PerfMonFlags.doMonitoring = True -jobproperties.PerfMonFlags.doMallocMonitoring = True -jobproperties.PerfMonFlags.doPostProcessing = True - -from ISF_FatrasServices.ISF_FatrasJobProperties import ISF_FatrasFlags -ISF_FatrasFlags.OutputLevelGeneral = INFO -#-------------------------------------------------------------- -# AthenaCommon configuration -#-------------------------------------------------------------- -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.SkipEvents=0 -athenaCommonFlags.EvtMax=10 -athenaCommonFlags.PoolHitsInput=["Hits.pool.root"] -athenaCommonFlags.PoolRDOOutput="DigitizationOutput.pool.root" - -# the magnetic field -from MagFieldServices import SetupField -from IOVDbSvc.CondDB import conddb -conddb.addOverride('/GLOBAL/BField/Map','BFieldMap-FullAsym-09-solTil') - -from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags -TrkDetFlags.MaterialSource = 'Input' - -#-------------------------------------------------------------- -# Digitiziation and Pileup configuration -#-------------------------------------------------------------- -from Digitization.DigitizationFlags import digitizationFlags -digitizationFlags.IOVDbGlobalTag='OFLCOND-SIM-00-00-00' - -#-------------------------------------------------------------- -# Global flags. Like eg the DD version: -#-------------------------------------------------------------- -from AthenaCommon.GlobalFlags import globalflags -globalflags.DetDescrVersion='ATLAS-PX-ITK-00-00-00' - -#-------------------------------------------------------------------- -# DetFlags. Use to turn on/off individual subdetector or LVL1 trigger -#-------------------------------------------------------------------- -from AthenaCommon.DetFlags import DetFlags -DetFlags.ID_setOn() -DetFlags.Calo_setOff() -DetFlags.Muon_setOff() -DetFlags.detdescr.Muon_setOff() -DetFlags.LVL1_setOff() -DetFlags.Truth_setOn() - -include("FastSiDigitization/SiSmearing_jobOptions.py") - -DetFlags.pixel_setOff() -DetFlags.detdescr.pixel_setOn() - -DetFlags.SCT_setOff() # setOn to use the standard digi -DetFlags.detdescr.SCT_setOn() - -DetFlags.TRT_setOff() # setOn to use the standard digi - -include("Digitization/Digitization.py") - -from InDetRecExample.InDetJobProperties import InDetFlags - -# --- Set output level threshold (2=DEBUG, 3=VERBOSE, 4=WARNING, 5=ERROR, 6=FATAL ) -OutputLevel = VERBOSE -# --- produce an atlantis data file -doJiveXML = False -# --- run the Virtual Point 1 event visualisation -doVP1 = True -# --- controls what is written out. ESD includes AOD, so it's normally enough -doWriteESD = True -doWriteAOD = True -# --- do auditors ? -doAuditors = True - -DetFlags.makeRIO.pixel_setOff() -DetFlags.makeRIO.SCT_setOff() - -DetFlags.readRIOPool.pixel_setOn() -DetFlags.readRIOPool.SCT_setOn() - -DetFlags.haveRIO.pixel_on() -DetFlags.haveRIO.SCT_on() - -# --- uncomment to change the default of one of the following options: -InDetFlags.doTruth = True -InDetFlags.doNewTracking = True -# --- Turn off track slimming -#InDetFlags.doSlimming = False - -# --- possibility to change the trackfitter -InDetFlags.trackFitterType = 'KalmanFitter' -#InDetFlags.trackFitterType = 'GlobalChi2Fitter' - -# --- activate monitorings -InDetFlags.doMonitoringGlobal = False -InDetFlags.doMonitoringPrimaryVertexingEnhanced = False -InDetFlags.doMonitoringPixel = False -InDetFlags.doMonitoringSCT = False -InDetFlags.doMonitoringTRT = False -InDetFlags.doMonitoringAlignment = False -InDetFlags.doPrintConfigurables = True -InDetFlags.doPseudoTracking = True -InDetFlags.doxAOD = True - -from InDetRecExample.InDetKeys import InDetKeys -InDetKeys.trkValidationNtupleName = 'TrkValidation.root' -InDetKeys.trkD3PDFileName = 'InDetTrackD3PD.root' - -StoreGateSvc = Service("StoreGateSvc") -StoreGateSvc.Dump = True - -from PixelConditionsTools.PixelConditionsToolsConf import PixelRecoDbTool -ToolSvc += PixelRecoDbTool() -ToolSvc.PixelRecoDbTool.InputSource = 1 - -from AthenaCommon.AppMgr import ServiceMgr -ServiceMgr.MessageSvc.enableSuppression = False -ServiceMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M" - -OutputNameString = 'CheckSmearing' - -if not hasattr(ServiceMgr, 'THistSvc'): - from GaudiSvc.GaudiSvcConf import THistSvc - ServiceMgr += THistSvc() - -from AthenaCommon.AlgSequence import AlgSequence -from AthenaCommon.SystemOfUnits import * -import math - -# load the tracking geometry service -from TrkDetDescrSvc.AtlasTrackingGeometrySvc import AtlasTrackingGeometrySvc - -topSequence = AlgSequence() - -topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.CheckSmear=True -topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.OutputLevel=OutputLevel -#topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.pitch_X=10.0*micrometer -#topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.pitch_X=0.0*micrometer -#topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.pitch_Y=55.0*micrometer -#topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.pitch_Y=0.0*micrometer -topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.TrackingGeometrySvc = AtlasTrackingGeometrySvc -topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.UseCustomGeometry = True -topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.DetectorElementMapName="Pixel_IdHashDetElementMap" -topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.MergeClusters = False -topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.PlanarClusterContainerName="Pixel_PlanarClusters" -topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.PRD_TruthPlanarContainerName="PRD_MultiTruthPlanarPixel" -#topSequence.PixelSmearedDigitization.SiSmearedDigitizationTool.Nsigma = 1.0 - -topSequence.SCTSmearedDigitization.SiSmearedDigitizationTool.CheckSmear=True -topSequence.SCTSmearedDigitization.SiSmearedDigitizationTool.SmearPixel = False -topSequence.SCTSmearedDigitization.SiSmearedDigitizationTool.OutputLevel=OutputLevel -#topSequence.SCTSmearedDigitization.SiSmearedDigitizationTool.pitch_X= 70.0*micrometer -#topSequence.SCTSmearedDigitization.SiSmearedDigitizationTool.pitch_X= 0.0*micrometer -topSequence.SCTSmearedDigitization.SiSmearedDigitizationTool.TrackingGeometrySvc = AtlasTrackingGeometrySvc -topSequence.SCTSmearedDigitization.SiSmearedDigitizationTool.UseCustomGeometry = True -topSequence.SCTSmearedDigitization.SiSmearedDigitizationTool.DetectorElementMapName="SCT_IdHashDetElementMap" -topSequence.SCTSmearedDigitization.SiSmearedDigitizationTool.MergeClusters = False -topSequence.SCTSmearedDigitization.SiSmearedDigitizationTool.PlanarClusterContainerName="SCT_PlanarClusters" -topSequence.SCTSmearedDigitization.SiSmearedDigitizationTool.PRD_TruthPlanarContainerName="PRD_MultiTruthPlanarSCT" - -AlgSequence("Streams").StreamRDO.ItemList += ["iFatras::PlanarClusterContainer#Pixel_PlanarClusters"] -##AlgSequence("Streams").StreamRDO.ItemList += ["InDet::SiClusterContainer#PixelClusters"] -AlgSequence("Streams").StreamRDO.ItemList += ["iFatras::PlanarClusterContainer#SCT_PlanarClusters"] -##AlgSequence("Streams").StreamRDO.ItemList += ["InDet::SiClusterContainer#SCT_Clusters"] - -AlgSequence("Streams").StreamRDO.ItemList += ["PRD_MultiTruthCollection#PRD_MultiTruthPlanarPixel"] -AlgSequence("Streams").StreamRDO.ItemList += ["PRD_MultiTruthCollection#PRD_MultiTruthPlanarSCT"] -##AlgSequence("Streams").StreamRDO.ItemList += ["PRD_MultiTruthCollection#PRD_MultiTruthPixel"] -##AlgSequence("Streams").StreamRDO.ItemList += ["PRD_MultiTruthCollection#PRD_MultiTruthSCT"] - -#from SiSpacePointTool.SiSpacePointToolConf import InDet__SiSpacePointMakerTool -#InDetSiSpacePointMakerTool = InDet__SiSpacePointMakerTool(name = "InDetSiSpacePointMakerTool") - -#InDetSiSpacePointMakerTool.OutputLevel = VERBOSE -#ToolSvc += InDetSiSpacePointMakerTool -#print InDetSiSpacePointMakerTool - -#from ISF_FatrasRecoTools.ISF_FatrasRecoToolsConf import iFatras__ISF_SiSpacePointMakerTool -#ISFSiSpacePointMakerTool = iFatras__ISF_SiSpacePointMakerTool(name = "ISF_SiSpacePointMakerTool") - -#ISFSiSpacePointMakerTool.OutputLevel = VERBOSE -#ToolSvc += ISFSiSpacePointMakerTool -#print ISFSiSpacePointMakerTool - -## -## SiTrackerSpacePointFinder algorithm -## -#from SiSpacePointFormation.SiSpacePointFormationConf import InDet__SiTrackerSpacePointFinder -#InDetSiTrackerSpacePointFinder = InDet__SiTrackerSpacePointFinder(name = "InDetSiTrackerSpacePointFinder", -# SiSpacePointMakerTool = InDetSiSpacePointMakerTool, -# ISF_SiSpacePointMakerTool = ISFSiSpacePointMakerTool, -# PixelsClustersName = InDetKeys.PixelClusters(), SCT_ClustersName = InDetKeys.SCT_Clusters(), -# SpacePointsPixelName = InDetKeys.PixelSpacePoints(), -# SpacePointsSCTName = InDetKeys.SCT_SpacePoints(), -# SpacePointsOverlapName = InDetKeys.OverlapSpacePoints(), -# ProcessPixels = True, -# ProcessSCTs = True, -# ProcessOverlaps = DetFlags.haveRIO.SCT_on()) - -#InDetSiTrackerSpacePointFinder.OutputLevel = VERBOSE - -#topSequence += InDetSiTrackerSpacePointFinder -#print InDetSiTrackerSpacePointFinder - -#AlgSequence("Streams").StreamRDO.ItemList += ["SpacePointContainer#PixelSpacePoints"] -#AlgSequence("Streams").StreamRDO.ItemList += ["SpacePointContainer#SCT_SpacePoints"] - -from ISF_FatrasRecoTools.ISF_FatrasRecoToolsConf import iFatras__ISF_PRDGeneralTruthTrajectorySorterID -mysort=iFatras__ISF_PRDGeneralTruthTrajectorySorterID(name="ISFGeneralTruthTrajectorySorter") -mysort.OutputLevel = OutputLevel -ToolSvc+=mysort -print mysort - -from ISF_FatrasRecoTools.ISF_FatrasRecoToolsConf import iFatras__PlanarClusterProvider -PlanarClusterProvider=iFatras__PlanarClusterProvider(name = "PlanarClusterProvider", - PlanarClusterContainers=["Pixel_PlanarClusters", "SCT_PlanarClusters"]) -ToolSvc+=PlanarClusterProvider -PlanarClusterProvider.OutputLevel = OutputLevel -print PlanarClusterProvider - -from ISF_FatrasRecoTools.ISF_FatrasRecoToolsConf import iFatras__PlanarClusterOnTrackTool -PixelPlanarClusterOnTrackTool = iFatras__PlanarClusterOnTrackTool("PixelPlanarClusterOnTrackTool") -PixelPlanarClusterOnTrackTool.OutputLevel = OutputLevel -ToolSvc += PixelPlanarClusterOnTrackTool -print PixelPlanarClusterOnTrackTool - -SCT_PlanarClusterOnTrackTool = iFatras__PlanarClusterOnTrackTool("SCT_PlanarClusterOnTrackTool") -SCT_PlanarClusterOnTrackTool.OutputLevel = OutputLevel -ToolSvc += SCT_PlanarClusterOnTrackTool -print SCT_PlanarClusterOnTrackTool - -from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackCreator -InDetRotCreator = Trk__RIO_OnTrackCreator(name = 'InDetRotCreator', - ToolPixelCluster = PixelPlanarClusterOnTrackTool, - ToolSCT_Cluster = SCT_PlanarClusterOnTrackTool, - ToolMuonCluster = None, - ToolMuonDriftCircle = None, - ToolMuonMMCluster = None, - ToolTRT_DriftCircle = None, - Mode = 'indet') -InDetRotCreator.OutputLevel = OutputLevel -ToolSvc += InDetRotCreator - -from TrkRIO_OnTrackCreator.TrkRIO_OnTrackCreatorConf import Trk__RIO_OnTrackCreator -BroadInDetRotCreator = Trk__RIO_OnTrackCreator(name = 'BroadInDetRotCreator', - ToolPixelCluster = PixelPlanarClusterOnTrackTool, - ToolSCT_Cluster = SCT_PlanarClusterOnTrackTool, - ToolMuonCluster = None, - ToolMuonDriftCircle = None, - ToolMuonMMCluster = None, - ToolTRT_DriftCircle = None, - Mode = 'indet') -BroadInDetRotCreator.OutputLevel = OutputLevel -ToolSvc += BroadInDetRotCreator - -print InDetRotCreator -print BroadInDetRotCreator - -ScaleHitUncertainty = 2.5 -InDetRefitRotCreator = InDetRotCreator - -from TrkMeasurementUpdator.TrkMeasurementUpdatorConf import Trk__KalmanUpdator -InDetUpdator = Trk__KalmanUpdator(name = 'InDetUpdator') -InDetUpdator.OutputLevel = OutputLevel -ToolSvc += InDetUpdator -print InDetUpdator - -# -# get propagator -# - -from TrkExRungeKuttaPropagator.TrkExRungeKuttaPropagatorConf import Trk__RungeKuttaPropagator as Propagator - -InDetPropagator = Propagator(name = 'InDetPropagator') - -ToolSvc += InDetPropagator -print InDetPropagator - -# -# Setup the Navigator (default, could be removed) -# - -from TrkExTools.TrkExToolsConf import Trk__Navigator -InDetNavigator = Trk__Navigator(name = 'InDetNavigator', - TrackingGeometrySvc = AtlasTrackingGeometrySvc) -ToolSvc += InDetNavigator -print InDetNavigator - -# -# Setup the MaterialEffectsUpdator -# - -from TrkExTools.TrkExToolsConf import Trk__MaterialEffectsUpdator -InDetMaterialUpdator = Trk__MaterialEffectsUpdator(name = "InDetMaterialEffectsUpdator") -if not InDetFlags.solenoidOn(): - InDetMaterialUpdator.EnergyLoss = False - InDetMaterialUpdator.ForceMomentum = True - InDetMaterialUpdator.ForcedMomentumValue = 1000*MeV - -ToolSvc += InDetMaterialUpdator -print InDetMaterialUpdator - -# CONFIGURE PROPAGATORS/UPDATORS ACCORDING TO GEOMETRY SIGNATURE - -InDetSubPropagators = [] -InDetSubUpdators = [] - -# -------------------- set it depending on the geometry ---------------------------------------------------- -# default for ID is (Rk,Mat) -InDetSubPropagators += [ InDetPropagator.name() ] -InDetSubUpdators += [ InDetMaterialUpdator.name() ] - -# default for Calo is (Rk,MatLandau) -InDetSubPropagators += [ InDetPropagator.name() ] -InDetSubUpdators += [ InDetMaterialUpdator.name() ] - -# default for MS is (STEP,Mat) -#InDetSubPropagators += [ InDetStepPropagator.name() ] -InDetSubUpdators += [ InDetMaterialUpdator.name() ] -# ---------------------------------------------------------------------------------------------------------- - -# -# set up extrapolator -# -from TrkExTools.TrkExToolsConf import Trk__Extrapolator -InDetExtrapolator = Trk__Extrapolator(name = 'InDetExtrapolator', - Propagators = [ InDetPropagator ], # [ InDetPropagator, InDetStepPropagator ], - MaterialEffectsUpdators = [ InDetMaterialUpdator ], - Navigator = InDetNavigator, - SubPropagators = InDetSubPropagators, - SubMEUpdators = InDetSubUpdators) -ToolSvc += InDetExtrapolator -print InDetExtrapolator - -from TrkExEngine.AtlasExtrapolationEngine import AtlasExtrapolationEngine -ATLAS_FatrasExEngine = AtlasExtrapolationEngine(name='Extrapolation', nameprefix='Atlas', ToolOutputLevel=OutputLevel) -ToolSvc += ATLAS_FatrasExEngine -print ATLAS_FatrasExEngine -ATLAS_FatrasExEngine.OutputLevel = OutputLevel - -from TrkKalmanFitter.TrkKalmanFitterConf import Trk__ForwardKalmanFitter as PublicFKF -InDetFKF = PublicFKF(name = 'InDetFKF', - StateChi2PerNDFPreCut = 30.0, - ExtrapolationEngine = ATLAS_FatrasExEngine, - UseExtrapolationEngine = True) -InDetFKF.OutputLevel = OutputLevel -ToolSvc += InDetFKF -print InDetFKF - -from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanSmoother as PublicBKS -InDetBKS = PublicBKS(name = 'InDetBKS', - InitialCovarianceSeedFactor = 200., - ExtrapolationEngine = ATLAS_FatrasExEngine, - UseExtrapolationEngine = True) -InDetBKS.OutputLevel = OutputLevel -ToolSvc += InDetBKS -print InDetBKS - -from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanOutlierLogic as PublicKOL -InDetKOL = PublicKOL(name = 'InDetKOL', - TrackChi2PerNDFCut = 17.0, - StateChi2PerNDFCut = 12.5) -InDetKOL.OutputLevel = OutputLevel -ToolSvc += InDetKOL -print InDetKOL - -InDetDNAdjustor = None -InDetDNASeparator = None - -from TrkKalmanFitter.TrkKalmanFitterConf import Trk__KalmanFitter as ConfiguredKalmanFitter -InDetTrackFitter = ConfiguredKalmanFitter(name = 'InDetTrackFitter', - ExtrapolatorHandle = InDetExtrapolator, - RIO_OnTrackCreatorHandle = InDetRotCreator, - MeasurementUpdatorHandle = InDetUpdator, - ForwardKalmanFitterHandle = InDetFKF, - KalmanSmootherHandle = InDetBKS, - KalmanOutlierLogicHandle = InDetKOL, - DynamicNoiseAdjustorHandle = InDetDNAdjustor, - BrempointAnalyserHandle = InDetDNASeparator, - AlignableSurfaceProviderHandle = None, - RecalibratorHandle = None, - InternalDAFHandle = None) -InDetTrackFitter.OutputLevel = OutputLevel #VERBOSE -ToolSvc += InDetTrackFitter -print InDetTrackFitter - -from TrkTruthTrackTools.TrkTruthTrackToolsConf import Trk__TruthTrackBuilder -InDetTruthTrackBuilder = Trk__TruthTrackBuilder(name = 'InDetTruthTrackBuilder', - TrackFitter = InDetTrackFitter, - ExtrapolationTool = InDetExtrapolator, - RotCreatorTool = InDetRotCreator, - BroadRotCreatorTool = BroadInDetRotCreator, - MinDegreesOfFreedom = 1) -InDetTruthTrackBuilder.OutputLevel = OutputLevel #VERBOSE -ToolSvc += InDetTruthTrackBuilder -print InDetTruthTrackBuilder - - -PRD_PlanarMultiTruthColl = [] -PRD_PlanarMultiTruthColl += ["PRD_MultiTruthPlanarPixel","PRD_MultiTruthPlanarSCT"] - -from ISF_FatrasRecoTools.ISF_FatrasRecoToolsConf import iFatras__PRD_PlanarTruthTrajectoryBuilder -# change input collection key if taking only pileup -ISF_PRD_TruthTrajectoryBuilder=iFatras__PRD_PlanarTruthTrajectoryBuilder(name = 'ISF_PRD_TruthTrajectoryBuilder', - PRD_PlanarMultiTruthCollections = PRD_PlanarMultiTruthColl, - InDetPRD_PlanarClusterProvider = PlanarClusterProvider, - MinimumPt = 400, - PRD_TruthTrajectoryManipulators = [mysort]) - -ISF_PRD_TruthTrajectoryBuilder.OutputLevel = OutputLevel #VERBOSE -ToolSvc+=ISF_PRD_TruthTrajectoryBuilder -print ISF_PRD_TruthTrajectoryBuilder - -def getIFS_PRDtoTrackMapTool(**kwargs) : - tool_name = 'ISF_PRDtoTrackMapTool' - from AthenaCommon.AppMgr import ToolSvc - if hasattr(ToolSvc,tool_name) : - return getattr(ToolSvc,tool_name) - - from ISF_FatrasRecoTools.ISF_FatrasRecoToolsConf import iFatras__ISF_PRDtoTrackMapTool - tool=iFatras__ISF_PRDtoTrackMapTool( name=tool_name, **kwargs) - ToolSvc += tool - return tool - - -from ISF_FatrasRecoTools.ISF_FatrasRecoToolsConf import iFatras__ISF_TrackSummaryHelperTool -ISF_TrackSummaryHelperTool = iFatras__ISF_TrackSummaryHelperTool(name = "ISF_TrackSummaryHelperTool", - AssoTool = "", - DoSharedHits = True) -ISF_TrackSummaryHelperTool.OutputLevel = OutputLevel #VERBOSE -ToolSvc += ISF_TrackSummaryHelperTool -print ISF_TrackSummaryHelperTool - -# @TODO does th ISF_TrackSummaryHelperTool do hole search and if so is that intedned ? -from TrkTrackSummaryTool.TrkTrackSummaryToolConf import Trk__TrackSummaryTool -InDetTrackSummaryTool = Trk__TrackSummaryTool(name = "InDetTrackSummaryTool", - doSharedHits = True, - InDetSummaryHelperTool = ISF_TrackSummaryHelperTool, - AddDetailedInDetSummary = False, - doHolesInDet = False, - doHolesMuon = False, - MuonSummaryHelperTool = "", - AddDetailedMuonSummary = False, - TRT_ElectronPidTool = "", - PixelToTPIDTool = "", - PixelExists = True) -InDetTrackSummaryTool.OutputLevel = OutputLevel #VERBOSE -ToolSvc += InDetTrackSummaryTool -print InDetTrackSummaryTool - -# --- the truth track creation algorithm -from InDetRecExample.TrackingCommon import getInDetPRDtoTrackMapToolGangedPixels -from TrkTruthTrackAlgs.TrkTruthTrackAlgsConf import Trk__TruthTrackCreation -InDetTruthTrackCreation = Trk__TruthTrackCreation(name = 'InDetTruthTrackCreation', - PRD_TruthTrajectoryBuilder = ISF_PRD_TruthTrajectoryBuilder, - TruthTrackBuilder = InDetTruthTrackBuilder, - OutputTrackCollection = InDetKeys.PseudoTracks(), - AssociationTool = getIFS_PRDtoTrackMapTool(), - TrackSummaryTool = InDetTrackSummaryTool) -InDetTruthTrackCreation.OutputLevel = OutputLevel #VERBOSE -topSequence += InDetTruthTrackCreation -print InDetTruthTrackCreation - -if TrkDetFlags.ISF_FatrasCustomGeometry(): - InDetKeys.PixelClustersTruth = "PRD_MultiTruthPlanarPixel" - InDetKeys.SCT_ClustersTruth = "PRD_MultiTruthPlanarSCT" -InDetFlags.doPhysValMon = True -InDetRecTestBLayerTool=None - -InDetTrackSummaryToolSharedHits=InDetTrackSummaryTool - -InDetKeys.UnslimmedTracks = InDetKeys.PseudoTracks() -InDetKeys.UnslimmedTracksTruth = InDetKeys.PseudoTracksTruth() - -InputTrackCollection = InDetKeys.PseudoTracks() - -include ("InDetRecExample/ConfiguredInDetTrackTruth.py") -InDetTracksTruth = ConfiguredInDetTrackTruth(InDetKeys.PseudoTracks(), - InDetKeys.PseudoDetailedTracksTruth(), - InDetKeys.PseudoTracksTruth()) -InDetTracksTruth.OutputLevel = OutputLevel #VERBOSE - -from TrkTruthToTrack.TrkTruthToTrackConf import Trk__TruthToTrack -InDetTruthToTrack = Trk__TruthToTrack(name = "InDetTruthToTrack", - Extrapolator = InDetExtrapolator) - -ToolSvc += InDetTruthToTrack -InDetTruthToTrack.OutputLevel = OutputLevel #VERBOSE - -# track collection keys for statistics -if not 'TrackCollectionKeys' in dir(): - TrackCollectionKeys = [] -if not 'TrackCollectionTruthKeys' in dir(): - TrackCollectionTruthKeys = [] - -TrackCollectionKeys += [ InDetKeys.PseudoTracks() ] -TrackCollectionTruthKeys += [ InDetKeys.PseudoTracksTruth() ] - -from xAODTruthCnv.xAODTruthCnvConf import xAODMaker__xAODTruthCnvAlg -xAODTruthCnvAlg = xAODMaker__xAODTruthCnvAlg( name = "xAODTruthCnvAlg", - AODContainerName = "TruthEvent", - WriteInTimePileUpTruth = False, - WriteAllPileUpTruth = False) -xAODTruthCnvAlg.OutputLevel = OutputLevel #VERBOSE -topSequence += xAODTruthCnvAlg - -print xAODTruthCnvAlg - -# register internally used track summary tool -from TrkTrackSummaryTool.AtlasTrackSummaryTool import AtlasTrackSummaryTool -AtlasTrackSummaryTool = AtlasTrackSummaryTool() -ToolSvc += AtlasTrackSummaryTool - -include("InDetRecExample/InDetxAODCreator.py") - -public_InDetxAODParticleCreatorTool = getInDetxAODParticleCreatorTool() -public_InDetxAODParticleCreatorTool.TrackSummaryTool = InDetTrackSummaryTool -public_InDetxAODParticleCreatorTool.OutputLevel = OutputLevel #VERBOSE -print public_InDetxAODParticleCreatorTool - -# adjust track particle creators -add_truth_links=[False,True] -idx=0 -for alg_name in ['InDetTrackParticles',InDetKeys.xAODPseudoTrackParticleContainer()] : - if hasattr(topSequence,alg_name) : - alg=getattr(topSequence,alg_name) - alg.OutputLevel = OutputLevel # VERBOSE - if hasattr(alg,"TrackParticleCreator") : - alg.TrackParticleCreator.TrackSummaryTool = InDetTrackSummaryTool - alg.TrackParticleCreator.OutputLevel = OutputLevel # VERBOSE - if add_truth_links[idx] : - alg.AddTruthLink = InDetFlags.doTruth() - else : - print >>sys.stderr,'WARNING the %s algorithm does not contain the expected TrackParticleCreator property.' % alg_name - print alg - else : - import sys - print >>sys.stderr,'WARNING top sequence does not contain the expected %s algorithm' % alg_name - idx += 1 - -from OutputStreamAthenaPool.MultipleStreamManager import MSMgr -xaodStream = MSMgr.NewPoolStream( "StreamAOD", "xAOD.pool.root" ) -#xaodStream.AddItem( "#*" ) -xaodStream.AddItem("xAOD::AuxContainerBase#InDetPseudoTrackParticlesAux.") -xaodStream.AddItem("xAOD::IParticleContainer#InDetPseudoTrackParticles") -xaodStream.AddItem("xAOD::TrackParticleContainer#InDetPseudoTrackParticles") -xaodStream.AddItem("xAOD::TrackParticleAuxContainer#InDetPseudoTrackParticlesAux.") -xaodStream.AddItem( "xAOD::TruthEventContainer#TruthEvents" ) -xaodStream.AddItem( "xAOD::TruthEventAuxContainer#TruthEventsAux." ) -xaodStream.AddItem( "xAOD::TruthParticleContainer#TruthParticles" ) -xaodStream.AddItem( "xAOD::TruthParticleAuxContainer#TruthParticlesAux." ) - -xaodStream.Print() -xaodStream.OutputLevel = OutputLevel #VERBOSE - -if doVP1: - from VP1Algs.VP1AlgsConf import VP1Alg - topSequence += VP1Alg() diff --git a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py index fb8f71212c7585afccdd24cd908cef4492855855..7015d588204d9d6bb41189907f0d9674368a6627 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py +++ b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfig.py @@ -54,15 +54,6 @@ def SensorSimPlanarTool(name="SensorSimPlanarTool", **kwargs): kwargs.setdefault("SiPropertiesTool", ToolSvc.PixelSiPropertiesTool) kwargs.setdefault("LorentzAngleTool", ToolSvc.PixelLorentzAngleTool) kwargs.setdefault("doRadDamage", digitizationFlags.doRadiationDamage.get_Value()) - # TODO This is 2018 fluence setting. These parameters should be controlled by the conditions data. - kwargs.setdefault("fluence", 6.4) - kwargs.setdefault("fluenceB", 4.6) - kwargs.setdefault("fluence1", 2.1) - kwargs.setdefault("fluence2", 1.3) - kwargs.setdefault("voltage", 400) - kwargs.setdefault("voltageB", 400) - kwargs.setdefault("voltage1", 250) - kwargs.setdefault("voltage2", 250) return CfgMgr.SensorSimPlanarTool(name, **kwargs) def SensorSim3DTool(name="SensorSim3DTool", **kwargs): @@ -204,15 +195,23 @@ def PixelConfigCondAlg_MC(): #==================================================================================== # Run-dependent SIMULATION(digitization) parameters: #==================================================================================== - # RUN2 2015/2016 - alg.BarrelToTThreshold2016 = [ -1, 5, 5, 5] - alg.FEI3BarrelLatency2016 = [ 0, 151, 256, 256] - alg.FEI3BarrelHitDuplication2016 = [False,False,False,False] - alg.FEI3BarrelSmallHitToT2016 = [ -1, -1, -1, -1] - alg.FEI3BarrelTimingSimTune2016 = [ -1, 2015, 2015, 2015] - alg.BarrelCrossTalk2016 = [ 0.30, 0.06, 0.06, 0.06] - alg.BarrelNoiseOccupancy2016 = [ 5e-8, 5e-8, 5e-8, 5e-8] - alg.BarrelDisableProbability2016 = [ 9e-3, 9e-3, 9e-3, 9e-3] + # RUN2 2015/2016 (mc16a) + # The pixel conditions are matched with 2016 data (mc16a) at L=17.3fb-1 (run#303638). + alg.BarrelToTThreshold2016 = [ -1, 5, 5, 5] + alg.FEI3BarrelLatency2016 = [ 0, 151, 256, 256] + alg.FEI3BarrelHitDuplication2016 = [ False, False, False, False] + alg.FEI3BarrelSmallHitToT2016 = [ -1, -1, -1, -1] + alg.FEI3BarrelTimingSimTune2016 = [ -1, 2015, 2015, 2015] + alg.BarrelCrossTalk2016 = [ 0.30, 0.06, 0.06, 0.06] + alg.BarrelNoiseOccupancy2016 = [ 5e-8, 5e-8, 5e-8, 5e-8] + alg.BarrelDisableProbability2016 = [ 9e-3, 9e-3, 9e-3, 9e-3] + alg.DefaultBarrelBiasVoltage2016 = [ 80.0, 350.0, 200.0, 150.0] + alg.BarrelFluence2016 = [0.80e14,1.61e14,0.71e14,0.48e14] + + alg.BarrelFluenceMap2016 = ["PixelDigitization/maps_IBL_PL_80V_fl0_8e14.root", + "PixelDigitization/maps_PIX_350V_fl1_61e14.root", + "PixelDigitization/maps_PIX_200V_fl0_71e14.root", + "PixelDigitization/maps_PIX_150V_fl0_48e14.root"] alg.EndcapToTThreshold2016 = [ 5, 5, 5] alg.FEI3EndcapLatency2016 = [ 256, 256, 256] @@ -222,11 +221,13 @@ def PixelConfigCondAlg_MC(): alg.EndcapCrossTalk2016 = [ 0.06, 0.06, 0.06] alg.EndcapNoiseOccupancy2016 = [ 5e-8, 5e-8, 5e-8] alg.EndcapDisableProbability2016 = [ 9e-3, 9e-3, 9e-3] + alg.DefaultEndcapBiasVoltage2016 = [150.0,150.0,150.0] alg.DBMToTThreshold2016 = [ -1, -1, -1] alg.DBMCrossTalk2016 = [ 0.06, 0.06, 0.06] alg.DBMNoiseOccupancy2016 = [ 5e-8, 5e-8, 5e-8] alg.DBMDisableProbability2016 = [ 9e-3, 9e-3, 9e-3] + alg.DefaultDBMBiasVoltage2016 = [500.0,500.0,500.0] alg.IBLNoiseShape2016 = [0.0, 0.0330, 0.0, 0.3026, 0.5019, 0.6760, 0.8412, 0.9918, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0] alg.BLayerNoiseShape2016 = [0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0] @@ -239,15 +240,23 @@ def PixelConfigCondAlg_MC(): # [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.1735, 0.3380, 0.4733, 0.5829, 0.6730, 0.7516, 0.8234, 0.8916, 0.9595, 1.0]] #==================================================================================== - # RUN2 2017 - alg.BarrelToTThreshold2017 = [ -1, 5, 5, 5] - alg.FEI3BarrelLatency2017 = [ 0, 151, 256, 256] - alg.FEI3BarrelHitDuplication2017 = [False,False,False,False] - alg.FEI3BarrelSmallHitToT2017 = [ -1, -1, -1, -1] - alg.FEI3BarrelTimingSimTune2017 = [ -1, 2018, 2018, 2018] - alg.BarrelCrossTalk2017 = [ 0.30, 0.06, 0.06, 0.06] - alg.BarrelNoiseOccupancy2017 = [ 5e-8, 5e-8, 5e-8, 5e-8] - alg.BarrelDisableProbability2017 = [ 9e-3, 9e-3, 9e-3, 9e-3] + # RUN2 2017 (mc16d) + # The pixel conditions are matched with 2017 data (mc16d) at L=69.0fb-1 (run#336506). + alg.BarrelToTThreshold2017 = [ -1, 5, 5, 5] + alg.FEI3BarrelLatency2017 = [ 0, 151, 256, 256] + alg.FEI3BarrelHitDuplication2017 = [ False, False, False, False] + alg.FEI3BarrelSmallHitToT2017 = [ -1, -1, -1, -1] + alg.FEI3BarrelTimingSimTune2017 = [ -1, 2018, 2018, 2018] + alg.BarrelCrossTalk2017 = [ 0.30, 0.06, 0.06, 0.06] + alg.BarrelNoiseOccupancy2017 = [ 5e-8, 5e-8, 5e-8, 5e-8] + alg.BarrelDisableProbability2017 = [ 9e-3, 9e-3, 9e-3, 9e-3] + alg.DefaultBarrelBiasVoltage2017 = [ 350.0, 350.0, 200.0, 150.0] + alg.BarrelFluence2017 = [3.18e14,3.42e14,1.50e14,1.01e14] + + alg.BarrelFluenceMap2017 = ["PixelDigitization/maps_IBL_PL_350V_fl3_18e14.root", + "PixelDigitization/maps_PIX_350V_fl3_42e14.root", + "PixelDigitization/maps_PIX_200V_fl1_5e14.root", + "PixelDigitization/maps_PIX_150V_fl1_01e14.root"] alg.EndcapToTThreshold2017 = [ 5, 5, 5] alg.FEI3EndcapLatency2017 = [ 256, 256, 256] @@ -257,26 +266,36 @@ def PixelConfigCondAlg_MC(): alg.EndcapCrossTalk2017 = [ 0.06, 0.06, 0.06] alg.EndcapNoiseOccupancy2017 = [ 5e-8, 5e-8, 5e-8] alg.EndcapDisableProbability2017 = [ 9e-3, 9e-3, 9e-3] + alg.DefaultEndcapBiasVoltage2017 = [150.0,150.0,150.0] alg.DBMToTThreshold2017 = [ -1, -1, -1] alg.DBMCrossTalk2017 = [ 0.06, 0.06, 0.06] alg.DBMNoiseOccupancy2017 = [ 5e-8, 5e-8, 5e-8] alg.DBMDisableProbability2017 = [ 9e-3, 9e-3, 9e-3] + alg.DefaultDBMBiasVoltage2017 = [500.0,500.0,500.0] alg.IBLNoiseShape2017 = [0.0, 0.0330, 0.0, 0.3026, 0.5019, 0.6760, 0.8412, 0.9918, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0] alg.BLayerNoiseShape2017 = [0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0] alg.PixelNoiseShape2017 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0] #==================================================================================== - # RUN2 2018 - alg.BarrelToTThreshold2018 = [ -1, 3, 5, 5] - alg.FEI3BarrelLatency2018 = [ 0, 151, 256, 256] - alg.FEI3BarrelHitDuplication2018 = [False,False,False,False] - alg.FEI3BarrelSmallHitToT2018 = [ -1, -1, -1, -1] - alg.FEI3BarrelTimingSimTune2018 = [ -1, 2018, 2018, 2018] - alg.BarrelCrossTalk2018 = [ 0.30, 0.06, 0.06, 0.06] - alg.BarrelNoiseOccupancy2018 = [ 5e-8, 5e-8, 5e-8, 5e-8] - alg.BarrelDisableProbability2018 = [ 9e-3, 9e-3, 9e-3, 9e-3] + # RUN2 2018 (mc16e) + # The pixel conditions are matched with 2018 data (mc16e) at L=119.4fb-1 (run#357193). + alg.BarrelToTThreshold2018 = [ -1, 3, 5, 5] + alg.FEI3BarrelLatency2018 = [ 0, 151, 256, 256] + alg.FEI3BarrelHitDuplication2018 = [ False, False, False, False] + alg.FEI3BarrelSmallHitToT2018 = [ -1, -1, -1, -1] + alg.FEI3BarrelTimingSimTune2018 = [ -1, 2018, 2018, 2018] + alg.BarrelCrossTalk2018 = [ 0.30, 0.06, 0.06, 0.06] + alg.BarrelNoiseOccupancy2018 = [ 5e-8, 5e-8, 5e-8, 5e-8] + alg.BarrelDisableProbability2018 = [ 9e-3, 9e-3, 9e-3, 9e-3] + alg.DefaultBarrelBiasVoltage2018 = [ 400.0, 400.0, 250.0, 250.0] + alg.BarrelFluence2018 = [5.50e14,5.19e14,2.28e14,1.53e14] + + alg.BarrelFluenceMap2018 = ["PixelDigitization/maps_IBL_PL_400V_fl5_5e14.root", + "PixelDigitization/maps_PIX_400V_fl5_19e14.root", + "PixelDigitization/maps_PIX_250V_fl2_28e14.root", + "PixelDigitization/maps_PIX_250V_fl1_53e14.root"] alg.EndcapToTThreshold2018 = [ 5, 5, 5] alg.FEI3EndcapLatency2018 = [ 256, 256, 256] @@ -286,11 +305,13 @@ def PixelConfigCondAlg_MC(): alg.EndcapCrossTalk2018 = [ 0.06, 0.06, 0.06] alg.EndcapNoiseOccupancy2018 = [ 5e-8, 5e-8, 5e-8] alg.EndcapDisableProbability2018 = [ 9e-3, 9e-3, 9e-3] + alg.DefaultEndcapBiasVoltage2018 = [250.0,250.0,250.0] alg.DBMToTThreshold2018 = [ -1, -1, -1] alg.DBMCrossTalk2018 = [ 0.06, 0.06, 0.06] alg.DBMNoiseOccupancy2018 = [ 5e-8, 5e-8, 5e-8] alg.DBMDisableProbability2018 = [ 9e-3, 9e-3, 9e-3] + alg.DefaultDBMBiasVoltage2018 = [500.0,500.0,500.0] alg.IBLNoiseShape2018 = [0.0, 0.0330, 0.0, 0.3026, 0.5019, 0.6760, 0.8412, 0.9918, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0] alg.BLayerNoiseShape2018 = [0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0] @@ -298,14 +319,20 @@ def PixelConfigCondAlg_MC(): #==================================================================================== # RUN1 - alg.BarrelToTThresholdRUN1 = [ 3, 3, 3] - alg.FEI3BarrelLatencyRUN1 = [ 256, 256, 256] - alg.FEI3BarrelHitDuplicationRUN1 = [ True, True, True] - alg.FEI3BarrelSmallHitToTRUN1 = [ 7, 7, 7] - alg.FEI3BarrelTimingSimTuneRUN1 = [ 2009, 2009, 2009] - alg.BarrelCrossTalkRUN1 = [ 0.06, 0.06, 0.06] - alg.BarrelNoiseOccupancyRUN1 = [ 5e-8, 5e-8, 5e-8] - alg.BarrelDisableProbabilityRUN1 = [ 9e-3, 9e-3, 9e-3] + alg.BarrelToTThresholdRUN1 = [ 3, 3, 3] + alg.FEI3BarrelLatencyRUN1 = [ 256, 256, 256] + alg.FEI3BarrelHitDuplicationRUN1 = [ True, True, True] + alg.FEI3BarrelSmallHitToTRUN1 = [ 7, 7, 7] + alg.FEI3BarrelTimingSimTuneRUN1 = [ 2009, 2009, 2009] + alg.BarrelCrossTalkRUN1 = [ 0.06, 0.06, 0.06] + alg.BarrelNoiseOccupancyRUN1 = [ 5e-8, 5e-8, 5e-8] + alg.BarrelDisableProbabilityRUN1 = [ 9e-3, 9e-3, 9e-3] + alg.DefaultBarrelBiasVoltageRUN1 = [ 150.0, 150.0, 150.0] + alg.BarrelFluenceRUN1 = [1.01e14,0.44e14,0.30e14] + + alg.BarrelFluenceMapRUN1 = ["PixelDigitization/maps_PIX_250V_fl1_01e14.root", + "PixelDigitization/maps_PIX_150V_fl0_44e14.root", + "PixelDigitization/maps_PIX_150V_fl0_3e14.root"] alg.EndcapToTThresholdRUN1 = [ 3, 3, 3] alg.FEI3EndcapLatencyRUN1 = [ 256, 256, 256] @@ -315,21 +342,31 @@ def PixelConfigCondAlg_MC(): alg.EndcapCrossTalkRUN1 = [ 0.06, 0.06, 0.06] alg.EndcapNoiseOccupancyRUN1 = [ 5e-8, 5e-8, 5e-8] alg.EndcapDisableProbabilityRUN1 = [ 9e-3, 9e-3, 9e-3] + alg.DefaultEndcapBiasVoltageRUN1 = [150.0,150.0,150.0] alg.BLayerNoiseShapeRUN1 = [0.0, 0.0, 0.0, 0.0, 0.2204, 0.5311, 0.7493, 0.8954, 0.9980, 1.0] alg.PixelNoiseShapeRUN1 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.2418, 0.4397, 0.5858, 0.6949, 0.7737, 0.8414, 0.8959, 0.9414, 0.9828, 1.0] #==================================================================================== # ITK - alg.BarrelToTThresholdITK = [ 3, 3, 3, 3, 3] - alg.BarrelCrossTalkITK = [ 0.06, 0.06, 0.06, 0.06, 0.06] - alg.BarrelNoiseOccupancyITK = [ 5e-8, 5e-8, 5e-8, 5e-8, 5e-8] - alg.BarrelDisableProbabilityITK = [ 9e-3, 9e-3, 9e-3, 9e-3, 9e-3] + alg.BarrelToTThresholdITK = [ 3, 3, 3, 3, 3] + alg.BarrelCrossTalkITK = [ 0.06, 0.06, 0.06, 0.06, 0.06] + alg.BarrelNoiseOccupancyITK = [ 5e-8, 5e-8, 5e-8, 5e-8, 5e-8] + alg.BarrelDisableProbabilityITK = [ 9e-3, 9e-3, 9e-3, 9e-3, 9e-3] + alg.DefaultBarrelBiasVoltageITK = [ 150.0, 150.0, 150.0, 150.0, 150.0] + alg.BarrelFluenceITK = [0.0e14,0.0e14,0.0e14,0.0e14,0.0e14] + + alg.BarrelFluenceMapITK = ["PixelDigitization/maps_IBL_PL_80V_fl0e14.root", + "PixelDigitization/maps_IBL_PL_80V_fl0e14.root", + "PixelDigitization/maps_IBL_PL_80V_fl0e14.root", + "PixelDigitization/maps_IBL_PL_80V_fl0e14.root", + "PixelDigitization/maps_IBL_PL_80V_fl0e14.root"] alg.EndcapToTThresholdITK = [ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3] alg.EndcapCrossTalkITK = [ 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06, 0.06] alg.EndcapNoiseOccupancyITK = [ 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8, 5e-8] alg.EndcapDisableProbabilityITK = [ 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3, 9e-3] + alg.DefaultEndcapBiasVoltageITK = [150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0,150.0] alg.InnermostNoiseShapeITK = [0.0, 1.0] alg.NextInnermostNoiseShapeITK = [0.0, 1.0] diff --git a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfigNew.py b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfigNew.py index 71563d2317a37231cf2d884d8c61a58b05437ed8..efc78d58aa4ff065d20539b90b0d667f19f2c5a7 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfigNew.py +++ b/InnerDetector/InDetDigitization/PixelDigitization/python/PixelDigitizationConfigNew.py @@ -84,15 +84,6 @@ def SensorSimPlanarToolCfg(flags, name="SensorSimPlanarTool", **kwargs): kwargs.setdefault("LorentzAngleTool", LorentzTool) SensorSimPlanarTool = CompFactory.SensorSimPlanarTool kwargs.setdefault("doRadDamage", flags.Digitization.DoRadiationDamage) - # TODO This is 2018 fluence setting. These parameters should be controlled by the conditions data. - kwargs.setdefault("fluence", 6.4) - kwargs.setdefault("fluenceB", 4.6) - kwargs.setdefault("fluence1", 2.1) - kwargs.setdefault("fluence2", 1.3) - kwargs.setdefault("voltage", 400) - kwargs.setdefault("voltageB", 400) - kwargs.setdefault("voltage1", 250) - kwargs.setdefault("voltage2", 250) acc.setPrivateTools(SensorSimPlanarTool(name, **kwargs)) return acc diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx index df14c3d5aececbc9c238dc01ee0e660841e95da1..4444967edfbca94fb9f6f4be8adf5a6e473c649a 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx @@ -46,18 +46,7 @@ StatusCode SensorSimPlanarTool::initialize() { ATH_CHECK(m_lorentzAngleTool.retrieve()); - //Calculate trapping times based on fluence (already includes check for fluence=0) - if (m_doRadDamage) { - std::pair<double,double> trappingTimes = m_radDamageUtil->getTrappingTimes( m_fluence ); - m_trappingTimeElectrons = trappingTimes.first; - m_trappingTimeHoles = trappingTimes.second; - } - else { - m_fluence = 0; - } - //If any fluence or voltage initialized negative use benchmark maps and not interpolation - bool doInterpolateEfield = (m_fluence > 0. && m_fluenceB > 0. && m_fluence1 > 0. && m_fluence2 > 0. && m_voltage > 0. && m_voltageB > 0. && m_voltage1 > 0. && m_voltage2 > 0.); std::vector<std::string> mapsPath_list; std::vector<std::string> TCADpath_list; @@ -68,224 +57,54 @@ StatusCode SensorSimPlanarTool::initialize() { // For each layer one configuration TCADpath_list = {iblFiles, sensorFiles, sensorFiles, sensorFiles}; //IBL - 200um sensor depth, B layer - 20um, layer 1, layer 2 - if (static_cast<int>(m_fluence)==1) { - ATH_MSG_INFO("Use benchmark point 1!"); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_IBL_PL_80V_fl0em10.root") ); //IBL PL - Barrel - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_250V_fl7e13.root") ); //B-Layer - Barrel - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_150V_fl3e13.root") ); //Layer-1 - Barrel - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_150V_fl2e13.root") ); //Layer-2 - Barrel - - m_fluence_layers.push_back(1e-10); - m_fluence_layers.push_back(7e13); - m_fluence_layers.push_back(3e13); - m_fluence_layers.push_back(2e13); - - m_voltage_layers.push_back(80); - m_voltage_layers.push_back(250); - m_voltage_layers.push_back(150); - m_voltage_layers.push_back(150); - } - else if (static_cast<int>(m_fluence)==2) { - ATH_MSG_INFO("Use benchmark point 2!"); - - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_IBL_PL_80V_fl1e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_350V_fl1_2e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_200V_fl0_5e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_150V_fl3e13.root") ); - - m_fluence_layers.push_back(1e14); - m_fluence_layers.push_back(1.2e14); - m_fluence_layers.push_back(5e13); - m_fluence_layers.push_back(3e13); - - m_voltage_layers.push_back(80); - m_voltage_layers.push_back(350); - m_voltage_layers.push_back(200); - m_voltage_layers.push_back(150); - } - else if (static_cast<int>(m_fluence)==3) { - ATH_MSG_INFO("Use benchmark point 3!"); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_IBL_PL_80V_fl2e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_350V_fl1_7e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_200V_fl0_7e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_150V_fl4e13.root") ); - - m_fluence_layers.push_back(2e14); - m_fluence_layers.push_back(1.7e14); - m_fluence_layers.push_back(7e13); - m_fluence_layers.push_back(4e13); - - m_voltage_layers.push_back(80); - m_voltage_layers.push_back(350); - m_voltage_layers.push_back(200); - m_voltage_layers.push_back(150); - } - else if (static_cast<int>(m_fluence)==4) { - ATH_MSG_INFO("Use benchmark point 4!"); - - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_IBL_PL_150V_fl2e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_350V_fl1_7e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_200V_fl0_7e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_150V_fl4e13.root") ); - - m_fluence_layers.push_back(2e14); - m_fluence_layers.push_back(1.7e14); - m_fluence_layers.push_back(7e13); - m_fluence_layers.push_back(4e13); - - m_voltage_layers.push_back(150); - m_voltage_layers.push_back(350); - m_voltage_layers.push_back(200); - m_voltage_layers.push_back(150); - } - else if (static_cast<int>(m_fluence)==5) { - ATH_MSG_INFO("Use benchmark point 5!"); - - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_IBL_PL_350V_fl5e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_350V_fl3_1e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_200V_fl1_3e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_150V_fl8e13.root") ); - - m_fluence_layers.push_back(5e14); - m_fluence_layers.push_back(3.1e14); - m_fluence_layers.push_back(1.3e14); - m_fluence_layers.push_back(8e13); - - m_voltage_layers.push_back(350); - m_voltage_layers.push_back(350); - m_voltage_layers.push_back(200); - m_voltage_layers.push_back(150); - } - else if (static_cast<int>(m_fluence)==6) { - ATH_MSG_INFO("Use benchmark point 6!"); - - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_IBL_400V_fl8_7e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_400V_fl4_6e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_250V_fl2_1e14.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_250V_fl1_3e14.root") ); - - m_fluence_layers.push_back(8.7e14); - m_fluence_layers.push_back(4.6e14); - m_fluence_layers.push_back(2.1e14); - m_fluence_layers.push_back(1.3e14); - - m_voltage_layers.push_back(400); - m_voltage_layers.push_back(400); - m_voltage_layers.push_back(250); - m_voltage_layers.push_back(250); - } - else if (static_cast<int>(m_fluence)==7) { - ATH_MSG_INFO("Use benchmark point 7!"); - - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_IBL_endLHC.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_blayer_endLHC.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_L1_endLHC.root") ); - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_L2_endLHC.root") ); - - m_fluence_layers.push_back(2*8.7e14); - m_fluence_layers.push_back(2*4.6e14); - m_fluence_layers.push_back(2*2.1e14); - m_fluence_layers.push_back(2*1.3e14); - - m_voltage_layers.push_back(400); - m_voltage_layers.push_back(400); - m_voltage_layers.push_back(250); - m_voltage_layers.push_back(250); - } - - if (mapsPath_list.size()==0) { - if (doInterpolateEfield) { - ATH_MSG_INFO("No benchmark value set for fluence. Use interpolation."); - mapsPath_list.clear(); - m_fluence_layers.clear(); - m_voltage_layers.clear(); - //Set up default maps for ramoMap, - //but retrieve Efield from interpolation as well as Lorentz, time and distance map from E field - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_IBL_PL_80V_fl0em10.root") ); //IBL PL - Barrel - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_150V_fl7e13.root") ); //B-Layer - Barrel - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_150V_fl3e13.root") ); //Layer-1 - Barrel - mapsPath_list.push_back( PathResolverFindCalibFile("PixelDigitization/maps_PIX_150V_fl2e13.root") ); //Layer-2 - Barrel - m_fluence_layers.push_back(m_fluence*1e14); - m_fluence_layers.push_back(m_fluenceB*1e14); - m_fluence_layers.push_back(m_fluence1*1e14); - m_fluence_layers.push_back(m_fluence2*1e14); - - m_voltage_layers.push_back(m_voltage); - m_voltage_layers.push_back(m_voltageB); - m_voltage_layers.push_back(m_voltage1); - m_voltage_layers.push_back(m_voltage2); - } - } - else { - if (!doInterpolateEfield) { - ATH_MSG_INFO("m_fluence set to becnhmark value. Use becnhmark values for all layers."); - } - else { - ATH_MSG_WARNING("m_fluence set to benchmark value. Fluence and bias voltage for all layers overwritten accordingly."); + if (m_doInterpolateEfield) { + if (m_fluenceMap.size()==0 || m_fluenceLayer.size()==0 || m_voltageLayer.size()==0 || m_fluenceMap.size()!=m_fluenceLayer.size() || m_fluenceMap.size()!=m_voltageLayer.size()) { + ATH_MSG_INFO("Use interpolation, but the input map/fluence/valtage are not set."); + return StatusCode::FAILURE; } - } - - if (m_doRadDamage) { - ATH_MSG_INFO("ibl : Phi=" << m_fluence_layers.at(0) << "e14neq/cm2 U="<< m_voltage_layers.at(0) << "V"); - ATH_MSG_INFO("B layer : Phi=" << m_fluence_layers.at(1) << "e14neq/cm2 U="<< m_voltage_layers.at(1) << "V"); - ATH_MSG_INFO("layer 1 : Phi=" << m_fluence_layers.at(2) << "e14neq/cm2 U="<< m_voltage_layers.at(2) << "V"); - ATH_MSG_INFO("layer 2 : Phi=" << m_fluence_layers.at(3) << "e14neq/cm2 U="<< m_voltage_layers.at(3) << "V"); - } + ATH_MSG_INFO("No benchmark value set for fluence. Use interpolation."); - // ***************************** - // *** Setup Maps **** - // ***************************** - //TODO This is only temporary until remotely stored maps and locally generated maps can be implemented - //E field already implemented: needs fluence and bias voltage given as Property m_fluence, m_fluenceB, ..., m_fluence1, ... - for (unsigned int i=0; i<mapsPath_list.size(); i++) { - - ATH_MSG_INFO("Using maps located in: "<<mapsPath_list.at(i) << " for layer No." << i); - if(doInterpolateEfield)ATH_MSG_INFO("Create E field via interpolation based on files from: " << TCADpath_list.at(i)); - //std::unique_ptr<TFile> mapsFile=std::make_unique<TFile>( (mapsPath_list.at(i)).c_str() ); //this is the ramo potential. - TFile* mapsFile=new TFile( (mapsPath_list.at(i)).c_str() ); //this is the ramo potential. - - std::pair<int, int> Layer; // index for layer/end cap position - Layer.first=0; //Barrel (0) or End Cap (1) - Now only for Barrel. If we want to add End Caps, put them at Layer.first=1 - Layer.second=i; //Layer: 0 = IBL Planar, 1=B-Layer, 2=Layer-1, 3=Layer-2 - //IBL Barrel doesn't exist. So the possible idexes should be: 0-0, 0-1, 0-2, 0-3, 1-1, 1-2, 1-3 - - //Setup ramo weighting field map - TH3F* ramoPotentialMap_hold; - ramoPotentialMap_hold=0; - ramoPotentialMap_hold=(TH3F*)mapsFile->Get("hramomap1"); - if (ramoPotentialMap_hold==0) ramoPotentialMap_hold=(TH3F*)mapsFile->Get("ramo3d"); - if (ramoPotentialMap_hold==0){ - ATH_MSG_INFO("Did not find a Ramo potential map. Will use an approximate form."); - ATH_MSG_WARNING("Not implemented yet - exit"); - return StatusCode::FAILURE; //Obviously, remove this when gen. code is set up - } - m_ramoPotentialMap[Layer]=ramoPotentialMap_hold; - m_fluence_layersMaps[Layer]=m_fluence_layers.at(i); - //Now setup the E-field. - TH1F* eFieldMap_hold; - eFieldMap_hold= new TH1F() ; - if(doInterpolateEfield){ - //ATH_MSG_INFO("Generating E field maps using interpolation."); - CHECK(m_radDamageUtil->generateEfieldMap( eFieldMap_hold, NULL, m_fluence_layers.at(i), m_voltage_layers.at(i), i, TCADpath_list.at(i), true)); - }else{ - //precomputed map - eFieldMap_hold=(TH1F*)mapsFile->Get("hEfield1D"); + mapsPath_list.clear(); + for (size_t i=0; i<m_fluenceMap.size(); i++) { + mapsPath_list.push_back(PathResolverFindCalibFile(m_fluenceMap[i])); } - if (eFieldMap_hold == 0){ - ATH_MSG_INFO("Unable to load sensor e-field map."); - return StatusCode::FAILURE; - } - m_eFieldMap[Layer]=eFieldMap_hold; + // ***************************** + // *** Setup Maps **** + // ***************************** + //TODO This is only temporary until remotely stored maps and locally generated maps can be implemented + //E field already implemented: needs fluence and bias voltage given as Property m_fluence, m_fluenceB, ..., m_fluence1, ... + for (unsigned int i=0; i<mapsPath_list.size(); i++) { + + ATH_MSG_INFO("Using maps located in: "<<mapsPath_list.at(i) << " for layer No." << i); + ATH_MSG_INFO("Create E field via interpolation based on files from: " << TCADpath_list.at(i)); + //std::unique_ptr<TFile> mapsFile=std::make_unique<TFile>( (mapsPath_list.at(i)).c_str() ); //this is the ramo potential. + TFile* mapsFile=new TFile( (mapsPath_list.at(i)).c_str() ); //this is the ramo potential. + + //Setup ramo weighting field map + TH3F* ramoPotentialMap_hold; + ramoPotentialMap_hold=0; + ramoPotentialMap_hold=(TH3F*)mapsFile->Get("hramomap1"); + if (ramoPotentialMap_hold==0) ramoPotentialMap_hold=(TH3F*)mapsFile->Get("ramo3d"); + if (ramoPotentialMap_hold==0){ + ATH_MSG_INFO("Did not find a Ramo potential map. Will use an approximate form."); + ATH_MSG_WARNING("Not implemented yet - exit"); + return StatusCode::FAILURE; //Obviously, remove this when gen. code is set up + } + m_ramoPotentialMap.push_back(ramoPotentialMap_hold); + //Now setup the E-field. + TH1F* eFieldMap_hold; + eFieldMap_hold= new TH1F() ; + //ATH_MSG_INFO("Generating E field maps using interpolation."); + CHECK(m_radDamageUtil->generateEfieldMap( eFieldMap_hold, NULL, m_fluenceLayer[i], m_voltageLayer[i], i, TCADpath_list.at(i), true)); - TH2F* lorentzMap_e_hold =new TH2F() ; - TH2F* lorentzMap_h_hold =new TH2F() ; - TH2F* distanceMap_h_hold =new TH2F() ; - TH2F* distanceMap_e_hold =new TH2F() ; - TH1F* timeMap_e_hold =new TH1F() ; - TH1F* timeMap_h_hold =new TH1F() ; + TH2F* lorentzMap_e_hold = new TH2F(); + TH2F* lorentzMap_h_hold = new TH2F(); + TH2F* distanceMap_h_hold = new TH2F(); + TH2F* distanceMap_e_hold = new TH2F(); + TH1F* timeMap_e_hold = new TH1F(); + TH1F* timeMap_h_hold = new TH1F(); - if (doInterpolateEfield) { ATH_CHECK(m_radDamageUtil->generateDistanceTimeMap( distanceMap_e_hold, distanceMap_h_hold, timeMap_e_hold, timeMap_h_hold, lorentzMap_e_hold, lorentzMap_h_hold, eFieldMap_hold, NULL )); // For debugging and documentation: uncomment to save different maps which are based on the interpolated E field if(m_radDamageUtil->saveDebugMaps()){ @@ -304,27 +123,16 @@ StatusCode SensorSimPlanarTool::initialize() { prename.ReplaceAll( "_e","_h"); lorentzMap_h_hold->SaveAs(prename); } + //Safetycheck + if (distanceMap_e_hold == 0 || distanceMap_h_hold == 0 || timeMap_e_hold == 0 || timeMap_h_hold == 0 || lorentzMap_e_hold == 0 || lorentzMap_h_hold == 0){ + ATH_MSG_INFO("Unable to load at least one of the distance/time/Lorentz angle maps."); + return StatusCode::FAILURE;//Obviously, remove this when gen. code is set up + } + m_distanceMap_e.push_back(distanceMap_e_hold); + m_distanceMap_h.push_back(distanceMap_h_hold); + m_lorentzMap_e.push_back(lorentzMap_e_hold); + m_lorentzMap_h.push_back(lorentzMap_h_hold); } - else { - //retrieve precomputed maps - lorentzMap_e_hold=(TH2F*)mapsFile->Get("lorentz_map_e"); - lorentzMap_h_hold=(TH2F*)mapsFile->Get("lorentz_map_h"); - distanceMap_h_hold=(TH2F*)mapsFile->Get("hdistance"); - distanceMap_e_hold=(TH2F*)mapsFile->Get("edistance"); - timeMap_e_hold=(TH1F*)mapsFile->Get("etimes"); - timeMap_h_hold=(TH1F*)mapsFile->Get("htimes"); - } - //Safetycheck - if (distanceMap_e_hold == 0 || distanceMap_h_hold == 0 || timeMap_e_hold == 0 || timeMap_h_hold == 0 || lorentzMap_e_hold == 0 || lorentzMap_h_hold == 0){ - ATH_MSG_INFO("Unable to load at least one of the distance/time/Lorentz angle maps."); - return StatusCode::FAILURE;//Obviously, remove this when gen. code is set up - } - m_lorentzMap_e[Layer]=lorentzMap_e_hold; - m_lorentzMap_h[Layer]=lorentzMap_h_hold; - m_distanceMap_e[Layer]=distanceMap_e_hold; - m_distanceMap_h[Layer]=distanceMap_h_hold; - m_timeMap_e[Layer]=timeMap_e_hold; - m_timeMap_h[Layer]=timeMap_h_hold; } return StatusCode::SUCCESS; } @@ -351,24 +159,16 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiC } } - bool isBarrel = false; - const PixelID* p_pixelId = static_cast<const PixelID *>(Module.getIdHelper()); int layer=p_pixelId->layer_disk(Module.identify() ); - int bec=1; - if (p_pixelId->is_barrel(Module.identify())) { bec=0; } - - if (Module.isBarrel()) { isBarrel=true; } - std::pair<int, int> Layer; // index for layer/end cap position - Layer.first=bec; //Barrel (0) or End Cap (1) - Maps only for Barrel at the moment. isBarrel will avoid zsh - Layer.second=layer; //Layer: 0 = IBL Planar, 1=B-Layer, 2=Layer-1, 3=Layer-2 - //IBL Barrel doesn't exist. So the possible idexes should be: 0-0, 0-1, 0-2, 0-3, 1-1, 1-2, 1-3 + // retrieve conditions data + SG::ReadCondHandle<PixelModuleData> moduleData(m_moduleDataKey); - if (m_doRadDamage && isBarrel && m_fluence>0) { - std::pair<double,double> trappingTimes = m_radDamageUtil->getTrappingTimes( m_fluence_layersMaps[Layer] ); - m_trappingTimeElectrons = trappingTimes.first; - m_trappingTimeHoles = trappingTimes.second; + std::pair<double,double> trappingTimes; + if (m_doRadDamage && Module.isBarrel()) { + if (m_doInterpolateEfield) { trappingTimes = m_radDamageUtil->getTrappingTimes(m_fluenceLayer[layer]); } + else { trappingTimes = m_radDamageUtil->getTrappingTimes(moduleData->getFluenceLayer(layer)); } } //Load values from energyDeposition @@ -449,7 +249,7 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiC int numBins_weightingPotential_y = 0; int numBins_weightingPotential_z = 0; - if (m_doRadDamage && m_fluence>0 && !(Module.isDBM()) && isBarrel) { + if (m_doRadDamage && !(Module.isDBM()) && Module.isBarrel()) { centreOfPixel_i = p_design.positionFromColumnRow(pixel_i.etaIndex(), pixel_i.phiIndex()); //Find the displacment of the charge carriers from the centre of the pixel in +ve quadrant @@ -464,12 +264,20 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiC nnLoop_pixelPhiMin = std::max( -2, pixel_i.phiIndex() + 1 - phiCells ); //Setup values to check for overflow when using maps - numBins_driftTime_e = m_distanceMap_e[Layer]->GetNbinsY(); //Returns nBins = totalBins - underflow - overflow - numBins_driftTime_h = m_distanceMap_h[Layer]->GetNbinsY(); - - numBins_weightingPotential_x = m_ramoPotentialMap[Layer]->GetNbinsX(); - numBins_weightingPotential_y = m_ramoPotentialMap[Layer]->GetNbinsY(); - numBins_weightingPotential_z = m_ramoPotentialMap[Layer]->GetNbinsZ(); + if (m_doInterpolateEfield) { + numBins_driftTime_e = m_distanceMap_e[layer]->GetNbinsY(); //Returns nBins = totalBins - underflow - overflow + numBins_driftTime_h = m_distanceMap_h[layer]->GetNbinsY(); + numBins_weightingPotential_x = m_ramoPotentialMap[layer]->GetNbinsX(); + numBins_weightingPotential_y = m_ramoPotentialMap[layer]->GetNbinsY(); + numBins_weightingPotential_z = m_ramoPotentialMap[layer]->GetNbinsZ(); + } + else { // use fluence value from conditions data + numBins_driftTime_e = moduleData->getDistanceMap_e(layer)->GetNbinsY(); + numBins_driftTime_h = moduleData->getDistanceMap_h(layer)->GetNbinsY(); + numBins_weightingPotential_x = moduleData->getRamoPotentialMap(layer)->GetNbinsX(); + numBins_weightingPotential_y = moduleData->getRamoPotentialMap(layer)->GetNbinsY(); + numBins_weightingPotential_z = moduleData->getRamoPotentialMap(layer)->GetNbinsZ(); + } } // Distance between charge and readout side. p_design->readoutSide() is @@ -485,52 +293,66 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiC for (int j=0; j<ncharges; j++) { - if (m_doRadDamage && m_fluence>0 && !(Module.isDBM()) && isBarrel) { + if (m_doRadDamage && !(Module.isDBM()) && Module.isBarrel()) { double u = CLHEP::RandFlat::shoot(0.,1.); - double drifttime_e = (-1.)*m_trappingTimeElectrons*TMath::Log(u); //ns + double drifttime_e = (-1.)*(trappingTimes.first)*TMath::Log(u); //ns u = CLHEP::RandFlat::shoot(0.,1.); - double drifttime_h = (-1.)*m_trappingTimeHoles*TMath::Log(u); //ns + double drifttime_h = (-1.)*(trappingTimes.second)*TMath::Log(u); //ns //Now, need the z-position at the trap. - int nbin_z_e_xbin = m_distanceMap_e[Layer]->GetXaxis()->FindBin(dist_electrode); - int nbin_z_e_ybin = m_distanceMap_e[Layer]->GetYaxis()->FindBin(drifttime_e); - if (nbin_z_e_ybin > numBins_driftTime_e ) nbin_z_e_ybin = numBins_driftTime_e; - double depth_f_e = m_distanceMap_e[Layer]->GetBinContent( nbin_z_e_xbin,nbin_z_e_ybin ); - double dz_e = fabs(dist_electrode - depth_f_e); - + double depth_f_e = 0.0; + double depth_f_h = 0.0; + double tanLorentz_e = 0.0; + double tanLorentz_h = 0.0; //TODO: the holes map does not currently extend for a drift time long enough that, any hole will reach //the corresponding electrode. This needs to be rectified by either (a) extrapolating the current map or //(b) making a new map with a y-axis (drift time) that extends to at least 18 ns so all charge carriers reach electrode. //However, if choose (b), will need to reduce granularity of map. - int nbin_z_h_xbin = m_distanceMap_h[Layer]->GetXaxis()->FindBin(dist_electrode); - int nbin_z_h_ybin = m_distanceMap_h[Layer]->GetYaxis()->FindBin(drifttime_h); - if (nbin_z_h_ybin > numBins_driftTime_h ) - nbin_z_h_ybin = numBins_driftTime_h; - double depth_f_h = m_distanceMap_h[Layer]->GetBinContent( nbin_z_h_xbin,nbin_z_h_ybin ); + if (m_doInterpolateEfield) { + int nbin_z_e_xbin = m_distanceMap_e[layer]->GetXaxis()->FindBin(dist_electrode); + int nbin_z_e_ybin = m_distanceMap_e[layer]->GetYaxis()->FindBin(drifttime_e); + if (nbin_z_e_ybin>numBins_driftTime_e) { nbin_z_e_ybin = numBins_driftTime_e; } + depth_f_e = m_distanceMap_e[layer]->GetBinContent(nbin_z_e_xbin,nbin_z_e_ybin); + int nbin_z_h_xbin = m_distanceMap_h[layer]->GetXaxis()->FindBin(dist_electrode); + int nbin_z_h_ybin = m_distanceMap_h[layer]->GetYaxis()->FindBin(drifttime_h); + if (nbin_z_h_ybin>numBins_driftTime_h) { nbin_z_h_ybin = numBins_driftTime_h; } + depth_f_h = m_distanceMap_h[layer]->GetBinContent( nbin_z_h_xbin,nbin_z_h_ybin ); + int nbin_Lorentz_e = m_lorentzMap_e[layer]->FindBin(dist_electrode,depth_f_e); + tanLorentz_e = m_lorentzMap_e[layer]->GetBinContent(nbin_Lorentz_e); + int nbin_Lorentz_h = m_lorentzMap_h[layer]->FindBin(dist_electrode,depth_f_h); + tanLorentz_h = m_lorentzMap_h[layer]->GetBinContent(nbin_Lorentz_h); + } + else { // use fluence value from conditions data + int nbin_z_e_xbin = moduleData->getDistanceMap_e(layer)->GetXaxis()->FindBin(dist_electrode); + int nbin_z_e_ybin = moduleData->getDistanceMap_e(layer)->GetYaxis()->FindBin(drifttime_e); + if (nbin_z_e_ybin>numBins_driftTime_e) { nbin_z_e_ybin = numBins_driftTime_e; } + depth_f_e = moduleData->getDistanceMap_e(layer)->GetBinContent(nbin_z_e_xbin,nbin_z_e_ybin); + int nbin_z_h_xbin = moduleData->getDistanceMap_h(layer)->GetXaxis()->FindBin(dist_electrode); + int nbin_z_h_ybin = moduleData->getDistanceMap_h(layer)->GetYaxis()->FindBin(drifttime_h); + if (nbin_z_h_ybin>numBins_driftTime_h) { nbin_z_h_ybin = numBins_driftTime_h; } + depth_f_h = moduleData->getDistanceMap_h(layer)->GetBinContent( nbin_z_h_xbin,nbin_z_h_ybin ); + int nbin_Lorentz_e = moduleData->getLorentzMap_e(layer)->FindBin(dist_electrode,depth_f_e); + tanLorentz_e = moduleData->getLorentzMap_e(layer)->GetBinContent(nbin_Lorentz_e); + int nbin_Lorentz_h = moduleData->getLorentzMap_h(layer)->FindBin(dist_electrode,depth_f_h); + tanLorentz_h = moduleData->getLorentzMap_h(layer)->GetBinContent(nbin_Lorentz_h); + } + double dz_e = fabs(dist_electrode - depth_f_e); double dz_h = fabs(depth_f_h - dist_electrode); + double coLorentz_e = std::sqrt(1.0+std::pow(tanLorentz_e,2)); //Apply drift due to Lorentz force and diffusion double phiRand = CLHEP::RandGaussZiggurat::shoot(rndmEngine); - int nbin_Lorentz_e = m_lorentzMap_e[Layer]->FindBin(dist_electrode,depth_f_e); - tanLorentz = m_lorentzMap_e[Layer]->GetBinContent(nbin_Lorentz_e); - coLorentz=sqrt(1+pow(tanLorentz,2)); - //Apply diffusion. rdif is teh max. diffusion - double rdif_e=this->m_diffusionConstant*sqrt( fabs(dist_electrode - depth_f_e)*coLorentz/0.3); - double phi_f_e=phi_i + dz_e*tanLorentz + rdif_e*phiRand; + double rdif_e=this->m_diffusionConstant*sqrt( fabs(dist_electrode - depth_f_e)*coLorentz_e/0.3); + double phi_f_e=phi_i + dz_e*tanLorentz_e + rdif_e*phiRand; double etaRand = CLHEP::RandGaussZiggurat::shoot(rndmEngine); double eta_f_e=eta_i + rdif_e*etaRand; phiRand = CLHEP::RandGaussZiggurat::shoot(rndmEngine); - - int nbin_Lorentz_h = m_lorentzMap_h[Layer]->FindBin(dist_electrode,depth_f_h); - tanLorentz = m_lorentzMap_h[Layer]->GetBinContent(nbin_Lorentz_h); - coLorentz=sqrt(1+pow(tanLorentz,2)); - - double rdif_h=this->m_diffusionConstant*sqrt( fabs(dist_electrode - depth_f_h)*coLorentz/0.3); - - double phi_f_h=phi_i + dz_h*tanLorentz + rdif_h*phiRand; + double coLorentz_h = std::sqrt(1.0+std::pow(tanLorentz_h,2)); + double rdif_h=this->m_diffusionConstant*sqrt( fabs(dist_electrode - depth_f_h)*coLorentz_h/0.3); + double phi_f_h=phi_i + dz_h*tanLorentz_h + rdif_h*phiRand; etaRand = CLHEP::RandGaussZiggurat::shoot(rndmEngine); double eta_f_h=eta_i + rdif_h*etaRand; @@ -563,16 +385,6 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiC double dEta_i_e = pixelEta_i - dEta_nn_centre; double dPhi_i_e = pixelPhi_i - dPhi_nn_centre; - int nbin_ramo_i_x = m_ramoPotentialMap[Layer]->GetXaxis()->FindBin( fabs( dPhi_i_e )*1000. ); - int nbin_ramo_i_y = m_ramoPotentialMap[Layer]->GetYaxis()->FindBin( fabs( dEta_i_e )*1000. ); - int nbin_ramo_i_z = m_ramoPotentialMap[Layer]->GetZaxis()->FindBin( dist_electrode*1000 ); - //int nbin_ramo_i = m_ramoPotentialMap[0]->FindBin( fabs( dEta_i_e )*1000. , fabs( dPhi_i_e )*1000., dist_electrode*1000); - - //Boundary check on maps - double ramo_i=0.; - if( nbin_ramo_i_x <= numBins_weightingPotential_x && nbin_ramo_i_y <= numBins_weightingPotential_y && nbin_ramo_i_z <=numBins_weightingPotential_z ){ - ramo_i =m_ramoPotentialMap[Layer]->GetBinContent( nbin_ramo_i_x,nbin_ramo_i_y,nbin_ramo_i_z ); - } //Find the displacment of the charge carriers from the centre of the pixel in +ve quadrant double pixelEta_f_e = eta_f_e - centreOfPixel_i.xEta() ; double pixelPhi_f_e = phi_f_e - centreOfPixel_i.xPhi() ; @@ -581,45 +393,76 @@ StatusCode SensorSimPlanarTool::induceCharge(const TimedHitPtr<SiHit> &phit, SiC double pixelPhi_f_h = phi_f_h - centreOfPixel_i.xPhi() ; //Final position of charge carriers wrt nn centre - double dEta_f_e = pixelEta_f_e - dEta_nn_centre ; - double dPhi_f_e = pixelPhi_f_e - dPhi_nn_centre ; - - int nbin_ramo_f_e_x = m_ramoPotentialMap[Layer]->GetXaxis()->FindBin( fabs( dPhi_f_e )*1000. ); - int nbin_ramo_f_e_y = m_ramoPotentialMap[Layer]->GetYaxis()->FindBin( fabs( dEta_f_e )*1000. ); - int nbin_ramo_f_e_z = m_ramoPotentialMap[Layer]->GetZaxis()->FindBin( depth_f_e*1000 ); - //int nbin_ramo_f_e = m_ramoPotentialMap[0]->FindBin( fabs( dEta_f_e )*1000. , fabs( dPhi_f_e )*1000., depth_f_e*1000); - double ramo_f_e=0.; - if( nbin_ramo_f_e_x <= numBins_weightingPotential_x && nbin_ramo_f_e_y <= numBins_weightingPotential_y && nbin_ramo_f_e_z <=numBins_weightingPotential_z ){ - ramo_f_e =m_ramoPotentialMap[Layer]->GetBinContent( nbin_ramo_f_e_x,nbin_ramo_f_e_y,nbin_ramo_f_e_z ); - } - - double dEta_f_h = pixelEta_f_h - dEta_nn_centre ; - double dPhi_f_h = pixelPhi_f_h - dPhi_nn_centre ; - - int nbin_ramo_f_h_x = m_ramoPotentialMap[Layer]->GetXaxis()->FindBin( fabs( dPhi_f_h )*1000. ); - int nbin_ramo_f_h_y = m_ramoPotentialMap[Layer]->GetYaxis()->FindBin( fabs( dEta_f_h )*1000. ); - int nbin_ramo_f_h_z = m_ramoPotentialMap[Layer]->GetZaxis()->FindBin( depth_f_h*1000 ); - //int nbin_ramo_f_h = m_ramoPotentialMap->FindBin( fabs( dEta_f_h )*1000. , fabs( dPhi_f_h )*1000., depth_f_h*1000); + double dEta_f_e = pixelEta_f_e - dEta_nn_centre; + double dPhi_f_e = pixelPhi_f_e - dPhi_nn_centre; + + double dEta_f_h = pixelEta_f_h - dEta_nn_centre; + double dPhi_f_h = pixelPhi_f_h - dPhi_nn_centre; + //Boundary check on maps - double ramo_f_h=0.; - if( nbin_ramo_f_h_x <= numBins_weightingPotential_x && nbin_ramo_f_h_y <= numBins_weightingPotential_y && nbin_ramo_f_h_z <=numBins_weightingPotential_z ){ - ramo_f_h =m_ramoPotentialMap[Layer]->GetBinContent( nbin_ramo_f_h_x,nbin_ramo_f_h_y,nbin_ramo_f_h_z ); - } - - //Account for the imperfect binning that would cause charge to be double-counted - if(m_ramoPotentialMap[Layer]->GetZaxis()->FindBin(depth_f_h*1000) == m_ramoPotentialMap[Layer]->GetNbinsZ()+1) ramo_f_h=0;//this means the hole has reached the back end - if(m_ramoPotentialMap[Layer]->GetZaxis()->FindBin(depth_f_e*1000) == 1){ - if( fabs(dEta_f_e)>=Module.etaPitch()/2. || fabs(dPhi_f_e)>=Module.phiPitch()/2. ) ramo_f_e=0; - else if (fabs(dEta_f_e)<Module.etaPitch()/2. && fabs(dPhi_f_e)<Module.phiPitch()/2. ) ramo_f_e=1.; + double ramo_i = 0.0; + double ramo_f_e = 0.0; + double ramo_f_h = 0.0; + if (m_doInterpolateEfield) { + int nbin_ramo_i_x = m_ramoPotentialMap[layer]->GetXaxis()->FindBin( fabs( dPhi_i_e )*1000. ); + int nbin_ramo_i_y = m_ramoPotentialMap[layer]->GetYaxis()->FindBin( fabs( dEta_i_e )*1000. ); + int nbin_ramo_i_z = m_ramoPotentialMap[layer]->GetZaxis()->FindBin( dist_electrode*1000 ); + if (nbin_ramo_i_x<=numBins_weightingPotential_x && nbin_ramo_i_y<=numBins_weightingPotential_y && nbin_ramo_i_z<=numBins_weightingPotential_z) { + ramo_i = m_ramoPotentialMap[layer]->GetBinContent(nbin_ramo_i_x,nbin_ramo_i_y,nbin_ramo_i_z); + } + int nbin_ramo_f_e_x = m_ramoPotentialMap[layer]->GetXaxis()->FindBin(fabs(dPhi_f_e)*1000.0); + int nbin_ramo_f_e_y = m_ramoPotentialMap[layer]->GetYaxis()->FindBin(fabs(dEta_f_e)*1000.0); + int nbin_ramo_f_e_z = m_ramoPotentialMap[layer]->GetZaxis()->FindBin(depth_f_e*1000); + if(nbin_ramo_f_e_x<=numBins_weightingPotential_x && nbin_ramo_f_e_y<=numBins_weightingPotential_y && nbin_ramo_f_e_z<=numBins_weightingPotential_z) { + ramo_f_e = m_ramoPotentialMap[layer]->GetBinContent(nbin_ramo_f_e_x,nbin_ramo_f_e_y,nbin_ramo_f_e_z); + } + int nbin_ramo_f_h_x = m_ramoPotentialMap[layer]->GetXaxis()->FindBin( fabs( dPhi_f_h )*1000. ); + int nbin_ramo_f_h_y = m_ramoPotentialMap[layer]->GetYaxis()->FindBin( fabs( dEta_f_h )*1000. ); + int nbin_ramo_f_h_z = m_ramoPotentialMap[layer]->GetZaxis()->FindBin( depth_f_h*1000 ); + if (nbin_ramo_f_h_x<=numBins_weightingPotential_x && nbin_ramo_f_h_y<=numBins_weightingPotential_y && nbin_ramo_f_h_z<=numBins_weightingPotential_z) { + ramo_f_h = m_ramoPotentialMap[layer]->GetBinContent(nbin_ramo_f_h_x,nbin_ramo_f_h_y,nbin_ramo_f_h_z); + } + //Account for the imperfect binning that would cause charge to be double-counted + if (m_ramoPotentialMap[layer]->GetZaxis()->FindBin(depth_f_h*1000)==m_ramoPotentialMap[layer]->GetNbinsZ()+1) { ramo_f_h = 0.0; } //this means the hole has reached the back end + + if (m_ramoPotentialMap[layer]->GetZaxis()->FindBin(depth_f_e*1000)==1) { + if (fabs(dEta_f_e)>=Module.etaPitch()/2.0 || fabs(dPhi_f_e)>=Module.phiPitch()/2.0) { ramo_f_e = 0.0; } + else if (fabs(dEta_f_e)<Module.etaPitch()/2.0 && fabs(dPhi_f_e)<Module.phiPitch()/2.0) { ramo_f_e = 1.0; } + } + } + else { // use fluence value from conditions data + int nbin_ramo_i_x = moduleData->getRamoPotentialMap(layer)->GetXaxis()->FindBin( fabs( dPhi_i_e )*1000. ); + int nbin_ramo_i_y = moduleData->getRamoPotentialMap(layer)->GetYaxis()->FindBin( fabs( dEta_i_e )*1000. ); + int nbin_ramo_i_z = moduleData->getRamoPotentialMap(layer)->GetZaxis()->FindBin( dist_electrode*1000 ); + if (nbin_ramo_i_x<=numBins_weightingPotential_x && nbin_ramo_i_y<=numBins_weightingPotential_y && nbin_ramo_i_z<=numBins_weightingPotential_z) { + ramo_i = moduleData->getRamoPotentialMap(layer)->GetBinContent(nbin_ramo_i_x,nbin_ramo_i_y,nbin_ramo_i_z); + } + int nbin_ramo_f_e_x = moduleData->getRamoPotentialMap(layer)->GetXaxis()->FindBin( fabs( dPhi_f_e )*1000. ); + int nbin_ramo_f_e_y = moduleData->getRamoPotentialMap(layer)->GetYaxis()->FindBin( fabs( dEta_f_e )*1000. ); + int nbin_ramo_f_e_z = moduleData->getRamoPotentialMap(layer)->GetZaxis()->FindBin( depth_f_e*1000 ); + if(nbin_ramo_f_e_x<=numBins_weightingPotential_x && nbin_ramo_f_e_y<=numBins_weightingPotential_y && nbin_ramo_f_e_z<=numBins_weightingPotential_z) { + ramo_f_e = moduleData->getRamoPotentialMap(layer)->GetBinContent(nbin_ramo_f_e_x,nbin_ramo_f_e_y,nbin_ramo_f_e_z); + } + int nbin_ramo_f_h_x = moduleData->getRamoPotentialMap(layer)->GetXaxis()->FindBin( fabs( dPhi_f_h )*1000. ); + int nbin_ramo_f_h_y = moduleData->getRamoPotentialMap(layer)->GetYaxis()->FindBin( fabs( dEta_f_h )*1000. ); + int nbin_ramo_f_h_z = moduleData->getRamoPotentialMap(layer)->GetZaxis()->FindBin( depth_f_h*1000 ); + if (nbin_ramo_f_h_x<=numBins_weightingPotential_x && nbin_ramo_f_h_y<=numBins_weightingPotential_y && nbin_ramo_f_h_z<=numBins_weightingPotential_z) { + ramo_f_h = moduleData->getRamoPotentialMap(layer)->GetBinContent(nbin_ramo_f_h_x,nbin_ramo_f_h_y,nbin_ramo_f_h_z); + } + //Account for the imperfect binning that would cause charge to be double-counted + if(moduleData->getRamoPotentialMap(layer)->GetZaxis()->FindBin(depth_f_h*1000)==moduleData->getRamoPotentialMap(layer)->GetNbinsZ()+1) { ramo_f_h=0; } //this means the hole has reached the back end + + if (moduleData->getRamoPotentialMap(layer)->GetZaxis()->FindBin(depth_f_e*1000)==1) { + if (fabs(dEta_f_e)>=Module.etaPitch()/2.0 || fabs(dPhi_f_e)>=Module.phiPitch()/2.0) { ramo_f_e = 0.0; } + else if (fabs(dEta_f_e)<Module.etaPitch()/2.0 && fabs(dPhi_f_e)<Module.phiPitch()/2.0) { ramo_f_e = 1.0; } + } } - //Given final position of charge carrier, find induced charge. The difference in Ramo weighting potential gives the fraction of charge induced. //The energy_per_step is transformed into charge with the eleholePair per Energy double induced_charge_e = (ramo_f_e - ramo_i) * energy_per_step * eleholePairEnergy; double induced_charge_h = -(ramo_f_h - ramo_i) * energy_per_step * eleholePairEnergy; - //Collect charge in centre of each pixel, since location within pixel doesn't matter for record SiLocalPosition chargePos = Module.hitLocalToLocal( centreOfPixel_nn.xEta(), centreOfPixel_nn.xPhi() ); diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.h index 3db9f5b5e22d13bca13f2be9bc14d169277d1857..f3f0fdda27e461b68f594385c5efe1ffaecf4e17 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.h @@ -35,17 +35,11 @@ class SensorSimPlanarTool : public SensorSimTool { SensorSimPlanarTool(); // Map for radiation damage simulation - std::map<std::pair<int, int>, TH3F*> m_ramoPotentialMap; - std::map<std::pair<int, int>, TH1F*> m_eFieldMap; - std::map<std::pair<int, int>, TH2F*> m_distanceMap_e; - std::map<std::pair<int, int>, TH2F*> m_distanceMap_h; - std::map<std::pair<int, int>, TH1F*> m_timeMap_e; - std::map<std::pair<int, int>, TH1F*> m_timeMap_h; - std::map<std::pair<int, int>, TH2F*> m_lorentzMap_e; - std::map<std::pair<int, int>, TH2F*> m_lorentzMap_h; - - std::vector<double> m_fluence_layers,m_voltage_layers; //merging information from m_fluence* and m_voltage* - std::map<std::pair<int, int>, double> m_fluence_layersMaps; + std::vector<TH3F*> m_ramoPotentialMap; + std::vector<TH2F*> m_distanceMap_e; + std::vector<TH2F*> m_distanceMap_h; + std::vector<TH2F*> m_lorentzMap_e; + std::vector<TH2F*> m_lorentzMap_h; Gaudi::Property<int> m_numberOfSteps {this, "numberOfSteps", 50, "Geant4:number of steps for PixelPlanar"}; @@ -56,35 +50,21 @@ class SensorSimPlanarTool : public SensorSimTool { Gaudi::Property<bool> m_doRadDamage {this, "doRadDamage", false, "doRadDmaage bool: should be flag"}; - Gaudi::Property<double> m_trappingTimeElectrons - {this, "trappingTimeElectrons", 0.0, "Characteristic time till electron is trapped [ns]"}; + Gaudi::Property<bool> m_doInterpolateEfield + {this, "doInterpolateEfield", false, "doInterpolateEfield bool: should be flag"}; - Gaudi::Property<double> m_trappingTimeHoles - {this, "trappingTimeHoles", 0.0, "Characteristic time till hole is trapped [ns]"}; + Gaudi::Property<std::vector<std::string>> m_fluenceMap + {this, "FluenceMap", {"PixelDigitization/maps_IBL_PL_400V_fl5_5e14.root", + "PixelDigitization/maps_PIX_400V_fl5_19e14.root", + "PixelDigitization/maps_PIX_250V_fl2_28e14.root", + "PixelDigitization/maps_PIX_250V_fl1_53e14.root"}, + "Fluence map for radiation damage when interpolation method is activated"}; - Gaudi::Property<double> m_fluence - {this, "fluence", 0, "this is the fluence benchmark, 0-6. 0 is unirradiated, 1 is start of Run 2, 5 is end of 2018 and 6 is projected end of 2018"}; + Gaudi::Property<std::vector<double>> m_fluenceLayer + {this, "FluenceLayer", {5.50e14, 5.19e14, 2.28e14, 1.53e14}, "Fluence for radiation damage when interpolation method is activated"}; - Gaudi::Property<double> m_fluenceB - {this, "fluenceB", -1, "fluence detector has recieved in neqcm2 at the B layer."}; - - Gaudi::Property<double> m_fluence1 - {this, "fluence1", -1, "fluence detector has recieved in neqcm2 at the layer 1."}; - - Gaudi::Property<double> m_fluence2 - {this, "fluence2", -1, "fluence detector has recieved in neqcm2 at the layer 2."}; - - Gaudi::Property<double> m_voltage - {this, "voltage", -1.0, "this is the bias voltage applied to the IBL - if not set use values from applied at benchmark points according to fluence"}; - - Gaudi::Property<double> m_voltageB - {this, "voltageB", -1.0, "bias voltage applied to the B layer."}; - - Gaudi::Property<double> m_voltage1 - {this, "voltage1", -1.0, "bias voltage applied to the layer 1."}; - - Gaudi::Property<double> m_voltage2 - {this, "voltage2", -1.0, "bias voltage applied to the layer 2."}; + Gaudi::Property<std::vector<float>> m_voltageLayer + {this, "BiasVoltageLayer", {400.0,400.0,250.0,250.0}, "Bias voltage for radiation damage when interpolation method is activated"}; ToolHandle<RadDamageUtil> m_radDamageUtil {this, "RadDamageUtil", "RadDamageUtil", "Rad Damage utility"}; diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h index fbf423714cb48e5b3bec9ea9c2407e923b8fba17..adb5b1a68d522f00a43125a20f7633f560b32876 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h @@ -23,6 +23,9 @@ #include "PixelReadoutGeometry/PixelModuleDesign.h" #include "SiPropertiesTool/ISiPropertiesTool.h" +#include "PixelConditionsData/PixelModuleData.h" +#include "StoreGate/ReadCondHandleKey.h" + static const InterfaceID IID_ISensorSimTool("SensorSimTool", 1, 0); class SensorSimTool:public AthAlgTool,virtual public IAlgTool { @@ -39,6 +42,7 @@ class SensorSimTool:public AthAlgTool,virtual public IAlgTool { virtual StatusCode initialize() { ATH_CHECK(AthAlgTool::initialize()); ATH_CHECK(m_siPropertiesTool.retrieve()); + ATH_CHECK(m_moduleDataKey.initialize()); return StatusCode::SUCCESS; } @@ -52,7 +56,12 @@ class SensorSimTool:public AthAlgTool,virtual public IAlgTool { SensorSimTool(); protected: - ToolHandle<ISiPropertiesTool> m_siPropertiesTool{this, "SiPropertiesTool", "SiPropertiesTool", "Tool to retrieve SiProperties"}; + ToolHandle<ISiPropertiesTool> m_siPropertiesTool + {this, "SiPropertiesTool", "SiPropertiesTool", "Tool to retrieve SiProperties"}; + + SG::ReadCondHandleKey<PixelModuleData> m_moduleDataKey + {this, "PixelModuleData", "PixelModuleData", "Pixel module data"}; + }; #endif // PIXELDIGITIZATION_SensorSimTool_H diff --git a/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/InDetPrepRawData/PixelClusterContainerCnv_p1.cxx b/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/InDetPrepRawData/PixelClusterContainerCnv_p1.cxx index 21ba9aaa626871b338f4ec574ccda2b79cf5af8e..8d8db8be509e2312575695a212b16ad8234e3682 100644 --- a/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/InDetPrepRawData/PixelClusterContainerCnv_p1.cxx +++ b/InnerDetector/InDetEventCnv/InDetEventTPCnv/src/InDetPrepRawData/PixelClusterContainerCnv_p1.cxx @@ -111,7 +111,7 @@ void InDet::PixelClusterContainerCnv_p1::persToTrans(const InDet::InDetPRD_Cont coll->setIdentifier(Identifier(pcoll.m_id)); unsigned int nchans = pcoll.m_end - pcoll.m_begin; coll->resize(nchans); - const InDetDD::SiDetectorElement * de = (m_useDetectorElement ? elements->getDetectorElement(collIDHash) : nullptr); + const InDetDD::SiDetectorElement * de = (elements ? elements->getDetectorElement(collIDHash) : nullptr); // Fill with channels for (unsigned int ichan = 0; ichan < nchans; ++ ichan) { const TPObjRef pchan = persCont->m_PRD[ichan + pcoll.m_begin]; diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/CMakeLists.txt b/InnerDetector/InDetExample/InDetSLHC_Example/CMakeLists.txt index b2bc25ca0db590450dbe14cfe3bbee85d29953b1..fcbeecd57cf1c956c4b8bb38c0aae70423ca5ca3 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/CMakeLists.txt +++ b/InnerDetector/InDetExample/InDetSLHC_Example/CMakeLists.txt @@ -4,7 +4,7 @@ atlas_subdir( InDetSLHC_Example ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) atlas_install_runtime( data/*.txt data/*.xml test/InDetSLHC_Example_TestConfiguration.xml scripts/make*.C scripts/IDPerf*.py ExtraFiles/ALL*.html ) atlas_install_xmls( data/*.xml ) diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_JobProperties.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_JobProperties.py index b6bd9c46e4080e818608a0027f2d5ac627c41d03..bda31be3f3ba7c9868319f66fe249febd37477cc 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_JobProperties.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_JobProperties.py @@ -7,7 +7,6 @@ __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_JobProperties" -__all__ = [ "SLHC_JobProperties" ] # kindly stolen from AthenaCommonFlags from S. Binet and M. Gallas diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup.py index 0158a1e710047e2c76ab3fc13a7512eae906160d..8225d945218dd7936b4057d06bc2867550c94bc8 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_ATLAS.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_ATLAS.py index 9db08f349b450208d90d73bbd549685ed9dedbb7..4a897f972c5a01493d60f77217835499a8c63a2d 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_ATLAS.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_ATLAS.py @@ -9,18 +9,17 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join from InDetSLHC_Example.SLHC_JobProperties import SLHC_Flags -from PyJobTransformsCore.envutil import * +from PyJobTransformsCore.envutil import find_file_env class SLHC_Setup : # constructor requires the SLHC_Flags def __init__(self): - import os, shutil + import os #-------------------------------------------------------------- # XML reader diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_Alpine.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_Alpine.py index efe3d1071d128cbe9d2a6002b9d107d82d7fa972..9290dbf9f0eefdd8f43ede6a7e4851da4eeccdc7 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_Alpine.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_Alpine.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_Alpine_ECRing.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_Alpine_ECRing.py index 45c05b21c38e7eb459b9734db09825b6c771b320..f71e9068c4b1abff3241e7d6be5643f9a8717c11 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_Alpine_ECRing.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_Alpine_ECRing.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_Alpine_VF.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_Alpine_VF.py index f8907911bd71a6c1338e4e76010b360346845dee..85885a809443331eea399642cb98907661490e0c 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_Alpine_VF.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_Alpine_VF.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_BeamPipe.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_BeamPipe.py index 9768cd9b22024fc872cb2686f5e34b805f300663..6593a35362be838ede262b8112d6750d94e0dfc0 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_BeamPipe.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_BeamPipe.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_ExtBrl_32.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_ExtBrl_32.py index c25ada2542d4d8573709793d40612a5d5da756ec..874d737cc2a44ab491e428622e0cc39e9af2b86a 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_ExtBrl_32.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_ExtBrl_32.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_ExtBrl_4.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_ExtBrl_4.py index 844d99a17d0d63a848bc0b6672cbf93bc833551d..f5774950006baa9664d475649f5cb6a829dcf08f 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_ExtBrl_4.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_ExtBrl_4.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_IExtBrl_4.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_IExtBrl_4.py index b3efc7a68393fc93a914b046dd36e7eb27064810..dc92984a90e4f17abd8cb882801007e9fedc20f7 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_IExtBrl_4.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_IExtBrl_4.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl.py index c234746e47e6934037af43f6a42720e7aff7c066..5fcb050c08fd0850e8c5d68ced79611e4c577fa8 100644 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InclBrl.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InnerInclined.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InnerInclined.py index 220cfdbf92702a50c3c4c1a0680061f8d676d78c..a52db77a1a2093d4db3a6a20b90e3f685176a18f 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InnerInclined.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_InnerInclined.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_LoI.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_LoI.py index f413b2d2990251693b0536b6c63b7e847093fe7f..6e34496ebe74494ae8766b69ad52fb3b78325450 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_LoI.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_LoI.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_LoI_ECRing.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_LoI_ECRing.py index 581546713a6fd3bd839241582f0a240addb9ba91..e51b8448483cf159e90afba42158d9c6446589b1 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_LoI_ECRing.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_LoI_ECRing.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_LoI_VF.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_LoI_VF.py index 0ea21830033f8087698086c6f6905574acada6fd..5bbde37181bca82ca85563ba4f00b266a484e07a 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_LoI_VF.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_LoI_VF.py @@ -9,7 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] import os from os.path import exists, join diff --git a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_XML.py b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_XML.py index 94b33ac0c6c8dcb36f7f6d6f887f0cb48b843e05..216522dbf503e548db35e5aa63c94952f6679c29 100755 --- a/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_XML.py +++ b/InnerDetector/InDetExample/InDetSLHC_Example/python/SLHC_Setup_XML.py @@ -9,11 +9,6 @@ from __future__ import print_function __author__ = "A. Salzburger" __version__= "$Revision: 1.13 $" __doc__ = "SLHC_PathSetting" -__all__ = [ "SLHC_PathSetting" ] - -import os -from os.path import exists, join -from InDetSLHC_Example.SLHC_JobProperties import SLHC_Flags class SLHC_Setup_XMLReader : # constructor requires the SLHC_Flags @@ -24,7 +19,6 @@ class SLHC_Setup_XMLReader : print (dir(XMLReaderFlags)) if XMLReaderFlags.Initialized(): return - import os, shutil from PyJobTransformsCore.envutil import find_file_env print ("*******************************************************************************************") @@ -42,13 +36,6 @@ class SLHC_Setup_XMLReader : from InDetTrackingGeometryXML.InDetTrackingGeometryXMLConf import InDet__XMLReaderSvc xmlReader = InDet__XMLReaderSvc(name='InDetXMLReaderSvc') - dictionaryFileName = "" - if "dictionaryFileName" in kwargs: dictionaryFileName = kwargs["dictionaryFileName"] - createXML = False - if "createXML" in kwargs: createXML = kwargs["createXML"] - doPix = kwargs["doPix"] - doSCT = kwargs["doSCT"] - PIXMODULEFILE = "ITK_PixelModules.xml" PIXSTAVEFILE = str(kwargs["PixelLayout"]) + "_PixelStave.xml" PIXBARRELFILE = str(kwargs["PixelLayout"]) + "_PixelBarrel.xml" @@ -61,7 +48,7 @@ class SLHC_Setup_XMLReader : SCTENDCAPFILE = str(kwargs["SCTLayout"]) + "_SCTEndcap.xml" ## ###### Setup dictionary file to use ###### - ## dictDir = os.path.dirname(dictionaryFileName) + ## dictDir = os.path.dirname(kwargs["dictionaryFileName"]) ## if not os.path.exists(dictDir): ## os.makedirs(dictDir) diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonAlgCfg.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonAlgCfg.py index 63e2f31534a0944b6bf8234b9b54809cf7391ffe..5f8cfa1458c65862f558dcd0f11704c3d7cb6feb 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonAlgCfg.py +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonAlgCfg.py @@ -12,7 +12,7 @@ from PixelMonitoring.PixelAthMonitoringBase import define1DLayers, defineMapVsLu from PixelMonitoring.PixelAthMonitoringBase import define1DProfLumiLayers from PixelMonitoring.PixelAthMonitoringBase import layers, totcuts, xbinsem, xminsem, lumibinsx, ztotbinsy, ztotminsy from PixelMonitoring.PixelAthMonitoringBase import addOnTrackTxt, addOnTrackToPath, fullDressTitle -from PixelMonitoring.PixelAthMonitoringBase import runtext +from PixelMonitoring.PixelAthMonitoringBase import runtext, ReadingDataErrLabels def PixelAthClusterMonAlgCfg(helper, alg, **kwargs): @@ -35,7 +35,7 @@ def PixelAthClusterMonAlgCfg(helper, alg, **kwargs): if doLumiBlock: title = 'Modules Status (0=Active+Good, 1=Active+Bad, 2=Inactive)' - define2DProfHist(helper, alg, histoGroupName, title, pathLowStat, type='TProfile2D', lifecycle='lumiblock', histname='MapOfModulesStatusLB') + define2DProfHist(helper, alg, histoGroupName, title, pathLowStat, type='TProfile2D', lifecycle='lowstat', histname='MapOfModulesStatusLB') if doFEPlots: histoGroupName = 'MapOfFEsStatus' @@ -147,6 +147,12 @@ def PixelAthClusterMonAlgCfg(helper, alg, **kwargs): title = 'Hole+Outlier per track reset every 5 min' define2DProfHist(helper, alg, 'MissHitsRatio', title, path, type='TProfile2D', zmin=0, zmax=1.1, opt='kLBNHistoryDepth=5', histname=histoGroupName) + varName = 'trkdataread_err;ReadingTrackDataErr' + title = 'Number of Track data reading errors;error type;# events' + trackGroup.defineHistogram(varName, + type='TH1I', path=path, title=title, + xbins=len(ReadingDataErrLabels), xmin=-0.5, xmax=-0.5+len(ReadingDataErrLabels), xlabels=ReadingDataErrLabels) + ### end track histograms ### begin cluster histograms path = '/Pixel/Clusters' @@ -299,6 +305,11 @@ def PixelAthClusterMonAlgCfg(helper, alg, **kwargs): ### ### end cluster ToT and charge - + if not ontrack: + varName = 'clsdataread_err;ReadingClusterDataErr' + title = 'Number of Cluster data reading errors;error type;# events' + trackGroup.defineHistogram(varName, + type='TH1I', path=pathGroup, title=title, + xbins=len(ReadingDataErrLabels), xmin=-0.5, xmax=-0.5+len(ReadingDataErrLabels), xlabels=ReadingDataErrLabels) ### end cluster histograms diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthErrorMonAlgCfg.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthErrorMonAlgCfg.py index 76f0437bde7633a3517506fa305ee25fb52760d7..bfdbbc004f9e818297390ac5e636b5e8f3fdf3d3 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthErrorMonAlgCfg.py +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthErrorMonAlgCfg.py @@ -73,6 +73,14 @@ def PixelAthErrorMonAlgCfg(helper, alg, **kwargs): title = "Average FE/MCC Error Words" define2DProfHist(helper, alg, histoGroupName, title, path, type='TProfile2D', onlylayers=fei3layers) + histoGroupName = "TruncatedROBErrors" + title = "Truncated ROB Errors" + define2DProfHist(helper, alg, histoGroupName, title, path, type='TH2F') + + histoGroupName = "MaskedROBErrors" + title = "Masked ROB Errors" + define2DProfHist(helper, alg, histoGroupName, title, path, type='TH2F') + if doLumiBlock: histoGroupName = "ErrorsLB" title = "Errors" diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthHitMonAlgCfg.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthHitMonAlgCfg.py index 80ebdf7936c51e0a3864ec060522795b0d8df8ba..219fd938ca56a2023a700ed8b1c2d0b8578b767c 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthHitMonAlgCfg.py +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthHitMonAlgCfg.py @@ -12,7 +12,7 @@ from PixelMonitoring.PixelAthMonitoringBase import define1DProfLumiLayers, defin from PixelMonitoring.PixelAthMonitoringBase import define1DLayers from PixelMonitoring.PixelAthMonitoringBase import layers, lumibinsx, bcidbinsx from PixelMonitoring.PixelAthMonitoringBase import addOnTrackTxt, addOnTrackToPath, fullDressTitle -from PixelMonitoring.PixelAthMonitoringBase import runtext +from PixelMonitoring.PixelAthMonitoringBase import runtext, ReadingDataErrLabels def PixelAthHitMonAlgCfg(helper, alg, **kwargs): ''' @@ -33,6 +33,12 @@ def PixelAthHitMonAlgCfg(helper, alg, **kwargs): hitGroup = helper.addGroup(alg, 'Hit') + varName = 'hitdataread_err;ReadingHitDataErr' + title = 'Number of Hit data reading errors;error type;# events' + hitGroup.defineHistogram(varName, + type='TH1I', path=pathGroup, title=title, + xbins=len(ReadingDataErrLabels), xmin=-0.5, xmax=-0.5+len(ReadingDataErrLabels), xlabels=ReadingDataErrLabels) + varName = 'pixhitsmontool_lb,nhits_per_event' title = fullDressTitle('Average number of pixel hits per event per LB', ontrack, ';lumi block', ';# hits/event') varName += ';'+ addOnTrackTxt('HitsPerLumi', ontrack) diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py index 4c26d5721f83f94d2d000a7983e07d273b883d8a..010006a3b05c1c69e80a0379c20a33594a2fb2a9 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py @@ -262,6 +262,12 @@ ErrCatLabelsNorm = [ "TimeoutErrorsFracPerEvent" ] +ReadingDataErrLabels = [ + "Invalid container", + "Invalid collection", + "Container empty" +] + layergroups = {} def getLayerGroup(helper, alg, layer): if alg not in layergroups: diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthClusterMonAlg.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthClusterMonAlg.cxx index e04de719c682e6796bca653afb5f789afa8ebb38..f2025d05bc8c26e1085b6a66a6cde2d847ed1bdb 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthClusterMonAlg.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthClusterMonAlg.cxx @@ -154,12 +154,15 @@ StatusCode PixelAthClusterMonAlg::fillHistograms( const EventContext& ctx ) cons if ( !(tracks.isValid()) ) { ATH_MSG_ERROR("PixelMonitoring: Track container "<< m_tracksKey.key() << " could not be found."); + auto dataread_err = Monitored::Scalar<int>( "trkdataread_err", DataReadErrors::ContainerInvalid ); + fill(trackGroup, dataread_err); return StatusCode::RECOVERABLE; } else { ATH_MSG_DEBUG("PixelMonitoring: Track container "<< tracks.name() <<" is found."); } int ntracksPerEvent = 0; + bool havePixelHits(false); std::vector<std::pair<Identifier, double> > ClusterIDs; auto lbval = Monitored::Scalar<int>( "pixclusmontool_lb", lb ); @@ -298,9 +301,14 @@ StatusCode PixelAthClusterMonAlg::fillHistograms( const EventContext& ctx ) cons auto trkChiN = Monitored::Scalar<float>( "fit_chi2byndf", trkfitchi2 / trkfitndf); fill(trackGroup, trkChiN); } + havePixelHits = havePixelHits || (nPixelHits > 0); } // end of track loop - + if (!havePixelHits) { + auto dataread_err = Monitored::Scalar<int>( "trkdataread_err", DataReadErrors::EmptyContainer ); + fill(trackGroup, dataread_err); + } + fill2DProfLayerAccum( HolesRatio ); fill2DProfLayerAccum( MissHitsRatio ); if (!m_doOnline) { @@ -353,6 +361,8 @@ StatusCode PixelAthClusterMonAlg::fillHistograms( const EventContext& ctx ) cons if ( !(pixel_clcontainer.isValid()) ) { ATH_MSG_ERROR("Pixel Monitoring: Pixel Cluster container "<< m_clustersKey.key() << " could not be found."); + auto dataread_err = Monitored::Scalar<int>( "clsdataread_err", DataReadErrors::ContainerInvalid ); + fill(clusterGroup, dataread_err); return StatusCode::RECOVERABLE; } else { ATH_MSG_DEBUG("Pixel Monitoring: Pixel Cluster container "<< pixel_clcontainer.name() <<" is found."); @@ -373,6 +383,8 @@ StatusCode PixelAthClusterMonAlg::fillHistograms( const EventContext& ctx ) cons const InDet::PixelClusterCollection* ClusterCollection(*colNext); if (!ClusterCollection) { ATH_MSG_DEBUG("Pixel Monitoring: Pixel Cluster container is empty."); + auto dataread_err = Monitored::Scalar<int>( "clsdataread_err", DataReadErrors::CollectionInvalid ); + fill(clusterGroup, dataread_err); continue; } @@ -502,7 +514,10 @@ StatusCode PixelAthClusterMonAlg::fillHistograms( const EventContext& ctx ) cons if (nclusters>0) { auto clsFracOnTrack = Monitored::Scalar<float>( "cls_frac_ontrack", (float)nclusters_ontrack / nclusters ); - fill( clusterGroup_OnTrack, lbval, clsFracOnTrack); + fill(clusterGroup_OnTrack, lbval, clsFracOnTrack); + } else { + auto dataread_err = Monitored::Scalar<int>( "clsdataread_err", DataReadErrors::EmptyContainer ); + fill(clusterGroup, dataread_err); } fill1DProfLumiLayers( "ClustersPerLumi", lb, nclusters_mod); diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonAlg.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonAlg.cxx index 8842509f559b3156936081980652f780ce16824f..c5fac8bb94bed53dae9f4cb1944b6e198169cc37 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonAlg.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonAlg.cxx @@ -74,8 +74,10 @@ StatusCode PixelAthErrorMonAlg::fillHistograms( const EventContext& ctx ) const float num_errormodules_per_cat[ErrorCategory::COUNT][PixLayers::COUNT] = {{0}}; float num_errormodules_per_cat_rodmod[ErrorCategoryRODMOD::COUNT][PixLayers::COUNT] = {{0}}; - // Generate femcc_errwords and per LB maps, all _per module_, including IBL. + // Generate femcc_errwords, ROB error and per LB maps. VecAccumulator2DMap femcc_errwords_maps("FEMCCErrorwords"); + VecAccumulator2DMap trunc_rob_errors_maps("TruncatedROBErrors", true); + VecAccumulator2DMap masked_rob_errors_maps("MaskedROBErrors", true); VecAccumulator2DMap all_errors_maps("ErrorsLB"); VecAccumulator2DMap modsync_errors_maps("ErrorsModSyncLB"); VecAccumulator2DMap rodsync_errors_maps("ErrorsRODSyncLB"); @@ -141,10 +143,19 @@ StatusCode PixelAthErrorMonAlg::fillHistograms( const EventContext& ctx ) const // count number of words w/ MCC/FE flags per module unsigned int num_femcc_errwords = 0; + uint64_t mod_errorword = m_pixelCondSummaryTool->getBSErrorWord(modHash, ctx); + + // extracting ROB error information + // + if ( PixelByteStreamErrors::hasError(mod_errorword, PixelByteStreamErrors::TruncatedROB) ) { + trunc_rob_errors_maps.add(pixlayer, waferID, m_pixelid, 1.0); + } + if ( PixelByteStreamErrors::hasError(mod_errorword, PixelByteStreamErrors::MaskedROB) ) { + masked_rob_errors_maps.add(pixlayer, waferID, m_pixelid, 1.0); + } // getting module_error information (only fei3 layers) // if (!is_fei4) { - uint64_t mod_errorword = m_pixelCondSummaryTool->getBSErrorWord(modHash, ctx); std::bitset<kNumErrorStatesFEI3> stateFEI3 = getErrorStateFEI3Mod(mod_errorword); num_errors[pixlayer]+=stateFEI3.count(); for (unsigned int state = 0; state < stateFEI3.size(); ++state) { @@ -297,6 +308,8 @@ StatusCode PixelAthErrorMonAlg::fillHistograms( const EventContext& ctx ) const } // Fill the accumulated maps fill2DProfLayerAccum(femcc_errwords_maps); + fill2DProfLayerAccum(trunc_rob_errors_maps); + fill2DProfLayerAccum(masked_rob_errors_maps); fill2DProfLayerAccum(all_errors_maps); fill2DProfLayerAccum(modsync_errors_maps); fill2DProfLayerAccum(rodsync_errors_maps); diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthHitMonAlg.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthHitMonAlg.cxx index 2e7b5209e883868c5d2e4b3818c5dcb4ec4bb72c..c6fa0f8edb0a77b857bca5287bc9e298158ff661 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthHitMonAlg.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthHitMonAlg.cxx @@ -45,6 +45,8 @@ StatusCode PixelAthHitMonAlg::fillHistograms( const EventContext& ctx ) const { auto rdocontainer = SG::makeHandle(m_pixelRDOName, ctx); if ( !(rdocontainer.isValid()) ) { ATH_MSG_ERROR("Pixel Monitoring: Pixel RDO container "<< m_pixelRDOName << " could not be found."); + auto dataread_err = Monitored::Scalar<int>( "hitdataread_err", DataReadErrors::ContainerInvalid ); + fill(hitGroup, dataread_err); return StatusCode::RECOVERABLE; } else { ATH_MSG_DEBUG("Pixel Monitoring: Pixel RDO container "<< rdocontainer.name() <<" is found."); @@ -148,6 +150,8 @@ StatusCode PixelAthHitMonAlg::fillHistograms( const EventContext& ctx ) const { const InDetRawDataCollection<PixelRDORawData>* PixelCollection(*colNext); if (!PixelCollection) { ATH_MSG_DEBUG("Pixel Monitoring: Pixel Hit container is empty."); + auto dataread_err = Monitored::Scalar<int>( "hitdataread_err", DataReadErrors::CollectionInvalid ); + fill(hitGroup, dataread_err); continue; } @@ -224,6 +228,11 @@ StatusCode PixelAthHitMonAlg::fillHistograms( const EventContext& ctx ) const { } fill1DProfLumiLayers( "AvgOccRatioToIBLPerLumi", lb, avgocc_ratio_toIBL_layer ); } + + if (nhits==0) { + auto dataread_err = Monitored::Scalar<int>( "hitdataread_err", DataReadErrors::EmptyContainer ); + fill(hitGroup, dataread_err); + } //******************************************************************************* //************************** End of filling Hit Histograms ********************** //******************************************************************************* diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthMonitoringBase.h b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthMonitoringBase.h index 9ce1939caff92d9d00830f95f1e3d766468ca49c..43b97b84e4dff72af62c00aefdfd7c4c1aafa316 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthMonitoringBase.h +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthMonitoringBase.h @@ -16,6 +16,10 @@ class PixLayers { public: enum PixLayersID {kECA = 0, kECC, kB0, kB1, kB2, kIBL, NFEI3LAYERS=kIBL, kDBMA, kDBMC, COUNT}; }; +class DataReadErrors { + public: + enum DataReadErrorsID {ContainerInvalid = 0, CollectionInvalid, EmptyContainer, COUNT}; +}; const std::string pixLayersLabel[PixLayers::COUNT] = {"ECA", "ECC", "B0", "B1", "B2", "IBL", "DBMA", "DBMC"}; const float inv_nmod_per_layer[PixLayers::COUNT] = {1./144., 1./144., 1./286., 1./494., 1./676., 1./448., 1./12., 1./12.}; const int clusterToTMinCut[PixLayers::COUNT] = {15, 15, 15, 15, 15, 4, 4, 4}; diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt b/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt index 45930adf8013f47e844d7ddaad7cc47060709f8f..e59c1ba4a12a956d8173ffa87e64b53d9e99cc4a 100644 --- a/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt +++ b/InnerDetector/InDetRawAlgs/InDetOverlay/CMakeLists.txt @@ -48,7 +48,7 @@ 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_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/StoreGateTestCommon.txt ) # Configuration tests diff --git a/InnerDetector/InDetRawAlgs/InDetOverlay/python/InDetOverlayConfig.py b/InnerDetector/InDetRawAlgs/InDetOverlay/python/InDetOverlayConfig.py index 7b84a98bede5a32912dcc613594d583bd80bbf0f..ff591ee4bdea7faf318ac20bc486e9370e3da728 100644 --- a/InnerDetector/InDetRawAlgs/InDetOverlay/python/InDetOverlayConfig.py +++ b/InnerDetector/InDetRawAlgs/InDetOverlay/python/InDetOverlayConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon import CfgMgr @@ -7,13 +7,13 @@ def getPixelOverlay(name="PixelOverlay", **kwargs): from OverlayCommonAlgs.OverlayFlags import overlayFlags if overlayFlags.isOverlayMT(): - kwargs.setdefault("BkgInputKey", overlayFlags.bkgPrefix() + "PixelRDOs"); - kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "PixelRDOs"); - kwargs.setdefault("OutputKey", "PixelRDOs"); + kwargs.setdefault("BkgInputKey", overlayFlags.bkgPrefix() + "PixelRDOs") + kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "PixelRDOs") + kwargs.setdefault("OutputKey", "PixelRDOs") else: - kwargs.setdefault("BkgInputKey", overlayFlags.dataStore() + "+PixelRDOs"); - kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+PixelRDOs"); - kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+PixelRDOs"); + kwargs.setdefault("BkgInputKey", overlayFlags.dataStore() + "+PixelRDOs") + kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+PixelRDOs") + kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+PixelRDOs") return CfgMgr.PixelOverlay(name, **kwargs) @@ -22,14 +22,14 @@ def getPixelSDOOverlay(name="PixelSDOOverlay", **kwargs): from OverlayCommonAlgs.OverlayFlags import overlayFlags # We do not need background pixel SDOs - kwargs.setdefault("BkgInputKey", ""); + kwargs.setdefault("BkgInputKey", "") if overlayFlags.isOverlayMT(): - kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "PixelSDO_Map"); - kwargs.setdefault("OutputKey", "PixelSDO_Map"); + kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "PixelSDO_Map") + kwargs.setdefault("OutputKey", "PixelSDO_Map") else: - kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+PixelSDO_Map"); - kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+PixelSDO_Map"); + kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+PixelSDO_Map") + kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+PixelSDO_Map") return CfgMgr.InDetSDOOverlay(name, **kwargs) @@ -38,13 +38,13 @@ def getSCTOverlay(name="SCTOverlay", **kwargs): from OverlayCommonAlgs.OverlayFlags import overlayFlags if overlayFlags.isOverlayMT(): - kwargs.setdefault("BkgInputKey", overlayFlags.bkgPrefix() + "SCT_RDOs"); - kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "SCT_RDOs"); - kwargs.setdefault("OutputKey", "SCT_RDOs"); + kwargs.setdefault("BkgInputKey", overlayFlags.bkgPrefix() + "SCT_RDOs") + kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "SCT_RDOs") + kwargs.setdefault("OutputKey", "SCT_RDOs") else: - kwargs.setdefault("BkgInputKey", overlayFlags.dataStore() + "+SCT_RDOs"); - kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+SCT_RDOs"); - kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+SCT_RDOs"); + kwargs.setdefault("BkgInputKey", overlayFlags.dataStore() + "+SCT_RDOs") + kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+SCT_RDOs") + kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+SCT_RDOs") return CfgMgr.SCTOverlay(name, **kwargs) @@ -53,34 +53,33 @@ def getSCTSDOOverlay(name="SCTSDOOverlay", **kwargs): from OverlayCommonAlgs.OverlayFlags import overlayFlags # We do not need background SCT SDOs - kwargs.setdefault("BkgInputKey", ""); + kwargs.setdefault("BkgInputKey", "") if overlayFlags.isOverlayMT(): - kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "SCT_SDO_Map"); - kwargs.setdefault("OutputKey", "SCT_SDO_Map"); + kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "SCT_SDO_Map") + kwargs.setdefault("OutputKey", "SCT_SDO_Map") else: - kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+SCT_SDO_Map"); - kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+SCT_SDO_Map"); + kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+SCT_SDO_Map") + kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+SCT_SDO_Map") return CfgMgr.InDetSDOOverlay(name, **kwargs) def getTRTOverlay(name="TRTOverlay", **kwargs): from OverlayCommonAlgs.OverlayFlags import overlayFlags - from Digitization.DigitizationFlags import digitizationFlags if overlayFlags.isOverlayMT(): kwargs.setdefault("SortBkgInput", overlayFlags.isDataOverlay()) - kwargs.setdefault("BkgInputKey", overlayFlags.bkgPrefix() + "TRT_RDOs"); - kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "TRT_RDOs"); - kwargs.setdefault("OutputKey", "TRT_RDOs"); - kwargs.setdefault("SignalInputSDOKey", overlayFlags.sigPrefix() + "TRT_SDO_Map"); + kwargs.setdefault("BkgInputKey", overlayFlags.bkgPrefix() + "TRT_RDOs") + kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "TRT_RDOs") + kwargs.setdefault("OutputKey", "TRT_RDOs") + kwargs.setdefault("SignalInputSDOKey", overlayFlags.sigPrefix() + "TRT_SDO_Map") else: kwargs.setdefault("SortBkgInput", overlayFlags.isDataOverlay()) - kwargs.setdefault("BkgInputKey", overlayFlags.dataStore() + "+TRT_RDOs"); - kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+TRT_RDOs"); - kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+TRT_RDOs"); - kwargs.setdefault("SignalInputSDOKey", overlayFlags.evtStore() + "+TRT_SDO_Map"); + kwargs.setdefault("BkgInputKey", overlayFlags.dataStore() + "+TRT_RDOs") + kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+TRT_RDOs") + kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+TRT_RDOs") + kwargs.setdefault("SignalInputSDOKey", overlayFlags.evtStore() + "+TRT_SDO_Map") kwargs.setdefault("TRT_LocalOccupancyTool", "TRT_LocalOccupancy") @@ -100,16 +99,16 @@ def getTRTSDOOverlay(name="TRTSDOOverlay", **kwargs): if overlayFlags.isDataOverlay(): kwargs.setdefault("BkgInputKey", "") else: - kwargs.setdefault("BkgInputKey", overlayFlags.bkgPrefix() + "TRT_SDO_Map"); - kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "TRT_SDO_Map"); - kwargs.setdefault("OutputKey", "TRT_SDO_Map"); + kwargs.setdefault("BkgInputKey", overlayFlags.bkgPrefix() + "TRT_SDO_Map") + kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "TRT_SDO_Map") + kwargs.setdefault("OutputKey", "TRT_SDO_Map") else: if overlayFlags.isDataOverlay(): kwargs.setdefault("BkgInputKey", "") else: - kwargs.setdefault("BkgInputKey", overlayFlags.dataStore() + "+TRT_SDO_Map"); - kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+TRT_SDO_Map"); - kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+TRT_SDO_Map"); + kwargs.setdefault("BkgInputKey", overlayFlags.dataStore() + "+TRT_SDO_Map") + kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+TRT_SDO_Map") + kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+TRT_SDO_Map") return CfgMgr.InDetSDOOverlay(name, **kwargs) @@ -120,13 +119,13 @@ def getBCMOverlay(name="BCMOverlay", **kwargs): kwargs.setdefault("isDataOverlay", overlayFlags.isDataOverlay()) if overlayFlags.isOverlayMT(): - kwargs.setdefault("BkgInputKey", overlayFlags.bkgPrefix() + "BCM_RDOs"); - kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "BCM_RDOs"); - kwargs.setdefault("OutputKey", "BCM_RDOs"); + kwargs.setdefault("BkgInputKey", overlayFlags.bkgPrefix() + "BCM_RDOs") + kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "BCM_RDOs") + kwargs.setdefault("OutputKey", "BCM_RDOs") else: - kwargs.setdefault("BkgInputKey", overlayFlags.dataStore() + "+BCM_RDOs"); - kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+BCM_RDOs"); - kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+BCM_RDOs"); + kwargs.setdefault("BkgInputKey", overlayFlags.dataStore() + "+BCM_RDOs") + kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+BCM_RDOs") + kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+BCM_RDOs") return CfgMgr.BCMOverlay(name, **kwargs) @@ -135,14 +134,14 @@ def getBCMSDOOverlay(name="BCMSDOOverlay", **kwargs): from OverlayCommonAlgs.OverlayFlags import overlayFlags # We do not need background pixel SDOs - kwargs.setdefault("BkgInputKey", ""); + kwargs.setdefault("BkgInputKey", "") if overlayFlags.isOverlayMT(): - kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "BCM_SDO_Map"); - kwargs.setdefault("OutputKey", "BCM_SDO_Map"); + kwargs.setdefault("SignalInputKey", overlayFlags.sigPrefix() + "BCM_SDO_Map") + kwargs.setdefault("OutputKey", "BCM_SDO_Map") else: - kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+BCM_SDO_Map"); - kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+BCM_SDO_Map"); + kwargs.setdefault("SignalInputKey", overlayFlags.evtStore() + "+BCM_SDO_Map") + kwargs.setdefault("OutputKey", overlayFlags.outputStore() + "+BCM_SDO_Map") return CfgMgr.InDetSDOOverlay(name, **kwargs) diff --git a/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IInDetTestBLayerTool.h b/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IInDetTestBLayerTool.h index bb50a1cac65e33850019cb45a0f7ebe4a1405102..a294fbeb9ba4d5dc62b887465c78055f68217ad6 100755 --- a/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IInDetTestBLayerTool.h +++ b/InnerDetector/InDetRecTools/InDetRecToolInterfaces/InDetRecToolInterfaces/IInDetTestBLayerTool.h @@ -4,7 +4,9 @@ #ifndef IInDetTestBLayerTool_H #define IInDetTestBLayerTool_H -#include "GaudiKernel/AlgTool.h" +#include "GaudiKernel/EventContext.h" +#include "GaudiKernel/IAlgTool.h" +#include "GaudiKernel/ThreadLocalContext.h" #include "TrkParameters/TrackParameters.h" #include "TrkEventPrimitives/ResidualPull.h" #include <vector> @@ -26,10 +28,18 @@ namespace InDet { static const InterfaceID& interfaceID() { return IID_IInDetTestBLayerTool; }; virtual ~IInDetTestBLayerTool() {}; - - virtual bool expectHitInBLayer(const Trk::TrackParticleBase*, bool recompute=false) const=0; - virtual bool expectHitInBLayer(const Trk::Track*, bool recompute=false) const=0; - virtual bool expectHitInBLayer(const Trk::TrackParameters* trackpar) const=0; + + virtual bool expectHitInBLayer(const EventContext& ctx, + const Trk::Track* track, + bool recompute = false) const = 0; + virtual bool expectHitInBLayer(const Trk::TrackParticleBase*, + bool recompute = false) const = 0; + bool expectHitInBLayer(const Trk::Track* track, bool recompute = false) const + { + return expectHitInBLayer(Gaudi::Hive::currentContext(), track, recompute); + } + virtual bool expectHitInBLayer( + const Trk::TrackParameters* trackpar) const = 0; virtual const Trk::ResidualPull* bLayerHitResidual(const Trk::Track* ) const=0; virtual const Trk::ResidualPull* bLayerHitResidual(const Trk::TrackParticleBase*) const=0; @@ -41,10 +51,21 @@ namespace InDet { virtual bool getTrackStateOnBlayerInfo(const Trk::TrackParameters* trackpar, std::vector<TrackStateOnBLayerInfo>& infoList) const=0; - - virtual bool expectHitInInnermostPixelLayer(const Trk::TrackParticleBase*, bool recompute=false) const=0; - virtual bool expectHitInInnermostPixelLayer(const Trk::Track*, bool recompute=false) const=0; - virtual bool expectHitInInnermostPixelLayer(const Trk::TrackParameters* trackpar) const=0; + virtual bool expectHitInInnermostPixelLayer( + const EventContext& ctx, + const Trk::Track* track, + bool recompute = false) const = 0; + virtual bool expectHitInInnermostPixelLayer( + const Trk::TrackParticleBase*, + bool recompute = false) const = 0; + bool expectHitInInnermostPixelLayer(const Trk::Track* track, + bool recompute = false) const + { + return expectHitInInnermostPixelLayer( + Gaudi::Hive::currentContext(), track, recompute); + } + virtual bool expectHitInInnermostPixelLayer( + const Trk::TrackParameters* trackpar) const = 0; virtual const Trk::ResidualPull* innermostPixelLayerHitResidual(const Trk::Track* ) const=0; virtual const Trk::ResidualPull* innermostPixelLayerHitResidual(const Trk::TrackParticleBase*) const=0; @@ -56,11 +77,24 @@ namespace InDet { virtual bool getTrackStateOnInnermostPixelLayerInfo(const Trk::TrackParameters* trackpar, std::vector<TrackStateOnBLayerInfo>& infoList) const=0; - virtual bool expectHitInNextToInnermostPixelLayer(const Trk::TrackParticleBase*, bool recompute=false) const=0; - virtual bool expectHitInNextToInnermostPixelLayer(const Trk::Track*, bool recompute=false) const=0; - virtual bool expectHitInNextToInnermostPixelLayer(const Trk::TrackParameters* trackpar) const=0; - - virtual const Trk::ResidualPull* nextToInnermostPixelLayerHitResidual(const Trk::Track* ) const=0; + virtual bool expectHitInNextToInnermostPixelLayer( + const EventContext& ctx, + const Trk::Track* track, + bool recompute = false) const = 0; + virtual bool expectHitInNextToInnermostPixelLayer( + const Trk::TrackParticleBase*, + bool recompute = false) const = 0; + bool expectHitInNextToInnermostPixelLayer(const Trk::Track* track, + bool recompute = false) const + { + return expectHitInInnermostPixelLayer( + Gaudi::Hive::currentContext(), track, recompute); + } + virtual bool expectHitInNextToInnermostPixelLayer( + const Trk::TrackParameters* trackpar) const = 0; + + virtual const Trk::ResidualPull* nextToInnermostPixelLayerHitResidual( + const Trk::Track*) const = 0; virtual const Trk::ResidualPull* nextToInnermostPixelLayerHitResidual(const Trk::TrackParticleBase*) const=0; virtual bool getTrackStateOnNextToInnermostPixelLayerInfo(const Trk::TrackParticleBase*, diff --git a/InnerDetector/InDetRecTools/InDetTestBLayer/InDetTestBLayer/InDetTestBLayerTool.h b/InnerDetector/InDetRecTools/InDetTestBLayer/InDetTestBLayer/InDetTestBLayerTool.h index 9369c7c7c4c5ff77633e16912d07abeab73d91ee..3e42bc06d7a5ba711de47ba26c423570a01bd43b 100644 --- a/InnerDetector/InDetRecTools/InDetTestBLayer/InDetTestBLayer/InDetTestBLayerTool.h +++ b/InnerDetector/InDetRecTools/InDetTestBLayer/InDetTestBLayer/InDetTestBLayerTool.h @@ -41,12 +41,17 @@ namespace InDet { virtual StatusCode initialize() override; virtual StatusCode finalize() override; - // bool expectHitInBLayer(const Rec::TrackParticle*) const ; - virtual bool expectHitInBLayer(const Trk::TrackParticleBase*, bool recompute = false) const override; - virtual bool expectHitInBLayer(const Trk::Track*, bool recompute = false) const override; - virtual bool expectHitInBLayer(const Trk::TrackParameters* trackpar) const override; + virtual bool expectHitInBLayer(const EventContext& ctx, + const Trk::Track*, + bool recompute = false) const override final; - virtual const Trk::ResidualPull* bLayerHitResidual(const Trk::Track*) const override; + virtual bool expectHitInBLayer(const Trk::TrackParticleBase*, + bool recompute = false) const override final; + virtual bool expectHitInBLayer( + const Trk::TrackParameters* trackpar) const override final; + + virtual const Trk::ResidualPull* bLayerHitResidual( + const Trk::Track*) const override; virtual const Trk::ResidualPull* bLayerHitResidual(const Trk::TrackParticleBase*) const override; //// return false if extrapolation failed @@ -57,10 +62,15 @@ namespace InDet { virtual bool getTrackStateOnBlayerInfo(const Trk::TrackParameters* trackpar, std::vector<TrackStateOnBLayerInfo>& infoList) const override; - virtual bool expectHitInInnermostPixelLayer(const Trk::TrackParticleBase*, - bool recompute = false) const override; - virtual bool expectHitInInnermostPixelLayer(const Trk::Track*, bool recompute = false) const override; - virtual bool expectHitInInnermostPixelLayer(const Trk::TrackParameters* trackpar) const override; + virtual bool expectHitInInnermostPixelLayer( + const EventContext& ctx, + const Trk::Track* track, + bool recompute = false) const override final; + virtual bool expectHitInInnermostPixelLayer( + const Trk::TrackParticleBase*, + bool recompute = false) const override final; + virtual bool expectHitInInnermostPixelLayer( + const Trk::TrackParameters* trackpar) const override final; virtual const Trk::ResidualPull* innermostPixelLayerHitResidual(const Trk::Track*) const override; virtual const Trk::ResidualPull* innermostPixelLayerHitResidual( @@ -78,11 +88,15 @@ namespace InDet { const Trk::TrackParameters* trackpar, std::vector<TrackStateOnBLayerInfo>& infoList) const override; - virtual bool expectHitInNextToInnermostPixelLayer(const Trk::TrackParticleBase*, - bool recompute = false) const override; - virtual bool expectHitInNextToInnermostPixelLayer(const Trk::Track*, - bool recompute = false) const override; - virtual bool expectHitInNextToInnermostPixelLayer(const Trk::TrackParameters* trackpar) const override; + virtual bool expectHitInNextToInnermostPixelLayer( + const EventContext& ctx, + const Trk::Track*, + bool recompute = false) const override final; + virtual bool expectHitInNextToInnermostPixelLayer( + const Trk::TrackParticleBase*, + bool recompute = false) const override final; + virtual bool expectHitInNextToInnermostPixelLayer( + const Trk::TrackParameters* trackpar) const override final; virtual const Trk::ResidualPull* nextToInnermostPixelLayerHitResidual(const Trk::Track*) const override; virtual const Trk::ResidualPull* nextToInnermostPixelLayerHitResidual( @@ -99,9 +113,22 @@ namespace InDet { std::vector<TrackStateOnBLayerInfo>& infoList) const override; private: - bool expectHitInPixelLayer(const Trk::TrackParticleBase*, int layer, bool recompute = false) const; - bool expectHitInPixelLayer(const Trk::Track*, int layer, bool recompute = false) const; - bool expectHitInPixelLayer(const Trk::TrackParameters* trackpar, int layer) const; + bool expectHitInPixelLayer(const EventContext& ctx, + const Trk::Track*, + int layer, + bool recompute = false) const; + bool expectHitInPixelLayer(const Trk::TrackParticleBase*, + int layer, + bool recompute = false) const; + bool expectHitInPixelLayer(const EventContext& ctx, + const Trk::TrackParameters* trackpar, + int layer) const; + bool expectHitInPixelLayer(const Trk::TrackParameters* trackpar, + int layer) const + { + return expectHitInPixelLayer( + Gaudi::Hive::currentContext(), trackpar, layer); + } const Trk::ResidualPull* pixelLayerHitResidual(const Trk::Track*, int layer) const; @@ -119,9 +146,20 @@ namespace InDet { bool isActive(const Trk::TrackParameters* trackpar) const; - bool getPixelLayerParameters(const Trk::TrackParameters* trackpar, - std::vector<std::unique_ptr<const Trk::TrackParameters>>& blayerParam, - int layer) const; + bool getPixelLayerParameters( + const EventContext& ctx, + const Trk::TrackParameters* trackpar, + std::vector<std::unique_ptr<const Trk::TrackParameters>>& blayerParam, + int layer) const; + + bool getPixelLayerParameters( + const Trk::TrackParameters* trackpar, + std::vector<std::unique_ptr<const Trk::TrackParameters>>& blayerParam, + int layer) const + { + return getPixelLayerParameters( + Gaudi::Hive::currentContext(), trackpar, blayerParam, layer); + } double getFracGood(const Trk::TrackParameters* trackpar, double phiRegionSize, diff --git a/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx b/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx index 180dde76a47b1025d7b011fcffd73e7dbd842bc4..53a0749595c2167aa453a9cac1b4f881de9bab61 100644 --- a/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx @@ -228,55 +228,73 @@ namespace InDet { } - bool InDet::InDetTestBLayerTool::expectHitInBLayer(const Trk::Track* track, bool recompute) const + bool + InDet::InDetTestBLayerTool::expectHitInBLayer(const EventContext& ctx, + const Trk::Track* track, + bool recompute) const { - return expectHitInPixelLayer(track,0, recompute); + return expectHitInPixelLayer(ctx, track, 0, recompute); } - bool InDet::InDetTestBLayerTool::expectHitInInnermostPixelLayer(const Trk::Track* track, bool recompute) const + bool + InDet::InDetTestBLayerTool::expectHitInInnermostPixelLayer( + const EventContext& ctx, + const Trk::Track* track, + bool recompute) const { - return expectHitInPixelLayer(track,0, recompute); + return expectHitInPixelLayer(ctx, track, 0, recompute); } - bool InDet::InDetTestBLayerTool::expectHitInNextToInnermostPixelLayer(const Trk::Track* track, bool recompute) const + bool + InDet::InDetTestBLayerTool::expectHitInNextToInnermostPixelLayer( + const EventContext& ctx, + const Trk::Track* track, + bool recompute) const { - return expectHitInPixelLayer(track,1, recompute); + return expectHitInPixelLayer(ctx, track, 1, recompute); } - bool InDet::InDetTestBLayerTool::expectHitInPixelLayer(const Trk::Track *track, int layer, bool recompute) const { - assert( layer>=0 && layer<=1); - if(!recompute){ - const Trk::TrackSummary* ts = track->trackSummary(); - if(ts){ - int ehbl = ts->get(s_layerSummaryTypeExpectHit[layer]); - if(0==ehbl || 1==ehbl ){ - ATH_MSG_DEBUG("Found the expected hit in the " << s_layerNames[layer] << " info in TrackSummary: return cached value" ); - return ehbl; - } + bool + InDet::InDetTestBLayerTool::expectHitInPixelLayer(const EventContext& ctx, + const Trk::Track* track, + int layer, + bool recompute) const + { + assert(layer >= 0 && layer <= 1); + if (!recompute) { + const Trk::TrackSummary* ts = track->trackSummary(); + if (ts) { + int ehbl = ts->get(s_layerSummaryTypeExpectHit[layer]); + if (0 == ehbl || 1 == ehbl) { + ATH_MSG_DEBUG("Found the expected hit in the " + << s_layerNames[layer] + << " info in TrackSummary: return cached value"); + return ehbl; + } } - } - else{ - ATH_MSG_DEBUG("Forced to recompute whether a hit is expected in the " << s_layerNames[layer] << " or not." ); + } else { + ATH_MSG_DEBUG("Forced to recompute whether a hit is expected in the " + << s_layerNames[layer] << " or not."); } - ATH_MSG_DEBUG("Computing whether a hit is expected in the " << s_layerNames[layer] << " or not." ); + ATH_MSG_DEBUG("Computing whether a hit is expected in the " + << s_layerNames[layer] << " or not."); const Trk::Perigee* mp = track->perigeeParameters(); - if (!mp) - { - //This can happen if re-creating the summary for tracks prior to ambi-solving and final fit, e.g. in StatisticAlg - ATH_MSG_DEBUG("Found Track with no perigee parameters: no information whether a hit is expected in the " << s_layerNames[layer] << " will be provided." ); - return false; - } - else - { - ATH_MSG_DEBUG("Track perigee parameters"); - return this->expectHitInPixelLayer(mp,layer); - } + if (!mp) { + // This can happen if re-creating the summary for tracks prior to + // ambi-solving and final fit, e.g. in StatisticAlg + ATH_MSG_DEBUG("Found Track with no perigee parameters: no information " + "whether a hit is expected in the " + << s_layerNames[layer] << " will be provided."); + return false; + } else { + ATH_MSG_DEBUG("Track perigee parameters"); + return this->expectHitInPixelLayer(ctx,mp, layer); + } } - bool InDet::InDetTestBLayerTool::expectHitInBLayer(const Trk::TrackParticleBase* track, bool recompute) const { return expectHitInPixelLayer(track,0,recompute); @@ -343,75 +361,80 @@ namespace InDet { return expectHitInPixelLayer(trackpar, 1); } - bool InDet::InDetTestBLayerTool::expectHitInPixelLayer(const Trk::TrackParameters* trackpar,int layer) const + bool + InDet::InDetTestBLayerTool::expectHitInPixelLayer( + const EventContext& ctx, + const Trk::TrackParameters* trackpar, + int layer) const { - assert( layer >=0 && layer<=1); - const std::string layer_name=s_layerNames[layer]; + assert(layer >= 0 && layer <= 1); + const std::string layer_name = s_layerNames[layer]; - if(!m_configured){ - ATH_MSG_WARNING("Unconfigured tool, unable to compute expected hit in the " << layer_name << "."); + if (!m_configured) { + ATH_MSG_WARNING( + "Unconfigured tool, unable to compute expected hit in the " + << layer_name << "."); return false; } - bool expect_hit = false; /// will be set to true if at least on good module is passed + bool expect_hit = + false; /// will be set to true if at least on good module is passed //// Cylinder bigger than the given layer ? //// - std::vector<std::unique_ptr<const Trk::TrackParameters> > blayerParam; - if(!this->getPixelLayerParameters(trackpar, blayerParam,layer)) return false; - + std::vector<std::unique_ptr<const Trk::TrackParameters>> blayerParam; + if (!this->getPixelLayerParameters(ctx,trackpar, blayerParam, layer)) + return false; for (std::unique_ptr<const Trk::TrackParameters>& p : blayerParam) { - Identifier id = p->associatedSurface().associatedDetectorElement()->identify(); + Identifier id = + p->associatedSurface().associatedDetectorElement()->identify(); - if( m_pixelCondSummaryTool->isGood(id,InDetConditions::PIXEL_MODULE) ){ + if (m_pixelCondSummaryTool->isGood(id, InDetConditions::PIXEL_MODULE,ctx)) { - if( m_checkActiveAreas ){ + if (m_checkActiveAreas) { - if( isActive(p.get()) ){ + if (isActive(p.get())) { - if(m_checkDeadRegions){ + if (m_checkDeadRegions) { - double fracGood = getFracGood(p.get(), m_phiRegionSize, m_etaRegionSize); - if(fracGood>m_goodFracCut){ - ATH_MSG_DEBUG("Condition Summary: " << layer_name << " good"); - expect_hit=true; /// pass good module -> hit is expected on blayer - } - else{ - ATH_MSG_DEBUG( layer_name << " in dead region"); - } + double fracGood = + getFracGood(p.get(), m_phiRegionSize, m_etaRegionSize); + if (fracGood > m_goodFracCut) { + ATH_MSG_DEBUG("Condition Summary: " << layer_name << " good"); + expect_hit = + true; /// pass good module -> hit is expected on blayer + } else { + ATH_MSG_DEBUG(layer_name << " in dead region"); + } - } - else{ /// check dead regios - ATH_MSG_DEBUG("Condition Summary: " << layer_name << " good"); - expect_hit=true; /// pass good module -> hit is expected on blayer - } + } else { /// check dead regios + ATH_MSG_DEBUG("Condition Summary: " << layer_name << " good"); + expect_hit = + true; /// pass good module -> hit is expected on blayer + } - } - else{ - ATH_MSG_DEBUG("Condition Summary: " << layer_name << " good but outside active area"); - } + } else { + ATH_MSG_DEBUG("Condition Summary: " + << layer_name << " good but outside active area"); + } - } /// check active area (check edges) - else{ - ATH_MSG_DEBUG("Condition Summary: " << layer_name << " good, active areas not checked"); - expect_hit=true; /// pass good module -> hit is expected on blayer - } + } /// check active area (check edges) + else { + ATH_MSG_DEBUG("Condition Summary: " + << layer_name << " good, active areas not checked"); + expect_hit = true; /// pass good module -> hit is expected on blayer + } - } - else{ - ATH_MSG_DEBUG( layer_name << " not good"); + } else { + ATH_MSG_DEBUG(layer_name << " not good"); } } /// blayer param - return expect_hit; - } - - bool InDet::InDetTestBLayerTool::isActive(const Trk::TrackParameters* trackpar) const { @@ -639,73 +662,70 @@ namespace InDet { } - bool InDet::InDetTestBLayerTool::getPixelLayerParameters - (const Trk::TrackParameters* trackpar, - std::vector<std::unique_ptr<const Trk::TrackParameters> >& blayerParam, + bool + InDet::InDetTestBLayerTool::getPixelLayerParameters + + (const EventContext& ctx, + const Trk::TrackParameters* trackpar, + std::vector<std::unique_ptr<const Trk::TrackParameters>>& blayerParam, int layer) const { //// Cylinder bigger than the b-layer //// ATH_MSG_DEBUG("Trying to extrapolate to Pixel layer " << layer); - Trk::CylinderSurface BiggerThanBLayerSurface (new Transform3D(Transform3D::Identity()), - 100.0, - 10000.0); - - // extrapolate stepwise to this parameter (be careful, sorting might be wrong) - std::vector<std::unique_ptr<const Trk::TrackParameters> > paramList = - m_extrapolator->extrapolateStepwise(*trackpar, - BiggerThanBLayerSurface, - Trk::alongMomentum, - false); - + Trk::CylinderSurface BiggerThanBLayerSurface( + new Transform3D(Transform3D::Identity()), 100.0, 10000.0); + // extrapolate stepwise to this parameter (be careful, sorting might be + // wrong) + std::vector<std::unique_ptr<const Trk::TrackParameters>> paramList = + m_extrapolator->extrapolateStepwise( + ctx, *trackpar, BiggerThanBLayerSurface, Trk::alongMomentum, false); + if (paramList.empty()) { + ATH_MSG_DEBUG("No parameter returned by propagator "); + ATH_MSG_VERBOSE("dumping track parameters " << *trackpar); + return false; + } - if(paramList.empty()){ - ATH_MSG_DEBUG("No parameter returned by propagator "); - ATH_MSG_VERBOSE("dumping track parameters " <<*trackpar); - return false; - } - - ATH_MSG_DEBUG(" Number of generated parameters by propagator: " << paramList.size() ); - + ATH_MSG_DEBUG( + " Number of generated parameters by propagator: " << paramList.size()); - int s_int = 0; - for (std::unique_ptr<const Trk::TrackParameters>& p : paramList) { + int s_int = 0; + for (std::unique_ptr<const Trk::TrackParameters>& p : paramList) { - ATH_MSG_DEBUG( s_int++ << "th surface : "); + ATH_MSG_DEBUG(s_int++ << "th surface : "); - Identifier id; - if( !( p->associatedSurface().associatedDetectorElement() !=0 && - p->associatedSurface().associatedDetectorElement()->identify() !=0 ) ) - { - continue; - } + Identifier id; + if (!(p->associatedSurface().associatedDetectorElement() != 0 && + p->associatedSurface().associatedDetectorElement()->identify() != + 0)) { + continue; + } - id = p->associatedSurface().associatedDetectorElement()->identify(); - if (!m_idHelper->is_pixel(id)){ - continue; - } + id = p->associatedSurface().associatedDetectorElement()->identify(); + if (!m_idHelper->is_pixel(id)) { + continue; + } - ATH_MSG_DEBUG("Found pixel module : Associated track parameter"); - if(!m_pixelId->is_barrel(id)){ - continue; - } - ATH_MSG_DEBUG("Found pixel barrel"); - if(m_pixelId->layer_disk(id)!=layer) { - continue; - } + ATH_MSG_DEBUG("Found pixel module : Associated track parameter"); + if (!m_pixelId->is_barrel(id)) { + continue; + } + ATH_MSG_DEBUG("Found pixel barrel"); + if (m_pixelId->layer_disk(id) != layer) { + continue; + } - ATH_MSG_DEBUG( "Found layer " << layer << " ID: " << id.get_compact() ); - blayerParam.push_back (std::move (p)); + ATH_MSG_DEBUG("Found layer " << layer << " ID: " << id.get_compact()); + blayerParam.push_back(std::move(p)); - } /// all params + } /// all params - return true; + return true; } - double InDet::InDetTestBLayerTool::getFracGood(const Trk::TrackParameters* trkParam, double phiRegionSize, double etaRegionSize) const{ diff --git a/InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool.h b/InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool.h index 1309b85481c25d43f244ad98a8fd1237409a5ab2..77aa32e2186c2d943283832a93f7711e1b857c71 100755 --- a/InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool.h +++ b/InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool/InDetTrackSummaryHelperTool.h @@ -59,7 +59,8 @@ namespace InDet { */ using IExtendedTrackSummaryHelperTool::analyse; using IExtendedTrackSummaryHelperTool::addDetailedTrackSummary; - + using IExtendedTrackSummaryHelperTool::updateExpectedHitInfo; + virtual void analyse( const EventContext& ctx, const Trk::Track& track, @@ -84,6 +85,12 @@ namespace InDet { const Trk::Track&, Trk::TrackSummary&) const override final; + /** This method updates the expect... hit info*/ + virtual void updateExpectedHitInfo( + const EventContext& ctx, + const Trk::Track& track, + Trk::TrackSummary& summary) const override final; + /** Input : track, partHyp Output: Changes in information This method first calls the method getListOfHits to isolate the relevant @@ -113,11 +120,6 @@ namespace InDet { int& nclus, int& noverflowclus) const override final; - /** This method updates the expect... hit info*/ - virtual void updateExpectedHitInfo( - const Trk::Track& track, - Trk::TrackSummary& summary) const override final; - private: const Trk::ClusterSplitProbabilityContainer::ProbabilityInfo& getClusterSplittingProbability(const EventContext& ctx, diff --git a/InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool/src/InDetTrackSummaryHelperTool.cxx b/InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool/src/InDetTrackSummaryHelperTool.cxx index 5e2967a1bb7b1799565691a3de470b10f543bc36..88a876652059e2abbcbedc79269a3af473c22734 100755 --- a/InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool/src/InDetTrackSummaryHelperTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackSummaryHelperTool/src/InDetTrackSummaryHelperTool.cxx @@ -441,23 +441,25 @@ void InDet::InDetTrackSummaryHelperTool::updateSharedHitCount(const Trk::Track & void InDet::InDetTrackSummaryHelperTool::updateExpectedHitInfo( + const EventContext& ctx, const Trk::Track& track, Trk::TrackSummary& summary) const { - if (m_usePixel and not m_testBLayerTool.empty() ) { + if (m_usePixel and not m_testBLayerTool.empty()) { - if ( summary.m_information[Trk::numberOfContribPixelLayers] == 0 ) { + if (summary.m_information[Trk::numberOfContribPixelLayers] == 0) { ATH_MSG_DEBUG("No pxiels on track, so wo do not expect a B-Layer hit !"); summary.m_information[Trk::expectInnermostPixelLayerHit] = 0; summary.m_information[Trk::expectNextToInnermostPixelLayerHit] = 0; - } else{ - //innermost layer block - if (summary.m_information[Trk::numberOfInnermostPixelLayerHits] > 0){ - ATH_MSG_DEBUG("Innermost pixel Layer hit on track, so we expect a innermost pixel layer hit !"); + } else { + // innermost layer block + if (summary.m_information[Trk::numberOfInnermostPixelLayerHits] > 0) { + ATH_MSG_DEBUG("Innermost pixel Layer hit on track, so we expect a " + "innermost pixel layer hit !"); summary.m_information[Trk::expectInnermostPixelLayerHit] = 1; } else { - if (m_testBLayerTool->expectHitInInnermostPixelLayer(&track) ) { + if (m_testBLayerTool->expectHitInInnermostPixelLayer(ctx,&track)) { ATH_MSG_DEBUG("expect Pixel Layer 0 hit !"); summary.m_information[Trk::expectInnermostPixelLayerHit] = 1; } else { @@ -466,11 +468,12 @@ InDet::InDetTrackSummaryHelperTool::updateExpectedHitInfo( } } - //next to innermost block - if (summary.m_information[Trk::numberOfNextToInnermostPixelLayerHits] > 0){ + // next to innermost block + if (summary.m_information[Trk::numberOfNextToInnermostPixelLayerHits] > + 0) { summary.m_information[Trk::expectNextToInnermostPixelLayerHit] = 1; } else { - if (m_testBLayerTool->expectHitInNextToInnermostPixelLayer(&track) ) { + if (m_testBLayerTool->expectHitInNextToInnermostPixelLayer(ctx,&track)) { ATH_MSG_DEBUG("expect Pixel Layer 1 hit !"); summary.m_information[Trk::expectNextToInnermostPixelLayerHit] = 1; } else { diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt index 8f2ad316714b4248e5ed7b1dd3a3462082b4f62a..99e0766f13cc21d27cb3c0a4a20cc5536fbfe3cb 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt @@ -9,6 +9,7 @@ find_package( Eigen ) find_package( CLHEP ) find_package( ROOT COMPONENTS Core MathCore Hist ) find_package( COOL COMPONENTS CoolKernel CoolApplication ) +find_package( Boost ) # Component(s) in the package: atlas_add_library( SiClusterizationToolLib diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx index 5f097ebb3faed43f9d10ecb5d48e3486680ee718..b039fc6bae124713c6ff6dab8758677b4c80c9d4 100644 --- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx +++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx @@ -2287,12 +2287,15 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::newOneSeedWithCurvaturesComparison float topR=(*it_commonTopSP).second->radius(); float topZ=(*it_commonTopSP).second->z(); - float theta1=std::atan2(topR-bottomR,topZ-bottomZ); - float eta1=-std::log(std::tan(.5*theta1)); + float Zot = std::abs(topR - bottomR) > 10e-9 ? + bottomZ - (bottomR - originalSeedQuality) * ((topZ - bottomZ) / (topR - bottomR)) : bottomZ; - float Zot=bottomZ - (bottomR-originalSeedQuality) * ((topZ-bottomZ)/(topR-bottomR)); - float theta0=std::atan2(seedIP,Zot); - float eta0=-std::log(std::tan(.5*theta0)); + float theta1 = std::abs(topR - bottomR) > 10e-9 ? + std::atan2(topR - bottomR, topZ - bottomZ) : 0.; + float eta1 = theta1 > 0 ? -std::log(std::tan(.5 * theta1)) : 0.; + + float theta0 = seedIP > 0 ? std::atan2(seedIP, Zot) : 0; + float eta0 = theta0 > 0 ? -std::log(std::tan(.5 * theta0)) : 0.; float deltaEta=std::abs(eta1-eta0); //For LLP daughters, the direction of the track is correlated with the direction of the LLP (which is correlated with the direction of the point of closest approach //calculate weighted average of d0 and deltaEta, normalized by their maximum values diff --git a/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/InDetRecStatisticsAlg.h b/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/InDetRecStatisticsAlg.h index e170ef32763ebd65490786b6b6fb5ad81c88f745..db1dc432c662115a68416892a87010a16046cdea 100755 --- a/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/InDetRecStatisticsAlg.h +++ b/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/InDetRecStatisticsAlg.h @@ -82,7 +82,7 @@ namespace InDet { /** Select charged,stable particles which pass pt and eta cuts for analysis*/ /** Classify truth tracks as primary, secondary or truncated */ void selectGenSignal (const McEventCollection*, - std::vector <std::pair<HepMC::GenParticle *,int> > &, + std::vector <std::pair<HepMC::GenParticlePtr,int> > &, unsigned int, unsigned int, CounterLocal &counter) const; diff --git a/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/TrackStatHelper.h b/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/TrackStatHelper.h index def8ec0b7811576f108262fa49369494911851cf..d192e7d7d4440fc9ef9f0f2a082ed2bd70d6c25a 100755 --- a/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/TrackStatHelper.h +++ b/InnerDetector/InDetValidation/InDetRecStatistics/InDetRecStatistics/TrackStatHelper.h @@ -146,7 +146,7 @@ namespace InDet { void addEvent (const TrackCollection *, std::vector<const Trk::Track *> &, Trk::PRDtoTrackMap *prd_to_track_map, - std::vector <std::pair<HepMC::GenParticle *,int> > &, + std::vector <std::pair<HepMC::GenParticlePtr,int> > &, const TrackTruthCollection *, const AtlasDetectorID * const, const PixelID *, @@ -175,7 +175,7 @@ namespace InDet { /** defines 'good' reco tracks*/ bool PassTrackCuts(const Trk::TrackParameters *para) const; /** classifies gen particle as primary, secondary or truncated */ - int ClassifyParticle( const HepMC::GenParticle *particle, const double prob) const; + int ClassifyParticle( HepMC::ConstGenParticlePtr particle, const double prob) const; static std::string getSummaryTypeHeader(); diff --git a/LArCalorimeter/LArG4/LArG4GenShowerLib/LArG4GenShowerLib/LArG4GenShowerLib.h b/LArCalorimeter/LArG4/LArG4GenShowerLib/LArG4GenShowerLib/LArG4GenShowerLib.h index a832b092149c228ad22385ac0a70838d1874a034..6293b15ef49f6d9673cc883493d31f3474e7c533 100644 --- a/LArCalorimeter/LArG4/LArG4GenShowerLib/LArG4GenShowerLib/LArG4GenShowerLib.h +++ b/LArCalorimeter/LArG4/LArG4GenShowerLib/LArG4GenShowerLib/LArG4GenShowerLib.h @@ -60,7 +60,7 @@ class LArG4GenShowerLib : public AthAlgorithm { void truncate(ShowerLib::StepInfoList* stepinfo); //! return first MC truth particle for event - const HepMC::GenParticle* getParticleFromMC(); + HepMC::ConstGenParticlePtr getParticleFromMC(); //! calculate moments from StepInfoCollection void calculateMoments(const ShowerLib::StepInfoCollection& eventSteps, double& weights, double& xavfra, double& yavfra, double& ravfra); diff --git a/LArCalorimeter/LArG4/LArG4GenShowerLib/src/LArG4GenShowerLib.cxx b/LArCalorimeter/LArG4/LArG4GenShowerLib/src/LArG4GenShowerLib.cxx index 9c6b92d30c2d7646cf12724a09b87b7f98dcd823..62cbd3e55dd01309daa6ba17b7010205fccec497 100644 --- a/LArCalorimeter/LArG4/LArG4GenShowerLib/src/LArG4GenShowerLib.cxx +++ b/LArCalorimeter/LArG4/LArG4GenShowerLib/src/LArG4GenShowerLib.cxx @@ -274,14 +274,18 @@ StatusCode LArG4GenShowerLib::execute() return StatusCode::SUCCESS; } -const HepMC::GenParticle* LArG4GenShowerLib::getParticleFromMC() +HepMC::ConstGenParticlePtr LArG4GenShowerLib::getParticleFromMC() { const DataHandle<McEventCollection> mcEvent; if (evtStore()->retrieve(mcEvent,"BeamTruthEvent").isFailure()) return 0; // Return the first particle of the first event if (mcEvent) +#ifdef HEPMC3 + return (* mcEvent->begin())->particles().front(); +#else return ( * (* mcEvent->begin())->particles_begin()); +#endif return NULL; } diff --git a/LArCalorimeter/LArTrackingGeometry/src/LArVolumeBuilder.cxx b/LArCalorimeter/LArTrackingGeometry/src/LArVolumeBuilder.cxx index dc65355f37ce18a9a262662a687529871a088e01..b452aca949de1d0fb438577d86ba0088fd4e8fdc 100755 --- a/LArCalorimeter/LArTrackingGeometry/src/LArVolumeBuilder.cxx +++ b/LArCalorimeter/LArTrackingGeometry/src/LArVolumeBuilder.cxx @@ -292,28 +292,28 @@ const std::vector<const Trk::TrackingVolume*>* LAr::LArVolumeBuilder::trackingVo // layer entry/exit // binned material for LAr : steering in binEta - std::vector<const Trk::IdentifiedMaterial*> matID; + std::vector<Trk::IdentifiedMaterial> matID; // layer material can be adjusted here int baseID = Trk::GeometrySignature(Trk::Calo)*1000; - matID.push_back(new std::pair<const Trk::Material*,int>(lArBarrelMaterial,0)); - matID.push_back(new std::pair<const Trk::Material*,int>(lArBarrelMaterial,baseID+1)); - matID.push_back(new std::pair<const Trk::Material*,int>(lArBarrelMaterial,baseID+2)); - matID.push_back(new std::pair<const Trk::Material*,int>(lArBarrelMaterial,baseID+3)); + matID.emplace_back(lArBarrelMaterial,0); + matID.emplace_back(lArBarrelMaterial,baseID+1); + matID.emplace_back(lArBarrelMaterial,baseID+2); + matID.emplace_back(lArBarrelMaterial,baseID+3); // scaling factors refer to avZ(avA) change - matID.push_back(new std::pair<const Trk::Material*,int>(lArBarrelMaterial->scale(1.3),baseID+1)); - throwIntoGarbage(matID.back()->first); - matID.push_back(new std::pair<const Trk::Material*,int>(lArBarrelMaterial->scale(1.3),baseID+2)); - throwIntoGarbage(matID.back()->first); - matID.push_back(new std::pair<const Trk::Material*,int>(lArBarrelMaterial->scale(0.6),baseID+3)); - throwIntoGarbage(matID.back()->first); - matID.push_back(new std::pair<const Trk::Material*,int>(lArBarrelMaterial->scale(0.7),baseID+3)); - throwIntoGarbage(matID.back()->first); - matID.push_back(new std::pair<const Trk::Material*,int>(lArBarrelMaterial->scale(0.8),baseID+3)); - throwIntoGarbage(matID.back()->first); - matID.push_back(new std::pair<const Trk::Material*,int>(lArBarrelMaterial->scale(0.9),baseID+3)); - throwIntoGarbage(matID.back()->first); - matID.push_back(new std::pair<const Trk::Material*,int>(lArBarrelMaterial->scale(1.1),baseID+3)); - throwIntoGarbage(matID.back()->first); + matID.emplace_back(lArBarrelMaterial->scale(1.3),baseID+1); + throwIntoGarbage(matID.back().first); + matID.emplace_back(lArBarrelMaterial->scale(1.3),baseID+2); + throwIntoGarbage(matID.back().first); + matID.emplace_back(lArBarrelMaterial->scale(0.6),baseID+3); + throwIntoGarbage(matID.back().first); + matID.emplace_back(lArBarrelMaterial->scale(0.7),baseID+3); + throwIntoGarbage(matID.back().first); + matID.emplace_back(lArBarrelMaterial->scale(0.8),baseID+3); + throwIntoGarbage(matID.back().first); + matID.emplace_back(lArBarrelMaterial->scale(0.9),baseID+3); + throwIntoGarbage(matID.back().first); + matID.emplace_back(lArBarrelMaterial->scale(1.1),baseID+3); + throwIntoGarbage(matID.back().first); //std::cout <<"matID:"<< matID[3]->second<< std::endl; // @@ -536,10 +536,10 @@ const std::vector<const Trk::TrackingVolume*>* LAr::LArVolumeBuilder::trackingVo std::vector<size_t> dummylay (1,0); // binned material for Presampler : - std::vector<const Trk::IdentifiedMaterial*> matBP; + std::vector<Trk::IdentifiedMaterial> matBP; // layer material can be adjusted here int baseID = Trk::GeometrySignature(Trk::Calo)*1000; - matBP.push_back(new Trk::IdentifiedMaterial(lArBarrelPresamplerMaterial,baseID)); + matBP.emplace_back(lArBarrelPresamplerMaterial,baseID); const Trk::BinnedMaterial* lArBarrelPresamplerMaterialBinPos = new Trk::BinnedMaterial(lArBarrelPresamplerMaterial,rBU,dummylay,matBP); const Trk::BinnedMaterial* lArBarrelPresamplerMaterialBinNeg = new Trk::BinnedMaterial(lArBarrelPresamplerMaterial,rBUc,dummylay,matBP); @@ -748,68 +748,68 @@ const std::vector<const Trk::TrackingVolume*>* LAr::LArVolumeBuilder::trackingVo Trk::BinUtility* bun = new Trk::BinUtility(37,-3.2,-1.35,Trk::open,Trk::binEta); // binned material for LAr : steering in binEta - std::vector<const Trk::IdentifiedMaterial*> matEID; + std::vector<Trk::IdentifiedMaterial> matEID; // layer material can be adjusted here int baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 4; - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial,0)); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial,baseID+1)); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial,baseID+2)); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial,baseID+3)); + matEID.emplace_back(lArEndcapMaterial,0); + matEID.emplace_back(lArEndcapMaterial,baseID+1); + matEID.emplace_back(lArEndcapMaterial,baseID+2); + matEID.emplace_back(lArEndcapMaterial,baseID+3); // scaled - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.05),baseID+1)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.1),baseID+1)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.15),baseID+1)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.2),baseID+1)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.25),baseID+1)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.3),baseID+1)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.35),baseID+1)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.4),baseID+1)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.05),baseID+2)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.1),baseID+2)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.15),baseID+2)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.2),baseID+2)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.25),baseID+2)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.3),baseID+2)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.35),baseID+2)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.4),baseID+2)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.45),baseID+2)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(0.7),baseID+3)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(0.75),baseID+3)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(0.8),baseID+3)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(0.85),baseID+3)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(0.9),baseID+3)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(0.95),baseID+3)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.05),baseID+3)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.1),baseID+3)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.15),baseID+3)); - throwIntoGarbage(matEID.back()->first); - matEID.push_back(new std::pair<const Trk::Material*,int>(lArEndcapMaterial->scale(1.2),baseID+3)); - throwIntoGarbage(matEID.back()->first); + matEID.emplace_back(lArEndcapMaterial->scale(1.05),baseID+1); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.1),baseID+1); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.15),baseID+1); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.2),baseID+1); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.25),baseID+1); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.3),baseID+1); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.35),baseID+1); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.4),baseID+1); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.05),baseID+2); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.1),baseID+2); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.15),baseID+2); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.2),baseID+2); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.25),baseID+2); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.3),baseID+2); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.35),baseID+2); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.4),baseID+2); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.45),baseID+2); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(0.7),baseID+3); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(0.75),baseID+3); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(0.8),baseID+3); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(0.85),baseID+3); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(0.9),baseID+3); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(0.95),baseID+3); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.05),baseID+3); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.1),baseID+3); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.15),baseID+3); + throwIntoGarbage(matEID.back().first); + matEID.emplace_back(lArEndcapMaterial->scale(1.2),baseID+3); + throwIntoGarbage(matEID.back().first); // binned material for LAr : layer depth per eta bin std::vector< Trk::BinUtility*> layEUP(bup->bins()); @@ -963,7 +963,7 @@ const std::vector<const Trk::TrackingVolume*>* LAr::LArVolumeBuilder::trackingVo const GeoLogVol* lArECPresamplerLogVol = lArECPresamplerPhysVol ? lArECPresamplerPhysVol->getLogVol() : 0; // binned material for EC Presampler : layers only - std::vector<const Trk::IdentifiedMaterial*> matECP; + std::vector<Trk::IdentifiedMaterial> matECP; const Trk::Material* mAr = new Trk::Material(140., 1170./1.4, 40., 18., 0.0014); const Trk::Material* mAl = new Trk::Material(88.93, 388.8, 27., 13., 0.0027); throwIntoGarbage(mAr); @@ -971,8 +971,8 @@ const std::vector<const Trk::TrackingVolume*>* LAr::LArVolumeBuilder::trackingVo // layer material can be adjusted here int baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 4; - matECP.push_back(new std::pair<const Trk::Material*,int>(mAl,0)); - matECP.push_back(new std::pair<const Trk::Material*,int>(mAr,baseID)); + matECP.emplace_back(mAl,0); + matECP.emplace_back(mAr,baseID); if ( lArECPresamplerLogVol ) { @@ -1441,7 +1441,7 @@ const std::vector<const Trk::TrackingVolume*>* LAr::LArVolumeBuilder::trackingVo lArFcalZposition = hecFcalCoverZpos; // binned material for HEC : layers only - std::vector<const Trk::IdentifiedMaterial*> matHEC; + std::vector<Trk::IdentifiedMaterial> matHEC; //Trk::MaterialProperties lArHecFcalCoverMaterial = geoMaterialToMaterialProperties.convert(lArPositiveHec1Material); //Trk::MaterialProperties lArHecFcalCoverMaterial = Trk::MaterialProperties(1., 18.6, 0.00345, 27.); const Trk::Material* lArHecFcalCoverMaterial=new Trk::Material(18.4, 201.9, 57.2, 26.1, 0.0071); @@ -1451,14 +1451,16 @@ const std::vector<const Trk::TrackingVolume*>* LAr::LArVolumeBuilder::trackingVo // layer material can be adjusted here baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 8; - matHEC.push_back(new std::pair<const Trk::Material*,int>(lArHecFcalCoverMaterial->scale(0.13*m_scale_HECmaterial),0)); - matHEC.push_back(new std::pair<const Trk::Material*,int>(lArHecMaterial->scale(m_scale_HECmaterial),baseID)); - matHEC.push_back(new std::pair<const Trk::Material*,int>(lArHecFcalCoverMaterial->scale(0.93*m_scale_HECmaterial),baseID+1)); - throwIntoGarbage(matHEC.back()->first); - matHEC.push_back(new std::pair<const Trk::Material*,int>(lArHecFcalCoverMaterial->scale(1.09*m_scale_HECmaterial),baseID+2)); - throwIntoGarbage(matHEC.back()->first); - matHEC.push_back(new std::pair<const Trk::Material*,int>(lArHecFcalCoverMaterial->scale(1.12*m_scale_HECmaterial),baseID+3)); - throwIntoGarbage(matHEC.back()->first); + matHEC.emplace_back(lArHecFcalCoverMaterial->scale(0.13*m_scale_HECmaterial),0); + throwIntoGarbage(matHEC.back().first); + matHEC.emplace_back(lArHecMaterial->scale(m_scale_HECmaterial),baseID); + throwIntoGarbage(matHEC.back().first); + matHEC.emplace_back(lArHecFcalCoverMaterial->scale(0.93*m_scale_HECmaterial),baseID+1); + throwIntoGarbage(matHEC.back().first); + matHEC.emplace_back(lArHecFcalCoverMaterial->scale(1.09*m_scale_HECmaterial),baseID+2); + throwIntoGarbage(matHEC.back().first); + matHEC.emplace_back(lArHecFcalCoverMaterial->scale(1.12*m_scale_HECmaterial),baseID+3); + throwIntoGarbage(matHEC.back().first); // divide the HEC into two parts per EC : // - fit one around the FCAL - and adopt to LAr Endcap outer radius @@ -1600,7 +1602,7 @@ const std::vector<const Trk::TrackingVolume*>* LAr::LArVolumeBuilder::trackingVo // Now the FCAL // binned material for FCAL : layers only - std::vector<const Trk::IdentifiedMaterial*> matFCAL; + std::vector<Trk::IdentifiedMaterial> matFCAL; // convert the Material //Trk::MaterialProperties lArFcalMaterial = geoMaterialToMaterialProperties.convert(lArPositiveEndcapMaterial); const Trk::Material* lArFcalMaterial =new Trk::Material(8.4, 175.5, 100.8, 42.1, 0.0097); @@ -1610,13 +1612,13 @@ const std::vector<const Trk::TrackingVolume*>* LAr::LArVolumeBuilder::trackingVo // layer material can be adjusted here baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 20; - matFCAL.push_back(new std::pair<const Trk::Material*,int>(lArFcalMaterial0,0)); - matFCAL.push_back(new std::pair<const Trk::Material*,int>(lArFcalMaterial->scale(0.5),baseID+1)); - throwIntoGarbage(matFCAL.back()->first); - matFCAL.push_back(new std::pair<const Trk::Material*,int>(lArFcalMaterial->scale(1.5),baseID+2)); - throwIntoGarbage(matFCAL.back()->first); - matFCAL.push_back(new std::pair<const Trk::Material*,int>(lArFcalMaterial->scale(1.4),baseID+3)); - throwIntoGarbage(matFCAL.back()->first); + matFCAL.emplace_back(lArFcalMaterial0,0); + matFCAL.emplace_back(lArFcalMaterial->scale(0.5),baseID+1); + throwIntoGarbage(matFCAL.back().first); + matFCAL.emplace_back(lArFcalMaterial->scale(1.5),baseID+2); + throwIntoGarbage(matFCAL.back().first); + matFCAL.emplace_back(lArFcalMaterial->scale(1.4),baseID+3); + throwIntoGarbage(matFCAL.back().first); // smooth the FCal to Tube form if (lArPositiveFcal1Bounds && lArPositiveFcal2Bounds && lArPositiveFcal3Bounds && diff --git a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MuonMDT_CablingSvc.h b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MuonMDT_CablingSvc.h index 9969f1b82fc1b2bade820b7b379a24b937ce533f..27aadd9b9f9a28616fc9e0ed51bdb2ca46fe823b 100644 --- a/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MuonMDT_CablingSvc.h +++ b/MuonSpectrometer/MuonCablings/MuonMDT_Cabling/MuonMDT_Cabling/MuonMDT_CablingSvc.h @@ -31,8 +31,8 @@ class MuonMDT_CablingSvc : public AthService , MuonMDT_CablingSvc(const std::string& name,ISvcLocator* sl); virtual ~MuonMDT_CablingSvc(); - virtual StatusCode initialize(); - virtual StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; /** methods called at trigger stop/start */ // virtual StatusCode start(); @@ -43,7 +43,7 @@ class MuonMDT_CablingSvc : public AthService , static const InterfaceID& interfaceID() { return IID_IMuonMDT_CablingSvc; } - virtual StatusCode queryInterface(const InterfaceID & riid, void** ppvInterface ); + virtual StatusCode queryInterface(const InterfaceID & riid, void** ppvInterface ) override; // IOV service callback StatusCode initMappingModel(IOVSVC_CALLBACK_ARGS_P(I,keys)); diff --git a/MuonSpectrometer/MuonConfig/python/MuonBytestreamDecodeConfig.py b/MuonSpectrometer/MuonConfig/python/MuonBytestreamDecodeConfig.py index 8f58c38694b5270dead7455c2c90f23628ec5902..83fa969bec4671e09f177425ee54248a2e27a3c6 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonBytestreamDecodeConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonBytestreamDecodeConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory @@ -29,9 +29,8 @@ def MuonCacheCfg(): ## This configuration function sets up everything for decoding RPC bytestream data into RDOs # -# The forTrigger paramater is used to put the algorithm in RoI mode # The function returns a ComponentAccumulator and the data-decoding algorithm, which should be added to the right sequence by the user -def RpcBytestreamDecodeCfg(flags, forTrigger=False): +def RpcBytestreamDecodeCfg(flags, name="RpcRawDataProvider"): acc = ComponentAccumulator() # We need the RPC cabling to be setup @@ -57,7 +56,7 @@ def RpcBytestreamDecodeCfg(flags, forTrigger=False): MuonRpcRawDataProviderTool = Muon__RPC_RawDataProviderToolMT(name = "RPC_RawDataProviderToolMT", Decoder = RPCRodDecoder, RdoLocation = keyName ) - if forTrigger: + if flags.Muon.MuonTrigger: MuonRpcRawDataProviderTool.RpcContainerCacheKey = MuonCacheNames.RpcCache MuonRpcRawDataProviderTool.WriteOutRpcSectorLogic = False @@ -65,18 +64,23 @@ def RpcBytestreamDecodeCfg(flags, forTrigger=False): # Setup the RAW data provider algorithm Muon__RpcRawDataProvider=CompFactory.Muon.RpcRawDataProvider - RpcRawDataProvider = Muon__RpcRawDataProvider(name = "RpcRawDataProvider", + RpcRawDataProvider = Muon__RpcRawDataProvider(name = name, ProviderTool = MuonRpcRawDataProviderTool ) - if forTrigger: + if flags.Muon.MuonTrigger: # Configure the RAW data provider for ROI access from L1Decoder.L1DecoderConfig import mapThresholdToL1RoICollection RpcRawDataProvider.RoIs = mapThresholdToL1RoICollection("MU") + RpcRawDataProvider.DoSeededDecoding = True + # add RegSelTool + from RegionSelector.RegSelToolConfig import regSelTool_RPC_Cfg + RpcRawDataProvider.RegionSelectionTool = acc.popToolsAndMerge( regSelTool_RPC_Cfg( flags ) ) + acc.addEventAlgo(RpcRawDataProvider, primary=True) return acc -def TgcBytestreamDecodeCfg(flags, forTrigger=False): +def TgcBytestreamDecodeCfg(flags, name="TgcRawDataProvider"): acc = ComponentAccumulator() # We need the TGC cabling to be setup @@ -103,21 +107,27 @@ def TgcBytestreamDecodeCfg(flags, forTrigger=False): Decoder = TGCRodDecoder, RdoLocation = keyName ) - if forTrigger: + if flags.Muon.MuonTrigger: MuonTgcRawDataProviderTool.TgcContainerCacheKey = MuonCacheNames.TgcCache acc.addPublicTool( MuonTgcRawDataProviderTool ) # This should be removed, but now defined as PublicTool at MuFastSteering # Setup the RAW data provider algorithm Muon__TgcRawDataProvider=CompFactory.Muon.TgcRawDataProvider - TgcRawDataProvider = Muon__TgcRawDataProvider(name = "TgcRawDataProvider", + TgcRawDataProvider = Muon__TgcRawDataProvider(name = name, ProviderTool = MuonTgcRawDataProviderTool ) - + if flags.Muon.MuonTrigger: + TgcRawDataProvider.DoSeededDecoding = True + # add RegSelTool + from RegionSelector.RegSelToolConfig import regSelTool_TGC_Cfg + TgcRawDataProvider.RegionSelectionTool = acc.popToolsAndMerge( regSelTool_TGC_Cfg( flags ) ) + + acc.addEventAlgo(TgcRawDataProvider,primary=True) return acc -def MdtBytestreamDecodeCfg(flags, forTrigger=False): +def MdtBytestreamDecodeCfg(flags, name="MdtRawDataProvider"): acc = ComponentAccumulator() # We need the MDT cabling to be setup @@ -148,21 +158,27 @@ def MdtBytestreamDecodeCfg(flags, forTrigger=False): Decoder = MDTRodDecoder, RdoLocation = keyName) - if forTrigger: + if flags.Muon.MuonTrigger: MuonMdtRawDataProviderTool.CsmContainerCacheKey = MuonCacheNames.MdtCsmCache acc.addPublicTool( MuonMdtRawDataProviderTool ) # This should be removed, but now defined as PublicTool at MuFastSteering # Setup the RAW data provider algorithm Muon__MdtRawDataProvider=CompFactory.Muon.MdtRawDataProvider - MdtRawDataProvider = Muon__MdtRawDataProvider(name = "MdtRawDataProvider", + MdtRawDataProvider = Muon__MdtRawDataProvider(name = name, ProviderTool = MuonMdtRawDataProviderTool ) + if flags.Muon.MuonTrigger: + MdtRawDataProvider.DoSeededDecoding = True + # add RegSelTool + from RegionSelector.RegSelToolConfig import regSelTool_MDT_Cfg + MdtRawDataProvider.RegionSelectionTool = acc.popToolsAndMerge( regSelTool_MDT_Cfg( flags ) ) + acc.addEventAlgo(MdtRawDataProvider,primary=True) return acc -def CscBytestreamDecodeCfg(flags, forTrigger=False): +def CscBytestreamDecodeCfg(flags, name="CscRawDataProvider"): acc = ComponentAccumulator() # We need the CSC cabling to be setup @@ -188,15 +204,21 @@ def CscBytestreamDecodeCfg(flags, forTrigger=False): MuonCscRawDataProviderTool = Muon__CSC_RawDataProviderToolMT(name = "CSC_RawDataProviderToolMT", Decoder = CSCRodDecoder, RdoLocation = keyName) - if forTrigger: + if flags.Muon.MuonTrigger: MuonCscRawDataProviderTool.CscContainerCacheKey = MuonCacheNames.CscCache acc.addPublicTool( MuonCscRawDataProviderTool ) # This should be removed, but now defined as PublicTool at MuFastSteering # Setup the RAW data provider algorithm Muon__CscRawDataProvider=CompFactory.Muon.CscRawDataProvider - CscRawDataProvider = Muon__CscRawDataProvider(name = "CscRawDataProvider", + CscRawDataProvider = Muon__CscRawDataProvider(name = name, ProviderTool = MuonCscRawDataProviderTool ) + if flags.Muon.MuonTrigger: + CscRawDataProvider.DoSeededDecoding = True + # add RegSelTool + from RegionSelector.RegSelToolConfig import regSelTool_CSC_Cfg + CscRawDataProvider.RegionSelectionTool = acc.popToolsAndMerge( regSelTool_CSC_Cfg( flags ) ) + acc.addEventAlgo(CscRawDataProvider,primary=True) diff --git a/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py b/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py index 030bacb86902094e962485c74d69b2fe710a8f56..b3109196b6c8311023728d9d93cd4c8771df204c 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py +++ b/MuonSpectrometer/MuonConfig/python/MuonConfigFlags.py @@ -1,7 +1,7 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaConfiguration.AthConfigFlags import AthConfigFlags -from AthenaConfiguration.AutoConfigFlags import GetDetDescrInfo +from AthenaConfiguration.AutoConfigFlags import DetDescrInfo import re # Some comments from Ed about existing flags @@ -37,9 +37,9 @@ def createMuonConfigFlags(): mcf.addFlag("Muon.doMDTs",True) mcf.addFlag("Muon.doTGCs",True) mcf.addFlag("Muon.doRPCs",True) - mcf.addFlag("Muon.doCSCs",lambda prevFlags : GetDetDescrInfo(prevFlags.GeoModel.AtlasVersion).get('HasCSC',"True")) - mcf.addFlag("Muon.doMicromegas",lambda prevFlags : GetDetDescrInfo(prevFlags.GeoModel.AtlasVersion).get('HasMM',"True")) - mcf.addFlag("Muon.dosTGCs",lambda prevFlags : GetDetDescrInfo(prevFlags.GeoModel.AtlasVersion).get('HasSTGC',"True")) + mcf.addFlag("Muon.doCSCs",lambda prevFlags : DetDescrInfo(prevFlags.GeoModel.AtlasVersion)['Muon']['HasCSC']) + mcf.addFlag("Muon.doMicromegas",lambda prevFlags : DetDescrInfo(prevFlags.GeoModel.AtlasVersion)['Muon']['HasMM']) + mcf.addFlag("Muon.dosTGCs",lambda prevFlags : DetDescrInfo(prevFlags.GeoModel.AtlasVersion)['Muon']['HasSTGC']) # stages of processing # 1. Digitization diff --git a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py index fc3cacf940986932da031fd3f76e69d4c1759a0c..57325a2c1ede62bfeda9a9a04bf7798c1987e3c0 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py @@ -44,9 +44,8 @@ def MuonPrdCacheCfg(): ## This configuration function sets up everything for decoding RPC RDO to PRD conversion # -# The forTrigger paramater is used to put the algorithm in RoI mode # The function returns a ComponentAccumulator and the data-converting algorithm, which should be added to the right sequence by the user -def RpcRDODecodeCfg(flags, forTrigger=False): +def RpcRDODecodeCfg(flags, name="RpcRdoToRpcPrepData"): from MuonConfig.MuonCondAlgConfig import RpcCondDbAlgCfg # MT-safe conditions access acc = RpcCondDbAlgCfg(flags) @@ -64,20 +63,20 @@ def RpcRDODecodeCfg(flags, forTrigger=False): if flags.Common.isOnline: RpcRdoToRpcPrepDataTool.ReadKey = "" ## cond data not needed online - if forTrigger: + if flags.Muon.MuonTrigger: RpcRdoToRpcPrepDataTool.RpcPrdContainerCacheKey = MuonPrdCacheNames.RpcCache RpcRdoToRpcPrepDataTool.RpcCoinDataContainerCacheKey = MuonPrdCacheNames.RpcCoinCache # Get the RDO -> PRD alorithm RpcRdoToRpcPrepData=CompFactory.RpcRdoToRpcPrepData - RpcRdoToRpcPrepData = RpcRdoToRpcPrepData(name = "RpcRdoToRpcPrepData", + RpcRdoToRpcPrepData = RpcRdoToRpcPrepData(name = name, DecodingTool = RpcRdoToRpcPrepDataTool, PrintPrepData = False ) # add RegSelTool from RegionSelector.RegSelToolConfig import regSelTool_RPC_Cfg RpcRdoToRpcPrepData.RegSel_RPC = acc.popToolsAndMerge( regSelTool_RPC_Cfg( flags ) ) - if forTrigger: + if flags.Muon.MuonTrigger: # Set the algorithm to RoI mode RpcRdoToRpcPrepData.DoSeededDecoding = True from L1Decoder.L1DecoderConfig import mapThresholdToL1RoICollection @@ -86,7 +85,7 @@ def RpcRDODecodeCfg(flags, forTrigger=False): acc.addEventAlgo(RpcRdoToRpcPrepData) return acc -def TgcRDODecodeCfg(flags, forTrigger=False): +def TgcRDODecodeCfg(flags, name="TgcRdoToTgcPrepData"): acc = ComponentAccumulator() # We need the TGC cabling to be setup @@ -103,14 +102,14 @@ def TgcRDODecodeCfg(flags, forTrigger=False): # Get the RDO -> PRD alorithm TgcRdoToTgcPrepData=CompFactory.TgcRdoToTgcPrepData - TgcRdoToTgcPrepData = TgcRdoToTgcPrepData(name = "TgcRdoToTgcPrepData", + TgcRdoToTgcPrepData = TgcRdoToTgcPrepData(name = name, DecodingTool = TgcRdoToTgcPrepDataTool, PrintPrepData = False ) # add RegSelTool from RegionSelector.RegSelToolConfig import regSelTool_TGC_Cfg TgcRdoToTgcPrepData.RegSel_TGC = acc.popToolsAndMerge( regSelTool_TGC_Cfg( flags ) ) - if forTrigger: + if flags.Muon.MuonTrigger: # Set the algorithm to RoI mode TgcRdoToTgcPrepData.DoSeededDecoding = True from L1Decoder.L1DecoderConfig import mapThresholdToL1RoICollection @@ -119,7 +118,7 @@ def TgcRDODecodeCfg(flags, forTrigger=False): acc.addEventAlgo(TgcRdoToTgcPrepData) return acc -def MdtRDODecodeCfg(flags, forTrigger=False): +def MdtRDODecodeCfg(flags, name="MdtRdoToMdtPrepData"): acc = ComponentAccumulator() from MuonConfig.MuonCalibrationConfig import MdtCalibrationToolCfg @@ -141,14 +140,14 @@ def MdtRDODecodeCfg(flags, forTrigger=False): # Get the RDO -> PRD alorithm MdtRdoToMdtPrepData=CompFactory.MdtRdoToMdtPrepData - MdtRdoToMdtPrepData = MdtRdoToMdtPrepData(name = "MdtRdoToMdtPrepData", + MdtRdoToMdtPrepData = MdtRdoToMdtPrepData(name = name, DecodingTool = MdtRdoToMdtPrepDataTool, PrintPrepData = False) # add RegSelTool from RegionSelector.RegSelToolConfig import regSelTool_MDT_Cfg MdtRdoToMdtPrepData.RegSel_MDT = acc.popToolsAndMerge( regSelTool_MDT_Cfg( flags ) ) - if forTrigger: + if flags.Muon.MuonTrigger: # Set the algorithm to RoI mode MdtRdoToMdtPrepData.DoSeededDecoding = True from L1Decoder.L1DecoderConfig import mapThresholdToL1RoICollection @@ -158,7 +157,7 @@ def MdtRDODecodeCfg(flags, forTrigger=False): return acc -def CscRDODecodeCfg(flags, forTrigger=False): +def CscRDODecodeCfg(flags, name="CscRdoToCscPrepData"): acc = ComponentAccumulator() # We need the CSC cabling to be setup @@ -178,14 +177,14 @@ def CscRDODecodeCfg(flags, forTrigger=False): # Get the RDO -> PRD alorithm CscRdoToCscPrepData=CompFactory.CscRdoToCscPrepData - CscRdoToCscPrepData = CscRdoToCscPrepData(name = "CscRdoToCscPrepData", + CscRdoToCscPrepData = CscRdoToCscPrepData(name = name, CscRdoToCscPrepDataTool = CscRdoToCscPrepDataTool, PrintPrepData = False ) # add RegSelTool from RegionSelector.RegSelToolConfig import regSelTool_CSC_Cfg CscRdoToCscPrepData.RegSel_CSC = acc.popToolsAndMerge( regSelTool_CSC_Cfg( flags ) ) - if forTrigger: + if flags.Muon.MuonTrigger: # Set the algorithm to RoI mode CscRdoToCscPrepData.DoSeededDecoding = True from L1Decoder.L1DecoderConfig import mapThresholdToL1RoICollection @@ -194,7 +193,7 @@ def CscRDODecodeCfg(flags, forTrigger=False): acc.addEventAlgo(CscRdoToCscPrepData) return acc -def CscClusterBuildCfg(flags, forTrigger=False): +def CscClusterBuildCfg(flags, name= "CscThresholdClusterBuilder"): acc = ComponentAccumulator() # Get cluster creator tool @@ -203,7 +202,7 @@ def CscClusterBuildCfg(flags, forTrigger=False): #CSC cluster building CscThresholdClusterBuilder=CompFactory.CscThresholdClusterBuilder - CscClusterBuilder = CscThresholdClusterBuilder(name = "CscThresholdClusterBuilder", + CscClusterBuilder = CscThresholdClusterBuilder(name = name, cluster_builder = CscClusterBuilderTool ) acc.addEventAlgo(CscClusterBuilder) @@ -212,7 +211,6 @@ def CscClusterBuildCfg(flags, forTrigger=False): # This function runs the decoding on a data file def muonRdoDecodeTestData( forTrigger = False ): - # Add a flag, forTrigger, which will initially put the ByteStreamDecodeCfg code into "Cached Container" mode from AthenaCommon.Configurable import Configurable Configurable.configurableRun3Behavior=1 @@ -246,20 +244,20 @@ def muonRdoDecodeTestData( forTrigger = False ): # Schedule Rpc bytestream data decoding from MuonConfig.MuonBytestreamDecodeConfig import RpcBytestreamDecodeCfg - rpcdecodingAcc = RpcBytestreamDecodeCfg( ConfigFlags, forTrigger ) + rpcdecodingAcc = RpcBytestreamDecodeCfg( ConfigFlags ) cfg.merge( rpcdecodingAcc ) # Schedule Mdt bytestream data decoding from MuonConfig.MuonBytestreamDecodeConfig import TgcBytestreamDecodeCfg - tgcdecodingAcc = TgcBytestreamDecodeCfg( ConfigFlags, forTrigger ) + tgcdecodingAcc = TgcBytestreamDecodeCfg( ConfigFlags ) cfg.merge( tgcdecodingAcc ) from MuonConfig.MuonBytestreamDecodeConfig import MdtBytestreamDecodeCfg - mdtdecodingAcc = MdtBytestreamDecodeCfg( ConfigFlags, forTrigger ) + mdtdecodingAcc = MdtBytestreamDecodeCfg(ConfigFlags ) cfg.merge( mdtdecodingAcc ) from MuonConfig.MuonBytestreamDecodeConfig import CscBytestreamDecodeCfg - cscdecodingAcc = CscBytestreamDecodeCfg( ConfigFlags, forTrigger) + cscdecodingAcc = CscBytestreamDecodeCfg( ConfigFlags) cfg.merge( cscdecodingAcc ) # Schedule RDO conversion diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h index a81ab5b69b83aff3359c62669e6c8517e3996118..f9167d376ef72140b3a81957d576bd8fa69d26bf 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg/MuonTGMeasAssocAlg.h @@ -85,8 +85,8 @@ class MuonTGMeasAssocAlg : public AthAlgorithm { bool m_misAlign; bool m_allowGeomAssoc; - mutable const Trk::TrackingGeometry* m_trackingGeometry; - std::string m_trackingGeometryName; + SG::ReadCondHandleKey<Trk::TrackingGeometry> m_trackingGeometryReadKey; + ToolHandle<Muon::IMuonTGMeasTool> m_muonTgTool{ this, diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/share/MuonTGMeasAssocAlg_jobOptions.py b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/share/MuonTGMeasAssocAlg_jobOptions.py index 0434eede64864f89070f7d23cb8867d06e65fe8e..98c02d784ad38403038f673e371bb112995d0005 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/share/MuonTGMeasAssocAlg_jobOptions.py +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/share/MuonTGMeasAssocAlg_jobOptions.py @@ -9,23 +9,25 @@ MuonStandAloneGeometryBuilder = Trk__GeometryBuilder( name = "MuonStandAloneGeom ToolSvc += MuonStandAloneGeometryBuilder ToolSvc.MuonStandAloneGeometryBuilder.InDetTrackingGeometry = False ToolSvc.MuonStandAloneGeometryBuilder.CaloTrackingGeometry = False -ToolSvc.MuonStandAloneGeometryBuilder.MuonTrackingGeometry = True +ToolSvc.MuonStandAloneGeometryBuilder.MuonTrackingGeometry = True print MuonStandAloneGeometryBuilder # combined tracking geometry options -from TrkDetDescrSvc.TrkDetDescrSvcConf import TrackingGeometrySvc -MuonTrackingGeometrySvc = TrackingGeometrySvc( name ="MuonTrackingGeometrySvc", - TrackingGeometryName = "MuonStandaloneTrackingGeometry", - GeometryBuilder = MuonStandAloneGeometryBuilder, - BuildGeometryFromTagInfo = False, - AssignMaterialFromCOOL = False ) -theApp.CreateSvc += [ "TrackingGeometrySvc/MuonTrackingGeometrySvc" ] +from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlg import ConfiguredTrackingGeometryCondAlg +MuonTrkGeoCondAlg = ConfiguredTrackingGeometryCondAlg(name = "MuonTrackingGeometryCondAlg", + GeometryBuilder = MuonStandAloneGeometryBuilder, + BuildGeometryFromTagInfo = False, + TrackingGeometryWriteKey = 'MuonStandaloneTrackingGeometry') -# navigator +from AthenaCommon.AlgSequence import AthSequencer +condSeq = AthSequencer("AthCondSeq") +condSeq+= TrkGeoCondAlg + +# navigator from TrkExTools.TrkExToolsConf import Trk__Navigator MuonNavigator = Trk__Navigator(name = "MuonNavigator" ) ToolSvc += MuonNavigator -ToolSvc.MuonNavigator.TrackingGeometrySvc = "MuonTrackingGeometrySvc" +ToolSvc.MuonNavigator.TrackingGeometrySvc = "MuonTrackingGeometrySvc" ToolSvc.MuonNavigator.OutputLevel = 5 print MuonNavigator @@ -35,7 +37,7 @@ MuonMatUpdator = Trk__MaterialEffectsUpdator( name = "MuonMatUpdator" ) ToolSvc += MuonMatUpdator print MuonMatUpdator -# propagator +# propagator from TrkExSTEP_Propagator.TrkExSTEP_PropagatorConf import Trk__STEP_Propagator MuonPropagator = Trk__STEP_Propagator(name = 'MuonPropagator') ToolSvc += MuonPropagator @@ -44,7 +46,7 @@ print MuonPropagator # extrapolator from TrkExTools.TrkExToolsConf import Trk__Extrapolator -MuonExtrapolator = Trk__Extrapolator( name = 'MuonExtrapolator', +MuonExtrapolator = Trk__Extrapolator( name = 'MuonExtrapolator', Propagators = [ MuonPropagator ] , Navigator = MuonNavigator, MaterialEffectsUpdators = [ MuonMatUpdator ] @@ -57,7 +59,7 @@ print MuonExtrapolator # from MuonTGMeasAssocAlg.MuonTGMeasAssocAlgConf import Muon__MuonTGMeasAssocAlg MuonTGMeasAssocAlg = Muon__MuonTGMeasAssocAlg( name = 'MuonTGMeasAssocAlg', - Extrapolator = MuonExtrapolator, + Extrapolator = MuonExtrapolator, TrackingGeometry = 'MuonStandaloneTrackingGeometry', ProcessSegments = True ) topSequence += MuonTGMeasAssocAlg diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx index 68e917e73c3d2699196d488ae9b749e446e4ec9b..0786fa99d6da796e814d205dcf6df2288377062b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx @@ -39,8 +39,7 @@ Muon::MuonTGMeasAssocAlg::MuonTGMeasAssocAlg(const std::string& name, ISvcLocato m_reAlign(false), m_misAlign(false), m_allowGeomAssoc(true), - m_trackingGeometry(0), - m_trackingGeometryName("AtlasTrackingGeometry"), + m_trackingGeometryReadKey("AtlasTrackingGeometry"), m_inputSegmentCollectionMoore("MooreSegments"), m_inputSegmentCollectionMoMu("MuonSegments_MoMu"), m_inputSegmentCollectionMBoy("ConvertedMBoySegments"), @@ -56,7 +55,6 @@ Muon::MuonTGMeasAssocAlg::MuonTGMeasAssocAlg(const std::string& name, ISvcLocato m_allHits(0), m_allSegments(0) { - declareProperty("TrackingGeometry", m_trackingGeometryName); declareProperty("ProcessMdtHits", m_mdtIn); declareProperty("ProcessRpcHits", m_rpcIn); declareProperty("ProcessCscHits", m_cscIn); @@ -85,6 +83,8 @@ Muon::MuonTGMeasAssocAlg::initialize() ATH_CHECK(m_DetectorManagerKey.initialize()); + ATH_CHECK(m_trackingGeometryReadKey.initialize()); + // Get an Identifier helper object ATH_CHECK(service("ActiveStoreSvc", m_activeStore)); ATH_CHECK(m_idHelperSvc.retrieve()); @@ -144,14 +144,18 @@ Muon::MuonTGMeasAssocAlg::execute() StatusCode sc; - if (!m_trackingGeometry) { - - ATH_CHECK(detStore()->retrieve(m_trackingGeometry, m_trackingGeometryName)); - ATH_MSG_DEBUG("tracking geometry Svc \"" << m_trackingGeometryName << "\" booked "); + //Set up read handle + SG::ReadCondHandle<Trk::TrackingGeometry> readHandle{m_trackingGeometryReadKey}; + if (!readHandle.isValid() || *readHandle == nullptr) { + ATH_MSG_WARNING(m_trackingGeometryReadKey.fullKey() << " is not available."); + return StatusCode::FAILURE; } + const Trk::TrackingGeometry* trkGeom = *readHandle; + + // create station map if not done already ; misalign stations if required if (!m_stationMap.size()) { - const Trk::TrackingVolume* vol = m_trackingGeometry->highestTrackingVolume(); + const Trk::TrackingVolume* vol = trkGeom->highestTrackingVolume(); ATH_MSG_INFO("creating station map "); createStationMap(vol, MuonDetMgr); ATH_MSG_INFO("station map created with " << m_stationMap.size() << " members "); @@ -371,6 +375,13 @@ Muon::MuonTGMeasAssocAlg::createStationSegmentCollection(const MuonGM::MuonDetec m_allSegments = new MuonTGSegments; + SG::ReadCondHandle<Trk::TrackingGeometry> readHandle{m_trackingGeometryReadKey}; + if (!readHandle.isValid() || *readHandle == nullptr) { + ATH_MSG_WARNING(m_trackingGeometryReadKey.fullKey() << " is not available."); + return StatusCode::FAILURE; + } + const Trk::TrackingGeometry* trkGeom = *readHandle; + for (unsigned int ic = 0; ic < segmColls.size(); ic++) { const Trk::SegmentCollection* segmColl = segmColls[ic]; for (Trk::SegmentCollection::const_iterator iter = segmColl->begin(); iter != segmColl->end(); ++iter) { @@ -381,7 +392,7 @@ Muon::MuonTGMeasAssocAlg::createStationSegmentCollection(const MuonGM::MuonDetec // retrieve station const Trk::DetachedTrackingVolume* detVol = 0; const std::vector<const Trk::DetachedTrackingVolume*>* detVols = - m_trackingGeometry->lowestDetachedTrackingVolumes(segment->globalPosition()); + trkGeom->lowestDetachedTrackingVolumes(segment->globalPosition()); if (detVols) { if (detVols->size() > 1) ATH_MSG_INFO("station overlaps ? "); if (detVols->size()) detVol = detVols->front(); @@ -406,7 +417,7 @@ Muon::MuonTGMeasAssocAlg::createStationSegmentCollection(const MuonGM::MuonDetec const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(id); pos = tgcROE->channelPos(id); } - const Trk::Layer* lay = m_trackingGeometry->associatedLayer(pos); + const Trk::Layer* lay = trkGeom->associatedLayer(pos); if (lay) detVol = lay->enclosingDetachedTrackingVolume(); if (detVol) ATH_MSG_DEBUG(" enclosing detached volume retrieved:" << detVol->name()); } @@ -970,8 +981,15 @@ Muon::MuonTGMeasAssocAlg::associatedLayer(int techn, Identifier id, const MuonGM // Get the TgcReadoutElement and the tube position from it const MuonGM::TgcReadoutElement* tgcROE = MuonDetMgr->getTgcReadoutElement(id); Amg::Vector3D pos = tgcROE->channelPos(id); - std::vector<const Trk::DetachedTrackingVolume*>* detVols = - m_trackingGeometry->lowestDetachedTrackingVolumes(pos); + + //Get the TrackingGeometry + SG::ReadCondHandle<Trk::TrackingGeometry> readHandle{m_trackingGeometryReadKey}; + if (!readHandle.isValid() || *readHandle == nullptr) { + ATH_MSG_WARNING(m_trackingGeometryReadKey.fullKey() << " is not available."); + } + const Trk::TrackingGeometry* trkGeom = *readHandle; + std::vector<const Trk::DetachedTrackingVolume*>* detVols = trkGeom->lowestDetachedTrackingVolumes(pos); + for (unsigned int i = 0; i < detVols->size(); i++) { Identifier sId((*detVols)[i]->layerRepresentation()->layerType()); ATH_MSG_INFO("geom assoc with station:" << (*detVols)[i] << "," << (*detVols)[i]->name() << "," diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonSegmentTrackBuilder.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonSegmentTrackBuilder.h index 57bac061e8eb73501813afa6b5def354695a9e56..6ba5aaf8459ad24cdd03409fd0fcc44848af22a0 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonSegmentTrackBuilder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonSegmentTrackBuilder.h @@ -90,6 +90,8 @@ namespace Muon { */ virtual Trk::TrackParameters* getClosestParameters( const Trk::Track& track, const Trk::Surface& surf ) const = 0; + virtual void cleanUp() const = 0; + }; inline const InterfaceID& IMuonSegmentTrackBuilder::interfaceID() diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackSegmentMatchingTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackSegmentMatchingTool.h index 540f3cc3cfe5db0bd5f2100f6d743537875a6124..b18b89b087f66fd22529981df72e0fbbf55bc14c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackSegmentMatchingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackSegmentMatchingTool.h @@ -32,7 +32,7 @@ namespace Muon { The caller should ensure the track gets deleted. */ virtual bool match( const Trk::Track& track, const MuonSegment& segment, bool useTightCuts = false ) const = 0; - virtual void cleanUp() const {}; + virtual void cleanUp() const = 0; }; inline const InterfaceID& IMuonTrackSegmentMatchingTool::interfaceID() diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackTruthTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackTruthTool.h index 0421d00f3543d5a19ce632cbcf6c7e20c53b63de..bb4857d66f4f82e7cdbffb9ac0e94b52a8dba5cd 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackTruthTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces/MuonRecToolInterfaces/IMuonTrackTruthTool.h @@ -130,15 +130,15 @@ namespace Muon { /// returns the mother particle of the particle with barcodeIn if it is found in the truth trajectory /// It traces the decay chain until if finds the first particle that is different flavor from the starting one. - virtual const HepMC::GenParticle* getMother( const TruthTrajectory& traj, const int barcodeIn ) const = 0; + virtual HepMC::ConstGenParticlePtr getMother( const TruthTrajectory& traj, const int barcodeIn ) const = 0; /// Returns the ancestor particle of the particle with barcodeIn if it is found in the truth trajectory. /// Ancestor here means the last particle at generator level that has a status code different from final state, e.g. Z - virtual const HepMC::GenParticle* getAncestor( const TruthTrajectory& traj, const int barcodeIn ) const = 0; + virtual HepMC::ConstGenParticlePtr getAncestor( const TruthTrajectory& traj, const int barcodeIn ) const = 0; /// Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory. /// For example a mu undergoing a mubrem would create a second mu, in which case this method returns the mu prior to bremsstrahlung. - virtual const HepMC::GenParticle* getInitial( const TruthTrajectory& traj, const int barcodeIn ) const = 0; + virtual HepMC::ConstGenParticlePtr getInitial( const TruthTrajectory& traj, const int barcodeIn ) const = 0; /// Returns the number of steps a particle took while maintaining its PDG ID virtual unsigned int getNumberOfScatters( const TruthTrajectory& traj, const int barcodeIn ) const = 0; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.h index 879a5f3f0feac53b350af49e7dca0d217aadfdc2..9d0c6d715cdc1468544ccada1271d236c81a9372 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.h @@ -47,6 +47,7 @@ namespace Muon { using IExtendedTrackSummaryHelperTool::analyse; using IExtendedTrackSummaryHelperTool::updateSharedHitCount; + using IExtendedTrackSummaryHelperTool::updateExpectedHitInfo; using IExtendedTrackSummaryHelperTool::addDetailedTrackSummary; virtual void analyse( const Trk::Track& trk, @@ -67,10 +68,15 @@ namespace Muon { std::vector<int>& information, Trk::ParticleHypothesis hyp) const override final; - virtual void updateSharedHitCount( - const Trk::Track&, - const Trk::PRDtoTrackMap*, - Trk::TrackSummary&) const override final{}; + virtual void updateSharedHitCount(const Trk::Track&, + const Trk::PRDtoTrackMap*, + Trk::TrackSummary&) const override final + {} + + virtual void updateExpectedHitInfo( + const Trk::Track&, + Trk::TrackSummary&) const override final + {} virtual void addDetailedTrackSummary( const Trk::Track& track, diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.h index cc99d1a403c46cc1fac5df970a819ae71108decd..f45b7fc80096cd4e2d38bc189eb1e5f42ea2b6d7 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.h @@ -118,7 +118,7 @@ namespace Muon { /** @brief returns a new track with segments recovered using RegionSelector*/ Trk::Track* recover( const Trk::Track& track ) const; - void cleanUp() const; + void cleanUp() const override; private: diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx index 6d28a71a675570ec11144928866bcdd3fbdb7571..89e4df46b375ec552edeb47023848c1cb5f2d83c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx @@ -1045,7 +1045,7 @@ namespace Muon { } std::unique_ptr<MdtDriftCircleOnTrack> mdtRotFlipped; - std::unique_ptr<CompetingMuonClustersOnTrack> updatedCompRot; + std::unique_ptr<const CompetingMuonClustersOnTrack> updatedCompRot; bool flipSign = false; if( !pseudo ){ const MdtDriftCircleOnTrack* mdtRot = isMDT ? dynamic_cast<const MdtDriftCircleOnTrack*>(meas) : 0; @@ -1176,9 +1176,7 @@ namespace Muon { if( prdList.empty() ){ ATH_MSG_WARNING("No clusters selected during comprot cleaning, keeping old cluster" ); }else{ - //TODO: createBroadCluster returns a const object so a workaround is needed to get a unique pointer, this should be fixed in some fashion - CompetingMuonClustersOnTrack tempCompRot=*m_compRotCreator->createBroadCluster(prdList,0.); - updatedCompRot = std::make_unique<CompetingMuonClustersOnTrack>(tempCompRot); + updatedCompRot.reset(m_compRotCreator->createBroadCluster(prdList,0.)); ++state.numberOfCleanedCompROTs; } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.h index f6e86b22a97745d70c6eafcd6ba088b2abbcfdbe..d7f06d97874537921c547e16a69dafef9f94551b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.h @@ -62,7 +62,7 @@ namespace Muon { const Trk::TrackParameters* pars; std::unique_ptr<Trk::ResidualPull> resPull; std::unique_ptr<MdtDriftCircleOnTrack> flippedMdt; - std::unique_ptr<CompetingMuonClustersOnTrack> cleanedCompROT; + std::unique_ptr<const CompetingMuonClustersOnTrack> cleanedCompROT; const Trk::FitQuality* fitQ; MCTBCleaningInfo( const Trk::TrackStateOnSurface* orState ) : diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h index 63a85c9d75ab362cdb1cc6a090f78a14cab118ce..bda954a90c03799f6b0bd3aaad6c1908c2ecbb1f 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h @@ -152,7 +152,7 @@ namespace Muon { /** @brief return whether the 2 segments are in neighbouring chambers */ bool areInNeighbouringChambers( const MuPatSegment& seg1, const MuPatSegment& seg2 ) const; - void cleanUp() const; + void cleanUp() const override; private: diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx index 494bdac4fbc5a33f0ff865709784863a153b2ecc..51e5b6e7142bde9bc3d68ddd7bcc1f9fa8049952 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx @@ -204,6 +204,8 @@ namespace Muon { std::unique_ptr<Trk::Track> MooTrackFitter::fit( const MuPatCandidateBase& entry1, const MuPatCandidateBase& entry2, const PrepVec* externalPhiHits ) const { GarbageCan localGarbage; + MuPatHitTool::HitGarbage hitsToBeDeleted; + MuPatHitTool::ParGarbage parsToBeDeleted; ++m_nfits; @@ -211,7 +213,7 @@ namespace Muon { FitterData fitterData; // extract hits and geometrical information - if( !extractData(entry1,entry2,fitterData, localGarbage) ) { + if( !extractData(entry1,entry2,fitterData, localGarbage, parsToBeDeleted ) ) { ATH_MSG_DEBUG(" Failed to extract data for initial fit" ); localGarbage.cleanUp(); return std::unique_ptr<Trk::Track>(); @@ -238,7 +240,8 @@ namespace Muon { ++m_nfailedParsInital; // clean phi hits and reevaluate hits. Do not run for cosmics - bool hasCleaned = m_cleanPhiHits ? cleanPhiHits( startPars->momentum().mag(), fitterData, externalPhiHits, localGarbage ) : true; + bool hasCleaned = m_cleanPhiHits ? cleanPhiHits( startPars->momentum().mag(), fitterData, externalPhiHits, + localGarbage, hitsToBeDeleted, parsToBeDeleted ) : true; if( hasCleaned ){ ATH_MSG_DEBUG(" Cleaned phi hits, re-extracting hits" ); bool usePrecise = m_usePreciseHits ? true : (fitterData.firstHasMomentum || fitterData.secondHasMomentum); @@ -361,12 +364,12 @@ namespace Muon { if( track ) ++m_nsuccess; localGarbage.cleanUp(); - m_hitHandler->cleanUp(); if( msgLvl(MSG::DEBUG) && track ) msg(MSG::DEBUG) << MSG::DEBUG << " Track found " << endmsg; return track; } - bool MooTrackFitter::extractData( const MuPatCandidateBase& entry1, const MuPatCandidateBase& entry2 , MooTrackFitter::FitterData& fitterData, GarbageCan& garbage ) const { + bool MooTrackFitter::extractData( const MuPatCandidateBase& entry1, const MuPatCandidateBase& entry2 , MooTrackFitter::FitterData& fitterData, GarbageCan& garbage, + MuPatHitTool::ParGarbage& parsToBeDeleted) const { // sanity checks on the entries if( corruptEntry( entry1 ) ) { ATH_MSG_DEBUG(" corrupt first entry, cannot perform fit: eta hits " << entry1.etaHits().size() ); @@ -410,7 +413,7 @@ namespace Muon { copyHitList(entry1.hitList(),fitterData.copyHitList1,garbage); copyHitList(entry2.hitList(),fitterData.copyHitList2,garbage); - if( !m_hitHandler->merge(fitterData.copyHitList1,fitterData.copyHitList2,hitList) ) return false; + if( !m_hitHandler->merge(fitterData.copyHitList1,fitterData.copyHitList2,hitList, parsToBeDeleted) ) return false; bool usePrecise = m_usePreciseHits ? true : (fitterData.firstHasMomentum || fitterData.secondHasMomentum); if( msgLvl(MSG::DEBUG) ){ @@ -1929,7 +1932,9 @@ namespace Muon { } bool MooTrackFitter::cleanPhiHits( double momentum, MooTrackFitter::FitterData& fitterData, - const std::vector<const Trk::PrepRawData*>* patternPhiHits, GarbageCan& garbage ) const { + const std::vector<const Trk::PrepRawData*>* patternPhiHits, GarbageCan& garbage, + MuPatHitTool::HitGarbage& hitsToBeDeleted, + MuPatHitTool::ParGarbage& parsToBeDeleted) const { ATH_MSG_VERBOSE(" cleaning phi hits " ); @@ -2096,8 +2101,8 @@ namespace Muon { if( !measurementsToBeAdded.empty() ){ if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << " adding measurements " << std::endl; MuPatHitList newHitList; - m_hitHandler->create(fitterData.firstEntry->entryPars(),measurementsToBeAdded,newHitList); - m_hitHandler->merge(newHitList,fitterData.hitList); + m_hitHandler->create(fitterData.firstEntry->entryPars(),measurementsToBeAdded,newHitList, hitsToBeDeleted, parsToBeDeleted); + m_hitHandler->merge(newHitList,fitterData.hitList, parsToBeDeleted); } ATH_MSG_VERBOSE(" done cleaning " ); diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h index 70edaf1e8d5285ba9b91d08e0e79c3156b856261..28b9b5cff253950dcc0cd3f2c70e2fba01886c5b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h @@ -219,7 +219,8 @@ namespace Muon { /** extract all information needed for the fit from the track */ - bool extractData( const MuPatCandidateBase& entry1, const MuPatCandidateBase& entry2, FitterData& fitterData, GarbageCan& garbage ) const; + bool extractData( const MuPatCandidateBase& entry1, const MuPatCandidateBase& entry2, FitterData& fitterData, GarbageCan& garbage, + MuPatHitTool::ParGarbage& parsToBeDeleted) const; /** extract all information from the HitList of a FitterData object */ bool extractData( FitterData& fitterData, bool usePreciseHits ) const; @@ -262,7 +263,9 @@ namespace Muon { double thetaSeeding( const MuPatCandidateBase& entry, MeasVec& etaHits ) const; /** clean phi hits, returns true if anything happened during the cleaning */ - bool cleanPhiHits( double momentum, FitterData& phiHits, const PrepVec* patternPhiHits, GarbageCan& garbage ) const; + bool cleanPhiHits( double momentum, FitterData& phiHits, const PrepVec* patternPhiHits, GarbageCan& garbage, + MuPatHitTool::HitGarbage& hitsToBeDeleted, + MuPatHitTool::ParGarbage& parsToBeDeleted) const; /** check whether mometum of start parameter is ok */ bool validMomentum( const Trk::TrackParameters& pars ) const; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx index b3364b7abc584959de22c58bb0a61d4d1be7c6f1..086c1b5be455e0765c219ecc14468ad53db5893b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.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 "MuPatCandidateTool.h" @@ -63,6 +63,8 @@ namespace Muon { MuPatSegment* MuPatCandidateTool::createSegInfo( const MuonSegment& segment ) const { + CacheEntry& ent = getCache(); + Identifier chid = m_edmHelperSvc->chamberId(segment); if( m_idHelperSvc->isTrigger(chid) ){ ATH_MSG_WARNING("Trigger hit only segments not supported " << m_idHelperSvc->toStringChamber(chid) ); @@ -100,7 +102,8 @@ namespace Muon { updateHits(*info,info->segment->containedMeasurements(),m_doMdtRecreation,m_doCscRecreation, true ); MuPatHitList& hitList = info->hitList(); - m_hitHandler->create( segment, hitList ); + m_hitHandler->create( segment, hitList, + ent.m_hitsToBeDeleted, ent.m_parsToBeDeleted ); return info; } @@ -156,13 +159,7 @@ namespace Muon { void MuPatCandidateTool::updateHits( MuPatCandidateBase& entry, const MuPatCandidateTool::MeasVec& measurements, bool recreateMDT, bool recreateCSC, bool createComp ) const { - std::lock_guard<std::mutex> lock{m_mutex}; - const EventContext& ctx = Gaudi::Hive::currentContext(); - CacheEntry* ent{m_cache.get(ctx)}; - if (ent->m_evt != ctx.evt()) { - ent->m_evt = ctx.evt(); - ent->cleanUp(); - } + CacheEntry& ent = getCache(); MeasVec etaHits; MeasVec phiHits; @@ -239,7 +236,7 @@ namespace Muon { } ATH_MSG_DEBUG(" recreating MdtDriftCircleOnTrack " ); const MdtDriftCircleOnTrack* newMdt = m_mdtRotCreator->createRIO_OnTrack(*mdt->prepRawData(),mdt->globalPosition()); - ent->m_measurementsToBeDeleted.push_back(newMdt); + ent.m_measurementsToBeDeleted.push_back(newMdt); meas = newMdt; } } @@ -282,7 +279,7 @@ namespace Muon { } ATH_MSG_DEBUG(" recreating CscClusterOnTrack " ); const MuonClusterOnTrack* newCsc = m_cscRotCreator->createRIO_OnTrack(*csc->prepRawData(),csc->globalPosition()); - ent->m_measurementsToBeDeleted.push_back(newCsc); + ent.m_measurementsToBeDeleted.push_back(newCsc); meas = newCsc; } @@ -313,8 +310,8 @@ namespace Muon { } if( createComp ){ - if( m_createCompetingROTsEta && !triggerHitsEta.empty() ) createAndAddCompetingROTs(triggerHitsEta, etaHits, allHits, ent->m_measurementsToBeDeleted); - if( m_createCompetingROTsPhi && !triggerHitsPhi.empty() ) createAndAddCompetingROTs(triggerHitsPhi, phiHits, allHits, ent->m_measurementsToBeDeleted); + if( m_createCompetingROTsEta && !triggerHitsEta.empty() ) createAndAddCompetingROTs(triggerHitsEta, etaHits, allHits, ent.m_measurementsToBeDeleted); + if( m_createCompetingROTsPhi && !triggerHitsPhi.empty() ) createAndAddCompetingROTs(triggerHitsPhi, phiHits, allHits, ent.m_measurementsToBeDeleted); } entry.nmdtHitsMl1 = nmdtHitsMl1; @@ -435,6 +432,8 @@ namespace Muon { bool MuPatCandidateTool::recalculateCandidateSegmentContent( MuPatTrack& candidate ) const { + CacheEntry& ent = getCache(); + // loop over track and get the chambers on the track const DataVector<const Trk::TrackStateOnSurface>* states = candidate.track().trackStateOnSurfaces(); if( !states ) return false; @@ -485,7 +484,8 @@ namespace Muon { // recalculate hit list candidate.hitList().clear(); - m_hitHandler->create( candidate.track(),candidate.hitList() ); + m_hitHandler->create( candidate.track(),candidate.hitList(), + ent.m_hitsToBeDeleted ); // update the hit summary updateHits(candidate,candidate.track().measurementsOnTrack()->stdcont()); @@ -528,14 +528,8 @@ namespace Muon { void MuPatCandidateTool::cleanUp() const { // delete segments and clear vector - std::lock_guard<std::mutex> lock{m_mutex}; - const EventContext& ctx = Gaudi::Hive::currentContext(); - CacheEntry* ent{m_cache.get(ctx)}; - if (ent->m_evt != ctx.evt()) { - ent->m_evt = ctx.evt(); - } - m_hitHandler->cleanUp(); - ent->cleanUp(); + CacheEntry& ent = getCache(); + ent.cleanUp(); } std::string MuPatCandidateTool::print( const MuPatSegment& segment, int level ) const { @@ -595,5 +589,16 @@ namespace Muon { return "Unknown candidate type"; } + MuPatCandidateTool::CacheEntry& MuPatCandidateTool::getCache() const + { + const EventContext& ctx = Gaudi::Hive::currentContext(); + CacheEntry* ent{m_cache.get(ctx)}; + if (ent->m_evt != ctx.evt()) { + ent->m_evt = ctx.evt(); + ent->cleanUp(); + } + return *ent; + } + } // namespace Muon diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.h index d4943d12c82b8d46b7fed6a05bb36bb60b735beb..9408b03df006abd7444dad72da8a6ba1340789d7 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatCandidateTool.h @@ -180,11 +180,14 @@ namespace Muon { Gaudi::Property<bool> m_doCscRecreation {this,"DoCscRecreation" , true }; // Mutex to protect the contents. - mutable std::mutex m_mutex{}; struct CacheEntry { EventContext::ContextEvt_t m_evt{EventContext::INVALID_CONTEXT_EVT}; MeasVec m_measurementsToBeDeleted{}; //<! vector to store measurements owned by the track maker + MuPatHitTool::HitGarbage m_hitsToBeDeleted; + MuPatHitTool::ParGarbage m_parsToBeDeleted; void cleanUp() { // Delete measurements to be deleted now + m_hitsToBeDeleted.clear(); + m_parsToBeDeleted.clear(); std::for_each( m_measurementsToBeDeleted.begin(), m_measurementsToBeDeleted.end(), MuonDeleteObject<const Trk::MeasurementBase>() ); m_measurementsToBeDeleted.clear(); }; @@ -193,7 +196,7 @@ namespace Muon { } }; mutable SG::SlotSpecificObj<CacheEntry> m_cache ATLAS_THREAD_SAFE; // Guarded by m_mutex - + CacheEntry& getCache() const; }; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHit.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHit.cxx index fa46e1a6402d01fb75f1e070dc650c34dc7e1ba9..b2c20352cb4dd05f2e212057c42da3b9eb2fa355 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHit.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHit.cxx @@ -13,9 +13,9 @@ namespace Muon { // Static members - unsigned int MuPatHit::s_maxNumberOfInstantiations = 0; - unsigned int MuPatHit::s_numberOfInstantiations = 0; - unsigned int MuPatHit::s_numberOfCopies = 0; + std::atomic<unsigned int> MuPatHit::s_maxNumberOfInstantiations; + std::atomic<unsigned int> MuPatHit::s_numberOfInstantiations = 0; + std::atomic<unsigned int> MuPatHit::s_numberOfCopies = 0; // Static functions @@ -44,7 +44,6 @@ namespace Muon { MuPatHit& MuPatHit::operator=( const MuPatHit& hit ) { if( &hit != this ){ - cleanUp(); copy(hit); #ifdef MCTB_OBJECT_COUNTERS ++s_numberOfCopies; @@ -55,7 +54,6 @@ namespace Muon { MuPatHit::~MuPatHit() { // std::cout << " delete MuPatHit " << this << std::endl; - cleanUp(); #ifdef MCTB_OBJECT_COUNTERS removeInstance(); #endif @@ -64,14 +62,10 @@ namespace Muon { void MuPatHit::copy( const MuPatHit& hit ){ m_pars = hit.m_pars; m_precisionMeas = hit.m_precisionMeas; - m_broadMeas = hit.m_broadMeas->clone(); + m_broadMeas.reset (hit.m_broadMeas->clone()); m_info = hit.m_info; } - void MuPatHit::cleanUp(){ - delete m_broadMeas; - } - void MuPatHit::updateParameters( const Trk::TrackParameters* pars ) { // if( pars ) std::cout << " update pars " << this << " theta " << pars->momentum().theta() << " phi " << pars->momentum().phi() << std::endl; m_pars = pars; diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHit.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHit.h index 88334379a838a20d4b71edb6180565a895e47638..72b412af5fc7386f5eb2bf585ade62e6708773b9 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHit.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHit.h @@ -7,6 +7,7 @@ #include "Identifier/Identifier.h" #include "TrkParameters/TrackParameters.h" +#include "CxxUtils/atomic_fetch_minmax.h" #include <list> #include <mutex> @@ -82,18 +83,12 @@ namespace Muon { /** @brief update the track parameters and residual of a MuPatHit */ void updateParameters( const Trk::TrackParameters* pars ); - /** @brief reset the maximum number of objects counter */ - static void resetMaxNumberOfInstantiations(); - /** @brief maximum number of objects of this type in memory */ static unsigned int maxNumberOfInstantiations(); /** current number of objects of this type in memory */ static unsigned int numberOfInstantiations(); - /** @brief reset the copy constructor counter */ - static void resetNumberOfCopies(); - /** @brief number of times the copy constructor was called since last reset */ static unsigned int numberOfCopies(); @@ -110,21 +105,15 @@ namespace Muon { // // private static data members // - static unsigned int s_numberOfInstantiations ATLAS_THREAD_SAFE; //<! current number of objects of this type in memory - static unsigned int s_maxNumberOfInstantiations ATLAS_THREAD_SAFE; //<! maximum number of objects of this type in memory - static unsigned int s_numberOfCopies ATLAS_THREAD_SAFE; //<! number of times the copy constructor was called since last reset - - static std::mutex s_mutex; //<! to remove race condition + static std::atomic<unsigned int> s_numberOfInstantiations; //<! current number of objects of this type in memory + static std::atomic<unsigned int> s_maxNumberOfInstantiations; //<! maximum number of objects of this type in memory + static std::atomic<unsigned int> s_numberOfCopies; //<! number of times the copy constructor was called since last reset // // private member functions // /** no default constructor */ - MuPatHit() : m_pars(0),m_precisionMeas(0),m_broadMeas(0) { } - - /** @brief clean memory */ - void cleanUp(); - + MuPatHit() = delete; /** @brief copy hit */ void copy( const MuPatHit& hit ); @@ -132,7 +121,7 @@ namespace Muon { // private member data const Trk::TrackParameters* m_pars; const Trk::MeasurementBase* m_precisionMeas; - const Trk::MeasurementBase* m_broadMeas; + std::unique_ptr<const Trk::MeasurementBase> m_broadMeas; Info m_info; }; // class MuPatHit @@ -151,48 +140,25 @@ namespace Muon { // static inline functions implementations // inline unsigned int MuPatHit::numberOfInstantiations() { - const std::lock_guard<std::mutex> lock(s_mutex); - return s_numberOfInstantiations; } inline unsigned int MuPatHit::maxNumberOfInstantiations() { - const std::lock_guard<std::mutex> lock(s_mutex); - return s_maxNumberOfInstantiations; } inline unsigned int MuPatHit::numberOfCopies() { - const std::lock_guard<std::mutex> lock(s_mutex); - return s_numberOfCopies; } inline void MuPatHit::addInstance() { - const std::lock_guard<std::mutex> lock(s_mutex); - ++s_numberOfInstantiations; - if ( s_numberOfInstantiations > s_maxNumberOfInstantiations ) { - s_maxNumberOfInstantiations = s_numberOfInstantiations; - } + CxxUtils::atomic_fetch_max (&s_maxNumberOfInstantiations, + s_numberOfInstantiations.load()); } inline void MuPatHit::removeInstance() { - const std::lock_guard<std::mutex> lock(s_mutex); - - if ( s_numberOfInstantiations > 0 ) --s_numberOfInstantiations; - } - - inline void MuPatHit::resetMaxNumberOfInstantiations() { - const std::lock_guard<std::mutex> lock(s_mutex); - - s_maxNumberOfInstantiations = 0; - } - - inline void MuPatHit::resetNumberOfCopies() { - const std::lock_guard<std::mutex> lock(s_mutex); - - s_numberOfCopies = 0; + --s_numberOfInstantiations; } // diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.cxx index 5e9e715ad98748e22c77aef6b24930b57b6957a5..1d6169030993e211695740f424506b53858237bd 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.cxx @@ -55,10 +55,6 @@ MuPatHitTool::initialize() ATH_CHECK(m_pullCalculator.retrieve()); ATH_CHECK(m_propagator.retrieve()); - // reserve space to store hits - m_hitsToBeDeleted.reserve(1000); - m_parsToBeDeleted.reserve(1000); - return StatusCode::SUCCESS; } @@ -69,28 +65,6 @@ MuPatHitTool::finalize() return StatusCode::SUCCESS; } -void -MuPatHitTool::cleanUp() const -{ - { - const std::lock_guard<std::mutex> lock(m_hitsMutex); - - for (auto ptr : m_hitsToBeDeleted) { - delete ptr; - } - m_hitsToBeDeleted.clear(); - } - - { - const std::lock_guard<std::mutex> lock(m_parsMutex); - - for (auto ptr : m_parsToBeDeleted) { - delete ptr; - } - m_parsToBeDeleted.clear(); - } -} - bool MuPatHitTool::insert(MuPatHit* /*hit*/, MuPatHitList& /*hitList*/) const { @@ -98,7 +72,9 @@ MuPatHitTool::insert(MuPatHit* /*hit*/, MuPatHitList& /*hitList*/) const } bool -MuPatHitTool::create(const MuonSegment& seg, MuPatHitList& hitList) const +MuPatHitTool::create(const MuonSegment& seg, MuPatHitList& hitList, + HitGarbage& hitsToBeDeleted, + ParGarbage& parsToBeDeleted) const { ATH_MSG_DEBUG(" creating hit list from segment " << std::endl << m_printer->print(seg)); @@ -111,7 +87,8 @@ MuPatHitTool::create(const MuonSegment& seg, MuPatHitList& hitList) const return false; } - bool result = create(*pars, seg.containedMeasurements(), hitList); + bool result = create(*pars, seg.containedMeasurements(), hitList, + hitsToBeDeleted, parsToBeDeleted); // clean up pars delete pars; @@ -121,7 +98,9 @@ MuPatHitTool::create(const MuonSegment& seg, MuPatHitList& hitList) const bool MuPatHitTool::create(const Trk::TrackParameters& pars, const std::vector<const Trk::MeasurementBase*>& measVec, - MuPatHitList& hitList) const + MuPatHitList& hitList, + HitGarbage& hitsToBeDeleted, + ParGarbage& parsToBeDeleted) const { // store position of the current hit to speed up insertion MuPatHitIt currentHitIt = hitList.begin(); @@ -171,25 +150,22 @@ MuPatHitTool::create(const Trk::TrackParameters& pars, const std::vector<const T } if (exPars) { - const std::lock_guard<std::mutex> lock(m_parsMutex); - m_parsToBeDeleted.push_back(exPars); + parsToBeDeleted.emplace_back (exPars); } // create hit and insert it into list - MuPatHit* hit = new MuPatHit(exPars, *sit, broadMeas, hitInfo); - { - const std::lock_guard<std::mutex> lock(m_hitsMutex); - m_hitsToBeDeleted.push_back(hit); - } + auto hit = std::make_unique<MuPatHit>(exPars, *sit, broadMeas, hitInfo); ATH_MSG_VERBOSE(" inserting hit " << m_idHelperSvc->toString(id) << " " << m_printer->print(*exPars)); - currentHitIt = insert(hitList, currentHitIt, hit); + currentHitIt = insert(hitList, currentHitIt, hit.get()); + hitsToBeDeleted.push_back (std::move (hit)); } return true; } bool -MuPatHitTool::create(const Trk::Track& track, MuPatHitList& hitList) const +MuPatHitTool::create(const Trk::Track& track, MuPatHitList& hitList, + HitGarbage& hitsToBeDeleted) const { // store position of the current hit to speed up insertion MuPatHitIt currentHitIt = hitList.begin(); @@ -238,34 +214,33 @@ MuPatHitTool::create(const Trk::Track& track, MuPatHitList& hitList) const // create hit and insert it into list - MuPatHit* hit = new MuPatHit(pars, meas, broadMeas, hitInfo); - { - const std::lock_guard<std::mutex> lock(m_hitsMutex); - m_hitsToBeDeleted.push_back(hit); - } + auto hit = std::make_unique<MuPatHit>(pars, meas, broadMeas, hitInfo); if (msgLvl(MSG::VERBOSE)) { msg(MSG::VERBOSE) << " inserting hit " << m_printer->print(*meas); if (hitInfo.status == MuPatHit::Outlier) msg(MSG::VERBOSE) << " Outlier"; msg(MSG::VERBOSE) << endmsg; } - currentHitIt = insert(hitList, currentHitIt, hit); + currentHitIt = insert(hitList, currentHitIt, hit.get()); + hitsToBeDeleted.push_back (std::move (hit)); } return true; } bool -MuPatHitTool::merge(const MuPatHitList& hitList1, const MuPatHitList& hitList2, MuPatHitList& outList) const +MuPatHitTool::merge(const MuPatHitList& hitList1, const MuPatHitList& hitList2, MuPatHitList& outList, + ParGarbage& parsToBeDeleted) const { // copy first list into outList outList = hitList1; - return merge(hitList2, outList); + return merge(hitList2, outList, parsToBeDeleted); } bool -MuPatHitTool::merge(const MuPatHitList& hitList1, MuPatHitList& hitList2) const +MuPatHitTool::merge(const MuPatHitList& hitList1, MuPatHitList& hitList2, + ParGarbage& parsToBeDeleted) const { // The hits in the first list are most likely expressed with respect to a different set of track parameters // as the ones in the second list. They cannot be merged. To allow merging a new set of track parameters is @@ -347,11 +322,8 @@ MuPatHitTool::merge(const MuPatHitList& hitList1, MuPatHitList& hitList2) const } } - { - const std::lock_guard<std::mutex> lock(m_parsMutex); - m_parsToBeDeleted.push_back(exPars); - } hit->updateParameters(exPars); + parsToBeDeleted.emplace_back (exPars); } } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.h index 4c732d8fb16d99a190faee00a732fdde5948d883..a0894be056326f154815b0ff0bc457fa3f33c9e4 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuPatHitTool.h @@ -38,6 +38,9 @@ static const InterfaceID IID_MuPatHitTool("Muon::MuPatHitTool", 1, 0); class MuPatHitTool : public AthAlgTool { public: + using HitGarbage = std::vector<std::unique_ptr<MuPatHit> >; + using ParGarbage = std::vector<std::unique_ptr<const Trk::TrackParameters> >; + /** default AlgTool constructor */ MuPatHitTool(const std::string&, const std::string&, const IInterface*); @@ -68,14 +71,17 @@ class MuPatHitTool : public AthAlgTool { @param hitList the list to be filled @return true if creation succeded */ - bool create(const MuonSegment& seg, MuPatHitList& hitList) const; + bool create(const MuonSegment& seg, MuPatHitList& hitList, + HitGarbage& hitsToBeDeleted, + ParGarbage& parsToBeDeleted) const; /** @brief create a MuPatHitList from a Track @param track the input track @param hitList the list to be filled @return true if creation succeded */ - bool create(const Trk::Track& track, MuPatHitList& hitList) const; + bool create(const Trk::Track& track, MuPatHitList& hitList, + HitGarbage& hitsToBeDeleted) const; /** @brief create a MuPatHitList from a Track @param pars the input parameters @@ -84,7 +90,9 @@ class MuPatHitTool : public AthAlgTool { @return true if creation succeded */ bool create(const Trk::TrackParameters& pars, const std::vector<const Trk::MeasurementBase*>& measVec, - MuPatHitList& hitList) const; + MuPatHitList& hitList, + HitGarbage& hitsToBeDeleted, + ParGarbage& parsToBeDeleted) const; /** @brief merge two MuPatHitLists into a new one @param hitList1 the first list @@ -92,14 +100,16 @@ class MuPatHitTool : public AthAlgTool { @param outList the resulting list @return true if merge succeded */ - bool merge(const MuPatHitList& hitList1, const MuPatHitList& hitList2, MuPatHitList& outList) const; + bool merge(const MuPatHitList& hitList1, const MuPatHitList& hitList2, MuPatHitList& outList, + ParGarbage& parsToBeDeleted) const; /** @brief merge two MuPatHitLists into a new one. The first list will be added to the second @param hitList1 the first list @param hitList2 the second list @return true if merge succeded */ - bool merge(const MuPatHitList& hitList1, MuPatHitList& hitList2) const; + bool merge(const MuPatHitList& hitList1, MuPatHitList& hitList2, + ParGarbage& parsToBeDeleted) const; /** @brief extract a sorted vector of MeasurementBase objects @param hitList the input list @@ -127,9 +137,6 @@ class MuPatHitTool : public AthAlgTool { /** update hit list for a give track */ bool update(const Trk::Track& track, MuPatHitList& hitList) const; - /** clean up MCTB hits allocated up to now */ - void cleanUp() const; - /** @brief print data part of Muon MeasurementBase to string. * * This really belongs in MuonEDMPrinterTool in package MuonRecHelperTools. @@ -211,11 +218,6 @@ class MuPatHitTool : public AthAlgTool { }; //<! multipurpose helper tool Trk::MagneticFieldProperties m_magFieldProperties; //!< magnetic field properties - - mutable std::vector<MuPatHit*> m_hitsToBeDeleted ATLAS_THREAD_SAFE; - mutable std::vector<const Trk::TrackParameters*> m_parsToBeDeleted ATLAS_THREAD_SAFE; - mutable std::mutex m_hitsMutex; - mutable std::mutex m_parsMutex; }; } // namespace Muon diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h index 1907efe70c64d95b8239049f19bbdccfb2685d3f..676489ed3dabebba08dbfc4566455c704097ea62 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h @@ -104,7 +104,7 @@ namespace Muon { TrackCollection* findTracks( SegColVec& chamberSegments, SegColVec& stationSegments ) const; bool extractSegments( const MuonSegmentCollection& coll, SegColVec& chamberSegments, SegColVec& stationSegments, ChSet& chambersWithSegments, StSet& stationsWithSegments ) const; - void cleanUp() const; + virtual void cleanUp() const override; StatusCode decodeStrategyVector(const std::vector<std::string>& strategy); const MuonTrackSteeringStrategy* decodeStrategy(const std::string& strategy) const; diff --git a/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h b/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h index c800bb4d8b067c40ce4e808198781b89a12e567a..d755688f54de5668a14487f48a4b2c8f27dfb5a6 100644 --- a/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h +++ b/MuonSpectrometer/MuonTruthAlgs/MuonTruthAlgs/MuonTrackTruthTool.h @@ -91,16 +91,16 @@ namespace Muon { /// Returns the mother particle of the particle with barcodeIn if it is found in the truth trajectory. /// It traces the decay chain until if finds the first particle that is different flavor from the starting one. - const HepMC::GenParticle* getMother( const TruthTrajectory& traj, const int barcodeIn ) const; + HepMC::ConstGenParticlePtr getMother( const TruthTrajectory& traj, const int barcodeIn ) const; /// Returns the ancestor particle of the particle with barcodeIn if it is found in the truth trajectory. /// Ancestor here means the last particle at generator level that has a status code different from final state, e.g. Z - const HepMC::GenParticle* getAncestor( const TruthTrajectory& traj, const int barcodeIn ) const; + HepMC::ConstGenParticlePtr getAncestor( const TruthTrajectory& traj, const int barcodeIn ) const; /// Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory. /// For example a mu undergoing a mubrem would create a second mu, in which case this method returns the mu prior to bremsstrahlung. /// This interface calls the method getInitialPair. - const HepMC::GenParticle* getInitial( const TruthTrajectory& traj, const int barcodeIn ) const; + HepMC::ConstGenParticlePtr getInitial( const TruthTrajectory& traj, const int barcodeIn ) const; /// Returns the number of steps a particle took while maintaining its PDG ID. /// This method calls getInitialPair for calculating this number. @@ -137,7 +137,7 @@ namespace Muon { /// Returns the initial particle of the particle with barcodeIn if it is found in the truth trajectory. /// For example a mu undergoing a mubrem would create a second mu, in which case this method returns the mu prior to bremsstrahlung. /// The number of such scatters is returned in the .second. - const std::pair<const HepMC::GenParticle*, unsigned int> getInitialPair( const TruthTrajectory& traj, const int barcodeIn ) const; + const std::pair<HepMC::ConstGenParticlePtr, unsigned int> getInitialPair( const TruthTrajectory& traj, const int barcodeIn ) const; const MuonGM::MuonDetectorManager* m_detMgr; diff --git a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionExprParser.cxx b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionExprParser.cxx index c15925fae605b70880c247e1c3d124fd8ef040d2..235a4bd001e9bd677f17b95b7d753583f53bb08e 100644 --- a/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionExprParser.cxx +++ b/PhysicsAnalysis/Algorithms/SelectionHelpers/Root/SelectionExprParser.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 "SelectionHelpers/SelectionExprParser.h" @@ -45,7 +45,7 @@ bool Separator::operator()(std::string::const_iterator& next, return true; } -Lexer::Lexer(const std::string& s) : m_string(s), m_tokenizer(s, {}) { +Lexer::Lexer(const std::string& s) : m_string(s), m_tokenizer(m_string, {}) { m_iterator = m_tokenizer.begin(); } diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/CMakeLists.txt b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..c2c6a30568d525bb749ef237540bca297c679296 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/CMakeLists.txt @@ -0,0 +1,53 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +# Declare the package name: +atlas_subdir( EGammaVariableCorrection ) + +# External dependencies: +find_package( ROOT COMPONENTS Core MathCore Hist Graph RIO ) + +# Component(s) in the package: +atlas_add_library( EGammaVariableCorrectionLib + EGammaVariableCorrection/*.h + Root/*.cxx + PUBLIC_HEADERS EGammaVariableCorrection + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools EgammaAnalysisInterfacesLib EgammaAnalysisHelpersLib + PRIVATE_LINK_LIBRARIES PathResolver xAODEgamma xAODEventShape) + +if( NOT XAOD_STANDALONE ) + atlas_add_component( EGammaVariableCorrection + src/components/*.cxx + LINK_LIBRARIES EGammaVariableCorrectionLib ) +endif() + +atlas_add_dictionary( ElectronPhotonVariableCorrectionDict + EGammaVariableCorrection/ElectronPhotonVariableCorrectionDict.h + EGammaVariableCorrection/selection.xml + LINK_LIBRARIES EGammaVariableCorrectionLib ) + +# Add tests +if( XAOD_STANDALONE ) + atlas_add_executable( Test_ElectronPhotonVariableCorrectionBase + util/testElectronPhotonVariableCorrectionBase.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} EGammaVariableCorrectionLib) + + atlas_add_executable( Test_IsoCorrection + util/testIsoCorrection.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} IsolationCorrectionsLib EGammaVariableCorrectionLib) + + atlas_add_executable( Test_ElectronPhotonVariableCorrectionTool + util/testElectronPhotonVariableCorrectionTool.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} EGammaVariableCorrectionLib) +endif() + +atlas_add_executable( Test_ElectronPhotonVariableCorrectionTool_DictionaryToolHandle + util/testElectronPhotonVariableCorrectionTool_DictionaryToolHandle.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} EGammaVariableCorrectionLib) + +# Install files from the package: +atlas_install_data( data/*.conf ) diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase.h b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase.h new file mode 100644 index 0000000000000000000000000000000000000000..cf0fdb16fbfd02230f032aa20af5bff283c43dcd --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase.h @@ -0,0 +1,287 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ElectronPhotonVariableCorrectionBase_H +#define ElectronPhotonVariableCorrectionBase_H + +/** @class ElectronPhotonVariableCorrectionBase + * @brief Class to correct electron and photon MC variables. + * @details For a detailed documentation, please refer to the [gitlab readme](https://gitlab.cern.ch/atlas/athena/-/blob/21.2/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/README.md) + * + * @author Nils Gillwald (DESY) nils.gillwald@desy.de + * @date February 2020 +*/ + +//ATLAS includes +#include "AsgTools/AsgTool.h" +#include "PATInterfaces/CorrectionCode.h" + +//EDM includes +#include "xAODEgamma/Electron.h" +#include "xAODEgamma/Photon.h" + +//Root includes +#include "TF1.h" + +// forward declarations +class TGraph; +class TEnv; + +// =========================================================================== +// Class ElectronPhotonVariableCorrectionBase +// =========================================================================== + +class ElectronPhotonVariableCorrectionBase : public asg::AsgTool +{ + +public: + /** @brief Standard constructor + * @param myname Internal name of the class instance, so they can be distinguished + */ + ElectronPhotonVariableCorrectionBase(const std::string& myname); + //! @brief Standard destructor + ~ElectronPhotonVariableCorrectionBase() {}; + + /** @brief Initialize the class instance + * @details Reads out the configuration file set via the setProperty(ConfigFile, "/path/to/conf/file.conf") function + * and sets up the class instance accordingly + */ + virtual StatusCode initialize() override; + + /** @brief Apply the correction given in the conf file to the passed photon + * @param photon The photon which should be corrected + * @details Pass a photon which should be corrected by the tool to this function. The tool gets the original photon variable value, + * corrects it according to the configuration file given, and overwrites the original value of the variable. The original variable + * is saved as <variable_name>_original. Note that the variable to be corrected should be an auxiliary variable, and that the photon + * or photon container, respectively, must not be const if you want to use this function. If you are running on const objects, please + * make a deep / shallow copy of the container or use the correctedCopy function of this class. + */ + const CP::CorrectionCode applyCorrection( xAOD::Photon& photon ) const; + + /** @brief Apply the correction given in the conf file to the passed electron + * @param electron The electron which should be corrected + * @details Pass an electron which should be corrected by the tool to this function. The tool gets the original electron variable value, + * corrects it according to the configuration file given, and overwrites the original value of the variable. The original variable + * is saved as <variable_name>_original. Note that the variable to be corrected should be an auxiliary variable, and that the electron + * or electron container, respectively, must not be const if you want to use this function. If you are running on const objects, please + * make a deep / shallow copy of the container or use the correctedCopy function of this class. + */ + const CP::CorrectionCode applyCorrection( xAOD::Electron& electron ) const; + + /** @brief Make a corrected copy of the passed photon according to the given conf file + * @param in_photon The original photon of which a corrected copy should be made + * @param out_photon Empty new photon where the corrected copy will be stored in + * @details Makes a corrected copy of the passed photon object according to the correction provided in the configuration file. The in_photon + * is copied to the out_photon, which is then passed to the applyCorrection function. + */ + const CP::CorrectionCode correctedCopy( const xAOD::Photon& in_photon, xAOD::Photon*& out_photon ) const; + + /** @brief Make a corrected copy of the passed electron according to the given conf file + * @param in_electron The original electron of which a corrected copy should be made + * @param out_electron Empty new electron where the corrected copy will be stored in + * @details Makes a corrected copy of the passed electron object according to the correction provided in the configuration file. The in_electron + * is copied to the out_electron, which is then passed to the applyCorrection function. + */ + const CP::CorrectionCode correctedCopy( const xAOD::Electron& in_electron, xAOD::Electron*& out_electron) const; + + //! @brief Returns the variable which should be corrected according to the passed configuration file + const std::string getCorrectionVariable() { return m_correctionVariable; }; + + /** @brief Define the categories of EGamma objects tool can be applied to + * @details The tool can be applied to electrons and photons, but the latter could also have different corrections according to whether they are + * converted or unconverted photons. The categories are designed in such a way, that the analyzer can freely choose whether he_she_* wants all objects + * (i.e. e and y) to be corrected in the same way, or wheter he_she_* wants to apply different corrections to different types of objects. + */ + enum class EGammaObjects{ + Failure = 0, + unconvertedPhotons = 1, + convertedPhotons, + allPhotons, + allElectrons, + allEGammaObjects + }; //end enum EGammaObjects + + //! @brief Returns the type of EGamma object to which the correction should be applied. + ElectronPhotonVariableCorrectionBase::EGammaObjects isAppliedTo() { return m_applyToObjects; }; + + /** @brief Check if the ApplyTo flag passed in the conf file is compatible with converted photons + * @return True if the ApplyTo flag is compatible, False if not + */ + bool applyToConvertedPhotons() const; + + /** @brief Check if the ApplyTo flag passed in the conf file is compatible with uconverted photons + * @return True if the ApplyTo flag is compatible, False if not + */ + bool applyToUnconvertedPhotons() const; + + /** @brief Check if the ApplyTo flag passed in the conf file is compatible with electrons + * @return True if the ApplyTo flag is compatible, False if not + */ + bool applyToElectrons() const; //check if passed flag is compatible with electron + +private: + //! @brief Use enum and not string for type of function parameter in order to do faster comparisons + enum class parameterType{ + Failure = 0, + EtaDependentTGraph = 1, + PtDependentTGraph, + EtaBinned, + PtBinned, + EtaTimesPtBinned, + EventDensity + }; // end enum ParameterType + //! @brief The name of the configuration file + std::string m_configFile; + //! @brief The name of the variable to correct + std::string m_correctionVariable; + //! @brief Values of discontinuities in the variable which should not be corrected + std::vector<float> m_uncorrectedDiscontinuities; + //! @brief Function to use for the variable correction, TF1 style + std::string m_correctionFunctionString; + //! @brief The actual TF1 correction function + std::unique_ptr<TF1> m_correctionFunctionTF1; + //! @brief Number of parameters of the variable correction function + int m_numberOfFunctionParameters; + //! @brief Map of the correction function parameter number to the parameter type + std::vector<parameterType> m_ParameterTypeVector; + //! @brief Copy of the TGraph from the root file, stored if needed by the respective correction function parameter + std::vector<TGraph*> m_graphCopies; + //! @brief List of eta/pt dependent values, stored if needed by the respective correction function parameter + std::vector<std::vector<float>> m_binValues; + //! @brief List of bin boundaries in eta, stored if needed by any correction function parameter + std::vector<float> m_etaBins; + //! @brief List of bin boundaries in pT, stored if needed by any correction function parameter + std::vector<float> m_ptBins; + //! @brief List of bools whether a parameter should use linear interpolation in pT if it's some kind of pT binned parameter + std::vector<bool> m_interpolatePtFlags; + //! @brief The type of objects to which the specific conf file settings are allowed to be applied to + ElectronPhotonVariableCorrectionBase::EGammaObjects m_applyToObjects; + //! @brief Store if already retrieved eta binning + bool m_retrievedEtaBinning = false; + //! @brief Store if already retrieved pt binning + bool m_retrievedPtBinning = false; + //! @brief Accessor for the variable to be corrected + std::unique_ptr<SG::AuxElement::Accessor<float>> m_variableToCorrect; + //! @brief Accessor to store the original value of the corrected variable + std::unique_ptr<SG::AuxElement::Accessor<float>> m_originalVariable; + + /** @brief Convert input string to a parameter function type + * @param input The string to convert to ElectronPhotonVariableCorrectionBase::parameterType + * @return ElectronPhotonVariableCorrectionBase::parameterType, returns ElectronPhotonVariableCorrectionBase::parameterType::Failure if no match found + */ + ElectronPhotonVariableCorrectionBase::parameterType stringToParameterType( const std::string& input ) const; + + /** @brief Convert input string to egamma object type + * @param input The string to convert to ElectronPhotonVariableCorrectionBase::EGammaObjects + * @return ElectronPhotonVariableCorrectionBase::EGammaObjects, returns ElectronPhotonVariableCorrectionBase::EGammaObjects::Failure if no match found + */ + ElectronPhotonVariableCorrectionBase::EGammaObjects stringToEGammaObject( const std::string& input ) const; + + /** @brief Check if the photon which was passed to the tool has the correct type, if only (un)converted photons were requested to be corrected + * @param photon The photon which was passed to the tool to be corrected + */ + bool passedCorrectPhotonType(const xAOD::Photon& photon) const; + + /** @brief Check if the value passed is equal to one of the values passed via the UncorrectedDiscontinuites flag and should thus not be corrected + * @param value The value which should be checked + */ + bool isEqualToUncorrectedDiscontinuity(const float value) const; + + /** @brief Get the relevant information for a correction function parameter from the given conf file + * @param env The given TEnv, which is used to read out the current conf file + * @param parameter_number The parameter number with respect to the m_correctionFunctionTF1 + * @param type The type of the respective parameter with this parameter_number + * @details The relevant information for the parameter with the given parameter number and given parameter type is retrieved from the current configuration + * file, and saved in the according member variables of the class, i.e. m_graphCopies, m_binValues, m_etaBins, m_ptBins + */ + const StatusCode getParameterInformationFromConf(TEnv& env, const int parameter_number, const ElectronPhotonVariableCorrectionBase::parameterType type); + + /** @brief Get the actual parameters entering the correction TF1 for the current e/y object to be corrected + * @param properties The vector where the values of the correction TF1 parameters will be saved in + * @param pt The pT of the current e/y object to be corrected + * @param absEta The absolute eta of the current e/y object to be corrected + * @details As every electron/photon has different values of pT/eta, the correction function must be adapted accordingly for every e/y. The according values of + * each of the correction function parameters are updated with this function. + */ + const StatusCode getCorrectionParameters(std::vector<float>& properties, const float pt, const float absEta) const; + + /** @brief Get the correction function parameter value if its type is eta- or pT-binned + * @param return_parameter_value The respective correction function parameter value is saved in this parameter + * @param evalPoint pT or eta evaluation point - i.e., the eta or pT value of the current e/y object to be corrected. Used to find the correct eta/pT bin to use for the correction + * @param binning The eta or pT binning + * @param parameter_number The number of the parameter with respect to the correction TF1. Needed in order to retrieve the correct values matching this parameter. + */ + const StatusCode get1DBinnedParameter(float& return_parameter_value, const float evalPoint, const std::vector<float>& binning, const int parameter_number) const; + + /** @brief Get the correction function parameter value if its type is eta- and pT-binned + * @param return_parameter_value The respective correction function parameter value is saved in this parameter + * @param etaEvalPoint eta evaluation point - i.e., the eta value of the current e/y object to be corrected. Used to find the correct eta bin to use for the correction + * @param ptEvalPoint pT evaluation point - i.e., the pT value of the current e/y object to be corrected. Used to find the correct pT bin to use for the correction + * @param parameter_number The number of the parameter with respect to the correction TF1. Needed in order to retrieve the correct values matching this parameter. + */ + const StatusCode get2DBinnedParameter(float& return_parameter_value, const float etaEvalPoint, const float ptEvalPoint, const int parameter_number) const; + + /** @brief Find the bin number in which the evalPoint is located in the binning binning. + * @param return_bin The respective bin number is saved in this parameter + * @param evalPoint The evaluation point for which the bin number should be found + * @param binning The binning which should be evaluated + */ + const StatusCode findBin(int& return_bin, const float evalPoint, const std::vector<float>& binning) const; + + /** @brief Return the interpolation flag of parameter parameter_number as a boolean. + * @param parameter_number Number of the parameter for which the interpolation flag should be checked + * @return The interpolation flag of parameter parameter_number (boolean) + */ + bool getInterpolationFlag(const int parameter_number) const; + + /** @brief Given a point x, approximates the value via linear interpolation based on the two nearest bin centers. Re-implementation of Double_t TH1::Interpolate( Double_t x) const. + * @param return_parameter_value The interpolated parameter value is saved in this parameter + * @param evalPoint The point for which the interpolation should be done + * @param bin The bin in which the evalPoint is located with respect to binning + * @param binning The binning based on which the interpolation should be done + * @param binValues The bin values according to the binning given in binning + */ + const StatusCode interpolate(float& return_parameter_value, const float evalPoint, const int bin, const std::vector<float>& binning, const std::vector<float>& binValues) const; + + /** @brief Get the bin center of a bin bin_int using the binning binning + * @param return_bin_center The bin center is saved in this parameter + * @param binning The binning which should be used to find the bin centers + * @param bin_int The bin for which the bin center should be found + */ + const StatusCode getBinCenter(float& return_bin_center, const std::vector<float>& binning, const int bin_int) const; + + /** @brief Returns the linearly intrpolated value of value given the bin centers and bin values + * @param value The x-value at which the interpolation should be done + * @param left_bin_center The x-value of the left bin center used for the interpolation + * @param left_bin_value The y-value of the left bin at the left bin center + * @param right_bin_center The x-value of the right bin center used for the interpolation + * @param right_bin_value The y-value of the right bin at the right bin center + */ + float interpolate_function(const float value, const float left_bin_center, const float left_bin_value, const float right_bin_center, const float right_bin_value) const; + + /** @brief Get the events energy density from the eventShape + * @param value The respective correction function parameter value is saved in this parameter + * @param eventShapeContainer The name of the respective event shape container to use + */ + const StatusCode getDensity(float& value, const std::string& eventShapeContainer) const; + + /** @brief Get the e/y kinematic properties + * @param egamma_object The e/y object to get the kinemativ properties of + * @param pt The pT value is saved in this parameter + * @param absEta The absolute eta value is saved in this parameter + * @details As every electron/photon has different values of pT/eta, the correction function must be adapted accordingly for every e/y. The according values of + * eta and pt are updated with this function. + */ + const StatusCode getKinematicProperties(const xAOD::Egamma& egamma_object, float& pt, float& absEta) const; + + /** @brief Actual application of the correction to the variable + * @param return_corrected_variable The corrected variable value is saved in this parameter + * @param original_variable The original value of the corrected variable + * @param properties The vector containing the correction TF1 parameters so the correction TF1 can be set for the respective e/y object + */ + const StatusCode correct(float& return_corrected_variable, const float original_variable, std::vector<float>& properties) const; + +}; //end class ElectronPhotonVariableCorrectionBase + +#endif diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/EGammaVariableCorrection/ElectronPhotonVariableCorrectionDict.h b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/EGammaVariableCorrection/ElectronPhotonVariableCorrectionDict.h new file mode 100644 index 0000000000000000000000000000000000000000..154b6df66e155098ad2a1da8531df7f023af2403 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/EGammaVariableCorrection/ElectronPhotonVariableCorrectionDict.h @@ -0,0 +1,15 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// Dear emacs, this is -*-c++-*- + +#ifndef ELECTRONPHOTONVARIABLECORRECTIONDICT_H +#define ELECTRONPHOTONVARIABLECORRECTIONDICT_H + + +#include "EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase.h" +#include "EGammaVariableCorrection/ElectronPhotonVariableCorrectionTool.h" + + +#endif diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/EGammaVariableCorrection/ElectronPhotonVariableCorrectionTool.h b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/EGammaVariableCorrection/ElectronPhotonVariableCorrectionTool.h new file mode 100644 index 0000000000000000000000000000000000000000..82551565881201042df97ac675597c2c8c7f7972 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/EGammaVariableCorrection/ElectronPhotonVariableCorrectionTool.h @@ -0,0 +1,131 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef ElectronPhotonVariableCorrectionTool_H +#define ElectronPhotonVariableCorrectionTool_H + +/** @class ElectronPhotonVariableCorrectionTool + * @brief Tool to correct electron and photon MC variables using the ElectronPhotonVariableCorrectionBase class. + * @details For a detailed documentation, please refer to the [gitlab readme](https://gitlab.cern.ch/atlas/athena/-/blob/21.2/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/README.md) + * + * @author Nils Gillwald (DESY) nils.gillwald@desy.de + * @date February 2020 +*/ + +//ATLAS includes +#include "AsgTools/AsgTool.h" +#include "EgammaAnalysisInterfaces/IElectronPhotonShowerShapeFudgeTool.h" +#include "EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase.h" + +//EDM includes +#include "xAODEgamma/Electron.h" +#include "xAODEgamma/Photon.h" + +// =========================================================================== +// Class ElectronPhotonVariableCorrectionTool +// =========================================================================== + +class ElectronPhotonVariableCorrectionTool : public asg::AsgTool, virtual public IElectronPhotonShowerShapeFudgeTool +{ + +/// Declare the interface that the class provides +ASG_TOOL_CLASS(ElectronPhotonVariableCorrectionTool, IElectronPhotonShowerShapeFudgeTool) + +public: + /** @brief Standard constructor + * @param myname Internal name of the tool instance, so they can be distinguished + */ + ElectronPhotonVariableCorrectionTool(const std::string& myname); + //! @brief Standard destructor + ~ElectronPhotonVariableCorrectionTool() {}; + + /** @brief Initialize the tool instance + * @details Reads out the configuration file set via the setProperty(ConfigFile, "/path/to/conf/file.conf") function + * and sets up the tool instance accordingly + */ + virtual StatusCode initialize() override; + + /** @brief Apply the correction given in the conf file to the passed photon + * @param photon The photon which should be corrected + * @details Pass a photon which should be corrected by the tool to this function. The tool gets the original photon variable value, + * corrects it according to the configuration file given, and overwrites the original value of the variable. The original variable + * is saved as <variable_name>_original. Note that the variable to be corrected should be an auxiliary variable, and that the photon + * or photon container, respectively, must not be const if you want to use this function. If you are running on const objects, please + * make a deep / shallow copy of the container or use the correctedCopy function of this class. + */ + virtual const CP::CorrectionCode applyCorrection( xAOD::Photon& photon ) const override; + + /** @brief Apply the correction given in the conf file to the passed electron + * @param electron The electron which should be corrected + * @details Pass an electron which should be corrected by the tool to this function. The tool gets the original electron variable value, + * corrects it according to the configuration file given, and overwrites the original value of the variable. The original variable + * is saved as <variable_name>_original. Note that the variable to be corrected should be an auxiliary variable, and that the electron + * or electron container, respectively, must not be const if you want to use this function. If you are running on const objects, please + * make a deep / shallow copy of the container or use the correctedCopy function of this class. + */ + virtual const CP::CorrectionCode applyCorrection( xAOD::Electron& electron ) const override; + + /** @brief Make a corrected copy of the passed photon according to the given conf file + * @param in_photon The original photon of which a corrected copy should be made + * @param out_photon Empty new photon where the corrected copy will be stored in + * @details Makes a corrected copy of the passed photon object according to the correction provided in the configuration file. The in_photon + * is copied to the out_photon, which is then passed to the applyCorrection function. + */ + virtual const CP::CorrectionCode correctedCopy( const xAOD::Photon& in_photon, xAOD::Photon*& out_photon ) const override; + + /** @brief Make a corrected copy of the passed electron according to the given conf file + * @param in_electron The original electron of which a corrected copy should be made + * @param out_electron Empty new electron where the corrected copy will be stored in + * @details Makes a corrected copy of the passed electron object according to the correction provided in the configuration file. The in_electron + * is copied to the out_electron, which is then passed to the applyCorrection function. + */ + virtual const CP::CorrectionCode correctedCopy( const xAOD::Electron& in_electron, xAOD::Electron*& out_electron) const override; + +private: + //! @brief The configuration file for the tool + std::string m_configFile; + //! @brief The configuration files for the base class - converted photons + std::vector<std::string> m_convertedPhotonConfFiles; + //! @brief The configuration files for the base class - unconverted photons + std::vector<std::string> m_unconvertedPhotonConfFiles; + //! @brief The configuration files for the base class - electrons + std::vector<std::string> m_electronConfFiles; + //! @brief The base class instances for single variable correction - converted photons + std::vector<std::unique_ptr<ElectronPhotonVariableCorrectionBase>> m_convertedPhotonTools; + //! @brief The base class instances for single variable correction - unconverted photons + std::vector<std::unique_ptr<ElectronPhotonVariableCorrectionBase>> m_unconvertedPhotonTools; + //! @brief The base class instances for single variable correction - electrons + std::vector<std::unique_ptr<ElectronPhotonVariableCorrectionBase>> m_electronTools; + + //! @brief Configure, initialize, and check the base class instances saved in the m_*Tools members + const StatusCode initializeCorrectionTools(); + + /** @brief Initialize the base clase instances saved in the m_*Tools members + * @param name The name of the tool holder which should be included in the base class instances names + * @param confFiles The conf files for the base class instances which should be created and initialized + * @param toolHolder The tool holder where the base class instances are created + */ + const StatusCode initializeTools( const std::string& name, const std::vector<std::string>& confFiles, std::vector<std::unique_ptr<ElectronPhotonVariableCorrectionBase>>& toolHolder ); + + /** @brief Get current name of the variable to be corrected by the current base class instance, in order to coherently name the base class instances + * @param variableName The current correction variable name is saved in this parameter + * @param confFile The respective conf file of the current base class instance to be read-out + */ + const StatusCode getCorrectionVariableName( std::string &variableName, const std::string& confFile ) const; + + /** @brief Locate all config files for the base class instances passed to the tool in m_configFile in the ATLAS file system + * @param confFiles The conf files which shoud be used for the setup and initialization of the base class instances + */ + const StatusCode findAllConfigFiles( std::vector<std::string>& confFiles ); + + /** @brief Check if the ApplyTo flag from the base class conf file does match with the container type spcified in the tool conf file + * @param confFiles The conf files used to initialze the base class instances now stored in the respective toolHolder + * @param toolHolder The base class instances which were initialized using the respective confFiles + * @param toolHolderType The type of base class instances which should be stored in the respective toolHolder with respect to the tespectif confFiles + */ + const StatusCode applyToFlagMatchesToolHolder( const std::vector<std::string>& confFiles, const std::vector<std::unique_ptr<ElectronPhotonVariableCorrectionBase>>& toolHolder, ElectronPhotonVariableCorrectionBase::EGammaObjects toolHolderType ); + +}; //end class ElectronPhotonVariableCorrectionTool + +#endif diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/EGammaVariableCorrection/selection.xml b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/EGammaVariableCorrection/selection.xml new file mode 100644 index 0000000000000000000000000000000000000000..6d1a76b00e023a5ee9bd5da216bd80b4338264aa --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/EGammaVariableCorrection/selection.xml @@ -0,0 +1,3 @@ +<lcgdict> + <class name="ElectronPhotonVariableCorrectionTool" /> +</lcgdict> diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/Root/ElectronPhotonVariableCorrectionBase.cxx b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/Root/ElectronPhotonVariableCorrectionBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b528b91d0c0586109bc8f7e4a034216edd604ca7 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/Root/ElectronPhotonVariableCorrectionBase.cxx @@ -0,0 +1,899 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + @class ElectronPhotonVariableCorrectionBase + @brief Tool to correct electron and photon MC variables. + + @author Nils Gillwald (DESY) nils.gillwald@desy.de + @date February 2020 +**/ + +#include "EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase.h" +#include "EgammaAnalysisHelpers/AsgEGammaConfigHelper.h" +#include "xAODEventShape/EventShape.h" + +// EDM includes +#include "xAODEgamma/EgammaEnums.h" +#include "TEnv.h" + +//Root includes +#include "TF1.h" +#include "TGraph.h" +#include "TFile.h" + +//allow advanced math for the TF1 +#include "TMath.h" + +#include "PathResolver/PathResolver.h" + +// =========================================================================== +// Standard Constructor +// =========================================================================== +ElectronPhotonVariableCorrectionBase::ElectronPhotonVariableCorrectionBase(const std::string& myname) : + AsgTool(myname) +{ + //declare the needed properties + declareProperty("ConfigFile",m_configFile="","The configuration file to use"); +} + +// =========================================================================== +// Initialize +// =========================================================================== +StatusCode ElectronPhotonVariableCorrectionBase::initialize() +{ + // Locate configuration file, abort if not found + std::string configFile; + if (!m_configFile.empty()) + { + configFile = PathResolverFindCalibFile(m_configFile); + if (configFile == "") + { + ATH_MSG_ERROR("Could not locate configuration file " << m_configFile); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Use configuration file " << m_configFile << " " << configFile); + } + else + { + ATH_MSG_ERROR("Config file string is empty. Please provide a config file to the tool."); + return StatusCode::FAILURE; + } + + // retrieve properties from configuration file, using TEnv class + TEnv env(configFile.c_str()); + // Send warning if duplicates found in conf file + env.IgnoreDuplicates(false); + + //retrieve variable to correct + if (env.Lookup("Variable")) + { + m_correctionVariable = env.GetValue("Variable",""); + } + else + { + ATH_MSG_ERROR("Correction variable is empty or not in configuration file."); + return StatusCode::FAILURE; + } + + // initialize the variable aux element accessors + // variable to be corrected + m_variableToCorrect = std::make_unique<SG::AuxElement::Accessor<float>>(m_correctionVariable); + // save original value under different name + m_originalVariable = std::make_unique<SG::AuxElement::Accessor<float>>(m_correctionVariable + "_original"); + + // Get the function used to correct the variable + if (env.Lookup("Function")) + { + m_correctionFunctionString = env.GetValue("Function","failure"); + // initialize the actual correction function TF1 + m_correctionFunctionTF1 = std::make_unique<TF1>(TF1("m_correctionFunctionTF1",m_correctionFunctionString.c_str())); + } + else + { + ATH_MSG_ERROR("Correction function is empty or not in configuration file."); + return StatusCode::FAILURE; + } + + // Get the number of parameters used in the correction function + if (env.Lookup("nFunctionParameters")) + { + m_numberOfFunctionParameters = env.GetValue("nFunctionParameters",-1); + } + else + { + ATH_MSG_ERROR("You did not specify the number of parameters in the correction function."); + return StatusCode::FAILURE; + } + + // resize all vectors used for getting parameters to m_numberOfFunctionParameters + m_ParameterTypeVector.resize(m_numberOfFunctionParameters); + m_binValues.resize(m_numberOfFunctionParameters); + m_graphCopies.resize(m_numberOfFunctionParameters); + m_interpolatePtFlags.resize(m_numberOfFunctionParameters); + + // Save the type of all parameters in the correction function (assuming m_numberOfFunctionParameters parameters) + for (int parameter_itr = 0; parameter_itr < m_numberOfFunctionParameters; parameter_itr++) + { + // if the parameter #parameter_itr is in the conf file, save its type + TString parameterType = TString::Format("Parameter%dType",parameter_itr); + if (env.Lookup(parameterType)) + { + // convert string to ParameterType, fail if non-existing type + ElectronPhotonVariableCorrectionBase::parameterType type = stringToParameterType(env.GetValue(parameterType.Data(),"")); + if( type == ElectronPhotonVariableCorrectionBase::parameterType::Failure ) + { + ATH_MSG_ERROR("Parameter " << parameter_itr << " read-in failed, not an allowed parameter type."); + return StatusCode::FAILURE; + } + // save type, get according type information and save it + m_ParameterTypeVector.at(parameter_itr) = type; + ATH_CHECK(getParameterInformationFromConf(env, parameter_itr, type)); + } + // else fail + else + { + ATH_MSG_ERROR("Did not find Parameter" << parameter_itr << ", although you specified there were " << m_numberOfFunctionParameters << " parameters for the correction function."); + return StatusCode::FAILURE; + } + } // end loop over all function parameters + + // check to which EGamma object the conf file should be applied to, if flag is set + if (env.Lookup("ApplyTo")) + { + std::string applyToObjectsFlag = env.GetValue("ApplyTo","Failure"); + m_applyToObjects = stringToEGammaObject(applyToObjectsFlag); + // fail if not passed a proper type + if (m_applyToObjects == ElectronPhotonVariableCorrectionBase::EGammaObjects::Failure) + { + ATH_MSG_ERROR("You did not correctly specify the object type in the ApplyTo flag."); + return StatusCode::FAILURE; + } + } + // else fail + else + { + ATH_MSG_ERROR("You did not specify to which objects this conf file should be applied to (ApplyTo)."); + return StatusCode::FAILURE; + } + + // check if there are any (discrete) values which should be left uncorrected + if (env.Lookup("UncorrectedDiscontinuities")) + { + m_uncorrectedDiscontinuities = AsgConfigHelper::HelperFloat("UncorrectedDiscontinuities", env); + // if flag is given, but no values, fail + if (m_uncorrectedDiscontinuities.size() < 1) + { + ATH_MSG_ERROR("Did not find any discontinuities to not correct, despite finding the flag UncorrectedDiscontinuities."); + return StatusCode::FAILURE; + } + } + + //everything worked out, so + return StatusCode::SUCCESS; +} + +// =========================================================================== +// Application of correction +// =========================================================================== +const CP::CorrectionCode ElectronPhotonVariableCorrectionBase::applyCorrection(xAOD::Photon& photon) const +{ + // check if we should only deal with converted / unconverted photons + if (!passedCorrectPhotonType(photon)) + { + ATH_MSG_ERROR("You specified in the conf file that the tool should only be used for (un-)converted photons, but passed the other conversion type."); + return CP::CorrectionCode::Error; + } + + // From the object, get the variable value according to the variable from the conf file + // if variable not found, fail + float original_variable = 0.; + if( m_variableToCorrect->isAvailable(photon) ) + { + original_variable = (*m_variableToCorrect)(photon); + //Save the original value to the photon under different name + (*m_originalVariable)(photon) = original_variable; + // check if tool should skip correcting this variable, as it's from some discontinuity + if (isEqualToUncorrectedDiscontinuity(original_variable)) + { + return CP::CorrectionCode::Ok; + } + } + else + { + ATH_MSG_ERROR("The correction variable \"" << m_correctionVariable << "\" provided in the conf file is not available."); + return CP::CorrectionCode::Error; + } + + //declare objects needed to retrieve photon properties + std::vector<float> properties; //safe value of function parameter i at place i + properties.resize(m_numberOfFunctionParameters); + float absEta; //safe absolute value of eta of event + float pt; //safe pt of event + + //Get all the properties from the photon and fill them to properties, eta, pt + if (getKinematicProperties(photon, pt, absEta) != StatusCode::SUCCESS) + { + ATH_MSG_ERROR("Could not retrieve kinematic properties of this photon object."); + return CP::CorrectionCode::Error; + } + ATH_MSG_VERBOSE("Got the photon kinematics , pT = " << pt << " |eta| = " << absEta); + if (getCorrectionParameters(properties, pt, absEta) != StatusCode::SUCCESS) + { + ATH_MSG_ERROR("Could not get the correction parameters for this photon object."); + return CP::CorrectionCode::Error; + } + for (auto p : properties) + ATH_MSG_VERBOSE("prop " << p); + + // Apply the correction, write to the corrected AuxElement + correct((*m_variableToCorrect)(photon),original_variable, properties).ignore(); // ignore as will always return SUCCESS + + // everything worked out, so + return CP::CorrectionCode::Ok; +} + +const CP::CorrectionCode ElectronPhotonVariableCorrectionBase::applyCorrection(xAOD::Electron& electron) const +{ + if (!(m_applyToObjects == ElectronPhotonVariableCorrectionBase::EGammaObjects::allElectrons || m_applyToObjects == ElectronPhotonVariableCorrectionBase::EGammaObjects::allEGammaObjects)) + { + ATH_MSG_ERROR("You want to correct electrons, but passed a conf file with ApplyTo flag not set for electrons. Are you using the correct conf file?"); + return CP::CorrectionCode::Error; + } + + // From the object, get the variable value according to the variable from the conf file + // if variable not found, fail + float original_variable = 0.; + if (m_variableToCorrect->isAvailable(electron)) + { + original_variable = (*m_variableToCorrect)(electron); + //Save the original value to the photon under different name + (*m_originalVariable)(electron) = original_variable; + // check if tool should skip correcting this variable, as it's from some discontinuity + if (isEqualToUncorrectedDiscontinuity(original_variable)) + { + return CP::CorrectionCode::Ok; + } + } + else + { + ATH_MSG_ERROR("The correction variable \"" << m_correctionVariable << "\" provided in the conf file is not available."); + return CP::CorrectionCode::Error; + } + + //declare objects needed to retrieve electron properties + std::vector<float> properties; //safe value of function parameter i at place i + properties.resize(m_numberOfFunctionParameters); + float absEta; //safe absolute value of eta of event + float pt; //safe pt of event + + //Get all the properties from the electron and fill them to properties, eta, pt + if (getKinematicProperties(electron, pt, absEta) != StatusCode::SUCCESS) + { + ATH_MSG_ERROR("Could not retrieve kinematic properties of this electron object."); + return CP::CorrectionCode::Error; + } + ATH_MSG_VERBOSE("Got the electron kinematics , pT = " << pt << " |eta| = " << absEta); + if (getCorrectionParameters(properties, pt, absEta) != StatusCode::SUCCESS) + { + ATH_MSG_ERROR("Could not get the correction parameters for this electron object."); + return CP::CorrectionCode::Error; + } + + for (auto p : properties) + ATH_MSG_VERBOSE("prop " << p); + + // Apply the correction, write to the corrected AuxElement + correct((*m_variableToCorrect)(electron),original_variable, properties).ignore(); // ignore as will always return SUCCESS + + // everything worked out, so + return CP::CorrectionCode::Ok; +} + +const StatusCode ElectronPhotonVariableCorrectionBase::correct(float& return_corrected_variable, const float original_variable, std::vector<float>& properties) const +{ + // set the parameters of the correction function + for (unsigned int parameter_itr = 0; parameter_itr < properties.size(); parameter_itr++) + { + m_correctionFunctionTF1->SetParameter(parameter_itr,properties.at(parameter_itr)); + } + + ATH_MSG_VERBOSE("original var " << original_variable); + + // Calculate corrected value + return_corrected_variable = m_correctionFunctionTF1->Eval(original_variable); + + ATH_MSG_VERBOSE("corrected var " << return_corrected_variable); + + // everything worked out, so + return StatusCode::SUCCESS; +} + +// =========================================================================== +// Corrected Copies +// =========================================================================== +const CP::CorrectionCode ElectronPhotonVariableCorrectionBase::correctedCopy( const xAOD::Photon& in_photon, xAOD::Photon*& out_photon ) const +{ + out_photon = new xAOD::Photon(in_photon); + return applyCorrection(*out_photon); +} + +const CP::CorrectionCode ElectronPhotonVariableCorrectionBase::correctedCopy( const xAOD::Electron& in_electron, xAOD::Electron*& out_electron) const +{ + out_electron = new xAOD::Electron(in_electron); + return applyCorrection(*out_electron); +} + +// =========================================================================== +// Helper Functions +// =========================================================================== + +bool ElectronPhotonVariableCorrectionBase::isEqualToUncorrectedDiscontinuity(const float value) const +{ + // if no values set, return false as there is nothing to check + if (m_uncorrectedDiscontinuities.size() < 1) + { + return false; + } + + // check all discontinuities which where passed + for (unsigned int value_itr = 0; value_itr < m_uncorrectedDiscontinuities.size(); value_itr++) + { + if (value == m_uncorrectedDiscontinuities.at(value_itr)) + { + // if the value is equal to one of the discontinuities, no need to check further + return true; + } + } + // if we eer get here, the value was never equal to a discontinuity + return false; +} + +const StatusCode ElectronPhotonVariableCorrectionBase::getKinematicProperties(const xAOD::Egamma& egamma_object, float& pt, float& absEta) const +{ + // just reteriving eta and pt is probably less expensive then checking if I need it and + // then retrieve it only if I actually need it + + // protection against bad clusters + const xAOD::CaloCluster* cluster = egamma_object.caloCluster(); + if ( cluster == nullptr ) + { + ATH_MSG_ERROR("EGamma object calorimeter cluster is NULL: Cluster " << cluster); + return StatusCode::FAILURE; + } + + // Fill variables + // eta position in second sampling + absEta = std::abs(cluster->etaBE(2)); + // transverse energy in calorimeter (using eta position in second sampling) + const double energy = cluster->e(); + double et = 0.; + if (absEta<999.) { + const double cosheta = cosh(absEta); + et = (cosheta != 0.) ? energy/cosheta : 0.; + } + pt = et; + + // everything went fine, so + return StatusCode::SUCCESS; +} + +const StatusCode ElectronPhotonVariableCorrectionBase::getParameterInformationFromConf(TEnv& env, const int parameter_number, const ElectronPhotonVariableCorrectionBase::parameterType type) +{ + // don't want to write the same code multiple times, so set flags when to retrieve eta/pt bins + bool getEtaBins = false; + bool getPtBins = false; + // form strings according to which parameter to retrieve + TString filePathKey = TString::Format("Parameter%dFile",parameter_number); + TString graphNameKey = TString::Format("Parameter%dGraphName",parameter_number); + TString binValues = TString::Format("Parameter%dValues",parameter_number); + TString interpolate = TString::Format("Parameter%dInterpolate",parameter_number); + // helpers + TString filePath = ""; + TString graphName = ""; + + // according to the parameter type, retrieve the information from conf + if (type == ElectronPhotonVariableCorrectionBase::parameterType::EtaDependentTGraph || type == ElectronPhotonVariableCorrectionBase::parameterType::PtDependentTGraph) + { + // check if necessary information is in conf, else fail + if (env.Lookup(filePathKey)) + { + //get the path to the root file where the graph is saved + filePath = PathResolverFindCalibFile(env.GetValue(filePathKey.Data(),"")); + // fail if file not found + if (filePath == "") + { + ATH_MSG_ERROR("Could not locate Parameter" << parameter_number << " TGraph file."); + return StatusCode::FAILURE; + } + } + else + { + ATH_MSG_ERROR("Could not retrieve Parameter" << parameter_number << " file path."); + return StatusCode::FAILURE; + } + // check if necessary information is in conf, else fail + if (env.Lookup(graphNameKey)) + { + //get the name of the TGraph + graphName = env.GetValue(graphNameKey.Data(),""); + } + else + { + ATH_MSG_ERROR("Could not retrieve Parameter" << parameter_number << " graph name."); + return StatusCode::FAILURE; + } + // open file, if it works, try to find graph, get graph, store a copy, else warning + fail + std::unique_ptr<TFile> file (new TFile(filePath.Data(),"READ")); + // check if file is open - if open, get graph, if not, fail + if (file->IsOpen()) + { + // if graph exists, get it, else fail + if (file->Get(graphName)) + { + std::unique_ptr<TGraph> graph ((TGraph*)file->Get(graphName.Data())); + m_graphCopies.at(parameter_number) = (TGraph*)graph->Clone(); //Or use copy constructor? + file->Close(); + } + else + { + ATH_MSG_ERROR("Could not find TGraph " << graphName << " in file " << filePath); + return StatusCode::FAILURE; + } + } + else + { + ATH_MSG_ERROR("Could not open Parameter" << parameter_number << " TGraph file " << filePath.Data()); + return StatusCode::FAILURE; + } + } + else if (type == ElectronPhotonVariableCorrectionBase::parameterType::EtaBinned ) + { + //get eta binning later + getEtaBins = true; + } + else if (type == ElectronPhotonVariableCorrectionBase::parameterType::PtBinned ) + { + //get pt binning later + getPtBins = true; + } + else if (type == ElectronPhotonVariableCorrectionBase::parameterType::EtaTimesPtBinned ) + { + //get eta and pt binning later + getEtaBins = true; + getPtBins = true; + } + else if (type == ElectronPhotonVariableCorrectionBase::parameterType::EventDensity ) + { + // nothing has to be retrieved, no additional parameters for EventDensity currently + return StatusCode::SUCCESS; + } + + // if needed and not already retrieved, get eta binning + if (getEtaBins && !m_retrievedEtaBinning) + { + // check if necessary information is in conf, else fail + if (env.Lookup("EtaBins")) + { + //get the eta binning (global!) + m_etaBins = AsgConfigHelper::HelperFloat("EtaBins",env); + //force that the low bin edges are given by the conf file, starting with 0 + if (m_etaBins.at(0) != 0.) + { + ATH_MSG_ERROR("Lowest bin edge given for parameter " << parameter_number << " is not 0. Please provide the lower bin edges of your correction binning in the conf file, starting with 0."); + return StatusCode::FAILURE; + } + // don't want to retrieve the same thing twice from conf + m_retrievedEtaBinning = true; + } + else + { + ATH_MSG_ERROR("Could not retrieve eta binning."); + return StatusCode::FAILURE; + } + } + // if needed and not already retrieved, get pt binning + if (getPtBins && !m_retrievedPtBinning) + { + // check if necessary information is in conf, else fail + if (env.Lookup("PtBins")) + { + //get the pt binning (global!) + m_ptBins = AsgConfigHelper::HelperFloat("PtBins",env); + //force that the low bin edges are given by the conf file, starting with 0 + if (m_ptBins.at(0) != 0.) + { + ATH_MSG_ERROR("Lowest bin edge given for parameter " << parameter_number << " is not 0. Please provide the lower bin edges of your correction binning in the conf file, starting with 0."); + return StatusCode::FAILURE; + } + // don't want to retrieve the same thing twice from conf + m_retrievedPtBinning = true; + } + else + { + ATH_MSG_ERROR("Could not retrieve pt binning."); + return StatusCode::FAILURE; + } + } + //check if interpolation should be done + if (getPtBins) + { + // default is false + m_interpolatePtFlags.at(parameter_number) = env.GetValue(interpolate.Data(),false); + } + if ( getEtaBins || getPtBins) + { + // check if necessary information is in conf, else fail + if (env.Lookup(binValues)) + { + //get the binned values of the eta/pt dependent parameter + m_binValues.at(parameter_number) = AsgConfigHelper::HelperFloat(binValues.Data(),env); + } + else + { + ATH_MSG_ERROR("Could not retrieve binned values."); + return StatusCode::FAILURE; + } + } + + // everything went fine, so + return StatusCode::SUCCESS; +} + +const StatusCode ElectronPhotonVariableCorrectionBase::getCorrectionParameters(std::vector<float>& properties, const float pt, const float absEta) const +{ + // according to the parameter type, get the actual parameter going to the correction function + // for this, loop over the parameter type vector + for (unsigned int parameter_itr = 0; parameter_itr < m_ParameterTypeVector.size(); parameter_itr++) + { + ElectronPhotonVariableCorrectionBase::parameterType type = m_ParameterTypeVector.at(parameter_itr); + if (type == ElectronPhotonVariableCorrectionBase::parameterType::EtaDependentTGraph) + { + // evaluate TGraph at abs(eta) + properties.at(parameter_itr) = m_graphCopies.at(parameter_itr)->Eval(absEta); + } + else if (type == ElectronPhotonVariableCorrectionBase::parameterType::PtDependentTGraph) + { + // evaluate TGraph at pt + properties.at(parameter_itr) = m_graphCopies.at(parameter_itr)->Eval(pt); + } + else if (type == ElectronPhotonVariableCorrectionBase::parameterType::EtaBinned) + { + // get value of correct eta bin + ATH_CHECK(get1DBinnedParameter(properties.at(parameter_itr),absEta,m_etaBins,parameter_itr)); + } + else if (type == ElectronPhotonVariableCorrectionBase::parameterType::PtBinned) + { + // get value of correct pt bin + ATH_CHECK(get1DBinnedParameter(properties.at(parameter_itr),pt,m_ptBins,parameter_itr)); + } + else if (type == ElectronPhotonVariableCorrectionBase::parameterType::EtaTimesPtBinned) + { + // get value of correct eta x pt bin + ATH_CHECK(get2DBinnedParameter(properties.at(parameter_itr),absEta,pt,parameter_itr)); + } + else if (type == ElectronPhotonVariableCorrectionBase::parameterType::EventDensity) + { + // get event density + ATH_CHECK(getDensity(properties.at(parameter_itr), "TopoClusterIsoCentralEventShape")); + } + } + + // everything went fine, so + return StatusCode::SUCCESS; +} + +const StatusCode ElectronPhotonVariableCorrectionBase::get1DBinnedParameter(float& return_parameter_value, const float evalPoint, const std::vector<float>& binning, const int parameter_number) const +{ + ANA_MSG_VERBOSE("EvalPoint: " << evalPoint); + // need to find the bin in which the evalPoint is + int bin = -1; + ATH_CHECK(findBin(bin, evalPoint, binning)); + + // calculate return value + // if interpolation flag is true, interpolate + if (getInterpolationFlag(parameter_number)) + { + ATH_CHECK(interpolate(return_parameter_value, evalPoint, bin, binning, m_binValues.at(parameter_number))); + } + else + { + return_parameter_value = m_binValues.at(parameter_number).at(bin); + } + + // everything went fine, so + return StatusCode::SUCCESS; +} + +const StatusCode ElectronPhotonVariableCorrectionBase::get2DBinnedParameter(float& return_parameter_value, const float etaEvalPoint, const float ptEvalPoint, const int parameter_number) const +{ + //need to find eta bin, and need to find pt bin + //from this, calculate which parameter of the list is needed to be returned. + int etaBin = -1; + int ptBin = -1; + + ATH_MSG_VERBOSE("eta = " << etaEvalPoint << " pt = " << ptEvalPoint); + + ATH_CHECK(findBin(etaBin, etaEvalPoint, m_etaBins)); + ATH_CHECK(findBin(ptBin, ptEvalPoint, m_ptBins)); + + // get the corresponding pt x eta bin found + /* Note: Assuming that the values are binned in pt x eta in the conf file: + * eta bin 0 | eta bin 1 | eta bin 2 | eta bin 3 | eta bin 4 | etc. + * pt bin 0 0 1 2 3 4 + * pt bin 1 5 6 7 8 9 + * pt bin 2 10 11 12 13 14 + * pt bin 3 15 16 17 18 19 + * pt bin 4 20 21 22 23 24 + * etc. + * the correct parameter is saved in the vector at (number of eta bins) * ptBinNumber + etaBinNumber + * */ + + ATH_MSG_VERBOSE(" eta bin " << etaBin << " pT bin " << ptBin); + + int bin_number_in_bin_values = m_etaBins.size() * ptBin + etaBin; + + // calculate return value + // if interpolation flag is true, interpolate + if (getInterpolationFlag(parameter_number)) + { + // create the vector of correction values binned in pT at the found eta bin + std::vector<float> tmp_binValuesAtEtaSlice; + // from the full binning vector, need to cut one of the columns + for (unsigned int binValue_itr = etaBin; binValue_itr < m_binValues.at(parameter_number).size(); binValue_itr += m_etaBins.size()) + { + tmp_binValuesAtEtaSlice.push_back(m_binValues.at(parameter_number).at(binValue_itr)); + } + // interpolate using the above slice of the correction values + ATH_CHECK(interpolate(return_parameter_value, ptEvalPoint, ptBin, m_ptBins, tmp_binValuesAtEtaSlice)); + } + else + { + return_parameter_value = m_binValues.at(parameter_number).at(bin_number_in_bin_values); + } + + // everything went fine, so + return StatusCode::SUCCESS; +} + +const StatusCode ElectronPhotonVariableCorrectionBase::findBin(int& return_bin, const float evalPoint, const std::vector<float>& binning) const +{ + // need to find the bin in which the evalPoint is + return_bin = -1; + // if the evalPoint is < 0, something is very wrong + if (evalPoint < binning.at(0)) + { + // I use it for eta and pT, so error message is tailored to that... + ATH_MSG_ERROR("Abs(Eta) or pT of object is smaller than 0."); + return StatusCode::FAILURE; + } + // loop over bin boundaries + //run only up to binning.size()-1, as running to binning.size() will get a seg fault for the boundary check + for (unsigned int bin_itr = 0; bin_itr < binning.size()-1; bin_itr++) + { + // if the evaluation point is within the checked bins boundaries, this is the value we want + if (evalPoint > binning.at(bin_itr) && evalPoint < binning.at(bin_itr + 1)) + { + // we found the according bin, so return the according value + return_bin = bin_itr; + // we can stop now + break; + } + } + //if this point is ever reached and bin == -1, the evaluation point is larger then the largest lowest bin edge + //if that's the case, return the value for the last bin + //the -1 is because the parameter numbering in a vector starts at 0 + if (return_bin == -1) + { + return_bin = m_binValues.size()-1; + } + + // everythin went fine, so + return StatusCode::SUCCESS; +} + +bool ElectronPhotonVariableCorrectionBase::getInterpolationFlag(const int parameter_number) const +{ + bool do_interpolation = false; + // get parameter number type + ElectronPhotonVariableCorrectionBase::parameterType type = m_ParameterTypeVector.at(parameter_number); + // check if parameter has a type for which we need to check if interpolation is wanted + if (type == ElectronPhotonVariableCorrectionBase::parameterType::PtBinned || type == ElectronPhotonVariableCorrectionBase::parameterType::EtaTimesPtBinned) + { + // get the flag + do_interpolation = m_interpolatePtFlags.at(parameter_number); + } + return do_interpolation; +} + +const StatusCode ElectronPhotonVariableCorrectionBase::interpolate(float& return_parameter_value, const float evalPoint, const int bin, const std::vector<float>& binning, const std::vector<float>& binValues) const +{ + // check if passed binning is consistent + if (binning.size() != binValues.size()) + { + ATH_MSG_ERROR("Binning and bin values have different sizes."); + return StatusCode::FAILURE; + } + + // if evalPoint is left to the leftmost bin center, return the leftmost bin center without interpolation + float leftmost_bin_center = 0; + ANA_CHECK(getBinCenter(leftmost_bin_center, binning, 0)); + if (evalPoint <= leftmost_bin_center) + { + return_parameter_value = binValues.at(0); + return StatusCode::SUCCESS; + } + + // if evalPoint is right to the rightmost bin center, return the rightmost bin center without interpolation + float rightmost_bin_center = 0; + ANA_CHECK(getBinCenter(rightmost_bin_center, binning, binning.size()-1)) + if (evalPoint >= rightmost_bin_center) + { + return_parameter_value = binValues.at(binValues.size()-1); + return StatusCode::SUCCESS; + } + + float left_bin_center = 0; + float right_bin_center = 0; + float left_bin_value = 0; + float right_bin_value = 0; + float current_bin_center = 0; + ANA_CHECK(getBinCenter(current_bin_center, binning, bin)); + + // else interpolate using next left or next right bin + if (evalPoint <= current_bin_center) + { + //interpolate left + ANA_CHECK(getBinCenter(left_bin_center, binning, bin-1)); + ANA_CHECK(getBinCenter(right_bin_center, binning, bin)); + left_bin_value = binValues.at(bin-1); + right_bin_value = binValues.at(bin); + } + else // evalPoint is right from bin center + { + //interpolate right + ANA_CHECK(getBinCenter(left_bin_center, binning, bin)); + ANA_CHECK(getBinCenter(right_bin_center, binning, bin+1)); + left_bin_value = binValues.at(bin); + right_bin_value = binValues.at(bin+1); + } + ATH_MSG_VERBOSE("bin centers : " << left_bin_center << " " << right_bin_center << " current : " << current_bin_center << " values : " << left_bin_value << " " << right_bin_value); + + // calculate return value + return_parameter_value = interpolate_function(evalPoint, left_bin_center, left_bin_value, right_bin_center, right_bin_value); + + // everything went fine, so + return StatusCode::SUCCESS; +} + +const StatusCode ElectronPhotonVariableCorrectionBase::getBinCenter(float& return_bin_center, const std::vector<float>& binning, const int bin_int) const +{ + if (bin_int < 0) + { + ATH_MSG_ERROR("Bin number must be a non-negative integer."); + return StatusCode::FAILURE; + } + + // implicitly convert to loong unsigend int for comparisons, to get rid of compiler warnings resulting from comparisons of int and unsigned int + long unsigned int bin = bin_int; + + if (bin >= binning.size()) + { + ATH_MSG_ERROR("The requested bin is out of range of the passed binning."); + return StatusCode::FAILURE; + } + + // need special treatment for rightmost bin center: + // it goes up to infinity...assume it's as broad as the + // next to the rightmost bin for the interpolation + if (bin == binning.size()-1) + { + //calculate the width of the next to rightmost bin + float bin_width = binning.at(bin) - binning.at(bin-1); + return_bin_center = binning.at(bin) + 0.5 * bin_width; + } + // normal calculation + else + { + return_bin_center = 0.5 * (binning.at(bin) + binning.at(bin+1)); + } + + //everything went fine, so + return StatusCode::SUCCESS; +} + +float ElectronPhotonVariableCorrectionBase::interpolate_function(const float value, const float left_bin_center, const float left_bin_value, const float right_bin_center, const float right_bin_value) const +{ + return left_bin_value + (value - left_bin_center) * (right_bin_value - left_bin_value) / (right_bin_center - left_bin_center); +} + +const StatusCode ElectronPhotonVariableCorrectionBase::getDensity(float& value, const std::string& eventShapeContainer) const +{ + // retrieve the event shape container + const xAOD::EventShape* evtShape = nullptr; + if(evtStore()->retrieve(evtShape, eventShapeContainer).isFailure()){ + ATH_MSG_ERROR("Cannot retrieve density container " << eventShapeContainer); + return StatusCode::FAILURE; + } + // get the density from the container + value = evtShape->getDensity(xAOD::EventShape::Density); + return StatusCode::SUCCESS; +} + +ElectronPhotonVariableCorrectionBase::parameterType ElectronPhotonVariableCorrectionBase::stringToParameterType( const std::string& input ) const +{ + // return parameter type according to string given in conf file + if( input == "EtaDependentTGraph") + { return ElectronPhotonVariableCorrectionBase::parameterType::EtaDependentTGraph; } + else if( input == "PtDependentTGraph") + { return ElectronPhotonVariableCorrectionBase::parameterType::PtDependentTGraph; } + else if( input == "EtaBinned") + { return ElectronPhotonVariableCorrectionBase::parameterType::EtaBinned; } + else if( input == "PtBinned") + { return ElectronPhotonVariableCorrectionBase::parameterType::PtBinned; } + else if( input == "EtaTimesPtBinned") + { return ElectronPhotonVariableCorrectionBase::parameterType::EtaTimesPtBinned; } + else if( input == "EventDensity") + { return ElectronPhotonVariableCorrectionBase::parameterType::EventDensity; } + else + { + // if not a proper type, return failure type - check and fail on this! + ATH_MSG_ERROR(input.c_str() << " is not an allowed parameter type."); + return ElectronPhotonVariableCorrectionBase::parameterType::Failure; + } +} + +ElectronPhotonVariableCorrectionBase::EGammaObjects ElectronPhotonVariableCorrectionBase::stringToEGammaObject( const std::string& input ) const +{ + // return object type which correction should be applied to + if( input == "unconvertedPhotons" ) + { return ElectronPhotonVariableCorrectionBase::EGammaObjects::unconvertedPhotons; } + else if( input == "convertedPhotons" ) + { return ElectronPhotonVariableCorrectionBase::EGammaObjects::convertedPhotons; } + else if( input == "allPhotons" ) + { return ElectronPhotonVariableCorrectionBase::EGammaObjects::allPhotons; } + else if( input == "allElectrons" ) + { return ElectronPhotonVariableCorrectionBase::EGammaObjects::allElectrons; } + else if( input == "allEGammaObjects" ) + { return ElectronPhotonVariableCorrectionBase::EGammaObjects::allEGammaObjects; } + else + { + // if not a proper object type, return failure type - check and fail on this! + ATH_MSG_ERROR(input.c_str() << " is not an allowed EGamma object type to apply corrections to."); + return ElectronPhotonVariableCorrectionBase::EGammaObjects::Failure; + } +} + +bool ElectronPhotonVariableCorrectionBase::passedCorrectPhotonType(const xAOD::Photon& photon) const +{ + // retrieve if photon is converted or unconverted + bool isConvertedPhoton = xAOD::EgammaHelpers::isConvertedPhoton(&photon); + bool isUnconvertedPhoton = !isConvertedPhoton; + + // check if conf file ApplyTo flag matches photon conversion type + return ((applyToConvertedPhotons() && isConvertedPhoton) || (applyToUnconvertedPhotons() && isUnconvertedPhoton)); +} + +bool ElectronPhotonVariableCorrectionBase::applyToConvertedPhotons() const +{ + bool applyToAllEGamma = (m_applyToObjects == ElectronPhotonVariableCorrectionBase::EGammaObjects::allEGammaObjects); + bool applyToAllPhotons = (m_applyToObjects == ElectronPhotonVariableCorrectionBase::EGammaObjects::allPhotons); + bool applyToConvertedPhotons = (m_applyToObjects == ElectronPhotonVariableCorrectionBase::EGammaObjects::convertedPhotons); + return (applyToAllEGamma || applyToAllPhotons || applyToConvertedPhotons); +} + +bool ElectronPhotonVariableCorrectionBase::applyToUnconvertedPhotons() const +{ + bool applyToAllEGamma = (m_applyToObjects == ElectronPhotonVariableCorrectionBase::EGammaObjects::allEGammaObjects); + bool applyToAllPhotons = (m_applyToObjects == ElectronPhotonVariableCorrectionBase::EGammaObjects::allPhotons); + bool applyToUnconvertedPhotons = (m_applyToObjects == ElectronPhotonVariableCorrectionBase::EGammaObjects::unconvertedPhotons); + return (applyToAllEGamma || applyToAllPhotons || applyToUnconvertedPhotons); +} + +bool ElectronPhotonVariableCorrectionBase::applyToElectrons() const +{ + bool applyToAllEGamma = (m_applyToObjects == ElectronPhotonVariableCorrectionBase::EGammaObjects::allEGammaObjects); + bool applyToAllElectrons = (m_applyToObjects == ElectronPhotonVariableCorrectionBase::EGammaObjects::allElectrons); + return (applyToAllEGamma || applyToAllElectrons); +} diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/Root/ElectronPhotonVariableCorrectionTool.cxx b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/Root/ElectronPhotonVariableCorrectionTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c57b4f12c4fb7ba04190702f30b624218c66aaba --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/Root/ElectronPhotonVariableCorrectionTool.cxx @@ -0,0 +1,257 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + @class ElectronPhotonVariableCorrectionTool + @brief Tool to correct electron and photon MC variables. + + @author Nils Gillwald (DESY) nils.gillwald@desy.de + @date February 2020 +**/ + +#include "EGammaVariableCorrection/ElectronPhotonVariableCorrectionTool.h" +#include "EgammaAnalysisHelpers/AsgEGammaConfigHelper.h" +#include "PathResolver/PathResolver.h" +#include "TEnv.h" + +// =========================================================================== +// Standard Constructor +// =========================================================================== +ElectronPhotonVariableCorrectionTool::ElectronPhotonVariableCorrectionTool(const std::string& myname) : + AsgTool(myname) +{ + //declare the needed properties + declareProperty("ConfigFile",m_configFile="", "The configuration file to use"); +} + +StatusCode ElectronPhotonVariableCorrectionTool::initialize() +{ + // Locate configuration file, abort if not found + std::string configFile; + if (!m_configFile.empty()) + { + configFile = PathResolverFindCalibFile(m_configFile); + if (configFile == "") + { + ATH_MSG_ERROR("Could not locate configuration file " << m_configFile); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Use configuration file " << m_configFile); + } + else + { + ATH_MSG_ERROR("Config file string is empty. Please provide a config file to the tool."); + return StatusCode::FAILURE; + } + + // Retreive properties from configuration file, using TEnv class + TEnv env(configFile.c_str()); + // Send warning if duplicates found in conf file + env.IgnoreDuplicates(false); + + // retrieve different object type conf files + if (env.Lookup("ElectronConfigs")) + { + m_electronConfFiles = AsgConfigHelper::HelperString("ElectronConfigs",env); + } + if (env.Lookup("ConvertedPhotonConfigs")) + { + m_convertedPhotonConfFiles = AsgConfigHelper::HelperString("ConvertedPhotonConfigs",env); + } + if (env.Lookup("UnconvertedPhotonConfigs")) + { + m_unconvertedPhotonConfFiles = AsgConfigHelper::HelperString("UnconvertedPhotonConfigs",env); + } + + // check if any conf files were received + if (m_electronConfFiles.size() + m_convertedPhotonConfFiles.size() + m_unconvertedPhotonConfFiles.size() < 1) + { + ANA_MSG_ERROR("You did not provide any config files for the ElectronPhotonVariableCorrectionBase to the ElectronPhotonVariableCorrectionTool."); + return StatusCode::FAILURE; + } + + ATH_MSG_VERBOSE("number of files for the electron case : " << m_electronConfFiles.size()); + for (auto fN : m_electronConfFiles) + ATH_MSG_VERBOSE("file " << fN); + + // initialize the ElectronPhotonVariableCorrectionTools + ANA_CHECK(initializeCorrectionTools()); + + ANA_MSG_INFO("Initialized tool " << name()); + //everything worked out, so + return StatusCode::SUCCESS; +} + +const StatusCode ElectronPhotonVariableCorrectionTool::initializeCorrectionTools() +{ + //initialize all tools + ANA_CHECK(initializeTools("convertedPhotons", m_convertedPhotonConfFiles, m_convertedPhotonTools)); + ANA_CHECK(initializeTools("unconvertedPhotons", m_unconvertedPhotonConfFiles, m_unconvertedPhotonTools)); + ANA_CHECK(initializeTools("electrons", m_electronConfFiles, m_electronTools)); + // check if ApplyTo Flag matches with the tool holder + ANA_CHECK(applyToFlagMatchesToolHolder(m_convertedPhotonConfFiles, m_convertedPhotonTools, ElectronPhotonVariableCorrectionBase::EGammaObjects::convertedPhotons)); + ANA_CHECK(applyToFlagMatchesToolHolder(m_unconvertedPhotonConfFiles, m_unconvertedPhotonTools, ElectronPhotonVariableCorrectionBase::EGammaObjects::unconvertedPhotons)); + ANA_CHECK(applyToFlagMatchesToolHolder(m_electronConfFiles, m_electronTools, ElectronPhotonVariableCorrectionBase::EGammaObjects::allElectrons)); + + //everything worked out, so + return StatusCode::SUCCESS; +} + +const StatusCode ElectronPhotonVariableCorrectionTool::findAllConfigFiles( std::vector<std::string>& confFiles ) +{ + //loop over conf file vector, find conf file using path resolver + for( unsigned int confFile_itr = 0; confFile_itr < confFiles.size(); confFile_itr++ ) + { + std::string tmp_confFile = confFiles.at(confFile_itr); + confFiles.at(confFile_itr) = PathResolverFindCalibFile(confFiles.at(confFile_itr)); + if (confFiles.at(confFile_itr) == "") + { + ATH_MSG_ERROR("Could not locate configuration file " << tmp_confFile); + return StatusCode::FAILURE; + } + } + //everything worked out, so + return StatusCode::SUCCESS; +} + +const StatusCode ElectronPhotonVariableCorrectionTool::initializeTools( const std::string& name, const std::vector<std::string>& confFiles, std::vector<std::unique_ptr<ElectronPhotonVariableCorrectionBase>>& toolHolder ) +{ + // adapt size of toolHolder + toolHolder.resize(confFiles.size()); + // for each conf file, initialize one tool + for( unsigned int confFile_itr = 0; confFile_itr < confFiles.size(); confFile_itr++ ) + { + // name: supertool name + type name + variable name + std::string variable = ""; //get the name of the variable to be corrected + std::string confFileWithFullPath = PathResolverFindCalibFile(confFiles.at(confFile_itr)); + ANA_CHECK(getCorrectionVariableName(variable, confFileWithFullPath)); + TString toolname = TString::Format("%s_%s_%s", this->name().c_str(), name.c_str(), variable.c_str()); + ANA_MSG_DEBUG("Subtool name: " << toolname.Data()); + toolHolder.at(confFile_itr) = std::make_unique<ElectronPhotonVariableCorrectionBase>(toolname.Data()); + ANA_CHECK(toolHolder.at(confFile_itr)->setProperty("ConfigFile", confFiles.at(confFile_itr))); + ANA_CHECK(toolHolder.at(confFile_itr)->setProperty("OutputLevel", this->msg().level())); + ANA_CHECK(toolHolder.at(confFile_itr)->initialize()); + } + //everything worked out, so + return StatusCode::SUCCESS; +} + +const StatusCode ElectronPhotonVariableCorrectionTool::applyToFlagMatchesToolHolder( const std::vector<std::string>& confFiles, const std::vector<std::unique_ptr<ElectronPhotonVariableCorrectionBase>>& toolHolder, ElectronPhotonVariableCorrectionBase::EGammaObjects toolHolderType ) +{ + // loop over conf file holder + for (unsigned int tool_itr = 0; tool_itr < toolHolder.size(); tool_itr++) + { + // get ApplyTo flag + ElectronPhotonVariableCorrectionBase::EGammaObjects confFileType = toolHolder.at(tool_itr)->isAppliedTo(); + // skip all further tests if should be applied to all objects + if (confFileType == ElectronPhotonVariableCorrectionBase::EGammaObjects::allEGammaObjects) continue; + // continue if ApplyTo flag matches toolholder + if (toolHolderType == ElectronPhotonVariableCorrectionBase::EGammaObjects::convertedPhotons && toolHolder.at(tool_itr)->applyToConvertedPhotons()) continue; + if (toolHolderType == ElectronPhotonVariableCorrectionBase::EGammaObjects::unconvertedPhotons && toolHolder.at(tool_itr)->applyToUnconvertedPhotons()) continue; + if (toolHolderType == ElectronPhotonVariableCorrectionBase::EGammaObjects::allElectrons && toolHolder.at(tool_itr)->applyToElectrons()) continue; + // if this point is reached, something is wrong, so + ATH_MSG_ERROR("In conf " << confFiles.at(tool_itr) << ": The ApplyTo flag does not match with the container type from the conf file."); + return StatusCode::FAILURE; + } + //everything worked out, so + return StatusCode::SUCCESS; +} + +/* ======================================== + * Apply correction + * ======================================== */ + +const CP::CorrectionCode ElectronPhotonVariableCorrectionTool::applyCorrection( xAOD::Photon& photon ) const +{ + bool isConvertedPhoton = xAOD::EgammaHelpers::isConvertedPhoton(&photon); + + // check if need to run over converted or unconverted photons + if (isConvertedPhoton) + { + // correct variables on the converted photon + for (unsigned int convertedPhotonTool_itr = 0; convertedPhotonTool_itr < m_convertedPhotonTools.size(); convertedPhotonTool_itr++) + { + ATH_MSG_VERBOSE("Running tool " << m_convertedPhotonTools.at(convertedPhotonTool_itr)->name()); + if ((m_convertedPhotonTools.at(convertedPhotonTool_itr)->applyCorrection(photon)) != CP::CorrectionCode::Ok) + { + ATH_MSG_ERROR("Could not apply correction to converted photon object."); + return CP::CorrectionCode::Error; + } + } + } + else + { + // correct variables on the converted photon + for (unsigned int unconvertedPhotonTool_itr = 0; unconvertedPhotonTool_itr < m_unconvertedPhotonTools.size(); unconvertedPhotonTool_itr++) + { + ATH_MSG_VERBOSE("Running tool " << m_unconvertedPhotonTools.at(unconvertedPhotonTool_itr)->name()); + if ((m_unconvertedPhotonTools.at(unconvertedPhotonTool_itr)->applyCorrection(photon)) != CP::CorrectionCode::Ok) + { + ATH_MSG_ERROR("Could not apply correction to unconverted photon object."); + return CP::CorrectionCode::Error; + } + } + } + + // everything worked out, so + return CP::CorrectionCode::Ok; +} +const CP::CorrectionCode ElectronPhotonVariableCorrectionTool::applyCorrection( xAOD::Electron& electron ) const +{ + // correct variables on the electron + for (unsigned int electronTool_itr = 0; electronTool_itr < m_electronTools.size(); electronTool_itr++) + { + ATH_MSG_VERBOSE("Running tool " << m_electronTools.at(electronTool_itr)->name()); + if ((m_electronTools.at(electronTool_itr)->applyCorrection(electron)) != CP::CorrectionCode::Ok) + { + ATH_MSG_ERROR("Could not apply correction to electron object."); + return CP::CorrectionCode::Error; + } + } + // everything worked out, so + return CP::CorrectionCode::Ok; +} + +/* ======================================== + * Corrected Copy + * ======================================== */ + +const CP::CorrectionCode ElectronPhotonVariableCorrectionTool::correctedCopy( const xAOD::Photon& in_photon, xAOD::Photon*& out_photon ) const +{ + ATH_MSG_VERBOSE("Will correct photon " << &in_photon << " of pT, eta = " << in_photon.pt() << " " << in_photon.eta()); + out_photon = new xAOD::Photon(in_photon); + return applyCorrection(*out_photon); +} + +const CP::CorrectionCode ElectronPhotonVariableCorrectionTool::correctedCopy( const xAOD::Electron& in_electron, xAOD::Electron*& out_electron) const +{ + ATH_MSG_VERBOSE("Will correct electron " << &in_electron << " of pT, eta = " << in_electron.pt() << " " << in_electron.eta()); + out_electron = new xAOD::Electron(in_electron); + return applyCorrection(*out_electron); +} + +/* ======================================== + * Helper functions + * ======================================== */ + +const StatusCode ElectronPhotonVariableCorrectionTool::getCorrectionVariableName( std::string &variableName, const std::string& confFile ) const +{ + // Retreive properties from configuration file, using TEnv class + TEnv env(confFile.c_str()); + // Send warning if duplicates found in conf file + env.IgnoreDuplicates(false); + + // retrieve variable name + if (env.Lookup("Variable")) + { + variableName = env.GetValue("Variable", ""); + } + else + { + ATH_MSG_ERROR("In conf file " << confFile << ": Correction variable is empty or not in configuration file."); + return StatusCode::FAILURE; + } + //everything worked out, so + return StatusCode::SUCCESS; +} diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/EGammaVariableCorrectionTool_ExampleConf.conf b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/EGammaVariableCorrectionTool_ExampleConf.conf new file mode 100644 index 0000000000000000000000000000000000000000..b99d311da8a205b76d7ef0936eb6858b909093e9 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/EGammaVariableCorrectionTool_ExampleConf.conf @@ -0,0 +1,10 @@ +# This is a ROOT configuration file to be read via TEnv +# Purpose is to steer the correction of a (un)converted photon or electron +# simultaneously in all to be corrected variables + +ElectronConfigs: EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase_ExampleElectronConf_Eratio.conf; ++ElectronConfigs: EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase_ExampleElectronConf_Rhad.conf +ConvertedPhotonConfigs: EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase_ExampleConvertedPhotonConf_Eratio.conf; ++ConvertedPhotonConfigs: EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase_ExampleConvertedPhotonConf_Rhad.conf +UnconvertedPhotonConfigs: EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase_ExampleUnconvertedPhotonConf_Eratio.conf; ++UnconvertedPhotonConfigs: EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase_ExampleUnconvertedPhotonConf_Rhad.conf \ No newline at end of file diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleConvertedPhotonConf_Eratio.conf b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleConvertedPhotonConf_Eratio.conf new file mode 100644 index 0000000000000000000000000000000000000000..f4f67885dfa9a4d01bab6c48012ece77e5372b5a --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleConvertedPhotonConf_Eratio.conf @@ -0,0 +1,20 @@ +# This is a ROOT configuration file to be read via TEnv +# Purpose is to steer the correction of an aux var via the apply tool + +# This is a configuration file to test the application of corrections to photons + +Variable: Eratio +Function: [0] * x + [1] +nFunctionParameters: 2 + +ApplyTo: convertedPhotons + +UncorrectedDiscontinuities: 0.; 1. + +PtBins: 0.0; 10000; 50000; 100000 +Parameter0Type: PtBinned +Parameter0Values: 1.; 2.; 3.; 4. + +EtaBins: 0.0; 1.5; 3. +Parameter1Type: EtaBinned +Parameter1Values: 1.; 2.; 3. diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleConvertedPhotonConf_Rhad.conf b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleConvertedPhotonConf_Rhad.conf new file mode 100644 index 0000000000000000000000000000000000000000..36f75f5380fc6284b25f2f3539de45a803e19c63 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleConvertedPhotonConf_Rhad.conf @@ -0,0 +1,20 @@ +# This is a ROOT configuration file to be read via TEnv +# Purpose is to steer the correction of an aux var via the apply tool + +# This is a configuration file to test the application of corrections to photons + +Variable: Rhad +Function: [0] * x + [1] +nFunctionParameters: 2 + +ApplyTo: convertedPhotons + +UncorrectedDiscontinuities: 0.; 1. + +PtBins: 0.0; 10000; 50000; 100000 +Parameter0Type: PtBinned +Parameter0Values: 1.; 2.; 3.; 4. + +EtaBins: 0.0; 1.5; 3. +Parameter1Type: EtaBinned +Parameter1Values: 1.; 2.; 3. diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleElectronConf_Eratio.conf b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleElectronConf_Eratio.conf new file mode 100644 index 0000000000000000000000000000000000000000..04e812b46ec864e0ef99a0dec9a704bbe63b599d --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleElectronConf_Eratio.conf @@ -0,0 +1,31 @@ +# This is a ROOT configuration file to be read via TEnv +# Purpose is to steer the correction of an aux var via the apply tool + +# This is a configuration file to test the application of corrections to electrons + +ApplyTo: allElectrons + +Variable: Eratio + +UncorrectedDiscontinuities: 0.; 1. + +Function: [0] + [1] * x + [2] * x**2 +nFunctionParameters: 3 + +PtBins: 0.0; 10000; 50000; 100000 +Parameter0Type: PtBinned +Parameter0Values: 1.; 2.; 3.; 4. +Parameter0Interpolate: TRUE + +EtaBins: 0.0; 1.; 2. +Parameter1Type: EtaBinned +Parameter1Values: 1.; 2.; 3. + +Parameter2Type: EtaTimesPtBinned +Parameter2Interpolate: TRUE +#pT \ eta >0.0 >1. >2. +Parameter2Values: 0.5; 1.; 1.5; #0 - 10 GeV# ++Parameter2Values: 2.; 2.5; 3; #10 - 50 GeV# ++Parameter2Values: 3.1; 3.2; 3.3; #50 - 100 GeV# ++Parameter2Values: 3.4; 3.5; 4. #> 100 GeV# + diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleElectronConf_Rhad.conf b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleElectronConf_Rhad.conf new file mode 100644 index 0000000000000000000000000000000000000000..fe80f9e62c5d88bb320b85cc43559ad44b38aff5 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleElectronConf_Rhad.conf @@ -0,0 +1,21 @@ +# This is a ROOT configuration file to be read via TEnv +# Purpose is to steer the correction of an aux var via the apply tool + +# This is a configuration file to test the application of corrections to electrons + +ApplyTo: allElectrons + +Variable: Rhad + +UncorrectedDiscontinuities: 0.; 1. + +Function: [0] * x + [1] +nFunctionParameters: 2 + +PtBins: 0.0; 10000; 50000; 100000 +Parameter0Type: PtBinned +Parameter0Values: 1.; 2.; 3.; 4. + +EtaBins: 0.0; 1.5; 3. +Parameter1Type: EtaBinned +Parameter1Values: 1.; 2.; 3. diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleUnconvertedPhotonConf_Eratio.conf b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleUnconvertedPhotonConf_Eratio.conf new file mode 100644 index 0000000000000000000000000000000000000000..b0553a664c7813edb3db406d1d1d7fef4e36d174 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleUnconvertedPhotonConf_Eratio.conf @@ -0,0 +1,20 @@ +# This is a ROOT configuration file to be read via TEnv +# Purpose is to steer the correction of an aux var via the apply tool + +# This is a configuration file to test the application of corrections to photons + +Variable: Eratio +Function: [0] * x + [1] +nFunctionParameters: 2 + +ApplyTo: unconvertedPhotons + +UncorrectedDiscontinuities: 0.; 1. + +PtBins: 0.0; 10000; 50000; 100000 +Parameter0Type: PtBinned +Parameter0Values: 1.; 2.; 3.; 4. + +EtaBins: 0.0; 1.5; 3. +Parameter1Type: EtaBinned +Parameter1Values: 1.; 2.; 3. diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleUnconvertedPhotonConf_Rhad.conf b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleUnconvertedPhotonConf_Rhad.conf new file mode 100644 index 0000000000000000000000000000000000000000..f0b10f7fcaed5bba0b371853e7d159625dd0dd22 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/data/ElectronPhotonVariableCorrectionBase_ExampleUnconvertedPhotonConf_Rhad.conf @@ -0,0 +1,20 @@ +# This is a ROOT configuration file to be read via TEnv +# Purpose is to steer the correction of an aux var via the apply tool + +# This is a configuration file to test the application of corrections to photons + +Variable: Rhad +Function: [0] * x + [1] +nFunctionParameters: 2 + +ApplyTo: unconvertedPhotons + +UncorrectedDiscontinuities: 0.; 1. + +PtBins: 0.0; 10000; 50000; 100000 +Parameter0Type: PtBinned +Parameter0Values: 1.; 2.; 3.; 4. + +EtaBins: 0.0; 1.5; 3. +Parameter1Type: EtaBinned +Parameter1Values: 1.; 2.; 3. diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/src/components/EGammaVariableCorrection_entries.cxx b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/src/components/EGammaVariableCorrection_entries.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c1ffd7aa303934d6d66ef81ac8d09c0b84d0ddf3 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/src/components/EGammaVariableCorrection_entries.cxx @@ -0,0 +1,6 @@ +#include "EGammaVariableCorrection/ElectronPhotonVariableCorrectionTool.h" + +DECLARE_COMPONENT( ElectronPhotonVariableCorrectionTool ) + + + diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/util/testElectronPhotonVariableCorrectionBase.cxx b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/util/testElectronPhotonVariableCorrectionBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..93a77a0055b34b3146f232df14b212ee5fd88be0 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/util/testElectronPhotonVariableCorrectionBase.cxx @@ -0,0 +1,243 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @brief Test if ElectronPhotonVariableCorrectionBase runs fine on electrons and (un-)converted photons + * @author Nils Gillwald (DESY) nils.gillwald@desy.de + * @date February 2020 + **/ + +// ROOT includes +#include "TFile.h" +#include "TString.h" + +//EDM includes +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODEgamma/PhotonAuxContainer.h" +#include "xAODEgamma/Electron.h" +#include "xAODEgamma/Photon.h" + +#include "EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase.h" +// +#include "AsgMessaging/AsgMessaging.h" + +////infrastructure includes +#ifdef ROOTCORE +#include "xAODRootAccess/TEvent.h" +//#include "xAODRootAccess/TStore.h" +#endif //ROOTCORE + +//main test code + +int main (int argc, char* argv[]) +{ + using namespace asg::msgUserCode; + // The application's name: + const char* APP_NAME = argv[0]; + + // Check if we received a file name: + if (argc < 2) + { + ANA_MSG_ERROR("No file name received!" ); + ANA_MSG_ERROR( " Usage: %s [xAOD file name] %d Num of events to process %d (0 photons , 1 electrons)"); + return EXIT_FAILURE; + } + + // Check if we want to process Electron/Photon shifts + bool isPhoton = false; + bool isElectron = false; + if (argc < 4) + { + ANA_MSG_INFO(APP_NAME << " By default looking at Photon" ); + isPhoton=true; + } + else + { + int argv1 = atoi(argv[3]); + if (argv1 == 0) + { + isPhoton = true; + ANA_MSG_INFO (APP_NAME << " We are looking at photon shifts" ); + } + else if (argv1 == 1) + { + isElectron = true; + ANA_MSG_INFO(APP_NAME << " We are looking at electron shifts"); + } + else + { + ANA_MSG_ERROR ("Usage: %s [xAOD file name] %d Num of events to process %d (0 photons , 1 electrons)"); + return EXIT_FAILURE; + } + } + + //open input file + const TString fileName = argv[1]; + ANA_MSG_INFO(APP_NAME << " Opening file: " << fileName.Data()); + std::unique_ptr<TFile> inputFile(TFile::Open(fileName, "READ")); //probably rather "READ"? + ANA_CHECK(inputFile.get()); + + // Create a TEvent object (persistent store) + xAOD::TEvent pers(xAOD::TEvent::kClassAccess); + // Create a TStore object (transient store) + xAOD::TStore trans; + ANA_CHECK(pers.readFrom(inputFile.get())); + // + ANA_MSG_INFO("Number of events in the file: " << pers.getEntries()); + + // Decide how many events to run over: + Long64_t entries = pers.getEntries(); + if (argc > 2) + { + const Long64_t userInputEntries = atoll(argv[2]); + if (userInputEntries < entries) + { + entries = userInputEntries; + ANA_MSG_INFO("Running over " << userInputEntries << " events."); + } + } + + // =============================================== + // Photon test + // =============================================== + if (isPhoton) + { + //initialise the tool + //converted photons + std::string configFilePathConverted = "ElectronPhotonShowerShapeFudgeTool/ElectronPhotonVariableCorrectionBase_ExampleConvertedPhotonConf_Eratio.conf"; + ElectronPhotonVariableCorrectionBase CorrectConvertedPhotonTool("CorrectConvertedPhotonTool"); + ANA_CHECK(CorrectConvertedPhotonTool.setProperty("ConfigFile",configFilePathConverted)); + ANA_CHECK(CorrectConvertedPhotonTool.initialize()); + //unconverted photons + std::string configFilePathUnconverted = "ElectronPhotonShowerShapeFudgeTool/ElectronPhotonVariableCorrectionBase_ExampleUnconvertedPhotonConf_Eratio.conf"; + ElectronPhotonVariableCorrectionBase CorrectUnconvertedPhotonTool("CorrectUnconvertedPhotonTool"); + ANA_CHECK(CorrectUnconvertedPhotonTool.setProperty("ConfigFile",configFilePathUnconverted)); + ANA_CHECK(CorrectUnconvertedPhotonTool.initialize()); + + std::string correctionVariable = CorrectConvertedPhotonTool.getCorrectionVariable(); + ANA_MSG_INFO("Correcting Variable: " << correctionVariable); + + //loop over the events + for (Long64_t entry = 0; entry < entries; entry++) + { + //get entry + pers.getEntry(entry); + ANA_MSG_INFO("============================"); + ANA_MSG_INFO("Event: " << entry); + + //get photon container + const xAOD::PhotonContainer* photons; + ANA_CHECK(pers.retrieve(photons, "Photons")); + + // Make a deep copy of the photon container + // Create the new container and its auxiliary store. + auto photons_copy = std::make_unique<xAOD::PhotonContainer>(); + auto photons_copy_aux = std::make_unique<xAOD::AuxContainerBase>(); + photons_copy->setStore (photons_copy_aux.get()); //< Connect the two + + //copy photons over + for (auto photon : *photons) { + // Copy this photon to the output container: + xAOD::Photon* photon_copy = new xAOD::Photon(); + photons_copy->push_back (photon_copy); // photon acquires the photon_copy auxstore + *photon_copy = *photon; // copies auxdata from one auxstore to the other + } + // end make deep copy + + //loop over deep copy of photon container + for (unsigned int photon_itr = 0; photon_itr < photons_copy->size(); photon_itr++) + { + ANA_MSG_INFO("---------------------------"); + ANA_MSG_INFO("Photon: " << photon_itr); + xAOD::Photon* photon = photons_copy->at(photon_itr); + + //apply correction + if (xAOD::EgammaHelpers::isConvertedPhoton(photon)) + { + ANA_MSG_INFO("Converted Photon."); + ANA_CHECK(CorrectConvertedPhotonTool.applyCorrection(*photon)); + } + else + { + ANA_MSG_INFO("Unconverted Photon."); + ANA_CHECK(CorrectUnconvertedPhotonTool.applyCorrection(*photon)); + } + + //get original and corrected value + SG::AuxElement::Accessor<float> VariableToCorrect(correctionVariable + "_original"); + SG::AuxElement::Accessor<float> CorrectedVariable(correctionVariable); + + //print results + ANA_MSG_INFO("Original value: " << VariableToCorrect(*photon)); + ANA_MSG_INFO("Corrected value: " << CorrectedVariable(*photon)); + + } // loop over deep copy of photon container + } // loop over events + } // if isPhoton + + // =============================================== + // Electron test + // =============================================== + if (isElectron) + { + std::string configFilePath = "ElectronPhotonShowerShapeFudgeTool/ElectronPhotonVariableCorrectionBase_ExampleElectronConf_Eratio.conf"; + ElectronPhotonVariableCorrectionBase CorrectElectronTool("CorrectElectronTool"); + ANA_CHECK(CorrectElectronTool.setProperty("ConfigFile",configFilePath)); + ANA_CHECK(CorrectElectronTool.initialize()); + + std::string correctionVariable = CorrectElectronTool.getCorrectionVariable(); + ANA_MSG_INFO("Correcting Variable: " << correctionVariable); + + //loop over the events + for (Long64_t entry = 0; entry < entries; entry++) + { + //get entry + pers.getEntry(entry); + ANA_MSG_INFO("============================"); + ANA_MSG_INFO("Event: " << entry); + + //get electron container + const xAOD::ElectronContainer* electrons; + ANA_CHECK(pers.retrieve(electrons, "Electrons")); + + // Make a deep copy of the electron container + // Create the new container and its auxiliary store. + auto electrons_copy = std::make_unique<xAOD::ElectronContainer>(); + auto electrons_copy_aux = std::make_unique<xAOD::AuxContainerBase>(); + electrons_copy->setStore (electrons_copy_aux.get()); //< Connect the two + + //copy electrons over + for (auto electron : *electrons) { + // Copy this electron to the output container: + xAOD::Electron* electron_copy = new xAOD::Electron(); + electrons_copy->push_back (electron_copy); // electron acquires the electron_copy auxstore + *electron_copy = *electron; // copies auxdata from one auxstore to the other + } + // end make deep copy + + //loop over deep copy of electron container + for (unsigned int electron_itr = 0; electron_itr < electrons_copy->size(); electron_itr++) + { + ANA_MSG_INFO("---------------------------"); + ANA_MSG_INFO("Electron: " << electron_itr); + xAOD::Electron* electron = electrons_copy->at(electron_itr); + + //apply correction + ANA_CHECK(CorrectElectronTool.applyCorrection(*electron)); + + //get original and corrected value + SG::AuxElement::Accessor<float> VariableToCorrect(correctionVariable + "_original"); + SG::AuxElement::Accessor<float> CorrectedVariable(correctionVariable); + + //print results + ANA_MSG_INFO("Original value: " << VariableToCorrect(*electron)); + ANA_MSG_INFO("Corrected value: " << CorrectedVariable(*electron)); + + } // loop over deep copy of electron container + } // loop over events + } // if isElectron + + return 0; +} diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/util/testElectronPhotonVariableCorrectionTool.cxx b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/util/testElectronPhotonVariableCorrectionTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..40338d003b75fb12cda2937067ade9eb42623ec2 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/util/testElectronPhotonVariableCorrectionTool.cxx @@ -0,0 +1,157 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @brief Test if ElectronPhotonVariableCorrectionTool runs fine on electrons and (un-)converted photons + * @author Nils Gillwald (DESY) nils.gillwald@desy.de + * @date February 2020 + **/ + +// ROOT includes +#include "TFile.h" +#include "TString.h" + +//EDM includes +#include "xAODEgamma/ElectronContainer.h" +#include "xAODEgamma/PhotonContainer.h" +#include "xAODEgamma/PhotonAuxContainer.h" +#include "xAODEgamma/Electron.h" +#include "xAODEgamma/Photon.h" + +#include "AsgTools/AnaToolHandle.h" +#include "EgammaAnalysisInterfaces/IElectronPhotonShowerShapeFudgeTool.h" + +#include "AsgMessaging/AsgMessaging.h" + +////infrastructure includes +#ifdef ROOTCORE +#include "xAODRootAccess/TEvent.h" +#include "xAODRootAccess/TStore.h" +#endif //ROOTCORE + +// main test code + +int main(int argc, char* argv[]) +{ + using namespace asg::msgUserCode; + + // The application's name: + const char* APP_NAME = argv[0]; + + // Check if we received a file name: + if (argc < 2) + { + ANA_MSG_ERROR("No file name received!" ); + ANA_MSG_ERROR( " Usage: %s [xAOD file name] %d Num of events to process %d (0 photons , 1 electrons)"); + return EXIT_FAILURE; + } + + //open input file + const TString fileName = argv[1]; + ANA_MSG_INFO(APP_NAME << " Opening file: " << fileName.Data()); + std::unique_ptr<TFile> inputFile(TFile::Open(fileName, "READ")); //probably rather "READ"? + ANA_CHECK(inputFile.get()); + + // Create a TEvent object (persistent store) + xAOD::TEvent pers(xAOD::TEvent::kClassAccess); + // Create a TStore object (transient store) + xAOD::TStore trans; + ANA_CHECK(pers.readFrom(inputFile.get())); + // + ANA_MSG_INFO("Number of events in the file: " << pers.getEntries()); + + // Decide how many events to run over: + Long64_t entries = pers.getEntries(); + if (argc > 2) + { + const Long64_t userInputEntries = atoll(argv[2]); + if (userInputEntries < entries) + { + entries = userInputEntries; + } + } + ANA_MSG_INFO("Running over " << entries << " events."); + + // initialize the tool + asg::AnaToolHandle<IElectronPhotonShowerShapeFudgeTool> myTool("ElectronPhotonVariableCorrectionTool/myTestTool"); + std::string configFile = "EGammaVariableCorrection/ElectronPhotonVariableCorrectionTool_ExampleConf.conf"; + ANA_CHECK(myTool.setProperty("ConfigFile", configFile)); + ANA_CHECK(myTool.initialize()); + + // loop over the events + for (Long64_t entry = 0; entry < entries; entry++) + { + //get entry + pers.getEntry(entry); + + // ==================================== + // Photons + // ==================================== + + //get photon container + const xAOD::PhotonContainer* photons; + ANA_CHECK(pers.retrieve(photons, "Photons")); + + // Make a deep copy of the photon container + // Create the new container and its auxiliary store. + auto photons_copy = std::make_unique<xAOD::PhotonContainer>(); + auto photons_copy_aux = std::make_unique<xAOD::AuxContainerBase>(); + photons_copy->setStore (photons_copy_aux.get()); //< Connect the two + + //copy photons over + for (auto photon : *photons) { + // Copy this photon to the output container: + xAOD::Photon* photon_copy = new xAOD::Photon(); + photons_copy->push_back (photon_copy); // photon acquires the photon_copy auxstore + *photon_copy = *photon; // copies auxdata from one auxstore to the other + } + // end make deep copy + + //loop over deep copy of photon container + for (unsigned int photon_itr = 0; photon_itr < photons_copy->size(); photon_itr++) + { + xAOD::Photon* photon = photons_copy->at(photon_itr); + + //apply correction + ANA_CHECK(myTool->applyCorrection(*photon)); + + } // loop over deep copy of photon container + + // ==================================== + // Electrons + // ==================================== + + //get electron container + const xAOD::ElectronContainer* electrons; + ANA_CHECK(pers.retrieve(electrons, "Electrons")); + + // Make a deep copy of the electron container + // Create the new container and its auxiliary store. + auto electrons_copy = std::make_unique<xAOD::ElectronContainer>(); + auto electrons_copy_aux = std::make_unique<xAOD::AuxContainerBase>(); + electrons_copy->setStore (electrons_copy_aux.get()); //< Connect the two + + //copy electrons over + for (auto electron : *electrons) { + // Copy this electron to the output container: + xAOD::Electron* electron_copy = new xAOD::Electron(); + electrons_copy->push_back (electron_copy); // electron acquires the electron_copy auxstore + *electron_copy = *electron; // copies auxdata from one auxstore to the other + } + // end make deep copy + + //loop over deep copy of electron container + for (unsigned int electron_itr = 0; electron_itr < electrons_copy->size(); electron_itr++) + { + xAOD::Electron* electron = electrons_copy->at(electron_itr); + + //apply correction + ANA_CHECK(myTool->applyCorrection(*electron)); + + } // loop over deep copy of electrone container + + } // loop over events + + return 0; +} diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/util/testElectronPhotonVariableCorrectionTool_DictionaryToolHandle.cxx b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/util/testElectronPhotonVariableCorrectionTool_DictionaryToolHandle.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ec38bf5fe53f45443331975747571b0d47ea64fb --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/util/testElectronPhotonVariableCorrectionTool_DictionaryToolHandle.cxx @@ -0,0 +1,38 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + @brief Test code to test ElectronPhotonVariableCorrectionTool Dictionaries + @author Nils Gillwald (DESY) nils.gillwald@desy.de + @date February 2020 +**/ + +// ROOT include(s): +#include <TError.h> + +// EDM include(s): +#include "AsgTools/AnaToolHandle.h" + +#include "EgammaAnalysisInterfaces/IElectronPhotonShowerShapeFudgeTool.h" + +#define MSGSOURCE "testElectronPhotonVariableCorrectionTool_DictionaryToolHandle" + +int main(/*int argc, char* argv[]*/) //unused variable warnings!! +{ + Info(MSGSOURCE, "Configuring the ElectronPhotonVariableCorrectionTool"); + asg::AnaToolHandle<IElectronPhotonShowerShapeFudgeTool> myTool("ElectronPhotonVariableCorrectionTool/myTool"); + myTool.setProperty("ConfigFile", "EGammaVariableCorrection/EGammaVariableCorrectionTool_ExampleConf.conf").ignore(); + if(myTool.initialize() != StatusCode::SUCCESS) + { + Error(MSGSOURCE, "Unable to initialize the ElectronPhotonVariableCorrectionTool!"); + return 1; + } + else + { + Info(MSGSOURCE, "Initialized the ElectronPhotonVariableCorrectionTool!"); + } + + + return 0; +} //end main diff --git a/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/util/testIsoCorrection.cxx b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/util/testIsoCorrection.cxx new file mode 100644 index 0000000000000000000000000000000000000000..edd58d251b633fa636e859a2c271a18ca3df2e1a --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EGammaVariableCorrection/util/testIsoCorrection.cxx @@ -0,0 +1,119 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +/** + @brief Test code to compare output of ElectronPhotonVariableCorrectionBase correction to the isolation correction tool + @author Nils Gillwald (DESY) nils.gillwald@desy.de + @date February 2020 +**/ + +// ROOT includes +#include "TFile.h" +#include "TString.h" + +//EDM includes +#include "xAODEgamma/PhotonContainer.h" +#include "xAODEgamma/PhotonAuxContainer.h" +#include "xAODEgamma/Photon.h" + +// must be changed to not be a relative path! +#include "EGammaVariableCorrection/ElectronPhotonVariableCorrectionBase.h" +// +#include "AsgMessaging/AsgMessaging.h" + +//infrastructure includes +#ifdef ROOTCORE +#include "xAODRootAccess/TEvent.h" +#include "xAODRootAccess/TStore.h" +#endif //ROOTCORE +#include "IsolationCorrections/IsolationCorrectionTool.h" +#include "xAODCore/ShallowCopy.h" + +//main test code + +int main (int argc, char* argv[]) +{ + using namespace asg::msgUserCode; + // The application's name: + const char* APP_NAME = argv[0]; + // Check if we received a file name: + if (argc < 2) + { + ANA_MSG_ERROR("No file name received!" ); + ANA_MSG_ERROR( " Usage: %s [xAOD file name] %d Num of events to process %d (0 photons , 1 electrons)"); + return EXIT_FAILURE; + } + + //open input file + const TString fileName = argv[1]; + ANA_MSG_INFO(APP_NAME << " Opening file: " << fileName.Data()); + std::unique_ptr<TFile> inputFile(TFile::Open(fileName, "READ")); + ANA_CHECK(inputFile.get()); + + // Create a TEvent object (persistent store) + xAOD::TEvent pers(xAOD::TEvent::kClassAccess); + // Create a TStore object (transient store) + xAOD::TStore trans; + ANA_CHECK(pers.readFrom(inputFile.get())); + + ANA_MSG_INFO("Number of events in the file: " << pers.getEntries()); + + // Decide how many events to run over: + Long64_t entries = pers.getEntries(); + if (argc > 2) + { + const Long64_t userInputEntries = atoll(argv[2]); + if (userInputEntries < entries) + { + entries = userInputEntries; + } + } + + //initialise the tool + ElectronPhotonVariableCorrectionBase fudgeTool("fudgeTool"); + ANA_CHECK(fudgeTool.setProperty("ConfigFile","ElectronPhotonShowerShapeFudgeTool/ElectronPhotonVariableCorrectionBase_ExampleIsoCorrectionConf.conf")); + ANA_CHECK(fudgeTool.initialize()); + + //crosscheck with isolationcorrectiontool + // check these StatusCodes once update to a newer AnalysisBase version (not 21.2.56, probably > 21.2.94) + CP::IsolationCorrectionTool isoCorrToolFull("isoCorrToolFull"); + ANA_CHECK(isoCorrToolFull.setProperty("Apply_etaEDPar_mc_correction", true)); + ANA_CHECK(isoCorrToolFull.setProperty("Apply_etaEDParPU_correction", true)); + ANA_CHECK(isoCorrToolFull.initialize()); + + CP::IsolationCorrectionTool isoCorrToolStep("isoCorrToolStep"); + ANA_CHECK(isoCorrToolStep.setProperty("Apply_etaEDPar_mc_correction", false)); + ANA_CHECK(isoCorrToolStep.setProperty("Apply_etaEDParPU_correction", true)); + ANA_CHECK(isoCorrToolStep.initialize()); + + //loop over the events + for (Long64_t entry = 0; entry < entries; entry++) + { + //get entry + pers.getEntry(entry); + ANA_MSG_INFO("============================"); + ANA_MSG_INFO("Event: " << entry); + + //get photon container + const xAOD::PhotonContainer* photons; + ANA_CHECK(pers.retrieve(photons, "Photons")); + std::pair< xAOD::PhotonContainer*, xAOD::ShallowAuxContainer* > photons_isocorr = xAOD::shallowCopyContainer( *photons ); + std::pair< xAOD::PhotonContainer*, xAOD::ShallowAuxContainer* > photons_fudge = xAOD::shallowCopyContainer( *photons ); + + //loop over photon container + for (unsigned int idx = 0; idx < photons->size(); idx++) + { + ANA_MSG_INFO("---------------------------"); + ANA_MSG_INFO("Photon: " << idx); + ANA_CHECK(isoCorrToolFull.applyCorrection(*(photons_isocorr.first->at(idx)))); + ANA_CHECK(isoCorrToolStep.applyCorrection(*(photons_fudge.first->at(idx)))); + ANA_CHECK(fudgeTool.applyCorrection(*(photons_fudge.first->at(idx)))); + ANA_MSG_INFO("topoetcone40 fudge before applyCorrection: " << photons_fudge.first->at(idx)->auxdata<float>("topoetcone40_original")); + ANA_MSG_INFO("topoetcone40 fudge after applyCorrection : " << photons_fudge.first->at(idx)->auxdata<float>("topoetcone40")); + ANA_MSG_INFO("topoetcone40 with IsolationCorrectionTool : " << photons_isocorr.first->at(idx)->auxdata<float>("topoetcone40")); + } // loop over photon container + } // loop over events + + return 0; +} diff --git a/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/EgammaAnalysisHelpers/AsgEGammaConfigHelper.h b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/EgammaAnalysisHelpers/AsgEGammaConfigHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..b21125e1d9696cb8fb0b864cdcd06177de4127a9 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/EgammaAnalysisHelpers/AsgEGammaConfigHelper.h @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + + +// Dear emacs, this is -*-c++-*- +#ifndef ASGELEGAMMACONFIGHELPER_H +#define ASGELEGAMMACONFIGHELPER_H + +/** + @brief Tool to simplify the configuration of some egamma tools based on TEnv input + @author Christos Anastopoulos (2017) Nils Gillwald (DESY, 2020) nils.gillwald@desy.de + @date February 2020 +*/ +#include <string> +#include <vector> +#include <map> +class TEnv; + +namespace AsgConfigHelper{ + std::string findConfigFile (std::string input, const std::map<std::string,std::string>& configmap); + unsigned int findMask (std::string input, const std::map<std::string,unsigned int>& maskmap); + std::vector<double> HelperDouble(const std::string& input, TEnv& env); + std::vector<float> HelperFloat(const std::string& input, TEnv& env); + std::vector<int> HelperInt(const std::string& input, TEnv& env); + std::vector<std::string> HelperString(const std::string& input, TEnv& env); +} + + +#endif //ASGEGAMMACONFIGHELPER_H diff --git a/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/Root/AsgEGammaConfigHelper.cxx b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/Root/AsgEGammaConfigHelper.cxx new file mode 100644 index 0000000000000000000000000000000000000000..09211e9ad376cc05a6bf782a28715cf8d44f7910 --- /dev/null +++ b/PhysicsAnalysis/ElectronPhotonID/EgammaAnalysisHelpers/Root/AsgEGammaConfigHelper.cxx @@ -0,0 +1,117 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "EgammaAnalysisHelpers/AsgEGammaConfigHelper.h" +#include "AsgMessaging/AsgMessaging.h" +#include "TEnv.h" +#include <iostream> +#include <sstream> + +namespace AsgConfigHelper{ + + std::string findConfigFile (std::string input, const std::map<std::string,std::string>& configmap){ + auto confFile_itr=configmap.find(input); + if(confFile_itr == configmap.end()){ + static const asg::AsgMessaging msg("Egamma::AsgConfigHelper"); + msg.msg(MSG::WARNING)<<"Key "<<input<<" not found in map, no config file returned"<<endmsg; + return ""; + } + return confFile_itr->second; + } + + unsigned int findMask (std::string input, const std::map<std::string,unsigned int>& maskmap){ + auto mask_itr=maskmap.find(input); + if(mask_itr==maskmap.end()){ + static const asg::AsgMessaging msg("Egamma::AsgConfigHelper"); + msg.msg(MSG::WARNING)<<"Key "<<input<<" not found in map, egammaPID::EgPidUndefined mask returned"<<endmsg; + // mask has the choice to default to all 1 or all 0 bits, choose the former + return std::numeric_limits<unsigned int>::max(); + } + return static_cast < unsigned int> (mask_itr->second); + } + + template <typename T> + bool strtof(const std::string& input, T& f){ + int diff = 0 ; + std::string tmp = input; + std::string::size_type first(0); + std::string::size_type last(0); + first = ( input.find("#") ) ; + + //if we do not find a comment character "#" we are fine + if (first == std::string::npos) { + std::istringstream buffer (tmp); + buffer>>f; + return true; + } + else { + //if we have found comment character check if it is inlined between two "#" + last = (input.find("#",first+1) ); + //if nor error + if (last == std::string::npos) { + static const asg::AsgMessaging msg("Egamma::AsgConfigHelper"); + msg.msg(MSG::WARNING)<<" Improper comment format , inline comment should be enclosed between two # "<<endmsg; + return false; + } + //else if between two "#" remove this part + diff = last - first ; + tmp= tmp.erase(first,diff+1); + std::istringstream buffer (tmp); + buffer>>f; + return true; + } + } + + template <typename T> + std::vector<T> Helper (const std::string& input, TEnv& env){ + std::vector<T> CutVector; + std::string env_input(env.GetValue(input.c_str(), "")); + if (env_input.size() > 0) { + std::string::size_type end; + do { + end = env_input.find(";"); + T myValue(0); + if(AsgConfigHelper::strtof(env_input.substr(0,end),myValue)){ + CutVector.push_back(myValue); + } + if (end != std::string::npos) { + env_input= env_input.substr(end+1); + } + } while (end != std::string::npos); + } + return CutVector; + } +} + +//use the specializations +std::vector<double> AsgConfigHelper::HelperDouble(const std::string& input, TEnv& env){ + return AsgConfigHelper::Helper<double> ( input,env); +} +std::vector<float> AsgConfigHelper::HelperFloat(const std::string& input, TEnv& env){ + return AsgConfigHelper::Helper<float> (input, env); +} +std::vector<int> AsgConfigHelper::HelperInt(const std::string& input, TEnv& env){ + return AsgConfigHelper::Helper<int> (input, env); +} +// template does not work for std::string because of the T myValue(0); declaration, so implement it again for std::string +std::vector<std::string> AsgConfigHelper::HelperString(const std::string& input, TEnv& env){ + std::vector<std::string> CutVector; + std::string env_input(env.GetValue(input.c_str(), "")); + if (env_input.size() > 0) { + std::string::size_type end; + do { + end = env_input.find(";"); + std::string myValue(""); + if(AsgConfigHelper::strtof(env_input.substr(0,end),myValue)){ + CutVector.push_back(myValue); + } + if (end != std::string::npos) { + env_input= env_input.substr(end+1); + } + } while (end != std::string::npos); + } + return CutVector; +} + + diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool.h b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool.h index 5454a2bb9337fa6c60f81e4e22206d16608a9acd..6c3bf32a613e8eb04d992d62adb96596d3b97a82 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool.h +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool.h @@ -16,11 +16,7 @@ */ // Framework include(s): #include "AsgTools/AsgTool.h" -#ifdef USE_NEW_TOOL #include "ElectronPhotonShowerShapeFudgeTool/TPhotonMCShifterTool.h" -#else -#include "ElectronPhotonShowerShapeFudgeTool/FudgeMCTool.h" -#endif #include "ElectronPhotonShowerShapeFudgeTool/TElectronMCShifterTool.h" #include "EgammaAnalysisInterfaces/IElectronPhotonShowerShapeFudgeTool.h" #include "TEnv.h" @@ -57,16 +53,13 @@ public: private: -#ifdef USE_NEW_TOOL TPhotonMCShifterTool* m_ph_rootTool; -#else - FudgeMCTool* m_ph_rootTool; -#endif TElectronMCShifterTool* m_el_rootTool; int m_preselection; std::string m_configFile; + std::string m_ffFile; /** Copied over from the configuration helper so that the selector tools do not need to be included */ std::vector<float> GetFloatVector(const std::string& input, TEnv& env); diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool/TPhotonMCShifterTool.h b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool/TPhotonMCShifterTool.h index 68f49fa3d83f81dd414e46685a5531d1ebda4a31..e5980262b886c6e804ef7d4aaca67ede5c06162b 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool/TPhotonMCShifterTool.h +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/ElectronPhotonShowerShapeFudgeTool/TPhotonMCShifterTool.h @@ -2,380 +2,454 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#ifndef TPhotonMCShifterTool_h -#define TPhotonMCShifterTool_h - -/* @author Giovanni Marchiori <giovanni.marchiori@cern.ch> - * - * Reimplementation of FudgeMCTool with photon fudge factors - * stored in ROOT files instead of a C++ file - * - */ - -#include <iostream> -#include <stdio.h> -#include <cmath> -#include "TH2D.h" -#include "TGraphErrors.h" -#include "TSystem.h" - -namespace IDVAR -{ - const int RHAD1 = 0; - const int RHAD = 1; - const int E277 = 2; - const int RETA = 3; - const int RPHI = 4; - const int WETA2 = 5; - const int F1 = 6; - const int FSIDE = 7; - const int WTOT = 8; - const int W1 = 9; - const int DE = 10; - const int ERATIO = 11; -} - - -class TPhotonMCShifterTool -{ - - public: - - TPhotonMCShifterTool(); - ~TPhotonMCShifterTool(); - - //fudge shower shapes for preselection chosen. - void FudgeShowers( double pt , - double eta2 , - double& rhad1 , - double& rhad , - double& e277 , - double& reta , - double& rphi , - double& weta2 , - double& f1 , - double& fside , - double& wtot , - double& w1 , - double& deltae , - double& eratio , - int isConv , - int preselection=-999); - - //fudge shower shapes for preselection chosen. - void FudgeShowers( float pt , - float eta2 , - float& rhad1 , - float& rhad , - float& e277 , - float& reta , - float& rphi , - float& weta2 , - float& f1 , - float& fside , - float& wtot , - float& w1 , - float& deltae , - float& eratio , - int isConv , - int preselection=-999); - - // fudge showers using D3PD vectors (except for eratio) - void FudgeShowers( std::vector<float> clE, - std::vector<float> eta2 , - std::vector<float>& rhad1 , - std::vector<float>& rhad , - std::vector<float>& e277 , - std::vector<float>& reta , - std::vector<float>& rphi , - std::vector<float>& weta2 , - std::vector<float>& f1 , - std::vector<float>& fside , - std::vector<float>& wtot , - std::vector<float>& w1 , - std::vector<float>& deltae , - std::vector<float>& eratio , - std::vector<int> isConv , - int preselection=-999); - - /** Calculate Eratio (the only variable which is not stored in the egamma/PhotonD3PD) - * given emaxs1 and Emax2. Return a pointer to a vector<float> - **/ - static std::vector<float>* getEratio(std::vector<float> emaxs1, std::vector<float> Emax2) - { - std::vector<float> *eratio = new std::vector<float>(); - for (unsigned int i = 0; i < emaxs1.size(); ++i) - eratio->push_back(emaxs1[i] + Emax2[i] == 0 ? 0 : - (emaxs1[i] - Emax2[i])/(emaxs1[i] + Emax2[i])); - return eratio; - } - - // get fudge factor for predefined preselection - double GetFF_Rhad1 (double pt, double eta2, int conv){ - if (conv) return (h_c_rhad1->GetBinContent(h_u_rhad1->FindBin(pt, fabs(eta2)))); - else return (h_u_rhad1->GetBinContent(h_u_rhad1->FindBin(pt, fabs(eta2))));}; - - double GetFF_Rhad (double pt, double eta2, int conv){ - if (conv) return (h_c_rhad->GetBinContent(h_c_rhad->FindBin(pt, fabs(eta2)))); - else return (h_u_rhad->GetBinContent(h_u_rhad->FindBin(pt, fabs(eta2))));}; - - double GetFF_E277 (double pt, double eta2, int conv){ - if (conv) return (h_c_e277->GetBinContent(h_c_e277->FindBin(pt, fabs(eta2)))); - else return (h_u_e277->GetBinContent(h_u_e277->FindBin(pt, fabs(eta2))));}; - - double GetFF_Reta (double pt, double eta2, int conv){ - if (conv) return (h_c_reta->GetBinContent(h_c_reta->FindBin(pt, fabs(eta2)))); - else return (h_u_reta->GetBinContent(h_u_reta->FindBin(pt, fabs(eta2))));}; - - double GetFF_Rphi (double pt, double eta2, int conv){ - if (conv) return (h_c_rphi->GetBinContent(h_c_rphi->FindBin(pt, fabs(eta2)))); - else return (h_u_rphi->GetBinContent(h_u_rphi->FindBin(pt, fabs(eta2))));}; - - double GetFF_Weta2 (double pt, double eta2, int conv){ - if (conv) return (h_c_weta2->GetBinContent(h_c_weta2->FindBin(pt, fabs(eta2)))); - else return (h_u_weta2->GetBinContent(h_u_weta2->FindBin(pt, fabs(eta2))));}; - - double GetFF_F1 (double pt, double eta2, int conv){ - if (conv) return (h_c_f1->GetBinContent(h_c_f1->FindBin(pt, fabs(eta2)))); - else return (h_u_f1->GetBinContent(h_u_f1->FindBin(pt, fabs(eta2))));}; - - double GetFF_DE (double pt, double eta2, int conv){ - if (conv) return (h_c_de->GetBinContent(h_c_de->FindBin(pt, fabs(eta2)))); - else return (h_u_de->GetBinContent(h_u_de->FindBin(pt, fabs(eta2))));}; - - double GetFF_Eratio(double pt, double eta2, int conv){ - if (conv) return (h_c_eratio->GetBinContent(h_c_eratio->FindBin(pt, fabs(eta2)))); - else return (h_u_eratio->GetBinContent(h_u_eratio->FindBin(pt, fabs(eta2))));}; - - double GetFF_Fside (double pt, double eta2, int conv){ - if (conv) return (h_c_fside->GetBinContent(h_c_fside->FindBin(pt, fabs(eta2)))); - else return (h_u_fside->GetBinContent(h_u_fside->FindBin(pt, fabs(eta2))));}; - - double GetFF_Wtot (double pt, double eta2, int conv){ - if (conv) return (h_c_wtot->GetBinContent(h_c_wtot->FindBin(pt, fabs(eta2)))); - else return (h_u_wtot->GetBinContent(h_u_wtot->FindBin(pt, fabs(eta2))));}; - - double GetFF_W1 (double pt, double eta2, int conv){ - if (conv) return (h_c_w1->GetBinContent(h_c_w1->FindBin(pt, fabs(eta2)))); - else return (h_u_w1->GetBinContent(h_u_w1->FindBin(pt, fabs(eta2))));}; - - double GetFFerr_Rhad1 (double pt, double eta2, int conv){ - if (conv) return (h_c_rhad1->GetBinError(h_u_rhad1->FindBin(pt, fabs(eta2)))); - else return (h_u_rhad1->GetBinError(h_u_rhad1->FindBin(pt, fabs(eta2))));}; - - double GetFFerr_Rhad (double pt, double eta2, int conv){ - if (conv) return (h_c_rhad->GetBinError(h_c_rhad->FindBin(pt, fabs(eta2)))); - else return (h_u_rhad->GetBinError(h_u_rhad->FindBin(pt, fabs(eta2))));}; - - double GetFFerr_E277 (double pt, double eta2, int conv){ - if (conv) return (h_c_e277->GetBinError(h_c_e277->FindBin(pt, fabs(eta2)))); - else return (h_u_e277->GetBinError(h_u_e277->FindBin(pt, fabs(eta2))));}; - - double GetFFerr_Reta (double pt, double eta2, int conv){ - if (conv) return (h_c_reta->GetBinError(h_c_reta->FindBin(pt, fabs(eta2)))); - else return (h_u_reta->GetBinError(h_u_reta->FindBin(pt, fabs(eta2))));}; - - double GetFFerr_Rphi (double pt, double eta2, int conv){ - if (conv) return (h_c_rphi->GetBinError(h_c_rphi->FindBin(pt, fabs(eta2)))); - else return (h_u_rphi->GetBinError(h_u_rphi->FindBin(pt, fabs(eta2))));}; - - double GetFFerr_Weta2 (double pt, double eta2, int conv){ - if (conv) return (h_c_weta2->GetBinError(h_c_weta2->FindBin(pt, fabs(eta2)))); - else return (h_u_weta2->GetBinError(h_u_weta2->FindBin(pt, fabs(eta2))));}; - - double GetFFerr_F1 (double pt, double eta2, int conv){ - if (conv) return (h_c_f1->GetBinError(h_c_f1->FindBin(pt, fabs(eta2)))); - else return (h_u_f1->GetBinError(h_u_f1->FindBin(pt, fabs(eta2))));}; - - double GetFFerr_DE (double pt, double eta2, int conv){ - if (conv) return (h_c_de->GetBinError(h_c_de->FindBin(pt, fabs(eta2)))); - else return (h_u_de->GetBinError(h_u_de->FindBin(pt, fabs(eta2))));}; - - double GetFFerr_Eratio(double pt, double eta2, int conv){ - if (conv) return (h_c_eratio->GetBinError(h_c_eratio->FindBin(pt, fabs(eta2)))); - else return (h_u_eratio->GetBinError(h_u_eratio->FindBin(pt, fabs(eta2))));}; - - double GetFFerr_Fside (double pt, double eta2, int conv){ - if (conv) return (h_c_fside->GetBinError(h_c_fside->FindBin(pt, fabs(eta2)))); - else return (h_u_fside->GetBinError(h_u_fside->FindBin(pt, fabs(eta2))));}; - - double GetFFerr_Wtot (double pt, double eta2, int conv){ - if (conv) return (h_c_wtot->GetBinError(h_c_wtot->FindBin(pt, fabs(eta2)))); - else return (h_u_wtot->GetBinError(h_u_wtot->FindBin(pt, fabs(eta2))));}; - - double GetFFerr_W1 (double pt, double eta2, int conv){ - if (conv) return (h_c_w1->GetBinError(h_c_w1->FindBin(pt, fabs(eta2)))); - else return (h_u_w1->GetBinError(h_u_w1->FindBin(pt, fabs(eta2))));}; - - double GetFF (int var, double pt, double eta2, int conv){ - switch (var) { - case IDVAR::RHAD1: return GetFF_Rhad1( pt, eta2, conv ); - case IDVAR::RHAD: return GetFF_Rhad( pt, eta2, conv ); - case IDVAR::E277: return GetFF_E277( pt, eta2, conv ); - case IDVAR::RETA: return GetFF_Reta( pt, eta2, conv ); - case IDVAR::RPHI: return GetFF_Rphi( pt, eta2, conv ); - case IDVAR::WETA2: return GetFF_Weta2( pt, eta2, conv ); - case IDVAR::F1: return GetFF_F1( pt, eta2, conv ); - case IDVAR::FSIDE: return GetFF_Fside( pt, eta2, conv ); - case IDVAR::WTOT: return GetFF_Wtot( pt, eta2, conv ); - case IDVAR::W1: return GetFF_W1( pt, eta2, conv ); - case IDVAR::DE: return GetFF_DE( pt, eta2, conv ); - case IDVAR::ERATIO: return GetFF_Eratio( pt, eta2, conv ); - default: return 0.0; - } - } - - // fudge a specific variable - double Fudge_Rhad1 ( double rhad1, double pt, double eta2, int conv){ return ( rhad1 + GetFF_Rhad1 ( pt, eta2, conv ) ); } - double Fudge_Rhad ( double rhad, double pt, double eta2, int conv){ return ( rhad + GetFF_Rhad ( pt, eta2, conv ) ); } - double Fudge_E277 ( double e277, double pt, double eta2, int conv){ return ( e277 + GetFF_E277 ( pt, eta2, conv ) ); } - double Fudge_Reta ( double reta, double pt, double eta2, int conv){ return ( reta + GetFF_Reta ( pt, eta2, conv ) ); } - double Fudge_Rphi ( double rphi, double pt, double eta2, int conv){ return ( rphi + GetFF_Rphi ( pt, eta2, conv ) ); } - double Fudge_Weta2 ( double weta2, double pt, double eta2, int conv){ return ( weta2 + GetFF_Weta2 ( pt, eta2, conv ) ); } - double Fudge_F1 ( double f1, double pt, double eta2, int conv){ return ( f1 + GetFF_F1 ( pt, eta2, conv ) ); } - double Fudge_DE ( double deltae, double pt, double eta2, int conv){ return ( deltae + GetFF_DE ( pt, eta2, conv ) ); } - double Fudge_Eratio( double eratio, double pt, double eta2, int conv){ return ( eratio + GetFF_Eratio ( pt, eta2, conv ) ); } - double Fudge_Fside ( double fside, double pt, double eta2, int conv){ return ( fside + GetFF_Fside ( pt, eta2, conv ) ); } - double Fudge_Wtot ( double wtot, double pt, double eta2, int conv){ return ( wtot + GetFF_Wtot ( pt, eta2, conv ) ); } - double Fudge_W1 ( double w1, double pt, double eta2, int conv){ return ( w1 + GetFF_W1 ( pt, eta2, conv ) ); } - - // set shower preselection cuts - // *** 2010 - // 0 = tight isolated - // 1 = loose isolated - // 2 = tightx isolated - // 3 = tighty isolated - // 4 = tight isolated . Distorted material - // *** 2011 - // 5 = tight isolated - // 6 = tight non-isolated - // *** - // 10= tight isolated. Old menu rel15 (tune 3 in PhotonIDTool). - // .. - void SetVerbose( bool verbose=true ){ m_verbose=verbose; } - int GetPreselection(){ return m_preselection; }; - - //drawing methods - TGraphErrors* GetFFmap (int var, double eta, int isConv, int preselection); - - TGraphErrors* GetFFmap_Rhad1 (double eta, int isConv, int preselection); - TGraphErrors* GetFFmap_Rhad (double eta, int isConv, int preselection); - TGraphErrors* GetFFmap_E277 (double eta, int isConv, int preselection); - TGraphErrors* GetFFmap_Reta (double eta, int isConv, int preselection); - TGraphErrors* GetFFmap_Rphi (double eta, int isConv, int preselection); - TGraphErrors* GetFFmap_Weta2 (double eta, int isConv, int preselection); - TGraphErrors* GetFFmap_F1 (double eta, int isConv, int preselection); - TGraphErrors* GetFFmap_Fside (double eta, int isConv, int preselection); - TGraphErrors* GetFFmap_Wtot (double eta, int isConv, int preselection); - TGraphErrors* GetFFmap_W1 (double eta, int isConv, int preselection); - TGraphErrors* GetFFmap_DE (double eta, int isConv, int preselection); - TGraphErrors* GetFFmap_Eratio(double eta, int isConv, int preselection); - // TH2D* GetFFTH2D(int var, int isConv, int preselection); - void LoadFFs(int preselection); - - private: - bool m_verbose; - - //shower preselection to extract FFs - int m_preselection; - - // collections of fudge factors - TH2D* h_u_rhad1; - TH2D* h_u_rhad; - TH2D* h_u_e277; - TH2D* h_u_reta; - TH2D* h_u_rphi; - TH2D* h_u_weta2; - TH2D* h_u_f1; - TH2D* h_u_fside; - TH2D* h_u_wtot; - TH2D* h_u_w1; - TH2D* h_u_de; - TH2D* h_u_eratio; - TH2D* h_c_rhad1; - TH2D* h_c_rhad; - TH2D* h_c_e277; - TH2D* h_c_reta; - TH2D* h_c_rphi; - TH2D* h_c_weta2; - TH2D* h_c_f1; - TH2D* h_c_fside; - TH2D* h_c_wtot; - TH2D* h_c_w1; - TH2D* h_c_de; - TH2D* h_c_eratio; - - void SafeDeleteHistograms(); -}; - -#endif // #ifdef TPhotonMCShifterTool_h - -#ifdef TPhotonMCShifterTool_cxx - -TPhotonMCShifterTool::TPhotonMCShifterTool() -{ - m_preselection = -1; - h_u_rhad1 = 0; - h_u_rhad = 0; - h_u_e277 = 0; - h_u_reta = 0; - h_u_rphi = 0; - h_u_weta2 = 0; - h_u_f1 = 0; - h_u_fside = 0; - h_u_wtot = 0; - h_u_w1 = 0; - h_u_de = 0; - h_u_eratio = 0; - h_c_rhad1 = 0; - h_c_rhad = 0; - h_c_e277 = 0; - h_c_reta = 0; - h_c_rphi = 0; - h_c_weta2 = 0; - h_c_f1 = 0; - h_c_fside = 0; - h_c_wtot = 0; - h_c_w1 = 0; - h_c_de = 0; - h_c_eratio = 0; - - m_verbose = false; - // std::cout << "Initiliazing the tool ---->>> preselection " << preselection << std::endl; - -} - -TPhotonMCShifterTool::~TPhotonMCShifterTool() -{ - SafeDeleteHistograms(); -} - -void TPhotonMCShifterTool::SafeDeleteHistograms() { - if (h_u_rhad1) {delete h_u_rhad1; h_u_rhad1 = 0;} - if (h_u_rhad) {delete h_u_rhad; h_u_rhad = 0;} - if (h_u_e277) {delete h_u_e277; h_u_e277 = 0;} - if (h_u_reta) {delete h_u_reta; h_u_reta = 0;} - if (h_u_rphi) {delete h_u_rphi; h_u_rphi = 0;} - if (h_u_weta2) {delete h_u_weta2; h_u_weta2 = 0;} - if (h_u_f1) {delete h_u_f1; h_u_f1 = 0;} - if (h_u_fside) {delete h_u_fside; h_u_fside = 0;} - if (h_u_wtot) {delete h_u_wtot; h_u_wtot = 0;} - if (h_u_w1) {delete h_u_w1; h_u_w1 = 0;} - if (h_u_de) {delete h_u_de; h_u_de = 0;} - if (h_u_eratio) {delete h_u_eratio; h_u_eratio = 0;} - if (h_c_rhad1) {delete h_c_rhad1; h_c_rhad1 = 0;} - if (h_c_rhad) {delete h_c_rhad; h_c_rhad = 0;} - if (h_c_e277) {delete h_c_e277; h_c_e277 = 0;} - if (h_c_reta) {delete h_c_reta; h_c_reta = 0;} - if (h_c_rphi) {delete h_c_rphi; h_c_rphi = 0;} - if (h_c_weta2) {delete h_c_weta2; h_c_weta2 = 0;} - if (h_c_f1) {delete h_c_f1; h_c_f1 = 0;} - if (h_c_fside) {delete h_c_fside; h_c_fside = 0;} - if (h_c_wtot) {delete h_c_wtot; h_c_wtot = 0;} - if (h_c_w1) {delete h_c_w1; h_c_w1 = 0;} - if (h_c_de) {delete h_c_de; h_c_de = 0;} - if (h_c_eratio) {delete h_c_eratio; h_c_eratio = 0;} -} - -#endif// #ifdef TPhotonMCShifterTool_cxx - +#ifndef TPhotonMCShifterTool_h +#define TPhotonMCShifterTool_h + +/* @author Giovanni Marchiori <giovanni.marchiori@cern.ch> + * + * Reimplementation of FudgeMCTool with photon fudge factors + * stored in ROOT files instead of a C++ file + * + */ + +#include <iostream> +#include <stdio.h> +#include <cmath> +#include "TH2D.h" +#include "TGraphErrors.h" +#include "TSystem.h" + +namespace IDVAR +{ + const int RHAD1 = 0; + const int RHAD = 1; + const int E277 = 2; + const int RETA = 3; + const int RPHI = 4; + const int WETA2 = 5; + const int F1 = 6; + const int FSIDE = 7; + const int WTOT = 8; + const int W1 = 9; + const int DE = 10; + const int ERATIO = 11; +} + + +class TPhotonMCShifterTool +{ + + public: + + TPhotonMCShifterTool(); + ~TPhotonMCShifterTool(); + + //fudge shower shapes for preselection chosen. + void FudgeShowers( double pt , + double eta2 , + double& rhad1 , + double& rhad , + double& e277 , + double& reta , + double& rphi , + double& weta2 , + double& f1 , + double& fside , + double& wtot , + double& w1 , + double& deltae , + double& eratio , + int isConv , + int preselection=-999); + + //fudge shower shapes for preselection chosen. + void FudgeShowers( float pt , + float eta2 , + float& rhad1 , + float& rhad , + float& e277 , + float& reta , + float& rphi , + float& weta2 , + float& f1 , + float& fside , + float& wtot , + float& w1 , + float& deltae , + float& eratio , + int isConv , + int preselection=-999); + + // fudge showers using D3PD vectors (except for eratio) + void FudgeShowers( std::vector<float> clE, + std::vector<float> eta2 , + std::vector<float>& rhad1 , + std::vector<float>& rhad , + std::vector<float>& e277 , + std::vector<float>& reta , + std::vector<float>& rphi , + std::vector<float>& weta2 , + std::vector<float>& f1 , + std::vector<float>& fside , + std::vector<float>& wtot , + std::vector<float>& w1 , + std::vector<float>& deltae , + std::vector<float>& eratio , + std::vector<int> isConv , + int preselection=-999); + + /** Calculate Eratio (the only variable which is not stored in the egamma/PhotonD3PD) + * given emaxs1 and Emax2. Return a pointer to a vector<float> + **/ + static std::vector<float>* getEratio(std::vector<float> emaxs1, std::vector<float> Emax2) + { + std::vector<float> *eratio = new std::vector<float>(); + for (unsigned int i = 0; i < emaxs1.size(); ++i) + eratio->push_back(emaxs1[i] + Emax2[i] == 0 ? 0 : + (emaxs1[i] - Emax2[i])/(emaxs1[i] + Emax2[i])); + return eratio; + } + + // get fudge factor for predefined preselection + double GetFF_Rhad1 (double pt, double eta2, int conv){ + if (conv) + { return h_c_rhad1->GetBinContent(h_u_rhad1->FindBin(pt, fabs(eta2))); } + else + { return h_u_rhad1->GetBinContent(h_u_rhad1->FindBin(pt, fabs(eta2))); } + } + + double GetFF_Rhad (double pt, double eta2, int conv){ + if (conv) + { return h_c_rhad->GetBinContent(h_c_rhad->FindBin(pt, fabs(eta2))); } + else + { return h_u_rhad->GetBinContent(h_u_rhad->FindBin(pt, fabs(eta2))); } + } + + double GetFF_E277 (double pt, double eta2, int conv){ + if (conv) + { return h_c_e277->GetBinContent(h_c_e277->FindBin(pt, fabs(eta2))); } + else + { return h_u_e277->GetBinContent(h_u_e277->FindBin(pt, fabs(eta2))); } + } + + double GetFF_Reta (double pt, double eta2, int conv){ + if (conv) + { return h_c_reta->GetBinContent(h_c_reta->FindBin(pt, fabs(eta2))); } + else + { return h_u_reta->GetBinContent(h_u_reta->FindBin(pt, fabs(eta2))); } + } + + double GetFF_Rphi (double pt, double eta2, int conv){ + if (conv) + { return h_c_rphi->GetBinContent(h_c_rphi->FindBin(pt, fabs(eta2))); } + else + { return h_u_rphi->GetBinContent(h_u_rphi->FindBin(pt, fabs(eta2))); } + } + + double GetFF_Weta2 (double pt, double eta2, int conv){ + if (conv) + { return h_c_weta2->GetBinContent(h_c_weta2->FindBin(pt, fabs(eta2))); } + else + { return h_u_weta2->GetBinContent(h_u_weta2->FindBin(pt, fabs(eta2))); } + } + + double GetFF_F1 (double pt, double eta2, int conv){ + if (conv) + { return h_c_f1->GetBinContent(h_c_f1->FindBin(pt, fabs(eta2))); } + else + { return h_u_f1->GetBinContent(h_u_f1->FindBin(pt, fabs(eta2))); } + } + + double GetFF_DE (double pt, double eta2, int conv){ + if (conv) + { return h_c_de->GetBinContent(h_c_de->FindBin(pt, fabs(eta2))); } + else + { return h_u_de->GetBinContent(h_u_de->FindBin(pt, fabs(eta2))); } + } + + double GetFF_Eratio(double pt, double eta2, int conv){ + if (conv) + { return h_c_eratio->GetBinContent(h_c_eratio->FindBin(pt, fabs(eta2))); } + else + { return h_u_eratio->GetBinContent(h_u_eratio->FindBin(pt, fabs(eta2))); } + } + + double GetFF_Fside (double pt, double eta2, int conv){ + if (conv) + { return h_c_fside->GetBinContent(h_c_fside->FindBin(pt, fabs(eta2))); } + else + { return h_u_fside->GetBinContent(h_u_fside->FindBin(pt, fabs(eta2))); } + } + + double GetFF_Wtot (double pt, double eta2, int conv){ + if (conv) + { return h_c_wtot->GetBinContent(h_c_wtot->FindBin(pt, fabs(eta2))); } + else + { return h_u_wtot->GetBinContent(h_u_wtot->FindBin(pt, fabs(eta2))); } + } + + double GetFF_W1 (double pt, double eta2, int conv){ + if (conv) + { return h_c_w1->GetBinContent(h_c_w1->FindBin(pt, fabs(eta2))); } + else + { return h_u_w1->GetBinContent(h_u_w1->FindBin(pt, fabs(eta2))); } + } + + double GetFFerr_Rhad1 (double pt, double eta2, int conv){ + if (conv) + { return h_c_rhad1->GetBinError(h_u_rhad1->FindBin(pt, fabs(eta2))); } + else + { return h_u_rhad1->GetBinError(h_u_rhad1->FindBin(pt, fabs(eta2))); } + } + + double GetFFerr_Rhad (double pt, double eta2, int conv){ + if (conv) + { return h_c_rhad->GetBinError(h_c_rhad->FindBin(pt, fabs(eta2))); } + else + { return h_u_rhad->GetBinError(h_u_rhad->FindBin(pt, fabs(eta2))); } + } + + double GetFFerr_E277 (double pt, double eta2, int conv){ + if (conv) + { return h_c_e277->GetBinError(h_c_e277->FindBin(pt, fabs(eta2))); } + else + { return h_u_e277->GetBinError(h_u_e277->FindBin(pt, fabs(eta2))); } + } + + double GetFFerr_Reta (double pt, double eta2, int conv){ + if (conv) + { return h_c_reta->GetBinError(h_c_reta->FindBin(pt, fabs(eta2))); } + else + { return h_u_reta->GetBinError(h_u_reta->FindBin(pt, fabs(eta2))); } + } + + double GetFFerr_Rphi (double pt, double eta2, int conv){ + if (conv) + { return h_c_rphi->GetBinError(h_c_rphi->FindBin(pt, fabs(eta2))); } + else + { return h_u_rphi->GetBinError(h_u_rphi->FindBin(pt, fabs(eta2))); } + } + + double GetFFerr_Weta2 (double pt, double eta2, int conv){ + if (conv) + { return h_c_weta2->GetBinError(h_c_weta2->FindBin(pt, fabs(eta2))); } + else + { return h_u_weta2->GetBinError(h_u_weta2->FindBin(pt, fabs(eta2))); } + } + + double GetFFerr_F1 (double pt, double eta2, int conv){ + if (conv) + { return h_c_f1->GetBinError(h_c_f1->FindBin(pt, fabs(eta2))); } + else + { return h_u_f1->GetBinError(h_u_f1->FindBin(pt, fabs(eta2))); } + } + + double GetFFerr_DE (double pt, double eta2, int conv){ + if (conv) + { return h_c_de->GetBinError(h_c_de->FindBin(pt, fabs(eta2))); } + else + { return h_u_de->GetBinError(h_u_de->FindBin(pt, fabs(eta2))); } + } + + double GetFFerr_Eratio(double pt, double eta2, int conv){ + if (conv) + { return h_c_eratio->GetBinError(h_c_eratio->FindBin(pt, fabs(eta2))); } + else + { return h_u_eratio->GetBinError(h_u_eratio->FindBin(pt, fabs(eta2))); } + } + + double GetFFerr_Fside (double pt, double eta2, int conv){ + if (conv) + { return h_c_fside->GetBinError(h_c_fside->FindBin(pt, fabs(eta2))); } + else + { return h_u_fside->GetBinError(h_u_fside->FindBin(pt, fabs(eta2))); } + } + + double GetFFerr_Wtot (double pt, double eta2, int conv){ + if (conv) + { return h_c_wtot->GetBinError(h_c_wtot->FindBin(pt, fabs(eta2))); } + else + { return h_u_wtot->GetBinError(h_u_wtot->FindBin(pt, fabs(eta2))); } + } + + double GetFFerr_W1 (double pt, double eta2, int conv){ + if (conv) + { return h_c_w1->GetBinError(h_c_w1->FindBin(pt, fabs(eta2))); } + else + { return h_u_w1->GetBinError(h_u_w1->FindBin(pt, fabs(eta2))); } + } + + double GetFF (int var, double pt, double eta2, int conv){ + switch (var) { + case IDVAR::RHAD1: return GetFF_Rhad1( pt, eta2, conv ); + case IDVAR::RHAD: return GetFF_Rhad( pt, eta2, conv ); + case IDVAR::E277: return GetFF_E277( pt, eta2, conv ); + case IDVAR::RETA: return GetFF_Reta( pt, eta2, conv ); + case IDVAR::RPHI: return GetFF_Rphi( pt, eta2, conv ); + case IDVAR::WETA2: return GetFF_Weta2( pt, eta2, conv ); + case IDVAR::F1: return GetFF_F1( pt, eta2, conv ); + case IDVAR::FSIDE: return GetFF_Fside( pt, eta2, conv ); + case IDVAR::WTOT: return GetFF_Wtot( pt, eta2, conv ); + case IDVAR::W1: return GetFF_W1( pt, eta2, conv ); + case IDVAR::DE: return GetFF_DE( pt, eta2, conv ); + case IDVAR::ERATIO: return GetFF_Eratio( pt, eta2, conv ); + default: return 0.0; + } + } + + // fudge a specific variable + double Fudge_Rhad1 ( double rhad1, double pt, double eta2, int conv){ return ( rhad1 + GetFF_Rhad1 ( pt, eta2, conv ) ); } + double Fudge_Rhad ( double rhad, double pt, double eta2, int conv){ return ( rhad + GetFF_Rhad ( pt, eta2, conv ) ); } + double Fudge_E277 ( double e277, double pt, double eta2, int conv){ return ( e277 + GetFF_E277 ( pt, eta2, conv ) ); } + double Fudge_Reta ( double reta, double pt, double eta2, int conv){ return ( reta + GetFF_Reta ( pt, eta2, conv ) ); } + double Fudge_Rphi ( double rphi, double pt, double eta2, int conv){ return ( rphi + GetFF_Rphi ( pt, eta2, conv ) ); } + double Fudge_Weta2 ( double weta2, double pt, double eta2, int conv){ return ( weta2 + GetFF_Weta2 ( pt, eta2, conv ) ); } + double Fudge_F1 ( double f1, double pt, double eta2, int conv){ return ( f1 + GetFF_F1 ( pt, eta2, conv ) ); } + double Fudge_DE ( double deltae, double pt, double eta2, int conv){ return ( deltae + GetFF_DE ( pt, eta2, conv ) ); } + double Fudge_Eratio( double eratio, double pt, double eta2, int conv){ return ( eratio + GetFF_Eratio ( pt, eta2, conv ) ); } + double Fudge_Fside ( double fside, double pt, double eta2, int conv){ return ( fside + GetFF_Fside ( pt, eta2, conv ) ); } + double Fudge_Wtot ( double wtot, double pt, double eta2, int conv){ return ( wtot + GetFF_Wtot ( pt, eta2, conv ) ); } + double Fudge_W1 ( double w1, double pt, double eta2, int conv){ return ( w1 + GetFF_W1 ( pt, eta2, conv ) ); } + + // set shower preselection cuts + // *** 2010 + // 0 = tight isolated + // 1 = loose isolated + // 2 = tightx isolated + // 3 = tighty isolated + // 4 = tight isolated . Distorted material + // *** 2011 + // 5 = tight isolated + // 6 = tight non-isolated + // *** + // 10= tight isolated. Old menu rel15 (tune 3 in PhotonIDTool). + // .. + void SetVerbose( bool verbose=true ){ m_verbose=verbose; } + int GetPreselection(){ return m_preselection; }; + + //drawing methods + TGraphErrors* GetFFmap (int var, double eta, int isConv, int preselection); + + TGraphErrors* GetFFmap_Rhad1 (double eta, int isConv, int preselection); + TGraphErrors* GetFFmap_Rhad (double eta, int isConv, int preselection); + TGraphErrors* GetFFmap_E277 (double eta, int isConv, int preselection); + TGraphErrors* GetFFmap_Reta (double eta, int isConv, int preselection); + TGraphErrors* GetFFmap_Rphi (double eta, int isConv, int preselection); + TGraphErrors* GetFFmap_Weta2 (double eta, int isConv, int preselection); + TGraphErrors* GetFFmap_F1 (double eta, int isConv, int preselection); + TGraphErrors* GetFFmap_Fside (double eta, int isConv, int preselection); + TGraphErrors* GetFFmap_Wtot (double eta, int isConv, int preselection); + TGraphErrors* GetFFmap_W1 (double eta, int isConv, int preselection); + TGraphErrors* GetFFmap_DE (double eta, int isConv, int preselection); + TGraphErrors* GetFFmap_Eratio(double eta, int isConv, int preselection); + // TH2D* GetFFTH2D(int var, int isConv, int preselection); + void LoadFFs(int preselection, std::string file); + + private: + bool m_verbose; + + //shower preselection to extract FFs + int m_preselection; + + std::string m_corr_file; + + // collections of fudge factors + TH2D* h_u_rhad1; + TH2D* h_u_rhad; + TH2D* h_u_e277; + TH2D* h_u_reta; + TH2D* h_u_rphi; + TH2D* h_u_weta2; + TH2D* h_u_f1; + TH2D* h_u_fside; + TH2D* h_u_wtot; + TH2D* h_u_w1; + TH2D* h_u_de; + TH2D* h_u_eratio; + TH2D* h_c_rhad1; + TH2D* h_c_rhad; + TH2D* h_c_e277; + TH2D* h_c_reta; + TH2D* h_c_rphi; + TH2D* h_c_weta2; + TH2D* h_c_f1; + TH2D* h_c_fside; + TH2D* h_c_wtot; + TH2D* h_c_w1; + TH2D* h_c_de; + TH2D* h_c_eratio; + + void SafeDeleteHistograms(); +}; + +#endif // #ifdef TPhotonMCShifterTool_h + +#ifdef TPhotonMCShifterTool_cxx + +TPhotonMCShifterTool::TPhotonMCShifterTool() +{ + m_preselection = -1; + h_u_rhad1 = 0; + h_u_rhad = 0; + h_u_e277 = 0; + h_u_reta = 0; + h_u_rphi = 0; + h_u_weta2 = 0; + h_u_f1 = 0; + h_u_fside = 0; + h_u_wtot = 0; + h_u_w1 = 0; + h_u_de = 0; + h_u_eratio = 0; + h_c_rhad1 = 0; + h_c_rhad = 0; + h_c_e277 = 0; + h_c_reta = 0; + h_c_rphi = 0; + h_c_weta2 = 0; + h_c_f1 = 0; + h_c_fside = 0; + h_c_wtot = 0; + h_c_w1 = 0; + h_c_de = 0; + h_c_eratio = 0; + + m_verbose = false; + // std::cout << "Initiliazing the tool ---->>> preselection " << preselection << std::endl; + +} + +TPhotonMCShifterTool::~TPhotonMCShifterTool() +{ + SafeDeleteHistograms(); +} + +void TPhotonMCShifterTool::SafeDeleteHistograms() { + if (h_u_rhad1) {delete h_u_rhad1; h_u_rhad1 = 0;} + if (h_u_rhad) {delete h_u_rhad; h_u_rhad = 0;} + if (h_u_e277) {delete h_u_e277; h_u_e277 = 0;} + if (h_u_reta) {delete h_u_reta; h_u_reta = 0;} + if (h_u_rphi) {delete h_u_rphi; h_u_rphi = 0;} + if (h_u_weta2) {delete h_u_weta2; h_u_weta2 = 0;} + if (h_u_f1) {delete h_u_f1; h_u_f1 = 0;} + if (h_u_fside) {delete h_u_fside; h_u_fside = 0;} + if (h_u_wtot) {delete h_u_wtot; h_u_wtot = 0;} + if (h_u_w1) {delete h_u_w1; h_u_w1 = 0;} + if (h_u_de) {delete h_u_de; h_u_de = 0;} + if (h_u_eratio) {delete h_u_eratio; h_u_eratio = 0;} + if (h_c_rhad1) {delete h_c_rhad1; h_c_rhad1 = 0;} + if (h_c_rhad) {delete h_c_rhad; h_c_rhad = 0;} + if (h_c_e277) {delete h_c_e277; h_c_e277 = 0;} + if (h_c_reta) {delete h_c_reta; h_c_reta = 0;} + if (h_c_rphi) {delete h_c_rphi; h_c_rphi = 0;} + if (h_c_weta2) {delete h_c_weta2; h_c_weta2 = 0;} + if (h_c_f1) {delete h_c_f1; h_c_f1 = 0;} + if (h_c_fside) {delete h_c_fside; h_c_fside = 0;} + if (h_c_wtot) {delete h_c_wtot; h_c_wtot = 0;} + if (h_c_w1) {delete h_c_w1; h_c_w1 = 0;} + if (h_c_de) {delete h_c_de; h_c_de = 0;} + if (h_c_eratio) {delete h_c_eratio; h_c_eratio = 0;} +} + +#endif// #ifdef TPhotonMCShifterTool_cxx + diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/ElectronPhotonShowerShapeFudgeTool.cxx b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/ElectronPhotonShowerShapeFudgeTool.cxx index e9c964fb55acd84fb52359043c3fa4d8308b7262..64af52d65c7d26ceb593e60bc29cf171bc7b85f7 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/ElectronPhotonShowerShapeFudgeTool.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/ElectronPhotonShowerShapeFudgeTool.cxx @@ -28,15 +28,12 @@ ElectronPhotonShowerShapeFudgeTool::ElectronPhotonShowerShapeFudgeTool(std::stri m_configFile("") { + declareProperty("FFCalibFile", m_ffFile="ElectronPhotonShowerShapeFudgeTool/v2/PhotonFudgeFactors.root", "Calib path file for Photon MC corrections"); declareProperty("Preselection",m_preselection=-999); declareProperty("ConfigFile",m_configFile="","The config file to use for the Electron Shifter"); // Create an instance of the underlying ROOT tool -#ifdef USE_NEW_TOOL m_ph_rootTool = new TPhotonMCShifterTool(); -#else - m_ph_rootTool = new FudgeMCTool(); -#endif m_el_rootTool = new TElectronMCShifterTool(); } @@ -102,6 +99,8 @@ StatusCode ElectronPhotonShowerShapeFudgeTool::initialize() m_el_rootTool->Widths[ElePIDNames::Var::e277] = GetFloatVector("width_e277", env); m_el_rootTool->Widths[ElePIDNames::Var::DeltaE] = GetFloatVector("width_DeltaE", env); + m_ph_rootTool->LoadFFs(m_preselection, m_ffFile); + return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/TPhotonMCShifterTool.cxx b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/TPhotonMCShifterTool.cxx index 2383927c9e6dfcb75bb35dba67ab20ef2d238adf..4d4fa5301f3374011854eb3ab36b2813f0a4d44f 100644 --- a/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/TPhotonMCShifterTool.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/ElectronPhotonShowerShapeFudgeTool/Root/TPhotonMCShifterTool.cxx @@ -37,7 +37,7 @@ void TPhotonMCShifterTool::FudgeShowers( double pt , if (preselection<0) preselection = m_preselection; if (preselection>0 && preselection!=m_preselection) { m_preselection = preselection; - this->LoadFFs(preselection); + this->LoadFFs(preselection,m_corr_file); } //fudge showers @@ -77,7 +77,7 @@ void TPhotonMCShifterTool::FudgeShowers( float pt , if (preselection<0) preselection = m_preselection; if (preselection>0 && preselection!=m_preselection) { m_preselection = preselection; - this->LoadFFs(preselection); + this->LoadFFs(preselection,m_corr_file); } //fudge showers @@ -93,6 +93,7 @@ void TPhotonMCShifterTool::FudgeShowers( float pt , fside = Fudge_Fside(fside, pt, eta2, isConv); w1 = Fudge_W1(w1, pt, eta2, isConv); eratio = Fudge_Eratio(eratio, pt, eta2, isConv); + } void TPhotonMCShifterTool::FudgeShowers( std::vector<float> clE, @@ -133,17 +134,21 @@ void TPhotonMCShifterTool::FudgeShowers( std::vector<float> clE, } -void TPhotonMCShifterTool::LoadFFs(int preselection) +void TPhotonMCShifterTool::LoadFFs(int preselection, std::string file) { if (preselection == m_preselection) return; m_preselection = preselection; - static const std::string FILE_NAME = - "ElectronPhotonShowerShapeFudgeTool/PhotonFudgeFactors.root"; - const std::string filePath = PathResolverFindCalibFile( FILE_NAME ); - std::unique_ptr< TFile > f( TFile::Open( filePath.c_str(), "READ" ) ); + const std::string filename = PathResolverFindCalibFile( file ); + if (filename.empty()){ + throw std::runtime_error("FudgeMCTool ERROR Could NOT resolve file name "+ file); + } else{ + Info("FudgeMCTool", "Path found = %s", filename.c_str()); + } + m_corr_file = filename; + std::unique_ptr< TFile > f( TFile::Open( m_corr_file.c_str(), "READ" ) ); if( ( ! f.get() ) || f->IsZombie() ) { - throw std::runtime_error( "Couldn't open file: " + FILE_NAME ); + throw std::runtime_error( "Couldn't open file: " + m_corr_file ); } if (!f->FindKey(Form("TUNE%d",preselection))) { std::cout << "Directory TUNE" << preselection << " does not exist in fudge factor file. Aborting" << std::endl; @@ -225,123 +230,11 @@ void TPhotonMCShifterTool::LoadFFs(int preselection) f->Close(); } -/* -TH2D* TPhotonMCShifterTool::GetFFTH2D(int var, int isConv, int preselection){ - - // read the FFs - if (preselection>=0 && preselection != m_preselection) - this->LoadFFs(preselection); - - // create the histogram - const int ptbins = m_rhad1_ff.GetPtBins()+1; - double *ptarray = m_rhad1_ff.GetPtArray(); - const int etabins = m_rhad1_ff.GetEtaBins()+1; - double *etaarray = m_rhad1_ff.GetEtaArray(); - //std::cout << ptbins << " " << etabins << std::endl; - double x[100]; - double y[100]; - - for (int i=0; i<ptbins; i++){ - if(i==0) - x[0]=0.; - else - x[i] = ptarray[i-1]; - //std::cout << i << " " << x[i] << std::endl; - } - for (int i=0; i<etabins; i++){ - if(i==0) - y[0]=0.; - else - y[i] = etaarray[i-1]; - //std::cout << i << " " << y[i] << std::endl; - } - - - - TH2D* hff = new TH2D("hff","hff",ptbins-1,x,etabins-1,y); - hff->GetXaxis()->SetTitle("p_{T} [MeV]"); - hff->GetYaxis()->SetTitle("|#eta_{S2}|"); - - // fill the histogram - double pt, eta; - for (int i=1; i<ptbins; i++){ - pt = hff->GetXaxis()->GetBinCenter(i); - for (int j=1; j<etabins; j++){ - eta = hff->GetYaxis()->GetBinCenter(j); - //std::cout << "pT = " << pt << ", eta = " << eta << std::endl; - - double ff, fferr; - - switch (var) { - case IDVAR::RHAD1: - ff = GetFF_Rhad1( pt, eta ); - fferr = GetFFerr_Rhad1( pt, eta ); - break; - case IDVAR::RHAD: - ff = GetFF_Rhad( pt, eta ); - fferr = GetFFerr_Rhad( pt, eta ); - break; - case IDVAR::E277: - ff = GetFF_E277( pt, eta ); - fferr = GetFFerr_E277( pt, eta ); - break; - case IDVAR::RETA: - ff = GetFF_Reta( pt, eta ); - fferr = GetFFerr_Reta( pt, eta ); - break; - case IDVAR::RPHI: - ff = GetFF_Rphi( pt, eta ); - fferr = GetFFerr_Rphi( pt, eta ); - break; - case IDVAR::WETA2: - ff = GetFF_Weta2( pt, eta ); - fferr = GetFFerr_Weta2( pt, eta ); - break; - case IDVAR::F1: - ff = GetFF_F1( pt, eta ); - fferr = GetFFerr_F1( pt, eta ); - break; - case IDVAR::FSIDE: - ff = GetFF_Fside( pt, eta ); - fferr = GetFFerr_Fside( pt, eta ); - break; - case IDVAR::WTOT: - ff = GetFF_Wtot( pt, eta ); - fferr = GetFFerr_Wtot( pt, eta ); - break; - case IDVAR::W1: - ff = GetFF_W1( pt, eta ); - fferr = GetFFerr_W1( pt, eta ); - break; - case IDVAR::DE: - ff = GetFF_DE( pt, eta ); - fferr = GetFFerr_DE( pt, eta ); - break; - case IDVAR::ERATIO: - ff = GetFF_Eratio( pt, eta ); - fferr = GetFFerr_Eratio( pt, eta ); - break; - default: - ff = 0.; - fferr = 0.; - break; - } - //std::cout << "FF = " << ff << " +- " << fferr << std::endl; - hff->SetBinContent(i,j,ff); - hff->SetBinError(i,j,fferr); - } - } - - // return the histogram - return hff; -} -*/ - //Get graph of FFs TGraphErrors* TPhotonMCShifterTool::GetFFmap(int var, double eta, int isConv, int preselection ){ if (preselection>=0 && preselection != m_preselection) - this->LoadFFs(preselection); + this->LoadFFs(preselection,m_corr_file); if (h_u_rhad1==0) return 0; diff --git a/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/Root/egammaMVACalib.cxx b/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/Root/egammaMVACalib.cxx index 4744997fc8b3743693eee69c1aff74ec27636cca..18cfaf5c3cb2d19bb48a9b7a365e4d15850bebac 100644 --- a/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/Root/egammaMVACalib.cxx +++ b/PhysicsAnalysis/ElectronPhotonID/egammaMVACalibAnalysis/Root/egammaMVACalib.cxx @@ -390,7 +390,7 @@ void egammaMVACalib::setupBDT(const TString& fileName) TString filePath = PathResolverFindCalibFile(fileName.Data()); std::unique_ptr<TFile> f(TFile::Open(filePath)); - CHECK_SETUPBDT( f.get() && f->IsZombie() ); + CHECK_SETUPBDT( f.get() && !f->IsZombie() ); // Load hPoly auto hPoly = loadFromFile<TH2Poly>(f.get(), "hPoly"); diff --git a/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/Root/BTaggingTruthTaggingTool.cxx b/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/Root/BTaggingTruthTaggingTool.cxx index 068dba84fae2799e01d573eb1bfabf89ad8ae497..3f728ee3f1a855b1239591f4d9259e53427203ad 100644 --- a/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/Root/BTaggingTruthTaggingTool.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagPerformanceCalibration/xAODBTaggingEfficiency/Root/BTaggingTruthTaggingTool.cxx @@ -1104,7 +1104,7 @@ StatusCode BTaggingTruthTaggingTool::getDirectTaggedJets(TRFinfo &trfinf,std::ve is_tagged.clear(); std::vector<int> appo; - for(const auto jet : trfinf.jets) { + for(const auto& jet : trfinf.jets) { ATH_MSG_DEBUG("pt " << jet.vars.jetPt << " eta " << jet.vars.jetEta << " wei " << jet.vars.jetTagWeight); bool is_btagged = false; if(!m_continuous) diff --git a/PhysicsAnalysis/MCTruthClassifier/CMakeLists.txt b/PhysicsAnalysis/MCTruthClassifier/CMakeLists.txt index 1de31badb88c020235c51acc0203c0db9c0cbbcb..2709419df4078b38b9ae64eb77c0448b8a9d9c86 100644 --- a/PhysicsAnalysis/MCTruthClassifier/CMakeLists.txt +++ b/PhysicsAnalysis/MCTruthClassifier/CMakeLists.txt @@ -26,11 +26,20 @@ endif() # External dependencies: find_package( ROOT COMPONENTS Core RIO ) -find_package( HepMC ) - +if ( HEPMC3_USE ) + find_package( hepmc3 ) + MESSAGE( STATUS "Trying HepMC3") +# Libraries in the package: + if( HEPMC3_FOUND ) + MESSAGE( STATUS "HepMC3 FOUND!") + list(INSERT extra_libs 0 AtlasHepMCLib ) + endif() +else() + find_package( HepMC ) # Libraries in the package: -if( HEPMC_FOUND ) - list(INSERT extra_libs 0 AtlasHepMCLib ) + if( HEPMC_FOUND ) + list(INSERT extra_libs 0 AtlasHepMCLib ) + endif() endif() atlas_add_library( MCTruthClassifierLib diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/CMakeLists.txt b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/CMakeLists.txt index 34773bb868b63640f3ee9407fe561687999398e6..57f58df81ba81df614c25da997f0d55804b6df35 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/CMakeLists.txt +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/CMakeLists.txt @@ -42,4 +42,4 @@ endif() # Install files from the package: atlas_install_joboptions( share/*.py ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/python/CommonToolSetup.py b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/python/CommonToolSetup.py index f0e11d78fb032b7f55da5813383adc411158ed15..037d4be4e5a79fee358e3c0cec6cc400e8d6ea31 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/python/CommonToolSetup.py +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonEfficiencyCorrections/python/CommonToolSetup.py @@ -11,26 +11,25 @@ def AssembleIO(stream="TRIGGERSFTESTER"): print ("INFO: Old athfile-cache found. Will delete it otherwise athena just freaks out. This little boy") os.system("rm %s/athfile-cache.ascii.gz" % (os.getcwd())) from GaudiSvc.GaudiSvcConf import THistSvc - from AthenaCommon.JobProperties import jobproperties - import AthenaPoolCnvSvc.ReadAthenaPool + import AthenaPoolCnvSvc.ReadAthenaPool # noqa: F401 (setup POOL reading) from AthenaCommon.AthenaCommonFlags import athenaCommonFlags as acf from AthenaServices.AthenaServicesConf import AthenaEventLoopMgr - from AthenaCommon.AppMgr import ServiceMgr + from AthenaCommon.AppMgr import theApp, ServiceMgr from PathResolver import PathResolver ServiceMgr += AthenaEventLoopMgr(EventPrintoutInterval=5000) ServiceMgr += THistSvc() - OutFileName = "SFTest.root" if not "outFile" in globals() else outFile + OutFileName = globals().get("outFile", "SFTest.root") ServiceMgr.THistSvc.Output += ["%s DATAFILE='%s' OPT='RECREATE'"%(stream,OutFileName)] ROOTFiles = [] if "inputFile" in globals(): - print ("Use the following %s as input" % (inputFile)) + print ("Use the following %s as input" % globals()["inputFile"]) ROOTFiles = [] - ResolvedInFile = PathResolver.FindCalibFile(inputFile) - ReolvedInDir = PathResolver.FindCalibDirectory(inputFile) + ResolvedInFile = PathResolver.FindCalibFile(globals()["inputFile"]) + ReolvedInDir = PathResolver.FindCalibDirectory(globals()["inputFile"]) if os.path.isfile(ResolvedInFile): - print ("INFO: Found file %s"%(inputFile)) + print ("INFO: Found file %s" % globals()["inputFile"]) ROOTFiles.append(ResolvedInFile) elif os.path.isdir(ReolvedInDir): @@ -38,26 +37,26 @@ def AssembleIO(stream="TRIGGERSFTESTER"): if DirEnt.rfind(".root") != -1: if DirEnt.find(ReolvedInDir) != -1 : ROOTFiles.append(DirEnt) else: ROOTFiles.append("%s/%s"%(ReolvedInDir,DirEnt)) - else: raise RuntimeError("Invalid input " + inputFile) + else: raise RuntimeError("Invalid input " + globals()["inputFile"]) if len(ROOTFiles) == 0: raise RuntimeError("No ROOT files could be loaded as input") ServiceMgr.EventSelector.InputCollections = ROOTFiles acf.FilesInput = ROOTFiles if "nevents" in globals(): - print ("Only run on %i events" % (int(nevents))) - theApp.EvtMax = int (nevents) + print ("Only run on %i events" % globals()["nevents"]) + theApp.EvtMax = int (globals()["nevents"]) if "nskip" in globals(): - print ("Skip the first %i events" % (int(nskip))) - ServiceMgr.EventSelector.SkipEvents = int(nksip) + print ("Skip the first %i events" % globals("nskip")) + ServiceMgr.EventSelector.SkipEvents = int(globals("nskip")) def GetTriggerSFTool(MuonWP="Medium", Binning="fine"): from AthenaCommon.AppMgr import ToolSvc - from AthenaCommon import CfgMgr, GlobalFlags + from AthenaCommon import CfgMgr ToolName = "TriggerSFTool_%s_%s"%(MuonWP,Binning) if not hasattr(ToolSvc, ToolName): - from MuonEfficiencyCorrections.MuonEfficiencyCorrectionsConf import CP__MuonTriggerScaleFactors + from MuonEfficiencyCorrections.MuonEfficiencyCorrectionsConf import CP__MuonTriggerScaleFactors # noqa: F401 TriggerTool = CfgMgr.CP__MuonTriggerScaleFactors(ToolName) TriggerTool.MuonQuality = MuonWP TriggerTool.Binning = Binning @@ -67,10 +66,10 @@ def GetTriggerSFTool(MuonWP="Medium", Binning="fine"): def GetMuonEfficiencyTool(MuonWP="Medium", Release="", CustomInput = "", BreakDownSystematics=False, UncorrelateSystematics=False): from AthenaCommon.AppMgr import ToolSvc - from AthenaCommon import CfgMgr, GlobalFlags + from AthenaCommon import CfgMgr ToolName = "MuonEfficiencyTool_%s%s"%(MuonWP, Release if len(Release) == 0 else "_"+Release) if not hasattr(ToolSvc,ToolName): - from MuonEfficiencyCorrections.MuonEfficiencyCorrectionsConf import CP__MuonEfficiencyScaleFactors + from MuonEfficiencyCorrections.MuonEfficiencyCorrectionsConf import CP__MuonEfficiencyScaleFactors # noqa: F401 EffiTool = CfgMgr.CP__MuonEfficiencyScaleFactors(ToolName) EffiTool.WorkingPoint = MuonWP EffiTool.LowPtThreshold = 15.e3 @@ -84,9 +83,9 @@ def GetMuonEfficiencyTool(MuonWP="Medium", Release="", CustomInput = "", BreakDo def GetSelectionTool(): from AthenaCommon.AppMgr import ToolSvc - from AthenaCommon import CfgMgr, GlobalFlags + from AthenaCommon import CfgMgr if not hasattr(ToolSvc, "selectionTool"): - from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool + from MuonSelectorTools.MuonSelectorToolsConf import CP__MuonSelectionTool # noqa: F401 selTool = CfgMgr.CP__MuonSelectionTool("selectionTool") ToolSvc += selTool return getattr(ToolSvc,"selectionTool") @@ -104,7 +103,7 @@ def GetPRWTool( from AthenaCommon.AppMgr import ToolSvc from AthenaCommon import CfgMgr if not hasattr(ToolSvc, "prwTool"): - from PileupReweighting.PileupReweightingConf import CP__PileupReweightingTool + from PileupReweighting.PileupReweightingConf import CP__PileupReweightingTool # noqa: F401 prwTool = CfgMgr.CP__PileupReweightingTool("prwTool") prwTool.ConfigFiles = PRWMCConfigFiles prwTool.LumiCalcFiles = PRWLumiCalcFiles diff --git a/PhysicsAnalysis/MuonID/MuonSelectorTools/CMakeLists.txt b/PhysicsAnalysis/MuonID/MuonSelectorTools/CMakeLists.txt index 95c67f1c76598024b7cd57967ab4dee3e7307de7..847d5c2aa4e2c1d30e648481ae489263a27fa480 100644 --- a/PhysicsAnalysis/MuonID/MuonSelectorTools/CMakeLists.txt +++ b/PhysicsAnalysis/MuonID/MuonSelectorTools/CMakeLists.txt @@ -1,6 +1,4 @@ -################################################################################ -# Package: MuonSelectorTools -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( MuonSelectorTools ) @@ -13,14 +11,14 @@ atlas_add_library( MuonSelectorToolsLib MuonSelectorTools/*.h Root/*.cxx PUBLIC_HEADERS MuonSelectorTools INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODEventInfo xAODMuon PATCoreLib MuonAnalysisInterfacesLib AsgDataHandlesLib + LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODEventInfo PATCoreLib MuonAnalysisInterfacesLib AsgDataHandlesLib PRIVATE_LINK_LIBRARIES xAODTracking PathResolver ) if( NOT XAOD_STANDALONE ) atlas_add_component( MuonSelectorTools src/*.h src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps GaudiKernel xAODCore xAODEventInfo xAODMuon MuonAnalysisInterfacesLib - MuonSelectorToolsLib ) + LINK_LIBRARIES AthenaBaseComps GaudiKernel xAODCore xAODMuon MuonAnalysisInterfacesLib + MuonSelectorToolsLib PATCoreLib ) endif() atlas_add_dictionary( MuonSelectorToolsDict @@ -34,7 +32,7 @@ if( XAOD_STANDALONE ) util/MuonSelectorToolsTester.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEventInfo xAODMuon MCTruthClassifierLib - xAODTracking xAODCore MuonSelectorToolsLib ) + xAODTracking xAODCore MuonSelectorToolsLib PATCoreLib ) endif() @@ -42,10 +40,9 @@ endif() if( XAOD_STANDALONE ) atlas_add_test( ut_MuonSelectorToolsTester_data SOURCES test/ut_MuonSelectorToolsTester_data.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools ) + LINK_LIBRARIES AsgMessagingLib ) endif() # Install files from the package: atlas_install_joboptions( share/*.py ) -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/PhysicsAnalysis/MuonID/MuonSelectorTools/python/MuonSelectorCutDefs.py b/PhysicsAnalysis/MuonID/MuonSelectorTools/python/MuonSelectorCutDefs.py index 8f140b97342860bde2ce71e22e77886b1ea0dd28..31b500430dfaefc84ba9bc0fffc0d407a066d30d 100644 --- a/PhysicsAnalysis/MuonID/MuonSelectorTools/python/MuonSelectorCutDefs.py +++ b/PhysicsAnalysis/MuonID/MuonSelectorTools/python/MuonSelectorCutDefs.py @@ -11,7 +11,7 @@ ##============================================================================= # Import a needed helper -from PATCore.HelperUtils import * +from PATCore.HelperUtils import GetTool # Define GeV GeV = 1000.0 diff --git a/PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx b/PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx index c0a458457ff91c232344011437eae40ba70218a6..247bee76f5238bada03e4ee3032f8add8f3ebd8b 100644 --- a/PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx +++ b/PhysicsAnalysis/POOLRootAccess/src/TEvent.cxx @@ -126,8 +126,10 @@ void TEvent::setActive() { long TEvent::getEntries() { if(m_size>=0) return m_size; if(!m_evtLoop.isSet()) { if(m_evtLoop.retrieve().isFailure()) return 0; } - m_size = dynamic_cast<ICollectionSize*>(&*m_evtLoop)->size(); - return m_size; + if (ICollectionSize* isize = dynamic_cast<ICollectionSize*>(&*m_evtLoop)) { + return isize->size(); + } + return 0; } StatusCode TEvent::readFrom( TFile* file ) { @@ -153,7 +155,9 @@ StatusCode TEvent::readFrom( const char* file ) { std::unique_ptr<TObjArray> theFiles(gSystem->GetFromPipe(("ls " + std::string(file)).c_str()).Tokenize("\n")); for(int i=0;i<theFiles->GetEntries();i++) { //std::cout << "Adding " << dynamic_cast<TObjString*>(theFiles->At(i))->String().Data() << std::endl; - myFiles.push_back(gSystem->ExpandPathName(dynamic_cast<TObjString*>(theFiles->At(i))->String().Data())); + if (TObjString* objstr = dynamic_cast<TObjString*>(theFiles->At(i))) { + myFiles.push_back(gSystem->ExpandPathName(objstr->String().Data())); + } } } else { myFiles.push_back( gSystem->ExpandPathName(sFile.Data()) ); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/Tools.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/Tools.cxx index 3574e189429fc769e2cf43efee6407d913880229..5fb00c304378facc651e5a2382ec410c6fc04c96 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/Tools.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/Root/Tools.cxx @@ -162,33 +162,34 @@ namespace top { throw std::runtime_error("Cannot determine the derivation stream. Please report."); } - void parseCutBookkeepers(const xAOD::CutBookkeeperContainer *cutBookKeepers, + void parseCutBookkeepers(xAOD::TEvent& xaodEvent, const std::size_t size, std::vector<std::string> &names, std::vector<float>& sumW, const bool isHLLHC) { - std::vector<int> maxCycle; - for (const xAOD::CutBookkeeper *cbk : *cutBookKeepers) { - // skip RDO and ESD numbers, which are nonsense; and - // skip the derivation number, which is the one after skimming - // we want the primary xAOD numbers - if ((cbk->inputStream() != "StreamAOD") && !(isHLLHC && cbk->inputStream() == "StreamDAOD_TRUTH1")) - continue; - // only accept "AllExecutedEvents" bookkeeper (0th MC weight) - // or "AllExecutedEvents_NonNominalMCWeight_XYZ" where XYZ is the MC weight index - if (!((cbk->name() == "AllExecutedEvents") - || (cbk->name().find("AllExecutedEvents_NonNominalMCWeight_") != std::string::npos))) - continue; - const std::string name = cbk->name(); - auto pos_name = std::find(names.begin(), names.end(), name); - // is it a previously unencountered bookkeeper? If yes append its name to the vector of names - // if not no need, but we must check the corresponding entry for the sum of weights exist - if (pos_name == names.end()) { - names.push_back(name); - maxCycle.push_back(cbk->cycle()); - sumW.push_back(cbk->sumOfEventWeights()); - } else if (cbk->cycle() > maxCycle.at(pos_name - names.begin())) { - maxCycle.at(pos_name - names.begin()) = cbk->cycle(); - sumW.at(pos_name - names.begin()) = cbk->sumOfEventWeights(); - } else { - continue; + + for (std::size_t icbk = 0; icbk < size; ++icbk) { + const std::string cbkName = (icbk == 0) ? "CutBookkeepers" : "CutBookkeepers_weight_" + std::to_string(icbk); + const xAOD::CutBookkeeperContainer* cutBookKeepers = nullptr; + top::check(xaodEvent.retrieveMetaInput(cutBookKeepers, cbkName), "Cannot retrieve CutBookkeepers: " + cbkName); + + std::vector<int> maxCycle; + for (const xAOD::CutBookkeeper *cbk : *cutBookKeepers) { + // skip RDO and ESD numbers, which are nonsense; and + // skip the derivation number, which is the one after skimming + // we want the primary xAOD numbers + if ((cbk->inputStream() != "StreamAOD") && !(isHLLHC && cbk->inputStream() == "StreamDAOD_TRUTH1")) + continue; + if (cbk->name() != "AllExecutedEvents") continue; + const std::string name = cbk->name() + "_weight_" + std::to_string(icbk); + auto pos_name = std::find(names.begin(), names.end(), name); + // is it a previously unencountered bookkeeper? If yes append its name to the vector of names + // if not no need, but we must check the corresponding entry for the sum of weights exist + if (pos_name == names.end()) { + names.push_back(name); + maxCycle.push_back(cbk->cycle()); + sumW.push_back(cbk->sumOfEventWeights()); + } else if (cbk->cycle() > maxCycle.at(pos_name - names.begin())) { + maxCycle.at(pos_name - names.begin()) = cbk->cycle(); + sumW.at(pos_name - names.begin()) = cbk->sumOfEventWeights(); + } } } } @@ -215,7 +216,7 @@ namespace top { const std::vector<std::string>& pmg_weight_names) { // prefix in the bookkeeper names to remove - static const std::string name_prefix = "AllExecutedEvents_NonNominalMCWeight_"; + static const std::string name_prefix = "AllExecutedEvents_weight_"; // check if we have more than one MC generator weight, in that case we have to do the renaming if (pmg_weight_names.size() > 1) { @@ -228,13 +229,9 @@ namespace top { // rename the bookkeepers based on the weight names from PMGTool // this names are then also written into the sumWeights TTree in output files for (std::string &name : bookkeeper_names) { - if (name == "AllExecutedEvents") { - name = pmg_weight_names.at(0); - } else { - // erase "AllExecutedEvents_NonNominalMCWeight_" prefix - int index = std::stoi(name.erase(0, name_prefix.size())); - name = pmg_weight_names.at(index); - } + // erase "AllExecutedEvents_weight_" prefix + int index = std::stoi(name.erase(0, name_prefix.size())); + name = pmg_weight_names.at(index); } } else { // expect only one MC weight in this sample, hence only one AllExecutedEvents* bookeeeper diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/Tools.h b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/Tools.h index 613d72b399c6d216c1c36a0ed3cac953e7f1c7e9..6c8977bffe13687878e26c374cb10a29d1a085ad 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/Tools.h +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/TopAnalysis/Tools.h @@ -101,12 +101,13 @@ namespace top { * @brief Search bookkeepers for ones matching AllExecutedEvents, and which * originate from AOD before skimming. * - * @param cutBookKeepers Container with bookkeepers + * @param TEvent to retrieve the cutbookkeepers + * @param number of the generator weights * @param names Vector of names of the selected bookkeepers * @param sumW Vector of sum of weights of the selected bookkeepers * @param isHLLHC Whether this is a HLLHC ugprade sample, it uses different stream for bookkeepers */ - void parseCutBookkeepers(const xAOD::CutBookkeeperContainer *cutBookKeepers, + void parseCutBookkeepers(xAOD::TEvent& event, const std::size_t size, std::vector<std::string> &names, std::vector<float>& sumW, const bool isHLLHC=false); /** diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/util/top-xaod.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/util/top-xaod.cxx index 51b41c0a076cbfe9bebbe1125303a64e1168adf4..9781df7352ec8a83aec2e8bbb3213575a613fc3b 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/util/top-xaod.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopAnalysis/util/top-xaod.cxx @@ -561,39 +561,30 @@ int main(int argc, char** argv) { std::vector<float> LHE3_sumW_file; std::vector<std::string> LHE3_names_file; - // See https://twiki.cern.ch/twiki/bin/view/AtlasProtected/AnalysisMetadata#Event_Bookkeepers - const xAOD::CutBookkeeperContainer* cutBookKeepers = 0; - // Try to get the cut bookkeepers. - // <tom.neep@cern.ch> (4/4/16): Not there in DAOD_TRUTH1? - // If we can't get them and we are running on TRUTH then carry on, - // but anything else is bad! + const xAOD::CutBookkeeperContainer* cutBookKeepers = nullptr; if(topConfig->isTruthDxAOD()) { ATH_MSG_INFO("Bookkeepers are not read for TRUTH derivations"); - } - else if (!xaodEvent.retrieveMetaInput(cutBookKeepers, "CutBookkeepers")) { - ATH_MSG_ERROR("Failed to retrieve cut book keepers"); - return 1; } else { + top::check(xaodEvent.retrieveMetaInput(cutBookKeepers, "CutBookkeepers"), "Cannot retrieve CutBookkeepers"); if (topConfig->isMC()) { - // try to retrieve CutBookKeepers for LHE3Weights first - top::parseCutBookkeepers(cutBookKeepers, LHE3_names_file, LHE3_sumW_file, topConfig->HLLHC()); // here we attempt to name the CutBookkeepers based on the MC weight names // but we might end up in a situation where we don't have PMGTruthWeightTool // e.g. if TruthMetaData container is broken in derivation // we continue without names of the MC weights, only indices will be available ToolHandle<PMGTools::IPMGTruthWeightTool> m_pmg_weightTool("PMGTruthWeightTool"); - if (m_pmg_weightTool.retrieve()) { - const std::vector<std::string> &weight_names = m_pmg_weightTool->getWeightNames(); - // if we have MC generator weights, we rename the bookkeepers in sumWeights TTree to match the weight names from MetaData - top::renameCutBookkeepers(LHE3_names_file, weight_names); - } else { - for (std::string &name : LHE3_names_file) { - name = "?"; - } + if (!m_pmg_weightTool.retrieve()) { + ATH_MSG_ERROR("Cannot retrieve PMGTruthWeightTool"); + return 1; } + const std::vector<std::string> &weight_names = m_pmg_weightTool->getWeightNames(); + // try to retrieve CutBookKeepers for LHE3Weights first + top::parseCutBookkeepers(xaodEvent, weight_names.size(), LHE3_names_file, LHE3_sumW_file, topConfig->HLLHC()); + // if we have MC generator weights, we rename the bookkeepers in sumWeights TTree to match the weight names from MetaData + top::renameCutBookkeepers(LHE3_names_file, weight_names); + // raw number of events taken from "AllExecutedEvents" bookkeeper, which corresponds to 0th MC weight // but these are raw entries, so doesn't matter if 0th MC weight is nominal or not initialEvents = top::getRawEventsBookkeeper(cutBookKeepers, topConfig->HLLHC()); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MissingETObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MissingETObjectCollectionMaker.cxx index afb05d0ca1953ea6b4165db46998c292d63b4fa0..2e80ed78d4290ec81ee50405b18435ebb3b2c905 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MissingETObjectCollectionMaker.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MissingETObjectCollectionMaker.cxx @@ -127,7 +127,8 @@ namespace top { const std::string& outputContainerSuffix) { // decoration for objects that pass pre OR selection std::string passPreORSelection = "passPreORSelection"; - const std::string jet_collection = m_config->sgKeyJets(); + std::string jet_collection = m_config->sgKeyJets(); + jet_collection.erase(jet_collection.length() - 4); //erase "Jets" from jet collection name const bool is_loose_event = (event->isLooseEvent() == 1 ? true : false); @@ -278,13 +279,13 @@ namespace top { // https://svnweb.cern.ch/trac/atlasoff/browser/Reconstruction/MET/METUtilities/tags/METUtilities-00-01-43/util/example_METMaker_METSystematicsTool.cxx //get the soft cluster term, and applyCorrection - xAOD::MissingET* softClusMet = (*new_met_container)["SoftClus"]; + xAOD::MissingET* softClusMet = (*new_met_container)["SoftClusCore"]; if (softClusMet != nullptr) { //check we retrieved the clust term m_met_systematics->setRandomSeed(static_cast<int>(1e6*softClusMet->phi())); top::check(m_met_systematics->applyCorrection(*softClusMet), "Failed to applyCorrection"); } - xAOD::MissingET* softTrkMet = (*new_met_container)["PVSoftTrk"]; + xAOD::MissingET* softTrkMet = (*new_met_container)["PVSoftTrkCore"]; if (softTrkMet != nullptr) { //check we retrieved the soft trk m_met_systematics->setRandomSeed(static_cast<int>(1e6*softTrkMet->phi())); top::check(m_met_systematics->applyCorrection(*softTrkMet), "Failed to applyCorrection"); diff --git a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx index 896cdc2cce1556a0a5aa184e347f81f8b3609eb0..ea1e8ac0b29ec340d4b5a04ee0e331ee5afc66ab 100644 --- a/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx +++ b/PhysicsAnalysis/TopPhys/xAOD/TopSystematicObjectMaker/Root/MuonObjectCollectionMaker.cxx @@ -136,7 +136,9 @@ namespace top { StatusCode MuonObjectCollectionMaker::execute(bool executeNominal) { + static const SG::AuxElement::ConstAccessor<float> topoetcone20("topoetcone20"); static const SG::AuxElement::ConstAccessor<float> ptvarcone30_TightTTVA_pt1000("ptvarcone30_TightTTVA_pt1000"); + static const SG::AuxElement::ConstAccessor<float> ptvarcone20_TightTTVA_pt500("ptvarcone20_TightTTVA_pt500"); static const SG::AuxElement::ConstAccessor<float> ptcone20_TightTTVA_pt1000("ptcone20_TightTTVA_pt1000"); static const SG::AuxElement::ConstAccessor<float> ptcone20_TightTTVA_pt500("ptcone20_TightTTVA_pt500"); static const SG::AuxElement::ConstAccessor<float> ptvarcone30_TightTTVA_pt500("ptvarcone30_TightTTVA_pt500"); @@ -243,31 +245,45 @@ namespace top { passIsol_Tight_VarRad = -1; passIsol_Loose_VarRad = -1; - passIsol_FCTight = m_isolationTool_FCTight->accept(*muon) ? 1 : 0; - passIsol_FCLoose = m_isolationTool_FCLoose->accept(*muon) ? 1 : 0; - passIsol_FCTightTrackOnly = m_isolationTool_FCTightTrackOnly->accept(*muon) ? 1 : 0; - passIsol_FCTightTrackOnly_FixedRad = m_isolationTool_FCTightTrackOnly_FixedRad->accept(*muon) ? 1 : 0; - passIsol_FCLoose_FixedRad = m_isolationTool_FCLoose_FixedRad->accept(*muon) ? 1 : 0; - passIsol_FCTight_FixedRad = m_isolationTool_FCTight_FixedRad->accept(*muon) ? 1 : 0; - passIsol_FixedCutPflowTight = m_isolationTool_FixedCutPflowTight->accept(*muon) ? 1 : 0; - passIsol_FixedCutPflowLoose = m_isolationTool_FixedCutPflowLoose->accept(*muon) ? 1 : 0; + if (ptvarcone30_TightTTVA_pt1000.isAvailable(*muon) + && topoetcone20.isAvailable(*muon)) { + passIsol_FCTight = m_isolationTool_FCTight->accept(*muon) ? 1 : 0; + passIsol_FCLoose = m_isolationTool_FCLoose->accept(*muon) ? 1 : 0; + passIsol_FCLoose_FixedRad = m_isolationTool_FCLoose_FixedRad->accept(*muon) ? 1 : 0; + passIsol_FCTight_FixedRad = m_isolationTool_FCTight_FixedRad->accept(*muon) ? 1 : 0; + } + + if (ptvarcone30_TightTTVA_pt1000.isAvailable(*muon)) { + passIsol_FCTightTrackOnly = m_isolationTool_FCTightTrackOnly->accept(*muon) ? 1 : 0; + passIsol_FCTightTrackOnly_FixedRad = m_isolationTool_FCTightTrackOnly_FixedRad->accept(*muon) ? 1 : 0; + } + + if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) + && ptvarcone20_TightTTVA_pt500.isAvailable(*muon) + && neflowisol20.isAvailable(*muon)) { + passIsol_FixedCutPflowTight = m_isolationTool_FixedCutPflowTight->accept(*muon) ? 1 : 0; + passIsol_FixedCutPflowLoose = m_isolationTool_FixedCutPflowLoose->accept(*muon) ? 1 : 0; + } //new Iso WPs - if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) && neflowisol20.isAvailable(*muon) && ptcone20_TightTTVA_pt500.isAvailable(*muon)) { + if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) + && neflowisol20.isAvailable(*muon) + && ptcone20_TightTTVA_pt500.isAvailable(*muon)) { passIsol_PflowTight_FixedRad = m_isolationTool_PflowTight_FixedRad->accept(*muon) ? 1 : 0; passIsol_PflowLoose_FixedRad = m_isolationTool_PflowLoose_FixedRad->accept(*muon) ? 1 : 0; } - if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) && neflowisol20.isAvailable(*muon)) { + if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) + && neflowisol20.isAvailable(*muon)) { passIsol_PflowTight_VarRad = m_isolationTool_PflowTight_VarRad->accept(*muon) ? 1 : 0; passIsol_PflowLoose_VarRad = m_isolationTool_PflowLoose_VarRad->accept(*muon) ? 1 : 0; } if (ptcone20_TightTTVA_pt1000.isAvailable(*muon)) { passIsol_HighPtTrackOnly = m_isolationTool_HighPtTrackOnly->accept(*muon) ? 1 : 0; } - if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon)) { + if (ptvarcone30_TightTTVA_pt1000.isAvailable(*muon)) { passIsol_TightTrackOnly_VarRad = m_isolationTool_TightTrackOnly_VarRad->accept(*muon) ? 1 : 0; } - if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon) && ptcone20_TightTTVA_pt500.isAvailable(*muon)) { + if (ptvarcone30_TightTTVA_pt1000.isAvailable(*muon) && ptcone20_TightTTVA_pt1000.isAvailable(*muon)) { passIsol_TightTrackOnly_FixedRad = m_isolationTool_TightTrackOnly_FixedRad->accept(*muon) ? 1 : 0; } if (ptvarcone30_TightTTVA_pt500.isAvailable(*muon)) { @@ -287,7 +303,7 @@ namespace top { passIsol_Tight_FixedRad = m_isolationTool_Tight_FixedRad->accept(*muon) ? 1 : 0; passIsol_Loose_FixedRad = m_isolationTool_Loose_FixedRad->accept(*muon) ? 1 : 0; } - if (ptvarcone30_TightTTVA_pt1000.isAvailable(*muon)) { + if (ptvarcone30_TightTTVA_pt1000.isAvailable(*muon) && topoetcone20.isAvailable(*muon)) { passIsol_Tight_VarRad = m_isolationTool_Tight_VarRad->accept(*muon) ? 1 : 0; passIsol_Loose_VarRad = m_isolationTool_Loose_VarRad->accept(*muon) ? 1 : 0; } diff --git a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/test/TruthParticleContainerCnv_p6_test.cxx b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/test/TruthParticleContainerCnv_p6_test.cxx index e0aacbd1d35463033b8c76fd5377c176c8b23cfb..1f44290c33434e70944346c0ab8a4d7dc8d8546c 100644 --- a/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/test/TruthParticleContainerCnv_p6_test.cxx +++ b/PhysicsAnalysis/TruthParticleID/McParticleEventTPCnv/test/TruthParticleContainerCnv_p6_test.cxx @@ -82,9 +82,9 @@ void test1 (SGTest::TestStore& store) #ifdef HEPMC3 //Signal process id is obsolete in HepMC3 evcoll->push_back (std::make_unique<HepMC::GenEvent>()); - evcoll.back()->set_event_number(4); + evcoll->back()->set_event_number(4); evcoll->push_back (std::make_unique<HepMC::GenEvent>()); - evcoll.back()->set_event_number(5); + evcoll->back()->set_event_number(5); auto ge = std::make_unique<HepMC::GenEvent>(); ge->set_event_number(7); auto gv = HepMC::newGenVertexPtr(); diff --git a/Projects/AnalysisBase/version.txt b/Projects/AnalysisBase/version.txt index d4b369b4e5d8570b7a4ffd09e3e1336fcc9bc5e1..469a03d2db00c39b1d36b8f2151608ba8f6f5da5 100644 --- a/Projects/AnalysisBase/version.txt +++ b/Projects/AnalysisBase/version.txt @@ -1 +1 @@ -22.2.4 +22.2.5 diff --git a/Projects/AthDataQuality/version.txt b/Projects/AthDataQuality/version.txt index 18039123f5af7dc745fc5be9b3f14f86ee2d0d17..fba1acea3945b1b5b58e00bee6b312384a4bc546 100644 --- a/Projects/AthDataQuality/version.txt +++ b/Projects/AthDataQuality/version.txt @@ -1 +1 @@ -22.0.24 +22.0.25 diff --git a/Projects/AthGeneration/version.txt b/Projects/AthGeneration/version.txt index 18039123f5af7dc745fc5be9b3f14f86ee2d0d17..fba1acea3945b1b5b58e00bee6b312384a4bc546 100644 --- a/Projects/AthGeneration/version.txt +++ b/Projects/AthGeneration/version.txt @@ -1 +1 @@ -22.0.24 +22.0.25 diff --git a/Projects/AthSimulation/version.txt b/Projects/AthSimulation/version.txt index 18039123f5af7dc745fc5be9b3f14f86ee2d0d17..fba1acea3945b1b5b58e00bee6b312384a4bc546 100644 --- a/Projects/AthSimulation/version.txt +++ b/Projects/AthSimulation/version.txt @@ -1 +1 @@ -22.0.24 +22.0.25 diff --git a/Projects/Athena/version.txt b/Projects/Athena/version.txt index 18039123f5af7dc745fc5be9b3f14f86ee2d0d17..fba1acea3945b1b5b58e00bee6b312384a4bc546 100644 --- a/Projects/Athena/version.txt +++ b/Projects/Athena/version.txt @@ -1 +1 @@ -22.0.24 +22.0.25 diff --git a/Projects/VP1Light/version.txt b/Projects/VP1Light/version.txt index 18039123f5af7dc745fc5be9b3f14f86ee2d0d17..fba1acea3945b1b5b58e00bee6b312384a4bc546 100644 --- a/Projects/VP1Light/version.txt +++ b/Projects/VP1Light/version.txt @@ -1 +1 @@ -22.0.24 +22.0.25 diff --git a/Reconstruction/Jet/JetRecConfig/CMakeLists.txt b/Reconstruction/Jet/JetRecConfig/CMakeLists.txt index 5d29ebbb481e3703fb7c4d75f68f031e582d6827..fb87cd5b0f731cb61d26bd1124c7e08c3fe97653 100644 --- a/Reconstruction/Jet/JetRecConfig/CMakeLists.txt +++ b/Reconstruction/Jet/JetRecConfig/CMakeLists.txt @@ -4,7 +4,7 @@ atlas_subdir( JetRecConfig ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_scripts( share/JetRecTestCfg.py test/*.sh ) atlas_install_joboptions( share/*.py ) diff --git a/Reconstruction/Jet/JetRecConfig/python/JetModConfig.py b/Reconstruction/Jet/JetRecConfig/python/JetModConfig.py index 13ec64fcc8605d8c488b0eb4774c3d11c1c90be6..f1c39db7cf1d1b96e0332146d6eb742d07e1d519 100644 --- a/Reconstruction/Jet/JetRecConfig/python/JetModConfig.py +++ b/Reconstruction/Jet/JetRecConfig/python/JetModConfig.py @@ -91,8 +91,6 @@ def jetModWithAlternateTrk(jetdef, trkopt): IMPORTANT : this must be called after instantiateAliases() . """ - from JetRecTools.JetRecToolsConfig import trackcollectionmap - def changeJetModSpec( mod ): if mod in ['mod:JVT','mod:JVF', 'mod:TrackMoments', 'mod:TrackSumMoments']: return mod+':'+trkopt diff --git a/Reconstruction/Jet/JetRecConfig/python/StandardSmallRJets.py b/Reconstruction/Jet/JetRecConfig/python/StandardSmallRJets.py index 52750d138d5c5aa7a75ed376efceff5dfdb1195d..9765fedf5cbeba4061fb2bae0903f4b8f730d878 100644 --- a/Reconstruction/Jet/JetRecConfig/python/StandardSmallRJets.py +++ b/Reconstruction/Jet/JetRecConfig/python/StandardSmallRJets.py @@ -2,7 +2,6 @@ from JetRecConfig.StandardJetConstits import jetconstitdic as cst from .JetDefinition import JetDefinition -from xAODBase.xAODType import xAODType diff --git a/Reconstruction/Jet/JetRecConfig/python/Utilities.py b/Reconstruction/Jet/JetRecConfig/python/Utilities.py index 9769877e09a9b3830fbd146364fb48c6ac392182..6f1a29cc0d6206912eb0175367254287571d5afc 100644 --- a/Reconstruction/Jet/JetRecConfig/python/Utilities.py +++ b/Reconstruction/Jet/JetRecConfig/python/Utilities.py @@ -57,7 +57,7 @@ def make_alias( prop ): def _getter(self): return getattr(self,prop,None) def _setter(self,v): - raise AttributeError("Cannot set alias "+pname+" from "+str(self) ) + raise AttributeError("Cannot set alias "+prop+" from "+str(self) ) return property(_getter, _setter) def listClassLProperties(cls): diff --git a/Reconstruction/Jet/JetSimTools/CMakeLists.txt b/Reconstruction/Jet/JetSimTools/CMakeLists.txt index 293ad7b2d40953ccc778da36fe86cca67fcc6454..2ee508790830a8889be93ed751c90ceb8cf8809b 100644 --- a/Reconstruction/Jet/JetSimTools/CMakeLists.txt +++ b/Reconstruction/Jet/JetSimTools/CMakeLists.txt @@ -10,6 +10,6 @@ atlas_add_component( JetSimTools LINK_LIBRARIES AsgTools xAODTruth JetUtils ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) diff --git a/Reconstruction/Jet/JetSimTools/python/JetTruthParticleFilterGetter.py b/Reconstruction/Jet/JetSimTools/python/JetTruthParticleFilterGetter.py index f9c6c57ca2eef6dca108851f64f2f71dd377c8e1..b761cbc0ef2314e3d7ea9748d1fb9d61ac49f7e4 100644 --- a/Reconstruction/Jet/JetSimTools/python/JetTruthParticleFilterGetter.py +++ b/Reconstruction/Jet/JetSimTools/python/JetTruthParticleFilterGetter.py @@ -1,11 +1,10 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from JetSimTools.JetSimToolsConf import JetTruthParticleFilter, JetTruthParticleSelectorTool from JetRec.JetGetters import getStandardInputCollection from JetRec.JetAlgConfiguration import checkAndUpdateOptions -from AthenaCommon.SystemOfUnits import * from RecExConfig.Configured import Configured from AthenaCommon.AlgSequence import AlgSequence import logging diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/CMakeLists.txt b/Reconstruction/Jet/JetSubStructureMomentTools/CMakeLists.txt index d51d10d54139f2a810780c3297b9912f5fb6a53e..3934a9acb45f50be29339c903c250f7f4e0105cc 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/CMakeLists.txt +++ b/Reconstruction/Jet/JetSubStructureMomentTools/CMakeLists.txt @@ -37,5 +37,5 @@ atlas_add_dictionary( JetSubStructureMomentToolsDict LINK_LIBRARIES JetSubStructureMomentToolsLib ) # Install files from the package: -atlas_install_python_modules( python/*.py ) +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/python/DefaultTools.py b/Reconstruction/Jet/JetSubStructureMomentTools/python/DefaultTools.py index 2c17df095bc07c65826fcac26136754a8eb0770a..2d2dde4e1177f94fd4fb039a2cc4d6d3d7f11238 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/python/DefaultTools.py +++ b/Reconstruction/Jet/JetSubStructureMomentTools/python/DefaultTools.py @@ -10,6 +10,7 @@ from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import Dipolarity from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import PlanarFlowTool from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import KtMassDropTool from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import EnergyCorrelatorTool +from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import EnergyCorrelatorGeneralizedTool from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import EnergyCorrelatorGeneralizedRatiosTool from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import CenterOfMassShapesTool from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import JetPullTool diff --git a/Reconstruction/MET/METUtilities/METUtilities/METMaker.h b/Reconstruction/MET/METUtilities/METUtilities/METMaker.h index dc6bb7484510e0a76c02d7dafb6cc76f59de1228..22157ea0ba3c48234aab0aa7f1045ee1ca29a04c 100644 --- a/Reconstruction/MET/METUtilities/METUtilities/METMaker.h +++ b/Reconstruction/MET/METUtilities/METUtilities/METMaker.h @@ -170,6 +170,8 @@ namespace met { bool m_muEloss; bool m_orCaloTaggedMuon; + bool m_greedyPhotons; + bool m_veryGreedyPhotons; ToolHandle<InDet::IInDetTrackSelectionTool> m_trkseltool; /// Default constructor: diff --git a/Reconstruction/MET/METUtilities/METUtilities/METUtilitiesDict.h b/Reconstruction/MET/METUtilities/METUtilities/METUtilitiesDict.h index ac5ee294a5b1e216db142100fb381d92351cb4c4..1fa8fd0272ae83293161815190582273825bd0e8 100644 --- a/Reconstruction/MET/METUtilities/METUtilities/METUtilitiesDict.h +++ b/Reconstruction/MET/METUtilities/METUtilities/METUtilitiesDict.h @@ -12,5 +12,6 @@ #include "METUtilities/METRebuilder.h" #include "METUtilities/METMaker.h" #include "METUtilities/METSystematicsTool.h" +#include "METUtilities/METSignificance.h" #endif //METUTILITIESDICT_H diff --git a/Reconstruction/MET/METUtilities/Root/METMaker.cxx b/Reconstruction/MET/METUtilities/Root/METMaker.cxx index 997530d2e3b07ae8946f105df57dcb46f0af29bc..5bb1b9e416fa70d5ebf1c157686f2b518776be5c 100644 --- a/Reconstruction/MET/METUtilities/Root/METMaker.cxx +++ b/Reconstruction/MET/METUtilities/Root/METMaker.cxx @@ -117,6 +117,9 @@ namespace met { declareProperty("DoMuonEloss", m_muEloss = false ); declareProperty("ORCaloTaggedMuons", m_orCaloTaggedMuon = true ); + declareProperty("GreedyPhotons", m_greedyPhotons = false ); + declareProperty("VeryGreedyPhotons", m_veryGreedyPhotons = false ); + declareProperty("UseGhostMuons", m_useGhostMuons = false ); declareProperty("DoRemoveMuonJets", m_doRemoveMuonJets = true ); @@ -312,6 +315,21 @@ namespace met { ATH_MSG_VERBOSE(obj->type() << " (" << orig <<") with pt " << obj->pt() << " is " << ( selected ? "non-" : "") << "overlapping"); + // Greedy photon options: set selection flags + if ((m_greedyPhotons || m_veryGreedyPhotons) && selected && obj->type() == xAOD::Type::Photon){ + for(const xAOD::MissingETAssociation* assoc : assocs){ + std::vector<size_t> indices = assoc->overlapIndices(orig); + std::vector<const xAOD::IParticle*> allObjects = assoc->objects(); + for (size_t index : indices){ + const xAOD::IParticle* thisObj = allObjects[index]; + if(!thisObj) continue; + if ((thisObj->type() == xAOD::Type::Jet && m_veryGreedyPhotons) || + thisObj->type() == xAOD::Type::Electron) + helper->setObjSelectionFlag(assoc, thisObj, true); + } + } + } + //Do special overlap removal for calo tagged muons if(m_orCaloTaggedMuon && !removeOverlap && orig->type()==xAOD::Type::Muon && static_cast<const xAOD::Muon*>(orig)->muonType()==xAOD::Muon::CaloTagged) { for (size_t i = 0; i < assocs.size(); i++) { @@ -609,6 +627,10 @@ namespace met { ATH_MSG_VERBOSE(" Jet overlaps with " << object->type() << " " << object->index() << " with pt " << object->pt() << ", phi " << object->phi() ); } + + // Correctly handle this jet if we're using very greedy photons + if (object && object->type() == xAOD::Type::Photon && m_veryGreedyPhotons) hardJet = true; + } } diff --git a/Reconstruction/MissingETPerformance/MissingETPerformance/MissingETMuonData.h b/Reconstruction/MissingETPerformance/MissingETPerformance/MissingETMuonData.h index b315848fef603e81c2e3d21a7dfca637e106abe6..e1635b2310ae33043dd292d6f716980a3b1ec629 100755 --- a/Reconstruction/MissingETPerformance/MissingETPerformance/MissingETMuonData.h +++ b/Reconstruction/MissingETPerformance/MissingETPerformance/MissingETMuonData.h @@ -32,7 +32,7 @@ class MissingETMuonData : public AthAlgTool { std::string m_JetKey; //Muon containers - std::vector<const HepMC::GenParticle*> m_truth_Muons; + std::vector<HepMC::ConstGenParticlePtr> m_truth_Muons; std::vector<const Analysis::Muon*> m_crack_Muons; std::vector<const Analysis::Muon*> m_MuonBoy_Spectro_Muons; std::vector<const Analysis::Muon*> m_MuonBoy_Track_Muons; @@ -67,7 +67,7 @@ public: bool isIsolated(const Analysis::Muon *mu, const JetCollection *jets); - const std::vector<const HepMC::GenParticle*> &used_truth_muons() {return m_truth_Muons;} + const std::vector<HepMC::ConstGenParticlePtr> &used_truth_muons() {return m_truth_Muons;} const std::vector<const Analysis::Muon*> &used_crack_Muons() {return m_crack_Muons;} const std::vector<const Analysis::Muon*> &used_MuonBoy_Spectro_Muons() {return m_MuonBoy_Spectro_Muons;} const std::vector<const Analysis::Muon*> &used_MuonBoy_Track_Muons() {return m_MuonBoy_Track_Muons;} diff --git a/Reconstruction/MissingETPerformance/src/FakeMissingETTool.cxx b/Reconstruction/MissingETPerformance/src/FakeMissingETTool.cxx index 48ea69c163fa5aa47e3b331e60a4594a01a97bb5..afbb6c7fad2902312d1712bae0b545e71e4ddaaf 100755 --- a/Reconstruction/MissingETPerformance/src/FakeMissingETTool.cxx +++ b/Reconstruction/MissingETPerformance/src/FakeMissingETTool.cxx @@ -362,7 +362,7 @@ StatusCode FakeMissingETTool::fakeMissingET(MissingETData *data, MissingETMuonDa StatusCode sc = StatusCode::SUCCESS; - const std::vector<const HepMC::GenParticle*> &truth_muons = muondata->used_truth_muons(); + const std::vector<HepMC::ConstGenParticlePtr> &truth_muons = muondata->used_truth_muons(); const std::vector<const Analysis::Muon*> &spectroMuons = muondata->used_MuonBoy_Spectro_Muons(); const std::vector<const Analysis::Muon*> &trackMuons = muondata->used_MuonBoy_Track_Muons(); const std::vector<HepLorentzVector*> &used_muons = muondata->all_used_muons(); diff --git a/Reconstruction/MissingETPerformance/src/MuonTool.cxx b/Reconstruction/MissingETPerformance/src/MuonTool.cxx index 30cdb5fdc3a062f7baaae24f9fc26962ab50ff96..44f19b1158e978d20605d7fe22f5946b03a07149 100644 --- a/Reconstruction/MissingETPerformance/src/MuonTool.cxx +++ b/Reconstruction/MissingETPerformance/src/MuonTool.cxx @@ -372,7 +372,7 @@ StatusCode MuonTool::muonSetup(MissingETMuonData *muondata) { StatusCode sc = StatusCode::SUCCESS; - const std::vector<const HepMC::GenParticle*> &truth_muons = muondata->used_truth_muons(); + const std::vector<HepMC::ConstGenParticlePtr> &truth_muons = muondata->used_truth_muons(); std::vector<const Analysis::Muon*> spectroMuons = muondata->used_MuonBoy_Spectro_Muons(); std::vector<const Analysis::Muon*> trackMuons = muondata->used_MuonBoy_Track_Muons(); diff --git a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/MuidCaloEnergyTools/MuidCaloEnergyMeas.h b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/MuidCaloEnergyTools/MuidCaloEnergyMeas.h index e4806513800fd34531e11ed7ae99c1cda4efec81..23ae53a2cc4d45f028e486e25bfa930032caec2c 100755 --- a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/MuidCaloEnergyTools/MuidCaloEnergyMeas.h +++ b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/MuidCaloEnergyTools/MuidCaloEnergyMeas.h @@ -9,7 +9,6 @@ the active measurements in the traversed calorimeter cells. @author Konstantinos.Nikolopoulos@cern.ch, Alan.Poppleton@cern.ch - (c) ATLAS Combined Muon software */ /////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/MuidCaloEnergyTools/MuidCaloEnergyParam.h b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/MuidCaloEnergyTools/MuidCaloEnergyParam.h index b6d3e4e63555abe0c34232edd4158b5504d2fbb9..def72862e4dde6fd683a024b42fe60a038358882 100755 --- a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/MuidCaloEnergyTools/MuidCaloEnergyParam.h +++ b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/MuidCaloEnergyTools/MuidCaloEnergyParam.h @@ -9,7 +9,6 @@ to trackParameters given at the calo mid-surface. @author Konstantinos.Nikolopoulos@cern.ch, Alan.Poppleton@cern.ch - (c) ATLAS Combined Muon software */ ////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/MuidCaloEnergyTools/MuidCaloEnergyTool.h b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/MuidCaloEnergyTools/MuidCaloEnergyTool.h index a4ea560f9deeb0bc7978960e25da8db926f354dd..a8572629755e80d4b76819b281f9cbf44982c3c0 100755 --- a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/MuidCaloEnergyTools/MuidCaloEnergyTool.h +++ b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/MuidCaloEnergyTools/MuidCaloEnergyTool.h @@ -15,7 +15,6 @@ IEEE Trans. Nucl. Sci., vol. 54, no. 5, pt. 2, pp. 1792-1796, Oct. 2007. @author Konstantinos.Nikolopoulos@cern.ch, Alan.Poppleton@cern.ch - (c) ATLAS Combined Muon software */ ////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyMeas.cxx b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyMeas.cxx index e1798e456c84eb5f9c4cf597e0e27fe9c33ae111..1f808af7ecc7d4d777b8c80ea62240a7656b0693 100755 --- a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyMeas.cxx +++ b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyMeas.cxx @@ -8,7 +8,6 @@ // calorimeters. The energy deposit is estimated according to // the active measurements in the traversed calorimeter cells. // -// (c) ATLAS Combined Muon software /////////////////////////////////////////////////////////////////// //<<<<<< INCLUDES >>>>>> diff --git a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyParam.cxx b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyParam.cxx index bb6e88bd664b2128308eb81977b9f514bdbea9f7..35887aa216b8449102cc897d1d72d180160e0a7f 100755 --- a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyParam.cxx +++ b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyParam.cxx @@ -8,7 +8,6 @@ // deposited by a traversing muon. The energy is parametrized according // to trackParameters given at the calo mid-surface. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// //<<<<<< INCLUDES >>>>>> diff --git a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyTool.cxx b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyTool.cxx index c146b92a59f7464df60be2ac97c5868f345d95dd..7d5af8e066380b71aa3752c7fbb0d699ed791a1d 100755 --- a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyTool.cxx +++ b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyTool.cxx @@ -14,7 +14,6 @@ // "Event-by-Event Estimate of Muon Energy Loss in ATLAS", // IEEE Trans. Nucl. Sci., vol. 54, no. 5, pt. 2, pp. 1792-1796, Oct. 2007. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// //<<<<<< INCLUDES >>>>>> diff --git a/Reconstruction/MuonIdentification/MuidCaloIsolationTools/MuidCaloIsolationTools/MuidTrackIsolation.h b/Reconstruction/MuonIdentification/MuidCaloIsolationTools/MuidCaloIsolationTools/MuidTrackIsolation.h index 426c42fdf1ecb077a800c84c4d5f1c8191f8baf9..b2c3032fa5b9c07be2f9733f949f075ac448784b 100755 --- a/Reconstruction/MuonIdentification/MuidCaloIsolationTools/MuidCaloIsolationTools/MuidTrackIsolation.h +++ b/Reconstruction/MuonIdentification/MuidCaloIsolationTools/MuidCaloIsolationTools/MuidTrackIsolation.h @@ -8,7 +8,6 @@ energetic inner detector tracks in a cone surrounding a muon @author Konstantinos.Nikolopoulos@cern.ch, Alan.Poppleton@cern.ch - (c) ATLAS Combined Muon software */ ////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidCaloIsolationTools/src/MuidTrackIsolation.cxx b/Reconstruction/MuonIdentification/MuidCaloIsolationTools/src/MuidTrackIsolation.cxx index bbc3f0db68e7e564982a349b9e9048f0c736d937..2135ec5c3dcfcfe45d7acf37f50d937f6c6d46e2 100755 --- a/Reconstruction/MuonIdentification/MuidCaloIsolationTools/src/MuidTrackIsolation.cxx +++ b/Reconstruction/MuonIdentification/MuidCaloIsolationTools/src/MuidTrackIsolation.cxx @@ -7,7 +7,6 @@ // AlgTool for estimating the number, total charged momentum and most // energetic inner detector tracks in a cone surrounding a muon // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #include "MuidCaloIsolationTools/MuidTrackIsolation.h" diff --git a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/MuidCaloScatteringTools/MuidCaloMaterialParam.h b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/MuidCaloScatteringTools/MuidCaloMaterialParam.h index c3421cb17aea2f772a4c201b76fcae07f2ebaab0..50288afb81ff894e4f68b7a28408663f9a6a0108 100755 --- a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/MuidCaloScatteringTools/MuidCaloMaterialParam.h +++ b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/MuidCaloScatteringTools/MuidCaloMaterialParam.h @@ -15,7 +15,6 @@ Tabulated info taken from a geantino map @author Konstantinos.Nikolopoulos@cern.ch, Alan.Poppleton@cern.ch - (c) ATLAS Combined Muon software */ ////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/MuidCaloScatteringTools/MuidCaloTrackStateOnSurface.h b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/MuidCaloScatteringTools/MuidCaloTrackStateOnSurface.h index a52c1da685a76ce1799bbcad757c61a80a040aa0..add3c040dcbfb98adbac9ab7903e5ff6426cb06f 100755 --- a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/MuidCaloScatteringTools/MuidCaloTrackStateOnSurface.h +++ b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/MuidCaloScatteringTools/MuidCaloTrackStateOnSurface.h @@ -13,7 +13,6 @@ using the IMuidCaloMaterialParam and IMuidCaloEnergy interfaces @author Alan.Poppleton@cern.ch - (c) ATLAS Combined Muon software */ ////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloMaterialParam.cxx b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloMaterialParam.cxx index 23e030f7e57e94b33b02e08048c466d95d4aae9a..e357dc087fd0a4f595aeb56f485be9c1638d2b51 100755 --- a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloMaterialParam.cxx +++ b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloMaterialParam.cxx @@ -14,7 +14,6 @@ // // Tabulated info taken from a geantino map // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloTrackStateOnSurface.cxx b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloTrackStateOnSurface.cxx index 49a36aae0267e9252e6a66855b304244df5c1897..09e1a0de736b33c930796803426ea6e72582589e 100755 --- a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloTrackStateOnSurface.cxx +++ b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloTrackStateOnSurface.cxx @@ -12,7 +12,6 @@ // hybrid (measured + parametrized) energy deposit evaluation // using the IMuidCaloMaterialParam and IMuidCaloEnergy interfaces // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// //<<<<<< INCLUDES >>>>>> diff --git a/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/FieldIntegral.h b/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/FieldIntegral.h index 57f9e794194406974df45ed73ec322fc49d1f66c..c9b4f149ebb63dfdad416eac7f7ebb3a2f4495ed 100644 --- a/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/FieldIntegral.h +++ b/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/FieldIntegral.h @@ -3,7 +3,6 @@ */ ////////////////////////////////////////////////////////////////// -// FieldIntegral.h, (c) ATLAS Combined Muon software // lightweight data class containing various field integrals ////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/IndetMatchCandidate.h b/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/IndetMatchCandidate.h index c3f9ebf3a2ec70ed02e7ec1d74d7914e3260f8a3..fab4654ad2c938b59e2ebaf5e9926a142ea098f6 100644 --- a/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/IndetMatchCandidate.h +++ b/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/IndetMatchCandidate.h @@ -9,7 +9,6 @@ and information on the match quality @author Alan.Poppleton@cern.ch - (c) ATLAS Combined Muon software */ /////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/MuidTrack.h b/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/MuidTrack.h index 31170ff60064d7bfb341e521d05ff68488eea2d7..582f2891700b2d179e332c5d185e0e2fd43e40bb 100644 --- a/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/MuidTrack.h +++ b/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/MuidTrack.h @@ -10,7 +10,6 @@ Dummy methods @author Alan.Poppleton@cern.ch - (c) ATLAS Combined Muon software */ /////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/MuonMatch.h b/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/MuonMatch.h index 35ec6a228cd9d82707b1fedf57f12dce71e09485..ed8e50799eb913b8f04b87266e3e12d1434a1158 100644 --- a/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/MuonMatch.h +++ b/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/MuonMatch.h @@ -9,7 +9,6 @@ and information on the match quality @author Alan.Poppleton@cern.ch - (c) ATLAS Combined Muon software */ /////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/ScatteringAngleSignificance.h b/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/ScatteringAngleSignificance.h index 52b584bdefc52e65bed243ac62f94efb9c9680f8..1eef6f2304eb785a1fe74a6be88384b4809dbc87 100644 --- a/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/ScatteringAngleSignificance.h +++ b/Reconstruction/MuonIdentification/MuidEvent/MuidEvent/ScatteringAngleSignificance.h @@ -3,7 +3,6 @@ */ ////////////////////////////////////////////////////////////////// -// ScatteringAngleSignificance.h, (c) ATLAS Combined Muon software // lightweight data class containing analysis of inner scatterers ////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidEvent/src/IndetMatchCandidate.cxx b/Reconstruction/MuonIdentification/MuidEvent/src/IndetMatchCandidate.cxx index c78dfd33f9ff3f91bc906606755f3a19c2f4ad5f..dd4d701a00493b1b5b925783da4b2f708cfd3cdd 100644 --- a/Reconstruction/MuonIdentification/MuidEvent/src/IndetMatchCandidate.cxx +++ b/Reconstruction/MuonIdentification/MuidEvent/src/IndetMatchCandidate.cxx @@ -9,7 +9,6 @@ and information on the match quality @author Alan.Poppleton@cern.ch - (c) ATLAS Combined Muon software */ /////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidEvent/src/MuidTrack.cxx b/Reconstruction/MuonIdentification/MuidEvent/src/MuidTrack.cxx index 9e7fefb6c326f404fee7be946466f0b62d6ff07f..c54e7989102f4aed51e1c7c429123ae838f96763 100644 --- a/Reconstruction/MuonIdentification/MuidEvent/src/MuidTrack.cxx +++ b/Reconstruction/MuonIdentification/MuidEvent/src/MuidTrack.cxx @@ -10,7 +10,6 @@ Dummy methods @author Alan.Poppleton@cern.ch - (c) ATLAS Combined Muon software */ /////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidEvent/src/MuonMatch.cxx b/Reconstruction/MuonIdentification/MuidEvent/src/MuonMatch.cxx index 94eaf4ec8321e934daff4131333058b5a7427db8..b86f0fb1722363545bd630dedc053f7fe64d7227 100644 --- a/Reconstruction/MuonIdentification/MuidEvent/src/MuonMatch.cxx +++ b/Reconstruction/MuonIdentification/MuidEvent/src/MuonMatch.cxx @@ -9,7 +9,6 @@ and information on the match quality @author Alan.Poppleton@cern.ch - (c) ATLAS Combined Muon software */ /////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/ICombinedMuonTrackBuilder.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/ICombinedMuonTrackBuilder.h index cb56fb23ca5af169e3df0fb042ec34d4155c6693..34c44a56529b4b6df72d2c5547bccccee17dff2e 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/ICombinedMuonTrackBuilder.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/ICombinedMuonTrackBuilder.h @@ -8,7 +8,6 @@ // and/or MeasurementSet, gathering material effects along the // track (in particular for the calorimeter). // -// (c) ATLAS Combined Muon software /////////////////////////////////////////////////////////////////// #ifndef MUIDINTERFACES_ICOMBINEDMUONTRACKBUILDER_H @@ -76,7 +75,7 @@ public: virtual Trk::Track* fit(Trk::Track& track, const Trk::RunOutlierRemoval runOutlier = false, const Trk::ParticleHypothesis particleHypothesis = Trk::muon) const = 0; - virtual void cleanUp() const {}; + virtual void cleanUp() const = 0; }; } // end of namespace diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidBackTracker.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidBackTracker.h index 54e41c20ddc370caed4c5561ce9f40297aa4db4f..f77f9f6c706fc491768bc9c798626266ec695a84 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidBackTracker.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidBackTracker.h @@ -9,7 +9,6 @@ // The return collection is required to have a one-to-one correspondence // to the input. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #ifndef MUIDINTERFACES_IMUIDBACKTRACKER_H diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloEnergy.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloEnergy.h index b5f2abc3d26ce791ac3aebdfdd679c7fb509c71a..76bf7ffa3a6bfa7a1789d28e49531abbe4f8f7ec 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloEnergy.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloEnergy.h @@ -6,7 +6,6 @@ // IMuidCaloEnergy // tool interface for estimating the energy loss of a muon with its error. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloEnergyMeas.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloEnergyMeas.h index 9833d242023cb524c966ebed5f856578566aa9e1..3201e820be4972cfc9e62cecc59384afd9c28b1b 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloEnergyMeas.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloEnergyMeas.h @@ -8,7 +8,6 @@ // calorimeters. The energy deposit is estimated according to // the active measurements in the traversed calorimeter cells. // -// (c) ATLAS Combined Muon software /////////////////////////////////////////////////////////////////// #ifndef MUIDINTERFACES_IMUIDCALOENERGYMEAS_H diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloEnergyParam.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloEnergyParam.h index 681d9d3307f3a00ef78f829a0107094e1d47da2d..1899ac3fc643be73f08ae6f059d3307642292251 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloEnergyParam.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloEnergyParam.h @@ -8,7 +8,6 @@ // calorimeters. The energy is parametrized according to // trackParameters given at the calo mid-surface. // -// (c) ATLAS Combined Muon software /////////////////////////////////////////////////////////////////// #ifndef MUIDINTERFACES_IMUIDCALOENERGYPARAM_H diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloMaterialParam.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloMaterialParam.h index 2ad9181cc8ead4e7edf92483562fd94739c782ce..89c3a405e21f2073f020a4dad1ae422715caf60c 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloMaterialParam.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloMaterialParam.h @@ -3,7 +3,6 @@ */ /////////////////////////////////////////////////////////////////// -// IMuidCaloMaterialParam.h, (c) ATLAS Combined Muon software /////////////////////////////////////////////////////////////////// #ifndef MUIDINTERFACES_IMUIDCALOMATERIALPARAM_H diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloTrackStateOnSurface.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloTrackStateOnSurface.h index 7c046a5354f9c66289741845f5d1baaee9ca138c..31216a5f4d73a9685d56436b6b5bf7a242e99ab4 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloTrackStateOnSurface.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidCaloTrackStateOnSurface.h @@ -8,7 +8,6 @@ // objects representing the Coulomb scattering and energy deposit between // the InDet and MuonSpectrometer entrance. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #ifndef MUIDINTERFACES_IMUIDCALOTRACKSTATEONSURFACE_H diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidMatchMaker.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidMatchMaker.h index 0321e5e753331318759b84fed40cd6cfd5e9aa15..bd79cfae57276d4480210c8f82c37c0478c03d79 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidMatchMaker.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidMatchMaker.h @@ -8,7 +8,6 @@ // collection to any corresponding tracks from an inner detector collection. // Perform a full track-fit to the resultant combined tracks. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #ifndef MUIDINTERFACES_IMUIDMATCHMAKER_H diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidMuonRecovery.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidMuonRecovery.h index c980ebe33e36b243fb360a10bd22fdc09f196b59..f7cae727ffbe0b690096e1bc5add822a8dfa5079 100644 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidMuonRecovery.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidMuonRecovery.h @@ -7,7 +7,6 @@ // tool interface to recover spectrometer tracks (meaning MS hit reallocation) // for likely spectrometer-indet matches which give combined fit problems. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #ifndef MUIDINTERFACES_IMUIDMUONRECOVERY_H diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidTrackIsolation.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidTrackIsolation.h index fc535ee2197fc9c26d3619f8c352e1e1b004f977..e699a2efc1820623270bc0e2ff15f9c4c2f0c140 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidTrackIsolation.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidTrackIsolation.h @@ -7,7 +7,6 @@ // tool interface for estimating the number, total charged momentum and most // energetic inner detector tracks in a cone surrounding a muon // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #ifndef MUIDINTERFACES_IMUIDTRACKISOLATION_H diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidVertexCombiner.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidVertexCombiner.h index ecf1df35fd90b44a7b8df27843fba2145d119a76..84aebff7315659eb9fcc0bf1ad52bd0b9c72c426 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidVertexCombiner.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuidVertexCombiner.h @@ -7,7 +7,6 @@ // tool interface to match tracks from an input muon spectrometer // TrackParticleContainer to vertices in the InnerDetector. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #ifndef MUIDINTERFACES_IMUIDVERTEXCOMBINER_H diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuonAlignmentUncertTool.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuonAlignmentUncertTool.h index 32831774ec1eef6963b65fc771d464855437b0af..0ca77c6748609ef5827981ca15e925ca377a4bb1 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuonAlignmentUncertTool.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuonAlignmentUncertTool.h @@ -6,7 +6,6 @@ // IMuonAlignmentUncertTool // Interface tool to assess the muon alignment and scattering // uncertainties using calibration files -// (c) ATLAS Combined Muon software /////////////////////////////////////////////////////////////////// #ifndef MUIDINTERFACES_IMUONALIGNMENTUNCERTTOOL_H diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuonIdentificationHelper.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuonIdentificationHelper.h index 4f7afa434aab4b9bf548b745ae8f53d242891bd6..b6ddeda38f8c52869f6085c3aa5542496ae1fb2e 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuonIdentificationHelper.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuonIdentificationHelper.h @@ -4,7 +4,6 @@ /////////////////////////////////////////////////////////////////// // -// IMuonIdentificationHelper.h, (c) ATLAS Combined Muon software // // tools used during combined Track, Particle and Muon creation // diff --git a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuonMatchQuality.h b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuonMatchQuality.h index 2a21c5e8a33c228bb5f177e5c53e4403f179b284..c7525694fb0540ed3dd82e296fac8e399f58ae6e 100755 --- a/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuonMatchQuality.h +++ b/Reconstruction/MuonIdentification/MuidInterfaces/MuidInterfaces/IMuonMatchQuality.h @@ -3,7 +3,6 @@ */ ////////////////////////////////////////////////////////////////// -// IMuonMatchQuality.h, (c) ATLAS Combined Muon software // get quality of combined track match ////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h index e783b3f0b53dc2f3af7aca6898661909786bb68a..81dd5e2324b7142acfe23925d7de50a79669f7e8 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h @@ -9,7 +9,6 @@ // Coulomb scattering. // The resulting track is fitted at the IP // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #ifndef MUIDTRACKBUILDER_COMBINEDMUONTRACKBUILDER_H @@ -107,7 +106,7 @@ class CombinedMuonTrackBuilder : public AthAlgTool, virtual public ICombinedMuon const Trk::RunOutlierRemoval runOutlier = false, const Trk::ParticleHypothesis particleHypothesis = Trk::muon) const; - void cleanUp() const; + void cleanUp() const override; private: bool optimizeErrors(Trk::Track* track) const; @@ -167,7 +166,7 @@ class CombinedMuonTrackBuilder : public AthAlgTool, virtual public ICombinedMuon void dumpCaloEloss(const Trk::Track* track, std::string txt) const; int countAEOTs(const Trk::Track* track, std::string txt) const; - bool checkTrack(std::string txt, Trk::Track* newTrack, Trk::Track* track) const; + bool checkTrack(const std::string& txt, const Trk::Track* newTrack, const Trk::Track* track) const; // helpers, managers, tools ToolHandle<Rec::IMuidCaloEnergy> m_caloEnergyParam{ diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h index cd5da7d5a6cc905e0fbadafd8fbd9727a40db643..69ae66762c67fddc41d2fd2039e8b6a30ff3d86a 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h @@ -9,7 +9,6 @@ // Extrapolates indet track to MS. // Returns a combined track with full track fit. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #ifndef MUIDCOMBINEDTOOLS_MUIDMUONRECOVERY_H diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuonMatchQuality.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuonMatchQuality.h index 443c32640b6cf5c66dbc89066d9b12851a9e9731..bbc3e3d9c84be08160d04e80dd9a9e218e9434d1 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuonMatchQuality.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuonMatchQuality.h @@ -3,7 +3,6 @@ */ /////////////////////////////////////////////////////////////////// -// MuonMatchQuality.h, (c) ATLAS Combined Muon software // get quality of combined track match /////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h index c43a6255f016bd457cc97f950ed3fed2a0d491b0..6dca3a9b27c2cc5771656e9cbfff84b0a66da91f 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h @@ -9,7 +9,6 @@ // Coulomb scattering. // The resulting track is fitted at the IP using the ITrackFitter interface. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #ifndef MUIDTRACKBUILDER_OUTWARDSCOMBINEDMUONTRACKBUILDER_H @@ -105,6 +104,8 @@ class OutwardsCombinedMuonTrackBuilder : public AthAlgTool, virtual public IComb const Trk::RunOutlierRemoval runOutlier = false, const Trk::ParticleHypothesis particleHypothesis = Trk::muon) const; + void cleanUp() const override; + private: Trk::Track* addIDMSerrors(Trk::Track* track) const; diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx index 82b44be853bd15818e739f1d7ee966964158eaec..5cc56c38d3b500b297044cbabe7a271b6824bef7 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx @@ -9,7 +9,6 @@ // Coulomb scattering. // The resulting track is fitted at the IP // -// (c) ATLAS Combined Muon softwarem_trackingGeometrySvcm_trackingGeometrySvc ////////////////////////////////////////////////////////////////////////////// #include "MuidTrackBuilder/CombinedMuonTrackBuilder.h" @@ -1560,6 +1559,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack // fail as calo incorrectly described m_messageHelper->printWarning(12); delete track; + delete extrapolated; spectrometerTSOS->clear(); delete spectrometerTSOS; @@ -1576,7 +1576,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack if (m_refineELossStandAloneTrackFit) { ATH_MSG_VERBOSE("Refining Calorimeter TSOS in StandAlone Fit ..."); - std::unique_ptr<Trk::Track> oldTrack = std::make_unique<Trk::Track>(Trk::Track(*track)); + std::unique_ptr<Trk::Track> oldTrack = std::make_unique<Trk::Track>(Trk::Track(*track)); //Deep copy of track here??? m_materialUpdator->updateCaloTSOS(*track); @@ -1592,6 +1592,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack track = refinedTrack; } else { ATH_MSG_VERBOSE("refined track fit failed"); + delete track; track = oldTrack.release(); improvementsFailed++; } @@ -1645,6 +1646,7 @@ CombinedMuonTrackBuilder::standaloneFit(const Trk::Track& inputSpectrometerTrack ++m_countDegradedStandaloneFit; if (improvementsFailed == 2) { ATH_MSG_WARNING("reject track, quality degraded and improvements failed"); + delete track; return nullptr; } } @@ -4736,7 +4738,7 @@ CombinedMuonTrackBuilder::dumpCaloEloss(const Trk::Track* track, std::string txt bool -CombinedMuonTrackBuilder::checkTrack(std::string txt, Trk::Track* newTrack, Trk::Track* track) const +CombinedMuonTrackBuilder::checkTrack(const std::string& txt, const Trk::Track* newTrack, const Trk::Track* track) const { if (!newTrack) return false; diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx index 8a9c0c8aa7c7e6886ebc7316cb7feddc0ed745f2..7ceff5e122ff9fdbb55e8219c1ba6f98fd65a2a7 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx @@ -9,7 +9,6 @@ // Extrapolates indet track to MS. // Returns a combined track with full track fit. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #include "MuidTrackBuilder/MuidMuonRecovery.h" diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx index d6f7ce12fa211474fa56171fae5d50c2fa95bbc2..a5084496506e805af968d95f7c5c1128f676195c 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuonMatchQuality.cxx @@ -3,7 +3,6 @@ */ /////////////////////////////////////////////////////////////////// -// MuonMatchQuality.h, (c) ATLAS Combined Muon software // get quality of combined track match /////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx index 367e1881c62204441d6d878f99d0d7d2bb571b7c..4d464050a2e472bb3cb990c89cb59e4c994dd3cc 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/OutwardsCombinedMuonTrackBuilder.cxx @@ -9,7 +9,6 @@ // Coulomb scattering. // The resulting track is fitted at the IP using the ITrackFitter interface. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #include "MuidTrackBuilder/OutwardsCombinedMuonTrackBuilder.h" @@ -742,5 +741,8 @@ OutwardsCombinedMuonTrackBuilder::vertexOnTrack(const Trk::TrackParameters* para return new Trk::PseudoMeasurementOnTrack(localParameters, covarianceMatrix, surface); } + void OutwardsCombinedMuonTrackBuilder::cleanUp() const { + if (!m_muonHoleRecovery.empty()) m_muonHoleRecovery->cleanUp(); + } } // namespace Rec diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedAlg.cxx b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedAlg.cxx index 2815d4a3cbf421569e4942fb63be005211488031..971dc6536cde0d60d934ffa9205e4abb64dff852 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedAlg.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedAlg.cxx @@ -63,6 +63,8 @@ StatusCode MuonCombinedAlg::execute() //note that STACO does not create new Trk::Tracks so it doesn't need collections here m_muonCombinedTool->combine(*muonCandidateCollection,*inDetCandidateCollection,maps,muidCombTracks.ptr(),muidMETracks.ptr()); + m_muonCombinedTool->cleanUp(); + return StatusCode::SUCCESS; } diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx index 43f0ebe5ad331a8b7676cf5ea47357bd41dac6b0..1a57abd5fe549da3ead938f9f3148275f687c339 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedMuonCandidateAlg.cxx @@ -37,5 +37,7 @@ MuonCombinedMuonCandidateAlg::execute() SG::WriteHandle<TrackCollection> msOnlyTracks(m_msOnlyTracks); ATH_CHECK(msOnlyTracks.record(std::make_unique<TrackCollection>())); m_muonCandidateTool->create(*muonTrackParticles, *muonCandidates, *msOnlyTracks); + + m_muonCandidateTool->cleanUp(); return StatusCode::SUCCESS; } diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonAlignmentUncertTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonAlignmentUncertTool.h index fea5b199ed086727d43d6465c2ba13979894f7cb..e672fbbf3afafbc4d050d38c188ac1bcc695ace2 100755 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonAlignmentUncertTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonAlignmentUncertTool.h @@ -6,7 +6,6 @@ // MuonAlignmentUncertTool // Helper classes to read the scattering and alignment uncertainties // of the muons from the histograms -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #ifndef MUONCOMBINEDBASETOOLS_MUONALIGNMENTUNCERTTOOL_H diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx index ff7f207c0f721cf8a7fda4d87cc23afc5611887c..3457916e4e2a5edcdc261a86f76e669d0de82301 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCaloTagTool.cxx @@ -10,7 +10,6 @@ // Authors: Nicolo de Groot & Antonio Salvucci // based on: CaloTrkMuId // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx index 7092da07242c19b90c7c12c31d9f322e9840270f..bf9182bb16228401af9c8a7dafa43c1aef3cb42b 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.cxx @@ -7,7 +7,6 @@ // AlgTool performing pre-selection on MS tracks, extrapolation and creation // of MuonCandidate collection. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #include "TrkTrackSummary/MuonTrackSummary.h" @@ -119,6 +118,7 @@ namespace MuonCombined { } } if(!skipTrack){ + delete standaloneTrack; standaloneTrack=new Trk::Track(msTrack); trackLinks[ standaloneTrack ] = std::make_pair(trackLink,nullptr); } @@ -168,4 +168,10 @@ namespace MuonCombined { // delete all remaining tracks in the set for( auto it = tracksToBeDeleted.begin();it!=tracksToBeDeleted.end();++it ) delete *it; } + + + void MuonCandidateTool::cleanUp() const { + m_trackBuilder->cleanUp(); + } + } // end of namespace diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.h index 42e0826aaee259afa40f79ed93539263558cc9e2..f473c5a2e24eeeb36b7b44a84567f074ac700866 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCandidateTool.h @@ -33,6 +33,8 @@ namespace MuonCombined { /**IMuonCandidateTool interface: build a MuonCandidateCollection from a TrackCollection of spectrometer tracks */ virtual void create( const xAOD::TrackParticleContainer& tracks, MuonCandidateCollection& outputCollection, TrackCollection& outputTracks ) override; + virtual + void cleanUp() const override; private: ToolHandle<Muon::MuonEDMPrinterTool> m_printer {this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"}; diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedDebuggerTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedDebuggerTool.cxx index df604908399f9589cabde0d184e0032da3e86a0d..c09ae0acb64445878c4baf5f704b56e33c3d9db7 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedDebuggerTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedDebuggerTool.cxx @@ -6,7 +6,6 @@ // MuonCombinedDebuggerTool // AlgTool to dump ROOT TTree with debugging information to tune muon combined // fit preselection -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #include "MuonCombinedDebuggerTool.h" diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx index c9b468236d84bcce0a2c680536366f5f9d97f7c2..afa67ee9334a287b76b5e271dba257d17abdc30a 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.cxx @@ -7,7 +7,6 @@ // AlgTool performing combined fit of ID and MS tracks (Muid) // A CombinedFitTag is added to the InDetCandidate object. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #include "MuonCombinedFitTagTool.h" @@ -790,6 +789,10 @@ namespace MuonCombined { return false; } } + + void MuonCombinedFitTagTool::cleanUp() const { + m_trackBuilder->cleanUp(); + } } // end of namespace diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.h index 17cb7d85fd74bf5454564d01171e30b96316fdb6..06f8e31120a000e422753c9fc9927afa3481d677 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedFitTagTool.h @@ -47,6 +47,8 @@ namespace MuonCombined { void combine( const MuonCandidate& muonCandidate, const std::vector<const InDetCandidate*>& indetCandidates, InDetCandidateToTagMap& tagMap, TrackCollection* combTracks, TrackCollection* METracks) const override; + void cleanUp() const override; + private: Trk::Track* buildCombinedTrack(const Trk::Track& indetTrack, diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx index 33496cb470accda040a79030b356d42385c340c2..e27dd10d5089e24587904638389bf6790235c82a 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx @@ -7,7 +7,6 @@ // AlgTool performing statistical combination of ID and MS tracks (STACO) // A StacoTag is added to the InDetCandidate object. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #include "MuonCombinedStacoTagTool.h" @@ -171,4 +170,10 @@ namespace MuonCombined { covCB ) ); } + + void MuonCombinedStacoTagTool::cleanUp() const { + //Nothing to clean up here .. hopefully + return; + } + } // end of namespace diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.h index 4ad43e4796ec1fa73e4ae6114fc4df36b9b2b35f..b8737f738a3cb6da98946cb456010276ff8ff745 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.h @@ -39,6 +39,8 @@ namespace MuonCombined { void combine( const MuonCandidate& muonCandidate, const std::vector<const InDetCandidate*>& indetCandidates, InDetCandidateToTagMap& tagMap, TrackCollection* combTracks, TrackCollection* METracks) const override; + void cleanUp() const override; + private: std::unique_ptr<const Trk::Perigee> theCombIdMu( const Trk::Perigee& indetPerigee, const Trk::Perigee& extrPerigee, double& chi2 ) const; diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedTool.cxx index 64ea1e1a46df4fae3f880539a9637da5043d02b1..357f5d3b4334badb888c3f74b2f653a0410687f4 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedTool.cxx @@ -9,7 +9,6 @@ // Extrapolates indet track to MS. // Returns a combined track with full track fit. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #include "MuonCombinedTool.h" @@ -111,4 +110,10 @@ namespace MuonCombined { } } + void MuonCombinedTool::cleanUp() const { + for(auto& tool : m_muonCombinedTagTools){ + tool->cleanUp(); + } + } + } // end of namespace diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedTool.h index b9a189a20e7c0abe2574c520690ecb33469836e1..848754504049281078c163bfe77bd90ab8f28a82 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedTool.h @@ -30,6 +30,8 @@ namespace MuonCombined { void combine(const MuonCandidateCollection& muonCandidates,const InDetCandidateCollection& inDetCandidates, std::vector<InDetCandidateToTagMap*> tagMaps, TrackCollection* combinedTracks, TrackCollection* METracks) const; + void cleanUp() const override; + private: void associate( const MuonCandidate& muonCandidate, const InDetCandidateCollection& inDetCandidates, diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx index bb34569c351f35e78a49fbaa5bc11ba2f762ab9d..fff7d67d497b1fc9875e350b175ca5e06dbbbe6e 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx @@ -6,7 +6,6 @@ // MuonCreatorTool // Creates xAOD::Muon objects from muon candidates // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #include "MuonCreatorTool.h" diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx index 23f42e6603d65a511d890c519bb58e7f8e4f583e..62569f422d669c0fffa74a2427551b4085e62e77 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonSegmentTagTool.cxx @@ -7,7 +7,6 @@ // AlgTool performing MS segment tagging of ID tracks. // A SegmentTag is added to the InDetCandidate object. // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #include "MuonSegmentTagTool.h" diff --git a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCandidateTool.h b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCandidateTool.h index 538dbf66fb82166867e1b3516b1f6aabf1e72095..49bdfa8ccad841ccec8501539eae2e522bd96607 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCandidateTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCandidateTool.h @@ -31,6 +31,8 @@ namespace MuonCombined { /**IMuonCandidateTool interface: build a MuonCandidateCollection from a TrackCollection of spectrometer tracks */ virtual void create( const xAOD::TrackParticleContainer& tracks, MuonCandidateCollection& outputCollection, TrackCollection& outputTracks ) = 0; + virtual void cleanUp() const = 0; + }; inline const InterfaceID& IMuonCandidateTool::interfaceID() { diff --git a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedTagTool.h b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedTagTool.h index bdb76be9f9b607de8327eca2f60004422c2e6cf3..9e4cf30fb777fc142dc180edb3a4897baa911bae 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedTagTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedTagTool.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 */ /////////////////////////////////////////////////////////////////// @@ -35,6 +35,8 @@ namespace MuonCombined { virtual void combine( const MuonCandidate& muonCandidate, const std::vector<const InDetCandidate*>& indetCandidates, InDetCandidateToTagMap& tagMap, TrackCollection* combTracks, TrackCollection* METracks) const = 0; + + virtual void cleanUp() const = 0; }; inline const InterfaceID& IMuonCombinedTagTool::interfaceID() diff --git a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedTool.h b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedTool.h index 23b1fcd5313acd58e87c125205f058de65e3a3a9..0672d5d477864bf7759240a174a034fe2fb3ad55 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonCombinedTool.h @@ -34,6 +34,8 @@ namespace MuonCombined { virtual void combine( const MuonCandidateCollection& muonCandidates, const InDetCandidateCollection& inDetCandidates, std::vector<InDetCandidateToTagMap*> tagMaps, TrackCollection* combTracks, TrackCollection* METracks) const = 0; + virtual void cleanUp() const = 0; + }; inline const InterfaceID& IMuonCombinedTool::interfaceID() diff --git a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonLayerAmbiguitySolverTool.h b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonLayerAmbiguitySolverTool.h index 4aebffdc80700bec8478f16e6415e3242ce1ed5f..5fa8de457cf9c562ab02db1d2fde74263be0bbb0 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonLayerAmbiguitySolverTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedToolInterfaces/MuonCombinedToolInterfaces/IMuonLayerAmbiguitySolverTool.h @@ -27,6 +27,7 @@ namespace Muon { /** @brief resolve ambiguities and return a set of unique combinations */ virtual void resolveOverlaps( const std::vector<Muon::MuonLayerRecoData>& allLayers, std::vector< MuonCandidate >& resolvedCandidates ) const = 0; + virtual void cleanUp() const = 0; }; inline const InterfaceID& IMuonLayerAmbiguitySolverTool::interfaceID() diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.cxx index 3a8fd859d75239e816da85524bd5c39cf1492087..2f5fb625c2216dca23caa32550f55a948a7ae1a2 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.cxx @@ -126,6 +126,7 @@ namespace Muon { void MuonCandidateTrackBuilderTool::cleanUp() const { m_trackFitter->cleanUp(); + m_muonTrackBuilder->cleanUp(); } } diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h index a64b705591d02a7d1c75077c6186df95062750d1..b3e73e2bdf05714c4a489aa7f113c8067407e197 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h @@ -68,10 +68,10 @@ namespace Muon { /** Default AlgTool functions */ MuonCandidateTrackBuilderTool(const std::string& type, const std::string& name, const IInterface* parent); virtual ~MuonCandidateTrackBuilderTool()=default; - StatusCode initialize(); + virtual StatusCode initialize() override; /**IMuonCandidateTrackBuilderTool interface: buildCombinedTrack */ - Trk::Track* buildCombinedTrack( const Trk::Track& idTrack, const MuonCandidate& candidate ) const; + virtual Trk::Track* buildCombinedTrack( const Trk::Track& idTrack, const MuonCandidate& candidate ) const override; virtual void cleanUp() const override; diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx index dc13cf9f1dc544dcaebb748e8231d7e620907bed..4de4cd9499febf0663d7fb8977c2cdc723b6f8a3 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx @@ -344,6 +344,7 @@ namespace MuonCombined { void MuonInsideOutRecoTool::cleanUp() const { m_candidateTrackBuilder->cleanUp(); + m_ambiguityResolver->cleanUp(); } } diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.cxx index 8f41ddcdd6d3e9451978de0735f7cd08f2df234d..03e90da854772519a84e7254728bbf82157bcd68 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.cxx @@ -325,5 +325,10 @@ namespace Muon { std::swap(existingLayerIntersections,combinedIntersections); } + + void MuonLayerAmbiguitySolverTool::cleanUp() const { + m_muonTrackBuilder->cleanUp(); + //m_segmentMatchingTool->cleanUp(); + } } diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.h index 2116b9c156ce4b89fa3ef6701cc7c369d43a6bc6..d746543df4807fd9d593eec4aea474705e6517be 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.h @@ -34,6 +34,9 @@ namespace Muon { /**IMuonLayerAmbiguitySolverTool interface: find */ void resolveOverlaps( const std::vector<Muon::MuonLayerRecoData>& allLayers, std::vector< MuonCandidate >& resolvedCandidates ) const; + + void cleanUp() const override; + private: void buildLayerVec( const std::vector<MuonLayerRecoData>& allLayers, std::vector< std::vector<MuonLayerIntersection> >& muonLayerDataHashVec ) const; diff --git a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py index 2026f45a5146fa50462444a2b541e0612d64223d..6529e23a8e2e760288c56f4d5cfcd484d49eee0c 100644 --- a/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py +++ b/Reconstruction/RecExample/RecExCommon/share/RecExCommon_topOptions.py @@ -570,22 +570,26 @@ if rec.doTrigger: treatException("Could not import TriggerJobOpts.TriggerGetter . Switched off !" ) recAlgs.doTrigger=False -# Run-3 Trigger Outputs -from AthenaConfiguration.AllConfigFlags import ConfigFlags -if ConfigFlags.Trigger.EDMVersion == 3 and rec.readESD() and rec.doAOD(): - # Don't run any trigger - only pass the HLT contents from ESD to AOD - # Add HLT output - from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter - hltOutput = HLTTriggerResultGetter() - # Add Trigger menu metadata - if rec.doFileMetaData(): - from RecExConfig.ObjKeyStore import objKeyStore - metadataItems = [ "xAOD::TriggerMenuContainer#TriggerMenu", - "xAOD::TriggerMenuAuxContainer#TriggerMenuAux." ] - objKeyStore.addManyTypesMetaData( metadataItems ) - # Add L1 output (to be consistent with R2) - from TrigEDMConfig.TriggerEDM import getLvl1AODList - objKeyStore.addManyTypesStreamAOD(getLvl1AODList()) +# Run-3 Trigger Outputs: Don't run any trigger - only pass the HLT contents from ESD to AOD +if rec.readESD() and rec.doAOD(): + from AthenaConfiguration.AllConfigFlags import ConfigFlags + # The simplest protection in case ConfigFlags.Input.Files is not set, doesn't cover all cases: + if ConfigFlags.Input.Files == ['_ATHENA_GENERIC_INPUTFILE_NAME_'] and athenaCommonFlags.FilesInput(): + ConfigFlags.Input.Files = athenaCommonFlags.FilesInput() + + if ConfigFlags.Trigger.EDMVersion == 3: + # Add HLT output + from TriggerJobOpts.HLTTriggerResultGetter import HLTTriggerResultGetter + hltOutput = HLTTriggerResultGetter() + # Add Trigger menu metadata + if rec.doFileMetaData(): + from RecExConfig.ObjKeyStore import objKeyStore + metadataItems = [ "xAOD::TriggerMenuContainer#TriggerMenu", + "xAOD::TriggerMenuAuxContainer#TriggerMenuAux." ] + objKeyStore.addManyTypesMetaData( metadataItems ) + # Add L1 output (to be consistent with R2) + from TrigEDMConfig.TriggerEDM import getLvl1AODList + objKeyStore.addManyTypesStreamAOD(getLvl1AODList()) AODFix_postTrigger() @@ -1304,8 +1308,7 @@ if ( rec.doAOD() or rec.doWriteAOD()) and not rec.readAOD() : StreamName = 'StreamAOD', Cells = 'AllCalo', CellLinks = 'CaloCalTopoClusters_links', - Taus = "TauJets", - UseSubtractedCluster = tauFlags.useSubtractedCluster()) + Taus = "TauJets") topSequence += tauCellAlg3 except Exception: diff --git a/Reconstruction/egamma/egammaValidation/CMakeLists.txt b/Reconstruction/egamma/egammaValidation/CMakeLists.txt index 534847aa7ed5e7671320b73c7b8cba46fb316b5f..fa9cd2a8f7b1c703db21a5d7b59a054a4d617706 100644 --- a/Reconstruction/egamma/egammaValidation/CMakeLists.txt +++ b/Reconstruction/egamma/egammaValidation/CMakeLists.txt @@ -7,9 +7,9 @@ atlas_subdir( egammaValidation ) atlas_add_component ( egammmaValidation src/*.cxx src/components/*.cxx - LINK_LIBRARIES AsgTools AthenaBaseComps EgammaAnalysisInterfacesLib GaudiKernel IsolationSelectionLib - MCTruthClassifierLib PATCoreAcceptLib xAODBase xAODEgamma xAODEventInfo - xAODTracking xAODTruth ) + LINK_LIBRARIES AsgTools AthenaBaseComps EgammaAnalysisInterfacesLib GaudiKernel IsolationSelectionLib + MCTruthClassifierLib PATCoreAcceptLib xAODBase xAODEgamma xAODEventInfo + xAODTracking xAODTruth ) atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) # Install JO files from the package: @@ -17,3 +17,7 @@ atlas_install_joboptions( share/*.py ) # ART shell executable scripts : atlas_install_scripts( test/*.sh scripts/*py ) +atlas_add_test( ut_egammaARTJob_test + SCRIPT test/ut_egammaARTJob_test.sh + PROPERTIES TIMEOUT 900 +) diff --git a/Reconstruction/egamma/egammaValidation/test/ut_egammaARTJob_test.sh b/Reconstruction/egamma/egammaValidation/test/ut_egammaARTJob_test.sh new file mode 100755 index 0000000000000000000000000000000000000000..c80d993585db714bf897adb249e7da6b3d222a08 --- /dev/null +++ b/Reconstruction/egamma/egammaValidation/test/ut_egammaARTJob_test.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +if Reco_tf.py --inputRDOFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q221/22.0/v1/myRDO.pool.root --outputAODFile=Nightly_AOD_electron.pool.root --maxEvents=1 --autoConfiguration="everything" --preExec="from egammaValidation.egammaOnlyPreExec import setRunEgammaOnlyRecoFlags; setRunEgammaOnlyRecoFlags()" --postInclude "ESDtoAOD:egammaValidation/egammaArtCaloCalPostInclude.py" "POOLMergeAthenaMPAOD0:egammaValidation/egammaArtCaloCalPostInclude.py" >>/dev/null 2>&1 ; then + echo "Reco tf success" +else + echo "Reco tf failure" +fi + +if AODMerge_tf.py --inputAODFile=Nightly_AOD_electron.pool.root --outputAOD_MRGFile=Nightly_AOD_electron.pool.root --preExec "from egammaValidation.egammaOnlyPreExec import setRunEgammaOnlyMergeFlags; setRunEgammaOnlyMergeFlags()" --postInclude "all:egammaValidation/egammaArtCaloCalPostInclude.py">>/dev/null 2>&1 ; then + echo "Merge success" +else + echo "Merge failure" +fi + diff --git a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py index 04a349083b7dd0d0b69423bdfab92692d73a3be6..53b70a48cd3aac514f9c0281630a6344ce4f7c14 100644 --- a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py +++ b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py @@ -115,11 +115,9 @@ def getCellVariables(cellConeSize=0.2, prefix=''): from tauRecTools.tauRecToolsConf import TauCellVariables TauCellVariables = TauCellVariables(name = _name, - CellEthreshold = 0.2*GeV, StripEthreshold = 0.2*GeV, CellCone = cellConeSize, - VertexCorrection = True, - UseSubtractedCluster = tauFlags.useSubtractedCluster() ) + VertexCorrection = True) cached_instances[_name] = TauCellVariables return TauCellVariables @@ -318,8 +316,7 @@ def getElectronVetoVars(): TauElectronVetoVariables = TauElectronVetoVariables(name = _name, VertexCorrection = True, ParticleCaloExtensionTool = getParticleCaloExtensionTool(), - tauEVParticleCache = getParticleCache(), - UseSubtractedCluster = tauFlags.useSubtractedCluster() ) + tauEVParticleCache = getParticleCache()) cached_instances[_name] = TauElectronVetoVariables return TauElectronVetoVariables @@ -376,10 +373,7 @@ def getPi0ClusterCreator(): return cached_instances[_name] from tauRecTools.tauRecToolsConf import TauPi0ClusterCreator - TauPi0ClusterCreator = TauPi0ClusterCreator(name = _name, - TauVertexCorrection = getTauVertexCorrection(), - UseSubtractedCluster = tauFlags.useSubtractedCluster() - ) + TauPi0ClusterCreator = TauPi0ClusterCreator(name = _name) cached_instances[_name] = TauPi0ClusterCreator return TauPi0ClusterCreator @@ -693,8 +687,7 @@ def getMvaTESVariableDecorator(): from tauRecTools.tauRecToolsConf import MvaTESVariableDecorator MvaTESVariableDecorator = MvaTESVariableDecorator(name = _name, Key_vertexInputContainer=_DefaultVertexContainer, - TauVertexCorrection = getTauVertexCorrection(), - UseSubtractedCluster = tauFlags.useSubtractedCluster() ) + VertexCorrection = True) cached_instances[_name] = MvaTESVariableDecorator return MvaTESVariableDecorator @@ -902,13 +895,13 @@ def getTauJetRNNEvaluator(_n, NetworkFile0P="", NetworkFile1P="", NetworkFile3P= MaxTracks=MaxTracks, MaxClusters=MaxClusters, MaxClusterDR=MaxClusterDR, + VertexCorrection=True, InputLayerScalar=InputLayerScalar, InputLayerTracks=InputLayerTracks, InputLayerClusters=InputLayerClusters, OutputLayer=OutputLayer, - OutputNode=OutputNode, - TauVertexCorrection = getTauVertexCorrection(), - UseSubtractedCluster = tauFlags.useSubtractedCluster() ) + OutputNode=OutputNode) + cached_instances[_name] = myTauJetRNNEvaluator return myTauJetRNNEvaluator @@ -931,8 +924,7 @@ def getTauIDVarCalculator(): from tauRecTools.tauRecToolsConf import TauIDVarCalculator myTauIDVarCalculator = TauIDVarCalculator(name=_name, - UseSubtractedCluster = tauFlags.useSubtractedCluster(), - TauVertexCorrection = getTauVertexCorrection()) + VertexCorrection = True) cached_instances[_name] = myTauIDVarCalculator return myTauIDVarCalculator @@ -952,13 +944,12 @@ def getTauEleRNNEvaluator(_n, MaxTracks=MaxTracks, MaxClusters=MaxClusters, MaxClusterDR=MaxClusterDR, + VertexCorrection=True, InputLayerScalar=InputLayerScalar, InputLayerTracks=InputLayerTracks, InputLayerClusters=InputLayerClusters, OutputLayer=OutputLayer, - OutputNode=OutputNode, - TauVertexCorrection = getTauVertexCorrection(), - UseSubtractedCluster = tauFlags.useSubtractedCluster()) + OutputNode=OutputNode) cached_instances[_name] = tool return tool @@ -999,30 +990,6 @@ def getTauDecayModeNNClassifier(): cached_instances[_name] = TauDecayModeNNClassifier return TauDecayModeNNClassifier -def getTauVertexCorrection(): - from tauRec.tauRecFlags import tauFlags - from tauRecTools.tauRecToolsConf import TauVertexCorrection - from JetRec.JetRecFlags import jetFlags - - _name = sPrefix + 'TauVertexCorrection' - - if _name in cached_instances: - return cached_instances[_name] - - doJetVertexCorrection = False - if tauFlags.isStandalone: - doJetVertexCorrection = True - if jetFlags.useVertices() and jetFlags.useTracks(): - doJetVertexCorrection = True - - myTauVertexCorrection = TauVertexCorrection(name = _name, - SeedJet = tauFlags.tauRecSeedJetCollection(), - VertexCorrection = True, - JetVertexCorrection = doJetVertexCorrection) - - cached_instances[_name] = myTauVertexCorrection - return myTauVertexCorrection - def getTauVertexedClusterDecorator(): from tauRec.tauRecFlags import tauFlags from tauRecTools.tauRecToolsConf import TauVertexedClusterDecorator diff --git a/Reconstruction/tauRec/python/tauRecFlags.py b/Reconstruction/tauRec/python/tauRecFlags.py index 1fbaaee61353cb495e6211de70be28dd3ef9230f..72490b28b994d73115b487d48c9a180be97c6d08 100644 --- a/Reconstruction/tauRec/python/tauRecFlags.py +++ b/Reconstruction/tauRec/python/tauRecFlags.py @@ -221,13 +221,6 @@ class useOldVertexFitterAPI(JobProperty): allowedTypes=['bool'] StoredValue=False -class useSubtractedCluster(JobProperty): - """ switch on use of shower subtracted clusters - """ - statusOn=True - allowedTypes=['bool'] - StoredValue=False - # Defines a sub-container for the algorithm switches class tauRecFlags(JobPropertyContainer): """ tau information """ @@ -236,7 +229,7 @@ class tauRecFlags(JobPropertyContainer): jobproperties.add_Container(tauRecFlags) # I want always the following flags in the Rec container -_list_tau=[Enabled,doTauRec,isStandalone,tauRecSeedJetCollection,tauRecToolsCVMFSPath,doTJVA,useLargeD0Tracks,removeDuplicateCoreTracks,tauRecMVATrackClassification,tauRecRNNTrackClassification,tauRecMVATrackClassificationConfig,tauRecRNNTrackClassificationConfig,tauRecDecayModeNNClassifierConfig,tauRecSeedMinPt,tauRecSeedMaxEta,tauRecMaxNTracks,tauRecToolsDevToolList,tauRecToolsDevToolListProcessor,doRunTauDiscriminant,useVertexBasedConvFinder,useNewPIDBasedConvFinder,doPanTau,doPi0,pi0EtCuts,pi0MVACuts_1prong,pi0MVACuts_mprong,shotPtCut_1Photon,shotPtCut_2Photons,useOldVertexFitterAPI,useSubtractedCluster] +_list_tau=[Enabled,doTauRec,isStandalone,tauRecSeedJetCollection,tauRecToolsCVMFSPath,doTJVA,useLargeD0Tracks,removeDuplicateCoreTracks,tauRecMVATrackClassification,tauRecRNNTrackClassification,tauRecMVATrackClassificationConfig,tauRecRNNTrackClassificationConfig,tauRecDecayModeNNClassifierConfig,tauRecSeedMinPt,tauRecSeedMaxEta,tauRecMaxNTracks,tauRecToolsDevToolList,tauRecToolsDevToolListProcessor,doRunTauDiscriminant,useVertexBasedConvFinder,useNewPIDBasedConvFinder,doPanTau,doPi0,pi0EtCuts,pi0MVACuts_1prong,pi0MVACuts_mprong,shotPtCut_1Photon,shotPtCut_2Photons,useOldVertexFitterAPI] for j in _list_tau: jobproperties.tauRecFlags.add_JobProperty(j) del _list_tau diff --git a/Reconstruction/tauRec/src/TauCellThinningAlg.cxx b/Reconstruction/tauRec/src/TauCellThinningAlg.cxx index 83f32876faaf241025e80852706c22035fb90bf5..9f5013dfcd8b592d9239c4cc43b8783f7cdc1099 100644 --- a/Reconstruction/tauRec/src/TauCellThinningAlg.cxx +++ b/Reconstruction/tauRec/src/TauCellThinningAlg.cxx @@ -40,12 +40,22 @@ StatusCode TauCellThinningAlg::execute (const EventContext& ctx) const } for (const xAOD::TauJet* tau : *taus) { - std::vector<const xAOD::CaloCluster*> clusters; - ATH_CHECK( tauRecTools::GetJetClusterList(tau->jet(), clusters, m_useSubtractedCluster) ); + // Assume we always do the vertex correction + TLorentzVector tauAxis = tauRecTools::getTauAxis(*tau); + const xAOD::Vertex* tauVertex = tauRecTools::getTauVertex(*tau); - for (const xAOD::CaloCluster* cluster : clusters) { - // only keep cells for clusters within 0.2 - if (cluster->p4().DeltaR(tau->p4())>0.2) continue; + auto clusterList = tau->clusters(); + for (const xAOD::IParticle* particle : clusterList) { + const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>(particle); + TLorentzVector clusterP4 = cluster->p4(); + + // Correct the four momentum to point at the tau vertex + if (tauVertex) { + xAOD::CaloVertexedTopoCluster vertexedCluster(*cluster, tauVertex->position()); + clusterP4 = vertexedCluster.p4(); + } + + if (clusterP4.DeltaR(tauAxis) > 0.2) continue; const CaloClusterCellLink* cellLinks = cluster->getCellLinks(); if (!cellLinks) { diff --git a/Reconstruction/tauRec/src/TauCellThinningAlg.h b/Reconstruction/tauRec/src/TauCellThinningAlg.h index a202feee001d8b16f6a2e384728c81ed9cd34379..d946b9ba71a3b205a91b9c67219e5b2cc7922fac 100644 --- a/Reconstruction/tauRec/src/TauCellThinningAlg.h +++ b/Reconstruction/tauRec/src/TauCellThinningAlg.h @@ -53,11 +53,6 @@ class TauCellThinningAlg : public AthReentrantAlgorithm // Tau container SG::ReadHandleKey<xAOD::TauJetContainer> m_taus { this, "Taus", "TauJets", "Container of taus for which cells should be saved" }; - - // Use shower subtracted clusters, only relevant for PFlow seed jets - Gaudi::Property<bool> m_useSubtractedCluster - { this, "UseSubtractedCluster", false, "Use shower subtracted clusters" }; - }; #endif // not TAUREC_TAUCELLTHINNING_H diff --git a/Reconstruction/tauRecTools/CMakeLists.txt b/Reconstruction/tauRecTools/CMakeLists.txt index 589a385fb53452093998cc32ae7ad6842e8ad733..ae8f23cedb7fae0703fdc373f37d088e40d313e0 100644 --- a/Reconstruction/tauRecTools/CMakeLists.txt +++ b/Reconstruction/tauRecTools/CMakeLists.txt @@ -26,7 +26,6 @@ atlas_add_root_dictionary( tauRecToolsLib tauRecToolsLibCintDict tauRecTools/TauJetRNNEvaluator.h tauRecTools/TauIDVarCalculator.h tauRecTools/TauDecayModeNNClassifier.h - tauRecTools/TauVertexCorrection.h tauRecTools/TauVertexedClusterDecorator.h Root/LinkDef.h EXTERNAL_PACKAGES ROOT diff --git a/Reconstruction/tauRecTools/Root/HelperFunctions.cxx b/Reconstruction/tauRecTools/Root/HelperFunctions.cxx index 980c6aad09f6cf74ca4cdf15da65288465e04201..1e9088f13b26e5794d8d2ef4cec83b71f6cd6612 100644 --- a/Reconstruction/tauRecTools/Root/HelperFunctions.cxx +++ b/Reconstruction/tauRecTools/Root/HelperFunctions.cxx @@ -216,73 +216,3 @@ TLorentzVector tauRecTools::GetConstituentP4(const xAOD::JetConstituent& constit return constituentP4; } - - - -const StatusCode tauRecTools::GetJetClusterList(const xAOD::Jet* jet, std::vector<const xAOD::CaloCluster*> &clusterList, bool useSubtractedCluster) { - using namespace tauRecTools::msgHelperFunction; - - // If using subtracted clusters, need to store unmodified to check if charged are duplicates - std::vector<const xAOD::CaloCluster*> dupList; - - // Loop over jet constituents - xAOD::JetConstituentVector constituents = jet->getConstituents(); - for(const xAOD::JetConstituent* constituent : constituents){ - ANA_MSG_DEBUG("JetConstituent: "); - ANA_MSG_DEBUG("eta: " << constituent->eta() << " phi: " << constituent->phi() << " e: " << constituent->e()); - - if( constituent->type() == xAOD::Type::CaloCluster ) { - const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>( constituent->rawConstituent() ); - ANA_MSG_DEBUG("CaloCluster: "); - ANA_MSG_DEBUG("eta: " << cluster->eta() << " phi: " << cluster->phi() << " e: " << cluster->e()); - clusterList.push_back(cluster); - } - else if ( constituent->type() == xAOD::Type::ParticleFlow ) { - const xAOD::PFO* pfo = static_cast<const xAOD::PFO*>( constituent->rawConstituent() ); - - if (pfo->isCharged()) continue; - if (pfo->nCaloCluster()!=1){ - ANA_MSG_WARNING("Neutral PFO has " << std::to_string(pfo->nCaloCluster()) << " clusters, expected exactly 1!\n"); - continue; - } - - if (useSubtractedCluster){ - ElementLink<xAOD::CaloClusterContainer> subClusLink; - pfo->attribute("PFOShowerSubtractedClusterLink", subClusLink); - if ( !subClusLink.isValid() ){ - ANA_MSG_ERROR("Tau HelperFunctions: Found invalid link to shower subtracted cluster"); - return StatusCode::FAILURE; - } - else { - clusterList.push_back( (*subClusLink) ); - } - } - else { - clusterList.push_back(pfo->cluster(0)); - } - } - else { - ANA_MSG_ERROR("GetJetConstCluster: Seed jet constituent type not supported!"); - return StatusCode::FAILURE; - } - } - - if (useSubtractedCluster) return StatusCode::SUCCESS; - - for (const xAOD::JetConstituent* constituent : constituents){ - if ( constituent->type() != xAOD::Type::ParticleFlow ) break; - - const xAOD::PFO* pfo = static_cast<const xAOD::PFO*>( constituent->rawConstituent() ); - if (! pfo->isCharged()) continue; - - for (u_int index=0; index<pfo->nCaloCluster(); index++){ - const xAOD::CaloCluster* cluster = pfo->cluster(index); - // check it is not duplicate of one in neutral list - if ( std::find(clusterList.begin(), clusterList.end(), cluster) == clusterList.end() ) { - clusterList.push_back(cluster); - } - } - } - - return StatusCode::SUCCESS; -} diff --git a/Reconstruction/tauRecTools/Root/LinkDef.h b/Reconstruction/tauRecTools/Root/LinkDef.h index 9078305d94444e124e319b7e8ee198fe06fed84f..2861a22edbf6465acb8115b656cbc1f3d7cd0870 100644 --- a/Reconstruction/tauRecTools/Root/LinkDef.h +++ b/Reconstruction/tauRecTools/Root/LinkDef.h @@ -17,7 +17,6 @@ #include "tauRecTools/TauIDVarCalculator.h" #include "tauRecTools/TauJetRNNEvaluator.h" #include "tauRecTools/TauDecayModeNNClassifier.h" -#include "tauRecTools/TauVertexCorrection.h" #ifdef __CINT__ @@ -43,7 +42,5 @@ #pragma link C++ class TauIDVarCalculator+; #pragma link C++ class TauJetRNNEvaluator+; #pragma link C++ class TauDecayModeNNClassifier+; -#pragma link C++ class ITauVertexCorrection+; -#pragma link C++ class TauVertexCorrection+; #endif diff --git a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx index 169ead2075a75e9036262e953e0d52ba177b707d..25c566020dfe15eebeedf070273ea24493d8e13d 100644 --- a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx +++ b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx @@ -11,27 +11,25 @@ #define GeV 1000 -//_____________________________________________________________________________ + + MvaTESVariableDecorator::MvaTESVariableDecorator(const std::string& name) : TauRecToolBase(name) { - declareProperty("UseSubtractedCluster", m_useSubtractedCluster = true, "use shower subtracted clusters in calo calculations"); + declareProperty("VertexCorrection", m_doVertexCorrection = true); } -//_____________________________________________________________________________ -MvaTESVariableDecorator::~MvaTESVariableDecorator() { -} StatusCode MvaTESVariableDecorator::initialize() { - ATH_CHECK(m_tauVertexCorrection.retrieve()); ATH_CHECK(m_aveIntPerXKey.initialize()); ATH_CHECK(m_vertexContainerKey.initialize(SG::AllowEmpty)); return StatusCode::SUCCESS; } -//_____________________________________________________________________________ + + StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) const { // Decorate event info @@ -79,55 +77,43 @@ StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) const { TLorentzVector clusters_had_P4; clusters_had_P4.SetPtEtaPhiM(0,0,0,0); - if (! xTau.jetLink().isValid()) { - ATH_MSG_ERROR("Tau jet link is invalid."); - return StatusCode::FAILURE; - } - const xAOD::Jet *jetSeed = xTau.jet(); - - const xAOD::Vertex* jetVertex = m_tauVertexCorrection->getJetVertex(*jetSeed); - - const xAOD::Vertex* tauVertex = nullptr; - if (xTau.vertexLink().isValid()) tauVertex = xTau.vertex(); - - TLorentzVector tauAxis = m_tauVertexCorrection->getTauAxis(xTau); - - // Loop through jets, get links to clusters - std::vector<const xAOD::CaloCluster*> clusterList; - ATH_CHECK(tauRecTools::GetJetClusterList(jetSeed, clusterList, m_useSubtractedCluster)); - + TLorentzVector tauAxis = tauRecTools::getTauAxis(xTau, m_doVertexCorrection); // Loop through clusters and jet constituents - for (const xAOD::CaloCluster* cluster : clusterList){ - TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex); - + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = xTau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList){ + TLorentzVector clusterP4 = vertexedCluster.p4(); if (clusterP4.DeltaR(tauAxis) > 0.2) continue; - clE = cluster->calE(); + // FIXME: should we use calE for EMTopo clusters ? + // what's the energy scale when calculating thee cluster momentum + const xAOD::CaloCluster& cluster = vertexedCluster.clust(); + clE = cluster.calE(); Etot += clE; - if(clE>lead_cluster_frac) lead_cluster_frac = clE; - if(cluster->retrieveMoment(xAOD::CaloCluster::MomentType::CENTER_LAMBDA,center_lambda)) + if(cluster.retrieveMoment(xAOD::CaloCluster::MomentType::CENTER_LAMBDA,center_lambda)) mean_center_lambda += clE*center_lambda; else ATH_MSG_WARNING("Failed to retrieve moment: CENTER_LAMBDA"); - if(cluster->retrieveMoment(xAOD::CaloCluster::MomentType::FIRST_ENG_DENS,first_eng_dens)) + if(cluster.retrieveMoment(xAOD::CaloCluster::MomentType::FIRST_ENG_DENS,first_eng_dens)) mean_first_eng_dens += clE*first_eng_dens; else ATH_MSG_WARNING("Failed to retrieve moment: FIRST_ENG_DENS"); - if(cluster->retrieveMoment(xAOD::CaloCluster::MomentType::EM_PROBABILITY,em_probability)) { + if(cluster.retrieveMoment(xAOD::CaloCluster::MomentType::EM_PROBABILITY,em_probability)) { mean_em_probability += clE*em_probability; - if(em_probability>0.5) clusters_EM_P4 += cluster->p4(xAOD::CaloCluster::State::CALIBRATED); - else clusters_had_P4 += cluster->p4(xAOD::CaloCluster::State::CALIBRATED); + // FIXME: should we use calE for EMTopo clusters ? + // what's the energy scale when calculating thee cluster momentum + if(em_probability>0.5) clusters_EM_P4 += cluster.p4(xAOD::CaloCluster::State::CALIBRATED); + else clusters_had_P4 += cluster.p4(xAOD::CaloCluster::State::CALIBRATED); } else ATH_MSG_WARNING("Failed to retrieve moment: EM_PROBABILITY"); - if(cluster->retrieveMoment(xAOD::CaloCluster::MomentType::SECOND_LAMBDA,second_lambda)) + if(cluster.retrieveMoment(xAOD::CaloCluster::MomentType::SECOND_LAMBDA,second_lambda)) mean_second_lambda += clE*second_lambda; else ATH_MSG_WARNING("Failed to retrieve moment: SECOND_LAMBDA"); - mean_presampler_frac += (cluster->eSample(CaloSampling::PreSamplerB) + cluster->eSample(CaloSampling::PreSamplerE)); + mean_presampler_frac += (cluster.eSample(CaloSampling::PreSamplerB) + cluster.eSample(CaloSampling::PreSamplerE)); } // ----calculate mean values @@ -167,6 +153,12 @@ StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) const { } // ----retrieve Ghost Muon Segment Count (for punch-through studies) + if (! xTau.jetLink().isValid()) { + ATH_MSG_ERROR("Tau jet link is invalid."); + return StatusCode::FAILURE; + } + const xAOD::Jet* jetSeed = xTau.jet(); + int nMuSeg=0; if(!jetSeed->getAttribute<int>("GhostMuonSegmentCount", nMuSeg)) nMuSeg=0; xTau.setDetail(xAOD::TauJetParameters::GhostMuonSegmentCount, nMuSeg); diff --git a/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx b/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx index b2606be19621dc043ebb987a7cfcb939ab2e9e1c..fc301e8e15d9eff44813989dcff3e9b775699743 100644 --- a/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx +++ b/Reconstruction/tauRecTools/Root/TauIDVarCalculator.cxx @@ -20,22 +20,14 @@ const float TauIDVarCalculator::LOW_NUMBER = -1111.; TauIDVarCalculator::TauIDVarCalculator(const std::string& name): - TauRecToolBase(name), - m_useSubtractedCluster(true) -{ - declareProperty("UseSubtractedCluster", m_useSubtractedCluster); + TauRecToolBase(name) { + declareProperty("VertexCorrection", m_doVertexCorrection = true); } -StatusCode TauIDVarCalculator::initialize() -{ - ATH_CHECK(m_tauVertexCorrection.retrieve()); - return StatusCode::SUCCESS; -} -StatusCode TauIDVarCalculator::execute(xAOD::TauJet& tau) const -{ - static const SG::AuxElement::Accessor<float> acc_absipSigLeadTrk("absipSigLeadTrk"); +StatusCode TauIDVarCalculator::execute(xAOD::TauJet& tau) const { + static const SG::AuxElement::Accessor<float> acc_absipSigLeadTrk("absipSigLeadTrk"); acc_absipSigLeadTrk(tau) = (tau.nTracks()>0) ? std::abs(tau.track(0)->d0SigTJVA()) : 0.; if(inTrigger()) return StatusCode::SUCCESS; @@ -79,37 +71,25 @@ StatusCode TauIDVarCalculator::execute(xAOD::TauJet& tau) const std::vector<CaloSampling::CaloSample> Had1Samps = { CaloSampling::HEC0, CaloSampling::TileBar0, CaloSampling::TileGap1, CaloSampling::TileExt0}; - if (! tau.jetLink().isValid()) { - ATH_MSG_ERROR("Tau jet link is invalid."); - return StatusCode::FAILURE; - } - const xAOD::Jet *jetSeed = tau.jet(); - - const xAOD::Vertex* jetVertex = m_tauVertexCorrection->getJetVertex(*jetSeed); - - const xAOD::Vertex* tauVertex = nullptr; - if (tau.vertexLink().isValid()) tauVertex = tau.vertex(); - - TLorentzVector tauAxis = m_tauVertexCorrection->getTauAxis(tau); - - std::vector<const xAOD::CaloCluster*> clusterList; - ATH_CHECK(tauRecTools::GetJetClusterList(jetSeed, clusterList, m_useSubtractedCluster)); - float eEMAtEMScaleFixed = 0.; float eHadAtEMScaleFixed = 0.; float eHad1AtEMScaleFixed = 0.; - for (const xAOD::CaloCluster* cluster : clusterList) { - TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex); - - if( tauAxis.DeltaR(clusterP4) > 0.2 ) continue; + TLorentzVector tauAxis = tauRecTools::getTauAxis(tau, m_doVertexCorrection); + + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = tau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList){ + TLorentzVector clusterP4 = vertexedCluster.p4(); + if( clusterP4.DeltaR(tauAxis) > 0.2 ) continue; + + const xAOD::CaloCluster& cluster = vertexedCluster.clust(); for( auto samp : EMSamps ) - eEMAtEMScaleFixed += cluster->eSample(samp); + eEMAtEMScaleFixed += cluster.eSample(samp); for( auto samp : HadSamps ) - eHadAtEMScaleFixed += cluster->eSample(samp); + eHadAtEMScaleFixed += cluster.eSample(samp); for( auto samp : Had1Samps ) - eHad1AtEMScaleFixed += cluster->eSample(samp); + eHad1AtEMScaleFixed += cluster.eSample(samp); } acc_EMFracFixed(tau) = ( eEMAtEMScaleFixed + eHadAtEMScaleFixed ) != 0. ? eEMAtEMScaleFixed / ( eEMAtEMScaleFixed + eHadAtEMScaleFixed ) : LOW_NUMBER; diff --git a/Reconstruction/tauRecTools/Root/TauJetRNN.cxx b/Reconstruction/tauRecTools/Root/TauJetRNN.cxx index 9a04d19cfa981f95201063c8677bfdcd1879676f..810a18eb45fd4c08b9293975bccd6dccf0172a80 100644 --- a/Reconstruction/tauRecTools/Root/TauJetRNN.cxx +++ b/Reconstruction/tauRecTools/Root/TauJetRNN.cxx @@ -90,7 +90,7 @@ TauJetRNN::~TauJetRNN() {} float TauJetRNN::compute(const xAOD::TauJet &tau, const std::vector<const xAOD::TauTrack *> &tracks, - const std::vector<const xAOD::CaloCluster *> &clusters) const { + const std::vector<xAOD::CaloVertexedTopoCluster> &clusters) const { InputMap scalarInputs; InputSequenceMap vectorInputs; if (!calculateInputVariables(tau, tracks, clusters, scalarInputs, vectorInputs)) { @@ -104,7 +104,7 @@ float TauJetRNN::compute(const xAOD::TauJet &tau, bool TauJetRNN::calculateInputVariables(const xAOD::TauJet &tau, const std::vector<const xAOD::TauTrack *> &tracks, - const std::vector<const xAOD::CaloCluster *> &clusters, + const std::vector<xAOD::CaloVertexedTopoCluster> &clusters, std::map<std::string, std::map<std::string, double>>& scalarInputs, std::map<std::string, std::map<std::string, std::vector<double>>>& vectorInputs) const { scalarInputs.clear(); @@ -137,4 +137,4 @@ bool TauJetRNN::calculateInputVariables(const xAOD::TauJet &tau, } } return true; -} \ No newline at end of file +} diff --git a/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx b/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx index 347086ea491597b146ba40547114855e9cbba0b3..d22d5c73969b2509c399156ea048dc9282ecfa19 100644 --- a/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx +++ b/Reconstruction/tauRecTools/Root/TauJetRNNEvaluator.cxx @@ -24,6 +24,7 @@ TauJetRNNEvaluator::TauJetRNNEvaluator(const std::string &name): declareProperty("MaxTracks", m_max_tracks = 10); declareProperty("MaxClusters", m_max_clusters = 6); declareProperty("MaxClusterDR", m_max_cluster_dr = 1.0f); + declareProperty("VertexCorrection", m_doVertexCorrection = true); // Naming conventions for the network weight files: declareProperty("InputLayerScalar", m_input_layer_scalar = "scalar"); @@ -31,8 +32,6 @@ TauJetRNNEvaluator::TauJetRNNEvaluator(const std::string &name): declareProperty("InputLayerClusters", m_input_layer_clusters = "clusters"); declareProperty("OutputLayer", m_output_layer = "rnnid_output"); declareProperty("OutputNode", m_output_node = "sig_prob"); - - declareProperty("UseSubtractedCluster", m_useSubtractedCluster = true, "use shower subtracted clusters in calo calculations"); } TauJetRNNEvaluator::~TauJetRNNEvaluator() {} @@ -40,8 +39,6 @@ TauJetRNNEvaluator::~TauJetRNNEvaluator() {} StatusCode TauJetRNNEvaluator::initialize() { ATH_MSG_INFO("Initializing TauJetRNNEvaluator"); - ATH_CHECK(m_tauVertexCorrection.retrieve()); - std::string weightfile_0p(""); std::string weightfile_1p(""); std::string weightfile_3p(""); @@ -127,7 +124,7 @@ StatusCode TauJetRNNEvaluator::execute(xAOD::TauJet &tau) const { // Get input objects std::vector<const xAOD::TauTrack *> tracks; ATH_CHECK(get_tracks(tau, tracks)); - std::vector<const xAOD::CaloCluster *> clusters; + std::vector<xAOD::CaloVertexedTopoCluster> clusters; ATH_CHECK(get_clusters(tau, clusters)); // Evaluate networks @@ -178,50 +175,29 @@ StatusCode TauJetRNNEvaluator::get_tracks( } StatusCode TauJetRNNEvaluator::get_clusters( - const xAOD::TauJet &tau, std::vector<const xAOD::CaloCluster *> &out) const { + const xAOD::TauJet &tau, std::vector<xAOD::CaloVertexedTopoCluster> &clusters) const { - if (! tau.jetLink().isValid()) { - ATH_MSG_ERROR("Tau jet link is invalid."); - return StatusCode::FAILURE; - } - const xAOD::Jet *jetSeed = tau.jet(); - - const xAOD::Vertex* jetVertex = m_tauVertexCorrection->getJetVertex(*jetSeed); - - const xAOD::Vertex* tauVertex = nullptr; - if (tau.vertexLink().isValid()) tauVertex = tau.vertex(); - - TLorentzVector tauAxis = m_tauVertexCorrection->getTauAxis(tau); + TLorentzVector tauAxis = tauRecTools::getTauAxis(tau, m_doVertexCorrection); - std::vector<const xAOD::CaloCluster*> clusters; - ATH_CHECK(tauRecTools::GetJetClusterList(jetSeed, clusters, m_useSubtractedCluster)); - - // remove clusters that do not meet dR requirement - auto cItr = clusters.begin(); - while( cItr != clusters.end() ){ - const xAOD::CaloCluster* cluster = (*cItr); - TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex); - - if (tauAxis.DeltaR(clusterP4) > m_max_cluster_dr) { - clusters.erase(cItr); - } - else { - ++cItr; - } + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = tau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList) { + TLorentzVector clusterP4 = vertexedCluster.p4(); + if (clusterP4.DeltaR(tauAxis) > m_max_cluster_dr) continue; + + clusters.push_back(vertexedCluster); } // Sort by descending et - auto et_cmp = [](const xAOD::CaloCluster *lhs, - const xAOD::CaloCluster *rhs) { - return lhs->et() > rhs->et(); + auto et_cmp = [](const xAOD::CaloVertexedTopoCluster& lhs, + const xAOD::CaloVertexedTopoCluster& rhs) { + return lhs.p4().Et() > rhs.p4().Et(); }; std::sort(clusters.begin(), clusters.end(), et_cmp); // Truncate clusters if (clusters.size() > m_max_clusters) { - clusters.resize(m_max_clusters); + clusters.resize(m_max_clusters, clusters[0]); } - out = std::move(clusters); return StatusCode::SUCCESS; } diff --git a/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx b/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx index 5418e2a5db42b42019b6e1447df5de3225d5b738..90a634b4f6cd056aa0c4f3c46785a0b6167153d6 100644 --- a/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx +++ b/Reconstruction/tauRecTools/Root/TauJetRNNUtils.cxx @@ -53,7 +53,7 @@ bool VarCalc::compute(const std::string &name, const xAOD::TauJet &tau, } bool VarCalc::compute(const std::string &name, const xAOD::TauJet &tau, - const std::vector<const xAOD::CaloCluster *> &clusters, + const std::vector<xAOD::CaloVertexedTopoCluster> &clusters, std::vector<double> &out) const { out.clear(); @@ -69,8 +69,8 @@ bool VarCalc::compute(const std::string &name, const xAOD::TauJet &tau, // Calculate variables for selected clusters bool success = true; double value; - for (const auto cls : clusters) { - success = success && func(tau, *cls, value); + for (const auto cluster : clusters) { + success = success && func(tau, cluster, value); out.push_back(value); } @@ -450,67 +450,67 @@ bool eProbabilityHT(const xAOD::TauJet& /*tau*/, const xAOD::TauTrack &track, namespace Cluster { using MomentType = xAOD::CaloCluster::MomentType; -bool et_log(const xAOD::TauJet& /*tau*/, const xAOD::CaloCluster &cluster, +bool et_log(const xAOD::TauJet& /*tau*/, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { - out = std::log10(cluster.et()); + out = std::log10(cluster.p4().Et()); return true; } -bool pt_jetseed_log(const xAOD::TauJet &tau, const xAOD::CaloCluster& /*cluster*/, +bool pt_jetseed_log(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster& /*cluster*/, double &out) { out = std::log10(tau.ptJetSeed()); return true; } -bool dEta(const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, +bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { out = cluster.eta() - tau.eta(); return true; } -bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, +bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { out = cluster.p4().DeltaPhi(tau.p4()); return true; } -bool SECOND_R(const xAOD::TauJet& /*tau*/, const xAOD::CaloCluster &cluster, +bool SECOND_R(const xAOD::TauJet& /*tau*/, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { - const auto success = cluster.retrieveMoment(MomentType::SECOND_R, out); + const auto success = cluster.clust().retrieveMoment(MomentType::SECOND_R, out); out = std::log10(out + 0.1); return success; } -bool SECOND_LAMBDA(const xAOD::TauJet& /*tau*/, const xAOD::CaloCluster &cluster, +bool SECOND_LAMBDA(const xAOD::TauJet& /*tau*/, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { - const auto success = cluster.retrieveMoment(MomentType::SECOND_LAMBDA, out); + const auto success = cluster.clust().retrieveMoment(MomentType::SECOND_LAMBDA, out); out = std::log10(out + 0.1); return success; } -bool CENTER_LAMBDA(const xAOD::TauJet& /*tau*/, const xAOD::CaloCluster &cluster, +bool CENTER_LAMBDA(const xAOD::TauJet& /*tau*/, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { - const auto success = cluster.retrieveMoment(MomentType::CENTER_LAMBDA, out); + const auto success = cluster.clust().retrieveMoment(MomentType::CENTER_LAMBDA, out); out = std::log10(out + 1e-6); return success; } -bool SECOND_LAMBDAOverClustersMeanSecondLambda(const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out) { +bool SECOND_LAMBDAOverClustersMeanSecondLambda(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { float ClustersMeanSecondLambda = tau.auxdata<float>("ClustersMeanSecondLambda"); double secondLambda(0); - const auto success = cluster.retrieveMoment(MomentType::SECOND_LAMBDA, secondLambda); + const auto success = cluster.clust().retrieveMoment(MomentType::SECOND_LAMBDA, secondLambda); out = secondLambda/ClustersMeanSecondLambda; return success; } -bool CENTER_LAMBDAOverClustersMeanCenterLambda(const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out) { +bool CENTER_LAMBDAOverClustersMeanCenterLambda(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { float ClustersMeanCenterLambda = tau.auxdata<float>("ClustersMeanCenterLambda"); double centerLambda(0); - const auto success = cluster.retrieveMoment(MomentType::CENTER_LAMBDA, centerLambda); + const auto success = cluster.clust().retrieveMoment(MomentType::CENTER_LAMBDA, centerLambda); if (ClustersMeanCenterLambda == 0.){ out = 250.; }else { @@ -523,12 +523,12 @@ bool CENTER_LAMBDAOverClustersMeanCenterLambda(const xAOD::TauJet &tau, const xA } -bool FirstEngDensOverClustersMeanFirstEngDens(const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out) { +bool FirstEngDensOverClustersMeanFirstEngDens(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out) { // the ClustersMeanFirstEngDens is the log10 of the energy weighted average of the First_ENG_DENS // divided by ETot to make it dimension-less, // so we need to evaluate the differance of log10(clusterFirstEngDens/clusterTotalEnergy) and the ClustersMeanFirstEngDens double clusterFirstEngDens = 0.0; - bool status = cluster.retrieveMoment(MomentType::FIRST_ENG_DENS, clusterFirstEngDens); + bool status = cluster.clust().retrieveMoment(MomentType::FIRST_ENG_DENS, clusterFirstEngDens); if (clusterFirstEngDens < 1e-6) clusterFirstEngDens = 1e-6; float clusterTotalEnergy = tau.auxdata<float>("ClusterTotalEnergy"); diff --git a/Reconstruction/tauRecTools/Root/TauVertexCorrection.cxx b/Reconstruction/tauRecTools/Root/TauVertexCorrection.cxx deleted file mode 100644 index 2522a3cd2b9c1fc53b657b2f795e1f8639dbd5a4..0000000000000000000000000000000000000000 --- a/Reconstruction/tauRecTools/Root/TauVertexCorrection.cxx +++ /dev/null @@ -1,231 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#include "tauRecTools/TauVertexCorrection.h" - -#include "xAODCaloEvent/CaloVertexedTopoCluster.h" - -TauVertexCorrection::TauVertexCorrection(const std::string& name): - asg::AsgTool(name) { - declareProperty("SeedJet", m_seedJet = ""); - declareProperty("VertexCorrection", m_doVertexCorrection = true); - declareProperty("JetVertexCorrection", m_doJetVertexCorrection = true); -} - - - -StatusCode TauVertexCorrection::initialize() { - ATH_MSG_INFO("in initialize"); - - // For AntiKt4LCTopoJets: CALIBRATED -- jet vertex corrected at LCScale, UNCALIBRATED -- EMScale - // For AntiKt4EMTopoJets: CALIBRATED -- jet vertex corrected at EMScale, UNCALIBRATED -- EMScale - if (m_seedJet == "AntiKt4LCTopoJets") { - m_isPFO = false; - m_clusterState = xAOD::CaloCluster::State::CALIBRATED; - } - else if (m_seedJet == "AntiKt4EMTopoJets") { - m_isPFO = false; - m_clusterState = xAOD::CaloCluster::State::CALIBRATED; - } - else if (m_seedJet == "AntiKt4EMPFlowJets") { - m_isPFO = true; - m_clusterState = xAOD::CaloCluster::State::UNCALIBRATED; - } - else { - ATH_MSG_ERROR("Seed jet " << m_seedJet << " not supported !"); - return StatusCode::FAILURE; - } - - ATH_MSG_INFO("VertexCorrection: " << m_doVertexCorrection); - ATH_MSG_INFO("JetVertexCorrection: " << m_doJetVertexCorrection); - ATH_MSG_INFO("SeedJet: " << m_seedJet); - ATH_MSG_INFO("PFO: " << m_isPFO); - ATH_MSG_INFO("Cluster Calibraction State: " << m_clusterState); - - return StatusCode::SUCCESS; -} - - - -const xAOD::Vertex* TauVertexCorrection::getJetVertex(const xAOD::Jet& jet) const { - - const xAOD::Vertex* jetVertex = nullptr; - - if (m_doJetVertexCorrection) { - bool isAvailable = jet.getAssociatedObject("OriginVertex", jetVertex); - if (!isAvailable) { - ATH_MSG_WARNING("OriginVertex not available !"); - jetVertex = nullptr; - } - } - - return jetVertex; -} - - - -TLorentzVector TauVertexCorrection::getTauAxis(const xAOD::TauJet& tau) const { - TLorentzVector tauAxis; - if (m_doVertexCorrection) { - tauAxis = tau.p4(xAOD::TauJetParameters::IntermediateAxis); - } - else { - tauAxis = tau.p4(xAOD::TauJetParameters::DetectorAxis); - } - - return tauAxis; -} - - - -TLorentzVector TauVertexCorrection::getVertexCorrectedP4(const xAOD::CaloCluster& cluster, - const Amg::Vector3D& position) const { - - TLorentzVector vertexCorrectedP4 = xAOD::CaloVertexedTopoCluster(cluster, m_clusterState, position).p4(); - - ATH_MSG_DEBUG("Cluster: " << &cluster); - ATH_MSG_DEBUG("Original cluster four momentum, pt: " << cluster.pt(m_clusterState) << - " eta: " << cluster.eta(m_clusterState) << " phi: " << cluster.phi(m_clusterState) << - " e: " << cluster.e(m_clusterState)); - ATH_MSG_DEBUG("Vertex corrected four momentum, pt: " << vertexCorrectedP4.Pt() << - " eta: " << vertexCorrectedP4.Eta() << " phi: " << vertexCorrectedP4.Phi() << - " e: " << vertexCorrectedP4.E()); - - return vertexCorrectedP4; -} - - - -TLorentzVector TauVertexCorrection::getVertexCorrectedP4(const xAOD::PFO& pfo, - const Amg::Vector3D& position) const { - TLorentzVector vertexCorrectedP4; - - if (!pfo.isCharged()) { - TVector3 pos(position.x(), position.y(), position.z()); - - // If there is a vertex correction in jet reconstruction, then pfo.p4() is the four momentum - // at EM scale. Otherwise, pfo.p4() is at LC scale (not clear), and pfo.p4EM() is the four - // momentum at EM scale. - // TODO: May need further modifications, depending on how the jet reconstruction fix ATLJETMET-1280 - // The strategy only works for PFlow at EM scale. - if (m_doJetVertexCorrection) { - vertexCorrectedP4 = pfo.GetVertexCorrectedFourVec(pos); - } - else { - vertexCorrectedP4 = pfo.GetVertexCorrectedEMFourVec(pos); - } - } - else { - vertexCorrectedP4 = pfo.p4(); - } - - ATH_MSG_DEBUG("Original pfo four momentum, pt: " << pfo.pt() << - " eta: " << pfo.eta() << " phi: " << pfo.phi() << " e: " << pfo.e()); - ATH_MSG_DEBUG("Vertex corrected four momentum, pt: " << vertexCorrectedP4.Pt() << - " eta: " << vertexCorrectedP4.Eta() << " phi: " << vertexCorrectedP4.Phi() << " e: " << vertexCorrectedP4.E()); - - return vertexCorrectedP4; -} - - - -TLorentzVector TauVertexCorrection::getVertexCorrectedP4(const xAOD::CaloCluster& cluster, - const xAOD::Vertex* tauVertex, - const xAOD::Vertex* jetVertex) const { - TLorentzVector vertexCorrectedP4 = cluster.p4(m_clusterState); - Amg::Vector3D position; - - // In jet reconstruction: - // Clusters in Topo jets are corrected to point at PV0 when m_doJetVertexCorrection is true - // Clusters in PFlow jets are not corrected in jet reconstruction - // In tau reconstruction: - // If we want to do the vertex correction using tau vertexs, use the position of the tau vertex - // for PFlow jets, while the relative position of the tau vertex and default vertex for Topo jets - // If not, use the default vertex to correct clusters from PFlow jets - if (m_doVertexCorrection) { - if (m_isPFO) { - // use the position of tau vertex if we want to correct to tau vertex and seed is PFO jets - if (tauVertex) { - position = tauVertex->position(); - vertexCorrectedP4 = getVertexCorrectedP4(cluster, position); - } - // use the position of jet vertex if tau vertex not available - else if (m_doJetVertexCorrection && jetVertex) { - position = jetVertex->position(); - vertexCorrectedP4 = getVertexCorrectedP4(cluster, position); - } - } - else { - // use the relative position of tau vertex and default vertex for Topo jets - if (tauVertex && tauVertex != jetVertex) { - position = tauVertex->position(); - if (m_doJetVertexCorrection && jetVertex) { - position -= jetVertex->position(); - } - vertexCorrectedP4 = getVertexCorrectedP4(cluster, position); - } - } - } - else if (m_doJetVertexCorrection && m_isPFO) { - // use the position of jet vertex for PFO jets when no tau vertex correction is requried - if (jetVertex) { - position = jetVertex->position(); - vertexCorrectedP4 = getVertexCorrectedP4(cluster, position); - } - } - - return vertexCorrectedP4; -} - - - -TLorentzVector TauVertexCorrection::getVertexCorrectedP4(const xAOD::PFO& pfo, - const xAOD::Vertex* tauVertex, - const xAOD::Vertex* jetVertex) const { - TLorentzVector vertexCorrectedP4 = pfo.p4(); - Amg::Vector3D position; - - // In jet reconstruction: - // PFOs are corrected to point at PV0 when m_doJetVertexCorrection is true - - // In tau reconstruction: - // If we want to do the vertex correction using tau vertexs, use the relative position - // of the tau vertex and default vertex - - if (m_doVertexCorrection) { - // use the relative position of tau vertex and default vertex - if (tauVertex) { - position = tauVertex->position(); - if (m_doJetVertexCorrection && jetVertex) { - position -= jetVertex->position(); - } - vertexCorrectedP4 = getVertexCorrectedP4(pfo, position); - } - } - - return vertexCorrectedP4; -} - - - -TLorentzVector TauVertexCorrection::getVertexCorrectedP4(const xAOD::JetConstituent& constituent, - const xAOD::Vertex* tauVertex, - const xAOD::Vertex* jetVertex) const { - TLorentzVector vertexCorrectedP4; - - if (constituent.type() == xAOD::Type::CaloCluster) { - const xAOD::CaloCluster* cluster = static_cast<const xAOD::CaloCluster*>( constituent.rawConstituent() ); - vertexCorrectedP4 = getVertexCorrectedP4(*cluster, tauVertex, jetVertex); - } - else if (constituent.type() == xAOD::Type::ParticleFlow) { - const xAOD::PFO* pfo = static_cast<const xAOD::PFO*>( constituent.rawConstituent() ); - vertexCorrectedP4 = getVertexCorrectedP4(*pfo, tauVertex, jetVertex); - } - else { - ATH_MSG_WARNING("Seed jet constituent type not supported, will not do vertex correction !"); - vertexCorrectedP4.SetPtEtaPhiE(constituent.pt(), constituent.eta(), constituent.phi(), constituent.e()); - } - - return vertexCorrectedP4; -} diff --git a/Reconstruction/tauRecTools/src/TauCellVariables.cxx b/Reconstruction/tauRecTools/src/TauCellVariables.cxx index 51caf877e02e895109b4cd7e137b27d491cadada..016b1cd9f1c1eaf16cbbf1953570aea85109f6a4 100644 --- a/Reconstruction/tauRecTools/src/TauCellVariables.cxx +++ b/Reconstruction/tauRecTools/src/TauCellVariables.cxx @@ -15,28 +15,16 @@ #include <cmath> #include <vector> -//______________________________________________________________________________ + TauCellVariables::TauCellVariables(const std::string& name) : TauRecToolBase(name) { } -//______________________________________________________________________________ -TauCellVariables::~TauCellVariables() { -} -//______________________________________________________________________________ -StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { - if (! pTau.jetLink().isValid()) { - ATH_MSG_ERROR("tau does not have jet seed for cell variable calculation"); - return StatusCode::FAILURE; - } - const xAOD::Jet* pJetSeed = pTau.jet(); - - ATH_MSG_VERBOSE("cluster position is eta=" << pTau.eta() << " phi=" << pTau.phi() ); +StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { int numStripCell = 0; - int numEMCell = 0; double sumCellET = 0.; double sumCellET01 = 0; @@ -51,15 +39,16 @@ StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { std::vector<double> cellRingEnergys(7,0.); - std::vector<const xAOD::CaloCluster*> clusterList; - ATH_CHECK(tauRecTools::GetJetClusterList(pJetSeed, clusterList, m_useSubtractedCluster)); - int numCells = 0; std::bitset<200000> cellSeen; + TLorentzVector tauAxis = tauRecTools::getTauAxis(pTau, m_doVertexCorrection); + // loop over cells in all the clusters and calculate the variables - for (auto cluster : clusterList){ - const CaloClusterCellLink* cellLinks = cluster->getCellLinks(); + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = pTau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList){ + const xAOD::CaloCluster& cluster = vertexedCluster.clust(); + const CaloClusterCellLink* cellLinks = cluster.getCellLinks(); for (const CaloCell* cell : *cellLinks) { ++numCells; @@ -72,26 +61,24 @@ StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { cellSeen.set(cell->caloDDE()->calo_hash()); } + // cell four momentum corrected to point at the required vertex double cellPhi = cell->phi(); double cellEta = cell->eta(); double cellET = cell->et(); double cellEnergy = cell->energy(); - TLorentzVector tauAxis = pTau.p4(xAOD::TauJetParameters::DetectorAxis); - - // correct cell four momentum based on tau vertex - if (m_doVertexCorrection && pTau.vertexLink().isValid()) { + + const xAOD::Vertex* vertex = tauRecTools::getTauVertex(pTau, inTrigger()); + if (m_doVertexCorrection && vertex) { CaloVertexedCell vxCell (*cell, pTau.vertex()->position()); cellPhi = vxCell.phi(); cellEta = vxCell.eta(); cellET = vxCell.et(); cellEnergy = vxCell.energy(); - tauAxis = pTau.p4(xAOD::TauJetParameters::IntermediateAxis); } - + double dR = Tau1P3PKineUtils::deltaR(tauAxis.Eta(), tauAxis.Phi(), cellEta, cellPhi); CaloSampling::CaloSample calo = cell->caloDDE()->getSampling(); - // use cells with dR < m_cellCone relative to tau intermediate axis: if (dR < m_cellCone) { sumCellET += cellET; @@ -104,7 +91,6 @@ StatusCode TauCellVariables::execute(xAOD::TauJet& pTau) const { if (isEMLayer(calo)) { EMRadius += dR*cellET; sumEMCellET += cellET; - if (cellEnergy > m_cellEthr) numEMCell += 1; // Strip layer: EMB1 and EME1 if (isStripLayer(calo) && (std::abs(cellEta) < 2.5)) { diff --git a/Reconstruction/tauRecTools/src/TauCellVariables.h b/Reconstruction/tauRecTools/src/TauCellVariables.h index ba548d0c63ee8809cd64f27fff075bc3212d1718..c75a46533ece994e434fd88f69fa338288e645ac 100644 --- a/Reconstruction/tauRecTools/src/TauCellVariables.h +++ b/Reconstruction/tauRecTools/src/TauCellVariables.h @@ -23,7 +23,7 @@ class TauCellVariables : public TauRecToolBase { TauCellVariables(const std::string& name); /** @brief Destructor */ - ~TauCellVariables(); + virtual ~TauCellVariables() = default; /** @brief Perform the calculation of cell variables for each tau candidate */ virtual StatusCode execute(xAOD::TauJet& pTau) const override; @@ -36,11 +36,9 @@ class TauCellVariables : public TauRecToolBase { /** @brief Check whether the CaloSample is a Strip layer */ bool isStripLayer(const CaloSampling::CaloSample& calo) const; - Gaudi::Property<double> m_cellEthr {this, "CellEthreshold", 0.2 * Gaudi::Units::GeV, "energy threshould of EM cell"}; Gaudi::Property<double> m_stripEthr {this, "StripEthreshold", 0.2 * Gaudi::Units::GeV, "energy threshould for strip cell"}; Gaudi::Property<double> m_cellCone {this, "CellCone", 0.2, "outer cone for cells used in calculation"}; Gaudi::Property<bool> m_doVertexCorrection {this, "VertexCorrection", true, "switch of vertex correction"}; - Gaudi::Property<bool> m_useSubtractedCluster {this, "UseSubtractedCluster", true, "use shower subtracted clusters in calo calculations"}; }; //______________________________________________________________________________ diff --git a/Reconstruction/tauRecTools/src/TauClusterFinder.h b/Reconstruction/tauRecTools/src/TauClusterFinder.h index 3d11cda80cd5fda14c330e8a7080e20cf460d212..cfb4a9a32b80caa8b56879739f4cbf2213f3cf84 100644 --- a/Reconstruction/tauRecTools/src/TauClusterFinder.h +++ b/Reconstruction/tauRecTools/src/TauClusterFinder.h @@ -6,7 +6,6 @@ #define TAUCLUSTERFINDER_H #include "tauRecTools/TauRecToolBase.h" -#include "tauRecTools/ITauVertexCorrection.h" #include "AsgTools/ToolHandle.h" diff --git a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx index 9816326736b008a9988da4e162ccd5b4db0f441c..bbe13122a7ad5b82e3eaef151c76203f606f4e2e 100644 --- a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx +++ b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.cxx @@ -4,42 +4,31 @@ #ifndef XAOD_ANALYSIS - - -#include "GaudiKernel/SystemOfUnits.h" -#include "CaloUtils/CaloVertexedCell.h" - -#include "xAODTau/TauJet.h" -#include "xAODJet/Jet.h" +#include "TauElectronVetoVariables.h" #include "tauRecTools/KineUtils.h" -#include "tauRecTools/HelperFunctions.h" +#include "xAODTau/TauJet.h" +#include "CaloUtils/CaloVertexedCell.h" #include "TrkParametersIdentificationHelpers/TrackParametersIdHelper.h" #include "RecoToolInterfaces/IParticleCaloExtensionTool.h" -#include "TauElectronVetoVariables.h" + +#include "GaudiKernel/SystemOfUnits.h" + #include <algorithm> #include <cmath> #include <unordered_map> #include <array> + using Gaudi::Units::GeV; -//------------------------------------------------------------------------- -// Constructor -//------------------------------------------------------------------------- + TauElectronVetoVariables::TauElectronVetoVariables(const std::string &name) : TauRecToolBase(name) { } -//------------------------------------------------------------------------- -// Destructor -//------------------------------------------------------------------------- -TauElectronVetoVariables::~TauElectronVetoVariables() { } -//------------------------------------------------------------------------- -// Initializer -//------------------------------------------------------------------------- -StatusCode TauElectronVetoVariables::initialize() -{ + +StatusCode TauElectronVetoVariables::initialize() { ATH_CHECK( m_caloExtensionTool.retrieve() ); if (!m_ParticleCacheKey.key().empty()) { ATH_CHECK(m_ParticleCacheKey.initialize()); @@ -49,11 +38,9 @@ StatusCode TauElectronVetoVariables::initialize() return StatusCode::SUCCESS; } -//------------------------------------------------------------------------- -// Execution -//------------------------------------------------------------------------- -StatusCode TauElectronVetoVariables::execute(xAOD::TauJet& pTau) const -{ + + +StatusCode TauElectronVetoVariables::execute(xAOD::TauJet& pTau) const { if (pTau.nTracks() < 1) { return StatusCode::SUCCESS; } @@ -152,23 +139,21 @@ StatusCode TauElectronVetoVariables::execute(xAOD::TauJet& pTau) const return StatusCode::SUCCESS; } } - if (! pTau.jetLink().isValid()) { - ATH_MSG_ERROR("tau does not have jet seed for electron veto cell variable calculation"); - return StatusCode::FAILURE; - } - const xAOD::Jet* pJetSeed = pTau.jet(); + // Loop through jets, get links to clusters - std::vector<const xAOD::CaloCluster*> clusterList; - ATH_CHECK(tauRecTools::GetJetClusterList(pJetSeed, clusterList, m_useSubtractedCluster)); std::bitset<200000> cellSeen{}; const std::unordered_map<int, int> samplingLookup{ {4,0}, {5,1}, {6,2}, {7,3}, {8,12}, {15, 12}, {16,13}, {17,14}, {18,12}, {19, 13}, {20,14} }; const auto notFound{samplingLookup.end()}; - for (auto cluster : clusterList){ - CaloClusterCellLink::const_iterator pCellIter = cluster->getCellLinks()->begin(); - CaloClusterCellLink::const_iterator pCellIterE = cluster->getCellLinks()->end(); + + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = pTau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList){ + + const xAOD::CaloCluster& cluster = vertexedCluster.clust(); + CaloClusterCellLink::const_iterator pCellIter = cluster.getCellLinks()->begin(); + CaloClusterCellLink::const_iterator pCellIterE = cluster.getCellLinks()->end(); for (; pCellIter != pCellIterE; ++pCellIter) { double cellEta{}, cellPhi{}, cellET{}; pCell = *pCellIter; diff --git a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.h b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.h index d31230f6cf3972488f1d98fa20424fa667c8b1af..33c64fa60537d6a42433471db6695df58e7f25c5 100644 --- a/Reconstruction/tauRecTools/src/TauElectronVetoVariables.h +++ b/Reconstruction/tauRecTools/src/TauElectronVetoVariables.h @@ -2,13 +2,15 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#ifndef TAUREC_TAU1P3PELEVETO_H -#define TAUREC_TAU1P3PELEVETO_H +#ifndef TAURECTOOLS_TAUELECTRONVETOVARIABLES_H +#define TAURECTOOLS_TAUELECTRONVETOVARIABLES_H #include "tauRecTools/TauRecToolBase.h" + +#include "TrkCaloExtension/CaloExtensionCollection.h" + #include "GaudiKernel/ToolHandle.h" #include "StoreGate/ReadHandleKey.h" -#include "TrkCaloExtension/CaloExtensionCollection.h" namespace Trk { class IParticleCaloExtensionTool; @@ -23,23 +25,27 @@ namespace Trk { */ class TauElectronVetoVariables : public TauRecToolBase { + public: + + ASG_TOOL_CLASS2(TauElectronVetoVariables, TauRecToolBase, ITauToolBase) + + TauElectronVetoVariables(const std::string& name); - TauElectronVetoVariables(const std::string& name); - ASG_TOOL_CLASS2(TauElectronVetoVariables, TauRecToolBase, ITauToolBase); + virtual ~TauElectronVetoVariables() = default; - virtual ~TauElectronVetoVariables(); - virtual StatusCode execute(xAOD::TauJet& pTau) const override; - virtual StatusCode initialize() override; + virtual StatusCode initialize() override; + + virtual StatusCode execute(xAOD::TauJet& pTau) const override; private: - Gaudi::Property<bool> m_doVertexCorrection {this, "VertexCorrection", true, "switch of vertex correction"}; - Gaudi::Property<bool> m_useOldCalo{this,"useOldCalo",false,"If true, it uses the CaloExtensionTool for calculating track extrapolation. Otherwise, it allows the code to read from the cache created by CaloExtensionBuilderalg."}; - Gaudi::Property<bool> m_useSubtractedCluster {this, "UseSubtractedCluster", true, "use shower subtracted clusters in calo calculations"}; - ToolHandle<Trk::IParticleCaloExtensionTool> m_caloExtensionTool {this, - "ParticleCaloExtensionTool", "Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool", "Tool for calculating track extrapolation"}; - SG::ReadHandleKey<CaloExtensionCollection> m_ParticleCacheKey{this, - "tauEVParticleCache", "ParticleCaloExtension", "Name of the particle measurement extrapolation cache for TauEV Algorithm"}; + + Gaudi::Property<bool> m_doVertexCorrection {this, "VertexCorrection", true, "switch of vertex correction"}; + Gaudi::Property<bool> m_useOldCalo{this,"useOldCalo",false,"If true, it uses the CaloExtensionTool for calculating track extrapolation. Otherwise, it allows the code to read from the cache created by CaloExtensionBuilderalg."}; + ToolHandle<Trk::IParticleCaloExtensionTool> m_caloExtensionTool {this, + "ParticleCaloExtensionTool", "Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool", "Tool for calculating track extrapolation"}; + SG::ReadHandleKey<CaloExtensionCollection> m_ParticleCacheKey{this, + "tauEVParticleCache", "ParticleCaloExtension", "Name of the particle measurement extrapolation cache for TauEV Algorithm"}; }; #endif diff --git a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx index 241dc39b8b00e66d38daab8109dd5a9c8517a783..226987b143ac0ad19c28590d0cd44ff61e0133e1 100644 --- a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx +++ b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.cxx @@ -12,20 +12,12 @@ #include "xAODJet/Jet.h" - TauPi0ClusterCreator::TauPi0ClusterCreator(const std::string& name) : TauRecToolBase(name) { } -StatusCode TauPi0ClusterCreator::initialize() { - ATH_CHECK(m_tauVertexCorrection.retrieve()); - return StatusCode::SUCCESS; -} - - - StatusCode TauPi0ClusterCreator::executePi0ClusterCreator(xAOD::TauJet& tau, xAOD::PFOContainer& neutralPFOContainer, xAOD::PFOContainer& hadronicPFOContainer, const xAOD::CaloClusterContainer& pi0ClusterContainer) const { @@ -51,21 +43,24 @@ StatusCode TauPi0ClusterCreator::executePi0ClusterCreator(xAOD::TauJet& tau, xAO // Map shot to the pi0 cluster std::map<unsigned, const xAOD::CaloCluster*> shotToClusterMap = getShotToClusterMap(shotPFOs, pi0ClusterContainer, tau); - // FIXME: These clusters are custom ones, so could be corrected using tau vertex directly - if (! tau.jetLink().isValid()) { - ATH_MSG_ERROR("Tau jet link is invalid."); - return StatusCode::FAILURE; - } - const xAOD::Jet *jetSeed = tau.jet(); - const xAOD::Vertex* jetVertex = m_tauVertexCorrection->getJetVertex(*jetSeed); - const xAOD::Vertex* tauVertex = nullptr; - if (tau.vertexLink().isValid()) tauVertex = tau.vertex(); - TLorentzVector tauAxis = m_tauVertexCorrection->getTauAxis(tau); + // We will always perform the vertex correction + const xAOD::Vertex* vertex = tauRecTools::getTauVertex(tau); + + // Tau custom PFO reconstruction is only used in offline reconstrution + TLorentzVector tauAxis = tauRecTools::getTauAxis(tau); - // Loop over clusters, and create neutral PFOs + // Loop over custom pi0 clusters, and create neutral PFOs for (const xAOD::CaloCluster* cluster: pi0ClusterContainer) { - TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex); - + // custom clusters could be correctd directly using the tau vertex + TLorentzVector clusterP4; + if (vertex) { + xAOD::CaloVertexedTopoCluster vertexedCluster(*cluster, vertex->position()); + clusterP4 = vertexedCluster.p4(); + } + else { + clusterP4 = cluster->p4(); + } + // Clusters must have enough energy, and within 0.4 cone of the tau candidate if (clusterP4.Pt() < m_clusterEtCut) continue; if (clusterP4.DeltaR(tauAxis) > 0.4) continue; @@ -82,18 +77,19 @@ StatusCode TauPi0ClusterCreator::executePi0ClusterCreator(xAOD::TauJet& tau, xAO ATH_CHECK(configureNeutralPFO(*cluster, pi0ClusterContainer, tau, shotPFOs, shotToClusterMap, *neutralPFO)); } - // Loop over clusters, and create hadronic PFOs - std::vector<const xAOD::CaloCluster*> clusterList; - ATH_CHECK(tauRecTools::GetJetClusterList(jetSeed, clusterList, m_useSubtractedCluster)); - for (const xAOD::CaloCluster* cluster: clusterList) { - TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex); + // Loop over clusters from jet seed, and create hadronic PFOs + std::vector<xAOD::CaloVertexedTopoCluster> vertexedClusterList = tau.vertexedClusters(); + for (const xAOD::CaloVertexedTopoCluster& vertexedCluster : vertexedClusterList){ + TLorentzVector clusterP4 = vertexedCluster.p4(); // Clusters must have positive energy, and within 0.2 cone of the tau candidate if(clusterP4.E()<=0.) continue; if(clusterP4.DeltaR(tauAxis) > 0.2) continue; double clusterEnergyHad = 0.; - const CaloClusterCellLink* cellLinks = cluster->getCellLinks(); + + const xAOD::CaloCluster& cluster = vertexedCluster.clust(); + const CaloClusterCellLink* cellLinks = cluster.getCellLinks(); CaloClusterCellLink::const_iterator cellLink = cellLinks->begin(); for (; cellLink != cellLinks->end(); ++cellLink) { const CaloCell* cell = static_cast<const CaloCell*>(*cellLink); @@ -101,6 +97,7 @@ StatusCode TauPi0ClusterCreator::executePi0ClusterCreator(xAOD::TauJet& tau, xAO int sampling = cell->caloDDE()->getSampling(); if (sampling < 8) continue; + // TODO: what is the weight for EMTopo double cellEnergy = cell->e() * cellLink.weight(); clusterEnergyHad += cellEnergy; } @@ -117,7 +114,7 @@ StatusCode TauPi0ClusterCreator::executePi0ClusterCreator(xAOD::TauJet& tau, xAO PFOElementLink.toContainedElement( hadronicPFOContainer, hadronicPFO ); tau.addHadronicPFOLink( PFOElementLink ); - ATH_CHECK(configureHadronicPFO(*cluster, clusterEnergyHad, *hadronicPFO)); + ATH_CHECK(configureHadronicPFO(cluster, clusterEnergyHad, *hadronicPFO)); } return StatusCode::SUCCESS; @@ -138,24 +135,26 @@ std::map<unsigned, const xAOD::CaloCluster*> TauPi0ClusterCreator::getShotToClus } const IdentifierHash seedHash = static_cast<const IdentifierHash>(seedHashInt); - const xAOD::Jet *jetSeed = tau.jet(); - if (!jetSeed) { - ATH_MSG_ERROR("Tau jet link is invalid."); - return shotToClusterMap; - } - const xAOD::Vertex* jetVertex = m_tauVertexCorrection->getJetVertex(*jetSeed); + // We will always perform the vertex correction + const xAOD::Vertex* vertex = tauRecTools::getTauVertex(tau); - const xAOD::Vertex* tauVertex = nullptr; - if (tau.vertexLink().isValid()) tauVertex = tau.vertex(); + // Tau custom PFO reconstruction is only used in offline reconstrution + TLorentzVector tauAxis = tauRecTools::getTauAxis(tau); - TLorentzVector tauAxis = m_tauVertexCorrection->getTauAxis(tau); - float weightInCluster = -1.; float weightInPreviousCluster = -1; - for (const xAOD::CaloCluster* cluster : pi0ClusterContainer) { - // FIXME: cluster here is not corrected - TLorentzVector clusterP4 = m_tauVertexCorrection->getVertexCorrectedP4(*cluster, tauVertex, jetVertex); + // Loop over custom pi0 clusters, and map shot to the cluster + for (const xAOD::CaloCluster* cluster: pi0ClusterContainer) { + // custom clusters could be correctd directly using the tau vertex + TLorentzVector clusterP4; + if (vertex) { + xAOD::CaloVertexedTopoCluster vertexedCluster(*cluster, vertex->position()); + clusterP4 = vertexedCluster.p4(); + } + else { + clusterP4 = cluster->p4(); + } weightInCluster = -1.; if (clusterP4.Et() < m_clusterEtCut) continue; diff --git a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h index fcb8c415b532cb25f71b4ad9c741b6735de82fcc..e1d474c33af99da934119cefb52177562af99781 100644 --- a/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h +++ b/Reconstruction/tauRecTools/src/TauPi0ClusterCreator.h @@ -6,7 +6,6 @@ #define TAUREC_TAUPI0CLUSTERCREATOR_H #include "tauRecTools/TauRecToolBase.h" -#include "tauRecTools/ITauVertexCorrection.h" #include "xAODPFlow/PFOContainer.h" #include "xAODCaloEvent/CaloClusterContainer.h" @@ -30,12 +29,12 @@ class TauPi0ClusterCreator : public TauRecToolBase { public: - ASG_TOOL_CLASS2(TauPi0ClusterCreator, TauRecToolBase, ITauToolBase); + ASG_TOOL_CLASS2(TauPi0ClusterCreator, TauRecToolBase, ITauToolBase) - TauPi0ClusterCreator(const std::string& name) ; + TauPi0ClusterCreator(const std::string& name); + virtual ~TauPi0ClusterCreator() = default; - virtual StatusCode initialize() override; virtual StatusCode executePi0ClusterCreator(xAOD::TauJet& pTau, xAOD::PFOContainer& neutralPFOContainer, xAOD::PFOContainer& hadronicClusterPFOContainer, const xAOD::CaloClusterContainer& pi0CaloClusContainer) const override; @@ -81,10 +80,6 @@ private: std::vector<float> get2ndEtaMomWRTCluster(const xAOD::CaloCluster& cluster) const; Gaudi::Property<double> m_clusterEtCut {this, "ClusterEtCut", 0.5 * Gaudi::Units::GeV, "Et threshould for pi0 candidate clusters"}; - Gaudi::Property<bool> m_useSubtractedCluster {this, "UseSubtractedCluster", true, "use shower subtracted clusters in calo calculations"}; - - ToolHandle<ITauVertexCorrection> m_tauVertexCorrection { this, - "TauVertexCorrection", "TauVertexCorrection", "Tool to perform the vertex correction"}; }; #endif /* TAUPI0CLUSTERCREATOR_H */ diff --git a/Reconstruction/tauRecTools/src/components/tauRecTools_entries.cxx b/Reconstruction/tauRecTools/src/components/tauRecTools_entries.cxx index 2a2d8a9a02b06940e3bff744bd016a3360b958f8..a66ec3712bc05033eb2cafaa95316a0847bf544d 100644 --- a/Reconstruction/tauRecTools/src/components/tauRecTools_entries.cxx +++ b/Reconstruction/tauRecTools/src/components/tauRecTools_entries.cxx @@ -28,7 +28,6 @@ #include "tauRecTools/TauIDVarCalculator.h" #include "tauRecTools/TauJetRNNEvaluator.h" #include "tauRecTools/TauDecayModeNNClassifier.h" -#include "tauRecTools/TauVertexCorrection.h" #include "tauRecTools/TauVertexedClusterDecorator.h" #ifndef XAOD_ANALYSIS @@ -63,5 +62,4 @@ DECLARE_COMPONENT( TauJetBDTEvaluator ) DECLARE_COMPONENT( TauIDVarCalculator ) DECLARE_COMPONENT( TauJetRNNEvaluator ) DECLARE_COMPONENT( TauDecayModeNNClassifier ) -DECLARE_COMPONENT( TauVertexCorrection ) DECLARE_COMPONENT( TauVertexedClusterDecorator ) diff --git a/Reconstruction/tauRecTools/tauRecTools/CaloClusterVariables.h b/Reconstruction/tauRecTools/tauRecTools/CaloClusterVariables.h index f0d1636a7b51db61c82813859eb87089688f620f..d4a12570939a095b45d20065bbf82a15786a3ac9 100644 --- a/Reconstruction/tauRecTools/tauRecTools/CaloClusterVariables.h +++ b/Reconstruction/tauRecTools/tauRecTools/CaloClusterVariables.h @@ -5,10 +5,7 @@ #ifndef CALOCLUSTERVARIABLES_H #define CALOCLUSTERVARIABLES_H -#include "tauRecTools/ITauVertexCorrection.h" - #include "xAODTau/TauJet.h" -#include "AsgTools/ToolHandle.h" #include "CxxUtils/fpcompare.h" #include "TLorentzVector.h" diff --git a/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h b/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h index b7b1c92c8d8043370d4703cf9a26ab0663a49a28..7bf233bfcfe43b098a7421026e1d6da04876ff64 100644 --- a/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h +++ b/Reconstruction/tauRecTools/tauRecTools/HelperFunctions.h @@ -49,8 +49,6 @@ namespace tauRecTools TLorentzVector GetConstituentP4(const xAOD::JetConstituent& constituent); - const StatusCode GetJetClusterList(const xAOD::Jet* jet, std::vector<const xAOD::CaloCluster*> &clusterList, bool useSubtractedCluster); - xAOD::TauTrack::TrackFlagType isolateClassifiedBits(xAOD::TauTrack::TrackFlagType flag); bool sortTracks(const ElementLink<xAOD::TauTrackContainer> &l1, const ElementLink<xAOD::TauTrackContainer> &l2); diff --git a/Reconstruction/tauRecTools/tauRecTools/ITauVertexCorrection.h b/Reconstruction/tauRecTools/tauRecTools/ITauVertexCorrection.h deleted file mode 100644 index 35fa425b67bca528de1558217d051be7a6ec28e3..0000000000000000000000000000000000000000 --- a/Reconstruction/tauRecTools/tauRecTools/ITauVertexCorrection.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ITAUVERTEXCORRECTION_H -#define ITAUVERTEXCORRECTION_H - -#include "AsgTools/IAsgTool.h" - -#include "xAODTracking/VertexContainer.h" -#include "xAODPFlow/PFOContainer.h" -#include "xAODCaloEvent/CaloClusterContainer.h" -#include "xAODTau/TauJet.h" - - -/** - * @brief Tool to perform the vertex correction for the tau candidate - */ - -class ITauVertexCorrection : virtual public asg::IAsgTool { - -public: - - ASG_TOOL_INTERFACE(ITauVertexCorrection) - - virtual ~ITauVertexCorrection() = default; - - virtual StatusCode initialize() = 0; - - /** Get the jet vertex */ - virtual const xAOD::Vertex* getJetVertex(const xAOD::Jet& jet) const = 0; - - /** Get the tau axis */ - virtual TLorentzVector getTauAxis(const xAOD::TauJet& tau) const = 0; - - /**@brief Get the vertex corrected four momentum, the position of - * the tau vertex relative to the jet vertex is used - * @param cluster input cluster - * @param vertex the vertex of the tau candidate - * @param relativeVertex the vertex of the jet seed - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::CaloCluster& cluster, - const xAOD::Vertex* vertex, - const xAOD::Vertex* relativeVertex = nullptr) const = 0; - - /**@brief Get the vertex corrected four momentum, the position of - * the tau vertex relative to the jet vertex is used - * @param pfo input PFO - * @param vertex the vertex of the tau candidate - * @param relativeVertex the vertex of the jet seed - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::PFO& pfo, - const xAOD::Vertex* vertex, - const xAOD::Vertex* relativeVertex = nullptr) const = 0; - - /**@brief Get the vertex corrected four momentum, the position of - * the tau vertex relative to the jet vertex is used - * @param constituent input constituent - * @param vertex the vertex of the tau candiate - * @param relativeVertex the vertex of the jet seed - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::JetConstituent& constituent, - const xAOD::Vertex* vertex, - const xAOD::Vertex* relativeVertex = nullptr) const = 0; - -private: - - /**@brief Get the vertex corrected four momentum - * @param cluster input cluster - * @param position position of the vertex - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::CaloCluster& cluster, - const Amg::Vector3D& position) const = 0; - - /**@brief Get the vertex corrected four momentum - * @param pfo input PFO - * @param position position of the vertex - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::PFO& pfo, - const Amg::Vector3D& position) const = 0; -}; - -#endif // ITAUVERTEXCORRECTION_H diff --git a/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h b/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h index 5e07b0c4267553f576ad3d7871e2f3b46d212beb..a72ffba9df8a77c649aa951ebca0157679d354e9 100644 --- a/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h +++ b/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h @@ -6,30 +6,29 @@ #define TAURECTOOLSDEV_MVATESVARIABLEDECORATOR_H #include "tauRecTools/TauRecToolBase.h" -#include "tauRecTools/ITauVertexCorrection.h" #include "xAODEventInfo/EventInfo.h" #include "AsgDataHandles/ReadHandleKey.h" #include "AsgDataHandles/ReadDecorHandleKey.h" -#include "AsgTools/ToolHandle.h" -class MvaTESVariableDecorator -: public TauRecToolBase -{ - public: +class MvaTESVariableDecorator : public TauRecToolBase { + +public: ASG_TOOL_CLASS2( MvaTESVariableDecorator, TauRecToolBase, ITauToolBase ) MvaTESVariableDecorator(const std::string& name="MvaTESVariableDecorator"); - virtual ~MvaTESVariableDecorator(); + + virtual ~MvaTESVariableDecorator() = default; virtual StatusCode initialize() override; + virtual StatusCode execute(xAOD::TauJet& xTau) const override; - private: +private: - bool m_useSubtractedCluster; + bool m_doVertexCorrection; SG::ReadDecorHandleKey<xAOD::EventInfo> m_aveIntPerXKey {this, "averageInteractionsPerCrossingKey", @@ -40,10 +39,6 @@ class MvaTESVariableDecorator "Key_vertexInputContainer", "PrimaryVertices", "input vertex container key"}; - - ToolHandle<ITauVertexCorrection> m_tauVertexCorrection { this, - "TauVertexCorrection", "TauVertexCorrection", "Tool to perform the vertex correction"}; }; - #endif // TAURECTOOLSDEV_MVATESVARIABLEDECORATOR_H diff --git a/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h b/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h index 1afa6101d677c0a839950f981f3c1f227d0e05b3..e6ebcde9fe96a14261455dc104fc35fa604505c7 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauIDVarCalculator.h @@ -13,32 +13,25 @@ #define TAUIDVARCALCULATOR_H #include "tauRecTools/TauRecToolBase.h" -#include "tauRecTools/ITauVertexCorrection.h" -#include "AsgTools/ToolHandle.h" -class TauIDVarCalculator: public TauRecToolBase -{ - ASG_TOOL_CLASS2(TauIDVarCalculator, TauRecToolBase, ITauToolBase) +class TauIDVarCalculator: public TauRecToolBase { - public: +public: + + ASG_TOOL_CLASS2(TauIDVarCalculator, TauRecToolBase, ITauToolBase) TauIDVarCalculator(const std::string& name = "TauIDVarCalculator"); - virtual ~TauIDVarCalculator() {} - - virtual StatusCode initialize() override; + virtual ~TauIDVarCalculator() = default; virtual StatusCode execute(xAOD::TauJet&) const override; static const float LOW_NUMBER; - - private: - bool m_useSubtractedCluster; +private: - ToolHandle<ITauVertexCorrection> m_tauVertexCorrection { this, - "TauVertexCorrection", "TauVertexCorrection", "Tool to perform the vertex correction"}; + bool m_doVertexCorrection; }; #endif diff --git a/Reconstruction/tauRecTools/tauRecTools/TauJetRNN.h b/Reconstruction/tauRecTools/tauRecTools/TauJetRNN.h index 6db5ee4a8cc2dae37ff19895d03244a02bad0c91..09b75c9ae152150002af34bc74c7d56ccd00164b 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauJetRNN.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauJetRNN.h @@ -5,12 +5,12 @@ #ifndef TAUREC_TAUJETRNN_H #define TAUREC_TAUJETRNN_H -#include <memory> +#include "xAODTau/TauJet.h" +#include "xAODCaloEvent/CaloVertexedTopoCluster.h" #include "AsgMessaging/AsgMessaging.h" -#include "xAODTau/TauJet.h" - +#include <memory> // Forward declaration namespace lwt { @@ -51,12 +51,12 @@ public: // Compute the signal probability in [0, 1] or a default value float compute(const xAOD::TauJet &tau, const std::vector<const xAOD::TauTrack *> &tracks, - const std::vector<const xAOD::CaloCluster *> &clusters) const; + const std::vector<xAOD::CaloVertexedTopoCluster> &clusters) const; // Compute all input variables and store them in the maps that are passed by reference bool calculateInputVariables(const xAOD::TauJet &tau, const std::vector<const xAOD::TauTrack *> &tracks, - const std::vector<const xAOD::CaloCluster *> &clusters, + const std::vector<xAOD::CaloVertexedTopoCluster> &clusters, std::map<std::string, std::map<std::string, double>>& scalarInputs, std::map<std::string, std::map<std::string, std::vector<double>>>& vectorInputs) const; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h index 0898241c9e7e993f79ffcb23c196666c90fd3b0e..cbca4bc20c0ad994ef60b7415b3059fa7677f0cb 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNEvaluator.h @@ -6,11 +6,9 @@ #define TAUREC_TAUJETRNNEVALUATOR_H #include "tauRecTools/TauRecToolBase.h" -#include "tauRecTools/ITauVertexCorrection.h" #include "xAODTau/TauJet.h" - -#include "AsgTools/ToolHandle.h" +#include "xAODCaloEvent/CaloVertexedTopoCluster.h" #include <memory> @@ -40,14 +38,13 @@ public: const TauJetRNN* get_rnn_1p() const; const TauJetRNN* get_rnn_3p() const; -public: // Selects tracks to be used as input to the network StatusCode get_tracks(const xAOD::TauJet &tau, std::vector<const xAOD::TauTrack *> &out) const; // Selects clusters to be used as input to the network StatusCode get_clusters(const xAOD::TauJet &tau, - std::vector<const xAOD::CaloCluster *> &out) const; + std::vector<xAOD::CaloVertexedTopoCluster> &out) const; private: std::string m_output_varname; @@ -57,6 +54,7 @@ private: std::size_t m_max_tracks; std::size_t m_max_clusters; float m_max_cluster_dr; + bool m_doVertexCorrection; // Configuration of the weight file std::string m_input_layer_scalar; @@ -69,12 +67,6 @@ private: std::unique_ptr<TauJetRNN> m_net_0p; //! std::unique_ptr<TauJetRNN> m_net_1p; //! std::unique_ptr<TauJetRNN> m_net_3p; //! - - bool m_useSubtractedCluster; - - ToolHandle<ITauVertexCorrection> m_tauVertexCorrection { this, - "TauVertexCorrection", "TauVertexCorrection", "Tool to perform the vertex correction"}; }; - #endif // TAUREC_TAUJETRNNEVALUATOR_H diff --git a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNUtils.h b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNUtils.h index f53752499a62b0af53fbe6fb975fb8a0749940b3..5de645b43206576924d9a67fe3bac104d92c4e26 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauJetRNNUtils.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauJetRNNUtils.h @@ -5,11 +5,12 @@ #ifndef TAUREC_TAUJETRNNUTILS_H #define TAUREC_TAUJETRNNUTILS_H -#include <unordered_map> +#include "xAODTau/TauJet.h" +#include "xAODCaloEvent/CaloVertexedTopoCluster.h" #include "AsgMessaging/AsgMessaging.h" -#include "xAODTau/TauJet.h" +#include <unordered_map> namespace TauJetRNNUtils { @@ -34,7 +35,7 @@ public: double &); using ClusterCalc = bool (*)(const xAOD::TauJet &, - const xAOD::CaloCluster &, double &); + const xAOD::CaloVertexedTopoCluster &, double &); public: VarCalc(); @@ -52,7 +53,7 @@ public: // Computes cluster variables bool compute(const std::string &name, const xAOD::TauJet &tau, - const std::vector<const xAOD::CaloCluster *> &clusters, + const std::vector<xAOD::CaloVertexedTopoCluster> &clusters, std::vector<double> &out) const; // Methods to insert calculator functions into the lookup table @@ -176,29 +177,29 @@ namespace Cluster { // Returns a status code indicating success bool et_log( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); bool pt_jetseed_log( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); bool dEta( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); bool dPhi( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); bool SECOND_R( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); bool SECOND_LAMBDA( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); bool CENTER_LAMBDA( - const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); + const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); -bool SECOND_LAMBDAOverClustersMeanSecondLambda (const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); -bool CENTER_LAMBDAOverClustersMeanCenterLambda (const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); -bool FirstEngDensOverClustersMeanFirstEngDens (const xAOD::TauJet &tau, const xAOD::CaloCluster &cluster, double &out); +bool SECOND_LAMBDAOverClustersMeanSecondLambda (const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); +bool CENTER_LAMBDAOverClustersMeanCenterLambda (const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); +bool FirstEngDensOverClustersMeanFirstEngDens (const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, double &out); } // namespace Cluster } // namespace Variables diff --git a/Reconstruction/tauRecTools/tauRecTools/TauVertexCorrection.h b/Reconstruction/tauRecTools/tauRecTools/TauVertexCorrection.h deleted file mode 100644 index 4b4d53d4bcaedfdfd62923bd825a272d2cc3b34e..0000000000000000000000000000000000000000 --- a/Reconstruction/tauRecTools/tauRecTools/TauVertexCorrection.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TAUVERTEXCORRECTION_H -#define TAUVERTEXCORRECTION_H - -#include "tauRecTools/ITauVertexCorrection.h" - -#include "AsgTools/AsgTool.h" -#include "AsgDataHandles/ReadHandleKey.h" - -/** - * @brief Tool to perform the vertex correction for the tau candidate - * @author Xiaozhong Huang <xiaozhong.huang@cern.ch> - */ - -class TauVertexCorrection : public asg::AsgTool, virtual public ITauVertexCorrection { - -public: - - ASG_TOOL_INTERFACE(TauVertexCorrection) - ASG_TOOL_CLASS1(TauVertexCorrection, ITauVertexCorrection) - - TauVertexCorrection(const std::string& name); - virtual ~TauVertexCorrection() = default; - - virtual StatusCode initialize() override; - - /** Get the jet vertex */ - virtual const xAOD::Vertex* getJetVertex(const xAOD::Jet& jet) const override; - - /** Get the tau axis */ - virtual TLorentzVector getTauAxis(const xAOD::TauJet& tau) const override; - - /**@brief Get the vertex corrected four momentum, the position of - * the tau vertex relative to the jet vertex is used - * @param cluster input cluster - * @param tauVertex the vertex of the tau candidate - * @param jetVertex the vertex of the jet seed - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::CaloCluster& cluster, - const xAOD::Vertex* tauVertex, - const xAOD::Vertex* jetVertex = nullptr) const override; - - /**@brief Get the vertex corrected four momentum, the position of - * the tau vertex relative to the jet vertex is used - * @param pfo input PFO - * @param tauVertex the vertex of the tau candidate - * @param jetVertex the vertex of the jet seed - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::PFO& pfo, - const xAOD::Vertex* tauVertex, - const xAOD::Vertex* jetVertex = nullptr) const override; - - /**@brief Get the vertex corrected four momentum, the position of - * the tau vertex relative to the jet vertex is used - * @param constituent input constituent - * @param tauVertex the vertex of the tau candiate - * @param jetVertex the vertex of the jet seed - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::JetConstituent& constituent, - const xAOD::Vertex* tauVertex, - const xAOD::Vertex* jetVertex = nullptr) const override; - -private: - - /**@brief Get the vertex corrected four momentum - * @param cluster input cluster - * @param position position of the vertex - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::CaloCluster& cluster, - const Amg::Vector3D& position) const override; - - /**@brief Get the vertex corrected four momentum - * @param pfo input PFO - * @param position position of the vertex - */ - virtual TLorentzVector getVertexCorrectedP4(const xAOD::PFO& pfo, - const Amg::Vector3D& position) const override; - - /// Name of the seed jet - std::string m_seedJet; - - /// Switch of the tau vertex correction - bool m_doVertexCorrection; - - /// Switch of the jet vertex correction - bool m_doJetVertexCorrection; - - /// Whehter the seed jet is PFO - bool m_isPFO = false; //! - - /// Calibration state of cluster - xAOD::CaloCluster::State m_clusterState; //! - -}; - -#endif // ITAUVERTEXCORRECTION_H diff --git a/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx b/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx index 7e3dc1fe2b1d1b7da30c44fbffd81400ef719b9d..ba4f942d286990c8ff23d856053fdbbc7197f581 100644 --- a/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx +++ b/Simulation/FastShower/FastCaloSim/src/FastShowerCellBuilderTool.cxx @@ -2017,7 +2017,9 @@ FastShowerCellBuilderTool::flag_simul_sate FastShowerCellBuilderTool::Is_below_v int nin=0; int id_in=0; #ifdef HEPMC3 - for(auto par_in:ver->particles_in()) { + HepMC::ConstGenParticlePtr par_in; + for(auto pin:ver->particles_in()) { + par_in=pin; #else const HepMC::GenParticle* par_in=0; for(HepMC::GenVertex::particles_in_const_iterator pin=ver->particles_in_const_begin();pin!=ver->particles_in_const_end();++pin) { diff --git a/Simulation/G4Extensions/G4ExternalDecay/src/Pythia8ForDecays.cxx b/Simulation/G4Extensions/G4ExternalDecay/src/Pythia8ForDecays.cxx index d30a0e9e8c83bd2e490890964f2796f66eac39d7..c5173dcb754dd5d7b1fa06e61256355d82569f5c 100644 --- a/Simulation/G4Extensions/G4ExternalDecay/src/Pythia8ForDecays.cxx +++ b/Simulation/G4Extensions/G4ExternalDecay/src/Pythia8ForDecays.cxx @@ -22,7 +22,7 @@ #include "G4ParticleTable.hh" #include "G4ThreeVector.hh" #include "TLorentzVector.h" -#include "MCUtils/HepMCUtils.h" +#include "MCUtils/PIDUtils.h" // STL includes #include <cstdlib> diff --git a/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt b/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt index 74a442533079bbd493085f2ae2ff656dbeb2d840..3b44b7594648654a22ebfed7056382195f69df8a 100644 --- a/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt +++ b/Simulation/G4Utilities/TrackWriteFastSim/CMakeLists.txt @@ -25,5 +25,5 @@ atlas_add_component( TrackWriteFastSim LINK_LIBRARIES TrackWriteFastSimLib ) # 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/G4Utilities/TrackWriteFastSim/python/TrackWriteFastSimConfig.py b/Simulation/G4Utilities/TrackWriteFastSim/python/TrackWriteFastSimConfig.py index 87729ffc05f6547013e30f81407a6890b08f083c..1adc67daca308365b11d1c62a8e5a577c86ea21e 100644 --- a/Simulation/G4Utilities/TrackWriteFastSim/python/TrackWriteFastSimConfig.py +++ b/Simulation/G4Utilities/TrackWriteFastSim/python/TrackWriteFastSimConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon import CfgMgr def getTrackFastSimSD(name='TrackFastSimSD', **kwargs): @@ -34,4 +34,4 @@ def getMuonEntryRecordSD(name="MuonEntryRecord", **kwargs): kwargs.setdefault("LogicalVolumeNames", ['MSEL']) kwargs.setdefault("SD_type", 1) kwargs.setdefault ('OutputCollectionNames', ['MuonEntryRecord']) - return getTrackRecorderSD(name, **kwargs) + return CfgMgr.TrackRecorderSDTool(name, **kwargs) diff --git a/Simulation/HitManagement/HitManagement/AthenaHitsVector.h b/Simulation/HitManagement/HitManagement/AthenaHitsVector.h index 03a3f423ec4794bddd307f5052a8850d6ae4c0d0..11467348ff85bad4b2109785e13646052b97c12a 100755 --- a/Simulation/HitManagement/HitManagement/AthenaHitsVector.h +++ b/Simulation/HitManagement/HitManagement/AthenaHitsVector.h @@ -47,11 +47,11 @@ public: // // default constructor for rootcint #ifdef __CINT__ - AthenaHitsVector<T>( ) {} + AthenaHitsVector( ) {} // // methods not provided to rootcint #else - AthenaHitsVector<T>(const std::string& collectionName="DefaultCollectionName") + AthenaHitsVector(const std::string& collectionName="DefaultCollectionName") { IMessageSvc* msgSvc(Athena::getMessageSvc()); MsgStream log(msgSvc, "AthenaHitsVector"); @@ -59,7 +59,7 @@ public: m_name = collectionName; } - ~AthenaHitsVector<T> () {Clear();} + ~AthenaHitsVector () {Clear();} void Clear() { for (unsigned int i=0;i<m_hitvector.size();i++) diff --git a/Simulation/HitManagement/HitManagement/AtlasHitsVector.h b/Simulation/HitManagement/HitManagement/AtlasHitsVector.h index f355c4ca76c9807b9028d1b1d2e66083c9f9a27e..ac2d34972ce3b6ba8de447cb843d3e7af8074460 100755 --- a/Simulation/HitManagement/HitManagement/AtlasHitsVector.h +++ b/Simulation/HitManagement/HitManagement/AtlasHitsVector.h @@ -48,11 +48,11 @@ public: // // default constructor for rootcint #ifdef __CINT__ - AtlasHitsVector<T>( ) {} + AtlasHitsVector( ) {} // // methods not provided to rootcint #else - AtlasHitsVector<T>(std::string collectionName="DefaultCollectionName", const unsigned int mySize=100) + AtlasHitsVector(std::string collectionName="DefaultCollectionName", const unsigned int mySize=100) { IMessageSvc* msgSvc(Athena::getMessageSvc()); MsgStream log(msgSvc, "AtlasHitsVector"); @@ -62,7 +62,7 @@ public: m_hitvector.reserve(mySize); } - ~AtlasHitsVector<T> () { + ~AtlasHitsVector () { std::vector<T>().swap(m_hitvector); } void Clear() diff --git a/Simulation/ISF/ISF_Config/python/FlagSetters.py b/Simulation/ISF/ISF_Config/python/FlagSetters.py index c2fb89fd70f340254507324053fe8bafd2cc4b49..747c38ea6d185f5bb2287117d7f26471eb0a8f61 100644 --- a/Simulation/ISF/ISF_Config/python/FlagSetters.py +++ b/Simulation/ISF/ISF_Config/python/FlagSetters.py @@ -162,6 +162,11 @@ def configureFlagsG4FastCaloMT(): ISF_Flags.ParticleBroker = "" from G4AtlasApps.SimFlags import simFlags simFlags.SimulationFlavour = "G4FastCaloMT" + +def configureFlagsG4FastCalo_QS(): + configureFlagsATLFASTII() + from G4AtlasApps.SimFlags import simFlags + simFlags.SimulationFlavour = "G4FastCalo_QS" return def configureFlagsG4FastCaloTest(): diff --git a/Simulation/ISF/ISF_Config/python/ISF_ConfigConfigDb.py b/Simulation/ISF/ISF_Config/python/ISF_ConfigConfigDb.py index b03981093b62c3a36d9f5171a8d24586ecfeba10..dad481d6a31fa44a0857ceaa8685284462e789b3 100644 --- a/Simulation/ISF/ISF_Config/python/ISF_ConfigConfigDb.py +++ b/Simulation/ISF/ISF_Config/python/ISF_ConfigConfigDb.py @@ -47,6 +47,7 @@ addAlgorithm("ISF_Config.ISF_MainConfig.getKernel_G4HS_FastPileup", "ISF_Ker addAlgorithm("ISF_Config.ISF_MainConfig.getKernel_ATLFASTIIF_IDOnly", "ISF_Kernel_ATLFASTIIF_IDOnly") addAlgorithm("ISF_Config.ISF_MainConfig.getKernel_ATLFASTIIF_IDCalo", "ISF_Kernel_ATLFASTIIF_IDCalo") addAlgorithm("ISF_Config.ISF_MainConfig.getKernel_G4FastCalo", "ISF_Kernel_G4FastCalo") +addAlgorithm("ISF_Config.ISF_MainConfig.getKernel_G4FastCalo_QS", "ISF_Kernel_G4FastCalo_QS") addAlgorithm("ISF_Config.ISF_MainConfig.getKernel_G4FastCaloTest", "ISF_Kernel_G4FastCaloTest") addAlgorithm("ISF_Config.ISF_MainConfig.getKernel_G4FastCaloDNN", "ISF_Kernel_G4FastCaloDNN") addAlgorithm("ISF_Config.ISF_MainConfig.getKernel_G4FastCaloMT", "ISF_Kernel_G4FastCaloMT") diff --git a/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py b/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py index bfde6ee01929ea9160092eeec6c44597e936b57e..24c76f5f5765ec7fd60b6e4ab670a30d0b2aa5e0 100644 --- a/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py +++ b/Simulation/ISF/ISF_Config/python/ISF_MainConfig.py @@ -398,6 +398,28 @@ def getKernel_G4FastCaloMT(name="ISF_Kernel_G4FastCaloMT", **kwargs): simFlags.SimulationFlavour = "G4FastCalo" return getKernel_GenericSimulatorMT(name, **kwargs) +############## Simulator: G4FastCalo_QS ############### +def getKernel_G4FastCalo_QS(name="ISF_Kernel_G4FastCalo_QS", **kwargs): + kwargs.setdefault("ParticleBroker" , 'ISF_AFIIParticleBrokerSvc' ) + + kwargs.setdefault("BeamPipeSimulationSelectors", [ 'ISF_DefaultAFII_QS_Geant4Selector' ] ) + kwargs.setdefault("IDSimulationSelectors" , [ 'ISF_DefaultAFII_QS_Geant4Selector' ] ) + kwargs.setdefault("CaloSimulationSelectors" , [ 'ISF_MuonAFII_QS_Geant4Selector', + 'ISF_EtaGreater5ParticleKillerSimSelector', + 'ISF_PionG4FastCalo_QS_Geant4Selector', + 'ISF_ProtonG4FastCalo_QS_Geant4Selector', + 'ISF_NeutronG4FastCalo_QS_Geant4Selector', + 'ISF_ChargedKaonG4FastCalo_QS_Geant4Selector', + 'ISF_KLongG4FastCalo_QS_Geant4Selector', + 'ISF_DefaultFastCaloSimV2Selector' ] ) + kwargs.setdefault("MSSimulationSelectors" , [ 'ISF_DefaultAFII_QS_Geant4Selector' ] ) + kwargs.setdefault("CavernSimulationSelectors" , [ 'ISF_DefaultParticleKillerSelector' ] ) + kwargs.setdefault("InputConverter" , 'ISF_LongLivedInputConverter' ) + kwargs.setdefault("QuasiStablePatcher" , 'ZeroLifetimePositioner' ) + from G4AtlasApps.SimFlags import simFlags + simFlags.SimulationFlavour = "G4FastCalo_QS" + return getKernel_GenericSimulator(name, **kwargs) + ############## Simulator: G4FastCaloTest ############### def getKernel_G4FastCaloTest(name="ISF_Kernel_G4FastCaloTest", **kwargs): kwargs.setdefault("ParticleBroker" , 'ISF_AFIIParticleBrokerSvc') diff --git a/Simulation/ISF/ISF_Example/CMakeLists.txt b/Simulation/ISF/ISF_Example/CMakeLists.txt index 4cc8cd3a72fd906df2d9e47e0645cf53e4dbcff9..6907e43b736602956773adb4eec50e0ded509586 100644 --- a/Simulation/ISF/ISF_Example/CMakeLists.txt +++ b/Simulation/ISF/ISF_Example/CMakeLists.txt @@ -6,7 +6,4 @@ atlas_subdir( ISF_Example ) # Install files from the package: -atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/*.py ) -atlas_install_scripts( scripts/*.py ) - +atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Simulation/ISF/ISF_Example/python/ISF_Input.py b/Simulation/ISF/ISF_Example/python/ISF_Input.py index af474d2145b0a3ab29ea224e592d8956787a3415..0cec7235eff1da55bc1c37e8c40041081c9cc474 100644 --- a/Simulation/ISF/ISF_Example/python/ISF_Input.py +++ b/Simulation/ISF/ISF_Example/python/ISF_Input.py @@ -1,8 +1,8 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## Get the logger -from AthenaCommon.Logging import * +from AthenaCommon.Logging import logging isfiplog = logging.getLogger('ISF_Input') # almost all the contents of this file is stolen diff --git a/Simulation/ISF/ISF_Example/python/ISF_Metadata.py b/Simulation/ISF/ISF_Example/python/ISF_Metadata.py index edf54bc2aa9b46a6f70fbf7ebd0ea773be9fd95b..c4eade3480317e7fd07046685cfddbce02c33355 100644 --- a/Simulation/ISF/ISF_Example/python/ISF_Metadata.py +++ b/Simulation/ISF/ISF_Example/python/ISF_Metadata.py @@ -1,9 +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 ### This module contains functions which may need to peek at the input file metadata +import os ## Get the logger -from AthenaCommon.Logging import * +from AthenaCommon.Logging import logging simMDlog = logging.getLogger('Sim_Metadata') def get_metadata(mode='lite'): @@ -19,7 +20,7 @@ def get_metadata(mode='lite'): metadata = read_metadata(input_file, mode = mode) metadata = metadata[input_file] # promote all keys one level up return metadata - except: + except Exception: simMDlog.warning("MetaReader failed to open %s", athenaCommonFlags.PoolEvgenInput()[0]) else: simMDlog.info("G4ATLAS_SKIPFILEPEEK environment variable present, so skipping all input file peeking.") @@ -59,7 +60,7 @@ def patch_mc_channel_numberMetadata(addToFile=True): simMDlog.warning("No mc_channel_number in input file metadata. Using run number.") mc_channel_number = metadata_lite['runNumbers'] if addToFile: - simMDlog.info('Adding mc_channel_number to \TagInfo: %s', str(mc_channel_number)) + simMDlog.info('Adding mc_channel_number to TagInfo: %s', str(mc_channel_number)) # Initialize tag info management #import EventInfoMgt.EventInfoMgtInit from AthenaCommon.AppMgr import ServiceMgr @@ -134,8 +135,8 @@ def fillAtlasMetadata(dbFiller): import os dbFiller.addSimParam('G4Version', str(os.environ['G4VERS'])) dbFiller.addSimParam('RunType', 'atlas') - from AthenaCommon.BeamFlags import jobproperties - dbFiller.addSimParam('beamType', jobproperties.Beam.beamType.get_Value()) + from AthenaCommon.BeamFlags import beamFlags + dbFiller.addSimParam('beamType', beamFlags.beamType.get_Value()) ## Simulated detector flags: add each enabled detector to the simulatedDetectors list from AthenaCommon.DetFlags import DetFlags @@ -157,6 +158,7 @@ def fillTestBeamMetadata(dbFiller): SimParams = ['CalibrationRun','DoLArBirk','LArParameterization', 'MagneticField','PhysicsList','Seeds','SeedsG4','SimLayout', 'WorldZRange','NeutronTimeCut','NeutronEnergyCut','ApplyEMCuts','RunNumber'] + from G4AtlasApps.SimFlags import simFlags for o in [ o for o in SimParams if simFlags.__dict__.keys().__contains__(o) ]: testValue = 'default' if (simFlags.__dict__.__contains__(o) and simFlags.__dict__.get(o).statusOn) : @@ -171,7 +173,8 @@ def fillTestBeamMetadata(dbFiller): dbFiller.addSimParam('EtaPhiStatus', 'default') dbFiller.addSimParam('VRangeStatus', 'default') dbFiller.addSimParam('G4Version', str(os.environ['G4VERS'])) - dbFiller.addSimParam('beamType',jobproperties.Beam.beamType.get_Value()) + from AthenaCommon.BeamFlags import beamFlags + dbFiller.addSimParam('beamType',beamFlags.beamType.get_Value()) ####### Hard coded simulation hit file magic number (for major changes) ###### dbFiller.addSimParam('hitFileMagicNumber','0') @@ -179,7 +182,7 @@ def fillTestBeamMetadata(dbFiller): def fillISFMetadata(dbFiller): from ISF_Config.ISF_jobProperties import ISF_Flags dbFiller.addSimParam('Simulator', ISF_Flags.Simulator()) - if ISF_Flags.Simulator() in ['G4FastCalo', 'G4FastCaloTest', 'G4FastCaloDNN']: + if ISF_Flags.Simulator() in ['G4FastCalo', 'G4FastCaloTest', 'G4FastCaloDNN', 'G4FastCalo_QS']: from ISF_FastCaloSimServices.ISF_FastCaloSimJobProperties import ISF_FastCaloSimFlags dbFiller.addSimParam('FCSParamFile', ISF_FastCaloSimFlags.ParamsInputFilename()) @@ -189,7 +192,6 @@ def createSimulationParametersMetadata(): ## Set run numbers minrunnum = 0 maxrunnum = 2147483647 # MAX - from AthenaCommon.AthenaCommonFlags import athenaCommonFlags from G4AtlasApps.SimFlags import simFlags if hasattr(simFlags, 'RunNumber') and simFlags.RunNumber.statusOn: minrunnum = simFlags.RunNumber() @@ -203,7 +205,7 @@ def createSimulationParametersMetadata(): raise Exception('IllegalRunNumber') else: simMDlog.info('Skipping run number setting - would need to set simFlags.RunNumber for this.') - simMDlog.info("Using the following run number range for MetaData IOV: ("+str(minrunnum)+","+str(maxrunnum)+").") + simMDlog.info("Using the following run number range for MetaData IOV: (%s,%s).", str(minrunnum), str(maxrunnum) ) dbFiller.setBeginRun(minrunnum) dbFiller.setEndRun(maxrunnum) @@ -215,7 +217,7 @@ def createSimulationParametersMetadata(): dbFiller.genSimDb() folder = "/Simulation/Parameters" dbConnection = "sqlite://;schema=SimParams.db;dbname=SIMPARAM" - import IOVDbSvc.IOVDb + import IOVDbSvc.IOVDb # noqa : F401 from AthenaCommon.AppMgr import ServiceMgr ServiceMgr.IOVDbSvc.Folders += [ folder + "<dbConnection>" + dbConnection + "</dbConnection>" ] ServiceMgr.IOVDbSvc.FoldersToMetaData += [folder] @@ -225,25 +227,24 @@ def createTBSimulationParametersMetadata(): from IOVDbMetaDataTools import ParameterDbFiller dbFiller = ParameterDbFiller.ParameterDbFiller() ## Set run numbers - minrunnum = 0 - maxrunnum = 2147483647 # MAX - from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + minRunNumber = 0 + maxRunNumber = 2147483647 # MAX from G4AtlasApps.SimFlags import simFlags if hasattr(simFlags, 'RunNumber') and simFlags.RunNumber.statusOn: - minrunnum = simFlags.RunNumber() - ## FIXME need to use maxrunnum = 2147483647 for now to keep overlay working but in the future this should be set properly. - #maxrunnum = minrunnum + 1 + minRunNumber = simFlags.RunNumber() + ## FIXME need to use maxRunNumber = 2147483647 for now to keep overlay working but in the future this should be set properly. + #maxRunNumber = minRunNumber + 1 elif metadata_lite is not None: if len(metadata_lite['runNumbers']) > 0: - minrunnum = metadata_lite['runNumbers'][0] - maxrunnum = minrunnum + 1 + minRunNumber = metadata_lite['runNumbers'][0] + maxRunNumber = minRunNumber + 1 else: raise Exception('IllegalRunNumber') else: simMDlog.info('Skipping run number setting - would need to set simFlags.RunNumber for this.') - simMDlog.info("Using the following run number range for MetaData IOV: ("+str(minrunnum)+","+str(maxrunnum)+").") - dbFiller.setBeginRun(myMinRunNumber) - dbFiller.setEndRun(myMaxRunNumber) + simMDlog.info("Using the following run number range for MetaData IOV: (%s,%s).", str(minRunNumber), str(maxRunNumber) ) + dbFiller.setBeginRun(minRunNumber) + dbFiller.setEndRun(maxRunNumber) fillTestBeamMetadata(dbFiller) if simFlags.ISFRun: @@ -253,7 +254,7 @@ def createTBSimulationParametersMetadata(): dbFiller.genSimDb() folder = "/Simulation/Parameters" dbConnection = "sqlite://;schema=SimParams.db;dbname=SIMPARAM" - import IOVDbSvc.IOVDb + import IOVDbSvc.IOVDb # noqa : F401 from AthenaCommon.AppMgr import ServiceMgr ServiceMgr.IOVDbSvc.Folders += [ folder + "<dbConnection>" + dbConnection + "</dbConnection>" ] ServiceMgr.IOVDbSvc.FoldersToMetaData += [folder] @@ -268,7 +269,7 @@ def configureRunNumberOverrides(): from G4AtlasApps.SimFlags import simFlags if hasattr(simFlags, "RunNumber") and simFlags.RunNumber.statusOn: myRunNumber = simFlags.RunNumber.get_Value() - simMDlog.info('Found run number %d in sim flags.' % myRunNumber) + simMDlog.info('Found run number %d in sim flags.', myRunNumber) ## Set event selector details based on evgen metadata ######update the run/event info for each event @@ -295,7 +296,7 @@ def configureRunNumberOverrides(): from RunDependentSimComps.RunDMCFlags import runDMCFlags myInitialTimeStamp = runDMCFlags.RunToTimestampDict.getTimestampForRun(myRunNumber) #print "FOUND TIMESTAMP ", str(myInitialTimeStamp) - except: + except Exception: myInitialTimeStamp = 1 ServiceMgr.EvtIdModifierSvc.add_modifier(run_nbr=myRunNumber, lbk_nbr=myFirstLB, time_stamp=myInitialTimeStamp, nevts=totalNumber) if hasattr(ServiceMgr.EventSelector,'OverrideRunNumberFromInput'): ServiceMgr.EventSelector.OverrideRunNumberFromInput = True @@ -303,7 +304,7 @@ def configureRunNumberOverrides(): ## Get evgen run number and lumi block if len(metadata_lite['runNumbers']) > 0: myRunNumber = metadata_lite['runNumbers'][0] - simMDlog.info('Found run number %d in hits file metadata.'% myRunNumber) + simMDlog.info('Found run number %d in hits file metadata.', myRunNumber) else: simMDlog.warning('Failed to find run number in hits file metadata.') if metadata_lite['lumiBlockNumbers']: diff --git a/Simulation/ISF/ISF_Example/python/ISF_Output.py b/Simulation/ISF/ISF_Example/python/ISF_Output.py index 2c8900261957d77139f4b9dc3089bf0570d162b1..c0d45d60159a5d46e5b4541afb01ccf301656efa 100644 --- a/Simulation/ISF/ISF_Example/python/ISF_Output.py +++ b/Simulation/ISF/ISF_Example/python/ISF_Output.py @@ -1,8 +1,8 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## Get the logger -from AthenaCommon.Logging import * +from AthenaCommon.Logging import logging isfoplog = logging.getLogger('ISF_Output') def getHITSStreamItemList(): diff --git a/Simulation/ISF/ISF_Example/scripts/isf_simu.py b/Simulation/ISF/ISF_Example/scripts/isf_simu.py deleted file mode 100755 index 065e517571f5bf6973c89d23f641e97ead31c700..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Example/scripts/isf_simu.py +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -#File name: isf_sim.py -#Author:Bo Liu <boliu@cern.ch> - -import os,sys -from optparse import OptionParser -###Options from command line -parser=OptionParser() - -parser.add_option("--jobtype",dest="jobtype",help="Option for Job type,\n alternative:ATLFASTII(default),Simu,Merge,DigiMRec,ISF,ISF_sim",default="ATLFASTII") -parser.add_option("--eventtype",dest="eventtype",help="option for event type,\n alternative:ttbar(default),electron,muon,pion,minbias",default="ttbar") - -parser.add_option("--EvtMax",dest="EvtMax",help="options for Max Event Number(default:5)",default=5) -parser.add_option("--skipEvents",dest="skipEvents",help="options for skip Event(default:0)",default=0) -parser.add_option("--Histfile",dest="Histfile",help="options for Monitoring hist file",default="HIST.root") -(options,args)=parser.parse_args() -jobtype=options.jobtype -eventtype=options.eventtype -EvtMax=int(options.EvtMax) -skipEvents=int(options.skipEvents) -Histfile=options.Histfile -import random -randomSeed=random.randint(1,100000000) -randomSeed1=random.randint(1,100000000) -randomSeed2=random.randint(1,100000000) -if jobtype.find("ISF")!=-1: - Hitsfile_digi="Hits.pool.root" -else: - Hitsfile_digi="Merge.pool.root" - -pwd=os.getcwd() - - - -###definition of command### -def setcommand(commandtype): - if commandtype=="Simu": - Simu_command='''AtlasG4_trf.py conditionsTag=OFLCOND-MC12-SIM-00 geometryVersion=ATLAS-GEO-20-00-01 randomSeed=%d maxEvents=%d inputEvgenFile=%s outputHitsFile=Hits.pool.root physicsList=QGSP_BERT preInclude=SimulationJobOptions/preInclude.MC12_AtlfastII_Hits.py''' % (randomSeed,EvtMax,eventfile) - return Simu_command - elif commandtype=="Merge": - Merge_command='''Merging_trf.py inputHitsFile=%s outputHitsFile=Merge.pool.root maxEvents=%d skipEvents=%d geometryVersion=ATLAS-GEO-20-00-01 conditionsTag=OFLCOND-MC12-SIM-00 inputLogsFile=NONE preInclude=FastSimulationJobTransforms/jobConfig.v14_Parametrisation.py,FastCaloSimHit/preInclude.AF2Hit.py postInclude=FastCaloSimHit/postInclude.AF2FilterHitItems.py,FastSimulationJobTransforms/jobConfig.FastCaloSim_ID_cuts.py,FastSimulationJobTransforms/jobConfig.egamma_lateral_shape_tuning.config19.py,G4AtlasTests/postInclude.DCubeTest.py postExec='from AthenaCommon.AppMgr import ServiceMgr as svcMgr;svcMgr.MessageSvc.setError+=["AtDSFMTGenSvc"]' '''% (Hitsfile,EvtMax,skipEvents,) - return Merge_command - elif commandtype=="DigiMRec": - DigiMRec_command='''DigiMReco_trf.py inputHitsFile=%s outputESDFile=ESO.pool.root outputAODFile=AOD.pool.root outputHISTFile=%s outputRDOFile=ttbar_AtlfastII_RDO_50.pool.root maxEvents=%d preInclude_h2r=SimulationJobOptions/preInclude.PileUpBunchTrains2011Config8_DigitConfig.py,RunDependentSimData/configLumi_mc12_v1.py postInclude_h2r=FastSimulationJobTransforms/postInclude.AF2DigiSetContainerNames.py preExec_h2r='from Digitization.DigitizationFlags import digitizationFlags;digitizationFlags.overrideMetadata+=["SimLayout","PhysicsList"]' postExec_h2r='ToolSvc.LArAutoCorrTotalToolDefault.NMinBias=0' preExec_r2e='rec.Commissioning.set_Value_and_Lock(True);jobproperties.Beam.energy.set_Value_and_Lock(3500*Units.GeV);muonRecFlags.writeSDOs=True;from CaloRec.CaloCellFlags import jobproperties;jobproperties.CaloCellFlags.doLArCellEmMisCalib=False' preExec_e2a='TriggerFlags.AODEDMSet="AODSLIM";rec.Commissioning.set_Value_and_Lock(True);jobproperties.Beam.energy.set_Value_and_Lock(3500*Units.GeV);muonRecFlags.writeSDOs=True' RunNumber=158127 autoConfiguration=everything conditionsTag=OFLCOND-MC12-AFII-07 geometryVersion=ATLAS-GEO-20-00-01 numberOfCavernBkg=0 DataRunNumber=-1 jobNumber=%d digiSeedOffset1=%d digiSeedOffset2=%d digiRndmSvc=AtDSFMTGenSvc cavernHitsFile=%s ''' % (Hitsfile_digi,Histfile,EvtMax,EvtMax,randomSeed1,randomSeed2,Hitsfile_digi) - return DigiMRec_command - elif commandtype=="ISF_sim": - ISF_sim_command='''athena.py -c 'EvtMax=%d;Simulator="ATLFASTII";Input="%s"' ISF_Example/jobOptions_ConfGetter.py''' % (EvtMax,eventtype) - return ISF_sim_command - -####Check the existence of File### -def checkfile(filename): - if os.path.exists(pwd+"/"+filename): - print "File exist in this directory." - return 1 - else: - print "File does not exist in this directory" - return 0 - -###Add EOS prefix### -def addeos(filename): - argv=pwd.split('/') - postfix='/'.join(argv[-4:]) - middle='/'.join(argv[-8:-5]) - prefix="root://eosatlas.cern.ch//eos/atlas/atlascerngroupdisk/proj-sit/rtt/prod" - path=prefix+'/'+middle+'/'+postfix+'/'+filename - return path - - -###Run Job### -###main### -if __name__ =="__main__": - if options.jobtype=="ATLFASTII": - if options.eventtype=="ttbar": - print "Run %s with %s" % (options.jobtype,options.eventtype) - eventfile="/afs/cern.ch/atlas/offline/ProdData/16.6.X/16.6.7.Y/ttbar_muplusjets-pythia6-7000.evgen.pool.root" - simu_command=setcommand("Simu") - log_Simu=os.system(simu_command) - if log_Simu!=0: - print "Error, Simulation job failed." - sys.exit(1) - else: - if checkfile("Hits.pool.root")==1: - Hitsfile="Hits.pool.root" - else: - Hitsfile=addeos("Hits.pool.root") - merge_command=setcommand("Merge") - log_Merge=os.system(merge_command) - if log_Merge!=0: - print "Error,Merge job failed." - sys.exit(1) - else: - os.system("mv truth.root ATLFASTII_sim_ttbar.truth.root") - if checkfile("Merge.pool.root")==1: - Hitsfile_digi="Merge.pool.root" - else: - Hitsfile_digi=addeos("Merge.pool.root") - digi_command=setcommand("DigiMRec") - log_DigiMRec=os.system(digi_command) - if log_DigiMRec!=0: - print "Error,Digi and Reco job failed." - sys.exit(1) - else: - print "All Jobs run Ok" - sys.exit() - - -# print simu_command -# print merge_command -# print digi_command - elif options.jobtype=="Simu": - print options.jobtype -# log_Simu=os.system(Simu_command) - elif options.jobtype=="Merge": - print options.jobtype -# log_Merge=os.system(Merge_command) - elif options.jobtype=="DigiMRec": - print options.jobtype -# log_DigiMRec=os.system(DigiMRec_command) - elif options.jobtype=="ISF": - print options.jobtype - isf_command=setcommand("ISF_sim") - log_ISF_sim=os.system(isf_command) - if log_ISF_sim!=0: - print "Error,ISF Simulation job failed" - sys.exit(1) - else: - if checkfile("Hits.pool.root")==1: - Hitsfile_digi="Hits.pool.root" - else: - Hitsfile_digi=addeos("Hits.pool.root") - digi_command=setcommand("DigiMRec") - log_DigiMRec=os.system(digi_command) - if log_DigiMRec!=0: - print "Error,ISF Digi and Reco job failed" - sys.exit(1) - else: - print "All Jobs run Ok" - sys.exit() - - - elif options.jobtype=="ISF_sim": - print options.jobtype - # log_ISF_sim=os.system("ISF_sim_command") diff --git a/Simulation/ISF/ISF_Example/scripts/isf_test.py b/Simulation/ISF/ISF_Example/scripts/isf_test.py deleted file mode 100755 index b2c0cda03591a2eca4fd917aa76b5a3f0f0f022e..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Example/scripts/isf_test.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -#File name: isf_test.py -#Author:Bo Liu <boliu@cern.ch> - -import os,sys - -from optparse import OptionParser -parser=OptionParser() -parser.add_option("--jobs",dest="jobs",help="Option for compare jobs, Add with full job name,seperate with comma") -parser.add_option("--referencefile=",dest="referencefile",help="Options for referencefiles,seperate with comma",default="") -parser.add_option("--chain",dest="chain",help="Option for chain name") -parser.add_option("--tag",dest="tag",help="tag for stored file",default="") - -(options,args)=parser.parse_args() - -jobs=options.jobs -referencefile=options.referencefile -chain=options.chain -tag=options.tag - -pwd=os.getcwd() -###Add chain directory### -def addchain(current,chain_name): -## current=os.getcwd() - print current - chain_store_prefix="/afs/cern.ch/atlas/project/RTT/prod/Results/rtt/chainstore" -## chain_store_prefix="/afs/cern.ch/work/b/boliu/testarea/ISF_Test/Results/rtt/chainstore" - chain_store_postfix="AtlasProduction/Simulation/ISF/" - argv=current.split('/') - middle_list=[] - middle_list.append(argv[-6]) - middle_list.append(argv[-4]) - middle='/'.join(middle_list) - chain_store_path=chain_store_prefix+'/'+middle+'/'+chain_store_postfix+argv[-2]+'/'+chain_name - return chain_store_path -###copy file from chainstore###(For monitoring .root file from Reconstruction) -def copy_from_chainstore(current_path,Chain_Name,filename,posttag): -# current_path=os.getcwd() - print current_path - num_file=0 - chain_store_path=addchain(current_path,Chain_Name) - for f in os.listdir(chain_store_path): - if f==filename: - if posttag=="": - cmd="cp %s/%s %s" % (chain_store_path,filename,filename) - else: - cmd="cp %s/%s %s.%s" % (chain_store_path,filename,posttag,filename) - print cmd - num_file=num_file+1 - os.system(cmd) - if num_file==1: - print "Copy %s from %s successfully." % (filename,chain_store_path) - else: - print "Can not find file %s in this store." % (filename,) -###copy file###(For some small .root file) -def copyfile(current,jobname,filename,posttag): - # current=os.getcwd() - - print current - argv=current.split('/') - argv.pop() - argv.append(jobname) - store_path='/'.join(argv) - num_file=0 - for f in os.listdir(store_path): - if f==filename: - if posttag=="": - cmd="cp %s/%s %s" % (store_path,filename,filename) - else: - cmd="cp %s/%s %s.%s" % (store_path,filename,posttag,filename) - print cmd - num_file=num_file+1 - os.system(cmd) - if num_file==1: - print "Copy file %s successfully." % (filename,) - return True - else: - print "Can not find file %s in this store." % (filename,) - return False -##main### -if __name__ =="__main__": - pwd=os.getcwd() - if os.environ.has_key('LS_SUBCWD'): - pwd=os.environ['LS_SUBCWD'] - print pwd - - referencelist=referencefile.split(',') - print referencelist - joblist=jobs.split(',') - print joblist - -### search referencefile in jobname subdirectory at first, if can not find it, copy it from chainstore - for rf in referencelist: - status=False - for job in joblist: - print "Search referencefile %s in %s subdirectory"%(rf,job) - status=copyfile(pwd,job,rf,tag) - if status==True: - break - if status==False: - print "Search referencefile %s in %s chainstore"%(rf,chain) - copy_from_chainstore(pwd,chain,rf,tag) -### make FileGrepper successful - print "leaving with code 0" - - -# diff --git a/Simulation/ISF/ISF_Example/share/FatrasPhysicsList.py b/Simulation/ISF/ISF_Example/share/FatrasPhysicsList.py deleted file mode 100644 index c092f412eb00cc87421d52bd9e0384a95ff89a83..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Example/share/FatrasPhysicsList.py +++ /dev/null @@ -1,94 +0,0 @@ -# -## @file FatrasExample/python/FatrasPhysicsList.py -## @purpose Python module to hold common flags to configure JobOptions -## - -""" FatrasPhysicsList - Python module to hold storegate keys of InDet objects. - -""" - -__author__ = "A. Salzburger" -__version__= "$Revision: 463109 $" -__doc__ = "FatrasPhysicsList" - -__all__ = [ "FatrasPhysicsList" ] - -# kindly stolen from AthenaCommonFlags from S. Binet and M. Gallas - -##----------------------------------------------------------------------------- -## Import - -from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer -from AthenaCommon.JobProperties import jobproperties - -##----------------------------------------------------------------------------- -## 1st step: define JobProperty classes -class MultipleScattering(JobProperty): - """Steering of multiple scattering in simulation/reconstruction""" - statusOn = True - allowedTypes = ['bool'] - StoredValue = True - -class EnergyLoss(JobProperty): - """Steering of energy loss (ionisation) in simulation/reconstruction""" - statusOn = True - allowedTypes = ['bool'] - StoredValue = True - -class Bremsstrahlung(JobProperty): - """Steering of energy loss (radiative) in simulation""" - statusOn = True - allowedTypes = ['bool'] - StoredValue = True - -class PairProduction(JobProperty): - """Steering of pair production in simulation""" - statusOn = True - allowedTypes = ['bool'] - StoredValue = True - -class HadronicInteraction(JobProperty): - """Steering of nuclear (hadronic) interactions in simulation""" - statusOn = True - allowedTypes = ['bool'] - StoredValue = True - -class ParticleDecay(JobProperty): - """Steering of particle decay in simulation""" - statusOn = True - allowedTypes = ['bool'] - StoredValue = True - -##----------------------------------------------------------------------------- -## 2nd step -## Definition of the InDet flag container -class FatrasPhysicsList(JobPropertyContainer): - """Container for the Fatras physics list flags - """ - pass - - -##----------------------------------------------------------------------------- -## 3rd step -## adding the container to the general top-level container -jobproperties.add_Container(FatrasPhysicsList) - -##----------------------------------------------------------------------------- -## 4th step -## adding ID flags to the InDetKeys container -jobproperties.FatrasPhysicsList.add_JobProperty(MultipleScattering) -jobproperties.FatrasPhysicsList.add_JobProperty(EnergyLoss) -jobproperties.FatrasPhysicsList.add_JobProperty(Bremsstrahlung) -jobproperties.FatrasPhysicsList.add_JobProperty(PairProduction) -jobproperties.FatrasPhysicsList.add_JobProperty(HadronicInteraction) -jobproperties.FatrasPhysicsList.add_JobProperty(ParticleDecay) - -##----------------------------------------------------------------------------- -## 5th step -## short-cut for lazy people -## carefull: do not select FatrasPhysicsList as a short name as well. -## otherwise problems with pickle -## Note: you still have to import it: -## >>> from FatrasExample.FatrasPhysicsList import FatrasPhysicsListFlags -FatrasPhysicsListFlags = jobproperties.FatrasPhysicsList diff --git a/Simulation/ISF/ISF_Example/share/FatrasTuning.py b/Simulation/ISF/ISF_Example/share/FatrasTuning.py deleted file mode 100644 index 580809e44498da9ccc9d615a77860451f7bfcd5c..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Example/share/FatrasTuning.py +++ /dev/null @@ -1,243 +0,0 @@ -# -## @file FatrasExample/python/FatrasTuning.py -## @purpose Python module to hold common flags to configure JobOptions -## - -""" FatrasKeys - Python module to hold storegate keys of InDet objects. - -""" - -__author__ = "A. Salzburger" -__version__= "$Revision: 463109 $" -__doc__ = "FatrasTuning" - -__all__ = [ "FatrasTuning" ] - -# kindly stolen from AthenaCommonFlags from S. Binet and M. Gallas - -##----------------------------------------------------------------------------- -## Import - -from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer -from AthenaCommon.JobProperties import jobproperties - -##----------------------------------------------------------------------------- -## 1st step: define JobProperty classes - -class MinimumParticlePtPrimaryTrackCreation(JobProperty): - """do not simulate primary tracks below this momentum""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 250. - -class MinimumMuonPtTrackCreation(JobProperty): - """Kill the particle when it falls underneath this threshold""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 1000. - -class MinimumParticleMomentum(JobProperty): - """Kill the particle when it falls underneath this threshold""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 50. - - -class MinimumBremPhotonMomentum(JobProperty): - """Follow the photon if it is over threshold""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 150. - -# Conversion Creation: -class InteractionVolumeRadius(JobProperty): - """Volume (r) in which brem photons / had int are processed""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 1200. - -class InteractionVolumeHalfZ(JobProperty): - """Volume (z) in which brem photons / had int are processed""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 4000. - -## ============================================================================ -## Energy Loss through: Bethe-Heitler distribution -class BetheHeitlerScalor(JobProperty): - """Scalor to adapt Bethe-Heitler contribution""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 1. - -## ============================================================================ -## Multiple Scattering: Gaussian mixture model -class GaussianMixtureModel(JobProperty): - """Gaussian mixture model on/off for Multiple Scattering""" - statusOn = True - allowedTypes = ['bool'] - StoredValue = True - -## ============================================================================ -## Conversion Creation: -class ParticleDecayMinChildEnergy(JobProperty): - """minimum child energy from a conversion""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 250. - -## ============================================================================ -## Conversion Creation: -class ConversionMinChildEnergy(JobProperty): - """minimum child energy from a conversion""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 100. - -class ConversionChildEnergyScalor(JobProperty): - """minimum child energy from a conversion""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 2. - -# Conversion Creation: -class ConversionProbabilityScalor(JobProperty): - """Scalor to adapt the conversion probability""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 0.98 - -# Conversion Creation: -class ConversionVolumeRadius(JobProperty): - """Volume (r) in which conversions are created""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 1200. - -class ConversionVolumeHalfZ(JobProperty): - """Volume (z) in which conversions are created""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 4000. - - -## ============================================================================ -## Hadronic interactions: -class HadronicInteractionProbabilityScalor(JobProperty): - """ """ - statusOn = True - allowedTypes = ['float'] - StoredValue = 1. - -## Hadronic interactions: -class HadronicInteractionMinMomentumIn(JobProperty): - """ """ - statusOn = True - allowedTypes = ['float'] - StoredValue = 1000. - -## Hadronic interactions: -class HadronicInteractionMinMomentumOut(JobProperty): - """Volume (z) in which conversions are created""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 200. - - -## ============================================================================ -## Noise Levels -class PixNoiseLevel(JobProperty): - """Pixel overall noise level (fraction of noisy pixels)""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 1e-5 - -class SctNoiseLevel(JobProperty): - """SCT overall noise level (fraction of noisy strips)""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 1e-5 - -class TrtNoiseLevel(JobProperty): - """TRT overall noise level (fraction of noisy straws)""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 0.02 - -class TrtMultiHitFlag(JobProperty): - """Flag how to deal with TRT multiple hits on straw""" - statusOn = True - allowedTypes = ['int'] - StoredValue = 1 - -# Material distortions -class MaterialScalor(JobProperty): - """efficiencies (vs. eta) for the TRT""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 1.00 - -class MaterialDistortionsX0(JobProperty): - """efficiencies (vs. eta) for the TRT""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 0.02 - -# Material distortions -class MaterialDistortionsRho(JobProperty): - """efficiencies (vs. eta) for the TRT""" - statusOn = True - allowedTypes = ['float'] - StoredValue = 0.02 - -##----------------------------------------------------------------------------- -## 2nd step -## Definition of the InDet flag container -class FatrasTuning(JobPropertyContainer): - """Container for the Fatras key flags - """ - pass - - -##----------------------------------------------------------------------------- -## 3rd step -## adding the container to the general top-level container -jobproperties.add_Container(FatrasTuning) - - -##----------------------------------------------------------------------------- -## 4th step -## adding ID flags to the InDetKeys container -jobproperties.FatrasTuning.add_JobProperty(MinimumParticlePtPrimaryTrackCreation) -jobproperties.FatrasTuning.add_JobProperty(MinimumMuonPtTrackCreation) -jobproperties.FatrasTuning.add_JobProperty(MinimumParticleMomentum) -jobproperties.FatrasTuning.add_JobProperty(MinimumBremPhotonMomentum) -jobproperties.FatrasTuning.add_JobProperty(InteractionVolumeRadius) -jobproperties.FatrasTuning.add_JobProperty(InteractionVolumeHalfZ) -jobproperties.FatrasTuning.add_JobProperty(BetheHeitlerScalor) -jobproperties.FatrasTuning.add_JobProperty(GaussianMixtureModel) -jobproperties.FatrasTuning.add_JobProperty(ParticleDecayMinChildEnergy) -jobproperties.FatrasTuning.add_JobProperty(ConversionMinChildEnergy) -jobproperties.FatrasTuning.add_JobProperty(ConversionChildEnergyScalor) -jobproperties.FatrasTuning.add_JobProperty(ConversionProbabilityScalor) -jobproperties.FatrasTuning.add_JobProperty(ConversionVolumeRadius) -jobproperties.FatrasTuning.add_JobProperty(ConversionVolumeHalfZ) -jobproperties.FatrasTuning.add_JobProperty(HadronicInteractionProbabilityScalor) -jobproperties.FatrasTuning.add_JobProperty(HadronicInteractionMinMomentumIn) -jobproperties.FatrasTuning.add_JobProperty(HadronicInteractionMinMomentumOut) -jobproperties.FatrasTuning.add_JobProperty(PixNoiseLevel) -jobproperties.FatrasTuning.add_JobProperty(SctNoiseLevel) -jobproperties.FatrasTuning.add_JobProperty(TrtNoiseLevel) -jobproperties.FatrasTuning.add_JobProperty(TrtMultiHitFlag) -jobproperties.FatrasTuning.add_JobProperty(MaterialScalor) -jobproperties.FatrasTuning.add_JobProperty(MaterialDistortionsX0) -jobproperties.FatrasTuning.add_JobProperty(MaterialDistortionsRho) -##----------------------------------------------------------------------------- -## 5th step -## short-cut for lazy people -## carefull: do not select FatrasKeys as a short name as well. -## otherwise problems with pickle -## Note: you still have to import it: -## >>> from FatrasExample.FatrasTuning import FatrasTuningFlags -FatrasTuningFlags = jobproperties.FatrasTuning diff --git a/Simulation/ISF/ISF_Example/share/FileGrepper.py b/Simulation/ISF/ISF_Example/share/FileGrepper.py deleted file mode 100755 index 966c34d686048458754030b573e09411083d91d3..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Example/share/FileGrepper.py +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env python - -"""FileGrepper - runs fileGrepper.py. RTT Postprocessing class. -vlaidates inputs, calls fileGrepper for each file matching input file pattern. -""" - -###################################################### -# # -# Do NOT bind any objects (self.xxx) which contain # -# file objects (such as self.logger in this class # -# otherwise cannot shelve the objects # -# Instead, unload the necessary variables in from # -# more complicated classes in __init__ # -# # -###################################################### - -import os -import glob - -from ExeRunnerBase import ExeRunnerBase - - -def fixPatterns(pList, pString): - """PList is a list of comma separated strings or '' - pString is a list of strings or ''For - - """ - if not isinstance(pString, list): - if pString: - pString = [pString] - else: - pString = [] - - if not isinstance(pList, list): - if pList: - pList = [pList] - else: - pList = [] - - l = [] - l.extend(pList) - l.extend(pString) - - l = ','.join(l) - l = "'%s'" % l # escape the regexes as will be seen by the shell - - return l - - -class FileGrepper(ExeRunnerBase): - """Grep files with using two lists of regexes""" - - def __init__(self, paramDict): - """Parameters are passed in via a parameter dictionary. - Read these, and use the veto and serach regexes lists - to set up the corresponding matcher objects. These - will find matching lines, and place the results in - a {regex:[line]} dictionary""" - - testIdentifier = paramDict['testIdentifierObj'] - - # find the name of the output file. - # new-style tests: the output file is passed in via an - # optional xml tag. If the tag is missing, the value defaults to ''. - # For old style tests (and new style tests using old style xml tags), - # the name is sometimes passed in using the <arg> tag, with - # <argName>outputFile</argName> as a sub tag. - # - # The old-style name is used preferentially to the new-style name - # to avoid abliging users to change there package files. - # - - outputFile = paramDict['testOutputFile'] # pick up new-style name - try: # use old-style name is present. - outputFile = paramDict['outputFile'] - except: - pass - - ExeRunnerBase.__init__(self, - cmd='', # set in run - testIdentifier=testIdentifier, - outputFile=outputFile) - - # argument passing gone mad.... - - fList = paramDict.get('searchList', '') - fStrings = paramDict.get('searchStrings', '') - self.fPatterns = fixPatterns(fList, fStrings) - - vList = paramDict.get('vetoList', '') - vStrings = paramDict.get('vetoStrings', '') - self.vPatterns = fixPatterns(vList, vStrings) - - nList = paramDict.get('multipleInstanceList', '') - nStrings = paramDict.get('multipleInstanceStrings', '') - self.nPatterns = fixPatterns(nList, nStrings) - - self.iFilePat = paramDict['inputFile'] - - ok, msg = self.configurationIsOK() - if not ok: - raise RuntimeError( - '%s.__init__, bad configuration:\n %s' % ( - self.__class__.__name__, - msg - ) - ) - - self.iFilePat = os.path.abspath(self.iFilePat) - - def configurationIsOK(self): - """Check the user has supplied all the necessary parameters.""" - - if not self.iFilePat: - m = '%s ==> no input file pattern to match was given. Abandoning.'\ - % self.__class__.__name__ - self.logger.error(m) - return (False, m) - - return (True, '') - - def getInFiles(self): - """Find the input files with the user supplied file name pattern""" - - matches = [m for m in glob.glob(self.iFilePat) if os.path.isfile(m)] - if not matches: - m = '%s => No matches found for the input file pattern: %s\n' % \ - (self.__class__.__name__, self.iFilePat) - self.logger.warning(m) - return matches - - def run(self): - """Check the user has supplied necessary parameters. For files - with names matching the user supplied file name pattern, - store any lines mathcing the user supplied regexes. - Print out a file of results containing name - of file checked, the regexes checked for and the correponding lines - found. - - Return 1 if any matching file has any line matching a veto pattern. - Return 0 otherwise.""" - - iFiles = self.getInFiles() - - for iFile in iFiles: - - self.cmd = 'fileGrepperScript.py ' - if self.fPatterns != "''": - self.cmd += '-f %s ' % self.fPatterns - if self.vPatterns != "''": - self.cmd += '-v %s ' % self.vPatterns - if self.nPatterns != "''": - self.cmd += '-n %s ' % self.nPatterns - - self.cmd += iFile - - ExeRunnerBase.run(self) diff --git a/Simulation/ISF/ISF_Example/share/ISF_ExampleCommonConfig.py b/Simulation/ISF/ISF_Example/share/ISF_ExampleCommonConfig.py deleted file mode 100644 index 865ba2b3cfe4971c7393504e2922ac87af1fe586..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Example/share/ISF_ExampleCommonConfig.py +++ /dev/null @@ -1,10 +0,0 @@ -""" -Common configurations for ISF -KG Tan, 17/06/2012 -""" - -include.block('ISF_Example/ISF_ExampleCommonConfig.py') - -print "DEPRECATION WARNING: include('ISF_Example/ISF_ExampleCommonConfig.py') is deprecated." -print "Please Use include('ISF_Config/ISF_ConfigJobInclude.py') instead." -include('ISF_Config/ISF_ConfigJobInclude.py') diff --git a/Simulation/ISF/ISF_Example/share/fileGrepperScript.py b/Simulation/ISF/ISF_Example/share/fileGrepperScript.py deleted file mode 100755 index 8063ff34222e9bbe1260b2d1023b61f605d17e24..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Example/share/fileGrepperScript.py +++ /dev/null @@ -1,238 +0,0 @@ -#!/usr/bin/env python - -""" -fileGrepper - function to look for strings or veto strings in a file. - -classes: -FileGrepResult Holds grep results for a file -Matcher Applies the regexes to the lines of a file. Returns the - results in a dictionary {regex:[matching lines]} - -functions: -resultsDictToString formatting helper function. -fileGrepper -""" -import getopt -import re -import sys -import collections -import os - - -def resultsDictToString(ddict): - """Convert a dictionary of regex: matching lines to a string""" - - s = [] - for k, matches in ddict.items(): - s.append(' %s:' % k) - for v in matches: - s.append(' ' + v) - return '\n'.join(s) - - -class FileGrepResult(object): - """Class that holds a file name and dictionaries - of regex:matching lines for two lists of regexes""" - - def __init__(self, fn, searchResults, vetoResults, multInstanceResults): - - self.fn = fn - self.searchResults = searchResults # {pattern: [lines]} - self.vetoResults = vetoResults # {pattern: [lines]} - self.multInstanceResults = multInstanceResults # {pattern: [[lines],nInstances] } - self.nMultInstanceFailures = 0 - self.multInstanceResultString = self.multInstances() - - def vetoIsPresent(self): - 'return True if there is a non-empty vetoResult dictionary' - - if self.vetoResults: - return True - - return False - - def multInstances(self): - 'return False if number of instances is too high' - - s = [] - if len(self.multInstanceResults)>0: - for res,nInstances in self.multInstanceResults: - for k, matches in res.items(): - if len(matches) > int(nInstances): - self.nMultInstanceFailures += 1 - s.append(' %s ( >%s instances ):' % (k,nInstances)) - for v in matches: - s.append(' ' + v) - return '\n'.join(s) - - def __str__(self): - """Present data as a formatted string""" - - s = ['File: %s' % self.fn] - s.append('Search Results [%d]' % len(self.searchResults)) - s.append(resultsDictToString(self.searchResults)) - s.append('') - s.append('Veto Results [%d]' % len(self.vetoResults)) - s.append(resultsDictToString(self.vetoResults)) - s.append('') - s.append('Multiple Instance results [%d]' % self.nMultInstanceFailures) - s.append(self.multInstanceResultString) - return '\n'.join(s) - - -class Matcher(object): - """A class that performs regex matches on lines in a file""" - - def __init__(self, patternList,checkNInstances=False): - """Converts an input list of regexes to a list of - raw and compiled regexes. The raw regexes are needed - for presenting results""" - - - self.patternList = [] - self.nInstancesList = [] - self.checkNInstances = checkNInstances - - if checkNInstances: - for i in range(0,len(patternList),2): - p = patternList[i] - self.patternList += [(p,re.compile(p))] - self.nInstancesList += patternList[i+1] - else: - - self.patternList = [(p, re.compile(p)) for p in patternList] - - - def match(self, fn): - """Opens file with supplied file name, reads all it lines - checking the against the regexes. If a line matches, store it - in the {raw regex:[lines]} dictionary""" - - - if not self.checkNInstances: - matchDict = collections.defaultdict(list) - with open(fn) as ifile: - for l in ifile: - for ori, comp in self.patternList: - if comp.search(l): - matchDict[ori].append(l) - return matchDict - - else: - result = [] - for i in range(len(self.patternList)): - ori=self.patternList[i][0] - comp=self.patternList[i][1] - nInstances=self.nInstancesList[i] - - matchDict = collections.defaultdict(list) - with open(fn) as ifile: - for l in ifile: - if comp.search(l): - matchDict[ori].append(l) - result.append([matchDict,nInstances]) - return result - -def usage(): - print 'NAME ' - print ' fileGrepper' - print - print 'SYNOPSIS' - print ' fileGrepper [option] [FILE]' - print - print 'DESCRIPTION' - print ' Look for lines in FILE that match search and veto ' - print 'fPattern vPattern are split at the commas. The input file' - print 'is read line by line. Lines matching any of the fPattern or ' - print 'vPattern regexes are written to the output file.' - print 'If a veto pattern matches any line, the script exits with ' - print 'exit code 1. Otherwise it exits with exit code 0' - print - print ' -f' - print ' a comma separated string of regexes' - print ' -v' - print ' a comma separated string of regexes' - print - print ' -o' - print ' name of output file if present. Otherwise output written to' - print ' standard out unless -s option is present' - print - print ' -s ' - print ' silent mode' - print '' - -def fileGrepper(fList, vList, nList, inFile, outFile, silent=True): - """Check the user has supplied necessary parameters. For files - with names matching the user supplied file name pattern, - store any lines mathcing the user supplied regexes. - Print out a file of results containing name - of file checked, the regexes checked for and the correponding lines - found. - - Return 1 if any matching file has any line matching a veto pattern. - Return 0 otherwise.""" - - # run the Matchers. Store results in a FileGrepResult object. - # make the results an attribute for unit tests. - - - grepResult = FileGrepResult(inFile, - Matcher(fList).match(inFile), - Matcher(vList).match(inFile), - Matcher(nList,True).match(inFile) - ) - - if not silent: - text = [(str(grepResult))] - text.append('') - text = '\n'.join(text) - - print text - - if grepResult.vetoIsPresent(): - return 1 - - if grepResult.multInstances(): - return 1 - - return 0 - -if __name__ == '__main__': - - opts, args = getopt.getopt(sys.argv[1:], 'f:v:o:s:n:', []) - - fList = [] - vList = [] - nList = [] - outFile = '' - silent = False - nInstances = 0 - - for o, v in opts: - if o == '-f': - fList = v.split(',') - if o == '-v': - vList = v.split(',') - if o == '-o': - outFile = v - if o == '-s': - silent = True - if o == '-n': - nList = v.split(',') - - if len(args) != 1: - print 'Supply only one input file' - print args - usage() - sys.exit(1) - - inFile = args[0] - - status = fileGrepper(fList=fList, - vList=vList, - nList=nList, - inFile=inFile, - outFile=outFile, - silent=silent) - - sys.exit(status) diff --git a/Simulation/ISF/ISF_Example/share/jobOptions_IDOnly_trf.py b/Simulation/ISF/ISF_Example/share/jobOptions_IDOnly_trf.py deleted file mode 100644 index e4cfd4e314566f3c465c96b7ee9005ce6bcc8703..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Example/share/jobOptions_IDOnly_trf.py +++ /dev/null @@ -1,184 +0,0 @@ -#-------------------------------------------------------------- -# Template jobOptions: SLHC -# - Tracking -#-------------------------------------------------------------- - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - -from RecExConfig.RecFlags import rec -# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) -OutputLevel = INFO -# --- produce an atlantis data file -doJiveXML = False -# --- run the Virtual Point 1 event visualisation -doVP1 = False -# --- controls what is written out. ESD includes AOD, so it's normally enough -doWriteESD = rec.doWriteESD() -doWriteAOD = rec.doWriteAOD() -# --- read BS - please look at the default input file(s) to know the det descr and cond tag -doReadBS = False -# --- do auditors ? -doAuditors = True - -if os.environ['CMTCONFIG'].endswith('-dbg'): - # --- do EDM monitor (debug mode only) - doEdmMonitor = True - # --- write out a short message upon entering or leaving each algorithm - doNameAuditor = True -else: - doEdmMonitor = False - doNameAuditor = False - - - -#-------------------------------------------------------------- -# load Global Flags and set defaults (import the new jobProperty globalflags) -#-------------------------------------------------------------- - -from AthenaCommon.GlobalFlags import globalflags -# --- default is atlas geometry -globalflags.DetGeo = 'atlas' -# --- set defaults -globalflags.DataSource = 'geant4' -# --- input is pool for SLHC -globalflags.InputFormat = 'pool' - -from AthenaCommon.GlobalFlags import jobproperties -jobproperties.Global.DetDescrVersion='ATLAS-GEO-20-00-01' - -# --- printout -globalflags.print_JobProperties() - -from AthenaCommon.BeamFlags import jobproperties -# --- default is high luminosity for SLHC -jobproperties.Beam.numberOfCollisions = 40.0 - -from AthenaCommon.GlobalFlags import globalflags -globalflags.ConditionsTag = "OFLCOND-MC12-SDR-06" - -# --- no conditions for SLHC -if len(globalflags.ConditionsTag())!=0: - from IOVDbSvc.CondDB import conddb - conddb.setGlobalTag(globalflags.ConditionsTag()) - -#-------------------------------------------------------------- -# Set Detector setup -#-------------------------------------------------------------- - -from RecExConfig.RecFlags import rec -rec.Commissioning=False - -from AthenaCommon.DetFlags import DetFlags -# --- switch on InnerDetector -DetFlags.ID_setOn() -# --- and switch off all the rest -DetFlags.Calo_setOff() -DetFlags.Muon_setOff() -# --- printout -DetFlags.Print() - -#DetFlags.writeRDOPool.pixel_setOn() - -#-------------------------------------------------------------- -# Load InDet configuration -#-------------------------------------------------------------- - -# --- setup InDetJobProperties -from InDetRecExample.InDetJobProperties import InDetFlags -InDetFlags.doTruth = (globalflags.InputFormat() == 'pool') - -InDetFlags.doLowBetaFinder = False - - -# --- uncomment to change the default of one of the following options: -#OutputLevel = DEBUG - -# --- possibility to change the trackfitter -#InDetFlags.trackFitterType = 'KalmanFitter' -#if (hasattr(InDetFlags,"doPixelClusterSplitting")) : -# InDetFlags.doPixelClusterSplitting=False -#---slhc -#InDetFlags.doTrackSegmentsPixel = False -#InDetFlags.doTrackSegmentsSCT = False -#InDetFlags.doTrackSegmentsTRT = False - -#InDetFlags.doNewTracking = True -#InDetFlags.doLowPt = False -#InDetFlags.doxKalman = False -#InDetFlags.doiPatRec = False -#InDetFlags.doBackTracking = False -#InDetFlags.doTRTStandalone = False -#InDetFlags.doSingleSpBackTracking = False -InDetFlags.postProcessing = True -InDetFlags.doBeamGas = False -InDetFlags.doBeamHalo = False -InDetFlags.doCosmics = False -InDetFlags.doSharedHits = True -# --- Turn off track slimming -InDetFlags.doSlimming = False -#---endslhc - -# --- de-activate monitorings -InDetFlags.doMonitoringGlobal = False -InDetFlags.doMonitoringPixel = False -InDetFlags.doMonitoringSCT = False -InDetFlags.doMonitoringTRT = False -InDetFlags.doMonitoringAlignment = False - -# --- activate (memory/cpu) monitoring -#InDetFlags.doPerfMon = True - -# --- activate creation of ntuples, standard plots -#InDetFlags.doTrkNtuple = False -InDetFlags.doPhysValMon = False -InDetFlags.doSGDeletion = False -#InDetFlags.doTrkD3PD = True - -from TrackD3PDMaker.TrackD3PDMakerFlags import TrackD3PDFlags -TrackD3PDFlags.trackParametersAtGlobalPerigeeLevelOfDetails = 2 -TrackD3PDFlags.storeTrackPredictionAtBLayer = False -TrackD3PDFlags.storeTrackSummary = True -TrackD3PDFlags.storeHitTruthMatching = True -TrackD3PDFlags.storeDetailedTruth = True - - -# activate the print InDetXYZAlgorithm statements -InDetFlags.doPrintConfigurables = True - - -# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py! -# This way RecExCommon just needs to import the properties without doing anything else! -# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored! - -#-------------------------------------------------------------- -# turn on SLHC tracking -#-------------------------------------------------------------- - -from InDetRecExample.InDetJobProperties import InDetFlags - -# --- do tracking D3PD -from InDetRecExample.InDetKeys import InDetKeys -if hasattr(runArgs,"outputDESDM_TRACKFile"): - InDetFlags.doTrkD3PD.set_Value_and_Lock(True) - InDetKeys.trkD3PDFileName.set_Value_and_Lock(runArgs.outputDESDM_TRACKFile) - -# --- Set output names such that they work with Reco_trf.py -if athenaCommonFlags.PoolESDOutput(): InDetKeys.OutputESDFileName = athenaCommonFlags.PoolESDOutput() -if athenaCommonFlags.PoolAODOutput(): InDetKeys.OutputAODFileName = athenaCommonFlags.PoolAODOutput() -#-------------------------------------------------------------- -# load master joboptions file -#-------------------------------------------------------------- - -include("InDetRecExample/InDetRec_all.py") - - -#-------------------------------------------------------------- -# Event related parameters and input files -#-------------------------------------------------------------- - -# Number of events to be processed -theApp.EvtMax = athenaCommonFlags.EvtMax() - -# --- default SLHC test file from digit output -ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.PoolRDOInput() -athenaCommonFlags.FilesInput = athenaCommonFlags.PoolRDOInput() diff --git a/Simulation/ISF/ISF_Example/share/jobOptions_PhysValMon.py b/Simulation/ISF/ISF_Example/share/jobOptions_PhysValMon.py deleted file mode 100644 index ad88b7cbfb00608439790658cb0dd05a73159d57..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Example/share/jobOptions_PhysValMon.py +++ /dev/null @@ -1,252 +0,0 @@ -# ************************* -# Application configuration -# ************************* -### This joboption bases on PhysicsAnalysis/PhysicsValidation/PhysValMon/share/PhysValMonFCT.py, Thanks to the author #### - - -##EvtMax = 400 -##SkipEvents = 0 -##InputCollections = ["ttbar_AtlfastII_AOD_400.pool.root"] -##OutputFileName = "Hist_50.root" -##DetDescrVersion = "ATLAS-GEO-20-00-01" -##TriggerSwitch = "NONE" -##CounterCheck = False -##WriteReference = False -##ConditionsTag = "OFLCOND-MC12-SIM-00" - -options=locals() -options.setdefault('EvtMax',50) -options.setdefault('SkipEvents',0) -options.setdefault('InputCollections',"ttbar_AtlfastII_AOD_50.pool.root") ###not exist in current dir, should be changed to an exist file -options.setdefault('DetDescrVersion','ATLAS-GEO-20-00-01') -options.setdefault('OutputFileName','Hist_50.root') -options.setdefault('TriggerSwitch','NONE') -options.setdefault('CounterCheck',False) -options.setdefault('WriteReference',False) -options.setdefault('ConditionsTag','OFLCOND-MC12-SIM-00') - - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.PoolAODInput.set_Value_and_Lock([InputCollections]) - -print 'IACOPO Conditions ' + str(ConditionsTag) - -TriggerOn = 0 - -if TriggerSwitch != "NONE": - TriggerOn = 1 - -# ************************* - -from AthenaCommon.GlobalFlags import GlobalFlags -GlobalFlags.DetGeo = 'atlas' -GlobalFlags.DataSource = 'geant4' -GlobalFlags.InputFormat = 'pool' - - - -include ("RecExCond/AllDet_detDescr.py") - -from RecExConfig.RecFlags import rec -rec.readRDO=False -rec.readAOD=True -rec.doWriteAOD=False -rec.doWriteESD=False - -from AthenaCommon.AppMgr import theApp -IOVDbSvc = theApp.service('IOVDbSvc') -IOVDbSvc.GlobalTag = ConditionsTag - -import JetRec.ParticleJetCompatibility - -if TriggerOn == 1: - # Set up trigger configuration service and metadata service it relies on, for analysis job without RecExCommon - # set up trigger decision tool - - # set up metadata services ... NB comment if "aod" state is selected above - from EventInfoMgt.EventInfoMgtConf import TagInfoMgr - ServiceMgr += TagInfoMgr() - #ServiceMgr.TagInfoMgr.AddGeoModelTags = False - from IOVDbMetaDataTools.IOVDbMetaDataToolsConf import IOVDbMetaDataTool - ToolSvc += IOVDbMetaDataTool( "IOVDbMetaDataTool" ) - from AthenaServices.AthenaServicesConf import MetaDataSvc - ServiceMgr += MetaDataSvc( "MetaDataSvc" ) - ServiceMgr.MetaDataSvc.MetaDataContainer = "MetaDataHdr" - ServiceMgr.MetaDataSvc.MetaDataTools += [ "IOVDbMetaDataTool" ] - import IOVDbSvc.IOVDb - - - from RecExConfig.RecFlags import rec - rec.readAOD=True - rec.doWriteAOD=False - rec.doWriteESD=False - -# from TrigDecisionTool.TrigDecisionConf import TrigDecisionTool -# tdt = TrigDecisionTool() - from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool - tdt = Trig__TrigDecisionTool() - ToolSvc += tdt - # flags needed for TriggerConfigGetter - - - # To read AOD produced with 13.0.30 you need to change ds to aod: - from TriggerJobOpts.TriggerFlags import TriggerFlags - TriggerFlags.configurationSourceList = ['ds'] - - # set up trigger config service - from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter - cfg = TriggerConfigGetter() - -from AthenaCommon.AppMgr import ServiceMgr as svcMgr -svcMgr.MessageSvc.OutputLevel = INFO - -## read pool data - - -import AthenaPoolCnvSvc.ReadAthenaPool -svcMgr.EventSelector.InputCollections = [InputCollections] - -## get the one and only one Athena Application Mgr -from AthenaCommon.AppMgr import theApp -theApp.EvtMax = EvtMax - -## get a handle on the top sequence of algorithms -from AthenaCommon.AlgSequence import AlgSequence -topSequence = AlgSequence() - -## add an AthenaMonManager algorithm to the list of algorithms to be ran -from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager -topSequence += AthenaMonManager( "AthenaMonManagerPV" ) - -# ************************ -# Monitoring configuration -# ************************ - -## Setup the output file(s): -from GaudiSvc.GaudiSvcConf import THistSvc -svcMgr += THistSvc() - -## The string "TestMon" in the argument below is the 'FileKey' -## used by Athena to access the output file internally - -if OutputFileName != 'NONE': - svcMgr.THistSvc.Output += ["PhysValMon DATAFILE='" + OutputFileName + "' OPT='RECREATE'"] -else: - svcMgr.THistSvc.Output += ["PhysValMon DATAFILE='PhysValMon.root' OPT='RECREATE'"] - -## AthenaMonManager is the Algorithm that manages many classes inheriting -## from ManagedMonitorToolBase -monMan = topSequence.AthenaMonManagerPV - -## FileKey must match that given to THistSvc -monMan.FileKey = "PhysValMon" - -## Set global monitoring parameters: see the AthenaMonManager class -## in the Control/AthenaMonitoring package -monMan.ManualDataTypeSetup = True -monMan.DataType = "monteCarlo" -monMan.Environment = "altprod" -monMan.ManualRunLBSetup = True -monMan.Run = 1 -monMan.LumiBlock = 1 -monMan.OutputLevel = INFO - -# **************************************** -# Configuration of PhysValMon tools -# **************************************** - -from PhysValMon.PhysValMonConf import * - -# configuration of the muon tools -# **************************************** - -TopoClusterTool = PhysValMonTopoCluster("TopoClusterTool", TopoClusterContainer = "CaloCalTopoCluster") -TopoClusterTool.DoOnTheFlyCheck = CounterCheck -TopoClusterTool.WriteReference = WriteReference -ToolSvc += TopoClusterTool -monMan.AthenaMonTools += [ TopoClusterTool ] - -MuidMuonTool = PhysValMonMuon("MuidMuonTool", MuonContainer = "MuidMuonCollection", DoTrigger = TriggerOn) -ToolSvc += MuidMuonTool -MuidMuonTool.DoOnTheFlyCheck = CounterCheck -MuidMuonTool.WriteReference = WriteReference -monMan.AthenaMonTools += [ MuidMuonTool ] - - -StacoMuonTool = PhysValMonMuon("StacoMuonTool", MuonContainer = "StacoMuonCollection", DoTrigger = TriggerOn) -StacoMuonTool.DoOnTheFlyCheck = CounterCheck -StacoMuonTool.WriteReference = WriteReference -ToolSvc += StacoMuonTool -monMan.AthenaMonTools += [ StacoMuonTool ] - -# configuration of the electron tools -# **************************************** - -import MCTruthClassifier.MCTruthClassifierBase - - -ElectronTool = PhysValMonElectron("ElectronTool", ElectronContainer = "ElectronAODCollection", DoTrigger = TriggerOn) -ElectronTool.DoOnTheFlyCheck = CounterCheck -ElectronTool.WriteReference = WriteReference -ToolSvc += ElectronTool -monMan.AthenaMonTools += [ ElectronTool ] - -# configuration of the photon tools -# **************************************** - -PhotonTool = PhysValMonPhoton("PhotonTool", PhotonContainer = "PhotonAODCollection", DoTrigger = TriggerOn) -PhotonTool.DoOnTheFlyCheck = CounterCheck -PhotonTool.WriteReference = WriteReference -ToolSvc += PhotonTool -monMan.AthenaMonTools += [ PhotonTool ] - -# configuration of the jet tools -# **************************************** - -#AntiKt4TowerJetTool = PhysValMonJet("AntiKt4TowerJetTool", JetContainer = "AntiKt4TowerAODJets", TruthJetContainer = "AntiKt4TruthJets", DoTrigger = TriggerOn) -#AntiKt4TowerJetTool.DoOnTheFlyCheck = CounterCheck -#AntiKt4TowerJetTool.WriteReference = WriteReference -AntiKt4TopoJetTool = PhysValMonJet("AntiKt4TopoJetTool", JetContainer = "AntiKt4TopoEMJets", TruthJetContainer = "AntiKt4TruthJets", DoTrigger = TriggerOn) -AntiKt4TopoJetTool.DoOnTheFlyCheck = CounterCheck -AntiKt4TopoJetTool.WriteReference = WriteReference - -AntiKt6TowerJetTool = PhysValMonJet("AntiKt6TowerJetTool", JetContainer = "AntiKt6TopoEMJets", TruthJetContainer = "AntiKt6TruthJets", DoTrigger = TriggerOn) - -#AntiKt4TowerJetTool.OutputLevel=VERBOSE -AntiKt4TopoJetTool.OutputLevel=VERBOSE - -#ToolSvc += AntiKt4TowerJetTool -ToolSvc += AntiKt4TopoJetTool -ToolSvc += AntiKt6TowerJetTool - -#monMan.AthenaMonTools += [ AntiKt4TowerJetTool ] -monMan.AthenaMonTools += [ AntiKt4TopoJetTool ] -monMan.AthenaMonTools += [ AntiKt6TowerJetTool] -#AntiKt4TowerJetBTaggingTool = PhysValMonBTagging("AntiKt4TowerJetBTaggingTool", -#JetContainer = "AntiKt4TowerJets", TruthParticleContainer = "Spc1MC" ) - -# AntiKt4TowerJetBTaggingTool.OutputLevel=1 - -#ToolSvc += AntiKt4TowerJetBTaggingTool -#monMan.AthenaMonTools += [ AntiKt4TowerJetBTaggingTool ] - -# configuration of the met tools -# **************************************** - -from AthenaCommon.Resilience import protectedInclude -protectedInclude("PhysValMon/PhysValMonMet_jobOptions.py") - -# configuration of the tau tools -# **************************************** -TauRecContainerTool = PhysValMonTau("TauRecContainerTool", TauContainer = "TauRecContainer", DoTrigger = TriggerOn) -TauRecContainerTool.DoOnTheFlyCheck = CounterCheck -TauRecContainerTool.WriteReference = WriteReference -ToolSvc += TauRecContainerTool -monMan.AthenaMonTools += [ TauRecContainerTool ] - -#configuration of the topoCluster toop - -from AthenaCommon.Resilience import protectedInclude -protectedInclude("HiggsValidation/HiggsValidation_montools.py") - -# LocalWords: TowerJetTool diff --git a/Simulation/ISF/ISF_Example/share/preInclude.IDonly_reconstruction.py b/Simulation/ISF/ISF_Example/share/preInclude.IDonly_reconstruction.py deleted file mode 100644 index a78083371f70d5828bb5631d95ff01a51e0a4c7b..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Example/share/preInclude.IDonly_reconstruction.py +++ /dev/null @@ -1,75 +0,0 @@ -from AthenaCommon.DetFlags import DetFlags -DetFlags.ID_setOn() -DetFlags.Calo_setOff() -DetFlags.Muon_setOff() - -import MagFieldServices.SetupField - -from InDetRecExample.InDetJobProperties import InDetFlags -InDetFlags.doBremRecovery.set_Value_and_Lock(False) -InDetFlags.doPhysValMon.set_Value_and_Lock(True) - -#from GaudiSvc.GaudiSvcConf import THistSvc - -# --- controls what is written out. ESD includes AOD, so it's normally enough -# --- ESD writing temporarily disabled post 2013 migration - to be reinstated! - -from ParticleBuilderOptions.AODFlags import AODFlags -AODFlags.TrackParticleSlimmer=False -AODFlags.TrackParticleLastHitAndPerigeeSlimmer=False - -#rec.doESD.set_Value_and_Lock (True) -#rec.doWriteESD.set_Value_and_Lock (True)### -#rec.doAOD.set_Value_and_Lock (True) -#rec.doWriteAOD.set_Value_and_Lock (True) -#rec.doDPD.set_Value_and_Lock (False) -#rec.doCBNT.set_Value_and_Lock (False) -#rec.doWriteTAG.set_Value_and_Lock (False) - -# --- turn on InDet -rec.doInDet.set_Value_and_Lock (True) -# --- turn off calo -rec.doCalo.set_Value_and_Lock (False) -# --- turn off muons -rec.doMuon.set_Value_and_Lock (False) -# --- turn off forward detectors -rec.doForwardDet.set_Value_and_Lock (False) -# --- turn off trigger -rec.doTrigger.set_Value_and_Lock (False) - -# --- turn off combined reconstruction -rec.doEgamma.set_Value_and_Lock (False) -rec.doMuonCombined.set_Value_and_Lock (False) -rec.doTau.set_Value_and_Lock (False) -rec.doJetMissingETTag.set_Value_and_Lock (False) - -# --- turn of calo stuff we don't need anyway -from CaloRec.CaloRecFlags import jobproperties -jobproperties.CaloRecFlags.doCaloTopoCluster.set_Value_and_Lock (False) -jobproperties.CaloRecFlags.doCaloEMTopoCluster.set_Value_and_Lock(False) -jobproperties.CaloRecFlags.doCaloTopoTower.set_Value_and_Lock (False) - -# --- turn of jets (Hack!!!) -from JetRec.JetRecFlags import jetFlags -jetFlags.Enabled.set_Value_and_Lock (False) - -# --- turn off egamma Brem -recAlgs.doEgammaBremReco.set_Value_and_Lock (False) -# --- turn off Eflow and missing ET -recAlgs.doEFlow.set_Value_and_Lock (False) -recAlgs.doEFlowJet.set_Value_and_Lock (False) -recAlgs.doMissingET.set_Value_and_Lock (False) -recAlgs.doMissingETSig.set_Value_and_Lock (False) -recAlgs.doObjMissingET.set_Value_and_Lock (False) -# --- turn off combined muons -recAlgs.doMuGirl.set_Value_and_Lock (False) -recAlgs.doMuTag.set_Value_and_Lock (False) -recAlgs.doMuidLowPt.set_Value_and_Lock (False) -recAlgs.doMuonIDCombined.set_Value_and_Lock (False) -recAlgs.doMuonIDStandAlone.set_Value_and_Lock(False) -recAlgs.doMuonSpShower.set_Value_and_Lock (False) -recAlgs.doStaco.set_Value_and_Lock (False) -recAlgs.doCaloTrkMuId.set_Value_and_Lock (False) -recAlgs.doTileMuID.set_Value_and_Lock (False) -# --- trigger -recAlgs.doTrigger.set_Value_and_Lock (False) diff --git a/Simulation/ISF/ISF_Example/share/preInclude.pionsGenerator.py b/Simulation/ISF/ISF_Example/share/preInclude.pionsGenerator.py deleted file mode 100644 index 132b2115a24ef035cb79de8aad5338788f6b5f6b..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Example/share/preInclude.pionsGenerator.py +++ /dev/null @@ -1,16 +0,0 @@ -print 'SINGLE PARTICLE GENERATOR' -## Run ParticleGenerator -import AthenaCommon.AtlasUnixGeneratorJob -spgorders = ['pdgcode: sequence 211 -211', - 'vertX: constant 0.0', - 'vertY: constant 0.0', - 'vertZ: constant 0.0', - 't: constant 0.0', - 'eta: constant 0.2', - 'phi: flat 0 6.28318', - 'pt: constant 50000'] -from AthenaCommon.AlgSequence import AlgSequence -topSeq = AlgSequence() -from ParticleGenerator.ParticleGeneratorConf import ParticleGenerator -topSeq += ParticleGenerator() -topSeq.ParticleGenerator.orders = sorted(spgorders) diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/CMakeLists.txt index 683b6dab65c03776d7998559752a65f180f88db4..8a4324242f85e3eb0c1f35a12e03d3684efd3251 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/CMakeLists.txt +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/CMakeLists.txt @@ -3,8 +3,21 @@ # Declare the package name: atlas_subdir( ISF_FatrasRecoTools ) +# Component(s) in the package: +atlas_add_library( ISF_FatrasRecoToolsLib + src/*.cxx + PUBLIC_HEADERS ISF_FatrasRecoTools + LINK_LIBRARIES AtlasHepMCLib AthenaBaseComps GeoPrimitives Identifier ISF_FatrasEvent TrkEventPrimitives TrkParameters TrkSpacePoint TrkTrackSummary TrkToolInterfaces AtlasDetDescr EventPrimitives GaudiKernel InDetIdentifier InDetPrepRawData SiSpacePoint ISF_FatrasDetDescrModel TrkDetElementBase TrkCompetingRIOsOnTrack TrkEventUtils TrkPrepRawData TrkRIO_OnTrack TrkTrack TrkTruthData TrkTruthTrackInterfaces ) + # Component(s) in the package: atlas_add_component( ISF_FatrasRecoTools src/*.cxx src/components/*.cxx - LINK_LIBRARIES AtlasHepMCLib AthenaBaseComps GeoPrimitives Identifier ISF_FatrasEvent TrkEventPrimitives TrkParameters TrkSpacePoint TrkTrackSummary TrkToolInterfaces AtlasDetDescr EventPrimitives GaudiKernel InDetIdentifier InDetPrepRawData SiSpacePoint ISF_FatrasDetDescrModel TrkDetElementBase TrkCompetingRIOsOnTrack TrkEventUtils TrkPrepRawData TrkRIO_OnTrack TrkTrack TrkTruthData TrkTruthTrackInterfaces ) + LINK_LIBRARIES ISF_FatrasRecoToolsLib ) + +# Test(s) in the package: +atlas_add_test( SiSpacePointMakerTool_test + SOURCES test/SiSpacePointMakerTool_test.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib AthenaPoolUtilities AthenaKernel IdDictParser TrkGeometry ISF_FatrasRecoToolsLib TestTools + ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" ) diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/ISF_TrackSummaryHelperTool.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/ISF_TrackSummaryHelperTool.h index dc4609482708b3ac794c85d128e9d14715de14e0..faf554d3fc9c1f08e3950fb9fcb8aebbd719d5a5 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/ISF_TrackSummaryHelperTool.h +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/ISF_TrackSummaryHelperTool.h @@ -46,6 +46,7 @@ namespace iFatras { */ using IExtendedTrackSummaryHelperTool::analyse; using IExtendedTrackSummaryHelperTool::updateSharedHitCount; + using IExtendedTrackSummaryHelperTool::updateExpectedHitInfo; using IExtendedTrackSummaryHelperTool::addDetailedTrackSummary; virtual void analyse( const EventContext& ctx, diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/PRD_PlanarTruthTrajectoryBuilder.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/PRD_PlanarTruthTrajectoryBuilder.h deleted file mode 100644 index eaecaae9ae4ccdfb030c77825559b12ff4d534f8..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/PRD_PlanarTruthTrajectoryBuilder.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PRD_PlanarTruthTrajectoryBuilder.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef ISF_FATRASRECOTOOLS_PRD_PLANARTRUTHTRAJECTORYBUILDER_H -#define ISF_FATRASRECOTOOLS_PRD_PLANARTRUTHTRAJECTORYBUILDER_H - -// Gaudi -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -// Trk includes -#include "TrkTruthTrackInterfaces/IPRD_TruthTrajectoryBuilder.h" -#include "TrkTruthTrackInterfaces/PRD_TruthTrajectory.h" - -class AtlasDetectorID; -class PRD_MultiTruthCollection; - -#include "AtlasHepMC/GenParticle_fwd.h" - -namespace Trk { - class IPRD_Provider; - class IPRD_TruthTrajectoryManipulator; - class PrepRawData; -} - -namespace iFatras { - /** - @class IPRD_TruthTrajectoryBuilder - - @brief The truth PRD trajectory builder, works with a cache, calling the ID sub-helpers - - It is based on the Trk::PRD_TruthTrajectoryBuilder and is made for working with iFatras::PlanarCluster - to avoid ISF dependencies in the Tracking package - - The truth PRD trajectory builder, works with a cache, and calls the ID sub-helpers. This is done - because it should also run for upgrade layouts and thus not know about dedicated detector technologies. - The cache is filled and created in the BeginEvent incident, the accessible PRDs are steered by the PRD multi truth collections - and handed forward from the IPRD_Provider (which should use a hash-lookup) - - A dedicated PRD_TruthTrajectoryManipulator can be used to shape the TruthTrajectories after beeing created - - @author Noemi.Calace -at- cern.ch - */ - - class PRD_PlanarTruthTrajectoryBuilder : public extends<AthAlgTool, Trk::IPRD_TruthTrajectoryBuilder> { - - public: - //** Constructor with parameters */ - PRD_PlanarTruthTrajectoryBuilder( const std::string& t, const std::string& n, const IInterface* p ); - - // Athena algtool's Hooks - StatusCode initialize(); - StatusCode finalize(); - - /** return a vector of PrepRawData trajectories - uses internal cache**/ - const std::map< HepMC::ConstGenParticlePtr , Trk::PRD_TruthTrajectory >& truthTrajectories() const; - - /** Event refresh - can't be an IIncident, because it has to run after PRD creation and PRD truth creation */ - StatusCode refreshEvent(); - - private: - //! Helper to detect type of sub-detector from PRD->identify(). - const AtlasDetectorID* m_idHelper; - - //!< Identifier to PRD relation in the Inner Detector for Planar Clusters - ToolHandle<Trk::IPRD_Provider> m_idPrdPlanarClusterProvider; - - //!< PRD truth tracjectory manipulators - ToolHandleArray<Trk::IPRD_TruthTrajectoryManipulator> m_prdTruthTrajectoryManipulators; - - //!< PRD multi truth collection names this builder is working on - std::vector<std::string> m_prdPlanarMultiTruthCollectionNames; - - //!< the retrieved PRD muli truth collections - std::vector<const PRD_MultiTruthCollection*> m_prdPlanarMultiTruthCollections; - - //!< minimum pT to be even considered - double m_minPt; - //!< Track geantinos or not - bool m_geantinos; - //!< the cache for the return (cleared by Incident) - mutable std::map<HepMC::ConstGenParticlePtr , Trk::PRD_TruthTrajectory > m_gpPrdTruthTrajectories; - }; - -} // end of namespace - -#endif // ISF_FATRASRECOTOOLS_PRD_PLANARTRUTHTRAJECTORYBUILDER_H diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/PlanarClusterOnTrackTool.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/PlanarClusterOnTrackTool.h deleted file mode 100644 index e23a63e45ad39cf68321eedd8e366c106d3e9cb9..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/PlanarClusterOnTrackTool.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// Header file for class PlanarClusterOnTrackTool -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// Interface for PlanarClusterOnTrack production -/////////////////////////////////////////////////////////////////// - -#ifndef ISF_FATRARECOTOOLS_PLANARCLUSTERONTRACKTOOL_H -#define ISF_FATRARECOTOOLS_PLANARCLUSTERONTRACKTOOL_H - -#include "GaudiKernel/ToolHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/IIncidentListener.h" - -#include "TrkToolInterfaces/IRIO_OnTrackCreator.h" -#include "ISF_FatrasEvent/PlanarClusterOnTrack.h" - -#include "TrkParameters/TrackParameters.h" -#include "GeoPrimitives/GeoPrimitives.h" - - -class StoreGateSvc; -class PixelID; -class IPixelOfflineCalibSvc; - - -namespace iFatras { - - class PlanarClusterOnTrackTool: public extends<AthAlgTool, Trk::IRIO_OnTrackCreator, IIncidentListener> - { - - public: - - //! AlgTool constructor - PlanarClusterOnTrackTool(const std::string&,const std::string&, - const IInterface*); - - virtual ~PlanarClusterOnTrackTool (); - - //! AlgTool initialisation - virtual StatusCode initialize(); - - //! AlgTool termination - virtual StatusCode finalize (); - - virtual const PlanarClusterOnTrack* correct(const Trk::PrepRawData&, - const Trk::TrackParameters&) const; - /** handle for incident service */ - void handle(const Incident& inc) ; - - private: - bool m_useDefinedParameters; - - }; - -} - -#endif // ISF_FATRARECOTOOLS_PLANARCLUSTERONTRACKTOOL_H diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/PlanarClusterProvider.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/PlanarClusterProvider.h deleted file mode 100644 index a7324cd5799d75e07f3f64c170ee8ee5ee5d57fc..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/PlanarClusterProvider.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// InDetPRD_Provider.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef ISF_FATRASRECOTOOLS_PLANARCLUSTERPROVIDER_H -#define ISF_FATRASRECOTOOLS_PLANARCLUSTERPROVIDER_H - -// Gaudi -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -// ISF includes -#include "ISF_FatrasEvent/PlanarClusterContainer.h" -// Trk includes -#include "TrkToolInterfaces/IPRD_Provider.h" -#include "TrkPrepRawData/PrepRawDataContainer.h" -#include "TrkPrepRawData/PrepRawDataCollection.h" -// Identifier -#include "Identifier/Identifier.h" -#include "Identifier/IdentifierHash.h" - -class AtlasDetectorID; -class PixelID; -class SCT_ID; - -namespace iFatras { - - /** - @class iFatras - - @brief PRD provider for the planar cluster - - @author Noemi.Calace -at- cern.ch - */ - - class PlanarClusterProvider : public extends<AthAlgTool, Trk::IPRD_Provider> { - - public: - //** Constructor with parameters */ - PlanarClusterProvider ( const std::string& t, const std::string& n, const IInterface* p ); - - /** Athena algtool's Hooks */ - StatusCode initialize(); - - /** finalize */ - StatusCode finalize(); - - /** retrieve the PRD collection from StoreGate */ - StatusCode retrieveCollection(); - - /** return the Prd given the Identifier - make a HashId out of the Id and return the associated PRD */ - const Trk::PrepRawData* prdFromIdentifier(const Identifier& ide, size_t& ndof ) const; - - private: - /** templated method since used for further developments */ - template < class PrdT > const Trk::PrepRawData* prdFromIdentifierContainers( - std::vector < const Trk::PrepRawDataContainer< Trk::PrepRawDataCollection< PrdT > >* >& coll, - const Identifier& ideh, const IdentifierHash& ideHash ) const - { - const PrdT* prd = 0; - // loop on the containers - typename std::vector < const Trk::PrepRawDataContainer< Trk::PrepRawDataCollection< PrdT > >* >::const_iterator pmtVecCollIter = coll.begin(); - typename std::vector < const Trk::PrepRawDataContainer< Trk::PrepRawDataCollection< PrdT > >* >::const_iterator pmtVecCollIterE = coll.end(); - for ( ; pmtVecCollIter != pmtVecCollIterE; ++pmtVecCollIter ){ - // find the collection - auto prdCollIter = (*pmtVecCollIter)->indexFindPtr(ideHash); - if (!prdCollIter) - continue; - - const Trk::PrepRawDataCollection< PrdT >* prdCollection = prdCollIter; - // search for the PRD in the collection --- do a loop, can be done better with std::find probably - // iterate through the collections - typename Trk::PrepRawDataCollection< PrdT >::const_iterator prdIter = prdCollection->begin(); - typename Trk::PrepRawDataCollection< PrdT >::const_iterator prdIterE = prdCollection->end(); - for ( ; prdIter != prdIterE; ++prdIter ){ - if ( (*prdIter)->identify() == ideh ){ - prd = (*prdIter); - break; - } - } - } - - // return what you have - if (!prd) // if no prd is found - ATH_MSG_VERBOSE("PRD Collection to IdentifierHash could not be found. Return 0."); - - return prd; - } - - const AtlasDetectorID* m_idHelper; //! Helper to detect type of sub-detector from PRD->identify(). - - const PixelID* m_pixIdHelper; - - const SCT_ID* m_sctIdHelper; - - std::vector<std::string> m_planarClusterContainerNames; - mutable std::vector<const iFatras::PlanarClusterContainer*>* m_planarClusterContainers; - - bool m_usePixel; - bool m_useSCT; - - }; - - -} // end of namespace - -#endif // ISF_FATRASRECOTOOLS_PLANARCLUSTERPROVIDER_H diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/PlanarSiSpacePointMakerTool.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/PlanarSiSpacePointMakerTool.h deleted file mode 100644 index 3d87ffcf6aa5b1854bc751bddbdf2fbbd473588d..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/ISF_FatrasRecoTools/PlanarSiSpacePointMakerTool.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ISF_FATRASREOCTOOLS_ISF_SISPACEPOINTMAKERTOOL_H -#define ISF_FATRASREOCTOOLS_ISF_SISPACEPOINTMAKERTOOL_H - -#include "AthenaBaseComps/AthAlgTool.h" - -// Cluster and space point collections -#include "ISF_FatrasEvent/PlanarClusterCollection.h" -#include "TrkSpacePoint/SpacePointCollection.h" -#include "TrkSpacePoint/SpacePointOverlapCollection.h" -#include "GeoPrimitives/GeoPrimitives.h" - -namespace iFatras{ - class PlanarSiSpacePointMakerTool : public AthAlgTool { - - public: - - // Constructor - PlanarSiSpacePointMakerTool( const std::string& type, - const std::string& name, - const IInterface* parent ); - - virtual ~PlanarSiSpacePointMakerTool(); - - static const InterfaceID& interfaceID(); - - virtual StatusCode initialize(); - - virtual StatusCode finalize(); - - void fillPixelSpacePointCollection(const PlanarClusterCollection* clusters, SpacePointCollection* spacepointCollection); - - }; -} // end namespace - -#endif // ISF_FATRASREOCTOOLS_ISF_SISPACEPOINTMAKERTOOL_H - - diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/share/ISF_FatrasRecoTools_test.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/share/ISF_FatrasRecoTools_test.txt new file mode 100644 index 0000000000000000000000000000000000000000..7a62d9fe77da0cf0d0cbc0da69a7694363ba0940 --- /dev/null +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/share/ISF_FatrasRecoTools_test.txt @@ -0,0 +1,2 @@ +ApplicationMgr.Dlls += { "StoreGate", "CLIDComps" }; +ApplicationMgr.ExtSvc += { "StoreGateSvc", "StoreGateSvc/DetectorStore" }; diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/PRD_PlanarTruthTrajectoryBuilder.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/PRD_PlanarTruthTrajectoryBuilder.cxx deleted file mode 100644 index 2e03f261a8b5888bc71bcdfb4e10ecb733649464..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/PRD_PlanarTruthTrajectoryBuilder.cxx +++ /dev/null @@ -1,191 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////// -// PRD_PlanarTruthTrajectoryBuilder.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -// package include -#include "ISF_FatrasRecoTools/PRD_PlanarTruthTrajectoryBuilder.h" - -// Trk -#include "TrkTruthData/PRD_MultiTruthCollection.h" -#include "TrkToolInterfaces/IPRD_Provider.h" -#include "TrkTruthTrackInterfaces/IPRD_TruthTrajectoryManipulator.h" -#include "TrkEventUtils/PrepRawDataComparisonFunction.h" - -// DetectorDescription -#include "AtlasDetDescr/AtlasDetectorID.h" - -// HepMC -#include "AtlasHepMC/GenParticle.h" -#include "AtlasHepMC/GenVertex.h" - -/** Constructor **/ -iFatras::PRD_PlanarTruthTrajectoryBuilder::PRD_PlanarTruthTrajectoryBuilder(const std::string& t, const std::string& n, const IInterface* p) : - base_class(t,n,p), - m_idHelper(0), - m_idPrdPlanarClusterProvider(""), - m_minPt(400.), - m_geantinos(false) -{ - // the PRD multi truth collections this builder works on - declareProperty("PRD_PlanarMultiTruthCollections", m_prdPlanarMultiTruthCollectionNames); - // the PRD providers that turn Identifier -> IdentiferHash and get the PRD - declareProperty("InDetPRD_PlanarClusterProvider", m_idPrdPlanarClusterProvider); - // the PRD manipulators - declareProperty("PRD_TruthTrajectoryManipulators", m_prdTruthTrajectoryManipulators); - // Minimum PT cut - declareProperty("MinimumPt", m_minPt); - // Track geantinos - declareProperty("Geantinos", m_geantinos); -} - -// Athena algtool's Hooks - initialize -StatusCode iFatras::PRD_PlanarTruthTrajectoryBuilder::initialize() -{ - ATH_MSG_VERBOSE("Initializing ..."); - // Set up ATLAS ID helper to be able to identify the PRD's det-subsystem - if (detStore()->retrieve(m_idHelper, "AtlasID").isFailure()) { - ATH_MSG_ERROR ("Could not get AtlasDetectorID helper. Arborting ..."); - return StatusCode::FAILURE; - } else ATH_MSG_DEBUG ("AtlasDetectorID helper retrieved."); - - // get the ID PRD Provider - if ( !m_idPrdPlanarClusterProvider.empty() && m_idPrdPlanarClusterProvider.retrieve().isFailure()){ - ATH_MSG_ERROR ("Could not get " << m_idPrdPlanarClusterProvider << ". Arborting ..." ); - return StatusCode::FAILURE; - } else ATH_MSG_DEBUG ("PRD Provider for PlanarClusters retrieved."); - - // get the manipulators - if ( m_prdTruthTrajectoryManipulators.size() && m_prdTruthTrajectoryManipulators.retrieve().isFailure()){ - ATH_MSG_ERROR ("Could not get configured " << m_prdTruthTrajectoryManipulators << ". Arborting ..." ); - return StatusCode::FAILURE; - } else ATH_MSG_DEBUG ("TruthTrajectoryManipulator retrieved."); - - ATH_MSG_VERBOSE("Initialization successfully finished!"); - - return StatusCode::SUCCESS; -} - -StatusCode iFatras::PRD_PlanarTruthTrajectoryBuilder::refreshEvent() { - - ATH_MSG_VERBOSE("Calling refreshEvent() to reset cache and retrieve collections"); - // clear the cache & reserve - m_gpPrdTruthTrajectories.clear(); - m_prdPlanarMultiTruthCollections.clear(); - m_prdPlanarMultiTruthCollections.reserve(m_prdPlanarMultiTruthCollectionNames.size()); - - // load the PRD collections from SG for PlanarClusters - std::vector< std::string >::iterator pmtPlanarCollNameIter = m_prdPlanarMultiTruthCollectionNames.begin(); - std::vector< std::string >::iterator pmtPlanarCollNameIterE = m_prdPlanarMultiTruthCollectionNames.end(); - for ( ; pmtPlanarCollNameIter != pmtPlanarCollNameIterE; ++pmtPlanarCollNameIter ) { - // try to retrieve the PRD multi truth collection for PlanarClusters - const PRD_MultiTruthCollection* curColl = 0; - if ( evtStore()->retrieve(curColl,(*pmtPlanarCollNameIter)).isFailure() ) - ATH_MSG_WARNING("Could not retrieve " << (*pmtPlanarCollNameIter) << ". Ignoring ... "); - else if (curColl){ - ATH_MSG_VERBOSE("Added " << (*pmtPlanarCollNameIter) << " to collection list for truth track creation."); - m_prdPlanarMultiTruthCollections.push_back(curColl); - } - } - - // retrieve collection call to the PRD_PlanarClusterProviders - if (!m_idPrdPlanarClusterProvider.empty() && m_idPrdPlanarClusterProvider->retrieveCollection().isFailure()){ - ATH_MSG_ERROR ("Failure in collection retrieval of " << m_idPrdPlanarClusterProvider << ". Arborting ..." ); - return StatusCode::FAILURE; - } - else { - ATH_MSG_INFO ("collection retrieval of " << m_idPrdPlanarClusterProvider << ". Done!" ); - } - - // all good - return StatusCode::SUCCESS; - -} - -const std::map< HepMC::ConstGenParticlePtr , Trk::PRD_TruthTrajectory >& iFatras::PRD_PlanarTruthTrajectoryBuilder::truthTrajectories() const { - // ndof - size_t ndofTotal = 0; - size_t ndof = 0; - - // PART 1 for Planar clusters-------------------------------------------------------------------------------------------------------- - // loop over the PRD_MultiTruthCollection, search for the PRD and create (if necessary and entry in the return map) - std::vector<const PRD_MultiTruthCollection*>::const_iterator pmtPlanarCollIter = m_prdPlanarMultiTruthCollections.begin(); - std::vector<const PRD_MultiTruthCollection*>::const_iterator pmtPlanarCollIterE = m_prdPlanarMultiTruthCollections.end(); - int first_count = 0; - int second_count = 0; - for ( ; pmtPlanarCollIter != pmtPlanarCollIterE; ++pmtPlanarCollIter ){ - // loop over the map and get the identifier, GenParticle relation - PRD_MultiTruthCollection::const_iterator prdMtCIter = (*pmtPlanarCollIter)->begin(); - PRD_MultiTruthCollection::const_iterator prdMtCIterE = (*pmtPlanarCollIter)->end(); - ATH_MSG_VERBOSE(" 1-Count " << first_count++ ); - ATH_MSG_VERBOSE(" Coll size = " << (*pmtPlanarCollIter)->size() ); - for ( ; prdMtCIter != prdMtCIterE; ++ prdMtCIter ){ - ATH_MSG_VERBOSE(" 2-Count " << second_count++ ); - // check if entry exists and if - auto curGenP = (*prdMtCIter).second; - Identifier curIdentifier = (*prdMtCIter).first; - // apply the min pT cut - if ( curGenP->momentum().perp() < m_minPt ) continue; - // skip geantinos if required - if (!m_geantinos && std::abs(curGenP->pdg_id())==999) continue; - // get the associated PRD from the provider - const Trk::PrepRawData* prd = 0; - if (m_idHelper->is_indet(curIdentifier)) - prd = m_idPrdPlanarClusterProvider->prdFromIdentifier(curIdentifier,ndof); - // stuff it into the trajectory if you found a PRD - if (prd){ - ATH_MSG_VERBOSE(" I got the PRD for Id = " << curIdentifier ); - // try to find the entry for this GenParticle - std::map< HepMC::ConstGenParticlePtr , Trk::PRD_TruthTrajectory >::iterator prdTrajIter = m_gpPrdTruthTrajectories.find(curGenP); - if ( prdTrajIter == m_gpPrdTruthTrajectories.end() ){ - // first PRD associated to this: create PRD_TruthTrajectory object - Trk::PRD_TruthTrajectory newPrdTruthTrajectory; - newPrdTruthTrajectory.prds.push_back(prd); - newPrdTruthTrajectory.nDoF = ndof-5; - // register the GenParticle only once - newPrdTruthTrajectory.genParticle = curGenP; - // fill into map - m_gpPrdTruthTrajectories[curGenP] = newPrdTruthTrajectory; - ndofTotal = ndof; - } else { - // this PRD_TruthTrajectory already exists - (prdTrajIter->second).prds.push_back(prd); - (prdTrajIter->second).nDoF += ndof; - ndofTotal = (prdTrajIter->second).nDoF; - } - ATH_MSG_VERBOSE(" Associating PRD for Planar Cluster with " << ndof << " degrees of freedom, total N.d.o.F : " << ndofTotal ); - ATH_MSG_VERBOSE(" Associating Identifier " << curIdentifier << " with particle at [ " << curGenP << " ]." ); - } else ATH_MSG_VERBOSE(" NO PRD for Id = " << curIdentifier ); - } - } - - // PART 2 -------------------------------------------------------------------------------------------------------- - // loop through the provided list of manipulators ( sorter is included ) - std::map< HepMC::ConstGenParticlePtr , Trk::PRD_TruthTrajectory >::iterator prdTruthTrajIter = m_gpPrdTruthTrajectories.begin(); - std::map< HepMC::ConstGenParticlePtr , Trk::PRD_TruthTrajectory >::iterator prdTruthTrajIterE = m_gpPrdTruthTrajectories.end(); - for ( ; prdTruthTrajIter != prdTruthTrajIterE; ++prdTruthTrajIter ){ - if ( m_prdTruthTrajectoryManipulators.size() ){ - ToolHandleArray<Trk::IPRD_TruthTrajectoryManipulator>::const_iterator prdTTMIter = m_prdTruthTrajectoryManipulators.begin(); - ToolHandleArray<Trk::IPRD_TruthTrajectoryManipulator>::const_iterator prdTTMIterE = m_prdTruthTrajectoryManipulators.end(); - for ( ; prdTTMIter != prdTTMIterE; ++prdTTMIter ){ - if ((*prdTTMIter)->manipulateTruthTrajectory((*prdTruthTrajIter).second)) - ATH_MSG_VERBOSE("PRD truth trajectory got manipulated by: " << (*prdTTMIter).name() ); - } - } - } - // return the truth trajectories and leave it to the TruthTrack creation to proceed further - return m_gpPrdTruthTrajectories; -} - -StatusCode iFatras::PRD_PlanarTruthTrajectoryBuilder::finalize() -{ - // clear the cache a last time - m_gpPrdTruthTrajectories.clear(); - //m_prdPlanarMultiTruthCollections.clear(); - ATH_MSG_VERBOSE("Finalizing ..."); - return StatusCode::SUCCESS; -} - diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/PlanarClusterOnTrackTool.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/PlanarClusterOnTrackTool.cxx deleted file mode 100644 index e4894e8b1a3aa43cf275cc355d6051c1947c559e..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/PlanarClusterOnTrackTool.cxx +++ /dev/null @@ -1,149 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// Implementation file for class PlanarClusterOnTrackTool -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// -// AlgTool used for PlanarClusterOnTrack object production -/////////////////////////////////////////////////////////////////// - -#include "ISF_FatrasRecoTools/PlanarClusterOnTrackTool.h" -#include "EventPrimitives/EventPrimitives.h" -#include "ISF_FatrasDetDescrModel/PlanarDetElement.h" -#include <sstream> - -/////////////////////////////////////////////////////////////////// -// Constructor -/////////////////////////////////////////////////////////////////// - -namespace iFatras { - PlanarClusterOnTrackTool::PlanarClusterOnTrackTool - (const std::string& t,const std::string& n,const IInterface* p) : - base_class(t,n,p), - m_useDefinedParameters(false) - { - declareProperty("UseDefinedParameters", m_useDefinedParameters); - } - - - /////////////////////////////////////////////////////////////////// - // Destructor - /////////////////////////////////////////////////////////////////// - - PlanarClusterOnTrackTool::~PlanarClusterOnTrackTool(){} - - /////////////////////////////////////////////////////////////////// - // Initialisation - /////////////////////////////////////////////////////////////////// - - StatusCode PlanarClusterOnTrackTool::initialize() - { - StatusCode sc = AthAlgTool::initialize(); - - msg(MSG::INFO) << name() << " initialize()" << endmsg; - - return sc; - } - - /////////////////////////////////////////////////////////////////// - // Finalize - /////////////////////////////////////////////////////////////////// - - StatusCode PlanarClusterOnTrackTool::finalize() - { - StatusCode sc = AlgTool::finalize(); - return sc; - } - - /////////////////////////////////////////////////////////////////// - // iFatras::PlanarClusterOnTrack production - /////////////////////////////////////////////////////////////////// - - const PlanarClusterOnTrack* PlanarClusterOnTrackTool::correct - (const Trk::PrepRawData& rio,const Trk::TrackParameters&) const - { - - ATH_MSG_VERBOSE ("PlanarClusterOnTrackTool:: correct()"); - - const PlanarCluster* plc=dynamic_cast<const PlanarCluster*>(&rio); - - if(plc==0) { - ATH_MSG_WARNING("This is not a planar cluster, return 0."); - return 0; - } - - // Get pointer to detector element - // - const iFatras::PlanarDetElement* element = plc->detectorElement(); - if(!element) { - ATH_MSG_WARNING ("Cannot access detector element. Aborting cluster correction..."); - return 0; - } - - bool isPixel = element->isPixel(); - bool isDisc = (element->surface().type() == Trk::Surface::Disc); - - IdentifierHash iH = element->identifyHash(); - - // PlanarCluster global and local position - // - Amg::Vector3D glob(plc->globalPosition()); - Amg::Vector2D locpos = plc->localPosition(); - Trk::LocalParameters locpar; - - // Covariance matrix - // - Amg::MatrixX oldLocalCov = plc->localCovariance(); - Amg::MatrixX* loce = 0; - - if(!isPixel) { // SCT case - // TODO! At the time being the KalmanFitter doesn't understand yet the DefinedParameters - // The code is already here when this will be the case - if ( m_useDefinedParameters ) { - if (isDisc) { // Disc surface with trapezoidal shape - Trk::DefinedParameter par(locpos[Trk::locPhi], Trk::locPhi); - locpar = Trk::LocalParameters(par); - Amg::MatrixX mat(1,1); - mat(0,0) = oldLocalCov(Trk::locPhi, Trk::locPhi); - loce = new Amg::MatrixX(mat); - } else { // Planar surface with trapezoidal shape - Trk::DefinedParameter par(locpos[Trk::locX], Trk::locX); - locpar = Trk::LocalParameters(par); - Amg::MatrixX mat(1,1); - mat(0,0) = oldLocalCov(Trk::locX, Trk::locX); - loce = new Amg::MatrixX(mat); - } - } else { - locpar = Trk::LocalParameters(locpos); - loce = new Amg::MatrixX(oldLocalCov); - } - } else { // Pixel case - locpar = Trk::LocalParameters(locpos); - loce = new Amg::MatrixX(oldLocalCov); - } - - ATH_MSG_DEBUG ("PlanarCluster: Global Position --> " << glob); - ATH_MSG_DEBUG ("PlanarCluster: Local Position --> " << locpos); - ATH_MSG_DEBUG ("PlanarCluster: Local Parameters --> " << locpar); - ATH_MSG_DEBUG ("PlanarCluster: Error Matrix --> " << *loce); - - iFatras::PlanarClusterOnTrack* pcot = new iFatras::PlanarClusterOnTrack(plc,locpar,*loce,iH,glob); - - std::ostringstream ss; - pcot->dump(ss); - ATH_MSG_DEBUG ("Planar: Planar Cluster On Track " << ss.str()); - - return pcot; - } - -void PlanarClusterOnTrackTool::handle(const Incident& inc) -{ - if ( inc.type() == "EndEvent" ){ - ATH_MSG_VERBOSE("'EndEvent' incident caught."); - } -} - -} diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/PlanarClusterProvider.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/PlanarClusterProvider.cxx deleted file mode 100644 index b42847c780b3be4c2a27236372f51e42a04d0339..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/PlanarClusterProvider.cxx +++ /dev/null @@ -1,132 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PlanarClusterProvider.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#include "ISF_FatrasRecoTools/PlanarClusterProvider.h" -// ISF includes -#include "ISF_FatrasEvent/PlanarCluster.h" -// AtlasDetDescr -#include "AtlasDetDescr/AtlasDetectorID.h" -// InDetIdentifier -#include "InDetIdentifier/PixelID.h" -#include "InDetIdentifier/SCT_ID.h" - -iFatras::PlanarClusterProvider::PlanarClusterProvider(const std::string& t, const std::string& n, const IInterface* p): - base_class(t,n,p), - m_idHelper(0), - m_pixIdHelper(0), - m_sctIdHelper(0), - m_planarClusterContainers(0), - m_usePixel(true), - m_useSCT(true) -{ - // PRD container name - declareProperty("PlanarClusterContainers", m_planarClusterContainerNames); - declareProperty("UsePixel", m_usePixel); - declareProperty("UseSCT", m_useSCT); - -} - - - -StatusCode iFatras::PlanarClusterProvider::initialize() -{ - - ATH_MSG_VERBOSE("Initializing ..."); - // Set up ATLAS ID helper to be able to identify the PRD's det-subsystem - if (detStore()->retrieve(m_idHelper, "AtlasID").isFailure()) { - ATH_MSG_ERROR ("Could not get AtlasDetectorID helper. Aborting ..."); - return StatusCode::FAILURE; - } - - // Get Pixel helpers - if (m_usePixel) - if (detStore()->retrieve(m_pixIdHelper, "PixelID").isFailure()) { - ATH_MSG_ERROR ("Could not get PixelID helper. Aborting ..."); - return StatusCode::FAILURE; - } - - // Get SCT helpers - if (m_useSCT) - if (detStore()->retrieve(m_sctIdHelper, "SCT_ID").isFailure()) { - ATH_MSG_ERROR ("Could not get SCT_ID helper. Aborting ..."); - return StatusCode::FAILURE; - } - - m_planarClusterContainers = new std::vector<const iFatras::PlanarClusterContainer*>(); - - return StatusCode::SUCCESS; -} - - - -StatusCode iFatras::PlanarClusterProvider::finalize() -{ - ATH_MSG_VERBOSE("Initializing ..."); - return StatusCode::SUCCESS; -} - - -StatusCode iFatras::PlanarClusterProvider::retrieveCollection() { - - m_planarClusterContainers->clear(); - m_planarClusterContainers->reserve(m_planarClusterContainerNames.size()); - for (const auto& contName : m_planarClusterContainerNames) { - const iFatras::PlanarClusterContainer* curCont = 0; - if (contName!="" && evtStore()->retrieve(curCont,contName).isFailure()) { - ATH_MSG_ERROR("Could not retrieve " << contName << ". Aborting." ); - return StatusCode::FAILURE; - } else if (curCont) { - ATH_MSG_VERBOSE("Added " << contName << " to collection list in PlanarClusterProvider"); - m_planarClusterContainers->push_back(curCont); - } - } - - //all good - return StatusCode::SUCCESS; -} - -/** return the Prd given the Identifier - make a HashId out of the Id and return the associated PRD */ -const Trk::PrepRawData* iFatras::PlanarClusterProvider::prdFromIdentifier(const Identifier& ide, size_t& ndof ) const { - - // check validity of the Identifier - if (!ide.is_valid()){ - ATH_MSG_VERBOSE("The identifier is not valid ! Return 0."); - return 0; - } - - // is pixel case - if ( m_usePixel && m_idHelper->is_pixel(ide) && m_planarClusterContainers){ - ndof = 2; - // get the Identifier Hash - Identifier idewafer = m_pixIdHelper->wafer_id(ide); - IdentifierHash ideHash = m_pixIdHelper->wafer_hash(idewafer); - ATH_MSG_VERBOSE("Pixel Identifier found as transformed to hash identifier " << (unsigned int)ideHash ); - if (!ideHash.is_valid()){ - ATH_MSG_VERBOSE("The hash identifier is not valid ! Return 0."); - return 0; - } - ATH_MSG_DEBUG("Returning the PRD for PlanarCluster for Pixel Identifier " << (unsigned int)ideHash ); - return prdFromIdentifierContainers<iFatras::PlanarCluster>(*m_planarClusterContainers,ide,ideHash); - } - - if ( m_useSCT && m_idHelper->is_sct(ide) && m_planarClusterContainers){ - // get the Identifier Hash - ndof = 1; - Identifier idewafer = m_sctIdHelper->wafer_id(ide); - IdentifierHash ideHash = m_sctIdHelper->wafer_hash(idewafer); - ATH_MSG_VERBOSE("SCT Identifier found as transformed to hash identifier " << (unsigned int)ideHash ); - if (!ideHash.is_valid()){ - ATH_MSG_VERBOSE("The hash identifier is not valid ! Return 0."); - return 0; - } - ATH_MSG_DEBUG("Returning the PRD for PlanarCluster for SCT Identifier " << (unsigned int)ideHash ); - return prdFromIdentifierContainers<iFatras::PlanarCluster>(*m_planarClusterContainers,ide,ideHash); - } - - return 0; -} diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/PlanarSiSpacePointMakerTool.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/PlanarSiSpacePointMakerTool.cxx deleted file mode 100644 index 9ea1f3ee350e2f6f3bf3e2151a95911e2754b255..0000000000000000000000000000000000000000 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/PlanarSiSpacePointMakerTool.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PlanarSiSpacePointMakerTool.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#include "ISF_FatrasRecoTools/PlanarSiSpacePointMakerTool.h" - -// Space points -#include "SiSpacePoint/PixelSpacePoint.h" - -namespace iFatras{ - - static const InterfaceID IID_IPlanarSiSpacePointMakerTool - ("PlanarSiSpacePointMakerTool", 252891434, 0); - - const InterfaceID& PlanarSiSpacePointMakerTool::interfaceID() { - return IID_IPlanarSiSpacePointMakerTool; - } - - // Constructor with parameters: - PlanarSiSpacePointMakerTool::PlanarSiSpacePointMakerTool(const std::string &type, - const std::string &name, - const IInterface *parent) : - AthAlgTool(type,name,parent){ - - declareInterface< PlanarSiSpacePointMakerTool>( this ); - - } - - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - // virtual destructor - PlanarSiSpacePointMakerTool::~PlanarSiSpacePointMakerTool() - {} - - //-------------------------------------------------------------------------- - StatusCode PlanarSiSpacePointMakerTool::initialize() { - StatusCode sc; - sc = AlgTool::initialize(); - return sc; - } - - //-------------------------------------------------------------------------- - StatusCode PlanarSiSpacePointMakerTool::finalize() { - StatusCode sc = AlgTool::finalize(); - return sc; - } - - void PlanarSiSpacePointMakerTool::fillPixelSpacePointCollection(const PlanarClusterCollection* clusters, SpacePointCollection* spacepointCollection){ - - IdentifierHash idHash = clusters->identifyHash(); - - iFatras::PlanarClusterCollection::const_iterator clusStart = clusters->begin(); - iFatras::PlanarClusterCollection::const_iterator clusFinish = clusters->end(); - if ((*clusStart)->detectorElement()!=0) { - // Since all the clusters in a PixelClusterCollection and in a pixel PlanarClusterCollection - // are from the same detector element, it is enough to test on the - // first cluster. - spacepointCollection->reserve(spacepointCollection->size()+clusters->size()); - for(; clusStart!=clusFinish; ++clusStart){ - Trk::SpacePoint* sp(new InDet::PixelSpacePoint(idHash, *clusStart)); - spacepointCollection->push_back(sp); - } - } - } - - -} diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/components/ISF_FatrasRecoTools_entries.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/components/ISF_FatrasRecoTools_entries.cxx index 03fe2a21ab789d5b6213d37132b1de45e04d9b8d..9e0e1ca9aed48e6c4fe5a2084b9d3e7851cda276 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/components/ISF_FatrasRecoTools_entries.cxx +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/src/components/ISF_FatrasRecoTools_entries.cxx @@ -1,22 +1,13 @@ -#include "ISF_FatrasRecoTools/PlanarClusterOnTrackTool.h" -#include "ISF_FatrasRecoTools/PlanarSiSpacePointMakerTool.h" -#include "ISF_FatrasRecoTools/PlanarClusterProvider.h" #include "ISF_FatrasRecoTools/ISF_SiSpacePointMakerTool.h" #include "ISF_FatrasRecoTools/ISF_PRDGeneralTruthTrajectorySorterID.h" #include "ISF_FatrasRecoTools/ISF_PRD_AssociationTool.h" #include "../ISF_PRDtoTrackMapTool.h" #include "ISF_FatrasRecoTools/ISF_TrackSummaryHelperTool.h" -#include "ISF_FatrasRecoTools/PRD_PlanarTruthTrajectoryBuilder.h" using namespace iFatras; -DECLARE_COMPONENT( PlanarClusterOnTrackTool ) -DECLARE_COMPONENT( PlanarSiSpacePointMakerTool ) -DECLARE_COMPONENT( PlanarClusterProvider ) DECLARE_COMPONENT( ISF_SiSpacePointMakerTool ) DECLARE_COMPONENT( ISF_PRDGeneralTruthTrajectorySorterID ) DECLARE_COMPONENT( ISF_PRD_AssociationTool ) DECLARE_COMPONENT( ISF_PRDtoTrackMapTool ) DECLARE_COMPONENT( ISF_TrackSummaryHelperTool ) -DECLARE_COMPONENT( PRD_PlanarTruthTrajectoryBuilder ) - diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/test/SiSpacePointMakerTool_test.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/test/SiSpacePointMakerTool_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..904da890f8783b2989532fdb479d4f0ba9f3feef --- /dev/null +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasRecoTools/test/SiSpacePointMakerTool_test.cxx @@ -0,0 +1,234 @@ +#undef NDEBUG + +#include "ISF_FatrasRecoTools/ISF_SiSpacePointMakerTool.h" +#include "ISF_FatrasEvent/PlanarClusterContainer.h" +#include "ISF_FatrasEvent/PlanarClusterCollection.h" +#include "InDetIdentifier/PixelID.h" +#include "InDetIdentifier/SCT_ID.h" +#include "IdDictParser/IdDictParser.h" +#include "TrkGeometry/HomogeneousLayerMaterial.h" +#include "ISF_FatrasDetDescrModel/IdHashDetElementCollection.h" +#include "GeoPrimitives/GeoPrimitivesHelpers.h" +#include "StoreGate/StoreGateSvc.h" +#include "TestTools/initGaudi.h" +#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ISvcLocator.h" +#include "TestTools/leakcheck.h" +#include <cassert> +#include <iostream> + + +const int NELTS = 10; + +struct IDHelpers +{ + PixelID* m_pix_id; + SCT_ID* m_sct_id; + Identifier m_pixel_ids; + std::unique_ptr<iFatras::PlanarDetElement> m_pixel_elts; + Identifier m_sct_ids; + std::unique_ptr<iFatras::PlanarDetElement> m_sct_elts; +}; + +std::unique_ptr<iFatras::PlanarDetElement> makeEle(const Identifier& id, + const IdentifierHash& idhash, + bool isPixel, + int o) +{ + Amg::Transform3D xform; + if (isPixel) + xform = Amg::getRotateX3D (0.5+o/100); + else + xform = Amg::getRotateY3D (0.5+o/100); + return std::make_unique<iFatras::PlanarDetElement> + (id, + idhash, + Amg::Vector3D (10.5+o, 11.5+o, 12.5+o), + xform, + Trk::HomogeneousLayerMaterial(), + 13.5+o, // thickness + 14.5+o, // lengthY + 15.5+o, // lengthXmin + 16.5+o, // lengthXmax + 17.5+o, // rMin + 18.5+o, // rMax + 19.5+o, // pitchX + 20.5+o, // pitchY + 21.5+o, // stereo + isPixel, + o&1, + !(o&1), + o&1); +} + + + +std::unique_ptr<IDHelpers> make_idhelpers (ISvcLocator* svcLoc) +{ + auto helpers = std::make_unique<IDHelpers>(); + auto pix_id = std::make_unique<PixelID>(); + auto sct_id = std::make_unique<SCT_ID>(); + helpers->m_pix_id = pix_id.get(); + helpers->m_sct_id = sct_id.get(); + + IdDictParser parser; + parser.register_external_entity ("InnerDetector", + "IdDictInnerDetector.xml"); + IdDictMgr& idd = parser.parse ("IdDictParser/ATLAS_IDS.xml"); + pix_id->initialize_from_dictionary (idd); + sct_id->initialize_from_dictionary (idd); + + StoreGateSvc* sg = 0; + assert ( svcLoc->service("DetectorStore", sg).isSuccess() ); + assert ( sg->record (std::move (pix_id), "PixelID") ); + assert ( sg->record (std::move (sct_id), "SCT_ID") ); + + auto pixel_map = std::make_unique<iFatras::IdHashDetElementCollection>(); + { + Identifier id = helpers->m_pix_id->wafer_id (0, + 1, + 3, + 4); + IdentifierHash hash = helpers->m_pix_id->wafer_hash (id); + std::unique_ptr<iFatras::PlanarDetElement> elt = makeEle(id, hash, + true, 0); + pixel_map->emplace (hash, elt.get()); + helpers->m_pixel_ids = id; + helpers->m_pixel_elts = std::move(elt); + } + + auto sct_map = std::make_unique<iFatras::IdHashDetElementCollection>(); + { + Identifier id = helpers->m_sct_id->wafer_id (0, + 1, + 3, + 4, + 0); + IdentifierHash hash = helpers->m_sct_id->wafer_hash (id); + std::unique_ptr<iFatras::PlanarDetElement> elt = makeEle (id, hash, + false, 5); + sct_map->emplace (hash, elt.get()); + helpers->m_sct_ids = id; + helpers->m_sct_elts = std::move(elt); + } + + return helpers; +} + + +void test (iFatras::ISF_SiSpacePointMakerTool& tool, const IDHelpers& helpers) +{ + std::cout << "test: " << tool.name() << "\n"; + // Creation of PlanarClusterCollection is from PlanarClusterContainerCnv test (by Scott) + iFatras::PlanarClusterContainer planarCont (3000); + { + Identifier wafer_id = helpers.m_pixel_ids; + IdentifierHash wafer_hash = helpers.m_pix_id->wafer_hash (wafer_id); + auto coll = std::make_unique<iFatras::PlanarClusterCollection> (wafer_hash); + for (int i=0; i < NELTS; i++) { + int o = i*10; + + Amg::Vector2D locpos (1.5+o, 2.5+o); + std::vector<Identifier> rdoList { + helpers.m_pix_id->pixel_id (wafer_id, + 21+o, + 32+o), + helpers.m_pix_id->pixel_id (wafer_id, + 21+o, + 33+o), + helpers.m_pix_id->pixel_id (wafer_id, + 21+o, + 34+o) }; + InDet::SiWidth width (Amg::Vector2D (1+o, 2+o), + Amg::Vector2D (3.5+o, 4.5+o)); + + Amg::MatrixX cov(2,2); + for (int i=0; i < 2; i++) + for (int j=0; j < 2; j++) + cov(i,j) = 100*(i+1)*(j+1) + o; + + auto clus = std::make_unique<iFatras::PlanarCluster> + (helpers.m_pix_id->pixel_id (wafer_id, + 21+o, + 31+o), + locpos, + rdoList, + width, + helpers.m_pixel_elts.get(), + new Amg::MatrixX(cov)); + + coll->push_back (std::move (clus)); + } + planarCont.addCollection (coll.release(), wafer_hash).ignore(); + } + + { + Identifier wafer_id = helpers.m_sct_ids; + IdentifierHash wafer_hash = helpers.m_sct_id->wafer_hash (wafer_id); + auto coll = std::make_unique<iFatras::PlanarClusterCollection> (wafer_hash); + for (int i=0; i < NELTS; i++) { + int o = i*10+5; + + Amg::Vector2D locpos (1.5+o, 2.5+o); + std::vector<Identifier> rdoList { + helpers.m_sct_id->strip_id (wafer_id, 42+o), + helpers.m_sct_id->strip_id (wafer_id, 43+o), + helpers.m_sct_id->strip_id (wafer_id, 44+o) }; + InDet::SiWidth width (Amg::Vector2D (1+o, 2+o), + Amg::Vector2D (3.5+o, 4.5+o)); + + Amg::MatrixX cov(2,2); + for (int i=0; i < 2; i++) + for (int j=0; j < 2; j++) + cov(i,j) = 100*(i+1)*(j+1) + o; + + auto clus = std::make_unique<iFatras::PlanarCluster> + (helpers.m_sct_id->strip_id (wafer_id, 41+i), + locpos, + rdoList, + width, + helpers.m_sct_elts.get(), + new Amg::MatrixX(cov)); + + coll->push_back (std::move (clus)); + } + planarCont.addCollection (coll.release(), wafer_hash).ignore(); + } + + iFatras::PlanarClusterContainer::const_iterator it1 = planarCont.begin(); + const iFatras::PlanarClusterCollection& coll1 = **it1; + std::cout << "Collection size: " << coll1.size() << "\n"; + + IdentifierHash idHash = it1->identifyHash(); + Identifier elementID = it1->identify(); + auto spacepointCollection = std::make_unique< SpacePointCollection >(idHash); + spacepointCollection->setIdentifier(elementID); + tool.fillPixelSpacePointCollection(*it1, spacepointCollection.get()); + std::cout << "coll size : " << (*it1)->size() << "\n"; + std::cout << "space size : " << spacepointCollection->size() << "\n"; + + assert( (*it1)->size() == spacepointCollection->size() ); + +} + + +int main() +{ + std::cout << "ISF_FatrasRecoTools/ISF_SiSpacePointMakerTool_test.cxx \n"; + + + ISvcLocator* pSvcLoc; + if (!Athena_test::initGaudi("ISF_FatrasRecoTools_test.txt", pSvcLoc)) { + std::cerr << "This test can not be run" << std::endl; + return 0; + } + + std::unique_ptr<IDHelpers> helpers = make_idhelpers (pSvcLoc); + + ToolHandle<iFatras::ISF_SiSpacePointMakerTool> tool ("iFatras::ISF_SiSpacePointMakerTool"); + assert( tool.retrieve().isSuccess() ); + + test (*tool, *helpers); + + return 0; +} diff --git a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py index 2d8d83fa87ba7ee6392d60abebf3cab5efd78178..f60120aa5c62fd950cce04347ab0410fc20dbe35 100644 --- a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py +++ b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfig.py @@ -212,12 +212,24 @@ def getPionG4FastCaloGeant4Selector(name="ISF_PionG4FastCaloGeant4Selector", **k kwargs.setdefault('Simulator' , 'ISF_AFIIGeant4SimSvc') return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) +def getPionG4FastCalo_QS_Geant4Selector(name="ISF_PionG4FastCalo_QS_Geant4Selector", **kwargs): + kwargs.setdefault('MaxEkin' , 200) + kwargs.setdefault('ParticlePDG' , 211) + kwargs.setdefault('Simulator' , 'ISF_AFII_QS_Geant4SimSvc') + return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) + def getProtonG4FastCaloGeant4Selector(name="ISF_ProtonG4FastCaloGeant4Selector", **kwargs): kwargs.setdefault('MaxEkin' , 400) kwargs.setdefault('ParticlePDG' , 2212) kwargs.setdefault('Simulator' , 'ISF_AFIIGeant4SimSvc') return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) +def getProtonG4FastCalo_QS_Geant4Selector(name="ISF_ProtonG4FastCalo_QS_Geant4Selector", **kwargs): + kwargs.setdefault('MaxEkin' , 400) + kwargs.setdefault('ParticlePDG' , 2212) + kwargs.setdefault('Simulator' , 'ISF_AFII_QS_Geant4SimSvc') + return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) + def getNeutronG4FastCaloGeant4Selector(name="ISF_NeutronG4FastCaloGeant4Selector", **kwargs): kwargs.setdefault('MaxEkin' , 400) kwargs.setdefault('ParticlePDG' , 2112) @@ -226,6 +238,12 @@ def getNeutronG4FastCaloGeant4Selector(name="ISF_NeutronG4FastCaloGeant4Selector kwargs.setdefault('Simulator' , 'ISF_AFIIGeant4SimSvc') return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) +def getNeutronG4FastCalo_QS_Geant4Selector(name="ISF_NeutronG4FastCalo_QS_Geant4Selector", **kwargs): + kwargs.setdefault('MaxEkin' , 400) + kwargs.setdefault('ParticlePDG' , 2112) + kwargs.setdefault('Simulator' , 'ISF_AFII_QS_Geant4SimSvc') + return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) + def getChargedKaonG4FastCaloGeant4Selector(name="ISF_ChargedKaonG4FastCaloGeant4Selector", **kwargs): kwargs.setdefault('MaxEkin' , 400) kwargs.setdefault('ParticlePDG' , 321) @@ -234,6 +252,12 @@ def getChargedKaonG4FastCaloGeant4Selector(name="ISF_ChargedKaonG4FastCaloGeant4 kwargs.setdefault('Simulator' , 'ISF_AFIIGeant4SimSvc') return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) +def getChargedKaonG4FastCalo_QS_Geant4Selector(name="ISF_ChargedKaonG4FastCalo_QS_Geant4Selector", **kwargs): + kwargs.setdefault('MaxEkin' , 400) + kwargs.setdefault('ParticlePDG' , 321) + kwargs.setdefault('Simulator' , 'ISF_AFII_QS_Geant4SimSvc') + return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) + def getKLongG4FastCaloGeant4Selector(name="ISF_KLongG4FastCaloGeant4Selector", **kwargs): kwargs.setdefault('MaxEkin' , 400) kwargs.setdefault('ParticlePDG' , 130) @@ -242,6 +266,12 @@ def getKLongG4FastCaloGeant4Selector(name="ISF_KLongG4FastCaloGeant4Selector", * kwargs.setdefault('Simulator' , 'ISF_AFIIGeant4SimSvc') return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) +def getKLongG4FastCalo_QS_Geant4Selector(name="ISF_KLongG4FastCalo_QS_Geant4Selector", **kwargs): + kwargs.setdefault('MaxEkin' , 400) + kwargs.setdefault('ParticlePDG' , 130) + kwargs.setdefault('Simulator' , 'ISF_AFII_QS_Geant4SimSvc') + return CfgMgr.ISF__KinematicSimSelector(name, **kwargs) + def getPionAFII_QS_Geant4Selector(name="ISF_PionAFII_QS_Geant4Selector", **kwargs): if usesSimKernelMT(): kwargs.setdefault('Simulator', '') diff --git a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py index 4fa66b226056da57755e18b477b45e053511b3b8..fe2e67e3de9a5883debfc855ccc2af3238a9c536 100644 --- a/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py +++ b/Simulation/ISF/ISF_SimulationSelectors/python/ISF_SimulationSelectorsConfigDb.py @@ -13,10 +13,15 @@ addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonAFIIGean addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonAFII_QS_Geant4Selector" , "ISF_ProtonAFII_QS_Geant4Selector" ) addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionAFIIGeant4Selector" , "ISF_PionAFIIGeant4Selector" ) addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionG4FastCaloGeant4Selector" , "ISF_PionG4FastCaloGeant4Selector" ) +addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionG4FastCalo_QS_Geant4Selector" , "ISF_PionG4FastCalo_QS_Geant4Selector" ) addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonG4FastCaloGeant4Selector" , "ISF_ProtonG4FastCaloGeant4Selector" ) +addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getProtonG4FastCalo_QS_Geant4Selector" , "ISF_ProtonG4FastCalo_QS_Geant4Selector" ) addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getNeutronG4FastCaloGeant4Selector" , "ISF_NeutronG4FastCaloGeant4Selector" ) -addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonG4FastCaloGeant4Selector" , "ISF_ChargedKaonG4FastCaloGeant4Selector" ) -addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getKLongG4FastCaloGeant4Selector" , "ISF_KLongG4FastCaloGeant4Selector" ) +addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getNeutronG4FastCalo_QS_Geant4Selector" , "ISF_NeutronG4FastCalo_QS_Geant4Selector" ) +addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonG4FastCaloGeant4Selector" , "ISF_ChargedKaonG4FastCaloGeant4Selector" ) +addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonG4FastCalo_QS_Geant4Selector", "ISF_ChargedKaonG4FastCalo_QS_Geant4Selector" ) +addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getKLongG4FastCaloGeant4Selector" , "ISF_KLongG4FastCaloGeant4Selector" ) +addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getKLongG4FastCalo_QS_Geant4Selector" , "ISF_KLongG4FastCalo_QS_Geant4Selector" ) addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getPionAFII_QS_Geant4Selector" , "ISF_PionAFII_QS_Geant4Selector" ) addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonAFIIGeant4Selector" , "ISF_ChargedKaonAFIIGeant4Selector" ) addTool("ISF_SimulationSelectors.ISF_SimulationSelectorsConfig.getChargedKaonAFII_QS_Geant4Selector" , "ISF_ChargedKaonAFII_QS_Geant4Selector" ) diff --git a/TileCalorimeter/TileConditions/test/TileDCSComponents_test.cxx b/TileCalorimeter/TileConditions/test/TileDCSComponents_test.cxx index c70774b4a3bb211927cad70dadf96285a2142307..aec6ba7b680a24c625faeed6b2a13b336528b768 100644 --- a/TileCalorimeter/TileConditions/test/TileDCSComponents_test.cxx +++ b/TileCalorimeter/TileConditions/test/TileDCSComponents_test.cxx @@ -209,14 +209,14 @@ void prepareDCSFolder(const std::string& key, const FolderData<T>& folderData) { std::unique_ptr<CondAttrListCollection> data = std::make_unique<CondAttrListCollection>(true); - for (const auto coolChannelData : folderData) { + for (const auto& coolChannelData : folderData) { unsigned int coolChannel = coolChannelData.first; const auto nameValuePairs = coolChannelData.second; coral::AttributeList attributeList; - for (const std::pair<std::string, T> nameValuePair : nameValuePairs) { + for (const std::pair<std::string, T>& nameValuePair : nameValuePairs) { std::string name = nameValuePair.first; T value = nameValuePair.second; attributeList.extend<T>(name); diff --git a/TileCalorimeter/TileEvent/TileEvent/TileRawDataCollection.h b/TileCalorimeter/TileEvent/TileEvent/TileRawDataCollection.h index 315c1af28cc68ec86e796a090b8d8e78459c110b..c3de4e970d426b12ffeead9160a2cf279ea811d6 100755 --- a/TileCalorimeter/TileEvent/TileEvent/TileRawDataCollection.h +++ b/TileCalorimeter/TileEvent/TileEvent/TileRawDataCollection.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 */ //******************************************************************** @@ -46,18 +46,18 @@ template <typename TELEMENT> class TileRawDataCollection typedef TELEMENT OBJECT; // construct a container for a given super-drawer (fragment) - TileRawDataCollection<TELEMENT> ( ID id, SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS ) + TileRawDataCollection ( ID id, SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS ) : DataVector <TELEMENT> (ownPolicy), m_id(id), m_lvl1Id(0), m_lvl1Type(0), m_detEvType(0), m_rodBCID(0) { this->reserve(48); } - TileRawDataCollection<TELEMENT> ( SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS ) + TileRawDataCollection ( SG::OwnershipPolicy ownPolicy=SG::OWN_ELEMENTS ) : DataVector < TELEMENT > (ownPolicy), m_id(0), m_lvl1Id(0), m_lvl1Type(0), m_detEvType(0), m_rodBCID(0) { this->reserve(48); } - TileRawDataCollection<TELEMENT> (const TileRawDataCollection<TELEMENT>& rhs) = default; - TileRawDataCollection<TELEMENT> (TileRawDataCollection<TELEMENT>&& rhs) = default; + TileRawDataCollection (const TileRawDataCollection<TELEMENT>& rhs) = default; + TileRawDataCollection (TileRawDataCollection<TELEMENT>&& rhs) = default; // destructor - virtual ~TileRawDataCollection<TELEMENT> () = default; + virtual ~TileRawDataCollection () = default; // clear everything for next event virtual void clear (); diff --git a/TileCalorimeter/TileTrackingGeometry/src/TileVolumeBuilder.cxx b/TileCalorimeter/TileTrackingGeometry/src/TileVolumeBuilder.cxx index 6c571e9e7004c794b5ab89676187ee44c8ef78a8..ca6732cc16d8bfbd893ecdf86c5104ec51e553fb 100755 --- a/TileCalorimeter/TileTrackingGeometry/src/TileVolumeBuilder.cxx +++ b/TileCalorimeter/TileTrackingGeometry/src/TileVolumeBuilder.cxx @@ -199,23 +199,23 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking ATH_MSG_DEBUG( "Retrieved " << numTreeTops << " tree tops from the TileDetDescrManager. " ); // layer material can be adjusted here - std::vector<const Trk::IdentifiedMaterial*> matTB; + std::vector<Trk::IdentifiedMaterial> matTB; int baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 12; - matTB.push_back(new std::pair<const Trk::Material*,int>(barrelProperties,0)); - matTB.push_back(new std::pair<const Trk::Material*,int>(barrelProperties,baseID)); - matTB.push_back(new std::pair<const Trk::Material*,int>(barrelProperties,baseID+1)); - matTB.push_back(new std::pair<const Trk::Material*,int>(barrelProperties,baseID+2)); + matTB.emplace_back(barrelProperties,0); + matTB.emplace_back(barrelProperties,baseID); + matTB.emplace_back(barrelProperties,baseID+1); + matTB.emplace_back(barrelProperties,baseID+2); // material index std::vector<size_t> ltb{0,1,2,3}; // layer material can be adjusted here - std::vector<const Trk::IdentifiedMaterial*> matETB; + std::vector<Trk::IdentifiedMaterial> matETB; baseID = Trk::GeometrySignature(Trk::Calo)*1000 + 18; - matETB.push_back(new std::pair<const Trk::Material*,int>(extendedBarrelProperties,0)); - matETB.push_back(new std::pair<const Trk::Material*,int>(extendedBarrelProperties,baseID)); - matETB.push_back(new std::pair<const Trk::Material*,int>(extendedBarrelProperties,baseID+1)); - matETB.push_back(new std::pair<const Trk::Material*,int>(extendedBarrelProperties,baseID+2)); + matETB.emplace_back(extendedBarrelProperties,0); + matETB.emplace_back(extendedBarrelProperties,baseID); + matETB.emplace_back(extendedBarrelProperties,baseID+1); + matETB.emplace_back(extendedBarrelProperties,baseID+2); // layer material can be adjusted here //Trk::MaterialProperties barrelFingerGapProperties = Trk::MaterialProperties(1., 130./0.35, 0.003*pow(0.35,3),30.); @@ -438,12 +438,12 @@ const std::vector<const Trk::TrackingVolume*>* Tile::TileVolumeBuilder::tracking double tileExtZ = tilePositiveExtendedBarrel->center().z()-tilePositiveExtendedBarrelBounds.halflengthZ(); // binned material for ITC : - std::vector<const Trk::IdentifiedMaterial*> matITC; + std::vector<Trk::IdentifiedMaterial> matITC; // layer material can be adjusted here baseID = Trk::GeometrySignature(Trk::Calo)*1000; - matITC.push_back(new Trk::IdentifiedMaterial(barrelProperties,baseID+15)); - matITC.push_back(new Trk::IdentifiedMaterial(barrelProperties,baseID+16)); - matITC.push_back(new Trk::IdentifiedMaterial(barrelProperties,baseID+17)); + matITC.emplace_back(barrelProperties,baseID+15); + matITC.emplace_back(barrelProperties,baseID+16); + matITC.emplace_back(barrelProperties,baseID+17); // ITCPlug1 double p1Z = 0.5*(plug1Z-plug1hZ+tileExtZ); diff --git a/Tools/PyUtils/bin/checkxAOD.py b/Tools/PyUtils/bin/checkxAOD.py index f1af827a5c4d4ec063590635c69da913759e1e84..1d30f0887b13eca8906975beb41f8a90c7b6f24e 100755 --- a/Tools/PyUtils/bin/checkxAOD.py +++ b/Tools/PyUtils/bin/checkxAOD.py @@ -52,7 +52,8 @@ if __name__ == "__main__": "CaloTopo" : ["CaloCalTopoCluster"], "Calo" : ["^LAr", "^AllCalo", "^AODCellContainer", "^MBTSContainer", "^CaloCompactCellContainer", "^E4prContainer", "^TileCellVec", "^TileDigits"], "Truth" : ["^Truth", "Truth$", "TruthMap$", "TruthCollection$", "^PRD_MultiTruth", "TracksTruth$", ".*TrackTruth$", "TrackTruthCollection"], - "AFP" : ["^AFP"] + "AFP" : ["^AFP"], + "LRT" : ["^LRT", "(.*)LRT$", "(.*)LRTTrackParticles$", "(.*)LargeD0TrackParticles$"] } fileNames = [] diff --git a/Tools/PyUtils/python/scripts/cmake_depends.py b/Tools/PyUtils/python/scripts/cmake_depends.py index df351c9b385b180f669425f115bb207620e854b4..e6aa0ef0057be8c73db7d717ae2a8c7e5e662420 100644 --- a/Tools/PyUtils/python/scripts/cmake_depends.py +++ b/Tools/PyUtils/python/scripts/cmake_depends.py @@ -16,6 +16,8 @@ import PyUtils.acmdlib as acmdlib import argparse import pygraphviz +# Style for python dependencies: +py_style = 'dashed' def read_package_list(package_file): """Read packages.txt as a source for the full package path""" @@ -100,7 +102,7 @@ def add_legend(graph): for n in 'abcd': l.add_node(n, shape='point', style='invis') l.add_edge('a','b', label='C++', constraint=False) - l.add_edge('c','d', label='Python', style='dashed', constraint=False) + l.add_edge('c','d', label='Python', style=py_style, constraint=False) class AthGraph: @@ -173,7 +175,7 @@ class AthGraph: help='recursively resolve dependencies up to DEPTH (default: unlimited)') @acmdlib.argument('--py', action='store_true', - help='add Python dependencies') + help=f'add Python dependencies (marked with ":py" in printout, {py_style} in graph)') @acmdlib.argument('--regex', action='store_true', help='treat NAME as regular expression') @@ -184,8 +186,8 @@ class AthGraph: @acmdlib.argument('-d', '--dot', action='store_true', help='print DOT graph') -@acmdlib.argument('--noLegend', action='store_true', - help='do not add legend to graph') +@acmdlib.argument('--legend', action='store_true', + help='add legend to graph') # Debugging/expert options: @@ -286,17 +288,17 @@ def main(args): g = subgraph(pygraph, pysources, reverse=args.clients, maxdepth=args.recursive, nodegetter=lambda n : n.name) - graph.get_subgraph(target).add_edges_from(g.edges(), style='dashed') + graph.get_subgraph(target).add_edges_from(g.edges(), style=py_style) # Change style of nodes that have only Python dependencies: g = graph.get_subgraph(target) for n in g.nodes_iter(): - if all(e.attr['style']=='dashed' for e in g.edges_iter(n)): - n.attr['style'] = 'dashed' + if all(e.attr['style']==py_style for e in g.edges_iter(n)): + n.attr['style'] = py_style # Output final graph: - if not args.noLegend: + if args.dot and args.legend: add_legend(graph) if args.dot: @@ -305,4 +307,5 @@ def main(args): nodes = [e[0] for e in graph.in_edges_iter()] if args.clients \ else [e[1] for e in graph.out_edges_iter()] for p in sorted(set(nodes)): - print(p) + suffix = ':py' if p.attr['style']==py_style else '' + print(f'{p}{suffix}') diff --git a/Tools/Tier0ChainTests/test/test_recentrun_main_2018.sh b/Tools/Tier0ChainTests/test/test_recentrun_main_2018.sh index d5a4459467a7636fc901901ee728644aab472d65..41c9c8f82176c32fe4192946bdacddcf0a5fb7ef 100755 --- a/Tools/Tier0ChainTests/test/test_recentrun_main_2018.sh +++ b/Tools/Tier0ChainTests/test/test_recentrun_main_2018.sh @@ -8,7 +8,7 @@ # art-include: 21.3/Athena # art-include: 21.9/Athena -Reco_tf.py --AMI=f921 --maxEvents=250 --outputESDFile=myESD_Main.pool.root --outputAODFile=myAOD_Main.AOD.pool.root --outputHISTFile=myMergedMonitoring_Main.root --ignoreErrors=False --inputBSFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/data18_13TeV.00348618.physics_Main.daq.RAW._lb0220._SFO-1._0001.data +Reco_tf.py --AMI=f1089 --maxEvents=250 --outputESDFile=myESD_Main.pool.root --outputAODFile=myAOD_Main.AOD.pool.root --outputHISTFile=myMergedMonitoring_Main.root --ignoreErrors=False --inputBSFile=/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/data18_13TeV.00348618.physics_Main.daq.RAW._lb0220._SFO-1._0001.data echo "art-result: $? Reco" ArtPackage=$1 diff --git a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/TrkTrackSummaryUpdater/TrackSummaryUpdater.h b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/TrkTrackSummaryUpdater/TrackSummaryUpdater.h index 93967b3a40ea1a9c2d85fa8b0e2b30829a722265..c2e2a8e16598a08c1763d8aae220931a22c6c0af 100644 --- a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/TrkTrackSummaryUpdater/TrackSummaryUpdater.h +++ b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/TrkTrackSummaryUpdater/TrackSummaryUpdater.h @@ -39,7 +39,6 @@ namespace Trk { ToolHandle< Trk::IExtendedTrackSummaryTool > m_trkSummaryTool ; /** summary tool with shared hits enabled */ private: - bool m_createViewCollection; //!< option to create a view collection and not deep-copy tracks bool m_updateSharedHits; //!< do not create the track summary again, but only update shared hits bool m_updateAdditionalInfo; //!< do not create the track summary again, but only update necessary things }; diff --git a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/src/TrackSummaryUpdater.cxx b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/src/TrackSummaryUpdater.cxx index 098bee3bd0aa472b6a9aacef9295f2d6de48e343..df88877539469ac8f4f0e4b0aa01d44807030834 100644 --- a/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/src/TrackSummaryUpdater.cxx +++ b/Tracking/TrkAlgorithms/TrkTrackSummaryUpdater/src/TrackSummaryUpdater.cxx @@ -14,7 +14,6 @@ Trk::TrackSummaryUpdater::TrackSummaryUpdater (const std::string& name, ISvcLocator* pSvcLocator ) : AthAlgorithm(name, pSvcLocator ), - m_createViewCollection(true), m_updateSharedHits(true), m_updateAdditionalInfo(false){ m_inputTracksStoregateKey = "CombinedInDetTracks"; diff --git a/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/TrackingGeometrySvc.h b/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/TrackingGeometrySvc.h index 1de1c71903499896bbe15ccfd026660cb1a1d32e..747a0a000c0ce49ff3c947ed12da69f44197d2af 100755 --- a/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/TrackingGeometrySvc.h +++ b/Tracking/TrkDetDescr/TrkDetDescrSvc/TrkDetDescrSvc/TrackingGeometrySvc.h @@ -52,15 +52,15 @@ namespace Trk { //!< Retrieve interface ID static const InterfaceID& interfaceID() { return IID_ITrackingGeometrySvc; } - StatusCode initialize(); - StatusCode finalize(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; /** Query the interfaces. / Input: riid, Requested interface ID / ppvInterface, Pointer to requested interface / Return: StatusCode indicating SUCCESS or FAILURE. / N.B. Don't forget to release the interface after use!!! **/ - StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ); + virtual StatusCode queryInterface( const InterfaceID& riid, void** ppvInterface ) override; // TagInfoMgr callback virtual void tagInfoUpdated() override final; @@ -69,10 +69,10 @@ namespace Trk { StatusCode trackingGeometryInit(bool needsInit = true); /** Provide the TrackingGeometry */ - const Trk::TrackingGeometry* trackingGeometry() const; + virtual const Trk::TrackingGeometry* trackingGeometry() const override; //!< Returns the name of the TrackingGeometry built with this Svc - const std::string& trackingGeometryName() const; + virtual const std::string& trackingGeometryName() const override; friend class SvcFactory<TrackingGeometrySvc>; diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray.h index 41a47089e79408eddd051e20fde0c70f2b3b1479..9cd738fe6784baeba029dc72823296e9a8dfba69 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray.h +++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray.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 */ /////////////////////////////////////////////////////////////////// @@ -41,6 +41,7 @@ public: /** Implicit constructor */ virtual CompactBinnedArrayT* clone() const = 0; + virtual CompactBinnedArrayT* clone(const std::vector<T*>& ptrs) const = 0; /** layer bin utility */ virtual const Trk::BinUtility* layerBinUtility(const Amg::Vector3D& gp) const = 0; diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray1D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray1D.h index 7e304dd358a5f2ca4676dd427c2d27bfbd941ba8..2a22788d5cec4a21345b6ee50b1983a12a8646d6 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray1D.h +++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray1D.h @@ -94,6 +94,12 @@ public: return new CompactBinnedArray1DT(m_arrayObjects, m_array, m_binUtility->clone()); } + CompactBinnedArray1DT* clone(const std::vector<T*>& ptrs) const + { + assert (ptrs.size() == m_arrayObjects.size()); + return new CompactBinnedArray1DT(ptrs, m_array, m_binUtility->clone()); + } + /**Virtual Destructor*/ ~CompactBinnedArray1DT() { delete m_binUtility; } diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray2D.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray2D.h index 420bd1d0d8eafce2d0de5eb128d820d7610b74f3..5b6b3fa9cc3cb015f994b5b023a71fc904a6f9be 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray2D.h +++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/CompactBinnedArray2D.h @@ -103,6 +103,12 @@ public: return new CompactBinnedArray2DT(m_arrayObjects, m_array, m_binUtility->clone(), m_buVec); } + CompactBinnedArray2DT* clone(const std::vector<T*>& ptrs) const + { + assert (ptrs.size() == m_arrayObjects.size()); + return new CompactBinnedArray2DT(ptrs, m_array, m_binUtility->clone(), m_buVec); + } + /**Virtual Destructor*/ ~CompactBinnedArray2DT() { diff --git a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/BinnedMaterial.h b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/BinnedMaterial.h index ab6c04884cdc102bd5b43166574236051227fca3..d7bcd1bc2cda00b7c3c941c17715bb496e2cb901 100644 --- a/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/BinnedMaterial.h +++ b/Tracking/TrkDetDescr/TrkGeometry/TrkGeometry/BinnedMaterial.h @@ -16,6 +16,7 @@ #include <iomanip> #include <string> #include <climits> +#include <memory> #include "TrkGeometry/Material.h" #include "TrkDetDescrUtils/CompactBinnedArray.h" #include "TrkDetDescrUtils/CompactBinnedArray1D.h" @@ -38,9 +39,7 @@ namespace Trk { public: /** Default Constructor needed for POOL */ - BinnedMaterial(): - Material(), - m_matBins(nullptr){} + BinnedMaterial() = default; /** Constructor with arguments */ BinnedMaterial(float iX0, @@ -55,37 +54,21 @@ namespace Trk { /** Constructor with averaged material and binning in 1D*/ BinnedMaterial(const Material*& mat, BinUtility*& bu, const std::vector<size_t>& index, - const std::vector< const IdentifiedMaterial*>& detailedMat); + const std::vector<IdentifiedMaterial>& detailedMat); /** Constructor with averaged material and binning in 2D*/ BinnedMaterial(const Material*& mat, BinUtility*& bu, std::vector< Trk::BinUtility*>& bVec, const std::vector<std::vector<size_t> >& index, - const std::vector< const IdentifiedMaterial* >& detailedMat); + const std::vector<IdentifiedMaterial>& detailedMat); /** Copy Constructor */ - BinnedMaterial(const BinnedMaterial& amc) : - Material(amc), - m_matBins(amc.m_matBins? amc.m_matBins->clone() : nullptr ) - {} + BinnedMaterial(const BinnedMaterial& amc); - /** Desctructor - delete the composition if there */ - ~BinnedMaterial() { if (m_matBins) delete m_matBins; } + /** Destructor - delete the composition if there */ + ~BinnedMaterial() = default; /** Assignment operator */ - BinnedMaterial& operator=(const BinnedMaterial& amc) { - if (this != &amc){ - X0 = amc.X0; - L0 = amc.L0; - A = amc.A; - Z = amc.Z; - rho = amc.rho; - dEdX = amc.dEdX; - zOaTr = amc.zOaTr; - delete m_matBins; - m_matBins = amc.m_matBins ? amc.m_matBins->clone() : nullptr; - } - return (*this); - } + BinnedMaterial& operator=(const BinnedMaterial& amc); /** access to layer bin utility */ const Trk::BinUtility* layerBinUtility(const Amg::Vector3D& position) const; @@ -98,8 +81,10 @@ namespace Trk { const IdentifiedMaterial* materialNext(const Amg::Vector3D& pos,const Amg::Vector3D& dir, bool layOnly ) const; private: - const CompactBinnedArray< const IdentifiedMaterial >* m_matBins; - + std::vector<const Trk::IdentifiedMaterial* > ptrs() const; + std::vector<IdentifiedMaterial> m_matVec; + using binsPtr_t = std::unique_ptr<const CompactBinnedArray< const IdentifiedMaterial > >; + binsPtr_t m_matBins; }; diff --git a/Tracking/TrkDetDescr/TrkGeometry/src/BinnedMaterial.cxx b/Tracking/TrkDetDescr/TrkGeometry/src/BinnedMaterial.cxx index c72924044ad090f6e6a386ffc8ad5ae13069af2b..351094fa2cfa695d1c8d28971c1581c22088caa3 100755 --- a/Tracking/TrkDetDescr/TrkGeometry/src/BinnedMaterial.cxx +++ b/Tracking/TrkDetDescr/TrkGeometry/src/BinnedMaterial.cxx @@ -6,27 +6,63 @@ /** Constructor with averaged material and binning in 1D*/ Trk::BinnedMaterial::BinnedMaterial(const Trk::Material*& mat, Trk::BinUtility*& bu, const std::vector<size_t>& index, - const std::vector< const Trk::IdentifiedMaterial* >& detailedMat ) : + const std::vector<Trk::IdentifiedMaterial>& detailedMat ) : Trk::Material(*mat), - m_matBins(nullptr) + m_matVec (detailedMat), + m_matBins (std::make_unique<Trk::CompactBinnedArray1D<const Trk::IdentifiedMaterial> >(ptrs(),index,bu)) { - Trk::CompactBinnedArray1D<const Trk::IdentifiedMaterial >* bm = - new Trk::CompactBinnedArray1D<const Trk::IdentifiedMaterial >(detailedMat,index,bu); - m_matBins = bm; } /** Constructor with averaged material and binning in 2D*/ Trk::BinnedMaterial::BinnedMaterial(const Trk::Material*& mat, Trk::BinUtility*& bu, std::vector< Trk::BinUtility*>& bVec, const std::vector<std::vector<size_t> >& index, - const std::vector<const Trk::IdentifiedMaterial* >& detailedMat ) : + const std::vector<Trk::IdentifiedMaterial>& detailedMat ) : Trk::Material(*mat), - m_matBins(nullptr) + m_matVec (detailedMat), + m_matBins (std::make_unique<Trk::CompactBinnedArray2D<const Trk::IdentifiedMaterial> >(ptrs(),index,bu,bVec)) { - Trk::CompactBinnedArray2D<const Trk::IdentifiedMaterial >* bm = - new Trk::CompactBinnedArray2D<const Trk::IdentifiedMaterial >(detailedMat,index,bu,bVec); - m_matBins = bm; } +Trk::BinnedMaterial::BinnedMaterial(const BinnedMaterial& amc) : + Material(amc), + m_matVec (amc.m_matVec) +{ + if (amc.m_matBins) { + if (!m_matVec.empty()) { + m_matBins = binsPtr_t (amc.m_matBins->clone(ptrs())); + } + else { + m_matBins = binsPtr_t (amc.m_matBins->clone()); + } + } +} + +/** Assignment operator */ +Trk::BinnedMaterial& +Trk::BinnedMaterial::operator=(const BinnedMaterial& amc) +{ + if (this != &amc){ + X0 = amc.X0; + L0 = amc.L0; + A = amc.A; + Z = amc.Z; + rho = amc.rho; + dEdX = amc.dEdX; + zOaTr = amc.zOaTr; + m_matVec = amc.m_matVec; + m_matBins.reset(); + if (amc.m_matBins) { + if (!m_matVec.empty()) { + m_matBins = binsPtr_t (amc.m_matBins->clone(ptrs())); + } + else { + m_matBins = binsPtr_t (amc.m_matBins->clone()); + } + } + } + return (*this); +} + /** access to binned material */ const Trk::IdentifiedMaterial* Trk::BinnedMaterial::material(const Amg::Vector3D& position ) const { @@ -41,3 +77,14 @@ const Trk::IdentifiedMaterial* Trk::BinnedMaterial::materialNext(const Amg::Vect return mat ; } + +std::vector<const Trk::IdentifiedMaterial* > +Trk::BinnedMaterial::ptrs() const +{ + std::vector<const Trk::IdentifiedMaterial* > p; + p.reserve (m_matVec.size()); + for (const Trk::IdentifiedMaterial& m : m_matVec) { + p.push_back (&m); + } + return p; +} diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h index 2e57ce8ad6b12e5fb18aa5a6de6b1a01a5beda9b..84887a8093c1d5644eac9cd63ab27ca6bafed9b4 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h @@ -117,10 +117,6 @@ private: const SmoothedTrajectory&, const ParticleHypothesis particleHypothesis = nonInteracting) const; - //* Calculate the fit quality */ - std::unique_ptr<Trk::FitQuality> buildFitQuality( - const Trk::SmoothedTrajectory&) const; - /** Gsf smoothe trajectory*/ std::unique_ptr<SmoothedTrajectory> fit( const EventContext& ctx, diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfExtrapolator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfExtrapolator.h index 8f41475d80b3a20555d299a752e4698520865b3f..c0d6172e6fd938f8a56f03c3d152b62b39435bfc 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfExtrapolator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfExtrapolator.h @@ -252,13 +252,6 @@ private: PropDirection direction = anyDirection, ParticleHypothesis particleHypothesis = nonInteracting) const; - std::string layerRZoutput(const Trk::Layer* lay) const; - - std::string positionOutput(const Amg::Vector3D& pos) const; - - int radialDirection(const Trk::MultiComponentState& pars, - PropDirection dir) const; - ToolHandleArray<IPropagator> m_propagators{ this, "Propagators", {}, "" }; ToolHandle<INavigator> m_navigator{ this, "Navigator", diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialEffectsUpdator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialEffectsUpdator.h index 2d9b1750200cbecedb5fd2ad43389afe3b869ff4..da249730e4ee3a22ccef92c223583327f2e9d3e6 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialEffectsUpdator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialEffectsUpdator.h @@ -83,9 +83,6 @@ private: PropDirection direction = anyDirection, ParticleHypothesis particleHypothesis = nonInteracting) const; - /** Method to calculate the updated momentum based on material effects */ - bool updateP(AmgVector(5) &, double) const; - private: ToolHandle<IMultiStateMaterialEffects> m_materialEffects{ this, diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h index 7eb271c1cf365e9199eb10899620fa25bb2daf72..0cd12260c05b74087d01a6ab177412fdc2224dce 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h @@ -119,8 +119,6 @@ private: Trk::ParticleHypothesis particleHypothesis, MaterialUpdateType updateType) const; - bool updateP(double& qOverP, double deltaP) const; - std::pair<const Trk::MaterialProperties*, double> getMaterialProperties( const Trk::TrackParameters* trackParameters, const Trk::Layer& layer) const; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx index d30ea966bfc3860c6a2e7de3cb5fab1b8c6aeaf1..c1e22ae4ea430ef1a15711d90a13f6db21d00e30 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx @@ -31,6 +31,35 @@ #include <algorithm> #include <vector> +namespace { +std::unique_ptr<Trk::FitQuality> +buildFitQuality(const Trk::SmoothedTrajectory& smoothedTrajectory) +{ + + double chiSquared = 0.; + int numberDoF = -5; + // Loop over all TrackStateOnSurface objects in trajectory + Trk::SmoothedTrajectory::const_iterator stateOnSurface = + smoothedTrajectory.begin(); + for (; stateOnSurface != smoothedTrajectory.end(); ++stateOnSurface) { + if (!(*stateOnSurface)->type(Trk::TrackStateOnSurface::Measurement)) { + continue; + } + if ((*stateOnSurface)->fitQualityOnSurface() == nullptr) { + continue; + } + chiSquared += (*stateOnSurface)->fitQualityOnSurface()->chiSquared(); + numberDoF += (*stateOnSurface)->fitQualityOnSurface()->numberDoF(); + } + + if (std::isnan(chiSquared) || chiSquared <= 0.) { + return nullptr; + } + + return std::make_unique<Trk::FitQuality>(chiSquared, numberDoF); +} +} + Trk::GaussianSumFitter::GaussianSumFitter(const std::string& type, const std::string& name, const IInterface* parent) @@ -721,34 +750,6 @@ Trk::GaussianSumFitter::makePerigee( return perigeeMultiStateOnSurface; } -std::unique_ptr<Trk::FitQuality> -Trk::GaussianSumFitter::buildFitQuality( - const Trk::SmoothedTrajectory& smoothedTrajectory) const -{ - - double chiSquared = 0.; - int numberDoF = -5; - // Loop over all TrackStateOnSurface objects in trajectory - SmoothedTrajectory::const_iterator stateOnSurface = - smoothedTrajectory.begin(); - for (; stateOnSurface != smoothedTrajectory.end(); ++stateOnSurface) { - if (!(*stateOnSurface)->type(TrackStateOnSurface::Measurement)) { - continue; - } - if ((*stateOnSurface)->fitQualityOnSurface() == nullptr) { - continue; - } - chiSquared += (*stateOnSurface)->fitQualityOnSurface()->chiSquared(); - numberDoF += (*stateOnSurface)->fitQualityOnSurface()->numberDoF(); - } - - if (std::isnan(chiSquared) || chiSquared <= 0.) { - return nullptr; - } - - return std::make_unique<FitQuality>(chiSquared, numberDoF); -} - /* * Forwards fit on a set of PrepRawData */ diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfExtrapolator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfExtrapolator.cxx index 1b8dc6a944c0c7b91411faa99f83e8eefebc3057..48f106874d756558a64cbdb11e696544199a1a2c 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfExtrapolator.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfExtrapolator.cxx @@ -35,6 +35,44 @@ namespace { const bool useBoundaryMaterialUpdate(true); + +std::string +layerRZoutput(const Trk::Layer* lay) +{ + std::string result("NULL"); + if (not lay) { + return result; + } + result = "[r,z] = [ " + + std::to_string(lay->surfaceRepresentation().bounds().r()) + ", " + + std::to_string(lay->surfaceRepresentation().center().z()) + + " ] - Index "; + result += std::to_string(lay->layerIndex().value()); + return result; +} + +std::string +positionOutput(const Amg::Vector3D& pos) +{ + std::stringstream outStream; + outStream << "[r,phi,z] = [ " << pos.perp() << ", " << pos.phi() << ", " + << pos.z() << " ]"; + return outStream.str(); +} + +int +radialDirection(const Trk::MultiComponentState& pars, Trk::PropDirection dir) +{ + // safe inbound/outbound estimation + double prePositionR = pars.begin()->first->position().perp(); + return (prePositionR > + (pars.begin()->first->position() + + dir * 0.5 * prePositionR * pars.begin()->first->momentum().unit()) + .perp()) + ? -1 + : 1; +} + } Trk::GsfExtrapolator::GsfExtrapolator(const std::string& type, @@ -1578,44 +1616,6 @@ Trk::GsfExtrapolator::addMaterialtoVector(Cache& cache, } } -std::string -Trk::GsfExtrapolator::layerRZoutput(const Trk::Layer* lay) const -{ - std::string result("NULL"); - if (not lay) { - return result; - } - result = "[r,z] = [ " + - std::to_string(lay->surfaceRepresentation().bounds().r()) + ", " + - std::to_string(lay->surfaceRepresentation().center().z()) + - " ] - Index "; - result += std::to_string(lay->layerIndex().value()); - return result; -} - -std::string -Trk::GsfExtrapolator::positionOutput(const Amg::Vector3D& pos) const -{ - std::stringstream outStream; - outStream << "[r,phi,z] = [ " << pos.perp() << ", " << pos.phi() << ", " - << pos.z() << " ]"; - return outStream.str(); -} - -int -Trk::GsfExtrapolator::radialDirection(const Trk::MultiComponentState& pars, - PropDirection dir) const -{ - // safe inbound/outbound estimation - double prePositionR = pars.begin()->first->position().perp(); - return (prePositionR > - (pars.begin()->first->position() + - dir * 0.5 * prePositionR * pars.begin()->first->momentum().unit()) - .perp()) - ? -1 - : 1; -} - bool Trk::GsfExtrapolator::radialDirectionCheck( const EventContext& ctx, diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialEffectsUpdator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialEffectsUpdator.cxx index 029b45610157197493efb02d5864670cf802e919..85684a8a0b77bf0ef9cd3b753b9b80e19ac9fb91 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialEffectsUpdator.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialEffectsUpdator.cxx @@ -8,7 +8,6 @@ * @brief Implementation code for the class GsfMaterialEffectsUpdator */ - #include "TrkGaussianSumFilter/GsfMaterialEffectsUpdator.h" #include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h" @@ -19,6 +18,20 @@ #include "TrkGeometry/Layer.h" #include "TrkGeometry/MaterialProperties.h" +namespace { +bool +updateP(AmgVector(5) & stateVector, double deltaP) +{ + double p = 1. / std::abs(stateVector[Trk::qOverP]); + p += deltaP; + if (p <= 0.) { + return false; + } + double updatedIp = stateVector[Trk::qOverP] > 0. ? 1. / p : -1. / p; + stateVector[Trk::qOverP] = updatedIp; + return true; +} +} Trk::GsfMaterialEffectsUpdator::GsfMaterialEffectsUpdator( const std::string& type, @@ -435,21 +448,3 @@ Trk::GsfMaterialEffectsUpdator::compute( return computedState; } -/* ============================================================================ - updateP method - ============================================================================ - */ - -bool -Trk::GsfMaterialEffectsUpdator::updateP(AmgVector(5) & stateVector, - double deltaP) const -{ - double p = 1. / std::abs(stateVector[Trk::qOverP]); - p += deltaP; - if (p <= 0.) { - return false; - } - double updatedIp = stateVector[Trk::qOverP] > 0. ? 1. / p : -1. / p; - stateVector[Trk::qOverP] = updatedIp; - return true; -} diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolution.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolution.cxx index ea0daa7e41f0e257c71098a78cc9362681a1adc8..f930873e66872082e993339285fc2451df74c292 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolution.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolution.cxx @@ -23,6 +23,20 @@ #include "TrkMultiComponentStateOnSurface/MultiComponentState.h" #include "TrkSurfaces/PerigeeSurface.h" +namespace { +bool +updateP(double& qOverP, double deltaP) +{ + double p = 1. / std::abs(qOverP); + p += deltaP; + if (p <= 0.) { + return false; + } + qOverP = qOverP > 0. ? 1. / p : -1. / p; + return true; +} +} + Trk::GsfMaterialMixtureConvolution::GsfMaterialMixtureConvolution( const std::string& type, const std::string& name, @@ -443,18 +457,6 @@ Trk::GsfMaterialMixtureConvolution::update( return mergedState; } -bool -Trk::GsfMaterialMixtureConvolution::updateP(double& qOverP, double deltaP) const -{ - double p = 1. / std::abs(qOverP); - p += deltaP; - if (p <= 0.) { - return false; - } - qOverP = qOverP > 0. ? 1. / p : -1. / p; - return true; -} - std::pair<const Trk::MaterialProperties*, double> Trk::GsfMaterialMixtureConvolution::getMaterialProperties( const Trk::TrackParameters* trackParameters, diff --git a/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/FitMatrices.h b/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/FitMatrices.h index 2205bc52de7d2f2bb57aeb7f4f8bf2f568b4fe85..38170c7f5a948ce406af64678a6304ff99f289e6 100755 --- a/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/FitMatrices.h +++ b/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/FitMatrices.h @@ -20,7 +20,6 @@ // 5*5 final covariance with possible external contribution representing // leading material and field gradient effects // -// (c) ATLAS tracking software ////////////////////////////////////////////////////////////////////////////// #ifndef TRKIPATFITTERUTILS_FITMATRICES_H diff --git a/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/FitProcedure.h b/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/FitProcedure.h index 600c8b7af19c970ce97793d8ab763ba1d6f19201..bd9a0c9b1e87cd231f5edd1535321fafbb803c7c 100755 --- a/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/FitProcedure.h +++ b/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/FitProcedure.h @@ -13,7 +13,6 @@ // for clarity (i.e. to avoid an overly long class) the inner loop over // measurements is performed by MeasurementProcessor // -// (c) ATLAS tracking software ////////////////////////////////////////////////////////////////////////////// #ifndef TRKIPATFITTERUTILS_FITPROCEDURE_H diff --git a/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/IMaterialAllocator.h b/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/IMaterialAllocator.h index f730985eceaadad61753cf07217e5e37f369cba2..2949072a0db5ef04d98616d85484a17a0918f727 100755 --- a/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/IMaterialAllocator.h +++ b/Tracking/TrkFitter/TrkiPatFitterUtils/TrkiPatFitterUtils/IMaterialAllocator.h @@ -7,7 +7,6 @@ // tool interface to allocate tracking geometry material onto indet and/or // muon spectrometer tracks // -// (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// #ifndef TRKIPATFITTERUTILS_IMATERIALALLOCATOR_H diff --git a/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx b/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx index 3da9a55374e6147f68549a6e8fd28c530bf10366..abd50b910359d77e89d35420668857337a47c596 100755 --- a/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx +++ b/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx @@ -20,7 +20,6 @@ // 5*5 final covariance with possible external contribution representing // leading material and field gradient effects // -// (c) ATLAS tracking software ////////////////////////////////////////////////////////////////////////////// #include <iomanip> diff --git a/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitProcedure.cxx b/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitProcedure.cxx index 2deacb83a8783a2a02f23fdba169b061338d6975..7adacb872eb5e0fc2d9669d3c3a6955de46d106b 100755 --- a/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitProcedure.cxx +++ b/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitProcedure.cxx @@ -13,7 +13,6 @@ // for clarity (i.e. to avoid an overly long class) the inner loop over // measurements is performed by MeasurementProcessor // -// (c) ATLAS tracking software ////////////////////////////////////////////////////////////////////////////// diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IExtendedTrackSummaryHelperTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IExtendedTrackSummaryHelperTool.h index 2bb75e741c86e2a664f387312e10549cf1cb37ab..11d6e06e0c73b358501b564de58001aa9e63327b 100644 --- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IExtendedTrackSummaryHelperTool.h +++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IExtendedTrackSummaryHelperTool.h @@ -42,7 +42,11 @@ namespace Trk { /* Expand/Extend the interface , with methods using the EventContext * and Trk::PRDtoTrackMap. - * For now due to compatibility we provide a default implementation + */ + + /* + * For now due to client compatibility + * we provide a default implementations * in terms of the the older interface */ @@ -81,15 +85,21 @@ namespace Trk { (void)ctx; addDetailedTrackSummary(track,summary); }; + + virtual void updateExpectedHitInfo(const EventContext& ctx, + const Trk::Track& track, + Trk::TrackSummary& summary) const{ + + (void)ctx; + updateExpectedHitInfo(track,summary); + } + virtual void updateSharedHitCount( const Trk::Track&, const Trk::PRDtoTrackMap*, Trk::TrackSummary&) const {}; - virtual void updateExpectedHitInfo(const Trk::Track&, - Trk::TrackSummary&) const {}; - - virtual void updateAdditionalInfo(Trk::TrackSummary&, + virtual void updateAdditionalInfo(Trk::TrackSummary&, std::vector<float>&, float&, int&, @@ -100,7 +110,6 @@ namespace Trk { * of the interface for the methods with the same * name as the method above. */ - virtual void analyse( const Trk::Track& track, const RIO_OnTrack* rot, @@ -139,6 +148,14 @@ namespace Trk { { addDetailedTrackSummary(Gaudi::Hive::currentContext(), track, summary); } + + virtual void updateExpectedHitInfo(const Trk::Track& track, + Trk::TrackSummary& summary) const override{ + + updateExpectedHitInfo(Gaudi::Hive::currentContext(),track,summary); + } + + }; inline const InterfaceID& Trk::IExtendedTrackSummaryHelperTool::interfaceID() diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryHelperTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryHelperTool.h index 068e6e8f3bfd14794c3500c18a5af08d40b965cd..e8487834004ce6caac0295ad74a7c4e1686d6206 100755 --- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryHelperTool.h +++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackSummaryHelperTool.h @@ -64,7 +64,8 @@ namespace Trk { virtual void addDetailedTrackSummary(const Trk::Track& track, Trk::TrackSummary& summary) const = 0; - + virtual void updateExpectedHitInfo(const Trk::Track&, + Trk::TrackSummary&) const = 0; }; inline const InterfaceID& Trk::ITrackSummaryHelperTool::interfaceID() diff --git a/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.icc b/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.icc index 59c6cc29031c0a1488d5ef09f5bb43158af9f9d5..9c6472d28fd542d8224e9775597f85b50800da59 100644 --- a/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.icc +++ b/Tracking/TrkTools/TrkTrackSummaryTool/TrkTrackSummaryTool/TrackSummaryTool.icc @@ -17,7 +17,7 @@ TrackSummaryTool::updateTrackSummary(const EventContext& ctx, /*suppress hole search*/ UpdateSummary(ctx, track, nullptr, true); /*Needed for expected B-Layer*/ - m_idTool->updateExpectedHitInfo(track, *track.trackSummary()); + m_idTool->updateExpectedHitInfo(ctx,track, *track.trackSummary()); } inline void diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/DecayInFlyTruthTrajectoryBuilder.h b/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/DecayInFlyTruthTrajectoryBuilder.h index 9084aebc13f2bfe429ee4fff0338839591d559f2..152806ecaaf0bdabb0021a15a4bffaa1079596dd 100644 --- a/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/DecayInFlyTruthTrajectoryBuilder.h +++ b/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/DecayInFlyTruthTrajectoryBuilder.h @@ -22,21 +22,21 @@ namespace Trk { virtual StatusCode initialize(); - void buildTruthTrajectory(TruthTrajectory *result, const HepMC::GenParticle *input) const ; + void buildTruthTrajectory(TruthTrajectory *result, HepMC::ConstGenParticlePtr input) const ; /** Returns an umambiguous mother of the truth particle on a TruthTrajectory, or 0. * Implemented via truthTrajectoryCuts(). */ - const HepMC::GenParticle* getMother(const HepMC::GenParticle* particle) const; + HepMC::ConstGenParticlePtr getMother(HepMC::ConstGenParticlePtr particle) const; /** Returns an umambiguous daughter of the truth particle on a TruthTrajectory, or 0. * This assumes no one mother can correspond to no more than one daughter. * Implemented via truthTrajectoryCuts(). */ - const HepMC::GenParticle* getDaughter(const HepMC::GenParticle* particle) const; + HepMC::ConstGenParticlePtr getDaughter(HepMC::ConstGenParticlePtr particle) const; /** Return type for the next method */ - typedef std::pair<const HepMC::GenParticle*, const HepMC::GenParticle*> MotherDaughter; + typedef std::pair<HepMC::ConstGenParticlePtr,HepMC::ConstGenParticlePtr> MotherDaughter; /** * Decides if the vertex connects two particles on the same @@ -47,7 +47,7 @@ namespace Trk { * between mother and daughter particles; i.e. TruthTrajectories * are not allowed to branch. */ - MotherDaughter truthTrajectoryCuts(const HepMC::GenVertex *vtx) const; + MotherDaughter truthTrajectoryCuts(HepMC::ConstGenVertexPtr vtx) const; }; } // end namespace Trk diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/ElasticTruthTrajectoryBuilder.h b/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/ElasticTruthTrajectoryBuilder.h index 2a4fe184040fe0368b87dec06d41fa4ba1961473..8ecf777fcae14017e9d1709e78852a5680f505b0 100644 --- a/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/ElasticTruthTrajectoryBuilder.h +++ b/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/ElasticTruthTrajectoryBuilder.h @@ -22,21 +22,21 @@ namespace Trk { virtual StatusCode initialize(); - void buildTruthTrajectory(TruthTrajectory *result, const HepMC::GenParticle *input) const; + void buildTruthTrajectory(TruthTrajectory *result, HepMC::ConstGenParticlePtr input) const; /** Returns an umambiguous mother of the truth particle on a TruthTrajectory, or 0. * Implemented via truthTrajectoryCuts(). */ - const HepMC::GenParticle* getMother(const HepMC::GenParticle* particle) const; + HepMC::ConstGenParticlePtr getMother(HepMC::ConstGenParticlePtr particle) const; /** Returns an umambiguous daughter of the truth particle on a TruthTrajectory, or 0. * This assumes no one mother can correspond to no more than one daughter. * Implemented via truthTrajectoryCuts(). */ - const HepMC::GenParticle* getDaughter(const HepMC::GenParticle* particle) const; + HepMC::ConstGenParticlePtr getDaughter(HepMC::ConstGenParticlePtr particle) const; /** Return type for the next method */ - typedef std::pair<const HepMC::GenParticle*, const HepMC::GenParticle*> MotherDaughter; + typedef std::pair<HepMC::ConstGenParticlePtr, HepMC::ConstGenParticlePtr> MotherDaughter; /** * Decides if the vertex connects two particles on the same @@ -47,7 +47,7 @@ namespace Trk { * between mother and daughter particles; i.e. TruthTrajectories * are not allowed to branch. */ - MotherDaughter truthTrajectoryCuts(const HepMC::GenVertex *vtx) const; + MotherDaughter truthTrajectoryCuts(HepMC::ConstGenVertexPtr vtx) const; }; } // end namespace Trk diff --git a/Tracking/TrkTools/TrkTruthToTrack/TrkTruthToTrack/TruthToTrack.h b/Tracking/TrkTools/TrkTruthToTrack/TrkTruthToTrack/TruthToTrack.h index 8c6e2c779598c2672f740ebc61b501aebdad4fa7..4eebfb77307289017ce7aaca3db2edadfca56ae1 100755 --- a/Tracking/TrkTools/TrkTruthToTrack/TrkTruthToTrack/TruthToTrack.h +++ b/Tracking/TrkTools/TrkTruthToTrack/TrkTruthToTrack/TruthToTrack.h @@ -43,14 +43,14 @@ namespace Trk { /** Implements interface method. */ using ITruthToTrack::makeProdVertexParameters; - virtual const Trk::TrackParameters* makeProdVertexParameters(const HepMC::GenParticle* part) const; + virtual const Trk::TrackParameters* makeProdVertexParameters(HepMC::ConstGenParticlePtr part) const; virtual const Trk::TrackParameters* makeProdVertexParameters(const xAOD::TruthParticle* part) const; /** Implements interface method. * You can configure an extrapolator through the job options. */ using ITruthToTrack::makePerigeeParameters; - virtual const Trk::TrackParameters* makePerigeeParameters(const HepMC::GenParticle* part) const; + virtual const Trk::TrackParameters* makePerigeeParameters(HepMC::ConstGenParticlePtr part) const; virtual const Trk::TrackParameters* makePerigeeParameters(const xAOD::TruthParticle* part) const; private: diff --git a/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx b/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx index 8d7f147ff8dbd0de83304c2213c67977c65a5479..dfc1d669894aabda684e82e6dcf6518e5bc24cc7 100755 --- a/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx +++ b/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx @@ -58,7 +58,7 @@ StatusCode Trk::TruthToTrack::initialize() { //================================================================ -const Trk::TrackParameters* Trk::TruthToTrack::makeProdVertexParameters(const HepMC::GenParticle* part) const { +const Trk::TrackParameters* Trk::TruthToTrack::makeProdVertexParameters(HepMC::ConstGenParticlePtr part) const { Trk::TrackParameters *result = nullptr; if(part && part->production_vertex() && m_particleDataTable) { @@ -125,7 +125,7 @@ const Trk::TrackParameters* Trk::TruthToTrack::makeProdVertexParameters(const xA //================================================================ -const Trk::TrackParameters* Trk::TruthToTrack::makePerigeeParameters(const HepMC::GenParticle* part) const { +const Trk::TrackParameters* Trk::TruthToTrack::makePerigeeParameters(HepMC::ConstGenParticlePtr part) const { const Trk::TrackParameters* generatedTrackPerigee = nullptr; if(part && part->production_vertex() && m_particleDataTable && m_extrapolator) { diff --git a/Tracking/TrkVertexFitter/TrkVertexFitters/TrkVertexFitters/SequentialVertexSmoother.h b/Tracking/TrkVertexFitter/TrkVertexFitters/TrkVertexFitters/SequentialVertexSmoother.h index cc25da13f2c8473ec149075c80f950b15f9a2eba..d3db3753a1dece2639f16e14ccd65498950c2cca 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitters/TrkVertexFitters/SequentialVertexSmoother.h +++ b/Tracking/TrkVertexFitter/TrkVertexFitters/TrkVertexFitters/SequentialVertexSmoother.h @@ -60,7 +60,7 @@ namespace Trk * belonging to the VxCandidate with the knowledge * of the vertex position */ - virtual void smooth(xAOD::Vertex& vtx) const; + virtual void smooth(xAOD::Vertex& vtx) const override; private: diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinder_Config.py b/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinder_Config.py index 05c345cf6530afc9ca3a34836d03e1442af6f31b..8a0a72397ab1fb51de985bffbf59425adc94cdc8 100755 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinder_Config.py +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/python/TrigFastTrackFinder_Config.py @@ -44,6 +44,7 @@ class TrigFastTrackFinderMonitoring(GenericMonitoringTool): if type=='FS' or type=='JetFS' or type=='FullScan' or type=='fullScan': self.defineHistogram('roi_nSPs, TIME_PattReco', path='EXPERT',type='TH2F',title="PattReco time; nSPs", xbins = 200, xmin=0.0, xmax=200000.0, ybins = 100, ymin=0.0, ymax=40000.0) self.defineHistogram('roi_nTracks, TIME_PattReco',path='EXPERT',type='TH2F',title="PattReco time; nTracks", xbins = 50, xmin=0.0, xmax=10000.0, ybins = 100, ymin=0.0, ymax=40000.0) + self.defineHistogram('TIME_Total', path='EXPERT',type='TH1F',title="Total time (ms)", xbins = 200, xmin=0.0, xmax=15000.0) self.defineHistogram('TIME_PattReco', path='EXPERT',type='TH1F',title="Pure PattReco time (ms)", xbins = 200, xmin=0.0, xmax=40000.0) self.defineHistogram('TIME_SpacePointConversion', path='EXPERT',type='TH1F',title="SP Conversion time (ms)", xbins = 200, xmin=0.0, xmax=200.0) self.defineHistogram('TIME_ZFinder', path='EXPERT',type='TH1F',title="ZFinder time (ms)", xbins = 200, xmin=0.0, xmax=40000.0) @@ -53,6 +54,7 @@ class TrigFastTrackFinderMonitoring(GenericMonitoringTool): else: self.defineHistogram('roi_nSPs, TIME_PattReco', path='EXPERT',type='TH2F',title="PattReco time; nSPs", xbins = 200, xmin=0.0, xmax=3000.0, ybins = 100, ymin=0.0, ymax=400.0) self.defineHistogram('roi_nTracks, TIME_PattReco',path='EXPERT',type='TH2F',title="PattReco time; nTracks", xbins = 50, xmin=0.0, xmax=200.0, ybins = 100, ymin=0.0, ymax=400.0) + self.defineHistogram('TIME_Total', path='EXPERT',type='TH1F',title="Total time (ms)", xbins = 200, xmin=0.0, xmax=5000.0) self.defineHistogram('TIME_PattReco', path='EXPERT',type='TH1F',title="Pure PattReco time (ms)", xbins = 200, xmin=0.0, xmax=400.0) self.defineHistogram('TIME_SpacePointConversion', path='EXPERT',type='TH1F',title="SP Conversion time (ms)", xbins = 200, xmin=0.0, xmax=20.0) self.defineHistogram('TIME_ZFinder', path='EXPERT',type='TH1F',title="ZFinder time (ms)", xbins = 200, xmin=0.0, xmax=1000.0) diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx index f3c6a3bf5270273ab4a2c626b9d0272efd6f5caa..7e8dfded7723adb00bee754622618e2fbdc12f71 100644 --- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx +++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx @@ -522,17 +522,19 @@ StatusCode TrigFastTrackFinder::findTracks(InDet::SiTrackMakerEventData_xk &trac auto mnt_roi_nSPsSCT = Monitored::Scalar<int>("roi_nSPsSCT", 0); auto monSP = Monitored::Group(m_monTool, mnt_roi_nSPsPIX, mnt_roi_nSPsSCT); + auto mnt_timer_Total = Monitored::Timer<std::chrono::milliseconds>("TIME_Total"); auto mnt_timer_SpacePointConversion = Monitored::Timer<std::chrono::milliseconds>("TIME_SpacePointConversion"); auto mnt_timer_PatternReco = Monitored::Timer<std::chrono::milliseconds>("TIME_PattReco"); auto mnt_timer_TripletMaking = Monitored::Timer<std::chrono::milliseconds>("TIME_Triplets"); auto mnt_timer_CombTracking = Monitored::Timer<std::chrono::milliseconds>("TIME_CmbTrack"); auto mnt_timer_TrackFitter = Monitored::Timer<std::chrono::milliseconds>("TIME_TrackFitter"); - auto monTime = Monitored::Group(m_monTool, mnt_roi_nTracks, mnt_roi_nSPs, mnt_timer_SpacePointConversion, + auto monTime = Monitored::Group(m_monTool, mnt_roi_nTracks, mnt_roi_nSPs, mnt_timer_Total, mnt_timer_SpacePointConversion, mnt_timer_PatternReco, mnt_timer_TripletMaking, mnt_timer_CombTracking, mnt_timer_TrackFitter); auto mnt_roi_lastStageExecuted = Monitored::Scalar<int>("roi_lastStageExecuted", 0); auto monDataError = Monitored::Group(m_monTool, mnt_roi_lastStageExecuted); + mnt_timer_Total.start(); // Run3 monitoring mnt_timer_SpacePointConversion.start(); // Run3 monitoring @@ -782,6 +784,7 @@ StatusCode TrigFastTrackFinder::findTracks(InDet::SiTrackMakerEventData_xk &trac } mnt_timer_TrackFitter.stop(); // Run3 monitoring + mnt_timer_Total.stop(); // Run3 monitoring if( outputTracks.empty() ) { ATH_MSG_DEBUG("REGTEST / No tracks reconstructed"); diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.cxx index cff3a18595804d71ced744bdbbaa5aed661bb15e..128c2f490f152e2714eca03321e1812a546a5c51 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.cxx @@ -12,8 +12,7 @@ TrigL2MuonSA::MuFastDataPreparator::MuFastDataPreparator(const std::string& type, const std::string& name, const IInterface* parent): - AthAlgTool(type,name,parent), - m_regionSelector("RegSelSvc", name) + AthAlgTool(type,name,parent) { } @@ -33,9 +32,6 @@ StatusCode TrigL2MuonSA::MuFastDataPreparator::initialize() ATH_CHECK(m_readKey.initialize()); - ATH_CHECK(m_regionSelector.retrieve()); - ATH_MSG_DEBUG("Retrieved the RegionSelector service "); - if (m_use_rpc) { ATH_CHECK(m_rpcDataPreparator.retrieve()); ATH_MSG_DEBUG("Retrieved service " << m_rpcDataPreparator); @@ -65,10 +61,6 @@ StatusCode TrigL2MuonSA::MuFastDataPreparator::initialize() ATH_CHECK(m_rpcPatFinder.retrieve()); ATH_MSG_DEBUG("Retrieved service " << m_rpcPatFinder); - // set the geometry tools - m_rpcRoadDefiner->setMdtGeometry(m_regionSelector); - m_tgcRoadDefiner->setMdtGeometry(m_regionSelector); - return StatusCode::SUCCESS; } diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.h index 0f896e18374be9f4368ac61c76d35bda3bdfee29..f86150842b7879249788a3cf2f6ebc3216af5d0d 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MuFastDataPreparator.h @@ -12,7 +12,6 @@ #include "MuonCnvToolInterfaces/IMuonRawDataProviderTool.h" #include "ByteStreamCnvSvcBase/ROBDataProviderSvc.h" -#include "RegionSelector/IRegSelSvc.h" #include "TrigT1Interfaces/RecMuonRoI.h" #include "TrigT1Interfaces/RecMuonRoiSvc.h" @@ -102,8 +101,6 @@ class MuFastDataPreparator: public AthAlgTool { TrigL2MuonSA::MuFastDataPreparatorOptions m_options; SG::ReadCondHandleKey<RpcCablingCondData> m_readKey{this, "ReadKey", "RpcCablingCondData", "Key of RpcCablingCondData"}; - ServiceHandle<IRegSelSvc> m_regionSelector; - ServiceHandle<LVL1RPC::RPCRecRoiSvc> m_recRPCRoiSvc{this, "RPCRecRoiSvc", "LVL1RPC::RPCRecRoiSvc"}; ToolHandle<RpcDataPreparator> m_rpcDataPreparator{this, "RPCDataPreparator", "TrigL2MuonSA::RpcDataPreparator"}; ToolHandle<TgcDataPreparator> m_tgcDataPreparator{this, "TGCDataPreparator", "TrigL2MuonSA::TgcDataPreparator"}; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.cxx index 5741838c0e371b027084475d61defaa220d67d9b..5445ae2d65fbebf86cef50cf8039b06c7b5d0f2f 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.cxx @@ -14,8 +14,7 @@ TrigL2MuonSA::RpcRoadDefiner::RpcRoadDefiner(const std::string& type, const std::string& name, const IInterface* parent): - AthAlgTool(type, name, parent), - m_regionSelector( "RegSelSvc", name ) + AthAlgTool(type, name, parent) { } @@ -25,6 +24,10 @@ TrigL2MuonSA::RpcRoadDefiner::RpcRoadDefiner(const std::string& type, StatusCode TrigL2MuonSA::RpcRoadDefiner::initialize() { ATH_CHECK(m_idHelperSvc.retrieve()); + + ATH_CHECK(m_regionSelector.retrieve()); + ATH_MSG_DEBUG("Retrieved the RegionSelector tool "); + return StatusCode::SUCCESS; } @@ -159,8 +162,11 @@ StatusCode TrigL2MuonSA::RpcRoadDefiner::defineRoad(const LVL1::RecMuonRoI* const IRoiDescriptor* iroi = (IRoiDescriptor*) roi; - if (iroi) m_regionSelector->DetHashIDList(MDT, *iroi, mdtHashList); - else m_regionSelector->DetHashIDList(MDT, mdtHashList); + if (iroi) m_regionSelector->HashIDList(*iroi, mdtHashList); + else { + TrigRoiDescriptor fullscan_roi( true ); + m_regionSelector->HashIDList(fullscan_roi, mdtHashList); + } if(roi) delete roi; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.h index 895a783c3e88633a0591a8c0467961b1b1d48304..a5c332386d611e7fc2d651963f13adc29bf0f200 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/RpcRoadDefiner.h @@ -17,7 +17,7 @@ #include "RpcFitResult.h" #include "BarrelRoadData.h" #include "TrigT1Interfaces/RecMuonRoI.h" -#include "RegionSelector/IRegSelSvc.h" +#include "IRegionSelector/IRegSelTool.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" #include <string> @@ -50,7 +50,6 @@ class RpcRoadDefiner: public AthAlgTool double roiEtaMinHigh, double roiEtaMaxHigh) const; - void setMdtGeometry(const ServiceHandle<IRegSelSvc>& regionSelector){ m_regionSelector = regionSelector; }; void setRoadWidthForFailure(double rWidth_RPC_Failed){ m_rWidth_RPC_Failed = rWidth_RPC_Failed; }; void setRpcGeometry(bool use_rpc){ m_use_rpc = use_rpc; }; @@ -62,7 +61,7 @@ class RpcRoadDefiner: public AthAlgTool double m_rWidth_RPC_Failed{0}; bool m_use_rpc{true}; - ServiceHandle<IRegSelSvc> m_regionSelector; + ToolHandle<IRegSelTool> m_regionSelector{this, "RegionSelectionTool", "RegSelTool/RegSelTool_MDT", "MDT Region Selector Tool"}; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx index 7511369023e3682798d62c7c3fd66c73747dc78e..ef4b19d5bc2bea5a2da39c4b3e26ceb3d393b739 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx @@ -19,8 +19,7 @@ TrigL2MuonSA::TgcRoadDefiner::TgcRoadDefiner(const std::string& type, const std::string& name, const IInterface* parent): - AthAlgTool(type, name, parent), - m_regionSelector( "RegSelSvc", name ) + AthAlgTool(type, name, parent) { } @@ -32,6 +31,9 @@ StatusCode TrigL2MuonSA::TgcRoadDefiner::initialize() ATH_CHECK(AthAlgTool::initialize()); + ATH_CHECK(m_regionSelector.retrieve()); + ATH_MSG_DEBUG("Retrieved the RegionSelector tool "); + ATH_CHECK(m_tgcFit.retrieve()); ATH_MSG_DEBUG("Retrieved service " << m_tgcFit); @@ -333,8 +335,11 @@ StatusCode TrigL2MuonSA::TgcRoadDefiner::defineRoad(const LVL1::RecMuonRoI* if(phiMin < M_PI*-1) phiMin += M_PI*2.; TrigRoiDescriptor* roi = new TrigRoiDescriptor( p_roi->eta(), etaMin, etaMax, p_roi->phi(), phiMin, phiMax ); const IRoiDescriptor* iroi = (IRoiDescriptor*) roi; - if (iroi) m_regionSelector->DetHashIDList(MDT, *iroi, mdtHashList); - else m_regionSelector->DetHashIDList(MDT, mdtHashList); + if (iroi) m_regionSelector->HashIDList(*iroi, mdtHashList); + else { + TrigRoiDescriptor fullscan_roi( true ); + m_regionSelector->HashIDList(fullscan_roi, mdtHashList); + } if(roi) delete roi; for(const IdentifierHash& i_hash : mdtHashList ){ diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.h index 6987ce71bf4d95a295d67d7bc64ba246b93f8d46..0fed868b83f86834e2005dd177d6758ab74068d8 100644 --- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.h +++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.h @@ -17,7 +17,7 @@ #include "MuonRoad.h" #include "MdtRegion.h" #include "TrigT1Interfaces/RecMuonRoI.h" -#include "RegionSelector/IRegSelSvc.h" +#include "IRegionSelector/IRegSelTool.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" #include <string> @@ -42,7 +42,6 @@ class TgcRoadDefiner: public AthAlgTool TrigL2MuonSA::MuonRoad& muonRoad, TrigL2MuonSA::TgcFitResult& tgcFitResult) const; - void setMdtGeometry(const ServiceHandle<IRegSelSvc>& regionSelector) { m_regionSelector = regionSelector; }; void setPtLUT(const TrigL2MuonSA::PtEndcapLUTSvc* ptEndcapLUTSvc) { m_ptEndcapLUT = ptEndcapLUTSvc->ptEndcapLUT(); }; void setRoadWidthForFailure(double rWidth_TGC_Failed) { m_rWidth_TGC_Failed = rWidth_TGC_Failed; }; void setExtrapolatorTool(ToolHandle<ITrigMuonBackExtrapolator>* backExtrapolator) { m_backExtrapolatorTool = backExtrapolator; }; @@ -63,7 +62,7 @@ class TgcRoadDefiner: public AthAlgTool double m_rWidth_TGC_Failed {0}; - ServiceHandle<IRegSelSvc> m_regionSelector; + ToolHandle<IRegSelTool> m_regionSelector{this, "RegionSelectionTool", "RegSelTool/RegSelTool_MDT", "MDT Region Selector Tool"}; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py b/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py index 8fd01362166d534ea16bf1ea0c189553637df7c4..335f740404724062ff38a12a2ee9ec842aebd486 100644 --- a/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py +++ b/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py @@ -51,30 +51,6 @@ def getAtlasExtrapolator(): cached_instances[_name] = theAtlasExtrapolator return theAtlasExtrapolator -######################################################################## -def getTauVertexCorrection(): - from tauRec.tauRecFlags import tauFlags - from tauRecTools.tauRecToolsConf import TauVertexCorrection - - _name = sPrefix + 'TauVertexCorrection' - - if _name in cached_instances: - return cached_instances[_name] - - # FIXME:doJetVertexCorrection need to be False even though origin correction - # is turned on in jet reconstruction. - # If the seed jet is PFlow jets, then the tau axis will be corrected to point - # at PV0, but the clusters will not be corrected. - - doJetVertexCorrection = False - - myTauVertexCorrection = TauVertexCorrection(name = _name, - SeedJet = tauFlags.tauRecSeedJetCollection(), - VertexCorrection = doVertexCorrection, - JetVertexCorrection = doJetVertexCorrection) - - cached_instances[_name] = myTauVertexCorrection - return myTauVertexCorrection # JetSeedBuilder def getJetSeedBuilder(): @@ -142,7 +118,7 @@ def getMvaTESVariableDecorator(): from AthenaCommon.AppMgr import ToolSvc from tauRecTools.tauRecToolsConf import MvaTESVariableDecorator MvaTESVariableDecorator = MvaTESVariableDecorator(name = _name, - TauVertexCorrection = getTauVertexCorrection()) + VertexCorrection = doVertexCorrection) MvaTESVariableDecorator.Key_vertexInputContainer = "" @@ -179,7 +155,6 @@ def getCellVariables(cellConeSize=0.2): from tauRecTools.tauRecToolsConf import TauCellVariables TauCellVariables = TauCellVariables(name = _name, - CellEthreshold = 0.2*GeV, StripEthreshold = 0.2*GeV, CellCone = cellConeSize, VertexCorrection = doVertexCorrection) @@ -419,87 +394,6 @@ def getCellWeightTool(): cached_instances[_name] = CaloWeightTool return CaloWeightTool -######################################################################### -# Bonn Pi0 algo -# Cluster finder for Pi0 algo -def getBonnPi0ClusterFinder(): - _name = sPrefix + 'BonnPi0ClusterFinder' - - if _name in cached_instances: - return cached_instances[_name] - - from CaloRec.CaloRecConf import CaloCellContainerFinalizerTool - TauCellContainerFinalizer = CaloCellContainerFinalizerTool(name=sPrefix+'tauPi0CellContainerFinalizer') - - from AthenaCommon.AppMgr import ToolSvc - ToolSvc += TauCellContainerFinalizer - - from tauRecTools.tauRecToolsConf import TauPi0BonnCreateROI - TauPi0BonnCreateROI = TauPi0BonnCreateROI(name = _name, - CaloWeightTool = getCellWeightTool(), - CellMakerTool = TauCellContainerFinalizer, - #LonParFile = "longitudinal_para.dat", - #LatParFile = "lateral_para.dat", - LatParFile = "lateral_para.root", - #OriginCorrectionTool = getTauCellCorrection(), - ChargedPFOContainerName = 'TauPi0BonnChargedPFOContainer', - ) - - cached_instances[_name] = TauPi0BonnCreateROI - return TauPi0BonnCreateROI - -##################### -# create Pi0 clusters -def getBonnPi0ClusterCreator(): - _name = sPrefix + 'BonnPi0ClusterCreator' - - if _name in cached_instances: - return cached_instances[_name] - - from tauRecTools.tauRecToolsConf import TauPi0BonnClusterCreator - TauPi0BonnClusterCreator = TauPi0BonnClusterCreator(name = _name, - InputPi0ClusterContainerName = 'TauPi0BonnSubtractedClusterContainer', - OutputPi0ClusterContainerName = 'TauPi0BonnClusterContainer', - NeutralPFOContainerName= 'TauPi0BonnNeutralPFOContainer', - ) - - cached_instances[_name] = TauPi0BonnClusterCreator - return TauPi0BonnClusterCreator - -##################### -# calculate MVA scores of pi0 clusters -def getPi0BonnScoreCalculator(): - _name = sPrefix + 'BonnPi0ScoreCalculator' - - if _name in cached_instances: - return cached_instances[_name] - - from tauRecTools.tauRecToolsConf import TauPi0BonnScoreCalculator - TauPi0BonnScoreCalculator = TauPi0BonnScoreCalculator(name = _name, - ReaderOption = 'Silent:!Color', - BDTWeightFile = 'TauPi0BonnBDTWeights.xml', - ) - - cached_instances[_name] = TauPi0BonnScoreCalculator - return TauPi0BonnScoreCalculator - -##################### -# select pi0 clusters -def getPi0BonnSelector(): - _name = sPrefix + 'BonnPi0Selector' - - if _name in cached_instances: - return cached_instances[_name] - - from tauRecTools.tauRecToolsConf import TauPi0BonnSelector - TauPi0BonnSelector = TauPi0BonnSelector(name = _name, - ClusterEtCut = (2100.*MeV,2500.*MeV,2600.*MeV,2400.*MeV,1900.*MeV), - ClusterBDTCut_1prong = (0.46,0.39,0.51,0.47,0.54), - ClusterBDTCut_mprong = (0.47,0.52,0.60,0.55,0.50), - ) - - cached_instances[_name] = TauPi0BonnSelector - return TauPi0BonnSelector ######################################################################### # Photon Shot Finder algo @@ -796,7 +690,7 @@ def getTauIDVarCalculator(): from AthenaCommon.AppMgr import ToolSvc from tauRecTools.tauRecToolsConf import TauIDVarCalculator TauIDVarCalculator = TauIDVarCalculator(name=_name, - TauVertexCorrection=getTauVertexCorrection()) + VertexCorrection = doVertexCorrection) ToolSvc += TauIDVarCalculator cached_instances[_name] = TauIDVarCalculator @@ -844,12 +738,12 @@ def getTauJetRNNEvaluator(NetworkFile0P="", NetworkFile1P="", NetworkFile3P="", MaxTracks=MaxTracks, MaxClusters=MaxClusters, MaxClusterDR=MaxClusterDR, + VertexCorrection=doVertexCorrection, InputLayerScalar=InputLayerScalar, InputLayerTracks=InputLayerTracks, InputLayerClusters=InputLayerClusters, OutputLayer=OutputLayer, - OutputNode=OutputNode, - TauVertexCorrection=getTauVertexCorrection()) + OutputNode=OutputNode) ToolSvc += TauJetRNNEvaluator cached_instances[_name] = TauJetRNNEvaluator diff --git a/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMerged.cxx b/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMerged.cxx index 78333bc108cb99c2cc5f91b691795743b5437925..7b615deee6f4697c90b7aced4d47e1e6e8d3b748 100755 --- a/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMerged.cxx +++ b/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMerged.cxx @@ -41,6 +41,7 @@ #include "xAODTau/TauDefs.h" #include "xAODTau/TauTrackContainer.h" #include "xAODTau/TauTrackAuxContainer.h" +#include "xAODCaloEvent/CaloVertexedTopoCluster.h" #include "LumiBlockComps/ILumiBlockMuTool.h" @@ -845,7 +846,7 @@ HLT::ErrorCode TrigTauRecMerged::hltExecute(const HLT::TriggerElement* inputTE, std::map<std::string, std::map<std::string, std::vector<double>> > rnn_vector; std::vector<const xAOD::TauTrack *> tracks; - std::vector<const xAOD::CaloCluster *> clusters; + std::vector<xAOD::CaloVertexedTopoCluster> clusters; // TODO: these lines are commented out since the check returns "StatusCode", while "HLT::ErrorCode" is expected. This means no cluster or track variables are monitored //ATH_CHECK(m_rnn_evaluator->get_tracks(*p_tau, tracks)); //ATH_CHECK(m_rnn_evaluator->get_clusters(*p_tau, clusters)); diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfigMT_Tier0.h b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfigMT_Tier0.h index 0329f3aa51561c651664bd108ecd2b8b646b70a2..080c2156d02bdca154e0f746d2061ec8e5d5a1a9 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfigMT_Tier0.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfigMT_Tier0.h @@ -928,20 +928,17 @@ protected: int _ip = 0; /// count of particles in this interaction - int pid = (*evitr)->signal_process_id(); + int pid = HepMC::signal_process_id((*evitr)); - if ( pid!=0 && (*evitr)->particles_size()>0 ) { /// hooray! actually found a sensible event - /// go through the particles - HepMC::GenEvent::particle_const_iterator pitr((*evitr)->particles_begin()); - HepMC::GenEvent::particle_const_iterator pend((*evitr)->particles_end()); + //The logic should be clarified here + if ( pid!=0 ) { /// hooray! actually found a sensible event - while ( pitr!=pend ) { + for (auto pitr: *(*evitr) ) { - selectorTruth.selectTrack( *pitr ); + selectorTruth.selectTrack( pitr ); ++_ip; - - ++pitr; + } } diff --git a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfig_Tier0.h b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfig_Tier0.h index 99c320e463a8c360d24cd021a1adf2d738468376..6de9f6db838c9b523337d617854faa4590574f6f 100644 --- a/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfig_Tier0.h +++ b/Trigger/TrigAnalysis/TrigInDetAnalysisExample/TrigInDetAnalysisExample/T_AnalysisConfig_Tier0.h @@ -1089,20 +1089,17 @@ protected: int _ip = 0; /// count of particles in this interaction - int pid = (*evitr)->signal_process_id(); + int pid = HepMC::signal_process_id((*evitr)); - if ( pid!=0 && (*evitr)->particles_size()>0 ) { /// hooray! actually found a sensible event - /// go through the particles - HepMC::GenEvent::particle_const_iterator pitr((*evitr)->particles_begin()); - HepMC::GenEvent::particle_const_iterator pend((*evitr)->particles_end()); + //The logic should be clarified here + if ( pid!=0 ) { /// hooray! actually found a sensible event - while ( pitr!=pend ) { + for (auto pitr: *(*evitr)) { - selectorTruth.selectTrack( *pitr ); + selectorTruth.selectTrack( pitr ); ++_ip; - ++pitr; } } diff --git a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/DataStructure.h b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/DataStructure.h index da6a9fe0fb60992d3db8dec258d78ce79ea34bd4..856e64e1033aa50728d91cf942ea529b3b69eb6d 100644 --- a/Trigger/TrigConfiguration/TrigConfData/TrigConfData/DataStructure.h +++ b/Trigger/TrigConfiguration/TrigConfData/TrigConfData/DataStructure.h @@ -13,6 +13,7 @@ #include <vector> #include <memory> #include <type_traits> +#include <optional> #include "boost/property_tree/ptree.hpp" namespace TrigConf { diff --git a/Trigger/TrigConfiguration/TrigConfData/src/L1Menu.cxx b/Trigger/TrigConfiguration/TrigConfData/src/L1Menu.cxx index 3becff35226048a63f09857195565f11dcb2c7b7..282094b00735e03f22ac69b4e13107e7e5a27042 100644 --- a/Trigger/TrigConfiguration/TrigConfData/src/L1Menu.cxx +++ b/Trigger/TrigConfiguration/TrigConfData/src/L1Menu.cxx @@ -28,7 +28,7 @@ TrigConf::L1Menu::update() try { m_name = getAttribute("name"); // thresholds - for( const std::string & path : {"thresholds", "thresholds.legacyCalo" } ) { + for( const std::string path : {"thresholds", "thresholds.legacyCalo" } ) { for( auto & thrByType : data().get_child( path ) ) { const std::string & thrType = thrByType.first; if (thrType == "legacyCalo") @@ -93,7 +93,7 @@ TrigConf::L1Menu::update() try { // algorithms - for( const std::string & algoCategory : { "TOPO", "MULTTOPO", "MUTOPO", "R2TOPO" } ) { + for( const std::string algoCategory : { "TOPO", "MULTTOPO", "MUTOPO", "R2TOPO" } ) { auto & v = m_algorithmsByCategory[algoCategory] = std::vector<TrigConf::L1TopoAlgorithm>(); if(algoCategory == "MULTTOPO") { for( auto & alg : data().get_child( "topoAlgorithms." + algoCategory + ".multiplicityAlgorithms" ) ) { diff --git a/Trigger/TrigConfiguration/TrigConfIO/src/JsonFileWriter.cxx b/Trigger/TrigConfiguration/TrigConfIO/src/JsonFileWriter.cxx index 870de3386f59f50ae9029251a92ddc8ff0abe2d2..2d51128c2feb6df8b39e24a03106d8d07ebe2b39 100644 --- a/Trigger/TrigConfiguration/TrigConfIO/src/JsonFileWriter.cxx +++ b/Trigger/TrigConfiguration/TrigConfIO/src/JsonFileWriter.cxx @@ -224,7 +224,7 @@ TrigConf::JsonFileWriter::writeJsonFile(const std::string & filename, const L1Me if(thrType == "EM") { auto & eminfo = l1menu.thrExtraInfo().EM(); - for(const std::string & isoSet : { "EMIsoForEMthr", "HAIsoForEMthr" }) { + for(const std::string isoSet : { "EMIsoForEMthr", "HAIsoForEMthr" }) { jThrType["isolation"][isoSet]["thrtype"] = isoSet; jThrType["isolation"][isoSet]["Parametrization"] = json::array_t({}); for(size_t bit = 1; bit<=5; ++bit) { @@ -412,7 +412,7 @@ TrigConf::JsonFileWriter::writeJsonFile(const std::string & filename, const L1Me {L1TopoAlgorithm::AlgorithmType::MULTIPLICITY, "multiplicityAlgorithms"} }; - for( const std::string & topoCat : {"TOPO", "MUTOPO", "MULTTOPO", "R2TOPO"} ) { + for( const std::string topoCat : {"TOPO", "MUTOPO", "MULTTOPO", "R2TOPO"} ) { for(auto & algName : l1menu.topoAlgorithmNames(topoCat)) { json jalg = json::object_t({}); auto & alg = l1menu.algorithm(algName,topoCat); diff --git a/Trigger/TrigConfiguration/TrigConfIO/utils/TestTriggerMenuAccess.cxx b/Trigger/TrigConfiguration/TrigConfIO/utils/TestTriggerMenuAccess.cxx index 0d323dcb9b47e507c3fe94129b34227b22c713e2..328f4230b61d8c1f3afdd1b7d2fcbfbe52f4f9f4 100644 --- a/Trigger/TrigConfiguration/TrigConfIO/utils/TestTriggerMenuAccess.cxx +++ b/Trigger/TrigConfiguration/TrigConfIO/utils/TestTriggerMenuAccess.cxx @@ -292,7 +292,7 @@ testL1Menu_Extrainfo(const TrigConf::L1Menu & l1menu) cout << " EM" << endl; cout << " energy resolution (MeV) " << exEM.resolutionMeV() << endl; cout << " ptMinToTopo " << exEM.ptMinToTopo() << endl; - for( const std::string & tt : {"HAIsoForEMthr", "EMIsoForEMthr"} ) { + for( const std::string tt : {"HAIsoForEMthr", "EMIsoForEMthr"} ) { cout << " Isolation " << tt << endl; for(size_t bit = 1; bit <= 5; bit++) { auto & iso = exEM.isolation(tt, bit); diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/python/StreamerInfoGenerator.py b/Trigger/TrigDataAccess/TrigSerializeResult/python/StreamerInfoGenerator.py index 9dd5a0a4f6c10c99c09bc98433a580bd13c995c5..4d87c10e512d177a86bcd91c809ef34af12a7efb 100755 --- a/Trigger/TrigDataAccess/TrigSerializeResult/python/StreamerInfoGenerator.py +++ b/Trigger/TrigDataAccess/TrigSerializeResult/python/StreamerInfoGenerator.py @@ -2,6 +2,7 @@ # Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration import cppyy +import ROOT class StreamerInfoGenerator: def __init__(self): @@ -15,7 +16,7 @@ class StreamerInfoGenerator: self.type.EnableCintex() cppyy.load_library('libAtlasSTLAddReflexDict') #MN: switch off auto dict generation - god knows what that can mess up - cppyy.gbl.gROOT.ProcessLine(".autodict") + ROOT.gROOT.ProcessLine(".autodict") def inspect(self, typename): @@ -44,6 +45,8 @@ class StreamerInfoGenerator: except Exception: pass + # can't handle anonymous types + exceptions = ["string::(anonymous)"] try: # This doesn't work in ROOT 6.22 anymore # cl = cppyy.makeClass(typename) @@ -63,8 +66,10 @@ class StreamerInfoGenerator: if not dontAdd: self.classlist.append(typename) print("appended type to the classlist") - except Exception: - print('Cannot create class of ', typename) + except Exception as ex: + print('Cannot create class of {}: {}'.format(typename, ex)) + if typename not in exceptions: + raise ex t = self.type.ByName(typename) diff --git a/Trigger/TrigDataAccess/TrigSerializeResult/share/bs-streamerinfos.root b/Trigger/TrigDataAccess/TrigSerializeResult/share/bs-streamerinfos.root index c5496aff99e746fa01deef77d036623d0b574f2b..570b3058a08666e29327ecd83c49fa833c8a291d 100644 Binary files a/Trigger/TrigDataAccess/TrigSerializeResult/share/bs-streamerinfos.root and b/Trigger/TrigDataAccess/TrigSerializeResult/share/bs-streamerinfos.root differ diff --git a/Trigger/TrigEvent/TrigNavTools/CMakeLists.txt b/Trigger/TrigEvent/TrigNavTools/CMakeLists.txt index d9c1693d63f7ee3853e9b0a91a12f9164c594a04..2147e424b8b16761237dd5d9af78181810d4cf8e 100644 --- a/Trigger/TrigEvent/TrigNavTools/CMakeLists.txt +++ b/Trigger/TrigEvent/TrigNavTools/CMakeLists.txt @@ -17,4 +17,5 @@ atlas_add_component( TrigNavTools # Install files from the package: atlas_install_python_modules( python/__init__.py python/TrigNavToolsConfig.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py ) +atlas_install_scripts( share/RunNavDump.py ) diff --git a/Trigger/TrigEvent/TrigNavTools/share/RunNavDump.py b/Trigger/TrigEvent/TrigNavTools/share/RunNavDump.py new file mode 100755 index 0000000000000000000000000000000000000000..ebd811ec8d83fe42ae0dbd8eba590f2009b3edb4 --- /dev/null +++ b/Trigger/TrigEvent/TrigNavTools/share/RunNavDump.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# + +if __name__=='__main__': + import sys + + # Setup the Run III behavior + from AthenaCommon.Configurable import Configurable + Configurable.configurableRun3Behavior = 1 + + # Set the Athena configuration flags + from AthenaConfiguration.AllConfigFlags import ConfigFlags + parser = ConfigFlags.getArgumentParser() + args = parser.parse_args() + + #test input file: --filesInput='/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/Tier0ChainTests/q221/21.0/myAOD.pool.root' + + # Set the Athena configuration flags + ConfigFlags.fillFromArgs() + ConfigFlags.Output.AODFileName = "outAOD.pool.root" + ConfigFlags.Detector.GeometryLAr=True + ConfigFlags.Detector.GeometryTile=True + ConfigFlags.lock() + + # Initialize configuration object, add accumulator, merge, and run. + from AthenaConfiguration.MainServicesConfig import MainServicesCfg + from AthenaConfiguration.ComponentFactory import CompFactory + + from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg + cfg = MainServicesCfg(ConfigFlags) + cfg.merge(PoolReadCfg(ConfigFlags)) + + + from AthenaServices.MetaDataSvcConfig import MetaDataSvcCfg + cfg.merge(MetaDataSvcCfg(ConfigFlags)) + + confSvc = CompFactory.TrigConf.xAODConfigSvc("HLTConfigSvc") + cfg.addService(confSvc) + from AthenaCommon.Constants import DEBUG + alg = CompFactory.Run2ToRun3TrigNavConverter("TrigNavCnv", OutputLevel=DEBUG, HLTConfigSvc=confSvc) + alg.doPrint = False + alg.setConfig = ["xAOD::ElectronContainer","xAOD::TrigEMClusterContainer","xAOD::TrigEMCluster","xAOD::TrigElectron","xAOD::TrigElectronContainer","TrigRoiDescriptor","TrigRoiDescriptorCollection"] + cfg.addEventAlgo(alg, sequenceName="AthAlgSeq") + + + from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg + outputType="AOD" + toRecord = ["xAOD::TrigCompositeContainer#HLTNav_all", "xAOD::TrigCompositeAuxContainer#HLTNav_allAux.", + "xAOD::TrigCompositeContainer#HLTNav_Summary", "xAOD::TrigCompositeAuxContainer#HLTNav_SummaryAux."] + outputCfg = OutputStreamCfg(ConfigFlags, outputType, ItemList=toRecord, disableEventTag=True) + streamAlg = outputCfg.getEventAlgo("OutputStream"+outputType) + # need to expand possble options for the OutputStreamCfg to be able to pass also the metadata containers + streamAlg.MetadataItemList += ["xAOD::TriggerMenuContainer#TriggerMenu", "xAOD::TriggerMenuAuxContainer#TriggerMenuAux."] + streamAlg.TakeItemsFromInput = True + cfg.addPublicTool(CompFactory.xAODMaker.TriggerMenuMetaDataTool("TriggerMenuMetaDataTool")) + cfg.addService( CompFactory.MetaDataSvc("MetaDataSvc", MetaDataTools = [cfg.getPublicTool("TriggerMenuMetaDataTool")])) + + cfg.merge(outputCfg) + + # input EDM needs calo det descrition for conversion (uff) + from LArGeoAlgsNV.LArGMConfig import LArGMCfg + from TileGeoModel.TileGMConfig import TileGMCfg + cfg.merge(LArGMCfg(ConfigFlags)) + cfg.merge(TileGMCfg(ConfigFlags)) + + cfg.printConfig(withDetails=True, summariseProps=False) # set True for exhaustive info + sc = cfg.run(args.evtMax, args.loglevel) + sys.exit(0 if sc.isSuccess() else 1) diff --git a/Trigger/TrigEvent/TrigNavTools/src/Run2ToRun3TrigNavConverter.cxx b/Trigger/TrigEvent/TrigNavTools/src/Run2ToRun3TrigNavConverter.cxx new file mode 100644 index 0000000000000000000000000000000000000000..339c85b99b8b4b3920255a51313829a09154b4ab --- /dev/null +++ b/Trigger/TrigEvent/TrigNavTools/src/Run2ToRun3TrigNavConverter.cxx @@ -0,0 +1,194 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "Run2ToRun3TrigNavConverter.h" +//#include "TrigNavStructure/StandaloneNavigation.h" +#include "TrigConfHLTData/HLTChainList.h" +#include "TrigConfHLTData/HLTSignature.h" +#include "TrigConfHLTData/HLTTriggerElement.h" +#include "TrigNavStructure/TriggerElement.h" + + +Run2ToRun3TrigNavConverter::Run2ToRun3TrigNavConverter(const std::string& name, ISvcLocator* pSvcLocator) : + AthReentrantAlgorithm(name, pSvcLocator) +{ +} + +Run2ToRun3TrigNavConverter::~Run2ToRun3TrigNavConverter() +{ +} + +StatusCode Run2ToRun3TrigNavConverter::initialize() +{ + + ATH_CHECK( m_trigNavKey.initialize() ); + ATH_CHECK( m_trigNavWriteKey.initialize() ); + ATH_CHECK( m_trigSummaryWriteKey.initialize() ); + ATH_CHECK( m_configSvc.retrieve() ); + ATH_CHECK( m_clidSvc.retrieve() ); + + // retrievig CLID from names and storing to set + for (const auto& name : m_setConfig) { + CLID id {0}; + ATH_CHECK( m_clidSvc->getIDOfTypeName(name, id) ); + ATH_MSG_DEBUG("CLID NAME: " << name << " ID: " << id); + m_setCLID.insert(id); + } + + return StatusCode::SUCCESS; +} + +StatusCode Run2ToRun3TrigNavConverter::finalize() +{ + return StatusCode::SUCCESS; +} + +StatusCode Run2ToRun3TrigNavConverter::execute(const EventContext& context) const +{ + SG::ReadHandle navReadHandle(m_trigNavKey, context); + + ATH_CHECK( navReadHandle.isValid() ); + + HLT::StandaloneNavigation navDecoder = HLT::StandaloneNavigation(); + + navDecoder.deserialize( navReadHandle->serialized() ); + + SG::WriteHandle< TrigCompositeUtils::DecisionContainer > outputNavigation = TrigCompositeUtils::createAndStore( m_trigNavWriteKey, context ); + auto decisionOutput = outputNavigation.ptr(); + SG::WriteHandle< TrigCompositeUtils::DecisionContainer > outputSummary = TrigCompositeUtils::createAndStore( m_trigSummaryWriteKey, context ); + auto decisionSummary = outputSummary.ptr(); + TrigCompositeUtils::Decision* passRawOutput = TrigCompositeUtils::newDecisionIn( decisionSummary, "HLTPassRaw" ); + + + if (m_doPrint) { + std::string dump; + navDecoder.printASCIIArt(dump); + ATH_MSG_INFO(dump); + } + + // example chains used for testing + const std::string chainName{"HLT_e26_lhtight_nod0"}; + //const std::string chainName{"HLT_e28_lhtight_nod0"}; + + std::vector<HLT::TriggerElement*> tes; + TE_Decision_map mapTEtoDecision; // TE - Decision (xAOD::TrigComposite) + TE_Decision_map mapTEtoDecisionActive; // TE Active - Decision (xAOD::TrigComposite) + std::vector<TrigCompositeUtils::Decision*> decisionLast; // storing "last" decision in a chain + + std::vector<HLT::TriggerElement::FeatureAccessHelper> featureRoI; // for keeping predecessing TE with RoI + + + auto c = m_configSvc->chains().chain(chainName); + // create HLT Identifier aka decision ID + HLT::Identifier chainId = HLT::Identifier(chainName); + + + TrigCompositeUtils::Decision *passActive = TrigCompositeUtils::newDecisionIn(decisionOutput, "HLTActive"); + + ATH_MSG_DEBUG("CHAIN SIZE [signatures]: " << c->signatures().size()); + //for (auto s : c->signatures()) { + for (auto s_iter = c->signatures().begin(), first_s_iter = s_iter; s_iter != c->signatures().end(); ++s_iter) { + for (auto te : (*s_iter)->outputTEs()) { + tes.clear(); + decisionLast.clear(); + navDecoder.getAllOfType(te->id(), tes, false); + + for (auto teptr : tes) { + + for ( auto elemFE : vectorTEfeatures( teptr ) ) { + auto decision = TrigCompositeUtils::newDecisionIn(decisionOutput); + mapTEtoDecision[teptr].push_back( decision ); + if (teptr->getActiveState()) + { + auto decisionFeature = TrigCompositeUtils::newDecisionIn(decisionOutput); + TrigCompositeUtils::linkToPrevious(decisionFeature, decision, context); + mapTEtoDecisionActive[teptr].push_back( decisionFeature ); + ATH_CHECK(addTEfeatures( navDecoder, elemFE, decisionFeature )); + if (s_iter == first_s_iter) + { + for ( const auto& rNodes : HLT::TrigNavStructure::getRoINodes( teptr ) ) { + if ( HLT::TrigNavStructure::isRoINode(rNodes) ) { + for ( auto featureRoI : vectorTEfeatures( rNodes ) ) { + ATH_CHECK(addTEfeatures( navDecoder, featureRoI, decisionFeature, true )); + } + } + } + } + TrigCompositeUtils::addDecisionID(chainId, decisionFeature); + decisionLast.push_back( decisionFeature ); + } + } + + + for ( auto prep_ptr : navDecoder.getDirectPredecessors(teptr) ) { + if (mapTEtoDecision.find(prep_ptr) != mapTEtoDecision.end()) + { + for (auto d : mapTEtoDecision[teptr]) + { + for (auto pd : mapTEtoDecision[prep_ptr]) + { + TrigCompositeUtils::linkToPrevious(d, pd, context); + ATH_MSG_DEBUG("decision - previous decision"); + } + } + for (auto d : mapTEtoDecisionActive[teptr]) + { + for (auto pd : mapTEtoDecisionActive[prep_ptr]) + { + TrigCompositeUtils::linkToPrevious(d, pd, context); + ATH_MSG_DEBUG("ACTIVE decision - previous decision"); + } + } + } + } + + } + } + } + for ( auto last: decisionLast ) { + TrigCompositeUtils::Decision* filter = TrigCompositeUtils::newDecisionIn( decisionSummary, passActive, "F", context ); + TrigCompositeUtils::linkToPrevious(filter, last, context); + TrigCompositeUtils::decisionIDs(filter).push_back(chainId); + TrigCompositeUtils::linkToPrevious( passRawOutput, filter, context ); + } + TrigCompositeUtils::decisionIDs( passRawOutput ).push_back(chainId); + + + return StatusCode::SUCCESS; +} + +StatusCode Run2ToRun3TrigNavConverter::addTEfeatures(const HLT::StandaloneNavigation &navigationDecoder, HLT::TriggerElement::FeatureAccessHelper helper, TrigCompositeUtils::Decision *decisionPtr, bool kRoI) const +{ + std::string sgKeyString = navigationDecoder.label(helper.getCLID(), helper.getIndex().subTypeIndex()); + std::string type_name; + ATH_CHECK(m_clidSvc->getTypeNameOfID(helper.getCLID(), type_name)); + ATH_MSG_DEBUG("----------------Attached collection " << sgKeyString << ", " << helper << " NAME: " << type_name); + + ATH_MSG_DEBUG(" SG KEY NAME from formatSGkey: " << HLTNavDetails::formatSGkey("HLT", type_name, sgKeyString)); + + auto sgKey = evtStore()->stringToKey(HLTNavDetails::formatSGkey("HLT", type_name, sgKeyString), helper.getCLID()); + const CLID saveCLID = (helper.getCLID() == 6455 ? 1097199488 : helper.getCLID()); + + if ( kRoI ) { + decisionPtr->typelessSetObjectLink(TrigCompositeUtils::roiString(), sgKey, saveCLID, helper.getIndex().objectsBegin()); + } else { + decisionPtr->typelessSetObjectLink(TrigCompositeUtils::featureString(), sgKey, helper.getCLID(), helper.getIndex().objectsBegin(), helper.getIndex().objectsEnd()); + } + + return StatusCode::SUCCESS; +} + +const std::vector<HLT::TriggerElement::FeatureAccessHelper> Run2ToRun3TrigNavConverter::vectorTEfeatures(const HLT::TriggerElement *te_ptr) const +{ + std::vector<HLT::TriggerElement::FeatureAccessHelper> ptrFAHelper; + for (HLT::TriggerElement::FeatureAccessHelper helper : te_ptr->getFeatureAccessHelpers()) + { + if (m_setCLID.find(helper.getCLID()) == m_setCLID.end()) { + continue; + } + ptrFAHelper.push_back( helper ); + } + ATH_MSG_DEBUG(" **************** SIZE OF TCs: " << ptrFAHelper.size()); + return ptrFAHelper; +} diff --git a/Trigger/TrigEvent/TrigNavTools/src/Run2ToRun3TrigNavConverter.h b/Trigger/TrigEvent/TrigNavTools/src/Run2ToRun3TrigNavConverter.h new file mode 100644 index 0000000000000000000000000000000000000000..5b28867b508012769556690333356d167eab7a65 --- /dev/null +++ b/Trigger/TrigEvent/TrigNavTools/src/Run2ToRun3TrigNavConverter.h @@ -0,0 +1,57 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef TRIGNAVTOOLS_RUN2TORUN3TRIGNAVCONVERTER_H +#define TRIGNAVTOOLS_RUN2TORUN3TRIGNAVCONVERTER_H + +// Framework includes +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "StoreGate/ReadHandleKey.h" +#include "StoreGate/WriteHandleKey.h" +#include "xAODTrigger/TrigNavigation.h" +#include "TrigConfInterfaces/IHLTConfigSvc.h" +#include "AthenaKernel/IClassIDSvc.h" +#include "xAODTrigger/TrigComposite.h" +#include "xAODTrigger/TrigCompositeContainer.h" +#include "TrigCompositeUtils/TrigCompositeUtils.h" +#include "TrigNavStructure/TypedHolder.h" +#include "TrigNavStructure/StandaloneNavigation.h" + +// STL includes +#include <string> +#include <map> +#include <set> +#include <vector> + +/** + * @class Run2ToRun3TrigNavConverter + * @brief + **/ +class Run2ToRun3TrigNavConverter : public AthReentrantAlgorithm { +public: + Run2ToRun3TrigNavConverter(const std::string& name, ISvcLocator* pSvcLocator); + virtual ~Run2ToRun3TrigNavConverter() override; + + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext& context) const override; + virtual StatusCode finalize() override; + +private: + + + SG::ReadHandleKey<xAOD::TrigNavigation> m_trigNavKey { this, "TrigNavReadKey", "TrigNavigation"}; + Gaudi::Property<bool> m_doPrint{ this, "doPrint", true }; + Gaudi::Property<std::vector<std::string>> m_setConfig{ this, "setConfig", {} }; + ServiceHandle< TrigConf::IHLTConfigSvc > m_configSvc { this, "HLTConfigSvc", "HLTConfigSvc", "HLTConfig Service" }; + ServiceHandle<IClassIDSvc> m_clidSvc{ this, "ClassIDSvc", "ClassIDSvc", "Service to translate CLID to class name" }; + SG::WriteHandleKey<xAOD::TrigCompositeContainer> m_trigNavWriteKey { this, "TrigNavWriteKey", "HLTNav_all" }; + SG::WriteHandleKey<xAOD::TrigCompositeContainer> m_trigSummaryWriteKey { this, "TrigSummaryWriteKey", "HLTNav_Summary" }; + + std::set<CLID> m_setCLID; + StatusCode addTEfeatures(const HLT::StandaloneNavigation &navigationDecoder, HLT::TriggerElement::FeatureAccessHelper helper, TrigCompositeUtils::Decision *decisionPtr, bool kRoI=false) const; + const std::vector<HLT::TriggerElement::FeatureAccessHelper> vectorTEfeatures(const HLT::TriggerElement *te_ptr) const; + + using TE_Decision_map = std::map<HLT::TriggerElement*, std::vector<TrigCompositeUtils::Decision*>>; +}; + +#endif // TRIGNAVTOOLS_RUN2TORUN3TRIGNAVCONVERTER_H diff --git a/Trigger/TrigEvent/TrigNavTools/src/components/TrigNavTools_entries.cxx b/Trigger/TrigEvent/TrigNavTools/src/components/TrigNavTools_entries.cxx index 8dcfaf68c4b519df87e0faa7da60d111368f1f9c..e9cc2cb75271290fce640dc9e0f554427326c3d8 100644 --- a/Trigger/TrigEvent/TrigNavTools/src/components/TrigNavTools_entries.cxx +++ b/Trigger/TrigEvent/TrigNavTools/src/components/TrigNavTools_entries.cxx @@ -1,6 +1,8 @@ #include "../TrigNavigationThinningSvc.h" +#include "../Run2ToRun3TrigNavConverter.h" DECLARE_COMPONENT( TrigNavigationThinningSvc ) +DECLARE_COMPONENT( Run2ToRun3TrigNavConverter ) diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFHypoTool.cxx b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFHypoTool.cxx index 2fba829db3bfa05e61907f8307a9a75796e28673..3fb641d2308352cc945674e8a655c9097e1d0cfa 100644 --- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFHypoTool.cxx +++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFHypoTool.cxx @@ -34,11 +34,13 @@ StatusCode TrigMuonEFHypoTool::initialize(){ for(size_t j=0; j<m_ptBins.size(); j++){ m_bins[j] = m_ptBins[j].size() - 1; if (m_bins[j] != m_ptThresholds[j].size()) { - ATH_MSG_ERROR("bad thresholds setup .... exiting!"); - return StatusCode::FAILURE; + ATH_MSG_ERROR("bad thresholds setup .... exiting!"); + return StatusCode::FAILURE; } - for (std::vector<float>::size_type i=0; i<m_bins[j];++i) { - ATH_MSG_INFO( "bin " << m_ptBins[j][i] << " - " << m_ptBins[j][i+1]<<" with Pt Threshold of " << (m_ptThresholds[j][i])/Gaudi::Units::GeV<< " GeV"); + if (msgLvl(MSG::DEBUG)) { + for (std::vector<float>::size_type i=0; i<m_bins[j];++i) { + ATH_MSG_DEBUG( "bin " << m_ptBins[j][i] << " - " << m_ptBins[j][i+1]<<" with Pt Threshold of " << (m_ptThresholds[j][i])/Gaudi::Units::GeV<< " GeV"); + } } } } diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/ITrigTauGenericHypoTool.h b/Trigger/TrigHypothesis/TrigTauHypo/src/ITrigTauGenericHypoTool.h index 22478759e657cf10f6b207d641d065d3fb9c0163..3ccd3674ccab60482617acec5db799f08c96157e 100755 --- a/Trigger/TrigHypothesis/TrigTauHypo/src/ITrigTauGenericHypoTool.h +++ b/Trigger/TrigHypothesis/TrigTauHypo/src/ITrigTauGenericHypoTool.h @@ -1,21 +1,18 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGTAUHYPO_ITrigTauGenericHypoTool_H -#define TRIGTAUHYPO_ITrigTauGenericHypoTool_H 1 +#define TRIGTAUHYPO_ITrigTauGenericHypoTool_H #include "GaudiKernel/IAlgTool.h" - - - - +#include "TrigCompositeUtils/TrigCompositeUtils.h" +#include "TrigSteeringEvent/TrigRoiDescriptor.h" +#include "xAODTau/TauJetContainer.h" /** - * @class Base for tools dooing L2 Calo Hypo selection - * @brief + * @brief Base for tools doing tau hypo selection **/ - class ITrigTauGenericHypoTool : virtual public ::IAlgTool { @@ -34,9 +31,9 @@ class ITrigTauGenericHypoTool TrigCompositeUtils::decisionIDs( previousDecision ).end() ) {} - TrigCompositeUtils::Decision* decision; - const TrigRoiDescriptor* roi; - const xAOD::TauJetContainer* taucontainer; + TrigCompositeUtils::Decision* decision{nullptr}; + const TrigRoiDescriptor* roi{nullptr}; + const xAOD::TauJetContainer* taucontainer{nullptr}; const TrigCompositeUtils::DecisionIDContainer previousDecisionIDs; }; @@ -47,7 +44,7 @@ class ITrigTauGenericHypoTool * 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<ClusterInfo>& input ) const = 0; /** * @brief Makes a decision for a single object @@ -55,10 +52,7 @@ class ITrigTauGenericHypoTool **/ virtual bool decide( const ClusterInfo& i ) const = 0; - protected: - - -}; +}; #endif //> !TRIGTAUHYPO_ITrigTauGenericHypoTool_H diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/TrigTauGenericHypoMT.cxx b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigTauGenericHypoMT.cxx index 24da4daae0eab75677d1fc5955f37b77c8778b55..3d3b5779b2ebf7fcbc9fb86336e4714fc4fc377a 100644 --- a/Trigger/TrigHypothesis/TrigTauHypo/src/TrigTauGenericHypoMT.cxx +++ b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigTauGenericHypoMT.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************************** @@ -16,39 +16,15 @@ * *********************************************************************/ -#include <iterator> -#include <sstream> - -// -#include "TLorentzVector.h" -#include "TFormula.h" - -#include "GaudiKernel/IToolSvc.h" #include "GaudiKernel/StatusCode.h" -#include "GaudiKernel/ListItem.h" -// -#include "TrigTauGenericHypoMT.h" - -#include "TrigSteeringEvent/TrigRoiDescriptor.h" +#include "AthenaMonitoringKernel/Monitored.h" #include "xAODJet/Jet.h" -#include "xAODJet/JetContainer.h" -#include "xAODCaloEvent/CaloCluster.h" -#include "xAODCaloEvent/CaloClusterContainer.h" - #include "xAODTau/TauJet.h" -#include "xAODTau/TauJetContainer.h" - -#include "TrkTrack/Track.h" -#include "TrkTrack/TrackCollection.h" +#include "TrigTauGenericHypoMT.h" #include "TrigCompositeUtils/HLTIdentifier.h" -#include "TrigCompositeUtils/Combinators.h" -#include "AthenaMonitoringKernel/Monitored.h" -//class ISvcLocator; - -using namespace TrigCompositeUtils; TrigTauGenericHypoMT::TrigTauGenericHypoMT( const std::string& type, const std::string& name, @@ -60,31 +36,24 @@ TrigTauGenericHypoMT::TrigTauGenericHypoMT( const std::string& type, declareProperty("Formulas", m_formula); } -TrigTauGenericHypoMT::~TrigTauGenericHypoMT() -{} -StatusCode TrigTauGenericHypoMT::initialize() -{ +StatusCode TrigTauGenericHypoMT::initialize() { if ( !m_monTool.empty() ) CHECK( m_monTool.retrieve() ); - ATH_MSG_DEBUG( "AcceptAll = " - << ( m_acceptAll==true ? "True" : "False" ) ); - - //m_multiplicity = m_lowerPtCut.size(); - ATH_MSG_DEBUG( "Tool configured for chain/id: " << m_decisionId ); - - ATH_MSG_INFO(" REGTEST: TrigTauGenericHypoMT will cut on "); - ATH_MSG_INFO(" REGTEST: ------ "); + ATH_MSG_DEBUG("Tool configured for chain/id: " << m_decisionId << + ", AcceptAll = " << (m_acceptAll ? "True" : "False")); // Here we store the formulas since they need to compile + m_store.reserve(m_member.size()); + msg(MSG::INFO) << "Cuts: "; for(unsigned int i=0; i<m_member.size(); i++) { - m_store.push_back(TFormula(("TauHypoCut"+m_formula.at(i)).c_str(), m_formula.at(i).c_str())); - ATH_MSG_INFO(" REGTEST: " << m_formula.at(i)); + m_store.push_back(TFormula(("TauHypoCut"+m_formula.at(i)).c_str(), m_formula.at(i).c_str())); + msg(MSG::INFO) << "(" << m_formula.at(i) << ") "; + // x is the ID variables, y is Tau pT and z is Tau eta } - ATH_MSG_INFO(" REGTEST: where x is the ID variables, y is Tau pT and z is Tau eta "); - ATH_MSG_INFO("Initialization of TrigTauGenericHypoMT completed successfully"); + msg(MSG::INFO) << endmsg; return StatusCode::SUCCESS; } @@ -94,36 +63,26 @@ bool TrigTauGenericHypoMT::decide( const ITrigTauGenericHypoTool::ClusterInfo& i bool pass = false; - - auto PassedCuts = Monitored::Scalar<int>( "CutCounter", -1 ); - auto monitorIt = Monitored::Group( m_monTool, PassedCuts ); - - // when leaving scope it will ship data to monTool - PassedCuts = PassedCuts + 1; //got called (data in place) + auto passedCuts = Monitored::Scalar<unsigned int>( "CutCounter", 0 ); + auto monitorIt = Monitored::Group( m_monTool, passedCuts ); 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" ); } // get tau collection auto pTauCont = input.taucontainer; - if(pTauCont->size()!=0){ - ATH_MSG_DEBUG(" Input tau collection has size " << pTauCont->size()); + if( not pTauCont->empty() ){ + ATH_MSG_DEBUG("Input tau collection has size " << pTauCont->size()); }else { - ATH_MSG_DEBUG("No taus in input collection: Rejecting"); - pass=false; - return pass; + ATH_MSG_DEBUG("No taus in input collection: Rejecting"); + return false; } const xAOD::TauJet* aTau = pTauCont->back(); - int hasFailed = 0; - // We have to implement the cuts here - Eventually, declare the formulas in the initialize for(unsigned int i=0; i<m_member.size(); i++) { @@ -131,38 +90,35 @@ bool TrigTauGenericHypoMT::decide( const ITrigTauGenericHypoTool::ClusterInfo& i // Detail -1 ignores by convention the ID variables if(m_member.at(i) != -1) - { - xAOD::TauJetParameters::Detail myDetail = xAOD::TauJetParameters::Detail(m_member.at(i)); - aTau->detail(myDetail, theValue); - } + { + xAOD::TauJetParameters::Detail myDetail = xAOD::TauJetParameters::Detail(m_member.at(i)); + aTau->detail(myDetail, theValue); + } // What about upper and lower bounds? can work using x, y, z, t... double theResult = m_store.at(i).Eval(theValue, aTau->pt(), aTau->eta()); - ATH_MSG_DEBUG(" Evaluating Hypothesis on ID Variable #: " << m_member.at(i) ); - ATH_MSG_DEBUG(" With Cut = " << m_formula.at(i).c_str() ); - ATH_MSG_DEBUG(" And value x (ID), y (pT), z (Eta) = " << theValue <<", "<< aTau->pt() << ", " << aTau->eta() ); - ATH_MSG_DEBUG(" Result = " << (theResult > 0.5) ); + ATH_MSG_DEBUG("Evaluating Hypothesis on ID Variable #: " << m_member.at(i) << + " with cut = " << m_formula.at(i).c_str() << + " and value x (ID), y (pT), z (Eta) = " << theValue <<", "<< aTau->pt() << + ", " << aTau->eta() << + ", Result = " << (theResult > 0.5)); if(theResult < 0.5) - { - hasFailed = i+1; - break; - } + break; // cut failed + else + ++passedCuts; } - if (hasFailed) + if ( passedCuts!=m_member.size() ) { - ATH_MSG_DEBUG(" REGTEST: Cut Number: " - << hasFailed-1 - << " did not pass the threshold"); + ATH_MSG_DEBUG(" REGTEST: Cut Number: " << passedCuts + << " did not pass the threshold"); return pass; } pass = true; - ATH_MSG_DEBUG(" REGTEST: TE accepted !! "); - - + return pass; } @@ -170,10 +126,12 @@ bool TrigTauGenericHypoMT::decide( const ITrigTauGenericHypoTool::ClusterInfo& i StatusCode TrigTauGenericHypoMT::decide( std::vector<ClusterInfo>& input ) const { + using namespace TrigCompositeUtils; + for ( auto& i: input ) { if ( passed ( m_decisionId.numeric(), i.previousDecisionIDs ) ) { if ( decide( i ) ) { - addDecisionID( m_decisionId, i.decision ); + addDecisionID( m_decisionId, i.decision ); } } } diff --git a/Trigger/TrigHypothesis/TrigTauHypo/src/TrigTauGenericHypoMT.h b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigTauGenericHypoMT.h index 942c5dd33cfc460f7ecf784e58c5c5e3d5ce9efb..e8658dd31a888bb45a7e0ef77cc2bb10f0d823a8 100755 --- a/Trigger/TrigHypothesis/TrigTauHypo/src/TrigTauGenericHypoMT.h +++ b/Trigger/TrigHypothesis/TrigTauHypo/src/TrigTauGenericHypoMT.h @@ -2,8 +2,8 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#ifndef TrigTauGenericHypoMT_H -#define TrigTauGenericHypoMT_H +#ifndef TrigTauHypo_TrigTauGenericHypoMT_H +#define TrigTauHypo_TrigTauGenericHypoMT_H /******************************************************************** * @@ -21,25 +21,14 @@ #include <vector> #include "TFormula.h" -//#include "TrigInterfaces/HypoAlgo.h" - #include "Gaudi/Property.h" -#include "xAODTau/TauJet.h" -#include "xAODTau/TauJetContainer.h" -#include "TrigSteeringEvent/TrigRoiDescriptor.h" +#include "GaudiKernel/ToolHandle.h" #include "AthenaBaseComps/AthAlgTool.h" #include "AthenaMonitoringKernel/GenericMonitoringTool.h" -#include "TrigCompositeUtils/HLTIdentifier.h" -#include "TrigCompositeUtils/TrigCompositeUtils.h" #include "ITrigTauGenericHypoTool.h" - -class StoreGateSvc; - -namespace HLT { - class TriggerElement; -} +#include "TrigCompositeUtils/HLTIdentifier.h" class TrigTauGenericHypoMT : public extends<AthAlgTool, ITrigTauGenericHypoTool> { public: @@ -47,8 +36,6 @@ class TrigTauGenericHypoMT : public extends<AthAlgTool, ITrigTauGenericHypoTool> const std::string& name, const IInterface* parent ); - virtual ~TrigTauGenericHypoMT(); - virtual StatusCode initialize() override; virtual StatusCode decide( std::vector<ITrigTauGenericHypoTool::ClusterInfo>& input ) const override; @@ -57,9 +44,7 @@ class TrigTauGenericHypoMT : public extends<AthAlgTool, ITrigTauGenericHypoTool> private: - /** Configurables */ HLT::Identifier m_decisionId; - std::vector<int> m_member; std::vector<std::string> m_formula; std::vector<TFormula> m_store; diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/HLTMonTriggerList.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/HLTMonTriggerList.py index eaa544ad286ccf93c15466c982e4c076d6a4a1f2..d27ddc19e2fab50202b7f1c1b2b20fe3c4485f6e 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/python/HLTMonTriggerList.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/python/HLTMonTriggerList.py @@ -97,7 +97,6 @@ class HLTMonTriggerList: # Implementation of https://its.cern.ch/jira/browse/ATR-13200 def get_monitoring_mode(self): # Set monitoring mode - print ('jmasik: DQMonFlags.monManDataType(): ', DQMonFlags.monManDataType()) self.data_type = DQMonFlags.monManDataType() if self.data_type == 'monteCarlo': diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/skeleton.HLTMon_tf.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/skeleton.HLTMon_tf.py index 5178c6482f2637cafbc08715e4b3986fe08de29e..907773f9568bf8047119adec298a54308c12c65d 100644 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/skeleton.HLTMon_tf.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/skeleton.HLTMon_tf.py @@ -11,6 +11,7 @@ monLog.info('************* Starting HLTMon transform ***********') from AthenaCommon.GlobalFlags import globalflags from RecExConfig.RecFlags import rec from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +from AthenaConfiguration.AllConfigFlags import ConfigFlags #Common job options disable most RecExCommon by default. Re-enable below on demand rec.doWriteESD=False @@ -44,6 +45,7 @@ if hasattr(runArgs,"inputBSFile"): rec.doAOD=True globalflags.InputFormat.set_Value_and_Lock('bytestream') athenaCommonFlags.BSRDOInput.set_Value_and_Lock( runArgs.inputBSFile ) + ConfigFlags.Input.Files = athenaCommonFlags.BSRDOInput() if hasattr(runArgs,"inputAODFile"): rec.readAOD.set_Value_and_Lock(True) @@ -51,6 +53,7 @@ if hasattr(runArgs,"inputAODFile"): globalflags.InputFormat.set_Value_and_Lock('pool') athenaCommonFlags.PoolAODInput.set_Value_and_Lock( runArgs.inputAODFile ) + ConfigFlags.Input.Files = athenaCommonFlags.PoolAODInput() if hasattr(runArgs,"outputHIST_TEMPFile"): rec.doMonitoring.set_Value_and_Lock(False) diff --git a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteering.cxx b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteering.cxx index a7e609b804dc2b92030738257ef21a35258b6063..b7a12be19a32fbc54e270420221263b3f957b53b 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteering.cxx +++ b/Trigger/TrigT1/L1Topo/L1TopoCoreSim/Root/TopoSteering.cxx @@ -311,8 +311,10 @@ TopoSteering::executeDecisionConnector(TCS::DecisionConnector *conn) { for(TCS::Connector* inputConnector: conn->inputConnectors()) { // TODO DG-2017-04-18 the sort overflow (>10 TOBs) in the SortAlg is not implemented yet if(inputConnector->isSortingConnector()) { - sortOverflow = (sortOverflow || - dynamic_cast<SortingConnector*>(inputConnector)->sortingAlgorithm()->overflow()); + if (auto sortConn = dynamic_cast<SortingConnector*>(inputConnector)) { + sortOverflow = sortConn->sortingAlgorithm()->overflow(); + if (sortOverflow) break; + } } } conn->m_decision.setOverflow(conn->hasInputOverflow() || sortOverflow); diff --git a/Trigger/TrigTools/TrigInDetConfig/python/ConfigSettings.py b/Trigger/TrigTools/TrigInDetConfig/python/ConfigSettings.py index 82181e34607ea83dfe699bebb32307f3da814b01..4c5bf048be707b9099bf0c136e0311b581bbc39b 100644 --- a/Trigger/TrigTools/TrigInDetConfig/python/ConfigSettings.py +++ b/Trigger/TrigTools/TrigInDetConfig/python/ConfigSettings.py @@ -56,8 +56,8 @@ class _Settings : self._doTRT = False #Apply TRT extension sequence after ambiguity solving self._keepTrackParameters = False #Keep track parameters in conversion to TrackParticles self._usePixelSP = True - self._d0TrackMax = 20. - self._z0TrackMax = 300. + self._d0TrackMax = 20.0 + self._z0TrackMax = 300.0 self._isLRT = False #Previous version in: @@ -131,9 +131,14 @@ class _Settings : def doTRT(self): return self._doTRT + @property + def keepTrackParameters(self): + return self._keepTrackParameters + @property def usePixelSP(self): return self._usePixelSP + @property def d0TrackMax(self): return self._d0TrackMax @@ -142,10 +147,6 @@ class _Settings : def z0TrackMax(self): return self._z0TrackMax - @property - def keepTrackParameters(self): - return self._keepTrackParameters - @property def isLRT(self): return self._isLRT @@ -178,10 +179,6 @@ class _Tracking_electron( _Settings ): self._doTRT = True self._keepTrackParameters = True -class _Tracking_photon(_Settings): - def __init__(self): - _Settings.__init__(self) - class _Tracking_tauCore( _Settings ): def __init__( self ): _Settings.__init__(self) @@ -230,18 +227,10 @@ class _Tracking_muonIso( _Settings ): class _Tracking_bjet( _Settings ): def __init__( self ): _Settings.__init__(self) - self._etaHalfWidth = 0.2 - self._phiHalfWidth = 0.201 + self._etaHalfWidth = 0.4 + self._phiHalfWidth = 0.4 self._doTRT = False -class _Tracking_bjetVtx(_Settings): - def __init__(self): - _Settings.__init__(self) - self._phiHalfWidth = 0.201 - self._etaHalfWidth = 0.2 - self._pTmin = 5.*GeV - self._doTRT = False - class _Tracking_fullScan( _Settings ): def __init__( self ): _Settings.__init__(self) @@ -251,43 +240,11 @@ class _Tracking_fullScan( _Settings ): self._dRdoubletMax = 200 self._seedRadBinWidth = 10 -class _Tracking_fullScan2(_Settings): - def __init__(self): - self._pTmin = 2. * GeV - self._etaHalfWidth = 3.0 - self._phiHalfWidth = 3.14159 - self._doFullScan = True - -class _Tracking_fullScan500(_Settings): - def __init__(self): - self._pTmin = 0.5 * GeV - self._etaHalfWidth = 3.0 - self._phiHalfWidth = 3.14159 - self._doFullScan = True - -class _Tracking_minBias400( _Settings ): - def __init__( self ): - _Settings.__init__(self) - self._doFullScan = True - self._pTmin = 0.39*GeV - self._etaHalfWidth = 3 - self._phiHalfWidth = 3.14159 - self._doTRT = False - class _Tracking_minBias( _Settings ): def __init__( self ): _Settings.__init__(self) self._doFullScan = True - self._pTmin = 0.2*GeV - self._etaHalfWidth = 3 - self._phiHalfWidth = 3.14159 - self._doTRT = False - -class _Tracking_minBias2( _Settings ): - def __init__( self ): - _Settings.__init__(self) - self._doFullScan = True - self._pTmin = 0.5*GeV + self._pTmin = 0.2*GeV # TODO: double check self._etaHalfWidth = 3 self._phiHalfWidth = 3.14159 self._doTRT = False @@ -302,7 +259,6 @@ class _Tracking_beamSpot( _Settings ): self._etaHalfWidth = 3 self._phiHalfWidth = 3.14159 self._doTRT = False - self._checkRedundantSeeds = True class _Tracking_cosmic( _Settings ): def __init__( self ): @@ -313,32 +269,6 @@ class _Tracking_cosmic( _Settings ): self._etaHalfWidth = 3 self._phiHalfWidth = 3.14159 self._doTRT = False - #do these settings still apply, were defined in TrigFastTrackFinder_Config.py but not in slicesettings - self._d0TrackMax = 1000. - self._z0TrackMax = 1000. - -class _Tracking_cosmicsN(_Settings): - def __init__(self): - _Settings.__init__(self) - self._etaHalfWidth = 3.0 - self._phiHalfWidth = 3.14159 - self._doFullScan = True - self._pTmin = 0.5*GeV - -class _Tracking_beamgas(_Settings): - def __init__(self): - _Settings.__init__(self) - self._pTmin = 0.1 * GeV - self._etaHalfWidth = 3.0 - self._phiHalfWidth = 3.14159 - self._doFullScan = True - -class _Tracking_hadCalib(_Settings): - def __init__(self): - _Settings.__init__(self) - self._pTmin = 0.5*GeV - self._etaHalfWidth = 0.4 - self._phiHalfWidth = 0.4 class _Tracking_bphysics( _Settings ): def __init__( self ): @@ -350,36 +280,6 @@ class _Tracking_bphysics( _Settings ): self._checkRedundantSeeds = True self._doTRT = False -class _Tracking_bphysicsHighPt( _Settings ): - def __init__( self ): - _Settings.__init__(self) - self._d0SeedMax = 10. - self._doSpPhiFiltering = False - self._etaHalfWidth = 0.75 - self._phiHalfWidth = 0.75 - self._doTRT = False - self._pTmin = 2. * GeV - -class _Tracking_heavyIon(_Settings): - def __init__( self ): - _Settings.__init__(self) - -class _Tracking_heavyIonFS(_Settings): - def __init__( self ): - _Settings.__init__(self) - self._etaHalfWidth=3.0 - self._phiHalfWidth=3.14159 - self._doFullScan=True - -class _Tracking_lowPt(_Settings): - def __init__( self ): - _Settings.__init__(self) - self._pTmin = 0.1 * GeV - self._etaHalfWidth = 3.0 - self._phiHalfWidth = 3.14159 - self._doFullScan = True - - class _Tracking_electronLRT(_Settings): def __init__(self): _Settings.__init__(self) @@ -439,53 +339,32 @@ class _Tracking_bjetLRT(_Settings): self._z0TrackMax = 500. self._isLRT = True - #Map to retrieve available configurations of Tracking _TrackingConfigSettings = { "electron" : _Tracking_electron(), - "electronLRT" : _Tracking_electronLRT(), - - "photon" : _Tracking_photon(), #Muon signatures "muon" : _Tracking_muon(), "muonIso" : _Tracking_muonIso(), "muonCore" : _Tracking_muonCore(), - "muonLRT" : _Tracking_muonLRT(), "tau" : _Tracking_tau(), "tauCore" : _Tracking_tauCore(), "tauIso" : _Tracking_tauIso(), - "tauLRT" : _Tracking_tauLRT(), "bjet" : _Tracking_bjet(), - "bjetVtx" : _Tracking_bjetVtx(), - "bjetLRT" : _Tracking_bjetLRT(), - "fullScan" : _Tracking_fullScan(), - "fullScanLRT" : _Tracking_fullScanLRT(), - "fullScan2" : _Tracking_fullScan2(), - "fullScan500" : _Tracking_fullScan500(), - - "minBias" : _Tracking_minBias(), - "minBias2" : _Tracking_minBias2(), - "minBias400" : _Tracking_minBias400(), + "minBias400" : _Tracking_minBias(), "beamSpot" : _Tracking_beamSpot(), "cosmics" : _Tracking_cosmic(), - "cosmicsN" : _Tracking_cosmicsN(), - "beamgas" : _Tracking_beamgas(), - "bphysics" : _Tracking_bphysics(), - "bphysHighPt" : _Tracking_bphysicsHighPt(), - - "lowPt" : _Tracking_lowPt(), - - "hadCalib" : _Tracking_hadCalib(), - - "heavyIon" : _Tracking_heavyIon(), - "heavyIonFS" : _Tracking_heavyIonFS() + "electronLRT" : _Tracking_electronLRT(), + "muonLRT" : _Tracking_muonLRT(), + "tauLRT" : _Tracking_tauLRT(), + "bjetLRT" : _Tracking_bjetLRT(), + "fullScanLRT" : _Tracking_fullScanLRT(), } @@ -533,9 +412,6 @@ class _FastTracking(): @property def signatureType(self): return self._signatureType - @property - def config(self): - return self._config class _PrecisionTracking(): def __init__( self, signatureType, nameSuffix ) : @@ -655,16 +531,6 @@ class _Settings_muonFS( _GlobalSettings ): self._configPT = _PrecisionTracking( signatureType = 'muon', nameSuffix = 'MuonFS' ) self._doRecord = True #Allow recording of track collections -class _Settings_muonLRT( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "muonLRT" #To be appended to alg names - self._roi = "HLT_Roi_Muon" - self._configFT = _FastTracking( signatureType = 'muonLRT', nameSuffix = 'MuonLRT' ) - self._configPT = _PrecisionTracking( signatureType = 'muonLRT', nameSuffix = 'Muon' ) - self._doRecord = True #Allow recording of track collections - self._isLRT = True - class _Settings_muonCore( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) @@ -694,17 +560,6 @@ class _Settings_tauCore( _GlobalSettings ): #self._configPT = #_PrecisionTracking( signatureType = 'tauCore', nameSuffix = 'TauCore' ) self._doRecord = True #Allow recording of track collections -class _Settings_tauLRT( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "tauLRT" #To be appended to alg names - self._roi = "HLT_Roi_TauCore" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'tauLRT', nameSuffix = 'TauLRT' ) - #There should not be a need for tauCore PT! - #self._configPT = #_PrecisionTracking( signatureType = 'tauCore', nameSuffix = 'TauCore' ) - self._doRecord = True #Allow recording of track collections - self._isLRT = True - class _Settings_tauIso( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) @@ -715,45 +570,6 @@ class _Settings_tauIso( _GlobalSettings ): self._doRecord = True #Allow recording of track collections #This might be redundant but lets keep them for the time being... -class _Settings_tauId( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "tauId" #To be appended to alg names - self._roi = "HLT_Roi_Tau" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'tau', nameSuffix = 'Tau' ) - self._configPT = _PrecisionTracking( signatureType = 'tau', nameSuffix = 'Tau' ) #Final collection is being renamed to just tau apparently... - self._doRecord = False #FIXME: Do I need to record these? - -#This might be redundant but lets keep them for the time being... -class _Settings_tauEF( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "tauEF" #To be appended to alg names - self._roi = "HLT_Roi_TauIso" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'tauIso', nameSuffix = 'TauIso' ) # - self._configPT = _PrecisionTracking( signatureType = 'tau', nameSuffix = 'Tau' ) #Final collection is being renamed to just tau apparently... - self._doRecord = False #FIXME: Do I need to record these? - -#This might be redundant but lets keep them for the time being... -class _Settings_tauTrk( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "tauTrk" #To be appended to alg names - self._roi = "HLT_Roi_Tau" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'tau', nameSuffix = 'Tau' ) # - self._configPT = _PrecisionTracking( signatureType = 'tau', nameSuffix = 'Tau' ) #Final collection is being renamed to just tau apparently... - self._doRecord = False #FIXME: Do I need to record these? - -#This might be redundant but lets keep them for the time being... -class _Settings_tauTrkTwo( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "tauTrkTwo" #To be appended to alg names - self._roi = "HLT_Roi_TauIso" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'tauIso', nameSuffix = 'TauIso' ) # - self._configPT = _PrecisionTracking( signatureType = 'tau', nameSuffix = 'Tau' ) #Final collection is being renamed to just tau apparently... - self._doRecord = False #FIXME: Do I need to record these? - class _Settings_tauIsoBDT( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) @@ -772,25 +588,6 @@ class _Settings_bjet( _GlobalSettings ): self._configPT = _PrecisionTracking( signatureType = 'bjet', nameSuffix = 'Bjet' ) self._doRecord = True -class _Settings_bjetVtx( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "bjetVtx" #To be appended to alg names - self._roi = "HLT_Roi_Bjet" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'bjetVtx', nameSuffix = 'Bjet' ) - self._configPT = _PrecisionTracking( signatureType = 'bjetVtx', nameSuffix = 'Bjet' ) - self._doRecord = False - -class _Settings_bjetLRT( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "bjetLRT" #To be appended to alg names - self._roi = "HLT_Roi_Bjet" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'bjetLRT', nameSuffix = 'BjetLRT' ) - self._configPT = _PrecisionTracking( signatureType = 'bjetLRT', nameSuffix = 'BjetLRT' ) - self._isLRT = True - self._doRecord = True - class _Settings_jet( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) @@ -801,15 +598,6 @@ class _Settings_jet( _GlobalSettings ): self._doRecord = True class _Settings_minBias( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "minBias" #To be appended to alg names - self._roi = "HLT_Roi_MinBias" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'minBias', nameSuffix = 'MinBias' ) # - self._configPT = _PrecisionTracking( signatureType = 'minBias', nameSuffix = 'MinBias' ) #Final collection is being renamed to just tau apparently... - self._doRecord = True - -class _Settings_minBias400( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) self._name = "minBias" #To be appended to alg names @@ -818,15 +606,6 @@ class _Settings_minBias400( _GlobalSettings ): self._configPT = _PrecisionTracking( signatureType = 'minBias400', nameSuffix = 'MinBias' ) #Final collection is being renamed to just tau apparently... self._doRecord = True -class _Settings_minBias2( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "minBias" #To be appended to alg names - self._roi = "HLT_Roi_MinBias" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'minBias2', nameSuffix = 'MinBias' ) # - self._configPT = _PrecisionTracking( signatureType = 'minBias2', nameSuffix = 'MinBias' ) #Final collection is being renamed to just tau apparently... - self._doRecord = True - class _Settings_beamSpot( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) @@ -845,31 +624,6 @@ class _Settings_fullScan( _GlobalSettings ): self._configFT = _FastTracking( signatureType = 'fullScan', nameSuffix = 'FS' ) # self._doRecord = False -class _Settings_fullScan2( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "fullScan2" #To be appended to alg names - self._roi = "HLT_Roi_FS" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'fullScan2', nameSuffix = 'FS' ) # - self._doRecord = False - -class _Settings_fullScan500( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "fullScan500" #To be appended to alg names - self._roi = "HLT_Roi_FS" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'fullScan500', nameSuffix = 'FS' ) # - self._doRecord = False - -class _Settings_fullScanLRT( _GlobalSettings ): - def __init__( self ): - _GlobalSettings.__init__(self) - self._name = "fullScanLrt" #To be appended to alg names - self._roi = "HLT_Roi_FS" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'fullScanLRT', nameSuffix = 'FSLRT' ) # - self._doRecord = False - self._isLRT = True - class _Settings_cosmics( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) @@ -878,58 +632,66 @@ class _Settings_cosmics( _GlobalSettings ): self._configFT = _FastTracking( signatureType = 'cosmics', nameSuffix = 'Cosmic' ) # self._doRecord = False -class _Settings_cosmicsN( _GlobalSettings ): + +class _Settings_bmumux( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) - self._name = "cosmicsN" #To be appended to alg names - self._roi = "HLT_Roi_Cosmics" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'cosmicsN', nameSuffix = 'Cosmic' ) # - self._doRecord = False + self._name = "bmumux" #To be appended to alg names + self._roi = "HLT_Roi_Bmumux" + self._configFT = _FastTracking( signatureType = 'bphysics', nameSuffix = 'Bmumux' ) + self._configPT = _PrecisionTracking( signatureType = 'bphysics', nameSuffix = 'Bmumux' ) + self._doRecord = True #Allow recording of track collections -class _Settings_bphysics( _GlobalSettings ): + +class _Settings_electronLRT( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) - self._name = "bphysics" #To be appended to alg names - self._roi = "HLT_Roi_Bjet" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'bphysics', nameSuffix = 'Bjet' ) #TODO: get correct nameSuffix - self._configPT = _PrecisionTracking( signatureType = 'bphysics', nameSuffix = 'Bjet' ) - self._doRecord = False + self._name = "electronLRT" #To be appended to alg names + self._roi = "HLT_Roi_Electron" + self._configFT = _FastTracking( signatureType = 'electronLRT', nameSuffix = 'ElectronLRT' ) + self._configPT = _PrecisionTracking( signatureType = 'electronLRT', nameSuffix = 'Electron' ) + self._doRecord = True #Allow recording of track collections + self._isLRT = True -class _Settings_bphysicsHighPt( _GlobalSettings ): +class _Settings_muonLRT( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) - self._name = "bphysicsHighPt" #To be appended to alg names - self._roi = "HLT_Roi_Bjet" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'bphysHighPt', nameSuffix = 'Bjet' ) #TODO: Get correct nameSuffix - self._configPT = _PrecisionTracking( signatureType = 'bphysHighPt', nameSuffix = 'Bjet' ) - self._doRecord = False + self._name = "muonLRT" #To be appended to alg names + self._roi = "HLT_Roi_Muon" + self._configFT = _FastTracking( signatureType = 'muonLRT', nameSuffix = 'MuonLRT' ) + self._configPT = _PrecisionTracking( signatureType = 'muonLRT', nameSuffix = 'Muon' ) + self._doRecord = True #Allow recording of track collections + self._isLRT = True -class _Settings_bmumux( _GlobalSettings ): +class _Settings_tauLRT( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) - self._name = "bmumux" #To be appended to alg names - self._roi = "HLT_Roi_Bmumux" - self._configFT = _FastTracking( signatureType = 'bphysics', nameSuffix = 'Bmumux' ) - self._configPT = _PrecisionTracking( signatureType = 'bphysics', nameSuffix = 'Bmumux' ) - self._doRecord = True #Allow recording of track collections + self._name = "tauLRT" #To be appended to alg names + self._roi = "HLT_Roi_TauCore" #FIXME: possibly different! + self._configFT = _FastTracking( signatureType = 'tauLRT', nameSuffix = 'TauLRT' ) + #There should not be a need for tauCore PT! + #self._configPT = #_PrecisionTracking( signatureType = 'tauCore', nameSuffix = 'TauCore' ) + self._doRecord = True #Allow recording of track collections + self._isLRT = True -class _Settings_beamgas( _GlobalSettings ): +class _Settings_bjetLRT( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) - self._name = "beamgas" #To be appended to alg names - self._roi = "HLT_Roi_Beamgas" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'beamgas', nameSuffix = 'beamgas' ) #TODO: Get correct nameSuffix - self._configPT = _PrecisionTracking( signatureType = 'beamgas', nameSuffix = 'beamgas' ) - self._doRecord = False + self._name = "bjetLRT" #To be appended to alg names + self._roi = "HLT_Roi_Bjet" #FIXME: possibly different! + self._configFT = _FastTracking( signatureType = 'bjetLRT', nameSuffix = 'BjetLRT' ) + self._configPT = _PrecisionTracking( signatureType = 'bjetLRT', nameSuffix = 'BjetLRT' ) + self._isLRT = True + self._doRecord = True -class _Settings_hadCalib( _GlobalSettings ): +class _Settings_fullScanLRT( _GlobalSettings ): def __init__( self ): _GlobalSettings.__init__(self) - self._name = "hadcalib" #To be appended to alg names - self._roi = "HLT_Roi_hadCalib" #FIXME: possibly different! - self._configFT = _FastTracking( signatureType = 'hadCalib', nameSuffix = 'beamgas' ) #TODO: Get correct nameSuffix - self._configPT = _PrecisionTracking( signatureType = 'hadCalib', nameSuffix = 'beamgas' ) + self._name = "fullScanLrt" #To be appended to alg names + self._roi = "HLT_Roi_FS" #FIXME: possibly different! + self._configFT = _FastTracking( signatureType = 'fullScanLRT', nameSuffix = 'FSLRT' ) # self._doRecord = False + self._isLRT = True _ConfigSettings = { "electron" : _Settings_electron(), @@ -939,41 +701,30 @@ _ConfigSettings = { "muonCore" : _Settings_muonCore(), "muonFS" : _Settings_muonFS(), "muonLate" : _Settings_muonLate(), - "muonLRT" : _Settings_muonLRT(), #Tau signatures "tauTau" : _Settings_tauTau(), "tauCore" : _Settings_tauCore(), "tauIso" : _Settings_tauIso(), - "tauLRT" : _Settings_tauLRT(), - #Might be potentially removed - "tauId" : _Settings_tauId(), - "tauTrk" : _Settings_tauTrk(), - "tauTrkTwo" : _Settings_tauTrkTwo(), - "tauEF" : _Settings_tauEF(), "tauIsoBDT" : _Settings_tauIsoBDT(), "bjet" : _Settings_bjet(), - "bjetVtx" : _Settings_bjetVtx(), - "bjetLRT" : _Settings_bjetLRT(), "jet" : _Settings_jet(), "fullScan" : _Settings_fullScan(), - "fullScan2" : _Settings_fullScan2(), - "fullScan500" : _Settings_fullScan500(), - "fullScanLRT" : _Settings_fullScanLRT(), "beamSpot" : _Settings_beamSpot(), "cosmics" : _Settings_cosmics(), - "minBias" : _Settings_minBias400(), - "minBias2" : _Settings_minBias2(), - "minBias0" : _Settings_minBias(), - "bphysics" : _Settings_bphysics(), - "bphysHighPt" : _Settings_bphysicsHighPt(), "bmumux" : _Settings_bmumux(), + + "minBias" : _Settings_minBias(), + #"bphysics" : _Settings_bphysics(), - "beamgas" : _Settings_beamgas(), - "hadCalib" : _Settings_hadCalib() + "electronLRT" : _Settings_electronLRT(), + "muonLRT" : _Settings_muonLRT(), + "tauLRT" : _Settings_tauLRT(), + "bjetLRT" : _Settings_bjetLRT(), + "fullScanLRT" : _Settings_fullScanLRT(), } #FTF Remap which eventually will be dropped once naming is aligned with signature settings @@ -995,14 +746,13 @@ remap = { #"Jet" : "bjet", #"JetFS" : "fullScan", "FS" : "fullScan", + #"bjetVtx" : "bjetVtx", #"FullScan" : "fullScan", "BeamSpot" : "beamSpot", #"Bphysics" : "bphysics", #"Cosmic" : "cosmics", #"MinBias" : "minBias400", - #"minBias" : "minBias400", - "minBias400": "minBias", - "tau": "tauTau" + #"minBias" : "minBias400" } def remap_type( signature ): diff --git a/Trigger/TrigTruthEvent/TrigInDetTruthEvent/src/TrigInDetTrackTruth.cxx b/Trigger/TrigTruthEvent/TrigInDetTruthEvent/src/TrigInDetTrackTruth.cxx index 7034bbbd184fa929ae13a44cac0dc5e124220887..052f67bd01cda42513ec30c52c7a514be3161b46 100644 --- a/Trigger/TrigTruthEvent/TrigInDetTruthEvent/src/TrigInDetTrackTruth.cxx +++ b/Trigger/TrigTruthEvent/TrigInDetTruthEvent/src/TrigInDetTrackTruth.cxx @@ -28,6 +28,7 @@ #include "TrigInDetTruthEvent/TrigInDetTrackTruth.h" #include "AthenaKernel/getMessageSvc.h" #include "GaudiKernel/IMessageSvc.h" +#include "AtlasHepMC/Operators.h" /** accessor to fill object: returns index of new entry in vectors */ int TrigInDetTrackTruth::addMatch(HepMcParticleLink p_tru_part,TrigIDHitStats hits) @@ -140,7 +141,7 @@ int TrigInDetTrackTruth::updateFamilyTree() } auto p_mum = p_child_vtx->particles_in().begin(); - #else +#else HepMC::GenVertex::particles_in_const_iterator p_mum = p_child_vtx->particles_in_const_begin(); // check a mother was found diff --git a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx index 53ce67c108193bf718c504cb176ed3904d4ef714..a9e7841ee93e90c3ff14d084c58ac2df5157e271 100644 --- a/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx +++ b/Trigger/TrigTruthEvent/TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx @@ -1,8 +1,6 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id$ /** * @file TrigTruthEventTPCnv/test/TrigInDetTrackTruthCnv_p1_test.cxx * @author scott snyder <snyder@bnl.gov> @@ -17,6 +15,7 @@ #include "GaudiKernel/MsgStream.h" #include "TestTools/leakcheck.h" #include <cassert> +#include <sstream> #include <iostream> #include "GeneratorObjectsTPCnv/initMcEventCollection.h" @@ -95,10 +94,13 @@ void test1(std::vector<HepMC::GenParticlePtr>& genPartVector) auto particle = genPartVector.at(0); // Create HepMcParticleLink outside of leak check. HepMcParticleLink dummyHMPL(HepMC::barcode(particle),particle->parent_event()->event_number()); + // Make sure HepMcParticleLink::getLastEventCollectionName is called. + std::ostringstream ss; + ss << dummyHMPL; assert(dummyHMPL.cptr()==particle); - Athena_test::Leakcheck check; + Athena_test::Leakcheck check; TrigInDetTrackTruth trans1; TrigInDetTrackTruthCnv_p1_test::set (trans1, genPartVector); diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref index c059ebb16c13fa47a65b285dc75a12a5217e75a2..1ce4d677498b729b9de1380e7242bcd68e298bd9 100644 --- a/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref +++ b/Trigger/TrigValidation/TrigAnalysisTest/share/ref_RDOtoRDOTrig_v1Dev_build.ref @@ -2222,6 +2222,14 @@ HLT_mu6_L1MU6: 1: 12 2: 13 3: 13 +HLT_mu6_idperfLRT_l2lrt_L1MU6: + eventCount: 10 + stepCounts: + 0: 10 + 1: 10 + stepFeatures: + 0: 13 + 1: 13 HLT_mu6_idperf_L1MU6: eventCount: 10 stepCounts: diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_BStoBStoESDAOD_v1Dev_build.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_BStoBStoESDAOD_v1Dev_build.py index c776a0cd7ac463ef5baa0422b81a3088bf1c350c..a2a021e98a3640b506f84160b63fef27253ac02f 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_BStoBStoESDAOD_v1Dev_build.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_BStoBStoESDAOD_v1Dev_build.py @@ -9,7 +9,7 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps from TrigValTools.TrigValSteering.Common import find_file from TrigAnalysisTest.TrigAnalysisSteps import add_analysis_steps -menu_name = 'LS2_v1_TriggerValidation_mc_prescale' +menu_name = 'LS2_v1_TriggerValidation_prescale' # Run athena BS->BS job BStoBS = ExecStep.ExecStep("BStoBS") diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoRDOTrig_v1Dev_build.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoRDOTrig_v1Dev_build.py index bb619b840d5e45d127967c41ed804846949b5b9f..9dab6fd4bdac12a013dcb921904a47b0121794f7 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoRDOTrig_v1Dev_build.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoRDOTrig_v1Dev_build.py @@ -33,7 +33,7 @@ rdo2rdotrig.input = '' rdo2rdotrig.explicit_input = True rdo2rdotrig.threads = 1 rdo2rdotrig.args = '--inputRDOFile=RDO.pool.root --outputRDO_TRIGFile=RDO_TRIG.pool.root' -rdo2rdotrig.args += ' --preExec="setMenu=\'LS2_v1_TriggerValidation_mc_prescale\'"' +rdo2rdotrig.args += ' --preExec="setMenu=\'LS2_v1_TriggerValidation_prescale\'"' test = Test.Test() test.art_type = 'build' diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoRDOTrig_v1Dev_grid.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoRDOTrig_v1Dev_grid.py index 517fc56c9fad0878fc24f4caa024d5a6e3e49af5..5ef081fd7d28d461c985de2c8687145eabf7397c 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoRDOTrig_v1Dev_grid.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_HITtoRDOTrig_v1Dev_grid.py @@ -48,7 +48,7 @@ rdo2rdotrig.explicit_input = True rdo2rdotrig.threads = 4 rdo2rdotrig.concurrent_events = 4 rdo2rdotrig.args = '--inputRDOFile=RDO.pool.root --outputRDO_TRIGFile=RDO_TRIG.pool.root' -rdo2rdotrig.args += ' --preExec="setMenu=\'LS2_v1_TriggerValidation_mc_prescale\'"' +rdo2rdotrig.args += ' --preExec="setMenu=\'LS2_v1_TriggerValidation_prescale\'"' test = Test.Test() test.art_type = 'grid' diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoAOD_v1Dev_build.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoAOD_v1Dev_build.py index b6cf6b5878f2bd58a1aa49a2d1c0af05174bc5dd..09c42c60c218c096ac4424838c86ba026349608f 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoAOD_v1Dev_build.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoAOD_v1Dev_build.py @@ -11,7 +11,7 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps from TrigAnalysisTest.TrigAnalysisSteps import add_analysis_steps preExec = ';'.join([ - 'setMenu=\'LS2_v1_TriggerValidation_mc_prescale\'', + 'setMenu=\'LS2_v1_TriggerValidation_prescale\'', 'from TriggerJobOpts.TriggerFlags import TriggerFlags', 'TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\")', ]) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoAOD_v1Dev_grid.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoAOD_v1Dev_grid.py index 4d5c93882d632fad20582fd40c4170f4c9d66a2d..851c4a38167ac09427cccfc6862e3950981c7d3b 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoAOD_v1Dev_grid.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoAOD_v1Dev_grid.py @@ -24,7 +24,7 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps from TrigAnalysisTest.TrigAnalysisSteps import add_analysis_steps preExec = ';'.join([ - 'setMenu=\'LS2_v1_TriggerValidation_mc_prescale\'', + 'setMenu=\'LS2_v1_TriggerValidation_prescale\'', 'from TriggerJobOpts.TriggerFlags import TriggerFlags', 'TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\")', ]) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoPhysval_v1Dev_build.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoPhysval_v1Dev_build.py index fd7ba59ad698b7a2ce8b66f4b1f4dee2e4b6f2ae..46a33f26e36e796a3851f8829ec2c476a4a50656 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoPhysval_v1Dev_build.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoPhysval_v1Dev_build.py @@ -10,7 +10,7 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps preExec = ';'.join([ - 'setMenu=\'LS2_v1_TriggerValidation_mc_prescale\'', + 'setMenu=\'LS2_v1_TriggerValidation_prescale\'', 'from TriggerJobOpts.TriggerFlags import TriggerFlags', 'TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\")', ]) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoPhysval_v1Dev_grid.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoPhysval_v1Dev_grid.py index 56a1f27ccfd334f853e1505519e191a328bb14dd..6525600e8122c47c8e2a450024cfdfc418f4480f 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoPhysval_v1Dev_grid.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoPhysval_v1Dev_grid.py @@ -29,7 +29,7 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps from TrigAnalysisTest.TrigAnalysisSteps import add_physvalweb_steps preExec = ';'.join([ - 'setMenu=\'LS2_v1_TriggerValidation_mc_prescale\'', + 'setMenu=\'LS2_v1_TriggerValidation_prescale\'', 'from TriggerJobOpts.TriggerFlags import TriggerFlags', 'TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\")', ]) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRDOTrig_v1Dev_build.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRDOTrig_v1Dev_build.py index 4f9c61a1faa0a064613760676e4e76e47255c334..833319e233f4b9a35419a15e2d46cce423d78941 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRDOTrig_v1Dev_build.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRDOTrig_v1Dev_build.py @@ -10,7 +10,7 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps preExec = ';'.join([ - 'setMenu=\'LS2_v1_TriggerValidation_mc_prescale\'', + 'setMenu=\'LS2_v1_TriggerValidation_prescale\'', 'from TriggerJobOpts.TriggerFlags import TriggerFlags', 'TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\")', ]) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRDOTrig_v1Dev_grid.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRDOTrig_v1Dev_grid.py index 057bdfcb09c9219e7305952758c2b948c9976c67..f6e560d39edee0e070f0d0e3d13454ff7043cb07 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRDOTrig_v1Dev_grid.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRDOTrig_v1Dev_grid.py @@ -23,7 +23,7 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps preExec = ';'.join([ - 'setMenu=\'LS2_v1_TriggerValidation_mc_prescale\'', + 'setMenu=\'LS2_v1_TriggerValidation_prescale\'', 'from TriggerJobOpts.TriggerFlags import TriggerFlags', 'TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\")', ]) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRun3DQ_v1Dev_MT_build.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRun3DQ_v1Dev_MT_build.py index c9e340f28cce0e598973ae37770ce389bf479cf5..5793e8e5f2cc078e1e1f4860bae5e3ffeebde8bc 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRun3DQ_v1Dev_MT_build.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRun3DQ_v1Dev_MT_build.py @@ -11,7 +11,7 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps preExec = ';'.join([ - 'setMenu=\'LS2_v1_TriggerValidation_mc_prescale\'', + 'setMenu=\'LS2_v1_TriggerValidation_prescale\'', 'from TriggerJobOpts.TriggerFlags import TriggerFlags', 'TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\")', ]) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRun3DQ_v1Dev_build.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRun3DQ_v1Dev_build.py index 99ec38f567be7c275984fb2c8982cb63c4dfe443..d3ae2deb5956aa13c30212ab9086019e9cab9469 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRun3DQ_v1Dev_build.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRun3DQ_v1Dev_build.py @@ -10,7 +10,7 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps preExec = ';'.join([ - 'setMenu=\'LS2_v1_TriggerValidation_mc_prescale\'', + 'setMenu=\'LS2_v1_TriggerValidation_prescale\'', 'from TriggerJobOpts.TriggerFlags import TriggerFlags', 'TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\")', ]) diff --git a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRun3DQ_v1Dev_grid.py b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRun3DQ_v1Dev_grid.py index 22adbb616d325c509952606b48747999d9d0e0c1..ea55ad82a889a8c134dcde8cec5ea3c010021b49 100755 --- a/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRun3DQ_v1Dev_grid.py +++ b/Trigger/TrigValidation/TrigAnalysisTest/test/test_trigAna_RDOtoRun3DQ_v1Dev_grid.py @@ -23,7 +23,7 @@ from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps preExec = ';'.join([ - 'setMenu=\'LS2_v1_TriggerValidation_mc_prescale\'', + 'setMenu=\'LS2_v1_TriggerValidation_prescale\'', 'from TriggerJobOpts.TriggerFlags import TriggerFlags', 'TriggerFlags.AODEDMSet.set_Value_and_Lock(\\\"AODFULL\\\")', ]) diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TIDAml_extensions.py b/Trigger/TrigValidation/TrigInDetValidation/share/TIDAml_extensions.py index 158b8b4453ed61aa62a1caa9392f60069bc1e916..94100dae69b6765ffa38aaa7e5f989205af88b5f 100644 --- a/Trigger/TrigValidation/TrigInDetValidation/share/TIDAml_extensions.py +++ b/Trigger/TrigValidation/TrigInDetValidation/share/TIDAml_extensions.py @@ -1,8 +1,4 @@ ftf = findAlgorithm(topSequence, "TrigFastTrackFinder__jet") -### ML seeding not yet in master. This file is a placeholder until it is implemented. -#ftf.doSeedRedundancyCheck = True -#ftf.UseTrigSeedML = 1 #can be 0, 1, 2, or 3, 0 means the -## ML-based seed filtering is off -#ftf.TrigSeedML_LUT = 'trigseed_ML_medium.lut' -#ftf.OutputLevel=DEBUG +ftf.UseTrigSeedML = 4 +##ftf.OutputLevel=DEBUG diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py index 52e1249c8f3675b889d6c9cc8a59e3483a0dd5f4..d7f1351ceda9881e6abf99e2e795a2f14c012335 100644 --- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py +++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_AODtoTrkNtuple.py @@ -58,7 +58,7 @@ from AthenaCommon.AppMgr import ToolSvc from TrigInDetAnalysisExample.TrigInDetAnalysisExampleConf import TrigTestBase -if ( True ) : +if ( False ) : from TrigIDtrkMonitoring.TrigIDtrkMonitoringConfig import TrigIDtrkMonitoringTool diff --git a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml_pu40.py b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml_pu40.py index af59f067543aa08b6cc7d28d80cc8ae17c348c73..f2f3774b7bdcb9a28de1e770f60bcd0e732c8f7c 100755 --- a/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml_pu40.py +++ b/Trigger/TrigValidation/TrigInDetValidation/test/test_trigID_fsjet_ml_pu40.py @@ -33,8 +33,7 @@ Threads = 1 Slots = 1 # what about the mt: 4 art directive ? nfiles: 3 ? Input = 'ttbar' # defined in TrigValTools/share/TrigValInputs.json -# post exec doesn't quite work yet -# postexec_file = 'TIDAml_extensions.py' +postinclude_file = 'TIDAml_extensions.py' TrackReference = [ 'Truth', 'Offline' ] diff --git a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref index dfabadecc324963be5f5233a8264166c71ec10d6..9c8ff74457777e39e45614ba290edb1a50ba2ec2 100644 --- a/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref +++ b/Trigger/TrigValidation/TriggerTest/share/ref_data_v1Dev_build.ref @@ -1188,6 +1188,14 @@ HLT_mu6_L1MU6: stepFeatures: 0: 1 1: 1 +HLT_mu6_idperfLRT_l2lrt_L1MU6: + eventCount: 1 + stepCounts: + 0: 1 + 1: 1 + stepFeatures: + 0: 1 + 1: 1 HLT_mu6_idperf_L1MU6: eventCount: 0 stepCounts: diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_MT_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_MT_build.py index adcb8d91e7fac12900ba6719f1cc1bd6dc66b3d1..0eaf58531c40479aa209f354a4b3a3e1ebe4a80e 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_MT_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_MT_build.py @@ -16,7 +16,7 @@ ex.input = 'ttbar' ex.threads = 2 ex.concurrent_events = 2 precommand = ''.join([ - "setMenu='LS2_v1_TriggerValidation_mc_prescale';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 + "setMenu='LS2_v1_TriggerValidation_prescale';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 "doWriteBS=False;", "doWriteRDOTrigger=True;", "fpeAuditor=True;" diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_build.py index bf4a455773eb663322aab8441abf82b3b8809e21..cd1f8fa8f8c7d708f2cdb273e1697e114a5e9009 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_build.py @@ -15,7 +15,7 @@ ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' ex.input = 'ttbar' ex.threads = 1 precommand = ''.join([ - "setMenu='LS2_v1_TriggerValidation_mc_prescale';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 + "setMenu='LS2_v1_TriggerValidation_prescale';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 "doWriteBS=False;", "doWriteRDOTrigger=True;", "fpeAuditor=True;" diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_deps_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_deps_build.py index fca53a86195dc8ce91393fa396c17b566ae67eea..c9df3abed69adfe6f9839e9c1fb95168303c1fdb 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_deps_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_deps_build.py @@ -15,7 +15,7 @@ ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' ex.input = 'ttbar' ex.threads = 1 precommand = ''.join([ - "setMenu='LS2_v1_TriggerValidation_mc_prescale';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 + "setMenu='LS2_v1_TriggerValidation_prescale';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 "doWriteBS=False;", "doWriteRDOTrigger=True;", "fpeAuditor=True;", diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_grid.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_grid.py index 4e806448361a610ff5c2fec6b12b939bd094030b..c170bff826765a3d748e3354df3cae7cb25268c1 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_grid.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_grid.py @@ -28,7 +28,7 @@ ex.input = 'ttbar' ex.threads = 4 ex.concurrent_events = 4 # LS2_v1 soon to be renamed to Dev_pp_run3_v1 -ex.args = '-c "setMenu=\'LS2_v1_TriggerValidation_mc_prescale\';doWriteBS=False;doWriteRDOTrigger=True;"' +ex.args = '-c "setMenu=\'LS2_v1_TriggerValidation_prescale\';doWriteBS=False;doWriteRDOTrigger=True;"' test = Test.Test() test.art_type = 'grid' diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_pu80_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_pu80_build.py index c832577a846f826e2fb856c9efc98784292e0eb4..029510946781ed8c3689d6ed0495ad30724c63b2 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_pu80_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_pu80_build.py @@ -15,7 +15,7 @@ ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' ex.input = 'ttbar_pu80' ex.threads = 1 precommand = ''.join([ - "setMenu='LS2_v1_TriggerValidation_mc_prescale';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 + "setMenu='LS2_v1_TriggerValidation_prescale';", # LS2_v1 soon to be renamed to Dev_pp_run3_v1 "doWriteBS=False;", "doWriteRDOTrigger=True;", "fpeAuditor=True;" diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_pu80_grid.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_pu80_grid.py index b44906f430bf9a6542815ed84b1f8958efc47eb2..daf6799083f76f73b2e43be68d82c3c25576b4f3 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_pu80_grid.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_pu80_grid.py @@ -28,7 +28,7 @@ ex.input = 'ttbar_pu80' ex.threads = 4 ex.concurrent_events = 4 # LS2_v1 soon to be renamed to Dev_pp_run3_v1 -ex.args = '-c "setMenu=\'LS2_v1_TriggerValidation_mc_prescale\';doWriteBS=False;doWriteRDOTrigger=True;"' +ex.args = '-c "setMenu=\'LS2_v1_TriggerValidation_prescale\';doWriteBS=False;doWriteRDOTrigger=True;"' test = Test.Test() test.art_type = 'grid' diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_build.py index 11a392f1e41ad6b1cd2d329b972460bb2c32564b..1df9248a415a4f90030f3646e6516a10d53ba4b6 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_build.py @@ -16,7 +16,7 @@ ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' ex.input = 'ttbar' ex.threads = 1 # LS2_v1 soon to be renamed to Dev_pp_run3_v1 -ex.args = '-c "setMenu=\'LS2_v1_TriggerValidation_mc_prescale\';doWriteBS=True;doWriteRDOTrigger=False;"' +ex.args = '-c "setMenu=\'LS2_v1_TriggerValidation_prescale\';doWriteBS=True;doWriteRDOTrigger=False;"' checkBS = Step.Step("CheckBS") checkBS.executable = 'trigbs_dumpHLTContentInBS_run3.py' diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_grid.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_grid.py index d25b9b9371ef627b4815e650ae2e8a781631f3b2..0c92fa833fd57055513bb7cc7a6fab2fe92e5ff8 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_grid.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_mc_v1Dev_writeBS_grid.py @@ -29,7 +29,7 @@ ex.input = 'ttbar' ex.threads = 4 ex.concurrent_events = 4 # LS2_v1 soon to be renamed to Dev_pp_run3_v1 -ex.args = '-c "setMenu=\'LS2_v1_TriggerValidation_mc_prescale\';doWriteBS=True;doWriteRDOTrigger=False;"' +ex.args = '-c "setMenu=\'LS2_v1_TriggerValidation_prescale\';doWriteBS=True;doWriteRDOTrigger=False;"' checkBS = Step.Step("CheckBS") checkBS.executable = 'trigbs_dumpHLTContentInBS_run3.py' diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py index 76901fa90e34f87e55b67b593d2bb32e92607590..36f1a86f5704216cd2e5e2fcdf1faa320bde3c66 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py @@ -189,6 +189,9 @@ TriggerHLTListRun3 = [ ('xAOD::TrackParticleContainer#HLT_IDTrack_Muon_FTF', 'BS ESD AODFULL', 'Muon', 'inViews:MUCombViewRoIs'), ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_Muon_FTFAux.', 'BS ESD AODFULL', 'Muon'), + ('xAOD::TrackParticleContainer#HLT_IDTrack_MuonLRT_FTF', 'BS ESD AODFULL', 'Muon', 'inViews:MUCombLRTViewRoIs'), + ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_MuonLRT_FTFAux.', 'BS ESD AODFULL', 'Muon'), + ('xAOD::TrackParticleContainer#HLT_IDTrack_Muon_IDTrig', 'BS ESD AODFULL AODSLIM', 'Muon', 'inViews:MUEFCBViewRoIs'), ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_Muon_IDTrigAux.', 'BS ESD AODFULL AODSLIM', 'Muon'), @@ -279,6 +282,7 @@ TriggerHLTListRun3 = [ ('xAOD::L2IsoMuonAuxContainer#HLT_MuonL2ISInfoAux.', 'BS ESD AODFULL', 'Muon'), ('TrigRoiDescriptorCollection#HLT_Roi_L2SAMuon', 'BS ESD AODFULL', 'Muon'), + ('TrigRoiDescriptorCollection#HLT_Roi_L2SAMuon_LRT', 'BS ESD AODFULL', 'Muon'), ('TrigRoiDescriptorCollection#HLT_Roi_L2SAMuonForEF', 'BS ESD AODFULL', 'Muon'), ('TrigRoiDescriptorCollection#HLT_Roi_MuonIso', 'BS ESD AODFULL', 'Muon'), @@ -296,14 +300,10 @@ TriggerHLTListRun3 = [ ('xAOD::TrackParticleContainer#HLT_IDTrack_Tau_IDTrig', 'BS ESD AODFULL', 'Tau', 'inViews:TAUFTFIdViews'), ('xAOD::TrackParticleAuxContainer#HLT_IDTrack_Tau_IDTrigAux.', 'BS ESD AODFULL', 'Tau'), - ('TrigRoiDescriptorCollection#HLT_Roi_Tau_TrackTwo', 'BS ESD AODFULL AODSLIM', 'Steer'), - ('TrigRoiDescriptorCollection#HLT_Roi_Tau_Track', 'BS ESD AODFULL AODSLIM', 'Steer'), ('TrigRoiDescriptorCollection#HLT_Roi_Tau', 'BS ESD AODFULL AODSLIM', 'Steer'), - ('TrigRoiDescriptorCollection#HLT_Roi_TauCore_MVA', 'BS ESD AODFULL AODSLIM', 'Steer'), ('TrigRoiDescriptorCollection#HLT_Roi_TauCore', 'BS ESD AODFULL AODSLIM', 'Steer'), ('TrigRoiDescriptorCollection#HLT_Roi_TauIso', 'BS ESD AODFULL AODSLIM', 'Steer'), ('TrigRoiDescriptorCollection#HLT_Roi_TauIsoBDT', 'BS ESD AODFULL AODSLIM', 'Steer'), - ('TrigRoiDescriptorCollection#HLT_Roi_TauID', 'BS ESD AODFULL AODSLIM', 'Steer'), ('xAOD::JetContainer#HLT_jet_seed', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Tau', 'inViews:TAUCaloViews,TAUCaloMVAViews'), ('xAOD::JetAuxContainer#HLT_jet_seedAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Tau'), diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py index c1572a7226cdd9f11d1cc06bc76702eb96eef20a..a2faf47f8358107ccca6d791467baad01dd2c188 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerFlags.py @@ -806,7 +806,9 @@ class triggerMenuSetup(JobProperty): 'Dev_HI_run3_v1', # Dev_HI_run3 for AthenaMT 'MC_pp_v8', 'Physics_pp_v8', 'MC_pp_v8_no_prescale', 'MC_pp_v8_tight_mc_prescale', 'MC_pp_v8_tightperf_mc_prescale', 'MC_pp_v8_loose_mc_prescale','Physics_pp_v8_tight_physics_prescale', 'Cosmic_run3_v1', - 'LS2_v1_TriggerValidation_mc_prescale' + 'LS2_v1_TriggerValidation_prescale', + 'LS2_v1_BulkMCProd_prescale', + 'LS2_v1_CPSampleProd_prescale' ] _default_menu='Physics_pp_v7_primaries' diff --git a/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v7_primaries.py b/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v7_primaries.py index aae5f473bd25aa68a3bdae6e3bb685b4a8c7eae9..7f1c3998c8aaf0a79cf4baf68bf84727ec5c4b29 100644 --- a/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v7_primaries.py +++ b/Trigger/TriggerCommon/TriggerMenu/python/menu/Physics_pp_v7_primaries.py @@ -375,9 +375,29 @@ def setupMenu(): ['mu11_mu6_bTau', 'L1_MU11_2MU6', ['L1_MU11','L1_MU6'], [BPhysicsStream, 'express'], [RATE_BphysTag,BW_BphysTag], -1], # ATR-21242 - with L1 in the name, for validation with MT - ['2mu4_bJpsimumu_L12MU4', 'L1_2MU4', ['L1_2MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], - ['2mu4_bUpsimumu_L12MU4', 'L1_2MU4', ['L1_2MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], - ['2mu4_bDimu_L12MU4', 'L1_2MU4', ['L1_2MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['2mu4_bJpsimumu_L12MU4', 'L1_2MU4', ['L1_2MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['2mu4_bUpsimumu_L12MU4', 'L1_2MU4', ['L1_2MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['2mu4_bDimu_L12MU4', 'L1_2MU4', ['L1_2MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['mu6_mu4_bJpsimumu_L1MU6_2MU4', 'L1_MU6_2MU4', ['L1_MU6','L1_MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['mu6_mu4_bUpsimumu_L1MU6_2MU4', 'L1_MU6_2MU4', ['L1_MU6','L1_MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['mu6_mu4_bDimu_L1MU6_2MU4', 'L1_MU6_2MU4', ['L1_MU6','L1_MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['2mu6_bJpsimumu_L12MU6', 'L1_2MU6', ['L1_2MU6'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['2mu6_bUpsimumu_L12MU6', 'L1_2MU6', ['L1_2MU6'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['2mu6_bDimu_L12MU6', 'L1_2MU6', ['L1_2MU6'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['mu11_mu6_bBmumu_L1MU11_2MU6', 'L1_MU11_2MU6', ['L1_MU11','L1_MU6'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['mu11_mu6_bDimu_L1MU11_2MU6', 'L1_MU11_2MU6', ['L1_MU11','L1_MU6'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['mu11_mu6_bDimu2700_L1MU11_2MU6', 'L1_MU11_2MU6', ['L1_MU11','L1_MU6'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['mu11_mu6_bJpsimumu_L1MU11_2MU6', 'L1_MU11_2MU6', ['L1_MU11','L1_MU6'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['mu11_mu6_bPhi_L1MU11_2MU6', 'L1_MU11_2MU6', ['L1_MU11','L1_MU6'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['mu11_mu6_bTau_L1MU11_2MU6', 'L1_MU11_2MU6', ['L1_MU11','L1_MU6'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['mu11_mu6_bUpsimumu_L1MU11_2MU6', 'L1_MU11_2MU6', ['L1_MU11','L1_MU6'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['2mu4_bBmumux_BpmumuKp_L12MU4', 'L1_2MU4', ['L1_2MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['2mu4_bBmumux_BsmumuPhi_L12MU4', 'L1_2MU4', ['L1_2MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['3mu4_bJpsi', 'L1_3MU4', ['L1_3MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['3mu4_bUpsi', 'L1_3MU4', ['L1_3MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['3mu4_bTau', 'L1_3MU4', ['L1_3MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['3mu4_bPhi', 'L1_3MU4', ['L1_3MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], + ['3mu4_bDimu', 'L1_3MU4', ['L1_3MU4'], [BPhysicsStream], [RATE_BphysTag, BW_BphysTag], -1], ] diff --git a/Trigger/TriggerCommon/TriggerMenu/python/menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenu/python/menu/SignatureDicts.py index e9dfb0e8c16eb5a2ffde6601e4f397cf1a8e7026..17e8ca2fbc20bec2165d425dfb5421a5eb9fd863 100644 --- a/Trigger/TriggerCommon/TriggerMenu/python/menu/SignatureDicts.py +++ b/Trigger/TriggerCommon/TriggerMenu/python/menu/SignatureDicts.py @@ -56,7 +56,7 @@ ChainDictTemplate = { AllowedTopos_e = ["Jpsiee","Zeg","Zee"] AllowedTopos_mu = ['Jpsimumu'] AllowedTopos_xe = ['1dphi10', '2dphi05', '6dphi05', '6dphi15', '2dphi05', '2dphi15', 'mt25', 'mt35', 'razor140', 'razor170', 'razor200','razor220','razor100','razor185','razor195'] -AllowedTopos_bphys = ['bJpsi', 'bTau', 'bDimu', +AllowedTopos_bphys = ['bJpsi', 'bTau', 'bDimu', 'bDimu2700', 'bJpsimumu', 'bUpsimumu', 'bBmumu', 'bBmumux', 'bBmumuxv2', 'bBmumuxv3', diff --git a/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt b/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt index aec1bf6342f44cffd13852b2c26dbce60362be3e..089c345ce00ee201990ea5332d1494f299d4fef4 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt +++ b/Trigger/TriggerCommon/TriggerMenuMT/CMakeLists.txt @@ -166,4 +166,6 @@ atlas_build_lvl1_trigger_menu( MC_pp_run3_v1 ) atlas_build_lvl1_trigger_menu( Cosmic_run3_v1 ) atlas_build_lvl1_trigger_menu( PhysicsP1_HI_run3_v1 ) atlas_build_lvl1_trigger_menu( Dev_HI_run3_v1 ) -atlas_build_lvl1_trigger_menu( LS2_v1_TriggerValidation_mc_prescale ) +atlas_build_lvl1_trigger_menu( LS2_v1_TriggerValidation_prescale ) +atlas_build_lvl1_trigger_menu( LS2_v1_BulkMCProd_prescale ) +atlas_build_lvl1_trigger_menu( LS2_v1_CPSampleProd_prescale ) \ No newline at end of file diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py index 363092d4e08ffedab377e313e4f1a6bccc89deca..e0302f892f83f8dbc8fb1994d8548335893d6a9a 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py @@ -41,6 +41,8 @@ def setupMenu(): #test chains ChainProp(name='HLT_mu6_L1MU6', groups=SingleMuonGroup), + ChainProp(name='HLT_mu6_idperfLRT_l2lrt_L1MU6', groups=SingleMuonGroup), + ChainProp(name='HLT_mu6_ivarmedium_L1MU6', groups=SingleMuonGroup), # commented because it is conflict with dimuon noL1 serial chain diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py index 7ff099548b03ac841e6697e37a1920f19d88c760..41568079242c9648db22fd9839ed4ef152254337 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/MenuPrescaleConfig.py @@ -29,10 +29,18 @@ def MenuPrescaleConfig(triggerConfigHLT): if 'tight_mc_prescale' in menu_name: L1Prescales = Prescales.L1Prescales_tight_mc_prescale HLTPrescales = Prescales.HLTPrescales_tight_mc_prescale - elif 'TriggerValidation_mc_prescale' in menu_name: - disableChains(TriggerFlags, Prescales.HLTPrescales_trigvalid_mc_prescale, "Online") - L1Prescales = Prescales.L1Prescales_trigvalid_mc_prescale - HLTPrescales = Prescales.HLTPrescales_trigvalid_mc_prescale + elif 'TriggerValidation_prescale' in menu_name: + disableChains(TriggerFlags, Prescales.HLTPrescales_trigvalid_prescale, "Online") + L1Prescales = Prescales.L1Prescales_trigvalid_prescale + HLTPrescales = Prescales.HLTPrescales_trigvalid_prescale + elif 'BulkMCProd_prescale' in menu_name: + disableChains(TriggerFlags, Prescales.HLTPrescales_bulkmcprod_prescale, "Online") + L1Prescales = Prescales.L1Prescales_bulkmcprod_prescale + HLTPrescales = Prescales.HLTPrescales_bulkmcprod_prescale + elif 'CPSampleProd_prescale' in menu_name: + disableChains(TriggerFlags, Prescales.HLTPrescales_cpsampleprod_prescale, "Online") + L1Prescales = Prescales.L1Prescales_cpsampleprod_prescale + HLTPrescales = Prescales.HLTPrescales_cpsampleprod_prescale else: L1Prescales = Prescales.L1Prescales HLTPrescales = Prescales.HLTPrescales @@ -109,7 +117,7 @@ def MenuPrescaleConfig(triggerConfigHLT): return (L1Prescales, HLTPrescales) -def disableChains(flags, trigvalid_prescales, type_group): +def disableChains(flags, type_prescales, type_group): signatures = [] slice_props = [prop for prop in dir(flags) if prop.endswith("Slice")] for slice_prop in slice_props: @@ -125,7 +133,7 @@ def disableChains(flags, trigvalid_prescales, type_group): if type_group in chain.groups: chain_online_list.append(chain.name) - trigvalid_prescales.update(zip(chain_online_list,len(chain_online_list)*[ [-1, 0,-1] ])) + type_prescales.update(zip(chain_online_list,len(chain_online_list)*[ [-1, 0,-1] ])) def applyHLTPrescale(triggerPythonConfig, HLTPrescale, signaturesOverwritten): @@ -160,10 +168,15 @@ class PrescaleClass(object): # - If only the first value is specified, # the default value of pass-through (=0) will be used #---------------------------------------------------------- - HLTPrescales = { - } + HLTPrescales = {} + + L1Prescales_trigvalid_prescale = {} + HLTPrescales_trigvalid_prescale = {} + + L1Prescales_bulkmcprod_prescale = {} + HLTPrescales_bulkmcprod_prescale = {} - L1Prescales_trigvalid_mc_prescale = {} - HLTPrescales_trigvalid_mc_prescale = {} + L1Prescales_cpsampleprod_prescale = {} + HLTPrescales_cpsampleprod_prescale = {} chain_list=[] diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py index e6d9f2096f915e8e8a8dc96a13013b59e60e3b11..34bce8ae95447afaa80a913068fa3302603c4a03 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py @@ -222,11 +222,11 @@ MuonChainParts = { 'trigType' : ['mu'], 'etaRange' : ['0eta2550','0eta105'], 'threshold' : '', - 'extra' : ['noL1', 'msonly','lateMu', "Dr", "muoncalib" ,'l2io'], + 'extra' : ['noL1', 'msonly','lateMu', "Dr", "muoncalib" ,'l2io','l2lrt'], 'IDinfo' : [], 'isoInfo' : ['ivarmedium'], 'invMassInfo' : ['10invm70'], - 'addInfo' : ['1step','idperf','3layersEC','cosmic',"muonqual"], + 'addInfo' : ['1step','idperf','idperfLRT','3layersEC','cosmic',"muonqual"], 'topo' : AllowedTopos_mu, 'flavour' : [], 'sigFolder' : 'Muon', diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonDef.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonDef.py index d274928a3c1e86eb78520297d0687ae89569e389..f68f6cdfa5410ddfd713680a8025623737a675b5 100755 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonDef.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonDef.py @@ -11,7 +11,7 @@ log = logging.getLogger("TriggerMenuMT.HLTMenuConfig.Muon.MuonDef") from TriggerMenuMT.HLTMenuConfig.Menu.ChainConfigurationBase import ChainConfigurationBase -from TriggerMenuMT.HLTMenuConfig.Muon.MuonSequenceSetup import muFastSequence, muFastOvlpRmSequence, muCombSequence, muCombOvlpRmSequence, mul2IOOvlpRmSequence, muEFSASequence, muEFCBSequence, muEFSAFSSequence, muEFCBFSSequence, muEFIsoSequence, efLateMuRoISequence, efLateMuSequence +from TriggerMenuMT.HLTMenuConfig.Muon.MuonSequenceSetup import muFastSequence, muFastOvlpRmSequence, muCombSequence, muCombLRTSequence, muCombOvlpRmSequence, mul2IOOvlpRmSequence, muEFSASequence, muEFCBSequence, muEFSAFSSequence, muEFCBFSSequence, muEFIsoSequence, efLateMuRoISequence, efLateMuSequence from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigMuonEFInvMassHypoToolFromDict # this must be moved to the HypoTool file: @@ -35,6 +35,9 @@ def muFastOvlpRmSequenceCfg(flags): def muCombSequenceCfg(flags): return muCombSequence() +def muCombLRTSequenceCfg(flags): + return muCombLRTSequence() + def muCombOvlpRmSequenceCfg(flags): return muCombOvlpRmSequence() @@ -82,6 +85,7 @@ class MuonChainConfiguration(ChainConfigurationBase): key = self.chainPart['extra']+self.chainPart['isoInfo'] + steps=stepDictionary[key] for step_level in steps: @@ -112,7 +116,9 @@ class MuonChainConfiguration(ChainConfigurationBase): "ivarmedium":[['getmuFast', 'getmuComb'], ['getmuEFSA', 'getmuEFCB', 'getmuEFIso']], "lateMu":[[],['getLateMuRoI','getLateMu']], "Dr": [['getmuFastDr', 'getmuCombDr']], - "muoncalib":[['getmuFast']] + "muoncalib":[['getmuFast']], + "l2lrt":[['getmuFast', 'getmuComb']], + } return stepDictionary @@ -137,6 +143,7 @@ class MuonChainConfiguration(ChainConfigurationBase): # -------------------- def getmuComb(self): + doOvlpRm = False if "bTau" in self.chainName or "bJpsi" in self.chainName or "bUpsi" in self.chainName or "bDimu" in self.chainName or "bBmu" in self.chainName: doOvlpRm = False @@ -147,8 +154,11 @@ class MuonChainConfiguration(ChainConfigurationBase): else: doOvlpRm = False + if doOvlpRm: return self.getStep(2, 'muComb', [muCombOvlpRmSequenceCfg] ) + elif "idperfLRT" in self.chainName: + return self.getStep(2, 'muCombLRT', [muCombLRTSequenceCfg] ) else: return self.getStep(2, 'muComb', [muCombSequenceCfg] ) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py index 441544bda753adca2b2ce042e3628d84e4f3636a..45702fb654e27b511878b361185757b3ead7a4b2 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSequenceSetup.py @@ -183,6 +183,59 @@ def muCombSequence(): HypoToolGen = TrigmuCombHypoToolFromDict ) +def muCombLRTAlgSequence(ConfigFlags): + ### set the EVCreator ### + l2muCombLRTViewsMaker = EventViewCreatorAlgorithm("IMl2muCombLRT") + newRoITool = ViewCreatorFetchFromViewROITool() + newRoITool.RoisWriteHandleKey = recordable("HLT_Roi_L2SAMuon_LRT") #RoI collection recorded to EDM + newRoITool.InViewRoIs = muNames.L2forIDName #input RoIs from L2 SA views + + # + l2muCombLRTViewsMaker.RoIsLink = "initialRoI" # ROI for merging is still from L1, we get exactly one L2 SA muon per L1 ROI + l2muCombLRTViewsMaker.RoITool = newRoITool # Create a new ROI centred on the L2 SA muon from Step 1 + # + l2muCombLRTViewsMaker.Views = "MUCombLRTViewRoIs" #output of the views maker (key in "storegate") + l2muCombLRTViewsMaker.InViewRoIs = "MUIDRoIs" # Name of the RoI collection inside of the view, holds the single ROI used to seed the View. + # + l2muCombLRTViewsMaker.RequireParentView = True + l2muCombLRTViewsMaker.ViewFallThrough = True #if this needs to access anything from the previous step, from within the view + + ### get ID tracking and muComb reco sequences ### + from TriggerMenuMT.HLTMenuConfig.Muon.MuonSetup import muCombRecoSequence, muonIDFastTrackingSequence + + muCombLRTRecoSequence, sequenceOut = muCombRecoSequence( l2muCombLRTViewsMaker.InViewRoIs, "FTF_LRT" ) + + extraLoads = [] + + muFastIDRecoSequence = muonIDFastTrackingSequence( l2muCombLRTViewsMaker.InViewRoIs , "LRT", extraLoads, doLRT=True ) + + muCombLRTIDSequence = parOR("l2muCombLRTIDSequence", [muFastIDRecoSequence, muCombLRTRecoSequence]) + + l2muCombLRTViewsMaker.ViewNodeName = muCombLRTIDSequence.name() + + l2muCombLRTSequence = seqAND("l2muCombLRTSequence", [l2muCombLRTViewsMaker, muCombLRTIDSequence] ) + + return (l2muCombLRTSequence, l2muCombLRTViewsMaker, sequenceOut) + + + +def muCombLRTSequence(): + + (l2muCombLRTSequence, l2muCombLRTViewsMaker, sequenceOut) = RecoFragmentsPool.retrieve(muCombLRTAlgSequence, ConfigFlags) + + ### set up muCombHypo algorithm ### + from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigmuCombHypoAlg + #trigmuCombHypo = TrigmuCombHypoAlg("L2muCombHypoAlg") # avoid to have "Comb" string in the name due to HLTCFConfig.py. + trigmuCombHypo = TrigmuCombHypoAlg("TrigL2MuCBHypoAlg_LRT") + trigmuCombHypo.MuonL2CBInfoFromMuCombAlg = sequenceOut + + from TrigMuonHypoMT.TrigMuonHypoMTConfig import TrigmuCombHypoToolFromDict + + return MenuSequence( Sequence = l2muCombLRTSequence, + Maker = l2muCombLRTViewsMaker, + Hypo = trigmuCombHypo, + HypoToolGen = TrigmuCombHypoToolFromDict ) + def muCombOvlpRmSequence(): diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py index d7ac0a758cefa39c25fc1bf3bf90d9384dd0d1c4..ffae34767d601c331c72332500fb8cd75456c139 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py @@ -490,7 +490,7 @@ def muFastRecoSequence( RoIs, doFullScanID = False, InsideOutMode=False ): return muFastRecoSequence, sequenceOut -def muonIDFastTrackingSequence( RoIs, name, extraLoads=None ): +def muonIDFastTrackingSequence( RoIs, name, extraLoads=None, doLRT=False ): from AthenaCommon.CFElements import parOR @@ -517,11 +517,11 @@ def muonIDFastTrackingSequence( RoIs, name, extraLoads=None ): def muCombRecoSequence( RoIs, name ): from AthenaCommon.CFElements import parOR - muCombRecoSequence = parOR("l2muCombViewNode") + muCombRecoSequence = parOR("l2muCombViewNode_"+name) ### A simple algorithm to confirm that data has been inherited from parent view ### ### Required to satisfy data dependencies ### import AthenaCommon.CfgMgr as CfgMgr - ViewVerify = CfgMgr.AthViews__ViewDataVerifier("muFastViewDataVerifier") + ViewVerify = CfgMgr.AthViews__ViewDataVerifier("muFastViewDataVerifier_"+name) ViewVerify.DataObjects = [('xAOD::L2StandAloneMuonContainer','StoreGateSvc+%s' % muNames.L2SAName)] muCombRecoSequence+=ViewVerify @@ -529,9 +529,12 @@ def muCombRecoSequence( RoIs, name ): ### please read out TrigmuCombMTConfig file ### ### and set up to run muCombMT algorithm ### from TrigmuComb.TrigmuCombMTConfig import TrigmuCombMTConfig - muCombAlg = TrigmuCombMTConfig("Muon", name) + muCombAlg = TrigmuCombMTConfig("Muon",name) muCombAlg.L2StandAloneMuonContainerName = muNames.L2SAName - muCombAlg.TrackParticlesContainerName = TrackParticlesName + if ("LRT" in name): + muCombAlg.TrackParticlesContainerName = recordable("HLT_IDTrack_MuonLRT_FTF") ###Â TODO This should be set correctly elsewhere - see also note about TrackParticlesName at start of file. + else: + muCombAlg.TrackParticlesContainerName = TrackParticlesName muCombAlg.L2CombinedMuonContainerName = muNames.L2CBName muCombRecoSequence += muCombAlg @@ -669,6 +672,7 @@ def muEFSARecoSequence( RoIs, name ): def muEFCBRecoSequence( RoIs, name ): + from AthenaCommon import CfgMgr from AthenaCommon.CFElements import parOR from MuonCombinedRecExample.MuonCombinedAlgs import MuonCombinedInDetCandidateAlg, MuonCombinedAlg, MuonCreatorAlg diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py index 6a4eb88fad42bf75feed3d3abbe878be4547b5d9..ab0236cf8252ff24fbcc90b4da4282c058b16e37 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/generateMuon.py @@ -35,11 +35,13 @@ def EFMuonCBViewDataVerifierCfg(): def EFMuonViewDataVerifierCfg(): EFMuonViewDataVerifier = CompFactory.AthViews.ViewDataVerifier("VDVEFMuon") EFMuonViewDataVerifier.DataObjects = [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ), - ( 'Muon::MdtPrepDataContainer' , 'StoreGateSvc+MDT_DriftCircles' ), - ( 'Muon::TgcPrepDataContainer' , 'StoreGateSvc+TGC_Measurements' ), - ( 'Muon::RpcPrepDataContainer' , 'StoreGateSvc+RPC_Measurements' ), - ( 'Muon::CscStripPrepDataContainer' , 'StoreGateSvc+CSC_Measurements' ), - ( 'Muon::CscPrepDataContainer' , 'StoreGateSvc+CSC_Clusters' ), + ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+EFMuMSRecoRoIs' ), + ( 'RpcPad_Cache' , 'StoreGateSvc+RpcRdoCache' ), + ( 'RpcCoinDataCollection_Cache' , 'StoreGateSvc+RpcCoinCache' ), + ( 'RpcPrepDataCollection_Cache' , 'StoreGateSvc+RpcPrdCache' ), + ( 'TgcRdo_Cache' , 'StoreGateSvc+TgcRdoCache' ), + ( 'MdtCsm_Cache' , 'StoreGateSvc+MdtCsmRdoCache' ), + ( 'CscRawDataCollection_Cache' , 'StoreGateSvc+CscRdoCache' ) ] result = ComponentAccumulator() result.addEventAlgo(EFMuonViewDataVerifier) @@ -111,6 +113,10 @@ def MuonTrackParticleCnvCfg(flags, name = "MuonTrackParticleCnvAlg",**kwargs): kwargs.setdefault("RecTrackParticleContainerCnvTool", acc.popPrivateTools()) result.merge(acc) + acc = MuonRecTrackParticleContainerCnvToolCfg(flags) + kwargs.setdefault("RecTrackParticleContainerCnvTool", acc.popPrivateTools()) + result.merge(acc) + kwargs.setdefault("TrackContainerName", "MuonSpectrometerTracks") kwargs.setdefault("xAODTrackParticlesFromTracksContainerName", "MuonSpectrometerTrackParticles") kwargs.setdefault("AODContainerName", "") @@ -124,100 +130,108 @@ def MuonTrackParticleCnvCfg(flags, name = "MuonTrackParticleCnvAlg",**kwargs): result.addEventAlgo( trackcnv, primary=True ) return result -def efMuHypoCfg(flags, name="UNSPECIFIED", inputMuons="UNSPECIFIED"): - TrigMuonEFHypoAlg = CompFactory.TrigMuonEFHypoAlg - efHypo = TrigMuonEFHypoAlg(name) - efHypo.MuonDecisions = inputMuons - return efHypo - - -def generateChains( flags, chainDict ): - chainDict = splitChainDict(chainDict)[0] - - # Step 1 (L2MuonSA) - stepName = 'L2MuonSA' - stepReco, stepView = createStepView(stepName) - +def decodeCfg(flags, RoIs): acc = ComponentAccumulator() - acc.addSequence(stepView) - - # Set EventViews for L2MuonSA step - from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import InViewReco - reco = InViewReco("L2MuFastReco") - - #external data loading to view - reco.mergeReco( MuFastViewDataVerifier() ) - - - # decoding # Get RPC BS decoder from MuonConfig.MuonBytestreamDecodeConfig import RpcBytestreamDecodeCfg - rpcAcc = RpcBytestreamDecodeCfg( flags, forTrigger=True ) - rpcAcc.getEventAlgo("RpcRawDataProvider").RoIs = reco.name+"RoIs" - reco.mergeReco( rpcAcc ) + rpcAcc = RpcBytestreamDecodeCfg( flags, name = "RpcRawDataProvider_"+RoIs ) + rpcAcc.getEventAlgo("RpcRawDataProvider_"+RoIs).RoIs = RoIs + acc.merge( rpcAcc ) # Get RPC BS->RDO convertor from MuonConfig.MuonRdoDecodeConfig import RpcRDODecodeCfg - rpcAcc = RpcRDODecodeCfg( flags, forTrigger=True ) - rpcAcc.getEventAlgo("RpcRdoToRpcPrepData").RoIs = reco.name+"RoIs" - reco.mergeReco( rpcAcc ) + rpcAcc = RpcRDODecodeCfg( flags, name= "RpcRdoToRpcPrepData_"+RoIs ) + rpcAcc.getEventAlgo("RpcRdoToRpcPrepData_"+RoIs).RoIs = RoIs + acc.merge( rpcAcc ) # Get TGC BS decoder from MuonConfig.MuonBytestreamDecodeConfig import TgcBytestreamDecodeCfg - tgcAcc = TgcBytestreamDecodeCfg( flags, forTrigger=True ) - tgcAcc.getEventAlgo("TgcRawDataProvider").RoIs = reco.name+"RoIs" - reco.mergeReco( tgcAcc ) + tgcAcc = TgcBytestreamDecodeCfg( flags, name="TgcRawDataProvider_"+RoIs ) + tgcAcc.getEventAlgo("TgcRawDataProvider_"+RoIs).RoIs = RoIs + acc.merge( tgcAcc ) # Get TGC BS->RDO convertor from MuonConfig.MuonRdoDecodeConfig import TgcRDODecodeCfg - tgcAcc = TgcRDODecodeCfg( flags, forTrigger=True ) - tgcAcc.getEventAlgo("TgcRdoToTgcPrepData").RoIs = reco.name+"RoIs" - reco.mergeReco( tgcAcc ) + tgcAcc = TgcRDODecodeCfg( flags, name="TgcRdoToTgcPrepData_"+RoIs ) + tgcAcc.getEventAlgo("TgcRdoToTgcPrepData_"+RoIs).RoIs = RoIs + acc.merge( tgcAcc ) # Get MDT BS decoder from MuonConfig.MuonBytestreamDecodeConfig import MdtBytestreamDecodeCfg - mdtAcc = MdtBytestreamDecodeCfg( flags, forTrigger=True ) - mdtAcc.getEventAlgo("MdtRawDataProvider").RoIs = reco.name+"RoIs" - reco.mergeReco( mdtAcc ) + mdtAcc = MdtBytestreamDecodeCfg( flags, name="MdtRawDataProvider_"+RoIs ) + mdtAcc.getEventAlgo("MdtRawDataProvider_"+RoIs).RoIs = RoIs + acc.merge( mdtAcc ) # Get MDT BS->RDO convertor from MuonConfig.MuonRdoDecodeConfig import MdtRDODecodeCfg - mdtAcc = MdtRDODecodeCfg( flags, forTrigger=True ) - mdtAcc.getEventAlgo("MdtRdoToMdtPrepData").RoIs = reco.name+"RoIs" - reco.mergeReco( mdtAcc ) + mdtAcc = MdtRDODecodeCfg( flags, name="MdtRdoToMdtPrepData_"+RoIs ) + mdtAcc.getEventAlgo("MdtRdoToMdtPrepData_"+RoIs).RoIs = RoIs + acc.merge( mdtAcc ) # Get CSC BS decoder from MuonConfig.MuonBytestreamDecodeConfig import CscBytestreamDecodeCfg - cscAcc = CscBytestreamDecodeCfg( flags, forTrigger=True ) - cscAcc.getEventAlgo("CscRawDataProvider").RoIs = reco.name+"RoIs" - reco.mergeReco( cscAcc ) + cscAcc = CscBytestreamDecodeCfg( flags, name="CscRawDataProvider_"+RoIs ) + cscAcc.getEventAlgo("CscRawDataProvider_"+RoIs).RoIs = RoIs + acc.merge( cscAcc ) # Get CSC BS->RDO convertor from MuonConfig.MuonRdoDecodeConfig import CscRDODecodeCfg - cscAcc = CscRDODecodeCfg( flags, forTrigger=True ) - cscAcc.getEventAlgo("CscRdoToCscPrepData").RoIs = reco.name+"RoIs" - reco.mergeReco( cscAcc ) + cscAcc = CscRDODecodeCfg( flags, name="CscRdoToCscPrepData_"+RoIs ) + cscAcc.getEventAlgo("CscRdoToCscPrepData_"+RoIs).RoIs = RoIs + acc.merge( cscAcc ) # Get CSC cluster builder from MuonConfig.MuonRdoDecodeConfig import CscClusterBuildCfg - cscAcc = CscClusterBuildCfg( flags, forTrigger=True ) - reco.mergeReco( cscAcc ) + cscAcc = CscClusterBuildCfg( flags, name="CscThresholdClusterBuilder_"+RoIs ) + acc.merge( cscAcc ) + + return acc + + +def efMuHypoCfg(flags, name="UNSPECIFIED", inputMuons="UNSPECIFIED"): + TrigMuonEFHypoAlg = CompFactory.TrigMuonEFHypoAlg + efHypo = TrigMuonEFHypoAlg(name) + efHypo.MuonDecisions = inputMuons + return efHypo + + +def generateChains( flags, chainDict ): + chainDict = splitChainDict(chainDict)[0] + + #Clone and replace offline flags so we can set muon trigger specific values + muonflags = flags.cloneAndReplace('Muon', 'Trigger.Offline.Muon') + + # Step 1 (L2MuonSA) + stepName = 'L2MuonSA' + stepReco, stepView = createStepView(stepName) + acc = ComponentAccumulator() + acc.addSequence(stepView) + + # Set EventViews for L2MuonSA step + from TriggerMenuMT.HLTMenuConfig.Menu.MenuComponents import InViewReco + reco = InViewReco("L2MuFastReco") + + #external data loading to view + reco.mergeReco( MuFastViewDataVerifier() ) + + # decoding + decodeAcc = decodeCfg(muonflags, reco.name+"RoIs") + reco.mergeReco(decodeAcc) # Get Reco alg of muFast Step in order to set into the view - algAcc, alg = l2MuFastAlgCfg( flags, roisKey=reco.name+"RoIs") + algAcc, alg = l2MuFastAlgCfg( muonflags, roisKey=reco.name+"RoIs") l2MuFastAlgAcc = ComponentAccumulator() l2MuFastAlgAcc.addEventAlgo(alg) reco.mergeReco( l2MuFastAlgAcc ) reco.merge( algAcc ) - # l2muFastReco = l2MuFastRecoCfg(flags) acc.merge( reco, sequenceName=stepReco.getName() ) ### Set muon step1 ### - l2muFastHypo = l2MuFastHypoCfg( flags, + l2muFastHypo = l2MuFastHypoCfg( muonflags, name = 'TrigL2MuFastHypo', muFastInfo = 'MuonL2SAInfo' ) @@ -238,18 +252,18 @@ def generateChains( flags, chainDict ): accL2CB.addSequence(stepL2CBView) # Set EventViews for L2MuonCB step - recoL2CB = l2MuCombRecoCfg(flags) + recoL2CB = l2MuCombRecoCfg(muonflags) #external data loading to view recoL2CB.inputMaker().RequireParentView = True recoL2CB.mergeReco( MuCombViewDataVerifier() ) #ID tracking - accID = trigInDetFastTrackingCfg( flags, roisKey=recoL2CB.inputMaker().InViewRoIs, signatureName="Muon" ) + accID = trigInDetFastTrackingCfg( muonflags, roisKey=recoL2CB.inputMaker().InViewRoIs, signatureName="Muon" ) recoL2CB.mergeReco(accID) accL2CB.merge(recoL2CB, sequenceName = stepL2CBReco.getName()) - l2muCombHypo = l2MuCombHypoCfg(flags, + l2muCombHypo = l2MuCombHypoCfg(muonflags, name = 'TrigL2MuCombHypo', muCombInfo = 'HLT_MuonL2CBInfo' ) @@ -265,9 +279,6 @@ def generateChains( flags, chainDict ): stepEFMSName = 'EFMSMuon' stepEFMSReco, stepEFMSView = createStepView(stepEFMSName) - #Clone and replace offline flags so we can set muon trigger specific values - muonflags = flags.cloneAndReplace('Muon', 'Trigger.Offline.Muon') - accMS = ComponentAccumulator() accMS.addSequence(stepEFMSView) @@ -286,23 +297,27 @@ def generateChains( flags, chainDict ): #Probably this block will eventually need to move somewhere more central from BeamPipeGeoModel.BeamPipeGMConfig import BeamPipeGeometryCfg - accMS.merge( BeamPipeGeometryCfg(flags) ) + accMS.merge( BeamPipeGeometryCfg(muonflags) ) from PixelGeoModel.PixelGeoModelConfig import PixelGeometryCfg - accMS.merge(PixelGeometryCfg(flags)) + accMS.merge(PixelGeometryCfg(muonflags)) from SCT_GeoModel.SCT_GeoModelConfig import SCT_GeometryCfg - accMS.merge(SCT_GeometryCfg(flags)) + accMS.merge(SCT_GeometryCfg(muonflags)) from TRT_GeoModel.TRT_GeoModelConfig import TRT_GeometryCfg - accMS.merge(TRT_GeometryCfg(flags)) + accMS.merge(TRT_GeometryCfg(muonflags)) from TrkConfig.AtlasTrackingGeometrySvcConfig import TrackingGeometrySvcCfg - accMS.merge(TrackingGeometrySvcCfg(flags)) + accMS.merge(TrackingGeometrySvcCfg(muonflags)) ################### EFMuonViewDataVerifier = EFMuonViewDataVerifierCfg() recoMS.mergeReco(EFMuonViewDataVerifier) + + # decoding + decodeAcc = decodeCfg(muonflags, recoMS.name+"RoIs") + recoMS.mergeReco(decodeAcc) from MuonConfig.MuonSegmentFindingConfig import MooSegmentFinderAlgCfg segCfg = MooSegmentFinderAlgCfg(muonflags,name="TrigMooSegmentFinder",UseTGCNextBC=False, UseTGCPriorBC=False) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py index f69fbc8370abff462a298f9f036ddfeec8f3d644..57bb6c32579ec30771c56affb7b776d1c54dd3e8 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Tau/TauRecoSequences.py @@ -109,7 +109,7 @@ def _algoTauPreselection(inputRoIs, tracks, step): from TrigTauRec.TrigTauRecConfigMT import TrigTauRecMerged_TauPreselection algo = TrigTauRecMerged_TauPreselection(name= "TrigTauRecMerged_TauPreselection_"+step) algo.RoIInputKey = inputRoIs - algo.L1RoIKey = "TAUCaloRoIs" + algo.L1RoIKey = "HLT_TAURoI" algo.clustersKey = "" algo.Key_vertexInputContainer = "" algo.Key_trigTauJetInputContainer = "HLT_TrigTauRecMerged_CaloOnly" @@ -123,7 +123,7 @@ def _algoTauPrecision(inputRoIs, tracks, step): from TrigTauRec.TrigTauRecConfigMT import TrigTauRecMerged_TauPrecision algo = TrigTauRecMerged_TauPrecision(name= "TrigTauRecMerged_TauPrecision_"+step) algo.RoIInputKey = inputRoIs - algo.L1RoIKey = "TAUCaloRoIs" + algo.L1RoIKey = "HLT_TAURoI" algo.clustersKey = "" algo.Key_vertexInputContainer = "" algo.Key_trackPartInputContainer = tracks @@ -143,7 +143,7 @@ def _algoTauPrecisionMVA(inputRoIs, tracks, step): if "EF" in step: algo = TrigTauRecMerged_TauPrecisionMVA(name= "TrigTauRecMerged_TauPrecisionMVA"+step, doMVATES=False, doTrackBDT=False, doRNN=True) algo.RoIInputKey = inputRoIs - algo.L1RoIKey = "TAUCaloRoIs" + algo.L1RoIKey = "HLT_TAURoI" algo.clustersKey = "" algo.Key_vertexInputContainer = "" algo.Key_trigTauJetInputContainer = "HLT_TrigTauRecMerged_CaloOnly" @@ -177,7 +177,7 @@ def tauCaloMVARecoSequence(InViewRoIs, SeqName): def tauCaloSequence(ConfigFlags): """ Creates L2 Fast Calo sequence for Taus""" # EV creator - InViewRoIs = "TAUCaloRoIs" + InViewRoIs = "HLT_TAURoI" RecoSequenceName = "tauCaloInViewSequence" tauCaloViewsMaker = EventViewCreatorAlgorithm( "IMtauCalo") @@ -190,7 +190,7 @@ def tauCaloSequence(ConfigFlags): (tauCaloInViewSequence, sequenceOut) = tauCaloRecoSequence( InViewRoIs, RecoSequenceName) tauCaloRecoVDV = CfgMgr.AthViews__ViewDataVerifier( "tauCaloRecoVDV" ) - tauCaloRecoVDV.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+TAUCaloRoIs' ), + tauCaloRecoVDV.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+HLT_TAURoI' ), ( 'CaloBCIDAverage' , 'StoreGateSvc+CaloBCIDAverage' ), ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ), ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.actualInteractionsPerCrossing' ), @@ -203,7 +203,7 @@ def tauCaloSequence(ConfigFlags): def tauCaloMVASequence(ConfigFlags): """ Creates L2 Fast Calo sequence for Taus""" # EV creator - InViewRoIs = "TAUCaloRoIs" + InViewRoIs = "HLT_TAURoI" RecoSequenceName = "tauCaloMVAInViewSequence" tauCaloMVAViewsMaker = EventViewCreatorAlgorithm( "IMtauCaloMVA") @@ -216,7 +216,7 @@ def tauCaloMVASequence(ConfigFlags): (tauCaloMVAInViewSequence, sequenceOut) = tauCaloMVARecoSequence(InViewRoIs, RecoSequenceName) tauCaloMVARecoVDV = CfgMgr.AthViews__ViewDataVerifier( "tauCaloMVARecoVDV" ) - tauCaloMVARecoVDV.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+TAUCaloRoIs' ), + tauCaloMVARecoVDV.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+HLT_TAURoI' ), ( 'CaloBCIDAverage' , 'StoreGateSvc+CaloBCIDAverage' ), ( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' ), ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.actualInteractionsPerCrossing' ), @@ -235,7 +235,7 @@ def preSelSequence( RoIs, name): IDTrigConfig = getInDetTrigConfig( signatureNameID ) ViewVerifyPreSel = CfgMgr.AthViews__ViewDataVerifier("tauPSViewDataVerifier_"+signatureName) - ViewVerifyPreSel.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+TAUCaloRoIs' ), + ViewVerifyPreSel.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+HLT_TAURoI' ), ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+RoiForTau' ), ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+RoiForTauIso' ), ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.averageInteractionsPerCrossing' ), @@ -268,7 +268,7 @@ def tauIdSequence( RoIs, name): IDTrigConfig = getInDetTrigConfig( signatureNameID ) ViewVerifyId = CfgMgr.AthViews__ViewDataVerifier("tauIdViewDataVerifier_"+signatureName) - ViewVerifyId.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+TAUCaloRoIs' ), + ViewVerifyId.DataObjects = [( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+HLT_TAURoI' ), ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+%s' % RoIs ), ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+RoiForTauCore' ), ( 'xAOD::TauTrackContainer' , 'StoreGateSvc+HLT_tautrack_Presel'), @@ -311,7 +311,7 @@ def precTrackSequence( RoIs , name): ViewVerifyTrk.DataObjects = [( 'xAOD::TrackParticleContainer' , 'StoreGateSvc+%s' % IDTrigConfig.FT.tracksFTF() ), ( 'SG::AuxElement' , 'StoreGateSvc+EventInfo.averageInteractionsPerCrossing' ), ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+%s' % RoIs ), - ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+TAUCaloRoIs' ), + ( 'TrigRoiDescriptorCollection' , 'StoreGateSvc+HLT_TAURoI' ), ( 'xAOD::TauTrackContainer' , 'StoreGateSvc+HLT_tautrack_dummy' ), ( 'xAOD::TauJetContainer' , 'StoreGateSvc+HLT_TrigTauRecMerged_CaloOnly' ), ( 'IDCInDetBSErrContainer' , 'StoreGateSvc+SCT_FlaggedCondData_TRIG' ), diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Menu/MenuMapping.py b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Menu/MenuMapping.py index 0b641377b92cc9a4f4009f5775bf6cb4da8df81c..cd94ed0aefc7e6bcc291a197dca7b8a7f5832b67 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Menu/MenuMapping.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/L1/Menu/MenuMapping.py @@ -20,5 +20,7 @@ menuMap = { "PhysicsP1_pp_run3_v1" : "MC_pp_v8", "PhysicsP1_HI_run3_v1" : "MC_pp_v8", "Dev_HI_run3_v1" : "MC_pp_v8", - "LS2_v1_TriggerValidation_mc_prescale" : "MC_pp_v8" + "LS2_v1_TriggerValidation_prescale" : "MC_pp_v8", + "LS2_v1_BulkMCProd_prescale" : "MC_pp_v8", + "LS2_v1_CPSampleProd_prescale" : "MC_pp_v8" }