3 # Build a description of the detectors from gdml fragments
7 # List all the files that need to be glomed together
11 @defFile = qw(global-defs.gdml dune/dune-defs.gdml);
12 @gdmlFile = qw(dune/dune-rotations.gdml
14 dune/dune-vertplane.gdml
17 dune/dune-cryostat.gdml
18 dune/dune-enclosure.gdml
24 # Build the table of variable replacements
28 for ($ifile=0; $ifile<@defFile; ++$ifile) {
30 $DEFINES = @defFile[$ifile];
31 open(DEFINES) or die("Could not open file $DEFINES");
32 foreach $line (<DEFINES>) {
34 ($key,$name,$value) = split(' ',$line);
35 if ($key eq "<constant") {
38 ($tmp,$name) = split('=',$name);
39 ($tmp,$value) = split('=',$value);
40 ($tmp,$name, $tmp) = split('"',$name);
41 ($tmp,$value,$tmp) = split('"',$value);
43 @defNAME[$ikey] = $name;
44 @defVALUE[$ikey] = "($value)";
45 print @defName[$ikey];
53 # Open each file in turn, read line-by-line making variable
54 # substitutions, and write to standard output
57 print "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
58 print "<gdml xmlns:gdml=\"http://cern.ch/2001/Schemas/GDML\"\n";
59 print " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
60 print " xsi:noNamespaceSchemaLocation=\"GDMLSchema/gdml.xsd\">\n";
61 for ($i=0; $i<@gdmlFile; ++$i)
63 $FILE = @gdmlFile[$i];
64 open(FILE) or die("Could not open file @gdmlFile[$i] for read.");
65 foreach $line (<FILE>) {
67 # Work backwards to keep dependency order correct
69 for ($j=@defNAME-1; $j>=0; --$j) {
70 $line =~ s/@defNAME[$j]/@defVALUE[$j]/g;
76 print "\n<setup name=\"Default\" version=\"1.0\">\n";
77 print " <world ref=\"volWorld\" />\n";