Skip to content

430 atof reconstruction #436

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 86 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
ca09bc6
Definition of atof hits
N-Plx Jan 13, 2025
f21f8c1
Definition of bar hits
N-Plx Jan 13, 2025
64b5dd0
Building hit lists
N-Plx Jan 13, 2025
b81680b
First clustering, to be revisited
N-Plx Jan 13, 2025
49d70a7
ahdc track projection
N-Plx Jan 13, 2025
8b2f35b
Path length
N-Plx Jan 15, 2025
40a9109
Hits sorted by energy
N-Plx Jan 15, 2025
00fb57c
Some more clustering algo, resolutions need to be set
N-Plx Jan 15, 2025
9bfe8cf
Track projection bank def
N-Plx Jan 15, 2025
6852b64
Track projection to the middle of elements
N-Plx Jan 15, 2025
4b9ad51
Track projection surfaces redefinition
N-Plx Jan 15, 2025
4306a90
Merge branch 'development' into 430-atof-reconstruction
N-Plx Jan 16, 2025
ccd62bd
Some naming conventions
N-Plx Jan 16, 2025
32dd302
Handling parameters + method for testing
N-Plx Jan 17, 2025
584db56
Handling parameters + bank input
N-Plx Jan 17, 2025
5b652ea
Correcting conversion to MeV
N-Plx Jan 17, 2025
02c89e0
Refactoring BarHit definition, now inherits from AtofHit
N-Plx Jan 17, 2025
bd04a6e
ATOF hit bank
N-Plx Jan 17, 2025
1cdd484
ATOF bank writer
N-Plx Jan 17, 2025
8368618
viewed clustering logic
Jan 21, 2025
a803cc3
will work on this branch
Jan 22, 2025
d80672f
proximity checks for ClusterFinder::improved logic
Jan 23, 2025
2f5b398
Fixing conversions tdc/tot to time/energy and cleanup
N-Plx Jan 23, 2025
13e72f9
Fixing time/energy computation and some cleanup
N-Plx Jan 23, 2025
8343ce8
Fixing energy sorting and some cleanup
N-Plx Jan 23, 2025
229e68e
Merge branch '430-atof-reconstruction' of https://github.com/Jefferso…
N-Plx Jan 23, 2025
16fb079
handling clustering parameters
N-Plx Feb 3, 2025
91d9b11
cluster parameters definition
N-Plx Feb 3, 2025
14a7cc6
fix hit order
N-Plx Feb 3, 2025
9764d60
cluster bank definition
N-Plx Feb 3, 2025
33cbb4f
charge sign fix and projection from MC Particle info
N-Plx Feb 3, 2025
e6d13d5
draft atof engine to be completed
N-Plx Feb 3, 2025
f7d21c2
Merge pull request #460 from JeffersonLab/development
N-Plx Feb 4, 2025
436e21c
appending output banks
N-Plx Feb 6, 2025
08fe9f4
fix:but writing output banks
N-Plx Feb 6, 2025
6099557
style: naming conventions and some cleaning
N-Plx Feb 11, 2025
199c47f
style: fixed naming conventions and some cleaning
N-Plx Feb 11, 2025
29f4d6d
fix: file name matches class name
N-Plx Feb 11, 2025
70c80e5
style: some more documentation
N-Plx Feb 11, 2025
d04345a
refactor: move writing of the projection bank
N-Plx Feb 12, 2025
350b6ec
Definition of atof hits
N-Plx Jan 13, 2025
2ba808a
Definition of bar hits
N-Plx Jan 13, 2025
17b553d
Building hit lists
N-Plx Jan 13, 2025
dbb413c
First clustering, to be revisited
N-Plx Jan 13, 2025
ddd47bd
ahdc track projection
N-Plx Jan 13, 2025
d5913b1
Path length
N-Plx Jan 15, 2025
bddc2c0
Hits sorted by energy
N-Plx Jan 15, 2025
41f0648
Some more clustering algo, resolutions need to be set
N-Plx Jan 15, 2025
88ffc5f
Track projection bank def
N-Plx Jan 15, 2025
e6d874f
Track projection to the middle of elements
N-Plx Jan 15, 2025
0596da4
Track projection surfaces redefinition
N-Plx Jan 15, 2025
e812ba5
Some naming conventions
N-Plx Jan 16, 2025
5a05006
Handling parameters + method for testing
N-Plx Jan 17, 2025
f0a1817
Handling parameters + bank input
N-Plx Jan 17, 2025
8003196
Correcting conversion to MeV
N-Plx Jan 17, 2025
f624514
Refactoring BarHit definition, now inherits from AtofHit
N-Plx Jan 17, 2025
06cf985
ATOF hit bank
N-Plx Jan 17, 2025
61ea386
ATOF bank writer
N-Plx Jan 17, 2025
81d4c64
viewed clustering logic
Jan 21, 2025
80c743b
will work on this branch
Jan 22, 2025
4d51e5e
proximity checks for ClusterFinder::improved logic
Jan 23, 2025
aa85343
Fixing conversions tdc/tot to time/energy and cleanup
N-Plx Jan 23, 2025
786488b
Fixing time/energy computation and some cleanup
N-Plx Jan 23, 2025
57d9228
Fixing energy sorting and some cleanup
N-Plx Jan 23, 2025
146ec82
handling clustering parameters
N-Plx Feb 3, 2025
4ab2fc0
cluster parameters definition
N-Plx Feb 3, 2025
dce50ef
fix hit order
N-Plx Feb 3, 2025
21934c1
cluster bank definition
N-Plx Feb 3, 2025
74ab588
charge sign fix and projection from MC Particle info
N-Plx Feb 3, 2025
e162c11
draft atof engine to be completed
N-Plx Feb 3, 2025
de817c4
appending output banks
N-Plx Feb 6, 2025
c94715f
fix:but writing output banks
N-Plx Feb 6, 2025
05ac12b
style: naming conventions and some cleaning
N-Plx Feb 11, 2025
21c956e
style: fixed naming conventions and some cleaning
N-Plx Feb 11, 2025
15a8b15
fix: file name matches class name
N-Plx Feb 11, 2025
cb272a9
style: some more documentation
N-Plx Feb 11, 2025
5bb27b3
refactor: move writing of the projection bank
N-Plx Feb 12, 2025
b507e11
Merge branch '430-atof-reconstruction' of https://github.com/Jefferso…
N-Plx Feb 15, 2025
a337e06
refactor: move track matching from hit to cluster level
N-Plx Feb 15, 2025
c5376fd
refactor: changing paths
N-Plx Feb 15, 2025
17dd519
feat: reading magnetic field using swimmer tools
N-Plx Feb 15, 2025
014847f
fix: missing closing bracket
N-Plx Feb 15, 2025
1f4c469
Renamed things to use ATOF instead of Atof
Feb 17, 2025
3cd22c1
More name changes
Feb 17, 2025
4e6c911
Missed bank name change.
Feb 17, 2025
e83adc9
Missed AHDC -> ALERT Projections
Feb 17, 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
500 changes: 320 additions & 180 deletions etc/bankdefs/hipo4/alert.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
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.trackMatch.TrackProjection;

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

/**
* Writes the bank of atof hits.
*
* @param event the {@link DataEvent} in which to add the bank
* @param wedgeHits the {@link ArrayList} of {@link ATOFHit} containing the
* wedge hits to be added to the bank
* @param barHits the {@link ArrayList} of {@link BarHit} containing the bar
* hits to be added to the bank
*
* @return {@link DataBank} the bank with all the hits read in the event.
*
*/
public static DataBank fillATOFHitBank(DataEvent event, ArrayList<ATOFHit> wedgeHits, ArrayList<BarHit> barHits) {

ArrayList<ATOFHit> hitList = new ArrayList<>();
hitList.addAll(wedgeHits);
hitList.addAll(barHits);

DataBank bank = event.createBank("ATOF::hits", hitList.size());

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

for (int i = 0; i < hitList.size(); i++) {
bank.setShort("id", i, (short) (i + 1));
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.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.setFloat("energy", i, (float) hitList.get(i).getEnergy());
}
return bank;
}

/**
* Writes the bank of atof clusters.
*
* @param event the {@link DataEvent} in which to add the bank
* @param clusterList the {@link ArrayList} of {@link ATOFCluster}
* containing the clusters info to be added to the bank
*
* @return {@link DataBank} the bank with all the clusters built in the
* event.
*
*/
public static DataBank fillATOFClusterBank(DataEvent event, ArrayList<ATOFCluster> clusterList) {

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

if (bank == null) {
System.err.println("COULD NOT CREATE A ATOF::clusters 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.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.setFloat("energy", i, (float) clusterList.get(i).getEnergy());
}
return bank;
}

/**
* Writes the bank of track projections.
*
* @param event the {@link DataEvent} in which to add the bank
* @param projections the {@link ArrayList} of {@link TrackProjection}
* containing the track projection info to be added to the bank
*
* @return {@link DataBank} the bank with all the projected tracks in the
* event.
*
*/
public static DataBank fillProjectionsBank(DataEvent event, ArrayList<TrackProjection> projections) {

DataBank bank = event.createBank("ALERT::Projections", projections.size());

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

for (int i = 0; i < projections.size(); i++) {
TrackProjection projection = projections.get(i);
bank.setFloat("x_at_bar", i, (float) projection.getBarIntersect().x());
bank.setFloat("y_at_bar", i, (float) projection.getBarIntersect().y());
bank.setFloat("z_at_bar", i, (float) projection.getBarIntersect().z());
bank.setFloat("L_at_bar", i, (float) projection.getBarPathLength());
bank.setFloat("L_in_bar", i, (float) projection.getBarInPathLength());
bank.setFloat("x_at_wedge", i, (float) projection.getWedgeIntersect().x());
bank.setFloat("y_at_wedge", i, (float) projection.getWedgeIntersect().y());
bank.setFloat("z_at_wedge", i, (float) projection.getWedgeIntersect().z());
bank.setFloat("L_at_wedge", i, (float) projection.getWedgePathLength());
bank.setFloat("L_in_wedge", i, (float) projection.getWedgeInPathLength());
}
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.fillATOFHitBank(event, wedgeHits, barHits);
if (hitbank != null) {
event.appendBank(hitbank);
} else {
return 1;
}

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

return 0;
}

/**
* Appends the alert match banks to an event.
*
* @param event the {@link DataEvent} in which to append the banks
* @param projections the {@link ArrayList} of {@link TrackProjection} containing the
* track projections info to be added
*
* @return 0 if it worked, 1 if it failed
*
*/
public int appendMatchBanks(DataEvent event, ArrayList<TrackProjection> projections) {

DataBank projbank = this.fillProjectionsBank(event, projections);
if (projbank != null) {
event.appendBank(projbank);
} else {
return 1;
}
return 0;
}

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

}
Loading