ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Generators
GeneratorObjectsTPCnv
src
HepMcParticleLinkCnv_p3.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"
9
#include "
AthenaKernel/proxyDictFromEventContext.h
"
10
11
#include "
GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p3.h
"
12
13
14
void
HepMcParticleLinkCnv_p3::persToTrans
(
const
HepMcParticleLink_p3
* persObj,
15
HepMcParticleLink
* transObj,
16
MsgStream &
/*msg*/
)
const
17
{
18
HepMcParticleLink::PositionFlag
flag =
HepMcParticleLink::IS_EVENTNUM
;
19
20
if
(persObj->
m_mcEvtIndex
== 0) {
21
flag =
HepMcParticleLink::IS_POSITION
;
22
}
23
24
transObj->
setExtendedBarCode
25
(
HepMcParticleLink::ExtendedBarCode
( persObj->
m_id
,
26
persObj->
m_mcEvtIndex
,
27
flag) );
28
29
transObj->
setTruthSuppressionType
(
HepMcParticleLink::ExtendedBarCode::truthSuppressionTypeFromChar
(persObj->
m_truthSupp
));
30
}
31
32
void
HepMcParticleLinkCnv_p3::transToPers
(
const
HepMcParticleLink
* transObj,
33
HepMcParticleLink_p3
* persObj,
34
MsgStream &
msg
)
const
35
{
36
// In the case that the standard production workflow is being used
37
// then the first event in the McEventCollection is the only one
38
// where the eventIndex could exceed the maximum value of unsigned
39
// short. In this case we can work around the issue by using an
40
// m_mcEvtIndex of zero as a special case, in which m_mcEvtIndex
41
// should be interpreted as the position in the McEventCollection
42
// rather than the value of GenEvent::event_number().
43
IProxyDict
* proxy =
Atlas::proxyDictFromEventContext
();
44
unsigned
short
index
{0};
45
const
HepMcParticleLink::index_type
position =
46
HepMcParticleLink::getEventPositionInCollection
(transObj->
eventIndex
(),
47
proxy).at(0);
48
if
(position!=0) {
49
index
= transObj->
eventIndex
();
50
if
(transObj->
eventIndex
()!=
static_cast<
HepMcParticleLink::index_type
>
(
index
)) {
51
msg
<< MSG::WARNING <<
"Attempting to persistify an eventIndex larger than max unsigned short!"
<<
endmsg
;
52
}
53
}
54
persObj->
m_mcEvtIndex
=
index
;
55
persObj->
m_id
= transObj->
id
();
56
persObj->
m_truthSupp
= transObj->
getTruthSuppressionTypeAsChar
();
57
}
58
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:54
HepMcParticleLinkCnv_p3.h
HepMcParticleLinkCnv_p3::transToPers
virtual void transToPers(const HepMcParticleLink *transObj, HepMcParticleLink_p3 *persObj, MsgStream &msg) const override
Method creating the persistent representation HepMcParticleLink_p3 from its transient representation ...
Definition
HepMcParticleLinkCnv_p3.cxx:32
HepMcParticleLinkCnv_p3::persToTrans
virtual void persToTrans(const HepMcParticleLink_p3 *persObj, HepMcParticleLink *transObj, MsgStream &msg) const override
Method creating the transient representation of HepMcParticleLink from its persistent representation ...
Definition
HepMcParticleLinkCnv_p3.cxx:14
HepMcParticleLink::ExtendedBarCode
Persistent representation of a link.
Definition
HepMcParticleLink.h:93
HepMcParticleLink::ExtendedBarCode::truthSuppressionTypeFromChar
static EBC_SUPPRESSED_TRUTH truthSuppressionTypeFromChar(char suppChar)
Translate truth suppression char ('a'..'b') to an enum.
Definition
HepMcParticleLink.cxx:72
HepMcParticleLink_p3
Definition
HepMcParticleLink_p3.h:17
HepMcParticleLink_p3::m_mcEvtIndex
unsigned short m_mcEvtIndex
index of the HepMC::GenEvent holding the HepMC::GenParticle we are pointing to.
Definition
HepMcParticleLink_p3.h:43
HepMcParticleLink_p3::m_truthSupp
char m_truthSupp
Definition
HepMcParticleLink_p3.h:49
HepMcParticleLink_p3::m_id
unsigned long m_id
id of the HepMC::GenParticle we are pointing to.
Definition
HepMcParticleLink_p3.h:46
HepMcParticleLink
a link optimized in size for a GenParticle in a McEventCollection
Definition
HepMcParticleLink.h:72
HepMcParticleLink::PositionFlag
PositionFlag
Definition
HepMcParticleLink.h:78
HepMcParticleLink::IS_POSITION
@ IS_POSITION
Definition
HepMcParticleLink.h:80
HepMcParticleLink::IS_EVENTNUM
@ IS_EVENTNUM
Definition
HepMcParticleLink.h:79
HepMcParticleLink::setExtendedBarCode
void setExtendedBarCode(const ExtendedBarCode &extBarcode)
Alter the persistent part of the link.
Definition
HepMcParticleLink.cxx:499
HepMcParticleLink::id
int id() const
Return the id of the target particle.
Definition
HepMcParticleLink.cxx:284
HepMcParticleLink::index_type
uint32_t index_type
Definition
HepMcParticleLink.h:75
HepMcParticleLink::getTruthSuppressionTypeAsChar
char getTruthSuppressionTypeAsChar() const
Return whether the truth particle has been suppressed, as a char ('a'..'b').
HepMcParticleLink::eventIndex
index_type eventIndex() const
Return the event number of the referenced GenEvent.
Definition
HepMcParticleLink.cxx:338
HepMcParticleLink::getEventPositionInCollection
static std::vector< index_type > getEventPositionInCollection(index_type index, IProxyDict *sg)
Return a vector of the positions in the McEventCollection of the GenEvent(s) with a given event numbe...
Definition
HepMcParticleLink.cxx:426
HepMcParticleLink::setTruthSuppressionType
void setTruthSuppressionType(EBC_SUPPRESSED_TRUTH truthSupp)
Return whether the truth particle has been suppressed.
IProxyDict
A proxy dictionary.
Definition
AthenaKernel/AthenaKernel/IProxyDict.h:48
Atlas::proxyDictFromEventContext
IProxyDict * proxyDictFromEventContext()
Return the IProxyDict for this thread's current context.
Definition
proxyDictFromEventContext.cxx:28
index
Definition
index.py:1
proxyDictFromEventContext.h
Some out-of-line helpers for ExtendedEventContext.
msg
MsgStream & msg
Definition
testRead.cxx:32
Generated on
for ATLAS Offline Software by
1.17.0