Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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"),
RECOILTOF (27, "RECOILTOF"),
TARGET (100, "TARGET"),
MAGNETS (101, "MAGNETS");

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


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


public class RecoilTOFConstants {

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
}

}


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

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 RecoilTOFGeant4Factory extends Geant4Factory {

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

public RecoilTOFGeant4Factory( DatabaseConstantProvider cp) {
RecoilTOFConstants.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)*(RecoilTOFConstants.RADIUS)*Math.sin(Math.toRadians(RecoilTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RecoilTOFConstants.HORIZONTAL_STARTING_ANGLE));
vCenter.y = 0;
vCenter.z =RecoilTOFConstants.RADIUS*Math.cos(Math.toRadians(RecoilTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RecoilTOFConstants.HORIZONTAL_STARTING_ANGLE));
return vCenter;
}



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

double hlx = RecoilTOFConstants.WIDTH/2+1;
double hly = RecoilTOFConstants.LENGTH/2+1;
double hlz = RecoilTOFConstants.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((RecoilTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RecoilTOFConstants.HORIZONTAL_STARTING_ANGLE)),0,0);
if(isector==1) sectorVolume.rotate("yxz",Math.toRadians(-(RecoilTOFConstants.HORIZONTAL_OPENING_ANGLE/2+RecoilTOFConstants.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 = RecoilTOFConstants.NCOLUMNS;

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

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

double barDZ = RecoilTOFConstants.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 = -(RecoilTOFConstants.LENGTH - RecoilTOFConstants.LONG_BAR_LENGTH)/2; // Starting Y position
double x_spacing = RecoilTOFConstants.BAR_WIDTH;
double x_start = -(RecoilTOFConstants.WIDTH - x_spacing)/2; // starting X position
double dy_long = RecoilTOFConstants.LONG_BAR_LENGTH;
double dy_short = RecoilTOFConstants.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");

RecoilTOFConstants.connect(cp);

RecoilTOFGeant4Factory factory = new RecoilTOFGeant4Factory(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" : "RECOILTOF::tdc",
"group": 22700,
"item" : 12,
"info": "TDC bank for the RECOIL TOF",
"entries":[
{ "name":"sector" , "type":"B", "info":"sector"},
{ "name":"row" , "type":"B", "info":"row"},
{ "name":"column" , "type":"B", "info":"column"},
{ "name":"order" , "type":"B", "info":"order: 2 - TDCL , 3 - TDCR"},
{ "name":"TDC" , "type":"I", "info":"TDC value"},
{ "name":"ToT" , "type":"I", "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": "RECOILTOF::hits",
"group": 22700,
"item": 21,
"info": "Reconstructed RECOILTOF hits",
"entries": [
{
"name": "id",
"type": "S",
"info": "hit id"
}, {
"name": "sector",
"type": "I",
"info": "recoil tof sector"
}, {
"name": "row",
"type": "I",
"info": "recoil tof row"
},{
"name": "column",
"type": "I",
"info": "recoil tof column"
},{
"name": "time",
"type": "F",
"info": "time in ns"
},{
"name": "x",
"type": "F",
"info": "x position in mm"
}, {
"name": "y",
"type": "F",
"info": "y position in mm"
}, {
"name": "z",
"type": "F",
"info": "z position in mm"
},{
"name": "energy",
"type": "F",
"info": "deposited energy in MeV"
},{
"name": "clusterid",
"type": "S",
"info": "id of cluster to which the hit was associated"
}
]
},{
"name": "RECOILTOF::clusters",
"group": 22700,
"item": 22,
"info": "Clusters in RECOILTOF",
"entries": [
{
"name": "id",
"type": "S",
"info": "hit id"
}, {
"name": "N_bar",
"type": "I",
"info": "number of hits from the bars"
},{
"name": "sector",
"type": "I",
"info": "sector number"
},{
"name": "time",
"type": "F",
"info": "time in ns"
},{
"name": "x",
"type": "F",
"info": "x position in mm"
}, {
"name": "y",
"type": "F",
"info": "y position in mm"
}, {
"name": "z",
"type": "F",
"info": "z position in mm"
},{
"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>recoiltof</module>
<module>bg</module>
<module>postproc</module>
<module>recoil</module>
Expand Down
33 changes: 33 additions & 0 deletions reconstruction/recoiltof/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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-recoiltof</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>

<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>

</dependencies>

</project>
Loading