From a9fa19b7db5c806e0e4e12c6f2df5fe155d36543 Mon Sep 17 00:00:00 2001 From: Pavol Strizenec <Pavol.Strizenec@cern.ch> Date: Fri, 26 Jul 2013 11:38:54 +0200 Subject: [PATCH] fix checkreq warnings (TBEventAthenaPool-00-01-01) --- TestBeam/TBEventAthenaPool/cmt/requirements | 47 +++++++++++++ .../TBEventAthenaPool/src/TBADCRawContCnv.cxx | 29 ++++++++ .../TBEventAthenaPool/src/TBADCRawContCnv.h | 33 +++++++++ .../TBEventAthenaPool/src/TBBPCContCnv.cxx | 28 ++++++++ TestBeam/TBEventAthenaPool/src/TBBPCContCnv.h | 33 +++++++++ .../TBEventAthenaPool/src/TBBPCRawContCnv.cxx | 69 +++++++++++++++++++ .../TBEventAthenaPool/src/TBBPCRawContCnv.h | 36 ++++++++++ .../TBEventAthenaPool/src/TBEventInfoCnv.cxx | 29 ++++++++ .../TBEventAthenaPool/src/TBEventInfoCnv.h | 33 +++++++++ .../TBEventAthenaPool/src/TBHitContCnv.cxx | 69 +++++++++++++++++++ TestBeam/TBEventAthenaPool/src/TBHitContCnv.h | 36 ++++++++++ .../src/TBHitPlaneContCnv.cxx | 69 +++++++++++++++++++ .../TBEventAthenaPool/src/TBHitPlaneContCnv.h | 36 ++++++++++ .../src/TBIdentifiedParticleCnv.cxx | 69 +++++++++++++++++++ .../src/TBIdentifiedParticleCnv.h | 36 ++++++++++ .../src/TBLArCalibDigitContainerCnv.cxx | 69 +++++++++++++++++++ .../src/TBLArCalibDigitContainerCnv.h | 36 ++++++++++ .../src/TBLArDigitContainerCnv.cxx | 51 ++++++++++++++ .../src/TBLArDigitContainerCnv.h | 41 +++++++++++ .../TBEventAthenaPool/src/TBMWPCContCnv.cxx | 29 ++++++++ .../TBEventAthenaPool/src/TBMWPCContCnv.h | 32 +++++++++ .../src/TBMWPCRawContCnv.cxx | 69 +++++++++++++++++++ .../TBEventAthenaPool/src/TBMWPCRawContCnv.h | 36 ++++++++++ TestBeam/TBEventAthenaPool/src/TBPhaseCnv.cxx | 29 ++++++++ TestBeam/TBEventAthenaPool/src/TBPhaseCnv.h | 32 +++++++++ .../src/TBScintillatorContCnv.cxx | 29 ++++++++ .../src/TBScintillatorContCnv.h | 33 +++++++++ .../src/TBScintillatorRawContCnv.cxx | 69 +++++++++++++++++++ .../src/TBScintillatorRawContCnv.h | 36 ++++++++++ TestBeam/TBEventAthenaPool/src/TBTDCCnv.cxx | 28 ++++++++ TestBeam/TBEventAthenaPool/src/TBTDCCnv.h | 33 +++++++++ .../TBEventAthenaPool/src/TBTDCRawContCnv.cxx | 29 ++++++++ .../TBEventAthenaPool/src/TBTDCRawContCnv.h | 34 +++++++++ .../src/TBTailCatcherCnv.cxx | 29 ++++++++ .../TBEventAthenaPool/src/TBTailCatcherCnv.h | 34 +++++++++ .../src/TBTailCatcherRawCnv.cxx | 69 +++++++++++++++++++ .../src/TBTailCatcherRawCnv.h | 36 ++++++++++ TestBeam/TBEventAthenaPool/src/TBTrackCnv.cxx | 30 ++++++++ TestBeam/TBEventAthenaPool/src/TBTrackCnv.h | 35 ++++++++++ .../TBEventAthenaPool/src/TBTrackInfoCnv.cxx | 29 ++++++++ .../TBEventAthenaPool/src/TBTrackInfoCnv.h | 33 +++++++++ .../src/TBTriggerPatternUnitCnv.cxx | 29 ++++++++ .../src/TBTriggerPatternUnitCnv.h | 33 +++++++++ 43 files changed, 1724 insertions(+) create mode 100755 TestBeam/TBEventAthenaPool/cmt/requirements create mode 100755 TestBeam/TBEventAthenaPool/src/TBADCRawContCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBADCRawContCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBBPCContCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBBPCContCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBBPCRawContCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBBPCRawContCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBEventInfoCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBEventInfoCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBHitContCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBHitContCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBHitPlaneContCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBHitPlaneContCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBIdentifiedParticleCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBIdentifiedParticleCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBLArCalibDigitContainerCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBLArCalibDigitContainerCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBLArDigitContainerCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBLArDigitContainerCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBMWPCContCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBMWPCContCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBMWPCRawContCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBMWPCRawContCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBPhaseCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBPhaseCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBScintillatorContCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBScintillatorContCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBScintillatorRawContCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBScintillatorRawContCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBTDCCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBTDCCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBTDCRawContCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBTDCRawContCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBTailCatcherCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBTailCatcherCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBTailCatcherRawCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBTailCatcherRawCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBTrackCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBTrackCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBTrackInfoCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBTrackInfoCnv.h create mode 100755 TestBeam/TBEventAthenaPool/src/TBTriggerPatternUnitCnv.cxx create mode 100755 TestBeam/TBEventAthenaPool/src/TBTriggerPatternUnitCnv.h diff --git a/TestBeam/TBEventAthenaPool/cmt/requirements b/TestBeam/TBEventAthenaPool/cmt/requirements new file mode 100755 index 00000000000..fdeb338bfaf --- /dev/null +++ b/TestBeam/TBEventAthenaPool/cmt/requirements @@ -0,0 +1,47 @@ +# +package TBEventAthenaPool + +author Rolf Seuster <seuster@cern.ch> +use AtlasPolicy AtlasPolicy-* + +# for converter +use AthenaPoolUtilities AthenaPoolUtilities-* Database/AthenaPOOL + +private +use TBEvent TBEvent-* TestBeam +use TBTPCnv TBTPCnv-* TestBeam +use SGTools SGTools-* Control +use GaudiInterface GaudiInterface-* External + +public +# converter +apply_pattern poolcnv files="-s=${TBEvent_root}/TBEvent TBADCRawCont.h \ + -s=${TBEvent_root}/TBEvent TBBPCCont.h \ + -s=${TBEvent_root}/TBEvent TBBPCRawCont.h \ + -s=${TBEvent_root}/TBEvent TBEventInfo.h \ + -s=${TBEvent_root}/TBEvent TBHitCont.h \ + -s=${TBEvent_root}/TBEvent TBHitPlaneCont.h \ + -s=${TBEvent_root}/TBEvent TBIdentifiedParticle.h \ + -s=${TBEvent_root}/TBEvent TBLArCalibDigitContainer.h \ + -s=${TBEvent_root}/TBEvent TBLArDigitContainer.h \ + -s=${TBEvent_root}/TBEvent TBMWPCCont.h \ + -s=${TBEvent_root}/TBEvent TBMWPCRawCont.h \ + -s=${TBEvent_root}/TBEvent TBPhase.h \ + -s=${TBEvent_root}/TBEvent TBScintillatorCont.h \ + -s=${TBEvent_root}/TBEvent TBScintillatorRawCont.h \ + -s=${TBEvent_root}/TBEvent TBTDC.h \ + -s=${TBEvent_root}/TBEvent TBTDCRawCont.h \ + -s=${TBEvent_root}/TBEvent TBTailCatcher.h \ + -s=${TBEvent_root}/TBEvent TBTailCatcherRaw.h \ + -s=${TBEvent_root}/TBEvent TBTrack.h \ + -s=${TBEvent_root}/TBEvent TBTriggerPatternUnit.h \ + -s=${TBEvent_root}/TBEvent TBTrackInfo.h" + + + + + +### use AthenaPoolCnvSvc AthenaPoolCnvSvc-00-* Database/AthenaPOOL +### apply_pattern poolcnv files=${converters} +### macro_append TBEventAthenaPoolPoolCnv_shlibflags "$(TBEventAthenaPool_dict_linkopts)" + diff --git a/TestBeam/TBEventAthenaPool/src/TBADCRawContCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBADCRawContCnv.cxx new file mode 100755 index 00000000000..c636f891909 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBADCRawContCnv.cxx @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBADCRawContCnv.h" + +TBADCRawCont_PERS* TBADCRawContCnv::createPersistent(TBADCRawCont* transCont) { + MsgStream log(messageService(), "TBADCRawContConverter" ); + TBADCRawCont_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + log << MSG::DEBUG << "Success" << endreq; + return persObj; +} + +TBADCRawCont* TBADCRawContCnv::createTransient() { + MsgStream log(messageService(), "TBADCRawContConverter" ); + static pool::Guid p1_guid("4D0407FD-A534-4595-B5BD-4A8DB797A094"); // GUID of the persistent object + static pool::Guid p0_guid("5D407302-FD4E-42BC-A6E5-F5C9ECCDCBF1"); // GUID of the transient object + if( compareClassGuid(p1_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< TBADCRawCont_p1 > col_vect( poolReadObject< TBADCRawCont_p1 >() ); + return m_TPConverter.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p0_guid) ) { + // regular object from before TP separation, just return it + return poolReadObject< TBADCRawCont >(); + } + throw std::runtime_error("Unsupported persistent version of Data Collection"); +} + diff --git a/TestBeam/TBEventAthenaPool/src/TBADCRawContCnv.h b/TestBeam/TBEventAthenaPool/src/TBADCRawContCnv.h new file mode 100755 index 00000000000..36844e27576 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBADCRawContCnv.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBADCRAWCONTCNV_P1_H +#define TBEVENTATHENAPOOL_TBADCRAWCONTCNV_P1_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "TBTPCnv/TBADCRawCont_p1.h" +#include "TBEvent/TBADCRawCont.h" +#include "TBTPCnv/TBADCRawContCnv_p1.h" + +// the latest persistent representation type of TBADCRawCont: +typedef TBADCRawCont_p1 TBADCRawCont_PERS; +typedef T_AthenaPoolCustomCnv<TBADCRawCont, TBADCRawCont_PERS > TBADCRawContCnvBase; + +class TBADCRawContCnv : public TBADCRawContCnvBase { +friend class CnvFactory<TBADCRawContCnv >; +protected: + TBADCRawContCnv (ISvcLocator* svcloc) : TBADCRawContCnvBase(svcloc) {} + virtual TBADCRawCont_PERS* createPersistent (TBADCRawCont* transCont); + virtual TBADCRawCont* createTransient (); + + TBADCRawContCnv_p1 m_TPConverter; +}; +#endif + diff --git a/TestBeam/TBEventAthenaPool/src/TBBPCContCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBBPCContCnv.cxx new file mode 100755 index 00000000000..fcaad76fc06 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBBPCContCnv.cxx @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBBPCContCnv.h" + +TBBPCCont_PERS* TBBPCContCnv::createPersistent(TBBPCCont* transCont) { + MsgStream log(messageService(), "TBBPCContConverter" ); + TBBPCCont_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + log << MSG::DEBUG << "Success" << endreq; + return persObj; +} + +TBBPCCont* TBBPCContCnv::createTransient() { + MsgStream log(messageService(), "TBBPCContConverter" ); + static pool::Guid p1_guid("89A09260-F284-4694-8687-3C6C72989A96"); // GUID of the persistent object + static pool::Guid p0_guid("05E6C927-F43C-4C2A-B654-C671BF8FDB67"); // GUID of the transient object + if( compareClassGuid(p1_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< TBBPCCont_p1 > col_vect( poolReadObject< TBBPCCont_p1 >() ); + return m_TPConverter.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p0_guid) ) { + // regular object from before TP separation, just return it + return poolReadObject< TBBPCCont >(); + } + throw std::runtime_error("Unsupported persistent version of Data Collection"); +} diff --git a/TestBeam/TBEventAthenaPool/src/TBBPCContCnv.h b/TestBeam/TBEventAthenaPool/src/TBBPCContCnv.h new file mode 100755 index 00000000000..d119c53568c --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBBPCContCnv.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBBPCCONTCNV_P1_H +#define TBEVENTATHENAPOOL_TBBPCCONTCNV_P1_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "TBTPCnv/TBBPCCont_p1.h" +#include "TBEvent/TBBPCCont.h" +#include "TBTPCnv/TBBPCContCnv_p1.h" + +// the latest persistent representation type of TBBPCCont: +typedef TBBPCCont_p1 TBBPCCont_PERS; +typedef T_AthenaPoolCustomCnv<TBBPCCont, TBBPCCont_PERS > TBBPCContCnvBase; + +class TBBPCContCnv : public TBBPCContCnvBase { +friend class CnvFactory<TBBPCContCnv >; +protected: + TBBPCContCnv (ISvcLocator* svcloc) : TBBPCContCnvBase(svcloc) {} + virtual TBBPCCont_PERS* createPersistent (TBBPCCont* transCont); + virtual TBBPCCont* createTransient (); + + TBBPCContCnv_p1 m_TPConverter; +}; +#endif + diff --git a/TestBeam/TBEventAthenaPool/src/TBBPCRawContCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBBPCRawContCnv.cxx new file mode 100755 index 00000000000..79d71f9590f --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBBPCRawContCnv.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBBPCRawContCnv.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" + +// Athena +#include "SGTools/StorableConversions.h" + + +// Constructor - call base constructor and initialize local attributes +TBBPCRawContCnv::TBBPCRawContCnv(ISvcLocator* svcloc) + : + // Base class constructor + TBBPCRawContCnvBase::T_AthenaPoolCnv(svcloc) +{} + +// Destructor +TBBPCRawContCnv::~TBBPCRawContCnv() +{} + +StatusCode TBBPCRawContCnv::initialize() +{ + // Call base clase initialize + AthenaPoolConverter::initialize(); + + // Get the messaging service, print where you are + MsgStream log(msgSvc(), "TBBPCRawContCnv"); + log << MSG::INFO << "initialize()" << endreq; + + return StatusCode::SUCCESS; +} + + +StatusCode TBBPCRawContCnv::PoolToDataObject(DataObject*& pObj,const std::string &token) +{ + // First call base class converter to get DataObject from + // pool. Then modify as appropriate + + MsgStream log(messageService(), "TBBPCRawContCnv::PoolToDataObject" ); + + StatusCode sc = TBBPCRawContCnvBase::PoolToDataObject(pObj, token); + if (sc.isFailure()) { + log << MSG::FATAL << "Unable to get object from pool" << endreq; + return StatusCode::FAILURE; + } else { + log << MSG::DEBUG << " Found DataObject " << endreq; + } + + // Convert DataObject pointer to TBBPCRawCont* + TBBPCRawCont* obj=0; + SG::fromStorable(pObj, obj ); + if(!obj) { + log << MSG::ERROR << " failed to cast to TBBPCRawCont " << endreq ; + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + +StatusCode TBBPCRawContCnv::DataObjectToPool(DataObject* pObj, const std::string &tname) +{ + MsgStream log(messageService(),"TBBPCRawContCnv::DataObjectToPool" ); + + return TBBPCRawContCnvBase::DataObjectToPool( pObj, tname) ; +} diff --git a/TestBeam/TBEventAthenaPool/src/TBBPCRawContCnv.h b/TestBeam/TBEventAthenaPool/src/TBBPCRawContCnv.h new file mode 100755 index 00000000000..cfac392f1b8 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBBPCRawContCnv.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TBBPCRawContCnv_H +#define TBBPCRawContCnv_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCnv.h" +#include "TBEvent/TBBPCRawCont.h" + +typedef T_AthenaPoolCnv<TBBPCRawCont> TBBPCRawContCnvBase; + +class TBBPCRawContCnv : public TBBPCRawContCnvBase +{ + friend class CnvFactory<TBBPCRawContCnv >; + public: + TBBPCRawContCnv(ISvcLocator* svcloc); + virtual ~TBBPCRawContCnv(); + + /// initialization + virtual StatusCode initialize(); + + /// Extend base-class conversion method to modify when reading in + virtual StatusCode PoolToDataObject(DataObject*& pObj,const std::string &token); + + /// Extend base-class conversion method for writing + virtual StatusCode DataObjectToPool(DataObject* pObj,const std::string &tname); + + private: + /// For your private attributes + +}; + +#endif + + diff --git a/TestBeam/TBEventAthenaPool/src/TBEventInfoCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBEventInfoCnv.cxx new file mode 100755 index 00000000000..87bc1bae784 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBEventInfoCnv.cxx @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBEventInfoCnv.h" + +TBEventInfo_PERS* TBEventInfoCnv::createPersistent(TBEventInfo* transCont) { + MsgStream log(messageService(), "TBEventInfoConverter" ); + TBEventInfo_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + log << MSG::DEBUG << "Success" << endreq; + return persObj; +} + +TBEventInfo* TBEventInfoCnv::createTransient() { + MsgStream log(messageService(), "TBEventInfoConverter" ); + static pool::Guid p1_guid("1E398439-74B3-457E-BC0B-DD69201AE463"); // GUID of the persistent object + static pool::Guid p0_guid("1295BE02-D698-43A8-A2BB-76E5ADCBD228"); // GUID of the transient object + if( compareClassGuid(p1_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< TBEventInfo_p1 > col_vect( poolReadObject< TBEventInfo_p1 >() ); + return m_TPConverter.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p0_guid) ) { + // regular object from before TP separation, just return it + return poolReadObject< TBEventInfo >(); + } + throw std::runtime_error("Unsupported persistent version of Data Collection"); +} + diff --git a/TestBeam/TBEventAthenaPool/src/TBEventInfoCnv.h b/TestBeam/TBEventAthenaPool/src/TBEventInfoCnv.h new file mode 100755 index 00000000000..cc133747a32 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBEventInfoCnv.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBEVENTINFOCNV_P1_H +#define TBEVENTATHENAPOOL_TBEVENTINFOCNV_P1_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "TBTPCnv/TBEventInfo_p1.h" +#include "TBEvent/TBEventInfo.h" +#include "TBTPCnv/TBEventInfoCnv_p1.h" + +// the latest persistent representation type of TBEventInfo: +typedef TBEventInfo_p1 TBEventInfo_PERS; +typedef T_AthenaPoolCustomCnv<TBEventInfo, TBEventInfo_PERS > TBEventInfoCnvBase; + +class TBEventInfoCnv : public TBEventInfoCnvBase { +friend class CnvFactory<TBEventInfoCnv >; +protected: + TBEventInfoCnv (ISvcLocator* svcloc) : TBEventInfoCnvBase(svcloc) {} + virtual TBEventInfo_PERS* createPersistent (TBEventInfo* transCont); + virtual TBEventInfo* createTransient (); + + TBEventInfoCnv_p1 m_TPConverter; +}; +#endif + diff --git a/TestBeam/TBEventAthenaPool/src/TBHitContCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBHitContCnv.cxx new file mode 100755 index 00000000000..dd0daf38aee --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBHitContCnv.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBHitContCnv.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" + +// Athena +#include "SGTools/StorableConversions.h" + + +// Constructor - call base constructor and initialize local attributes +TBHitContCnv::TBHitContCnv(ISvcLocator* svcloc) + : + // Base class constructor + TBHitContCnvBase::T_AthenaPoolCnv(svcloc) +{} + +// Destructor +TBHitContCnv::~TBHitContCnv() +{} + +StatusCode TBHitContCnv::initialize() +{ + // Call base clase initialize + AthenaPoolConverter::initialize(); + + // Get the messaging service, print where you are + MsgStream log(msgSvc(), "TBHitContCnv"); + log << MSG::INFO << "initialize()" << endreq; + + return StatusCode::SUCCESS; +} + + +StatusCode TBHitContCnv::PoolToDataObject(DataObject*& pObj,const std::string &token) +{ + // First call base class converter to get DataObject from + // pool. Then modify as appropriate + + MsgStream log(messageService(), "TBHitContCnv::PoolToDataObject" ); + + StatusCode sc = TBHitContCnvBase::PoolToDataObject(pObj, token); + if (sc.isFailure()) { + log << MSG::FATAL << "Unable to get object from pool" << endreq; + return StatusCode::FAILURE; + } else { + log << MSG::DEBUG << " Found DataObject " << endreq; + } + + // Convert DataObject pointer to TBHitCont* + TBHitCont* obj=0; + SG::fromStorable(pObj, obj ); + if(!obj) { + log << MSG::ERROR << " failed to cast to TBHitCont " << endreq ; + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + +StatusCode TBHitContCnv::DataObjectToPool(DataObject* pObj, const std::string &tname) +{ + MsgStream log(messageService(),"TBHitContCnv::DataObjectToPool" ); + + return TBHitContCnvBase::DataObjectToPool( pObj, tname) ; +} diff --git a/TestBeam/TBEventAthenaPool/src/TBHitContCnv.h b/TestBeam/TBEventAthenaPool/src/TBHitContCnv.h new file mode 100755 index 00000000000..81d99f19b35 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBHitContCnv.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TBHitContCnv_H +#define TBHitContCnv_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCnv.h" +#include "TBEvent/TBHitCont.h" + +typedef T_AthenaPoolCnv<TBHitCont> TBHitContCnvBase; + +class TBHitContCnv : public TBHitContCnvBase +{ + friend class CnvFactory<TBHitContCnv >; + public: + TBHitContCnv(ISvcLocator* svcloc); + virtual ~TBHitContCnv(); + + /// initialization + virtual StatusCode initialize(); + + /// Extend base-class conversion method to modify when reading in + virtual StatusCode PoolToDataObject(DataObject*& pObj,const std::string &token); + + /// Extend base-class conversion method for writing + virtual StatusCode DataObjectToPool(DataObject* pObj,const std::string &tname); + + private: + /// For your private attributes + +}; + +#endif + + diff --git a/TestBeam/TBEventAthenaPool/src/TBHitPlaneContCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBHitPlaneContCnv.cxx new file mode 100755 index 00000000000..caf74ecd546 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBHitPlaneContCnv.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBHitPlaneContCnv.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" + +// Athena +#include "SGTools/StorableConversions.h" + + +// Constructor - call base constructor and initialize local attributes +TBHitPlaneContCnv::TBHitPlaneContCnv(ISvcLocator* svcloc) + : + // Base class constructor + TBHitPlaneContCnvBase::T_AthenaPoolCnv(svcloc) +{} + +// Destructor +TBHitPlaneContCnv::~TBHitPlaneContCnv() +{} + +StatusCode TBHitPlaneContCnv::initialize() +{ + // Call base clase initialize + AthenaPoolConverter::initialize(); + + // Get the messaging service, print where you are + MsgStream log(msgSvc(), "TBHitPlaneContCnv"); + log << MSG::INFO << "initialize()" << endreq; + + return StatusCode::SUCCESS; +} + + +StatusCode TBHitPlaneContCnv::PoolToDataObject(DataObject*& pObj,const std::string &token) +{ + // First call base class converter to get DataObject from + // pool. Then modify as appropriate + + MsgStream log(messageService(), "TBHitPlaneContCnv::PoolToDataObject" ); + + StatusCode sc = TBHitPlaneContCnvBase::PoolToDataObject(pObj, token); + if (sc.isFailure()) { + log << MSG::FATAL << "Unable to get object from pool" << endreq; + return StatusCode::FAILURE; + } else { + log << MSG::DEBUG << " Found DataObject " << endreq; + } + + // Convert DataObject pointer to TBHitPlaneCont* + TBHitPlaneCont* obj=0; + SG::fromStorable(pObj, obj ); + if(!obj) { + log << MSG::ERROR << " failed to cast to TBHitPlaneCont " << endreq ; + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + +StatusCode TBHitPlaneContCnv::DataObjectToPool(DataObject* pObj, const std::string &tname) +{ + MsgStream log(messageService(),"TBHitPlaneContCnv::DataObjectToPool" ); + + return TBHitPlaneContCnvBase::DataObjectToPool( pObj, tname) ; +} diff --git a/TestBeam/TBEventAthenaPool/src/TBHitPlaneContCnv.h b/TestBeam/TBEventAthenaPool/src/TBHitPlaneContCnv.h new file mode 100755 index 00000000000..997cd65ff1f --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBHitPlaneContCnv.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TBHitPlaneContCnv_H +#define TBHitPlaneContCnv_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCnv.h" +#include "TBEvent/TBHitPlaneCont.h" + +typedef T_AthenaPoolCnv<TBHitPlaneCont> TBHitPlaneContCnvBase; + +class TBHitPlaneContCnv : public TBHitPlaneContCnvBase +{ + friend class CnvFactory<TBHitPlaneContCnv >; + public: + TBHitPlaneContCnv(ISvcLocator* svcloc); + virtual ~TBHitPlaneContCnv(); + + /// initialization + virtual StatusCode initialize(); + + /// Extend base-class conversion method to modify when reading in + virtual StatusCode PoolToDataObject(DataObject*& pObj,const std::string &token); + + /// Extend base-class conversion method for writing + virtual StatusCode DataObjectToPool(DataObject* pObj,const std::string &tname); + + private: + /// For your private attributes + +}; + +#endif + + diff --git a/TestBeam/TBEventAthenaPool/src/TBIdentifiedParticleCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBIdentifiedParticleCnv.cxx new file mode 100755 index 00000000000..ddbbe4aff58 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBIdentifiedParticleCnv.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBIdentifiedParticleCnv.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" + +// Athena +#include "SGTools/StorableConversions.h" + + +// Constructor - call base constructor and initialize local attributes +TBIdentifiedParticleCnv::TBIdentifiedParticleCnv(ISvcLocator* svcloc) + : + // Base class constructor + TBIdentifiedParticleCnvBase::T_AthenaPoolCnv(svcloc) +{} + +// Destructor +TBIdentifiedParticleCnv::~TBIdentifiedParticleCnv() +{} + +StatusCode TBIdentifiedParticleCnv::initialize() +{ + // Call base clase initialize + AthenaPoolConverter::initialize(); + + // Get the messaging service, print where you are + MsgStream log(msgSvc(), "TBIdentifiedParticleCnv"); + log << MSG::INFO << "initialize()" << endreq; + + return StatusCode::SUCCESS; +} + + +StatusCode TBIdentifiedParticleCnv::PoolToDataObject(DataObject*& pObj,const std::string &token) +{ + // First call base class converter to get DataObject from + // pool. Then modify as appropriate + + MsgStream log(messageService(), "TBIdentifiedParticleCnv::PoolToDataObject" ); + + StatusCode sc = TBIdentifiedParticleCnvBase::PoolToDataObject(pObj, token); + if (sc.isFailure()) { + log << MSG::FATAL << "Unable to get object from pool" << endreq; + return StatusCode::FAILURE; + } else { + log << MSG::DEBUG << " Found DataObject " << endreq; + } + + // Convert DataObject pointer to TBIdentifiedParticle* + TBIdentifiedParticle* obj=0; + SG::fromStorable(pObj, obj ); + if(!obj) { + log << MSG::ERROR << " failed to cast to TBIdentifiedParticle " << endreq ; + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + +StatusCode TBIdentifiedParticleCnv::DataObjectToPool(DataObject* pObj, const std::string &tname) +{ + MsgStream log(messageService(),"TBIdentifiedParticleCnv::DataObjectToPool" ); + + return TBIdentifiedParticleCnvBase::DataObjectToPool( pObj, tname) ; +} diff --git a/TestBeam/TBEventAthenaPool/src/TBIdentifiedParticleCnv.h b/TestBeam/TBEventAthenaPool/src/TBIdentifiedParticleCnv.h new file mode 100755 index 00000000000..6284b8222a2 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBIdentifiedParticleCnv.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TBIdentifiedParticleCnv_H +#define TBIdentifiedParticleCnv_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCnv.h" +#include "TBEvent/TBIdentifiedParticle.h" + +typedef T_AthenaPoolCnv<TBIdentifiedParticle> TBIdentifiedParticleCnvBase; + +class TBIdentifiedParticleCnv : public TBIdentifiedParticleCnvBase +{ + friend class CnvFactory<TBIdentifiedParticleCnv >; + public: + TBIdentifiedParticleCnv(ISvcLocator* svcloc); + virtual ~TBIdentifiedParticleCnv(); + + /// initialization + virtual StatusCode initialize(); + + /// Extend base-class conversion method to modify when reading in + virtual StatusCode PoolToDataObject(DataObject*& pObj,const std::string &token); + + /// Extend base-class conversion method for writing + virtual StatusCode DataObjectToPool(DataObject* pObj,const std::string &tname); + + private: + /// For your private attributes + +}; + +#endif + + diff --git a/TestBeam/TBEventAthenaPool/src/TBLArCalibDigitContainerCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBLArCalibDigitContainerCnv.cxx new file mode 100755 index 00000000000..03d227d2d6d --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBLArCalibDigitContainerCnv.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBLArCalibDigitContainerCnv.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" + +// Athena +#include "SGTools/StorableConversions.h" + + +// Constructor - call base constructor and initialize local attributes +TBLArCalibDigitContainerCnv::TBLArCalibDigitContainerCnv(ISvcLocator* svcloc) + : + // Base class constructor + TBLArCalibDigitContainerCnvBase::T_AthenaPoolCnv(svcloc) +{} + +// Destructor +TBLArCalibDigitContainerCnv::~TBLArCalibDigitContainerCnv() +{} + +StatusCode TBLArCalibDigitContainerCnv::initialize() +{ + // Call base clase initialize + AthenaPoolConverter::initialize(); + + // Get the messaging service, print where you are + MsgStream log(msgSvc(), "TBLArCalibDigitContainerCnv"); + log << MSG::INFO << "initialize()" << endreq; + + return StatusCode::SUCCESS; +} + + +StatusCode TBLArCalibDigitContainerCnv::PoolToDataObject(DataObject*& pObj,const std::string &token) +{ + // First call base class converter to get DataObject from + // pool. Then modify as appropriate + + MsgStream log(messageService(), "TBLArCalibDigitContainerCnv::PoolToDataObject" ); + + StatusCode sc = TBLArCalibDigitContainerCnvBase::PoolToDataObject(pObj, token); + if (sc.isFailure()) { + log << MSG::FATAL << "Unable to get object from pool" << endreq; + return StatusCode::FAILURE; + } else { + log << MSG::DEBUG << " Found DataObject " << endreq; + } + + // Convert DataObject pointer to TBLArCalibDigitContainer* + TBLArCalibDigitContainer* obj=0; + SG::fromStorable(pObj, obj ); + if(!obj) { + log << MSG::ERROR << " failed to cast to TBLArCalibDigitContainer " << endreq ; + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + +StatusCode TBLArCalibDigitContainerCnv::DataObjectToPool(DataObject* pObj, const std::string &tname) +{ + MsgStream log(messageService(),"TBLArCalibDigitContainerCnv::DataObjectToPool" ); + + return TBLArCalibDigitContainerCnvBase::DataObjectToPool( pObj, tname) ; +} diff --git a/TestBeam/TBEventAthenaPool/src/TBLArCalibDigitContainerCnv.h b/TestBeam/TBEventAthenaPool/src/TBLArCalibDigitContainerCnv.h new file mode 100755 index 00000000000..95a7afb7586 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBLArCalibDigitContainerCnv.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TBLArCalibDigitContainerCnv_H +#define TBLArCalibDigitContainerCnv_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCnv.h" +#include "TBEvent/TBLArCalibDigitContainer.h" + +typedef T_AthenaPoolCnv<TBLArCalibDigitContainer> TBLArCalibDigitContainerCnvBase; + +class TBLArCalibDigitContainerCnv : public TBLArCalibDigitContainerCnvBase +{ + friend class CnvFactory<TBLArCalibDigitContainerCnv >; + public: + TBLArCalibDigitContainerCnv(ISvcLocator* svcloc); + virtual ~TBLArCalibDigitContainerCnv(); + + /// initialization + virtual StatusCode initialize(); + + /// Extend base-class conversion method to modify when reading in + virtual StatusCode PoolToDataObject(DataObject*& pObj,const std::string &token); + + /// Extend base-class conversion method for writing + virtual StatusCode DataObjectToPool(DataObject* pObj,const std::string &tname); + + private: + /// For your private attributes + +}; + +#endif + + diff --git a/TestBeam/TBEventAthenaPool/src/TBLArDigitContainerCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBLArDigitContainerCnv.cxx new file mode 100755 index 00000000000..8efc755c4a0 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBLArDigitContainerCnv.cxx @@ -0,0 +1,51 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBLArDigitContainerCnv.h" +#include "TBTPCnv/TBLArDigitContainer_p1.h" +//#include "LArRawEvent/LArDigitContainer.h" + + +TBLArDigitContainerCnv::TBLArDigitContainerCnv(ISvcLocator* svcLoc) : + TBLArDigitContainerCnvBase(svcLoc), + p0_guid("B15FFDA0-206D-4062-8B5F-582A1ECD5502"), // GUID of the transient object + p1_guid("9F58DDD2-ACDC-4ECF-A714-779B05F94649") // GUID of the persistent object +{} + + + +TBLArDigitContainerPERS* TBLArDigitContainerCnv::createPersistent(TBLArDigitContainer* trans) { + MsgStream log(messageService(), "TBLArDigitContainerCnv"); + log << MSG::DEBUG << "Writing TBLArDigitContainer_p2" << endreq; + TBLArDigitContainerPERS* pers=new TBLArDigitContainerPERS(); + m_converter.transToPers(trans,pers,log); + return pers; +} + + + +TBLArDigitContainer* TBLArDigitContainerCnv::createTransient() { + MsgStream log(messageService(), "TBLArDigitContainerCnv" ); + TBLArDigitContainer* trans=new TBLArDigitContainer(); + if (compareClassGuid(p0_guid)) { + log << MSG::DEBUG << "Read version p0 of TBLArDigitContainer. GUID=" + << m_classID.toString() << endreq; + return poolReadObject<TBLArDigitContainer>(); + } + else if (compareClassGuid(p1_guid)) { + log << MSG::DEBUG << "Reading TBLArDigitContainer_p1. GUID=" + << m_classID.toString() << endreq; + TBLArDigitContainer_p1* pers=poolReadObject<TBLArDigitContainer_p1>(); + m_converter.persToTrans(pers,trans, log); + delete pers; + return trans; + } + else { + log << MSG::ERROR << "Unsupported persistent version of TBLArDigitContainer. GUID=" + << m_classID.toString() << endreq; + throw std::runtime_error("Unsupported persistent version of Data Collection"); + } + return trans; +} + diff --git a/TestBeam/TBEventAthenaPool/src/TBLArDigitContainerCnv.h b/TestBeam/TBEventAthenaPool/src/TBLArDigitContainerCnv.h new file mode 100755 index 00000000000..143882965aa --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBLArDigitContainerCnv.h @@ -0,0 +1,41 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBLARDIGITCONTAINERCNV_H +#define TBEVENTATHENAPOOL_TBLARDIGITCONTAINERCNV_H + +#include "TBTPCnv/TBLArDigitContainerCnv_p1.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +//#include "LArRawEvent/LArDigitContainer.h" +#include "TBEvent/TBLArDigitContainer.h" + +//class TBLArDigitContainer; +//class TBLArDigitContainer_p1; + +typedef TBLArDigitContainer_p1 TBLArDigitContainerPERS; + +typedef T_AthenaPoolCustomCnv<TBLArDigitContainer,TBLArDigitContainerPERS> TBLArDigitContainerCnvBase; + +class TBLArDigitContainerCnv : public TBLArDigitContainerCnvBase +{ + friend class CnvFactory<TBLArDigitContainerCnv>; + protected: + TBLArDigitContainerCnv(ISvcLocator*); + virtual TBLArDigitContainer* createTransient(); + virtual TBLArDigitContainerPERS* createPersistent(TBLArDigitContainer*); + private: + TBLArDigitContainerCnv_p1 m_converter; + pool::Guid p0_guid; + pool::Guid p1_guid; + +}; + +#endif + diff --git a/TestBeam/TBEventAthenaPool/src/TBMWPCContCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBMWPCContCnv.cxx new file mode 100755 index 00000000000..71d30f7c168 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBMWPCContCnv.cxx @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBMWPCContCnv.h" + +TBMWPCCont_PERS* TBMWPCContCnv::createPersistent(TBMWPCCont* transCont) { + MsgStream log(messageService(), "TBMWPCContConverter" ); + TBMWPCCont_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + log << MSG::DEBUG << "Success" << endreq; + return persObj; +} + +TBMWPCCont* TBMWPCContCnv::createTransient() { + MsgStream log(messageService(), "TBMWPCContConverter" ); + static pool::Guid p1_guid("E1F16B8A-9D8B-4906-83EE-E38EBE63768A"); // GUID of the persistent object + static pool::Guid p0_guid("05F6DFD7-EB63-49DB-AA5B-F03BE66365AC"); // GUID of the transient object + if( compareClassGuid(p1_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< TBMWPCCont_p1 > col_vect( poolReadObject< TBMWPCCont_p1 >() ); + return m_TPConverter.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p0_guid) ) { + // regular object from before TP separation, just return it + return poolReadObject< TBMWPCCont >(); + } + throw std::runtime_error("Unsupported persistent version of Data Collection"); +} + diff --git a/TestBeam/TBEventAthenaPool/src/TBMWPCContCnv.h b/TestBeam/TBEventAthenaPool/src/TBMWPCContCnv.h new file mode 100755 index 00000000000..15aa6d91b1c --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBMWPCContCnv.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBMWPCCONTCNV_P1_H +#define TBEVENTATHENAPOOL_TBMWPCCONTCNV_P1_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "TBTPCnv/TBMWPCCont_p1.h" +#include "TBEvent/TBMWPCCont.h" +#include "TBTPCnv/TBMWPCContCnv_p1.h" + +// the latest persistent representation type of TBMWPCCont: +typedef TBMWPCCont_p1 TBMWPCCont_PERS; +typedef T_AthenaPoolCustomCnv<TBMWPCCont, TBMWPCCont_PERS > TBMWPCContCnvBase; + +class TBMWPCContCnv : public TBMWPCContCnvBase { +friend class CnvFactory<TBMWPCContCnv >; +protected: + TBMWPCContCnv (ISvcLocator* svcloc) : TBMWPCContCnvBase(svcloc) {} + virtual TBMWPCCont_PERS* createPersistent (TBMWPCCont* transCont); + virtual TBMWPCCont* createTransient (); + + TBMWPCContCnv_p1 m_TPConverter; +}; +#endif diff --git a/TestBeam/TBEventAthenaPool/src/TBMWPCRawContCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBMWPCRawContCnv.cxx new file mode 100755 index 00000000000..292b463fc5c --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBMWPCRawContCnv.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBMWPCRawContCnv.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" + +// Athena +#include "SGTools/StorableConversions.h" + + +// Constructor - call base constructor and initialize local attributes +TBMWPCRawContCnv::TBMWPCRawContCnv(ISvcLocator* svcloc) + : + // Base class constructor + TBMWPCRawContCnvBase::T_AthenaPoolCnv(svcloc) +{} + +// Destructor +TBMWPCRawContCnv::~TBMWPCRawContCnv() +{} + +StatusCode TBMWPCRawContCnv::initialize() +{ + // Call base clase initialize + AthenaPoolConverter::initialize(); + + // Get the messaging service, print where you are + MsgStream log(msgSvc(), "TBMWPCRawContCnv"); + log << MSG::INFO << "initialize()" << endreq; + + return StatusCode::SUCCESS; +} + + +StatusCode TBMWPCRawContCnv::PoolToDataObject(DataObject*& pObj,const std::string &token) +{ + // First call base class converter to get DataObject from + // pool. Then modify as appropriate + + MsgStream log(messageService(), "TBMWPCRawContCnv::PoolToDataObject" ); + + StatusCode sc = TBMWPCRawContCnvBase::PoolToDataObject(pObj, token); + if (sc.isFailure()) { + log << MSG::FATAL << "Unable to get object from pool" << endreq; + return StatusCode::FAILURE; + } else { + log << MSG::DEBUG << " Found DataObject " << endreq; + } + + // Convert DataObject pointer to TBMWPCRawCont* + TBMWPCRawCont* obj=0; + SG::fromStorable(pObj, obj ); + if(!obj) { + log << MSG::ERROR << " failed to cast to TBMWPCRawCont " << endreq ; + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + +StatusCode TBMWPCRawContCnv::DataObjectToPool(DataObject* pObj, const std::string &tname) +{ + MsgStream log(messageService(),"TBMWPCRawContCnv::DataObjectToPool" ); + + return TBMWPCRawContCnvBase::DataObjectToPool( pObj, tname) ; +} diff --git a/TestBeam/TBEventAthenaPool/src/TBMWPCRawContCnv.h b/TestBeam/TBEventAthenaPool/src/TBMWPCRawContCnv.h new file mode 100755 index 00000000000..4b2e593deba --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBMWPCRawContCnv.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TBMWPCRawContCnv_H +#define TBMWPCRawContCnv_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCnv.h" +#include "TBEvent/TBMWPCRawCont.h" + +typedef T_AthenaPoolCnv<TBMWPCRawCont> TBMWPCRawContCnvBase; + +class TBMWPCRawContCnv : public TBMWPCRawContCnvBase +{ + friend class CnvFactory<TBMWPCRawContCnv >; + public: + TBMWPCRawContCnv(ISvcLocator* svcloc); + virtual ~TBMWPCRawContCnv(); + + /// initialization + virtual StatusCode initialize(); + + /// Extend base-class conversion method to modify when reading in + virtual StatusCode PoolToDataObject(DataObject*& pObj,const std::string &token); + + /// Extend base-class conversion method for writing + virtual StatusCode DataObjectToPool(DataObject* pObj,const std::string &tname); + + private: + /// For your private attributes + +}; + +#endif + + diff --git a/TestBeam/TBEventAthenaPool/src/TBPhaseCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBPhaseCnv.cxx new file mode 100755 index 00000000000..fa5efbc9475 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBPhaseCnv.cxx @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBPhaseCnv.h" + +TBPhase_PERS* TBPhaseCnv::createPersistent(TBPhase* transCont) { + MsgStream log(messageService(), "TBPhaseConverter" ); + TBPhase_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + log << MSG::DEBUG << "Success" << endreq; + return persObj; +} + +TBPhase* TBPhaseCnv::createTransient() { + MsgStream log(messageService(), "TBPhaseConverter" ); + static pool::Guid p1_guid("40443E91-053F-41C1-84F8-0A7F03F1DEC4"); // GUID of the persistent object + static pool::Guid p0_guid("C044C9BE-E371-4AC3-95ED-CCA05984EDE4"); // GUID of the transient object + if( compareClassGuid(p1_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< TBPhase_p1 > col_vect( poolReadObject< TBPhase_p1 >() ); + return m_TPConverter.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p0_guid) ) { + // regular object from before TP separation, just return it + return poolReadObject< TBPhase >(); + } + throw std::runtime_error("Unsupported persistent version of Data Collection"); +} + diff --git a/TestBeam/TBEventAthenaPool/src/TBPhaseCnv.h b/TestBeam/TBEventAthenaPool/src/TBPhaseCnv.h new file mode 100755 index 00000000000..c1df6a607a7 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBPhaseCnv.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBPHASECNV_P1_H +#define TBEVENTATHENAPOOL_TBPHASECNV_P1_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "TBTPCnv/TBPhase_p1.h" +#include "TBEvent/TBPhase.h" +#include "TBTPCnv/TBPhaseCnv_p1.h" + +// the latest persistent representation type of TBPhase: +typedef TBPhase_p1 TBPhase_PERS; +typedef T_AthenaPoolCustomCnv<TBPhase, TBPhase_PERS > TBPhaseCnvBase; + +class TBPhaseCnv : public TBPhaseCnvBase { +friend class CnvFactory<TBPhaseCnv >; +protected: + TBPhaseCnv (ISvcLocator* svcloc) : TBPhaseCnvBase(svcloc) {} + virtual TBPhase_PERS* createPersistent (TBPhase* transCont); + virtual TBPhase* createTransient (); + + TBPhaseCnv_p1 m_TPConverter; +}; +#endif diff --git a/TestBeam/TBEventAthenaPool/src/TBScintillatorContCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBScintillatorContCnv.cxx new file mode 100755 index 00000000000..40ea0b94687 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBScintillatorContCnv.cxx @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBScintillatorContCnv.h" + +TBScintillatorCont_PERS* TBScintillatorContCnv::createPersistent(TBScintillatorCont* transCont) { + MsgStream log(messageService(), "TBScintillatorContConverter" ); + TBScintillatorCont_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + log << MSG::DEBUG << "Success" << endreq; + return persObj; +} + +TBScintillatorCont* TBScintillatorContCnv::createTransient() { + MsgStream log(messageService(), "TBScintillatorContConverter" ); + static pool::Guid p1_guid("5887098D-DBFE-4634-92AB-CC9968CCB09A"); // GUID of the persistent object + static pool::Guid p0_guid("AE688514-B192-426D-A971-5CD072593272"); // GUID of the transient object + if( compareClassGuid(p1_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< TBScintillatorCont_p1 > col_vect( poolReadObject< TBScintillatorCont_p1 >() ); + return m_TPConverter.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p0_guid) ) { + // regular object from before TP separation, just return it + return poolReadObject< TBScintillatorCont >(); + } + throw std::runtime_error("Unsupported persistent version of Data Collection"); +} + diff --git a/TestBeam/TBEventAthenaPool/src/TBScintillatorContCnv.h b/TestBeam/TBEventAthenaPool/src/TBScintillatorContCnv.h new file mode 100755 index 00000000000..95eebca4004 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBScintillatorContCnv.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBSCINTILLATORCONTCNV_P1_H +#define TBEVENTATHENAPOOL_TBSCINTILLATORCONTCNV_P1_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "TBTPCnv/TBScintillatorCont_p1.h" +#include "TBEvent/TBScintillatorCont.h" +#include "TBTPCnv/TBScintillatorContCnv_p1.h" + +// the latest persistent representation type of TBScintillatorCont: +typedef TBScintillatorCont_p1 TBScintillatorCont_PERS; +typedef T_AthenaPoolCustomCnv<TBScintillatorCont, TBScintillatorCont_PERS > TBScintillatorContCnvBase; + +class TBScintillatorContCnv : public TBScintillatorContCnvBase { +friend class CnvFactory<TBScintillatorContCnv >; +protected: + TBScintillatorContCnv (ISvcLocator* svcloc) : TBScintillatorContCnvBase(svcloc) {} + virtual TBScintillatorCont_PERS* createPersistent (TBScintillatorCont* transCont); + virtual TBScintillatorCont* createTransient (); + + TBScintillatorContCnv_p1 m_TPConverter; +}; +#endif + diff --git a/TestBeam/TBEventAthenaPool/src/TBScintillatorRawContCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBScintillatorRawContCnv.cxx new file mode 100755 index 00000000000..80206e9bf9f --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBScintillatorRawContCnv.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBScintillatorRawContCnv.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" + +// Athena +#include "SGTools/StorableConversions.h" + + +// Constructor - call base constructor and initialize local attributes +TBScintillatorRawContCnv::TBScintillatorRawContCnv(ISvcLocator* svcloc) + : + // Base class constructor + TBScintillatorRawContCnvBase::T_AthenaPoolCnv(svcloc) +{} + +// Destructor +TBScintillatorRawContCnv::~TBScintillatorRawContCnv() +{} + +StatusCode TBScintillatorRawContCnv::initialize() +{ + // Call base clase initialize + AthenaPoolConverter::initialize(); + + // Get the messaging service, print where you are + MsgStream log(msgSvc(), "TBScintillatorRawContCnv"); + log << MSG::INFO << "initialize()" << endreq; + + return StatusCode::SUCCESS; +} + + +StatusCode TBScintillatorRawContCnv::PoolToDataObject(DataObject*& pObj,const std::string &token) +{ + // First call base class converter to get DataObject from + // pool. Then modify as appropriate + + MsgStream log(messageService(), "TBScintillatorRawContCnv::PoolToDataObject" ); + + StatusCode sc = TBScintillatorRawContCnvBase::PoolToDataObject(pObj, token); + if (sc.isFailure()) { + log << MSG::FATAL << "Unable to get object from pool" << endreq; + return StatusCode::FAILURE; + } else { + log << MSG::DEBUG << " Found DataObject " << endreq; + } + + // Convert DataObject pointer to TBScintillatorRawCont* + TBScintillatorRawCont* obj=0; + SG::fromStorable(pObj, obj ); + if(!obj) { + log << MSG::ERROR << " failed to cast to TBScintillatorRawCont " << endreq ; + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + +StatusCode TBScintillatorRawContCnv::DataObjectToPool(DataObject* pObj, const std::string &tname) +{ + MsgStream log(messageService(),"TBScintillatorRawContCnv::DataObjectToPool" ); + + return TBScintillatorRawContCnvBase::DataObjectToPool( pObj, tname) ; +} diff --git a/TestBeam/TBEventAthenaPool/src/TBScintillatorRawContCnv.h b/TestBeam/TBEventAthenaPool/src/TBScintillatorRawContCnv.h new file mode 100755 index 00000000000..188a691bd1b --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBScintillatorRawContCnv.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TBScintillatorRawContCnv_H +#define TBScintillatorRawContCnv_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCnv.h" +#include "TBEvent/TBScintillatorRawCont.h" + +typedef T_AthenaPoolCnv<TBScintillatorRawCont> TBScintillatorRawContCnvBase; + +class TBScintillatorRawContCnv : public TBScintillatorRawContCnvBase +{ + friend class CnvFactory<TBScintillatorRawContCnv >; + public: + TBScintillatorRawContCnv(ISvcLocator* svcloc); + virtual ~TBScintillatorRawContCnv(); + + /// initialization + virtual StatusCode initialize(); + + /// Extend base-class conversion method to modify when reading in + virtual StatusCode PoolToDataObject(DataObject*& pObj,const std::string &token); + + /// Extend base-class conversion method for writing + virtual StatusCode DataObjectToPool(DataObject* pObj,const std::string &tname); + + private: + /// For your private attributes + +}; + +#endif + + diff --git a/TestBeam/TBEventAthenaPool/src/TBTDCCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBTDCCnv.cxx new file mode 100755 index 00000000000..ff316d091f9 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTDCCnv.cxx @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBTDCCnv.h" + +TBTDC_PERS* TBTDCCnv::createPersistent(TBTDC* transCont) { + MsgStream log(messageService(), "TBTDCConverter" ); + TBTDC_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + log << MSG::DEBUG << "Success" << endreq; + return persObj; +} + +TBTDC* TBTDCCnv::createTransient() { + MsgStream log(messageService(), "TBTDCConverter" ); + static pool::Guid p1_guid("D909CCF6-CE91-4401-98FC-C1C41BD06513"); // GUID of the persistent object + static pool::Guid p0_guid("51CEFACC-47E5-4BF1-8BF5-FA48FCA15B43"); // GUID of the transient object + if( compareClassGuid(p1_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< TBTDC_p1 > col_vect( poolReadObject< TBTDC_p1 >() ); + return m_TPConverter.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p0_guid) ) { + // regular object from before TP separation, just return it + return poolReadObject< TBTDC >(); + } + throw std::runtime_error("Unsupported persistent version of Data Collection"); +} diff --git a/TestBeam/TBEventAthenaPool/src/TBTDCCnv.h b/TestBeam/TBEventAthenaPool/src/TBTDCCnv.h new file mode 100755 index 00000000000..e2594237941 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTDCCnv.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBTDCCNV_P1_H +#define TBEVENTATHENAPOOL_TBTDCCNV_P1_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "TBTPCnv/TBTDC_p1.h" +#include "TBEvent/TBTDC.h" +#include "TBTPCnv/TBTDCCnv_p1.h" + +// the latest persistent representation type of TBTDC: +typedef TBTDC_p1 TBTDC_PERS; +typedef T_AthenaPoolCustomCnv<TBTDC, TBTDC_PERS > TBTDCCnvBase; + +class TBTDCCnv : public TBTDCCnvBase { +friend class CnvFactory<TBTDCCnv >; +protected: + TBTDCCnv (ISvcLocator* svcloc) : TBTDCCnvBase(svcloc) {} + virtual TBTDC_PERS* createPersistent (TBTDC* transCont); + virtual TBTDC* createTransient (); + + TBTDCCnv_p1 m_TPConverter; +}; +#endif + diff --git a/TestBeam/TBEventAthenaPool/src/TBTDCRawContCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBTDCRawContCnv.cxx new file mode 100755 index 00000000000..1b80c5d63ea --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTDCRawContCnv.cxx @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBTDCRawContCnv.h" + +TBTDCRawCont_PERS* TBTDCRawContCnv::createPersistent(TBTDCRawCont* transCont) { + MsgStream log(messageService(), "TBTDCRawContConverter" ); + TBTDCRawCont_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + log << MSG::DEBUG << "Success" << endreq; + return persObj; +} + +TBTDCRawCont* TBTDCRawContCnv::createTransient() { + MsgStream log(messageService(), "TBTDCRawContConverter" ); + static pool::Guid p1_guid("C05FD0A4-E5AD-41C8-9EA5-2A71378BB247"); // GUID of the persistent object + static pool::Guid p0_guid("82D6D14E-49FE-4841-9B39-08D66B9DC7CE"); // GUID of the transient object + if( compareClassGuid(p1_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< TBTDCRawCont_p1 > col_vect( poolReadObject< TBTDCRawCont_p1 >() ); + return m_TPConverter.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p0_guid) ) { + // regular object from before TP separation, just return it + return poolReadObject< TBTDCRawCont >(); + } + throw std::runtime_error("Unsupported persistent version of Data Collection"); +} + diff --git a/TestBeam/TBEventAthenaPool/src/TBTDCRawContCnv.h b/TestBeam/TBEventAthenaPool/src/TBTDCRawContCnv.h new file mode 100755 index 00000000000..75f31a8852a --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTDCRawContCnv.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBTDCRAWCONTCNV_P1_H +#define TBEVENTATHENAPOOL_TBTDCRAWCONTCNV_P1_H + + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "TBTPCnv/TBTDCRawCont_p1.h" +#include "TBEvent/TBTDCRawCont.h" +#include "TBTPCnv/TBTDCRawContCnv_p1.h" + +// the latest persistent representation type of TBTDCRawCont: +typedef TBTDCRawCont_p1 TBTDCRawCont_PERS; +typedef T_AthenaPoolCustomCnv<TBTDCRawCont, TBTDCRawCont_PERS > TBTDCRawContCnvBase; + +class TBTDCRawContCnv : public TBTDCRawContCnvBase { +friend class CnvFactory<TBTDCRawContCnv >; +protected: + TBTDCRawContCnv (ISvcLocator* svcloc) : TBTDCRawContCnvBase(svcloc) {} + virtual TBTDCRawCont_PERS* createPersistent (TBTDCRawCont* transCont); + virtual TBTDCRawCont* createTransient (); + + TBTDCRawContCnv_p1 m_TPConverter; +}; +#endif + diff --git a/TestBeam/TBEventAthenaPool/src/TBTailCatcherCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBTailCatcherCnv.cxx new file mode 100755 index 00000000000..3215aafdbc4 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTailCatcherCnv.cxx @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBTailCatcherCnv.h" + +TBTailCatcher_PERS* TBTailCatcherCnv::createPersistent(TBTailCatcher* transCont) { + MsgStream log(messageService(), "TBTailCatcherConverter" ); + TBTailCatcher_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + log << MSG::DEBUG << "Success" << endreq; + return persObj; +} + +TBTailCatcher* TBTailCatcherCnv::createTransient() { + MsgStream log(messageService(), "TBTailCatcherConverter" ); + static pool::Guid p1_guid("B304A3B8-5FC1-415D-AE97-E3E7B6769213"); // GUID of the persistent object + static pool::Guid p0_guid("7AA6F3C3-3FF2-4732-B0CB-4ECC32FEF06D"); // GUID of the transient object + if( compareClassGuid(p1_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< TBTailCatcher_p1 > col_vect( poolReadObject< TBTailCatcher_p1 >() ); + return m_TPConverter.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p0_guid) ) { + // regular object from before TP separation, just return it + return poolReadObject< TBTailCatcher >(); + } + throw std::runtime_error("Unsupported persistent version of Data Collection"); +} + diff --git a/TestBeam/TBEventAthenaPool/src/TBTailCatcherCnv.h b/TestBeam/TBEventAthenaPool/src/TBTailCatcherCnv.h new file mode 100755 index 00000000000..5cf2ae37c0e --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTailCatcherCnv.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBTAILCATCHERCNV_P1_H +#define TBEVENTATHENAPOOL_TBTAILCATCHERCNV_P1_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "TBTPCnv/TBTailCatcher_p1.h" +#include "TBEvent/TBTailCatcher.h" +#include "TBTPCnv/TBTailCatcherCnv_p1.h" + +// the latest persistent representation type of TBTailCatcher: +typedef TBTailCatcher_p1 TBTailCatcher_PERS; +typedef T_AthenaPoolCustomCnv<TBTailCatcher, TBTailCatcher_PERS > TBTailCatcherCnvBase; + +class TBTailCatcherCnv : public TBTailCatcherCnvBase { +friend class CnvFactory<TBTailCatcherCnv >; +protected: + TBTailCatcherCnv (ISvcLocator* svcloc) : TBTailCatcherCnvBase(svcloc) {} + virtual TBTailCatcher_PERS* createPersistent (TBTailCatcher* transCont); + virtual TBTailCatcher* createTransient (); + + TBTailCatcherCnv_p1 m_TPConverter; +}; +#endif + + diff --git a/TestBeam/TBEventAthenaPool/src/TBTailCatcherRawCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBTailCatcherRawCnv.cxx new file mode 100755 index 00000000000..b62a8893444 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTailCatcherRawCnv.cxx @@ -0,0 +1,69 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBTailCatcherRawCnv.h" + +// Gaudi +#include "GaudiKernel/MsgStream.h" + +// Athena +#include "SGTools/StorableConversions.h" + + +// Constructor - call base constructor and initialize local attributes +TBTailCatcherRawCnv::TBTailCatcherRawCnv(ISvcLocator* svcloc) + : + // Base class constructor + TBTailCatcherRawCnvBase::T_AthenaPoolCnv(svcloc) +{} + +// Destructor +TBTailCatcherRawCnv::~TBTailCatcherRawCnv() +{} + +StatusCode TBTailCatcherRawCnv::initialize() +{ + // Call base clase initialize + AthenaPoolConverter::initialize(); + + // Get the messaging service, print where you are + MsgStream log(msgSvc(), "TBTailCatcherRawCnv"); + log << MSG::INFO << "initialize()" << endreq; + + return StatusCode::SUCCESS; +} + + +StatusCode TBTailCatcherRawCnv::PoolToDataObject(DataObject*& pObj,const std::string &token) +{ + // First call base class converter to get DataObject from + // pool. Then modify as appropriate + + MsgStream log(messageService(), "TBTailCatcherRawCnv::PoolToDataObject" ); + + StatusCode sc = TBTailCatcherRawCnvBase::PoolToDataObject(pObj, token); + if (sc.isFailure()) { + log << MSG::FATAL << "Unable to get object from pool" << endreq; + return StatusCode::FAILURE; + } else { + log << MSG::DEBUG << " Found DataObject " << endreq; + } + + // Convert DataObject pointer to TBTailCatcherRaw* + TBTailCatcherRaw* obj=0; + SG::fromStorable(pObj, obj ); + if(!obj) { + log << MSG::ERROR << " failed to cast to TBTailCatcherRaw " << endreq ; + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + +StatusCode TBTailCatcherRawCnv::DataObjectToPool(DataObject* pObj, const std::string &tname) +{ + MsgStream log(messageService(),"TBTailCatcherRawCnv::DataObjectToPool" ); + + return TBTailCatcherRawCnvBase::DataObjectToPool( pObj, tname) ; +} diff --git a/TestBeam/TBEventAthenaPool/src/TBTailCatcherRawCnv.h b/TestBeam/TBEventAthenaPool/src/TBTailCatcherRawCnv.h new file mode 100755 index 00000000000..540ee440fd7 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTailCatcherRawCnv.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TBTailCatcherRawCnv_H +#define TBTailCatcherRawCnv_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCnv.h" +#include "TBEvent/TBTailCatcherRaw.h" + +typedef T_AthenaPoolCnv<TBTailCatcherRaw> TBTailCatcherRawCnvBase; + +class TBTailCatcherRawCnv : public TBTailCatcherRawCnvBase +{ + friend class CnvFactory<TBTailCatcherRawCnv >; + public: + TBTailCatcherRawCnv(ISvcLocator* svcloc); + virtual ~TBTailCatcherRawCnv(); + + /// initialization + virtual StatusCode initialize(); + + /// Extend base-class conversion method to modify when reading in + virtual StatusCode PoolToDataObject(DataObject*& pObj,const std::string &token); + + /// Extend base-class conversion method for writing + virtual StatusCode DataObjectToPool(DataObject* pObj,const std::string &tname); + + private: + /// For your private attributes + +}; + +#endif + + diff --git a/TestBeam/TBEventAthenaPool/src/TBTrackCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBTrackCnv.cxx new file mode 100755 index 00000000000..18d5ad82fcb --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTrackCnv.cxx @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBTrackCnv.h" + +TBTrack_PERS* TBTrackCnv::createPersistent(TBTrack* transCont) { + MsgStream log(messageService(), "TBTrackConverter" ); + TBTrack_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + log << MSG::DEBUG << "Success" << endreq; + return persObj; +} + +TBTrack* TBTrackCnv::createTransient() { + MsgStream log(messageService(), "TBTrackConverter" ); + static pool::Guid p1_guid("9E50CAA3-CCDF-4BB9-96E9-E376B16963E8"); // GUID of the persistent object + static pool::Guid p0_guid("37E880D7-EBCB-4F53-8B14-490A4CEB71BD"); // GUID of the transient object + if( compareClassGuid(p1_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< TBTrack_p1 > col_vect( poolReadObject< TBTrack_p1 >() ); + return m_TPConverter.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p0_guid) ) { + // regular object from before TP separation, just return it + return poolReadObject< TBTrack >(); + } + throw std::runtime_error("Unsupported persistent version of Data Collection"); +} + + diff --git a/TestBeam/TBEventAthenaPool/src/TBTrackCnv.h b/TestBeam/TBEventAthenaPool/src/TBTrackCnv.h new file mode 100755 index 00000000000..055ca8f0edc --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTrackCnv.h @@ -0,0 +1,35 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBTRACKCNV_P1_H +#define TBEVENTATHENAPOOL_TBTRACKCNV_P1_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "TBTPCnv/TBTrack_p1.h" +#include "TBEvent/TBTrack.h" +#include "TBTPCnv/TBTrackCnv_p1.h" + +// the latest persistent representation type of TBTrack: +typedef TBTrack_p1 TBTrack_PERS; +typedef T_AthenaPoolCustomCnv<TBTrack, TBTrack_PERS > TBTrackCnvBase; + +class TBTrackCnv : public TBTrackCnvBase { +friend class CnvFactory<TBTrackCnv >; +protected: + TBTrackCnv (ISvcLocator* svcloc) : TBTrackCnvBase(svcloc) {} + virtual TBTrack_PERS* createPersistent (TBTrack* transCont); + virtual TBTrack* createTransient (); + + TBTrackCnv_p1 m_TPConverter; +}; +#endif + + + diff --git a/TestBeam/TBEventAthenaPool/src/TBTrackInfoCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBTrackInfoCnv.cxx new file mode 100755 index 00000000000..5ac9bfc6aa4 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTrackInfoCnv.cxx @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBTrackInfoCnv.h" + +TBTrackInfo_PERS* TBTrackInfoCnv::createPersistent(TBTrackInfo* transCont) { + MsgStream log(messageService(), "TBTrackInfoConverter" ); + TBTrackInfo_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + log << MSG::DEBUG << "Success" << endreq; + return persObj; +} + +TBTrackInfo* TBTrackInfoCnv::createTransient() { + MsgStream log(messageService(), "TBTrackInfoConverter" ); + static pool::Guid p1_guid("A49F674F-25AD-496B-BEBE-DE1EBEAFE990"); // GUID of the persistent object + static pool::Guid p0_guid("5780AB02-D5D1-4537-B682-56CA95927BFB"); // GUID of the transient object + if( compareClassGuid(p1_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< TBTrackInfo_p1 > col_vect( poolReadObject< TBTrackInfo_p1 >() ); + return m_TPConverter.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p0_guid) ) { + // regular object from before TP separation, just return it + return poolReadObject< TBTrackInfo >(); + } + throw std::runtime_error("Unsupported persistent version of Data Collection"); +} + diff --git a/TestBeam/TBEventAthenaPool/src/TBTrackInfoCnv.h b/TestBeam/TBEventAthenaPool/src/TBTrackInfoCnv.h new file mode 100755 index 00000000000..89ba5be48c4 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTrackInfoCnv.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBTRACKINFOCNV_P1_H +#define TBEVENTATHENAPOOL_TBTRACKINFOCNV_P1_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "TBTPCnv/TBTrackInfo_p1.h" +#include "TBEvent/TBTrackInfo.h" +#include "TBTPCnv/TBTrackInfoCnv_p1.h" + +// the latest persistent representation type of TBTrackInfo: +typedef TBTrackInfo_p1 TBTrackInfo_PERS; +typedef T_AthenaPoolCustomCnv<TBTrackInfo, TBTrackInfo_PERS > TBTrackInfoCnvBase; + +class TBTrackInfoCnv : public TBTrackInfoCnvBase { +friend class CnvFactory<TBTrackInfoCnv >; +protected: + TBTrackInfoCnv (ISvcLocator* svcloc) : TBTrackInfoCnvBase(svcloc) {} + virtual TBTrackInfo_PERS* createPersistent (TBTrackInfo* transCont); + virtual TBTrackInfo* createTransient (); + + TBTrackInfoCnv_p1 m_TPConverter; +}; +#endif + diff --git a/TestBeam/TBEventAthenaPool/src/TBTriggerPatternUnitCnv.cxx b/TestBeam/TBEventAthenaPool/src/TBTriggerPatternUnitCnv.cxx new file mode 100755 index 00000000000..04c441f7ce0 --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTriggerPatternUnitCnv.cxx @@ -0,0 +1,29 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TBTriggerPatternUnitCnv.h" + +TBTriggerPatternUnit_PERS* TBTriggerPatternUnitCnv::createPersistent(TBTriggerPatternUnit* transCont) { + MsgStream log(messageService(), "TBTriggerPatternUnitConverter" ); + TBTriggerPatternUnit_PERS *persObj = m_TPConverter.createPersistent( transCont, log ); + log << MSG::DEBUG << "Success" << endreq; + return persObj; +} + +TBTriggerPatternUnit* TBTriggerPatternUnitCnv::createTransient() { + MsgStream log(messageService(), "TBTriggerPatternUnitConverter" ); + static pool::Guid p1_guid("7630C108-3B5F-4ED3-97C8-F3148AF1B84F"); // GUID of the persistent object + static pool::Guid p0_guid("0B82A5B3-0808-4B78-B47B-BFE9388EEEEB"); // GUID of the transient object + if( compareClassGuid(p1_guid) ) { + // using auto_ptr ensures deletion of the persistent object + std::auto_ptr< TBTriggerPatternUnit_p1 > col_vect( poolReadObject< TBTriggerPatternUnit_p1 >() ); + return m_TPConverter.createTransient( col_vect.get(), log ); + } + else if( compareClassGuid(p0_guid) ) { + // regular object from before TP separation, just return it + return poolReadObject< TBTriggerPatternUnit >(); + } + throw std::runtime_error("Unsupported persistent version of Data Collection"); +} + diff --git a/TestBeam/TBEventAthenaPool/src/TBTriggerPatternUnitCnv.h b/TestBeam/TBEventAthenaPool/src/TBTriggerPatternUnitCnv.h new file mode 100755 index 00000000000..a593480753c --- /dev/null +++ b/TestBeam/TBEventAthenaPool/src/TBTriggerPatternUnitCnv.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ------------------------------------------------------------------- +// Modified pool converter which complies with the standards of the +// transient/persistent scheme. +// See: https://twiki.cern.ch/twiki/bin/view/Atlas/TransientPersistentSeparation#TP_converters_for_component_type +// Author: Iftach Sadeh (iftach.sadeh@NOSPAMTODAYcern.ch) , February 2010 +// ------------------------------------------------------------------- +#ifndef TBEVENTATHENAPOOL_TBTRIGGERPATTERNUNITCNV_P1_H +#define TBEVENTATHENAPOOL_TBTRIGGERPATTERNUNITCNV_P1_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +#include "TBTPCnv/TBTriggerPatternUnit_p1.h" +#include "TBEvent/TBTriggerPatternUnit.h" +#include "TBTPCnv/TBTriggerPatternUnitCnv_p1.h" + +// the latest persistent representation type of TBTriggerPatternUnit: +typedef TBTriggerPatternUnit_p1 TBTriggerPatternUnit_PERS; +typedef T_AthenaPoolCustomCnv<TBTriggerPatternUnit, TBTriggerPatternUnit_PERS > TBTriggerPatternUnitCnvBase; + +class TBTriggerPatternUnitCnv : public TBTriggerPatternUnitCnvBase { +friend class CnvFactory<TBTriggerPatternUnitCnv >; +protected: + TBTriggerPatternUnitCnv (ISvcLocator* svcloc) : TBTriggerPatternUnitCnvBase(svcloc) {} + virtual TBTriggerPatternUnit_PERS* createPersistent (TBTriggerPatternUnit* transCont); + virtual TBTriggerPatternUnit* createTransient (); + + TBTriggerPatternUnitCnv_p1 m_TPConverter; +}; +#endif + -- GitLab