ATLAS Offline Software
Loading...
Searching...
No Matches
BunchConfCnvAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Gaudi/Athena include(s):
7
8// xAOD include(s):
12
13// Local include(s):
14#include "BunchConfCnvAlg.h"
15
16namespace xAODMaker {
17
18 BunchConfCnvAlg::BunchConfCnvAlg( const std::string& name,
19 ISvcLocator* svcLoc )
20 : AthAlgorithm( name, svcLoc ),
21 m_bcConf( "Trig::TrigConfBunchCrossingTool/BunchCrossingTool" ),
22 m_metaStore( "StoreGateSvc/MetaDataStore", name ),
23 m_bcc( nullptr ) {
24
25 declareProperty( "EventName", m_eventName = "BunchConfKey" );
26 declareProperty( "MetaName", m_metaName = "BunchConfiguration" );
27
28 declareProperty( "BCConfProvider", m_bcConf );
29 declareProperty( "MetaDataStore", m_metaStore );
30 }
31
33
34 // Greet the user:
35 ATH_MSG_INFO( "Initialising" );
36 ATH_MSG_DEBUG( " EventName = " << m_eventName );
37 ATH_MSG_DEBUG( " MetaName = " << m_metaName );
38
39 // Retrieve all the used component(s):
40 CHECK( m_bcConf.retrieve() );
41 CHECK( m_metaStore.retrieve() );
42
43 // Clear the internal cache:
44 m_convertedIDs.clear();
45
46 // Create an empty bunch configuration container:
49 m_bcc->setStore( aux );
50
51 // Record it into the metadata store:
52 CHECK( m_metaStore->record( m_bcc, m_metaName ) );
53 CHECK( m_metaStore->record( aux, m_metaName + "Aux." ) );
54
55 // Return gracefully:
56 return StatusCode::SUCCESS;
57 }
58
60
61 // Create and record the configuration identifier object for the
62 // event data:
63 xAOD::BunchConfKey* key = new xAOD::BunchConfKey( m_bcConf->configID() );
64 CHECK( evtStore()->record( key, m_eventName ) );
65
66 // Check if this configuration was saved already:
67 if( ! m_convertedIDs.insert( m_bcConf->configID() ).second ) {
68 ATH_MSG_VERBOSE( "Configuration with key " << m_bcConf->configID()
69 << " already translated" );
70 return StatusCode::SUCCESS;
71 }
72
73 // Let the user know what's happening:
74 ATH_MSG_INFO( "Converting the configuration with key: "
75 << m_bcConf->configID() );
76
77 // Create a new configuration object:
78 xAOD::BunchConf* conf = new xAOD::BunchConf();
79 m_bcc->push_back( conf );
80
81 // Set its configuration ID:
82 conf->setConfigID( m_bcConf->configID() );
83
84 // Set the basic configuration on it:
85 conf->setCollidingBCIDs( m_bcConf->configuredBCIDs() );
86 conf->setIntensitiesBeam1( m_bcConf->configuredIntensitiesBeam1() );
87 conf->setIntensitiesBeam2( m_bcConf->configuredIntensitiesBeam2() );
88
89 // Set the detailed configuration on it:
90 conf->setUnpairedBCIDsBeam1( m_bcConf->configuredUnpairedBCIDsBeam1() );
91 conf->setUnpairedBCIDsBeam2( m_bcConf->configuredUnpairedBCIDsBeam2() );
92 conf->setUnpairedIntensitiesBeam1(
93 m_bcConf->configuredUnpairedIntensitiesBeam1() );
94 conf->setUnpairedIntensitiesBeam2(
95 m_bcConf->configuredUnpairedIntensitiesBeam2() );
96
97 // Return gracefully:
98 return StatusCode::SUCCESS;
99 }
100
101} // namespace xAODMaker
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > m_metaStore
Connection to the metadata store.
virtual StatusCode initialize()
Function initialising the algorithm.
std::set< uint32_t > m_convertedIDs
Configurations that have already been converted.
std::string m_eventName
StoreGate key for the event object.
std::string m_metaName
StoreGate key for the configuration object.
BunchConfCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
virtual StatusCode execute()
Function executing the algorithm.
xAOD::BunchConfContainer * m_bcc
The configuration object that is being written.
ToolHandle< Trig::IBunchCrossingConfProvider > m_bcConf
Connection to the bunch configuration provider tool.
BunchConfContainer_v1 BunchConfContainer
Define the latest version of the bunch configuration container class.
BunchConf_v1 BunchConf
Define the latest version of the bunch configuration class.
Definition BunchConf.h:16
BunchConfKey_v1 BunchConfKey
Declare the current version of the bunch configuration key type.
BunchConfAuxContainer_v1 BunchConfAuxContainer
Define the latest version of the bunch configuration auxiliary container class.