diff --git a/Tracker/TrackerEventCnv/TrackerEventAthenaPool/CMakeLists.txt b/Tracker/TrackerEventCnv/TrackerEventAthenaPool/CMakeLists.txt index ece9e4106d04403ed945c00a10b32dd62ea1a395..4f948521da35acaa0936d8b27c5cb6252693e9eb 100644 --- a/Tracker/TrackerEventCnv/TrackerEventAthenaPool/CMakeLists.txt +++ b/Tracker/TrackerEventCnv/TrackerEventAthenaPool/CMakeLists.txt @@ -12,6 +12,7 @@ atlas_add_poolcnv_library( TrackerEventAthenaPoolPoolCnv FILES TrackerRawData/FaserSCT_RDO_Container.h TrackerPrepRawData/FaserSCT_ClusterContainer.h TrackerSimData/TrackerSimDataCollection.h + TrkSpacePoint/SpacePointContainer.h # FaserSCT_ConditionsData/FaserSCT_FlaggedCondData.h LINK_LIBRARIES Identifier GeneratorObjectsTPCnv AthAllocators AthContainers AthenaBaseComps AthenaKernel SGTools StoreGateLib AthenaPoolCnvSvcLib @@ -19,6 +20,8 @@ atlas_add_poolcnv_library( TrackerEventAthenaPoolPoolCnv TrackerReadoutGeometry TrackerEventTPCnv TrackerRawData TrackerSimData TrackerPrepRawData TrkTrack + TrkSpacePoint + TrackerSpacePoint # FaserSCT_ConditionsData ) diff --git a/Tracker/TrackerEventCnv/TrackerEventAthenaPool/src/SpacePointContainerCnv.cxx b/Tracker/TrackerEventCnv/TrackerEventAthenaPool/src/SpacePointContainerCnv.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4ea69f69454c3e5683f3202e17b844dde7fb4208 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerEventAthenaPool/src/SpacePointContainerCnv.cxx @@ -0,0 +1,35 @@ +/* + Copyright (C) 2021 CERN for the benefit of the FASER collaboration +*/ + +#include "SpacePointContainerCnv.h" + +SpacePointContainer_PERS* +SpacePointContainerCnv::createPersistent (SpacePointContainer* transObj) { + ATH_MSG_INFO("SpacePointContainerCnv::createPersistent()"); + + SpacePointContainerCnv_PERS converter; + + SpacePointContainer_PERS* persObj(nullptr); + persObj = converter.createPersistent(transObj, msg()); + return persObj; +} + + +SpacePointContainer* +SpacePointContainerCnv::createTransient() { + ATH_MSG_INFO("SpacePointContainerCnv::createTransient()"); + + static const pool::Guid p0_guid("DB0397F9-A163-496F-BC17-C7E507A1FA50"); + SpacePointContainer* transObj(nullptr); + + if (compareClassGuid(p0_guid)) { + std::unique_ptr<SpacePointContainer_PERS> col_vect(poolReadObject<SpacePointContainer_PERS>()); + SpacePointContainerCnv_PERS converter; + transObj = converter.createTransient( col_vect.get(), msg()); + } else { + throw std::runtime_error("Unsupported persistent version of SpacePointContainer"); + } + + return transObj; +} diff --git a/Tracker/TrackerEventCnv/TrackerEventAthenaPool/src/SpacePointContainerCnv.h b/Tracker/TrackerEventCnv/TrackerEventAthenaPool/src/SpacePointContainerCnv.h new file mode 100644 index 0000000000000000000000000000000000000000..9537ce3aad9f6327535b90dfef7bda79e9c313c3 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerEventAthenaPool/src/SpacePointContainerCnv.h @@ -0,0 +1,31 @@ +/* + Copyright 2021 CERN for the benefit of the FASER collaboration +*/ + +#ifndef SPACEPOINTCONTAINERCNV_H +#define SPACEPOINTCONTAINERCNV_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h" + +#include "TrackerEventTPCnv/SpacePointContainerCnv_p0.h" + +#include "TrkSpacePoint/SpacePointContainer.h" +#include "TrackerEventTPCnv/SpacePointContainer_p0.h" + +typedef SpacePointContainer_p0 SpacePointContainer_PERS; +typedef SpacePointContainerCnv_p0 SpacePointContainerCnv_PERS; + +typedef T_AthenaPoolCustomCnv<SpacePointContainer, SpacePointContainer_PERS> SpacePointContainerCnvBase; + +class SpacePointContainerCnv : public SpacePointContainerCnvBase { + friend class CnvFactory<SpacePointContainerCnv>; + + public: + SpacePointContainerCnv (ISvcLocator* svcloc) : SpacePointContainerCnvBase(svcloc) {} + + protected: + virtual SpacePointContainer_PERS* createPersistent (SpacePointContainer* transObj); + virtual SpacePointContainer* createTransient (); +}; + +#endif // SPACEPOINTCONTAINERCNV_H diff --git a/Tracker/TrackerEventCnv/TrackerEventTPCnv/CMakeLists.txt b/Tracker/TrackerEventCnv/TrackerEventTPCnv/CMakeLists.txt index d60ff6dd88b2e6624f3a5b3297d5d0a5ad57996b..1a1a269b2e00ce4f4994965408f55141d9186c14 100644 --- a/Tracker/TrackerEventCnv/TrackerEventTPCnv/CMakeLists.txt +++ b/Tracker/TrackerEventCnv/TrackerEventTPCnv/CMakeLists.txt @@ -17,6 +17,8 @@ atlas_add_tpcnv_library( TrackerEventTPCnv TrackerPrepRawData TrkEventTPCnv TrkPrepRawData + TrkSpacePoint + TrackerSpacePoint PRIVATE_LINK_LIBRARIES AthenaBaseComps AthenaKernel EventPrimitives TrackerReadoutGeometry TrkSurfaces TrkEventPrimitives TrkMeasurementBase TrkRIO_OnTrack EventContainers ) diff --git a/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePointCnv_p0.h b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePointCnv_p0.h new file mode 100644 index 0000000000000000000000000000000000000000..10c3090e3c98fa4a2cfb14afaa0a81b22cdb6900 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePointCnv_p0.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2021 CERN for the benefit of the FASER collaboration +*/ + +#ifndef SPACEPOINTCNV_P0_H +#define SPACEPOINTCNV_P0_H + +#include "TrackerSpacePoint/FaserSCT_SpacePoint.h" +#include "TrackerEventTPCnv/SpacePoint_p0.h" + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +class SpacePointCnv_p0 : public T_AthenaPoolTPCnvBase<Tracker::FaserSCT_SpacePoint, SpacePoint_p0> { + public: + SpacePointCnv_p0() {}; + + virtual void persToTrans(const SpacePoint_p0* persObj, + Tracker::FaserSCT_SpacePoint* transObj, + MsgStream& log); + + virtual void transToPers(const Tracker::FaserSCT_SpacePoint* transObj, + SpacePoint_p0* persObj, + MsgStream& log); +}; + +#endif // SPACEPOINTCNV_P0_H diff --git a/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePointCollection_p0.h b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePointCollection_p0.h new file mode 100644 index 0000000000000000000000000000000000000000..3d71dcf8f1f15bd0bb5628a743f3af614f354e7a --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePointCollection_p0.h @@ -0,0 +1,22 @@ +/* + Copyright 2021 CERN for the benefit of the FASER collaboration +*/ + +#ifndef SPACEPOINTCOLLECTION_P0_H +#define SPACEPOINTCOLLECTION_P0_H + +#include <vector> + +class SpacePointCollection_p0 { + public: + SpacePointCollection_p0(); + friend class SpacePointClusterCnv_p0; + + unsigned short m_idHash; + unsigned short m_size; +}; + +inline +SpacePointCollection_p0::SpacePointCollection_p0() : m_idHash(0) { } + +#endif // SPACEPOINTCOLLECTION_P0_H diff --git a/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePointContainerCnv_p0.h b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePointContainerCnv_p0.h new file mode 100644 index 0000000000000000000000000000000000000000..2da19a3ce5880820fcf39fab7cac0a40ce3ffa4a --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePointContainerCnv_p0.h @@ -0,0 +1,26 @@ +/* + Copyright 2021 CERN for the benefit of the FASER collaboration +*/ + +#ifndef SPACEPOINTCONTAINERCNV_P0_H +#define SPACEPOINTCONTAINERCNV_P0_H + +#include "AthenaPoolCnvSvc/T_AthenaPoolTPConverter.h" + +#include "TrkSpacePoint/SpacePointContainer.h" +#include "TrackerEventTPCnv/SpacePointContainer_p0.h" + +class SpacePointContainerCnv_p0 : public T_AthenaPoolTPCnvBase<SpacePointContainer, SpacePointContainer_p0> { + public: + SpacePointContainerCnv_p0() {}; + + virtual void persToTrans(const SpacePointContainer_p0* persObj, + SpacePointContainer* transObj, + MsgStream& log); + + virtual void transToPers(const SpacePointContainer* transObj, + SpacePointContainer_p0* persObj, + MsgStream& log); +}; + +#endif // SPACEPOINTCONTAINERCNV_P0_H diff --git a/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePointContainer_p0.h b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePointContainer_p0.h new file mode 100644 index 0000000000000000000000000000000000000000..0a9cdbe4d8da94c47e96797a486649073ff02ebf --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePointContainer_p0.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2021 CERN for the benefit of the FASER collaboration +*/ + +#ifndef SPACEPOINTCONTAINER_P0_H +#define SPACEPOINTCONTAINER_P0_H + +#include <vector> +#include "TrackerEventTPCnv/SpacePoint_p0.h" +#include "TrackerEventTPCnv/SpacePointCollection_p0.h" + +class SpacePointContainer_p0 { + public: + SpacePointContainer_p0(); + friend class SpacePointContainerCnv_p0; + private: + std::vector<SpacePoint_p0> m_spacepoints; + std::vector<SpacePointCollection_p0> m_spacepoint_collections; +}; + +inline SpacePointContainer_p0::SpacePointContainer_p0() { + m_spacepoints.clear(); + m_spacepoint_collections.clear(); +} + +#endif // SPACEPOINTCONTAINER_P0_H diff --git a/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePoint_p0.h b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePoint_p0.h new file mode 100644 index 0000000000000000000000000000000000000000..4a648fa58dd681f52f59f91ecac25635b16b7f30 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/SpacePoint_p0.h @@ -0,0 +1,44 @@ +/* + Copyright 2021 CERN for the benefit of the FASER collaboration +*/ + +#ifndef SPACEPOINT_P0_H +#define SPACEPOINT_P0_H + +class SpacePoint_p0 { + public: + SpacePoint_p0(); + friend class SpacePointCnv_p0; + + private: + unsigned int m_idHash0; + unsigned int m_idHash1; + + float m_pos_x; + float m_pos_y; + float m_pos_z; + + float m_cov00; + float m_cov01; + float m_cov02; + float m_cov11; + float m_cov12; + float m_cov22; +}; + +inline +SpacePoint_p0::SpacePoint_p0() : + m_idHash0(0), + m_idHash1(0), + m_pos_x(0), + m_pos_y(0), + m_pos_z(0), + m_cov00(0), + m_cov01(0), + m_cov02(0), + m_cov11(0), + m_cov12(0), + m_cov22(0) +{} + +#endif // SPACEPOINT_P0_H diff --git a/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/TrackerEventTPCnvDict.h b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/TrackerEventTPCnvDict.h index a99bf84eb4e46238572c4fd4f29e4b60890f826a..11d25251977fdc838dc3bc87499772ed5c98a3b7 100644 --- a/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/TrackerEventTPCnvDict.h +++ b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/TrackerEventTPCnvDict.h @@ -40,6 +40,9 @@ // #include "InDetEventTPCnv/InDetLowBetaInfo/InDetLowBetaContainer_p1.h" // #include "InDetEventTPCnv/InDetLowBetaInfo/InDetLowBetaCandidate_tlp1.h" // #include "InDetEventTPCnv/InDetLowBetaInfo/InDetLowBetaContainer_tlp1.h" +#include "TrackerEventTPCnv/SpacePoint_p0.h" +#include "TrackerEventTPCnv/SpacePointCollection_p0.h" +#include "TrackerEventTPCnv/SpacePointContainer_p0.h" namespace TrackerEventTPCnvDict { struct tmp @@ -56,6 +59,8 @@ namespace TrackerEventTPCnvDict { // std::vector< InDet::CompetingSCT_ClustersOnTrack_p1> m_v10; // std::vector< InDet::CompetingTRT_DriftCirclesOnTrack_p1> m_v11; // std::vector< InDetLowBetaCandidate_p1> m_v12; + std::vector<SpacePoint_p0> m_v13; + std::vector<SpacePointCollection_p0> m_v14; }; } //> namespace TrackerEventTPCnvDict diff --git a/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/selection.xml b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/selection.xml index 9f9267182b5dd4e39314166555deb98db5b7eae0..d74ef582b72ea1988e8d188b92ada957340df1d5 100644 --- a/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/selection.xml +++ b/Tracker/TrackerEventCnv/TrackerEventTPCnv/TrackerEventTPCnv/selection.xml @@ -73,3 +73,11 @@ <!-- <class name="std::pair<unsigned int,std::vector<unsigned int> >" /> --> <class name="std::vector< std::pair<unsigned int, std::vector<unsigned int> > >" /> + <!-- SpacePoint --> + <class name="SpacePoint_p0" /> + <class name="std::vector<SpacePoint_p0>" /> + <class name="SpacePointCollection_p0" /> + <class name="std::vector<SpacePointCollection_p0>" /> + <class name="SpacePointContainer_p0" id="DB0397F9-A163-496F-BC17-C7E507A1FA50" /> + +</lcgdict> \ No newline at end of file diff --git a/Tracker/TrackerEventCnv/TrackerEventTPCnv/src/SpacePointCnv_p0.cxx b/Tracker/TrackerEventCnv/TrackerEventTPCnv/src/SpacePointCnv_p0.cxx new file mode 100644 index 0000000000000000000000000000000000000000..63dba18507be95fe780a27de401cc6ac01a57027 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerEventTPCnv/src/SpacePointCnv_p0.cxx @@ -0,0 +1,33 @@ +/* + Copyright (C) 2021 CERN for the benefit of the FASER collaboration +*/ + +#include "TrackerEventTPCnv/SpacePointCnv_p0.h" + +void +SpacePointCnv_p0::persToTrans(const SpacePoint_p0* persObj, Tracker::FaserSCT_SpacePoint* transObj, MsgStream& /*log*/) { + + // TODO + +} + +void +SpacePointCnv_p0::transToPers(const Tracker::FaserSCT_SpacePoint* transObj, SpacePoint_p0* persObj, MsgStream& /*log*/) { + + auto idHashs = transObj->elementIdList(); + persObj->m_idHash0 = idHashs.first; + persObj->m_idHash1 = idHashs.second; + + auto globalPosition = transObj->globalPosition(); + persObj->m_pos_x = globalPosition.x(); + persObj->m_pos_y = globalPosition.y(); + persObj->m_pos_z = globalPosition.z(); + + auto cov = transObj->globCovariance(); + persObj->m_cov00 = cov(0,0); + persObj->m_cov01 = cov(0,1); + persObj->m_cov02 = cov(0,2); + persObj->m_cov11 = cov(1,1); + persObj->m_cov12 = cov(2,2); + persObj->m_cov22 = cov(2,2); +} diff --git a/Tracker/TrackerEventCnv/TrackerEventTPCnv/src/SpacePointContainerCnv_p0.cxx b/Tracker/TrackerEventCnv/TrackerEventTPCnv/src/SpacePointContainerCnv_p0.cxx new file mode 100644 index 0000000000000000000000000000000000000000..88c0f0b220c45bac9322484e027707ada331bc27 --- /dev/null +++ b/Tracker/TrackerEventCnv/TrackerEventTPCnv/src/SpacePointContainerCnv_p0.cxx @@ -0,0 +1,56 @@ +/* + Copyright (C) 2021 CERN for the benefit of the FASER collaboration +*/ + +#include "TrackerEventTPCnv/SpacePointContainerCnv_p0.h" + +#include "TrackerEventTPCnv/SpacePoint_p0.h" +#include "TrackerEventTPCnv/SpacePointCollection_p0.h" +#include "TrackerEventTPCnv/SpacePointCnv_p0.h" + +void SpacePointContainerCnv_p0::persToTrans(const SpacePointContainer_p0* /*persObj*/, SpacePointContainer* /*transObj*/, MsgStream& /*log*/) { + + // TODO + +} + +void SpacePointContainerCnv_p0::transToPers(const SpacePointContainer* transObj, SpacePointContainer_p0* persObj, MsgStream& log) { + log << MSG::INFO << "SpacePointContainerCnv_p0::transToPers()" << endmsg; + + SpacePointCnv_p0 spCnv; + typedef SpacePointContainer TRANS; + + TRANS::const_iterator spColl; + TRANS::const_iterator spCollEnd = transObj->end(); + unsigned int spCollId; + unsigned int spId = 0; + unsigned int nextSpId = 0; + unsigned int lastIdHash = 0; + + // resize data vectors + persObj->m_spacepoint_collections.resize(transObj->numberOfCollections()); + int n_spacepoints = 0; + for (spColl = transObj->begin(); spColl != spCollEnd; spColl++) { + n_spacepoints += (*spColl)->size(); + } + persObj->m_spacepoints.resize(n_spacepoints); + + for (spColl = transObj->begin(), spCollId = 0; spColl != spCollEnd; ++spCollId, ++spColl) { + // create persitent representation of SpacePointCollections + const SpacePointCollection& collection = **spColl; + SpacePointCollection_p0& pcollection = persObj->m_spacepoint_collections[spCollId]; + pcollection.m_size = collection.size(); + pcollection.m_idHash = collection.identifyHash() - lastIdHash; + lastIdHash = collection.identifyHash(); + + spId = nextSpId; + nextSpId += collection.size(); + + // create persitent representation of SpacePoints + for (std::size_t i = 0; i < collection.size(); ++i) { + SpacePoint_p0* persSP = &(persObj->m_spacepoints[i + spId]); + const Tracker::FaserSCT_SpacePoint* transSP = dynamic_cast<const Tracker::FaserSCT_SpacePoint*>(collection[i]); + spCnv.transToPers(transSP, persSP, log); + } + } +} diff --git a/Tracker/TrackerRecAlgs/TrackerSpacePointFormation/python/TrackerSpacePointFormationConfig.py b/Tracker/TrackerRecAlgs/TrackerSpacePointFormation/python/TrackerSpacePointFormationConfig.py index 9760e36277f013aa6f0ef6eb03ecfbcee3f1635e..e3859d6d1c2ad9e764b59dd2e92344489090ad13 100644 --- a/Tracker/TrackerRecAlgs/TrackerSpacePointFormation/python/TrackerSpacePointFormationConfig.py +++ b/Tracker/TrackerRecAlgs/TrackerSpacePointFormation/python/TrackerSpacePointFormationConfig.py @@ -55,7 +55,8 @@ def StatisticsBasicCfg(flags, **kwargs): def TrackerSpacePointFinder_OutputCfg(flags): """Return ComponentAccumulator with Output for SCT. Not standalone.""" acc = ComponentAccumulator() - acc.merge(OutputStreamCfg(flags, "ESD")) + itemList = [ "SpacePointContainer#*"] + acc.merge(OutputStreamCfg(flags, "ESD", itemList)) ostream = acc.getEventAlgo("OutputStreamESD") ostream.TakeItemsFromInput = True return acc