Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
67 const std::string&
name,
76 renounceArray( handles.
in );
78 renounceArray( handles.
views );
81 if ( handles.
views.empty() ) {
88 return StatusCode::SUCCESS;
98 return StatusCode::SUCCESS;
107 const bool found = std::any_of(m_TrigCompositeContainer.begin(),
108 m_TrigCompositeContainer.end(), [&](
const auto& writeHandleKey) { return writeHandleKey.key() == entry; } );
110 ATH_MSG_ERROR(
"FixLinks contains the entry " <<
entry <<
", however this is not one of this EDMCreator tool's managed TrigCompositeContainers.");
111 ATH_MSG_ERROR(
"Configure FixLinks to be a sub-set of TrigCompositeContainer");
112 return StatusCode::FAILURE;
116 for (
const auto& writeHandleKey: m_TrigCompositeContainer ) {
117 const bool doFixLinks = std::any_of(
m_fixLinks.begin(),
m_fixLinks.end(), [&](
const std::string&
s) { return s == writeHandleKey.key(); } );
132 #define INIT(__TYPE) \
133 ATH_CHECK( initHandles( HandlesGroup<__TYPE>( m_##__TYPE, m_##__TYPE##InViews, m_##__TYPE##Views ) ) );
135 #define INIT_XAOD(__TYPE, __STORE_TYPE) \
136 ATH_CHECK( initHandles( HandlesGroup<xAOD::__TYPE>( m_##__TYPE, m_##__TYPE##InViews, m_##__TYPE##Views ) ) ); \
137 ATH_CHECK( initAuxKey<xAOD::__STORE_TYPE>( m_##__TYPE.keys() ) );
189 #define INIT_SHALLOW(__TYPE) \
190 ATH_CHECK( m_##__TYPE##ShallowCopy.initialize() ); \
191 renounceArray( m_##__TYPE##ShallowCopy ); \
192 for ( auto k: m_##__TYPE##ShallowCopy ) \
193 m_##__TYPE##ShallowCopyOut.push_back(k.key()); \
194 ATH_CHECK( m_##__TYPE##ShallowCopyOut.initialize() ); \
195 if(m_renounceOutputs) { renounceArray( m_##__TYPE##ShallowCopyOut ); }
202 return StatusCode::SUCCESS;
212 data = std::make_unique<T>();
217 return h.record( std::move(
data ) );
218 return StatusCode::SUCCESS;
222 template<
class T,
class STORE>
231 data = std::make_unique<T>();
232 store = std::make_unique<STORE>();
239 return h.record( std::move(
data ), std::move(
store ) );
240 return StatusCode::SUCCESS;
246 EventContext
const&,
T & )
const {
248 return StatusCode::FAILURE;
254 EventContext
const& context,
T &
output )
const {
256 using type_in_container =
typename T::base_value_type;
262 return StatusCode::SUCCESS;
268 ATH_MSG_DEBUG(
"fixLinks: No collections defined for this tool");
269 return StatusCode::SUCCESS;
272 ATH_MSG_DEBUG(
"fixLinks called for " <<
m_fixLinks.size() <<
" of " << m_TrigCompositeContainer.size() <<
" collections");
275 int writeHandleArrayIndex = -1;
276 for (
const auto& writeHandleKey: m_TrigCompositeContainer ) {
278 const bool doFixLinks = std::any_of(
m_fixLinks.begin(),
m_fixLinks.end(), [&](
const std::string&
s) { return s == writeHandleKey.key(); } );
279 if ( not doFixLinks ) {
280 ATH_MSG_DEBUG(
"Not requested to fix TrigComposite ElementLinks for " << writeHandleKey.key());
285 ++writeHandleArrayIndex;
287 ATH_MSG_DEBUG(
"Fixing links: confirm collection is there: " << writeHandleKey.key() <<
", write handle array index: " << writeHandleArrayIndex);
289 if ( not readHandle.
isValid() ) {
290 ATH_MSG_ERROR(
" Collection is not present. " << writeHandleKey.key() <<
" should have been created by createIfMissing.");
291 return StatusCode::FAILURE;
294 ATH_MSG_DEBUG(
"Collection exists with size " << readHandle->
size() <<
" Decision objects" );
301 int decisionObjectIndex = -1;
302 for (
auto inputDecision : *( readHandle.
cptr() ) ) {
303 ++decisionObjectIndex;
306 std::vector< SG::sgkey_t > remappedKeys = inputDecision->linkColKeys();
307 std::vector< xAOD::TrigComposite::index_type > remappedIndexes = inputDecision->linkColIndices();
310 size_t const collectionTotal = inputDecision->linkColNames().size();
311 ATH_MSG_DEBUG(
" Decision object #" << decisionObjectIndex <<
" has " << collectionTotal <<
" links");
312 for (
size_t elementLinkIndex = 0; elementLinkIndex < collectionTotal; ++elementLinkIndex ) {
315 std::string
const collectionName = inputDecision->linkColNames().at(elementLinkIndex);
316 SG::sgkey_t const collectionKey = remappedKeys.at(elementLinkIndex);
317 std::string
const keyString = *( evtStore()->keyToString( collectionKey ) );
323 bool isRemapped = evtStore()->tryELRemap( collectionKey, collectionIndex, newKey, newIndex);
326 ATH_MSG_DEBUG(
" Remap link [" << collectionName <<
"] from " << keyString <<
" to " << *( evtStore()->keyToString( newKey ) ) <<
", from index " << collectionIndex <<
" to index " << newIndex );
327 remappedKeys[ elementLinkIndex ] = newKey;
328 remappedIndexes[ elementLinkIndex ] = newIndex;
332 ATH_MSG_DEBUG(
" StoreGate did not remap link [" << collectionName <<
"] from " << keyString <<
" index " << collectionIndex );
339 keyDecor( *inputDecision ) = remappedKeys;
340 indexDecor( *inputDecision ) = remappedIndexes;
345 return StatusCode::SUCCESS;
349 template<
typename T,
typename STORE,
typename G,
typename M>
352 for (
size_t i = 0;
i < handles.
out.size(); ++
i) {
355 if ( handles.
views.empty() ) {
367 if constexpr (!std::is_void_v<STORE>) {
369 if ( !readAuxHandle.
isValid() ) {
388 if ( handles.
out.size() == 1 ) {
391 const bool doCreate =
i == 0 or handles.
out.at(
i-1).key() != handles.
out.at(
i).key();
392 const bool doRecord =
i == handles.
out.size()-1 or handles.
out.at(
i+1).key() != handles.
out.at(
i).key();
393 ATH_MSG_DEBUG(
"Instructing generator " << (doCreate ?
"to" :
"NOT TO") <<
" create collection and " << (doRecord ?
"to" :
"NOT TO") <<
" record collection in this iteration");
398 ATH_MSG_DEBUG(
"Will be trying to merge from the " << viewsReadHandleKey.
key() <<
" view container into that output");
401 if ( viewsHandle.isValid() ) {
403 ATH_MSG_DEBUG(
"Will be merging from " << viewsHandle->size() <<
" views using in-view key " << inViewReadHandleKey.
key() );
404 ATH_CHECK( (this->*merger)( *viewsHandle, inViewReadHandleKey , context, *
generator.data.get() ) );
406 ATH_MSG_DEBUG(
"Views " << viewsReadHandleKey.
key() <<
" are missing. Will leave " << writeHandleKey.
key() <<
" output collection empty.");
411 static const std::string probe_suffix =
"_probe";
412 const std::string viewsReadHandleKeyProbe = viewsReadHandleKey.
key() + probe_suffix;
413 ATH_MSG_VERBOSE(
"Will try to merge from the " << viewsReadHandleKeyProbe <<
" view container into that output");
418 if (evtStore()->contains<ViewContainer>(viewsReadHandleKeyProbe)) {
421 if ( viewsContainer_probe ) {
423 ATH_MSG_DEBUG(
"Will be merging from " << viewsContainer_probe->
size() <<
" probe views using in-view key " << inViewReadHandleKey.
key() );
424 ATH_CHECK( (this->*merger)( *viewsContainer_probe, inViewReadHandleKey , context, *
generator.data.get() ) );
426 ATH_MSG_VERBOSE(
"Probe views " << viewsReadHandleKeyProbe <<
" are missing.");
435 return StatusCode::SUCCESS;
445 #define CREATE(__TYPE) \
447 plainGenerator<__TYPE> generator; \
448 ATH_CHECK( (createIfMissing<__TYPE, void>( context, ConstHandlesGroup<__TYPE>( m_##__TYPE, m_##__TYPE##InViews, m_##__TYPE##Views ), generator, &HLTEDMCreator::noMerge<__TYPE>)) ); \
455 #define CREATE_XAOD(__TYPE, __STORE_TYPE) \
457 xAODGenerator<xAOD::__TYPE, xAOD::__STORE_TYPE> generator; \
458 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>)) ); \
513 #define CREATE_SHALLOW(__TYPE) \
515 for ( size_t index = 0; index < m_##__TYPE##ShallowCopy.size(); ++index ){ \
516 auto readHandle = SG::makeHandle<xAOD::__TYPE> ( m_##__TYPE##ShallowCopy[index], context ); \
517 if ( not readHandle.isValid() ) { \
518 ATH_MSG_DEBUG( "Creating missing "#__TYPE"ShallowCopy " << m_##__TYPE##ShallowCopy[index].key() ); \
519 auto writeHandle = SG::makeHandle( m_##__TYPE##ShallowCopyOut[index], context ); \
520 ATH_CHECK( writeHandle.record( std::make_unique<xAOD::__TYPE>(), std::make_unique<xAOD::ShallowAuxContainer>() )); \
522 ATH_MSG_DEBUG( #__TYPE"ShallowCopy " << m_##__TYPE##ShallowCopyOut[index].key() << " present in the event, done nothing"); \
530 #undef CREATE_SHALLOW
536 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.
const_pointer_type cptr()
Dereference the pointer.
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
StatusCode fixLinks() const
TrackParticleAuxContainer_v5 TrackParticleAuxContainer
Definition of the current TrackParticle auxiliary container.
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.
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.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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
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.
size_type size() const noexcept
Returns the number of elements in the collection.
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.