Skip to content

Commit 5238bfd

Browse files
Merge branch 'development' into development
2 parents 5c4fe4a + 3f00dfa commit 5238bfd

File tree

31 files changed

+1029
-613
lines changed

31 files changed

+1029
-613
lines changed
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,8 @@
5151
# dump a table
5252
puts """# Bank Group and Item IDs
5353
54-
This file was generated by
55-
```bash
56-
#{$0} #{ARGV.join ' '}
57-
```
58-
59-
> [!IMPORTANT]
60-
> Please re-run this script if you modify any of the bank definitions.
54+
> [!NOTE]
55+
> Iguana banks, which are defined in the Iguana repository, use group number 30000.
6156
6257
"""
6358

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env sh
2+
.github/make_banks_readme.rb etc/bankdefs/hipo4 > etc/bankdefs/hipo4/README.md

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: make_banks_readme
5+
name: make banks readme
6+
entry: .github/make_banks_readme_precommit.sh
7+
language: script
8+
pass_filenames: false

common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CLASDecoder4.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ public Bank getDataBankWF(String name, DetectorType type) {
260260
b.putShort("component", i, (short) a.get(i).getDescriptor().getComponent());
261261
b.putByte("order", i, (byte) a.get(i).getDescriptor().getOrder());
262262
b.putLong("timestamp", i, a.get(i).getADCData(0).getTimeStamp());
263+
b.putInt("time", i, (int)a.get(i).getADCData(0).getTime());
263264
DetectorDataDgtz.ADCData xxx = a.get(i).getADCData(0);
264265
for (int j=0; j<xxx.getPulseSize(); ++j)
265266
b.putShort(String.format("s%d",j+1), i, xxx.getPulseValue(j));

common-tools/clas-detector/src/main/java/org/jlab/detector/pulse/HipoExtractor.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,10 @@ protected List<Pulse> getPulses(int n, IndexedTable it, DataBank wfBank) {
129129
for (int i=0; i<wfBank.rows(); ++i) {
130130
for (int j=0; j<n; ++j)
131131
samples[j] = wfBank.getShort(String.format("s%d",j+1), i);
132-
List<Pulse> p = it==null ? extract(null, i, samples) :
133-
extract(it.getNamedEntry(getIndices(wfBank,i)), i, samples);
132+
long timestamp = wfBank.getLong("timestamp",i);
133+
int time = wfBank.getInt("time",i);
134+
List<Pulse> p = it==null ? extract(null, i, timestamp, time, samples) :
135+
extract(it.getNamedEntry(getIndices(wfBank,i)), i, timestamp, time, samples);
134136
if (p!=null && !p.isEmpty()) {
135137
if (pulses == null) pulses = new ArrayList<>();
136138
pulses.addAll(p);
@@ -147,8 +149,10 @@ protected List<Pulse> getPulses(int n, IndexedTable it, Bank wfBank) {
147149
samples[j] = wfBank.getShort(String.format("s%d",j+1), i);
148150
// FIXME: Can speed this up (but looks like not for DataBank?):
149151
//samples[j] = wfBank.getShort(String.format(5+j,j+1), i);
150-
List p = it==null ? extract(null, i, samples) :
151-
extract(it.getNamedEntry(getIndices(wfBank,i)), i, samples);
152+
int time = wfBank.getInt("time",i);
153+
long timestamp = wfBank.getLong("timestamp",i);
154+
List p = it==null ? extract(null, i, timestamp, time, samples) :
155+
extract(it.getNamedEntry(getIndices(wfBank,i)), i, timestamp, time, samples);
152156
if (p!=null && !p.isEmpty()) {
153157
if (pulses == null) pulses = new ArrayList<>();
154158
pulses.addAll(p);

common-tools/clas-detector/src/main/java/org/jlab/detector/pulse/IExtractor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55

66
public interface IExtractor <T> {
77

8-
public List<T> extract(NamedEntry pars, int id, short... samples);
8+
public List<T> extract(NamedEntry pars, int id, long par1, long par2, short... samples);
99

1010
}

common-tools/clas-detector/src/main/java/org/jlab/detector/pulse/Mode3.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ public class Mode3 extends HipoExtractor {
2020
/**
2121
* @param pars CCDB row
2222
* @param id link to row in source bank
23+
* @param par1
24+
* @param par2
2325
* @param samples ADC samples
2426
* @return extracted pulses
2527
*/
2628
@Override
27-
public List<Pulse> extract(NamedEntry pars, int id, short... samples) {
29+
public List<Pulse> extract(NamedEntry pars, int id, long par1, long par2, short... samples) {
2830

2931
List<Pulse> pulses = null;
3032

common-tools/clas-detector/src/main/java/org/jlab/detector/pulse/Mode7.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ private static float calculateTime(int t0, float ped, short... samples) {
2929
}
3030

3131
@Override
32-
public List<Pulse> extract(NamedEntry pars, int id, short... samples) {
33-
List<Pulse> pulses = super.extract(pars, id, samples);
32+
public List<Pulse> extract(NamedEntry pars, int id, long par1, long par2, short... samples) {
33+
List<Pulse> pulses = super.extract(pars, id, par1, par2, samples);
3434
for (Pulse p : pulses)
3535
p.time = calculateTime((int)p.time, p.pedestal, samples);
3636
return pulses;

common-tools/clas-detector/src/main/java/org/jlab/detector/pulse/ModeAHDC.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
import org.jlab.io.base.DataBank;
66
import org.jlab.io.base.DataEvent;
77
import org.jlab.jnp.hipo4.data.Bank;
8-
import org.jlab.jnp.hipo4.data.Event;
9-
import org.jlab.jnp.hipo4.data.SchemaFactory;
108
import org.jlab.utils.groups.IndexedTable;
11-
12-
import net.jcip.annotations.GuardedBy;
139
import org.jlab.utils.groups.NamedEntry;
1410

1511

@@ -32,7 +28,7 @@ public class ModeAHDC extends HipoExtractor {
3228
* @param samples ADC samples
3329
*/
3430
@Override
35-
public List<Pulse> extract(NamedEntry pars, int id, short... samples){
31+
public List<Pulse> extract(NamedEntry pars, int id, long par1, long par2, short... samples){
3632
// Settings parameters (they can be initialised by a CCDB)
3733
float samplingTime = 44;
3834
int sparseSample = 0;

common-tools/clas-tracking/src/main/java/org/jlab/clas/tracking/kalmanfilter/zReference/KFitter.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,9 @@ private boolean filter(int k, boolean forward, double annealingFactor) {
708708
return false;
709709
}
710710
}
711-
711+
712+
// Since no vertex inforamtion, the starting point for path length is the final point at the last layer.
713+
// After vertex information is obtained, transition for the starting point from the final point to vertex will be taken.
712714
private boolean filter(int k, boolean forward) {
713715
StateVec sVec = sv.transported(forward).get(k);
714716
org.jlab.clas.tracking.kalmanfilter.AMeasVecs.MeasVec mVec = mv.measurements.get(k);
@@ -857,7 +859,9 @@ public Matrix filterCovMat(double[] H, Matrix Ci, double V) {
857859
private void calcFinalChisq(int sector) {
858860
calcFinalChisq(sector, false);
859861
}
860-
862+
863+
// Since no vertex inforamtion, the starting point for path length is the final point at the last layer.
864+
// After vertex information is obtained, transition for the starting point from the final point to vertex will be taken.
861865
private void calcFinalChisq(int sector, boolean nofilter) {
862866
int k = svzLength - 1;
863867
this.chi2 = 0;
@@ -880,9 +884,9 @@ private void calcFinalChisq(int sector, boolean nofilter) {
880884
sv.transport(sector, k, 0, sVec, mv, this.getSwimmer(), forward);
881885

882886
StateVec svc = sv.transported(forward).get(0);
883-
path += svc.deltaPath;
887+
path += (forward ? 1 : -1) * svc.deltaPath;
884888
svc.setPathLength(path);
885-
889+
886890
double V0 = mv.measurements.get(0).surface.unc[0];
887891

888892
Point3D point = new Point3D(svc.x, svc.y, mv.measurements.get(0).surface.measPoint.z());
@@ -922,7 +926,7 @@ private void calcFinalChisq(int sector, boolean nofilter) {
922926

923927
double h = mv.hDoca(point, mv.measurements.get(k1 + 1).surface.wireLine[0]);
924928
svc = sv.transported(forward).get(k1 + 1);
925-
path += svc.deltaPath;
929+
path += (forward ? 1 : -1) * svc.deltaPath;
926930
svc.setPathLength(path);
927931
svc.setProjector(mv.measurements.get(k1 + 1).surface.wireLine[0].origin().x());
928932
svc.setProjectorDoca(h);
@@ -975,7 +979,7 @@ private void calcFinalChisqDAF(int sector, boolean nofilter) {
975979
sv.transport(sector, k, 0, sVec, mv, this.getSwimmer(), forward);
976980

977981
StateVec svc = sv.transported(forward).get(0);
978-
path += svc.deltaPath;
982+
path += (forward ? 1 : -1) * svc.deltaPath;
979983
svc.setPathLength(path);
980984

981985
Point3D point = new Point3D(svc.x, svc.y, mv.measurements.get(0).surface.measPoint.z());
@@ -1047,7 +1051,7 @@ private void calcFinalChisqDAF(int sector, boolean nofilter) {
10471051
}
10481052

10491053
svc = sv.transported(forward).get(k1 + 1);
1050-
path += svc.deltaPath;
1054+
path += (forward ? 1 : -1) * svc.deltaPath;
10511055
svc.setPathLength(path);
10521056

10531057
point = new Point3D(sv.transported(forward).get(k1 + 1).x, sv.transported(forward).get(k1 + 1).y, mv.measurements.get(k1 + 1).surface.measPoint.z());
@@ -1116,6 +1120,10 @@ private void calcFinalChisqDAF(int sector, boolean nofilter) {
11161120
public Matrix propagateToVtx(int sector, double Zf) {
11171121
return sv.transport(sector, finalStateVec.k, Zf, finalStateVec, mv, this.getSwimmer());
11181122
}
1123+
1124+
public double getDeltaPathToVtx(int sector, double Zf) {
1125+
return sv.getDeltaPath(sector, finalStateVec.k, Zf, finalStateVec, mv, this.getSwimmer());
1126+
}
11191127

11201128
//Todo: apply the common funciton to replace current function above
11211129
@Override

0 commit comments

Comments
 (0)