Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public enum DetectorType {
AHDC (24, "AHDC"),
ATOF (25, "ATOF"),
RECOIL (26, "RECOIL"),
RTOF (27, "RTOF"),
TARGET (100, "TARGET"),
MAGNETS (101, "MAGNETS");

Expand Down

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest reorganizing these classes under the following directory structure:
.../v2/recoil/tof/RecoilTOFConstants.java
.../v2/recoil/trk/...

Also, if constants are the same in the two detectors, a single class could be used

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package org.jlab.detector.geant4.v2.rtof;


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


public class RTOFConstants {

public final static int NSECTORS = 2; //number of sectors
public final static int NROWS = 5; //number of rows of bars in a sector
public final static int NCOLUMNS = 63; //number of columns of bars in a sector

public final static double LONG_BAR_LENGTH = 27.5; // cm
public final static double SHORT_BAR_LENGTH = 4; // cm

public final static double BAR_WIDTH = 1; // cm
public final static double BAR_THICKNESS = 0.5; // cm

public final static double HORIZONTAL_STARTING_ANGLE = 40.;
public final static double HORIZONTAL_OPENING_ANGLE = 29.;
public final static double RADIUS = 122.; // cm

public final static double WIDTH = NCOLUMNS * BAR_WIDTH;
public final static double LENGTH = (NROWS-1) * LONG_BAR_LENGTH + SHORT_BAR_LENGTH;
public final static double THICKNESS = 0.5; // cm


public static DatabaseConstantProvider connect( DatabaseConstantProvider cp )
{

load(cp );
return cp;
}

/**
* Reads all the necessary constants from CCDB into static variables.
* Please use a DatabaseConstantProvider to access CCDB and load the following tables:
* @param cp a ConstantProvider that has loaded the necessary tables
*/

public static synchronized void load( DatabaseConstantProvider cp )
{
//WIDTH = NCOLUMNS * BAR_WIDTH;
//LENGTH = (NROWS-1) * LONG_BAR_LENGTH + SHORT_BAR_LENGTH;
//THICKNESS = 0.5; // cm
}

}


Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see the comment above about the directory structure

Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
package org.jlab.detector.geant4.v2.rtof;

import eu.mihosoft.vrl.v3d.Vector3d;
import org.jlab.detector.geant4.v2.Geant4Factory;
import org.jlab.detector.volume.G4World;
import org.jlab.detector.volume.G4Box;
import org.jlab.detector.volume.Geant4Basic;
import org.jlab.detector.calib.utils.DatabaseConstantProvider;

/**
* Generate GEANT4 volume for the RECOIL TOF detector
*
* @author Nilanga Wickramaarachchi
*/
public final class RTOFGeant4Factory extends Geant4Factory {

private int nSectors = RTOFConstants.NSECTORS;
private int nRows = RTOFConstants.NROWS;
private int nCols = RTOFConstants.NCOLUMNS;

public RTOFGeant4Factory( DatabaseConstantProvider cp) {
RTOFConstants.connect(cp );
this.init(cp);
}

public void init(DatabaseConstantProvider cp) {

motherVolume = new G4World("root");

for (int isector = 0; isector < nSectors; isector++) {
Geant4Basic sectorVolume = createSector(isector, nRows, nCols);

sectorVolume.setName("recoil_tof_sector" + (isector + 1));
sectorVolume.setMother(motherVolume);
}
}


public Vector3d getCenterCoordinate(int isector)
{
int is=isector;
Vector3d vCenter = new Vector3d(0, 0, 0);

vCenter.x = (-1+is*2)*(RTOFConstants.RADIUS)*Math.sin(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
vCenter.y = 0;
vCenter.z =RTOFConstants.RADIUS*Math.cos(Math.toRadians(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE));
return vCenter;
}



public Geant4Basic createSector(int isector, int nRows, int nCols ) {

double hlx = RTOFConstants.WIDTH/2+1;
double hly = RTOFConstants.LENGTH/2+1;
double hlz = RTOFConstants.THICKNESS/2+1;

Vector3d vCenter = this.getCenterCoordinate(isector);

Geant4Basic sectorVolume = new G4Box("recoil_tof_sector" + (isector + 1), hlx, hly, hlz);

if(isector==0) sectorVolume.rotate("yxz",Math.toRadians((RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE)),0,0);
if(isector==1) sectorVolume.rotate("yxz",Math.toRadians(-(RTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RTOFConstants.HORIZONTAL_STARTING_ANGLE)),0,0);
sectorVolume.translate(vCenter.x, vCenter.y, vCenter.z);
sectorVolume.setId(isector + 1, 0, 0);

// Bars construction
for (int row = 0; row < nRows; row++) {
for (int col = 0; col < nCols; col++) {

Geant4Basic barVolume = this.createBar(isector, row, col);

barVolume.setName("bar_sector" + (isector + 1) + "_row" + (row + 1) + "_column" + (col + 1));

barVolume.setMother(sectorVolume);

barVolume.setId(isector + 1, row +1, col+1, 0);
}
}

return sectorVolume;
}


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

int nCols = RTOFConstants.NCOLUMNS;

double barDX = RTOFConstants.BAR_WIDTH/2;
double barDY;

if (iRow == (nRows - 1) / 2) barDY = RTOFConstants.SHORT_BAR_LENGTH/2;
else barDY = RTOFConstants.LONG_BAR_LENGTH/2;

double barDZ = RTOFConstants.BAR_THICKNESS/2;

Geant4Basic barVolume = new G4Box("bar_sector" + (iSector + 1) + "_row" + (iRow + 1) + "_column" + (iCol + 1), barDX, barDY, barDZ);

// Constants for positioning
double y_start = -(RTOFConstants.LENGTH - RTOFConstants.LONG_BAR_LENGTH)/2; // Starting Y position
double x_spacing = RTOFConstants.BAR_WIDTH;
double x_start = -(RTOFConstants.WIDTH - x_spacing)/2; // starting X position
double dy_long = RTOFConstants.LONG_BAR_LENGTH;
double dy_short = RTOFConstants.SHORT_BAR_LENGTH;

//Position calculation
double z_pos = 0;
double x_pos = x_start + (iCol * x_spacing);

double y_pos;
if(iRow < (nRows - 1) / 2)
{
y_pos = y_start + (iRow * dy_long);
}
else if (iRow == (nRows - 1) / 2) // middle row
{
y_pos = 0;
}
else
{
y_pos = y_start + (iRow -1) * dy_long + dy_short;
}

barVolume.setPosition(x_pos, y_pos, z_pos);

return barVolume;
}




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

RTOFConstants.connect(cp);

RTOFGeant4Factory factory = new RTOFGeant4Factory(cp);

factory.getAllVolumes().forEach(volume -> {
System.out.println(volume.gemcString());
});

}
}
18 changes: 16 additions & 2 deletions etc/bankdefs/hipo4/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@
{ "name":"ped" , "type":"S", "info":"pedestal from pulse analysis"}
]
},
{
{
"name" : "URWELL::adc",
"group": 22300,
"item" : 11,
Expand All @@ -596,7 +596,21 @@
{ "name":"time" , "type":"F", "info":"time"},
{ "name":"ped" , "type":"S", "info":"pedestal from pulse analysis"}
]
},
},
{
"name" : "RTOF::tdc",
"group": 22700,
"item" : 12,
"info": "TDC bank for the RECOIL TOF",
"entries":[
{ "name":"sector" , "type":"B", "info":"sector"},
{ "name":"layer" , "type":"B", "info":"layer"},
{ "name":"component" , "type":"B", "info":"component"},
{ "name":"order" , "type":"S", "info":"order: 2 - TDCL , 3 - TDCR"},
{ "name":"TDC" , "type":"S", "info":"TDC value"},
{ "name":"ToT" , "type":"S", "info":"Time Over Threshold"}
]
},
{
"name" : "RAW::adc",
"group": 20000,
Expand Down
91 changes: 91 additions & 0 deletions etc/bankdefs/hipo4/recoiltof.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
[
{
"name": "RTOF::hits",
"group": 22700,
"item": 21,
"info": "Reconstructed RTOF hits",
"entries": [
{
"name": "id",
"type": "S",
"info": "hit id"
}, {
"name": "sector",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sector, row, and column cab be byte

"type": "B",
"info": "recoil tof sector"
}, {
"name": "layer",
"type": "B",
"info": "recoil tof layer"
},{
"name": "component",
"type": "B",
"info": "recoil tof component"
},{
"name": "time",
"type": "F",
"info": "time in ns"
},{
"name": "x",
"type": "F",
"info": "x position in cm"
}, {
"name": "y",
"type": "F",
"info": "y position in cm"
}, {
"name": "z",
"type": "F",
"info": "z position in cm"
},{
"name": "energy",
"type": "F",
"info": "deposited energy in MeV"
},{
"name": "clusterid",
"type": "S",
"info": "id of cluster to which the hit was associated"
}
]
},{
"name": "RTOF::clusters",
"group": 22700,
"item": 22,
"info": "Clusters in RTOF",
"entries": [
{
"name": "id",
"type": "S",
"info": "hit id"
}, {
"name": "size",
"type": "S",
"info": "number of hits from the bars"
},{
"name": "sector",
"type": "B",
"info": "sector number"
},{
"name": "time",
"type": "F",
"info": "time in ns"
},{
"name": "x",
"type": "F",
"info": "x position in cm"
}, {
"name": "y",
"type": "F",
"info": "y position in cm"
}, {
"name": "z",
"type": "F",
"info": "z position in cm"
},{
"name": "energy",
"type": "F",
"info": "energy in MeV"
}
]
}
]
1 change: 1 addition & 0 deletions reconstruction/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<module>vtx</module>
<module>urwell</module>
<module>alert</module>
<module>rtof</module>
<module>bg</module>
<module>postproc</module>
<module>recoil</module>
Expand Down
40 changes: 40 additions & 0 deletions reconstruction/rtof/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.jlab.clas12.detector</groupId>
<artifactId>clas12detector-rtof</artifactId>
<version>13.4.0-SNAPSHOT</version>
<packaging>jar</packaging>

<parent>
<groupId>org.jlab.clas12</groupId>
<artifactId>reconstruction</artifactId>
<version>13.4.0-SNAPSHOT</version>
</parent>
Comment thread
niwgit marked this conversation as resolved.

<dependencies>

<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-io</artifactId>
<version>13.4.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-reco</artifactId>
<version>13.4.0-SNAPSHOT</version>
</dependency>
Comment thread
niwgit marked this conversation as resolved.
<dependency>
<groupId>org.jlab.clas</groupId>
<artifactId>clas-jcsg</artifactId>
<version>13.4.0-SNAPSHOT</version>
</dependency>



</dependencies>

</project>
Loading