ATLAS Offline Software
BunchConfCnvAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: BunchConfCnvAlg.cxx 583381 2014-02-14 15:58:20Z krasznaa $
6 
7 // Gaudi/Athena include(s):
9 
10 // xAOD include(s):
11 #include "xAODTrigger/BunchConf.h"
14 
15 // Local include(s):
16 #include "BunchConfCnvAlg.h"
17 
18 namespace xAODMaker {
19 
21  ISvcLocator* svcLoc )
22  : AthAlgorithm( name, svcLoc ),
23  m_bcConf( "Trig::TrigConfBunchCrossingTool/BunchCrossingTool" ),
24  m_metaStore( "MetaDataStore", name ),
25  m_bcc( nullptr ) {
26 
27  declareProperty( "EventName", m_eventName = "BunchConfKey" );
28  declareProperty( "MetaName", m_metaName = "BunchConfiguration" );
29 
30  declareProperty( "BCConfProvider", m_bcConf );
31  declareProperty( "MetaDataStore", m_metaStore );
32  }
33 
35 
36  // Greet the user:
37  ATH_MSG_INFO( "Initialising" );
38  ATH_MSG_DEBUG( " EventName = " << m_eventName );
39  ATH_MSG_DEBUG( " MetaName = " << m_metaName );
40 
41  // Retrieve all the used component(s):
42  CHECK( m_bcConf.retrieve() );
43  CHECK( m_metaStore.retrieve() );
44 
45  // Clear the internal cache:
46  m_convertedIDs.clear();
47 
48  // Create an empty bunch configuration container:
51  m_bcc->setStore( aux );
52 
53  // Record it into the metadata store:
54  CHECK( m_metaStore->record( m_bcc, m_metaName ) );
55  CHECK( m_metaStore->record( aux, m_metaName + "Aux." ) );
56 
57  // Return gracefully:
58  return StatusCode::SUCCESS;
59  }
60 
62 
63  // Create and record the configuration identifier object for the
64  // event data:
65  xAOD::BunchConfKey* key = new xAOD::BunchConfKey( m_bcConf->configID() );
66  CHECK( evtStore()->record( key, m_eventName ) );
67 
68  // Check if this configuration was saved already:
69  if( ! m_convertedIDs.insert( m_bcConf->configID() ).second ) {
70  ATH_MSG_VERBOSE( "Configuration with key " << m_bcConf->configID()
71  << " already translated" );
72  return StatusCode::SUCCESS;
73  }
74 
75  // Let the user know what's happening:
76  ATH_MSG_INFO( "Converting the configuration with key: "
77  << m_bcConf->configID() );
78 
79  // Create a new configuration object:
81  m_bcc->push_back( conf );
82 
83  // Set its configuration ID:
84  conf->setConfigID( m_bcConf->configID() );
85 
86  // Set the basic configuration on it:
87  conf->setCollidingBCIDs( m_bcConf->configuredBCIDs() );
88  conf->setIntensitiesBeam1( m_bcConf->configuredIntensitiesBeam1() );
89  conf->setIntensitiesBeam2( m_bcConf->configuredIntensitiesBeam2() );
90 
91  // Set the detailed configuration on it:
92  conf->setUnpairedBCIDsBeam1( m_bcConf->configuredUnpairedBCIDsBeam1() );
93  conf->setUnpairedBCIDsBeam2( m_bcConf->configuredUnpairedBCIDsBeam2() );
94  conf->setUnpairedIntensitiesBeam1(
95  m_bcConf->configuredUnpairedIntensitiesBeam1() );
96  conf->setUnpairedIntensitiesBeam2(
97  m_bcConf->configuredUnpairedIntensitiesBeam2() );
98 
99  // Return gracefully:
100  return StatusCode::SUCCESS;
101  }
102 
103 } // 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
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
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:72
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
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:20
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:34
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
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:61
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