Warning, /firebird/firebird-ng/src/app/theme/cad-geometry-ruleset.ts is written in an unsupported language. File is not indexed.
0001 import {Injectable, signal, WritableSignal} from '@angular/core';
0002 import {openFile} from 'jsroot';
0003 import {
0004 analyzeGeoNodes,
0005 findGeoManager, getGeoNodesByLevel
0006 } from '../../lib-root-geometry/root-geo-navigation';
0007 import {build} from 'jsroot/geom';
0008 import {RootGeometryProcessor} from "../data-pipelines/root-geometry.processor";
0009
0010 import {Subdetector} from "../model/subdetector";
0011 import {Color, DoubleSide, MeshLambertMaterial, NormalBlending, Object3D, Plane} from "three";
0012
0013 import {DetectorThreeRuleSet, ThreeGeometryProcessor} from "../data-pipelines/three-geometry.processor";
0014 import * as THREE from "three";
0015 import {disposeHierarchy, getColorOrDefault} from "../utils/three.utils";
0016
0017 export const cadColorRules = [
0018 // Solenoid components - Very light blue-gray
0019 {
0020 names: ["SolenoidBarrel_assembly_0", "SolenoidEndcapP_1", "SolenoidEndcapN_2"],
0021 rules: [
0022 {
0023 color: 0xECEFF1, // Blue Gray 50 - very light blue-gray
0024 merge: true,
0025 outline: true
0026 }
0027 ]
0028 },
0029
0030 // Trackers - Warm light peach/orange
0031 {
0032 names: ["InnerSiTrackerSubAssembly_4", "MiddleSiTrackerSubAssembly_5", "OuterSiTrackerSubAssembly_6", "B0TrackerSubAssembly_12"],
0033 rules: [
0034 {
0035 color: 0xFFE0B2, // Orange 100 - very light warm orange/peach
0036 merge: true,
0037 outline: true
0038 }
0039 ]
0040 },
0041
0042 // MPGD Trackers - Light warm yellow
0043 {
0044 names: ["EndcapMPGDSubAssembly_7", "InnerMPGDBarrelSubAssembly_8", "OuterBarrelMPGDSubAssembly_11"],
0045 rules: [
0046 {
0047 color: 0xFFF9C4, // Yellow 100 - very light yellow
0048 merge: true,
0049 outline: true
0050 }
0051 ]
0052 },
0053
0054 // TOF components - Very light blue
0055 {
0056 names: ["EndcapTOFSubAssembly_9", "BarrelTOFSubAssembly_10"],
0057 rules: [
0058 {
0059 color: 0xE1F5FE, // Light Blue 50 - extremely light blue
0060 merge: true,
0061 outline: true
0062 }
0063 ]
0064 },
0065
0066 // Inner tracker support - White with slight blue tint
0067 {
0068 name: "InnerTrackerSupport_assembly_13",
0069 rules: [
0070 {
0071 color: 0xFF0000,
0072 outline: true,
0073 merge: false,
0074 newName: "InnerTrackerSupport"
0075 }
0076 ]
0077 },
0078
0079 // DIRC - Light cyan/blue
0080 {
0081 name: "DIRC_14",
0082 rules: [
0083 {
0084 patterns: ["**/*box*", "**/*prism*"],
0085 material: new THREE.MeshPhysicalMaterial({
0086 color: 0xE0F7FA, // Cyan 50 - extremely light cyan
0087 metalness: .4,
0088 roughness: .2,
0089 envMapIntensity: 0.5,
0090 clearcoat: 0.8,
0091 transparent: true,
0092 opacity: .5,
0093 reflectivity: 0.2,
0094 ior: 0.9,
0095 side: THREE.DoubleSide,
0096 }),
0097 newName: "DIRC_barAndPrisms"
0098 },
0099 {
0100 patterns: ["**/*rail*"],
0101 newName: "DIRC_rails",
0102 color: 0xF5F5F5 // Gray 100 - almost white
0103 },
0104 {
0105 patterns: ["**/*mcp*"],
0106 newName: "DIRC_mcps",
0107 color: 0xE1F5FE // Light Blue 50 - extremely light blue
0108 }
0109 ]
0110 },
0111 {
0112 // This is when DIRC geometry is standalone
0113 name: "DIRC_0",
0114 rules: [
0115 {
0116 patterns: ["**/*box*", "**/*prism*"],
0117 material: new THREE.MeshPhysicalMaterial({
0118 color: 0xFFF8E1,
0119 metalness: .2,
0120 roughness: .05,
0121 envMapIntensity: 0.3,
0122 clearcoat: 1,
0123 transparent: true,
0124 transmission: .2,
0125 opacity: .25,
0126 reflectivity: 0.2,
0127 //refr: 0.985,
0128 ior: 0.9,
0129 side: THREE.DoubleSide,
0130 }),
0131 merge: false,
0132 outline: true,
0133 newName: "DIRC_barAndPrisms",
0134 },
0135 {
0136 patterns: ["**/*rail*"],
0137 newName: "DIRC_rails",
0138 color: 0xAAAACC
0139 },
0140 {
0141 patterns: ["**/*mcp*"],
0142 newName: "DIRC_mcps"
0143 }
0144 ]
0145
0146 },
0147
0148 // RICH Endcap - Very light violet-blue
0149 {
0150 name: "RICHEndcapN_Vol_15",
0151 rules: [
0152 {
0153 color: 0xE8EAF6, // Indigo 50 - extremely light indigo
0154 merge: true,
0155 outline: true
0156 }
0157 ]
0158 },
0159
0160 // DRICH - Different tone as requested (light peach)
0161 {
0162 name: "DRICH_16",
0163 rules: [
0164 {
0165 color: 0xFFECB3, // Amber 100 - light warm amber/peach
0166 merge: true,
0167 outline: true
0168 }
0169 ]
0170 },
0171
0172 // Ecal components - Very light lavender
0173 {
0174 names: ["EcalEndcapP_17", "EcalEndcapPInsert_18", "EcalBarrelImaging_19", "EcalBarrelScFi_20", "B0ECal_43"],
0175 rules: [
0176 {
0177 color: 0xF3E5F5, // Purple 50 - extremely light purple
0178 merge: true,
0179 outline: true
0180 }
0181 ]
0182 },
0183
0184 // EcalEndcapN - Light blue crystal
0185 {
0186 name: "EcalEndcapN*",
0187 rules: [
0188 {
0189 patterns: ["**/crystal_vol_0"],
0190 color: 0xE3F2FD // Blue 50 - extremely light blue
0191 },
0192 {
0193 patterns: ["**/inner_support*", "**/ring*"],
0194 material: new THREE.MeshStandardMaterial({
0195 color: 0xF5F5F5, // Gray 100 - almost white
0196 roughness: 0.5,
0197 metalness: 0.1,
0198 transparent: true,
0199 opacity: 0.5,
0200 side: THREE.DoubleSide
0201 })
0202 }
0203 ]
0204 },
0205
0206 // Hcal components - Light blue (biggest components)
0207 {
0208 names: ["LFHCAL_env_22", "HcalEndcapPInsert_23", "HcalBarrel_24", "HcalEndcapN_25"],
0209 rules: [
0210 {
0211 color: 0x90CAF9, // Blue 200 - light blue with more saturation
0212 merge: true,
0213 outline: true
0214 }
0215 ]
0216 },
0217
0218 // Flux components - Light blue
0219 {
0220 names: ["FluxBarrel_env_25", "FluxEndcapP_26", "FluxEndcapN_26", "FluxEndcapN_28"],
0221 rules: [
0222 {
0223 color: 0xE3F2FD, // Blue 50 - extremely light blue
0224 merge: true,
0225 outline: true
0226 }
0227 ]
0228 },
0229
0230 // Beam Pipe components - Nearly white
0231 {
0232 names: [
0233 "BeamPipe_assembly_27",
0234 "BeamPipeB0_assembly_36",
0235 "B0Window_vol_ExitWindow_37",
0236 "Pipe_cen_to_pos_assembly_38",
0237 "Pipe_Q1eR_to_B2BeR_assembly_53",
0238 "Q0EF_vac_40",
0239 "Q1EF_vac_42"
0240 ],
0241 rules: [
0242 {
0243 color: 0xFAFAFA, // Gray 50 - almost white
0244 merge: true,
0245 outline: true
0246 }
0247 ]
0248 },
0249
0250 // Magnet components - Light green as requested (beamline magnets are typically green)
0251 {
0252 names: [
0253 "B0PF_BeamlineMagnet_assembly_28",
0254 "B0APF_BeamlineMagnet_assembly_29",
0255 "Q1APF_BeamlineMagnet_assembly_30",
0256 "Q1BPF_BeamlineMagnet_assembly_31",
0257 "Q0EF_assembly_39",
0258 "Q1EF_assembly_41",
0259 "Magnet_Q1eR_assembly_54",
0260 "Magnet_Q2eR_assembly_55",
0261 "Magnet_B2AeR_assembly_56",
0262 "Magnet_B2BeR_assembly_57",
0263 "Magnets_Q3eR_assembly_58"
0264 ],
0265 rules: [
0266 {
0267 color: 0xC8E6C9, // Green 100 - light green
0268 merge: true,
0269 outline: true
0270 }
0271 ]
0272 },
0273
0274 // Vertex Barrel - Warm light amber
0275 {
0276 name: "VertexBarrelSubAssembly_3",
0277 rules: [
0278 {
0279 color: 0xFFF8E1, // Amber 50 - extremely light amber/peach
0280 merge: true,
0281 outline: true
0282 }
0283 ]
0284 },
0285
0286 // Default rule for anything not matched above
0287 {
0288 name: "*",
0289 rules: [
0290 {
0291 color: 0x82817f, // Gray 100 - very light gray
0292 merge: true,
0293 outline: true,
0294 outlineColor: 0xA0A0A0
0295 }
0296 ]
0297 }
0298 ]