diff --git a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/InDetSimDataCollection_p1.h b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/InDetSimDataCollection_p1.h new file mode 100755 index 0000000000000000000000000000000000000000..2298acdeb1092567af4e6b0e3d194a7184f22b62 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/InDetSimDataCollection_p1.h @@ -0,0 +1,4 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + diff --git a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/InDetSimDataCollection_p2.h b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/InDetSimDataCollection_p2.h new file mode 100644 index 0000000000000000000000000000000000000000..2298acdeb1092567af4e6b0e3d194a7184f22b62 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/InDetSimDataCollection_p2.h @@ -0,0 +1,4 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + diff --git a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/InDetSimData_p1.h b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/InDetSimData_p1.h new file mode 100755 index 0000000000000000000000000000000000000000..2298acdeb1092567af4e6b0e3d194a7184f22b62 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/InDetSimData_p1.h @@ -0,0 +1,4 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + diff --git a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/InDetSimEventAthenaPoolCnvDict.h b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/InDetSimEventAthenaPoolCnvDict.h new file mode 100755 index 0000000000000000000000000000000000000000..4b99074f8cb7f1393725712f7e83d240483cc589 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/InDetSimEventAthenaPoolCnvDict.h @@ -0,0 +1,9 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef INDETSIMEVENTATHENAPOOLDICT_H +#define INDETSIMEVENTATHENAPOOLDICT_H + + +#endif diff --git a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/selection.xml b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/selection.xml new file mode 100755 index 0000000000000000000000000000000000000000..2eff49dff6688999d781e8922c8138fc7a36b1e8 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/InDetSimEventAthenaPool/selection.xml @@ -0,0 +1,2 @@ +<lcgdict> +</lcgdict> diff --git a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/cmt/requirements b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/cmt/requirements new file mode 100755 index 0000000000000000000000000000000000000000..8b6a1d18de2e48804945d823679e4dfb70e7998e --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/cmt/requirements @@ -0,0 +1,29 @@ +package InDetSimEventAthenaPool + +author Andreas Wildauer <Andreas.Wildauer@cern.ch> +author Davide Costanzo <Davide.Costanzo@cern.ch> + +use AtlasPolicy AtlasPolicy-* + +private + +use GaudiInterface GaudiInterface-* External +use InDetSimEventTPCnv InDetSimEventTPCnv-* InnerDetector/InDetEventCnv +use AthenaPoolUtilities AthenaPoolUtilities-* Database/AthenaPOOL +use InDetSimEvent InDetSimEvent-* InnerDetector +use AtlasReflex AtlasReflex-* External + + +# Converters for the rdo containers and hit collections +apply_pattern poolcnv files="-s=${InDetSimEvent_root}/InDetSimEvent SiHitCollection.h TRTUncompressedHitCollection.h" + +macro_append InDetSimEventAthenaPoolPoolCnvGen_dependencies " InDetSimEventAthenaPoolCnvDict " +apply_pattern lcgdict dict=InDetSimEventAthenaPoolCnv selectionfile=selection.xml headerfiles="../InDetSimEventAthenaPool/InDetSimEventAthenaPoolCnvDict.h" + +macro_append InDetSimEventAthenaPoolPoolCnv_shlibflags "$(InDetEventAthenaPool_linkopts)" + +private +use AthenaPoolCnvSvc AthenaPoolCnvSvc-* Database/AthenaPOOL +use AtlasSealCLHEP AtlasSealCLHEP-* Database +end_private + diff --git a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/src/SiHitCollectionCnv.cxx b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/src/SiHitCollectionCnv.cxx new file mode 100644 index 0000000000000000000000000000000000000000..18ff80ec8cd6551cade5341ee2b3eafb6da3304f --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/src/SiHitCollectionCnv.cxx @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "InDetSimEventTPCnv/InDetHits/SiHitCollectionCnv_p1.h" +#include "InDetSimEventTPCnv/InDetHits/SiHitCollectionCnv_p2.h" +#include "InDetSimEventTPCnv/InDetHits/SiHit_p1.h" +#include "SiHitCollectionCnv.h" + + +SiHitCollection_PERS* SiHitCollectionCnv::createPersistent(SiHitCollection* transCont) { + MsgStream mlog(messageService(), "SiHitCollectionConverter" ); + SiHitCollectionCnv_PERS converter; + SiHitCollection_PERS *persObj = converter.createPersistent( transCont, mlog ); + return persObj; +} + + +SiHitCollection* SiHitCollectionCnv::createTransient() { + MsgStream mlog(messageService(), "SiHitCollectionConverter" ); + SiHitCollectionCnv_p1 converter_p1; + SiHitCollectionCnv_p2 converter_p2; + + static const pool::Guid p1_guid("36D1FF8E-5734-4A93-A133-F286CF47DB72"); + static const pool::Guid p2_guid("BD1469C5-C904-40B8-82B9-43D25888D884"); + static const pool::Guid old_guid("1EC39DA3-14F9-4901-88C7-F6909B064574"); + + SiHitCollection *trans_cont(0); + if( this->compareClassGuid(p1_guid)) { + std::auto_ptr< SiHitCollection_p1 > col_vect( this->poolReadObject< SiHitCollection_p1 >() ); + trans_cont = converter_p1.createTransient( col_vect.get(), mlog ); + } + else if( this->compareClassGuid(p2_guid)) { // version p2 + std::auto_ptr< SiHitCollection_p2 > col_vect( this->poolReadObject< SiHitCollection_p2 >() ); + trans_cont = converter_p2.createTransient( col_vect.get(), mlog ); + } + else if( this->compareClassGuid(old_guid)) { + // old version from before TP separation, just return it + AthenaHitsVector<SiHit>* oldColl = this->poolReadObject< AthenaHitsVector<SiHit> >(); + size_t size = oldColl->size(); + trans_cont=new SiHitCollection("DefaultCollectionName",size); + //do the copy + AthenaHitsVector<SiHit>::const_iterator it = oldColl->begin(), itEnd=oldColl->end(); + for (;it!=itEnd;++it) { + trans_cont->push_back(**it); + } + delete oldColl; + } else { + throw std::runtime_error("Unsupported persistent version of Data container"); + } + return trans_cont; +} diff --git a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/src/SiHitCollectionCnv.h b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/src/SiHitCollectionCnv.h new file mode 100644 index 0000000000000000000000000000000000000000..6ed46e35e2e0210ca1226e8107cae44064483286 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/src/SiHitCollectionCnv.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef SIHITCOLLECTIONCNV +#define SIHITCOLLECTIONCNV + +#include "InDetSimEvent/SiHitCollection.h" +#include "InDetSimEventTPCnv/InDetHits/SiHitCollection_p1.h" +#include "InDetSimEventTPCnv/InDetHits/SiHitCollectionCnv_p1.h" +#include "InDetSimEventTPCnv/InDetHits/SiHitCollection_p2.h" +#include "InDetSimEventTPCnv/InDetHits/SiHitCollectionCnv_p2.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +// Gaudi +#include "GaudiKernel/MsgStream.h" +// typedef to the latest persistent version +//typedef SiHitCollection_p1 SiHitCollection_PERS; +//typedef SiHitCollectionCnv_p1 SiHitCollectionCnv_PERS; +typedef SiHitCollection_p2 SiHitCollection_PERS; +typedef SiHitCollectionCnv_p2 SiHitCollectionCnv_PERS; + +class SiHitCollectionCnv : public T_AthenaPoolCustomCnv<SiHitCollection, SiHitCollection_PERS > { + friend class CnvFactory<SiHitCollectionCnv>; +protected: + SiHitCollectionCnv(ISvcLocator* svcloc) : + T_AthenaPoolCustomCnv<SiHitCollection, SiHitCollection_PERS >( svcloc) {} + SiHitCollection_PERS* createPersistent(SiHitCollection* transCont); + SiHitCollection* createTransient (); +}; + + +#endif diff --git a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/src/TRTUncompressedHitCollectionCnv.cxx b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/src/TRTUncompressedHitCollectionCnv.cxx new file mode 100755 index 0000000000000000000000000000000000000000..65a817109e38aebe0a2dee4036e6cc416edb3f5f --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/src/TRTUncompressedHitCollectionCnv.cxx @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "InDetSimEventTPCnv/InDetHits/TRT_HitCollectionCnv_p1.h" +#include "InDetSimEventTPCnv/InDetHits/TRT_HitCollectionCnv_p2.h" +#include "InDetSimEventTPCnv/InDetHits/TRT_HitCollectionCnv_p3.h" +#include "TRTUncompressedHitCollectionCnv.h" +#include "InDetSimEventTPCnv/InDetHits/TRT_Hit_p1.h" + + +TRT_HitCollection_PERS* TRTUncompressedHitCollectionCnv::createPersistent(TRTUncompressedHitCollection* transCont) { + MsgStream mlog(messageService(), "TRT_HitCollectionConverter" ); + TRT_HitCollectionCnv_PERS converter; + TRT_HitCollection_PERS *persObj = converter.createPersistent( transCont, mlog ); + return persObj; +} + + +TRTUncompressedHitCollection* TRTUncompressedHitCollectionCnv::createTransient() { + MsgStream mlog(messageService(), "TRT_HitCollectionConverter" ); + TRT_HitCollectionCnv_p1 converter_p1; + TRT_HitCollectionCnv_p2 converter_p2; + TRT_HitCollectionCnv_p3 converter_p3; + static const pool::Guid p1_guid("6688E934-157E-421A-B6D1-A35FC8BD651C"); + static const pool::Guid p2_guid("473FF621-3466-4D87-9469-4780A6A77023"); + static const pool::Guid p3_guid("FB5F5BFC-43E5-44E1-B79C-C330C1480E2E"); + static const pool::Guid old_guid("35722E01-C4E3-420E-8A7E-E375C5E7989D"); + + + TRTUncompressedHitCollection *trans_cont(0); + if( this->compareClassGuid(p1_guid)) { + std::auto_ptr< TRT_HitCollection_p1 > col_vect( this->poolReadObject< TRT_HitCollection_p1 >() ); + trans_cont = converter_p1.createTransient( col_vect.get(), mlog ); + } + else if( this->compareClassGuid(p2_guid)) { + std::auto_ptr< TRT_HitCollection_p2 > col_vect( this->poolReadObject< TRT_HitCollection_p2 >() ); + trans_cont = converter_p2.createTransient( col_vect.get(), mlog ); + } + else if( this->compareClassGuid(p3_guid)) { + std::auto_ptr< TRT_HitCollection_p3 > col_vect( this->poolReadObject< TRT_HitCollection_p3 >() ); + trans_cont = converter_p3.createTransient( col_vect.get(), mlog ); + } + else if( this->compareClassGuid(old_guid)) { + // old version from before TP separation - convert to new transient format + AthenaHitsVector<TRTUncompressedHit>* oldColl = this->poolReadObject< AthenaHitsVector<TRTUncompressedHit> >(); + size_t size = oldColl->size(); + trans_cont=new TRTUncompressedHitCollection("DefaultCollectionName",size); + //do the copy + AthenaHitsVector<TRTUncompressedHit>::const_iterator it = oldColl->begin(), itEnd=oldColl->end(); + for (;it!=itEnd;++it) { + trans_cont->push_back(**it); + } + delete oldColl; + } else { + throw std::runtime_error("Unsupported persistent version of Data container"); + } + return trans_cont; +} diff --git a/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/src/TRTUncompressedHitCollectionCnv.h b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/src/TRTUncompressedHitCollectionCnv.h new file mode 100755 index 0000000000000000000000000000000000000000..b5c95f80cd61da1d7ed1473af1a9d8aeae23e6a3 --- /dev/null +++ b/InnerDetector/InDetEventCnv/InDetSimEventAthenaPool/src/TRTUncompressedHitCollectionCnv.h @@ -0,0 +1,36 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRT_HITCOLLECTIONCNV +#define TRT_HITCOLLECTIONCNV + +#include "InDetSimEvent/TRTUncompressedHitCollection.h" +#include "InDetSimEventTPCnv/InDetHits/TRT_HitCollection_p1.h" +#include "InDetSimEventTPCnv/InDetHits/TRT_HitCollectionCnv_p1.h" +#include "InDetSimEventTPCnv/InDetHits/TRT_HitCollection_p2.h" +#include "InDetSimEventTPCnv/InDetHits/TRT_HitCollection_p3.h" +#include "InDetSimEventTPCnv/InDetHits/TRT_HitCollectionCnv_p2.h" +#include "InDetSimEventTPCnv/InDetHits/TRT_HitCollectionCnv_p3.h" +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" +// Gaudi +#include "GaudiKernel/MsgStream.h" + +// typedef to the latest persistent version +//typedef TRT_HitCollection_p1 TRT_HitCollection_PERS; +//typedef TRT_HitCollectionCnv_p1 TRT_HitCollectionCnv_PERS; +//typedef TRT_HitCollection_p2 TRT_HitCollection_PERS; +//typedef TRT_HitCollectionCnv_p2 TRT_HitCollectionCnv_PERS; +typedef TRT_HitCollection_p3 TRT_HitCollection_PERS; +typedef TRT_HitCollectionCnv_p3 TRT_HitCollectionCnv_PERS; + +class TRTUncompressedHitCollectionCnv : public T_AthenaPoolCustomCnv<TRTUncompressedHitCollection, TRT_HitCollection_PERS > { + friend class CnvFactory<TRTUncompressedHitCollectionCnv>; +protected: + TRTUncompressedHitCollectionCnv(ISvcLocator* svcloc) : + T_AthenaPoolCustomCnv<TRTUncompressedHitCollection, TRT_HitCollection_PERS >( svcloc) {} + TRT_HitCollection_PERS* createPersistent(TRTUncompressedHitCollection* transCont); + TRTUncompressedHitCollection* createTransient (); +}; + +#endif