Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


import org.jlab.detector.calib.utils.DatabaseConstantProvider;
import org.jlab.geom.prim.Point3D;


public class RecoilConstants {
Expand All @@ -15,24 +14,15 @@ public class RecoilConstants {
public final static int NLAYERS = 2; //number of layers
public final static int NCHAMBERS = 1; //number of chambers in a sector

public final static double HORIZONTHAL_OPENING_ANGLE = 34.;
public final static double HORIZONTHAL_STARTING_ANGLE = 40.;
public final static double HORIZONTHAL_OPENING_ANGLE = 29.;
public final static double VERTICAL_OPENING_ANGLE = 50.;
public final static double RADIUS[] = {33.5,55.5,79.5};
public final static double RADIUS[] = {44,72,100};
public final static double WIDTH[] = new double[NMAXREGIONS];
public final static double HEIGHT[] = new double[NMAXREGIONS];

public final static double THTILT = 0; // theta tilt (deg)
/* public final static double XENLARGEMENT = 0.5; // cm
public final static double YENLARGEMENT = 1.; // cm
public final static double ZENLARGEMENT = 0.1; // cm

// Sector geometrical parameters
public final static double THOPEN = 34.; // opening angle between endplate planes (deg)
public final static double THTILT = 0; // theta tilt (deg)
public final static double THMIN = 4.694; // polar angle to the base of first chamber (deg)
public final static double SECTORHEIGHT = 146.21; //height of each sector (cm)
public final static double DX0CHAMBER0 = 5.197; // halfbase of chamber 1 (cm)*/

// Chamber volumes and materials (units are cm)
public final static double[] CHAMBERVOLUMESTHICKNESS = {0.0025, 0.0005,0.3, // window
0.0025, 0.0005,0.4, // cathode
Expand All @@ -49,15 +39,6 @@ public class RecoilConstants {
"readout1_glue", "readout1_Cu", "readout1_kapton", "readout2_glue", "readout2_Cu", "readout2_kapton", "readout3_glue",
"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 URWELL2DC0 = 2; // cm
public final static double URWELL2DC0[] = new double[NMAXREGIONS];
public final static double DIST2TGT[] = new double[NMAXREGIONS];
public final static double W2TGT[] = new double[NMAXREGIONS];;
public final static double YMIN[] = new double[NMAXREGIONS];
public final static double ZMIN[] = new double[NMAXREGIONS];*/

public final static double PITCH = 0.1 ; // cm
public final static double STEREOANGLE = 90; // deg

Expand Down Expand Up @@ -95,14 +76,8 @@ public static synchronized void load( DatabaseConstantProvider cp )

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

/* 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));
*/
WIDTH[i]=2.*RADIUS[i]*Math.sin(Math.toRadians(HORIZONTHAL_OPENING_ANGLE)/2);
HEIGHT[i]=RADIUS[i]*Math.tan(Math.toRadians(VERTICAL_OPENING_ANGLE)/2);
WIDTH[i]=2.*RADIUS[i]*Math.tan(Math.toRadians(HORIZONTHAL_OPENING_ANGLE)/2);
HEIGHT[i]=2*RADIUS[i]*Math.tan(Math.toRadians(VERTICAL_OPENING_ANGLE)/2);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@

import eu.mihosoft.vrl.v3d.Vector3d;
import org.jlab.detector.geant4.v2.Geant4Factory;
import org.jlab.detector.volume.G4Trap;
import org.jlab.detector.volume.G4World;
import org.jlab.detector.volume.G4Box;
import org.jlab.detector.volume.G4Trd;
import org.jlab.detector.volume.Geant4Basic;
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
import org.jlab.geom.prim.Line3D;
import org.jlab.geom.prim.Point3D;
import org.jlab.geom.prim.Plane3D;
import org.jlab.geom.prim.Vector3D;
import org.jlab.geometry.prim.Line3d;
import org.jlab.geometry.prim.Straight;

/**
* Generate GEANT4 volume for the RECOIL detector
Expand Down Expand Up @@ -78,18 +70,11 @@ public double[] getSectorDimensions(int iregion){

int i=iregion;
double[] SectorDimensions = new double[5];

SectorDimensions[0] = RecoilConstants.WIDTH[i]/2+1.;
SectorDimensions[1] = RecoilConstants.HEIGHT[i]/2+1.;
SectorDimensions[2] = (this.getChamberThickness())/2.+1;

/* SectorDimensions[0] = (this.getChamberThickness())/2. + RecoilConstants.ZENLARGEMENT ;
SectorDimensions[1] = RecoilConstants.SECTORHEIGHT/2 + RecoilConstants.YENLARGEMENT ;
SectorDimensions[2] = RecoilConstants.DX0CHAMBER0 + RecoilConstants.XENLARGEMENT ;
SectorDimensions[3] = (SectorDimensions[1]*2)*Math.tan(Math.toRadians(RecoilConstants.THOPEN/2))+SectorDimensions[2];
SectorDimensions[4] = Math.toRadians(RecoilConstants.THTILT);
*/

SectorDimensions[0] = RecoilConstants.WIDTH[i]/2;
SectorDimensions[1] = RecoilConstants.HEIGHT[i]/2;
SectorDimensions[2] = (this.getChamberThickness())/2.;

return SectorDimensions;
}

Expand All @@ -108,9 +93,9 @@ public Vector3d getCenterCoordinate(int isector, int iregion)
int ir=iregion;
Vector3d vCenter = new Vector3d(0, 0, 0);

vCenter.x = (-1+is*2)*(RecoilConstants.RADIUS[iregion])*Math.sin(Math.toRadians(1.5*RecoilConstants.HORIZONTHAL_OPENING_ANGLE));
vCenter.x = (-1+is*2)*(RecoilConstants.RADIUS[iregion])*Math.sin(Math.toRadians(RecoilConstants.HORIZONTHAL_OPENING_ANGLE/2+RecoilConstants.HORIZONTHAL_STARTING_ANGLE));
vCenter.y = 0;
vCenter.z =RecoilConstants.RADIUS[iregion]*Math.cos(Math.toRadians(1.5*RecoilConstants.HORIZONTHAL_OPENING_ANGLE));
vCenter.z =RecoilConstants.RADIUS[iregion]*Math.cos(Math.toRadians(RecoilConstants.HORIZONTHAL_OPENING_ANGLE/2+RecoilConstants.HORIZONTHAL_STARTING_ANGLE));
return vCenter;
}

Expand All @@ -132,29 +117,21 @@ public Geant4Basic createSector(int isector, int iregion, int Nchambers) {
// baricenter coordinate in CLAS12 frame

Vector3d vCenter = this.getCenterCoordinate(isector,iregion);
// Sector construction
/* Geant4Basic sectorVolume = new G4Trap("region_Recoil_" + (iregion + 1) + "_s" + (isector + 1),
regionDZ, -regionThilt, Math.toRadians(90.0),
regionDY, regionDX0, regionDX1, 0.0,
regionDY, regionDX0, regionDX1, 0.0);*/

Geant4Basic sectorVolume = new G4Box("region_recoil_" + (iregion + 1) + "_s" + (isector + 1),hlx,hly,hlz);
/* sectorVolume.rotate("yxz", 0.0, regionThilt, Math.toRadians(90.0 - isector * 60.0));*/
sectorVolume.rotate("yxz",(-1+isector*2)*Math.toRadians(1.5*RecoilConstants.HORIZONTHAL_OPENING_ANGLE+270),0,0);

//sectorVolume.rotate("yxz",(-1+isector*2)*Math.toRadians((RecoilConstants.HORIZONTHAL_OPENING_ANGLE/2+RecoilConstants.HORIZONTHAL_STARTING_ANGLE)),0,0);
if(isector==0)sectorVolume.rotate("yxz",Math.toRadians((RecoilConstants.HORIZONTHAL_OPENING_ANGLE/2+RecoilConstants.HORIZONTHAL_STARTING_ANGLE)),0,0);
if(isector==1)sectorVolume.rotate("yxz",Math.toRadians(-(RecoilConstants.HORIZONTHAL_OPENING_ANGLE/2+RecoilConstants.HORIZONTHAL_STARTING_ANGLE)),0,0);
sectorVolume.translate(vCenter.x, vCenter.y, vCenter.z);
sectorVolume.setId(isector + 1, iregion +1, 0, 0);

// Chambers construction
for (int ich = 0; ich < Nchambers; ich++) {

// double y_chamber = (2*ich+1)*(RecoilConstants.SECTORHEIGHT/RecoilConstants.NCHAMBERS/2+0.05);

Geant4Basic chamberVolume = this.createChamber(isector, iregion, ich);

chamberVolume.setName("rg" + (iregion + 1) + "_s" + (isector + 1) + "_c" + (ich +1));

Geant4Basic chamberVolume = this.createChamber(isector, iregion, ich);
chamberVolume.setName("rg" + (iregion + 1) + "_s" + (isector + 1) + "_c" + (ich +1));
chamberVolume.setMother(sectorVolume);
//chamberVolume.translate(0.0,y_chamber-RecoilConstants.SECTORHEIGHT/2,0. );
chamberVolume.setId(isector + 1, iregion + 1, ich +1, 0);
}

Expand Down Expand Up @@ -235,15 +212,6 @@ public double[] getChamber_daughter_Dimensions(int iregion, int ichamber){
int i = iregion;
double[] chamber_daughter_Dimensions = new double[3];

/* chamber_daughter_Dimensions[0] = RecoilConstants.SECTORHEIGHT/RecoilConstants.NCHAMBERS/2 ;
chamber_daughter_Dimensions[1] = (ichamber*RecoilConstants.SECTORHEIGHT/RecoilConstants.NCHAMBERS)
* Math.tan(Math.toRadians(RecoilConstants.THOPEN/2.))
+ RecoilConstants.DX0CHAMBER0 ;

chamber_daughter_Dimensions[2] = (RecoilConstants.SECTORHEIGHT/RecoilConstants.NCHAMBERS)
* Math.tan(Math.toRadians(RecoilConstants.THOPEN/2.))+chamber_daughter_Dimensions[1];
*/

chamber_daughter_Dimensions[0] = RecoilConstants.WIDTH[i]/2;
chamber_daughter_Dimensions[1] = RecoilConstants.HEIGHT[i]/2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.jlab.detector.hits.DetHit;
import org.jlab.detector.volume.Geant4Basic;
import org.jlab.geom.prim.Line3D;
import org.jlab.geom.prim.Plane3D;
import org.jlab.geom.prim.Point3D;
import org.jlab.geom.prim.Vector3D;
import org.jlab.geometry.prim.Line3d;
Expand All @@ -23,7 +22,6 @@ public final class RecoilStripFactory {
private RecoilGeant4Factory factory;
private IndexedList<Line3D> globalStrips = new IndexedList(3);
private IndexedList<Line3D> localStrips = new IndexedList(3);
private IndexedList<Plane3D> planeStrips = new IndexedList(3);
private int nRegions;
private int nSectors;
private int nChambers;
Expand Down Expand Up @@ -73,7 +71,6 @@ public void init(DatabaseConstantProvider cp, int regions) {
nChambers = RecoilConstants.NCHAMBERS;
nLayers = RecoilConstants.NLAYERS;
this.fillStripLists();
// this.fillPlaneLists();
}

/**
Expand Down Expand Up @@ -117,7 +114,7 @@ public int getNStripChamber(int ichamber, int regions) {
int nAB = (int) (2 * xHalf / RecoilConstants.PITCH);
int nAC = (int) (2 * yHalf / RecoilConstants.PITCH);

int nStrips = nAB + nAC;
int nStrips = nAB + nAC +1;

return nStrips;
}
Expand Down Expand Up @@ -191,7 +188,8 @@ private Line3d createStrip(int sector, int region, int layer, int strip) {
}
// ID of the strip
int nS = (int) (DY / RecoilConstants.PITCH);
int nCStrip = nS + (cStrip - 1);
// int nCStrip = nS + (cStrip - 1);
int nCStrip = nS + (cStrip);
double c = nCStrip * RecoilConstants.PITCH;

// Take 2 points in the strip straight line. They needs to define Line object
Expand Down Expand Up @@ -308,9 +306,10 @@ private void fillStripLists() {
DY = -yHalf;
}
int nS = (int) (DY / RecoilConstants.PITCH);
int nCStrip = nS + (cStrip - 1);
// int nCStrip = nS + (cStrip - 1);
int nCStrip = nS + (cStrip);
double c = nCStrip * RecoilConstants.PITCH;
if (((layer) % 2 == 0 && c>-xHalf && c<xHalf)||((layer) % 2 != 0 && c>-yHalf && c<yHalf))
if (((layer) % 2 == 0 && c>=-xHalf && c<=xHalf)||((layer) % 2 != 0 && c>=-yHalf && c<=yHalf))
{

Line3d line = this.createStrip(sector, region,layer, strip);
Expand Down Expand Up @@ -339,55 +338,12 @@ private void fillStripLists() {
public Line3D toLocal(int sector, Line3D global) {
Line3D local = new Line3D();
local.copy(global);
local.rotateY((-1+sector*2)*Math.toRadians(1.5*RecoilConstants.HORIZONTHAL_OPENING_ANGLE+270));

if(sector==0)local.rotateY((Math.toRadians(RecoilConstants.HORIZONTHAL_OPENING_ANGLE/2+RecoilConstants.HORIZONTHAL_STARTING_ANGLE)));
if(sector==1)local.rotateY(-(Math.toRadians(RecoilConstants.HORIZONTHAL_OPENING_ANGLE/2+RecoilConstants.HORIZONTHAL_STARTING_ANGLE)));
return local;
}

private void fillPlaneLists() {

for(int ir=0; ir<nRegions; ir++) {
int region = ir+1;
for(int is=0; is<nSectors; is++) {
int sector = is+1;
for(int il=0; il<nLayers; il++) {

int layer = (2*region-1) + il;

for(int ic=0; ic<this.getNStripSector(); ic++) {
int strip = ic+1;

int chamberIndex = getChamberIndex(strip);
double[] dim = factory.getChamber_daughter_Dimensions(region-1,chamberIndex);

double yHalf = dim[1];
double xHalf = dim[0];
int cStrip = this.getLocalStripId(strip);
double DY = -xHalf; //v strip
if (layer % 2 != 0) { //u strip
DY = -yHalf;
}
int nS = (int) (DY / RecoilConstants.PITCH);
int nCStrip = nS + (cStrip - 1);
double c = nCStrip * RecoilConstants.PITCH;
if ((layer % 2 == 0 && c>-xHalf && c<xHalf)||(layer % 2 != 0 && c>-yHalf && c<yHalf))
{
Plane3D plane = this.createPLane(sector, region, layer, strip);
this.planeStrips.add(plane, sector, layer, strip);
}
}
}
}
}
}


public Plane3D getPlane(int sector, int layer, int strip){

return planeStrips.getItem(sector, layer, strip);
}



/**
* Provides the 3D line for the given strip in the CLAS12 frame
* @param sector (1-6)
Expand All @@ -411,31 +367,6 @@ public Line3D getTiltedStrip(int sector, int layer, int strip) {
return localStrips.getItem(sector, layer, strip);
}

private Plane3D createPLane(int sector, int region, int layer, int strip){

int chamber = this.getChamberIndex(strip);
int LastStripID = this.getNStripChamber(chamber, region);

Line3D Last_strip = this.getStrip(sector, layer, LastStripID);

Line3D First_strip = this.getStrip(sector, layer, 1);

Line3D test_strip = this.getStrip(sector, layer, 1);

Vector3D Dir_strip_test = First_strip.originDir();

/* Line orthogonal to the 2 strip */
Line3D line = First_strip.distance(Last_strip);

Vector3D Dir_line = line.originDir();

Vector3D normal_plane = Dir_strip_test.cross(Dir_line);

Plane3D plane = new Plane3D(First_strip.origin(), normal_plane);

return plane;
}

public static void main(String[] args) {
DatabaseConstantProvider cp = new DatabaseConstantProvider(11, "default");

Expand All @@ -444,13 +375,7 @@ public static void main(String[] args) {
RecoilGeant4Factory factory = new RecoilGeant4Factory(cp,1);

RecoilStripFactory factory2 = new RecoilStripFactory(cp,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
40 changes: 40 additions & 0 deletions etc/bankdefs/clas12/RECOIL.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<evio_dictionary>
<bank name="RECOIL" tag="2600" info="Simulated BMT Hit Information">
<section name="true" tag="2601" num="0" info="True Values">
<column name="pid" num="1" type="int32" info="ID of the first particle entering the sensitive volume"/>
<column name="mpid" num="2" type="int32" info="ID of the mother of the first particle entering the sensitive volume"/>
<column name="tid" num="3" type="int32" info="Track ID of the first particle entering the sensitive volume"/>
<column name="mtid" num="4" type="int32" info="Track ID of the mother of the first particle entering the sensitive volume"/>
<column name="otid" num="5" type="int32" info="Track ID of the original track that generated the first particle entering the sensitive volume"/>
<column name="trackE" num="6" type="float64" info="Energy of the track"/>
<column name="totEdep" num="7" type="float64" info="Total Energy Deposited"/>
<column name="avgX" num="8" type="float64" info="Average X position in global reference system"/>
<column name="avgY" num="9" type="float64" info="Average Y position in global reference system"/>
<column name="avgZ" num="10" type="float64" info="Average Z position in global reference system"/>
<column name="avgLx" num="11" type="float64" info="Average X position in local reference system"/>
<column name="avgLy" num="12" type="float64" info="Average Y position in local reference system"/>
<column name="avgLz" num="13" type="float64" info="Average Z position in local reference system"/>
<column name="px" num="14" type="float64" info="x component of momentum of the particle entering the sensitive volume"/>
<column name="py" num="15" type="float64" info="y component of momentum of the particle entering the sensitive volume"/>
<column name="pz" num="16" type="float64" info="z component of momentum of the particle entering the sensitive volume"/>
<column name="vx" num="17" type="float64" info="x component of primary vertex of the particle entering the sensitive volume"/>
<column name="vy" num="18" type="float64" info="y component of primary vertex of the particle entering the sensitive volume"/>
<column name="vz" num="19" type="float64" info="z component of primary vertex of the particle entering the sensitive volume"/>
<column name="mvx" num="20" type="float64" info="x component of primary vertex of the mother of the particle entering the sensitive volume"/>
<column name="mvy" num="21" type="float64" info="y component of primary vertex of the mother of the particle entering the sensitive volume"/>
<column name="mvz" num="22" type="float64" info="z component of primary vertex of the mother of the particle entering the sensitive volume"/>
<column name="avgT" num="23" type="float64" info="Average time"/>
<column name="nsteps" num="24" type="int32" info="Number of steps"/>
<column name="procID" num="25" type="int32" info="Process ID"/>
<column name="hitn" num="99" type="int32" info="Hit1 Number"/>
</section>
<section name="dgtz" tag="2602" num="0" info="Digitized information">
<column name="sector" type="int32" num="1" info="Sector (10..63)" />
<column name="layer" type="int32" num="2" info="Layer number (1..2)" />
<column name="component" type="int32" num="3" info="Strip number (1..10000)" />
<column name="ADC" type="int32" num="4" info="adc" />
<column name="time" type="float64" num="5" info="Time of the hit" />
<column name="hitn" type="int32" num="99" info="Hit Number" />
</section>
</bank>
</evio_dictionary>
Loading