ATLAS Offline Software
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 
16 namespace xAODMaker {
17 
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:
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
xAODMaker::BunchConfCnvAlg::m_convertedIDs
std::set< uint32_t > m_convertedIDs
Configurations that have already been converted.
Definition: BunchConfCnvAlg.h:69
xAOD::BunchConfAuxContainer
BunchConfAuxContainer_v1 BunchConfAuxContainer
Define the latest version of the bunch configuration auxiliary container class.
Definition: BunchConfAuxContainer.h:17
xAODMaker::BunchConfCnvAlg::m_metaName
std::string m_metaName
StoreGate key for the configuration object.
Definition: BunchConfCnvAlg.h:58
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
BunchConf.h
BunchConfCnvAlg.h
xAOD::BunchConfAuxContainer_v1
Auxiliary store for BunchConfContainer_v1.
Definition: BunchConfAuxContainer_v1.h:33
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
xAODMaker
Definition: StoreGateSvc.h:70
xAODMaker::BunchConfCnvAlg::m_metaStore
ServiceHandle< StoreGateSvc > m_metaStore
Connection to the metadata store.
Definition: BunchConfCnvAlg.h:63
BunchConfAuxContainer.h
xAODMaker::BunchConfCnvAlg::m_eventName
std::string m_eventName
StoreGate key for the event object.
Definition: BunchConfCnvAlg.h:56
xAOD::BunchConfContainer
BunchConfContainer_v1 BunchConfContainer
Define the latest version of the bunch configuration container class.
Definition: BunchConfContainer.h:17
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
python.ConfigurableDb.conf
def conf
Definition: ConfigurableDb.py:282
xAODMaker::BunchConfCnvAlg::m_bcc
xAOD::BunchConfContainer * m_bcc
The configuration object that is being written.
Definition: BunchConfCnvAlg.h:66
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition: AthCommonDataStore.h:145
xAOD::BunchConf_v1
Class holding one particular bunch configuration.
Definition: BunchConf_v1.h:33
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
xAODMaker::BunchConfCnvAlg::BunchConfCnvAlg
BunchConfCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
Definition: BunchConfCnvAlg.cxx:18
xAOD::BunchConfKey
BunchConfKey_v1 BunchConfKey
Declare the current version of the bunch configuration key type.
Definition: BunchConfKey.h:16
AthAlgorithm
Definition: AthAlgorithm.h:47
xAODMaker::BunchConfCnvAlg::initialize
virtual StatusCode initialize()
Function initialising the algorithm.
Definition: BunchConfCnvAlg.cxx:32
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
errorcheck.h
Helpers for checking error return status codes and reporting errors.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
xAOD::BunchConf
BunchConf_v1 BunchConf
Define the latest version of the bunch configuration class.
Definition: BunchConf.h:16
xAODMaker::BunchConfCnvAlg::m_bcConf
ToolHandle< Trig::IBunchCrossingConfProvider > m_bcConf
Connection to the bunch configuration provider tool.
Definition: BunchConfCnvAlg.h:61
xAODMaker::BunchConfCnvAlg::execute
virtual StatusCode execute()
Function executing the algorithm.
Definition: BunchConfCnvAlg.cxx:59
BunchConfKey.h
xAOD::BunchConfKey_v1
Class identifying the bunch configuration of a given event.
Definition: BunchConfKey_v1.h:29
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37