diff --git a/Calorimeter/CaloEventCnv/FaserCaloSimEventTPCnv/CMakeLists.txt b/Calorimeter/CaloEventCnv/FaserCaloSimEventTPCnv/CMakeLists.txt index dbbd1a372aa26fde66a58aee80ce3bf30f758812..ef770c2b59d440fe41bc1c63893f49ecd0d49439 100644 --- a/Calorimeter/CaloEventCnv/FaserCaloSimEventTPCnv/CMakeLists.txt +++ b/Calorimeter/CaloEventCnv/FaserCaloSimEventTPCnv/CMakeLists.txt @@ -22,5 +22,5 @@ atlas_add_dictionary( FaserCaloSimEventTPCnvDict FaserCaloSimEventTPCnv/CaloSimEventTPCnvDict.h FaserCaloSimEventTPCnv/selection.xml INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv FaserCaloSimEvent TestTools StoreGateLib SGtests Identifier FaserCaloSimEventTPCnv ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv FaserCaloSimEvent TestTools StoreGateLib SGtests Identifier FaserCaloSimEventTPCnv AthenaKernel) diff --git a/Calorimeter/CaloEventCnv/FaserCaloSimEventTPCnv/src/CaloHits/CaloHitCollectionCnv_p1.cxx b/Calorimeter/CaloEventCnv/FaserCaloSimEventTPCnv/src/CaloHits/CaloHitCollectionCnv_p1.cxx index c54f8765abfcbeda9b8c72b67717608c9c8b21ef..77d4262f78647661a678e02b4081199b25f6c10d 100644 --- a/Calorimeter/CaloEventCnv/FaserCaloSimEventTPCnv/src/CaloHits/CaloHitCollectionCnv_p1.cxx +++ b/Calorimeter/CaloEventCnv/FaserCaloSimEventTPCnv/src/CaloHits/CaloHitCollectionCnv_p1.cxx @@ -14,7 +14,10 @@ #include "CLHEP/Geometry/Point3D.h" // Gaudi #include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ThreadLocalContext.h" + // Athena +#include "AthenaKernel/ExtendedEventContext.h" #include "StoreGate/StoreGateSvc.h" // * * * stolen from eflowRec * * * // @@ -60,7 +63,7 @@ const double CaloHitCollectionCnv_p1::m_2bHalfMaximum = pow(2.0, 15.0); const int CaloHitCollectionCnv_p1::m_2bMaximum = (unsigned short)(-1); -void CaloHitCollectionCnv_p1::transToPers(const CaloHitCollection* transCont, CaloHitCollection_p1* persCont, MsgStream &/*log*/) +void CaloHitCollectionCnv_p1::transToPers(const CaloHitCollection* transCont, CaloHitCollection_p1* persCont, MsgStream &log) { // Finds hits belonging to a "string" (in which the end point of one hit is the same as the start point of the next) and // persistifies the end point of each hit plus the start point of the first hit in each string. @@ -77,6 +80,8 @@ void CaloHitCollectionCnv_p1::transToPers(const CaloHitCollection* transCont, Ca static const double dRcut = 1.0e-7; static const double dTcut = 1.0; + const EventContext& ctx = Gaudi::Hive::currentContext(); + const IProxyDict* proxy = Atlas::getExtendedEventContext(ctx).proxy(); const HepMcParticleLink * lastLink=nullptr; int lastId = -1; double stringFirstTheta = 0.0; @@ -98,11 +103,22 @@ void CaloHitCollectionCnv_p1::transToPers(const CaloHitCollection* transCont, Ca if ( !lastLink || (siHit->particleLink() != *lastLink) ) { - // store barcode once for set of consecutive hits with same barcode + // store barcode, eventIndex and McEventCollection once for set of consecutive hits with same barcode lastLink = &(siHit->particleLink()); persCont->m_barcode.push_back(lastLink->barcode()); - persCont->m_mcEvtIndex.push_back(lastLink->eventIndex()); + unsigned short index{0}; + const HepMcParticleLink::index_type position = + HepMcParticleLink::getEventPositionInCollection(lastLink->eventIndex(), + lastLink->getEventCollection(), + proxy).at(0); + if (position!=0) { + index = lastLink->eventIndex(); + if(lastLink->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) { + log << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg; + } + } + persCont->m_mcEvtIndex.push_back(index); persCont->m_evtColl.push_back(lastLink->getEventCollectionAsChar()); if (idx > 0) { @@ -250,6 +266,8 @@ CaloHitCollection* CaloHitCollectionCnv_p1::createTransient(const CaloHitCollect void CaloHitCollectionCnv_p1::persToTrans(const CaloHitCollection_p1* persCont, CaloHitCollection* transCont, MsgStream &/*log*/) { + const EventContext& ctx = Gaudi::Hive::currentContext(); + unsigned int hitCount = 0; unsigned int angleCount = 0; unsigned int idxBC = 0; @@ -299,7 +317,11 @@ void CaloHitCollectionCnv_p1::persToTrans(const CaloHitCollection_p1* persCont, HepGeom::Point3D<double> endThis( endLast + r ); - HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), HepMcParticleLink::IS_INDEX ); + HepMcParticleLink::PositionFlag flag = HepMcParticleLink::IS_INDEX; + if (persCont->m_mcEvtIndex[idxBC] == 0) { + flag = HepMcParticleLink::IS_POSITION; + } + HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), flag, ctx ); transCont->Emplace( endLast, endThis, eneLoss, meanTime, partLink, persCont->m_id[idxId]); endLast = endThis; diff --git a/Neutrino/NeutrinoEventCnv/NeutrinoSimEventTPCnv/CMakeLists.txt b/Neutrino/NeutrinoEventCnv/NeutrinoSimEventTPCnv/CMakeLists.txt index defef98b76adfaf00e4b4c1da37c685cee6e2d7c..332a16c77b33035a064668b13fe3fe41ad4061ff 100644 --- a/Neutrino/NeutrinoEventCnv/NeutrinoSimEventTPCnv/CMakeLists.txt +++ b/Neutrino/NeutrinoEventCnv/NeutrinoSimEventTPCnv/CMakeLists.txt @@ -22,5 +22,5 @@ atlas_add_dictionary( NeutrinoSimEventTPCnvDict NeutrinoSimEventTPCnv/NeutrinoSimEventTPCnvDict.h NeutrinoSimEventTPCnv/selection.xml INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv NeutrinoSimEvent TestTools StoreGateLib SGtests Identifier NeutrinoSimEventTPCnv ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv NeutrinoSimEvent TestTools StoreGateLib SGtests Identifier NeutrinoSimEventTPCnv AthenaKernel ) diff --git a/Neutrino/NeutrinoEventCnv/NeutrinoSimEventTPCnv/src/NeutrinoHits/NeutrinoHitCollectionCnv_p1.cxx b/Neutrino/NeutrinoEventCnv/NeutrinoSimEventTPCnv/src/NeutrinoHits/NeutrinoHitCollectionCnv_p1.cxx index 3b85676a61cd4235918207a9deb82659ed1bc5bc..444ad41777263c39b68a5e7a3cd613d787f25e32 100644 --- a/Neutrino/NeutrinoEventCnv/NeutrinoSimEventTPCnv/src/NeutrinoHits/NeutrinoHitCollectionCnv_p1.cxx +++ b/Neutrino/NeutrinoEventCnv/NeutrinoSimEventTPCnv/src/NeutrinoHits/NeutrinoHitCollectionCnv_p1.cxx @@ -14,7 +14,10 @@ #include "CLHEP/Geometry/Point3D.h" // Gaudi #include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ThreadLocalContext.h" + // Athena +#include "AthenaKernel/ExtendedEventContext.h" #include "StoreGate/StoreGateSvc.h" // * * * stolen from eflowRec * * * // @@ -60,7 +63,7 @@ const double NeutrinoHitCollectionCnv_p1::m_2bHalfMaximum = pow(2.0, 15.0); const int NeutrinoHitCollectionCnv_p1::m_2bMaximum = (unsigned short)(-1); -void NeutrinoHitCollectionCnv_p1::transToPers(const NeutrinoHitCollection* transCont, NeutrinoHitCollection_p1* persCont, MsgStream &/*log*/) +void NeutrinoHitCollectionCnv_p1::transToPers(const NeutrinoHitCollection* transCont, NeutrinoHitCollection_p1* persCont, MsgStream &log) { // Finds hits belonging to a "string" (in which the end point of one hit is the same as the start point of the next) and // persistifies the end point of each hit plus the start point of the first hit in each string. @@ -77,6 +80,8 @@ void NeutrinoHitCollectionCnv_p1::transToPers(const NeutrinoHitCollection* trans static const double dRcut = 1.0e-7; static const double dTcut = 1.0; + const EventContext& ctx = Gaudi::Hive::currentContext(); + const IProxyDict* proxy = Atlas::getExtendedEventContext(ctx).proxy(); const HepMcParticleLink * lastLink=nullptr; int lastId = -1; double stringFirstTheta = 0.0; @@ -102,7 +107,18 @@ void NeutrinoHitCollectionCnv_p1::transToPers(const NeutrinoHitCollection* trans lastLink = &(siHit->particleLink()); persCont->m_barcode.push_back(lastLink->barcode()); - persCont->m_mcEvtIndex.push_back(lastLink->eventIndex()); + unsigned short index{0}; + const HepMcParticleLink::index_type position = + HepMcParticleLink::getEventPositionInCollection(lastLink->eventIndex(), + lastLink->getEventCollection(), + proxy).at(0); + if (position!=0) { + index = lastLink->eventIndex(); + if(lastLink->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) { + log << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg; + } + } + persCont->m_mcEvtIndex.push_back(index); persCont->m_evtColl.push_back(lastLink->getEventCollectionAsChar()); if (idx > 0) { @@ -113,7 +129,7 @@ void NeutrinoHitCollectionCnv_p1::transToPers(const NeutrinoHitCollection* trans if ( (int)siHit->identify() != lastId ) { - // store id once for set of consecutive hits with same barcode + // store barcode, eventIndex and McEventCollection once for set of consecutive hits with same barcode lastId = siHit->identify(); persCont->m_id.push_back(lastId); @@ -250,6 +266,8 @@ NeutrinoHitCollection* NeutrinoHitCollectionCnv_p1::createTransient(const Neutri void NeutrinoHitCollectionCnv_p1::persToTrans(const NeutrinoHitCollection_p1* persCont, NeutrinoHitCollection* transCont, MsgStream &/*log*/) { + const EventContext& ctx = Gaudi::Hive::currentContext(); + unsigned int hitCount = 0; unsigned int angleCount = 0; unsigned int idxBC = 0; @@ -299,7 +317,11 @@ void NeutrinoHitCollectionCnv_p1::persToTrans(const NeutrinoHitCollection_p1* pe HepGeom::Point3D<double> endThis( endLast + r ); - HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), HepMcParticleLink::IS_INDEX ); + HepMcParticleLink::PositionFlag flag = HepMcParticleLink::IS_INDEX; + if (persCont->m_mcEvtIndex[idxBC] == 0) { + flag = HepMcParticleLink::IS_POSITION; + } + HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), flag, ctx ); transCont->Emplace( endLast, endThis, eneLoss, meanTime, partLink, persCont->m_id[idxId]); endLast = endThis; diff --git a/Scintillator/ScintEventCnv/ScintSimEventTPCnv/CMakeLists.txt b/Scintillator/ScintEventCnv/ScintSimEventTPCnv/CMakeLists.txt index 89c0c08d0204d449808531439e227498cc824a1a..04ca202da817c0f95b4942bfc62b4c5159a47679 100644 --- a/Scintillator/ScintEventCnv/ScintSimEventTPCnv/CMakeLists.txt +++ b/Scintillator/ScintEventCnv/ScintSimEventTPCnv/CMakeLists.txt @@ -22,5 +22,5 @@ atlas_add_dictionary( ScintSimEventTPCnvDict ScintSimEventTPCnv/ScintSimEventTPCnvDict.h ScintSimEventTPCnv/selection.xml INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv ScintSimEvent TestTools StoreGateLib SGtests Identifier ScintSimEventTPCnv ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv ScintSimEvent TestTools StoreGateLib SGtests Identifier ScintSimEventTPCnv AthenaKernel ) diff --git a/Scintillator/ScintEventCnv/ScintSimEventTPCnv/src/ScintHits/ScintHitCollectionCnv_p1.cxx b/Scintillator/ScintEventCnv/ScintSimEventTPCnv/src/ScintHits/ScintHitCollectionCnv_p1.cxx index 08e4c55e910be26cd47735c49a11bcebad82f446..42b4160a2176e95919d5930140c5abcd7c0e8dfb 100644 --- a/Scintillator/ScintEventCnv/ScintSimEventTPCnv/src/ScintHits/ScintHitCollectionCnv_p1.cxx +++ b/Scintillator/ScintEventCnv/ScintSimEventTPCnv/src/ScintHits/ScintHitCollectionCnv_p1.cxx @@ -14,7 +14,10 @@ #include "CLHEP/Geometry/Point3D.h" // Gaudi #include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ThreadLocalContext.h" + // Athena +#include "AthenaKernel/ExtendedEventContext.h" #include "StoreGate/StoreGateSvc.h" // * * * stolen from eflowRec * * * // @@ -60,7 +63,7 @@ const double ScintHitCollectionCnv_p1::m_2bHalfMaximum = pow(2.0, 15.0); const int ScintHitCollectionCnv_p1::m_2bMaximum = (unsigned short)(-1); -void ScintHitCollectionCnv_p1::transToPers(const ScintHitCollection* transCont, ScintHitCollection_p1* persCont, MsgStream &/*log*/) +void ScintHitCollectionCnv_p1::transToPers(const ScintHitCollection* transCont, ScintHitCollection_p1* persCont, MsgStream &log) { // Finds hits belonging to a "string" (in which the end point of one hit is the same as the start point of the next) and // persistifies the end point of each hit plus the start point of the first hit in each string. @@ -77,6 +80,8 @@ void ScintHitCollectionCnv_p1::transToPers(const ScintHitCollection* transCont, static const double dRcut = 1.0e-7; static const double dTcut = 1.0; + const EventContext& ctx = Gaudi::Hive::currentContext(); + const IProxyDict* proxy = Atlas::getExtendedEventContext(ctx).proxy(); const HepMcParticleLink * lastLink=nullptr; int lastId = -1; double stringFirstTheta = 0.0; @@ -98,11 +103,22 @@ void ScintHitCollectionCnv_p1::transToPers(const ScintHitCollection* transCont, if ( !lastLink || (siHit->particleLink() != *lastLink) ) { - // store barcode once for set of consecutive hits with same barcode + // store barcode, eventIndex and McEventCollection once for set of consecutive hits with same barcode lastLink = &(siHit->particleLink()); persCont->m_barcode.push_back(lastLink->barcode()); - persCont->m_mcEvtIndex.push_back(lastLink->eventIndex()); + unsigned short index{0}; + const HepMcParticleLink::index_type position = + HepMcParticleLink::getEventPositionInCollection(lastLink->eventIndex(), + lastLink->getEventCollection(), + proxy).at(0); + if (position!=0) { + index = lastLink->eventIndex(); + if(lastLink->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) { + log << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg; + } + } + persCont->m_mcEvtIndex.push_back(index); persCont->m_evtColl.push_back(lastLink->getEventCollectionAsChar()); if (idx > 0) { @@ -250,6 +266,8 @@ ScintHitCollection* ScintHitCollectionCnv_p1::createTransient(const ScintHitColl void ScintHitCollectionCnv_p1::persToTrans(const ScintHitCollection_p1* persCont, ScintHitCollection* transCont, MsgStream &/*log*/) { + const EventContext& ctx = Gaudi::Hive::currentContext(); + unsigned int hitCount = 0; unsigned int angleCount = 0; unsigned int idxBC = 0; @@ -299,7 +317,11 @@ void ScintHitCollectionCnv_p1::persToTrans(const ScintHitCollection_p1* persCont HepGeom::Point3D<double> endThis( endLast + r ); - HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), HepMcParticleLink::IS_INDEX ); + HepMcParticleLink::PositionFlag flag = HepMcParticleLink::IS_INDEX; + if (persCont->m_mcEvtIndex[idxBC] == 0) { + flag = HepMcParticleLink::IS_POSITION; + } + HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), flag, ctx ); transCont->Emplace( endLast, endThis, eneLoss, meanTime, partLink, persCont->m_id[idxId]); endLast = endThis; diff --git a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/CMakeLists.txt b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/CMakeLists.txt index f18b094587235a28640989f322dd66b1a65d284b..7e51dca0f68d6ec72f510b641c9ab535094db6ba 100644 --- a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/CMakeLists.txt +++ b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/CMakeLists.txt @@ -22,5 +22,5 @@ atlas_add_dictionary( TrackerSimEventTPCnvDict TrackerSimEventTPCnv/TrackerSimEventTPCnvDict.h TrackerSimEventTPCnv/selection.xml INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv TrackerSimEvent TestTools StoreGateLib SGtests Identifier TrackerSimEventTPCnv ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv TrackerSimEvent TestTools StoreGateLib SGtests Identifier TrackerSimEventTPCnv AthenaKernel ) diff --git a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/src/TrackerHits/FaserSiHitCollectionCnv_p3.cxx b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/src/TrackerHits/FaserSiHitCollectionCnv_p3.cxx index e8c9549040bca63195e340694c1114371e8f0259..ee4b293a83af7fbb970f12a48d63ce67285e476d 100644 --- a/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/src/TrackerHits/FaserSiHitCollectionCnv_p3.cxx +++ b/Tracker/TrackerEventCnv/TrackerSimEventTPCnv/src/TrackerHits/FaserSiHitCollectionCnv_p3.cxx @@ -14,8 +14,12 @@ #include "CLHEP/Geometry/Point3D.h" // Gaudi #include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/ThreadLocalContext.h" + // Athena #include "StoreGate/StoreGateSvc.h" +#include "AthenaKernel/ExtendedEventContext.h" + // * * * stolen from eflowRec * * * // inline double phicorr(double a) @@ -60,7 +64,7 @@ const double FaserSiHitCollectionCnv_p3::m_2bHalfMaximum = pow(2.0, 15.0); const int FaserSiHitCollectionCnv_p3::m_2bMaximum = (unsigned short)(-1); -void FaserSiHitCollectionCnv_p3::transToPers(const FaserSiHitCollection* transCont, FaserSiHitCollection_p3* persCont, MsgStream &/*log*/) +void FaserSiHitCollectionCnv_p3::transToPers(const FaserSiHitCollection* transCont, FaserSiHitCollection_p3* persCont, MsgStream &log) { // Finds hits belonging to a "string" (in which the end point of one hit is the same as the start point of the next) and // persistifies the end point of each hit plus the start point of the first hit in each string. @@ -77,6 +81,8 @@ void FaserSiHitCollectionCnv_p3::transToPers(const FaserSiHitCollection* transCo static const double dRcut = 1.0e-7; static const double dTcut = 1.0; + const EventContext& ctx = Gaudi::Hive::currentContext(); + const IProxyDict* proxy = Atlas::getExtendedEventContext(ctx).proxy(); const HepMcParticleLink * lastLink=nullptr; int lastId = -1; double stringFirstTheta = 0.0; @@ -98,11 +104,22 @@ void FaserSiHitCollectionCnv_p3::transToPers(const FaserSiHitCollection* transCo if ( !lastLink || (siHit->particleLink() != *lastLink) ) { - // store barcode once for set of consecutive hits with same barcode + // store barcode, eventIndex and McEventCollection once for set of consecutive hits with same barcode lastLink = &(siHit->particleLink()); persCont->m_barcode.push_back(lastLink->barcode()); - persCont->m_mcEvtIndex.push_back(lastLink->eventIndex()); + unsigned short index{0}; + const HepMcParticleLink::index_type position = + HepMcParticleLink::getEventPositionInCollection(lastLink->eventIndex(), + lastLink->getEventCollection(), + proxy).at(0); + if (position!=0) { + index = lastLink->eventIndex(); + if(lastLink->eventIndex()!=static_cast<HepMcParticleLink::index_type>(index)) { + log << MSG::WARNING << "Attempting to persistify an eventIndex larger than max unsigned short!" << endmsg; + } + } + persCont->m_mcEvtIndex.push_back(index); persCont->m_evtColl.push_back(lastLink->getEventCollectionAsChar()); if (idx > 0) { @@ -250,6 +267,8 @@ FaserSiHitCollection* FaserSiHitCollectionCnv_p3::createTransient(const FaserSiH void FaserSiHitCollectionCnv_p3::persToTrans(const FaserSiHitCollection_p3* persCont, FaserSiHitCollection* transCont, MsgStream &/*log*/) { + const EventContext& ctx = Gaudi::Hive::currentContext(); + unsigned int hitCount = 0; unsigned int angleCount = 0; unsigned int idxBC = 0; @@ -299,7 +318,11 @@ void FaserSiHitCollectionCnv_p3::persToTrans(const FaserSiHitCollection_p3* pers HepGeom::Point3D<double> endThis( endLast + r ); - HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), HepMcParticleLink::IS_INDEX ); + HepMcParticleLink::PositionFlag flag = HepMcParticleLink::IS_INDEX; + if (persCont->m_mcEvtIndex[idxBC] == 0) { + flag = HepMcParticleLink::IS_POSITION; + } + HepMcParticleLink partLink( persCont->m_barcode[idxBC], persCont->m_mcEvtIndex[idxBC], HepMcParticleLink::ExtendedBarCode::eventCollectionFromChar(persCont->m_evtColl[idxBC]), flag, ctx ); transCont->Emplace( endLast, endThis, eneLoss, meanTime, partLink, persCont->m_id[idxId]); endLast = endThis;