diff --git a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorData.java b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorData.java index 320369cb10..17a9dd8c72 100644 --- a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorData.java +++ b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorData.java @@ -424,6 +424,27 @@ public static DataBank getUTracksBank(List utracks, List ftracks, Listtracks, 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 particles, DataEvent event, String bank_name) { // these are going to be dropped from REC::Traj: @@ -594,6 +615,36 @@ public static List readDetectorTracks(DataEvent event, String ban return tracks; } + public static List readFDetectorTracks(DataEvent event, String bank_name) { + + List 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 readCentralDetectorTracks(DataEvent event, String bank_name, String traj_bank_name) { // these are ordered by index (1,2,3,4,5): diff --git a/etc/bankdefs/hipo4/event-ai.json b/etc/bankdefs/hipo4/event-ai.json index d7ced2262e..b5902b3667 100644 --- a/etc/bankdefs/hipo4/event-ai.json +++ b/etc/bankdefs/hipo4/event-ai.json @@ -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, diff --git a/etc/bankdefs/hipo4/event.json b/etc/bankdefs/hipo4/event.json index a7771dfa9d..5f87be6520 100644 --- a/etc/bankdefs/hipo4/event.json +++ b/etc/bankdefs/hipo4/event.json @@ -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, diff --git a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java index 4899368aef..11640c5c1a 100644 --- a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java +++ b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java @@ -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; @@ -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"); @@ -133,6 +135,8 @@ public boolean processDataEvent(DataEvent de,EBScalers ebs) { List tracks = DetectorData.readDetectorTracks(de, trackType, trajectoryType, covMatrixType); eb.addTracks(tracks); + List ftracks = DetectorData.readFDetectorTracks(de, "FMT::Tracks"); + List ctracks = DetectorData.readCentralDetectorTracks(de, cvtTrackType, cvtTrajType); eb.addTracks(ctracks); @@ -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: @@ -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; } @@ -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);