Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,27 @@ public static DataBank getUTracksBank(List<DetectorTrack> utracks, List<Detector
}


public static DataBank getFTracksBank(List<DetectorTrack> ftracks, List<DetectorTrack>tracks, DataEvent event, String bank_name) {
DataBank bank = event.createBank(bank_name, ftracks.size());
for (int i = 0; i < tracks.size(); i++) {
bank.setShort("index", i, (short) ftracks.get(i).getTrackIndex());
bank.setShort("pindex", i, (short) tracks.get(ftracks.get(i).getTrackIndex()).getAssociation());
bank.setByte("sector", i, (byte) ftracks.get(i).getSector());
bank.setByte("detector", i, (byte) ftracks.get(i).getDetectorID());
bank.setByte("q", i, (byte) ftracks.get(i).getCharge());
bank.setFloat("chi2", i, (float) ftracks.get(i).getchi2());
bank.setShort("NDF", i, (short) ftracks.get(i).getNDF());
bank.setShort("status", i, (short) ftracks.get(i).getStatus());
bank.setFloat("px", i, (float) ftracks.get(i).getVector().x());
bank.setFloat("py", i, (float) ftracks.get(i).getVector().y());
bank.setFloat("pz", i, (float) ftracks.get(i).getVector().z());
bank.setFloat("vx", i, (float) ftracks.get(i).getVertex().x());
bank.setFloat("vy", i, (float) ftracks.get(i).getVertex().y());
bank.setFloat("vz", i, (float) ftracks.get(i).getVertex().z());
}
return bank;
}

public static DataBank getTrajectoriesBank(List<DetectorParticle> particles, DataEvent event, String bank_name) {

// these are going to be dropped from REC::Traj:
Expand Down Expand Up @@ -594,6 +615,36 @@ public static List<DetectorTrack> readDetectorTracks(DataEvent event, String ban
return tracks;
}

public static List<DetectorTrack> readFDetectorTracks(DataEvent event, String bank_name) {

List<DetectorTrack> tracks = new ArrayList<>();
if (event.hasBank(bank_name) == true) {
DataBank bank = event.getBank(bank_name);
int nrows = bank.rows();

for (int row = 0; row < nrows; row++) {
int charge = bank.getByte("q", row);
Vector3D pvec = DetectorData.readVector(bank, row, "p0_x", "p0_y", "p0_z");
Vector3D vertex = DetectorData.readVector(bank, row, "Vtx0_x", "Vtx0_y", "Vtx0_z");

DetectorTrack track = new DetectorTrack(charge, pvec.mag(), (row));
track.setVector(pvec.x(), pvec.y(), pvec.z());
track.setVertex(vertex.x(), vertex.y(), vertex.z());
track.setSector(bank.getByte("sector", row));

track.setNDF(bank.getInt("NDF", row));
track.setchi2(bank.getFloat("chi2", row));
track.setStatus(bank.getInt("status", row));

track.setDetectorID(DetectorType.FMT.getDetectorId());

// save track only if NDF!=0, i.e. was refitted with FMT clusters
if(track.getNDF()>0) tracks.add(track);
}
}
return tracks;
}

public static List<DetectorTrack> readCentralDetectorTracks(DataEvent event, String bank_name, String traj_bank_name) {

// these are ordered by index (1,2,3,4,5):
Expand Down
44 changes: 44 additions & 0 deletions etc/bankdefs/hipo4/event-ai.json
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,50 @@
{"name":"vz", "type":"F", "info":"z component of the vertex (cm)"}
]
},
{
"name": "RECAI::FTrack",
"group": 400,
"item" : 47,
"info": "Track information for Particles bank",
"entries": [
{"name":"index", "type":"S", "info":"index of the track in the specific detector bank"},
{"name":"pindex", "type":"S", "info":"row number in the particle bank hit is associated with"},
{"name":"detector", "type":"B", "info":"Detector ID, as defined in org.jlab.detector.base.DetectorType"},
{"name":"sector", "type":"B", "info":"Sector of the track"},
{"name":"status", "type":"S", "info":"status of the track"},
{"name":"q", "type":"B", "info":"charge of the track"},
{"name":"chi2", "type":"F", "info":"Chi2 (or quality) track fitting"},
{"name":"NDF", "type":"S", "info":"number of degrees of freedom in track fitting"},
{"name":"px", "type":"F", "info":"x component of the momentum (GeV)"},
{"name":"py", "type":"F", "info":"y component of the momentum (GeV)"},
{"name":"pz", "type":"F", "info":"z component of the momentum (GeV)"},
{"name":"vx", "type":"F", "info":"x component of the vertex (cm)"},
{"name":"vy", "type":"F", "info":"y component of the vertex (cm)"},
{"name":"vz", "type":"F", "info":"z component of the vertex (cm)"}
]
},
{
"name": "RECHBAI::FTrack",
"group": 400,
"item" : 48,
"info": "Track information for Particles bank",
"entries": [
{"name":"index", "type":"S", "info":"index of the track in the specific detector bank"},
{"name":"pindex", "type":"S", "info":"row number in the particle bank hit is associated with"},
{"name":"detector", "type":"B", "info":"Detector ID, as defined in org.jlab.detector.base.DetectorType"},
{"name":"sector", "type":"B", "info":"Sector of the track"},
{"name":"status", "type":"S", "info":"status of the track"},
{"name":"q", "type":"B", "info":"charge of the track"},
{"name":"chi2", "type":"F", "info":"Chi2 (or quality) track fitting"},
{"name":"NDF", "type":"S", "info":"number of degrees of freedom in track fitting"},
{"name":"px", "type":"F", "info":"x component of the momentum (GeV)"},
{"name":"py", "type":"F", "info":"y component of the momentum (GeV)"},
{"name":"pz", "type":"F", "info":"z component of the momentum (GeV)"},
{"name":"vx", "type":"F", "info":"x component of the vertex (cm)"},
{"name":"vy", "type":"F", "info":"y component of the vertex (cm)"},
{"name":"vz", "type":"F", "info":"z component of the vertex (cm)"}
]
},
{
"name": "RECAI::TrackCross",
"group": 400,
Expand Down
46 changes: 46 additions & 0 deletions etc/bankdefs/hipo4/event.json
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,52 @@
{"name":"vz", "type":"F", "info":"z component of the vertex (cm)"}
]
},
{
"name": "REC::FTrack",
"group": 300,
"item" : 47,
"info": "Track information for Particles bank",
"entries": [
{"name":"index", "type":"S", "info":"index of the track in the specific detector bank"},
{"name":"pindex", "type":"S", "info":"row number in the particle bank hit is associated with"},
{"name":"detector", "type":"B", "info":"Detector ID, as defined in org.jlab.detector.base.DetectorType"},
{"name":"sector", "type":"B", "info":"Sector of the track"},
{"name":"status", "type":"S", "info":"status of the track"},
{"name":"q", "type":"B", "info":"charge of the track"},
{"name":"chi2", "type":"F", "info":"Chi2 (or quality) track fitting"},
{"name":"NDF", "type":"S", "info":"number of degrees of freedom in track fitting"},
{"name":"hbindex", "type":"S", "info":"row number of corresponding track in RECHB::Track"},
{"name":"px", "type":"F", "info":"x component of the momentum (GeV)"},
{"name":"py", "type":"F", "info":"y component of the momentum (GeV)"},
{"name":"pz", "type":"F", "info":"z component of the momentum (GeV)"},
{"name":"vx", "type":"F", "info":"x component of the vertex (cm)"},
{"name":"vy", "type":"F", "info":"y component of the vertex (cm)"},
{"name":"vz", "type":"F", "info":"z component of the vertex (cm)"}
]
},
{
"name": "RECHB::FTrack",
"group": 300,
"item" : 48,
"info": "Track information for Particles bank",
"entries": [
{"name":"index", "type":"S", "info":"index of the track in the specific detector bank"},
{"name":"pindex", "type":"S", "info":"row number in the particle bank hit is associated with"},
{"name":"detector", "type":"B", "info":"Detector ID, as defined in org.jlab.detector.base.DetectorType"},
{"name":"sector", "type":"B", "info":"Sector of the track"},
{"name":"status", "type":"S", "info":"status of the track"},
{"name":"q", "type":"B", "info":"charge of the track"},
{"name":"chi2", "type":"F", "info":"Chi2 (or quality) track fitting"},
{"name":"NDF", "type":"S", "info":"number of degrees of freedom in track fitting"},
{"name":"hbindex", "type":"S", "info":"row number of corresponding track in RECHB::Track"},
{"name":"px", "type":"F", "info":"x component of the momentum (GeV)"},
{"name":"py", "type":"F", "info":"y component of the momentum (GeV)"},
{"name":"pz", "type":"F", "info":"z component of the momentum (GeV)"},
{"name":"vx", "type":"F", "info":"x component of the vertex (cm)"},
{"name":"vy", "type":"F", "info":"y component of the vertex (cm)"},
{"name":"vz", "type":"F", "info":"z component of the vertex (cm)"}
]
},
{
"name": "REC::TrackCross",
"group": 300,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class EBEngine extends ReconstructionEngine {
String cherenkovBank = null;
String trackBank = null;
String utrackBank = null;
String ftrackBank = null;
String crossBank = null;
String ftBank = null;
String trajectoryBank = null;
Expand Down Expand Up @@ -80,6 +81,7 @@ public void setOutputBankPrefix(String prefix) {
this.setScintExtrasBank(prefix+"::ScintExtras");
this.setTrackBank(prefix+"::Track");
this.setUTrackBank(prefix+"::UTrack");
this.setFTrackBank(prefix+"::FTrack");
this.setCrossBank(prefix+"::TrackCross");
this.setTrajectoryBank(prefix+"::Traj");
this.setFTBank(prefix+"::ForwardTagger");
Expand Down Expand Up @@ -133,6 +135,8 @@ public boolean processDataEvent(DataEvent de,EBScalers ebs) {
List<DetectorTrack> tracks = DetectorData.readDetectorTracks(de, trackType, trajectoryType, covMatrixType);
eb.addTracks(tracks);

List<DetectorTrack> ftracks = DetectorData.readFDetectorTracks(de, "FMT::Tracks");

List<DetectorTrack> ctracks = DetectorData.readCentralDetectorTracks(de, cvtTrackType, cvtTrajType);
eb.addTracks(ctracks);

Expand Down Expand Up @@ -221,6 +225,11 @@ public boolean processDataEvent(DataEvent de,EBScalers ebs) {
DataBank x = DetectorData.getUTracksBank(cutracks, ctracks, de, utrackBank);
de.appendBanks(x);
}

if (!ftracks.isEmpty()) {
DataBank x = DetectorData.getFTracksBank(ftracks, tracks, de, ftrackBank);
de.appendBanks(x);
}
}

// update PID for FT-based start time:
Expand Down Expand Up @@ -284,6 +293,10 @@ public void setUTrackBank(String name) {
this.utrackBank = name;
}

public void setFTrackBank(String name) {
this.ftrackBank = name;
}

public void setFTBank(String name) {
this.ftBank = name;
}
Expand Down Expand Up @@ -338,6 +351,7 @@ public boolean init() {
this.registerOutputBank(cherenkovBank);
this.registerOutputBank(trackBank);
this.registerOutputBank(utrackBank);
this.registerOutputBank(ftrackBank);
this.registerOutputBank(crossBank);
this.registerOutputBank(ftBank);
this.registerOutputBank(trajectoryBank);
Expand Down