ATLAS Offline Software
LegacyBarcodeSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef BARCODESERVICES_LEGACYBARCODESVC_H
6 #define BARCODESERVICES_LEGACYBARCODESVC_H 1
7 
8 // STL includes
9 #include <string>
10 
11 // FrameWork includes
12 #include "GaudiKernel/ServiceHandle.h"
14 
15 //include
17 
18 #include "tbb/concurrent_unordered_map.h"
19 
20 
21 
22 namespace Barcode {
23 
32  class LegacyBarcodeSvc : public extends<AthService, IBarcodeSvc> {
33  public:
34 
36  LegacyBarcodeSvc( const std::string& name, ISvcLocator* pSvcLocator );
37 
39  virtual ~LegacyBarcodeSvc() = default;
40 
42  virtual StatusCode initialize() override;
43 
45  virtual StatusCode initializeBarcodes(int largestGeneratedParticleBC=0, int largestGeneratedVertexBC=0) override;
46 
48  virtual StatusCode resetBarcodes(int largestGeneratedParticleBC=0, int largestGeneratedVertexBC=0) override;
49 
51  virtual int newSecondaryParticle( int) override;
52 
54  virtual int newGeneratedParticle(int ) override;
55 
57  virtual int newSimulationVertex() override;
58 
60  virtual int newGeneratedVertex() override;
61 
64  virtual void registerLargestGeneratedParticleBC( int bc) override;
65  virtual void registerLargestGeneratedVtxBC( int bc) override;
66  virtual void registerLargestSecondaryParticleBC( int bc) override;
67  virtual void registerLargestSimulationVtxBC( int bc) override;
68 
70  virtual int secondaryParticleBcOffset() const override;
71  virtual int secondaryVertexBcOffset() const override;
72 
73  private:
74 
78 
82 
83  struct BarcodeInfo {
84  BarcodeInfo() = delete;
85  BarcodeInfo(int csv, int csp, int cgv, int cgp)
89  , currentGeneratedParticle(cgp) {};
94  };
95 
96  using LegacyBarcodeSvcThreadMap_t = tbb::concurrent_unordered_map
97  < std::thread::id, BarcodeInfo, std::hash<std::thread::id> >;
99 
101 
102  };
103 
104 
105 } // end 'Barcode' namespace
106 
107 #endif //> !BARCODESERVICES_LEGACYBARCODESVC_H
Barcode::LegacyBarcodeSvc::registerLargestSecondaryParticleBC
virtual void registerLargestSecondaryParticleBC(int bc) override
Definition: LegacyBarcodeSvc.cxx:189
Barcode
Definition: IBarcodeSvc.h:17
Barcode::LegacyBarcodeSvc::LegacyBarcodeSvcThreadMap_t
tbb::concurrent_unordered_map< std::thread::id, BarcodeInfo, std::hash< std::thread::id > > LegacyBarcodeSvcThreadMap_t
Definition: LegacyBarcodeSvc.h:97
Barcode::LegacyBarcodeSvc::m_particleIncrement
int m_particleIncrement
Definition: LegacyBarcodeSvc.h:81
Barcode::LegacyBarcodeSvc::m_bcThreadMap
LegacyBarcodeSvcThreadMap_t m_bcThreadMap
Definition: LegacyBarcodeSvc.h:98
Barcode::LegacyBarcodeSvc::registerLargestSimulationVtxBC
virtual void registerLargestSimulationVtxBC(int bc) override
Definition: LegacyBarcodeSvc.cxx:193
Barcode::LegacyBarcodeSvc::resetBarcodes
virtual StatusCode resetBarcodes(int largestGeneratedParticleBC=0, int largestGeneratedVertexBC=0) override
Reset barcodes.
Definition: LegacyBarcodeSvc.cxx:209
Barcode::LegacyBarcodeSvc::newSecondaryParticle
virtual int newSecondaryParticle(int) override
Generate a new unique barcode for a secondary particle above the simulation offset.
Definition: LegacyBarcodeSvc.cxx:101
Barcode::LegacyBarcodeSvc::BarcodeInfo::currentSimulationVertex
int currentSimulationVertex
Definition: LegacyBarcodeSvc.h:90
Barcode::LegacyBarcodeSvc::registerLargestGeneratedVtxBC
virtual void registerLargestGeneratedVtxBC(int bc) override
Definition: LegacyBarcodeSvc.cxx:182
Barcode::LegacyBarcodeSvc::BarcodeInfo::currentGeneratedParticle
int currentGeneratedParticle
Definition: LegacyBarcodeSvc.h:93
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Barcode::LegacyBarcodeSvc::LegacyBarcodeSvc
LegacyBarcodeSvc(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters.
Definition: LegacyBarcodeSvc.cxx:11
Barcode::LegacyBarcodeSvc::BarcodeInfo::BarcodeInfo
BarcodeInfo()=delete
Barcode::LegacyBarcodeSvc::m_firstSecondary
int m_firstSecondary
barcode information used for secondary GenParticles
Definition: LegacyBarcodeSvc.h:80
IBarcodeSvc.h
Barcode::LegacyBarcodeSvc::newGeneratedVertex
virtual int newGeneratedVertex() override
Generate a new unique vertex barcode below the simulation offset.
Definition: LegacyBarcodeSvc.cxx:123
Barcode::LegacyBarcodeSvc::secondaryParticleBcOffset
virtual int secondaryParticleBcOffset() const override
Return the secondary particle and vertex offsets.
Definition: LegacyBarcodeSvc.cxx:198
Barcode::LegacyBarcodeSvc::~LegacyBarcodeSvc
virtual ~LegacyBarcodeSvc()=default
Destructor.
Barcode::LegacyBarcodeSvc::initializeBarcodes
virtual StatusCode initializeBarcodes(int largestGeneratedParticleBC=0, int largestGeneratedVertexBC=0) override
Construct and insert a new set of barcode members.
Definition: LegacyBarcodeSvc.cxx:34
Barcode::LegacyBarcodeSvc::BarcodeInfo::currentSecondaryParticle
int currentSecondaryParticle
Definition: LegacyBarcodeSvc.h:91
Barcode::LegacyBarcodeSvc::newSimulationVertex
virtual int newSimulationVertex() override
Generate a new unique vertex barcode above the simulation offset.
Definition: LegacyBarcodeSvc.cxx:80
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:227
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
Barcode::LegacyBarcodeSvc::registerLargestGeneratedParticleBC
virtual void registerLargestGeneratedParticleBC(int bc) override
Inform the BarcodeSvc about the largest particle and vertex Barcodes in the event input.
Definition: LegacyBarcodeSvc.cxx:175
Barcode::LegacyBarcodeSvc::BarcodeInfo::BarcodeInfo
BarcodeInfo(int csv, int csp, int cgv, int cgp)
Definition: LegacyBarcodeSvc.h:85
Barcode::LegacyBarcodeSvc::secondaryVertexBcOffset
virtual int secondaryVertexBcOffset() const override
Return the secondary vertex offset.
Definition: LegacyBarcodeSvc.cxx:204
Barcode::LegacyBarcodeSvc::BarcodeInfo
Definition: LegacyBarcodeSvc.h:83
Barcode::LegacyBarcodeSvc::m_vertexIncrement
int m_vertexIncrement
Definition: LegacyBarcodeSvc.h:77
AthService.h
Barcode::LegacyBarcodeSvc::getBarcodeInfo
BarcodeInfo & getBarcodeInfo()
Definition: LegacyBarcodeSvc.cxx:61
Barcode::LegacyBarcodeSvc
Definition: LegacyBarcodeSvc.h:32
Barcode::LegacyBarcodeSvc::newGeneratedParticle
virtual int newGeneratedParticle(int) override
Generate a new unique particle barcode below the simulation offset (for particles from pre-defined de...
Definition: LegacyBarcodeSvc.cxx:149
Barcode::LegacyBarcodeSvc::initialize
virtual StatusCode initialize() override
Athena algorithm's interface methods.
Definition: LegacyBarcodeSvc.cxx:22
Barcode::LegacyBarcodeSvc::BarcodeInfo::currentGeneratedVertex
int currentGeneratedVertex
Definition: LegacyBarcodeSvc.h:92
Barcode::LegacyBarcodeSvc::m_firstVertex
int m_firstVertex
barcode information used for GenVertices
Definition: LegacyBarcodeSvc.h:76