Skip to content

Commit

Permalink
fixed bug in uRwell strip factory causing R2 strips not being created… (
Browse files Browse the repository at this point in the history
#188)

* fixed bug in uRwell strip factory causing R2 strips not being created when the 2 region configuration was selected, changed uRWell service to always load the 2 region configuration

* setting number of layers/regions to maximum allowed

* bug fixes to cross making for 2-regions configuration and banks
  • Loading branch information
raffaelladevita authored Feb 23, 2024
1 parent a657b30 commit ff85fe9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void init(DatabaseConstantProvider cp, boolean prototype, int regions) {
factory = new URWellGeant4Factory(cp, prototype, regions);
isProto = prototype;
if(!isProto){
nRegions = URWellConstants.NREGIONS;
nRegions = Math.min(URWellConstants.NMAXREGIONS, regions);
nSectors = URWellConstants.NSECTORS;
nChambers = URWellConstants.NCHAMBERS;
nLayers = URWellConstants.NLAYERS;
Expand Down
28 changes: 14 additions & 14 deletions etc/bankdefs/hipo4/urwell.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"entries": [
{"name":"id", "type":"S", "info":"id of the hit"},
{"name":"sector", "type":"B", "info":"sector of URWELL"},
{"name":"layer", "type":"B", "info":"Layer of URWELL (1-3:PCAL, 4-6:ECIN, 7-9:ECOUT"},
{"name":"strip", "type":"S", "info":"Strip number"},
{"name":"energy", "type":"F", "info":"Energy of the hit (eV)"},
{"name":"time", "type":"F", "info":"Time of the hit (ns)"},
{"name":"layer", "type":"B", "info":"layer of URWELL (1-3:PCAL, 4-6:ECIN, 7-9:ECOUT"},
{"name":"strip", "type":"S", "info":"strip number"},
{"name":"energy", "type":"F", "info":"energy of the hit (eV)"},
{"name":"time", "type":"F", "info":"time of the hit (ns)"},
{"name":"clusterId", "type":"S", "info":"id of the cluster the hit belongs to"},
{"name":"status", "type":"S", "info":"status of the hit"}
]
Expand All @@ -23,10 +23,10 @@
"entries": [
{"name":"id", "type":"S", "info":"id of the cluster"},
{"name":"sector", "type":"B", "info":"sector of URWELL"},
{"name":"layer", "type":"B", "info":"Layer of URWELL"},
{"name":"strip", "type":"S", "info":"Seed strip"},
{"name":"energy", "type":"F", "info":"Energy of the cluster (eV)"},
{"name":"time", "type":"F", "info":"Time of the cluster (ns)"},
{"name":"layer", "type":"B", "info":"layer of URWELL"},
{"name":"strip", "type":"S", "info":"seed strip"},
{"name":"energy", "type":"F", "info":"energy of the cluster (eV)"},
{"name":"time", "type":"F", "info":"time of the cluster (ns)"},
{"name":"xo", "type":"F", "info":"strip origin X coordinate (cm)"},
{"name":"yo", "type":"F", "info":"strip origin Y coordinate (cm)"},
{"name":"zo", "type":"F", "info":"strip origin Z coordinate (cm)"},
Expand All @@ -45,12 +45,12 @@
"entries": [
{"name":"id", "type":"S", "info":"id of the cross"},
{"name":"sector", "type":"B", "info":"sector of URWELL"},
{"name":"layer", "type":"B", "info":"Layer of URWELL"},
{"name":"energy", "type":"F", "info":"Energy of the cross (eV)"},
{"name":"time", "type":"F", "info":"Time of the cross (ns)"},
{"name":"x", "type":"F", "info":"X coordinate (cm)"},
{"name":"y", "type":"F", "info":"Y coordinate (cm)"},
{"name":"z", "type":"F", "info":"Z coordinate (cm)"},
{"name":"region", "type":"B", "info":"region of URWELL"},
{"name":"energy", "type":"F", "info":"energy of the cross (eV)"},
{"name":"time", "type":"F", "info":"time of the cross (ns)"},
{"name":"x", "type":"F", "info":"x coordinate (cm)"},
{"name":"y", "type":"F", "info":"y coordinate (cm)"},
{"name":"z", "type":"F", "info":"z coordinate (cm)"},
{"name":"cluster1", "type":"S", "info":"id of the cluster in the V layer"},
{"name":"cluster2", "type":"S", "info":"id of the cluster in the W layer"},
{"name":"status", "type":"S", "info":"status of the cluster"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public class URWellConstants {

// geometry
public final static int NSECTOR = 6;
public final static int NLAYER = 2;
public final static int NLAYER = 4;
public final static int NREGION = 2;
public final static int NCHAMBER = 3;
public final static int[] NSTRIPS = { 542, 628, 714}; // number of strips for the three chambers
public final static int[] STRIPMIN = { 1, 543, 1171}; // lower strip number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class URWellCross {
private int id;

private int sector;
private int region;
private int chamber;

private int cluster1;
Expand All @@ -35,6 +36,7 @@ public URWellCross(URWellCluster c1, URWellCluster c2) {
int nint = plane.intersectionSegment(c2.getLine(), point);
if(nint==1) {
this.sector = c1.getSector();
this.region = (c1.getLayer()-1)/(URWellConstants.NLAYER/URWellConstants.NREGION)+1;
this.cross = point;
this.energy = c1.getEnergy() + c2.getEnergy();
this.time = (c1.getTime() + c2.getTime())/2;
Expand All @@ -55,6 +57,10 @@ public int getSector() {
return this.sector;
}

public int getRegion() {
return this.region;
}

public int getChamber() {
return this.chamber;
}
Expand Down Expand Up @@ -88,9 +94,9 @@ public static List<URWellCross> createCrosses(List<URWellCluster> clusters) {
List<URWellCross> crosses = new ArrayList<>();

for(int is=0; is<URWellConstants.NSECTOR; is++) {
for(int il=0; il<URWellConstants.NLAYER/2; il++) {
List<URWellCluster> clustersV = URWellCluster.getClusters(clusters, is+1, il+1);
List<URWellCluster> clustersW = URWellCluster.getClusters(clusters, is+1, il+2);
for(int ir=0; ir<URWellConstants.NREGION; ir++) {
List<URWellCluster> clustersV = URWellCluster.getClusters(clusters, is+1, (URWellConstants.NLAYER/URWellConstants.NREGION)*ir+1);
List<URWellCluster> clustersW = URWellCluster.getClusters(clusters, is+1, (URWellConstants.NLAYER/URWellConstants.NREGION)*ir+2);

for(URWellCluster v : clustersV) {
for(URWellCluster w : clustersW) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public boolean init() {
// init ConstantsManager to read constants from CCDB
String variationName = Optional.ofNullable(this.getEngineConfigString("variation")).orElse("default");
DatabaseConstantProvider cp = new DatabaseConstantProvider(11, variationName);
factory.init(cp);
factory.init(cp, false, URWellConstants.NREGION);
// register output banks for drop option
this.registerOutputBank("URWELL::hits");
this.registerOutputBank("URWELL::clusters");
Expand Down Expand Up @@ -86,7 +86,7 @@ private void writeHipoBanks(DataEvent de,

DataBank bankC = de.createBank("URWELL::clusters", clusters.size());
for(int c = 0; c < clusters.size(); c++){
bankS.setShort("id", c, (short) clusters.get(c).getId());
bankC.setShort("id", c, (short) clusters.get(c).getId());
bankC.setByte("sector", c, (byte) clusters.get(c).get(0).getDescriptor().getSector());
bankC.setByte("layer", c, (byte) clusters.get(c).get(0).getDescriptor().getLayer());
bankC.setShort("strip", c, (short) clusters.get(c).getMaxStrip());
Expand All @@ -106,6 +106,7 @@ private void writeHipoBanks(DataEvent de,
for(int c = 0; c < crosses.size(); c++){
bankX.setShort("id", c, (short) crosses.get(c).getId());
bankX.setByte("sector", c, (byte) crosses.get(c).getSector());
bankX.setByte("region", c, (byte) crosses.get(c).getRegion());
bankX.setFloat("energy", c, (float) crosses.get(c).getEnergy());
bankX.setFloat("time", c, (float) crosses.get(c).getTime());
bankX.setFloat("x", c, (float) crosses.get(c).point().x());
Expand Down

0 comments on commit ff85fe9

Please sign in to comment.