Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GeometryIdentifier.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GeometryIdentifier.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019-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 
10 
11 #include <array>
12 #include <ostream>
13 
14 std::ostream& Acts::operator<<(std::ostream& os, Acts::GeometryIdentifier id) {
15  // zero represents an invalid/undefined identifier
16  if (id.value() == 0u) {
17  return (os << "undefined");
18  }
19 
20  static const std::array<const char*, 6> names = {
21  "vol=", "bnd=", "lay=", "apr=", "sen=", "ext=",
22  };
23 
24  const std::array<GeometryIdentifier::Value, 6> levels = {
25  id.volume(), id.boundary(), id.layer(),
26  id.approach(), id.sensitive(), id.extra()};
27 
28  bool writeSeparator = false;
29  for (auto i = 0u; i < levels.size(); ++i) {
30  if (levels[i] != 0u) {
31  if (writeSeparator) {
32  os << '|';
33  }
34  os << names[i] << levels[i];
35  writeSeparator = true;
36  }
37  }
38  return os;
39 }
40 
43  const Acts::Surface& /*surface*/) const {
44  return identifier;
45 }