Skip to content

Commit 8529bc5

Browse files
authored
Merge branch 'development' into cd_denoising_redux
2 parents 6ea23d6 + 047f594 commit 8529bc5

8 files changed

Lines changed: 243 additions & 54 deletions

File tree

‎common-tools/clas-jcsg/src/main/java/org/jlab/detector/geant4/v2/MUCALGeant4Factory.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import java.util.ArrayList;
55
import org.jlab.detector.volume.Geant4Basic;
66
import org.jlab.detector.units.SystemOfUnits.Length;
7-
import org.jlab.detector.volume.G4Pgon;
7+
import org.jlab.detector.volume.G4Pcone;
88
import org.jlab.detector.volume.G4Trd;
99
import org.jlab.detector.volume.G4World;
1010
import org.jlab.geom.base.ConstantProvider;
@@ -24,7 +24,7 @@ public MUCALGeant4Factory(ConstantProvider provider) {
2424
double[] mucal_iradius = {301.0*Length.mm, 72.8*Length.mm, 81.5*Length.mm, 98.7*Length.mm};
2525
double[] mucal_oradius = {301.1*Length.mm, 360.6*Length.mm, 401.0*Length.mm, 98.8*Length.mm};
2626
double[] mucal_zpos_root = {520.0*Length.mm, 625.0*Length.mm, 696.0*Length.mm, 836.0*Length.mm};
27-
G4Pgon mucalVolume = new G4Pgon("mucalVolume", phiStart, phiTotal, nplanes, nplanes, mucal_zpos_root, mucal_iradius, mucal_oradius);
27+
G4Pcone mucalVolume = new G4Pcone("mucalVolume", phiStart, phiTotal, nplanes, mucal_zpos_root, mucal_iradius, mucal_oradius);
2828
mucalVolume.setMother(motherVolume);
2929
for (int sector = 1; sector <= 2; sector++) {
3030
List<G4Trd> layerVolume = createPanel(provider, sector, 1);
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package org.jlab.detector.volume;
2+
3+
import org.jlab.geometry.prim.Pcone;
4+
import org.jlab.detector.units.Measurement;
5+
import org.jlab.detector.units.SystemOfUnits.Angle;
6+
import org.jlab.detector.units.SystemOfUnits.Length;
7+
8+
/**
9+
* @author pdavies/devita
10+
*/
11+
// FIXME: currently support only polyheadra defintion to gemc geometry
12+
public class G4Pcone extends Geant4Basic {
13+
14+
public G4Pcone(String name, double phiStart, double phiTotal, int numZPlanes,
15+
double[] zPlane, double[] rInner, double[] rOuter ) {
16+
17+
super( new Pcone(phiStart, phiTotal, numZPlanes, zPlane, rInner, rOuter));
18+
setName( name );
19+
setType("Polycone");
20+
21+
Measurement[] dimensions = new Measurement[3+3*numZPlanes];
22+
dimensions[0] = Angle.value(phiStart);
23+
dimensions[1] = Angle.value(phiTotal);
24+
dimensions[2] = new Measurement(numZPlanes,"counts");
25+
for(int i=0; i<numZPlanes; i++) dimensions[3+0*numZPlanes+i] = Length.value(rInner[i]);
26+
for(int i=0; i<numZPlanes; i++) dimensions[3+1*numZPlanes+i] = Length.value(rOuter[i]);
27+
for(int i=0; i<numZPlanes; i++) dimensions[3+2*numZPlanes+i] = Length.value(zPlane[i]);
28+
setDimensions(dimensions);
29+
}
30+
31+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package org.jlab.geometry.prim;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
import eu.mihosoft.vrl.v3d.Polygon;
6+
import eu.mihosoft.vrl.v3d.Primitive;
7+
import eu.mihosoft.vrl.v3d.PropertyStorage;
8+
9+
/**
10+
* @author pdavies/devita
11+
*/
12+
13+
// FIXME: currently support only polyheadra defintion to gemc geometry
14+
public class Pcone implements Primitive {
15+
16+
private final PropertyStorage properties = new PropertyStorage();
17+
private int numZPlanes;
18+
private double phiStart, phiTotal;
19+
double[] zPlane;
20+
double[] rInner;
21+
double[] rOuter;
22+
23+
public Pcone(double phiStart,
24+
double phiTotal,
25+
int numZPlanes,
26+
double[] zPlane,
27+
double[] rInner,
28+
double[] rOuter)
29+
{
30+
if( numZPlanes < 0 || phiStart < 0 || phiTotal <= 0 ) {
31+
throw new IllegalArgumentException("Illegal arguments for Polyhedra Primitive!");
32+
}
33+
if( zPlane.length<2 || rInner.length<2 || rOuter.length<2) {
34+
throw new IllegalArgumentException("Illegal arguments for Polyhedra Primitive!");
35+
}
36+
if( zPlane.length!=rInner.length || zPlane.length!=rOuter.length) {
37+
throw new IllegalArgumentException("Illegal arguments for Polyhedra Primitive!");
38+
}
39+
40+
this.phiStart = phiStart;
41+
this.phiTotal = phiTotal;
42+
this.zPlane = zPlane;
43+
this.rInner = rInner;
44+
this.rOuter = rOuter;
45+
}
46+
47+
@Override
48+
public List<Polygon> toPolygons()
49+
{
50+
List<Polygon> polygons = new ArrayList<>();
51+
// just returns something to not cause a NullPointerException
52+
return polygons;
53+
}
54+
55+
@Override
56+
public PropertyStorage getProperties()
57+
{
58+
return null;
59+
}
60+
61+
}

‎pom.xml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
</modules>
2020

2121
<repositories>
22+
<repository>
23+
<id>clas12-hipo-java</id> <!-- `jnp-hipo4` is now built and published from its own repository, https://code.jlab.org/hallb/clas12/hipo-java. Project 919's package registry is public -->
24+
<url>https://code.jlab.org/api/v4/projects/919/packages/maven</url>
25+
</repository>
2226
<repository>
2327
<id>clas12maven</id>
2428
<url>https://clasweb.jlab.org/.clas12maven</url>
@@ -168,7 +172,7 @@
168172
<dependency>
169173
<groupId>org.jlab.jnp</groupId>
170174
<artifactId>jnp-hipo4</artifactId>
171-
<version>4.3-SNAPSHOT</version> <!-- WARNING: if changed, check the `net.objecthunter:exp4j` version; see `docs/dependency_conflicts.md` -->
175+
<version>4.5</version> <!-- from code.jlab.org/hallb/clas12/hipo-java; WARNING: if changed, check the `net.objecthunter:exp4j` version; see `docs/dependency_conflicts.md` -->
172176
</dependency>
173177

174178
<dependency>
@@ -216,7 +220,7 @@
216220
- see `docs/dependency_conflicts.md` for more info
217221
-->
218222

219-
<!-- resolve conflict between `org.jlab.jnp:jnp-hipo:jar:2.0-SNAPSHOT` and `org.jlab.jnp:jnp-hipo4:jar:4.3-SNAPSHOT`
223+
<!-- resolve conflict between `org.jlab.jnp:jnp-hipo:jar:2.0-SNAPSHOT` and `org.jlab.jnp:jnp-hipo4:jar:4.5`
220224
by choosing the later version of their `net.objecthunter:exp4j` dependency -->
221225
<dependency>
222226
<groupId>net.objecthunter</groupId>

‎reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHBankBuilder.java‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ public RICHBankBuilder() {
2020
}
2121
@Override
2222
public boolean isGoodEvent(DataEvent event) {
23+
24+
DataBank part = event.getBank("REC::Particle");
2325

24-
DataBank part = event.getBank("REC::Particle");
25-
if(part.rows()<1 ||
26+
if(part.rows()<1 ||
2627
part.getInt("pid", 0)!=11 ||
2728
((int) (Math.abs(part.getShort("status", 0))/1000))!=2)
2829
return false;
@@ -37,7 +38,8 @@ public DataBank buildCalibBank(DataEvent event) {
3738
DataBank hits = event.getBank("RICH::Hit");
3839
DataBank clus = event.getBank("RICH::Cluster");
3940
DataBank phos = event.getBank("RICH::Photon");
40-
41+
42+
4143
List<Integer> goodPhotons = new ArrayList<>();
4244
for(int i=0; i<phos.rows(); i++) {
4345
int pid = phos.getInt("hypo_pid", i);

‎reconstruction/rich/src/main/java/org/jlab/rec/rich/RICHCluster.java‎

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.util.ArrayList;
44
import org.jlab.geom.prim.Point3D;
55

6-
public class RICHCluster extends ArrayList<RICHHit> {
6+
public class RICHCluster extends ArrayList<RICHHit> implements Comparable<RICHCluster> {
77

88
/**
99
* A cluster in the RICH consists of an array of anodes in one PMT
@@ -339,14 +339,31 @@ public void merge(RICHCluster clu) {
339339

340340
}
341341

342+
// ----------------
343+
public boolean overlaps(RICHCluster clu) {
344+
// ----------------
345+
346+
if (this.get(0).get_sector() != clu.get(0).get_sector() ) return false;
347+
if (this.get(0).get_pmt() != clu.get(0).get_pmt() ) return false;
348+
349+
for(int i=0; i<clu.size(); i++){
350+
RICHHit rhit = clu.get(i);
351+
if(this.contains(rhit) || this.containsHit(rhit))
352+
return true;
353+
}
354+
return false;
355+
}
356+
342357
// ----------------
343358
public boolean containsHit(RICHHit hit) {
344359
// ----------------
345360
// checks if the hit belongs to any nonet around its already associated hits
346361

347362
boolean addFlag = false;
363+
if(this.get(0).get_sector()!=hit.get_sector())return addFlag;
348364
if(this.get(0).get_pmt()!=hit.get_pmt())return addFlag;
349365

366+
350367
for(int j = 0; j< this.size(); j++) {
351368
double tDiff = Math.abs(hit.get_Time() - this.get(j).get_Time());
352369
int xDiff = Math.abs(hit.get_idx() - this.get(j).get_idx());
@@ -357,24 +374,42 @@ public boolean containsHit(RICHHit hit) {
357374
}
358375

359376

377+
// ----------------
378+
@Override
360379
// ----------------
361380
public int compareTo(RICHCluster ocluster) {
362381
// ----------------
363382
//System.out.println(" --> comp "+this.get_channel()+" "+this.get_charge()+" "+ocluster.get_channel()+" "+ocluster.get_charge());
364-
if(this.get_charge() == ocluster.get_charge())return 0;
365-
if(this.get_charge() > ocluster.get_charge()){
366-
return 1;
367-
}else{
383+
//if(this.get_charge() == ocluster.get_charge())return 0;
384+
//if(this.get_charge() > ocluster.get_charge()){
385+
// return 1;
386+
//}else{
387+
// return -1;
388+
//}
389+
390+
if(this.get(0).get_sector()!=ocluster.get(0).get_sector())
391+
return this.get(0).get_sector()>ocluster.get(0).get_sector() ? 1 : -1;
392+
393+
if(this.get(0).get_pmt()!=ocluster.get(0).get_pmt())
394+
return this.get(0).get_pmt()>ocluster.get(0).get_pmt() ? 1 : -1;
395+
396+
if(this.get_size() == ocluster.get_size())
397+
return 0;
398+
else if(this.get_size() > ocluster.get_size())
368399
return -1;
369-
}
400+
else
401+
return 1;
402+
403+
370404
}
371405

372406

373407
// ----------------
374408
public void showCluster() {
375409
// ----------------
376-
System.out.format("Cluster ID %3d PMT %4d Siz %4d Ch %7.1f T %7.1f raw %7.1f wT %7.1f glxy %4d %4d XYZ %7.2f %7.2f %7.2f wXYZ %7.2f %7.2f %7.2f \n",
410+
System.out.format("Cluster ID %3d sector %1d PMT %4d Siz %4d Ch %7.1f T %7.1f raw %7.1f wT %7.1f glxy %4d %4d XYZ %7.2f %7.2f %7.2f wXYZ %7.2f %7.2f %7.2f \n",
377411
this.clusid,
412+
this.get(0).get_sector(),
378413
this.get(0).get_pmt(),
379414
this.get_size(),
380415
this.get_charge(),
@@ -383,9 +418,9 @@ public void showCluster() {
383418
this.get_x(), this.get_y(), this.get_z(),
384419
this.get_wx(), this.get_wy(), this.get_wz());
385420
for(int j = 0; j< this.size(); j++) {
386-
System.out.format(" --> hit # %3d ID %3d idxy %3d %3d dur %4d \n",
387-
j, this.get(j).get_id(),
388-
this.get(j).get_idx(), this.get(j).get_idy(), this.get(j).get_duration());
421+
System.out.format(" --> hit # %3d ID %3d anode %2d idxy %3d %3d dur %4d clu %2d\n",
422+
j, this.get(j).get_id(), this.get(j).get_anode(),
423+
this.get(j).get_idx(), this.get(j).get_idy(), this.get(j).get_duration(), this.get(j).get_cluster());
389424
}
390425
}
391426

‎reconstruction/rich/src/main/java/org/jlab/rec/rich/RICHHit.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ public boolean passHitSelection(RICHHit hit) {
366366
}
367367

368368

369+
// ----------------
370+
@Override
369371
// ----------------
370372
public int compareTo(RICHHit ohit) {
371373
// ----------------

0 commit comments

Comments
 (0)