ATLAS Offline Software
Loading...
Searching...
No Matches
HepMcParticleLinkCnv_p2.cxx
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5*/
6
7// Framework includes
8#include "GaudiKernel/MsgStream.h"
11
13
14
16 HepMcParticleLink* transObj,
17 MsgStream &/*msg*/ ) const
18{
20
21 if (persObj->m_mcEvtIndex == 0) {
23 }
24
25 transObj->setExtendedBarCode
27 persObj->m_mcEvtIndex,
28 flag, HepMcParticleLink::IS_BARCODE) ); // FIXME barcode-based
29
30 if ( HepMC::BarcodeBased::is_truth_suppressed_pileup(static_cast<int>(persObj->m_barcode)) ) {
32 }
33}
34
36 HepMcParticleLink_p2* persObj,
37 MsgStream &msg ) const
38{
39 // In the case that the standard production workflow is being used
40 // then the first event in the McEventCollection is the only one
41 // where the eventIndex could exceed the maximum value of unsigned
42 // short. In this case we can work around the issue by using an
43 // m_mcEvtIndex of zero as a special case, in which m_mcEvtIndex
44 // should be interpreted as the position in the McEventCollection
45 // rather than the value of GenEvent::event_number().
47 unsigned short index{0};
48 const HepMcParticleLink::index_type position =
50 proxy).at(0);
51 if (position!=0) {
52 index = transObj->eventIndex();
53 if(transObj->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) {
54 msg << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg;
55 }
56 }
57 persObj->m_mcEvtIndex = index;
58 if (transObj->getTruthSuppressionType() == EBC_PU_SUPPRESSED) {
60 }
61 else {
62 persObj->m_barcode = transObj->barcode(); // FIXME in the future the barcode will need to be generated here
63 }
64 persObj->m_evtColl = 'a'; // Hard-coding as this only ever had a single value in production
65}
66
#define endmsg
@ EBC_PU_SUPPRESSED
virtual void persToTrans(const HepMcParticleLink_p2 *persObj, HepMcParticleLink *transObj, MsgStream &msg) const override
Method creating the transient representation of HepMcParticleLink from its persistent representation ...
virtual void transToPers(const HepMcParticleLink *transObj, HepMcParticleLink_p2 *persObj, MsgStream &msg) const override
Method creating the persistent representation HepMcParticleLink_p2 from its transient representation ...
IProxyDict * proxyDictFromEventContext()
Return the IProxyDict for this thread's current context.
bool is_truth_suppressed_pileup(const T &p)
Method to establish if a particle (or barcode) corresponds to truth-suppressed pile-up.
constexpr int SUPPRESSED_PILEUP_BARCODE(std::numeric_limits< int32_t >::max())
This barcode is used by objects matched to particles from pile-up interactions in standard MC Product...
Definition index.py:1
Some out-of-line helpers for ExtendedEventContext.
MsgStream & msg
Definition testRead.cxx:32