View Javadoc

1   package org.lcsim.geometry.subdetector;
2   
3   import hep.graphics.heprep.HepRep;
4   import hep.graphics.heprep.HepRepFactory;
5   import hep.graphics.heprep.HepRepInstance;
6   import hep.graphics.heprep.HepRepInstanceTree;
7   import hep.graphics.heprep.HepRepType;
8   import hep.graphics.heprep.HepRepTypeTree;
9   
10  import org.jdom.Element;
11  import org.jdom.JDOMException;
12  import org.lcsim.detector.converter.heprep.DetectorElementToHepRepConverter;
13  
14  /**
15   * 
16   * @author Tony Johnson
17   */
18  public class CylindricalBarrelCalorimeter extends CylindricalCalorimeter
19  {
20      public CylindricalBarrelCalorimeter( Element node ) throws JDOMException
21      {
22          super( node );
23          build( node );
24      }
25  
26      public boolean isBarrel()
27      {
28          return true;
29      }
30  
31      private void build( Element node ) throws JDOMException
32      {
33          Element dimensions = node.getChild( "dimensions" );
34  
35          outerR = innerR + getLayering().getThickness();
36          maxZ = dimensions.getAttribute( "outer_z" ).getDoubleValue();
37          minZ = -maxZ;
38          zlength = maxZ * 2;
39  
40          getLayering().setOffset( innerR );
41      }
42  
43      public void appendHepRep( HepRepFactory factory, HepRep heprep )
44      {
45          DetectorElementToHepRepConverter.convert( getDetectorElement(), factory, heprep, 1, false, getVisAttributes().getColor() );
46          /*
47          HepRepInstanceTree instanceTree = heprep.getInstanceTreeTop( "Detector", "1.0" );
48          HepRepTypeTree typeTree = heprep.getTypeTree( "DetectorType", "1.0" );
49          HepRepType barrel = typeTree.getType( "Barrel" );
50  
51          HepRepType type = factory.createHepRepType( barrel, getName() );
52          type.addAttValue( "drawAs", "Cylinder" );
53          //type.addAttValue( "color", getVisAttributes().getColor() );
54  
55          setHepRepColor( type );
56  
57          HepRepInstance instance = factory.createHepRepInstance( instanceTree, type );
58          instance.addAttValue( "radius", getInnerRadius() );
59          factory.createHepRepPoint( instance, 0, 0, getZMin() );
60          factory.createHepRepPoint( instance, 0, 0, getZMax() );
61  
62          HepRepInstance instance2 = factory.createHepRepInstance( instanceTree, type );
63          instance2.addAttValue( "radius", getOuterRadius() );
64          factory.createHepRepPoint( instance2, 0, 0, getZMin() );
65          factory.createHepRepPoint( instance2, 0, 0, getZMax() );
66          */
67      }
68  
69      public double getZLength()
70      {
71          return this.maxZ * 2;
72      }
73  }