Skip to content
Merged
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
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ reconstruction/rtpc/ @mathieuouillon @Hattawy
reconstruction/swaps/ @baltzell @raffaelladevita
reconstruction/tof/ @zieglerv @raffaelladevita
reconstruction/uber/ @baltzell @raffaelladevita
reconstruction/urwell/ @raffaelladevita @tongtongcao
reconstruction/urwt/ @raffaelladevita @tongtongcao
reconstruction/vtx/ @zieglerv

# etc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class EventMergerConstants {
public static final String[] TDCBANKTYPES = {"tot","tdc"};

public static final String[] ADCDETECTORS = {"BAND","BMT", "BST","CND","CTOF","ECAL","FMT","FTCAL",
"FTHODO","FTOF","FTTRK","HTCC","LTCC","URWELL"};
"FTHODO","FTOF","FTTRK","HTCC","LTCC","URWT"};
public static final String[] TDCDETECTORS = {"BAND","CND","CTOF","DC","ECAL","FTOF"};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public enum DetectorType {
HEL (20, "HEL"),
BAND (21, "BAND"),
RASTER (22, "RASTER"),
URWELL (23, "URWELL"),
URWT (23, "URWT"),
AHDC (24, "AHDC"),
ATOF (25, "ATOF"),
RECOIL (26, "RECOIL"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.jlab.detector.geant4.v2.MPGD.MUVT;

import org.jlab.detector.calib.utils.DatabaseConstantProvider;
import org.jlab.detector.geant4.v2.MPGD.trapezoid.MPGDTrapezoidConstants;

/**
* MUVT-specific constants.
*/
public final class MUVTConstants extends MPGDTrapezoidConstants {

private MUVTConstants() {
super(
"/test/muvt/", // CCDB base path
"muvt_global", // global table name
"muvt_material", // material table name
"muvt" // detector nams
);
}

public MUVTConstants(int run, String variation) {
this();
DatabaseConstantProvider cp = new DatabaseConstantProvider(run, variation);
this.load(cp);
cp.disconnect();
}

public MUVTConstants(DatabaseConstantProvider cp) {
this();
this.load(cp);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package org.jlab.detector.geant4.v2.MPGD.MUVT;

import org.jlab.detector.calib.utils.DatabaseConstantProvider;
import org.jlab.detector.geant4.v2.MPGD.trapezoid.MPGDTrapezoidGeant4Factory;

/**
* Geant4 factory for the muCLAS Forward Vertex Tracker (muVT).
*
* This class specializes the generic
* {@link MPGDTrapezoidGeant4Factory} by:
* - passing the MUVT-specific constants
* - using "MUVT" as detector name in volume names
*
* All the geometry construction (sectors, regions, material stack)
* is implemented in the base class.
*/
public final class MUVTGeant4Factory extends MPGDTrapezoidGeant4Factory {

private final String variation;


public MUVTGeant4Factory(DatabaseConstantProvider cp, String variation) {
super(new MUVTConstants(cp));
this.variation = variation;
}

public MUVTGeant4Factory(int run, String variation) {
super(new MUVTConstants(run, variation));
this.variation = variation;
}


public static void main(String[] args) {

int run = 11;
String variation = "default";

if (args.length > 0) {
try {
run = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
System.err.println("Invalid run number \"" + args[0] + "\", using default 11.");
}
}
if (args.length > 1) {
variation = args[1];
}

MUVTGeant4Factory factory = new MUVTGeant4Factory(run, variation);

System.out.println("MUVT geometry for run " + run + " (variation=\"" + variation + "\")");
System.out.println("Total volumes: " + factory.getAllVolumes().size());

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


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

import org.jlab.detector.calib.utils.DatabaseConstantProvider;
import org.jlab.detector.geant4.v2.MPGD.trapezoid.MPGDTrapezoidStripFactory;
import org.jlab.detector.volume.Geant4Basic;

import java.util.HashMap;
import java.util.Map;

/**
* MUVT strip factory.
*
* It relies entirely on AbstractMPGDTrapezoidStripFactory for:
* - strip building (component IDs, endpoints)
* - surfaces
* - planes
*
* The ONLY detector-specific thing here is the mapping "volume name -> Geant4Basic",
* used by the abstract class to find the sensitive volume (Sensitivity==1) and its transform.
*/
public final class MUVTStripFactory extends MPGDTrapezoidStripFactory {

private final Map<String, Geant4Basic> volumeByName = new HashMap<>();

/**
* Build using an already-configured DatabaseConstantProvider.
*/
public MUVTStripFactory(DatabaseConstantProvider cp, String variation) {
super(new MUVTConstants(cp));


for (Geant4Basic v : geo.getAllVolumes()) {
if (v.getName() != null) {
volumeByName.put(v.getName(), v);
}
}

buildAll();
}


/**
* Convenience constructor: internally creates a DatabaseConstantProvider.
* @param run
* @param variation
*/
public MUVTStripFactory(int run, String variation) {
super(new MUVTConstants(run, variation));

for (Geant4Basic v : geo.getAllVolumes()) {
if (v.getName() != null) {
volumeByName.put(v.getName(), v);
}
}

buildAll();
}

@Override
protected Geant4Basic getVolumeByName(String name) {
return volumeByName.get(name);
}


@Override
protected boolean is2DReadout() {
// change to true if your MUVT readout is truly 2D
return true;
}

/**
* Small test / debug.
*/
public static void main(String[] args) {

int run = 11;
String variation = "default";

if (args.length > 0) {
try { run = Integer.parseInt(args[0]); } catch (Exception ignored) {}
}
if (args.length > 1) variation = args[1];

MUVTStripFactory sf = new MUVTStripFactory(run, variation);

int sector = 2;
int layer = 12;

System.out.println("MUVT strips: sector=" + sector + " layer=" + layer
+ " nComponents=" + sf.getNComponents(sector, layer));

// print first strip global/local/tilted
int comp = 10;
System.out.println("Global strip(1): " + sf.getStrip(sector, layer, comp));
System.out.println("Local strip(1): " + sf.getStripLocal(sector, layer, comp));
System.out.println("Tilted strip(1): " + sf.getStripTilted(sector, layer, comp));

System.out.println("Plane: " + sf.getPlane(sector, layer));
System.out.println("Surface: " + sf.getSurface(sector, layer));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.jlab.detector.geant4.v2.MPGD.URWT;

import org.jlab.detector.calib.utils.DatabaseConstantProvider;
import org.jlab.detector.geant4.v2.MPGD.trapezoid.MPGDTrapezoidConstants;

/**
* URWT-specific constants.
*/
public final class URWTConstants extends MPGDTrapezoidConstants {

private URWTConstants() {
super(
"/test/urwt/", // CCDB base path
"urwt_global", // global table name
"urwt_material", // material table name
"urwt" // detector nams
);
}

public URWTConstants(int run, String variation) {
this();
DatabaseConstantProvider cp = new DatabaseConstantProvider(run, variation);
this.load(cp);
cp.disconnect();
}

public URWTConstants(DatabaseConstantProvider cp) {
this();
this.load(cp);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package org.jlab.detector.geant4.v2.MPGD.URWT;

import org.jlab.detector.calib.utils.DatabaseConstantProvider;
import org.jlab.detector.geant4.v2.MPGD.trapezoid.MPGDTrapezoidGeant4Factory;

/**
* Geant4 factory for the uRWell Tracker (URWT).
*
* This class specializes the generic {@link MPGDTrapezoidGeant4Factory}
* by: - passing the URWT-specific constants - using "uRWT" as detector name in
* volume names
*
* All the geometry construction (sectors, regions, material stack) is
* implemented in the base class.
*/
public final class URWTGeant4Factory extends MPGDTrapezoidGeant4Factory {

private final String variation;

public URWTGeant4Factory(DatabaseConstantProvider cp, String variation) {
super(new URWTConstants(cp));
this.variation = variation;
}

public URWTGeant4Factory(int run, String variation) {
super(new URWTConstants(run, variation));
this.variation = variation;
}

/**
*
* @param region
* @return
*/
@Override
public SectorDimensions getSectorActiveVolumeDimensions(int region) {

if (variation != null && variation.toLowerCase().contains("proto")) {

double halfThickness = this.getSectorThickness() / 2.0;
double tiltRad = Math.toRadians(C.THTILT);

// da vertici (mm)
double halfLargeBase = 72.71785;
double halfSmallBase = 50.44350;
double halfHeight = 24.74554;

return new SectorDimensions(halfThickness, halfHeight, halfLargeBase, halfSmallBase, tiltRad);
}

return super.getSectorActiveVolumeDimensions(region);
}

/**
* Standalone test: builds the URWT geometry and prints all volumes in GEMC
* format.
*
* Usage: java org.jlab.detector.geant4.v2.URWT.URWTGeant4Factory [run]
* [variation]
*
* Defaults: run = 11 variation = "default"
*/
public static void main(String[] args) {

int run = 11;
String variation = "default";

if (args.length > 0) {
try {
run = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
System.err.println("Invalid run number \"" + args[0] + "\", using default 11.");
}
}
if (args.length > 1) {
variation = args[1];
}

URWTGeant4Factory factory = new URWTGeant4Factory(run, variation);

System.out.println("uRWT geometry for run " + run + " (variation=\"" + variation + "\")");
System.out.println("Total volumes: " + factory.getAllVolumes().size());

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