Commit in projects/lcsim/trunk/detector-framework/src on MAIN
main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java+311-603102 -> 3103
test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml+13102 -> 3103
+312-60
2 modified files
Work in progress. Added base and base plate. Added proper peek pedestals and pockets in support plate. Still need to fix problem with 'inverted' halfmodules

projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd
HPSTestRunTracker2014.java 3102 -> 3103
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java	2014-04-22 05:15:50 UTC (rev 3102)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014.java	2014-04-24 01:34:56 UTC (rev 3103)
@@ -41,12 +41,11 @@
 	private boolean _debug = true; 
 	public static final double inch = 25.4;
 	
-	private final double sensor_length= 98.33;
-	private final double sensor_width = 38.3399;
+	private final double sensor_length= 100.00; //98.33;
+	private final double sensor_width = 40.34; //38.3399;
 	private final double sensor_thickness = 0.32;
 	private final double hybrid_length = 170.0 - sensor_length; // sensor b-to-b with hybrid
 	private final double hybrid_width  = sensor_width;
-	private final double hybrid_width_L46  = 45.34;
 	private final double hybrid_thickness = 4.0/64.0*inch;
 	//TODO Check these numbers
 	private final double cf_length = 200.;
@@ -59,43 +58,77 @@
 	private final double support_plate_bottom_height = 12.7; //1/2"
 	private final double support_plate_bottom_length = 736.1;
 	private final double support_plate_bottom_width = 120.0;
+	private final double pedestal_height_L1 = 11.00;
+	private final double pedestal_height_L2 = 9.50;
+	private final double pedestal_height_L3 = 8.00;
+	private final double pedestal_height_L4 = 10.00;
+	private final double pedestal_height_L5 = 7.00;
+	private final double support_plate_pocket_depth = 6.00;
 
+	private final double module_box_L13_length = 205.2; // includes lexan spacer and cold block
+	private final double module_box_L13_height = 12.5; // includes screws height
+	private final double module_box_L13_width = 71.3 - 13.0; // height from cold block to encapsulate the whole module
+	private final double module_box_L45_length = 205.2; // includes lexan spacer and cold block
+	private final double module_box_L45_height = 12.5; // includes screws height
+	private final double module_box_L45_width = 65.3-12.0; 
 	
-	private final double module_L13_width = 71.3 - 13.0; // height from cold block to encapsulate the whole module
-	private final double module_L45_width = 65.3-12.0; 
-	final double module_box_L13_length = 205.2; // includes lexan spacer and cold block
-	final double module_box_L13_height = 12.5; // includes screws height
-	final double module_box_L13_width = module_L13_width;
-	
 	private final double half_module_thickness = this.hybrid_thickness + this.cf_thickness + this.kapton_thickness;
 	private final double half_module_length = this.cf_length;
 	private final double half_module_width = 6.83 + this.sensor_width;
 	
-	private final double coldblock_length = 82.00;
-	private final double coldblock_width = 52.50;
-	private final double coldblock_thickness = 6.00;
+	private final double coldblock_L13_length = 82.00;
+	private final double coldblock_L13_width = 52.50;
+	private final double coldblock_L13_thickness = 6.00;
+	private final double coldblock_L45_length = 82.00;
+	private final double coldblock_L45_width = 51.00;
+	private final double coldblock_L45_thickness = 6.00;
+
+	private final double support_bottom_length = this.support_plate_bottom_length;
+	private final double support_bottom_width = (25.0-5.0) + this.module_box_L13_length;
+	private final double support_bottom_height = this.support_plate_bottom_height - this.support_plate_pocket_depth + this.module_box_L13_width + this.pedestal_height_L1;
+	private final double support_top_length = support_bottom_length;
+	private final double support_top_width = support_bottom_width;
+	private final double support_top_height = support_bottom_height;
 	
-	private final Hep3Vector ball_pos_module1_support_plate_local = new BasicHep3Vector(25.0, 661.0, 0.0);
-	private final Hep3Vector vee_pos_module1_support_plate_local = new BasicHep3Vector(95.0, 661.0, 0.0);
-	private final Hep3Vector flat_pos_module1_support_plate_local = new BasicHep3Vector(60.0, 667.10, 0.0);
+	
+	
+	
+	// survey positions for each module is the pockets:
+	// ball: hole
+	// vee:  slot
+	// flat: middle of pocket defining local w out of the pocket vertically
+	
+	private final Hep3Vector ball_pos_module1_support_plate_local = new BasicHep3Vector(25.0, 661.0, pedestal_height_L1-support_plate_pocket_depth);
+	private final Hep3Vector vee_pos_module1_support_plate_local = new BasicHep3Vector(95.0, 661.0, pedestal_height_L1-support_plate_pocket_depth);
+	private final Hep3Vector flat_pos_module1_support_plate_local = new BasicHep3Vector(60.0, 667.10, pedestal_height_L1-support_plate_pocket_depth);
 
-	private final Hep3Vector ball_pos_module2_support_plate_local = new BasicHep3Vector(25.0, 561.0, 0.0);
-	private final Hep3Vector vee_pos_module2_support_plate_local = new BasicHep3Vector(95.0, 561.0, 0.0);
-	private final Hep3Vector flat_pos_module2_support_plate_local = new BasicHep3Vector(60.0, 567.10, 0.0);
+	private final Hep3Vector ball_pos_module2_support_plate_local = new BasicHep3Vector(25.0, 561.0, pedestal_height_L2-support_plate_pocket_depth);
+	private final Hep3Vector vee_pos_module2_support_plate_local = new BasicHep3Vector(95.0, 561.0, pedestal_height_L2-support_plate_pocket_depth);
+	private final Hep3Vector flat_pos_module2_support_plate_local = new BasicHep3Vector(60.0, 567.10, pedestal_height_L2-support_plate_pocket_depth);
 
-	private final Hep3Vector ball_pos_module3_support_plate_local = new BasicHep3Vector(25.0, 461.0, 0.0);
-	private final Hep3Vector vee_pos_module3_support_plate_local = new BasicHep3Vector(95.0, 461.0, 0.0);
-	private final Hep3Vector flat_pos_module3_support_plate_local = new BasicHep3Vector(60.0, 467.10, 0.0);
+	private final Hep3Vector ball_pos_module3_support_plate_local = new BasicHep3Vector(25.0, 461.0, pedestal_height_L3-support_plate_pocket_depth);
+	private final Hep3Vector vee_pos_module3_support_plate_local = new BasicHep3Vector(95.0, 461.0, pedestal_height_L3-support_plate_pocket_depth);
+	private final Hep3Vector flat_pos_module3_support_plate_local = new BasicHep3Vector(60.0, 467.10, pedestal_height_L3-support_plate_pocket_depth);
 
-	private final Hep3Vector ball_pos_module4_support_plate_local = new BasicHep3Vector(25.0, 261.0, 0.0);
-	private final Hep3Vector vee_pos_module4_support_plate_local = new BasicHep3Vector(95.0, 261.0, 0.0);
-	private final Hep3Vector flat_pos_module4_support_plate_local = new BasicHep3Vector(60.0, 267.10, 0.0);
+	private final Hep3Vector ball_pos_module4_support_plate_local = new BasicHep3Vector(25.0, 261.0, pedestal_height_L4-support_plate_pocket_depth);
+	private final Hep3Vector vee_pos_module4_support_plate_local = new BasicHep3Vector(95.0, 261.0, pedestal_height_L4-support_plate_pocket_depth);
+	private final Hep3Vector flat_pos_module4_support_plate_local = new BasicHep3Vector(60.0, 267.10, pedestal_height_L4-support_plate_pocket_depth);
 
-	private final Hep3Vector ball_pos_module5_support_plate_local = new BasicHep3Vector(25.0, 61.0, 0.0);
-	private final Hep3Vector vee_pos_module5_support_plate_local = new BasicHep3Vector(95.0, 61.0, 0.0);
-	private final Hep3Vector flat_pos_module5_support_plate_local = new BasicHep3Vector(60.0, 67.10, 0.0);
+	private final Hep3Vector ball_pos_module5_support_plate_local = new BasicHep3Vector(25.0, 61.0, pedestal_height_L5-support_plate_pocket_depth);
+	private final Hep3Vector vee_pos_module5_support_plate_local = new BasicHep3Vector(95.0, 61.0, pedestal_height_L5-support_plate_pocket_depth);
+	private final Hep3Vector flat_pos_module5_support_plate_local = new BasicHep3Vector(60.0, 67.10, pedestal_height_L5-support_plate_pocket_depth);
+	
+	
+	private final double base_plate_thickness = 0.25*inch;
+	private final double base_plate_width = 385.00;
+	private final double base_plate_length = 1216.00;
+	private final double PS_vac_box_inner_height = 7.0*inch;
+	private final double PS_vac_box_plate_thickness = 0.75*inch;
+	private final double base_height = PS_vac_box_inner_height - PS_vac_box_plate_thickness; 
+	private final double base_width = base_plate_width;
+	private final double base_length = base_plate_length;
+	
 
-
 	
 
 	
@@ -150,10 +183,17 @@
 		trackingWrap.name = "trackingVolume";
 		trackingWrap.vol = trackingVolume;
 	
-		// create the box around the support plate: "support box"
-		makeSupport(trackingWrap, lcdd, sens );
+		// Surveyed position of the base plate in the JLab/tracking volume
+		Hep3Vector ball_pos_base_plate = new BasicHep3Vector(-1*this.base_plate_width/2.0, -1.0*this.base_height/2.0+this.base_plate_thickness,this.base_length/2.0);
+		Hep3Vector vee_pos_base_plate = new BasicHep3Vector(ball_pos_base_plate.x()+this.base_plate_width,ball_pos_base_plate.y(),ball_pos_base_plate.z());
+		Hep3Vector flat_pos_base_plate = new BasicHep3Vector(ball_pos_base_plate.x(),ball_pos_base_plate.y(),ball_pos_base_plate.z()-this.base_plate_length);
 		
 		
+		makeBase(trackingWrap, ball_pos_base_plate, vee_pos_base_plate, flat_pos_base_plate, lcdd, sens );
+				
+		
+		
+		
 	
 		
 		
@@ -163,18 +203,101 @@
 	
 	
 	
-	private void makeSupport(VolWrapper trackingWrap, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+	private void makeBase(VolWrapper trackingWrap,
+				Hep3Vector ball_pos_base_plate, Hep3Vector vee_pos_base_plate,
+				Hep3Vector flat_pos_base_plate, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
 		
 		
+		if(_debug) {
+			print("--- makeBase ----");
+			
+		}
 		
+		String volName = "base";
+		Box box = new Box(volName + "Box", this.base_width, this.base_height , this.base_length);
+		lcdd.add(box);
+		Volume baseVolume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
+
 		
-		final double support_length = this.support_plate_bottom_length;
-		final double support_width = (25.0-5.0) + this.module_box_L13_length;  
-		// height to encapsulate all the modules; a little arbitrary here, TODO fix this 
-		final double support_height = this.support_plate_bottom_height + module_L45_width;
+		// create the coordinate system of the base plate
+		CoordSysDef base_plate_coord = new CoordSysDef(ball_pos_base_plate, vee_pos_base_plate, flat_pos_base_plate);		
+		Transform3D trans_base_plate_to_base = getTransformation(base_plate_coord);
+
 		
+		// Find distance to center in the local coordinate system 
+		Hep3Vector box_center_base_local = new BasicHep3Vector(base_width/2.0, base_length/2.0, base_height/2.0 - this.base_plate_thickness);
+		Hep3Vector box_center_base = trans_base_plate_to_base.transformed(box_center_base_local);
+				
+		print(String.format("box_center_base_local  %s", box_center_base_local.toString()));
+		print(String.format("box_center_base        %s", box_center_base.toString()));
+
+
+		Position pos = new Position(volName + "_position",box_center_base.x(), box_center_base.y(), box_center_base.z());
+		//Find LCDD rotation angles from coordinate system unit vectors
+		Hep3Vector lcdd_rot_angles = new BasicHep3Vector(0,0,0); //getLCDDRotation(support_plate_coord);
+		Rotation rot = new Rotation(volName + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z());
+		lcdd.add(pos);
+		lcdd.add(rot);
 		
-		String volName = "support";
+		PhysVol basePV = new PhysVol(baseVolume, trackingWrap.vol, pos, rot);
+		
+		VolWrapper baseWrap = new VolWrapper();
+		baseWrap.vol = baseVolume;
+		baseWrap.name = volName;
+		baseWrap.pos_vol = pos;
+		baseWrap.rot_vol = rot;
+		
+		
+		
+		
+		
+		// create the base plate inside the support box 
+		makeBasePlate(baseWrap, ball_pos_base_plate, vee_pos_base_plate, flat_pos_base_plate, lcdd, sens );
+		
+	
+		
+		// create the box around the support plate w.r.t. base plate 
+		makeSupport("bottom",baseWrap, lcdd, sens );
+				
+		
+		
+		//baseVolume.setVisAttributes(lcdd.getVisAttributes("BaseVis"));
+		
+		lcdd.add(baseVolume);
+		
+
+
+	}
+
+	
+	
+	
+	private void makeSupport(String name, VolWrapper baseWrap, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+		
+
+		double support_length = -99999.9;
+		double support_width = -99999.9;
+		double support_height = -99999.9;
+		
+		if( name == "bottom" ) {
+			
+			support_length = support_bottom_length;
+			support_width = support_bottom_width;
+			support_height = support_bottom_height;
+		}
+		else if( name == "top" ) {
+				support_length = support_top_length;
+				support_width = support_top_width;
+				support_height = support_top_height;
+				
+		} else {
+			print("Error: cannot make support for " + name);
+			System.exit(1);
+		}
+		
+		
+		
+		String volName = "support_" + name;
 		Box box = new Box(volName + "Box", support_width, support_height , support_length);
 		lcdd.add(box);
 		Volume supportVolume = new Volume(volName + "_volume", box, lcdd.getMaterial("Vacuum"));
@@ -184,15 +307,16 @@
 		lcdd.add(pos);
 		lcdd.add(rot);
 		
-		PhysVol supportPV = new PhysVol(supportVolume, trackingWrap.vol, pos, rot);
+		PhysVol supportPV = new PhysVol(supportVolume, baseWrap.vol, pos, rot);
 		
 		VolWrapper supportWrap = new VolWrapper();
 		supportWrap.vol = supportVolume;
 		supportWrap.name = volName;
 		supportWrap.pos_vol = pos;
 		supportWrap.rot_vol = rot;
+		supportWrap.mother = baseWrap;
+		baseWrap.daughters.add(supportWrap);
 		
-		
 
 		
 		
@@ -400,7 +524,78 @@
 		
 	}
 
+	
+	
 
+	private void makeBasePlate(VolWrapper baseWrap,
+			Hep3Vector ball_pos_base_plate,
+			Hep3Vector vee_pos_base_plate,
+			Hep3Vector flat_pos_base_plate, LCDD lcdd, SensitiveDetector sens) throws JDOMException {
+
+		if(_debug) {
+			print("--- makeBasePlate----");
+		}
+		// create the coordinate system
+		CoordSysDef base_plate_coord = new CoordSysDef(ball_pos_base_plate, vee_pos_base_plate, flat_pos_base_plate);
+		Transform3D trans_base_plate_to_base = getTransformation(base_plate_coord);
+
+		
+		if(_debug) {
+			print(String.format("ball_pos_base_plate %s", ball_pos_base_plate.toString()));
+			print(String.format("vee_pos_base_plate %s", vee_pos_base_plate.toString()));
+			print(String.format("flat_pos_base_plate %s", flat_pos_base_plate.toString()));
+			print(String.format("support_plate:\n%s", base_plate_coord.toString()));
+		}
+		
+		
+		Hep3Vector box_dim_local = new BasicHep3Vector(base_plate_width,base_plate_length,this.base_plate_thickness);
+		Hep3Vector box_dim = trans_base_plate_to_base.rotated(box_dim_local);
+		
+		if(_debug) {
+			print(String.format("box_dim_local %s", box_dim_local.toString()));
+			print(String.format("box_dim %s", box_dim.toString()));
+		}
+		
+		String volName = "baseplate";
+		Box box = new Box(volName + "Box", box_dim.x(), box_dim.y(), box_dim.z());
+		lcdd.add(box);
+		Volume basePlateVolume = new Volume(volName + "_volume", box, lcdd.getMaterial("Aluminum"));
+		
+		
+		// Find distance to center in the local coordinate system 
+		Hep3Vector box_center_base_plate_local = new BasicHep3Vector(base_plate_width/2.0, base_plate_length/2.0, -1.0 * base_plate_thickness/2.0);
+		Hep3Vector box_center_base_plate = trans_base_plate_to_base.transformed(box_center_base_plate_local);
+		
+		print(String.format("box_center_base_plate_local  %s", box_center_base_plate_local.toString()));
+		print(String.format("box_center_base_plate        %s", box_center_base_plate.toString()));
+		
+		
+		Position pos = new Position(volName + "_position",box_center_base_plate.x(), box_center_base_plate.y(), box_center_base_plate.z());
+		Hep3Vector lcdd_rot_angles = new BasicHep3Vector(0,0,0); //getLCDDRotation(support_plate_coord);
+		Rotation rot = new Rotation(volName + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z());
+		lcdd.add(pos);
+		lcdd.add(rot);
+		PhysVol basePlatePV = new PhysVol(basePlateVolume, baseWrap.vol, pos, rot);
+		// add volume to lcdd
+		
+		basePlateVolume.setVisAttributes(lcdd.getVisAttributes("basePlateVis"));
+		
+		lcdd.add(basePlateVolume);
+		
+		VolWrapper basePlateWrap = new VolWrapper();
+		basePlateWrap.mother = baseWrap;
+		basePlateWrap.vol = basePlateVolume;
+		basePlateWrap.name = volName;
+		basePlateWrap.pos_vol = pos;
+		basePlateWrap.rot_vol = rot;		
+		baseWrap.daughters.add(basePlateWrap);
+		
+		
+		
+	}
+
+	
+
 	private void makeModule(String name, VolWrapper supportWrap, Hep3Vector ball_pos_mod, Hep3Vector vee_pos_mod, Hep3Vector flat_pos_mod, LCDD lcdd, SensitiveDetector sens) throws JDOMException 
     {
 
@@ -415,14 +610,33 @@
 			print(String.format("module_coord trans:\n%s", trans.toString()));
 		}
 		
+		String moduleName = "module_" + name;
 		
+		int layer = this.getLayerFromVolumeName(moduleName);
 		
-		String moduleName = "module_" + name;
-		// Find the bounding box for the module
-		//TODO find dimensions of this module box from Shawn
-		// Right now the box starts from the ball position and approximately encapsulates the two half-modules on the drawing
+		double coldblock_thickness = -99999.9;
+		double dist_lower_sensor_edge_to_cold_block_mounting_surface = -99999.9;
+		double module_box_length = -99999.9;
+		double module_box_height = -99999.9;
+		double module_box_width = -99999.9;
+		Hep3Vector box_dim_local;
+		if( layer >=1 && layer <=3 ) {
+			module_box_length = this.module_box_L13_length;
+			module_box_height = this.module_box_L13_height;
+			module_box_width = this.module_box_L13_width;
+			coldblock_thickness = this.coldblock_L13_thickness;
+			dist_lower_sensor_edge_to_cold_block_mounting_surface = 12.66;
+			
+		} else {
+			module_box_length = this.module_box_L45_length;
+			module_box_height = this.module_box_L45_height;
+			module_box_width = this.module_box_L45_width;
+			coldblock_thickness = this.coldblock_L45_thickness;
+			dist_lower_sensor_edge_to_cold_block_mounting_surface = 7.662;
+		}
+
+		box_dim_local = new BasicHep3Vector(module_box_length,module_box_height,module_box_width);
 		
-		Hep3Vector box_dim_local = new BasicHep3Vector(module_box_L13_length,module_box_L13_height,module_box_L13_width);
 		Hep3Vector box_dim = trans.rotated(box_dim_local);
 		if(_debug) {
 			print(String.format("box_dim_local: %s", box_dim_local.toString()));
@@ -446,13 +660,9 @@
 		//Hep3Vector box_center_local = new BasicHep3Vector(0.0, 0.0,0.0);
 		moduleWrap.center = box_center_local;
 				
-		// Find the LCDD position and rotation of this module
 		// vector to the center of module box from ball position/origin
 		Hep3Vector box_center = trans.transformed(box_center_local);
-		//Position pos = new Position(volName + "_position",box_center.x(), box_center.y(), box_center.z());
 		Position pos = new Position(moduleName + "_position",box_center.x(), box_center.y(), box_center.z());
-		//Find LCDD rotation angles from coordinate system unit vectors
-		//Hep3Vector lcdd_rot_angles = new BasicHep3Vector(	Math.PI/2.0,0,0); //getLCDDRotation(survey_coord);
 		Hep3Vector lcdd_rot_angles = new BasicHep3Vector(0,0,0); //getLCDDRotation(survey_coord);
 		Rotation rot = new Rotation(moduleName + "_rotation",lcdd_rot_angles.x(), lcdd_rot_angles.y(), lcdd_rot_angles.z());
 		lcdd.add(pos);
@@ -475,9 +685,14 @@
 		// is really just a dummy volume to contain the daughters. Therefore place it at the same place 
 		// as where the sensor coordinate system will be to make things simpler.
 		
-		final double ball_pos_halfmod_axial_local_x =  (180.0 - 30.0 + (33.73 - 5.0)) - sensor_length/2.0; 
-		final double ball_pos_halfmod_axial_local_y =  -1.0* (this.coldblock_thickness/2.0 + this.cf_thickness + this.kapton_thickness + this.sensor_thickness/2.0);
-		final double ball_pos_halfmod_axial_local_z =  12.66 + sensor_width/2.0;
+		// Distance from sensor to CF edge: 180mm
+		// Distance from CF edge to screw hole: 30mm
+		// Distance from screw hole to edge of cold block: 33.75mm
+		// Distance from edge of cold block to hole/ball position: 5mm
+		final double dist_sensor_center_to_coldblock_hole_vdir = (180.0 - 30.0 + (33.75 - 5.0)) - sensor_length/2.0;
+		final double ball_pos_halfmod_axial_local_x =  dist_sensor_center_to_coldblock_hole_vdir;
+		final double ball_pos_halfmod_axial_local_y =  -1.0* (coldblock_thickness/2.0 + this.cf_thickness + this.kapton_thickness + this.sensor_thickness/2.0);
+		final double ball_pos_halfmod_axial_local_z =  dist_lower_sensor_edge_to_cold_block_mounting_surface + sensor_width/2.0;
 		final double vee_pos_halfmod_axial_local_x =  ball_pos_halfmod_axial_local_x + sensor_length/2.0;
 		final double vee_pos_halfmod_axial_local_y =  ball_pos_halfmod_axial_local_y;
 		final double vee_pos_halfmod_axial_local_z =  ball_pos_halfmod_axial_local_z;
@@ -499,10 +714,10 @@
 
 		
 		
-		// cold block
+		// cold block position w.r.t. module box coordinate system
+		// this is a dummy coordinate system, make it simple
+		// edge of cold block on the mounting surface
 		
-		
-		
 		final double ball_pos_coldblock_local_x =  -5.00; 
 		final double ball_pos_coldblock_local_y =  0.00;
 		final double ball_pos_coldblock_local_z =  0.00;
@@ -549,7 +764,7 @@
 			print(String.format("flat_pos_halfmod_stereo_local %s", flat_pos_halfmod_stereo_local.toString()));
 		}
 		
-		makeHalfModule("stereo",moduleWrap, ball_pos_halfmod_stereo_local, vee_pos_halfmod_stereo_local, flat_pos_halfmod_stereo_local,lcdd,sens);
+		//makeHalfModule("stereo",moduleWrap, ball_pos_halfmod_stereo_local, vee_pos_halfmod_stereo_local, flat_pos_halfmod_stereo_local,lcdd,sens);
 
 		
 		moduleVolume.setVisAttributes(lcdd.getVisAttributes("ModuleVis"));
@@ -758,10 +973,32 @@
 
 		
 		String coldBlockName = moduleWrap.name + "_coldBlock";
-		//find the bounding box
-		final double x_local = this.coldblock_length; 
-		final double y_local = this.coldblock_thickness; 
-		final double z_local = this.coldblock_width;	
+		
+		int layer = getLayerFromVolumeName(moduleWrap.name);
+		double x_local = -99999.9; 
+		double y_local = -99999.9; 
+		double z_local = -99999.9;
+		double coldblock_length = -99999.9; 
+		double coldblock_thickness = -99999.9; 
+		double coldblock_width = -99999.9; 
+		if(layer >= 1 && layer <=3) {
+			coldblock_length = this.coldblock_L13_length;
+			coldblock_thickness = this.coldblock_L13_thickness;
+			coldblock_width = this.coldblock_L13_width;
+		} else if(layer >= 4 && layer <=5) {
+			coldblock_length = this.coldblock_L45_length;
+			coldblock_thickness = this.coldblock_L45_thickness;
+			coldblock_width = this.coldblock_L45_width;
+		} else {
+			print("wrong layer for " + moduleWrap.name);
+			System.exit(1);
+		}
+
+		x_local = coldblock_length; 
+		y_local = coldblock_thickness; 
+		z_local = coldblock_width;	
+
+		
 		Hep3Vector box_dim_local = new BasicHep3Vector( x_local, y_local, z_local); 
 		// rotate to module coordinate system
 		Hep3Vector box_dim_module = transToModuleCoord.rotated(box_dim_local);
@@ -780,9 +1017,9 @@
 
 		
 		// vector to the center of the half module box from the half module ball position
-		double box_center_local_x =  this.coldblock_length/2.0; 
+		double box_center_local_x =  coldblock_length/2.0; 
 		double box_center_local_y = 0.0;
-		double box_center_local_z = this.coldblock_width/2.0;
+		double box_center_local_z = coldblock_width/2.0;
 		Hep3Vector box_center_local = new BasicHep3Vector( box_center_local_x, box_center_local_y, box_center_local_z); 
 		//Hep3Vector box_center_local = new BasicHep3Vector( 0.,0.,0.);
 		
@@ -839,6 +1076,20 @@
 	
 	
 	
+	private int getLayerFromVolumeName(String name) {
+		int layer = -1;
+		for(int i=1; i<= 5; ++i) {
+			if(name.contains(String.format("_L%d", i))) {
+				layer = i;
+			}
+		}
+		if( layer == -1) {
+			print("cannot find layer from " + name);
+			System.exit(1);
+		}
+		return layer;
+	}
+
 	/**
 	 * Find the displacement of a point when rotating around an arbitrary position
 	 * @param origin_of_rotation

projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector
HPSTestRunTracker2014.xml 3102 -> 3103
--- projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml	2014-04-22 05:15:50 UTC (rev 3102)
+++ projects/lcsim/trunk/detector-framework/src/test/resources/org/lcsim/geometry/subdetector/HPSTestRunTracker2014.xml	2014-04-24 01:34:56 UTC (rev 3103)
@@ -37,6 +37,7 @@
     <vis name="ColdBlockVis" alpha="1.0" r="1.0" g="0.0" b="0.0" drawingStyle="wireframe" lineStyle="dashed" showDaughters="true" visible="true"/>
     <vis name="ModuleVis" alpha="1.0" r="1.0" g="1.0" b="1.0" drawingStyle="wireframe" lineStyle="dotted" showDaughters="true" visible="true"/>
     <vis name="SupportPlateVis" alpha="1.0" r="0.75" g="0.73" b="0.75" drawingStyle="solid" lineStyle="dashed" showDaughters="true" visible="true"/>
+    <vis name="BasePlateVis" alpha="1.0" r="0.75" g="0.73" b="0.75" drawingStyle="solid" lineStyle="dashed" showDaughters="true" visible="true"/>
     <vis name="LayerVis" alpha="0.0" r="0.0" g="0.0" b="1.0" drawingStyle="wireframe" showDaughters="true" visible="false"/>
     <vis name="ComponentVis" alpha="0.0" r="0.0" g="0.2" b="0.4" drawingStyle="solid" showDaughters="false" visible="false"/>
 	
SVNspam 0.1


Use REPLY-ALL to reply to list

To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1