Skip to content

Commit 9da88bb

Browse files
committed
fix formatting, remove empty mains
1 parent f9b8ff4 commit 9da88bb

17 files changed

Lines changed: 824 additions & 917 deletions

File tree

‎common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFConstants.java‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,22 @@ public class RTOFConstants {
2222
public final static double LENGTH = (NROWS-1) * LONG_BAR_LENGTH + SHORT_BAR_LENGTH;
2323
public final static double THICKNESS = 0.5; // cm
2424

25-
2625
public static DatabaseConstantProvider connect( DatabaseConstantProvider cp )
2726
{
28-
29-
load(cp );
30-
return cp;
27+
load(cp );
28+
return cp;
3129
}
3230

3331
/**
3432
* Reads all the necessary constants from CCDB into static variables.
3533
* Please use a DatabaseConstantProvider to access CCDB and load the following tables:
3634
* @param cp a ConstantProvider that has loaded the necessary tables
3735
*/
38-
3936
public static synchronized void load( DatabaseConstantProvider cp )
4037
{
41-
//WIDTH = NCOLUMNS * BAR_WIDTH;
38+
//WIDTH = NCOLUMNS * BAR_WIDTH;
4239
//LENGTH = (NROWS-1) * LONG_BAR_LENGTH + SHORT_BAR_LENGTH;
4340
//THICKNESS = 0.5; // cm
4441
}
4542

46-
}
47-
48-
43+
}

‎common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/recoil/tof/RTOFGeant4Factory.java‎

Lines changed: 70 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
/**
1111
* Generate GEANT4 volume for the RECOIL TOF detector
12-
*
12+
*
1313
* @author Nilanga Wickramaarachchi
1414
*/
1515
public final class RTOFGeant4Factory extends Geant4Factory {
@@ -24,121 +24,106 @@ public RTOFGeant4Factory( DatabaseConstantProvider cp) {
2424
}
2525

2626
public void init(DatabaseConstantProvider cp) {
27-
2827
motherVolume = new G4World("root");
29-
30-
for (int isector = 0; isector < nSectors; isector++) {
31-
Geant4Basic sectorVolume = createSector(isector, nRows, nCols);
32-
33-
sectorVolume.setName("recoil_tof_sector" + (isector + 1));
34-
sectorVolume.setMother(motherVolume);
35-
}
28+
for (int isector = 0; isector < nSectors; isector++) {
29+
Geant4Basic sectorVolume = createSector(isector, nRows, nCols);
30+
sectorVolume.setName("recoil_tof_sector" + (isector + 1));
31+
sectorVolume.setMother(motherVolume);
32+
}
3633
}
37-
38-
34+
3935
public Vector3d getCenterCoordinate(int isector)
4036
{
4137
int is=isector;
4238
Vector3d vCenter = new Vector3d(0, 0, 0);
43-
44-
vCenter.x = (-1+is*2)*(RTOFConstants.RADIUS)*Math.sin(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
45-
vCenter.y = 0;
46-
vCenter.z =RTOFConstants.RADIUS*Math.cos(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
39+
vCenter.x = (-1+is*2)*(RTOFConstants.RADIUS)*Math.sin(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
40+
vCenter.y = 0;
41+
vCenter.z =RTOFConstants.RADIUS*Math.cos(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
4742
return vCenter;
4843
}
49-
50-
5144

5245
public Geant4Basic createSector(int isector, int nRows, int nCols ) {
53-
46+
5447
double hlx = RTOFConstants.WIDTH/2+1;
5548
double hly = RTOFConstants.LENGTH/2+1;
56-
double hlz = RTOFConstants.THICKNESS/2+1;
57-
49+
double hlz = RTOFConstants.THICKNESS/2+1;
50+
5851
Vector3d vCenter = this.getCenterCoordinate(isector);
59-
60-
Geant4Basic sectorVolume = new G4Box("recoil_tof_sector" + (isector + 1), hlx, hly, hlz);
61-
62-
if(isector==0) sectorVolume.rotate("yxz",Math.toRadians((RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE)),0,0);
63-
if(isector==1) sectorVolume.rotate("yxz",Math.toRadians(-(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE)),0,0);
52+
53+
Geant4Basic sectorVolume = new G4Box("recoil_tof_sector" + (isector + 1), hlx, hly, hlz);
54+
55+
if(isector==0) sectorVolume.rotate("yxz",Math.toRadians((RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE)),0,0);
56+
if(isector==1) sectorVolume.rotate("yxz",Math.toRadians(-(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE)),0,0);
6457
sectorVolume.translate(vCenter.x, vCenter.y, vCenter.z);
6558
sectorVolume.setId(isector + 1, 0, 0);
66-
59+
6760
// Bars construction
68-
for (int row = 0; row < nRows; row++) {
69-
for (int col = 0; col < nCols; col++) {
70-
71-
Geant4Basic barVolume = this.createBar(isector, row, col);
72-
61+
for (int row = 0; row < nRows; row++) {
62+
for (int col = 0; col < nCols; col++) {
63+
64+
Geant4Basic barVolume = this.createBar(isector, row, col);
65+
7366
barVolume.setName("bar_sector" + (isector + 1) + "_row" + (row + 1) + "_column" + (col + 1));
74-
75-
barVolume.setMother(sectorVolume);
76-
77-
barVolume.setId(isector + 1, row +1, col+1, 0);
78-
}
79-
}
80-
67+
68+
barVolume.setMother(sectorVolume);
69+
70+
barVolume.setId(isector + 1, row +1, col+1, 0);
71+
}
72+
}
73+
8174
return sectorVolume;
8275
}
83-
8476

8577
public Geant4Basic createBar(int iSector, int iRow, int iCol) {
8678

87-
int nCols = RTOFConstants.NCOLUMNS;
88-
89-
double barDX = RTOFConstants.BAR_WIDTH/2;
90-
double barDY;
91-
92-
if (iRow == (nRows - 1) / 2) barDY = RTOFConstants.SHORT_BAR_LENGTH/2;
93-
else barDY = RTOFConstants.LONG_BAR_LENGTH/2;
94-
95-
double barDZ = RTOFConstants.BAR_THICKNESS/2;
79+
int nCols = RTOFConstants.NCOLUMNS;
80+
81+
double barDX = RTOFConstants.BAR_WIDTH/2;
82+
double barDY;
83+
84+
if (iRow == (nRows - 1) / 2) barDY = RTOFConstants.SHORT_BAR_LENGTH/2;
85+
else barDY = RTOFConstants.LONG_BAR_LENGTH/2;
86+
87+
double barDZ = RTOFConstants.BAR_THICKNESS/2;
88+
89+
Geant4Basic barVolume = new G4Box("bar_sector" + (iSector + 1) + "_row" + (iRow + 1) + "_column" + (iCol + 1), barDX, barDY, barDZ);
90+
91+
// Constants for positioning
92+
double y_start = -(RTOFConstants.LENGTH - RTOFConstants.LONG_BAR_LENGTH)/2; // Starting Y position
93+
double x_spacing = RTOFConstants.BAR_WIDTH;
94+
double x_start = -(RTOFConstants.WIDTH - x_spacing)/2; // starting X position
95+
double dy_long = RTOFConstants.LONG_BAR_LENGTH;
96+
double dy_short = RTOFConstants.SHORT_BAR_LENGTH;
97+
98+
//Position calculation
99+
double z_pos = 0;
100+
double x_pos = x_start + (iCol * x_spacing);
96101

97-
Geant4Basic barVolume = new G4Box("bar_sector" + (iSector + 1) + "_row" + (iRow + 1) + "_column" + (iCol + 1), barDX, barDY, barDZ);
98-
99-
// Constants for positioning
100-
double y_start = -(RTOFConstants.LENGTH - RTOFConstants.LONG_BAR_LENGTH)/2; // Starting Y position
101-
double x_spacing = RTOFConstants.BAR_WIDTH;
102-
double x_start = -(RTOFConstants.WIDTH - x_spacing)/2; // starting X position
103-
double dy_long = RTOFConstants.LONG_BAR_LENGTH;
104-
double dy_short = RTOFConstants.SHORT_BAR_LENGTH;
105-
106-
//Position calculation
107-
double z_pos = 0;
108-
double x_pos = x_start + (iCol * x_spacing);
109-
110102
double y_pos;
111-
if(iRow < (nRows - 1) / 2)
112-
{
113-
y_pos = y_start + (iRow * dy_long);
114-
}
115-
else if (iRow == (nRows - 1) / 2) // middle row
116-
{
117-
y_pos = 0;
118-
}
119-
else
120-
{
121-
y_pos = y_start + (iRow -1) * dy_long + dy_short;
122-
}
123-
124-
barVolume.setPosition(x_pos, y_pos, z_pos);
125-
126-
return barVolume;
103+
if (iRow < (nRows - 1) / 2) {
104+
y_pos = y_start + (iRow * dy_long);
105+
}
106+
else if (iRow == (nRows - 1) / 2) {// middle row
107+
y_pos = 0;
108+
}
109+
else {
110+
y_pos = y_start + (iRow -1) * dy_long + dy_short;
111+
}
112+
113+
barVolume.setPosition(x_pos, y_pos, z_pos);
114+
115+
return barVolume;
127116
}
128117

129-
130-
131-
132118
public static void main(String[] args) {
133119
DatabaseConstantProvider cp = new DatabaseConstantProvider(11, "default");
134-
120+
135121
RTOFConstants.connect(cp);
136122

137123
RTOFGeant4Factory factory = new RTOFGeant4Factory(cp);
138-
124+
139125
factory.getAllVolumes().forEach(volume -> {
140126
System.out.println(volume.gemcString());
141127
});
142-
143-
}
144-
}
128+
}
129+
}
Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,106 @@
11
package org.jlab.detector.geant4.v2.recoil.trk;
22

3-
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
3+
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
44

55
public class RtrkConstants {
6-
6+
77
private final static String CCDBPATH = "/geometry/recoil/trk/";
88

9-
public final static int NMAXREGIONS = 3; //max number of regions
10-
public final static int NREGIONS = 3; //number of regions
9+
public final static int NMAXREGIONS = 3; //max number of regions
10+
public final static int NREGIONS = 3; //number of regions
1111
public final static int NSECTORS = 2; //number of sectors
1212
public final static int NLAYERS = 2; //number of layers
1313
public final static int NCHAMBERS = 1; //number of chambers in a sector
14-
14+
1515
public final static double HORIZONTHAL_OPENING_ANGLE = 34.;
1616
public final static double VERTICAL_OPENING_ANGLE = 50.;
1717
public final static double RADIUS[] = {33.5,55.5,79.5};
1818
public final static double WIDTH[] = new double[NMAXREGIONS];
1919
public final static double HEIGHT[] = new double[NMAXREGIONS];
20-
20+
2121
public final static double THTILT = 0; // theta tilt (deg)
2222
/* public final static double XENLARGEMENT = 0.5; // cm
2323
public final static double YENLARGEMENT = 1.; // cm
2424
public final static double ZENLARGEMENT = 0.1; // cm
25-
25+
2626
// Sector geometrical parameters
2727
public final static double THOPEN = 34.; // opening angle between endplate planes (deg)
2828
public final static double THTILT = 0; // theta tilt (deg)
2929
public final static double THMIN = 4.694; // polar angle to the base of first chamber (deg)
3030
public final static double SECTORHEIGHT = 146.21; //height of each sector (cm)
3131
public final static double DX0CHAMBER0 = 5.197; // halfbase of chamber 1 (cm)*/
32-
32+
3333
// Chamber volumes and materials (units are cm)
34-
public final static double[] CHAMBERVOLUMESTHICKNESS = {0.0025, 0.0005,0.3, // window
35-
0.0025, 0.0005,0.4, // cathode
36-
0.0005, 0.005, 0.0005, // uRWell + DlC
37-
0.0005, 0.005, 0.0005, // Capacitive sharing layer1
38-
0.0005, 0.005, 0.0005, // Capacitive sharing layer2
39-
0.005, 0.0005,0.005, 0.005, 0.0005,0.005, 0.005, // Readout
40-
0.0127, 0.3, 0.0125}; // support
41-
public final static String[] CHAMBERVOLUMESNAME = {"window_kapton", "window_Al", "window_gas",
42-
"cathode_kapton", "cathode_Al", "cathode_gas",
43-
"muRwell_Cu", "muRwell_kapton", "muRwell_dlc",
44-
"capa_sharing_layer1_glue","capa_sharing_layer1_Cr","capa_sharing_layer1_kapton",
45-
"capa_sharing_layer2_glue","capa_sharing_layer2_Cr","capa_sharing_layer2_kapton",
46-
"readout1_glue", "readout1_Cu", "readout1_kapton", "readout2_glue", "readout2_Cu", "readout2_kapton", "readout3_glue",
47-
"support_skin1_g10", "support_honeycomb_nomex", "support_skin2_g10"};
48-
49-
// URWELL position in the CLAS12 frame
50-
/* public final static double TGT2DC0 = 228.078; // cm
51-
// public final static double URWELL2DC0 = 2; // cm
34+
public final static double[] CHAMBERVOLUMESTHICKNESS = {
35+
0.0025, 0.0005,0.3, // window
36+
0.0025, 0.0005,0.4, // cathode
37+
0.0005, 0.005, 0.0005, // uRWell + DlC
38+
0.0005, 0.005, 0.0005, // Capacitive sharing layer1
39+
0.0005, 0.005, 0.0005, // Capacitive sharing layer2
40+
0.005, 0.0005,0.005, 0.005, 0.0005,0.005, 0.005, // Readout
41+
0.0127, 0.3, 0.0125}; // support
42+
public final static String[] CHAMBERVOLUMESNAME = {
43+
"window_kapton", "window_Al", "window_gas",
44+
"cathode_kapton", "cathode_Al", "cathode_gas",
45+
"muRwell_Cu", "muRwell_kapton", "muRwell_dlc",
46+
"capa_sharing_layer1_glue","capa_sharing_layer1_Cr","capa_sharing_layer1_kapton",
47+
"capa_sharing_layer2_glue","capa_sharing_layer2_Cr","capa_sharing_layer2_kapton",
48+
"readout1_glue", "readout1_Cu", "readout1_kapton", "readout2_glue", "readout2_Cu", "readout2_kapton", "readout3_glue",
49+
"support_skin1_g10", "support_honeycomb_nomex", "support_skin2_g10"};
50+
51+
// URWELL position in the CLAS12 frame
52+
/* public final static double TGT2DC0 = 228.078; // cm
53+
// public final static double URWELL2DC0 = 2; // cm
5254
public final static double URWELL2DC0[] = new double[NMAXREGIONS];
5355
public final static double DIST2TGT[] = new double[NMAXREGIONS];
54-
public final static double W2TGT[] = new double[NMAXREGIONS];;
56+
public final static double W2TGT[] = new double[NMAXREGIONS];;
5557
public final static double YMIN[] = new double[NMAXREGIONS];
5658
public final static double ZMIN[] = new double[NMAXREGIONS];*/
5759

5860
public final static double PITCH = 0.1 ; // cm
5961
public final static double STEREOANGLE = 90; // deg
60-
61-
/*
62-
* @return String a path to a directory in CCDB of the format {@code "/geometry/detector/"}
63-
*/
62+
63+
/*
64+
* @return String a path to a directory in CCDB of the format {@code "/geometry/detector/"}
65+
*/
6466
public static String getCcdbPath()
6567
{
66-
return CCDBPATH;
68+
return CCDBPATH;
6769
}
68-
69-
/**
70+
71+
/**
7072
* Loads the the necessary tables for the URWELL geometry for a given DatabaseConstantProvider.
71-
*
73+
*
7274
* @return DatabaseConstantProvider the same thing
7375
*/
7476
public static DatabaseConstantProvider connect( DatabaseConstantProvider cp )
7577
{
76-
// cp.loadTable( CCDBPATH +"RWELL");
77-
78-
load(cp );
79-
return cp;
78+
// cp.loadTable( CCDBPATH +"RWELL");
79+
80+
load(cp );
81+
return cp;
8082
}
81-
83+
8284
/**
8385
* Reads all the necessary constants from CCDB into static variables.
8486
* Please use a DatabaseConstantProvider to access CCDB and load the following tables:
8587
* @param cp a ConstantProvider that has loaded the necessary tables
8688
*/
87-
8889
public static synchronized void load( DatabaseConstantProvider cp )
8990
{
90-
// read constants from svt table
91+
// read constants from svt table
9192
// NREGIONS = cp.getInteger( CCDBPATH+"svt/nRegions", 0 );
92-
93-
for (int i=0; i<NMAXREGIONS; i++){
94-
95-
/* URWELL2DC0[i] = -2.+i*1.3;
96-
DIST2TGT[i] = (TGT2DC0+URWELL2DC0[i]);
97-
W2TGT[i] = DIST2TGT[i]/Math.cos(Math.toRadians(THTILT-THMIN));
98-
YMIN[i]= W2TGT[i]*Math.sin(Math.toRadians(THMIN)); // distance from the base chamber1 and beamline
99-
ZMIN[i] = W2TGT[i]*Math.cos(Math.toRadians(THMIN));
100-
*/
101-
WIDTH[i]=2.*RADIUS[i]*Math.sin(Math.toRadians(HORIZONTHAL_OPENING_ANGLE)/2);
102-
HEIGHT[i]=RADIUS[i]*Math.tan(Math.toRadians(VERTICAL_OPENING_ANGLE)/2);
103-
}
93+
94+
for (int i=0; i<NMAXREGIONS; i++){
95+
96+
/* URWELL2DC0[i] = -2.+i*1.3;
97+
DIST2TGT[i] = (TGT2DC0+URWELL2DC0[i]);
98+
W2TGT[i] = DIST2TGT[i]/Math.cos(Math.toRadians(THTILT-THMIN));
99+
YMIN[i]= W2TGT[i]*Math.sin(Math.toRadians(THMIN)); // distance from the base chamber1 and beamline
100+
ZMIN[i] = W2TGT[i]*Math.cos(Math.toRadians(THMIN));
101+
*/
102+
WIDTH[i]=2.*RADIUS[i]*Math.sin(Math.toRadians(HORIZONTHAL_OPENING_ANGLE)/2);
103+
HEIGHT[i]=RADIUS[i]*Math.tan(Math.toRadians(VERTICAL_OPENING_ANGLE)/2);
104+
}
104105
}
105106
}

0 commit comments

Comments
 (0)