ATLAS Offline Software
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 
12 namespace Muon{
13 
15  return std::make_unique<Amg::Transform3D>(trf).release();
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
Muon::makeTransform
Amg::Transform3D * makeTransform(const Amg::Transform3D &trf)
Definition: MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/MuonTrackingGeometry/Utils.h:14
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Muon::toVec
std::vector< std::unique_ptr< ObjType > > toVec(const std::vector< ObjType * > *vecPtr)
Definition: MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/MuonTrackingGeometry/Utils.h:38
GeoPrimitivesHelpers.h
CaloLCW_tf.trf
trf
Definition: CaloLCW_tf.py:20
python.PyAthena.obj
obj
Definition: PyAthena.py:132
Muon::release
std::vector< ObjType * > release(std::vector< std::unique_ptr< ObjType >> &objVec)
Definition: MuonSpectrometer/MuonDetDescr/MuonTrackingGeometry/MuonTrackingGeometry/Utils.h:18