diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/CMakeLists.txt b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/CMakeLists.txt index a7113ffef66d964923a7c4f457c60dd839f1a47c..3e7ed631af46a8533cb00bf14b794f5b5133b462 100644 --- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( InDetEventAthenaPool ) @@ -11,7 +11,7 @@ atlas_add_library( InDetEventAthenaPool AthenaBaseComps AthenaKernel SGTools StoreGateLib AthenaPoolCnvSvcLib AthenaPoolUtilities GaudiKernel InDetIdentifier InDetReadoutGeometry TRT_ReadoutGeometry InDetEventTPCnv InDetRawData InDetSimData - InDetLowBetaInfo InDetPrepRawData SCT_ConditionsData TrkTrack ) + InDetLowBetaInfo InDetPrepRawData SCT_ConditionsData TrkTrack ) atlas_add_poolcnv_library( InDetEventAthenaPoolPoolCnv FILES InDetRawData/PixelRDO_Container.h InDetRawData/SCT_RDO_Container.h @@ -55,6 +55,7 @@ foreach( name InDetSimDataCollectionCnv_p1_test InDetSimDataCollectionCnv_p2_test InDetSimDataCollectionCnv_p3_test + InDetSimDataCollectionCnv_p4_test TRT_LoLumRawDataContainerCnv_p1_test TRT_LoLumRawDataContainerCnv_p2_test TRT_LoLumRawDataContainerCnv_p3_test ) @@ -62,7 +63,7 @@ foreach( name atlas_add_test( ${name} SOURCES test/${name}.cxx LINK_LIBRARIES - AtlasHepMCLib IdDict IdDictParser InDetEventAthenaPool TestTools CxxUtils + AtlasHepMCLib IdDict IdDictParser InDetEventAthenaPool TruthUtils TestTools CxxUtils ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/share" POST_EXEC_SCRIPT nopost.sh ) set_target_properties ( InDetEventAthenaPool_${name} PROPERTIES ENABLE_EXPORTS True ) diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetEventAthenaPoolCnvDict.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetEventAthenaPoolCnvDict.h index c906216533e98f09ebafc1ac21bbe39402724441..7d7c57566a95f3d0983e12433c530da6ae1629f8 100644 --- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetEventAthenaPoolCnvDict.h +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetEventAthenaPoolCnvDict.h @@ -1,15 +1,17 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#ifndef INDETEVENTATHENAPOOLDICT_H -#define INDETEVENTATHENAPOOLDICT_H +#ifndef INDETEVENTATHENAPOOL_INDETEVENTATHENAPOOLDICT_H +#define INDETEVENTATHENAPOOL_INDETEVENTATHENAPOOLDICT_H #include "InDetEventAthenaPool/InDetSimData_p1.h" #include "InDetEventAthenaPool/InDetSimData_p2.h" +#include "InDetEventAthenaPool/InDetSimData_p3.h" #include "InDetEventAthenaPool/InDetSimDataCollection_p1.h" #include "InDetEventAthenaPool/InDetSimDataCollection_p2.h" #include "InDetEventAthenaPool/InDetSimDataCollection_p3.h" +#include "InDetEventAthenaPool/InDetSimDataCollection_p4.h" #include "InDetEventAthenaPool/InDetRawData_p1.h" #include "InDetEventAthenaPool/SCT3_RawData_p1.h" #include "InDetEventAthenaPool/SCT3_RawData_p2.h" @@ -31,6 +33,7 @@ namespace InDetEventAthenaPoolCnvDict std::pair<unsigned long long, InDetSimData_p2> t2; std::vector<std::pair<unsigned int, InDetSimData_p2> > t3; std::vector<std::pair<unsigned long long, InDetSimData_p2> > t4; + std::vector<std::pair<unsigned long long, InDetSimData_p3> > t5; } -#endif +#endif // INDETEVENTATHENAPOOL_INDETEVENTATHENAPOOLDICT_H diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetSimDataCollection_p4.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetSimDataCollection_p4.h new file mode 100644 index 0000000000000000000000000000000000000000..fcf4fefbd6a826da0b55e64e639495f37c54992d --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetSimDataCollection_p4.h @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef INDETEVENTATHENAPOOL_INDETSIMDATACOLLECTION_P4_H +#define INDETEVENTATHENAPOOL_INDETSIMDATACOLLECTION_P4_H + +#include <vector> +#include <utility> +#include "InDetEventAthenaPool/InDetSimData_p3.h" +#include "Identifier/Identifier.h" + +class InDetSimDataCollection_p4 +{ + + +public: + + InDetSimDataCollection_p4() + { } ; + + // container cnv does conversion + friend class InDetSimDataCollectionCnv_p4; + +private: + std::vector<std::pair<Identifier::value_type, InDetSimData_p3> > m_simdata; +}; + +#endif // INDETEVENTATHENAPOOL_INDETSIMDATA_P4_H diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetSimData_p3.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetSimData_p3.h new file mode 100644 index 0000000000000000000000000000000000000000..8dfbb9feea995ac4d26182f4fdb0fa739b097e57 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/InDetSimData_p3.h @@ -0,0 +1,22 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef INDETEVENTATHENAPOOL_INDETSIMDATA_P3_H +#define INDETEVENTATHENAPOOL_INDETSIMDATA_P3_H + +#include <vector> +#include "GeneratorObjectsTPCnv/HepMcParticleLink_p3.h" + +class InDetSimData_p3 { + public: + InDetSimData_p3():m_word(0), m_links{}, m_enDeposits{} {}; +// List of Cnv classes that convert this into SimData objects + friend class InDetSimDataCnv_p3; + private: + unsigned int m_word; // sim data word + std::vector<HepMcParticleLink_p3> m_links; // HepMCPLs + std::vector<float> m_enDeposits; // energy deposits +}; + +#endif // INDETEVENTATHENAPOOL_INDETSIMDATA_P3_H diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/selection.xml b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/selection.xml index 6ec53a8d40f7e8878ac8493e3df70673a999c14b..3c18a1e888ac0315ae9fff69fc2562ddfd50a060 100644 --- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/selection.xml +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/InDetEventAthenaPool/selection.xml @@ -11,9 +11,13 @@ <class name="std::vector<std::pair<unsigned int, InDetSimData_p2> >" /> <class pattern="std::*pair*<unsigned long long, InDetSimData_p2>" /> <class name="std::vector<std::pair<unsigned long long, InDetSimData_p2> >" /> + <class name="InDetSimData_p3" /> + <class pattern="std::*pair*<unsigned long long, InDetSimData_p3>" /> + <class name="std::vector<std::pair<unsigned long long, InDetSimData_p3> >" /> <class name="InDetSimDataCollection_p1" id="333EF996-1672-4AB8-917D-187F908F1EDE" /> <class name="InDetSimDataCollection_p2" id="C648CA66-013D-44AC-B0D9-99BFB0060E84" /> <class name="InDetSimDataCollection_p3" id="1430AA7B-EE92-5A41-92F3-5DD5367D6BAA" /> + <class name="InDetSimDataCollection_p4" id="018E50BB-B807-75F9-828A-890C9AD1F7CB" /> <class name="InDetRawData_p1" /> <class name="InDetRawData_p2" /> <class name="SCT3_RawData_p1" /> diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCnv_p3.cxx b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCnv_p3.cxx new file mode 100644 index 0000000000000000000000000000000000000000..b4844a7185380e21916ab6db0557a2d5fcdd8536 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCnv_p3.cxx @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#include "InDetSimData/InDetSimData.h" +#include "MsgUtil.h" + +// Persistent class and converter header file +#include "InDetEventAthenaPool/InDetSimData_p3.h" +#include "InDetSimDataCnv_p3.h" +#include "AthenaBaseComps/AthMessaging.h" + + +using depositIterator = std::vector<InDetSimData::Deposit>::const_iterator; + +InDetSimDataCnv_p3::InDetSimDataCnv_p3() + : m_sg(nullptr) +{ +} + + +void +InDetSimDataCnv_p3::persToTrans(const InDetSimData_p3* persObj, InDetSimData* transObj, MsgStream &log) +{ + MSG_VERBOSE(log,"InDetSimDataCnv_p3::persToTrans called "); + std::vector<InDetSimData::Deposit> deposits; + const unsigned int ndeposits = persObj->m_enDeposits.size(); + deposits.reserve( ndeposits ); + for (unsigned int icount=0; icount < ndeposits; icount++) { + HepMcParticleLink mcLink (m_sg); + HepMcPLCnv.persToTrans(&(persObj->m_links[icount]),&mcLink, log); + deposits.emplace_back (mcLink, persObj->m_enDeposits[icount]); + } + + *transObj = InDetSimData (std::move(deposits), + persObj->m_word); +} + +void +InDetSimDataCnv_p3::transToPers(const InDetSimData* transObj, InDetSimData_p3* persObj, MsgStream &log) +{ + MSG_VERBOSE(log,"InDetSimDataCnv_p3::transToPers called "); + HepMcParticleLinkCnv_p3 HepMcPLCnv; + + persObj->m_word = transObj->word(); + const std::vector<InDetSimData::Deposit> &dep(transObj->getdeposits()); + const unsigned int ndeposits = dep.size(); + persObj->m_links.resize(ndeposits); + persObj->m_enDeposits.resize(ndeposits); + for (unsigned int icount(0); icount < ndeposits; ++icount) { + HepMcPLCnv.transToPers(&(dep[icount].first), &(persObj->m_links[icount]), log); + persObj->m_enDeposits[icount] = dep[icount].second; + } +} + +void InDetSimDataCnv_p3::setCurrentStore (IProxyDict* store) +{ + m_sg = store; +} diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCnv_p3.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCnv_p3.h new file mode 100644 index 0000000000000000000000000000000000000000..334de0638382578d9693fb8a0561596a1858bb26 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCnv_p3.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef INDETEVENTATHENAPOOL_INDETSIMDATACNV_P3_H +#define INDETEVENTATHENAPOOL_INDETSIMDATACNV_P3_H + +/* + Transient/Persistent converter for InDetSimData class + Author: Davide Costanzo +*/ + +#include "InDetSimData/InDetSimData.h" +#include "InDetEventAthenaPool/InDetSimData_p3.h" + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p3.h" + +class MsgStream; +class IProxyDict; + +class InDetSimDataCnv_p3 : public T_AthenaPoolTPCnvBase<InDetSimData, InDetSimData_p3> +{ +public: + + InDetSimDataCnv_p3(); + virtual void persToTrans(const InDetSimData_p3* persObj, InDetSimData* transObj, MsgStream &log); + virtual void transToPers(const InDetSimData* transObj, InDetSimData_p3* persObj, MsgStream &log); + void setCurrentStore (IProxyDict* store); + +private: + IProxyDict* m_sg; + HepMcParticleLinkCnv_p3 HepMcPLCnv; +}; + + +#endif // INDETEVENTATHENAPOOL_INDETSIMDATACNV_P3_H + + diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv.cxx b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv.cxx index 67faf6afcfc8c2b384baf415397f0d1a7c7fe942..747c15ff9b19819c4bba36b737bb5bbdec2c9be6 100644 --- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv.cxx +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv.cxx @@ -1,8 +1,12 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "InDetSimDataCollectionCnv.h" +#include "InDetSimDataCollectionCnv_p1.h" +#include "InDetSimDataCollectionCnv_p2.h" +#include "InDetSimDataCollectionCnv_p3.h" +#include "InDetSimDataCollectionCnv_p4.h" InDetSimDataCollection_PERS* InDetSimDataCollectionCnv::createPersistent(InDetSimDataCollection* transCont) { @@ -18,14 +22,20 @@ InDetSimDataCollection* InDetSimDataCollectionCnv::createTransient() { InDetSimDataCollectionCnv_p1 converter_p1; InDetSimDataCollectionCnv_p2 converter_p2; InDetSimDataCollectionCnv_p3 converter_p3; + InDetSimDataCollectionCnv_p4 converter_p4; InDetSimDataCollection *trans_cont(nullptr); + static const pool::Guid p4_guid("018E50BB-B807-75F9-828A-890C9AD1F7CB"); static const pool::Guid p3_guid("1430AA7B-EE92-5A41-92F3-5DD5367D6BAA"); static const pool::Guid p2_guid("C648CA66-013D-44AC-B0D9-99BFB0060E84"); static const pool::Guid p1_guid("333EF996-1672-4AB8-917D-187F908F1EDE"); static const pool::Guid old_guid("5A50C32E-C036-4A49-AE97-716D53210BE1"); - if( this->compareClassGuid(p3_guid)) { + if( this->compareClassGuid(p4_guid)) { + std::unique_ptr< InDetSimDataCollection_p4 > col_vect( this->poolReadObject< InDetSimDataCollection_p4 >() ); + trans_cont = converter_p4.createTransient( col_vect.get(), mlog ); + } + else if( this->compareClassGuid(p3_guid)) { std::unique_ptr< InDetSimDataCollection_p3 > col_vect( this->poolReadObject< InDetSimDataCollection_p3 >() ); trans_cont = converter_p3.createTransient( col_vect.get(), mlog ); } diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv.h index 478a44d21f8a1c38da0ae12b1a88843681e62163..6d689bfe3fc3ac60d0b48fb5e4a08aa22629df78 100644 --- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv.h +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv.h @@ -1,16 +1,17 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -#ifndef INDETSIMDATACOLLECTIONCNV_H -#define INDETSIMDATACOLLECTIONCNV_H - +#ifndef INDETEVENTATHENAPOOL_INDETSIMDATACOLLECTIONCNV_H +#define INDETEVENTATHENAPOOL_INDETSIMDATACOLLECTIONCNV_H + #include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" - + #include "InDetSimData/InDetSimDataCollection.h" #include "InDetSimDataCollectionCnv_p1.h" #include "InDetSimDataCollectionCnv_p2.h" #include "InDetSimDataCollectionCnv_p3.h" +#include "InDetSimDataCollectionCnv_p4.h" // Gaudi #include "GaudiKernel/MsgStream.h" @@ -18,12 +19,12 @@ typedef InDetSimDataCollection_p3 InDetSimDataCollection_PERS; typedef InDetSimDataCollectionCnv_p3 InDetSimDataCollectionCnv_PERS; -// base class +// base class typedef T_AthenaPoolCustomCnv<InDetSimDataCollection, InDetSimDataCollection_PERS > InDetSimDataCollectionCnvBase; class InDetSimDataCollectionCnv : public InDetSimDataCollectionCnvBase { friend class CnvFactory<InDetSimDataCollectionCnv >; - + protected: public: InDetSimDataCollectionCnv (ISvcLocator* svcloc) : InDetSimDataCollectionCnvBase(svcloc) {} @@ -31,6 +32,5 @@ protected: virtual InDetSimDataCollection_PERS* createPersistent (InDetSimDataCollection* transCont); virtual InDetSimDataCollection* createTransient (); }; - -#endif +#endif // INDETEVENTATHENAPOOL_INDETSIMDATACOLLECTIONCNV_H diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv_p4.cxx b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv_p4.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e77ca00627d69df9ca178204469fc281b442d6f6 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv_p4.cxx @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#include "InDetSimData/InDetSimData.h" +#include "InDetSimData/InDetSimDataCollection.h" +#include "InDetEventAthenaPool/InDetSimDataCollection_p4.h" +#include "InDetSimDataCollectionCnv_p4.h" +#include "InDetSimDataCnv_p3.h" +#include "Identifier/Identifier.h" +#include "SGTools/CurrentEventStore.h" +#include "MsgUtil.h" + +void InDetSimDataCollectionCnv_p4::transToPers(const InDetSimDataCollection* transCont, InDetSimDataCollection_p4* persCont, MsgStream &log) +{ + InDetSimDataCnv_p3 simDataCnv; + persCont->m_simdata.resize(transCont->size()); + MSG_DEBUG(log," Preparing " << persCont->m_simdata.size() << "Collections"); + unsigned int collIndex(0); + for (const auto& transSimDataPair : *transCont) { + // Add in new collection + (persCont->m_simdata[collIndex]).first = transSimDataPair.first.get_compact(); + const InDetSimData& simData = transSimDataPair.second; + InDetSimData_p3& psimData = persCont->m_simdata[collIndex].second; + simDataCnv.transToPers(&simData,&psimData,log); + ++collIndex; + } + MSG_DEBUG(log," *** Writing InDetSimdataCollection"); +} + +void InDetSimDataCollectionCnv_p4::persToTrans(const InDetSimDataCollection_p4* persCont, InDetSimDataCollection* transCont, MsgStream &log) +{ + InDetSimDataCnv_p3 simDataCnv; + MSG_DEBUG(log," Preparing " << persCont->m_simdata.size() << "Collections"); + simDataCnv.setCurrentStore (SG::CurrentEventStore::store()); + for (const auto& persSimDataPair : persCont->m_simdata) { + // Add in new collection + const InDetSimData_p3& psimData = persSimDataPair.second; + InDetSimData simData; + simDataCnv.persToTrans(&psimData,&simData,log); + transCont->insert( transCont->end(), std :: make_pair( Identifier( persSimDataPair.first ), simData ) ); + } + MSG_DEBUG(log," *** Reading InDetSimdataCollection"); +} + + diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv_p4.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv_p4.h new file mode 100644 index 0000000000000000000000000000000000000000..9e9cbb750eecda4eec9e949707619615b0322f40 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetSimDataCollectionCnv_p4.h @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef INDETEVENTATHENAPOOL_INDETSIMDATACOLLECTIONCNV_P4_H +#define INDETEVENTATHENAPOOL_INDETSIMDATACOLLECTIONCNV_P4_H + +// INDetSimDataCollectionCnv_p4, T/P separation of InDetSimData +// author D.Costanzo <davide.costanzo@cern.ch>,O.Arnaez <olivier.arnaez@cern.ch> + +#include "InDetSimData/InDetSimDataCollection.h" +#include "InDetEventAthenaPool/InDetSimDataCollection_p4.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + + +class InDetSimDataCollectionCnv_p4 : public T_AthenaPoolTPCnvBase<InDetSimDataCollection, InDetSimDataCollection_p4> +{ +public: + InDetSimDataCollectionCnv_p4() {}; + + virtual void persToTrans(const InDetSimDataCollection_p4* persCont, + InDetSimDataCollection* transCont, + MsgStream &log) ; + virtual void transToPers(const InDetSimDataCollection* transCont, + InDetSimDataCollection_p4* persCont, + MsgStream &log) ; + +}; + +#endif // INDETEVENTATHENAPOOL_INDETSIMDATACOLLECTIONCNV_P4_H diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_common_test.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_common_test.h index 62c7fb148b7e4839ba742c635ef90efe4c01232b..148bb0e88dd33b2c47a418d24fd5a1854049560f 100644 --- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_common_test.h +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_common_test.h @@ -16,6 +16,7 @@ #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" #include "AtlasHepMC/Operators.h" +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "InDetIdentifier/PixelID.h" #include "IdDictParser/IdDictParser.h" @@ -95,7 +96,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr>& genPartVec std::cout << "test1\n"; auto particle = genPartVector.at(0); // Create HepMcParticleLink outside of leak check. - HepMcParticleLink dummyHMPL(HepMC::barcode(particle), particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle), particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); Athena_test::Leakcheck check; @@ -103,11 +104,11 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr>& genPartVec // Assumme genPartVector is filled by Athena_test::initMcEventCollection. Do not check the vector size. for (int i=0; i<3; i++) { std::vector<InDetSimData::Deposit> deps; - HepMcParticleLink trkLink1(HepMC::barcode(genPartVector.at(0+(3*i))), genPartVector.at(0+(3*i))->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); + HepMcParticleLink trkLink1(HepMC::uniqueID(genPartVector.at(0+(3*i))), genPartVector.at(0+(3*i))->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); deps.emplace_back(trkLink1, 2.5+i); - HepMcParticleLink trkLink2(HepMC::barcode(genPartVector.at(1+(3*i))), genPartVector.at(1+(3*i))->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); + HepMcParticleLink trkLink2(HepMC::uniqueID(genPartVector.at(1+(3*i))), genPartVector.at(1+(3*i))->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); deps.emplace_back(trkLink2, 13.5+i); - HepMcParticleLink trkLink3(HepMC::barcode(genPartVector.at(2+(3*i))), genPartVector.at(2+(3*i))->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); + HepMcParticleLink trkLink3(HepMC::uniqueID(genPartVector.at(2+(3*i))), genPartVector.at(2+(3*i))->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); deps.emplace_back(trkLink3, 23.5+i); trans1[Identifier(1234+i)] = InDetSimData(deps, 4321+i); diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p4_test.cxx b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p4_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..cd2d63705d8189632fd06be9692d615a717b0402 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p4_test.cxx @@ -0,0 +1,22 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +/** + * @file InDetEventAthenaPool/test/InDetSimDataCollectionCnv_p4_test.cxx + * @author Susumu Oda <Susumu.Oda@cern.ch> + * @date 2020-05-22 + * @brief Regression tests. + */ + +#undef NDEBUG + +#include "../src/InDetSimDataCollectionCnv_p4.h" + +#include "InDetSimDataCollectionCnv_common_test.h" + + +int main ATLAS_NOT_THREAD_SAFE () +{ + return commonMain<InDetSimDataCollectionCnv_p4, InDetSimDataCollection_p4>(); +}