|
ATLAS Offline Software
|
Go to the documentation of this file.
14 const std::string&
name,
21 renounceArray( handles.
out );
23 renounceArray( handles.
in );
25 renounceArray( handles.
views );
28 if ( handles.
views.empty() ) {
35 return StatusCode::SUCCESS;
45 return StatusCode::SUCCESS;
54 const bool found = std::any_of(m_TrigCompositeContainer.begin(),
55 m_TrigCompositeContainer.end(), [&](
const auto& writeHandleKey) { return writeHandleKey.key() == entry; } );
57 ATH_MSG_ERROR(
"FixLinks contains the entry " <<
entry <<
", however this is not one of this EDMCreator tool's managed TrigCompositeContainers.");
58 ATH_MSG_ERROR(
"Configure FixLinks to be a sub-set of TrigCompositeContainer");
59 return StatusCode::FAILURE;
63 for (
const auto& writeHandleKey: m_TrigCompositeContainer ) {
64 const bool doFixLinks = std::any_of(
m_fixLinks.begin(),
m_fixLinks.end(), [&](
const std::string&
s) { return s == writeHandleKey.key(); } );
79 #define INIT(__TYPE) \
80 ATH_CHECK( initHandles( HandlesGroup<__TYPE>( m_##__TYPE, m_##__TYPE##InViews, m_##__TYPE##Views ) ) );
82 #define INIT_XAOD(__TYPE, __STORE_TYPE) \
83 ATH_CHECK( initHandles( HandlesGroup<xAOD::__TYPE>( m_##__TYPE, m_##__TYPE##InViews, m_##__TYPE##Views ) ) ); \
84 ATH_CHECK( initAuxKey<xAOD::__STORE_TYPE>( m_##__TYPE.keys() ) );
136 #define INIT_SHALLOW(__TYPE) \
137 ATH_CHECK( m_##__TYPE##ShallowCopy.initialize() ); \
138 renounceArray( m_##__TYPE##ShallowCopy ); \
139 for ( auto k: m_##__TYPE##ShallowCopy ) \
140 m_##__TYPE##ShallowCopyOut.push_back(k.key()); \
141 ATH_CHECK( m_##__TYPE##ShallowCopyOut.initialize() ); \
142 renounceArray( m_##__TYPE##ShallowCopyOut )
149 return StatusCode::SUCCESS;
159 data = std::make_unique<T>();
164 return h.record( std::move(
data ) );
165 return StatusCode::SUCCESS;
169 template<
class T,
class STORE>
178 data = std::make_unique<T>();
179 store = std::make_unique<STORE>();
186 return h.record( std::move(
data ), std::move(
store ) );
187 return StatusCode::SUCCESS;
193 EventContext
const&,
T & )
const {
195 return StatusCode::FAILURE;
201 EventContext
const& context,
T &
output )
const {
203 using type_in_container =
typename T::base_value_type;
209 return StatusCode::SUCCESS;
215 ATH_MSG_DEBUG(
"fixLinks: No collections defined for this tool");
216 return StatusCode::SUCCESS;
219 ATH_MSG_DEBUG(
"fixLinks called for " <<
m_fixLinks.size() <<
" of " << m_TrigCompositeContainer.size() <<
" collections");
222 int writeHandleArrayIndex = -1;
223 for (
const auto& writeHandleKey: m_TrigCompositeContainer ) {
225 const bool doFixLinks = std::any_of(
m_fixLinks.begin(),
m_fixLinks.end(), [&](
const std::string&
s) { return s == writeHandleKey.key(); } );
226 if ( not doFixLinks ) {
227 ATH_MSG_DEBUG(
"Not requested to fix TrigComposite ElementLinks for " << writeHandleKey.key());
232 ++writeHandleArrayIndex;
234 ATH_MSG_DEBUG(
"Fixing links: confirm collection is there: " << writeHandleKey.key() <<
", write handle array index: " << writeHandleArrayIndex);
236 if ( not readHandle.
isValid() ) {
237 ATH_MSG_ERROR(
" Collection is not present. " << writeHandleKey.key() <<
" should have been created by createIfMissing.");
238 return StatusCode::FAILURE;
241 ATH_MSG_DEBUG(
"Collection exists with size " << readHandle->
size() <<
" Decision objects" );
248 int decisionObjectIndex = -1;
249 for (
auto inputDecision : *( readHandle.
cptr() ) ) {
250 ++decisionObjectIndex;
253 std::vector< SG::sgkey_t > remappedKeys = inputDecision->linkColKeys();
254 std::vector< xAOD::TrigComposite::index_type > remappedIndexes = inputDecision->linkColIndices();
257 size_t const collectionTotal = inputDecision->linkColNames().size();
258 ATH_MSG_DEBUG(
" Decision object #" << decisionObjectIndex <<
" has " << collectionTotal <<
" links");
259 for (
size_t elementLinkIndex = 0; elementLinkIndex < collectionTotal; ++elementLinkIndex ) {
262 std::string
const collectionName = inputDecision->linkColNames().at(elementLinkIndex);
263 SG::sgkey_t const collectionKey = remappedKeys.at(elementLinkIndex);
264 std::string
const keyString = *( evtStore()->keyToString( collectionKey ) );
270 bool isRemapped = evtStore()->tryELRemap( collectionKey, collectionIndex, newKey, newIndex);
273 ATH_MSG_DEBUG(
" Remap link [" << collectionName <<
"] from " << keyString <<
" to " << *( evtStore()->keyToString( newKey ) ) <<
", from index " << collectionIndex <<
" to index " << newIndex );
274 remappedKeys[ elementLinkIndex ] = newKey;
275 remappedIndexes[ elementLinkIndex ] = newIndex;
279 ATH_MSG_DEBUG(
" StoreGate did not remap link [" << collectionName <<
"] from " << keyString <<
" index " << collectionIndex );
286 keyDecor( *inputDecision ) = remappedKeys;
287 indexDecor( *inputDecision ) = remappedIndexes;
292 return StatusCode::SUCCESS;
296 template<
typename T,
typename STORE,
typename G,
typename M>
299 for (
size_t i = 0;
i < handles.
out.size(); ++
i) {
302 if ( handles.
views.empty() ) {
314 if constexpr (!std::is_void_v<STORE>) {
316 if ( !readAuxHandle.
isValid() ) {
335 if ( handles.
out.size() == 1 ) {
338 const bool doCreate =
i == 0 or handles.
out.at(
i-1).key() != handles.
out.at(
i).key();
339 const bool doRecord =
i == handles.
out.size()-1 or handles.
out.at(
i+1).key() != handles.
out.at(
i).key();
340 ATH_MSG_DEBUG(
"Instructing generator " << (doCreate ?
"to" :
"NOT TO") <<
" create collection and " << (doRecord ?
"to" :
"NOT TO") <<
" record collection in this iteration");
345 ATH_MSG_DEBUG(
"Will be trying to merge from the " << viewsReadHandleKey.
key() <<
" view container into that output");
348 if ( viewsHandle.isValid() ) {
350 ATH_MSG_DEBUG(
"Will be merging from " << viewsHandle->size() <<
" views using in-view key " << inViewReadHandleKey.
key() );
351 ATH_CHECK( (this->*merger)( *viewsHandle, inViewReadHandleKey , context, *
generator.data.get() ) );
353 ATH_MSG_DEBUG(
"Views " << viewsReadHandleKey.
key() <<
" are missing. Will leave " << writeHandleKey.
key() <<
" output collection empty.");
358 static const std::string probe_suffix =
"_probe";
359 const std::string viewsReadHandleKeyProbe = viewsReadHandleKey.
key() + probe_suffix;
360 ATH_MSG_VERBOSE(
"Will try to merge from the " << viewsReadHandleKeyProbe <<
" view container into that output");
365 if (evtStore()->contains<ViewContainer>(viewsReadHandleKeyProbe)) {
368 if ( viewsContainer_probe ) {
370 ATH_MSG_DEBUG(
"Will be merging from " << viewsContainer_probe->
size() <<
" probe views using in-view key " << inViewReadHandleKey.
key() );
371 ATH_CHECK( (this->*merger)( *viewsContainer_probe, inViewReadHandleKey , context, *
generator.data.get() ) );
373 ATH_MSG_VERBOSE(
"Probe views " << viewsReadHandleKeyProbe <<
" are missing.");
382 return StatusCode::SUCCESS;
392 #define CREATE(__TYPE) \
394 plainGenerator<__TYPE> generator; \
395 ATH_CHECK( (createIfMissing<__TYPE, void>( context, ConstHandlesGroup<__TYPE>( m_##__TYPE, m_##__TYPE##InViews, m_##__TYPE##Views ), generator, &HLTEDMCreator::noMerge<__TYPE>)) ); \
402 #define CREATE_XAOD(__TYPE, __STORE_TYPE) \
404 xAODGenerator<xAOD::__TYPE, xAOD::__STORE_TYPE> generator; \
405 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>)) ); \
460 #define CREATE_SHALLOW(__TYPE) \
462 for ( size_t index = 0; index < m_##__TYPE##ShallowCopy.size(); ++index ){ \
463 auto readHandle = SG::makeHandle<xAOD::__TYPE> ( m_##__TYPE##ShallowCopy[index], context ); \
464 if ( not readHandle.isValid() ) { \
465 ATH_MSG_DEBUG( "Creating missing "#__TYPE"ShallowCopy " << m_##__TYPE##ShallowCopy[index].key() ); \
466 auto writeHandle = SG::makeHandle( m_##__TYPE##ShallowCopyOut[index], context ); \
467 ATH_CHECK( writeHandle.record( std::make_unique<xAOD::__TYPE>(), std::make_unique<xAOD::ShallowAuxContainer>() )); \
469 ATH_MSG_DEBUG( #__TYPE"ShallowCopy " << m_##__TYPE##ShallowCopyOut[index].key() << " present in the event, done nothing"); \
477 #undef CREATE_SHALLOW
483 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)
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.