From 50cdac31896f5adbfc8f6b4ea7f31d0e326f5643 Mon Sep 17 00:00:00 2001 From: Alaettin Serhan Mete <alaettin.serhan.mete@cern.ch> Date: Wed, 8 Nov 2023 07:22:23 +0100 Subject: [PATCH 1/2] TP separate LArTTL1 --- .../LArAthenaPool/src/LArTTL1ContainerCnv.cxx | 52 +++++++++++++++++++ .../LArAthenaPool/src/LArTTL1ContainerCnv.h | 52 +++++++++++++++++++ .../LArCnv/LArTPCnv/LArTPCnv/LArTPCnvDict.h | 5 +- .../LArCnv/LArTPCnv/LArTPCnv/LArTTL1Cnv_p1.h | 42 +++++++++++++++ .../LArTPCnv/LArTTL1ContainerCnv_p1.h | 24 +++++++++ .../LArTPCnv/LArTPCnv/LArTTL1Container_p1.h | 14 +++++ .../LArCnv/LArTPCnv/LArTPCnv/LArTTL1_p1.h | 34 ++++++++++++ .../LArCnv/LArTPCnv/LArTPCnv/selection.xml | 3 ++ .../LArCnv/LArTPCnv/src/LArTPCnv.cxx | 10 +++- .../LArCnv/LArTPCnv/src/LArTTL1Cnv_p1.cxx | 24 +++++++++ 10 files changed, 258 insertions(+), 2 deletions(-) create mode 100755 LArCalorimeter/LArCnv/LArAthenaPool/src/LArTTL1ContainerCnv.cxx create mode 100644 LArCalorimeter/LArCnv/LArAthenaPool/src/LArTTL1ContainerCnv.h create mode 100644 LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1Cnv_p1.h create mode 100644 LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1ContainerCnv_p1.h create mode 100644 LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1Container_p1.h create mode 100644 LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1_p1.h create mode 100644 LArCalorimeter/LArCnv/LArTPCnv/src/LArTTL1Cnv_p1.cxx diff --git a/LArCalorimeter/LArCnv/LArAthenaPool/src/LArTTL1ContainerCnv.cxx b/LArCalorimeter/LArCnv/LArAthenaPool/src/LArTTL1ContainerCnv.cxx new file mode 100755 index 000000000000..13a0db1e779c --- /dev/null +++ b/LArCalorimeter/LArCnv/LArAthenaPool/src/LArTTL1ContainerCnv.cxx @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +// Framework includes +#include "GaudiKernel/MsgStream.h" + +// LArTPCnv includes +#include "LArTPCnv/LArTTL1ContainerCnv_p1.h" + +// LArEventAthenaPool includes +#include "LArTTL1ContainerCnv.h" + +LArTTL1Container_PERS* +LArTTL1ContainerCnv::createPersistent( LArTTL1Container* transCont ) +{ + MsgStream msg( msgSvc(), "LArTTL1ContainerCnv" ); + + LArTTL1ContainerCnv_p1 cnv; + LArTTL1Container_PERS *persObj = cnv.createPersistent( transCont, msg ); + + if (msg.level()<=MSG::DEBUG) + msg << MSG::DEBUG << "::createPersistent [Success]" << endmsg; + return persObj; +} + +LArTTL1Container* LArTTL1ContainerCnv::createTransient() { + + MsgStream msg( msgSvc(), "LArTTL1ContainerCnv" ); + + LArTTL1Container *transObj = 0; + + static const pool::Guid tr_guid("38FAECC7-D0C5-4DD8-8FAE-8D35F0542ECD"); + static const pool::Guid p1_guid("b859a463-2ea4-4902-b46a-89e5fbc20132"); + + if ( compareClassGuid(tr_guid) ) { + + // regular object from before the T/P separation + return poolReadObject<LArTTL1Container>(); + + } else if ( compareClassGuid(p1_guid) ) { + + // using unique_ptr ensures deletion of the persistent object + std::unique_ptr<LArTTL1Container_p1> persObj( poolReadObject<LArTTL1Container_p1>() ); + LArTTL1ContainerCnv_p1 cnv; + transObj = cnv.createTransient( persObj.get(), msg ); + } else { + throw std::runtime_error("Unsupported persistent version of LArTTL1Container"); + } + + return transObj; +} diff --git a/LArCalorimeter/LArCnv/LArAthenaPool/src/LArTTL1ContainerCnv.h b/LArCalorimeter/LArCnv/LArAthenaPool/src/LArTTL1ContainerCnv.h new file mode 100644 index 000000000000..ee6e7ce76cb2 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArAthenaPool/src/LArTTL1ContainerCnv.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LAREVENTATHENAPOOL_LARTTL1CONTAINERCNV_H +#define LAREVENTATHENAPOOL_LARTTL1CONTAINERCNV_H + +// AthenaPoolCnvSvc includes +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" + +// LArTPCnv includes +#include "LArTPCnv/LArTTL1Container_p1.h" + +// LArRawEvent includes +#include "LArRawEvent/LArTTL1Container.h" + +typedef LArTTL1Container_p1 LArTTL1Container_PERS; + +class LArTTL1ContainerCnv: public T_AthenaPoolCustomCnv< + LArTTL1Container, + LArTTL1Container_PERS + > + +{ + + // make the factory for this converter our friend + friend class CnvFactory<LArTTL1ContainerCnv>; + + protected: + + /** Create the converter from the service locator + */ +public: + LArTTL1ContainerCnv(ISvcLocator* svcloc); +protected: + + /** Build the persistent representation from the transient one. + */ + virtual LArTTL1Container_PERS* + createPersistent( LArTTL1Container* transCont ); + + /** Build the transient representation from a persistent one + */ + virtual LArTTL1Container* createTransient(); + +}; + +inline LArTTL1ContainerCnv::LArTTL1ContainerCnv( ISvcLocator* svcLocator ) : + T_AthenaPoolCustomCnv<LArTTL1Container, LArTTL1Container_PERS>(svcLocator) +{} + +#endif //> LAREVENTATHENAPOOL_LARTTL1CONTAINERCNV_H diff --git a/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTPCnvDict.h b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTPCnvDict.h index 8913ad2395db..6f758bcd7cdc 100644 --- a/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTPCnvDict.h +++ b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTPCnvDict.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ @@ -30,6 +30,9 @@ #include "Identifier/HWIdentifier.h" +#include "LArTPCnv/LArTTL1_p1.h" +#include "LArTPCnv/LArTTL1Container_p1.h" + struct GCCXML_DUMMY_INSTANTIATION_LARTPCNV { std::pair<unsigned int, std::vector<int> > m_pair1; std::vector<std::pair<unsigned int, std::vector<int> > > m_vpair1; diff --git a/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1Cnv_p1.h b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1Cnv_p1.h new file mode 100644 index 000000000000..c2ddc26bcfbd --- /dev/null +++ b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1Cnv_p1.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARTPCNV_LARTTL1CNV_P1_H +#define LARTPCNV_LARTTL1CNV_P1_H + +// AthenaPoolCnvSvc includes +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +// LArTPCnv includes +#include "LArTPCnv/LArTTL1_p1.h" + +// LArRawEvent includes +#include "LArRawEvent/LArTTL1.h" + +class MsgStream; + +class LArTTL1Cnv_p1 : public T_AthenaPoolTPCnvConstBase<LArTTL1, LArTTL1_p1> { + +public: + using base_class::transToPers; + using base_class::persToTrans; + + + /** Default constructor: + */ + LArTTL1Cnv_p1() {} + + /** Method creating the transient representation LArTTL1 + * from its persistent representation LArTTL1_p1 + */ + virtual void persToTrans(const LArTTL1_p1* persObj, LArTTL1* transObj, MsgStream &log) const override; + + /** Method creating the persistent representation LArTTL1_p1 + * from its transient representation LArTTL1 + */ + virtual void transToPers(const LArTTL1* transObj, LArTTL1_p1* persObj, MsgStream &log) const override; + +}; + +#endif //> LARTPCNV_LARTTL1CNV_P1_H diff --git a/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1ContainerCnv_p1.h b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1ContainerCnv_p1.h new file mode 100644 index 000000000000..946e966af055 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1ContainerCnv_p1.h @@ -0,0 +1,24 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARTPCNV_LARTTL1CONTAINERCNV_P1_H +#define LARTPCNV_LARTTL1CONTAINERCNV_P1_H + +// AthenaPoolCnvSvc includes +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +// LArTPCnv includes +#include "LArTPCnv/LArTTL1Container_p1.h" +#include "LArTPCnv/LArTTL1Cnv_p1.h" + +// LArRawEvent includes +#include "LArRawEvent/LArTTL1Container.h" + +typedef T_AthenaPoolTPCnvVector< + LArTTL1Container, + LArTTL1Container_p1, + LArTTL1Cnv_p1 + > LArTTL1ContainerCnv_p1; + +#endif //> LARTPCNV_LARTTL1CONTAINERCNV_P1_H diff --git a/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1Container_p1.h b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1Container_p1.h new file mode 100644 index 000000000000..dceb92be1cb4 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1Container_p1.h @@ -0,0 +1,14 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARTPCNV_LARTTL1CONTAINER_P1_H +#define LARTPCNV_LARTTL1CONTAINER_P1_H + +// LArTPCnv includes +#include "LArTPCnv/LArTTL1_p1.h" + +class LArTTL1Container_p1 : public std::vector<LArTTL1_p1> +{}; + +#endif //> LARTPCNV_LARTTL1CONTAINER_P1_H diff --git a/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1_p1.h b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1_p1.h new file mode 100644 index 000000000000..51aec9639b87 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1_p1.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef LARTPCNV_LARTTL1_P1_H +#define LARTPCNV_LARTTL1_P1_H + +#include <vector> + +#include "Identifier/Identifier.h" + +// forward declarations +class LArTTL1Cnv_p1; + +class LArTTL1_p1 { + + // Make the AthenaPoolCnv class our friend + friend class LArTTL1Cnv_p1; + +public: + + /** Default constructor: + */ + LArTTL1_p1() : m_offlineId(0), m_samples() {} + +private: + + Identifier m_offlineId; + std::vector<float> m_samples; + +}; + +#endif //> LARTPCNV_LARTTL1_P1_H + diff --git a/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/selection.xml b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/selection.xml index cb44b7e680e9..27ce7d0397be 100644 --- a/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/selection.xml +++ b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/selection.xml @@ -17,6 +17,9 @@ <class name="std::vector<std::pair<unsigned int, std::vector<int> > >" /> <!-- pair<unsigned,vector<int> > and associated pair_base --> <class pattern="std::*pair*<unsigned int*std::vector<int*> >" /> + <class name="LArTTL1_p1" /> + <class name="std::vector<LArTTL1_p1>" /> + <class name="LArTTL1Container_p1" id="b859a463-2ea4-4902-b46a-89e5fbc20132" /> <exclusion> <!-- Exclude internal traits classes using pair that could be diff --git a/LArCalorimeter/LArCnv/LArTPCnv/src/LArTPCnv.cxx b/LArCalorimeter/LArCnv/LArTPCnv/src/LArTPCnv.cxx index aa33f155bf76..af339f599e73 100644 --- a/LArCalorimeter/LArCnv/LArTPCnv/src/LArTPCnv.cxx +++ b/LArCalorimeter/LArCnv/LArTPCnv/src/LArTPCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration */ // generate the T/P converter entries @@ -43,6 +43,10 @@ #include "LArTPCnv/LArLATOMEHeaderContainerCnv_p1.h" +#include "LArTPCnv/LArTTL1_p1.h" +#include "LArTPCnv/LArTTL1Container_p1.h" +#include "LArTPCnv/LArTTL1ContainerCnv_p1.h" + DECLARE_TPCNV_FACTORY(LArDigitContainerCnv_p1, LArDigitContainer, LArDigitContainer_p1, @@ -103,3 +107,7 @@ DECLARE_TPCNV_FACTORY(LArLATOMEHeaderContainerCnv_p1, LArLATOMEHeaderContainer_p1, Athena::TPCnvVers::Current) +DECLARE_TPCNV_FACTORY(LArTTL1ContainerCnv_p1, + LArContainer<LArTTL1>, + LArTTL1Container_p1, + Athena::TPCnvVers::Current) diff --git a/LArCalorimeter/LArCnv/LArTPCnv/src/LArTTL1Cnv_p1.cxx b/LArCalorimeter/LArCnv/LArTPCnv/src/LArTTL1Cnv_p1.cxx new file mode 100644 index 000000000000..7c4216d09861 --- /dev/null +++ b/LArCalorimeter/LArCnv/LArTPCnv/src/LArTTL1Cnv_p1.cxx @@ -0,0 +1,24 @@ +/* + Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +*/ + +#include "LArRawEvent/LArTTL1.h" +#include "LArTPCnv/LArTTL1Cnv_p1.h" +#include "Identifier/HWIdentifier.h" + +void +LArTTL1Cnv_p1::persToTrans(const LArTTL1_p1* persObj, LArTTL1* transObj, MsgStream &/*log*/) const +{ + HWIdentifier ttChannel; + *transObj = LArTTL1 (ttChannel, + persObj->m_offlineId, + persObj->m_samples); +} + + +void +LArTTL1Cnv_p1::transToPers(const LArTTL1* transObj, LArTTL1_p1* persObj, MsgStream &/*log*/) const +{ + persObj->m_offlineId = transObj->ttOfflineID(); + persObj->m_samples = transObj->samples(); +} -- GitLab From bf20747c02b85d6901e911c8030ade7644b2317e Mon Sep 17 00:00:00 2001 From: Alaettin Serhan Mete <alaettin.serhan.mete@cern.ch> Date: Wed, 8 Nov 2023 20:15:52 +0100 Subject: [PATCH 2/2] Default construct the Identifier --- LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1_p1.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1_p1.h b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1_p1.h index 51aec9639b87..eda3c1c14911 100644 --- a/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1_p1.h +++ b/LArCalorimeter/LArCnv/LArTPCnv/LArTPCnv/LArTTL1_p1.h @@ -21,7 +21,7 @@ public: /** Default constructor: */ - LArTTL1_p1() : m_offlineId(0), m_samples() {} + LArTTL1_p1() : m_offlineId(), m_samples() {} private: @@ -31,4 +31,3 @@ private: }; #endif //> LARTPCNV_LARTTL1_P1_H - -- GitLab