diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/URWELL/URWellConstants.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/URWELL/URWellConstants.java index 4d99e1601..8e1455e17 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/URWELL/URWellConstants.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/URWELL/URWellConstants.java @@ -43,7 +43,7 @@ public class URWellConstants { "support_skin1_g10", "support_honeycomb_nomex", "support_skin2_g10"}; // URWELL position in the CLAS12 frame - public final static double TGT2DC0 = 228.078; // cm + public final static double TGT2DC0 = 230.078; // cm // public final static double URWELL2DC0 = 2; // cm public final static double URWELL2DC0[] = new double[NMAXREGIONS]; public final static double DIST2TGT[] = new double[NMAXREGIONS]; @@ -116,7 +116,7 @@ public static synchronized void load( DatabaseConstantProvider cp ) for (int i=0; i y = mx +c; double stereoAngle = URWellConstants.STEREOANGLE; - if (layer % 2 == 0) { + if (layer % 2 != 0) { stereoAngle = -URWellConstants.STEREOANGLE; } double m = Math.tan(Math.toRadians(stereoAngle)); @@ -252,6 +252,32 @@ private Line3d createStrip(int sector, int layer, int strip) { } } + /** + * Provides the given strip line in the Chamber local frame + * @param region (1-2) + * @param sector (1-6) + * @param layer (1-4) + * @param strip (1-N) + * @return the 3D strip line as a Line3d + */ + + private Line3d getChamberStrip(int region, int sector, int chamber, int layer, int strip) { + + + Line3d globalStrip = createStrip(sector, layer, strip); + Geant4Basic chamberVolume = factory.getChamberVolume(sector, chamber, layer, isProto); + + Vector3d origin = chamberVolume.getGlobalTransform().invert().transform(globalStrip.origin()); + Vector3d end = chamberVolume.getGlobalTransform().invert().transform(globalStrip.end()); + + Line3d localStrip = new Line3d(origin, end); + + + return localStrip; + } + + + /** * Provides the given strip line in the sector local frame * @param sector (1-6) @@ -411,11 +437,19 @@ public static void main(String[] args) { URWellGeant4Factory factory = new URWellGeant4Factory(cp,true,2); - URWellStripFactory factory2 = new URWellStripFactory(cp,false,1); + URWellStripFactory factory2 = new URWellStripFactory(cp,true,1); Plane3D plane = factory2.getPlane(6, 1, 200); System.out.println(plane.toString()); + int strip =20; + System.out.println((strip) + " " + factory2.getLocalStripId(strip) + "\n" + factory2.getChamberStrip(1, 6,1,2,strip)) ; + + + // for(int istrip=0; istrip