Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • mwilkins-correct-usage-example
  • main
  • feat/JetCaloRings_JetType
  • 24.0
  • emoyse-main-patch-13713
  • new_LLP1_LRSMdHNL
  • igrabows-main-patch-33821
  • sawyer-24.0-patch-49542
  • main-DCSCalc-manual-run
  • averbyts-main-patch-34985
  • 22.0-mc20
  • ademaria-main-patch-93969
  • averbyts-main-patch-33740
  • ademaria-main-patch-71330
  • averbyts-main-patch-45024
  • menu_jJ70run4v2
  • fixTrackSummaryInfo
  • addBackMultiSliceDiJet
  • fivone-24.0-patch-57442
  • FTagTritonFixes-main-20251119
  • PatternMatchingAlgo
  • dvij/tmp
  • dta-24.0-patch-6bd8
  • ademaria-main-patch-70674
  • disable-rfp-for-comm-runs
  • dguest-main-patch-48115
  • sawyer-24.0-patch-35007
  • fwinkl-24.0-patch-25508
  • 24.0_ATR-32133
  • menu_jJ70run4
  • fwinkl-main-patch-42382
  • 23.0
  • rwang-main-patch-99c5
  • averbyts-main-patch-75441
  • averbyts-main-patch-65171
  • IDPM_Rel25_Run3_v05
  • averbyts-main-patch-93712
  • averbyts-main-patch-04186
  • igrabows-main-patch-22700
  • tamartin-main-patch-11278
  • dev_ISF_ACTS_ITk
  • IDPM_Rel25_Run3_v04
  • averbyts-main-patch-47480
  • averbyts-main-patch-78487
  • averbyts-main-patch-12627
  • rui_emec_study_24.0.114
  • averbyts-main-patch-26216
  • averbyts-main-patch-89804
  • WWWLocal
  • averbyts-main-patch-19459
  • master
  • ademaria-main-patch-39466
  • tstreble-main-patch-18545
  • linghua-main-patch-0cd2
  • dguest-main-patch-69510
  • sawyer-24.0-patch-06624
  • sroe-main-bugfix
  • averbyts-main-patch-22399
  • ravinab-main-patch-99a8
  • SegRefitTest
  • gEspresso_bytestream
  • igrabows-main-patch-00708
  • rwang-main-patch-cbe4
  • revert-bcd30e23
  • keepTopoClusterCells-24.0
  • rpozzi-addDJTriggers
  • dguest-main-patch-56512
  • ravinab-main-patch-6358
  • sawyer-24.0-patch-14876
  • 24.0.42-patches
  • averbyts-main-patch-16453
  • averbyts-main-patch-79811
  • averbyts-24.0-patch-76290
  • jajimene-24.0-patch-55830
  • jajimene-24.0-patch-82181
  • dguest-24.0-patch-43616
  • averbyts-main-patch-70168
  • ATR30712
  • averbyts-main-patch-23130
  • averbyts-main-patch-54162
  • 21.0
  • dguest-main-patch-83621
  • 21.2
  • fwinkl-24.0-patch-74923
  • ravinab-main-patch-2a2b
  • dbiswas-main-patch-15352
  • will-24.0-patch-89472
  • bdong-main-patch-07426
  • averbyts-main-patch-82418
  • clusterml-deploy
  • averbyts-main-patch-32062
  • dguest-main-patch-03281
  • 23.0.32-patches
  • averbyts-main-patch-56909
  • averbyts-main-patch-90893
  • misalignment-bug-fix
  • tmp-acts-investigate-surface-grid
  • revert-643be8f3
  • averbyts-main-patch-51771
  • averbyts-main-patch-95681
  • 21.0.116
  • 21.2.264
  • 21.6.0
  • 21.6.6
  • 21.6.97
  • 21.9.10
  • 21.9.12
  • 21.9.9
  • 23.6.45
  • 23.6.51
  • 23.6.53
  • 24.0.52.3
  • 24.2.24
  • MT/sweeps/pre-2017.03.08
  • MT/sweeps/pre-2017.03.16
  • archive/19.2
  • archive/19.2.0
  • archive/19.2.1
  • archive/19.2.3
  • archive/19.2.4
  • archive/19.2.5
  • archive/20.1
  • archive/20.1.0
  • archive/20.1.2
  • archive/20.1.3
  • archive/20.1.4
  • archive/20.1.5
  • archive/20.1.6
  • archive/20.1.7
  • archive/20.1.8
  • archive/20.1.9
  • archive/20.11
  • archive/20.11.0
  • archive/20.20
  • archive/20.20.0
  • archive/20.20.10
  • archive/20.20.2
  • archive/20.20.3
  • archive/20.20.4
  • archive/20.20.5
  • archive/20.20.6
  • archive/20.20.7
  • archive/20.20.8
  • archive/20.20.9
  • archive/20.7
  • archive/20.7.0
  • archive/20.7.1
  • archive/20.7.2
  • archive/20.7.3
  • archive/20.7.4
  • archive/20.7.5
  • archive/20.7.6
  • archive/20.7.7
  • archive/20.7.8
  • archive/20.7.9
  • archive/20.8
  • archive/21.0-TrigMC
  • archive/21.1
  • archive/21.1-dev
  • archive/21.2.10
  • archive/21.3
  • nightly/21.0-mc16a/2021-04-22T2142
  • nightly/21.0-mc16a/2021-09-18T0344
  • nightly/21.0-mc16a/2021-10-13T0353
  • nightly/21.0-mc16a/2021-10-20T0353
  • nightly/21.0-mc16a/2021-12-07T0346
  • nightly/21.0-mc16a/2021-12-09T0344
  • nightly/21.0-mc16a/2022-01-12T0345
  • nightly/21.0-mc16a/2022-01-23T0346
  • nightly/21.0-mc16a/2022-02-03T0346
  • nightly/21.0-mc16a/2022-02-14T0345
  • nightly/21.0-mc16a/2022-02-25T0346
  • nightly/21.0-mc16a/2022-03-07T0520
  • nightly/21.0-mc16a/2022-03-18T0456
  • nightly/21.0-mc16a/2022-03-30T0540
  • nightly/21.0-mc16a/2022-04-10T0528
  • nightly/21.0-mc16a/2022-04-21T0448
  • nightly/21.0-mc16a/2022-05-02T0450
  • nightly/21.0-mc16a/2023-02-05T0849
  • nightly/21.0-mc16a/2023-02-16T0849
  • nightly/21.0-mc16a/2023-02-27T0851
  • nightly/21.0-mc16a/2023-03-10T0849
  • nightly/21.0-mc16a/2023-03-21T0848
  • nightly/21.0-mc16a/2023-03-29T0848
  • nightly/21.0-mc16a/2023-04-09T0849
  • nightly/21.0-mc16a/2023-04-20T0848
  • nightly/21.0-mc16a/2023-05-01T0848
  • nightly/21.0-mc16a/2023-05-09T0848
  • nightly/21.0-mc16a/2023-05-10T0849
  • nightly/21.0-mc16a/2023-05-12T0849
  • nightly/21.0-mc16a/2023-05-23T0848
  • nightly/21.0-mc16a/2023-06-03T0848
  • nightly/21.0-mc16a/2023-06-14T0848
  • nightly/21.0-mc16a/2023-06-25T0848
  • nightly/21.0-mc16a/2023-07-05T0848
  • nightly/21.0-mc16a/2023-07-16T0848
  • nightly/21.0-mc16a/2023-07-27T0848
  • nightly/21.0-mc16a/2023-08-07T0848
  • nightly/21.0-mc16a/2023-08-18T0848
  • nightly/21.0-mc16a/2023-08-29T0848
200 results

Target

Select target project
  • Luca Matthias Spitzauer / athena
  • Neil Andrew Pohl / athena
  • Jasper Preston / athena-canary
  • Matteo Bauce / athena
  • Phil Lennart Stahlhut / athena
  • Hayden Bronson / athena
  • Luka Vomberg / athena
  • Jeremie Harmond Lepage Bourbonnais / athena_JetUncertaintiesOverhaul
  • Rina Kugo / athena
  • Firdaus Soberi / athena
  • Martino Errico / athena
  • Yassine El Ghazali / athena
  • Lauren Fabre Wills / athena
  • Maria Bressan / athena
  • Jonh Brian Lemos / athena
  • Isaiah Michael Conway / athena
  • Kevin Nicholas Barends / athena
  • Keiran Sudo / athena
  • Vincenzo Triglione / athena
  • Melik Danyal Oughton / athena
20 results
Select Git revision
  • mwilkins-correct-usage-example
  • main
  • feat/JetCaloRings_JetType
  • 24.0
  • emoyse-main-patch-13713
  • sawyer-24.0-patch-49542
  • 22.0-mc20
  • averbyts-main-patch-45024
  • menu_jJ70run4v2
  • addBackMultiSliceDiJet
  • fivone-24.0-patch-57442
  • dguest-main-patch-48115
  • 24.0_ATR-32133
  • 23.0
  • linghua-main-patch-0cd2
  • dguest-main-patch-56512
  • 24.0.42-patches
  • 21.0
  • 21.2
  • 23.0.32-patches
  • 23.0.20-patches
  • 24.0.88-patches
  • 21.0-mc16a
  • 21.0-mc16d
  • 24.0.100-patches
  • 24.0.98-patches
  • refactor-jet-physvalidation-simple
  • fgiuli_ATR-31358
  • 24.0-MuonSegmentMakerTools-Minimize-FPE
  • 22.0
  • 24.0.86-patches
  • 24.0.66-patches
  • 24.0.52-patches
  • 21.6
  • 24.0.23-patches
  • 23.0-patch-aa01
  • 21.9
  • 22.0.38.X
  • 21.2.88.X
  • 21.6.46-patches
  • 21.6.44-patches
  • 21.6.43-patches
  • 21.6.41-patches
  • 21.6.39-patches
  • SoftwareDevTutorial
  • 21.2.60
  • 21.0.116
  • 21.6.0
  • 21.6.6
  • 21.6.97
  • 21.9.10
  • 21.9.12
  • 21.9.9
  • 23.6.45
  • 23.6.51
  • 23.6.53
  • MT/sweeps/pre-2017.03.08
  • MT/sweeps/pre-2017.03.16
  • archive/19.2
  • archive/19.2.0
  • archive/19.2.1
  • archive/19.2.3
  • archive/19.2.4
  • archive/19.2.5
  • archive/20.1
  • archive/20.1.0
  • archive/20.1.2
  • archive/20.1.3
  • archive/20.1.4
  • archive/20.1.5
  • archive/20.1.6
  • archive/20.1.7
  • archive/20.1.8
  • archive/20.1.9
  • archive/20.11
  • archive/20.11.0
  • archive/20.20
  • archive/20.20.0
  • archive/20.20.10
  • archive/20.20.2
  • archive/20.20.3
  • archive/20.20.4
  • archive/20.20.5
  • archive/20.20.6
  • archive/20.20.7
  • archive/20.20.8
  • archive/20.20.9
  • archive/20.7
  • archive/20.7.0
  • archive/20.7.1
  • archive/20.7.2
  • archive/20.7.3
  • archive/20.7.4
  • archive/20.7.5
  • archive/20.7.6
  • archive/20.7.7
  • archive/20.7.8
  • archive/20.7.9
  • archive/20.8
  • archive/21.0-TrigMC
  • archive/21.1
  • archive/21.1-dev
  • archive/21.2.10
  • archive/21.3
  • nightly/21.0-mc16a/2025-02-01T0913
  • nightly/21.0-mc16a/2025-02-08T0913
  • nightly/21.0-mc16a/2025-02-15T0913
  • nightly/21.0-mc16a/2025-02-22T0913
  • nightly/21.0-mc16a/2025-03-01T0913
  • nightly/21.0-mc16a/2025-03-08T0913
  • nightly/21.0-mc16a/2025-03-15T0913
  • nightly/21.0-mc16a/2025-03-22T0913
  • nightly/21.0-mc16a/2025-03-29T0913
  • nightly/21.0-mc16a/2025-04-05T0913
  • nightly/21.0-mc16a/2025-04-12T0913
  • nightly/21.0-mc16a/2025-04-19T0913
  • nightly/21.0-mc16a/2025-04-26T0913
  • nightly/21.0-mc16a/2025-05-03T0913
  • nightly/21.0-mc16a/2025-05-10T0913
  • nightly/21.0-mc16a/2025-05-17T0913
  • nightly/21.0-mc16a/2025-05-24T2113
  • nightly/21.0-mc16a/2025-05-31T2115
  • nightly/21.0-mc16a/2025-06-07T2114
  • nightly/21.0-mc16a/2025-06-14T2114
  • nightly/21.0-mc16a/2025-06-21T2120
  • nightly/21.0-mc16a/2025-06-28T2116
  • nightly/21.0-mc16a/2025-07-05T2115
  • nightly/21.0-mc16a/2025-07-12T2114
  • nightly/21.0-mc16a/2025-07-19T2115
  • nightly/21.0-mc16a/2025-07-26T2114
  • nightly/21.0-mc16a/2025-08-02T2113
  • nightly/21.0-mc16a/2025-08-09T2115
  • nightly/21.0-mc16a/2025-08-14T2115
  • nightly/21.0-mc16a/2025-08-21T2116
  • nightly/21.0-mc16a/2025-08-28T2130
  • nightly/21.0-mc16a/2025-09-04T2126
  • nightly/21.0-mc16a/2025-09-13T2129
  • nightly/21.0-mc16a/2025-09-20T2114
  • nightly/21.0-mc16a/2025-09-27T2141
  • nightly/21.0-mc16a/2025-10-04T2125
  • nightly/21.0-mc16a/2025-10-14T2133
  • nightly/21.0-mc16a/2025-10-21T2117
  • nightly/21.0-mc16a/2025-10-28T2151
  • nightly/21.0-mc16a/2025-11-04T2115
  • nightly/21.0-mc16a/2025-11-11T2114
  • nightly/21.0-mc16a/2025-11-18T2118
146 results
Show changes

Commits on Source 11

27 files
+ 817
78
Compare changes
  • Side-by-side
  • Inline

Files

+14 −0
Original line number Diff line number Diff line
atlas_subdir( DevTutorialWriteAlgAndTool )

atlas_depends_on_subdirs( PUBLIC
                          GaudiKernel
                          PRIVATE
                          Control/AthenaBaseComps
                          Event/xAOD/xAODTracking )

atlas_add_component( DevTutorialWriteAlgAndTool
                     src/*.cxx
                     src/components/*.cxx 
                     LINK_LIBRARIES GaudiKernel AthenaBaseComps xAODTracking )

atlas_install_python_modules( python/*.py )
+28 −0
Original line number Diff line number Diff line
/*
  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/

#ifndef MYNEWPACKAGE_IMYALGTOOL_H
#define MYNEWPACKAGE_IMYALGTOOL_H
#include "GaudiKernel/IAlgTool.h"
#include "xAODTracking/TrackParticle.h"

static const InterfaceID IID_IMyAlgTool("IMyAlgTool", 1, 0);

/** @class IMyAlgTool
    @brief Interface to demonstrate how to make an interface which actually does something useful.
*/

class IMyAlgTool : virtual public IAlgTool {
  public:
  static const InterfaceID& interfaceID( );
  virtual bool selectTrackParticle( const xAOD::TrackParticle& particle) const = 0 ;
};

inline const InterfaceID& IMyAlgTool::interfaceID()
{ 
	return IID_IMyAlgTool; 
}

#endif 
+45 −0
Original line number Diff line number Diff line
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration

from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaCommon.Constants import VERBOSE
from DevTutorialWriteAlgAndTool.DevTutorialWriteAlgAndToolConf import ExampleAlg
from TrkExTools.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg

def ExampleAlgCfg(configFlags, **kwargs):
    result=ComponentAccumulator()
    alg = ExampleAlg(**kwargs )
    result.addEventAlgo(alg)
    return result

if __name__=="__main__":
    from AthenaCommon.Configurable import Configurable
    from AthenaCommon.Logging import log
    from AthenaConfiguration.AllConfigFlags import ConfigFlags
    from AthenaConfiguration.MainServicesConfig import MainServicesThreadedCfg    
    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg

    Configurable.configurableRun3Behavior=1

    from AthenaConfiguration.TestDefaults import defaultTestFiles
    ConfigFlags.Input.Files = defaultTestFiles.ESD

    ConfigFlags.Detector.GeometryPixel = True     
    ConfigFlags.Detector.GeometrySCT   = True 
    ConfigFlags.Detector.GeometryTRT   = True
    ConfigFlags.Concurrency.NumThreads = 1
    ConfigFlags.Concurrency.NumConcurrentEvents = 1

    ConfigFlags.lock()

    cfg=MainServicesThreadedCfg(ConfigFlags)
    
    cfg.merge(PoolReadCfg(ConfigFlags))
    
    from AthenaCommon.Constants import VERBOSE
    acc=ExampleAlgCfg(ConfigFlags, OutputLevel=VERBOSE)
    cfg.merge(acc)

    cfg.run(10)


+46 −0
Original line number Diff line number Diff line
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration

from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaCommon.Constants import VERBOSE
from DevTutorialWriteAlgAndTool.DevTutorialWriteAlgAndToolConf import ExampleAlg_step1 as ExampleAlg
from TrkExTools.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg

def ExampleAlgCfg(configFlags, **kwargs):
    result=ComponentAccumulator()
    alg = ExampleAlg(**kwargs )
    result.addEventAlgo(alg)
    return result

if __name__=="__main__":
    from AthenaCommon.Configurable import Configurable
    from AthenaCommon.Logging import log
    from AthenaConfiguration.AllConfigFlags import ConfigFlags
    from AthenaConfiguration.MainServicesConfig import MainServicesThreadedCfg    
    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg

    Configurable.configurableRun3Behavior=1

    from AthenaConfiguration.TestDefaults import defaultTestFiles
    ConfigFlags.Input.Files = defaultTestFiles.ESD

    ConfigFlags.Detector.GeometryPixel = True     
    ConfigFlags.Detector.GeometrySCT   = True 
    ConfigFlags.Detector.GeometryTRT   = True
    ConfigFlags.Concurrency.NumThreads = 8
    ConfigFlags.Concurrency.NumConcurrentEvents = 8


    ConfigFlags.lock()

    cfg=MainServicesThreadedCfg(ConfigFlags)
    
    cfg.merge(PoolReadCfg(ConfigFlags))
    
    from AthenaCommon.Constants import VERBOSE
    acc=ExampleAlgCfg(ConfigFlags, OutputLevel=VERBOSE)
    cfg.merge(acc)

    cfg.run(10)


+46 −0
Original line number Diff line number Diff line
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration

from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
from AthenaCommon.Constants import VERBOSE
from DevTutorialWriteAlgAndTool.DevTutorialWriteAlgAndToolConf import ExampleAlg_step4 as ExampleAlg
from TrkExTools.AtlasExtrapolatorConfig import AtlasExtrapolatorCfg

def ExampleAlgCfg(configFlags, **kwargs):
    result=ComponentAccumulator()
    alg = ExampleAlg(**kwargs )
    result.addEventAlgo(alg)
    return result

if __name__=="__main__":
    from AthenaCommon.Configurable import Configurable
    from AthenaCommon.Logging import log
    from AthenaConfiguration.AllConfigFlags import ConfigFlags
    from AthenaConfiguration.MainServicesConfig import MainServicesThreadedCfg    
    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg

    Configurable.configurableRun3Behavior=1

    from AthenaConfiguration.TestDefaults import defaultTestFiles
    ConfigFlags.Input.Files = defaultTestFiles.ESD

    ConfigFlags.Detector.GeometryPixel = True     
    ConfigFlags.Detector.GeometrySCT   = True 
    ConfigFlags.Detector.GeometryTRT   = True
    ConfigFlags.Concurrency.NumThreads = 8
    ConfigFlags.Concurrency.NumConcurrentEvents = 8


    ConfigFlags.lock()

    cfg=MainServicesThreadedCfg(ConfigFlags)
    
    cfg.merge(PoolReadCfg(ConfigFlags))
    
    from AthenaCommon.Constants import VERBOSE
    acc=ExampleAlgCfg(ConfigFlags, OutputLevel=VERBOSE)
    cfg.merge(acc)

    cfg.run(10)


+25 −0
Original line number Diff line number Diff line
/*
  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/

#include "ExampleAlg.h"

StatusCode ExampleAlg::initialize()
{
  ATH_CHECK( m_trackParticleKey.initialize());
  ATH_CHECK( m_algTool.retrieve() );
  return StatusCode::SUCCESS;
}

StatusCode ExampleAlg::execute(const EventContext& ctx) const
{
  SG::ReadHandle<xAOD::TrackParticleContainer> handle(m_trackParticleKey, ctx);
  ATH_MSG_VERBOSE(ctx<< " Got back "<<handle->size()<<" trackparticles");
  unsigned int count=0;
  for (auto tp : *handle) {
    if ( m_algTool->selectTrackParticle( *tp ) ) count++;
  }
  ATH_MSG_VERBOSE(ctx << " " << count << " pass selection");
  
  return StatusCode::SUCCESS;
}
+26 −0
Original line number Diff line number Diff line
/*
  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MYNEWPACKAGE_EXAMPLEALG_H
#define MYNEWPACKAGE_EXAMPLEALG_H

#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "xAODTracking/TrackParticleContainer.h"
#include "DevTutorialWriteAlgAndTool/IMyAlgTool.h"

/** An example algorithm that reads and writes objects from the event store
 using handles.*/
class ExampleAlg
  : public AthReentrantAlgorithm
{
public:
  using AthReentrantAlgorithm::AthReentrantAlgorithm;
  virtual StatusCode initialize() override;
  virtual StatusCode execute (const EventContext& ctx) const override;
private:
  SG::ReadHandleKey<xAOD::TrackParticleContainer>   m_trackParticleKey
     { this, "TrackParticleContainerKey", "InDetTrackParticles", "Key for TrackParticle Containers" };
  
  ToolHandle<IMyAlgTool> m_algTool {this, "SelectionTool", "MyAlgTool", "The selection tool"};
};
#endif
+16 −0
Original line number Diff line number Diff line
/*
  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/

#include "ExampleAlg_step1.h"

StatusCode ExampleAlg_step1::initialize()
{
  return StatusCode::SUCCESS;
}

StatusCode ExampleAlg_step1::execute(const EventContext& ctx) const
{
  ATH_MSG_VERBOSE("Events processed: "<<ctx.evt());
  return StatusCode::SUCCESS;
}
+20 −0
Original line number Diff line number Diff line
/*
  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MYNEWPACKAGE_EXAMPLEALG_STEP1_H
#define MYNEWPACKAGE_EXAMPLEALG_STEP1_H

#include "AthenaBaseComps/AthReentrantAlgorithm.h"

/** An example algorithm that reads and writes objects from the event store
 using handles.*/
class ExampleAlg_step1
  : public AthReentrantAlgorithm
{
public:
  using AthReentrantAlgorithm::AthReentrantAlgorithm;
  virtual StatusCode initialize() override;
  virtual StatusCode execute (const EventContext& ctx) const override;
private:
};
#endif
+19 −0
Original line number Diff line number Diff line
/*
  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/

#include "ExampleAlg_step3.h"

StatusCode ExampleAlg_step3::initialize()
{
  ATH_CHECK( m_trackParticleKey.initialize());
  return StatusCode::SUCCESS;
}

StatusCode ExampleAlg_step3::execute(const EventContext& ctx) const
{
  ATH_MSG_VERBOSE("Events processed: "<<ctx.evt());
  SG::ReadHandle<xAOD::TrackParticleContainer> handle(m_trackParticleKey, ctx);
  ATH_MSG_VERBOSE("Got back  "<<handle->size());
  return StatusCode::SUCCESS;
}
+24 −0
Original line number Diff line number Diff line
/*
  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MYNEWPACKAGE_ExampleAlg_STEP3_H
#define MYNEWPACKAGE_ExampleAlg_STEP3_H

#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "xAODTracking/TrackParticleContainer.h"

/** An example algorithm that reads and writes objects from the event store
 using handles.*/
class ExampleAlg_step3
  : public AthReentrantAlgorithm
{
public:
  using AthReentrantAlgorithm::AthReentrantAlgorithm;
  virtual StatusCode initialize() override;
  virtual StatusCode execute (const EventContext& ctx) const override;
private:
  /// 
  SG::ReadHandleKey<xAOD::TrackParticleContainer>   m_trackParticleKey
     { this, "TrackParticleContainerKey", "InDetTrackParticles", "Key for TrackParticle Containers" };
};
#endif
+20 −0
Original line number Diff line number Diff line
/*
  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/

#include "ExampleAlg_step4.h"

StatusCode ExampleAlg_step4::initialize()
{
  ATH_CHECK( m_trackParticleKey.initialize());
  ATH_CHECK( m_algTool.retrieve() );
  return StatusCode::SUCCESS;
}

StatusCode ExampleAlg_step4::execute(const EventContext& ctx) const
{
  ATH_MSG_VERBOSE("Event slot: "<<ctx.evt());
  SG::ReadHandle<xAOD::TrackParticleContainer> handle(m_trackParticleKey, ctx);
  ATH_MSG_VERBOSE("Got back  "<<handle->size()<<" trackparticles");
  return StatusCode::SUCCESS;
}
+26 −0
Original line number Diff line number Diff line
/*
  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MYNEWPACKAGE_EXAMPLEALG_STEP4_H
#define MYNEWPACKAGE_EXAMPLEALG_STEP4_H

#include "AthenaBaseComps/AthReentrantAlgorithm.h"
#include "xAODTracking/TrackParticleContainer.h"
#include "DevTutorialWriteAlgAndTool/IMyAlgTool.h"

/** An example algorithm that reads and writes objects from the event store
 using handles.*/
class ExampleAlg_step4
  : public AthReentrantAlgorithm
{
public:
  using AthReentrantAlgorithm::AthReentrantAlgorithm;
  virtual StatusCode initialize() override;
  virtual StatusCode execute (const EventContext& ctx) const override;
private:
  SG::ReadHandleKey<xAOD::TrackParticleContainer>   m_trackParticleKey
     { this, "TrackParticleContainerKey", "InDetTrackParticles", "Key for TrackParticle Containers" };
  
  ToolHandle<IMyAlgTool> m_algTool {this, "SelectionTool", "MyAlgTool", "The selection tool"};
};
#endif
+15 −0
Original line number Diff line number Diff line
/*
  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/

#include "MyAlgTool.h"

MyAlgTool::MyAlgTool(const std::string& t, const std::string& n,  const IInterface* p ) :
AthAlgTool(t,n,p)
{
  declareInterface<IMyAlgTool>(this);
}

bool MyAlgTool::selectTrackParticle( const xAOD::TrackParticle& particle) const {
  return particle.pt()>2.0;
}
+19 −0
Original line number Diff line number Diff line
/*
  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
*/

#ifndef MYNEWPACKAGE_MYALGTOOL_H
#define MYNEWPACKAGE_MYALGTOOL_H

#include "AthenaBaseComps/AthAlgTool.h"
#include "DevTutorialWriteAlgAndTool/IMyAlgTool.h"

class MyAlgTool : public AthAlgTool, virtual public IMyAlgTool {
public:
      MyAlgTool(const std::string&,const std::string&,const IInterface*);
      MyAlgTool& operator= (const MyAlgTool& ) = delete;
        
      bool selectTrackParticle( const xAOD::TrackParticle& particle) const override;
};

#endif
+10 −0
Original line number Diff line number Diff line
#include "../ExampleAlg.h"
#include "../ExampleAlg_step1.h"
#include "../ExampleAlg_step3.h"
#include "../ExampleAlg_step4.h"
#include "../MyAlgTool.h"
DECLARE_COMPONENT( ExampleAlg )
DECLARE_COMPONENT( ExampleAlg_step1 )
DECLARE_COMPONENT( ExampleAlg_step3 )
DECLARE_COMPONENT( ExampleAlg_step4 )
DECLARE_COMPONENT( MyAlgTool )
+0 −1
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ def TriggerChamberClusterOnTrackCreatorCfg(flags, **kwargs):
    result.setPrivateTools(Muon__TriggerChamberClusterOnTrackCreator(**kwargs))
    return result


def CscClusterOnTrackCreatorCfg(flags,**kwargs):
    from MuonConfig.MuonSegmentFindingConfig import QratCscClusterFitterCfg, CscClusterUtilToolCfg

+4 −1
Original line number Diff line number Diff line
@@ -29,10 +29,13 @@ def MuonSeededSegmentFinderCfg(flags,name="MuonSeededSegmentFinder", **kwargs):
        kwargs.setdefault("SegmentMakerNoHoles", seg_maker) #FIXME. Just remove one.
    if not flags.Detector.GeometryCSC:
        kwargs.setdefault("CscPrepDataContainer","")
    else:
    if not flags.Detector.GeometrysTGC:
        kwargs.setdefault("sTgcPrepDataContainer","")
    if not flags.Detector.GeometryMM:
        kwargs.setdefault("MMPrepDataContainer","")
    
    kwargs.setdefault('TgcPrepDataContainer', 'TGC_MeasurementsAllBCs' if not flags.Muon.useTGCPriorNextBC and not flags.Muon.useTGCPriorNextBC else 'TGC_Measurements')
    
    muon_seeded_segment_finder = Muon__MuonSeededSegmentFinder(name, **kwargs)
    result.setPrivateTools(muon_seeded_segment_finder)
    return result
+71 −35
Original line number Diff line number Diff line
@@ -511,19 +511,19 @@ def MooSegmentFinderCfg(flags, name='MooSegmentFinder', **kwargs):
        csc_2d_segment_maker=None
        csc_4d_segment_maker=None
    
    segment_finder_tool = Muon__MooSegmentCombinationFinder(name=name, 
        SegmentCombiner = muon_curved_segment_combiner_tool,
        SegmentCombinationCleaner = muon_segment_combination_cleaner_tool,
        HoughPatternFinder =muon_pattern_finder_tool,
        MdtSegmentMaker=muon_pattern_segment_maker,
        DoSegmentCombinations=False,
        DoSegmentCombinationCleaning=False,
        DoCscSegments = flags.Muon.doCSCs,
        DoMdtSegments = flags.Muon.doMDTs,   
        Csc2dSegmentMaker = csc_2d_segment_maker,
        Csc4dSegmentMaker = csc_4d_segment_maker,
        DoSummary = flags.Muon.printSummary
        )
    kwargs.setdefault('SegmentCombiner', muon_curved_segment_combiner_tool)
    kwargs.setdefault('SegmentCombinationCleaner', muon_segment_combination_cleaner_tool)
    kwargs.setdefault('HoughPatternFinder', muon_pattern_finder_tool)
    kwargs.setdefault('MdtSegmentMaker', muon_pattern_segment_maker)
    kwargs.setdefault('DoSegmentCombinations', False)
    kwargs.setdefault('DoSegmentCombinationCleaning', False)
    kwargs.setdefault('DoCscSegments', flags.Muon.doCSCs)
    kwargs.setdefault('DoMdtSegments', flags.Muon.doMDTs)
    kwargs.setdefault('Csc2dSegmentMaker', csc_2d_segment_maker)
    kwargs.setdefault('Csc4dSegmentMaker', csc_4d_segment_maker)
    kwargs.setdefault('DoSummary', flags.Muon.printSummary)
    
    segment_finder_tool = Muon__MooSegmentCombinationFinder(name=name, **kwargs)
    
    result.setPrivateTools(segment_finder_tool)
    return result
@@ -638,6 +638,7 @@ def MooSegmentFinderAlgCfg(flags, name = "MuonSegmentMaker", **kwargs):
    kwargs.setdefault('MuonSegmentOutputLocation', "ThirdChainSegments" if flags.Muon.segmentOrigin=="TruthTracking" else "MuonSegments")
    
    moo_segment_finder_alg = MooSegmentFinderAlg( name=name, **kwargs )
    moo_segment_finder_alg.Cardinality=10
    result.addEventAlgo( moo_segment_finder_alg )
        
    return result
@@ -658,7 +659,9 @@ def MooSegmentFinderAlg_NCBCfg(flags, name = "MuonSegmentMaker_NCB", **kwargs):
    csc_4d_segment_maker = acc.getPrimary()
    result.merge(acc)
    
    acc  = MooSegmentFinderCfg(flags, name='MooSegmentFinder_NCB', Csc2dSegmentMaker=csc_2d_segment_maker, Csc4dSegmentMaker=csc_4d_segment_maker)
    acc  = MooSegmentFinderCfg(flags, name='MooSegmentFinder_NCB', Csc2dSegmentMaker=csc_2d_segment_maker, 
                               Csc4dSegmentMaker=csc_4d_segment_maker, 
                               DoMdtSegments=False,DoSegmentCombinations=False,DoSegmentCombinationCleaning=False)
    segment_finder_tool=(acc.popPrivateTools())
    result.addPublicTool(segment_finder_tool)
    result.merge(acc)
@@ -703,12 +706,31 @@ def MuonSegmentFindingCfg(flags):

if __name__=="__main__":                        
    # To run this, do e.g. 
    # python ../athena/MuonSpectrometer/MuonConfig/python/MuonSegmentFindingConfig.py
    # python -m MuonConfig.MuonSegmentFindingConfig --run --threads=1
    
    from argparse import ArgumentParser
    
    parser = ArgumentParser()
    parser.add_argument("-t", "--threads", dest="threads", type=int,
                        help="number of threads", default=1)
                        
    parser.add_argument("-o", "--output", dest="output", default='newESD.pool.root',
                        help="write ESD to FILE", metavar="FILE")
                        
    parser.add_argument("--run", help="Run directly from the python. If false, just stop once the pickle is written.",
                        action="store_true")
                        
    args = parser.parse_args()
    
    from AthenaCommon.Configurable import Configurable

    from AthenaConfiguration.AllConfigFlags import ConfigFlags
    from AthenaCommon.Logging import log
    from AthenaConfiguration.TestDefaults import defaultTestFiles

    ConfigFlags.Concurrency.NumThreads=args.threads
    ConfigFlags.Concurrency.NumConcurrentEvents=args.threads # Might change this later, but good enough for the moment.

    Configurable.configurableRun3Behavior=1

    ConfigFlags.Detector.GeometryMDT   = True 
@@ -717,41 +739,55 @@ if __name__=="__main__":
    ConfigFlags.Detector.GeometryRPC   = True 
    
    ConfigFlags.Input.Files = defaultTestFiles.ESD
    ConfigFlags.Output.ESDFileName='newESD.pool.root'
    ConfigFlags.Output.ESDFileName=args.output
    
    # from AthenaCommon.Constants import DEBUG
    #log.setLevel(DEBUG)
    from AthenaCommon.Constants import DEBUG
    log.setLevel(DEBUG)
    log.debug('About to set up Segment Finding.')
    
    ConfigFlags.Input.isMC = True
    ConfigFlags.lock()
    ConfigFlags.dump()
        
    # import pdb; pdb.set_trace()
    
    # When running from a pickled file, athena inserts some services automatically. So only use this if running now.
    if args.run:
        from AthenaConfiguration.MainServicesConfig import MainServicesThreadedCfg
        cfg = MainServicesThreadedCfg(ConfigFlags)
    else:
        cfg=ComponentAccumulator()

    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
    cfg.merge(PoolReadCfg(ConfigFlags))

    cfg.merge(MuonSegmentFindingCfg(ConfigFlags))

    # from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
    # itemsToRecord = ["Trk::SegmentCollection#MuonSegments"]
    #
    # cfg.merge( OutputStreamCfg( ConfigFlags, 'ESD', ItemList=itemsToRecord) )
    # outstream = cfg.getEventAlgo("OutputStreamESD")
    # outstream.OutputLevel=DEBUG
    # outstream.ForceRead = True
    # This is a temporary fix - it should go someplace central as it replaces the functionality of addInputRename from here:
    # https://gitlab.cern.ch/atlas/athena/blob/master/Control/SGComps/python/AddressRemappingSvc.py
    from SGComps.SGCompsConf import AddressRemappingSvc, ProxyProviderSvc
    pps = ProxyProviderSvc()
    ars=AddressRemappingSvc()
    pps.ProviderNames += [ 'AddressRemappingSvc' ]
    ars.TypeKeyRenameMaps += [ '%s#%s->%s' % ("Trk::SegmentCollection", "MuonSegments", "MuonSegments_old") ]
    ars.TypeKeyRenameMaps += [ '%s#%s->%s' % ("Trk::SegmentCollection", "MuonSegments_NCB", "MuonSegments_NCB_old") ]
    
    ConfigFlags.dump()
    cfg.printConfig()
    cfg.addService(pps)
    cfg.addService(ars)
    
    # cfg.getService("StoreGateSvc").Dump = True
    # Set up output
    from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
    itemsToRecord = ["Trk::SegmentCollection#MuonSegments", "Trk::SegmentCollection#NCB_MuonSegments"]

    cfg.merge( OutputStreamCfg( ConfigFlags, 'ESD', ItemList=itemsToRecord) )
    outstream = cfg.getEventAlgo("OutputStreamESD")
    outstream.OutputLevel=DEBUG
    outstream.ForceRead = True

    # cfg.getService("StoreGateSvc").Dump = True
    cfg.printConfig()
    f=open("MuonSegmentFinding.pkl","w")
    cfg.store(f)
    f.close()

    # cfg.run()
    if args.run:
        cfg.run(20)
    
+92 −22
Original line number Diff line number Diff line
@@ -188,10 +188,41 @@ def MuPatCandidateToolCfg(flags, name="MuPatCandidateTool", **kwargs):
    
    kwargs.setdefault("SegmentExtender", "") #FIXME If this is always empty, can it be removed?
    
    mu_pat_cand_tool = Muon__MuPatCandidateTool(name, **kwargs)
    from AthenaCommon.Constants import VERBOSE
    mu_pat_cand_tool = Muon__MuPatCandidateTool(name, OutputLevel=VERBOSE, **kwargs)
    result.setPrivateTools(mu_pat_cand_tool)
    return result
    
def MuonChamberHoleRecoveryToolCfg(flags, name="MuonChamberHoleRecoveryTool", **kwargs):
    from MuonTrackFinderTools.MuonTrackFinderToolsConf import Muon__MuonChamberHoleRecoveryTool
    result=ComponentAccumulator()
    kwargs.setdefault("AddMeasurements",  not flags.Muon.doSegmentT0Fit )
    if flags.Detector.GeometryCSC:
        from MuonConfig.MuonRIO_OnTrackCreatorConfig import CscClusterOnTrackCreatorCfg
        extrakwargs={}
        if flags.Muon.enableErrorTuning or not flags.Input.isMC:
            extrakwargs["ErrorScalerBeta"] = 0.200
        acc = CscClusterOnTrackCreatorCfg(flags, **extrakwargs)
        csc_cluster_creator = acc.getPrimary()
        result.merge(acc)
        kwargs.setdefault("CscRotCreator", csc_cluster_creator)
    else:
        kwargs["CscRotCreator"] = None
    
    if not flags.Detector.GeometrysTGC:
        kwargs.setdefault("sTgcPrepDataContainer","")
    
    if not flags.Detector.GeometryMM:
        kwargs.setdefault("MMPrepDataContainer","")
    
    kwargs.setdefault('TgcPrepDataContainer', 'TGC_MeasurementsAllBCs' if not flags.Muon.useTGCPriorNextBC and not flags.Muon.useTGCPriorNextBC else 'TGC_Measurements')
    
    
    hole_rec_tool = Muon__MuonChamberHoleRecoveryTool(name, **kwargs)
    result.setPrivateTools(hole_rec_tool)
    return result
    

def MuonTrackSteeringCfg(flags, name="MuonTrackSteering", **kwargs):
    from MuonTrackSteeringTools.MuonTrackSteeringToolsConf import Muon__MuonTrackSteering
    # This is based on https://gitlab.cern.ch/atlas/athena/blob/release/22.0.3/MuonSpectrometer/MuonReconstruction/MuonRecExample/python/MuonStandalone.py#L35
@@ -270,6 +301,13 @@ def MuonTrackSteeringCfg(flags, name="MuonTrackSteering", **kwargs):
    kwargs.setdefault("MuonSegmentFittingTool",       seg_fitting_tool) 
    kwargs.setdefault("MuonTrackSelector",       MuonTrackSelector(flags)) 

    acc = MuonChamberHoleRecoveryToolCfg(flags)
    hole_recovery_tool =  acc.getPrimary()
    result.addPublicTool(hole_recovery_tool)
    result.merge(acc)
    
    kwargs.setdefault("HoleRecoveryTool",       hole_recovery_tool) 
    
    track_maker_steering = Muon__MuonTrackSteering(name,**kwargs)
    result.setPrivateTools(track_maker_steering)
    return result
@@ -311,20 +349,39 @@ def MuonTrackBuildingCfg(flags):
    result.merge(acc)
    result.addPublicTool(track_steering)
    
    track_builder = MuPatTrackBuilder("MuPatTrackBuilder", TrackSteering = track_steering )
    track_builder = MuPatTrackBuilder("MuPatTrackBuilder", TrackSteering = track_steering, MuonSegmentCollection="MuonSegments", SpectrometerTrackOutputLocation="MuonSpectrometerTracks" )
    track_builder.Cardinality=10

    result.addEventAlgo( track_builder )
    return result
    

if __name__=="__main__":
    # To run this, do e.g. 
    # python ../athena/MuonSpectrometer/MuonConfig/python/MuonTrackBuildingConfig.py
    # python -m MuonConfig.MuonTrackBuildingConfig --run --threads=
    
    from argparse import ArgumentParser    
    parser = ArgumentParser()
    parser.add_argument("-t", "--threads", dest="threads", type=int,
                        help="number of threads", default=1)
                        
    parser.add_argument("-o", "--output", dest="output", default='newESD.pool.root',
                        help="write ESD to FILE", metavar="FILE")
                        
    parser.add_argument("--run", help="Run directly from the python. If false, just stop once the pickle is written.",
                        action="store_true")
                        
    args = parser.parse_args()
    
    from AthenaCommon.Configurable import Configurable
    Configurable.configurableRun3Behavior=1

    from AthenaCommon.Logging import log
    from AthenaConfiguration.AllConfigFlags import ConfigFlags
    
    ConfigFlags.Concurrency.NumThreads=args.threads
    ConfigFlags.Concurrency.NumConcurrentEvents=args.threads # Might change this later, but good enough for the moment.

    ConfigFlags.Detector.GeometryMDT   = True 
    ConfigFlags.Detector.GeometryTGC   = True
    ConfigFlags.Detector.GeometryCSC   = True     
@@ -332,47 +389,60 @@ if __name__=="__main__":
        
    from AthenaConfiguration.TestDefaults import defaultTestFiles
    ConfigFlags.Input.Files = defaultTestFiles.ESD
    ConfigFlags.Output.ESDFileName='newESD.pool.root'
    ConfigFlags.Output.ESDFileName=args.output

    # from AthenaCommon.Constants import DEBUG
    #log.setLevel(DEBUG)
    log.debug('About to set up Muon Track Building.')    
    from AthenaCommon.Constants import DEBUG
    # log.setLevel(DEBUG)
    # log.info('About to set up Muon Track Building.')
    
    ConfigFlags.Input.isMC = True
    ConfigFlags.lock()
    log.info('Flags set as follows:')
    ConfigFlags.dump()

    # When running from a pickled file, athena inserts some services automatically. So only use this if running now.
    if args.run:
        from AthenaConfiguration.MainServicesConfig import MainServicesThreadedCfg
        cfg = MainServicesThreadedCfg(ConfigFlags)
    else:
        cfg=ComponentAccumulator()
    
    # cfg = ComponentAccumulator()
    # acc = MainServicesThreadedCfg(ConfigFlags)
    # print acc._isMergable
    # cfg.merge(acc)
    
    log.info(cfg._allSequences)
    from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
    cfg.merge(PoolReadCfg(ConfigFlags))
    log.info(cfg._allSequences)

    cfg.merge(MuonTrackBuildingCfg(ConfigFlags))
    log.info(cfg._allSequences)
    
    # This is a temporary fix - it should go someplace central as it replaces the functionality of addInputRename from here:
    # https://gitlab.cern.ch/atlas/athena/blob/master/Control/SGComps/python/AddressRemappingSvc.py
    from SGComps.SGCompsConf import AddressRemappingSvc, ProxyProviderSvc
    pps = ProxyProviderSvc()
    ars=AddressRemappingSvc()
    pps.ProviderNames += [ 'AddressRemappingSvc' ]
    ars.TypeKeyRenameMaps += [ '%s#%s->%s' % ("TrackCollection", "MuonSpectrometerTracks", "MuonSpectrometerTracks_old") ]
    
    cfg.addService(pps)
    cfg.addService(ars)
    
    from OutputStreamAthenaPool.OutputStreamConfig import OutputStreamCfg
    itemsToRecord = ["TrackCollection#MuonSpectrometerTracks"] 
    itemsToRecord = ["TrackCollection#MuonSpectrometerTracks", "TrackCollection#MuonSpectrometerTracks_old"] 

    cfg.merge( OutputStreamCfg( ConfigFlags, 'ESD', ItemList=itemsToRecord) )
    log.info(cfg._allSequences)
    
    outstream = cfg.getEventAlgo("OutputStreamESD")
    outstream.OutputLevel=DEBUG
    # outstream.OutputLevel=DEBUG
    outstream.ForceRead = True
    
    # cfg.printConfig(withDetails = True, summariseProps = True)
    msgService = cfg.getService('MessageSvc')
    msgService.Format = "% F%48W%S%7W%R%T %0W%M"
    msgService.OutputLevel=DEBUG
    
    cfg.printConfig(withDetails = True, summariseProps = True)
              
    f=open("MuonTrackBuilding.pkl","w")
    cfg.store(f)
    f.close()

    # cfg.run()
    if args.run:
        cfg.run(20)
+24 −19
Original line number Diff line number Diff line
@@ -496,7 +496,12 @@ namespace Muon {
      std::vector<const MuonClusterOnTrack*>::iterator clit = chit->second.begin();
      std::vector<const MuonClusterOnTrack*>::iterator clit_end = chit->second.end();
      for( ;clit!=clit_end;++clit){
	prds.push_back( (*clit)->prepRawData() );
        const Trk::PrepRawData* prd = (*clit)->prepRawData();
        if (prd){ 
          prds.push_back( prd );
        } else {
          ATH_MSG_ERROR("MuonClusterOnTrack has no PRD.");
        }
      }

      const CompetingMuonClustersOnTrack* comprot = m_compClusterCreator->createBroadCluster(prds,0);
+30 −0
Original line number Diff line number Diff line
################################################################################
# Package: DebugTutorial
################################################################################

# Declare the package name:
atlas_subdir( DebugTutorial )

# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
                          Control/AthContainers
                          Control/StoreGate
                          Control/AthenaBaseComps
                          Event/xAOD/xAODJet )

# External dependencies:
find_package( ROOT COMPONENTS Core Hist )
find_package( CLHEP )


atlas_add_component( DebugTutorial
                     src/*.cxx src/components/*.cxx
                     INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                     LINK_LIBRARIES AthContainers StoreGateLib AthenaBaseComps
                                    xAODJet
                                    ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} )


# Install files from the package:
atlas_install_joboptions( share/*.py )
+33 −0
Original line number Diff line number Diff line
#
# File: DebugTutorial/share/DebugTutorial_jo.py
# Author: snyder@bnl.gov
# Date: Sep 2019
# Purpose: debugging tutorial
#

## basic job configuration
import AthenaCommon.AtlasUnixStandardJob

## get a handle to the default top-level algorithm sequence
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()

## get a handle to the ServiceManager
from AthenaCommon.AppMgr import ServiceMgr as svcMgr

#--------------------------------------------------------------
# Load POOL support
#--------------------------------------------------------------
import AthenaPoolCnvSvc.ReadAthenaPool

#--------------------------------------------------------------
# Define input
#--------------------------------------------------------------
#/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/aod/
svcMgr.EventSelector.InputCollections = [
    "/eos/atlas/atlascerngroupdisk/data-art/grid-input/aod/AOD-20.1.6.4/AOD-20.1.6.4-full.pool.root"
    ]

from DebugTutorial.DebugTutorialConf import Tutorial__TestAlg
topSequence += Tutorial__TestAlg ("TestAlg", Jets = 'AntiKt4LCTopoJets',
                                  OutputLevel = VERBOSE)
+86 −0
Original line number Diff line number Diff line
/**
 * @file DebugTutorial/src/TestAlg.cxx
 * @author scott snyder <snyder@bnl.gov>
 * @date Sep, 2019
 * @brief debugging tutorial
 */


#include "TestAlg.h"
#include "CLHEP/Units/SystemOfUnits.h"
#include "TH1F.h"
#include <vector>
#include <string>


using CLHEP::GeV;


namespace Tutorial {


/// Standard Gaudi @c initialize method.
StatusCode TestAlg::initialize()
{
  ATH_CHECK( m_jetsKey.initialize() );

  // Build the pair index lookup table.
  for (int i=0; i<6; i++) {
    for (int j=0; j<=i; j++) {
      m_pairtable.push_back(i);
      m_pairtable.push_back(j);
    }
    m_end.push_back (m_pairtable.size());
  }
  return StatusCode::SUCCESS;
}


/// Standard Gaudi @c finalize method.
StatusCode TestAlg::finalize()
{
  m_hist->Print("ALL");
  return StatusCode::SUCCESS;
}


// Generate a label for jet I.
std::string jetlab (int i)
{
  char* buf = new char[16];
  // 15 chars +  null byte
  sprintf (buf, "jet %1d xverse pt", i);
  std::string s(buf);
  delete [] buf;
  return s;
}


/// Standard Gaudi @c execute method.
StatusCode TestAlg::execute()
{
  // First dump jets.
  int i = 0;
  SG::ReadHandle<xAOD::JetContainer> jets (m_jetsKey);
  for (const xAOD::Jet* jet : *jets) {
    msg(MSG::VERBOSE) << jetlab(i) << " " << jet->auxdata<float> ("Pt") << endmsg;
    ++i;
  }

  // Fill the histogram with invariant masses of jet pairs from the table.
  unsigned int njet = jets->size();
  if (njet > 1) {
    if (njet > m_end.size())
      njet = m_end.size();
    for (int i=0; i < m_end[njet]; i += 2) {
      const xAOD::Jet* j1 = (*jets)[m_pairtable[i]];
      const xAOD::Jet* j2 = (*jets)[m_pairtable[i+1]];
      float minv = (j1->p4() + j2->p4()).M();
      m_hist->Fill (minv / GeV);
    }
  }
  return StatusCode::SUCCESS;
}


} // namespace TestAlg
+66 −0
Original line number Diff line number Diff line
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/**
 * @file DebugTutorial/src/TestAlg.h
 * @author scott snyder <snyder@bnl.gov>
 * @date Sep, 2019
 * @brief debugging tutorial
 */


#ifndef DEBUGTUTORIAL_TESTALG_H
#define DEBUGTUTORIAL_TESTALG_H


#include "xAODJet/JetContainer.h"
#include "AthenaBaseComps/AthAlgorithm.h"
#include "StoreGate/ReadHandleKey.h"
#include "TH1.h"
#include <vector>
#include <memory>


namespace Tutorial {


class TestAlg
  : public AthAlgorithm
{
public:
  /// Use base class constructor.
  using AthAlgorithm::AthAlgorithm;


  /// Standard Gaudi @c initialize method.
  virtual StatusCode initialize() override final;


  /// Standard Gaudi @c finalize method.
  virtual StatusCode finalize() override final;


  /// Standard Gaudi @c execute method.
  virtual StatusCode execute() override final;


private:
  /// Handle used to access jets from the current event.
  SG::ReadHandleKey<xAOD::JetContainer> m_jetsKey
  { this, "Jets", "", "" };

  /// Adjacent entries contain the (i,j) indices of jets to combine.
  std::vector<int> m_pairtable;

  /// Number of pairs for each jet multiplicity.
  std::vector<int> m_end;

  /// Output histogram.
  std::unique_ptr<TH1> m_hist
  { new TH1F ("hist", "hist", 20, 0, 200) };
};


} // namespace Tutorial


#endif // not DEBUGTUTORIAL_TESTALG_H
+12 −0
Original line number Diff line number Diff line
// $Id$
/**
 * @file DebugTutorial/src/components/DebugTutorial_entries.cxx
 * @author scott snyder <snyder@bnl.gov>
 * @date Sep, 2019
 * @brief debugging tutorial
 */


#include "../TestAlg.h"

DECLARE_COMPONENT( Tutorial::TestAlg )