-
Notifications
You must be signed in to change notification settings - Fork 2
Adding Color to volumes in GDML
Volumes do not have to be a generic white, they can have color!
The color is specified in the GDML itself, where the volumes are defined. However, the limitation (a geant4 limitation) is that colors can only be specified to logical volumes, and not to the physical volumes. This means that if multiple physical volumes are placed that use the same logical volume as reference, they will all have the same color! Though, I tend to think that's a good thing, as the color should really highlight the type of volume it is, and not a particular position.
In GDML, the color is added to the logical volume definition itself by adding the following line:
<auxiliary auxtype="Color" auxvalue="#RRGGBBAA" />
where the letter pairs RR, GG, BB and AA correspond to a two letter hex code (00-FF) corresponding to Red, Green, Blue and Alpha values, respectively. Ex: #AA000077 will color the volume red with about 50% opacity (~50% translucent).
Remember, this goes inside a logical volume definition only. For example:
<volume name="ComptonPMTGlassLogical" >
<materialref ref="Silica" />
<solidref ref="ComptonPMTGlassSolid" />
<auxiliary auxtype="Color" auxvalue="#ABABAB22" />
</volume>