Back to home page

EIC code displayed by LXR

 
 

    


Warning, /firebird/packages/epic/src/cool2-geometry-ruleset.ts is written in an unsupported language. File is not indexed.

0001 import * as THREE from "three";
0002 import {DepthModes} from "three";
0003 import {
0004   AMBER_50, BLUE_50, GRAY_50, INDIGO_80, PINK_50, PURPLE_50, GRAY_100, GREEN_100, ORANGE_100,
0005   YELLOW_100, BLUE_200, BROWN_100, AMBER_200, INDIGO_200, GREEN_200, ORANGE_200, ORANGE_DEEP_200,
0006   TEAL_200, YELLOW_200, BLUE_300, GRAY_300, BLUE_GRAY_400, PURPLE_400, AMBER_500, GUNMETAL_BLUE,
0007   PEWTER, STEEL_BLUE, TITANIUM, CHROME, SILVER,
0008 } from "@dexvis/firebird-ng/geometry-palette";
0009 
0010 /**
0011  * COOL2 Color Rules - Modern palette based on detector categories
0012  *
0013  * Color scheme:
0014  * - Tracking detectors: yellowish-orange (AMBER, ORANGE, YELLOW)
0015  * - PID detectors: greenish (GREEN, TEAL)
0016  * - Electron calorimeters (Ecal): pink/violetish (PINK, PURPLE)
0017  * - HCALs: bluish (BLUE)
0018  * - Flux return: grey (GRAY)
0019  * - Electron beampipe: saturated blue metallic (STEEL_BLUE)
0020  * - Magnets and support: neutral metal or light colors
0021  */
0022 export const cool2ColorRules = [
0023 
0024   // ============================================================
0025   // CENTRAL DETECTOR - MAGNETS
0026   // ============================================================
0027   {
0028     names: ["SolenoidBarrel_assembly*", "SolenoidEndcapP*", "SolenoidEndcapN*"],
0029     rules: [
0030       {
0031         //color: CHROME,  // Neutral metal for main solenoid
0032         material: new THREE.MeshPhongMaterial({
0033           color: CHROME,  // Metal support
0034           specular: GRAY_50,
0035           shininess: 100,
0036           transparent: false,
0037           opacity: 1,
0038           side: THREE.DoubleSide,
0039           clipShadows: true,
0040           stencilWrite: true,
0041           stencilFunc: THREE.AlwaysStencilFunc,
0042           stencilRef: 1,
0043         }),
0044         merge: true,
0045         outline: true
0046       }
0047     ]
0048   },
0049 
0050   // ============================================================
0051   // CENTRAL DETECTOR - TRACKING (Yellowish-Orange)
0052   // ============================================================
0053 
0054   // Vertex detectors - warmest orange tone
0055   {
0056     name: "VertexBarrelSubAssembly*",
0057     rules: [
0058       {
0059         color: ORANGE_DEEP_200,  // Medium-light orange
0060         merge: true,
0061         outline: true
0062       }
0063     ]
0064   },
0065 
0066   // Silicon trackers - amber/orange tones
0067   {
0068     names: [
0069       "InnerSiTrackerSubAssembly*",
0070       "MiddleSiBarrelSubAssembly*",
0071       "OuterSiBarrelSubAssembly*",
0072       "MiddleSiEndcapSubAssembly*",
0073       "OuterSiEndcapSubAssembly*"
0074     ],
0075     rules: [
0076       {
0077         color: AMBER_200,  // Medium-light amber
0078         merge: true,
0079         outline: true
0080       }
0081     ]
0082   },
0083 
0084   // MPGD Trackers - yellowish
0085   {
0086     names: [
0087       "EndcapMPGDSubAssembly*",
0088       "InnerMPGDBarrelSubAssembly*",
0089       "OuterBarrelMPGDSubAssembly*"
0090     ],
0091     rules: [
0092       {
0093         color: YELLOW_200,  // Medium-light yellow
0094         merge: true,
0095         outline: true
0096       }
0097     ]
0098   },
0099 
0100   // Ecal Barrel Tracker (imaging part) - yellowish as it's tracking
0101   {
0102     name: "EcalBarrelTrackerSubAssembly*",
0103     rules: [
0104       // {
0105       //   color: YELLOW_100,  // Very light yellow
0106       //   merge: true,
0107       //   outline: true
0108       // }
0109       {
0110         material: new THREE.MeshLambertMaterial({
0111           color: YELLOW_100,  // Metal support
0112           transparent: false,
0113           opacity: 1,
0114           side: THREE.DoubleSide,
0115           clipShadows: true,
0116           stencilWrite: true,
0117           stencilFunc: THREE.AlwaysStencilFunc,
0118           stencilRef: 1,
0119         }),
0120         merge: true,
0121         outline: true
0122       }
0123     ]
0124   },
0125 
0126   // ============================================================
0127   // CENTRAL DETECTOR - PID (Greenish)
0128   // ============================================================
0129 
0130   // TOF components - teal green
0131   {
0132     names: ["EndcapTOFSubAssembly*", "BarrelTOFSubAssembly*"],
0133     rules: [
0134       {
0135         color: TEAL_200,  // Medium-light teal
0136         merge: true,
0137         outline: true
0138       }
0139     ]
0140   },
0141 
0142   // DIRC - Green with glass effect
0143   {
0144     name: "DIRC*",
0145     rules: [
0146       {
0147         patterns: ["**/*box*", "**/*prism*"],
0148         material: new THREE.MeshPhysicalMaterial({
0149           color: GREEN_200,  // Medium-light green
0150           metalness: 0.3,
0151           roughness: 0.2,
0152           envMapIntensity: 0.5,
0153           clearcoat: 0.8,
0154           transparent: true,
0155           opacity: 0.5,
0156           reflectivity: 0.2,
0157           ior: 0.9,
0158           side: THREE.DoubleSide,
0159         }),
0160         newName: "DIRC_barAndPrisms"
0161       },
0162       {
0163         patterns: ["**/*rail*"],
0164         newName: "DIRC_rails",
0165         color: SILVER  // Metal rails
0166       },
0167       {
0168         patterns: ["**/*mcp*"],
0169         newName: "DIRC_mcps",
0170         color: GREEN_100  // Light green
0171       }
0172     ]
0173   },
0174 
0175   // DRICH
0176   {
0177     name: "DRICH*",
0178     rules: [
0179       // Pattern-specific rules FIRST (order matters!)
0180       {
0181         patterns: ["**/DRICH_mirror*"],
0182         color: SILVER,  // Simple silver color for fast mode; prettifier handles reflections
0183         merge: true,
0184         outline: false,
0185         newName: "DRICH_mirror"
0186       },
0187       {
0188         patterns: ["**/DRICH*pdu*"],
0189         color: TEAL_200,
0190         merge: true,
0191         newName: "DRICH_pdu"
0192       },
0193       // "The rest" rule LAST - processes remaining unprocessed nodes
0194       {
0195         color: GREEN_100,  // Light green
0196         merge: false,
0197         outline: true
0198       }
0199     ]
0200   },
0201 
0202   // Modular RICH (Negative endcap)
0203   {
0204     name: "RICHEndcapN*",
0205     rules: [
0206       {
0207         color: GREEN_100,  // Medium-light teal
0208         merge: true,
0209         outline: true
0210       }
0211     ]
0212   },
0213 
0214   // ============================================================
0215   // CENTRAL DETECTOR - ECAL (Pink/Violetish)
0216   // ============================================================
0217   {
0218     name:"EcalBarrelScFi*",
0219     rules: [
0220       // {
0221       //   color: PURPLE_50,
0222       //   merge: true,
0223       //   outline: true
0224       // }
0225       {
0226         material: new THREE.MeshLambertMaterial({
0227           color: PURPLE_50,  // Metal support
0228           transparent: false,
0229           opacity: 1,
0230           side: THREE.DoubleSide,
0231           clipShadows: true,
0232           stencilWrite: true,
0233           stencilFunc: THREE.AlwaysStencilFunc,
0234           stencilRef: 1,
0235         }),
0236         merge: true,
0237         outline: true
0238       }
0239     ]
0240 
0241   },
0242 
0243   // Ecal Forward and Barrel
0244   {
0245     name: "EcalEndcapP*",
0246     rules: [
0247       {
0248         color: INDIGO_80,  // Very light pink
0249         merge: true,
0250         outline: true
0251       }
0252     ]
0253   },
0254   {
0255     name: "EcalEndcapPInsert*",
0256     rules: [
0257       {
0258         color: INDIGO_200,  // Very light pink
0259         merge: true,
0260         outline: true
0261       }
0262     ]
0263   },
0264 
0265   // Ecal Backward - slightly different pink/violet
0266   {
0267     name: "EcalEndcapN*",
0268     rules: [
0269       {
0270         patterns: ["**/crystal_vol_0"],
0271         color: INDIGO_80,  // Light purple for crystals
0272         outlineColor: GUNMETAL_BLUE,
0273         merge: true,
0274       },
0275       {
0276         patterns: ["**/inner_support*", "**/ring*"],
0277         material: new THREE.MeshStandardMaterial({
0278           color: SILVER,  // Metal support
0279           roughness: 0.5,
0280           metalness: 0.3,
0281           transparent: true,
0282           opacity: 0.5,
0283           side: THREE.DoubleSide
0284         })
0285       }
0286     ]
0287   },
0288 
0289   // ============================================================
0290   // CENTRAL DETECTOR - HCAL (Bluish)
0291   // ============================================================
0292   {
0293     names: ["LFHCAL*", "HcalEndcapPInsert*", "HcalBarrel*", "HcalEndcapN*"],
0294     rules: [
0295       {
0296         // color: BLUE_200,  // Medium-light blue
0297         material: new THREE.MeshPhongMaterial({
0298           color: BLUE_200,  // Metal support
0299           specular: 0x454545,
0300           shininess: 62,
0301           transparent: false,
0302           opacity: 1,
0303           side: THREE.DoubleSide,
0304           clipShadows: true,
0305           stencilWrite: true,
0306           stencilFunc: THREE.AlwaysStencilFunc,
0307           stencilRef: 1,
0308         }),
0309         merge: true,
0310         outline: true
0311       }
0312     ]
0313   },
0314 
0315   // ============================================================
0316   // CENTRAL DETECTOR - FLUX (Grey)
0317   // ============================================================
0318   {
0319     names: ["FluxBarrel*", "FluxEndcapP*", "FluxEndcapN*"],
0320     rules: [
0321       {
0322         //color: BLUE_50,  // Light-medium gray
0323         material: new THREE.MeshPhongMaterial({
0324           color: BLUE_50,  // Metal support
0325           specular: 0x454545,
0326           shininess: 62,
0327           transparent: false,
0328           depthWrite: true,
0329           depthTest: true,
0330           opacity: 1,
0331           side: THREE.DoubleSide,
0332           clipShadows: true,
0333           stencilWrite: true,
0334           stencilFunc: THREE.AlwaysStencilFunc,
0335           stencilRef: 1,
0336         }),
0337         merge: true,
0338         outline: true
0339       }
0340     ]
0341   },
0342 
0343   // ============================================================
0344   // CENTRAL DETECTOR - SUPPORT (Neutral metal/light)
0345   // ============================================================
0346 
0347   // Tracking supports - light metal
0348   {
0349     names: [
0350       "SVT_IB_Support_L2_assembly*",
0351       "SVT_IB_Support_L1_assembly*",
0352       "SVT_IB_Support_L0_L1_assembly*"
0353     ],
0354     rules: [
0355       {
0356         color: SILVER,  // Silver metal
0357         merge: true,
0358         outline: true
0359       }
0360     ]
0361   },
0362 
0363   // Inner tracker support - semi-transparent
0364   {
0365     name: "InnerTrackerSupport_assembly*",
0366     rules: [
0367       {
0368         material: new THREE.MeshStandardMaterial({
0369           color: TITANIUM,  // Chrome metallic
0370           roughness: 0.4,
0371           metalness: 0.2,
0372           transparent: true,
0373           opacity: 0.7,
0374           blending: THREE.NormalBlending,
0375           depthWrite: true,
0376           polygonOffset: true,
0377           polygonOffsetFactor: 1,
0378           side: THREE.DoubleSide
0379         }),
0380         outline: true,
0381         outlineColor: CHROME,
0382         merge: true,
0383         newName: "InnerTrackerSupport"
0384       }
0385     ]
0386   },
0387 
0388   // Central beam pipe
0389   {
0390     name: "BeamPipe_assembly*",
0391     rules: [
0392       {
0393         // Match v_upstream nodes - applyToDescendants (default true) includes all children
0394         patterns: ["**/v_upstream*"],
0395         color: BROWN_100,
0396         merge: false,
0397         outline: true
0398       },
0399       {
0400         // "The rest" - uses hierarchical skip, so v_upstream descendants are skipped
0401         color: BROWN_100,
0402         merge: false,
0403         outline: true
0404       }
0405     ]
0406   },
0407 
0408   // ============================================================
0409   // FORWARD DETECTOR
0410   // ============================================================
0411 
0412   // Electron beampipe (forward) - Saturated blue metallic
0413   {
0414     name: "Pipe_cen_to_pos_assembly*",
0415     rules: [
0416       {
0417         color: BROWN_100,
0418         merge: true,
0419         outline: true,
0420         outlineColor: BLUE_GRAY_400
0421       }
0422     ]
0423   },
0424 
0425   // B0 Window
0426   {
0427     name: "B0Window_vol_ExitWindow*",
0428     rules: [
0429       {
0430         color: BROWN_100,  // Light-medium blue-gray
0431         merge: true,
0432         outline: true
0433       }
0434     ]
0435   },
0436 
0437   // B0 Tracker - yellowish-orange (tracking)
0438   {
0439     name: "B0TrackerSubAssembly*",
0440     rules: [
0441       {
0442         color: ORANGE_100,  // Very light warm orange
0443         merge: true,
0444         outline: true
0445       }
0446     ]
0447   },
0448 
0449   // B0 ECal - pink/violetish (calorimeter)
0450   {
0451     name: "B0ECal*",
0452     rules: [
0453       {
0454         color: BLUE_300,  // Extremely light pink
0455         merge: true,
0456         outline: true
0457       }
0458     ]
0459   },
0460 
0461   // Forward magnets - neutral metal/greenish
0462   {
0463     names: [
0464       "B0PF_BeamlineMagnet_assembly*",
0465       "B0APF_BeamlineMagnet_assembly*",
0466       "Q0EF_BeamlineMagnet_assembly*",
0467       "Q1APF_BeamlineMagnet_assembly*",
0468       "Q1BPF_BeamlineMagnet_assembly*",
0469       "Q1EF_BeamlineMagnet_assembly*",
0470       "Q2PF_BeamlineMagnet_assembly*",
0471       "B1PF_BeamlineMagnet_assembly*",
0472       "B1APF_BeamlineMagnet_assembly*"
0473     ],
0474     rules: [
0475       {
0476         //color: BLUE_50,
0477         material: new THREE.MeshPhongMaterial({
0478           color: BLUE_50,  // Metal support
0479           specular: 0x454545,
0480           shininess: 62,
0481           transparent: false,
0482           depthWrite: true,
0483           depthTest: true,
0484           opacity: 1,
0485           side: THREE.DoubleSide,
0486           clipShadows: true,
0487           stencilWrite: true,
0488           stencilFunc: THREE.AlwaysStencilFunc,
0489           stencilRef: 1,
0490         }),
0491         merge: true,
0492         outline: true
0493       }
0494     ]
0495   },
0496 
0497   // Forward beampipe (hadron side)
0498   {
0499     name: "BeamPipeB0_assembly*",
0500     rules: [
0501       {
0502         color: BROWN_100,  // Very light gray
0503         merge: true,
0504         outline: true
0505       }
0506     ]
0507   },
0508 
0509   // Off-momentum trackers - yellowish-orange (tracking)
0510   {
0511     names: [
0512       "ForwardOffMTracker_station_1*",
0513       "ForwardOffMTracker_station_2*",
0514       "ForwardOffMTracker_station_3*",
0515       "ForwardOffMTracker_station_4*"
0516     ],
0517     rules: [
0518       {
0519         color: AMBER_500,  // Extremely light amber
0520         merge: true,
0521         outline: true
0522       }
0523     ]
0524   },
0525 
0526   // Roman pots - yellowish-orange (tracking)
0527   {
0528     names: ["ForwardRomanPot_Station_1*", "ForwardRomanPot_Station_2*"],
0529     rules: [
0530       {
0531         color: ORANGE_200,  // Very light warm orange
0532         merge: true,
0533         outline: true
0534       }
0535     ]
0536   },
0537 
0538   // ZDC Crystal - bluish (calorimeter)
0539   {
0540     name: "ZDC_Crystal_envelope*",
0541     rules: [
0542       {
0543         color: PURPLE_400,  // Medium-light cyan-blue
0544         merge: true,
0545         outline: true
0546       }
0547     ]
0548   },
0549 
0550   // ZDC HCal - bluish (HCAL)
0551   {
0552     name: "HcalFarForwardZDC_SiPMonTile*",
0553     rules: [
0554       {
0555         color: BLUE_200,  // Light blue with more saturation
0556         merge: true,
0557         outline: true
0558       }
0559     ]
0560   },
0561 
0562   // Vacuum magnet element
0563   {
0564     name: "VacuumMagnetElement_assembly*",
0565     rules: [
0566       {
0567         color: GRAY_300,  // Light-medium gray
0568         merge: true,
0569         outline: true
0570       }
0571     ]
0572   },
0573 
0574   // ============================================================
0575   // BACKWARD DETECTOR
0576   // ============================================================
0577 
0578   // Electron pipe (backward) - Saturated blue metallic
0579   {
0580     name: "Pipe_Q1eR_to_B2BeR_assembly*",
0581     rules: [
0582       {
0583         color: BROWN_100,
0584         merge: true,
0585         outline: true,
0586         outlineColor: BLUE_GRAY_400
0587       }
0588     ]
0589   },
0590 
0591   // Backward magnets - neutral metal/greenish
0592   {
0593     names: [
0594       "Q1ER_BeamlineMagnet_assembly*",
0595       "Q1APR_BeamlineMagnet_assembly*",
0596       "Q2ER_BeamlineMagnet_assembly*",
0597       "Q1BPR_BeamlineMagnet_assembly*",
0598       "Q2PR_BeamlineMagnet_assembly*",
0599       "Magnets_Q3eR_assembly*"
0600     ],
0601     rules: [
0602       {
0603         color: BLUE_50,  // Light green
0604         merge: true,
0605         outline: true
0606       }
0607     ]
0608   },
0609 
0610   // Tagger
0611   {
0612     names: ["BackwardsTaggerVacuum_assembly*", "BackwardsTaggerAssembly*"],
0613     rules: [
0614       {
0615         color: AMBER_50,  // Extremely light amber (tracking/tagging)
0616         merge: true,
0617         outline: true
0618       }
0619     ]
0620   },
0621 
0622   // Lumi components
0623   {
0624     name: "LumiWindow_vol_ExitWindow*",
0625     rules: [
0626       {
0627         color: GRAY_100,  // Very light gray
0628         merge: true,
0629         outline: true
0630       }
0631     ]
0632   },
0633 
0634   {
0635     name: "LumiCollimator_assembly*",
0636     rules: [
0637       {
0638         color: PEWTER,  // Metallic gray
0639         merge: true,
0640         outline: true
0641       }
0642     ]
0643   },
0644 
0645   {
0646     names: ["SweeperMag_assembly*", "AnalyzerMag_assembly*"],
0647     rules: [
0648       {
0649         color: GREEN_100,  // Light green (magnets)
0650         merge: true,
0651         outline: true
0652       }
0653     ]
0654   },
0655 
0656   {
0657     name: "LumiSpecTracker*",
0658     rules: [
0659       {
0660         color: YELLOW_100,  // Very light yellow (tracking)
0661         merge: true,
0662         outline: true
0663       }
0664     ]
0665   },
0666 
0667   {
0668     name: "LumiPhotonChamber*",
0669     rules: [
0670       {
0671         color: GRAY_300,  // Light-medium gray
0672         merge: true,
0673         outline: true
0674       }
0675     ]
0676   },
0677 
0678   {
0679     name: "LumiDirectPCAL*",
0680     rules: [
0681       {
0682         color: PINK_50,  // Extremely light pink (calorimeter)
0683         merge: true,
0684         outline: true
0685       }
0686     ]
0687   },
0688 
0689   // ============================================================
0690   // DEFAULT RULE
0691   // ============================================================
0692   {
0693     name: "*",
0694     rules: [
0695       {
0696         color: GRAY_100,  // Very light gray default
0697         merge: true,
0698         outline: true
0699       }
0700     ]
0701   }
0702 ];