From ff85fe9e858e7b6460c2bd369a8b7c5a4a0aee94 Mon Sep 17 00:00:00 2001 From: raffaelladevita Date: Thu, 22 Feb 2024 19:38:06 -0500 Subject: [PATCH] =?UTF-8?q?fixed=20bug=20in=20uRwell=20strip=20factory=20c?= =?UTF-8?q?ausing=20R2=20strips=20not=20being=20created=E2=80=A6=20(#188)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- .../geant4/v2/URWELL/URWellStripFactory.java | 2 +- etc/bankdefs/hipo4/urwell.json | 28 +++++++++---------- .../jlab/service/urwell/URWellConstants.java | 3 +- .../org/jlab/service/urwell/URWellCross.java | 12 ++++++-- .../org/jlab/service/urwell/URWellEngine.java | 5 ++-- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/URWELL/URWellStripFactory.java b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/URWELL/URWellStripFactory.java index 32683bf98..a7ec2edb5 100644 --- a/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/URWELL/URWellStripFactory.java +++ b/common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/URWELL/URWellStripFactory.java @@ -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; diff --git a/etc/bankdefs/hipo4/urwell.json b/etc/bankdefs/hipo4/urwell.json index 63932105f..0981d24a0 100644 --- a/etc/bankdefs/hipo4/urwell.json +++ b/etc/bankdefs/hipo4/urwell.json @@ -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"} ] @@ -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)"}, @@ -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"} diff --git a/reconstruction/urwell/src/main/java/org/jlab/service/urwell/URWellConstants.java b/reconstruction/urwell/src/main/java/org/jlab/service/urwell/URWellConstants.java index 4c7ac644f..732c923fb 100644 --- a/reconstruction/urwell/src/main/java/org/jlab/service/urwell/URWellConstants.java +++ b/reconstruction/urwell/src/main/java/org/jlab/service/urwell/URWellConstants.java @@ -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 diff --git a/reconstruction/urwell/src/main/java/org/jlab/service/urwell/URWellCross.java b/reconstruction/urwell/src/main/java/org/jlab/service/urwell/URWellCross.java index fb0189c8d..90fa1d2c4 100644 --- a/reconstruction/urwell/src/main/java/org/jlab/service/urwell/URWellCross.java +++ b/reconstruction/urwell/src/main/java/org/jlab/service/urwell/URWellCross.java @@ -15,6 +15,7 @@ public class URWellCross { private int id; private int sector; + private int region; private int chamber; private int cluster1; @@ -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; @@ -55,6 +57,10 @@ public int getSector() { return this.sector; } + public int getRegion() { + return this.region; + } + public int getChamber() { return this.chamber; } @@ -88,9 +94,9 @@ public static List createCrosses(List clusters) { List crosses = new ArrayList<>(); for(int is=0; is clustersV = URWellCluster.getClusters(clusters, is+1, il+1); - List clustersW = URWellCluster.getClusters(clusters, is+1, il+2); + for(int ir=0; ir clustersV = URWellCluster.getClusters(clusters, is+1, (URWellConstants.NLAYER/URWellConstants.NREGION)*ir+1); + List clustersW = URWellCluster.getClusters(clusters, is+1, (URWellConstants.NLAYER/URWellConstants.NREGION)*ir+2); for(URWellCluster v : clustersV) { for(URWellCluster w : clustersW) { diff --git a/reconstruction/urwell/src/main/java/org/jlab/service/urwell/URWellEngine.java b/reconstruction/urwell/src/main/java/org/jlab/service/urwell/URWellEngine.java index 15a338c75..fcb53c5ad 100644 --- a/reconstruction/urwell/src/main/java/org/jlab/service/urwell/URWellEngine.java +++ b/reconstruction/urwell/src/main/java/org/jlab/service/urwell/URWellEngine.java @@ -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"); @@ -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()); @@ -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());