Skip to content

Commit 1dd01a5

Browse files
raffaelladevitatongtongcao
authored andcommitted
saving FMT tracks in REC::FTrack (#879)2
* saving FMT tracks in REC::FTrack * fixed bug and added comment
1 parent 9d10741 commit 1dd01a5

File tree

4 files changed

+155
-0
lines changed

4 files changed

+155
-0
lines changed

common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorData.java

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,27 @@ public static DataBank getUTracksBank(List<DetectorTrack> utracks, List<Detector
424424
}
425425

426426

427+
public static DataBank getFTracksBank(List<DetectorTrack> ftracks, List<DetectorTrack>tracks, DataEvent event, String bank_name) {
428+
DataBank bank = event.createBank(bank_name, ftracks.size());
429+
for (int i = 0; i < tracks.size(); i++) {
430+
bank.setShort("index", i, (short) ftracks.get(i).getTrackIndex());
431+
bank.setShort("pindex", i, (short) tracks.get(ftracks.get(i).getTrackIndex()).getAssociation());
432+
bank.setByte("sector", i, (byte) ftracks.get(i).getSector());
433+
bank.setByte("detector", i, (byte) ftracks.get(i).getDetectorID());
434+
bank.setByte("q", i, (byte) ftracks.get(i).getCharge());
435+
bank.setFloat("chi2", i, (float) ftracks.get(i).getchi2());
436+
bank.setShort("NDF", i, (short) ftracks.get(i).getNDF());
437+
bank.setShort("status", i, (short) ftracks.get(i).getStatus());
438+
bank.setFloat("px", i, (float) ftracks.get(i).getVector().x());
439+
bank.setFloat("py", i, (float) ftracks.get(i).getVector().y());
440+
bank.setFloat("pz", i, (float) ftracks.get(i).getVector().z());
441+
bank.setFloat("vx", i, (float) ftracks.get(i).getVertex().x());
442+
bank.setFloat("vy", i, (float) ftracks.get(i).getVertex().y());
443+
bank.setFloat("vz", i, (float) ftracks.get(i).getVertex().z());
444+
}
445+
return bank;
446+
}
447+
427448
public static DataBank getTrajectoriesBank(List<DetectorParticle> particles, DataEvent event, String bank_name) {
428449

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

618+
public static List<DetectorTrack> readFDetectorTracks(DataEvent event, String bank_name) {
619+
620+
List<DetectorTrack> tracks = new ArrayList<>();
621+
if (event.hasBank(bank_name) == true) {
622+
DataBank bank = event.getBank(bank_name);
623+
int nrows = bank.rows();
624+
625+
for (int row = 0; row < nrows; row++) {
626+
int charge = bank.getByte("q", row);
627+
Vector3D pvec = DetectorData.readVector(bank, row, "p0_x", "p0_y", "p0_z");
628+
Vector3D vertex = DetectorData.readVector(bank, row, "Vtx0_x", "Vtx0_y", "Vtx0_z");
629+
630+
DetectorTrack track = new DetectorTrack(charge, pvec.mag(), (row));
631+
track.setVector(pvec.x(), pvec.y(), pvec.z());
632+
track.setVertex(vertex.x(), vertex.y(), vertex.z());
633+
track.setSector(bank.getByte("sector", row));
634+
635+
track.setNDF(bank.getInt("NDF", row));
636+
track.setchi2(bank.getFloat("chi2", row));
637+
track.setStatus(bank.getInt("status", row));
638+
639+
track.setDetectorID(DetectorType.FMT.getDetectorId());
640+
641+
// save track only if NDF!=0, i.e. was refitted with FMT clusters
642+
if(track.getNDF()>0) tracks.add(track);
643+
}
644+
}
645+
return tracks;
646+
}
647+
597648
public static List<DetectorTrack> readCentralDetectorTracks(DataEvent event, String bank_name, String traj_bank_name) {
598649

599650
// these are ordered by index (1,2,3,4,5):

etc/bankdefs/hipo4/event-ai.json

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,50 @@
473473
{"name":"vz", "type":"F", "info":"z component of the vertex (cm)"}
474474
]
475475
},
476+
{
477+
"name": "RECAI::FTrack",
478+
"group": 400,
479+
"item" : 47,
480+
"info": "Track information for Particles bank",
481+
"entries": [
482+
{"name":"index", "type":"S", "info":"index of the track in the specific detector bank"},
483+
{"name":"pindex", "type":"S", "info":"row number in the particle bank hit is associated with"},
484+
{"name":"detector", "type":"B", "info":"Detector ID, as defined in org.jlab.detector.base.DetectorType"},
485+
{"name":"sector", "type":"B", "info":"Sector of the track"},
486+
{"name":"status", "type":"S", "info":"status of the track"},
487+
{"name":"q", "type":"B", "info":"charge of the track"},
488+
{"name":"chi2", "type":"F", "info":"Chi2 (or quality) track fitting"},
489+
{"name":"NDF", "type":"S", "info":"number of degrees of freedom in track fitting"},
490+
{"name":"px", "type":"F", "info":"x component of the momentum (GeV)"},
491+
{"name":"py", "type":"F", "info":"y component of the momentum (GeV)"},
492+
{"name":"pz", "type":"F", "info":"z component of the momentum (GeV)"},
493+
{"name":"vx", "type":"F", "info":"x component of the vertex (cm)"},
494+
{"name":"vy", "type":"F", "info":"y component of the vertex (cm)"},
495+
{"name":"vz", "type":"F", "info":"z component of the vertex (cm)"}
496+
]
497+
},
498+
{
499+
"name": "RECHBAI::FTrack",
500+
"group": 400,
501+
"item" : 48,
502+
"info": "Track information for Particles bank",
503+
"entries": [
504+
{"name":"index", "type":"S", "info":"index of the track in the specific detector bank"},
505+
{"name":"pindex", "type":"S", "info":"row number in the particle bank hit is associated with"},
506+
{"name":"detector", "type":"B", "info":"Detector ID, as defined in org.jlab.detector.base.DetectorType"},
507+
{"name":"sector", "type":"B", "info":"Sector of the track"},
508+
{"name":"status", "type":"S", "info":"status of the track"},
509+
{"name":"q", "type":"B", "info":"charge of the track"},
510+
{"name":"chi2", "type":"F", "info":"Chi2 (or quality) track fitting"},
511+
{"name":"NDF", "type":"S", "info":"number of degrees of freedom in track fitting"},
512+
{"name":"px", "type":"F", "info":"x component of the momentum (GeV)"},
513+
{"name":"py", "type":"F", "info":"y component of the momentum (GeV)"},
514+
{"name":"pz", "type":"F", "info":"z component of the momentum (GeV)"},
515+
{"name":"vx", "type":"F", "info":"x component of the vertex (cm)"},
516+
{"name":"vy", "type":"F", "info":"y component of the vertex (cm)"},
517+
{"name":"vz", "type":"F", "info":"z component of the vertex (cm)"}
518+
]
519+
},
476520
{
477521
"name": "RECAI::TrackCross",
478522
"group": 400,

etc/bankdefs/hipo4/event.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,52 @@
476476
{"name":"vz", "type":"F", "info":"z component of the vertex (cm)"}
477477
]
478478
},
479+
{
480+
"name": "REC::FTrack",
481+
"group": 300,
482+
"item" : 47,
483+
"info": "Track information for Particles bank",
484+
"entries": [
485+
{"name":"index", "type":"S", "info":"index of the track in the specific detector bank"},
486+
{"name":"pindex", "type":"S", "info":"row number in the particle bank hit is associated with"},
487+
{"name":"detector", "type":"B", "info":"Detector ID, as defined in org.jlab.detector.base.DetectorType"},
488+
{"name":"sector", "type":"B", "info":"Sector of the track"},
489+
{"name":"status", "type":"S", "info":"status of the track"},
490+
{"name":"q", "type":"B", "info":"charge of the track"},
491+
{"name":"chi2", "type":"F", "info":"Chi2 (or quality) track fitting"},
492+
{"name":"NDF", "type":"S", "info":"number of degrees of freedom in track fitting"},
493+
{"name":"hbindex", "type":"S", "info":"row number of corresponding track in RECHB::Track"},
494+
{"name":"px", "type":"F", "info":"x component of the momentum (GeV)"},
495+
{"name":"py", "type":"F", "info":"y component of the momentum (GeV)"},
496+
{"name":"pz", "type":"F", "info":"z component of the momentum (GeV)"},
497+
{"name":"vx", "type":"F", "info":"x component of the vertex (cm)"},
498+
{"name":"vy", "type":"F", "info":"y component of the vertex (cm)"},
499+
{"name":"vz", "type":"F", "info":"z component of the vertex (cm)"}
500+
]
501+
},
502+
{
503+
"name": "RECHB::FTrack",
504+
"group": 300,
505+
"item" : 48,
506+
"info": "Track information for Particles bank",
507+
"entries": [
508+
{"name":"index", "type":"S", "info":"index of the track in the specific detector bank"},
509+
{"name":"pindex", "type":"S", "info":"row number in the particle bank hit is associated with"},
510+
{"name":"detector", "type":"B", "info":"Detector ID, as defined in org.jlab.detector.base.DetectorType"},
511+
{"name":"sector", "type":"B", "info":"Sector of the track"},
512+
{"name":"status", "type":"S", "info":"status of the track"},
513+
{"name":"q", "type":"B", "info":"charge of the track"},
514+
{"name":"chi2", "type":"F", "info":"Chi2 (or quality) track fitting"},
515+
{"name":"NDF", "type":"S", "info":"number of degrees of freedom in track fitting"},
516+
{"name":"hbindex", "type":"S", "info":"row number of corresponding track in RECHB::Track"},
517+
{"name":"px", "type":"F", "info":"x component of the momentum (GeV)"},
518+
{"name":"py", "type":"F", "info":"y component of the momentum (GeV)"},
519+
{"name":"pz", "type":"F", "info":"z component of the momentum (GeV)"},
520+
{"name":"vx", "type":"F", "info":"x component of the vertex (cm)"},
521+
{"name":"vy", "type":"F", "info":"y component of the vertex (cm)"},
522+
{"name":"vz", "type":"F", "info":"z component of the vertex (cm)"}
523+
]
524+
},
479525
{
480526
"name": "REC::TrackCross",
481527
"group": 300,

reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class EBEngine extends ReconstructionEngine {
3939
String cherenkovBank = null;
4040
String trackBank = null;
4141
String utrackBank = null;
42+
String ftrackBank = null;
4243
String crossBank = null;
4344
String ftBank = null;
4445
String trajectoryBank = null;
@@ -80,6 +81,7 @@ public void setOutputBankPrefix(String prefix) {
8081
this.setScintExtrasBank(prefix+"::ScintExtras");
8182
this.setTrackBank(prefix+"::Track");
8283
this.setUTrackBank(prefix+"::UTrack");
84+
this.setFTrackBank(prefix+"::FTrack");
8385
this.setCrossBank(prefix+"::TrackCross");
8486
this.setTrajectoryBank(prefix+"::Traj");
8587
this.setFTBank(prefix+"::ForwardTagger");
@@ -133,6 +135,8 @@ public boolean processDataEvent(DataEvent de,EBScalers ebs) {
133135
List<DetectorTrack> tracks = DetectorData.readDetectorTracks(de, trackType, trajectoryType, covMatrixType);
134136
eb.addTracks(tracks);
135137

138+
List<DetectorTrack> ftracks = DetectorData.readFDetectorTracks(de, "FMT::Tracks");
139+
136140
List<DetectorTrack> ctracks = DetectorData.readCentralDetectorTracks(de, cvtTrackType, cvtTrajType);
137141
eb.addTracks(ctracks);
138142

@@ -221,6 +225,11 @@ public boolean processDataEvent(DataEvent de,EBScalers ebs) {
221225
DataBank x = DetectorData.getUTracksBank(cutracks, ctracks, de, utrackBank);
222226
de.appendBanks(x);
223227
}
228+
229+
if (!ftracks.isEmpty()) {
230+
DataBank x = DetectorData.getFTracksBank(ftracks, tracks, de, ftrackBank);
231+
de.appendBanks(x);
232+
}
224233
}
225234

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

296+
public void setFTrackBank(String name) {
297+
this.ftrackBank = name;
298+
}
299+
287300
public void setFTBank(String name) {
288301
this.ftBank = name;
289302
}
@@ -338,6 +351,7 @@ public boolean init() {
338351
this.registerOutputBank(cherenkovBank);
339352
this.registerOutputBank(trackBank);
340353
this.registerOutputBank(utrackBank);
354+
this.registerOutputBank(ftrackBank);
341355
this.registerOutputBank(crossBank);
342356
this.registerOutputBank(ftBank);
343357
this.registerOutputBank(trajectoryBank);

0 commit comments

Comments
 (0)