Skip to content

Commit 6ab288d

Browse files
raffaelladevitaMariangela Bondí
andauthored
integrate urwell geometry (#1095)
* new MUVT and URWT geometry * propating changes through common tools, reconstruction, and schemas * some refactoring * some refactoring * some refactoring * code cleanup and simplification --------- Co-authored-by: Mariangela Bondí <mariangelabondi@Mariangelas-MacBook-Pro-10.local>
1 parent 24e2dba commit 6ab288d

25 files changed

Lines changed: 1769 additions & 1129 deletions

File tree

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ reconstruction/rtpc/ @mathieuouillon @Hattawy
8888
reconstruction/swaps/ @baltzell @raffaelladevita
8989
reconstruction/tof/ @zieglerv @raffaelladevita
9090
reconstruction/uber/ @baltzell @raffaelladevita
91-
reconstruction/urwell/ @raffaelladevita @tongtongcao
91+
reconstruction/urwt/ @raffaelladevita @tongtongcao
9292
reconstruction/vtx/ @zieglerv
9393

9494
# etc

common-tools/clas-analysis/src/main/java/org/jlab/analysis/eventmerger/EventMergerConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class EventMergerConstants {
3636
public static final String[] TDCBANKTYPES = {"tot","tdc"};
3737

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

4242

common-tools/clas-detector/src/main/java/org/jlab/detector/base/DetectorType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public enum DetectorType {
3030
HEL (20, "HEL"),
3131
BAND (21, "BAND"),
3232
RASTER (22, "RASTER"),
33-
URWELL (23, "URWELL"),
33+
URWT (23, "URWT"),
3434
AHDC (24, "AHDC"),
3535
ATOF (25, "ATOF"),
3636
RECOIL (26, "RECOIL"),
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.jlab.detector.geant4.v2.MPGD.MUVT;
2+
3+
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
4+
import org.jlab.detector.geant4.v2.MPGD.trapezoid.MPGDTrapezoidConstants;
5+
6+
/**
7+
* MUVT-specific constants.
8+
*/
9+
public final class MUVTConstants extends MPGDTrapezoidConstants {
10+
11+
private MUVTConstants() {
12+
super(
13+
"/test/muvt/", // CCDB base path
14+
"muvt_global", // global table name
15+
"muvt_material", // material table name
16+
"muvt" // detector nams
17+
);
18+
}
19+
20+
public MUVTConstants(int run, String variation) {
21+
this();
22+
DatabaseConstantProvider cp = new DatabaseConstantProvider(run, variation);
23+
this.load(cp);
24+
cp.disconnect();
25+
}
26+
27+
public MUVTConstants(DatabaseConstantProvider cp) {
28+
this();
29+
this.load(cp);
30+
}
31+
32+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package org.jlab.detector.geant4.v2.MPGD.MUVT;
2+
3+
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
4+
import org.jlab.detector.geant4.v2.MPGD.trapezoid.MPGDTrapezoidGeant4Factory;
5+
6+
/**
7+
* Geant4 factory for the muCLAS Forward Vertex Tracker (muVT).
8+
*
9+
* This class specializes the generic
10+
* {@link MPGDTrapezoidGeant4Factory} by:
11+
* - passing the MUVT-specific constants
12+
* - using "MUVT" as detector name in volume names
13+
*
14+
* All the geometry construction (sectors, regions, material stack)
15+
* is implemented in the base class.
16+
*/
17+
public final class MUVTGeant4Factory extends MPGDTrapezoidGeant4Factory {
18+
19+
private final String variation;
20+
21+
22+
public MUVTGeant4Factory(DatabaseConstantProvider cp, String variation) {
23+
super(new MUVTConstants(cp));
24+
this.variation = variation;
25+
}
26+
27+
public MUVTGeant4Factory(int run, String variation) {
28+
super(new MUVTConstants(run, variation));
29+
this.variation = variation;
30+
}
31+
32+
33+
public static void main(String[] args) {
34+
35+
int run = 11;
36+
String variation = "default";
37+
38+
if (args.length > 0) {
39+
try {
40+
run = Integer.parseInt(args[0]);
41+
} catch (NumberFormatException e) {
42+
System.err.println("Invalid run number \"" + args[0] + "\", using default 11.");
43+
}
44+
}
45+
if (args.length > 1) {
46+
variation = args[1];
47+
}
48+
49+
MUVTGeant4Factory factory = new MUVTGeant4Factory(run, variation);
50+
51+
System.out.println("MUVT geometry for run " + run + " (variation=\"" + variation + "\")");
52+
System.out.println("Total volumes: " + factory.getAllVolumes().size());
53+
54+
factory.getAllVolumes().forEach(volume -> {
55+
System.out.println(volume.gemcString());
56+
});
57+
}
58+
}
59+
60+
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
package org.jlab.detector.geant4.v2.MPGD.MUVT;
2+
3+
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
4+
import org.jlab.detector.geant4.v2.MPGD.trapezoid.MPGDTrapezoidStripFactory;
5+
import org.jlab.detector.volume.Geant4Basic;
6+
7+
import java.util.HashMap;
8+
import java.util.Map;
9+
10+
/**
11+
* MUVT strip factory.
12+
*
13+
* It relies entirely on AbstractMPGDTrapezoidStripFactory for:
14+
* - strip building (component IDs, endpoints)
15+
* - surfaces
16+
* - planes
17+
*
18+
* The ONLY detector-specific thing here is the mapping "volume name -> Geant4Basic",
19+
* used by the abstract class to find the sensitive volume (Sensitivity==1) and its transform.
20+
*/
21+
public final class MUVTStripFactory extends MPGDTrapezoidStripFactory {
22+
23+
private final Map<String, Geant4Basic> volumeByName = new HashMap<>();
24+
25+
/**
26+
* Build using an already-configured DatabaseConstantProvider.
27+
*/
28+
public MUVTStripFactory(DatabaseConstantProvider cp, String variation) {
29+
super(new MUVTConstants(cp));
30+
31+
32+
for (Geant4Basic v : geo.getAllVolumes()) {
33+
if (v.getName() != null) {
34+
volumeByName.put(v.getName(), v);
35+
}
36+
}
37+
38+
buildAll();
39+
}
40+
41+
42+
/**
43+
* Convenience constructor: internally creates a DatabaseConstantProvider.
44+
* @param run
45+
* @param variation
46+
*/
47+
public MUVTStripFactory(int run, String variation) {
48+
super(new MUVTConstants(run, variation));
49+
50+
for (Geant4Basic v : geo.getAllVolumes()) {
51+
if (v.getName() != null) {
52+
volumeByName.put(v.getName(), v);
53+
}
54+
}
55+
56+
buildAll();
57+
}
58+
59+
@Override
60+
protected Geant4Basic getVolumeByName(String name) {
61+
return volumeByName.get(name);
62+
}
63+
64+
65+
@Override
66+
protected boolean is2DReadout() {
67+
// change to true if your MUVT readout is truly 2D
68+
return true;
69+
}
70+
71+
/**
72+
* Small test / debug.
73+
*/
74+
public static void main(String[] args) {
75+
76+
int run = 11;
77+
String variation = "default";
78+
79+
if (args.length > 0) {
80+
try { run = Integer.parseInt(args[0]); } catch (Exception ignored) {}
81+
}
82+
if (args.length > 1) variation = args[1];
83+
84+
MUVTStripFactory sf = new MUVTStripFactory(run, variation);
85+
86+
int sector = 2;
87+
int layer = 12;
88+
89+
System.out.println("MUVT strips: sector=" + sector + " layer=" + layer
90+
+ " nComponents=" + sf.getNComponents(sector, layer));
91+
92+
// print first strip global/local/tilted
93+
int comp = 10;
94+
System.out.println("Global strip(1): " + sf.getStrip(sector, layer, comp));
95+
System.out.println("Local strip(1): " + sf.getStripLocal(sector, layer, comp));
96+
System.out.println("Tilted strip(1): " + sf.getStripTilted(sector, layer, comp));
97+
98+
System.out.println("Plane: " + sf.getPlane(sector, layer));
99+
System.out.println("Surface: " + sf.getSurface(sector, layer));
100+
}
101+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package org.jlab.detector.geant4.v2.MPGD.URWT;
2+
3+
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
4+
import org.jlab.detector.geant4.v2.MPGD.trapezoid.MPGDTrapezoidConstants;
5+
6+
/**
7+
* URWT-specific constants.
8+
*/
9+
public final class URWTConstants extends MPGDTrapezoidConstants {
10+
11+
private URWTConstants() {
12+
super(
13+
"/test/urwt/", // CCDB base path
14+
"urwt_global", // global table name
15+
"urwt_material", // material table name
16+
"urwt" // detector nams
17+
);
18+
}
19+
20+
public URWTConstants(int run, String variation) {
21+
this();
22+
DatabaseConstantProvider cp = new DatabaseConstantProvider(run, variation);
23+
this.load(cp);
24+
cp.disconnect();
25+
}
26+
27+
public URWTConstants(DatabaseConstantProvider cp) {
28+
this();
29+
this.load(cp);
30+
}
31+
32+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package org.jlab.detector.geant4.v2.MPGD.URWT;
2+
3+
import org.jlab.detector.calib.utils.DatabaseConstantProvider;
4+
import org.jlab.detector.geant4.v2.MPGD.trapezoid.MPGDTrapezoidGeant4Factory;
5+
6+
/**
7+
* Geant4 factory for the uRWell Tracker (URWT).
8+
*
9+
* This class specializes the generic {@link MPGDTrapezoidGeant4Factory}
10+
* by: - passing the URWT-specific constants - using "uRWT" as detector name in
11+
* volume names
12+
*
13+
* All the geometry construction (sectors, regions, material stack) is
14+
* implemented in the base class.
15+
*/
16+
public final class URWTGeant4Factory extends MPGDTrapezoidGeant4Factory {
17+
18+
private final String variation;
19+
20+
public URWTGeant4Factory(DatabaseConstantProvider cp, String variation) {
21+
super(new URWTConstants(cp));
22+
this.variation = variation;
23+
}
24+
25+
public URWTGeant4Factory(int run, String variation) {
26+
super(new URWTConstants(run, variation));
27+
this.variation = variation;
28+
}
29+
30+
/**
31+
*
32+
* @param region
33+
* @return
34+
*/
35+
@Override
36+
public SectorDimensions getSectorActiveVolumeDimensions(int region) {
37+
38+
if (variation != null && variation.toLowerCase().contains("proto")) {
39+
40+
double halfThickness = this.getSectorThickness() / 2.0;
41+
double tiltRad = Math.toRadians(C.THTILT);
42+
43+
// da vertici (mm)
44+
double halfLargeBase = 72.71785;
45+
double halfSmallBase = 50.44350;
46+
double halfHeight = 24.74554;
47+
48+
return new SectorDimensions(halfThickness, halfHeight, halfLargeBase, halfSmallBase, tiltRad);
49+
}
50+
51+
return super.getSectorActiveVolumeDimensions(region);
52+
}
53+
54+
/**
55+
* Standalone test: builds the URWT geometry and prints all volumes in GEMC
56+
* format.
57+
*
58+
* Usage: java org.jlab.detector.geant4.v2.URWT.URWTGeant4Factory [run]
59+
* [variation]
60+
*
61+
* Defaults: run = 11 variation = "default"
62+
*/
63+
public static void main(String[] args) {
64+
65+
int run = 11;
66+
String variation = "default";
67+
68+
if (args.length > 0) {
69+
try {
70+
run = Integer.parseInt(args[0]);
71+
} catch (NumberFormatException e) {
72+
System.err.println("Invalid run number \"" + args[0] + "\", using default 11.");
73+
}
74+
}
75+
if (args.length > 1) {
76+
variation = args[1];
77+
}
78+
79+
URWTGeant4Factory factory = new URWTGeant4Factory(run, variation);
80+
81+
System.out.println("uRWT geometry for run " + run + " (variation=\"" + variation + "\")");
82+
System.out.println("Total volumes: " + factory.getAllVolumes().size());
83+
84+
factory.getAllVolumes().forEach(volume -> {
85+
System.out.println(volume.gemcString());
86+
});
87+
}
88+
}

0 commit comments

Comments
 (0)