ATLAS Offline Software
Loading...
Searching...
No Matches
MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/MuonTrackingGeometry/Utils.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONTRACKINGGEOMETRY_TRANSFORMUTILS_H
5#define MUONTRACKINGGEOMETRY_TRANSFORMUTILS_H
6
8
9#include <vector>
10#include <memory>
11
12namespace Muon{
13
14 inline std::unique_ptr<Amg::Transform3D> makeTransform(const Amg::Transform3D& trf) {
15 return std::make_unique<Amg::Transform3D>(trf);
16 }
17 template <class ObjType>
18 std::vector<ObjType *> release(std::vector<std::unique_ptr<ObjType>>& objVec) {
19 std::vector<ObjType*> outVec{};
20 outVec.reserve(objVec.size());
21 for (std::unique_ptr<ObjType>& obj : objVec) {
22 outVec.push_back(obj.release());
23 }
24 objVec.clear();
25 return outVec;
26 }
27 template<class ObjPtr>
28 std::vector<std::vector<ObjPtr*>>
29 release(std::vector<std::vector<std::unique_ptr<ObjPtr>>>& inVec){
30 std::vector<std::vector<ObjPtr*>> outVec{};
31 outVec.reserve(inVec.size());
32 for (auto& in : inVec){
33 outVec.emplace_back(release(in));
34 }
35 return outVec;
36 }
37 template <class ObjType>
38 std::vector<std::unique_ptr<ObjType>> toVec(const std::vector<ObjType*>* vecPtr) {
39 std::vector<std::unique_ptr<ObjType>> outVec{};
40 outVec.reserve(vecPtr->size());
41 for (auto obj : *vecPtr) {
42 outVec.emplace_back(obj);
43 }
44 delete vecPtr;
45 return outVec;
46 }
47}
48#endif
static std::string release
Definition computils.h:50
Eigen::Affine3d Transform3D
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
std::unique_ptr< Amg::Transform3D > makeTransform(const Amg::Transform3D &trf)
std::vector< std::unique_ptr< ObjType > > toVec(const std::vector< ObjType * > *vecPtr)