Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-25 09:17:24

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 "materialPlotHelper.hpp"
0010 
0011 #include <iomanip>
0012 #include <ostream>
0013 #include <string>
0014 
0015 /// Information on a given surface.
0016 
0017 struct sinfo {
0018   std::string name;
0019   std::string idname;
0020   std::string id;
0021   int type;
0022   float pos;
0023   float range_min;
0024   float range_max;
0025 };
0026 
0027 std::ostream& Acts::operator<<(std::ostream& os, Acts::GeometryIdentifier id) {
0028   os << "[ " << std::setw(3) << id.volume();
0029   os << " | " << std::setw(3) << id.boundary();
0030   os << " | " << std::setw(3) << id.layer();
0031   os << " | " << std::setw(3) << id.approach();
0032   os << " | " << std::setw(4) << id.sensitive() << " ]";
0033   return os;
0034 }
0035 
0036 /// Initialise the information on each surface.
0037 
0038 void Initialise_info(sinfo& surface_info,
0039                      const std::map<std::string, std::string>& surfaceName,
0040                      const std::uint64_t& id, const int& type, const float& pos,
0041                      const float& range_min, const float& range_max) {
0042   Acts::GeometryIdentifier ID(id);
0043   std::ostringstream layerID;
0044   layerID << ID;
0045   std::string surface_id = layerID.str();
0046 
0047   std::string Id_temp = surface_id;
0048   std::string delimiter = " | ";
0049   std::size_t del_pos = 0;
0050   std::vector<std::string> Ids;
0051   while ((del_pos = Id_temp.find(delimiter)) != std::string::npos) {
0052     Ids.push_back(Id_temp.substr(0, del_pos));
0053     Id_temp.erase(0, del_pos + delimiter.length());
0054   }
0055   Ids.push_back(Id_temp);
0056 
0057   for (int tag = 0; tag < 5; tag++) {
0058     Ids[tag].erase(std::remove(Ids[tag].begin(), Ids[tag].end(), ' '),
0059                    Ids[tag].end());
0060     Ids[tag].erase(std::remove(Ids[tag].begin(), Ids[tag].end(), '['),
0061                    Ids[tag].end());
0062     Ids[tag].erase(std::remove(Ids[tag].begin(), Ids[tag].end(), ']'),
0063                    Ids[tag].end());
0064   }
0065 
0066   surface_info.idname = "v" + Ids[0] + "_b" + Ids[1] + "_l" + Ids[2] + "_a" +
0067                         Ids[3] + "_s" + Ids[4];
0068   surface_info.type = type;
0069 
0070   if (surfaceName.contains(surface_id)) {
0071     surface_info.name = surfaceName.at(surface_id);
0072   } else {
0073     surface_info.name = "";
0074   }
0075 
0076   surface_info.id = surface_id;
0077   surface_info.pos = pos;
0078   surface_info.range_min = range_min;
0079   surface_info.range_max = range_max;
0080 }