 |
ATLAS Offline Software
|
Go to the documentation of this file.
68 const std::string&
name,
77 renounceArray( handles.
in );
79 renounceArray( handles.
views );
82 if ( handles.
views.empty() ) {
89 return StatusCode::SUCCESS;
99 return StatusCode::SUCCESS;
108 const bool found = std::any_of(m_TrigCompositeContainer.begin(),
109 m_TrigCompositeContainer.end(), [&](
const auto& writeHandleKey) { return writeHandleKey.key() == entry; } );
111 ATH_MSG_ERROR(
"FixLinks contains the entry " <<
entry <<
", however this is not one of this EDMCreator tool's managed TrigCompositeContainers.");
112 ATH_MSG_ERROR(
"Configure FixLinks to be a sub-set of TrigCompositeContainer");
113 return StatusCode::FAILURE;
117 for (
const auto& writeHandleKey: m_TrigCompositeContainer ) {
118 const bool doFixLinks = std::any_of(
m_fixLinks.begin(),
m_fixLinks.end(), [&](
const std::string&
s) { return s == writeHandleKey.key(); } );
133 #define INIT(__TYPE) \
134 ATH_CHECK( initHandles( HandlesGroup<__TYPE>( m_##__TYPE, m_##__TYPE##InViews, m_##__TYPE##Views ) ) );
136 #define INIT_XAOD(__TYPE, __STORE_TYPE) \
137 ATH_CHECK( initHandles( HandlesGroup<xAOD::__TYPE>( m_##__TYPE, m_##__TYPE##InViews, m_##__TYPE##Views ) ) ); \
138 ATH_CHECK( initAuxKey<xAOD::__STORE_TYPE>( m_##__TYPE.keys() ) );
191 #define INIT_SHALLOW(__TYPE) \
192 ATH_CHECK( m_##__TYPE##ShallowCopy.initialize() ); \
193 renounceArray( m_##__TYPE##ShallowCopy ); \
194 for ( auto k: m_##__TYPE##ShallowCopy ) \
195 m_##__TYPE##ShallowCopyOut.push_back(k.key()); \
196 ATH_CHECK( m_##__TYPE##ShallowCopyOut.initialize() ); \
197 if(m_renounceOutputs) { renounceArray( m_##__TYPE##ShallowCopyOut ); }
204 return StatusCode::SUCCESS;
214 data = std::make_unique<T>();
219 return h.record( std::move(
data ) );
220 return StatusCode::SUCCESS;
224 template<
class T,
class STORE>
233 data = std::make_unique<T>();
234 store = std::make_unique<STORE>();
241 return h.record( std::move(
data ), std::move(
store ) );
242 return StatusCode::SUCCESS;
248 EventContext
const&,
T & )
const {
250 return StatusCode::FAILURE;
256 EventContext
const& context,
T &
output )
const {
258 using type_in_container =
typename T::base_value_type;
264 return StatusCode::SUCCESS;
270 ATH_MSG_DEBUG(
"fixLinks: No collections defined for this tool");
271 return StatusCode::SUCCESS;
274 ATH_MSG_DEBUG(
"fixLinks called for " <<
m_fixLinks.size() <<
" of " << m_TrigCompositeContainer.size() <<
" collections");
277 int writeHandleArrayIndex = -1;
283 for (
const auto& writeHandleKey: m_TrigCompositeContainer ) {
285 const bool doFixLinks = std::any_of(
m_fixLinks.begin(),
m_fixLinks.end(), [&](
const std::string&
s) { return s == writeHandleKey.key(); } );
286 if ( not doFixLinks ) {
287 ATH_MSG_DEBUG(
"Not requested to fix TrigComposite ElementLinks for " << writeHandleKey.key());
292 ++writeHandleArrayIndex;
294 ATH_MSG_DEBUG(
"Fixing links: confirm collection is there: " << writeHandleKey.key() <<
", write handle array index: " << writeHandleArrayIndex);
296 readHandleKey = writeHandleKey.
key();
298 if ( not readHandle.isValid() ) {
299 ATH_MSG_ERROR(
"Collection is not present. " << readHandleKey.
key() <<
" should have been created by createIfMissing.");
300 return StatusCode::FAILURE;
303 ATH_MSG_DEBUG(
"Collection exists with size " << readHandle->size() <<
" Decision objects" );
312 int decisionObjectIndex = -1;
313 for (
auto inputDecision : *( readHandle.cptr() ) ) {
314 ++decisionObjectIndex;
317 std::vector< SG::sgkey_t > remappedKeys = inputDecision->linkColKeys();
318 std::vector< xAOD::TrigComposite::index_type > remappedIndexes = inputDecision->linkColIndices();
321 size_t const collectionTotal = inputDecision->linkColNames().size();
322 ATH_MSG_DEBUG(
" Decision object #" << decisionObjectIndex <<
" has " << collectionTotal <<
" links");
323 for (
size_t elementLinkIndex = 0; elementLinkIndex < collectionTotal; ++elementLinkIndex ) {
326 std::string
const collectionName = inputDecision->linkColNames().at(elementLinkIndex);
327 SG::sgkey_t const collectionKey = remappedKeys.at(elementLinkIndex);
328 std::string
const keyString = *( evtStore()->keyToString( collectionKey ) );
334 bool isRemapped = evtStore()->tryELRemap( collectionKey, collectionIndex, newKey, newIndex);
337 ATH_MSG_DEBUG(
" Remap link [" << collectionName <<
"] from " << keyString <<
" to " << *( evtStore()->keyToString( newKey ) ) <<
", from index " << collectionIndex <<
" to index " << newIndex );
338 remappedKeys[ elementLinkIndex ] = newKey;
339 remappedIndexes[ elementLinkIndex ] = newIndex;
343 ATH_MSG_DEBUG(
" StoreGate did not remap link [" << collectionName <<
"] from " << keyString <<
" index " << collectionIndex );
350 keyDecor( *inputDecision ) = remappedKeys;
351 indexDecor( *inputDecision ) = remappedIndexes;
356 return StatusCode::SUCCESS;
360 template<
typename T,
typename STORE,
typename G,
typename M>
368 using AuxType = std::conditional_t<std::is_void_v<STORE>,
T, STORE>;
373 for (
size_t i = 0;
i < handles.
out.size(); ++
i) {
377 if ( handles.
views.empty() ) {
381 if ( readHandle.isValid() ) {
389 if constexpr (!std::is_void_v<STORE>) {
390 rhkAux = rhk.
key() +
"Aux.";
392 if ( !readAuxHandle.isValid() ) {
412 if ( handles.
out.size() == 1 ) {
415 const bool doCreate =
i == 0 or handles.
out.at(
i-1).key() != whk.
key();
416 const bool doRecord =
i == handles.
out.size()-1 or handles.
out.at(
i+1).key() != whk.
key();
417 ATH_MSG_DEBUG(
"Instructing generator " << (doCreate ?
"to" :
"NOT TO") <<
" create collection and " << (doRecord ?
"to" :
"NOT TO") <<
" record collection in this iteration");
422 ATH_MSG_DEBUG(
"Will be trying to merge from the " << viewsReadHandleKey.
key() <<
" view container into that output");
425 if ( viewsHandle.isValid() ) {
427 ATH_MSG_DEBUG(
"Will be merging from " << viewsHandle->size() <<
" views using in-view key " << inViewReadHandleKey.
key() );
428 ATH_CHECK( (this->*merger)( *viewsHandle, inViewReadHandleKey , context, *
generator.data.get() ) );
430 ATH_MSG_DEBUG(
"Views " << viewsReadHandleKey.
key() <<
" are missing. Will leave " << whk.
key() <<
" output collection empty.");
435 const std::string viewsReadHandleKeyProbe = viewsReadHandleKey.
key() +
"_probe";
436 ATH_MSG_VERBOSE(
"Will try to merge from the " << viewsReadHandleKeyProbe <<
" view container into that output");
441 if (evtStore()->contains<ViewContainer>(viewsReadHandleKeyProbe)) {
444 if ( viewsContainer_probe ) {
446 ATH_MSG_DEBUG(
"Will be merging from " << viewsContainer_probe->
size() <<
" probe views using in-view key " << inViewReadHandleKey.
key() );
447 ATH_CHECK( (this->*merger)( *viewsContainer_probe, inViewReadHandleKey , context, *
generator.data.get() ) );
449 ATH_MSG_VERBOSE(
"Probe views " << viewsReadHandleKeyProbe <<
" are missing.");
458 return StatusCode::SUCCESS;
468 #define CREATE(__TYPE) \
470 plainGenerator<__TYPE> generator; \
471 ATH_CHECK( (createIfMissing<__TYPE, void>( context, ConstHandlesGroup<__TYPE>( m_##__TYPE, m_##__TYPE##InViews, m_##__TYPE##Views ), generator, &HLTEDMCreator::noMerge<__TYPE>)) ); \
478 #define CREATE_XAOD(__TYPE, __STORE_TYPE) \
480 xAODGenerator<xAOD::__TYPE, xAOD::__STORE_TYPE> generator; \
481 ATH_CHECK( (createIfMissing<xAOD::__TYPE, xAOD::__STORE_TYPE>( context, ConstHandlesGroup<xAOD::__TYPE>( m_##__TYPE, m_##__TYPE##InViews, m_##__TYPE##Views ), generator, &HLTEDMCreator::viewsMerge<xAOD::__TYPE>)) ); \
537 #define CREATE_SHALLOW(__TYPE) \
539 for ( size_t index = 0; index < m_##__TYPE##ShallowCopy.size(); ++index ){ \
540 auto readHandle = SG::makeHandle<xAOD::__TYPE> ( m_##__TYPE##ShallowCopy[index], context ); \
541 if ( not readHandle.isValid() ) { \
542 ATH_MSG_DEBUG( "Creating missing "#__TYPE"ShallowCopy " << m_##__TYPE##ShallowCopy[index].key() ); \
543 auto writeHandle = SG::makeHandle( m_##__TYPE##ShallowCopyOut[index], context ); \
544 ATH_CHECK( writeHandle.record( std::make_unique<xAOD::__TYPE>(), std::make_unique<xAOD::ShallowAuxContainer>() )); \
546 ATH_MSG_DEBUG( #__TYPE"ShallowCopy " << m_##__TYPE##ShallowCopyOut[index].key() << " present in the event, done nothing"); \
554 #undef CREATE_SHALLOW
560 return StatusCode::SUCCESS;
Gaudi::Property< std::vector< std::string > > m_fixLinks
def retrieve(aClass, aKey=None)
AFPToFTrackContainer_v1 AFPToFTrackContainer
AFPProtonContainer_v1 AFPProtonContainer
Gaudi::Property< bool > m_dumpSGBefore
SG::WriteDecorHandleKeyArray< xAOD::TrigCompositeContainer, std::vector< SG::sgkey_t > > m_remapLinkColKeys
SG::ReadHandleKeyArray< ViewContainer > & views
TrigElectronAuxContainer_v1 TrigElectronAuxContainer
Declare the latest version of the auxiliary container.
std::unique_ptr< T > data
AFPVertexContainer_v1 AFPVertexContainer
BTaggingAuxContainer_v2 BTaggingAuxContainer
Definition of the current BTagging auxiliary container.
jFexTauRoIContainer_v1 jFexTauRoIContainer
jFexSumETRoIContainer_v1 jFexSumETRoIContainer
std::unique_ptr< T > data
HIEventShapeAuxContainer_v2 HIEventShapeAuxContainer
Define the latest version of the auxiliary container.
TauTrackContainer_v1 TauTrackContainer
Definition of the current TauTrack container version.
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
JetAuxContainer_v1 JetAuxContainer
Definition of the current jet auxiliary container.
vecmem::edm::container< TrackParticleInterface, vecmem::edm::type::vector< float >, vecmem::edm::type::vector< float >, vecmem::edm::type::vector< float > > TrackParticleContainer
SoA, GPU friendly TrackParticleContainer.
BTagVertexContainer_v1 BTagVertexContainer
Definition of the current "BTagging container version".
TauJetAuxContainer_v3 TauJetAuxContainer
Definition of the current taujet auxiliary container.
std::unique_ptr< STORE > store
jFexSRJetRoIContainer_v1 jFexSRJetRoIContainer
Storable container for CaloCluster.
#define CREATE_XAOD(__TYPE, __STORE_TYPE)
jFexMETRoIContainer_v1 jFexMETRoIContainer
jFexLRJetRoIContainer_v1 jFexLRJetRoIContainer
TrackParticleAuxContainer_v5 TrackParticleAuxContainer
Definition of the current TrackParticle auxiliary container.
StatusCode fixLinks(EventContext const &context) const
jFexFwdElRoIContainer_v1 jFexFwdElRoIContainer
gFexJetRoIContainer_v1 gFexJetRoIContainer
eFexTauRoIContainer_v1 eFexTauRoIContainer
PhotonAuxContainer_v3 PhotonAuxContainer
Definition of the current photon auxiliary container.
TrigEMClusterAuxContainer_v2 TrigEMClusterAuxContainer
Define the latest version of the trigger EM cluster auxiliary container.
eFexEMRoIAuxContainer_v1 eFexEMRoIAuxContainer
jFexSumETRoIAuxContainer_v1 jFexSumETRoIAuxContainer
MuonRoIAuxContainer_v1 MuonRoIAuxContainer
virtual StatusCode createOutput(const EventContext &context) const override
TrigCompositeAuxContainer_v2 TrigCompositeAuxContainer
Declare the latest version of the container.
SG::WriteDecorHandleKeyArray< xAOD::TrigCompositeContainer, std::vector< xAOD::TrigComposite::index_type > > m_remapLinkColIndices
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
Property holding a SG store/key/clid from which a ReadHandle is made.
TrigRingerRingsContainer_v2 TrigRingerRingsContainer
Define the latest version of the TrigRingerRingsContainer class.
Container from TrigEMCluster type objects.
SG::WriteHandleKeyArray< T > & out
AFPTrackAuxContainer_v2 AFPTrackAuxContainer
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
L2StandAloneMuonAuxContainer_v2 L2StandAloneMuonAuxContainer
Define the latest version of the muon SA auxiliary container.
TrigT2MbtsBitsAuxContainer_v1 TrigT2MbtsBitsAuxContainer
jFexSRJetRoIAuxContainer_v1 jFexSRJetRoIAuxContainer
TrigRingerRingsAuxContainer_v2 TrigRingerRingsAuxContainer
Define the latest version of the TrigRingerRings class.
TrigPhotonAuxContainer_v1 TrigPhotonAuxContainer
Declare the latest version of the photon auxiliary container.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
The Athena Transient Store API.
TauTrackAuxContainer_v1 TauTrackAuxContainer
Container from TrigComposite type objects.
DiTauJetAuxContainer_v1 DiTauJetAuxContainer
AFPSiHitsClusterAuxContainer_v1 AFPSiHitsClusterAuxContainer
Property holding a SG store/key/clid from which a WriteHandle is made.
Gaudi::Property< bool > m_dumpSGAfter
BTaggingContainer_v1 BTaggingContainer
Definition of the current "BTagging container version".
VertexAuxContainer_v1 VertexAuxContainer
Definition of the current jet auxiliary container.
StatusCode initHandles(const HandlesGroup< T > &handles)
Init related handles.
::StatusCode StatusCode
StatusCode definition for legacy code.
AFPVertexAuxContainer_v1 AFPVertexAuxContainer
L2StandAloneMuonContainer_v2 L2StandAloneMuonContainer
Define the latest version of the muon SA container.
#define CREATE_SHALLOW(__TYPE)
Handle class for adding a decoration to an object.
jFexTauRoIAuxContainer_v1 jFexTauRoIAuxContainer
Handle class for adding a decoration to an object.
BTagVertexAuxContainer_v1 BTagVertexAuxContainer
Definition of the current BTagging auxiliary container.
const SG::ReadHandleKeyArray< ViewContainer > & views
jFexLRJetRoIAuxContainer_v1 jFexLRJetRoIAuxContainer
TrigMissingETAuxContainer_v1 TrigMissingETAuxContainer
Define the most recent version of the AuxContainer for the TrigMissingET object(s).
L2IsoMuonAuxContainer_v1 L2IsoMuonAuxContainer
Define the latest version of the muon Iso auxiliary container.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
StatusCode viewsMerge(ViewContainer const &views, const SG::ReadHandleKey< T > &inViewKey, EventContext const &context, T &output) const
ElectronAuxContainer_v3 ElectronAuxContainer
Definition of the current electron auxiliary container.
jFexMETRoIAuxContainer_v1 jFexMETRoIAuxContainer
TrigBphysAuxContainer_v1 TrigBphysAuxContainer
void create(bool create, bool record)
gFexGlobalRoIContainer_v1 gFexGlobalRoIContainer
TauJetContainer_v3 TauJetContainer
Definition of the current "taujet container version".
eFexTauRoIAuxContainer_v1 eFexTauRoIAuxContainer
StatusCode mergeViewCollection(ViewContainer const &viewVector, SG::ReadHandleKey< T > const &queryKey, EventContext const &sourceContext, T &outputData)
#define INIT_XAOD(__TYPE, __STORE_TYPE)
uint32_t sgkey_t
Type used for hashed StoreGate key+CLID pairs.
const SG::WriteHandleKeyArray< T > & out
TrigBphysContainer_v1 TrigBphysContainer
DiTauJetContainer_v1 DiTauJetContainer
Definition of the current DiTauJet container version.
A property holding a SG store/key/clid from which a VarHandle is made.
TrigCaloClusterAuxContainer_v1 TrigCaloClusterAuxContainer
Define the latest version of the trigger calorimeter cluster auxiliary container.
File: TrigPhotonContainer.h.
StatusCode record(SG::WriteHandle< T > &h)
#define INIT_SHALLOW(__TYPE)
StatusCode initAuxKey(const std::vector< SG::VarHandleKey * > &keys)
Register AuxStore keys for the given keys.
jFexFwdElRoIAuxContainer_v1 jFexFwdElRoIAuxContainer
generator
Configure Herwig7 These are the commands corresponding to what would go into the regular Herwig infil...
L2CombinedMuonContainer_v1 L2CombinedMuonContainer
Define the latest version of the muon CB container.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
CaloClusterTrigAuxContainer_v1 CaloClusterTrigAuxContainer
Define the latest version of the calorimeter cluster auxiliary container.
StatusCode createIfMissing(const EventContext &context, const ConstHandlesGroup< T > &handles, G &generator, M merger) const
StatusCode record(SG::WriteHandle< T > &h)
Gaudi::Property< bool > m_renounceOutputs
void create(bool create, bool record)
JetContainer_v1 JetContainer
Definition of the current "jet container version".
HIEventShapeContainer_v2 HIEventShapeContainer
Define the latest version of the container.
virtual StatusCode initialize() override
const SG::ReadHandleKeyArray< T > & in
File: TrigElectronContainer.h.
TrigRNNOutputAuxContainer_v2 TrigRNNOutputAuxContainer
Define the latest version of the RingerRings class.
MuonAuxContainer_v5 MuonAuxContainer
Definition of the current Muon auxiliary container.
AFPTrackContainer_v2 AFPTrackContainer
L2CombinedMuonAuxContainer_v1 L2CombinedMuonAuxContainer
Define the latest version of the muon CB auxiliary container.
MuonRoIContainer_v1 MuonRoIContainer
gFexGlobalRoIAuxContainer_v1 gFexGlobalRoIAuxContainer
AFPProtonAuxContainer_v1 AFPProtonAuxContainer
Container from TrigCaloCluster type objects.
gFexJetRoIAuxContainer_v1 gFexJetRoIAuxContainer
AFPToFTrackAuxContainer_v1 AFPToFTrackAuxContainer
AFPSiHitsClusterContainer_v1 AFPSiHitsClusterContainer
StatusCode noMerge(ViewContainer const &views, const SG::ReadHandleKey< T > &inViewKey, EventContext const &context, T &output) const
eFexEMRoIContainer_v1 eFexEMRoIContainer
SG::ReadHandleKeyArray< T > & in
L2IsoMuonContainer_v1 L2IsoMuonContainer
Define the latest version of the muon Iso container.