diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/CSCSimHitCollectionCnv.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/CSCSimHitCollectionCnv.cxx index 52e4146acc4447aaa7727d21bdb115e68457cebb..06eb83b8eac5f1c26147fb5ba6e1da67fbbffe1d 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/CSCSimHitCollectionCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/CSCSimHitCollectionCnv.cxx @@ -1,5 +1,5 @@ /* - 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 "CSCSimHitCollectionCnv.h" @@ -15,6 +15,7 @@ #include "MuonSimEventTPCnv/CSCSimHitCollection_p1.h" #include "MuonSimEventTPCnv/CSCSimHitCollection_p2.h" #include "MuonSimEventTPCnv/CSCSimHitCollection_p3.h" +#include "MuonSimEventTPCnv/CSCSimHitCollection_p4.h" #include "HitManagement/AthenaHitsVector.h" //for back-compatibility @@ -35,29 +36,29 @@ CSCSimHitCollection_PERS* CSCSimHitCollectionCnv::createPersistent (CSCSimHit CSCSimHitCollection* CSCSimHitCollectionCnv::createTransient() { MsgStream log(msgSvc(), "CSCSimHitCollectionCnv" ); static const pool::Guid p0_guid("DC744F9B-078A-4C61-B03F-D035D885B559"); // before t/p split - static const pool::Guid p1_guid("E45CD293-4599-41BE-8B65-945A18F41AB7"); + static const pool::Guid p1_guid("E45CD293-4599-41BE-8B65-945A18F41AB7"); static const pool::Guid p2_guid("7E5A120C-E64F-4519-A24B-B485A58724BF"); static const pool::Guid p3_guid("6BFFE81C-C99E-43D9-B06F-1A998C3B3E40"); + static const pool::Guid p4_guid("018E2DAC-18EB-71D2-A246-66F818B3681B"); if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): main converter"<<endmsg; CSCSimHitCollection* p_collection(nullptr); - if( compareClassGuid(p3_guid) ) { + if( compareClassGuid(p4_guid) ) { + if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 4 detected"<<endmsg; + std::unique_ptr< Muon::CSCSimHitCollection_p4 > col_vect( this->poolReadObject< Muon::CSCSimHitCollection_p4 >() ); + p_collection = m_TPConverter_p4.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p3_guid) ) { if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 3 detected"<<endmsg; - // poolReadObject< CSCSimHitCollection_PERS >( m_TPConverter ); - // p_collection = m_TPConverter.createTransient( log ); std::unique_ptr< Muon::CSCSimHitCollection_p3 > col_vect( this->poolReadObject< Muon::CSCSimHitCollection_p3 >() ); p_collection = m_TPConverter_p3.createTransient( col_vect.get(), log ); } else if( compareClassGuid(p2_guid) ) { if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 2 detected"<<endmsg; - // poolReadObject< CSCSimHitCollection_PERS >( m_TPConverter ); - // p_collection = m_TPConverter.createTransient( log ); std::unique_ptr< Muon::CSCSimHitCollection_p2 > col_vect( this->poolReadObject< Muon::CSCSimHitCollection_p2 >() ); p_collection = m_TPConverter_p2.createTransient( col_vect.get(), log ); } else if( compareClassGuid(p1_guid) ) { if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 1 detected"<<endmsg; - // poolReadObject< CSCSimHitCollection_PERS >( m_TPConverter ); - // p_collection = m_TPConverter.createTransient( log ); std::unique_ptr< Muon::CSCSimHitCollection_p1 > col_vect( this->poolReadObject< Muon::CSCSimHitCollection_p1 >() ); p_collection = m_TPConverter.createTransient( col_vect.get(), log ); } @@ -68,9 +69,9 @@ CSCSimHitCollection* CSCSimHitCollectionCnv::createTransient() { size_t size = oldColl->size(); p_collection=new CSCSimHitCollection("DefaultCollectionName",size); p_collection->reserve(size); - //do the copy + //do the copy for (const CSCSimHit* hit : *oldColl) { - p_collection->push_back(*hit); + p_collection->push_back(*hit); } delete oldColl; } diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/CSCSimHitCollectionCnv.h b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/CSCSimHitCollectionCnv.h index f0c2ade2268f179b5c21f4e1c75a59d1f7e6ed22..b1d0f638e2010b13470c886fb977001b72d0ed13 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/CSCSimHitCollectionCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/CSCSimHitCollectionCnv.h @@ -1,5 +1,5 @@ /* - 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 MUONSIMEVENTATHENAPOOL_CSCSIMHITCOLLECTIONCNV_H @@ -11,6 +11,7 @@ #include "MuonSimEventTPCnv/CSCSimHitCollectionCnv_p1.h" #include "MuonSimEventTPCnv/CSCSimHitCollectionCnv_p2.h" #include "MuonSimEventTPCnv/CSCSimHitCollectionCnv_p3.h" +#include "MuonSimEventTPCnv/CSCSimHitCollectionCnv_p4.h" // the latest persistent representation type of DataCollection: typedef Muon::CSCSimHitCollection_p3 CSCSimHitCollection_PERS; @@ -20,16 +21,16 @@ typedef T_AthenaPoolCustomCnv<CSCSimHitCollection, CSCSimHitCollection_PERS > ** Create derived converter to customize the saving of identifiable ** container **/ -class CSCSimHitCollectionCnv : - public CSCSimHitCollectionCnvBase +class CSCSimHitCollectionCnv : + public CSCSimHitCollectionCnvBase { - + friend class CnvFactory<CSCSimHitCollectionCnv>; - + public: CSCSimHitCollectionCnv(ISvcLocator* svcloc); virtual ~CSCSimHitCollectionCnv(); - + virtual CSCSimHitCollection_PERS* createPersistent (CSCSimHitCollection* transCont); virtual CSCSimHitCollection* createTransient (); @@ -37,6 +38,7 @@ private: CSCSimHitCollectionCnv_p1 m_TPConverter; CSCSimHitCollectionCnv_p2 m_TPConverter_p2; CSCSimHitCollectionCnv_p3 m_TPConverter_p3; + CSCSimHitCollectionCnv_p4 m_TPConverter_p4; }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/GenericMuonSimHitCollectionCnv.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/GenericMuonSimHitCollectionCnv.cxx index 3a687bf0457575a29de90cecd41ddad5a4abdf6b..21df70f0a77815815d3759026f54d410409219d9 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/GenericMuonSimHitCollectionCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/GenericMuonSimHitCollectionCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "GenericMuonSimHitCollectionCnv.h" @@ -13,6 +13,8 @@ #include "MuonSimEvent/GenericMuonSimHitCollection.h" #include "MuonSimEventTPCnv/GenericMuonSimHitCollection_p1.h" +#include "MuonSimEventTPCnv/GenericMuonSimHitCollection_p2.h" +#include "MuonSimEventTPCnv/GenericMuonSimHitCollection_p3.h" #include "HitManagement/AthenaHitsVector.h" //for back-compatibility @@ -34,9 +36,14 @@ GenericMuonSimHitCollection* GenericMuonSimHitCollectionCnv::createTransient() { MsgStream log(msgSvc(), "GenericMuonSimHitCollectionCnv" ); static const pool::Guid p1_guid("C2D5D558-2671-11E1-AAFA-001E4F3E5646"); static const pool::Guid p2_guid("3760C0D8-C7EA-42C7-925A-E841196F2138"); + static const pool::Guid p3_guid("018E2DAC-18EB-7635-A068-B08EFB5CD64A"); ATH_MSG_DEBUG("createTransient(): main converter"); GenericMuonSimHitCollection* p_collection(nullptr); - if( compareClassGuid(p2_guid) ) { + if( compareClassGuid(p3_guid) ) { + ATH_MSG_DEBUG("createTransient(): T/P version 3 detected"); + std::unique_ptr< Muon::GenericMuonSimHitCollection_p3 > col_vect( this->poolReadObject< Muon::GenericMuonSimHitCollection_p3 >() ); + p_collection = m_TPConverter_p3.createTransient( col_vect.get(), log ); + } else if( compareClassGuid(p2_guid) ) { ATH_MSG_DEBUG("createTransient(): T/P version 2 detected"); std::unique_ptr< Muon::GenericMuonSimHitCollection_p2 > col_vect( this->poolReadObject< Muon::GenericMuonSimHitCollection_p2 >() ); p_collection = m_TPConverter_p2.createTransient( col_vect.get(), log ); diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/GenericMuonSimHitCollectionCnv.h b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/GenericMuonSimHitCollectionCnv.h index d6bf07b975b5bf2e1eda4231c2d096f40e8466b0..f15eca4e06ae5574a41b7472d277cc62de41bcd6 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/GenericMuonSimHitCollectionCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/GenericMuonSimHitCollectionCnv.h @@ -1,5 +1,5 @@ /* - 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 MUONSIMEVENTATHENAPOOL_GENERICMUONSIMHITCOLLECTIONCNV_H @@ -10,6 +10,7 @@ #include "MuonSimEventTPCnv/GenericMuonSimHitCollectionCnv_p1.h" #include "MuonSimEventTPCnv/GenericMuonSimHitCollectionCnv_p2.h" +#include "MuonSimEventTPCnv/GenericMuonSimHitCollectionCnv_p3.h" // the latest persistent representation type of DataCollection: typedef Muon::GenericMuonSimHitCollection_p2 GenericMuonSimHitCollection_PERS; @@ -19,22 +20,23 @@ typedef T_AthenaPoolCustomCnv<GenericMuonSimHitCollection, GenericMuonSimHitCol ** Create derived converter to customize the saving of identifiable ** container **/ -class GenericMuonSimHitCollectionCnv : - public GenericMuonSimHitCollectionCnvBase +class GenericMuonSimHitCollectionCnv : + public GenericMuonSimHitCollectionCnvBase { - + friend class CnvFactory<GenericMuonSimHitCollectionCnv>; - + public: GenericMuonSimHitCollectionCnv(ISvcLocator* svcloc); virtual ~GenericMuonSimHitCollectionCnv(); - + virtual GenericMuonSimHitCollection_PERS* createPersistent (GenericMuonSimHitCollection* transCont); virtual GenericMuonSimHitCollection* createTransient (); - + private: GenericMuonSimHitCollectionCnv_p1 m_TPConverter_p1; GenericMuonSimHitCollectionCnv_p2 m_TPConverter_p2; + GenericMuonSimHitCollectionCnv_p3 m_TPConverter_p3; }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MDTSimHitCollectionCnv.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MDTSimHitCollectionCnv.cxx index 2c473d0864fe957bb8f252d7ca70b8b65839c648..879bb79bfa2bff09804d0afc2b819b4867ebd80e 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MDTSimHitCollectionCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MDTSimHitCollectionCnv.cxx @@ -1,5 +1,5 @@ /* - 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 "MDTSimHitCollectionCnv.h" @@ -13,6 +13,9 @@ #include "MuonSimEvent/MDTSimHitCollection.h" #include "MuonSimEventTPCnv/MDTSimHitCollection_p1.h" +#include "MuonSimEventTPCnv/MDTSimHitCollection_p2.h" +#include "MuonSimEventTPCnv/MDTSimHitCollection_p3.h" +#include "MuonSimEventTPCnv/MDTSimHitCollection_p4.h" #include "HitManagement/AthenaHitsVector.h" //for back-compatibility @@ -33,12 +36,17 @@ MDTSimHitCollection_PERS* MDTSimHitCollectionCnv::createPersistent (MDTSimHit MDTSimHitCollection* MDTSimHitCollectionCnv::createTransient() { MsgStream log(msgSvc(), "MDTSimHitCollectionCnv" ); static const pool::Guid p0_guid("D76D06CC-C15F-43E6-BBC3-480DE5DA065D"); // before t/p split - static const pool::Guid p1_guid("EA781971-65C5-4B30-9D22-EEFB764BA0B3"); + static const pool::Guid p1_guid("EA781971-65C5-4B30-9D22-EEFB764BA0B3"); static const pool::Guid p2_guid("92880B97-75BB-4C5D-8183-577338059FCC"); static const pool::Guid p3_guid("0E9EEEE2-304F-44B8-B1DF-E75297183A02"); + static const pool::Guid p4_guid("018E2DAC-18EB-7BBC-92AF-EFE3F0E400C2"); ATH_MSG_DEBUG("createTransient(): main converter"); MDTSimHitCollection* p_collection(nullptr); - if( compareClassGuid(p3_guid) ) { + if( compareClassGuid(p4_guid) ) { + ATH_MSG_DEBUG("createTransient(): T/P version 4 detected"); + std::unique_ptr< Muon::MDTSimHitCollection_p4 > col_vect( this->poolReadObject< Muon::MDTSimHitCollection_p4 >() ); + p_collection = m_TPConverter_p4.createTransient( col_vect.get(), log ); + } else if( compareClassGuid(p3_guid) ) { ATH_MSG_DEBUG("createTransient(): T/P version 3 detected"); std::unique_ptr< Muon::MDTSimHitCollection_p3 > col_vect( this->poolReadObject< Muon::MDTSimHitCollection_p3 >() ); p_collection = m_TPConverter_p3.createTransient( col_vect.get(), log ); diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MDTSimHitCollectionCnv.h b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MDTSimHitCollectionCnv.h index 0daa28e63d35485efe23e6bf456d593b02d2e5aa..058d92abe009a7e66e4cf8550b72bf572e404d19 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MDTSimHitCollectionCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MDTSimHitCollectionCnv.h @@ -1,5 +1,5 @@ /* - 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 MUONSIMEVENTATHENAPOOL_MDTSIMHITCOLLECTIONCNV_H @@ -11,6 +11,7 @@ #include "MuonSimEventTPCnv/MDTSimHitCollectionCnv_p1.h" #include "MuonSimEventTPCnv/MDTSimHitCollectionCnv_p2.h" #include "MuonSimEventTPCnv/MDTSimHitCollectionCnv_p3.h" +#include "MuonSimEventTPCnv/MDTSimHitCollectionCnv_p4.h" // the latest persistent representation type of DataCollection: typedef Muon::MDTSimHitCollection_p3 MDTSimHitCollection_PERS; @@ -20,23 +21,24 @@ typedef T_AthenaPoolCustomCnv<MDTSimHitCollection, MDTSimHitCollection_PERS > ** Create derived converter to customize the saving of identifiable ** container **/ -class MDTSimHitCollectionCnv : - public MDTSimHitCollectionCnvBase +class MDTSimHitCollectionCnv : + public MDTSimHitCollectionCnvBase { - + friend class CnvFactory<MDTSimHitCollectionCnv>; - + public: MDTSimHitCollectionCnv(ISvcLocator* svcloc); virtual ~MDTSimHitCollectionCnv(); - + virtual MDTSimHitCollection_PERS* createPersistent (MDTSimHitCollection* transCont); virtual MDTSimHitCollection* createTransient (); - + private: MDTSimHitCollectionCnv_p1 m_TPConverter_p1; MDTSimHitCollectionCnv_p2 m_TPConverter_p2; MDTSimHitCollectionCnv_p3 m_TPConverter_p3; + MDTSimHitCollectionCnv_p4 m_TPConverter_p4; }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MMSimHitCollectionCnv.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MMSimHitCollectionCnv.cxx index c164f50ab2d91629c3d9dcc25f67ee9c148af1b0..3420e914d461fd9ca6470f786af975f5636e317c 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MMSimHitCollectionCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MMSimHitCollectionCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include "MMSimHitCollectionCnv.h" @@ -13,6 +13,8 @@ #include "MuonSimEvent/MMSimHitCollection.h" #include "MuonSimEventTPCnv/MMSimHitCollection_p1.h" +#include "MuonSimEventTPCnv/MMSimHitCollection_p2.h" +#include "MuonSimEventTPCnv/MMSimHitCollection_p3.h" #include "HitManagement/AthenaHitsVector.h" //for back-compatibility @@ -34,9 +36,14 @@ MMSimHitCollection* MMSimHitCollectionCnv::createTransient() { MsgStream log(msgSvc(), "MMSimHitCollectionCnv" ); static const pool::Guid p1_guid("ac0b677c-fe08-11e8-b174-02163e018187"); static const pool::Guid p2_guid("b9bdd436-fe08-11e8-a40f-02163e018187"); + static const pool::Guid p3_guid("018E2DAC-18EB-7EAA-A141-F0FD2A6E1E06"); ATH_MSG_DEBUG("createTransient(): main converter"); MMSimHitCollection* p_collection(nullptr); - if( compareClassGuid(p2_guid) ) { + if( compareClassGuid(p3_guid) ) { + ATH_MSG_DEBUG("createTransient(): T/P version 3 detected"); + std::unique_ptr< Muon::MMSimHitCollection_p3 > col_vect( this->poolReadObject< Muon::MMSimHitCollection_p3 >() ); + p_collection = m_TPConverter_p3.createTransient( col_vect.get(), log ); + } else if( compareClassGuid(p2_guid) ) { ATH_MSG_DEBUG("createTransient(): T/P version 2 detected"); std::unique_ptr< Muon::MMSimHitCollection_p2 > col_vect( this->poolReadObject< Muon::MMSimHitCollection_p2 >() ); p_collection = m_TPConverter_p2.createTransient( col_vect.get(), log ); diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MMSimHitCollectionCnv.h b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MMSimHitCollectionCnv.h index 8b70b55ab10b66d2bb44b36e7e804930cddc2f28..9fa773fd2660eff9b8ed148f0210b11365cf4767 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MMSimHitCollectionCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/MMSimHitCollectionCnv.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONSIMEVENTATHENAPOOL_MMSIMHITCOLLECTIONCNV_H @@ -10,6 +10,7 @@ #include "MuonSimEventTPCnv/MMSimHitCollectionCnv_p1.h" #include "MuonSimEventTPCnv/MMSimHitCollectionCnv_p2.h" +#include "MuonSimEventTPCnv/MMSimHitCollectionCnv_p3.h" // the latest persistent representation type of DataCollection: typedef Muon::MMSimHitCollection_p2 MMSimHitCollection_PERS; @@ -19,22 +20,23 @@ typedef T_AthenaPoolCustomCnv<MMSimHitCollection, MMSimHitCollection_PERS > MM ** Create derived converter to customize the saving of identifiable ** container **/ -class MMSimHitCollectionCnv : - public MMSimHitCollectionCnvBase +class MMSimHitCollectionCnv : + public MMSimHitCollectionCnvBase { - + friend class CnvFactory<MMSimHitCollectionCnv>; - + public: MMSimHitCollectionCnv(ISvcLocator* svcloc); virtual ~MMSimHitCollectionCnv(); - + virtual MMSimHitCollection_PERS* createPersistent (MMSimHitCollection* transCont); virtual MMSimHitCollection* createTransient (); - + private: MMSimHitCollectionCnv_p1 m_TPConverter_p1; MMSimHitCollectionCnv_p2 m_TPConverter_p2; + MMSimHitCollectionCnv_p3 m_TPConverter_p3; }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/RPCSimHitCollectionCnv.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/RPCSimHitCollectionCnv.cxx index c8aa1376dd456d01d68cfafe12d46c602fad5cc8..0c98ee2a426728e303fc733f24ddd8256e5c9e93 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/RPCSimHitCollectionCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/RPCSimHitCollectionCnv.cxx @@ -1,5 +1,5 @@ /* - 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 "RPCSimHitCollectionCnv.h" @@ -15,6 +15,7 @@ #include "MuonSimEventTPCnv/RPCSimHitCollection_p1.h" #include "MuonSimEventTPCnv/RPCSimHitCollection_p2.h" #include "MuonSimEventTPCnv/RPCSimHitCollection_p3.h" +#include "MuonSimEventTPCnv/RPCSimHitCollection_p4.h" #include "HitManagement/AthenaHitsVector.h" //for back-compatibility @@ -35,29 +36,29 @@ RPCSimHitCollection_PERS* RPCSimHitCollectionCnv::createPersistent (RPCSimHit RPCSimHitCollection* RPCSimHitCollectionCnv::createTransient() { MsgStream log(msgSvc(), "RPCSimHitCollectionCnv" ); static const pool::Guid p0_guid("45EB013E-FC8E-4612-88B7-6E0CAF718F79"); // before t/p split - static const pool::Guid p1_guid("C4C57487-41DC-4706-9604-721D76F0AA52"); + static const pool::Guid p1_guid("C4C57487-41DC-4706-9604-721D76F0AA52"); static const pool::Guid p2_guid("1B611C70-CC6F-42AE-9F6D-7DA6A9A22546"); static const pool::Guid p3_guid("B48E5E17-FB26-4BC0-A0E2-5324925EAE2F"); + static const pool::Guid p4_guid("018E2DAC-18EB-714B-B9BD-F9354E30CB51"); if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): main converter"<<endmsg; RPCSimHitCollection* p_collection(nullptr); - if( compareClassGuid(p3_guid) ) { + if( compareClassGuid(p4_guid) ) { + if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 4 detected"<<endmsg; + std::unique_ptr< Muon::RPCSimHitCollection_p4 > col_vect( this->poolReadObject< Muon::RPCSimHitCollection_p4 >() ); + p_collection = m_TPConverter_p4.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p3_guid) ) { if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 3 detected"<<endmsg; - // poolReadObject< RPCSimHitCollection_PERS >( m_TPConverter ); - // p_collection = m_TPConverter.createTransient( log ); std::unique_ptr< Muon::RPCSimHitCollection_p3 > col_vect( this->poolReadObject< Muon::RPCSimHitCollection_p3 >() ); p_collection = m_TPConverter_p3.createTransient( col_vect.get(), log ); } else if( compareClassGuid(p2_guid) ) { if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 2 detected"<<endmsg; - // poolReadObject< RPCSimHitCollection_PERS >( m_TPConverter ); - // p_collection = m_TPConverter.createTransient( log ); std::unique_ptr< Muon::RPCSimHitCollection_p2 > col_vect( this->poolReadObject< Muon::RPCSimHitCollection_p2 >() ); p_collection = m_TPConverter_p2.createTransient( col_vect.get(), log ); } else if( compareClassGuid(p1_guid) ) { if (log.level() <= MSG::DEBUG) log<<MSG::DEBUG<<"createTransient(): T/P version 1 detected"<<endmsg; - // poolReadObject< RPCSimHitCollection_PERS >( m_TPConverter ); - // p_collection = m_TPConverter.createTransient( log ); std::unique_ptr< Muon::RPCSimHitCollection_p1 > col_vect( this->poolReadObject< Muon::RPCSimHitCollection_p1 >() ); p_collection = m_TPConverter.createTransient( col_vect.get(), log ); } @@ -70,7 +71,7 @@ RPCSimHitCollection* RPCSimHitCollectionCnv::createTransient() { p_collection->reserve(size); //do the copy for (const RPCSimHit* hit : *oldColl) { - p_collection->push_back(*hit); + p_collection->push_back(*hit); } delete oldColl; } diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/RPCSimHitCollectionCnv.h b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/RPCSimHitCollectionCnv.h index 8446237fdeee3b4237b3384bd3b44f9ff66e7c7f..af061375ed742690d58f10ae90910959364fa392 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/RPCSimHitCollectionCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/RPCSimHitCollectionCnv.h @@ -1,5 +1,5 @@ /* - 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 MUONSIMEVENTATHENAPOOL_RPCSIMHITCOLLECTIONCNV_H @@ -11,6 +11,7 @@ #include "MuonSimEventTPCnv/RPCSimHitCollectionCnv_p1.h" #include "MuonSimEventTPCnv/RPCSimHitCollectionCnv_p2.h" #include "MuonSimEventTPCnv/RPCSimHitCollectionCnv_p3.h" +#include "MuonSimEventTPCnv/RPCSimHitCollectionCnv_p4.h" // the latest persistent representation type of DataCollection: @@ -21,23 +22,24 @@ typedef T_AthenaPoolCustomCnv<RPCSimHitCollection, RPCSimHitCollection_PERS > ** Create derived converter to customize the saving of identifiable ** container **/ -class RPCSimHitCollectionCnv : - public RPCSimHitCollectionCnvBase +class RPCSimHitCollectionCnv : + public RPCSimHitCollectionCnvBase { - + friend class CnvFactory<RPCSimHitCollectionCnv>; - + public: RPCSimHitCollectionCnv(ISvcLocator* svcloc); virtual ~RPCSimHitCollectionCnv(); - + virtual RPCSimHitCollection_PERS* createPersistent (RPCSimHitCollection* transCont); virtual RPCSimHitCollection* createTransient (); - + private: RPCSimHitCollectionCnv_p1 m_TPConverter; RPCSimHitCollectionCnv_p2 m_TPConverter_p2; RPCSimHitCollectionCnv_p3 m_TPConverter_p3; + RPCSimHitCollectionCnv_p4 m_TPConverter_p4; }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/TGCSimHitCollectionCnv.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/TGCSimHitCollectionCnv.cxx index 4a459d3e85ee7973fa5903031a5bb2ae1a9884b6..f0c5c22370694a1462765ce260db9fdee3b0dd1e 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/TGCSimHitCollectionCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/TGCSimHitCollectionCnv.cxx @@ -1,5 +1,5 @@ /* - 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 "TGCSimHitCollectionCnv.h" @@ -13,6 +13,10 @@ #include "MuonSimEvent/TGCSimHitCollection.h" #include "MuonSimEventTPCnv/TGCSimHitCollection_p1.h" +#include "MuonSimEventTPCnv/TGCSimHitCollection_p2.h" +#include "MuonSimEventTPCnv/TGCSimHitCollection_p3.h" +#include "MuonSimEventTPCnv/TGCSimHitCollection_p4.h" +#include "MuonSimEventTPCnv/TGCSimHitCollection_p5.h" #include "HitManagement/AthenaHitsVector.h" //for back-compatibility @@ -33,13 +37,20 @@ TGCSimHitCollection_PERS* TGCSimHitCollectionCnv::createPersistent (TGCSimHit TGCSimHitCollection* TGCSimHitCollectionCnv::createTransient() { MsgStream log(msgSvc(), "TGCSimHitCollectionCnv" ); static const pool::Guid p0_guid("D7C91818-4730-4717-A650-107F52C0221E"); // before t/p split - static const pool::Guid p1_guid("BD569381-2489-4402-BBD3-91EE8C009F26"); - static const pool::Guid p2_guid("710241EE-D5F7-4CB6-A1D7-6E80D040E637"); + static const pool::Guid p1_guid("BD569381-2489-4402-BBD3-91EE8C009F26"); + static const pool::Guid p2_guid("710241EE-D5F7-4CB6-A1D7-6E80D040E637"); static const pool::Guid p3_guid("BACD19A8-4737-4857-A22D-B9DF833A0A80"); static const pool::Guid p4_guid("F8F77562-BBD9-45DB-A276-6A21018EA7FA"); + static const pool::Guid p5_guid("018E2DAC-18EB-7E5B-9F18-CC2E36343F17"); log<<MSG::DEBUG<<"createTransient(): main converter"<<endmsg; TGCSimHitCollection* p_collection(nullptr); - if(compareClassGuid(p4_guid) ) { + if(compareClassGuid(p5_guid) ) { + log<<MSG::DEBUG<<"createTransient(): T/P version 5 detected"<<endmsg; + std::unique_ptr< Muon::TGCSimHitCollection_p5 > col_vect( this->poolReadObject< Muon::TGCSimHitCollection_p5 >() ); + p_collection = m_TPConverter_p5.createTransient( col_vect.get(), log ); + } + //---------------------------------------------------------------- + else if(compareClassGuid(p4_guid) ) { log<<MSG::DEBUG<<"createTransient(): T/P version 4 detected"<<endmsg; std::unique_ptr< Muon::TGCSimHitCollection_p4 > col_vect( this->poolReadObject< Muon::TGCSimHitCollection_p4 >() ); p_collection = m_TPConverter_p4.createTransient( col_vect.get(), log ); @@ -71,7 +82,7 @@ TGCSimHitCollection* TGCSimHitCollectionCnv::createTransient() { p_collection->reserve(size); //do the copy for (const TGCSimHit* hit : *oldColl) { - p_collection->push_back(*hit); + p_collection->push_back(*hit); } delete oldColl; } diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/TGCSimHitCollectionCnv.h b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/TGCSimHitCollectionCnv.h index 47c015a689c0ab3fb81d7e1cffad1bbf4cb2fe13..3df8ce9fdbf4aa3fbf27a674aaccc9fd3dc17c57 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/TGCSimHitCollectionCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/TGCSimHitCollectionCnv.h @@ -1,5 +1,5 @@ /* - 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 MUONSIMEVENTATHENAPOOL_TGCSIMHITCOLLECTIONCNV_H @@ -12,6 +12,7 @@ #include "MuonSimEventTPCnv/TGCSimHitCollectionCnv_p2.h" #include "MuonSimEventTPCnv/TGCSimHitCollectionCnv_p3.h" #include "MuonSimEventTPCnv/TGCSimHitCollectionCnv_p4.h" +#include "MuonSimEventTPCnv/TGCSimHitCollectionCnv_p5.h" // the latest persistent representation type of DataCollection: typedef Muon::TGCSimHitCollection_p4 TGCSimHitCollection_PERS; @@ -21,24 +22,25 @@ typedef T_AthenaPoolCustomCnv<TGCSimHitCollection, TGCSimHitCollection_PERS > ** Create derived converter to customize the saving of identifiable ** container **/ -class TGCSimHitCollectionCnv : - public TGCSimHitCollectionCnvBase +class TGCSimHitCollectionCnv : + public TGCSimHitCollectionCnvBase { - + friend class CnvFactory<TGCSimHitCollectionCnv>; - + public: TGCSimHitCollectionCnv(ISvcLocator* svcloc); virtual ~TGCSimHitCollectionCnv(); - + virtual TGCSimHitCollection_PERS* createPersistent (TGCSimHitCollection* transCont); virtual TGCSimHitCollection* createTransient (); - + private: TGCSimHitCollectionCnv_p1 m_TPConverter_p1; TGCSimHitCollectionCnv_p2 m_TPConverter_p2; TGCSimHitCollectionCnv_p3 m_TPConverter_p3; TGCSimHitCollectionCnv_p4 m_TPConverter_p4; + TGCSimHitCollectionCnv_p5 m_TPConverter_p5; }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/sTGCSimHitCollectionCnv.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/sTGCSimHitCollectionCnv.cxx index 5931e042519ef8956e18e4fd9e5ff2ee427ffe53..948b4ba0a366699d04fdf63fffa1b2817d2a2eef 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/sTGCSimHitCollectionCnv.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/sTGCSimHitCollectionCnv.cxx @@ -1,5 +1,5 @@ /* - 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 "sTGCSimHitCollectionCnv.h" @@ -12,7 +12,10 @@ #include "StoreGate/StoreGateSvc.h" #include "MuonSimEvent/sTGCSimHitCollection.h" +#include "MuonSimEventTPCnv/sTGCSimHitCollection_p1.h" #include "MuonSimEventTPCnv/sTGCSimHitCollection_p2.h" +#include "MuonSimEventTPCnv/sTGCSimHitCollection_p3.h" +#include "MuonSimEventTPCnv/sTGCSimHitCollection_p4.h" #include "HitManagement/AthenaHitsVector.h" //for back-compatibility @@ -35,10 +38,15 @@ sTGCSimHitCollection* sTGCSimHitCollectionCnv::createTransient() { static const pool::Guid p1_guid("f8b975d2-8130-11e8-abf4-4b4a6a2b6ee5"); static const pool::Guid p2_guid("b9521cc6-6e3b-11e8-adbb-02163e01bddd"); static const pool::Guid p3_guid("8f3ffd1c-c9a0-4da7-b99e-a3828b6ac789"); + static const pool::Guid p4_guid("018E2DAC-18EB-79C4-B562-FD7C035C92C1"); ATH_MSG_DEBUG("createTransient(): main converter"); sTGCSimHitCollection* p_collection(nullptr); - if( compareClassGuid(p3_guid) ) { + if( compareClassGuid(p4_guid) ) { + ATH_MSG_DEBUG("createTransient(): T/P version 4 detected"); + std::unique_ptr< Muon::sTGCSimHitCollection_p4 > col_vect( this->poolReadObject< Muon::sTGCSimHitCollection_p4 >() ); + p_collection = m_TPConverter_p4.createTransient( col_vect.get(), log ); + } else if( compareClassGuid(p3_guid) ) { ATH_MSG_DEBUG("createTransient(): T/P version 3 detected"); std::unique_ptr< Muon::sTGCSimHitCollection_p3 > col_vect( this->poolReadObject< Muon::sTGCSimHitCollection_p3 >() ); p_collection = m_TPConverter_p3.createTransient( col_vect.get(), log ); diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/sTGCSimHitCollectionCnv.h b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/sTGCSimHitCollectionCnv.h index bf67461f7e891059466c9d7a045c48b2d32c22be..d6a9f0eafd492e4a1474ab0510b73ddbfe272d7d 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/sTGCSimHitCollectionCnv.h +++ b/MuonSpectrometer/MuonCnv/MuonSimEventAthenaPool/src/sTGCSimHitCollectionCnv.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONSIMEVENTATHENAPOOL_STGCSIMHITCOLLECTIONCNV_H @@ -11,6 +11,7 @@ #include "MuonSimEventTPCnv/sTGCSimHitCollectionCnv_p1.h" #include "MuonSimEventTPCnv/sTGCSimHitCollectionCnv_p2.h" #include "MuonSimEventTPCnv/sTGCSimHitCollectionCnv_p3.h" +#include "MuonSimEventTPCnv/sTGCSimHitCollectionCnv_p4.h" // the latest persistent representation type of DataCollection: @@ -21,23 +22,24 @@ typedef T_AthenaPoolCustomCnv<sTGCSimHitCollection, sTGCSimHitCollection_PERS > ** Create derived converter to customize the saving of identifiable ** container **/ -class sTGCSimHitCollectionCnv : - public sTGCSimHitCollectionCnvBase +class sTGCSimHitCollectionCnv : + public sTGCSimHitCollectionCnvBase { - + friend class CnvFactory<sTGCSimHitCollectionCnv>; - + public: sTGCSimHitCollectionCnv(ISvcLocator* svcloc); virtual ~sTGCSimHitCollectionCnv(); - + virtual sTGCSimHitCollection_PERS* createPersistent (sTGCSimHitCollection* transCont); virtual sTGCSimHitCollection* createTransient (); - + private: sTGCSimHitCollectionCnv_p1 m_TPConverter_p1; sTGCSimHitCollectionCnv_p2 m_TPConverter_p2; sTGCSimHitCollectionCnv_p3 m_TPConverter_p3; + sTGCSimHitCollectionCnv_p4 m_TPConverter_p4; }; #endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/CMakeLists.txt index 01991ec7eeaead24eb2de70a91e20f243bca5060..408e3aeb856568fa19694286652b447451dff256 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/CMakeLists.txt @@ -32,118 +32,160 @@ atlas_add_test( CSCSimHitCollectionCnv_p1_test SOURCES test/CSCSimHitCollectionCnv_p1_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( CSCSimHitCollectionCnv_p2_test SOURCES test/CSCSimHitCollectionCnv_p2_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( CSCSimHitCollectionCnv_p3_test SOURCES test/CSCSimHitCollectionCnv_p3_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) + +atlas_add_test( CSCSimHitCollectionCnv_p4_test + SOURCES + test/CSCSimHitCollectionCnv_p4_test.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( GenericMuonSimHitCollectionCnv_p1_test SOURCES test/GenericMuonSimHitCollectionCnv_p1_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( GenericMuonSimHitCollectionCnv_p2_test SOURCES test/GenericMuonSimHitCollectionCnv_p2_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) + +atlas_add_test( GenericMuonSimHitCollectionCnv_p3_test + SOURCES + test/GenericMuonSimHitCollectionCnv_p3_test.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( MDTSimHitCollectionCnv_p1_test SOURCES test/MDTSimHitCollectionCnv_p1_test.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( MDTSimHitCollectionCnv_p2_test SOURCES test/MDTSimHitCollectionCnv_p2_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( MDTSimHitCollectionCnv_p3_test SOURCES test/MDTSimHitCollectionCnv_p3_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) + +atlas_add_test( MDTSimHitCollectionCnv_p4_test + SOURCES + test/MDTSimHitCollectionCnv_p4_test.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( RPCSimHitCollectionCnv_p1_test SOURCES test/RPCSimHitCollectionCnv_p1_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( RPCSimHitCollectionCnv_p2_test SOURCES test/RPCSimHitCollectionCnv_p2_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( RPCSimHitCollectionCnv_p3_test SOURCES test/RPCSimHitCollectionCnv_p3_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) + +atlas_add_test( RPCSimHitCollectionCnv_p4_test + SOURCES + test/RPCSimHitCollectionCnv_p4_test.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( TGCSimHitCollectionCnv_p1_test SOURCES test/TGCSimHitCollectionCnv_p1_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( TGCSimHitCollectionCnv_p2_test SOURCES test/TGCSimHitCollectionCnv_p2_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( TGCSimHitCollectionCnv_p3_test SOURCES test/TGCSimHitCollectionCnv_p3_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( TGCSimHitCollectionCnv_p4_test SOURCES test/TGCSimHitCollectionCnv_p4_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) + +atlas_add_test( TGCSimHitCollectionCnv_p5_test + SOURCES + test/TGCSimHitCollectionCnv_p5_test.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( sTGCSimHitCollectionCnv_p1_test SOURCES test/sTGCSimHitCollectionCnv_p1_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( sTGCSimHitCollectionCnv_p2_test SOURCES test/sTGCSimHitCollectionCnv_p2_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( sTGCSimHitCollectionCnv_p3_test SOURCES test/sTGCSimHitCollectionCnv_p3_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) + +atlas_add_test( sTGCSimHitCollectionCnv_p4_test + SOURCES + test/sTGCSimHitCollectionCnv_p4_test.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( MMSimHitCollectionCnv_p1_test SOURCES test/MMSimHitCollectionCnv_p1_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) atlas_add_test( MMSimHitCollectionCnv_p2_test SOURCES test/MMSimHitCollectionCnv_p2_test.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) + +atlas_add_test( MMSimHitCollectionCnv_p3_test + SOURCES + test/MMSimHitCollectionCnv_p3_test.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaPoolCnvSvcLib GaudiKernel GeneratorObjectsTPCnv MuonSimEvent TestTools StoreGateLib GeoPrimitives MuonSimEventTPCnv CxxUtils TruthUtils ) diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/CSCSimHitCollectionCnv_p4.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/CSCSimHitCollectionCnv_p4.h new file mode 100644 index 0000000000000000000000000000000000000000..5f7c4616f52fe83fd7b4c6a929332cec994f9f12 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/CSCSimHitCollectionCnv_p4.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef CSCSimHitCOLLECTIONCNV_P4_H +#define CSCSimHitCOLLECTIONCNV_P4_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "MuonSimEvent/CSCSimHitCollection.h" +#include "CSCSimHitCollection_p4.h" +// namespace Muon { +// class CSCSimHitCollection_p1; +// } + +class CSCSimHitCollectionCnv_p4 : public T_AthenaPoolTPCnvBase<CSCSimHitCollection, Muon::CSCSimHitCollection_p4> +{ + public: + + CSCSimHitCollectionCnv_p4() {}; + + virtual CSCSimHitCollection* createTransient(const Muon::CSCSimHitCollection_p4* persObj, MsgStream &log); + virtual void persToTrans(const Muon::CSCSimHitCollection_p4* persCont, + CSCSimHitCollection* transCont, + MsgStream &log) ; + virtual void transToPers(const CSCSimHitCollection* transCont, + Muon::CSCSimHitCollection_p4* persCont, + MsgStream &log) ; + +}; + +#endif + diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/CSCSimHitCollection_p4.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/CSCSimHitCollection_p4.h new file mode 100644 index 0000000000000000000000000000000000000000..9fd9c21c81092963cec5ed135df1de591ae51def --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/CSCSimHitCollection_p4.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef CSCSIMHITCOLLECTION_P4_H +#define CSCSIMHITCOLLECTION_P4_H + +#include <vector> +#include "GeneratorObjectsTPCnv/HepMcParticleLink_p3.h" + +namespace Muon { +class CSCSimHitCollection_p4 +{ + public: + std::vector<int> m_CSCid; + std::vector<float> m_globalTime; + std::vector<float> m_energyDeposit; + std::vector<float> m_stX, m_stY, m_stZ; //!< Represents m_hitStart in transient class + std::vector<float> m_enX, m_enY, m_enZ; //!< Represents m_hitEnd in transient class + std::vector<int> m_particleID; + std::vector<float> m_meanTime; + std::vector<HepMcParticleLink_p3> m_partLink; + std::vector<float> m_kineticEnergy; +}; +} + +#endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/GenericMuonSimHitCollectionCnv_p3.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/GenericMuonSimHitCollectionCnv_p3.h new file mode 100644 index 0000000000000000000000000000000000000000..bbb606c4a32572324ba270c22ea67331ca55ac7a --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/GenericMuonSimHitCollectionCnv_p3.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GenericMuonSimHitCOLLECTIONCNV_P3_H +#define GenericMuonSimHitCOLLECTIONCNV_P3_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "MuonSimEvent/GenericMuonSimHitCollection.h" +#include "GenericMuonSimHitCollection_p3.h" +// namespace Muon { +// class GenericMuonSimHitCollection_p3; +// } + +class GenericMuonSimHitCollectionCnv_p3 : public T_AthenaPoolTPCnvBase<GenericMuonSimHitCollection, Muon::GenericMuonSimHitCollection_p3> +{ + public: + + GenericMuonSimHitCollectionCnv_p3() {}; + + virtual GenericMuonSimHitCollection* createTransient(const Muon::GenericMuonSimHitCollection_p3* persObj, MsgStream &log); + virtual void persToTrans(const Muon::GenericMuonSimHitCollection_p3* persCont, + GenericMuonSimHitCollection* transCont, + MsgStream &log) ; + virtual void transToPers(const GenericMuonSimHitCollection* transCont, + Muon::GenericMuonSimHitCollection_p3* persCont, + MsgStream &log) ; + +}; + +#endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/GenericMuonSimHitCollection_p3.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/GenericMuonSimHitCollection_p3.h new file mode 100644 index 0000000000000000000000000000000000000000..7efccdefbf6d31ccdd0f1808c3b9b1396f557419 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/GenericMuonSimHitCollection_p3.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef GENERICMUONSIMHITCOLLECTION_P3_H +#define GENERICMUONSIMHITCOLLECTION_P3_H + +#include <vector> +#include "GeneratorObjectsTPCnv/HepMcParticleLink_p3.h" + +namespace Muon { + class GenericMuonSimHitCollection_p3 + { + public: + std::vector<int> m_GenericId; + std::vector<float> m_globalTime; + std::vector<float> m_globalpreTime; + //preStep + std::vector<float> m_prestX, m_prestY, m_prestZ; //!< Represents m_globalPosition in transient class + std::vector<float> m_prelocX, m_prelocY, m_prelocZ; //!< Represents m_localPosition in transient class + //postStep + std::vector<float> m_stX, m_stY, m_stZ; //!< Represents m_globalPosition in transient class + std::vector<float> m_locX, m_locY, m_locZ; //!< Represents m_localPosition in transient class + std::vector<float> m_kineticEnergy; + std::vector<int> m_particleEncoding; + std::vector<float> m_ptX, m_ptY, m_ptZ; + std::vector<float> m_depositEnergy; + std::vector<float> m_StepLength; + + std::vector<HepMcParticleLink_p3> m_partLink; + }; +} + +#endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MDTSimHitCollectionCnv_p4.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MDTSimHitCollectionCnv_p4.h new file mode 100644 index 0000000000000000000000000000000000000000..b28643922e3635eebb3a6995bf352864fca2c29e --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MDTSimHitCollectionCnv_p4.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MDTSimHitCOLLECTIONCNV_P4_H +#define MDTSimHitCOLLECTIONCNV_P4_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "MuonSimEvent/MDTSimHitCollection.h" +#include "MDTSimHitCollection_p4.h" + +class MDTSimHitCollectionCnv_p4 : public T_AthenaPoolTPCnvBase<MDTSimHitCollection, Muon::MDTSimHitCollection_p4> +{ + public: + + MDTSimHitCollectionCnv_p4() {}; + + virtual MDTSimHitCollection* createTransient(const Muon::MDTSimHitCollection_p4* persObj, MsgStream &log); + virtual void persToTrans(const Muon::MDTSimHitCollection_p4* persCont, + MDTSimHitCollection* transCont, + MsgStream &log) ; + virtual void transToPers(const MDTSimHitCollection* transCont, + Muon::MDTSimHitCollection_p4* persCont, + MsgStream &log) ; + +}; + +#endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MDTSimHitCollection_p4.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MDTSimHitCollection_p4.h new file mode 100644 index 0000000000000000000000000000000000000000..d9ff686063265e322f148d56223ca956b926448c --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MDTSimHitCollection_p4.h @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MDTSIMHITCOLLECTION_P4_H +#define MDTSIMHITCOLLECTION_P4_H + +#include <vector> +#include "GeneratorObjectsTPCnv/HepMcParticleLink_p3.h" + +namespace Muon { +class MDTSimHitCollection_p4 +{ + public: + std::vector<int> m_MDTid; + std::vector<float> m_globalTime; + std::vector<float> m_driftRadius; + std::vector<float> m_stX, m_stY, m_stZ; //!< Represents m_localPosition in transient class + //std::vector<float> m_meanTime; + std::vector<HepMcParticleLink_p3> m_partLink; + std::vector<float> m_energyDeposit; + std::vector<int> m_particleEncoding; + std::vector<float> m_kineticEnergy; + std::vector<float> m_stepLength; +}; +} + +#endif + diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MMSimHitCollectionCnv_p3.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MMSimHitCollectionCnv_p3.h new file mode 100644 index 0000000000000000000000000000000000000000..955bdaf71e7f14f3f840d23c2eaedba8f3b967be --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MMSimHitCollectionCnv_p3.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MMSimHitCOLLECTIONCNV_P3_H +#define MMSimHitCOLLECTIONCNV_P3_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "MuonSimEvent/MMSimHitCollection.h" +#include "MMSimHitCollection_p3.h" + +class MMSimHitCollectionCnv_p3 : public T_AthenaPoolTPCnvBase<MMSimHitCollection, Muon::MMSimHitCollection_p3> +{ + public: + + MMSimHitCollectionCnv_p3() {}; + + virtual MMSimHitCollection* createTransient(const Muon::MMSimHitCollection_p3* persObj, MsgStream &log); + virtual void persToTrans(const Muon::MMSimHitCollection_p3* persCont, + MMSimHitCollection* transCont, + MsgStream &log) ; + virtual void transToPers(const MMSimHitCollection* transCont, + Muon::MMSimHitCollection_p3* persCont, + MsgStream &log) ; + +}; + +#endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MMSimHitCollection_p3.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MMSimHitCollection_p3.h new file mode 100644 index 0000000000000000000000000000000000000000..64d5fab428fb2f23a4dccae201524976ec3fd8ec --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MMSimHitCollection_p3.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef MUONSIMEVENTTPCNV_MMSIMHITCOLLECTION_P3_H +#define MUONSIMEVENTTPCNV_MMSIMHITCOLLECTION_P3_H + +#include <vector> +#include "GeneratorObjectsTPCnv/HepMcParticleLink_p3.h" + +namespace Muon { + class MMSimHitCollection_p3 + { + public: + std::vector<int> m_MMId; + std::vector<float> m_globalTime; + //postStep + std::vector<float> m_stX, m_stY, m_stZ; //!< Represents m_globalPosition in transient class + std::vector<float> m_kineticEnergy; + std::vector<int> m_particleEncoding; + std::vector<float> m_ptX, m_ptY, m_ptZ; + std::vector<float> m_depositEnergy; + + std::vector<HepMcParticleLink_p3> m_partLink; + }; +} + +#endif // MUONSIMEVENTTPCNV_MMSIMHITCOLLECTION_P3_H diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MuonSimEventTPCnvDict.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MuonSimEventTPCnvDict.h index 55f505df4f6b04374c3de88eda1109505c001159..ab8f4a8b48c5a07f7bacff90188c5560b2a39440 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MuonSimEventTPCnvDict.h +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/MuonSimEventTPCnvDict.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONSIMEVENTTPCNV_MUONSIMEVENTTPCNVDICT_H @@ -14,22 +14,29 @@ #include "MuonSimEventTPCnv/CSCSimHitCollection_p1.h" #include "MuonSimEventTPCnv/CSCSimHitCollection_p2.h" #include "MuonSimEventTPCnv/CSCSimHitCollection_p3.h" +#include "MuonSimEventTPCnv/CSCSimHitCollection_p4.h" #include "MuonSimEventTPCnv/RPCSimHitCollection_p1.h" #include "MuonSimEventTPCnv/RPCSimHitCollection_p2.h" #include "MuonSimEventTPCnv/RPCSimHitCollection_p3.h" +#include "MuonSimEventTPCnv/RPCSimHitCollection_p4.h" #include "MuonSimEventTPCnv/TGCSimHitCollection_p1.h" #include "MuonSimEventTPCnv/TGCSimHitCollection_p2.h" #include "MuonSimEventTPCnv/TGCSimHitCollection_p3.h" #include "MuonSimEventTPCnv/TGCSimHitCollection_p4.h" +#include "MuonSimEventTPCnv/TGCSimHitCollection_p5.h" #include "MuonSimEventTPCnv/MDTSimHitCollection_p1.h" #include "MuonSimEventTPCnv/MDTSimHitCollection_p2.h" #include "MuonSimEventTPCnv/MDTSimHitCollection_p3.h" +#include "MuonSimEventTPCnv/MDTSimHitCollection_p4.h" #include "MuonSimEventTPCnv/GenericMuonSimHitCollection_p1.h" #include "MuonSimEventTPCnv/GenericMuonSimHitCollection_p2.h" +#include "MuonSimEventTPCnv/GenericMuonSimHitCollection_p3.h" #include "MuonSimEventTPCnv/sTGCSimHitCollection_p1.h" #include "MuonSimEventTPCnv/sTGCSimHitCollection_p2.h" #include "MuonSimEventTPCnv/sTGCSimHitCollection_p3.h" +#include "MuonSimEventTPCnv/sTGCSimHitCollection_p4.h" #include "MuonSimEventTPCnv/MMSimHitCollection_p1.h" #include "MuonSimEventTPCnv/MMSimHitCollection_p2.h" +#include "MuonSimEventTPCnv/MMSimHitCollection_p3.h" #endif // MUONSIMEVENTTPCNV_MUONSIMEVENTTPCNVDICT_H diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/RPCSimHitCollectionCnv_p4.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/RPCSimHitCollectionCnv_p4.h new file mode 100644 index 0000000000000000000000000000000000000000..a0035b59ab1f05ee2386bb0eb882471d3ad539eb --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/RPCSimHitCollectionCnv_p4.h @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef RPCSimHitCOLLECTIONCNV_P4_H +#define RPCSimHitCOLLECTIONCNV_P4_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "MuonSimEvent/RPCSimHitCollection.h" +#include "RPCSimHitCollection_p4.h" +// namespace Muon { +// class RPCSimHitCollection_p1; +// } + +class RPCSimHitCollectionCnv_p4 : public T_AthenaPoolTPCnvBase<RPCSimHitCollection, Muon::RPCSimHitCollection_p4> +{ + public: + + RPCSimHitCollectionCnv_p4() {}; + + virtual RPCSimHitCollection* createTransient(const Muon::RPCSimHitCollection_p4* persObj, MsgStream &log); + virtual void persToTrans(const Muon::RPCSimHitCollection_p4* persCont, + RPCSimHitCollection* transCont, + MsgStream &log) ; + virtual void transToPers(const RPCSimHitCollection* transCont, + Muon::RPCSimHitCollection_p4* persCont, + MsgStream &log) ; + +}; + +#endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/RPCSimHitCollection_p4.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/RPCSimHitCollection_p4.h new file mode 100644 index 0000000000000000000000000000000000000000..4c2a701a6a657580bd59b7b8f2e070a4a573c946 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/RPCSimHitCollection_p4.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef RPCSIMHITCOLLECTION_P4_H +#define RPCSIMHITCOLLECTION_P4_H + +#include <vector> +#include "GeneratorObjectsTPCnv/HepMcParticleLink_p3.h" + +namespace Muon { +class RPCSimHitCollection_p4 +{ + public: + std::vector<int> m_RPCid; + std::vector<float> m_globalTime; + std::vector<float> m_stX, m_stY, m_stZ; //!< Represents m_localPosition in transient class + std::vector<HepMcParticleLink_p3> m_partLink; + std::vector<float> m_stopX, m_stopY, m_stopZ; //!< Represents end-point of the g4 step in the transient class + std::vector<float> m_energyDeposit; + std::vector<float> m_stepLength; + std::vector<int> m_particleEncoding; + std::vector<float> m_kineticEnergy; +}; +} + +#endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/TGCSimHitCollectionCnv_p5.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/TGCSimHitCollectionCnv_p5.h new file mode 100644 index 0000000000000000000000000000000000000000..d6e7fa34307dd85e09272ec6c4bff8b32b3a44b6 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/TGCSimHitCollectionCnv_p5.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TGCSimHitCOLLECTIONCNV_P5_H +#define TGCSimHitCOLLECTIONCNV_P5_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "MuonSimEvent/TGCSimHitCollection.h" +#include "TGCSimHitCollection_p5.h" + +class TGCSimHitCollectionCnv_p5 : public T_AthenaPoolTPCnvBase<TGCSimHitCollection, Muon::TGCSimHitCollection_p5> +{ + public: + + TGCSimHitCollectionCnv_p5() {}; + + virtual TGCSimHitCollection* createTransient(const Muon::TGCSimHitCollection_p5* persObj, MsgStream &log); + virtual void persToTrans(const Muon::TGCSimHitCollection_p5* persCont, + TGCSimHitCollection* transCont, + MsgStream &log) ; + virtual void transToPers(const TGCSimHitCollection* transCont, + Muon::TGCSimHitCollection_p5* persCont, + MsgStream &log) ; + +}; + +#endif // TGCSimHitCOLLECTIONCNV_P5_H diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/TGCSimHitCollection_p5.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/TGCSimHitCollection_p5.h new file mode 100644 index 0000000000000000000000000000000000000000..5724b233af8aac1ed421d9f1b8fb7f990858a665 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/TGCSimHitCollection_p5.h @@ -0,0 +1,27 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TGCSIMHITCOLLECTION_P5_H +#define TGCSIMHITCOLLECTION_P5_H + +#include <vector> +#include "GeneratorObjectsTPCnv/HepMcParticleLink_p3.h" + +namespace Muon { +class TGCSimHitCollection_p5 +{ + public: + std::vector<int> m_TGCid; + std::vector<float> m_globalTime; + std::vector<float> m_stX, m_stY, m_stZ; //!< Represents m_localPosition in transient class + std::vector<float> m_enX, m_enY, m_enZ; //!< Represents m_localDireCos in transient class + std::vector<HepMcParticleLink_p3> m_partLink; + std::vector<float> m_energyDeposit; + std::vector<float> m_stepLength; + std::vector<int> m_particleEncoding; + std::vector<float> m_kineticEnergy; +}; +} + +#endif // TGCSIMHITCOLLECTION_P5_H diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/sTGCSimHitCollectionCnv_p4.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/sTGCSimHitCollectionCnv_p4.h new file mode 100644 index 0000000000000000000000000000000000000000..a84db1635f8d1d7edfeb98901eb6c25bfd8092fd --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/sTGCSimHitCollectionCnv_p4.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef sTGCSimHitCOLLECTIONCNV_P4_H +#define sTGCSimHitCOLLECTIONCNV_P4_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" +#include "MuonSimEvent/sTGCSimHitCollection.h" +#include "sTGCSimHitCollection_p4.h" + +class sTGCSimHitCollectionCnv_p4 : public T_AthenaPoolTPCnvBase<sTGCSimHitCollection, Muon::sTGCSimHitCollection_p4> +{ + public: + + sTGCSimHitCollectionCnv_p4() {}; + + virtual sTGCSimHitCollection* createTransient(const Muon::sTGCSimHitCollection_p4* persObj, MsgStream &log); + virtual void persToTrans(const Muon::sTGCSimHitCollection_p4* persCont, + sTGCSimHitCollection* transCont, + MsgStream &log) ; + virtual void transToPers(const sTGCSimHitCollection* transCont, + Muon::sTGCSimHitCollection_p4* persCont, + MsgStream &log) ; + +}; + +#endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/sTGCSimHitCollection_p4.h b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/sTGCSimHitCollection_p4.h new file mode 100644 index 0000000000000000000000000000000000000000..3b31ee21d8a71444ff88ac5bc82460cbb958bed5 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/sTGCSimHitCollection_p4.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef STGCSIMHITCOLLECTION_P4_H +#define STGCSIMHITCOLLECTION_P4_H + +#include <vector> +#include "GeneratorObjectsTPCnv/HepMcParticleLink_p3.h" + +namespace Muon { + class sTGCSimHitCollection_p4 + { + public: + std::vector<int> m_sTGCId; + std::vector<float> m_globalTime; + std::vector<float> m_stX, m_stY, m_stZ; //!< Represents m_globalPosition in transient class + std::vector<int> m_particleEncoding; + std::vector<float> m_depositEnergy; + std::vector<HepMcParticleLink_p3> m_partLink; + std::vector<float> m_kineticEnergy; + std::vector<float> m_prestX, m_prestY, m_prestZ; + }; +} + +#endif diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/selection.xml b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/selection.xml index c4195796ce661c5c894e54f1d927836527edcbaa..66f717f33793852aadb5f15616082a0de22252bf 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/selection.xml +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/MuonSimEventTPCnv/selection.xml @@ -6,22 +6,29 @@ <class name="Muon::CSCSimHitCollection_p1" id="E45CD293-4599-41BE-8B65-945A18F41AB7"/> <class name="Muon::CSCSimHitCollection_p2" id="7E5A120C-E64F-4519-A24B-B485A58724BF"/> <class name="Muon::CSCSimHitCollection_p3" id="6BFFE81C-C99E-43D9-B06F-1A998C3B3E40"/> + <class name="Muon::CSCSimHitCollection_p4" id="018E2DAC-18EB-71D2-A246-66F818B3681B"/> <class name="Muon::RPCSimHitCollection_p1" id="C4C57487-41DC-4706-9604-721D76F0AA52"/> <class name="Muon::RPCSimHitCollection_p2" id="1B611C70-CC6F-42AE-9F6D-7DA6A9A22546"/> <class name="Muon::RPCSimHitCollection_p3" id="B48E5E17-FB26-4BC0-A0E2-5324925EAE2F"/> + <class name="Muon::RPCSimHitCollection_p4" id="018E2DAC-18EB-714B-B9BD-F9354E30CB51"/> <class name="Muon::TGCSimHitCollection_p1" id="BD569381-2489-4402-BBD3-91EE8C009F26"/> <class name="Muon::TGCSimHitCollection_p2" id="710241EE-D5F7-4CB6-A1D7-6E80D040E637"/> <class name="Muon::TGCSimHitCollection_p3" id="BACD19A8-4737-4857-A22D-B9DF833A0A80"/> <class name="Muon::TGCSimHitCollection_p4" id="F8F77562-BBD9-45DB-A276-6A21018EA7FA"/> + <class name="Muon::TGCSimHitCollection_p5" id="018E2DAC-18EB-7E5B-9F18-CC2E36343F17"/> <class name="Muon::MDTSimHitCollection_p1" id="EA781971-65C5-4B30-9D22-EEFB764BA0B3"/> <class name="Muon::MDTSimHitCollection_p2" id="92880B97-75BB-4C5D-8183-577338059FCC"/> <class name="Muon::MDTSimHitCollection_p3" id="0E9EEEE2-304F-44B8-B1DF-E75297183A02"/> + <class name="Muon::MDTSimHitCollection_p4" id="018E2DAC-18EB-7BBC-92AF-EFE3F0E400C2"/> <class name="Muon::GenericMuonSimHitCollection_p1" id="C2D5D558-2671-11E1-AAFA-001E4F3E5646"/> <class name="Muon::GenericMuonSimHitCollection_p2" id="3760C0D8-C7EA-42C7-925A-E841196F2138"/> - <class name="Muon::sTGCSimHitCollection_p1" id="f8b975d2-8130-11e8-abf4-4b4a6a2b6ee5"/> - <class name="Muon::sTGCSimHitCollection_p2" id="b9521cc6-6e3b-11e8-adbb-02163e01bddd"/> - <class name="Muon::sTGCSimHitCollection_p3" id="8f3ffd1c-c9a0-4da7-b99e-a3828b6ac789"/> + <class name="Muon::GenericMuonSimHitCollection_p3" id="018E2DAC-18EB-7635-A068-B08EFB5CD64A"/> + <class name="Muon::sTGCSimHitCollection_p1" id="f8b975d2-8130-11e8-abf4-4b4a6a2b6ee5"/> + <class name="Muon::sTGCSimHitCollection_p2" id="b9521cc6-6e3b-11e8-adbb-02163e01bddd"/> + <class name="Muon::sTGCSimHitCollection_p3" id="8f3ffd1c-c9a0-4da7-b99e-a3828b6ac789"/> + <class name="Muon::sTGCSimHitCollection_p4" id="018E2DAC-18EB-79C4-B562-FD7C035C92C1"/> <class name="Muon::MMSimHitCollection_p1" id="ac0b677c-fe08-11e8-b174-02163e018187"/> <class name="Muon::MMSimHitCollection_p2" id="b9bdd436-fe08-11e8-a40f-02163e018187"/> - + <class name="Muon::MMSimHitCollection_p3" id="018E2DAC-18EB-7EAA-A141-F0FD2A6E1E06"/> + </lcgdict> diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/CSCSimHitCollectionCnv_p4_test.ref b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/CSCSimHitCollectionCnv_p4_test.ref new file mode 100644 index 0000000000000000000000000000000000000000..4a7c11977bb121447c32603da54a83a704e8898b --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/CSCSimHitCollectionCnv_p4_test.ref @@ -0,0 +1,8 @@ +ApplicationMgr INFO Application Manager Configured successfully +EventLoopMgr WARNING Unable to locate service "EventSelector" +EventLoopMgr WARNING No events will be processed from external input. +HistogramPersis...WARNING Histograms saving not required. +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr Ready +test1 +HepMcParticleLink INFO find_proxy: Using TruthEvent as McEventCollection key for this job diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/GenericMuonSimHitCollectionCnv_p3_test.ref b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/GenericMuonSimHitCollectionCnv_p3_test.ref new file mode 100644 index 0000000000000000000000000000000000000000..4a7c11977bb121447c32603da54a83a704e8898b --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/GenericMuonSimHitCollectionCnv_p3_test.ref @@ -0,0 +1,8 @@ +ApplicationMgr INFO Application Manager Configured successfully +EventLoopMgr WARNING Unable to locate service "EventSelector" +EventLoopMgr WARNING No events will be processed from external input. +HistogramPersis...WARNING Histograms saving not required. +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr Ready +test1 +HepMcParticleLink INFO find_proxy: Using TruthEvent as McEventCollection key for this job diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/MDTSimHitCollectionCnv_p4_test.ref b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/MDTSimHitCollectionCnv_p4_test.ref new file mode 100644 index 0000000000000000000000000000000000000000..4a7c11977bb121447c32603da54a83a704e8898b --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/MDTSimHitCollectionCnv_p4_test.ref @@ -0,0 +1,8 @@ +ApplicationMgr INFO Application Manager Configured successfully +EventLoopMgr WARNING Unable to locate service "EventSelector" +EventLoopMgr WARNING No events will be processed from external input. +HistogramPersis...WARNING Histograms saving not required. +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr Ready +test1 +HepMcParticleLink INFO find_proxy: Using TruthEvent as McEventCollection key for this job diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/MMSimHitCollectionCnv_p3_test.ref b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/MMSimHitCollectionCnv_p3_test.ref new file mode 100644 index 0000000000000000000000000000000000000000..4a7c11977bb121447c32603da54a83a704e8898b --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/MMSimHitCollectionCnv_p3_test.ref @@ -0,0 +1,8 @@ +ApplicationMgr INFO Application Manager Configured successfully +EventLoopMgr WARNING Unable to locate service "EventSelector" +EventLoopMgr WARNING No events will be processed from external input. +HistogramPersis...WARNING Histograms saving not required. +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr Ready +test1 +HepMcParticleLink INFO find_proxy: Using TruthEvent as McEventCollection key for this job diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/RPCSimHitCollectionCnv_p4_test.ref b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/RPCSimHitCollectionCnv_p4_test.ref new file mode 100644 index 0000000000000000000000000000000000000000..4a7c11977bb121447c32603da54a83a704e8898b --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/RPCSimHitCollectionCnv_p4_test.ref @@ -0,0 +1,8 @@ +ApplicationMgr INFO Application Manager Configured successfully +EventLoopMgr WARNING Unable to locate service "EventSelector" +EventLoopMgr WARNING No events will be processed from external input. +HistogramPersis...WARNING Histograms saving not required. +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr Ready +test1 +HepMcParticleLink INFO find_proxy: Using TruthEvent as McEventCollection key for this job diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/TGCSimHitCollectionCnv_p5_test.ref b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/TGCSimHitCollectionCnv_p5_test.ref new file mode 100644 index 0000000000000000000000000000000000000000..4a7c11977bb121447c32603da54a83a704e8898b --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/TGCSimHitCollectionCnv_p5_test.ref @@ -0,0 +1,8 @@ +ApplicationMgr INFO Application Manager Configured successfully +EventLoopMgr WARNING Unable to locate service "EventSelector" +EventLoopMgr WARNING No events will be processed from external input. +HistogramPersis...WARNING Histograms saving not required. +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr Ready +test1 +HepMcParticleLink INFO find_proxy: Using TruthEvent as McEventCollection key for this job diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/sTGCSimHitCollectionCnv_p4_test.ref b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/sTGCSimHitCollectionCnv_p4_test.ref new file mode 100644 index 0000000000000000000000000000000000000000..fcde3756ca5647eb6ae86b09cadbc2daac24ed7a --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/share/sTGCSimHitCollectionCnv_p4_test.ref @@ -0,0 +1,8 @@ +ApplicationMgr INFO Application Manager Configured successfully +EventLoopMgr WARNING Unable to locate service "EventSelector" +EventLoopMgr WARNING No events will be processed from external input. +ApplicationMgr INFO Application Manager Initialized successfully +ApplicationMgr Ready +ClassIDSvc INFO getRegistryEntries: read 1917 CLIDRegistry entries for module ALL +test1 +HepMcParticleLink INFO find_proxy: Using TruthEvent as McEventCollection key for this job diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/CSCSimHitCollectionCnv_p4.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/CSCSimHitCollectionCnv_p4.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7b4800c359a793fd18b38fc0ec1a12b6ea677120 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/CSCSimHitCollectionCnv_p4.cxx @@ -0,0 +1,83 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonSimEvent/CSCSimHit.h" +#include "MuonSimEventTPCnv/CSCSimHitCollectionCnv_p4.h" +#include "MuonSimEventTPCnv/CSCSimHitCollection_p4.h" +#include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p3.h" + +//#include <cmath> +#include "GeoPrimitives/GeoPrimitives.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" +// Athena +#include "StoreGate/StoreGateSvc.h" + +void CSCSimHitCollectionCnv_p4::transToPers(const CSCSimHitCollection* transCont, Muon::CSCSimHitCollection_p4* persCont, MsgStream &log) +{ + // for reasons of efficiency, set size before hand + unsigned int size=transCont->size(); + persCont->m_CSCid.reserve(size); + persCont->m_globalTime.reserve(size); + persCont->m_energyDeposit.reserve(size); + persCont->m_stX.reserve(size); + persCont->m_stY.reserve(size); + persCont->m_stZ.reserve(size); + persCont->m_enX.reserve(size); + persCont->m_enY.reserve(size); + persCont->m_enZ.reserve(size); + persCont->m_particleID.reserve(size); + // persCont->m_meanTime.reserve(size); + persCont->m_partLink.reserve(size); + + // make convertor to handle HepMcParticleLinks + HepMcParticleLinkCnv_p3 hepMcPLCnv; + HepMcParticleLink_p3 persLink; // will use this as a temp object inside the loop + + // loop through container, filling pers object + CSCSimHitCollection::const_iterator it = transCont->begin(), itEnd = transCont->end(); + for (; it != itEnd; ++it) { + persCont->m_CSCid.push_back(it->CSCid()); + persCont->m_globalTime.push_back(it->globalTime()); + persCont->m_energyDeposit.push_back(it->energyDeposit()); + persCont->m_stX.push_back(it->getHitStart().x()); + persCont->m_stY.push_back(it->getHitStart().y()); + persCont->m_stZ.push_back(it->getHitStart().z()); + persCont->m_enX.push_back(it->getHitEnd().x()); + persCont->m_enY.push_back(it->getHitEnd().y()); + persCont->m_enZ.push_back(it->getHitEnd().z()); + persCont->m_particleID.push_back(it->particleID()); + // persCont->m_meanTime.push_back(hit->m_meanTime); + + hepMcPLCnv.transToPers(&(it->particleLink()),&persLink, log); + persCont->m_partLink.push_back(persLink); + persCont->m_kineticEnergy.push_back(it->kineticEnergy()); + } +} + + +CSCSimHitCollection* CSCSimHitCollectionCnv_p4::createTransient(const Muon::CSCSimHitCollection_p4* persObj, MsgStream &log) { + std::unique_ptr<CSCSimHitCollection> trans(new CSCSimHitCollection("DefaultCollectionName",persObj->m_globalTime.size())); + persToTrans(persObj, trans.get(), log); + return(trans.release()); +} + + +void CSCSimHitCollectionCnv_p4::persToTrans(const Muon::CSCSimHitCollection_p4* persCont, CSCSimHitCollection* transCont, MsgStream &log) +{ + HepMcParticleLinkCnv_p3 hepMcPLCnv; + + //transCont->reserve(persCont->m_CSCid.size());//done in createTransient + for (unsigned int i = 0; i < persCont->m_CSCid.size(); i++) { + Amg::Vector3D start(persCont->m_stX[i], persCont->m_stY[i], persCont->m_stZ[i]); + Amg::Vector3D end(persCont->m_enX[i], persCont->m_enY[i], persCont->m_enZ[i]); + + HepMcParticleLink link; + hepMcPLCnv.persToTrans(&persCont->m_partLink[i],&link, log); + + transCont->Emplace (persCont->m_CSCid[i], persCont->m_globalTime[i], persCont->m_energyDeposit[i], start, end, persCont->m_particleID[i], + link, persCont->m_kineticEnergy[i]); + } +} diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/GenericMuonSimHitCollectionCnv_p3.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/GenericMuonSimHitCollectionCnv_p3.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e160b8b9803ac0b2a2e6136b768679fb669b9f24 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/GenericMuonSimHitCollectionCnv_p3.cxx @@ -0,0 +1,118 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonSimEvent/GenericMuonSimHit.h" +#include "MuonSimEventTPCnv/GenericMuonSimHitCollectionCnv_p3.h" +#include "MuonSimEventTPCnv/GenericMuonSimHitCollection_p3.h" +#include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p3.h" + +//#include <cmath> +#include "GeoPrimitives/GeoPrimitives.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" +// Athena +#include "StoreGate/StoreGateSvc.h" + +void GenericMuonSimHitCollectionCnv_p3::transToPers(const GenericMuonSimHitCollection* transCont, Muon::GenericMuonSimHitCollection_p3* persCont, MsgStream &log) +{ + // for reasons of efficiency, set size before hand + unsigned int size=transCont->size(); + persCont->m_GenericId.reserve(size); + persCont->m_globalTime.reserve(size); + persCont->m_globalpreTime.reserve(size); + // preStep Global + persCont->m_prestX.reserve(size); + persCont->m_prestY.reserve(size); + persCont->m_prestZ.reserve(size); + // preStep Local + persCont->m_prelocX.reserve(size); + persCont->m_prelocY.reserve(size); + persCont->m_prelocZ.reserve(size); + // postStep Global + persCont->m_stX.reserve(size); + persCont->m_stY.reserve(size); + persCont->m_stZ.reserve(size); + // postStep Local + persCont->m_locX.reserve(size); + persCont->m_locY.reserve(size); + persCont->m_locZ.reserve(size); + persCont->m_kineticEnergy.reserve(size); + persCont->m_particleEncoding.reserve(size); + persCont->m_ptX.reserve(size); + persCont->m_ptY.reserve(size); + persCont->m_ptZ.reserve(size); + persCont->m_depositEnergy.reserve(size); + persCont->m_StepLength.reserve(size); + persCont->m_partLink.reserve(size); + + // make convertor to handle HepMcParticleLinks + HepMcParticleLinkCnv_p3 hepMcPLCnv; + HepMcParticleLink_p3 persLink; // will use this as a temp object inside the loop + + // loop through container, filling pers object + GenericMuonSimHitCollection::const_iterator it = transCont->begin(), itEnd = transCont->end(); + for (; it != itEnd; ++it) { + persCont->m_GenericId.push_back(it->GenericId()); + persCont->m_globalTime.push_back(it->globalTime()); + persCont->m_globalpreTime.push_back(it->globalpreTime()); + // preStep Global + persCont->m_prestX.push_back(it->globalPrePosition().x()); + persCont->m_prestY.push_back(it->globalPrePosition().y()); + persCont->m_prestZ.push_back(it->globalPrePosition().z()); + // preStep Local + persCont->m_prelocX.push_back(it->localPrePosition().x()); + persCont->m_prelocY.push_back(it->localPrePosition().y()); + persCont->m_prelocZ.push_back(it->localPrePosition().z()); + // postStep Global + persCont->m_stX.push_back(it->globalPosition().x()); + persCont->m_stY.push_back(it->globalPosition().y()); + persCont->m_stZ.push_back(it->globalPosition().z()); + // postStep Local + persCont->m_locX.push_back(it->localPosition().x()); + persCont->m_locY.push_back(it->localPosition().y()); + persCont->m_locZ.push_back(it->localPosition().z()); + persCont->m_kineticEnergy.push_back(it->kineticEnergy()); + persCont->m_particleEncoding.push_back(it->particleEncoding()); + persCont->m_ptX.push_back(it->globalDirection().x()); + persCont->m_ptY.push_back(it->globalDirection().y()); + persCont->m_ptZ.push_back(it->globalDirection().z()); + persCont->m_depositEnergy.push_back(it->depositEnergy()); + persCont->m_StepLength.push_back(it->StepLength()); + + hepMcPLCnv.transToPers(&it->particleLink(),&persLink, log); + persCont->m_partLink.push_back(persLink); + + } +} + + +GenericMuonSimHitCollection* GenericMuonSimHitCollectionCnv_p3::createTransient(const Muon::GenericMuonSimHitCollection_p3* persObj, MsgStream &log) { + std::unique_ptr<GenericMuonSimHitCollection> trans(new GenericMuonSimHitCollection("DefaultCollectionName",persObj->m_globalTime.size())); + persToTrans(persObj, trans.get(), log); + return(trans.release()); +} + + +void GenericMuonSimHitCollectionCnv_p3::persToTrans(const Muon::GenericMuonSimHitCollection_p3* persCont, GenericMuonSimHitCollection* transCont, MsgStream &log) +{ + HepMcParticleLinkCnv_p3 hepMcPLCnv; + + //transCont->reserve(persCont->m_GenericId.size());//done in createTransient + for (unsigned int i = 0; i < persCont->m_GenericId.size(); i++) { + //pre + Amg::Vector3D preposition(persCont->m_prestX[i], persCont->m_prestY[i], persCont->m_prestZ[i]); + Amg::Vector3D loc_preposition(persCont->m_prelocX[i], persCont->m_prelocY[i], persCont->m_prelocZ[i]); + //post + Amg::Vector3D position(persCont->m_stX[i], persCont->m_stY[i], persCont->m_stZ[i]); + Amg::Vector3D loc_position(persCont->m_locX[i], persCont->m_locY[i], persCont->m_locZ[i]); + Amg::Vector3D direction(persCont->m_ptX[i], persCont->m_ptY[i], persCont->m_ptZ[i]); + + HepMcParticleLink link; + hepMcPLCnv.persToTrans(&persCont->m_partLink[i],&link, log); + + transCont->Emplace(persCont->m_GenericId[i], persCont->m_globalTime[i], persCont->m_globalpreTime[i], position, loc_position, preposition, loc_preposition, persCont->m_particleEncoding[i], persCont->m_kineticEnergy[i], direction, persCont->m_depositEnergy[i], persCont->m_StepLength[i], link); + } +} + diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/MDTSimHitCollectionCnv_p4.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/MDTSimHitCollectionCnv_p4.cxx new file mode 100644 index 0000000000000000000000000000000000000000..ba88b01032955d31ed281dfb1ed6a4ca919ccd53 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/MDTSimHitCollectionCnv_p4.cxx @@ -0,0 +1,84 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonSimEvent/MDTSimHit.h" +#include "MuonSimEventTPCnv/MDTSimHitCollectionCnv_p4.h" +#include "MuonSimEventTPCnv/MDTSimHitCollection_p4.h" +#include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p3.h" + +//#include <cmath> +#include "GeoPrimitives/GeoPrimitives.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" +// Athena +#include "StoreGate/StoreGateSvc.h" + +void MDTSimHitCollectionCnv_p4::transToPers(const MDTSimHitCollection* transCont, Muon::MDTSimHitCollection_p4* persCont, MsgStream &log) +{ + // for reasons of efficiency, set size before hand + unsigned int size=transCont->size(); + persCont->m_MDTid.reserve(size); + persCont->m_globalTime.reserve(size); + persCont->m_driftRadius.reserve(size); + persCont->m_stX.reserve(size); + persCont->m_stY.reserve(size); + persCont->m_stZ.reserve(size); + persCont->m_stepLength.reserve(size); + persCont->m_energyDeposit.reserve(size); + persCont->m_particleEncoding.reserve(size); + persCont->m_kineticEnergy.reserve(size); + // persCont->m_meanTime.reserve(size); + persCont->m_partLink.reserve(size); + + // make convertor to handle HepMcParticleLinks + HepMcParticleLinkCnv_p3 hepMcPLCnv; + HepMcParticleLink_p3 persLink; // will use this as a temp object inside the loop + + // loop through container, filling pers object + MDTSimHitCollection::const_iterator it = transCont->begin(), itEnd = transCont->end(); + for (; it != itEnd; ++it) { + persCont->m_MDTid.push_back(it->MDTid()); + persCont->m_globalTime.push_back(it->globalTime()); + persCont->m_driftRadius.push_back(it->driftRadius()); + persCont->m_stX.push_back(it->localPosition().x()); + persCont->m_stY.push_back(it->localPosition().y()); + persCont->m_stZ.push_back(it->localPosition().z()); + // persCont->m_meanTime.push_back(hit->m_meanTime); + persCont->m_stepLength.push_back(it->stepLength()); + persCont->m_energyDeposit.push_back(it->energyDeposit()); + persCont->m_particleEncoding.push_back(it->particleEncoding()); + persCont->m_kineticEnergy.push_back(it->kineticEnergy()); + + hepMcPLCnv.transToPers(&it->particleLink(),&persLink, log); + persCont->m_partLink.push_back(persLink); + + } +} + + +MDTSimHitCollection* MDTSimHitCollectionCnv_p4::createTransient(const Muon::MDTSimHitCollection_p4* persObj, MsgStream &log) { + std::unique_ptr<MDTSimHitCollection> trans(new MDTSimHitCollection("DefaultCollectionName",persObj->m_globalTime.size())); + persToTrans(persObj, trans.get(), log); + return(trans.release()); +} + + +void MDTSimHitCollectionCnv_p4::persToTrans(const Muon::MDTSimHitCollection_p4* persCont, MDTSimHitCollection* transCont, MsgStream &log) +{ + HepMcParticleLinkCnv_p3 hepMcPLCnv; + + //transCont->reserve(persCont->m_MDTid.size());//done in createTransient + for (unsigned int i = 0; i < persCont->m_MDTid.size(); i++) { + Amg::Vector3D position(persCont->m_stX[i], persCont->m_stY[i], persCont->m_stZ[i]); + + HepMcParticleLink link; + hepMcPLCnv.persToTrans(&persCont->m_partLink[i],&link, log); + + transCont->Emplace(persCont->m_MDTid[i], persCont->m_globalTime[i], persCont->m_driftRadius[i], position, + link, + persCont->m_stepLength[i], persCont->m_energyDeposit[i], persCont->m_particleEncoding[i], persCont->m_kineticEnergy[i]); + } +} + diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/MMSimHitCollectionCnv_p3.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/MMSimHitCollectionCnv_p3.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0690370f251cf9c65aee655af90271350ae21b78 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/MMSimHitCollectionCnv_p3.cxx @@ -0,0 +1,85 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonSimEvent/MMSimHit.h" +#include "MuonSimEventTPCnv/MMSimHitCollectionCnv_p3.h" +#include "MuonSimEventTPCnv/MMSimHitCollection_p3.h" +#include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p3.h" + +//#include <cmath> +#include "GeoPrimitives/GeoPrimitives.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" +// Athena +#include "StoreGate/StoreGateSvc.h" + +void MMSimHitCollectionCnv_p3::transToPers(const MMSimHitCollection* transCont, Muon::MMSimHitCollection_p3* persCont, MsgStream &log) +{ + // for reasons of efficiency, set size before hand + unsigned int size=transCont->size(); + persCont->m_MMId.reserve(size); + persCont->m_globalTime.reserve(size); + // postStep Global + persCont->m_stX.reserve(size); + persCont->m_stY.reserve(size); + persCont->m_stZ.reserve(size); + persCont->m_kineticEnergy.reserve(size); + persCont->m_particleEncoding.reserve(size); + persCont->m_ptX.reserve(size); + persCont->m_ptY.reserve(size); + persCont->m_ptZ.reserve(size); + persCont->m_depositEnergy.reserve(size); + persCont->m_partLink.reserve(size); + + // make convertor to handle HepMcParticleLinks + HepMcParticleLinkCnv_p3 hepMcPLCnv; + HepMcParticleLink_p3 persLink; // will use this as a temp object inside the loop + + // loop through container, filling pers object + MMSimHitCollection::const_iterator it = transCont->begin(), itEnd = transCont->end(); + for (; it != itEnd; ++it) { + persCont->m_MMId.push_back(it->MMId()); + persCont->m_globalTime.push_back(it->globalTime()); + // postStep Global + persCont->m_stX.push_back(it->globalPosition().x()); + persCont->m_stY.push_back(it->globalPosition().y()); + persCont->m_stZ.push_back(it->globalPosition().z()); + persCont->m_kineticEnergy.push_back(it->kineticEnergy()); + persCont->m_particleEncoding.push_back(it->particleEncoding()); + persCont->m_ptX.push_back(it->globalDirection().x()); + persCont->m_ptY.push_back(it->globalDirection().y()); + persCont->m_ptZ.push_back(it->globalDirection().z()); + persCont->m_depositEnergy.push_back(it->depositEnergy()); + + hepMcPLCnv.transToPers(&it->particleLink(),&persLink, log); + persCont->m_partLink.push_back(persLink); + + } +} + + +MMSimHitCollection* MMSimHitCollectionCnv_p3::createTransient(const Muon::MMSimHitCollection_p3* persObj, MsgStream &log) { + std::unique_ptr<MMSimHitCollection> trans(new MMSimHitCollection("DefaultCollectionName",persObj->m_globalTime.size())); + persToTrans(persObj, trans.get(), log); + return(trans.release()); +} + + +void MMSimHitCollectionCnv_p3::persToTrans(const Muon::MMSimHitCollection_p3* persCont, MMSimHitCollection* transCont, MsgStream &log) +{ + HepMcParticleLinkCnv_p3 hepMcPLCnv; + + for (unsigned int i = 0; i < persCont->m_MMId.size(); i++) { + //post + Amg::Vector3D position(persCont->m_stX[i], persCont->m_stY[i], persCont->m_stZ[i]); + Amg::Vector3D direction(persCont->m_ptX[i], persCont->m_ptY[i], persCont->m_ptZ[i]); + + HepMcParticleLink link; + hepMcPLCnv.persToTrans(&persCont->m_partLink[i],&link, log); + + transCont->Emplace(persCont->m_MMId[i], persCont->m_globalTime[i], position, persCont->m_particleEncoding[i], persCont->m_kineticEnergy[i], direction, persCont->m_depositEnergy[i], link); + } +} + diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/RPCSimHitCollectionCnv_p4.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/RPCSimHitCollectionCnv_p4.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2c907afe2934d518a84e19147511d4ba4843e672 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/RPCSimHitCollectionCnv_p4.cxx @@ -0,0 +1,88 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonSimEvent/RPCSimHit.h" +#include "MuonSimEventTPCnv/RPCSimHitCollectionCnv_p4.h" +#include "MuonSimEventTPCnv/RPCSimHitCollection_p4.h" +#include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p3.h" + +//#include <cmath> +#include "GeoPrimitives/GeoPrimitives.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" +// Athena +#include "StoreGate/StoreGateSvc.h" + +void RPCSimHitCollectionCnv_p4::transToPers(const RPCSimHitCollection* transCont, Muon::RPCSimHitCollection_p4* persCont, MsgStream &log) +{ + // for reasons of efficiency, set size before hand + unsigned int size=transCont->size(); + persCont->m_RPCid.reserve(size); + persCont->m_globalTime.reserve(size); + persCont->m_stX.reserve(size); + persCont->m_stY.reserve(size); + persCont->m_stZ.reserve(size); + persCont->m_partLink.reserve(size); + persCont->m_stopX.reserve(size); + persCont->m_stopY.reserve(size); + persCont->m_stopZ.reserve(size); + persCont->m_energyDeposit.reserve(size); + persCont->m_stepLength.reserve(size); + persCont->m_particleEncoding.reserve(size); + persCont->m_kineticEnergy.reserve(size); + + // make convertor to handle HepMcParticleLinks + HepMcParticleLinkCnv_p3 hepMcPLCnv; + HepMcParticleLink_p3 persLink; // will use this as a temp object inside the loop + + // loop through container, filling pers object + RPCSimHitCollection::const_iterator it = transCont->begin(), itEnd = transCont->end(); + for (; it != itEnd; ++it) { + persCont->m_RPCid.push_back(it->RPCid()); + persCont->m_globalTime.push_back(it->globalTime()); + persCont->m_stX.push_back(it->localPosition().x()); + persCont->m_stY.push_back(it->localPosition().y()); + persCont->m_stZ.push_back(it->localPosition().z()); + + hepMcPLCnv.transToPers(&it->particleLink(),&persLink, log); + persCont->m_partLink.push_back(persLink); + persCont->m_stopX.push_back(it->postLocalPosition().x()); + persCont->m_stopY.push_back(it->postLocalPosition().y()); + persCont->m_stopZ.push_back(it->postLocalPosition().z()); + persCont->m_energyDeposit.push_back(it->energyDeposit()); + persCont->m_stepLength.push_back(it->stepLength()); + persCont->m_particleEncoding.push_back(it->particleEncoding()); + persCont->m_kineticEnergy.push_back(it->kineticEnergy()); + } +} + + +RPCSimHitCollection* RPCSimHitCollectionCnv_p4::createTransient(const Muon::RPCSimHitCollection_p4* persObj, MsgStream &log) { + std::unique_ptr<RPCSimHitCollection> trans(new RPCSimHitCollection("DefaultCollectionName",persObj->m_globalTime.size())); + persToTrans(persObj, trans.get(), log); + return(trans.release()); +} + + +void RPCSimHitCollectionCnv_p4::persToTrans(const Muon::RPCSimHitCollection_p4* persCont, RPCSimHitCollection* transCont, MsgStream &log) +{ + HepMcParticleLinkCnv_p3 hepMcPLCnv; + + //transCont->reserve(persCont->m_RPCid.size());//done in createTransient + for (unsigned int i = 0; i < persCont->m_RPCid.size(); i++) { + Amg::Vector3D position(persCont->m_stX[i], persCont->m_stY[i], persCont->m_stZ[i]); + Amg::Vector3D postPosition(persCont->m_stopX[i], persCont->m_stopY[i], persCont->m_stopZ[i]); + + + HepMcParticleLink link; + hepMcPLCnv.persToTrans(&persCont->m_partLink[i],&link, log); + + transCont->Emplace(persCont->m_RPCid[i], persCont->m_globalTime[i], position, + link, postPosition, + persCont->m_energyDeposit[i], persCont->m_stepLength[i], + persCont->m_particleEncoding[i], persCont->m_kineticEnergy[i]); + } +} + diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/TGCSimHitCollectionCnv_p5.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/TGCSimHitCollectionCnv_p5.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c52727e725ed6ec3f059dd73aa6bda129e078239 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/TGCSimHitCollectionCnv_p5.cxx @@ -0,0 +1,87 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonSimEvent/TGCSimHit.h" +#include "MuonSimEventTPCnv/TGCSimHitCollectionCnv_p5.h" +#include "MuonSimEventTPCnv/TGCSimHitCollection_p5.h" +#include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p3.h" + +//#include <cmath> +#include "GeoPrimitives/GeoPrimitives.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" +// Athena +#include "StoreGate/StoreGateSvc.h" + +void TGCSimHitCollectionCnv_p5::transToPers(const TGCSimHitCollection* transCont, Muon::TGCSimHitCollection_p5* persCont, MsgStream &log) +{ + // for reasons of efficiency, set size before hand + unsigned int size=transCont->size(); + persCont->m_TGCid.reserve(size); + persCont->m_globalTime.reserve(size); + persCont->m_stX.reserve(size); + persCont->m_stY.reserve(size); + persCont->m_stZ.reserve(size); + persCont->m_enX.reserve(size); + persCont->m_enY.reserve(size); + persCont->m_enZ.reserve(size); + persCont->m_partLink.reserve(size); + persCont->m_energyDeposit.reserve(size); + persCont->m_stepLength.reserve(size); + persCont->m_particleEncoding.reserve(size); + persCont->m_kineticEnergy.reserve(size); + + // make convertor to handle HepMcParticleLinks + HepMcParticleLinkCnv_p3 hepMcPLCnv; + HepMcParticleLink_p3 persLink; // will use this as a temp object inside the loop + + // loop through container, filling pers object + TGCSimHitCollection::const_iterator it = transCont->begin(), itEnd = transCont->end(); + for (; it != itEnd; ++it) { + persCont->m_TGCid.push_back(it->TGCid()); + persCont->m_globalTime.push_back(it->globalTime()); + persCont->m_stX.push_back(it->localPosition().x()); + persCont->m_stY.push_back(it->localPosition().y()); + persCont->m_stZ.push_back(it->localPosition().z()); + persCont->m_enX.push_back(it->localDireCos().x()); + persCont->m_enY.push_back(it->localDireCos().y()); + persCont->m_enZ.push_back(it->localDireCos().z()); + persCont->m_energyDeposit.push_back(it->energyDeposit()); + persCont->m_stepLength.push_back(it->stepLength()); + persCont->m_particleEncoding.push_back(it->particleEncoding()); + persCont->m_kineticEnergy.push_back(it->kineticEnergy()); + + hepMcPLCnv.transToPers(&it->particleLink(),&persLink, log); + persCont->m_partLink.push_back(persLink); + } +} + + +TGCSimHitCollection* TGCSimHitCollectionCnv_p5::createTransient(const Muon::TGCSimHitCollection_p5* persObj, MsgStream &log) { + std::unique_ptr<TGCSimHitCollection> trans(new TGCSimHitCollection("DefaultCollectionName",persObj->m_globalTime.size())); + persToTrans(persObj, trans.get(), log); + return(trans.release()); +} + + +void TGCSimHitCollectionCnv_p5::persToTrans(const Muon::TGCSimHitCollection_p5* persCont, TGCSimHitCollection* transCont, MsgStream &log) +{ + HepMcParticleLinkCnv_p3 hepMcPLCnv; + + //transCont->reserve(persCont->m_TGCid.size()); //done in createTransient + for (unsigned int i = 0; i < persCont->m_TGCid.size(); i++) { + Amg::Vector3D position(persCont->m_stX[i], persCont->m_stY[i], persCont->m_stZ[i]); + Amg::Vector3D localDireCos(persCont->m_enX[i], persCont->m_enY[i], persCont->m_enZ[i]); + + HepMcParticleLink link; + hepMcPLCnv.persToTrans(&persCont->m_partLink[i],&link, log); + + transCont->Emplace(persCont->m_TGCid[i], persCont->m_globalTime[i], position, localDireCos, + link, + persCont->m_energyDeposit[i], persCont->m_stepLength[i], + persCont->m_particleEncoding[i], persCont->m_kineticEnergy[i]); + } +} + diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/sTGCSimHitCollectionCnv_p4.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/sTGCSimHitCollectionCnv_p4.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a112d1c133658e713fad7648dc57a4fd21ac9507 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/src/sTGCSimHitCollectionCnv_p4.cxx @@ -0,0 +1,96 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonSimEvent/sTGCSimHit.h" +#include "MuonSimEventTPCnv/sTGCSimHitCollectionCnv_p4.h" +#include "MuonSimEventTPCnv/sTGCSimHitCollection_p4.h" +#include "GeneratorObjectsTPCnv/HepMcParticleLinkCnv_p3.h" + +#include "GeoPrimitives/GeoPrimitives.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" +// Athena +#include "StoreGate/StoreGateSvc.h" + + +void sTGCSimHitCollectionCnv_p4::transToPers(const sTGCSimHitCollection* transCont, Muon::sTGCSimHitCollection_p4* persCont, MsgStream &log) +{ + // for reasons of efficiency, set size before hand + unsigned int size=transCont->size(); + persCont->m_sTGCId.reserve(size); + persCont->m_globalTime.reserve(size); + // postStep Global position + persCont->m_stX.reserve(size); + persCont->m_stY.reserve(size); + persCont->m_stZ.reserve(size); + persCont->m_particleEncoding.reserve(size); + persCont->m_depositEnergy.reserve(size); + persCont->m_partLink.reserve(size); + persCont->m_kineticEnergy.reserve(size); + // preStep global position + persCont->m_prestX.reserve(size); + persCont->m_prestY.reserve(size); + persCont->m_prestZ.reserve(size); + + // make convertor to handle HepMcParticleLinks + HepMcParticleLinkCnv_p3 hepMcPLCnv; + HepMcParticleLink_p3 persLink; // will use this as a temp object inside the loop + + // loop through container, filling pers object + sTGCSimHitCollection::const_iterator it = transCont->begin(), itEnd = transCont->end(); + for (; it != itEnd; ++it) { + persCont->m_sTGCId.push_back(it->sTGCId()); + persCont->m_globalTime.push_back(it->globalTime()); + // postStep Global position + persCont->m_stX.push_back(it->globalPosition().x()); + persCont->m_stY.push_back(it->globalPosition().y()); + persCont->m_stZ.push_back(it->globalPosition().z()); + persCont->m_particleEncoding.push_back(it->particleEncoding()); + persCont->m_depositEnergy.push_back(it->depositEnergy()); + persCont->m_kineticEnergy.push_back(it->kineticEnergy()); + // preStep global position + persCont->m_prestX.push_back(it->globalPrePosition().x()); + persCont->m_prestY.push_back(it->globalPrePosition().y()); + persCont->m_prestZ.push_back(it->globalPrePosition().z()); + + hepMcPLCnv.transToPers(&it->particleLink(),&persLink, log); + persCont->m_partLink.push_back(persLink); + + } +} + + +sTGCSimHitCollection* sTGCSimHitCollectionCnv_p4::createTransient(const Muon::sTGCSimHitCollection_p4* persObj, MsgStream &log) { + std::unique_ptr<sTGCSimHitCollection> trans(new sTGCSimHitCollection("DefaultCollectionName",persObj->m_globalTime.size())); + persToTrans(persObj, trans.get(), log); + return(trans.release()); +} + + +void sTGCSimHitCollectionCnv_p4::persToTrans(const Muon::sTGCSimHitCollection_p4* persCont, sTGCSimHitCollection* transCont, MsgStream &log) +{ + HepMcParticleLinkCnv_p3 hepMcPLCnv; + + //transCont->reserve(persCont->m_sTGCId.size());//done in createTransient + for (unsigned int i = 0; i < persCont->m_sTGCId.size(); i++) { + //postStep position + Amg::Vector3D position(persCont->m_stX[i], persCont->m_stY[i], persCont->m_stZ[i]); + // preStep position + Amg::Vector3D preposition(persCont->m_prestX[i], persCont->m_prestY[i], persCont->m_prestZ[i]); + // direction + Amg::Vector3D direction(persCont->m_stX[i] - persCont->m_prestX[i], + persCont->m_stY[i] - persCont->m_prestY[i], + persCont->m_stZ[i] - persCont->m_prestZ[i]); + // Normalize the direction vector if its length is greater than zero + if (direction.mag() > 0.0001) direction /= direction.mag(); + + HepMcParticleLink link; + hepMcPLCnv.persToTrans(&persCont->m_partLink[i],&link, log); + + transCont->Emplace(persCont->m_sTGCId[i], persCont->m_globalTime[i], position, + persCont->m_particleEncoding[i], direction, persCont->m_depositEnergy[i], link, + persCont->m_kineticEnergy[i], preposition); + } +} diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p1_test.cxx index d574cafd6310af7249387e63c29de19c9447a3b7..f707c709b9e3ae1725eae6e98ff92baa84125c02 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p1_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p1_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -83,7 +85,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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. CSCSimHitCollection dum ("coll"); @@ -92,7 +94,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr>& genPartVec CSCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, 11.5, Amg::Vector3D (12.5, 13.5, 14.5), Amg::Vector3D (15.5, 16.5, 17.5), diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p2_test.cxx index 0e198a1fcd05a08c581d7e23bc467a4bcb853827..719f9a5f00ea108a5c2e2fa81b6a0ebc13f8f8cd 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p2_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p2_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -83,7 +85,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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. CSCSimHitCollection dum ("coll"); @@ -92,7 +94,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr>& genPartVec CSCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, 11.5, Amg::Vector3D (12.5, 13.5, 14.5), Amg::Vector3D (15.5, 16.5, 17.5), diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p3_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p3_test.cxx index 231c40072ddbe22a5773ee374ab4ae162033c690..5ca1048c3c99d688a1d768d8280e07f8eefb93ad 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p3_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p3_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p3_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -83,7 +85,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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. CSCSimHitCollection dum ("coll"); @@ -92,7 +94,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr>& genPartVec CSCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, 11.5, Amg::Vector3D (12.5, 13.5, 14.5), Amg::Vector3D (15.5, 16.5, 17.5), diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p4_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p4_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..533a3d817c872a6f6d42fb070b0b67e3becaec73 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p4_test.cxx @@ -0,0 +1,120 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ +/** + * @file MuonSimEventTPCnv/test/CSCSimHitCollectionCnv_p4_test.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Mar, 2016 + * @brief Tests for CSCSimHitCollectionCnv_p4. + */ + + +#undef NDEBUG +#include "MuonSimEventTPCnv/CSCSimHitCollectionCnv_p4.h" +#include "CxxUtils/checker_macros.h" +#include "TestTools/leakcheck.h" +#include <cassert> +#include <iostream> + +#include "TruthUtils/MagicNumbers.h" +#include "GeneratorObjectsTPCnv/initMcEventCollection.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/Operators.h" + + +void compare (const HepMcParticleLink& p1, + const HepMcParticleLink& p2) +{ + assert ( p1.isValid() == p2.isValid() ); + assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); + assert ( p1.eventIndex() == p2.eventIndex() ); + assert ( p1.cptr() == p2.cptr() ); + assert ( p1 == p2 ); +} + +void compare (const CSCSimHit& p1, + const CSCSimHit& p2) +{ + assert (p1.CSCid() == p2.CSCid()); + assert (p1.globalTime() == p2.globalTime()); + assert (p1.energyDeposit() == p2.energyDeposit()); + assert (p1.getHitStart() == p2.getHitStart()); + assert (p1.getHitEnd() == p2.getHitEnd()); + assert (p1.particleID() == p2.particleID()); + compare(p1.particleLink(), p2.particleLink()); + assert (p1.particleLink() == p2.particleLink()); + assert (p1.kineticEnergy() == p2.kineticEnergy()); +} + + +void compare (const CSCSimHitCollection& p1, + const CSCSimHitCollection& p2) +{ + //assert (p1.Name() == p2.Name()); + assert (p1.size() == p2.size()); + for (size_t i=0; i < p1.size(); i++) + compare (p1[i], p2[i]); +} + + +void testit (const CSCSimHitCollection& trans1) +{ + MsgStream log (nullptr, "test"); + CSCSimHitCollectionCnv_p4 cnv; + Muon::CSCSimHitCollection_p4 pers; + cnv.transToPers (&trans1, &pers, log); + CSCSimHitCollection trans2; + cnv.persToTrans (&pers, &trans2, log); + + compare (trans1, trans2); +} + +int lundCode(int pdgid) { + if(pdgid==22) { return 1; } + if(pdgid==11) { return 2; } + if(pdgid==-11) { return 3; } + if(pdgid==13) { return 5; } + if(pdgid==-13) { return 6; } + return -1; +} + +void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr>& genPartVector) +{ + std::cout << "test1\n"; + auto particle = genPartVector.at(0); + // Create HepMcParticleLink outside of leak check. + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + assert(dummyHMPL.cptr()==particle); + // Create DVL info outside of leak check. + CSCSimHitCollection dum ("coll"); + Athena_test::Leakcheck check; + + CSCSimHitCollection trans1 ("coll"); + for (int i=0; i < 10; i++) { + auto pGenParticle = genPartVector.at(i); + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + trans1.Emplace (123, 10.5, 11.5, + Amg::Vector3D (12.5, 13.5, 14.5), + Amg::Vector3D (15.5, 16.5, 17.5), + lundCode(pGenParticle->pdg_id()), trkLink, 20.5 + ); + } + + testit (trans1); +} + + +int main ATLAS_NOT_THREAD_SAFE () +{ + ISvcLocator* pSvcLoc = nullptr; + std::vector<HepMC::GenParticlePtr> genPartVector; + if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) { + std::cerr << "This test can not be run" << std::endl; + return 0; + } + + test1(genPartVector); + return 0; +} diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p1_test.cxx index 7583f85426cef4f81dd1c5c118e04dbfe3e9ad3a..90922b16a447bc3fbc8d6075e531ea1eca9a6b92 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p1_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p1_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -80,7 +82,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. GenericMuonSimHitCollection dum ("coll"); @@ -89,7 +91,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect GenericMuonSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, 11.5, Amg::Vector3D (12.5, 13.5, 14.5), Amg::Vector3D (15.5, 16.5, 17.5), diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p2_test.cxx index 5ba0255785b76b47ee496cb34c494e8f95854ce0..0e340faebf4c79a874945e5fd3ba7f5865d6ae2e 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p2_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // $Id$ @@ -17,6 +17,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -80,7 +82,7 @@ void test1(std::vector<HepMC::GenParticlePtr> genPartVector) 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. GenericMuonSimHitCollection dum ("coll"); @@ -88,7 +90,7 @@ void test1(std::vector<HepMC::GenParticlePtr> genPartVector) GenericMuonSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, 11.5, Amg::Vector3D (12.5, 13.5, 14.5), Amg::Vector3D (15.5, 16.5, 17.5), diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p3_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p3_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..c0e6a081414c450de3fa65203b47cc8d5c0600a4 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p3_test.cxx @@ -0,0 +1,120 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +// $Id$ +/** + * @file MuonSimEventTPCnv/test/GenericMuonSimHitCollectionCnv_p3_test.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Mar, 2016 + * @brief Tests for GenericMuonSimHitCollectionCnv_p3. + */ + + +#undef NDEBUG +#include "MuonSimEventTPCnv/GenericMuonSimHitCollectionCnv_p3.h" +#include "TestTools/leakcheck.h" +#include <cassert> +#include <iostream> + +#include "TruthUtils/MagicNumbers.h" +#include "GeneratorObjectsTPCnv/initMcEventCollection.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/Operators.h" + +void compare (const HepMcParticleLink& p1, + const HepMcParticleLink& p2) +{ + assert ( p1.isValid() == p2.isValid() ); + assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); + assert ( p1.eventIndex() == p2.eventIndex() ); + assert ( p1.cptr() == p2.cptr() ); + assert ( p1 == p2 ); +} + +void compare (const GenericMuonSimHit& p1, + const GenericMuonSimHit& p2) +{ + assert (p1.GenericId() == p2.GenericId()); + assert (p1.globalTime() == p2.globalTime()); + assert (p1.globalpreTime() == p2.globalpreTime()); + assert (p1.globalPosition() == p2.globalPosition()); + assert (p1.localPosition() == p2.localPosition()); + assert (p1.globalPrePosition() == p2.globalPrePosition()); + assert (p1.localPrePosition() == p2.localPrePosition()); + assert (p1.particleEncoding() == p2.particleEncoding()); + assert (p1.kineticEnergy() == p2.kineticEnergy()); + assert (p1.globalDirection() == p2.globalDirection()); + assert (p1.depositEnergy() == p2.depositEnergy()); + assert (p1.StepLength() == p2.StepLength()); + compare(p1.particleLink(), p2.particleLink()); + assert (p1.particleLink() == p2.particleLink()); +} + + +void compare (const GenericMuonSimHitCollection& p1, + const GenericMuonSimHitCollection& p2) +{ + //assert (p1.Name() == p2.Name()); + assert (p1.size() == p2.size()); + for (size_t i=0; i < p1.size(); i++) + compare (p1[i], p2[i]); +} + + +void testit (const GenericMuonSimHitCollection& trans1) +{ + MsgStream log (nullptr, "test"); + GenericMuonSimHitCollectionCnv_p3 cnv; + Muon::GenericMuonSimHitCollection_p3 pers; + cnv.transToPers (&trans1, &pers, log); + GenericMuonSimHitCollection trans2; + cnv.persToTrans (&pers, &trans2, log); + + compare (trans1, trans2); +} + + +void test1(std::vector<HepMC::GenParticlePtr> genPartVector) +{ + std::cout << "test1\n"; + auto particle = genPartVector.at(0); + // Create HepMcParticleLink outside of leak check. + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + assert(dummyHMPL.cptr()==particle); + // Create DVL info outside of leak check. + GenericMuonSimHitCollection dum ("coll"); + + GenericMuonSimHitCollection trans1 ("coll"); + for (int i=0; i < 10; i++) { + auto pGenParticle = genPartVector.at(i); + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + trans1.Emplace (123, 10.5, 11.5, + Amg::Vector3D (12.5, 13.5, 14.5), + Amg::Vector3D (15.5, 16.5, 17.5), + Amg::Vector3D (18.5, 19.5, 20.5), + Amg::Vector3D (21.5, 22.5, 23.5), + pGenParticle->pdg_id(), 25.5, + Amg::Vector3D (26.5, 27.5, 28.5), + 29.5, 30.5, trkLink + ); + } + + testit (trans1); +} + + +int main() +{ + ISvcLocator* pSvcLoc = nullptr; + std::vector<HepMC::GenParticlePtr> genPartVector; + if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) { + std::cerr << "This test can not be run" << std::endl; + return 0; + } + + test1(genPartVector); + return 0; +} diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p1_test.cxx index 5577ac6809c7bbda4ecddaad4abf26f2d3468b64..4026af3f7835b304d8db9ad5b104c0be4a1d51d3 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p1_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p1_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -76,7 +78,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. MDTSimHitCollection dum ("coll"); @@ -85,7 +87,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect MDTSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, 11.5, Amg::Vector3D (12.5, 13.5, 14.5), trkLink, 19.5, 20.5, pGenParticle->pdg_id(), 22.5 diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p2_test.cxx index 4a893ef4acebbfca8e9901a12ec6b2a02066b5c7..ca5b542d716be6905690b71a2f2a6002b45a24f3 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p2_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p2_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -76,7 +78,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. MDTSimHitCollection dum ("coll"); @@ -85,7 +87,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect MDTSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, 11.5, Amg::Vector3D (12.5, 13.5, 14.5), trkLink, 19.5, 20.5, pGenParticle->pdg_id(), 22.5 diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p3_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p3_test.cxx index e4a1507e9e86751c325ce0b89bbc1a1b3c96bfc9..50daf5f66b669847690e7b8213cfaa6ce9d3bd41 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p3_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p3_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p3_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -76,7 +78,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. MDTSimHitCollection dum ("coll"); @@ -85,7 +87,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect MDTSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, 11.5, Amg::Vector3D (12.5, 13.5, 14.5), trkLink, 19.5, 20.5, pGenParticle->pdg_id(), 22.5 diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p4_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p4_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..7958c6f154f34880124216cb06ab0cd4a3ba515d --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p4_test.cxx @@ -0,0 +1,112 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ +/** + * @file MuonSimEventTPCnv/test/MDTSimHitCollectionCnv_p4_test.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Mar, 2016 + * @brief Tests for MDTSimHitCollectionCnv_p4. + */ + + +#undef NDEBUG +#include "MuonSimEventTPCnv/MDTSimHitCollectionCnv_p4.h" +#include "CxxUtils/checker_macros.h" +#include "TestTools/leakcheck.h" +#include <cassert> +#include <iostream> + +#include "TruthUtils/MagicNumbers.h" +#include "GeneratorObjectsTPCnv/initMcEventCollection.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/Operators.h" + + +void compare (const HepMcParticleLink& p1, + const HepMcParticleLink& p2) +{ + assert ( p1.isValid() == p2.isValid() ); + assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); + assert ( p1.eventIndex() == p2.eventIndex() ); + assert ( p1.cptr() == p2.cptr() ); + assert ( p1 == p2 ); +} + +void compare (const MDTSimHit& p1, + const MDTSimHit& p2) +{ + assert (p1.MDTid() == p2.MDTid()); + assert (p1.globalTime() == p2.globalTime()); + assert (p1.driftRadius() == p2.driftRadius()); + assert (p1.localPosition() == p2.localPosition()); + compare(p1.particleLink(), p2.particleLink()); + assert (p1.particleLink() == p2.particleLink()); + assert (p1.stepLength() == p2.stepLength()); + assert (p1.energyDeposit() == p2.energyDeposit()); + assert (p1.particleEncoding() == p2.particleEncoding()); + assert (p1.kineticEnergy() == p2.kineticEnergy()); +} + + +void compare (const MDTSimHitCollection& p1, + const MDTSimHitCollection& p2) +{ + //assert (p1.Name() == p2.Name()); + assert (p1.size() == p2.size()); + for (size_t i=0; i < p1.size(); i++) + compare (p1[i], p2[i]); +} + + +void testit (const MDTSimHitCollection& trans1) +{ + MsgStream log (nullptr, "test"); + MDTSimHitCollectionCnv_p4 cnv; + Muon::MDTSimHitCollection_p4 pers; + cnv.transToPers (&trans1, &pers, log); + MDTSimHitCollection trans2; + cnv.persToTrans (&pers, &trans2, log); + + compare (trans1, trans2); +} + + +void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVector) +{ + std::cout << "test1\n"; + auto particle = genPartVector.at(0); + // Create HepMcParticleLink outside of leak check. + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + assert(dummyHMPL.cptr()==particle); + // Create DVL info outside of leak check. + MDTSimHitCollection dum ("coll"); + Athena_test::Leakcheck check; + + MDTSimHitCollection trans1 ("coll"); + for (int i=0; i < 10; i++) { + auto pGenParticle = genPartVector.at(i); + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + trans1.Emplace (123, 10.5, 11.5, + Amg::Vector3D (12.5, 13.5, 14.5), + trkLink, 19.5, 20.5, pGenParticle->pdg_id(), 22.5 + ); + } + + testit (trans1); +} + + +int main ATLAS_NOT_THREAD_SAFE () +{ + ISvcLocator* pSvcLoc = nullptr; + std::vector<HepMC::GenParticlePtr> genPartVector; + if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) { + std::cerr << "This test can not be run" << std::endl; + return 0; + } + + test1(genPartVector); + return 0; +} diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p1_test.cxx index a211a3e66192eacb44a0cb9e7ac2546ad0824f72..146acc4616330f85169bd200d7d8df51515d2bf5 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p1_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #undef NDEBUG @@ -8,6 +8,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -19,6 +20,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -67,7 +69,7 @@ void test1(std::vector<HepMC::GenParticlePtr> genPartVector) 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. MMSimHitCollection dum ("coll"); @@ -75,7 +77,7 @@ void test1(std::vector<HepMC::GenParticlePtr> genPartVector) MMSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, Amg::Vector3D (12.5, 13.5, 14.5), pGenParticle->pdg_id(), 25.5, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p2_test.cxx index 2c82d44aed7c51cd02741bc4597dd0a053f72c61..d4bbf891ef31b74a18fc2842166d5e09ad263b50 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p2_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #undef NDEBUG @@ -8,6 +8,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -18,6 +19,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -66,7 +68,7 @@ void test1(std::vector<HepMC::GenParticlePtr> genPartVector) 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. MMSimHitCollection dum ("coll"); @@ -74,7 +76,7 @@ void test1(std::vector<HepMC::GenParticlePtr> genPartVector) MMSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, Amg::Vector3D (12.5, 13.5, 14.5), pGenParticle->pdg_id(), 25.5, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p3_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p3_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3b9e296b561cfe82b7542ced12443362cd95df9a --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/MMSimHitCollectionCnv_p3_test.cxx @@ -0,0 +1,103 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + +#undef NDEBUG +#include "MuonSimEventTPCnv/MMSimHitCollectionCnv_p3.h" +#include "TestTools/leakcheck.h" +#include <cassert> +#include <iostream> + +#include "TruthUtils/MagicNumbers.h" +#include "GeneratorObjectsTPCnv/initMcEventCollection.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/Operators.h" + +void compare (const HepMcParticleLink& p1, + const HepMcParticleLink& p2) +{ + assert ( p1.isValid() == p2.isValid() ); + assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); + assert ( p1.eventIndex() == p2.eventIndex() ); + assert ( p1.cptr() == p2.cptr() ); + assert ( p1 == p2 ); +} + +void compare (const MMSimHit& p1, + const MMSimHit& p2) +{ + assert (p1.MMId() == p2.MMId()); + assert (p1.globalTime() == p2.globalTime()); + assert (p1.globalPosition() == p2.globalPosition()); + assert (p1.particleEncoding() == p2.particleEncoding()); + assert (p1.kineticEnergy() == p2.kineticEnergy()); + assert (p1.globalDirection() == p2.globalDirection()); + assert (p1.depositEnergy() == p2.depositEnergy()); + compare(p1.particleLink(), p2.particleLink()); + assert (p1.particleLink() == p2.particleLink()); +} + + +void compare (const MMSimHitCollection& p1, + const MMSimHitCollection& p2) +{ + //assert (p1.Name() == p2.Name()); + assert (p1.size() == p2.size()); + for (size_t i=0; i < p1.size(); i++) + compare (p1[i], p2[i]); +} + + +void testit (const MMSimHitCollection& trans1) +{ + MsgStream log (nullptr, "test"); + MMSimHitCollectionCnv_p3 cnv; + Muon::MMSimHitCollection_p3 pers; + cnv.transToPers (&trans1, &pers, log); + MMSimHitCollection trans2; + cnv.persToTrans (&pers, &trans2, log); + + compare (trans1, trans2); +} + + +void test1(std::vector<HepMC::GenParticlePtr> genPartVector) +{ + std::cout << "test1\n"; + auto particle = genPartVector.at(0); + // Create HepMcParticleLink outside of leak check. + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + assert(dummyHMPL.cptr()==particle); + // Create DVL info outside of leak check. + MMSimHitCollection dum ("coll"); + + MMSimHitCollection trans1 ("coll"); + for (int i=0; i < 10; i++) { + auto pGenParticle = genPartVector.at(i); + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + trans1.Emplace (123, 10.5, + Amg::Vector3D (12.5, 13.5, 14.5), + pGenParticle->pdg_id(), 25.5, + Amg::Vector3D (26.5, 27.5, 28.5), + 29.5, trkLink + ); + } + + testit (trans1); +} + + +int main() +{ + ISvcLocator* pSvcLoc = nullptr; + std::vector<HepMC::GenParticlePtr> genPartVector; + if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) { + std::cerr << "This test can not be run" << std::endl; + return 0; + } + + test1(genPartVector); + return 0; +} diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p1_test.cxx index 49008b85746bb8bc39f7b7240536a8b741cd67b4..bf049f13ff0b3a90a4724fbee4813f9f6f439659 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p1_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p1_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -76,7 +78,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. RPCSimHitCollection dum ("coll"); @@ -85,7 +87,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect RPCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, Amg::Vector3D (12.5, 13.5, 14.5), trkLink, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p2_test.cxx index 66ad4c9f12a758a14806e902f24673abdacde3e4..ff7a08b5075ffbf0076f3ea78cc4d668455c4eec 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p2_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p2_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -76,7 +78,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. RPCSimHitCollection dum ("coll"); @@ -85,7 +87,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect RPCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, Amg::Vector3D (12.5, 13.5, 14.5), trkLink, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p3_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p3_test.cxx index 42bb37a6f676034897fb454b15e019b0d5fc26fb..b7e4b85b3e8fc30fd905fc3fdbfe0a30c17eb3a3 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p3_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p3_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p2_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -76,7 +78,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. RPCSimHitCollection dum ("coll"); @@ -85,7 +87,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect RPCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, Amg::Vector3D (12.5, 13.5, 14.5), trkLink, diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p4_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p4_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..79a7b332e617eac2f84237d4c4a9aee21a42774f --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p4_test.cxx @@ -0,0 +1,113 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ +/** + * @file MuonSimEventTPCnv/test/RPCSimHitCollectionCnv_p3_test.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Mar, 2016 + * @brief Tests for RPCSimHitCollectionCnv_p4. + */ + + +#undef NDEBUG +#include "MuonSimEventTPCnv/RPCSimHitCollectionCnv_p4.h" +#include "CxxUtils/checker_macros.h" +#include "TestTools/leakcheck.h" +#include <cassert> +#include <iostream> + +#include "TruthUtils/MagicNumbers.h" +#include "GeneratorObjectsTPCnv/initMcEventCollection.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/Operators.h" + + +void compare (const HepMcParticleLink& p1, + const HepMcParticleLink& p2) +{ + assert ( p1.isValid() == p2.isValid() ); + assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); + assert ( p1.eventIndex() == p2.eventIndex() ); + assert ( p1.cptr() == p2.cptr() ); + assert ( p1 == p2 ); +} + +void compare (const RPCSimHit& p1, + const RPCSimHit& p2) +{ + assert (p1.RPCid() == p2.RPCid()); + assert (p1.globalTime() == p2.globalTime()); + assert (p1.localPosition() == p2.localPosition()); + compare(p1.particleLink(), p2.particleLink()); + assert (p1.particleLink() == p2.particleLink()); + assert (p1.postLocalPosition() == p2.postLocalPosition()); + assert (p1.energyDeposit() == p2.energyDeposit()); + assert (p1.stepLength() == p2.stepLength()); + assert (p1.particleEncoding() == p2.particleEncoding()); + assert (p1.kineticEnergy() == p2.kineticEnergy()); +} + + +void compare (const RPCSimHitCollection& p1, + const RPCSimHitCollection& p2) +{ + //assert (p1.Name() == p2.Name()); + assert (p1.size() == p2.size()); + for (size_t i=0; i < p1.size(); i++) + compare (p1[i], p2[i]); +} + + +void testit (const RPCSimHitCollection& trans1) +{ + MsgStream log (nullptr, "test"); + RPCSimHitCollectionCnv_p4 cnv; + Muon::RPCSimHitCollection_p4 pers; + cnv.transToPers (&trans1, &pers, log); + RPCSimHitCollection trans2; + cnv.persToTrans (&pers, &trans2, log); + + compare (trans1, trans2); +} + + +void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVector) +{ + std::cout << "test1\n"; + auto particle = genPartVector.at(0); + // Create HepMcParticleLink outside of leak check. + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + assert(dummyHMPL.cptr()==particle); + // Create DVL info outside of leak check. + RPCSimHitCollection dum ("coll"); + Athena_test::Leakcheck check; + + RPCSimHitCollection trans1 ("coll"); + for (int i=0; i < 10; i++) { + auto pGenParticle = genPartVector.at(i); + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + trans1.Emplace (123, 10.5, + Amg::Vector3D (12.5, 13.5, 14.5), + trkLink, + Amg::Vector3D (16.5, 17.5, 18.5), + 19.5, 20.5, pGenParticle->pdg_id(), 22.5); + } + + testit (trans1); +} + + +int main ATLAS_NOT_THREAD_SAFE () +{ + ISvcLocator* pSvcLoc = nullptr; + std::vector<HepMC::GenParticlePtr> genPartVector; + if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) { + std::cerr << "This test can not be run" << std::endl; + return 0; + } + + test1(genPartVector); + return 0; +} diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p1_test.cxx index d95b544bc7aa9a079763724474694a14cd081016..93e2c81e042763807619c264e435aca12b7eccfd 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p1_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p1_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -76,7 +78,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. TGCSimHitCollection dum ("coll"); @@ -85,7 +87,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect TGCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, Amg::Vector3D (12.5, 13.5, 14.5), Amg::Vector3D (16.5, 17.5, 18.5), diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p2_test.cxx index 12fc7ccb2ec36b198b7b12cfa266c391e4d700b1..73914ac92f608c6998a3b2ccffc434a671a7fae9 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p2_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p2_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -76,7 +78,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. TGCSimHitCollection dum ("coll"); @@ -85,7 +87,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect TGCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, Amg::Vector3D (12.5, 13.5, 14.5), Amg::Vector3D (16.5, 17.5, 18.5), diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p3_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p3_test.cxx index 2334259115af3533f666d7f7780660413ed37122..8c39774e8f86cafbef967e2f807c70599d1bf01c 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p3_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p3_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p3_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -76,7 +78,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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. TGCSimHitCollection dum ("coll"); @@ -85,7 +87,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr>& genPartVec TGCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, Amg::Vector3D (12.5, 13.5, 14.5), Amg::Vector3D (16.5, 17.5, 18.5), diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p4_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p4_test.cxx index efe6fd290476eef638a75e15e2d47ad9f1fc9103..9ff2029b01bbdf39c2fa45ee2f929daf9c998653 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p4_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p4_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p4_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -27,6 +28,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -76,7 +78,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. TGCSimHitCollection dum ("coll"); @@ -85,7 +87,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect TGCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, Amg::Vector3D (12.5, 13.5, 14.5), Amg::Vector3D (16.5, 17.5, 18.5), diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p5_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p5_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0eed0a1827556d81f399869beee421578c6bdaab --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p5_test.cxx @@ -0,0 +1,112 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ +/** + * @file MuonSimEventTPCnv/test/TGCSimHitCollectionCnv_p5_test.cxx + * @author scott snyder <snyder@bnl.gov> + * @date Mar, 2016 + * @brief Tests for TGCSimHitCollectionCnv_p5. + */ + + +#undef NDEBUG +#include "MuonSimEventTPCnv/TGCSimHitCollectionCnv_p5.h" +#include "CxxUtils/checker_macros.h" +#include "TestTools/leakcheck.h" +#include <cassert> +#include <iostream> + +#include "TruthUtils/MagicNumbers.h" +#include "GeneratorObjectsTPCnv/initMcEventCollection.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/Operators.h" + + +void compare (const HepMcParticleLink& p1, + const HepMcParticleLink& p2) +{ + assert ( p1.isValid() == p2.isValid() ); + assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); + assert ( p1.eventIndex() == p2.eventIndex() ); + assert ( p1.cptr() == p2.cptr() ); + assert ( p1 == p2 ); +} + +void compare (const TGCSimHit& p1, + const TGCSimHit& p2) +{ + assert (p1.TGCid() == p2.TGCid()); + assert (p1.globalTime() == p2.globalTime()); + assert (p1.localPosition() == p2.localPosition()); + assert (p1.localDireCos() == p2.localDireCos()); + compare(p1.particleLink(), p2.particleLink()); + assert (p1.particleLink() == p2.particleLink()); + assert (p1.energyDeposit() == p2.energyDeposit()); + assert (p1.stepLength() == p2.stepLength()); + assert (p1.particleEncoding() == p2.particleEncoding()); + assert (p1.kineticEnergy() == p2.kineticEnergy()); +} + + +void compare (const TGCSimHitCollection& p1, + const TGCSimHitCollection& p2) +{ + //assert (p1.Name() == p2.Name()); + assert (p1.size() == p2.size()); + for (size_t i=0; i < p1.size(); i++) + compare (p1[i], p2[i]); +} + + +void testit (const TGCSimHitCollection& trans1) +{ + MsgStream log (nullptr, "test"); + TGCSimHitCollectionCnv_p5 cnv; + Muon::TGCSimHitCollection_p5 pers; + cnv.transToPers (&trans1, &pers, log); + TGCSimHitCollection trans2; + cnv.persToTrans (&pers, &trans2, log); + + compare (trans1, trans2); +} + + +void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVector) +{ + std::cout << "test1\n"; + auto particle = genPartVector.at(0); + // Create HepMcParticleLink outside of leak check. + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + assert(dummyHMPL.cptr()==particle); + // Create DVL info outside of leak check. + TGCSimHitCollection dum ("coll"); + Athena_test::Leakcheck check; + + TGCSimHitCollection trans1 ("coll"); + for (int i=0; i < 10; i++) { + auto pGenParticle = genPartVector.at(i); + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + trans1.Emplace (123, 10.5, + Amg::Vector3D (12.5, 13.5, 14.5), + Amg::Vector3D (16.5, 17.5, 18.5), + trkLink, 20.5, 21.5, pGenParticle->pdg_id(), 23.5); + } + + testit (trans1); +} + + +int main ATLAS_NOT_THREAD_SAFE () +{ + ISvcLocator* pSvcLoc = nullptr; + std::vector<HepMC::GenParticlePtr> genPartVector; + if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) { + std::cerr << "This test can not be run" << std::endl; + return 0; + } + + test1(genPartVector); + return 0; +} diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p1_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p1_test.cxx index ce78468b97db3b7542803e28f305c2b62b0d6226..2d0b80a0ae11fd0bc983c197a98de0b832896cd6 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p1_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p1_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p1_test.cxx @@ -16,6 +16,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -26,6 +27,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -73,7 +75,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. sTGCSimHitCollection dum ("coll"); @@ -82,7 +84,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect sTGCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, Amg::Vector3D (12.5, 13.5, 14.5), pGenParticle->pdg_id(), diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p2_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p2_test.cxx index 0eb3eec6aae8c9933a6c0a3c65f7c84b0632b990..51103bea1fbd0c752fb26c6fee419366868d6905 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p2_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p2_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ /** * @file MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p2_test.cxx @@ -24,6 +24,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -34,6 +35,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -82,7 +84,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. sTGCSimHitCollection dum ("coll"); @@ -91,7 +93,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect sTGCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, Amg::Vector3D (12.5, 13.5, 14.5), pGenParticle->pdg_id(), diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p3_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p3_test.cxx index 4c664ecef99f15f0c181cd9494cbe7c02419be7f..a51f84dda51d25f227cd3cb10f1a72b80db5d7a5 100644 --- a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p3_test.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p3_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ @@ -10,6 +10,7 @@ #include <cassert> #include <iostream> +#include "TruthUtils/MagicNumbers.h" #include "GeneratorObjectsTPCnv/initMcEventCollection.h" #include "AtlasHepMC/GenEvent.h" #include "AtlasHepMC/GenParticle.h" @@ -21,6 +22,7 @@ void compare (const HepMcParticleLink& p1, { assert ( p1.isValid() == p2.isValid() ); assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); assert ( p1.eventIndex() == p2.eventIndex() ); assert ( p1.cptr() == p2.cptr() ); assert ( p1 == p2 ); @@ -71,7 +73,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect 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); // FIXME barcode-based + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); assert(dummyHMPL.cptr()==particle); // Create DVL info outside of leak check. sTGCSimHitCollection dum ("coll"); @@ -80,7 +82,7 @@ void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVect sTGCSimHitCollection trans1 ("coll"); for (int i=0; i < 10; i++) { auto pGenParticle = genPartVector.at(i); - HepMcParticleLink trkLink(HepMC::barcode(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_BARCODE); // FIXME barcode-based + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); trans1.Emplace (123, 10.5, Amg::Vector3D (12.5, 13.5, 15.5), pGenParticle->pdg_id(), diff --git a/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p4_test.cxx b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p4_test.cxx new file mode 100644 index 0000000000000000000000000000000000000000..e109bc6e5406c9943ea8d23fbaad5953f1c509a9 --- /dev/null +++ b/MuonSpectrometer/MuonCnv/MuonSimEventTPCnv/test/sTGCSimHitCollectionCnv_p4_test.cxx @@ -0,0 +1,109 @@ +/* + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration +*/ + + +#undef NDEBUG +#include "MuonSimEventTPCnv/sTGCSimHitCollectionCnv_p4.h" +#include "CxxUtils/checker_macros.h" +#include "TestTools/leakcheck.h" +#include <cassert> +#include <iostream> + +#include "TruthUtils/MagicNumbers.h" +#include "GeneratorObjectsTPCnv/initMcEventCollection.h" +#include "AtlasHepMC/GenEvent.h" +#include "AtlasHepMC/GenParticle.h" +#include "AtlasHepMC/Operators.h" + + +void compare (const HepMcParticleLink& p1, + const HepMcParticleLink& p2) +{ + assert ( p1.isValid() == p2.isValid() ); + assert ( HepMC::barcode(p1) == HepMC::barcode(p2) ); + assert ( p1.id() == p2.id() ); + assert ( p1.eventIndex() == p2.eventIndex() ); + assert ( p1.cptr() == p2.cptr() ); + assert ( p1 == p2 ); +} + + +void compare (const sTGCSimHit& p1, + const sTGCSimHit& p2) +{ + assert (p1.sTGCId() == p2.sTGCId()); + assert (p1.globalTime() == p2.globalTime()); + assert (p1.globalPosition() == p2.globalPosition()); + assert (p1.particleEncoding() == p2.particleEncoding()); + assert (p1.globalDirection() == p2.globalDirection()); + assert (p1.depositEnergy() == p2.depositEnergy()); + compare(p1.particleLink(), p2.particleLink()); + assert (p1.particleLink() == p2.particleLink()); + assert (p1.kineticEnergy() == p2.kineticEnergy()); + assert (p1.globalPrePosition() == p2.globalPrePosition()); +} + + +void compare (const sTGCSimHitCollection& p1, + const sTGCSimHitCollection& p2) +{ + //assert (p1.Name() == p2.Name()); + assert (p1.size() == p2.size()); + for (size_t i=0; i < p1.size(); i++) + compare (p1[i], p2[i]); +} + + +void testit (const sTGCSimHitCollection& trans1) +{ + MsgStream log (nullptr, "test"); + sTGCSimHitCollectionCnv_p4 cnv; + Muon::sTGCSimHitCollection_p4 pers; + cnv.transToPers (&trans1, &pers, log); + sTGCSimHitCollection trans2; + cnv.persToTrans (&pers, &trans2, log); + + compare (trans1, trans2); +} + + +void test1 ATLAS_NOT_THREAD_SAFE (std::vector<HepMC::GenParticlePtr> genPartVector) +{ + std::cout << "test1\n"; + auto particle = genPartVector.at(0); + // Create HepMcParticleLink outside of leak check. + HepMcParticleLink dummyHMPL(HepMC::uniqueID(particle),particle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + assert(dummyHMPL.cptr()==particle); + // Create DVL info outside of leak check. + sTGCSimHitCollection dum ("coll"); + Athena_test::Leakcheck check; + + sTGCSimHitCollection trans1 ("coll"); + for (int i=0; i < 10; i++) { + auto pGenParticle = genPartVector.at(i); + HepMcParticleLink trkLink(HepMC::uniqueID(pGenParticle),pGenParticle->parent_event()->event_number(),HepMcParticleLink::IS_EVENTNUM,HepMcParticleLink::IS_ID); + trans1.Emplace (123, 10.5, + Amg::Vector3D (12.5, 13.5, 15.5), + pGenParticle->pdg_id(), + Amg::Vector3D (0.0, 0.0, 1.0), + 19.5, trkLink, 22.5, + Amg::Vector3D (12.5, 13.5, 14.5)); + } + + testit (trans1); +} + + +int main ATLAS_NOT_THREAD_SAFE () +{ + ISvcLocator* pSvcLoc = nullptr; + std::vector<HepMC::GenParticlePtr> genPartVector; + if (!Athena_test::initMcEventCollection(pSvcLoc,genPartVector)) { + std::cerr << "This test can not be run" << std::endl; + return 0; + } + + test1(genPartVector); + return 0; +}