Skip to content

Commit

Permalink
fix strip geo bug and new uRwell position
Browse files Browse the repository at this point in the history
  • Loading branch information
mariangela-bondi authored and baltzell committed Aug 7, 2023
1 parent 6f53cbb commit 5b15a97
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -116,7 +116,7 @@ public static synchronized void load( DatabaseConstantProvider cp )

for (int i=0; i<NMAXREGIONS; i++){

URWELL2DC0[NMAXREGIONS-i-1] = 2+i*2;
URWELL2DC0[NMAXREGIONS-i-1] = 2.2+i*2;
DIST2TGT[NMAXREGIONS-i-1] = (TGT2DC0-URWELL2DC0[NMAXREGIONS-i-1]);
W2TGT[NMAXREGIONS-i-1] = DIST2TGT[NMAXREGIONS-i-1]/Math.cos(Math.toRadians(THTILT-THMIN));
YMIN[NMAXREGIONS-i-1]= W2TGT[NMAXREGIONS-i-1]*Math.sin(Math.toRadians(THMIN)); // distance from the base chamber1 and beamline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ private Line3d createStrip(int sector, int layer, int strip) {

//strip straight line chamber reference frame -> 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));
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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<factory2.getNStripSector(); istrip++) {
// System.out.println((istrip+1) + " " + factory2.getChamberIndex(istrip+1) + "\n" + factory2.getStrip(1, 1, istrip+1) + "\n" + factory2.getStrip(1, 2, istrip+1));
// }


}

Expand Down

0 comments on commit 5b15a97

Please sign in to comment.