Analysis Software
Documentation for sPHENIX simulation 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 
14 
15 #include <memory>
16 #include <string>
17 #include <utility>
18 #include <vector>
19 
20 #include "TGeoMatrix.h"
21 
22 class TGeoNode;
23 class TGeoVolume;
24 
25 namespace Acts {
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 = {};
70  double unit = 1 * UnitConstants::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