1
2
3
4
5
6 package org.lcsim.geometry.subdetector;
7
8 import hep.graphics.heprep.HepRep;
9 import hep.graphics.heprep.HepRepFactory;
10 import hep.graphics.heprep.HepRepInstance;
11 import hep.graphics.heprep.HepRepInstanceTree;
12 import hep.graphics.heprep.HepRepType;
13 import hep.graphics.heprep.HepRepTypeTree;
14
15 import org.jdom.Element;
16 import org.jdom.JDOMException;
17
18
19
20
21
22 public class TPC extends AbstractCylindricalTracker
23 {
24
25 public TPC( Element node ) throws JDOMException
26 {
27 super( node );
28 }
29
30 public boolean isBarrel()
31 {
32 return true;
33 }
34
35 public void appendHepRep( HepRepFactory factory, HepRep heprep )
36 {
37 HepRepInstanceTree instanceTree = heprep.getInstanceTreeTop( "Detector", "1.0" );
38 HepRepTypeTree typeTree = heprep.getTypeTree( "DetectorType", "1.0" );
39 HepRepType barrel = typeTree.getType( "Barrel" );
40
41 HepRepType type = factory.createHepRepType( barrel, getName() );
42
43 type.addAttValue( "drawAs", "Cylinder" );
44 type.addAttValue( "color", getVisAttributes().getColor() );
45
46 HepRepInstance instance = factory.createHepRepInstance( instanceTree, type );
47 instance.addAttValue( "radius", getInnerRadius() );
48 factory.createHepRepPoint( instance, 0, 0, getZMin() );
49 factory.createHepRepPoint( instance, 0, 0, getZMax() );
50
51 HepRepInstance instance2 = factory.createHepRepInstance( instanceTree, type );
52 instance2.addAttValue( "radius", getOuterRadius() );
53 factory.createHepRepPoint( instance2, 0, 0, getZMin() );
54 factory.createHepRepPoint( instance2, 0, 0, getZMax() );
55 }
56 }