From 213221334b0be5d1e37df5a4bb8300e7fec55544 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Fri, 31 Jan 2025 19:00:36 -0500 Subject: [PATCH 01/17] created new FTOF::calib bank --- etc/bankdefs/hipo4/tof.json | 29 ++++++- .../rec/tof/banks/ftof/RecoBankWriter.java | 77 ++++++++++++++++--- 2 files changed, 95 insertions(+), 11 deletions(-) diff --git a/etc/bankdefs/hipo4/tof.json b/etc/bankdefs/hipo4/tof.json index d59609e816..baac7f8310 100644 --- a/etc/bankdefs/hipo4/tof.json +++ b/etc/bankdefs/hipo4/tof.json @@ -151,7 +151,34 @@ {"name":"midbarAlgo_1B_tCorr", "type":"F", "info":"corrected hit time using middle of bar algorithm to compute the path length between 1A and 1B"}, {"name":"EmaxAlgo_1B_tCorr", "type":"F", "info":"corrected hit time using Emax algorithm to compute the path length between 1A and 1B"} ] }, - + { + "name": "FTOF::calib", + "group": 21200, + "item" : 35, + "info": "reconstructed hit info from FTOF calibration", + "entries": [ + {"name":"id", "type":"S", "info":"id of the hit"}, + {"name":"status", "type":"S", "info":"hit status defined based on presence (0) or absence (1) of TDCR-TDCL-ADCR-ADCL"}, + {"name":"trackid", "type":"S", "info":"matched DC track id"}, + {"name":"sector", "type":"B", "info":"sector of FTOF"}, + {"name":"layer", "type":"B", "info":"panel id of FTOF (1-1A, 2-1B, 3-2"}, + {"name":"component", "type":"S", "info":"paddle id of FTOF"}, + {"name":"energy", "type":"F", "info":"E dep (MeV) of hit"}, + {"name":"time", "type":"F", "info":"Hit time (ns)"}, + {"name":"x", "type":"F", "info":"Global X coor (cm) of hit"}, + {"name":"y", "type":"F", "info":"Global Y coor (cm) of hit"}, + {"name":"z", "type":"F", "info":"Global Z coor (cm) of hit"}, + {"name":"tx", "type":"F", "info":"Global X coor (cm) of hit from DC info - trackid index"}, + {"name":"ty", "type":"F", "info":"Global Y coor (cm) of hit from DC info - trackid index"}, + {"name":"tz", "type":"F", "info":"Global Z coor (cm) of hit from DC info - trackid index"}, + {"name":"adc1", "type":"I", "info":"ADCL"}, + {"name":"adc2", "type":"I", "info":"ADCR"}, + {"name":"tdc1", "type":"I", "info":"TDCL"}, + {"name":"tdc2", "type":"I", "info":"TDCR"}, + {"name":"pathLength", "type":"F", "info":"pathlength of the track from the vertex (doca point to the beamline to the midpoint between the entrance and exit of the hit bar"}, + {"name":"pathLengthThruBar", "type":"F", "info":"pathlength of the track from the entrance point to the exit point through the hit bar "} + ] + }, { "name": "CTOF::rawhits", "group": 20400, diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/RecoBankWriter.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/RecoBankWriter.java index 8ab216be27..10baea4b55 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/RecoBankWriter.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/RecoBankWriter.java @@ -209,6 +209,65 @@ private DataBank fillMatchedClustersBank(DataEvent event, } } + public DataBank fillCalibBank(DataEvent event, List hitlist, String hitsType) { + if (hitlist == null) { + return null; + } + if (hitlist.isEmpty()) { + return null; + } + + if(hitsType.equalsIgnoreCase("FTOFHB")) + return null; + + int nrows=0; + for(Hit h : hitlist) { + if(h.get_TrkId()>0 && + h.get_TrkPosition()!=null && + h.get_TrkPosition().z()!=0) + nrows++; + } + if(nrows==0) return null; + + String bankName = "FTOF::calib"; + DataBank bank = event.createBank(bankName, nrows); + if (bank == null) { + System.err.println("COULD NOT CREATE A BANK!!!!!!"+bankName); + return null; + } + int irow=0; + for(Hit h : hitlist) { + if(h.get_TrkId()>0 && + h.get_TrkPosition()!=null && + h.get_TrkPosition().z()!=0) { + bank.setShort("id", irow, (short) h.get_Id()); + bank.setByte("sector", irow, (byte) h.get_Sector()); + bank.setByte("layer", irow, (byte) h.get_Panel()); + bank.setShort("component", irow, (short) h.get_Paddle()); + bank.setShort("status", irow, (short) h.getStatus()); + bank.setFloat("energy", irow, (float) h.get_Energy()); + bank.setFloat("time", irow, (float) h.get_t()); + bank.setFloat("x", irow, (float) h.get_Position().x()); + bank.setFloat("y", irow, (float) h.get_Position().y()); + bank.setFloat("z", irow, (float) h.get_Position().z()); + bank.setFloat("tx", irow, (float) h.get_TrkPosition().x()); + bank.setFloat("ty", irow, (float) h.get_TrkPosition().y()); + bank.setFloat("tz", irow, (float) h.get_TrkPosition().z()); + bank.setShort("trackid", irow, (short) h.get_TrkId()); + bank.setInt("adc1", irow, h.get_ADC1()); + bank.setInt("adc2", irow, h.get_ADC2()); + bank.setInt("tdc1", irow, h.get_TDC1()); + bank.setInt("tdc2", irow, h.get_TDC2()); + bank.setFloat("pathLength", irow, (float) h.get_TrkPathLen()); + bank.setFloat("pathLengthThruBar", irow, (float) h.get_TrkPathLenThruBar()); + irow++; + } + } + // bank.show(); + return bank; + + } + public void appendFTOFBanks(DataEvent event, List hits, List clusters, ArrayList matchedClusters, String hitsType) { List fTOFBanks = new ArrayList(); @@ -233,18 +292,16 @@ public void appendFTOFBanks(DataEvent event, List hits, List clust fTOFBanks.add(bank4); } - if (fTOFBanks.size() == 4) { - event.appendBanks(fTOFBanks.get(0), fTOFBanks.get(1), fTOFBanks.get(2), fTOFBanks.get(3)); - } - if (fTOFBanks.size() == 3) { - event.appendBanks(fTOFBanks.get(0), fTOFBanks.get(1), fTOFBanks.get(2)); + DataBank bank5 = this.fillCalibBank((DataEvent) event, hits, hitsType); + if (bank5 != null) { + fTOFBanks.add(bank5); } - if (fTOFBanks.size() == 2) { - event.appendBanks(fTOFBanks.get(0), fTOFBanks.get(1)); - } - if (fTOFBanks.size() == 1) { - event.appendBanks(fTOFBanks.get(0)); + + if(!fTOFBanks.isEmpty()) { + DataBank[] banks = new DataBank[fTOFBanks.size()]; + event.appendBanks(fTOFBanks.toArray(banks)); } + } From c5e1827d6dfee5607246bcc8e61da448f4a4e0c3 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Fri, 21 Feb 2025 18:34:32 -0500 Subject: [PATCH 02/17] first calibration service --- etc/bankdefs/hipo4/tof.json | 1 + reconstruction/calib/pom.xml | 35 +++++ .../org/jlab/service/calib/CalibEngine.java | 130 ++++++++++++++++++ reconstruction/pom.xml | 1 + .../rec/tof/banks/ftof/RecoBankWriter.java | 8 +- 5 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 reconstruction/calib/pom.xml create mode 100644 reconstruction/calib/src/main/java/org/jlab/service/calib/CalibEngine.java diff --git a/etc/bankdefs/hipo4/tof.json b/etc/bankdefs/hipo4/tof.json index baac7f8310..15ea984885 100644 --- a/etc/bankdefs/hipo4/tof.json +++ b/etc/bankdefs/hipo4/tof.json @@ -175,6 +175,7 @@ {"name":"adc2", "type":"I", "info":"ADCR"}, {"name":"tdc1", "type":"I", "info":"TDCL"}, {"name":"tdc2", "type":"I", "info":"TDCR"}, + {"name":"p", "type":"F", "info":"particle momentum"}, {"name":"pathLength", "type":"F", "info":"pathlength of the track from the vertex (doca point to the beamline to the midpoint between the entrance and exit of the hit bar"}, {"name":"pathLengthThruBar", "type":"F", "info":"pathlength of the track from the entrance point to the exit point through the hit bar "} ] diff --git a/reconstruction/calib/pom.xml b/reconstruction/calib/pom.xml new file mode 100644 index 0000000000..c9654713ae --- /dev/null +++ b/reconstruction/calib/pom.xml @@ -0,0 +1,35 @@ + + + 4.0.0 + + org.jlab.clas12.detector + clas12detector-calib + 1.0-SNAPSHOT + jar + + + org.jlab.clas + clas12rec + ../../parent/pom.xml + 11.1.1-SNAPSHOT + + + + + + org.jlab.clas + clas-io + 11.1.1-SNAPSHOT + + + + org.jlab.clas + clas-reco + 11.1.1-SNAPSHOT + + + + clas12detector-calib + diff --git a/reconstruction/calib/src/main/java/org/jlab/service/calib/CalibEngine.java b/reconstruction/calib/src/main/java/org/jlab/service/calib/CalibEngine.java new file mode 100644 index 0000000000..8fb9bf5557 --- /dev/null +++ b/reconstruction/calib/src/main/java/org/jlab/service/calib/CalibEngine.java @@ -0,0 +1,130 @@ +package org.jlab.service.calib; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; +import org.jlab.clas.reco.ReconstructionEngine; +import org.jlab.detector.base.DetectorType; +import org.jlab.io.base.DataBank; +import org.jlab.io.base.DataEvent; + +/** + * + * @author devita + */ +public class CalibEngine extends ReconstructionEngine { + + public static final String CONF_DETECTORS = "detectors"; + private List detectors = new ArrayList<>(); + + static final Logger logger = Logger.getLogger(CalibEngine.class.getName()); + + public CalibEngine() { + super("BG", "baltzell", "1.0"); + } + + @Override + public boolean init() { + String[] dets = getEngineConfigString(CONF_DETECTORS,"DC,FTOF").split(","); + for(String d : dets) { + DetectorType type = DetectorType.getType(d.trim()); + if(type != DetectorType.UNDEFINED) + detectors.add(type); + } + return !detectors.isEmpty(); + } + + @Override + public boolean processDataEvent(DataEvent event) { + this.createFTOFbank(event); + return true; + } + + private void createFTOFbank(DataEvent event) { + DataBank part = event.getBank("REC::Particle"); + DataBank scin = event.getBank("REC::Scintillator"); + DataBank trac = event.getBank("REC::Track"); + DataBank hits = event.getBank("FTOF::hits"); + DataBank adcs = event.getBank("FTOF::adc"); + DataBank tdcs = event.getBank("FTOF::tdc"); + + if(part!=null && scin!=null && hits!=null && adcs!=null && tdcs!=null) { + + if(part.rows()<2 || + part.getInt("pid", 0)!=11 || + ((int) (Math.abs(part.getShort("status", 0))/1000))!=2) + return; + + Map> paths = new HashMap<>(); + for(int is=0; is()); + paths.get(pindex).put(layer, path); + } + } + + + Map pinds = new HashMap<>(); + for(int it=0; it0) ngood++; + } + + if(ngood>0) { + DataBank calib = event.createBank("FTOF::calib", ngood); + + int row =0; + for(int i=0; i0) { + int pindex = pinds.get(tid-1); + int layer = hits.getByte("layer", i); + double path = paths.get(pindex).containsKey(layer) ? paths.get(pindex).get(layer) : 0; + double px = part.getFloat("px", pindex); + double py = part.getFloat("py", pindex); + double pz = part.getFloat("pz", pindex); + calib.setShort("id", row, hits.getShort("id", i)); + calib.setShort("status", row, hits.getShort("status", i)); + calib.setShort("trackid", row, hits.getShort("trackid", i)); + calib.setByte("sector", row, hits.getByte("sector", i)); + calib.setByte("layer", row, hits.getByte("layer", i)); + calib.setShort("component", row, hits.getShort("component", i)); + calib.setFloat("energy", row, hits.getFloat("energy", i)); + calib.setFloat("time", row, hits.getFloat("time", i)); + calib.setFloat("x", row, hits.getFloat("x", i)); + calib.setFloat("y", row, hits.getFloat("y", i)); + calib.setFloat("z", row, hits.getFloat("z", i)); + calib.setFloat("tx", row, hits.getFloat("tx", i)); + calib.setFloat("ty", row, hits.getFloat("ty", i)); + calib.setFloat("tz", row, hits.getFloat("tz", i)); + calib.setFloat("p", row, (float) Math.sqrt(px*px+py*py+pz*pz)); + calib.setFloat("pathLength", row, (float) path); + calib.setFloat("pathLengthThruBar", row, hits.getFloat("pathLengthThruBar", i)); + calib.setInt("adc1", row, adcs.getInt("ADC", hits.getShort("adc_idx1", i))); + calib.setInt("adc2", row, adcs.getInt("ADC", hits.getShort("adc_idx2", i))); + calib.setInt("tdc1", row, tdcs.getInt("TDC", hits.getShort("tdc_idx1", i))); + calib.setInt("tdc2", row, tdcs.getInt("TDC", hits.getShort("tdc_idx2", i))); + row++; + } + } + event.appendBank(calib); + } + } + } +} diff --git a/reconstruction/pom.xml b/reconstruction/pom.xml index 11b64932b2..d603747940 100644 --- a/reconstruction/pom.xml +++ b/reconstruction/pom.xml @@ -37,6 +37,7 @@ bg postproc recoil + calib diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/RecoBankWriter.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/RecoBankWriter.java index 10baea4b55..00b703f117 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/RecoBankWriter.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/RecoBankWriter.java @@ -292,10 +292,10 @@ public void appendFTOFBanks(DataEvent event, List hits, List clust fTOFBanks.add(bank4); } - DataBank bank5 = this.fillCalibBank((DataEvent) event, hits, hitsType); - if (bank5 != null) { - fTOFBanks.add(bank5); - } +// DataBank bank5 = this.fillCalibBank((DataEvent) event, hits, hitsType); +// if (bank5 != null) { +// fTOFBanks.add(bank5); +// } if(!fTOFBanks.isEmpty()) { DataBank[] banks = new DataBank[fTOFBanks.size()]; From fc6c12286addfeed67b0bd64a32b04f92c5321e0 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Mon, 24 Feb 2025 11:27:44 -0500 Subject: [PATCH 03/17] restructured calib service, added DC::calib --- etc/bankdefs/hipo4/dc.json | 37 +++++ etc/bankdefs/util/bankSplit.py | 2 +- .../calibration/detectors/DCCalibrator.java | 134 ++++++++++++++++++ .../detectors/DetectorCalibrator.java | 40 ++++++ .../calibration/detectors/FTOFCalibrator.java | 114 +++++++++++++++ .../calibration/service/CalibBankEngine.java | 66 +++++++++ .../org/jlab/service/calib/CalibEngine.java | 130 ----------------- 7 files changed, 392 insertions(+), 131 deletions(-) create mode 100644 reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCCalibrator.java create mode 100644 reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DetectorCalibrator.java create mode 100644 reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java create mode 100644 reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java delete mode 100644 reconstruction/calib/src/main/java/org/jlab/service/calib/CalibEngine.java diff --git a/etc/bankdefs/hipo4/dc.json b/etc/bankdefs/hipo4/dc.json index 53852e00b3..f2ef0bc3bb 100644 --- a/etc/bankdefs/hipo4/dc.json +++ b/etc/bankdefs/hipo4/dc.json @@ -580,6 +580,43 @@ {"name":"dx", "type":"F", "info":"pathlength of the track through the detector element (cm)"}, {"name":"edge", "type":"F", "info":"distance to the closest detector edge (cm), -1 if edge is not defined, 0 if outside, >0 if inside"} ] + }, + { + "name": "DC::calib", + "group": 20600, + "item" : 55, + "info": "reconstructed hits using DC timing information", + "entries": [ + {"name":"id", "type":"S", "info":"id of the hit"}, + {"name":"status", "type":"S", "info":"id of the hit"}, + {"name":"sector", "type":"B", "info":"DC sector"}, + {"name":"superlayer", "type":"B", "info":"DC superlayer (1...6)"}, + {"name":"layer", "type":"B", "info":"DC layer in superlayer (1...6)"}, + {"name":"wire", "type":"S", "info":"wire id of DC"}, + {"name":"TDC", "type":"I", "info":"raw time of the hit"}, + {"name":"jitter", "type":"B", "info":"time jitter (ns)"}, + {"name":"time", "type":"F", "info":"time used in tracking (ns)"}, + {"name":"doca", "type":"F", "info":"doca of the hit calculated from TDC (in cm)"}, + {"name":"docaError", "type":"F", "info":"uncertainty on doca of the hit calculated from TDC (in cm)"}, + {"name":"trkDoca", "type":"F", "info":"track doca of the hit (in cm)"}, + {"name":"timeResidual", "type":"F", "info":"time residual of the hit (in cm)"}, + {"name":"fitResidual", "type":"F", "info":"fit residual of the hit (in cm, from KF)"}, + {"name":"DAFWeight", "type":"F", "info":"Weight by DAF; the 1st bit of status indicates that a hit is belong to single or double"}, + {"name":"LR", "type":"B", "info":"Left/Right ambiguity of the hit"}, + {"name":"X", "type":"F", "info":"wire x-coordinate in tilted-sector"}, + {"name":"Z", "type":"F", "info":"wire z-coordinate in tilted-sector"}, + {"name":"B", "type":"F", "info":"B-field intensity at hit position in tilted-sector system"}, + {"name":"Alpha", "type":"F", "info":"local angle (degr.) in tilted-sector system"}, + {"name":"TProp", "type":"F", "info":"t propagation along the wire (ns)"}, + {"name":"TFlight", "type":"F", "info":"time of flight correction (ns)"}, + {"name":"T0", "type":"F", "info":"T0 (ns)"}, + {"name":"TStart", "type":"F", "info":"event start time used (ns)"}, + {"name":"beta", "type":"F", "info":"beta used in tracking"}, + {"name":"tBeta", "type":"F", "info":"beta-dependent time correction used in tracking"}, + {"name":"dDoca", "type":"F", "info":"delta Doca correction (cm)"}, + {"name":"clusterID", "type":"S", "info":"ID of associated cluster"}, + {"name":"trkID", "type":"B", "info":"ID of associated track"} + ] } ] diff --git a/etc/bankdefs/util/bankSplit.py b/etc/bankdefs/util/bankSplit.py index cb869f80c5..1e311fd88a 100755 --- a/etc/bankdefs/util/bankSplit.py +++ b/etc/bankdefs/util/bankSplit.py @@ -69,7 +69,7 @@ def create(dirname, banklist): dets = band + raster + rich + rtpc + alert # additions for the calibration schema: -calib = ["BAND::adc","BAND::laser","BAND::tdc","BAND::hits","BAND::rawhits","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","CVTRec::UTracks","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FMT::Hits","FMT::Clusters","FMT::Tracks","FMT::Trajectory","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTTRK::clusters","FTTRK::hits","FTTRK::crosses","FTOF::adc","FTOF::hits","FTOF::tdc","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","RASTER::adc","RF::adc","RF::tdc","RICH::tdc","RICH::Hit","RICH::Particle","RICH::Hadron","RICH::Photon","RICH::Ring","RTPC::adc","RTPC::hits","RTPC::tracks","RUN::rf","RUN::trigger","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBTracks"] +calib = ["BAND::adc","BAND::laser","BAND::tdc","BAND::hits","BAND::rawhits","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","CVTRec::UTracks","DC::calib","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FMT::Hits","FMT::Clusters","FMT::Tracks","FMT::Trajectory","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTTRK::clusters","FTTRK::hits","FTTRK::crosses","FTOF::adc","FTOF::calib","FTOF::hits","FTOF::tdc","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","RASTER::adc","RF::adc","RF::tdc","RICH::tdc","RICH::Hit","RICH::Particle","RICH::Hadron","RICH::Photon","RICH::Ring","RTPC::adc","RTPC::hits","RTPC::tracks","RUN::rf","RUN::trigger","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBTracks"] # additions for the monitoring schema: mon = ["BMT::adc","BMTRec::Clusters","BMTRec::Crosses","BMTRec::Hits","BMTRec::LayerEffs","BST::adc","BSTRec::Clusters","BSTRec::Crosses","BSTRec::Hits","BSTRec::LayerEffs","CND::clusters","CVTRec::Trajectory","ECAL::hits","FMT::adc","FTTRK::adc","HEL::adc","HitBasedTrkg::HBTracks","RAW::vtp","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::Trajectory"] diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCCalibrator.java new file mode 100644 index 0000000000..e241857ecb --- /dev/null +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCCalibrator.java @@ -0,0 +1,134 @@ +package org.jlab.calibration.detectors; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.jlab.detector.base.DetectorType; +import org.jlab.io.base.DataBank; +import org.jlab.io.base.DataEvent; + +/** + * + * @author devita + */ +public class DCCalibrator extends DetectorCalibrator { + + private static final int MINCLUSTERSIZE = 5; + private static final double MAXRESIDUAL = 0.1; // cm + + public DCCalibrator() { + super(DetectorType.DC); + super.init("TimeBasedTrkg::TBHits","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBTracks", + "REC::Track", "REC::Particle"); + } + @Override + public boolean isGoodEvent(DataEvent event) { + + DataBank part = event.getBank("REC::Particle"); + + if(part.rows()<2 || + part.getInt("pid", 0)!=11 || + (part.getFloat("chi2pid", 0))>3 || + ((int) (Math.abs(part.getShort("status", 0))/1000))!=2) + return false; + + boolean hasHadron = false; + for(int i=1; i pinds = new HashMap<>(); + for(int it=0; it> clusters = new HashMap<>(); + for(int i=0; i0 && + trackid>0 && + tflight>0 && + fitresiMINCLUSTERSIZE) + ngood += clusters.get(key).size(); + else + clusters.get(key).clear(); + } + + if(ngood>0) { + DataBank calib = event.createBank("DC::calib", ngood); + + int row = 0; + for(List cluster : clusters.values()) { + if(cluster.isEmpty()) continue; + for(int i : cluster) { + calib.setShort("id", row, tbhs.getShort("id",i)); + calib.setShort("status", row, tbhs.getShort("status",i)); + calib.setByte("superlayer", row, tbhs.getByte("superlayer",i)); + calib.setByte("layer", row, tbhs.getByte("layer",i)); + calib.setByte("sector", row, tbhs.getByte("sector",i)); + calib.setShort("wire", row, tbhs.getShort("wire",i)); + calib.setInt("TDC", row, tbhs.getInt("TDC",i)); + calib.setByte("jitter", row, tbhs.getByte("jitter",i)); + calib.setFloat("time", row, tbhs.getFloat("time",i)); + calib.setFloat("doca", row, tbhs.getFloat("doca",i)); + calib.setFloat("docaError", row, tbhs.getFloat("docaError",i)); + calib.setFloat("trkDoca", row, tbhs.getFloat("trkDoca",i)); + calib.setFloat("timeResidual", row, tbhs.getFloat("timeResidual",i)); + calib.setFloat("fitResidual", row, tbhs.getFloat("fitResidual",i)); + calib.setFloat("DAFWeight", row, tbhs.getFloat("DAFWeight",i)); + calib.setByte("LR", row, tbhs.getByte("LR",i)); + calib.setFloat("X", row, tbhs.getFloat("X",i)); + calib.setFloat("Z", row, tbhs.getFloat("Z",i)); + calib.setFloat("B", row, tbhs.getFloat("B",i)); + calib.setFloat("Alpha", row, tbhs.getFloat("Alpha",i)); + calib.setFloat("TProp", row, tbhs.getFloat("TProp",i)); + calib.setFloat("TFlight", row, tbhs.getFloat("TFlight",i)); + calib.setFloat("T0", row, tbhs.getFloat("T0",i)); + calib.setFloat("TStart", row, tbhs.getFloat("TStart",i)); + calib.setFloat("beta", row, tbhs.getFloat("beta",i)); + calib.setFloat("tBeta", row, tbhs.getFloat("tBeta",i)); + calib.setFloat("dDoca", row, tbhs.getFloat("dDoca",i)); + calib.setShort("clusterID", row, tbhs.getShort("clusterID",i)); + calib.setByte("trkID", row, tbhs.getByte("trkID",i)); + row++; + } + } + return calib; + } + return null; + } +} diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DetectorCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DetectorCalibrator.java new file mode 100644 index 0000000000..c72736a780 --- /dev/null +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DetectorCalibrator.java @@ -0,0 +1,40 @@ +package org.jlab.calibration.detectors; + +import java.util.Arrays; +import java.util.List; +import org.jlab.detector.base.DetectorType; +import org.jlab.io.base.DataBank; +import org.jlab.io.base.DataEvent; + +/** + * + * @author devita + */ +public abstract class DetectorCalibrator { + + private DetectorType type; + private List bankNames; + + public DetectorCalibrator(DetectorType type) { + this.type = type; + } + + public void init(String... banks) { + bankNames = Arrays.asList(banks); + } + + public DataBank getCalibBank(DataEvent event) { + for(String b : bankNames) + if(!event.hasBank(b)) + return null; + + if(this.isGoodEvent(event)) + return this.buildCalibBank(event); + else + return null; + } + + public abstract boolean isGoodEvent(DataEvent event); + + public abstract DataBank buildCalibBank(DataEvent event); +} diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java new file mode 100644 index 0000000000..104014eb57 --- /dev/null +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java @@ -0,0 +1,114 @@ +package org.jlab.calibration.detectors; + +import java.util.HashMap; +import java.util.Map; +import org.jlab.detector.base.DetectorType; +import org.jlab.io.base.DataBank; +import org.jlab.io.base.DataEvent; + +/** + * + * @author devita + */ +public class FTOFCalibrator extends DetectorCalibrator { + + public FTOFCalibrator() { + super(DetectorType.FTOF); + super.init("FTOF::adc", "FTOF::tdc", "FTOF::hits", "TimeBasedTrkg::TBTracks", + "REC::Track", "REC::Scintillator", "REC::Particle"); + } + @Override + public boolean isGoodEvent(DataEvent event) { + + DataBank part = event.getBank("REC::Particle"); + if(part.rows()<2 || + part.getInt("pid", 0)!=11 || + ((int) (Math.abs(part.getShort("status", 0))/1000))!=2) + return false; + + return true; + } + + @Override + public DataBank buildCalibBank(DataEvent event) { + DataBank part = event.getBank("REC::Particle"); + DataBank scin = event.getBank("REC::Scintillator"); + DataBank trac = event.getBank("REC::Track"); + DataBank tbts = event.getBank("TimeBasedTrkg::TBTracks"); + DataBank hits = event.getBank("FTOF::hits"); + DataBank adcs = event.getBank("FTOF::adc"); + DataBank tdcs = event.getBank("FTOF::tdc"); + + Map> paths = new HashMap<>(); + for(int is=0; is()); + paths.get(pindex).put(layer, path); + } + } + + + Map pinds = new HashMap<>(); + for(int it=0; it0) ngood++; + } + + if(ngood>0) { + DataBank calib = event.createBank("FTOF::calib", ngood); + + int row =0; + for(int i=0; i0) { + int pindex = pinds.get(tid); + int layer = hits.getByte("layer", i); + double path = paths.containsKey(pindex) && + paths.get(pindex).containsKey(layer) ? + paths.get(pindex).get(layer) : 0; + double px = part.getFloat("px", pindex); + double py = part.getFloat("py", pindex); + double pz = part.getFloat("pz", pindex); + calib.setShort("id", row, hits.getShort("id", i)); + calib.setShort("status", row, hits.getShort("status", i)); + calib.setShort("trackid", row, hits.getShort("trackid", i)); + calib.setByte("sector", row, hits.getByte("sector", i)); + calib.setByte("layer", row, hits.getByte("layer", i)); + calib.setShort("component", row, hits.getShort("component", i)); + calib.setFloat("energy", row, hits.getFloat("energy", i)); + calib.setFloat("time", row, hits.getFloat("time", i)); + calib.setFloat("x", row, hits.getFloat("x", i)); + calib.setFloat("y", row, hits.getFloat("y", i)); + calib.setFloat("z", row, hits.getFloat("z", i)); + calib.setFloat("tx", row, hits.getFloat("tx", i)); + calib.setFloat("ty", row, hits.getFloat("ty", i)); + calib.setFloat("tz", row, hits.getFloat("tz", i)); + calib.setFloat("p", row, (float) Math.sqrt(px*px+py*py+pz*pz)); + calib.setFloat("pathLength", row, (float) path); + calib.setFloat("pathLengthThruBar", row, hits.getFloat("pathLengthThruBar", i)); + calib.setInt("adc1", row, adcs.getInt("ADC", hits.getShort("adc_idx1", i))); + calib.setInt("adc2", row, adcs.getInt("ADC", hits.getShort("adc_idx2", i))); + calib.setInt("tdc1", row, tdcs.getInt("TDC", hits.getShort("tdc_idx1", i))); + calib.setInt("tdc2", row, tdcs.getInt("TDC", hits.getShort("tdc_idx2", i))); + row++; + } + } + return calib; + } + return null; + } +} diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java b/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java new file mode 100644 index 0000000000..b5c944ba59 --- /dev/null +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java @@ -0,0 +1,66 @@ +package org.jlab.calibration.service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; +import org.jlab.calibration.detectors.DCCalibrator; +import org.jlab.calibration.detectors.DetectorCalibrator; +import org.jlab.calibration.detectors.FTOFCalibrator; +import org.jlab.clas.reco.ReconstructionEngine; +import org.jlab.detector.base.DetectorType; +import org.jlab.io.base.DataBank; +import org.jlab.io.base.DataEvent; + +/** + * + * @author devita + */ +public class CalibBankEngine extends ReconstructionEngine { + + private Map calibrators = new HashMap<>(); + + public static final String CONF_DETECTORS = "detectors"; + private List detectors = new ArrayList<>(); + + static final Logger logger = Logger.getLogger(CalibBankEngine.class.getName()); + + public CalibBankEngine() { + super("BG", "baltzell", "1.0"); + calibrators.put(DetectorType.DC , new DCCalibrator()); + calibrators.put(DetectorType.FTOF, new FTOFCalibrator()); + } + + @Override + public boolean init() { + String[] dets = getEngineConfigString(CONF_DETECTORS,"DC,FTOF").split(","); + for(String d : dets) { + DetectorType type = DetectorType.getType(d.trim()); + if(type != DetectorType.UNDEFINED) + detectors.add(type); + } + return !detectors.isEmpty(); + } + + @Override + public boolean processDataEvent(DataEvent event) { + + List banks = new ArrayList<>(); + + for(DetectorType d : detectors) { + + DetectorCalibrator calibrator = calibrators.get(d); + + if(calibrator.isGoodEvent(event)) { + DataBank calib = calibrator.getCalibBank(event); + if(calib!=null) banks.add(calib); + } + } + + if(!banks.isEmpty()) + event.appendBanks(banks.toArray(new DataBank[banks.size()])); + return true; + } + +} diff --git a/reconstruction/calib/src/main/java/org/jlab/service/calib/CalibEngine.java b/reconstruction/calib/src/main/java/org/jlab/service/calib/CalibEngine.java deleted file mode 100644 index 8fb9bf5557..0000000000 --- a/reconstruction/calib/src/main/java/org/jlab/service/calib/CalibEngine.java +++ /dev/null @@ -1,130 +0,0 @@ -package org.jlab.service.calib; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; -import org.jlab.clas.reco.ReconstructionEngine; -import org.jlab.detector.base.DetectorType; -import org.jlab.io.base.DataBank; -import org.jlab.io.base.DataEvent; - -/** - * - * @author devita - */ -public class CalibEngine extends ReconstructionEngine { - - public static final String CONF_DETECTORS = "detectors"; - private List detectors = new ArrayList<>(); - - static final Logger logger = Logger.getLogger(CalibEngine.class.getName()); - - public CalibEngine() { - super("BG", "baltzell", "1.0"); - } - - @Override - public boolean init() { - String[] dets = getEngineConfigString(CONF_DETECTORS,"DC,FTOF").split(","); - for(String d : dets) { - DetectorType type = DetectorType.getType(d.trim()); - if(type != DetectorType.UNDEFINED) - detectors.add(type); - } - return !detectors.isEmpty(); - } - - @Override - public boolean processDataEvent(DataEvent event) { - this.createFTOFbank(event); - return true; - } - - private void createFTOFbank(DataEvent event) { - DataBank part = event.getBank("REC::Particle"); - DataBank scin = event.getBank("REC::Scintillator"); - DataBank trac = event.getBank("REC::Track"); - DataBank hits = event.getBank("FTOF::hits"); - DataBank adcs = event.getBank("FTOF::adc"); - DataBank tdcs = event.getBank("FTOF::tdc"); - - if(part!=null && scin!=null && hits!=null && adcs!=null && tdcs!=null) { - - if(part.rows()<2 || - part.getInt("pid", 0)!=11 || - ((int) (Math.abs(part.getShort("status", 0))/1000))!=2) - return; - - Map> paths = new HashMap<>(); - for(int is=0; is()); - paths.get(pindex).put(layer, path); - } - } - - - Map pinds = new HashMap<>(); - for(int it=0; it0) ngood++; - } - - if(ngood>0) { - DataBank calib = event.createBank("FTOF::calib", ngood); - - int row =0; - for(int i=0; i0) { - int pindex = pinds.get(tid-1); - int layer = hits.getByte("layer", i); - double path = paths.get(pindex).containsKey(layer) ? paths.get(pindex).get(layer) : 0; - double px = part.getFloat("px", pindex); - double py = part.getFloat("py", pindex); - double pz = part.getFloat("pz", pindex); - calib.setShort("id", row, hits.getShort("id", i)); - calib.setShort("status", row, hits.getShort("status", i)); - calib.setShort("trackid", row, hits.getShort("trackid", i)); - calib.setByte("sector", row, hits.getByte("sector", i)); - calib.setByte("layer", row, hits.getByte("layer", i)); - calib.setShort("component", row, hits.getShort("component", i)); - calib.setFloat("energy", row, hits.getFloat("energy", i)); - calib.setFloat("time", row, hits.getFloat("time", i)); - calib.setFloat("x", row, hits.getFloat("x", i)); - calib.setFloat("y", row, hits.getFloat("y", i)); - calib.setFloat("z", row, hits.getFloat("z", i)); - calib.setFloat("tx", row, hits.getFloat("tx", i)); - calib.setFloat("ty", row, hits.getFloat("ty", i)); - calib.setFloat("tz", row, hits.getFloat("tz", i)); - calib.setFloat("p", row, (float) Math.sqrt(px*px+py*py+pz*pz)); - calib.setFloat("pathLength", row, (float) path); - calib.setFloat("pathLengthThruBar", row, hits.getFloat("pathLengthThruBar", i)); - calib.setInt("adc1", row, adcs.getInt("ADC", hits.getShort("adc_idx1", i))); - calib.setInt("adc2", row, adcs.getInt("ADC", hits.getShort("adc_idx2", i))); - calib.setInt("tdc1", row, tdcs.getInt("TDC", hits.getShort("tdc_idx1", i))); - calib.setInt("tdc2", row, tdcs.getInt("TDC", hits.getShort("tdc_idx2", i))); - row++; - } - } - event.appendBank(calib); - } - } - } -} From cfef51009174fab80da7d3d6f464606df0c3deb1 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Mon, 24 Feb 2025 15:06:58 -0500 Subject: [PATCH 04/17] added RICH calibration filter --- etc/bankdefs/hipo4/rich.json | 46 +++++++++ etc/bankdefs/util/bankSplit.py | 2 +- .../detectors/DetectorCalibrator.java | 8 +- .../calibration/detectors/RICHCalibrator.java | 96 +++++++++++++++++++ .../calibration/service/CalibBankEngine.java | 18 +++- 5 files changed, 164 insertions(+), 6 deletions(-) create mode 100644 reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java diff --git a/etc/bankdefs/hipo4/rich.json b/etc/bankdefs/hipo4/rich.json index bb92d867dc..ffa7bc9b6d 100644 --- a/etc/bankdefs/hipo4/rich.json +++ b/etc/bankdefs/hipo4/rich.json @@ -220,5 +220,51 @@ {"name":"best_ntot", "type":"F", "info":"Number of photon used for likelihood"}, {"name":"best_mass", "type":"F", "info":"Reconstructed mass for best hypothesis"} ] + }, + { + "name": "RICH::calib", + "group": 21800, + "item" : 51, + "info": "Reconstructed Photons in RICH selected for detector calibration", + "entries": [ + {"name":"id", "type":"S", "info":"id" }, + {"name":"hindex", "type":"S", "info":"related row in the RICH::hits bank"}, + {"name":"pindex", "type":"B", "info":"related row in the REC::Particle bank"}, + {"name":"sector", "type":"B", "info":"Hit sector"}, + {"name":"tile", "type":"S", "info":"Hit tile"}, + {"name":"pmt", "type":"S", "info":"Hit pmt" }, + {"name":"anode", "type":"S", "info":"Hit anode" }, + {"name":"x", "type":"F", "info":"Hit x" }, + {"name":"y", "type":"F", "info":"Hit y" }, + {"name":"z", "type":"F", "info":"Hit z" }, + {"name":"time", "type":"F", "info":"Hit time" }, + {"name":"rawtime", "type":"F", "info":"Hit rawtime" }, + {"name":"duration", "type":"S", "info":"Hit duration" }, + {"name":"status", "type":"S", "info":"Hit status" }, + {"name":"type", "type":"S", "info":"hypo (0=ele, 1=pion, 2=kaon, 3=proto) + reco (0=real hit, 10=trial)"}, + {"name":"used", "type":"B", "info":"eligible for PID in time (1=yes, 0=no) angle (10=yes, 0=no) hypo (100=by other)"}, + {"name":"traced_the", "type":"F", "info":"Lab theta angle for traced solution"}, + {"name":"traced_phi", "type":"F", "info":"Lab phi angle for traced solution"}, + {"name":"traced_hitx", "type":"F", "info":"Lab hitx angle for traced solution"}, + {"name":"traced_hity", "type":"F", "info":"Lab hity angle for traced solution"}, + {"name":"traced_hitz", "type":"F", "info":"Lab hitz angle for traced solution"}, + {"name":"traced_path", "type":"F", "info":"path for traced solution"}, + {"name":"traced_time", "type":"F", "info":"time for traced solution"}, + {"name":"traced_stime", "type":"F", "info":"time rms for traced solution"}, + {"name":"traced_nrfl", "type":"S", "info":"n reflections for traced solution"}, + {"name":"traced_nrfr", "type":"S", "info":"n refractions for traced solution"}, + {"name":"traced_1rfl", "type":"S", "info":"first reflection type for traced solution"}, + {"name":"traced_layers", "type":"I", "info":"sequence of hit layers (reflections)"}, + {"name":"traced_compos", "type":"I", "info":"sequence of hit components (reflections)"}, + {"name":"traced_etaC", "type":"F", "info":"etaC angle for traced solution" }, + {"name":"traced_aeron", "type":"F", "info":"n for traced solution" }, + {"name":"traced_dthe", "type":"F", "info":"pixel equivalent dthe for traced solution" }, + {"name":"traced_dphi", "type":"F", "info":"pixel equivalent dphi for traced solution" }, + {"name":"eff", "type":"F", "info":"photon detection efficiency for likelihood"}, + {"name":"back", "type":"F", "info":"background level for likelihood"}, + {"name":"etac_ref", "type":"F", "info":"Cherenkov angle expected value"}, + {"name":"etac_rms", "type":"F", "info":"Cherenkov angle expected resolution"}, + {"name":"prob", "type":"F", "info":"probability for traced solution with given hypo"} + ] } ] diff --git a/etc/bankdefs/util/bankSplit.py b/etc/bankdefs/util/bankSplit.py index 1e311fd88a..60b8d2f043 100755 --- a/etc/bankdefs/util/bankSplit.py +++ b/etc/bankdefs/util/bankSplit.py @@ -69,7 +69,7 @@ def create(dirname, banklist): dets = band + raster + rich + rtpc + alert # additions for the calibration schema: -calib = ["BAND::adc","BAND::laser","BAND::tdc","BAND::hits","BAND::rawhits","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","CVTRec::UTracks","DC::calib","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FMT::Hits","FMT::Clusters","FMT::Tracks","FMT::Trajectory","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTTRK::clusters","FTTRK::hits","FTTRK::crosses","FTOF::adc","FTOF::calib","FTOF::hits","FTOF::tdc","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","RASTER::adc","RF::adc","RF::tdc","RICH::tdc","RICH::Hit","RICH::Particle","RICH::Hadron","RICH::Photon","RICH::Ring","RTPC::adc","RTPC::hits","RTPC::tracks","RUN::rf","RUN::trigger","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBTracks"] +calib = ["BAND::adc","BAND::laser","BAND::tdc","BAND::hits","BAND::rawhits","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","CVTRec::UTracks","DC::calib","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FMT::Hits","FMT::Clusters","FMT::Tracks","FMT::Trajectory","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTTRK::clusters","FTTRK::hits","FTTRK::crosses","FTOF::adc","FTOF::calib","FTOF::hits","FTOF::tdc","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","RASTER::adc","RF::adc","RF::tdc","RICH::tdc","RICH::Hit","RICH::Particle","RICH::Hadron","RICH::Photon","RICH::Ring","RICH::calib","RTPC::adc","RTPC::hits","RTPC::tracks","RUN::rf","RUN::trigger","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBTracks"] # additions for the monitoring schema: mon = ["BMT::adc","BMTRec::Clusters","BMTRec::Crosses","BMTRec::Hits","BMTRec::LayerEffs","BST::adc","BSTRec::Clusters","BSTRec::Crosses","BSTRec::Hits","BSTRec::LayerEffs","CND::clusters","CVTRec::Trajectory","ECAL::hits","FMT::adc","FTTRK::adc","HEL::adc","HitBasedTrkg::HBTracks","RAW::vtp","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::Trajectory"] diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DetectorCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DetectorCalibrator.java index c72736a780..9d94e5f0e0 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DetectorCalibrator.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DetectorCalibrator.java @@ -14,15 +14,21 @@ public abstract class DetectorCalibrator { private DetectorType type; private List bankNames; - + private String outputBankName; + public DetectorCalibrator(DetectorType type) { this.type = type; + this.outputBankName = type.getName()+"::calib"; } public void init(String... banks) { bankNames = Arrays.asList(banks); } + public String getOutputBankName() { + return this.outputBankName; + } + public DataBank getCalibBank(DataEvent event) { for(String b : bankNames) if(!event.hasBank(b)) diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java new file mode 100644 index 0000000000..82a7c7a690 --- /dev/null +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java @@ -0,0 +1,96 @@ +package org.jlab.calibration.detectors; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.jlab.detector.base.DetectorType; +import org.jlab.io.base.DataBank; +import org.jlab.io.base.DataEvent; + +/** + * + * @author devita + */ +public class RICHCalibrator extends DetectorCalibrator { + + public RICHCalibrator() { + super(DetectorType.RICH); + super.init("RICH::Hit", "RICH::Photon", "REC::Particle"); + } + @Override + public boolean isGoodEvent(DataEvent event) { + + DataBank part = event.getBank("REC::Particle"); + if(part.rows()<1 || + part.getInt("pid", 0)!=11 || + ((int) (Math.abs(part.getShort("status", 0))/1000))!=2) + return false; + + return true; + } + + @Override + public DataBank buildCalibBank(DataEvent event) { + DataBank part = event.getBank("REC::Particle"); ; + DataBank hits = event.getBank("RICH::Hit"); + DataBank phos = event.getBank("RICH::Photon"); + + List goodHits = new ArrayList<>(); + for(int i=0; i calibrators = new HashMap<>(); + private final Map calibrators = new HashMap<>(); public static final String CONF_DETECTORS = "detectors"; - private List detectors = new ArrayList<>(); + private final List detectors = new ArrayList<>(); static final Logger logger = Logger.getLogger(CalibBankEngine.class.getName()); public CalibBankEngine() { - super("BG", "baltzell", "1.0"); + super("CALIB", "devita", "1.0"); calibrators.put(DetectorType.DC , new DCCalibrator()); calibrators.put(DetectorType.FTOF, new FTOFCalibrator()); + calibrators.put(DetectorType.RICH, new RICHCalibrator()); } @Override @@ -40,7 +42,15 @@ public boolean init() { if(type != DetectorType.UNDEFINED) detectors.add(type); } - return !detectors.isEmpty(); + if(detectors.isEmpty()) + return false; + + String[] outputBanks = new String[detectors.size()]; + for(int i=0; i Date: Mon, 24 Feb 2025 17:13:24 -0500 Subject: [PATCH 05/17] relaxed DC cuts, including RICH by default --- .../java/org/jlab/calibration/detectors/DCCalibrator.java | 7 ++++--- .../java/org/jlab/calibration/service/CalibBankEngine.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCCalibrator.java index e241857ecb..a1875c74fd 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCCalibrator.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCCalibrator.java @@ -16,6 +16,7 @@ public class DCCalibrator extends DetectorCalibrator { private static final int MINCLUSTERSIZE = 5; private static final double MAXRESIDUAL = 0.1; // cm + private static final double CHI2PIDCUT = 5; // cm public DCCalibrator() { super(DetectorType.DC); @@ -29,14 +30,14 @@ public boolean isGoodEvent(DataEvent event) { if(part.rows()<2 || part.getInt("pid", 0)!=11 || - (part.getFloat("chi2pid", 0))>3 || + (part.getFloat("chi2pid", 0))>CHI2PIDCUT || ((int) (Math.abs(part.getShort("status", 0))/1000))!=2) return false; boolean hasHadron = false; for(int i=1; iMINCLUSTERSIZE) + if(clusters.get(key).size()>=MINCLUSTERSIZE) ngood += clusters.get(key).size(); else clusters.get(key).clear(); diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java b/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java index c0795c67af..953482f52e 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java @@ -36,7 +36,7 @@ public CalibBankEngine() { @Override public boolean init() { - String[] dets = getEngineConfigString(CONF_DETECTORS,"DC,FTOF").split(","); + String[] dets = getEngineConfigString(CONF_DETECTORS,"DC,FTOF,RICH").split(","); for(String d : dets) { DetectorType type = DetectorType.getType(d.trim()); if(type != DetectorType.UNDEFINED) From b3c3b103d4868c108a63a95308b626a2d15f4cee Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Wed, 5 Mar 2025 15:55:01 -0500 Subject: [PATCH 06/17] added cluster hits to RICH::calib --- etc/bankdefs/hipo4/rich.json | 10 +---- .../calibration/detectors/RICHCalibrator.java | 38 ++++++++++++------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/etc/bankdefs/hipo4/rich.json b/etc/bankdefs/hipo4/rich.json index ffa7bc9b6d..43f60f0513 100644 --- a/etc/bankdefs/hipo4/rich.json +++ b/etc/bankdefs/hipo4/rich.json @@ -227,11 +227,9 @@ "item" : 51, "info": "Reconstructed Photons in RICH selected for detector calibration", "entries": [ - {"name":"id", "type":"S", "info":"id" }, {"name":"hindex", "type":"S", "info":"related row in the RICH::hits bank"}, {"name":"pindex", "type":"B", "info":"related row in the REC::Particle bank"}, {"name":"sector", "type":"B", "info":"Hit sector"}, - {"name":"tile", "type":"S", "info":"Hit tile"}, {"name":"pmt", "type":"S", "info":"Hit pmt" }, {"name":"anode", "type":"S", "info":"Hit anode" }, {"name":"x", "type":"F", "info":"Hit x" }, @@ -241,8 +239,7 @@ {"name":"rawtime", "type":"F", "info":"Hit rawtime" }, {"name":"duration", "type":"S", "info":"Hit duration" }, {"name":"status", "type":"S", "info":"Hit status" }, - {"name":"type", "type":"S", "info":"hypo (0=ele, 1=pion, 2=kaon, 3=proto) + reco (0=real hit, 10=trial)"}, - {"name":"used", "type":"B", "info":"eligible for PID in time (1=yes, 0=no) angle (10=yes, 0=no) hypo (100=by other)"}, + {"name":"used", "type":"B", "info":"eligible for PID in time (1=yes, 0=no) angle (10=yes, 0=no) hypo (100=by other) or cluster (2)"}, {"name":"traced_the", "type":"F", "info":"Lab theta angle for traced solution"}, {"name":"traced_phi", "type":"F", "info":"Lab phi angle for traced solution"}, {"name":"traced_hitx", "type":"F", "info":"Lab hitx angle for traced solution"}, @@ -257,11 +254,6 @@ {"name":"traced_layers", "type":"I", "info":"sequence of hit layers (reflections)"}, {"name":"traced_compos", "type":"I", "info":"sequence of hit components (reflections)"}, {"name":"traced_etaC", "type":"F", "info":"etaC angle for traced solution" }, - {"name":"traced_aeron", "type":"F", "info":"n for traced solution" }, - {"name":"traced_dthe", "type":"F", "info":"pixel equivalent dthe for traced solution" }, - {"name":"traced_dphi", "type":"F", "info":"pixel equivalent dphi for traced solution" }, - {"name":"eff", "type":"F", "info":"photon detection efficiency for likelihood"}, - {"name":"back", "type":"F", "info":"background level for likelihood"}, {"name":"etac_ref", "type":"F", "info":"Cherenkov angle expected value"}, {"name":"etac_rms", "type":"F", "info":"Cherenkov angle expected resolution"}, {"name":"prob", "type":"F", "info":"probability for traced solution with given hypo"} diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java index 82a7c7a690..249a9c5cc2 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java @@ -36,28 +36,31 @@ public DataBank buildCalibBank(DataEvent event) { DataBank hits = event.getBank("RICH::Hit"); DataBank phos = event.getBank("RICH::Photon"); - List goodHits = new ArrayList<>(); + List goodPhotons = new ArrayList<>(); for(int i=0; i goodClusters = new ArrayList<>(); + for(int i=0; i0) goodClusters.add(i); + } + + if(!goodPhotons.isEmpty() || !goodClusters.isEmpty()) { + DataBank calib = event.createBank("RICH::calib", goodPhotons.size()+goodClusters.size()); int row =0; - for(int i : goodHits) { + for(int i : goodPhotons) { int hindex = phos.getShort("hindex", i); - calib.setShort("id", row, phos.getShort("id", i)); calib.setByte( "pindex", row, phos.getByte("pindex", i)); calib.setShort("hindex", row, (short) hindex); calib.setByte( "sector", row, (byte) hits.getShort("sector", hindex)); - calib.setShort("tile", row, hits.getShort("tile", hindex)); calib.setShort("pmt", row, hits.getShort("pmt", hindex)); calib.setShort("anode", row, hits.getShort("anode", hindex)); calib.setShort("status", row, hits.getShort("status", hindex)); - calib.setShort("type", row, phos.getShort("type", i)); calib.setByte( "used", row, phos.getByte("used", i)); calib.setFloat("x", row, hits.getFloat("x", hindex)); calib.setFloat("y", row, hits.getFloat("y", hindex)); @@ -79,16 +82,25 @@ public DataBank buildCalibBank(DataEvent event) { calib.setInt("traced_layers", row, phos.getInt("traced_layers", i)); calib.setInt("traced_compos", row, phos.getInt("traced_compos", i)); calib.setFloat("traced_etaC", row, phos.getFloat("traced_etaC", i)); - calib.setFloat("traced_aeron", row, phos.getFloat("traced_aeron", i)); - calib.setFloat("traced_dthe", row, phos.getFloat("traced_dthe", i)); - calib.setFloat("traced_dphi", row, phos.getFloat("traced_dphi", i)); - calib.setFloat("eff", row, phos.getFloat("eff", i)); - calib.setFloat("back", row, phos.getFloat("back", i)); calib.setFloat("etac_ref", row, phos.getFloat("etac_ref", i)); calib.setFloat("etac_rms", row, phos.getFloat("etac_rms", i)); calib.setFloat("prob", row, phos.getFloat("prob", i)); row++; } + for(int i : goodClusters) { + calib.setShort("hindex", row, (short) i); + calib.setByte( "sector", row, (byte) hits.getShort("sector", i)); + calib.setShort("pmt", row, hits.getShort("pmt", i)); + calib.setShort("anode", row, hits.getShort("anode", i)); + calib.setShort("status", row, hits.getShort("status", i)); + calib.setByte( "used", row, (byte) 2); + calib.setFloat("y", row, hits.getFloat("y", i)); + calib.setFloat("z", row, hits.getFloat("z", i)); + calib.setFloat("time", row, hits.getFloat("time", i)); + calib.setFloat("rawtime", row, hits.getFloat("rawtime", i)); + calib.setShort("duration", row, hits.getShort("duration", i)); + row++; + } return calib; } return null; From 9f4b07f4361ac3de86f213e2baaa29c6da6f87e1 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Sun, 30 Mar 2025 17:15:20 -0400 Subject: [PATCH 07/17] adding missing variable in RICH::calib --- etc/bankdefs/util/bankSplit.py | 2 +- .../java/org/jlab/calibration/detectors/RICHCalibrator.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/bankdefs/util/bankSplit.py b/etc/bankdefs/util/bankSplit.py index 60b8d2f043..a7a2f63557 100755 --- a/etc/bankdefs/util/bankSplit.py +++ b/etc/bankdefs/util/bankSplit.py @@ -69,7 +69,7 @@ def create(dirname, banklist): dets = band + raster + rich + rtpc + alert # additions for the calibration schema: -calib = ["BAND::adc","BAND::laser","BAND::tdc","BAND::hits","BAND::rawhits","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","CVTRec::UTracks","DC::calib","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FMT::Hits","FMT::Clusters","FMT::Tracks","FMT::Trajectory","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTTRK::clusters","FTTRK::hits","FTTRK::crosses","FTOF::adc","FTOF::calib","FTOF::hits","FTOF::tdc","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","RASTER::adc","RF::adc","RF::tdc","RICH::tdc","RICH::Hit","RICH::Particle","RICH::Hadron","RICH::Photon","RICH::Ring","RICH::calib","RTPC::adc","RTPC::hits","RTPC::tracks","RUN::rf","RUN::trigger","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBTracks"] +calib = ["BAND::adc","BAND::laser","BAND::tdc","BAND::hits","BAND::rawhits","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","CVTRec::UTracks","DC::calib","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FMT::Hits","FMT::Clusters","FMT::Tracks","FMT::Trajectory","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTTRK::clusters","FTTRK::hits","FTTRK::crosses","FTOF::adc","FTOF::calib","FTOF::hits","FTOF::tdc","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","RASTER::adc","RF::adc","RF::tdc","RICH::tdc","RICH::Hit","RICH::Cluster","RICH::Particle","RICH::Hadron","RICH::Photon","RICH::Ring","RICH::calib","RTPC::adc","RTPC::hits","RTPC::tracks","RUN::rf","RUN::trigger","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBTracks"] # additions for the monitoring schema: mon = ["BMT::adc","BMTRec::Clusters","BMTRec::Crosses","BMTRec::Hits","BMTRec::LayerEffs","BST::adc","BSTRec::Clusters","BSTRec::Crosses","BSTRec::Hits","BSTRec::LayerEffs","CND::clusters","CVTRec::Trajectory","ECAL::hits","FMT::adc","FTTRK::adc","HEL::adc","HitBasedTrkg::HBTracks","RAW::vtp","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::Trajectory"] diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java index 249a9c5cc2..7f46f5a9ad 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java @@ -94,6 +94,7 @@ public DataBank buildCalibBank(DataEvent event) { calib.setShort("anode", row, hits.getShort("anode", i)); calib.setShort("status", row, hits.getShort("status", i)); calib.setByte( "used", row, (byte) 2); + calib.setFloat("x", row, hits.getFloat("x", i)); calib.setFloat("y", row, hits.getFloat("y", i)); calib.setFloat("z", row, hits.getFloat("z", i)); calib.setFloat("time", row, hits.getFloat("time", i)); From b7defd7952769b0c4dac42d6ef2ed53218f94154 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Wed, 2 Apr 2025 12:42:06 -0400 Subject: [PATCH 08/17] addind missing info to FTOF::calib and restore variables order in DC::calib --- etc/bankdefs/hipo4/dc.json | 8 ++++---- etc/bankdefs/hipo4/tof.json | 6 ++++++ .../jlab/calibration/detectors/FTOFCalibrator.java | 14 ++++++++++---- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/etc/bankdefs/hipo4/dc.json b/etc/bankdefs/hipo4/dc.json index f2ef0bc3bb..4558300006 100644 --- a/etc/bankdefs/hipo4/dc.json +++ b/etc/bankdefs/hipo4/dc.json @@ -595,7 +595,6 @@ {"name":"wire", "type":"S", "info":"wire id of DC"}, {"name":"TDC", "type":"I", "info":"raw time of the hit"}, {"name":"jitter", "type":"B", "info":"time jitter (ns)"}, - {"name":"time", "type":"F", "info":"time used in tracking (ns)"}, {"name":"doca", "type":"F", "info":"doca of the hit calculated from TDC (in cm)"}, {"name":"docaError", "type":"F", "info":"uncertainty on doca of the hit calculated from TDC (in cm)"}, {"name":"trkDoca", "type":"F", "info":"track doca of the hit (in cm)"}, @@ -611,11 +610,12 @@ {"name":"TFlight", "type":"F", "info":"time of flight correction (ns)"}, {"name":"T0", "type":"F", "info":"T0 (ns)"}, {"name":"TStart", "type":"F", "info":"event start time used (ns)"}, - {"name":"beta", "type":"F", "info":"beta used in tracking"}, - {"name":"tBeta", "type":"F", "info":"beta-dependent time correction used in tracking"}, {"name":"dDoca", "type":"F", "info":"delta Doca correction (cm)"}, {"name":"clusterID", "type":"S", "info":"ID of associated cluster"}, - {"name":"trkID", "type":"B", "info":"ID of associated track"} + {"name":"trkID", "type":"B", "info":"ID of associated track"}, + {"name":"time", "type":"F", "info":"time used in tracking (ns)"}, + {"name":"beta", "type":"F", "info":"beta used in tracking"}, + {"name":"tBeta", "type":"F", "info":"beta-dependent time correction used in tracking"} ] } diff --git a/etc/bankdefs/hipo4/tof.json b/etc/bankdefs/hipo4/tof.json index 15ea984885..2bfececf46 100644 --- a/etc/bankdefs/hipo4/tof.json +++ b/etc/bankdefs/hipo4/tof.json @@ -175,7 +175,13 @@ {"name":"adc2", "type":"I", "info":"ADCR"}, {"name":"tdc1", "type":"I", "info":"TDCL"}, {"name":"tdc2", "type":"I", "info":"TDCR"}, + {"name":"pindex", "type":"S", "info":"particle positionin REC::Particle"}, + {"name":"pid", "type":"I", "info":"particle id"}, + {"name":"charge", "type":"B", "info":"particle charge"}, {"name":"p", "type":"F", "info":"particle momentum"}, + {"name":"vz", "type":"F", "info":"particle vertex z coordinate"}, + {"name":"chi2", "type":"F", "info":"track chi2"}, + {"name":"NDF", "type":"S", "info":"NDF"}, {"name":"pathLength", "type":"F", "info":"pathlength of the track from the vertex (doca point to the beamline to the midpoint between the entrance and exit of the hit bar"}, {"name":"pathLengthThruBar", "type":"F", "info":"pathlength of the track from the entrance point to the exit point through the hit bar "} ] diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java index 104014eb57..e59534cf6a 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java @@ -53,13 +53,12 @@ public DataBank buildCalibBank(DataEvent event) { } - Map pinds = new HashMap<>(); + Map tinds = new HashMap<>(); for(int it=0; it0) { - int pindex = pinds.get(tid); + int tindex = tinds.get(tid); + int pindex = trac.getShort("pindex", tindex); int layer = hits.getByte("layer", i); double path = paths.containsKey(pindex) && paths.get(pindex).containsKey(layer) ? @@ -86,6 +86,7 @@ public DataBank buildCalibBank(DataEvent event) { calib.setShort("id", row, hits.getShort("id", i)); calib.setShort("status", row, hits.getShort("status", i)); calib.setShort("trackid", row, hits.getShort("trackid", i)); + calib.setShort("pindex", row, (short) pindex); calib.setByte("sector", row, hits.getByte("sector", i)); calib.setByte("layer", row, hits.getByte("layer", i)); calib.setShort("component", row, hits.getShort("component", i)); @@ -97,9 +98,14 @@ public DataBank buildCalibBank(DataEvent event) { calib.setFloat("tx", row, hits.getFloat("tx", i)); calib.setFloat("ty", row, hits.getFloat("ty", i)); calib.setFloat("tz", row, hits.getFloat("tz", i)); + calib.setInt("pid", row, part.getInt("pid", pindex)); + calib.setByte("charge", row, part.getByte("charge", pindex)); calib.setFloat("p", row, (float) Math.sqrt(px*px+py*py+pz*pz)); + calib.setFloat("vz", row, part.getFloat("vz", pindex)); calib.setFloat("pathLength", row, (float) path); calib.setFloat("pathLengthThruBar", row, hits.getFloat("pathLengthThruBar", i)); + calib.setFloat("chi2", row, trac.getFloat("chi2", tindex)); + calib.setShort("NDF", row, trac.getShort("NDF", tindex)); calib.setInt("adc1", row, adcs.getInt("ADC", hits.getShort("adc_idx1", i))); calib.setInt("adc2", row, adcs.getInt("ADC", hits.getShort("adc_idx2", i))); calib.setInt("tdc1", row, tdcs.getInt("TDC", hits.getShort("tdc_idx1", i))); From 234064c27c9996c361bd0edf501928b16e004162 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Fri, 16 May 2025 19:29:19 -0400 Subject: [PATCH 09/17] few more variables for RICH::calib --- etc/bankdefs/hipo4/rich.json | 6 +++++- .../calibration/detectors/RICHCalibrator.java | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/etc/bankdefs/hipo4/rich.json b/etc/bankdefs/hipo4/rich.json index 43f60f0513..8b5a57415d 100644 --- a/etc/bankdefs/hipo4/rich.json +++ b/etc/bankdefs/hipo4/rich.json @@ -240,6 +240,11 @@ {"name":"duration", "type":"S", "info":"Hit duration" }, {"name":"status", "type":"S", "info":"Hit status" }, {"name":"used", "type":"B", "info":"eligible for PID in time (1=yes, 0=no) angle (10=yes, 0=no) hypo (100=by other) or cluster (2)"}, + {"name":"emilay", "type":"B", "info":"aerogel layer of photon emission"}, + {"name":"emico", "type":"B", "info":"aerogel component of photon emission"}, + {"name":"enico", "type":"B", "info":"aerogel component of photon entrance point"}, + {"name":"emqua", "type":"S", "info":"aerogel quadrant of photon emission"}, + {"name":"start_time", "type":"F", "info":"time at photon emission point"}, {"name":"traced_the", "type":"F", "info":"Lab theta angle for traced solution"}, {"name":"traced_phi", "type":"F", "info":"Lab phi angle for traced solution"}, {"name":"traced_hitx", "type":"F", "info":"Lab hitx angle for traced solution"}, @@ -247,7 +252,6 @@ {"name":"traced_hitz", "type":"F", "info":"Lab hitz angle for traced solution"}, {"name":"traced_path", "type":"F", "info":"path for traced solution"}, {"name":"traced_time", "type":"F", "info":"time for traced solution"}, - {"name":"traced_stime", "type":"F", "info":"time rms for traced solution"}, {"name":"traced_nrfl", "type":"S", "info":"n reflections for traced solution"}, {"name":"traced_nrfr", "type":"S", "info":"n refractions for traced solution"}, {"name":"traced_1rfl", "type":"S", "info":"first reflection type for traced solution"}, diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java index 7f46f5a9ad..acd1ab0729 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java @@ -32,7 +32,8 @@ public boolean isGoodEvent(DataEvent event) { @Override public DataBank buildCalibBank(DataEvent event) { - DataBank part = event.getBank("REC::Particle"); ; + DataBank part = event.getBank("REC::Particle"); + DataBank rich = event.getBank("RICH::Particle"); DataBank hits = event.getBank("RICH::Hit"); DataBank phos = event.getBank("RICH::Photon"); @@ -43,6 +44,12 @@ public DataBank buildCalibBank(DataEvent event) { if(part.getInt("pid", pindex)==pid) goodPhotons.add(i); } + Map part2Rich = new HashMap<>(); + for(int i=0; i goodClusters = new ArrayList<>(); for(int i=0; i Date: Thu, 19 Jun 2025 19:14:31 -0400 Subject: [PATCH 10/17] finalized FTOF:;calib --- etc/bankdefs/hipo4/tof.json | 6 +++++- reconstruction/calib/pom.xml | 6 +++--- .../org/jlab/calibration/detectors/FTOFCalibrator.java | 9 +++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/etc/bankdefs/hipo4/tof.json b/etc/bankdefs/hipo4/tof.json index 2bfececf46..3f60897bc9 100644 --- a/etc/bankdefs/hipo4/tof.json +++ b/etc/bankdefs/hipo4/tof.json @@ -178,7 +178,11 @@ {"name":"pindex", "type":"S", "info":"particle positionin REC::Particle"}, {"name":"pid", "type":"I", "info":"particle id"}, {"name":"charge", "type":"B", "info":"particle charge"}, - {"name":"p", "type":"F", "info":"particle momentum"}, + {"name":"px", "type":"F", "info":"particle momentum x component"}, + {"name":"py", "type":"F", "info":"particle momentum y component"}, + {"name":"pz", "type":"F", "info":"particle momentum z component"}, + {"name":"vx", "type":"F", "info":"particle vertex x coordinate"}, + {"name":"vy", "type":"F", "info":"particle vertex y coordinate"}, {"name":"vz", "type":"F", "info":"particle vertex z coordinate"}, {"name":"chi2", "type":"F", "info":"track chi2"}, {"name":"NDF", "type":"S", "info":"NDF"}, diff --git a/reconstruction/calib/pom.xml b/reconstruction/calib/pom.xml index c9654713ae..3812d44a37 100644 --- a/reconstruction/calib/pom.xml +++ b/reconstruction/calib/pom.xml @@ -13,7 +13,7 @@ org.jlab.clas clas12rec ../../parent/pom.xml - 11.1.1-SNAPSHOT + 12.0.4t-SNAPSHOT @@ -21,13 +21,13 @@ org.jlab.clas clas-io - 11.1.1-SNAPSHOT + 12.0.4t-SNAPSHOT org.jlab.clas clas-reco - 11.1.1-SNAPSHOT + 12.0.4t-SNAPSHOT diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java index e59534cf6a..764a0c8e59 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java @@ -80,9 +80,6 @@ public DataBank buildCalibBank(DataEvent event) { double path = paths.containsKey(pindex) && paths.get(pindex).containsKey(layer) ? paths.get(pindex).get(layer) : 0; - double px = part.getFloat("px", pindex); - double py = part.getFloat("py", pindex); - double pz = part.getFloat("pz", pindex); calib.setShort("id", row, hits.getShort("id", i)); calib.setShort("status", row, hits.getShort("status", i)); calib.setShort("trackid", row, hits.getShort("trackid", i)); @@ -100,7 +97,11 @@ public DataBank buildCalibBank(DataEvent event) { calib.setFloat("tz", row, hits.getFloat("tz", i)); calib.setInt("pid", row, part.getInt("pid", pindex)); calib.setByte("charge", row, part.getByte("charge", pindex)); - calib.setFloat("p", row, (float) Math.sqrt(px*px+py*py+pz*pz)); + calib.setFloat("px", row, part.getFloat("px", pindex)); + calib.setFloat("py", row, part.getFloat("py", pindex)); + calib.setFloat("pz", row, part.getFloat("pz", pindex)); + calib.setFloat("vx", row, part.getFloat("vx", pindex)); + calib.setFloat("vy", row, part.getFloat("vy", pindex)); calib.setFloat("vz", row, part.getFloat("vz", pindex)); calib.setFloat("pathLength", row, (float) path); calib.setFloat("pathLengthThruBar", row, hits.getFloat("pathLengthThruBar", i)); From a1bb3c347b180c4cdb44a84a4cdc2f850d551395 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Wed, 25 Jun 2025 16:36:44 -0400 Subject: [PATCH 11/17] exteding to ctof --- etc/bankdefs/hipo4/tof.json | 41 +++++- .../calibration/detectors/CTOFCalibrator.java | 127 ++++++++++++++++++ .../calibration/service/CalibBankEngine.java | 2 + 3 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CTOFCalibrator.java diff --git a/etc/bankdefs/hipo4/tof.json b/etc/bankdefs/hipo4/tof.json index 3f60897bc9..6cc8001915 100644 --- a/etc/bankdefs/hipo4/tof.json +++ b/etc/bankdefs/hipo4/tof.json @@ -266,6 +266,43 @@ {"name":"z", "type":"F", "info":"Global Z coor (cm) of cluster seed"}, {"name":"pathLengthThruBar", "type":"F", "info":"pathlength of the track from the entrance point to the exit point through the cluster bars "} ] - } - + }, + { + "name": "CTOF::calib", + "group": 20400, + "item" : 25, + "info": "reconstructed hit info from CTOF calibration", + "entries": [ + {"name":"id", "type":"S", "info":"id of the hit"}, + {"name":"status", "type":"S", "info":"hit status defined based on presence (0) or absence (1) of TDCR-TDCL-ADCR-ADCL"}, + {"name":"trackid", "type":"S", "info":"matched DC track id"}, + {"name":"component", "type":"S", "info":"paddle id of CTOF"}, + {"name":"energy", "type":"F", "info":"E dep (MeV) of hit"}, + {"name":"time", "type":"F", "info":"Hit time (ns)"}, + {"name":"x", "type":"F", "info":"Global X coor (cm) of hit"}, + {"name":"y", "type":"F", "info":"Global Y coor (cm) of hit"}, + {"name":"z", "type":"F", "info":"Global Z coor (cm) of hit"}, + {"name":"tx", "type":"F", "info":"Global X coor (cm) of hit from DC info - trackid index"}, + {"name":"ty", "type":"F", "info":"Global Y coor (cm) of hit from DC info - trackid index"}, + {"name":"tz", "type":"F", "info":"Global Z coor (cm) of hit from DC info - trackid index"}, + {"name":"adc1", "type":"I", "info":"ADCL"}, + {"name":"adc2", "type":"I", "info":"ADCR"}, + {"name":"tdc1", "type":"I", "info":"TDCL"}, + {"name":"tdc2", "type":"I", "info":"TDCR"}, + {"name":"pindex", "type":"S", "info":"particle positionin REC::Particle"}, + {"name":"pid", "type":"I", "info":"particle id"}, + {"name":"charge", "type":"B", "info":"particle charge"}, + {"name":"px", "type":"F", "info":"particle momentum x component"}, + {"name":"py", "type":"F", "info":"particle momentum y component"}, + {"name":"pz", "type":"F", "info":"particle momentum z component"}, + {"name":"vx", "type":"F", "info":"particle vertex x coordinate"}, + {"name":"vy", "type":"F", "info":"particle vertex y coordinate"}, + {"name":"vz", "type":"F", "info":"particle vertex z coordinate"}, + {"name":"vt", "type":"F", "info":"vertex-corrected event start time" }, + {"name":"chi2", "type":"F", "info":"track chi2"}, + {"name":"NDF", "type":"S", "info":"NDF"}, + {"name":"pathLength", "type":"F", "info":"pathlength of the track from the vertex (doca point to the beamline to the midpoint between the entrance and exit of the hit bar"}, + {"name":"pathLengthThruBar", "type":"F", "info":"pathlength of the track from the entrance point to the exit point through the hit bar "} + ] + } ] diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CTOFCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CTOFCalibrator.java new file mode 100644 index 0000000000..4c51d5ffed --- /dev/null +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CTOFCalibrator.java @@ -0,0 +1,127 @@ +package org.jlab.calibration.detectors; + +import java.util.HashMap; +import java.util.Map; +import org.jlab.detector.base.DetectorType; +import org.jlab.io.base.DataBank; +import org.jlab.io.base.DataEvent; + +/** + * + * @author devita + */ +public class CTOFCalibrator extends DetectorCalibrator { + + public CTOFCalibrator() { + super(DetectorType.CTOF); + super.init("CTOF::adc", "CTOF::tdc", "CTOF::hits", "CVTRec::Tracks", + "REC::Track", "REC::Scintillator", "REC::Particle"); + } + @Override + public boolean isGoodEvent(DataEvent event) { + + DataBank part = event.getBank("REC::Particle"); + if(part.rows()<2 || + part.getInt("pid", 0)!=11 || + ((int) (Math.abs(part.getShort("status", 0))/1000))!=2) + return false; + else { + for(int i=1; i4000) + return true; + } + } + return false; + } + + @Override + public DataBank buildCalibBank(DataEvent event) { + DataBank part = event.getBank("REC::Particle"); + DataBank scin = event.getBank("REC::Scintillator"); + DataBank trac = event.getBank("REC::Track"); + DataBank cvts = event.getBank("CVTRec::Tracks"); + DataBank hits = event.getBank("CTOF::hits"); + DataBank adcs = event.getBank("CTOF::adc"); + DataBank tdcs = event.getBank("CTOF::tdc"); + + Map sinds = new HashMap<>(); + for(int is=0; is tinds = new HashMap<>(); + for(int it=0; it0 && tinds.containsKey(tid)) { + int tindex = tinds.get(tid); + int pindex = trac.getShort("pindex", tindex); + if(sinds.containsKey(pindex)) + ngood++; + } + } + + if(ngood>0) { + DataBank calib = event.createBank("CTOF::calib", ngood); + + int row =0; + for(int i=0; i0 && tinds.containsKey(tid)) { + int tindex = tinds.get(tid); + int pindex = trac.getShort("pindex", tindex); + if(sinds.containsKey(pindex)) { + int sindex = sinds.get(pindex); + calib.setShort("id", row, hits.getShort("id", i)); + calib.setShort("status", row, hits.getShort("status", i)); + calib.setShort("trackid", row, hits.getShort("trkID", i)); + calib.setShort("pindex", row, (short) pindex); + calib.setShort("component", row, hits.getShort("component", i)); + calib.setFloat("energy", row, hits.getFloat("energy", i)); + calib.setFloat("time", row, hits.getFloat("time", i)); + calib.setFloat("x", row, hits.getFloat("x", i)); + calib.setFloat("y", row, hits.getFloat("y", i)); + calib.setFloat("z", row, hits.getFloat("z", i)); + calib.setFloat("tx", row, scin.getFloat("hx", sindex)); + calib.setFloat("ty", row, scin.getFloat("hy", sindex)); + calib.setFloat("tz", row, scin.getFloat("hz", sindex)); + calib.setInt("pid", row, part.getInt("pid", pindex)); + calib.setByte("charge", row, part.getByte("charge", pindex)); + calib.setFloat("px", row, part.getFloat("px", pindex)); + calib.setFloat("py", row, part.getFloat("py", pindex)); + calib.setFloat("pz", row, part.getFloat("pz", pindex)); + calib.setFloat("vx", row, part.getFloat("vx", pindex)); + calib.setFloat("vy", row, part.getFloat("vy", pindex)); + calib.setFloat("vz", row, part.getFloat("vz", pindex)); + calib.setFloat("vt", row, part.getFloat("vt", pindex)); + calib.setFloat("pathLength", row, scin.getFloat("path", sindex)); + calib.setFloat("pathLengthThruBar", row, hits.getFloat("pathLengthThruBar", i)); + calib.setFloat("chi2", row, trac.getFloat("chi2", tindex)); + calib.setShort("NDF", row, trac.getShort("NDF", tindex)); + calib.setInt("adc1", row, adcs.getInt("ADC", hits.getShort("adc_idx1", i))); + calib.setInt("adc2", row, adcs.getInt("ADC", hits.getShort("adc_idx2", i))); + calib.setInt("tdc1", row, tdcs.getInt("TDC", hits.getShort("tdc_idx1", i))); + calib.setInt("tdc2", row, tdcs.getInt("TDC", hits.getShort("tdc_idx2", i))); + row++; + } + } + } + return calib; + } + return null; + } +} diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java b/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java index 953482f52e..e5c3f653b6 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Map; import java.util.logging.Logger; +import org.jlab.calibration.detectors.CTOFCalibrator; import org.jlab.calibration.detectors.DCCalibrator; import org.jlab.calibration.detectors.DetectorCalibrator; import org.jlab.calibration.detectors.FTOFCalibrator; @@ -31,6 +32,7 @@ public CalibBankEngine() { super("CALIB", "devita", "1.0"); calibrators.put(DetectorType.DC , new DCCalibrator()); calibrators.put(DetectorType.FTOF, new FTOFCalibrator()); + calibrators.put(DetectorType.CTOF, new CTOFCalibrator()); calibrators.put(DetectorType.RICH, new RICHCalibrator()); } From 9d63e8ccb3667a9440b66f56cf72efb308017ae1 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Mon, 4 Aug 2025 13:28:31 -0400 Subject: [PATCH 12/17] calib service: updated version number in pom, added ctof to defaults, updated schemas and yaml files --- etc/bankdefs/util/bankSplit.py | 4 ++-- etc/services/data-ai.yaml | 2 ++ etc/services/data-aicv.yaml | 2 ++ etc/services/data-cv.yaml | 2 ++ etc/services/dcalign.yaml | 2 ++ etc/services/denoise.yaml | 2 ++ etc/services/kpp.yaml | 2 ++ etc/services/mc-ai.yaml | 2 ++ etc/services/mc-aicv.yaml | 2 ++ etc/services/mc-cv.yaml | 2 ++ reconstruction/calib/pom.xml | 13 ++++++------- .../jlab/calibration/service/CalibBankEngine.java | 2 +- 12 files changed, 27 insertions(+), 10 deletions(-) diff --git a/etc/bankdefs/util/bankSplit.py b/etc/bankdefs/util/bankSplit.py index a7a2f63557..37d8e3f363 100755 --- a/etc/bankdefs/util/bankSplit.py +++ b/etc/bankdefs/util/bankSplit.py @@ -69,10 +69,10 @@ def create(dirname, banklist): dets = band + raster + rich + rtpc + alert # additions for the calibration schema: -calib = ["BAND::adc","BAND::laser","BAND::tdc","BAND::hits","BAND::rawhits","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","CVTRec::UTracks","DC::calib","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FMT::Hits","FMT::Clusters","FMT::Tracks","FMT::Trajectory","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTTRK::clusters","FTTRK::hits","FTTRK::crosses","FTOF::adc","FTOF::calib","FTOF::hits","FTOF::tdc","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","RASTER::adc","RF::adc","RF::tdc","RICH::tdc","RICH::Hit","RICH::Cluster","RICH::Particle","RICH::Hadron","RICH::Photon","RICH::Ring","RICH::calib","RTPC::adc","RTPC::hits","RTPC::tracks","RUN::rf","RUN::trigger","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBTracks"] +calib = ["BAND::adc","BAND::laser","BAND::tdc","BAND::hits","BAND::rawhits","CND::adc","CND::hits","CND::tdc","CTOF::calib","CVTRec::Tracks","CVTRec::UTracks","DC::calib","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FMT::Hits","FMT::Clusters","FMT::Tracks","FMT::Trajectory","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTTRK::clusters","FTTRK::hits","FTTRK::crosses","FTOF::adc","FTOF::calib","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","RASTER::adc","RF::adc","RF::tdc","RICH::calib","RTPC::adc","RTPC::hits","RTPC::tracks","RUN::rf","RUN::trigger","TimeBasedTrkg::TBTracks"] # additions for the monitoring schema: -mon = ["BMT::adc","BMTRec::Clusters","BMTRec::Crosses","BMTRec::Hits","BMTRec::LayerEffs","BST::adc","BSTRec::Clusters","BSTRec::Crosses","BSTRec::Hits","BSTRec::LayerEffs","CND::clusters","CVTRec::Trajectory","ECAL::hits","FMT::adc","FTTRK::adc","HEL::adc","HitBasedTrkg::HBTracks","RAW::vtp","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::Trajectory"] +mon = ["BMT::adc","BMTRec::Clusters","BMTRec::Crosses","BMTRec::Hits","BMTRec::LayerEffs","BST::adc","BSTRec::Clusters","BSTRec::Crosses","BSTRec::Hits","BSTRec::LayerEffs","CND::clusters","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Trajectory","ECAL::hits","FMT::adc","FTTRK::adc","FTOF::adc","FTOF::hits","FTOF::tdc","HEL::adc","HitBasedTrkg::HBTracks","RAW::vtp","RICH::Particle","RICH::Ring","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::Trajectory"] # trigger validation needs these: trig = ["RAW::vtp","HTCC::rec","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::hits","ECAL::moments","ECAL::peaks","ECAL::tdc","ECAL::trigger"] diff --git a/etc/services/data-ai.yaml b/etc/services/data-ai.yaml index 87dfb05f7c..48da8ced37 100644 --- a/etc/services/data-ai.yaml +++ b/etc/services/data-ai.yaml @@ -61,6 +61,8 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX + - class: org.jlab.calibration.service.CalibEngine + name: CALIB configuration: global: variation: rgb_spring2019 diff --git a/etc/services/data-aicv.yaml b/etc/services/data-aicv.yaml index 2014375db7..2e65b53365 100644 --- a/etc/services/data-aicv.yaml +++ b/etc/services/data-aicv.yaml @@ -72,6 +72,8 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX + - class: org.jlab.calibration.service.CalibEngine + name: CALIB configuration: global: variation: rgb_spring2019 diff --git a/etc/services/data-cv.yaml b/etc/services/data-cv.yaml index ec5d6a7599..4b4108a5be 100644 --- a/etc/services/data-cv.yaml +++ b/etc/services/data-cv.yaml @@ -59,6 +59,8 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX + - class: org.jlab.calibration.service.CalibEngine + name: CALIB configuration: global: variation: rgb_spring2019 diff --git a/etc/services/dcalign.yaml b/etc/services/dcalign.yaml index 2e90ebe9ac..81a70e69ef 100644 --- a/etc/services/dcalign.yaml +++ b/etc/services/dcalign.yaml @@ -51,6 +51,8 @@ services: name: RICH - class: org.jlab.service.rtpc.RTPCEngine name: RTPC + - class: org.jlab.calibration.service.CalibEngine + name: CALIB configuration: global: variation: rgb_spring2019 diff --git a/etc/services/denoise.yaml b/etc/services/denoise.yaml index 97d1c8d89d..0cce706fa5 100644 --- a/etc/services/denoise.yaml +++ b/etc/services/denoise.yaml @@ -74,6 +74,8 @@ services: name: RICH - class: org.jlab.service.rtpc.RTPCEngine name: RTPC + - class: org.jlab.calibration.service.CalibEngine + name: CALIB configuration: global: variation: rgb_spring2019 diff --git a/etc/services/kpp.yaml b/etc/services/kpp.yaml index ce9d4a7298..43db3fc3a0 100644 --- a/etc/services/kpp.yaml +++ b/etc/services/kpp.yaml @@ -70,6 +70,8 @@ services: name: RICH - class: org.jlab.service.rtpc.RTPCEngine name: RTPC + - class: org.jlab.calibration.service.CalibEngine + name: CALIB configuration: services: MAGFIELDS: diff --git a/etc/services/mc-ai.yaml b/etc/services/mc-ai.yaml index fed6688c01..8efa2dd4fa 100644 --- a/etc/services/mc-ai.yaml +++ b/etc/services/mc-ai.yaml @@ -61,6 +61,8 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX + - class: org.jlab.calibration.service.CalibEngine + name: CALIB configuration: # global: # variation: rga_fall2018_mc diff --git a/etc/services/mc-aicv.yaml b/etc/services/mc-aicv.yaml index bcbb864a6b..d9bc208cca 100644 --- a/etc/services/mc-aicv.yaml +++ b/etc/services/mc-aicv.yaml @@ -72,6 +72,8 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX + - class: org.jlab.calibration.service.CalibEngine + name: CALIB configuration: # global: # variation: rga_fall2018_mc diff --git a/etc/services/mc-cv.yaml b/etc/services/mc-cv.yaml index a7ec84aed3..e3a91b9a54 100644 --- a/etc/services/mc-cv.yaml +++ b/etc/services/mc-cv.yaml @@ -59,6 +59,8 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX + - class: org.jlab.calibration.service.CalibEngine + name: CALIB configuration: # global: # variation: rga_fall2018_mc diff --git a/reconstruction/calib/pom.xml b/reconstruction/calib/pom.xml index 3812d44a37..5ab3f3ea8d 100644 --- a/reconstruction/calib/pom.xml +++ b/reconstruction/calib/pom.xml @@ -6,14 +6,13 @@ org.jlab.clas12.detector clas12detector-calib - 1.0-SNAPSHOT + 13.1.0-SNAPSHOT jar - org.jlab.clas - clas12rec - ../../parent/pom.xml - 12.0.4t-SNAPSHOT + org.jlab.clas12 + reconstruction + 13.1.0-SNAPSHOT @@ -21,13 +20,13 @@ org.jlab.clas clas-io - 12.0.4t-SNAPSHOT + 13.1.0-SNAPSHOT org.jlab.clas clas-reco - 12.0.4t-SNAPSHOT + 13.1.0-SNAPSHOT diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java b/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java index e5c3f653b6..96b2df1bee 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java @@ -38,7 +38,7 @@ public CalibBankEngine() { @Override public boolean init() { - String[] dets = getEngineConfigString(CONF_DETECTORS,"DC,FTOF,RICH").split(","); + String[] dets = getEngineConfigString(CONF_DETECTORS,"CTOF,DC,FTOF,RICH").split(","); for(String d : dets) { DetectorType type = DetectorType.getType(d.trim()); if(type != DetectorType.UNDEFINED) From 052ff45a9ac20b739e368097453b6056eb95ec8f Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Mon, 4 Aug 2025 13:50:53 -0400 Subject: [PATCH 13/17] calib service: fixed service class name yaml files --- etc/services/data-ai.yaml | 2 +- etc/services/data-aicv.yaml | 2 +- etc/services/data-cv.yaml | 2 +- etc/services/dcalign.yaml | 2 +- etc/services/denoise.yaml | 2 +- etc/services/kpp.yaml | 2 +- etc/services/mc-ai.yaml | 2 +- etc/services/mc-aicv.yaml | 2 +- etc/services/mc-cv.yaml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/etc/services/data-ai.yaml b/etc/services/data-ai.yaml index 48da8ced37..46daa569c3 100644 --- a/etc/services/data-ai.yaml +++ b/etc/services/data-ai.yaml @@ -61,7 +61,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: global: diff --git a/etc/services/data-aicv.yaml b/etc/services/data-aicv.yaml index 2e65b53365..8516df30e3 100644 --- a/etc/services/data-aicv.yaml +++ b/etc/services/data-aicv.yaml @@ -72,7 +72,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: global: diff --git a/etc/services/data-cv.yaml b/etc/services/data-cv.yaml index 4b4108a5be..00554281fd 100644 --- a/etc/services/data-cv.yaml +++ b/etc/services/data-cv.yaml @@ -59,7 +59,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: global: diff --git a/etc/services/dcalign.yaml b/etc/services/dcalign.yaml index 81a70e69ef..692d3083a1 100644 --- a/etc/services/dcalign.yaml +++ b/etc/services/dcalign.yaml @@ -51,7 +51,7 @@ services: name: RICH - class: org.jlab.service.rtpc.RTPCEngine name: RTPC - - class: org.jlab.calibration.service.CalibEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: global: diff --git a/etc/services/denoise.yaml b/etc/services/denoise.yaml index 0cce706fa5..0c98be66a5 100644 --- a/etc/services/denoise.yaml +++ b/etc/services/denoise.yaml @@ -74,7 +74,7 @@ services: name: RICH - class: org.jlab.service.rtpc.RTPCEngine name: RTPC - - class: org.jlab.calibration.service.CalibEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: global: diff --git a/etc/services/kpp.yaml b/etc/services/kpp.yaml index 43db3fc3a0..d56b4f905f 100644 --- a/etc/services/kpp.yaml +++ b/etc/services/kpp.yaml @@ -70,7 +70,7 @@ services: name: RICH - class: org.jlab.service.rtpc.RTPCEngine name: RTPC - - class: org.jlab.calibration.service.CalibEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: services: diff --git a/etc/services/mc-ai.yaml b/etc/services/mc-ai.yaml index 8efa2dd4fa..8412fc9a15 100644 --- a/etc/services/mc-ai.yaml +++ b/etc/services/mc-ai.yaml @@ -61,7 +61,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: # global: diff --git a/etc/services/mc-aicv.yaml b/etc/services/mc-aicv.yaml index d9bc208cca..d86b4549d2 100644 --- a/etc/services/mc-aicv.yaml +++ b/etc/services/mc-aicv.yaml @@ -72,7 +72,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: # global: diff --git a/etc/services/mc-cv.yaml b/etc/services/mc-cv.yaml index e3a91b9a54..d3294abc34 100644 --- a/etc/services/mc-cv.yaml +++ b/etc/services/mc-cv.yaml @@ -59,7 +59,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: # global: From 68977e3238a9d982ef784330e09612ebbc13989e Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Mon, 4 Aug 2025 14:13:52 -0400 Subject: [PATCH 14/17] calib service: fixed service class name yaml files, again --- etc/services/data-ai.yaml | 2 +- etc/services/data-aicv.yaml | 2 +- etc/services/data-cv.yaml | 2 +- etc/services/dcalign.yaml | 2 +- etc/services/denoise.yaml | 2 +- etc/services/kpp.yaml | 2 +- etc/services/mc-ai.yaml | 2 +- etc/services/mc-aicv.yaml | 2 +- etc/services/mc-cv.yaml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/etc/services/data-ai.yaml b/etc/services/data-ai.yaml index 46daa569c3..de07a70949 100644 --- a/etc/services/data-ai.yaml +++ b/etc/services/data-ai.yaml @@ -61,7 +61,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibBanksEngine + - class: org.jlab.calibration.service.CalibBankEngine name: CALIB configuration: global: diff --git a/etc/services/data-aicv.yaml b/etc/services/data-aicv.yaml index 8516df30e3..37c7544155 100644 --- a/etc/services/data-aicv.yaml +++ b/etc/services/data-aicv.yaml @@ -72,7 +72,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibBanksEngine + - class: org.jlab.calibration.service.CalibBankEngine name: CALIB configuration: global: diff --git a/etc/services/data-cv.yaml b/etc/services/data-cv.yaml index 00554281fd..e31705f5e4 100644 --- a/etc/services/data-cv.yaml +++ b/etc/services/data-cv.yaml @@ -59,7 +59,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibBanksEngine + - class: org.jlab.calibration.service.CalibBankEngine name: CALIB configuration: global: diff --git a/etc/services/dcalign.yaml b/etc/services/dcalign.yaml index 692d3083a1..766233ae80 100644 --- a/etc/services/dcalign.yaml +++ b/etc/services/dcalign.yaml @@ -51,7 +51,7 @@ services: name: RICH - class: org.jlab.service.rtpc.RTPCEngine name: RTPC - - class: org.jlab.calibration.service.CalibBanksEngine + - class: org.jlab.calibration.service.CalibBankEngine name: CALIB configuration: global: diff --git a/etc/services/denoise.yaml b/etc/services/denoise.yaml index 0c98be66a5..6fd7828eae 100644 --- a/etc/services/denoise.yaml +++ b/etc/services/denoise.yaml @@ -74,7 +74,7 @@ services: name: RICH - class: org.jlab.service.rtpc.RTPCEngine name: RTPC - - class: org.jlab.calibration.service.CalibBanksEngine + - class: org.jlab.calibration.service.CalibBankEngine name: CALIB configuration: global: diff --git a/etc/services/kpp.yaml b/etc/services/kpp.yaml index d56b4f905f..533000be8d 100644 --- a/etc/services/kpp.yaml +++ b/etc/services/kpp.yaml @@ -70,7 +70,7 @@ services: name: RICH - class: org.jlab.service.rtpc.RTPCEngine name: RTPC - - class: org.jlab.calibration.service.CalibBanksEngine + - class: org.jlab.calibration.service.CalibBankEngine name: CALIB configuration: services: diff --git a/etc/services/mc-ai.yaml b/etc/services/mc-ai.yaml index 8412fc9a15..aed33ac510 100644 --- a/etc/services/mc-ai.yaml +++ b/etc/services/mc-ai.yaml @@ -61,7 +61,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibBanksEngine + - class: org.jlab.calibration.service.CalibBankEngine name: CALIB configuration: # global: diff --git a/etc/services/mc-aicv.yaml b/etc/services/mc-aicv.yaml index d86b4549d2..5df84eebc1 100644 --- a/etc/services/mc-aicv.yaml +++ b/etc/services/mc-aicv.yaml @@ -72,7 +72,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibBanksEngine + - class: org.jlab.calibration.service.CalibBankEngine name: CALIB configuration: # global: diff --git a/etc/services/mc-cv.yaml b/etc/services/mc-cv.yaml index d3294abc34..9cacb41a58 100644 --- a/etc/services/mc-cv.yaml +++ b/etc/services/mc-cv.yaml @@ -59,7 +59,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibBanksEngine + - class: org.jlab.calibration.service.CalibBankEngine name: CALIB configuration: # global: From c0e90aa47eb6219557a03ebb03e0b05f11fd4780 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Tue, 5 Aug 2025 12:02:37 -0400 Subject: [PATCH 15/17] added calib service to codeowners --- CODEOWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/CODEOWNERS b/CODEOWNERS index 4e5bf0dddb..15c8aeae9a 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -86,6 +86,7 @@ reconstruction/swaps/ @baltzell @raffaelladevita reconstruction/tof/ @zieglerv @raffaelladevita reconstruction/urwell/ @raffaelladevita @tongtongcao reconstruction/vtx/ @zieglerv +reconstruction/calib/ @raffaelladevita # etc etc/bankdefs/ @baltzell @raffaelladevita @c-dilks From f6ad0e2402a7e41c2781734b8a051d6a4daaee9b Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Tue, 5 Aug 2025 15:07:35 -0400 Subject: [PATCH 16/17] add missing dependency --- reconstruction/calib/pom.xml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/reconstruction/calib/pom.xml b/reconstruction/calib/pom.xml index 5ab3f3ea8d..dbe1b9e768 100644 --- a/reconstruction/calib/pom.xml +++ b/reconstruction/calib/pom.xml @@ -20,15 +20,20 @@ org.jlab.clas clas-io - 13.1.0-SNAPSHOT + 13.1.0-SNAPSHOT + + + + org.jlab.clas + clas-detector + 13.1.0-SNAPSHOT org.jlab.clas clas-reco - 13.1.0-SNAPSHOT + 13.1.0-SNAPSHOT - clas12detector-calib From 06e2a39071ccd451e5eb7dc6b53eeab173638c39 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Tue, 5 Aug 2025 15:40:22 -0400 Subject: [PATCH 17/17] cleanups and renaming --- etc/services/data-ai.yaml | 2 +- etc/services/data-aicv.yaml | 2 +- etc/services/data-cv.yaml | 2 +- etc/services/dcalign.yaml | 2 +- etc/services/denoise.yaml | 2 +- etc/services/kpp.yaml | 2 +- etc/services/mc-ai.yaml | 2 +- etc/services/mc-aicv.yaml | 2 +- etc/services/mc-cv.yaml | 2 +- ...OFCalibrator.java => CTOFBankBuilder.java} | 4 +- ...rCalibrator.java => CalibBankBuilder.java} | 4 +- .../{DCCalibrator.java => DCBankBuilder.java} | 4 +- ...OFCalibrator.java => FTOFBankBuilder.java} | 4 +- ...CHCalibrator.java => RICHBankBuilder.java} | 4 +- ...bBankEngine.java => CalibBanksEngine.java} | 28 +++---- .../rec/tof/banks/ftof/RecoBankWriter.java | 79 +++---------------- 16 files changed, 44 insertions(+), 101 deletions(-) rename reconstruction/calib/src/main/java/org/jlab/calibration/detectors/{CTOFCalibrator.java => CTOFBankBuilder.java} (98%) rename reconstruction/calib/src/main/java/org/jlab/calibration/detectors/{DetectorCalibrator.java => CalibBankBuilder.java} (91%) rename reconstruction/calib/src/main/java/org/jlab/calibration/detectors/{DCCalibrator.java => DCBankBuilder.java} (98%) rename reconstruction/calib/src/main/java/org/jlab/calibration/detectors/{FTOFCalibrator.java => FTOFBankBuilder.java} (98%) rename reconstruction/calib/src/main/java/org/jlab/calibration/detectors/{RICHCalibrator.java => RICHBankBuilder.java} (98%) rename reconstruction/calib/src/main/java/org/jlab/calibration/service/{CalibBankEngine.java => CalibBanksEngine.java} (66%) diff --git a/etc/services/data-ai.yaml b/etc/services/data-ai.yaml index de07a70949..46daa569c3 100644 --- a/etc/services/data-ai.yaml +++ b/etc/services/data-ai.yaml @@ -61,7 +61,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibBankEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: global: diff --git a/etc/services/data-aicv.yaml b/etc/services/data-aicv.yaml index 37c7544155..8516df30e3 100644 --- a/etc/services/data-aicv.yaml +++ b/etc/services/data-aicv.yaml @@ -72,7 +72,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibBankEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: global: diff --git a/etc/services/data-cv.yaml b/etc/services/data-cv.yaml index e31705f5e4..00554281fd 100644 --- a/etc/services/data-cv.yaml +++ b/etc/services/data-cv.yaml @@ -59,7 +59,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibBankEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: global: diff --git a/etc/services/dcalign.yaml b/etc/services/dcalign.yaml index 766233ae80..692d3083a1 100644 --- a/etc/services/dcalign.yaml +++ b/etc/services/dcalign.yaml @@ -51,7 +51,7 @@ services: name: RICH - class: org.jlab.service.rtpc.RTPCEngine name: RTPC - - class: org.jlab.calibration.service.CalibBankEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: global: diff --git a/etc/services/denoise.yaml b/etc/services/denoise.yaml index 6fd7828eae..0c98be66a5 100644 --- a/etc/services/denoise.yaml +++ b/etc/services/denoise.yaml @@ -74,7 +74,7 @@ services: name: RICH - class: org.jlab.service.rtpc.RTPCEngine name: RTPC - - class: org.jlab.calibration.service.CalibBankEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: global: diff --git a/etc/services/kpp.yaml b/etc/services/kpp.yaml index 533000be8d..d56b4f905f 100644 --- a/etc/services/kpp.yaml +++ b/etc/services/kpp.yaml @@ -70,7 +70,7 @@ services: name: RICH - class: org.jlab.service.rtpc.RTPCEngine name: RTPC - - class: org.jlab.calibration.service.CalibBankEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: services: diff --git a/etc/services/mc-ai.yaml b/etc/services/mc-ai.yaml index aed33ac510..8412fc9a15 100644 --- a/etc/services/mc-ai.yaml +++ b/etc/services/mc-ai.yaml @@ -61,7 +61,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibBankEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: # global: diff --git a/etc/services/mc-aicv.yaml b/etc/services/mc-aicv.yaml index 5df84eebc1..d86b4549d2 100644 --- a/etc/services/mc-aicv.yaml +++ b/etc/services/mc-aicv.yaml @@ -72,7 +72,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibBankEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: # global: diff --git a/etc/services/mc-cv.yaml b/etc/services/mc-cv.yaml index 9cacb41a58..d3294abc34 100644 --- a/etc/services/mc-cv.yaml +++ b/etc/services/mc-cv.yaml @@ -59,7 +59,7 @@ services: name: RTPC - class: org.jlab.rec.service.vtx.VTXEngine name: VTX - - class: org.jlab.calibration.service.CalibBankEngine + - class: org.jlab.calibration.service.CalibBanksEngine name: CALIB configuration: # global: diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CTOFCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CTOFBankBuilder.java similarity index 98% rename from reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CTOFCalibrator.java rename to reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CTOFBankBuilder.java index 4c51d5ffed..0da81f014d 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CTOFCalibrator.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CTOFBankBuilder.java @@ -10,9 +10,9 @@ * * @author devita */ -public class CTOFCalibrator extends DetectorCalibrator { +public class CTOFBankBuilder extends CalibBankBuilder { - public CTOFCalibrator() { + public CTOFBankBuilder() { super(DetectorType.CTOF); super.init("CTOF::adc", "CTOF::tdc", "CTOF::hits", "CVTRec::Tracks", "REC::Track", "REC::Scintillator", "REC::Particle"); diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DetectorCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CalibBankBuilder.java similarity index 91% rename from reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DetectorCalibrator.java rename to reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CalibBankBuilder.java index 9d94e5f0e0..b3d154ea10 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DetectorCalibrator.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/CalibBankBuilder.java @@ -10,13 +10,13 @@ * * @author devita */ -public abstract class DetectorCalibrator { +public abstract class CalibBankBuilder { private DetectorType type; private List bankNames; private String outputBankName; - public DetectorCalibrator(DetectorType type) { + public CalibBankBuilder(DetectorType type) { this.type = type; this.outputBankName = type.getName()+"::calib"; } diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCBankBuilder.java similarity index 98% rename from reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCCalibrator.java rename to reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCBankBuilder.java index a1875c74fd..26e67ab293 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCCalibrator.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/DCBankBuilder.java @@ -12,13 +12,13 @@ * * @author devita */ -public class DCCalibrator extends DetectorCalibrator { +public class DCBankBuilder extends CalibBankBuilder { private static final int MINCLUSTERSIZE = 5; private static final double MAXRESIDUAL = 0.1; // cm private static final double CHI2PIDCUT = 5; // cm - public DCCalibrator() { + public DCBankBuilder() { super(DetectorType.DC); super.init("TimeBasedTrkg::TBHits","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBTracks", "REC::Track", "REC::Particle"); diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFBankBuilder.java similarity index 98% rename from reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java rename to reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFBankBuilder.java index 764a0c8e59..0b9a540760 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFCalibrator.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/FTOFBankBuilder.java @@ -10,9 +10,9 @@ * * @author devita */ -public class FTOFCalibrator extends DetectorCalibrator { +public class FTOFBankBuilder extends CalibBankBuilder { - public FTOFCalibrator() { + public FTOFBankBuilder() { super(DetectorType.FTOF); super.init("FTOF::adc", "FTOF::tdc", "FTOF::hits", "TimeBasedTrkg::TBTracks", "REC::Track", "REC::Scintillator", "REC::Particle"); diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHBankBuilder.java similarity index 98% rename from reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java rename to reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHBankBuilder.java index acd1ab0729..5f52852a1f 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHCalibrator.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/detectors/RICHBankBuilder.java @@ -12,9 +12,9 @@ * * @author devita */ -public class RICHCalibrator extends DetectorCalibrator { +public class RICHBankBuilder extends CalibBankBuilder { - public RICHCalibrator() { + public RICHBankBuilder() { super(DetectorType.RICH); super.init("RICH::Hit", "RICH::Photon", "REC::Particle"); } diff --git a/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java b/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBanksEngine.java similarity index 66% rename from reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java rename to reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBanksEngine.java index 96b2df1bee..486ba3e748 100644 --- a/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBankEngine.java +++ b/reconstruction/calib/src/main/java/org/jlab/calibration/service/CalibBanksEngine.java @@ -5,11 +5,11 @@ import java.util.List; import java.util.Map; import java.util.logging.Logger; -import org.jlab.calibration.detectors.CTOFCalibrator; -import org.jlab.calibration.detectors.DCCalibrator; -import org.jlab.calibration.detectors.DetectorCalibrator; -import org.jlab.calibration.detectors.FTOFCalibrator; -import org.jlab.calibration.detectors.RICHCalibrator; +import org.jlab.calibration.detectors.CTOFBankBuilder; +import org.jlab.calibration.detectors.DCBankBuilder; +import org.jlab.calibration.detectors.CalibBankBuilder; +import org.jlab.calibration.detectors.FTOFBankBuilder; +import org.jlab.calibration.detectors.RICHBankBuilder; import org.jlab.clas.reco.ReconstructionEngine; import org.jlab.detector.base.DetectorType; import org.jlab.io.base.DataBank; @@ -19,21 +19,21 @@ * * @author devita */ -public class CalibBankEngine extends ReconstructionEngine { +public class CalibBanksEngine extends ReconstructionEngine { - private final Map calibrators = new HashMap<>(); + private final Map calibrators = new HashMap<>(); public static final String CONF_DETECTORS = "detectors"; private final List detectors = new ArrayList<>(); - static final Logger logger = Logger.getLogger(CalibBankEngine.class.getName()); + static final Logger logger = Logger.getLogger(CalibBanksEngine.class.getName()); - public CalibBankEngine() { + public CalibBanksEngine() { super("CALIB", "devita", "1.0"); - calibrators.put(DetectorType.DC , new DCCalibrator()); - calibrators.put(DetectorType.FTOF, new FTOFCalibrator()); - calibrators.put(DetectorType.CTOF, new CTOFCalibrator()); - calibrators.put(DetectorType.RICH, new RICHCalibrator()); + calibrators.put(DetectorType.DC , new DCBankBuilder()); + calibrators.put(DetectorType.FTOF, new FTOFBankBuilder()); + calibrators.put(DetectorType.CTOF, new CTOFBankBuilder()); + calibrators.put(DetectorType.RICH, new RICHBankBuilder()); } @Override @@ -62,7 +62,7 @@ public boolean processDataEvent(DataEvent event) { for(DetectorType d : detectors) { - DetectorCalibrator calibrator = calibrators.get(d); + CalibBankBuilder calibrator = calibrators.get(d); if(calibrator.isGoodEvent(event)) { DataBank calib = calibrator.getCalibBank(event); diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/RecoBankWriter.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/RecoBankWriter.java index 00b703f117..2692176c61 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/RecoBankWriter.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/RecoBankWriter.java @@ -209,65 +209,6 @@ private DataBank fillMatchedClustersBank(DataEvent event, } } - public DataBank fillCalibBank(DataEvent event, List hitlist, String hitsType) { - if (hitlist == null) { - return null; - } - if (hitlist.isEmpty()) { - return null; - } - - if(hitsType.equalsIgnoreCase("FTOFHB")) - return null; - - int nrows=0; - for(Hit h : hitlist) { - if(h.get_TrkId()>0 && - h.get_TrkPosition()!=null && - h.get_TrkPosition().z()!=0) - nrows++; - } - if(nrows==0) return null; - - String bankName = "FTOF::calib"; - DataBank bank = event.createBank(bankName, nrows); - if (bank == null) { - System.err.println("COULD NOT CREATE A BANK!!!!!!"+bankName); - return null; - } - int irow=0; - for(Hit h : hitlist) { - if(h.get_TrkId()>0 && - h.get_TrkPosition()!=null && - h.get_TrkPosition().z()!=0) { - bank.setShort("id", irow, (short) h.get_Id()); - bank.setByte("sector", irow, (byte) h.get_Sector()); - bank.setByte("layer", irow, (byte) h.get_Panel()); - bank.setShort("component", irow, (short) h.get_Paddle()); - bank.setShort("status", irow, (short) h.getStatus()); - bank.setFloat("energy", irow, (float) h.get_Energy()); - bank.setFloat("time", irow, (float) h.get_t()); - bank.setFloat("x", irow, (float) h.get_Position().x()); - bank.setFloat("y", irow, (float) h.get_Position().y()); - bank.setFloat("z", irow, (float) h.get_Position().z()); - bank.setFloat("tx", irow, (float) h.get_TrkPosition().x()); - bank.setFloat("ty", irow, (float) h.get_TrkPosition().y()); - bank.setFloat("tz", irow, (float) h.get_TrkPosition().z()); - bank.setShort("trackid", irow, (short) h.get_TrkId()); - bank.setInt("adc1", irow, h.get_ADC1()); - bank.setInt("adc2", irow, h.get_ADC2()); - bank.setInt("tdc1", irow, h.get_TDC1()); - bank.setInt("tdc2", irow, h.get_TDC2()); - bank.setFloat("pathLength", irow, (float) h.get_TrkPathLen()); - bank.setFloat("pathLengthThruBar", irow, (float) h.get_TrkPathLenThruBar()); - irow++; - } - } - // bank.show(); - return bank; - - } - public void appendFTOFBanks(DataEvent event, List hits, List clusters, ArrayList matchedClusters, String hitsType) { List fTOFBanks = new ArrayList(); @@ -292,17 +233,19 @@ public void appendFTOFBanks(DataEvent event, List hits, List clust fTOFBanks.add(bank4); } -// DataBank bank5 = this.fillCalibBank((DataEvent) event, hits, hitsType); -// if (bank5 != null) { -// fTOFBanks.add(bank5); -// } - - if(!fTOFBanks.isEmpty()) { - DataBank[] banks = new DataBank[fTOFBanks.size()]; - event.appendBanks(fTOFBanks.toArray(banks)); + if (fTOFBanks.size() == 4) { + event.appendBanks(fTOFBanks.get(0), fTOFBanks.get(1), fTOFBanks.get(2), fTOFBanks.get(3)); + } + if (fTOFBanks.size() == 3) { + event.appendBanks(fTOFBanks.get(0), fTOFBanks.get(1), fTOFBanks.get(2)); + } + if (fTOFBanks.size() == 2) { + event.appendBanks(fTOFBanks.get(0), fTOFBanks.get(1)); + } + if (fTOFBanks.size() == 1) { + event.appendBanks(fTOFBanks.get(0)); } - } }