Skip to content
This repository has been archived by the owner on May 18, 2023. It is now read-only.

Commit

Permalink
Merge branch 'development' into iss528-ml-neuroph-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
raffaelladevita committed Dec 17, 2021
2 parents 2beaace + 4425b2d commit 0486121
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 230 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ public FMTLayer createLayer(ConstantProvider cp, int sectorId, int superlayerId,
layer.getBoundary().addFace(new Triangle3D(pUR, pUL, pLR));

layer.getPlane().set(0, 0, 0, 0, 0, -1);
layer.setRmin(beamHole);
layer.setRmax(rMax);

Transformation3D transform = new Transformation3D();
transform.rotateY(Math.toRadians(180));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
*/
public class FMTLayer extends AbstractLayer<TrackerStrip> {

private double rmin;
private double rmax;

protected FMTLayer(int sectorId, int superlayerId, int layerId) {
super(DetectorId.FMT, sectorId, superlayerId, layerId, false);
}
Expand All @@ -34,4 +37,37 @@ public String getType() {
return "FMT Layer";
}

/**
* Returns the minimum radius
* @return
*/
public double getRmin() {
return rmin;
}

/**
* Set the minimum radius
* @param rmin
*/
public void setRmin(double rmin) {
this.rmin = rmin;
}

/**
* Returns the maximum radius
* @return
*/
public double getRmax() {
return rmax;
}

/**
* Set the maximum radius
* @param rmax
*/
public void setRmax(double rmax) {
this.rmax = rmax;
}


}
11 changes: 6 additions & 5 deletions etc/bankdefs/hipo4/fmt.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
{"name":"residual", "type":"F", "info":"fitted hit residual"},
{"name":"adcIndex", "type":"S", "info":"associated adc index"},
{"name":"clusterIndex", "type":"S", "info":"associated cluster index"},
{"name":"trackIndex", "type":"S", "info":"associated track index"}
{"name":"trackIndex", "type":"S", "info":"associated track index"},
{"name":"status", "type":"B", "info":"hits status (0==good)"}
]
},
{
Expand Down Expand Up @@ -68,14 +69,14 @@
"info": "reconstructed tracks using FMT information",
"entries": [
{"name":"index", "type":"S", "info":"index of the track in the DC bank"},
{"name":"status", "type":"B", "info":"status of the track (0: not refit using FMT, 1: refit using FMT)"},
{"name":"status", "type":"B", "info":"status of the track (0: refitted using FMT, 1: original DC track)"},
{"name":"sector", "type":"B", "info":"sector of the track in DC"},
{"name":"Vtx0_x", "type":"F", "info":"Vertex x-position of the swam track to the DOCA to the beamline (in cm)"},
{"name":"Vtx0_y", "type":"F", "info":"Vertex y-position of the swam track to the DOCA to the beamline (in cm)"},
{"name":"Vtx0_z", "type":"F", "info":"Vertex z-position of the swam track to the DOCA to the beamline (in cm)"},
{"name":"p0_x", "type":"F", "info":"3-momentum x-coordinate of the swam track to the DOCA to the beamline (in cm)"},
{"name":"p0_y", "type":"F", "info":"3-momentum y-coordinate of the swam track to the DOCA to the beamline (in cm)"},
{"name":"p0_z", "type":"F", "info":"3-momentum z-coordinate of the swam track to the DOCA to the beamline (in cm)"},
{"name":"p0_x", "type":"F", "info":"3-momentum x-coordinate of the swam track to the DOCA to the beamline (in GeV)"},
{"name":"p0_y", "type":"F", "info":"3-momentum y-coordinate of the swam track to the DOCA to the beamline (in GeV)"},
{"name":"p0_z", "type":"F", "info":"3-momentum z-coordinate of the swam track to the DOCA to the beamline (in GeV)"},
{"name":"q", "type":"B", "info":"charge of the track"},
{"name":"chi2", "type":"F", "info":"chi^2 of the fit"},
{"name":"NDF", "type":"B", "info":"number of degrees of freedom of the fit"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class EBUtil {
*
* FIXME: move float parameters to CCDB
*/
@Deprecated
public static boolean centralNeutralVeto(DetectorParticle p) {

ScintillatorResponse cnd=(ScintillatorResponse)p.getHit(DetectorType.CND);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,7 @@ public int bestPidFromTiming(DetectorParticle p) {
bestPid = p.getBeta()<ccdb.getDouble(EBCCDBEnum.NEUTRON_maxBeta) ? 2112 : 22;
}
else if (p.hasHit(DetectorType.CND) || p.hasHit(DetectorType.CTOF)) {
if (!EBUtil.centralNeutralVeto(p)) {
bestPid = p.getBeta()<ccdb.getDouble(EBCCDBEnum.CND_NEUTRON_maxBeta) ? 2112 : 22;
}
bestPid = p.getBeta()<ccdb.getDouble(EBCCDBEnum.CND_NEUTRON_maxBeta) ? 2112 : 22;
}
else if (p.hasHit(DetectorType.BAND)) {
bestPid = p.getBeta() < 0.9 ? 2112 : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ public static Transformation3D getInverseTransform(int layer) {

/**
*
* @param other
* @param layer
* @param strip1
* @param strip2
* @return a boolean comparing 2 hits based on basic descriptors; returns
* true if the hits are the same
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.jlab.rec.fmt.Constants;
import org.jlab.rec.fmt.cluster.Cluster;
import org.jlab.rec.fmt.cross.Cross;
import org.jlab.rec.fmt.hit.FittedHit;
import org.jlab.rec.fmt.hit.Hit;
import org.jlab.rec.fmt.track.Track;

/**
Expand All @@ -18,7 +18,7 @@
*/
public class RecoBankWriter {

public static DataBank fillFMTHitsBank(DataEvent event, List<FittedHit> hitlist) {
public static DataBank fillFMTHitsBank(DataEvent event, List<Hit> hitlist) {
DataBank bank = event.createBank("FMT::Hits", hitlist.size());

for (int i = 0; i < hitlist.size(); i++) {
Expand All @@ -31,12 +31,14 @@ public static DataBank fillFMTHitsBank(DataEvent event, List<FittedHit> hitlist)
bank.setShort("adcIndex", i, (short) hitlist.get(i).getIndex());
bank.setShort("clusterIndex", i, (short) hitlist.get(i).getClusterIndex());
bank.setShort("trackIndex", i, (short) hitlist.get(i).getTrackIndex());
bank.setByte( "status", i, (byte) hitlist.get(i).getStatus());
}

return bank;
}

/**
* @param event
* @param cluslist the reconstructed list of fitted clusters in the event
* @return clusters bank
*/
Expand Down Expand Up @@ -65,6 +67,7 @@ public static DataBank fillFMTClustersBank(DataEvent event, List<Cluster> clusli

/**
*
* @param event
* @param crosses the reconstructed list of crosses in the event
* @return crosses bank
*/
Expand Down Expand Up @@ -127,10 +130,6 @@ private static DataBank fillFMTTrajectoryBank(DataEvent event,List<Track> candli
bank.setFloat("dy", row, (float) track.getDCTraj(layer).getLocalPosition().y());
bank.setFloat("dz", row, (float) track.getDCTraj(layer).getLocalPosition().z());
}
// else {
// System.out.println(layer + " " + track.toString());
// event.getBank("TimeBasedTrkg::Trajectory").show();
// }
if(track.getFMTTraj(layer)!=null) {
bank.setFloat("x", row, (float) track.getFMTTraj(layer).getPosition().x());
bank.setFloat("y", row, (float) track.getFMTTraj(layer).getPosition().y());
Expand All @@ -149,7 +148,7 @@ private static DataBank fillFMTTrajectoryBank(DataEvent event,List<Track> candli
return bank;
}

public static void appendFMTBanks(DataEvent event, List<FittedHit> fhits, List<Cluster> clusters,
public static void appendFMTBanks(DataEvent event, List<Hit> fhits, List<Cluster> clusters,
List<Track> tracks) {

if (event == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.List;
import org.jlab.geom.prim.Line3D;
import org.jlab.geom.prim.Point3D;
import org.jlab.rec.fmt.hit.FittedHit;
import org.jlab.rec.fmt.hit.Hit;

/**
Expand All @@ -15,7 +14,7 @@
* @author benkel
* @author devita
*/
public class Cluster extends ArrayList<FittedHit> implements Comparable<Cluster> {
public class Cluster extends ArrayList<Hit> implements Comparable<Cluster> {

private static final long serialVersionUID = 9153980362683755204L;

Expand Down Expand Up @@ -43,10 +42,8 @@ public class Cluster extends ArrayList<FittedHit> implements Comparable<Cluster>

/**
*
* @param sector the sector
* @param layer the layer
* @param cid the cluster ID, an incremental integer corresponding to the
* cluster formed in the series of clusters
* @param index
*/
public Cluster(int layer, int index) {
this._Layer = layer;
Expand All @@ -64,7 +61,7 @@ public int getLayer() {

/**
*
* @param _Superlayer the layer of the cluster (1...6)
* @param _Layer
*/
public void setLayer(int _Layer) {
this._Layer = _Layer;
Expand Down Expand Up @@ -117,7 +114,7 @@ public double getCentroidResidual() {

public void setCentroidResidual(double trackLocalY) {
this._CentroidResidual = this._Centroid-trackLocalY;
for(FittedHit hit : this) hit.setResidual(trackLocalY);
for(Hit hit : this) hit.setResidual(trackLocalY);
}

public double getTotalEnergy() {
Expand Down Expand Up @@ -214,14 +211,14 @@ public int getTrackIndex() {

public void setTrackIndex(int _AssociatedTrackIndex) {
this._AssociatedTrackIndex = _AssociatedTrackIndex;
for(FittedHit hit: this) hit.setTrackIndex(_AssociatedTrackIndex);
for(Hit hit: this) hit.setTrackIndex(_AssociatedTrackIndex);
}

private boolean containsHit(FittedHit hit) {
private boolean containsHit(Hit hit) {
boolean addFlag = false;
if(hit.getLayer()==this.getLayer()) {
for(int j = 0; j< this.size(); j++) {
if(this.get(j).isClose(hit)) {
for (Hit aThi : this) {
if (aThi.isClose(hit)) {
addFlag = true;
break;
}
Expand All @@ -232,10 +229,10 @@ private boolean containsHit(FittedHit hit) {


public static ArrayList<Cluster> findClusters(List<Hit> hits) {
ArrayList<Cluster> clusters = new ArrayList<Cluster>();
ArrayList<Cluster> clusters = new ArrayList<>();

for(int ihit=0; ihit<hits.size(); ihit++) {
FittedHit hit = new FittedHit(hits.get(ihit));
for(Hit hit: hits) {
if(hit.getStatus()!=0) continue;
if(hit.getClusterIndex()==-1) { // this hit is not yet associated with a cluster
for(int jclus=0; jclus<clusters.size(); jclus++) {
Cluster cluster = clusters.get(jclus);
Expand All @@ -261,8 +258,7 @@ public static ArrayList<Cluster> findClusters(List<Hit> hits) {

/**
* Sets energy-weighted parameters; these are the strip centroid
* (energy-weighted) value, the energy-weighted phi for Z detectors and the
* energy-weighted z for C detectorsting
* (energy-weighted) value
* @param eweight set to true for energy weighting
*/
public void calc_CentroidParams(boolean eweight) {
Expand Down Expand Up @@ -295,14 +291,11 @@ public void calc_CentroidParams(boolean eweight) {
if (nbhits != 0) {
int min = Integer.MAX_VALUE;
int max = Integer.MIN_VALUE;
int seed = -1;
double Emax = -1;
double Time = -1;
double Error = 0;
Hit seed = null;

// looping over the number of hits in the cluster
for (int i = 0; i < nbhits; i++) {
FittedHit thehit = this.get(i);
Hit thehit = this.get(i);

// get the energy value of the strip
double strpEn = thehit.getEnergy();
Expand Down Expand Up @@ -382,27 +375,25 @@ public void calc_CentroidParams(boolean eweight) {

double delta = Double.POSITIVE_INFINITY;
for (int i = 0; i < nbhits; i++) {
FittedHit thehit = this.get(i);
Hit thehit = this.get(i);
if(Math.abs(thehit.getStrip()-stripNumCent)<delta) {
delta = Math.abs(thehit.getStrip()-stripNumCent);
seed = thehit.getStrip();
Emax = thehit.getEnergy();
Time = thehit.getTime();
Error = thehit.getError();
seed = thehit;
}
}

_TotalEnergy = totEn;
_Centroid = stripNumCent;
_CentroidError = Math.sqrt(this.size()) * Error;
_CentroidError = seed.getError();// / Math.sqrt(this.size());
_GlobalSegment = new Line3D(weightedStripEndPoint1X,weightedStripEndPoint1Y,weightedStripEndPoint1Z,
weightedStripEndPoint2X,weightedStripEndPoint2Y,weightedStripEndPoint2Z);
_LocalSegment = new Line3D(weightedLocStripEndPoint1X,weightedLocStripEndPoint1Y,weightedLocStripEndPoint1Z,
weightedLocStripEndPoint2X,weightedLocStripEndPoint2Y,weightedLocStripEndPoint2Z);
_Time = averageTime;
_SeedStrip = seed;
_SeedEnergy = Emax;
_SeedTime = Time;
_SeedIndex = seed.getIndex();
_SeedStrip = seed.getStrip();
_SeedEnergy = seed.getEnergy();
_SeedTime = seed.getTime();
_MinStrip = min;
_MaxStrip = max;
}
Expand Down Expand Up @@ -457,7 +448,7 @@ public String toStringBrief() {
@Override
public String toString() {
String str = this.toStringBrief();
for (FittedHit aThi : this) {
for(Hit aThi : this) {
str = str.concat("\n" + aThi.toString());
}
return str;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.jlab.geom.prim.Point3D;
import org.jlab.geom.prim.Vector3D;
import org.jlab.rec.fmt.cluster.Cluster;
import org.jlab.rec.fmt.hit.FittedHit;
import org.jlab.rec.fmt.hit.Hit;

/**
* The crosses are objects used to find tracks and are characterized by a 3-D
Expand Down Expand Up @@ -36,10 +36,8 @@ public class Cross extends ArrayList<Cluster> implements Comparable<Cross> {

/**
*
* @param sector the sector (1)
* @param region the region (1...3)
* @param rid the cross ID (if there are only 3 crosses in the event, the ID
* corresponds to the region index
* @param index
*/
public Cross(int region, int index) {
this._Region = region;
Expand Down Expand Up @@ -74,7 +72,7 @@ public int getIndex() {
/**
* Sets the cross ID
*
* @param _Id the id of the cross
* @param index
*/
public void setIndex(int index) {
this._Index = index;
Expand Down Expand Up @@ -250,7 +248,7 @@ public void setAssociatedElementsIDs() {
cluster.setCrossIndex(this._Index);
cluster.setTrackIndex(this._TrackIndex);

for (FittedHit hit : cluster) {
for (Hit hit : cluster) {
hit.setClusterIndex(cluster.getIndex());
hit.setCrossIndex(this._Index);
hit.setTrackIndex(this._TrackIndex);
Expand Down
Loading

0 comments on commit 0486121

Please sign in to comment.