Skip to content

Commit

Permalink
Merge branch 'development' into upgradeTrackingWithuRWELL
Browse files Browse the repository at this point in the history
  • Loading branch information
tongtongcao committed Sep 18, 2023
2 parents 670e0d1 + 086172d commit acb9924
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 105 deletions.
22 changes: 22 additions & 0 deletions bin/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,25 @@ if [ -z "$COAT_MAGFIELD_SOLENOIDMAP" ]; then
export COAT_MAGFIELD_SOLENOIDMAP=Symm_solenoid_r601_phi1_z1201_13June2018.dat
fi

# additional environment variables for groovy or interactive use
# - call as `source $0 groovy` or `source $0 jshell`
if [ $# -ge 1 ]; then
if [ "$1" == "groovy" -o "$1" == "jshell" ]; then

# add jar files to class path
for lib in clas services utils; do
for jars in $(ls -a $CLAS12DIR/lib/$lib/*.jar); do
JYPATH="${JYPATH:+${JYPATH}:}${jars}"
done
done

# additional variables and settings for groovy
if [ "$1" == "groovy" ]; then
JYPATH="${JYPATH:+${JYPATH}:}${CLAS12DIR}/lib/packages"
export JAVA_OPTS="-Dsun.java2d.pmoffscreen=false -Djava.util.logging.config.file=$CLAS12DIR/etc/logging/debug.properties -Xms1024m -Xmx2048m -XX:+UseSerialGC"
fi

export JYPATH

fi
fi
56 changes: 7 additions & 49 deletions bin/run-groovy
Original file line number Diff line number Diff line change
@@ -1,53 +1,11 @@
#!/bin/sh

. `dirname $0`/env.sh
. `dirname $0`/env.sh groovy

echo """
****************************************
* Running COATJAVA Groovy Script *
****************************************
"""

export CLAS12DIR=`dirname $0`/..

#--------------------------------------------------------------
# Adding supporting COAT jar files
for i in `ls -a $CLAS12DIR/lib/clas/*.jar`
do
#echo "$i"
if [ -z "${JYPATH}" ] ; then
JYPATH="$i"
else
JYPATH=${JYPATH}:"$i"
fi
done
#--------------------------------------------------------------
# Adding supporting plugins directory
for i in `ls -a $CLAS12DIR/lib/services/*.jar`
do
if [ -z "${JYPATH}" ] ; then
JYPATH="$i"
else
JYPATH=${JYPATH}:"$i"
fi
done
#--------------------------------------------------------------
# Adding supporting plugins directory
#--------------------------------------------------------------
# Done loading plugins
#--------------------------------------------------------------
# Adding supporting plugins directory
for i in `ls -a $CLAS12DIR/lib/utils/*.jar`
do
if [ -z "${JYPATH}" ] ; then
JYPATH="$i"
else
JYPATH=${JYPATH}:"$i"
fi
done
#-------------------------------------------------------------
JYPATH=${JYPATH}:${CLAS12DIR}/lib/packages
echo " "
echo " "
echo "*****************************************"
echo "* Running COAT-JAVA Groovy Scripts *"
echo "* Version : 3a Release : 2016 *"
echo "*****************************************"
echo " "
echo " "
export JAVA_OPTS="-Dsun.java2d.pmoffscreen=false -Djava.util.logging.config.file=$CLAS12DIR/etc/logging/debug.properties -Xms1024m -Xmx2048m -XX:+UseSerialGC"
groovy -cp "$JYPATH" "$@"
11 changes: 11 additions & 0 deletions bin/run-groovysh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

. `dirname $0`/env.sh groovy

echo """
***************************************
* Running COATJAVA Groovy Shell *
***************************************
"""

groovysh -cp "$JYPATH" "$@"
53 changes: 7 additions & 46 deletions bin/run-jshell
Original file line number Diff line number Diff line change
@@ -1,50 +1,11 @@
#!/bin/sh

. `dirname $0`/env.sh
. `dirname $0`/env.sh jshell

echo """
*********************************
* Running COATJAVA JShell *
*********************************
"""

export CLAS12DIR=`dirname $0`/..

#--------------------------------------------------------------
# Adding supporting COAT jar files
for i in `ls -a $CLAS12DIR/lib/clas/*.jar`
do
#echo "$i"
if [ -z "${JYPATH}" ] ; then
JYPATH="$i"
else
JYPATH=${JYPATH}:"$i"
fi
done
#--------------------------------------------------------------
# Adding supporting plugins directory
for i in `ls -a $CLAS12DIR/lib/services/*.jar`
do
if [ -z "${JYPATH}" ] ; then
JYPATH="$i"
else
JYPATH=${JYPATH}:"$i"
fi
done
#--------------------------------------------------------------
# Adding supporting plugins directory
#--------------------------------------------------------------
# Done loading plugins
#--------------------------------------------------------------
# Adding supporting plugins directory
for i in `ls -a $CLAS12DIR/lib/utils/*.jar`
do
if [ -z "${JYPATH}" ] ; then
JYPATH="$i"
else
JYPATH=${JYPATH}:"$i"
fi
done
#-------------------------------------------------------------
echo " "
echo " "
echo "*****************************************"
echo "* Running COAT-JAVA JShell Scripts *"
echo "*****************************************"
echo " "
echo " "
jshell --class-path "$JYPATH" "$@"
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,14 @@ public static synchronized void load( DatabaseConstantProvider cp )
// NREGIONS = cp.getInteger( CCDBPATH+"svt/nRegions", 0 );

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

URWELL2DC0[NMAXREGIONS-i-1] = 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
ZMIN[NMAXREGIONS-i-1] = W2TGT[NMAXREGIONS-i-1]*Math.cos(Math.toRadians(THMIN));


URWELL2DC0[i] = -2.+i*1.3;
DIST2TGT[i] = (TGT2DC0+URWELL2DC0[i]);
W2TGT[i] = DIST2TGT[i]/Math.cos(Math.toRadians(THTILT-THMIN));
YMIN[i]= W2TGT[i]*Math.sin(Math.toRadians(THMIN)); // distance from the base chamber1 and beamline
ZMIN[i] = W2TGT[i]*Math.cos(Math.toRadians(THMIN));


}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ public static void main(String[] args) {

URWellConstants.connect(cp);

URWellGeant4Factory factory = new URWellGeant4Factory(cp, true, 2);
URWellGeant4Factory factory = new URWellGeant4Factory(cp, false, 2);

factory.getAllVolumes().forEach(volume -> {
System.out.println(volume.gemcString());
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 acb9924

Please sign in to comment.