18 ISvcLocator *pSvcLocator)
47 return StatusCode::SUCCESS;
57 auto vertex = beamSpot->beamVtx().position();
60 std::unique_ptr< xAOD::PixelClusterContainer > pixel_cluster_xaod_container = std::make_unique< xAOD::PixelClusterContainer >();
61 std::unique_ptr< xAOD::PixelClusterAuxContainer > pixel_cluster_xaod_aux_container = std::make_unique< xAOD::PixelClusterAuxContainer >();
62 pixel_cluster_xaod_container->setStore( pixel_cluster_xaod_aux_container.get() );
64 std::unique_ptr< xAOD::StripClusterContainer > strip_cluster_xaod_container = std::make_unique< xAOD::StripClusterContainer >();
65 std::unique_ptr< xAOD::StripClusterAuxContainer > strip_cluster_xaod_aux_container = std::make_unique< xAOD::StripClusterAuxContainer >();
66 strip_cluster_xaod_container->setStore( strip_cluster_xaod_aux_container.get() );
74 std::unordered_map<Identifier, std::size_t> mapClusters{};
76 strip_cluster_xaod_container.get(),
79 strip_cluster_xaod_container.get(),
87 ATH_CHECK( pixel_cluster_xaod_handle.
record( std::move(pixel_cluster_xaod_container),
88 std::move(pixel_cluster_xaod_aux_container) ) );
93 ATH_CHECK( strip_cluster_xaod_handle.
record( std::move(strip_cluster_xaod_container),
94 std::move(strip_cluster_xaod_aux_container) ) );
98 return StatusCode::SUCCESS;
109 if (not pixelDetEleHandle.
isValid()) {
111 return StatusCode::FAILURE;
113 pixElements = pixelDetEleHandle.
cptr();
119 const ::SpacePointContainer* pixel_container = pixel_handle.
cptr();
123 std::unique_ptr< xAOD::SpacePointAuxContainer > pixel_xaod_aux_container = std::make_unique< xAOD::SpacePointAuxContainer >();
124 pixel_xaod_container->setStore( pixel_xaod_aux_container.get() );
127 for (const ::SpacePointCollection *spc : *pixel_container) {
131 pixel_xaod_container->push_new (nsp, [&
pool](){
return pool.nextElementPtr();});
135 for (const ::SpacePointCollection *spc : *pixel_container) {
144 const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>& clusterList =
sp->clusterList();
146 if (theCluster ==
nullptr) {
150 auto clusterId = clusterList.first->identify();
152 if ( element ==
nullptr ) {
153 ATH_MSG_FATAL(
"Invalid pixel detector element for cluster identifier " << clusterId );
154 return StatusCode::FAILURE;
158 cluster_xaod_container->
push_back(pixelCl);
165 linkAcc(*pixel_sp) = link;
171 ATH_CHECK( pixel_xaod_handle.
record( std::move(pixel_xaod_container), std::move(pixel_xaod_aux_container) ) );
173 return StatusCode::SUCCESS;
179 std::unordered_map<Identifier, std::size_t>& mapClusters)
const
184 if (not stripDetEleHandle.
isValid()) {
186 return StatusCode::FAILURE;
188 stripElements = stripDetEleHandle.
cptr();
196 const ::SpacePointContainer* strip_container = strip_handle.
cptr();
199 std::unique_ptr< xAOD::SpacePointContainer > strip_xaod_container = std::make_unique< xAOD::SpacePointContainer >();
200 std::unique_ptr< xAOD::SpacePointAuxContainer > strip_xaod_aux_container = std::make_unique< xAOD::SpacePointAuxContainer >();
201 strip_xaod_container->setStore( strip_xaod_aux_container.get() );
203 strip_xaod_container->reserve(strip_container->size());
204 strip_xaod_aux_container->reserve(strip_container->size());
207 for (const ::SpacePointCollection *spc : *strip_container) {
216 const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>& clusterList =
sp->clusterList();
219 if (theCluster1 ==
nullptr or
220 theCluster2 ==
nullptr) {
224 auto clusterId1 = clusterList.first->identify();
225 auto clusterId2 = clusterList.second->identify();
228 if ( element1 ==
nullptr ) {
229 ATH_MSG_FATAL(
"Invalid strip detector element for cluster (1) identifiers " << clusterId1 );
230 return StatusCode::FAILURE;
232 if ( element2 ==
nullptr ) {
233 ATH_MSG_FATAL(
"Invalid strip detector element for cluster (2) identifiers " << clusterId2 );
234 return StatusCode::FAILURE;
237 auto insertEntry = [&mapClusters, cluster_xaod_container](
const auto & clusterId)->
bool{
238 const auto & [p,inserted] = mapClusters.try_emplace(clusterId, cluster_xaod_container->
size());
242 if (insertEntry(clusterId1)){
244 cluster_xaod_container->
push_back(stripCl1);
247 if (insertEntry(clusterId2)) {
249 cluster_xaod_container->
push_back(stripCl2);
255 strip_xaod_container->back()->setMeasurements( {stripCl1, stripCl2} );
260 linkAcc(*strip_xaod_container->back()) = link;
266 ATH_CHECK( strip_xaod_handle.
record( std::move(strip_xaod_container), std::move(strip_xaod_aux_container) ) );
268 return StatusCode::SUCCESS;
275 std::unordered_map<Identifier, std::size_t>& mapClusters)
const
280 if (not stripDetEleHandle.
isValid()) {
282 return StatusCode::FAILURE;
284 stripElements = stripDetEleHandle.
cptr();
290 const ::SpacePointOverlapCollection* strip_overlap_container = strip_overlap_handle.
cptr();
293 std::unique_ptr< xAOD::SpacePointContainer > strip_overlap_xaod_container = std::make_unique< xAOD::SpacePointContainer >();
294 std::unique_ptr< xAOD::SpacePointAuxContainer > strip_overlap_xaod_aux_container = std::make_unique< xAOD::SpacePointAuxContainer >();
295 strip_overlap_xaod_container->setStore( strip_overlap_xaod_aux_container.get() );
297 strip_overlap_xaod_container->reserve(strip_overlap_container->size());
298 strip_overlap_xaod_aux_container->reserve(strip_overlap_container->size());
311 const std::pair<const Trk::PrepRawData*, const Trk::PrepRawData*>& clusterList =
sp->clusterList();
314 if (theCluster1 ==
nullptr or
315 theCluster2 ==
nullptr) {
319 auto clusterId1 = clusterList.first->identify();
320 auto clusterId2 = clusterList.second->identify();
324 if ( element1 ==
nullptr ) {
325 ATH_MSG_FATAL(
"Invalid strip detector element for cluster (1) identifiers " << clusterId1 );
326 return StatusCode::FAILURE;
328 if ( element2 ==
nullptr ) {
329 ATH_MSG_FATAL(
"Invalid strip detector element for cluster (2) identifiers " << clusterId2 );
330 return StatusCode::FAILURE;
333 auto insertEntry = [&mapClusters, cluster_xaod_container](
const auto & clusterId)->
bool{
334 const auto & [p,inserted] = mapClusters.try_emplace(clusterId, cluster_xaod_container->
size());
337 if (insertEntry(clusterId1)) {
339 cluster_xaod_container->
push_back(stripCl1);
342 if (insertEntry(clusterId2)) {
344 cluster_xaod_container->
push_back(stripCl2);
350 strip_overlap_xaod_container->back()->setMeasurements( {stripCl1, stripCl2} );
354 stripSpacePointLinkAcc( *strip_overlap_xaod_container->back() ) = TrkLink;
359 ATH_CHECK( strip_overlap_xaod_handle.
record( std::move(strip_overlap_xaod_container), std::move(strip_overlap_xaod_aux_container) ) );
361 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
const ServiceHandle< StoreGateSvc > & detStore() const
An algorithm that can be simultaneously executed in multiple threads.
a typed memory pool that saves time spent allocation small object.
const T * back() const
Access the last element in the collection as an rvalue.
const T * at(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
ElementLink implementation for ROOT usage.
Class to hold the SiDetectorElement objects to be put in the detector store.
const SiDetectorElement * getDetectorElement(const IdentifierHash &hash) const
Class to hold geometrical description of a silicon detector element.
StatusCode convertPixel(const EventContext &ctx, xAOD::PixelClusterContainer *cluster_xaod_container) const
const PixelID * m_pixelID
virtual StatusCode execute(const EventContext &ctx) const override
SG::WriteHandleKey< xAOD::SpacePointContainer > m_outSpacepointsPixel
SG::ReadHandleKey< ::SpacePointContainer > m_inSpacepointsPixel
virtual StatusCode initialize() override
InDetToXAODSpacePointConversion(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
StatusCode convertStripOverlap(const EventContext &ctx, const Amg::Vector3D &vertex, xAOD::StripClusterContainer *cluster_xaod_container, std::unordered_map< Identifier, std::size_t > &mapClusters) const
Gaudi::Property< bool > m_processStrip
SG::WriteHandleKey< xAOD::PixelClusterContainer > m_outClustersPixel
Gaudi::Property< bool > m_processPixel
SG::WriteHandleKey< xAOD::SpacePointContainer > m_outSpacepointsOverlap
Gaudi::Property< bool > m_convertClusters
SG::ReadHandleKey< ::SpacePointContainer > m_inSpacepointsStrip
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
SG::ReadHandleKey< ::SpacePointOverlapCollection > m_inSpacepointsOverlap
SG::WriteHandleKey< xAOD::StripClusterContainer > m_outClustersStrip
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
SG::WriteHandleKey< xAOD::SpacePointContainer > m_outSpacepointsStrip
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_stripDetEleCollKey
StatusCode convertStrip(const EventContext &ctx, const Amg::Vector3D &vertex, xAOD::StripClusterContainer *cluster_xaod_container, std::unordered_map< Identifier, std::size_t > &mapClusters) const
A PixelSpacePoint is created from a PixelCluster.
An SCT_SpacePoint is created from two SCT_Cluster's from two different wafers.
SG::Accessor< T, ALLOC > Accessor
const_pointer_type cptr()
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
void setMeasurements(std::vector< const xAOD::UncalibratedMeasurement * > &&value)
Sets the index of the measurements.
Eigen::Matrix< double, 3, 1 > Vector3D
@ ALWAYS_TRACK_INDICES
Always track indices, regardless of the setting of the ownership policy.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
StatusCode convertTrkToXaodStripSpacePoint(const InDet::SCT_SpacePoint &trkSpacePoint, const Amg::Vector3D &vertex, xAOD::SpacePoint &xaodSpacePoint)
StatusCode convertTrkToXaodPixelSpacePoint(const InDet::PixelSpacePoint &trkSpacePoint, xAOD::SpacePoint &xaodSpacePoint)
StatusCode convertInDetToXaodCluster(const InDet::PixelCluster &indetCluster, const InDetDD::SiDetectorElement &element, xAOD::PixelCluster &xaodCluster)
PixelClusterContainer_v1 PixelClusterContainer
Define the version of the pixel cluster container.
StripCluster_v1 StripCluster
Define the version of the strip cluster class.
StripClusterContainer_v1 StripClusterContainer
Define the version of the strip cluster container.
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.