1 package org.lcsim.detector; 2 3 import org.lcsim.detector.identifier.IIdentifier; 4 import org.lcsim.detector.material.IMaterial; 5 import org.lcsim.detector.material.MaterialElement; 6 import org.lcsim.detector.material.MaterialMixture; 7 import org.lcsim.detector.material.IMaterial.State; 8 import org.lcsim.detector.solids.Box; 9 import org.lcsim.detector.solids.ISolid; 10 import org.lcsim.detector.solids.Tube; 11 12 public class DetectorFactory 13 implements IDetectorFactory 14 { 15 private static DetectorFactory factory = null; 16 17 public static DetectorFactory getInstance() 18 { 19 if (factory == null) 20 factory = new DetectorFactory(); 21 return factory; 22 } 23 24 public Box createBox(String name, double xHalfLength, double yHalfLength, 25 double zHalfLength) 26 { 27 return new Box( 28 name, 29 xHalfLength, 30 yHalfLength, 31 zHalfLength); 32 } 33 34 public ITransform3D createTransform3D() 35 { 36 return new Transform3D(); 37 } 38 39 public IDetectorElement createDetectorElement( 40 String name, 41 IDetectorElement parent, 42 IPhysicalVolumePath support, 43 IIdentifier id) { 44 return new DetectorElement( 45 name, 46 parent, 47 support, 48 id); 49 } 50 51 public ILogicalVolume createLogicalVolume( 52 String name, 53 ISolid solid, 54 IMaterial material) 55 { 56 return new LogicalVolume(name, solid, material); 57 } 58 59 public IMaterial createMaterialElement( 60 String name, 61 double Z, 62 double A, 63 double density, 64 State state, 65 double temperature, 66 double pressure) 67 { 68 return new MaterialElement( 69 name, 70 Z, 71 A, 72 density, 73 state, 74 temperature, 75 pressure); 76 } 77 78 public IMaterial createMaterialMixture( 79 String name, 80 int nComponents, 81 double density, 82 State state) 83 { 84 return new MaterialMixture( 85 name, 86 nComponents, 87 density, 88 state); 89 } 90 91 public IPhysicalVolume createPhysicalVolume( 92 ITransform3D transform, 93 String name, 94 ILogicalVolume logicalVolume, 95 ILogicalVolume motherLogicalVolume, 96 int copyNum) 97 { 98 return new PhysicalVolume( 99 transform, 100 name, 101 logicalVolume, 102 motherLogicalVolume, 103 copyNum); 104 } 105 106 public IPhysicalVolumeNavigator createPhysicalVolumeNavigator( 107 String name, 108 IPhysicalVolume worldVolume) 109 { 110 return new PhysicalVolumeNavigator(name, worldVolume); 111 } 112 113 public IPhysicalVolumeNavigator createPhysicalVolumeNavigator(IPhysicalVolume world) 114 { 115 return PhysicalVolumeNavigatorStore.getInstance().get(world); 116 } 117 118 public IRotation3D createRotation3D() 119 { 120 return new Rotation3D(); 121 } 122 123 public Tube createTube( 124 String name, 125 double innerRadius, 126 double outerRadius, 127 double zHalfLength) 128 { 129 return new Tube( 130 name, 131 innerRadius, 132 outerRadius, 133 zHalfLength); 134 } 135 136 public IReadout createReadout() 137 { 138 return new Readout(); 139 } 140 }