Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
56 changes: 56 additions & 0 deletions etc/bankdefs/hipo4/alert.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,62 @@
"info": "id of cluster to which the hit was associated"
}
]
},{
"name": "ATOF::calibhits",
"group": 22500,
"item": 23,
"info": "ATOF hits in single sipm channels",
"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": "order",
"type": "I",
"info": "atof order"
},{
"name": "time",
"type": "F",
"info": "time in ns"
},{
"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": "clusterid",
"type": "S",
"info": "id of cluster in which the hit was associated"
},{
"name": "tdcid",
"type": "S",
"info": "id of tdc entry corresponding to the hit"
}
]
},{
"name": "ATOF::clusters",
"group": 22500,
Expand Down
Binary file modified etc/data/test/atof.hipo
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class RecoBankWriter {

/**
* Writes the bank of atof hits.
* Hits represent hits in the scintillators.
*
* @param event the {@link DataEvent} in which to add the bank
* @param wedgeHits the {@link ArrayList} of {@link ATOFHit} containing the
Expand Down Expand Up @@ -55,6 +56,52 @@ public static DataBank fillATOFHitBank(DataEvent event, ArrayList<ATOFHit> wedge
}
return bank;
}

/**
* Writes the bank of atof hits in single sipm channels.
*
* @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 that are an association of single sipm hits to be added to the bank.
* @return {@link DataBank} the bank with all the hits read in the event.
*
*/
public static DataBank fillATOFChannelHitBank(DataEvent event, ArrayList<ATOFHit> wedgeHits, ArrayList<BarHit> barHits) {

ArrayList<ATOFHit> hitList = new ArrayList<>();
hitList.addAll(wedgeHits);
for(int i_bar_hits=0; i_bar_hits<barHits.size(); i_bar_hits++){
BarHit thisBarHit = barHits.get(i_bar_hits);
hitList.add(thisBarHit.getHitUp());
hitList.add(thisBarHit.getHitDown());

}

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

if (bank == null) {
System.err.println("COULD NOT CREATE A ATOF::calibhits 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.setShort("tdcid", i, (short) hitList.get(i).getIdTDC());
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("order", i, (int) hitList.get(i).getOrder());
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.
Expand Down Expand Up @@ -158,6 +205,13 @@ public int appendATOFBanks(DataEvent event, ArrayList<ATOFHit> wedgeHits, ArrayL
} else {
return 1;
}

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

return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class ATOFHit {
private String type;
private boolean isInACluster;
private int associatedClusterIndex;
int idTDC;
private int idTDC;

public int getSector() {
return sector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ public ATOFHit getHitDown() {
public void setHitDown(ATOFHit hit_down) {
this.hitDown = hit_down;
}

@Override
public void setAssociatedClusterIndex(int index) {
super.setAssociatedClusterIndex(index);
this.hitDown.setAssociatedClusterIndex(index);
this.hitUp.setAssociatedClusterIndex(index);
}

/**
* Computes bar hit z coordinate from up/downstream hit times.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ public void findHits(DataEvent event, Detector atof) {

//Building a Hit
ATOFHit hit = new ATOFHit(sector, layer, component, order, tdc, tot, atof);
hit.setIdTDC(i);
if (hit.getEnergy() < 0.01) {
continue; //energy threshold
}

//Sorting the hits into wedge, upstream and downstream bar hits
//Lists are built for up/down bar to match them after
//Wedge hits are mayched to ahdc tracks and listed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public boolean processDataEvent(DataEvent event) {
clusterFinder.makeClusters(event,hitfinder);
ArrayList<ATOFCluster> Clusters = clusterFinder.getClusters();

if (WedgeHits.size() != 0 || BarHits.size() != 0) {
if (!WedgeHits.isEmpty() || !BarHits.isEmpty()) {
rbc.appendATOFBanks(event, WedgeHits, BarHits, Clusters);
}
return true;
Expand Down