File indexing completed on 2026-09-12 09:33:22
0001 #ifndef NPDET_TOOLS_SETTINGS_H
0002 #define NPDET_TOOLS_SETTINGS_H
0003
0004 #include <map>
0005 #include <string>
0006 #include "TGeoManager.h"
0007
0008 class TGeoNode;
0009
0010 using std::string;
0011
0012 enum class mode { none, help, list, part };
0013
0014 struct settings {
0015 using string = std::string;
0016 using part_map = std::map<string,int>;
0017 bool help = false;
0018 bool success = false;
0019 string infile = "";
0020 string outfile = "detector_geometry";
0021 string part_name = "";
0022 int part_level = -1;
0023 mode selected = mode::list;
0024 bool level_set = false;
0025 int global_level = 1;
0026 bool list_all = false;
0027 int color = 1;
0028 double alpha = 1;
0029 bool export_visual_attributes = true;
0030 bool export_materials = true;
0031
0032 double tgeo_length_unit_in_mm = (TGeoManager::GetDefaultUnits() == TGeoManager::kRootUnits)? 10.:1.;
0033 std::map<std::string, int> part_name_levels;
0034 std::map<std::string, int> part_name_colors;
0035 std::map<std::string, double> part_name_alphas;
0036 };
0037
0038 void print_daughter_nodes(TGeoNode* node, int print_depth) ;
0039 void run_list_mode(const settings& s);
0040
0041 inline std::string ensure_step_extension(std::string output_path) {
0042 static const std::string extension = ".stp";
0043 if (output_path.size() >= extension.size() &&
0044 output_path.compare(output_path.size() - extension.size(), extension.size(), extension) == 0) {
0045 return output_path;
0046 }
0047 output_path += extension;
0048 return output_path;
0049 }
0050
0051 #endif