View Javadoc

1   package org.lcsim.detector;
2   
3   import hep.physics.vec.Hep3Vector;
4   
5   /**
6    * Implementation of @see IPhysicalVolume.
7    * 
8    * @author Jeremy McCormick <jeremym@slac.stanford.edu>
9    */
10  public class PhysicalVolume implements IPhysicalVolume
11  {
12  	ITransform3D transform;
13  	ILogicalVolume logicalVolume;
14  	ILogicalVolume motherLogicalVolume;
15  	int copyNum;
16  	boolean sensitive=false;
17  	String name;
18      
19  	public PhysicalVolume(
20  			ITransform3D transform,
21  			String name,
22  			ILogicalVolume logicalVolume,
23  			ILogicalVolume motherLogicalVolume,
24  			int copyNum)
25  	{
26  		this.name = name;
27  		
28  		if (transform != null)
29  		{
30  			this.transform = transform;
31  		}
32  		else {
33  			this.transform = new Transform3D();
34  		}
35  		
36  		this.logicalVolume = logicalVolume;
37  		this.motherLogicalVolume = motherLogicalVolume;		
38  		this.copyNum = copyNum;
39  		
40  		// Add to mother.
41  		if ( motherLogicalVolume != null )
42  		{
43  			motherLogicalVolume.addDaughter(this);
44  		}
45  		
46  		// Add to store.
47  		PhysicalVolumeStore.getInstance().add(this);
48  	}			
49  	
50  	public String getName()
51  	{
52  		return name;
53  	}
54  	
55  	public IRotation3D getRotation()
56  	{
57  		return transform.getRotation();
58  	}
59  	
60  	public int getCopyNumber()
61  	{
62  		return copyNum;
63  	}
64  	
65  	public ILogicalVolume getMotherLogicalVolume()
66  	{
67  		return motherLogicalVolume;
68  	}	
69  	
70  	public ILogicalVolume getLogicalVolume()
71  	{
72  		return logicalVolume;
73  	}
74  	
75  	public ITransform3D getTransform()
76  	{
77  		return transform;
78  	}
79  	
80  	public Hep3Vector getTranslation()
81  	{
82  		return transform.getTranslation();
83  	}
84  	
85  	public Hep3Vector transformParentToLocal(Hep3Vector point)
86  	{
87  		return getTransform().transformed(point);
88  	}
89      
90      public void setSensitive(boolean sensitive)
91      {
92          this.sensitive = sensitive;
93      }
94      
95      public boolean isSensitive()
96      {
97          return this.sensitive;
98      }
99  }