Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:22

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Geometry/GeometryIdentifier.hpp"
0010 
0011 #include <array>
0012 #include <ostream>
0013 
0014 std::ostream& Acts::operator<<(std::ostream& os, Acts::GeometryIdentifier id) {
0015   // zero represents an invalid/undefined identifier
0016   if (id.value() == 0u) {
0017     return (os << "undefined");
0018   }
0019 
0020   static const std::array<const char*, 6> names = {
0021       "vol=", "bnd=", "lay=", "apr=", "sen=", "ext=",
0022   };
0023 
0024   const std::array<GeometryIdentifier::Value, 6> levels = {
0025       id.volume(),   id.boundary(),  id.layer(),
0026       id.approach(), id.sensitive(), id.extra()};
0027 
0028   bool writeSeparator = false;
0029   for (auto i = 0u; i < levels.size(); ++i) {
0030     if (levels[i] != 0u) {
0031       if (writeSeparator) {
0032         os << '|';
0033       }
0034       os << names[i] << levels[i];
0035       writeSeparator = true;
0036     }
0037   }
0038   return os;
0039 }
0040 
0041 Acts::GeometryIdentifier Acts::GeometryIdentifierHook::decorateIdentifier(
0042     Acts::GeometryIdentifier identifier,
0043     const Acts::Surface& /*surface*/) const {
0044   return identifier;
0045 }