Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7a02191
refactor: generic method for clustering different types of hits, meth…
N-Plx Feb 20, 2025
9ff65b0
refactor: moving folders/packages for more generic alert features
N-Plx Feb 20, 2025
3e6381c
feat: putting back cluster path length information, now handling case…
N-Plx Feb 21, 2025
bbc0fc9
Merge branch 'development' into 481-make-atof-clustering-more-flexible
N-Plx Feb 21, 2025
4bc755d
feat: handling track-cluster matching for events with more than one t…
N-Plx Feb 22, 2025
b9e2750
Merge branch '481-make-atof-clustering-more-flexible' of https://gith…
N-Plx Feb 22, 2025
cd9acdc
feat: saving track ID in projection bank
N-Plx Feb 22, 2025
dc3ed34
feat: ignoring double barhits
N-Plx Feb 25, 2025
db708bd
feat: computing helix path length between points on the helix
N-Plx Feb 25, 2025
9a071b4
fix: correct path length definition
N-Plx Feb 25, 2025
a50ddad
Merge branch 'development' into 481-make-atof-clustering-more-flexible
N-Plx Feb 25, 2025
cf43a11
feat: computing maximal energy hit in clusters
N-Plx Feb 26, 2025
f0db0a4
feat: tdc entry id matched to hit
N-Plx Feb 26, 2025
9a2c6fe
feat: tdc and tot are filled for barhits
N-Plx Feb 26, 2025
1493d2a
Merge branch 'development' into 481-make-atof-clustering-more-flexible
N-Plx Feb 26, 2025
4aa57ae
Merge branch '481-make-atof-clustering-more-flexible' of https://gith…
N-Plx Feb 26, 2025
449b00a
feat: new engine and new banks for atof tests
N-Plx Feb 27, 2025
c6cde02
feat: new engine and new banks for atof tests with effective velocity
N-Plx Feb 27, 2025
fad27d8
fix: correct distances
N-Plx Feb 27, 2025
0fc8196
style: clean up
N-Plx Feb 27, 2025
20362f0
fix: simplifying
N-Plx Feb 28, 2025
ee82b2a
Merge branch 'development' into ATOF_testing
N-Plx Feb 28, 2025
b9d726b
fix:order definition
N-Plx Feb 28, 2025
299d508
solving merge conflict
N-Plx Mar 6, 2025
aaa62ff
Merging development in ATOF testing (#526)
N-Plx Apr 1, 2025
d596173
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 1, 2025
a57d3d1
Merge branch 'development' into ATOF_testing
N-Plx Apr 1, 2025
bd117d6
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions etc/bankdefs/hipo4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@
| 12 | `ATOF::tdc` | TDC bank for the ALERT TOF |
| 21 | `ATOF::hits` | Reconstructed ATOF hits |
| 22 | `ATOF::clusters` | Clusters in ATOF |
| 31 | `ATOF::testhits` | Reconstructed ATOF hits |
| 32 | `ATOF::testclusters` | Clusters in ATOF |

## Group 22600

Expand All @@ -407,3 +409,4 @@
| 26 | `AHDC::KFTrack` | Reco Kalman Filter Tracks |
| 30 | `AHDC_AI::Prediction` | Prediction given by AI |
| 31 | `ALERT::Projections` | Track Projections to ATOF |
| 35 | `ATOF::testVeff` | veff test for ATOF |
136 changes: 134 additions & 2 deletions etc/bankdefs/hipo4/alert.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,38 @@
"name": "L_at_wedge",
"type": "F",
"info": "path length at atof wedge (inner surface) in mm"
}
]
},{
"name": "ATOF::testVeff",
"group": 23000,
"item": 35,
"info": "veff test for ATOF",
"entries": [
{
"name": "id",
"type": "S",
"info": "calib id"
},{
"name": "iCluster",
"type": "S",
"info": "id of the cluster"
},{
"name": "iBar",
"type": "S",
"info": "id bar hit"
},{
"name": "L_in_wedge",
"name": "ldiff",
"type": "F",
"info": "path length inside atof wedge in mm"
"info": "length diff mm"
}, {
"name": "tdiff",
"type": "F",
"info": "time diff ns"
},{
"name": "module",
"type": "S",
"info": "module"
}
]
},{
Expand Down Expand Up @@ -103,6 +131,62 @@
"info": "id of cluster to which the hit was associated"
}
]
},{
"name": "ATOF::testhits",
"group": 22500,
"item": 31,
"info": "Reconstructed ATOF hits",
"entries": [
{
"name": "id",
"type": "S",
"info": "hit id"
}, {
"name": "sector",
"type": "I",
"info": "atof sector"
}, {
"name": "layer",
"type": "I",
"info": "atof layer"
},{
"name": "component",
"type": "I",
"info": "atof component"
},{
"name": "time",
"type": "F",
"info": "time in ns"
},{
"name": "TDC",
"type": "I",
"info": "TDC"
},{
"name": "x",
"type": "F",
"info": "x position in mm"
}, {
"name": "y",
"type": "F",
"info": "y position in mm"
}, {
"name": "z",
"type": "F",
"info": "z position in mm"
},{
"name": "energy",
"type": "F",
"info": "deposited energy in MeV"
},{
"name": "TOT",
"type": "I",
"info": "TOT"
},{
"name": "clusterid",
"type": "S",
"info": "id of cluster to which the hit was associated"
}
]
},{
"name": "ATOF::clusters",
"group": 22500,
Expand Down Expand Up @@ -155,6 +239,54 @@
"info": "id of the projected track matched. it is -1 if a straight track was assigned."
}
]
},{
"name": "ATOF::testclusters",
"group": 22500,
"item": 32,
"info": "Clusters in ATOF",
"entries": [
{
"name": "id",
"type": "S",
"info": "hit id"
}, {
"name": "N_bar",
"type": "I",
"info": "number of hits from the bars"
}, {
"name": "N_wedge",
"type": "I",
"info": "number of hits from the wedges"
},{
"name": "time",
"type": "F",
"info": "time in ns"
},{
"name": "TDC",
"type": "I",
"info": "TDC"
},{
"name": "x",
"type": "F",
"info": "x position in mm"
}, {
"name": "y",
"type": "F",
"info": "y position in mm"
}, {
"name": "z",
"type": "F",
"info": "z position in mm"
},{
"name": "energy",
"type": "F",
"info": "energy in MeV"
},{
"name": "TOT",
"type": "I",
"info": "TOT"
}
]
},{
"name": "AHDC::Hits",
"group": 23000,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package org.jlab.rec.atof.banks;

import java.util.ArrayList;
import org.jlab.io.base.DataBank;
import org.jlab.io.base.DataEvent;
import org.jlab.rec.atof.cluster.ATOFCluster;
import org.jlab.rec.atof.hit.ATOFHit;
import org.jlab.rec.atof.hit.BarHit;
import org.jlab.rec.atof.veff.VeffCalibration;

/**
* The {@code RecoBankWriter} writes the banks needed for the atof testing: hits
* and clusters info.
*
* @author pilleux
*/
public class TestBankWriter {

public static DataBank fillATOFTestHitBank(DataEvent event, ArrayList<ATOFHit> wedgeHits, ArrayList<BarHit> barHits) {
ArrayList<ATOFHit> hitList = new ArrayList<>();
hitList.addAll(wedgeHits);
hitList.addAll(barHits);
DataBank bank = event.createBank("ATOF::testhits", hitList.size());
if (bank == null) {
System.err.println("COULD NOT CREATE A ATOF::testhits BANK!!!!!!");
return null;
}

for (int i = 0; i < hitList.size(); i++) {
bank.setShort("id", i, (short) (i + 1));
bank.setShort("clusterid", i, (short) hitList.get(i).getAssociatedClusterIndex());
bank.setInt("sector", i, (int) hitList.get(i).getSector());
bank.setInt("layer", i, (int) hitList.get(i).getLayer());
bank.setInt("component", i, (int) hitList.get(i).getComponent());
bank.setInt("TDC", i, (int) hitList.get(i).getTdc());
bank.setFloat("time", i, (float) hitList.get(i).getTime());
bank.setFloat("x", i, (float) (hitList.get(i).getX()));
bank.setFloat("y", i, (float) (hitList.get(i).getY()));
bank.setFloat("z", i, (float) (hitList.get(i).getZ()));
bank.setInt("TOT", i, (int) hitList.get(i).getTot());
bank.setFloat("energy", i, (float) hitList.get(i).getEnergy());
}
return bank;
}

public static DataBank fillATOFTestClusterBank(DataEvent event, ArrayList<ATOFCluster> clusterList) {

DataBank bank = event.createBank("ATOF::testclusters", clusterList.size());

if (bank == null) {
System.err.println("COULD NOT CREATE A ATOF::testclusters BANK!!!!!!");
return null;
}

for (int i = 0; i < clusterList.size(); i++) {
bank.setShort("id", i, (short) (i + 1));
bank.setInt("N_bar", i, (int) clusterList.get(i).getBarHits().size());
bank.setInt("N_wedge", i, (int) clusterList.get(i).getWedgeHits().size());
bank.setInt("TDC", i, (int) clusterList.get(i).getTdc());
bank.setFloat("time", i, (float) clusterList.get(i).getTime());
bank.setFloat("x", i, (float) (clusterList.get(i).getX()));
bank.setFloat("y", i, (float) (clusterList.get(i).getY()));
bank.setFloat("z", i, (float) (clusterList.get(i).getZ()));
bank.setInt("TOT", i, (int) clusterList.get(i).getTot());
bank.setFloat("energy", i, (float) clusterList.get(i).getEnergy());
}
return bank;
}

public static DataBank fillATOFTestVeff(DataEvent event, ArrayList<VeffCalibration> calibrations) {

DataBank bank = event.createBank("ATOF::testVeff", calibrations.size());

if (bank == null) {
System.err.println("COULD NOT CREATE A ATOF::testclusters BANK!!!!!!");
return null;
}
for (int i = 0; i < calibrations.size(); i++) {
bank.setShort("id", i, (short) (i + 1));
bank.setShort("iCluster", i, (short) calibrations.get(i).getICluster());
bank.setShort("iBar", i, (short) calibrations.get(i).getIBarHit());
bank.setFloat("ldiff", i, (float) calibrations.get(i).getLdiff());
bank.setFloat("tdiff", i, (float) calibrations.get(i).getTdiff());
bank.setShort("module", i, (short) calibrations.get(i).getModule());
}
return bank;
}

/**
* Appends the atof banks to an event.
*
* @param event the {@link DataEvent} in which to append the banks
* @param clusterList the {@link ArrayList} of {@link ATOFCluster}
* containing the clusters info to be added to the bank
* @param wedgeHits the {@link ArrayList} of {@link ATOFHit} containing the
* wedge hits info to be added
* @param barHits the {@link ArrayList} of {@link BarHit} containing the bar
* hits info to be added
*
* @return 0 if it worked, 1 if it failed
*
*/
public int appendATOFBanks(DataEvent event, ArrayList<ATOFHit> wedgeHits, ArrayList<BarHit> barHits, ArrayList<ATOFCluster> clusterList) {

DataBank hitbank = this.fillATOFTestHitBank(event, wedgeHits, barHits);
if (hitbank != null) {
event.appendBank(hitbank);
} else {
return 1;
}

DataBank clusterbank = fillATOFTestClusterBank(event, clusterList);
if (clusterbank != null) {
event.appendBank(clusterbank);
} else {
return 1;
}

return 0;
}

public int appendVeffBanks(DataEvent event, ArrayList<VeffCalibration> calibrations) {

DataBank veffbank = fillATOFTestVeff(event, calibrations);
if (veffbank != null) {
event.appendBank(veffbank);
} else {
return 1;
}

return 0;
}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package org.jlab.rec.atof.veff;

public class VeffCalibration {
double ldiff, tdiff;
int iCluster, iBarHit, module;

public double getLdiff() {
return ldiff;
}

public void setLdiff(double ldiff) {
this.ldiff = ldiff;
}

public double getTdiff() {
return tdiff;
}

public void setTdiff(double tdiff) {
this.tdiff = tdiff;
}

// Getter and Setter for iCluster
public int getICluster() {
return iCluster;
}

public void setICluster(int iCluster) {
this.iCluster = iCluster;
}

// Getter and Setter for iBarHit
public int getIBarHit() {
return iBarHit;
}

public void setIBarHit(int iBarHit) {
this.iBarHit = iBarHit;
}

// Getter and Setter for module
public int getModule() {
return module;
}

public void setModule(int module) {
this.module = module;
}

VeffCalibration(int module, double ldiff, double tdiff, int iCluster, int iBarHit){
this.module=module;
this.ldiff = ldiff;
this.tdiff = tdiff;
this.iCluster = iCluster;
this.iBarHit = iBarHit;
}

public static void main(String[] args) {
}
}
Loading