EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TGeoParser.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TGeoParser.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
13 #include "Acts/Utilities/Units.hpp"
14 
15 #include <string>
16 #include <vector>
17 
18 #include "TGeoMatrix.h"
19 
20 class TGeoNode;
21 class TGeoVolume;
22 
23 namespace Acts {
24 
25 using namespace UnitLiterals;
26 
33 struct TGeoParser {
34  using ParseRange = std::pair<double, double>;
35 
36  struct SelectedNode {
37  // The selected geo node
38  const TGeoNode* node = nullptr;
39  // The transform to global
40  std::unique_ptr<TGeoMatrix> transform = nullptr;
41  };
42 
48  struct State {
49  // The current volume
50  TGeoVolume* volume = nullptr;
51  // The current node
52  TGeoNode* node = nullptr;
53  // Bool on branch
54  bool onBranch = false;
55  // The currently collected nodes
56  std::vector<SelectedNode> selectedNodes = {};
57  };
58 
62  struct Options {
64  std::vector<std::string> volumeNames = {};
66  std::vector<std::string> targetNames = {};
68  std::string localAxes = "XYZ";
70  double unit = 1_cm;
72  std::vector<std::pair<BinningValue, ParseRange> > parseRanges = {};
73  };
74 
79  static void select(State& state, const Options& options,
80  const TGeoMatrix& gmatrix = TGeoIdentity("ID"));
81 };
82 
83 } // namespace Acts