From 65c45170edc477cecdaf4b2291378e6466d0795f Mon Sep 17 00:00:00 2001 From: hauenst Date: Tue, 14 Jan 2020 18:15:13 -0500 Subject: [PATCH 01/47] Started working on modification of BANK banks and RecoBankWriter. This version will not compile. --- etc/bankdefs/hipo4/band.json | 95 ++++++++++++++++--- .../jlab/rec/band/banks/RecoBankWriter.java | 3 + 2 files changed, 86 insertions(+), 12 deletions(-) diff --git a/etc/bankdefs/hipo4/band.json b/etc/bankdefs/hipo4/band.json index b19f02aa52..b788418473 100644 --- a/etc/bankdefs/hipo4/band.json +++ b/etc/bankdefs/hipo4/band.json @@ -8,23 +8,94 @@ {"name":"id", "type":"S", "info":"id of the coincidence hit"}, {"name":"sector", "type":"B", "info":"sector of BAND"}, {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, - {"name":"component", "type":"S", "info":"paddle or bad id of BAND"}, - {"name":"meantimeTdc", "type":"F", "info":"Calibrated meantime of L and R on a bar (ns) from TDC"}, - {"name":"meantimeFadc", "type":"F", "info":"Calibrated meantime of L and R on a bar (ns) from FADC"}, - {"name":"difftimeTdc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, - {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, - {"name":"adcLcorr", "type":"F", "info":"Calibrated ADC of left PMT of coincidence hit"}, - {"name":"adcRcorr", "type":"F", "info":"Calibrated ADC of right PMT of coincidence hit"}, - {"name":"tFadcLcorr", "type":"F", "info":"Calibrated time from FADC of left PMT in ns of coincidence hit"}, - {"name":"tFadcRcorr", "type":"F", "info":"Calibrated time from FADC of right PMT in ns of coincidence hit"}, - {"name":"tTdcLcorr", "type":"F", "info":"Calibrated time from TDC of left PMT in ns of coincidence hit"}, - {"name":"tTdcRcorr", "type":"F", "info":"Calibrated time from TDC of right PMT in ns of coincidence hit"}, + {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, + {"name":"energy", "type":"F", "info":"Geometric mean of L and R ADC"}, + {"name":"time", "type":"F", "info":"Meantime from TDC from L and R hit (ns)"}, + {"name":"timeFadc", "type":"F", "info":"Meantime from FADC from L and R hit (ns)"}, + {"name":"difftimeTdc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, + {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, + {"name":"left_idx", "type":"S", "info":"index of rawhit from Left PMT, starts at zero"}, + {"name":"right_idx", "type":"S", "info":"index of rawhit from Right PMT, starts at zero"}, {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, {"name":"ux", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, {"name":"uy", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, - {"name":"uz", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"} + {"name":"uz", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"}, + {"name":"status" "type":"S", "info":"status of the hit"} ] + }, + { + "name": "BAND::rawhits", + "group": 22100, + "item" : 22, + "info": "single PMT hits from BAND", + "entries": [ + {"name":"id", "type":"S", "info":"id of the coincidence hit"}, + {"name":"sector", "type":"B", "info":"sector of BAND"}, + {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, + {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, + {"name":"side", "type":"S", "info":"side of bar (L = 0 and R = 1)"}, + {"name":"time", "type":"F", "info":"Raw Time (ns) from TDC"}, + {"name":"timeFadc", "type":"F", "info":"Raw Time (ns) from FADC"}, + {"name":"timeCorr", "type":"F", "info":"Raw Time (ns) from TDC corrected for trigger phase"}, + {"name":"adc", "type":"F", "info":"Raw ADC from FADC"}, + {"name":"tdc_idx", "type":"S", "info":"index to raw information in BAND::TDC bank"}, + {"name":"adc_idx", "type":"S", "info":"index to raw information in BAND::ADC bank"}, + ] + }, + { + "name": "BAND::laser", + "group": 22100, + "item" : 23, + "info": "laser hits from BAND", + "entries": [ + {"name":"id", "type":"S", "info":"id of the coincidence hit"}, + {"name":"sector", "type":"B", "info":"sector of BAND"}, + {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, + {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, + {"name":"energy", "type":"F", "info":"Geometric mean of L and R ADC"}, + {"name":"time", "type":"F", "info":"Meantime from TDC from L and R hit (ns)"}, + {"name":"timeFadc", "type":"F", "info":"Meantime from FADC from L and R hit (ns)"}, + {"name":"difftimeTdc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, + {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, + {"name":"left_idx", "type":"S", "info":"index of rawhit from Left PMT, starts at zero"}, + {"name":"right_idx", "type":"S", "info":"index of rawhit from Right PMT, starts at zero"}, + {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, + {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, + {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, + {"name":"ux", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, + {"name":"uy", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, + {"name":"uz", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"}, + {"name":"status" "type":"S", "info":"status of the hit"} + ] + }, + { + "name": "BAND::oldHits", + "group": 22100, + "item" : 24, + "info": " hits from BAND (old version)", + "entries": [ + {"name":"id", "type":"S", "info":"id of the coincidence hit"}, + {"name":"sector", "type":"B", "info":"sector of BAND"}, + {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, + {"name":"component", "type":"S", "info":"paddle or bad id of BAND"}, + {"name":"meantimeTdc", "type":"F", "info":"Calibrated meantime of L and R on a bar (ns) from TDC"}, + {"name":"meantimeFadc", "type":"F", "info":"Calibrated meantime of L and R on a bar (ns) from FADC"}, + {"name":"difftimeTdc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, + {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, + {"name":"adcLcorr", "type":"F", "info":"Calibrated ADC of left PMT of coincidence hit"}, + {"name":"adcRcorr", "type":"F", "info":"Calibrated ADC of right PMT of coincidence hit"}, + {"name":"tFadcLcorr", "type":"F", "info":"Calibrated time from FADC of left PMT in ns of coincidence hit"}, + {"name":"tFadcRcorr", "type":"F", "info":"Calibrated time from FADC of right PMT in ns of coincidence hit"}, + {"name":"tTdcLcorr", "type":"F", "info":"Calibrated time from TDC of left PMT in ns of coincidence hit"}, + {"name":"tTdcRcorr", "type":"F", "info":"Calibrated time from TDC of right PMT in ns of coincidence hit"}, + {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, + {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, + {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, + {"name":"ux", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, + {"name":"uy", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, + {"name":"uz", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"} + ] } ] diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java index 6fc68fe970..b6389c2c1d 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java @@ -2,6 +2,7 @@ import java.util.ArrayList; +import org.apache.commons.math3.analysis.function.Sqrt; import org.jlab.io.base.DataBank; import org.jlab.io.base.DataEvent; import org.jlab.rec.band.hit.BandHit; @@ -32,6 +33,8 @@ public static DataBank fillBandHitBanks(DataEvent event, ArrayList hitl bank.setByte("sector",i, (byte) hitlist.get(i).GetSector()); bank.setByte("layer",i, (byte) hitlist.get(i).GetLayer()); bank.setShort("component",i, (short) hitlist.get(i).GetComponent()); + + bank.setFloat("energy", i, (float) Math.sqrt(hitlist.get(i).GetAdcLeft() * hitlist.get(i).GetAdcRight())); bank.setFloat("meantimeTdc",i, (float) hitlist.get(i).GetMeanTime_TDC()); bank.setFloat("meantimeFadc",i, (float) hitlist.get(i).GetMeanTime_FADC()); From dfd9e67142a8aed3b361a9161858b4c1e3ef4aaa Mon Sep 17 00:00:00 2001 From: Florian Hauenstein Date: Wed, 22 Jan 2020 09:56:09 -0500 Subject: [PATCH 02/47] Updated bank.json with new names and accordingly the RecoBankWriter. BandHitFinder assign values for the 'status' row in Band::Hits. Included pointers to BandCandidates from single PMTs which are combined to hits into BAND::hits. --- etc/bankdefs/hipo4/band.json | 192 +++++++++--------- .../jlab/rec/band/banks/RecoBankWriter.java | 22 +- .../java/org/jlab/rec/band/hit/BandHit.java | 19 +- .../org/jlab/rec/band/hit/BandHitFinder.java | 19 +- 4 files changed, 136 insertions(+), 116 deletions(-) diff --git a/etc/bankdefs/hipo4/band.json b/etc/bankdefs/hipo4/band.json index b788418473..f723e3beae 100644 --- a/etc/bankdefs/hipo4/band.json +++ b/etc/bankdefs/hipo4/band.json @@ -1,101 +1,101 @@ -[ - { - "name": "BAND::hits", - "group": 22100, - "item" : 21, - "info": "reconstructed coincidence hits from BAND", - "entries": [ - {"name":"id", "type":"S", "info":"id of the coincidence hit"}, - {"name":"sector", "type":"B", "info":"sector of BAND"}, - {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, - {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, +[ + { + "name": "BAND::hits", + "group": 22100, + "item" : 21, + "info": "reconstructed coincidence hits from BAND", + "entries": [ + {"name":"id", "type":"S", "info":"id of the coincidence hit"}, + {"name":"sector", "type":"B", "info":"sector of BAND"}, + {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, + {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, {"name":"energy", "type":"F", "info":"Geometric mean of L and R ADC"}, {"name":"time", "type":"F", "info":"Meantime from TDC from L and R hit (ns)"}, {"name":"timeFadc", "type":"F", "info":"Meantime from FADC from L and R hit (ns)"}, - {"name":"difftimeTdc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, + {"name":"difftime", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, - {"name":"left_idx", "type":"S", "info":"index of rawhit from Left PMT, starts at zero"}, - {"name":"right_idx", "type":"S", "info":"index of rawhit from Right PMT, starts at zero"}, - {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, - {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, - {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, - {"name":"ux", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, - {"name":"uy", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, - {"name":"uz", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"}, - {"name":"status" "type":"S", "info":"status of the hit"} - ] - }, - { - "name": "BAND::rawhits", - "group": 22100, - "item" : 22, - "info": "single PMT hits from BAND", - "entries": [ - {"name":"id", "type":"S", "info":"id of the coincidence hit"}, - {"name":"sector", "type":"B", "info":"sector of BAND"}, - {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, + {"name":"indexLpmt", "type":"S", "info":"index of rawhit from Left PMT, starts at zero"}, + {"name":"indexRpmt", "type":"S", "info":"index of rawhit from Right PMT, starts at zero"}, + {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, + {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, + {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, + {"name":"ex", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, + {"name":"ey", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, + {"name":"ez", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"}, + {"name":"status", "type":"S", "info":"status of the hit"} + ] + }, + { + "name": "BAND::rawhits", + "group": 22100, + "item" : 22, + "info": "single PMT hits from BAND", + "entries": [ + {"name":"id", "type":"S", "info":"id of the coincidence hit"}, + {"name":"sector", "type":"B", "info":"sector of BAND"}, + {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, + {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, + {"name":"side", "type":"S", "info":"side of bar (L = 0 and R = 1)"}, + {"name":"time", "type":"F", "info":"Raw Time (ns) from TDC"}, + {"name":"timeFadc", "type":"F", "info":"Raw Time (ns) from FADC"}, + {"name":"timeCorr", "type":"F", "info":"Raw Time (ns) from TDC corrected for trigger phase"}, + {"name":"adc", "type":"F", "info":"Raw ADC from FADC"}, + {"name":"indexTdc", "type":"S", "info":"index to raw information in BAND::TDC bank"}, + {"name":"indexAdc", "type":"S", "info":"index to raw information in BAND::ADC bank"} + ] + }, + { + "name": "BAND::laser", + "group": 22100, + "item" : 23, + "info": "laser hits from BAND", + "entries": [ + {"name":"id", "type":"S", "info":"id of the coincidence hit"}, + {"name":"sector", "type":"B", "info":"sector of BAND"}, + {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, - {"name":"side", "type":"S", "info":"side of bar (L = 0 and R = 1)"}, - {"name":"time", "type":"F", "info":"Raw Time (ns) from TDC"}, - {"name":"timeFadc", "type":"F", "info":"Raw Time (ns) from FADC"}, - {"name":"timeCorr", "type":"F", "info":"Raw Time (ns) from TDC corrected for trigger phase"}, - {"name":"adc", "type":"F", "info":"Raw ADC from FADC"}, - {"name":"tdc_idx", "type":"S", "info":"index to raw information in BAND::TDC bank"}, - {"name":"adc_idx", "type":"S", "info":"index to raw information in BAND::ADC bank"}, - ] - }, - { - "name": "BAND::laser", - "group": 22100, - "item" : 23, - "info": "laser hits from BAND", - "entries": [ - {"name":"id", "type":"S", "info":"id of the coincidence hit"}, - {"name":"sector", "type":"B", "info":"sector of BAND"}, - {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, - {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, - {"name":"energy", "type":"F", "info":"Geometric mean of L and R ADC"}, - {"name":"time", "type":"F", "info":"Meantime from TDC from L and R hit (ns)"}, - {"name":"timeFadc", "type":"F", "info":"Meantime from FADC from L and R hit (ns)"}, - {"name":"difftimeTdc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, - {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, - {"name":"left_idx", "type":"S", "info":"index of rawhit from Left PMT, starts at zero"}, - {"name":"right_idx", "type":"S", "info":"index of rawhit from Right PMT, starts at zero"}, - {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, - {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, - {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, - {"name":"ux", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, - {"name":"uy", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, - {"name":"uz", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"}, - {"name":"status" "type":"S", "info":"status of the hit"} - ] - }, - { - "name": "BAND::oldHits", - "group": 22100, - "item" : 24, - "info": " hits from BAND (old version)", - "entries": [ - {"name":"id", "type":"S", "info":"id of the coincidence hit"}, - {"name":"sector", "type":"B", "info":"sector of BAND"}, - {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, - {"name":"component", "type":"S", "info":"paddle or bad id of BAND"}, - {"name":"meantimeTdc", "type":"F", "info":"Calibrated meantime of L and R on a bar (ns) from TDC"}, - {"name":"meantimeFadc", "type":"F", "info":"Calibrated meantime of L and R on a bar (ns) from FADC"}, - {"name":"difftimeTdc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, - {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, - {"name":"adcLcorr", "type":"F", "info":"Calibrated ADC of left PMT of coincidence hit"}, - {"name":"adcRcorr", "type":"F", "info":"Calibrated ADC of right PMT of coincidence hit"}, - {"name":"tFadcLcorr", "type":"F", "info":"Calibrated time from FADC of left PMT in ns of coincidence hit"}, - {"name":"tFadcRcorr", "type":"F", "info":"Calibrated time from FADC of right PMT in ns of coincidence hit"}, - {"name":"tTdcLcorr", "type":"F", "info":"Calibrated time from TDC of left PMT in ns of coincidence hit"}, - {"name":"tTdcRcorr", "type":"F", "info":"Calibrated time from TDC of right PMT in ns of coincidence hit"}, - {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, - {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, - {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, - {"name":"ux", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, - {"name":"uy", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, - {"name":"uz", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"} - ] - } -] + {"name":"energy", "type":"F", "info":"Geometric mean of L and R ADC"}, + {"name":"time", "type":"F", "info":"Meantime from TDC from L and R hit (ns)"}, + {"name":"timeFadc", "type":"F", "info":"Meantime from FADC from L and R hit (ns)"}, + {"name":"difftime", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, + {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, + {"name":"indexLpmt", "type":"S", "info":"index of rawhit from Left PMT, starts at zero"}, + {"name":"indexRpmt", "type":"S", "info":"index of rawhit from Right PMT, starts at zero"}, + {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, + {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, + {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, + {"name":"ex", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, + {"name":"ey", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, + {"name":"ez", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"}, + {"name":"status", "type":"S", "info":"status of the hit"} + ] + }, + { + "name": "BAND::oldHits", + "group": 22100, + "item" : 24, + "info": " hits from BAND (old version)", + "entries": [ + {"name":"id", "type":"S", "info":"id of the coincidence hit"}, + {"name":"sector", "type":"B", "info":"sector of BAND"}, + {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, + {"name":"component", "type":"S", "info":"paddle or bad id of BAND"}, + {"name":"meantimeTdc", "type":"F", "info":"Calibrated meantime of L and R on a bar (ns) from TDC"}, + {"name":"meantimeFadc", "type":"F", "info":"Calibrated meantime of L and R on a bar (ns) from FADC"}, + {"name":"difftimeTdc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, + {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, + {"name":"adcLcorr", "type":"F", "info":"Calibrated ADC of left PMT of coincidence hit"}, + {"name":"adcRcorr", "type":"F", "info":"Calibrated ADC of right PMT of coincidence hit"}, + {"name":"tFadcLcorr", "type":"F", "info":"Calibrated time from FADC of left PMT in ns of coincidence hit"}, + {"name":"tFadcRcorr", "type":"F", "info":"Calibrated time from FADC of right PMT in ns of coincidence hit"}, + {"name":"tTdcLcorr", "type":"F", "info":"Calibrated time from TDC of left PMT in ns of coincidence hit"}, + {"name":"tTdcRcorr", "type":"F", "info":"Calibrated time from TDC of right PMT in ns of coincidence hit"}, + {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, + {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, + {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, + {"name":"ux", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, + {"name":"uy", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, + {"name":"uz", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"} + ] + } +] diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java index b6389c2c1d..e5ac1d9827 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java @@ -36,27 +36,23 @@ public static DataBank fillBandHitBanks(DataEvent event, ArrayList hitl bank.setFloat("energy", i, (float) Math.sqrt(hitlist.get(i).GetAdcLeft() * hitlist.get(i).GetAdcRight())); - bank.setFloat("meantimeTdc",i, (float) hitlist.get(i).GetMeanTime_TDC()); - bank.setFloat("meantimeFadc",i, (float) hitlist.get(i).GetMeanTime_FADC()); + bank.setFloat("time",i, (float) hitlist.get(i).GetMeanTime_TDC()); + bank.setFloat("timeFadc",i, (float) hitlist.get(i).GetMeanTime_FADC()); - bank.setFloat("difftimeTdc",i, (float) hitlist.get(i).GetDiffTime_TDC()); + bank.setFloat("difftime",i, (float) hitlist.get(i).GetDiffTime_TDC()); bank.setFloat("difftimeFadc",i, (float) hitlist.get(i).GetDiffTime_FADC()); - bank.setFloat("adcLcorr",i, (float) hitlist.get(i).GetAdcLeft()); - bank.setFloat("adcRcorr",i, (float) hitlist.get(i).GetAdcRight()); - bank.setFloat("tFadcLcorr",i, (float) hitlist.get(i).GetTLeft_FADC()); - bank.setFloat("tFadcRcorr",i, (float) hitlist.get(i).GetTRight_FADC()); - bank.setFloat("tTdcLcorr",i, (float) hitlist.get(i).GetTLeft_TDC()); - bank.setFloat("tTdcRcorr",i, (float) hitlist.get(i).GetTRight_TDC()); + bank.setShort("indexLpmt",i, (short) hitlist.get(i).GetIndexLpmt()); + bank.setShort("indexRpmt",i, (short) hitlist.get(i).GetIndexRpmt()); bank.setFloat("x",i, (float) (hitlist.get(i).GetX())); bank.setFloat("y",i, (float) (hitlist.get(i).GetY())); bank.setFloat("z",i, (float) (hitlist.get(i).GetZ())); - bank.setFloat("ux",i, (float) (hitlist.get(i).GetUx())); - bank.setFloat("uy",i, (float) (hitlist.get(i).GetUy())); - bank.setFloat("uz",i, (float) (hitlist.get(i).GetUz())); - + bank.setFloat("ex",i, (float) (hitlist.get(i).GetUx())); + bank.setFloat("ey",i, (float) (hitlist.get(i).GetUy())); + bank.setFloat("ez",i, (float) (hitlist.get(i).GetUz())); + bank.setShort("status",i, (short) hitlist.get(i).GetStatus()); } return bank; diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHit.java b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHit.java index 91ed6c04b7..fcc95be704 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHit.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHit.java @@ -13,8 +13,9 @@ public class BandHit extends ArrayList { private static final long serialVersionUID = 1L; // What is this?? - private int _sector, _layer, _component; - + private int _sector, _layer, _component, _status; + private int _indexLpmt, _indexRpmt; + private double _meantimeTdc, _meantimeFadc; private double _difftimeTdc, _difftimeFadc; @@ -27,7 +28,8 @@ public class BandHit extends ArrayList { // constructor public BandHit() { - _sector = -1; _layer = -1; _component = -1; + _sector = -1; _layer = -1; _component = -1; _status = -1; + _indexLpmt = -1; _indexRpmt = -1; _meantimeTdc = -2000.; _meantimeFadc = -2000.; _difftimeTdc = -2000.; _difftimeFadc = -2000.; @@ -46,18 +48,23 @@ public void Print(){ System.out.println(_sector+" "+_layer+" "+_component); System.out.println("\t"+_x+" "+_y+" "+_z); System.out.println("\t"+_difftimeFadc+" "+_adcLcorr+" "+_adcRcorr); + System.out.println("\t"+_status); } // Grab functions public int GetSector() {return _sector;} public int GetLayer() {return _layer;} public int GetComponent() {return _component;} + public int GetStatus() {return _status;} public double GetMeanTime_TDC() {return _meantimeTdc;} public double GetMeanTime_FADC() {return _meantimeFadc;} public double GetDiffTime_TDC() {return _difftimeTdc;} public double GetDiffTime_FADC() {return _difftimeFadc;} + public int GetIndexLpmt() {return _indexLpmt;} + public int GetIndexRpmt() {return _indexRpmt;} + public double GetAdcLeft() {return _adcLcorr;} public double GetAdcRight() {return _adcRcorr;} public double GetTLeft_FADC() {return _tFadcLcorr;} @@ -75,13 +82,17 @@ public void Print(){ // Set functions public void SetSector(int sector) {this._sector = sector; } public void SetLayer(int layer) {this._layer = layer; } - public void SetComponent(int component) {this._component = component;} + public void SetComponent(int component) {this._component = component;} + public void SetStatus(int status) {this._status = status;} public void SetMeanTime_TDC(double meanTimeTDC) {this._meantimeTdc = meanTimeTDC;} public void SetMeanTime_FADC(double meanTimeFADC) {this._meantimeFadc = meanTimeFADC;} public void SetDiffTime_TDC(double diffTimeTDC) {this._difftimeTdc = diffTimeTDC;} public void SetDiffTime_FADC(double diffTimeFADC) {this._difftimeFadc = diffTimeFADC;} + public void SetIndexLpmt(int indexL) {this._indexLpmt = indexL;} + public void SetIndexRpmt(int indexR) {this._indexRpmt = indexR;} + public void SetAdcLeft(double adcL) {this._adcLcorr = adcL;} public void SetAdcRight(double adcR) {this._adcRcorr = adcR;} public void SetTLeft_FADC(double ftdcL) {this._tFadcLcorr = ftdcL;} diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java index 6a2927c460..663b715a4d 100644 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java @@ -65,7 +65,7 @@ public ArrayList findGoodHits(ArrayList candidates) { Hit.SetSector(sector); Hit.SetLayer(layer); Hit.SetComponent(component); - + Hit.SetMeanTime_TDC(0.); Hit.SetMeanTime_FADC(0.); Hit.SetDiffTime_TDC(0.); @@ -119,6 +119,8 @@ public ArrayList findGoodHits(ArrayList candidates) { double adcright = -1; float ftdcleft = -1; float ftdcright = -1; + int indexleft = -1; + int indexright = -1; if (hit1.GetSide() == 1) { //Hit1 is from left side PMT tdcleft = hit1.GetTimeCorr(); tdcright = hit2.GetTimeCorr(); @@ -126,6 +128,8 @@ public ArrayList findGoodHits(ArrayList candidates) { ftdcright = hit2.GetFtdc(); adcleft = hit1.GetAdc(); adcright = hit2.GetAdc(); + indexleft = i; + indexright = j; } else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT tdcleft = hit2.GetTimeCorr(); @@ -134,6 +138,8 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT ftdcright = hit1.GetFtdc(); adcleft = hit2.GetAdc(); adcright = hit1.GetAdc(); + indexright = j; + indexleft = i; } else { System.err.println("BAND HIT FINDER. Found two hits with left and right side but can not assign which hide belongs to which side"); @@ -226,7 +232,8 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT Hit.SetUx(xposHitUnc); Hit.SetUy(yposHitUnc); Hit.SetUz(zposHitUnc); - + Hit.SetIndexLpmt(indexleft); + Hit.SetIndexRpmt(indexright); // Print for debugging: //Hit.Print(); @@ -262,9 +269,15 @@ public ArrayList advancedHitFinder(ArrayList coincidences) ArrayList betterHits = new ArrayList(); - + //Set status bits for each hit, good hit status is 0 for each hit when #hits is < 5. + //If #hits > 100, status will be set to 1 (laser hits), other possibilities it will be 2 + int status_temp = -1; + if (coincidences.size() > 100) { status_temp = 1; } + else if (coincidences.size() < 5) { status_temp = 0; } //coincidences.size > 0 is already checked before advanceHitFinder is called + else { status_temp = 2; } for( int hit = 0 ; hit < coincidences.size() ; hit++){ BandHit thisHit = coincidences.get(hit); + thisHit.SetStatus(status_temp); //if( thisHit.GetLayer() == 6 ){ // return new ArrayList(); //} From 01827a9d65509693da32eac9b5d8f2611cc1dd4b Mon Sep 17 00:00:00 2001 From: hauenst Date: Fri, 24 Jan 2020 12:53:21 -0500 Subject: [PATCH 03/47] * Implemented pointer to BAND::ADC and TDC banks to BandHitCandidate class * Implemented writer of BAND::rawhits in RecoBandWriter. * Modified HitReader to add index information of ADC and TDC bank to BandHitCandidate --- .../org/jlab/rec/band/banks/HitReader.java | 10 ++++- .../jlab/rec/band/banks/RecoBankWriter.java | 40 +++++++++++++++++++ .../jlab/rec/band/hit/BandHitCandidate.java | 16 +++++++- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java index fbe80eb801..d045ad7a93 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java @@ -28,6 +28,8 @@ public static ArrayList getBandCandidates(DataEvent event) { Map fadcInt = new HashMap(); Map fadcTimes = new HashMap(); Map tdcTimes = new HashMap(); + Map fadcIndex = new HashMap(); + Map tdcIndex = new HashMap(); @@ -73,11 +75,13 @@ public static ArrayList getBandCandidates(DataEvent event) { if( fadcInt.get( Integer.valueOf(key) ) < adc ) { fadcInt.put( Integer.valueOf(key) , Integer.valueOf(adc) ); fadcTimes.put( Integer.valueOf(key), Float.valueOf(ftdc) ); + fadcIndex.put( Integer.valueOf(key), Integer.valueOf(i)); } } else { fadcInt.put( Integer.valueOf(key) , Integer.valueOf(adc) ); fadcTimes.put( Integer.valueOf(key), Float.valueOf(ftdc) ); + fadcIndex.put( Integer.valueOf(key), Integer.valueOf(i)); } } // end fadc loop @@ -109,10 +113,12 @@ public static ArrayList getBandCandidates(DataEvent event) { if( Math.abs(thisDiff) < Math.abs(prevDiff) ) { tdcTimes.put( Integer.valueOf(key), Double.valueOf(tdc) ); + tdcIndex.put( Integer.valueOf(key), Integer.valueOf(j)); } } else { tdcTimes.put( Integer.valueOf(key), Double.valueOf(tdc) ); + tdcIndex.put( Integer.valueOf(key), Integer.valueOf(j)); } } // end tdc loop @@ -131,10 +137,12 @@ public static ArrayList getBandCandidates(DataEvent event) { int adc = fadcInt.get(keys); float ftdc = fadcTimes.get(keys); double tdc = tdcTimes.get(keys); + int indexadc = fadcIndex.get(keys); + int indextdc = tdcIndex.get(keys); //System.out.println("Found a candidate PMT hit! slco: "+sector+" "+layer+" "+component+" "+order+" "+adc+" "+ftdc+" "+tdc); BandHitCandidate newHit = new BandHitCandidate( sector,layer,component,order, - adc, tdc, ftdc ,triggerPhase); + adc, tdc, ftdc ,triggerPhase, indexadc, indextdc); candidates.add(newHit); } diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java index e5ac1d9827..ab54e5e109 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java @@ -6,6 +6,7 @@ import org.jlab.io.base.DataBank; import org.jlab.io.base.DataEvent; import org.jlab.rec.band.hit.BandHit; +import org.jlab.rec.band.hit.BandHitCandidate; @@ -57,6 +58,45 @@ public static DataBank fillBandHitBanks(DataEvent event, ArrayList hitl return bank; } + + public static DataBank fillBandCandidateBanks(DataEvent event, ArrayList candidatelist) { + + if (candidatelist == null) { + return null; + } + DataBank bank = event.createBank("BAND::rawhits", candidatelist.size()); + + if (bank == null) { + //System.err.println("COULD NOT CREATE A BAND::Hits BANK!!!!!!"); + return null; + } + + + //i should only go to 1 but keep for loop for future extensions if more hits are required + for(int i =0; i hitlist) { diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitCandidate.java b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitCandidate.java index e5d89cb38d..1a1c3ea434 100644 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitCandidate.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitCandidate.java @@ -4,7 +4,7 @@ public class BandHitCandidate { - public BandHitCandidate(int sector, int layer, int component, int order, int adc, double tdc, float ftdc, double triggerPhase) + public BandHitCandidate(int sector, int layer, int component, int order, int adc, double tdc, float ftdc, double triggerPhase, int idadc, int idtdc) { this._sector = sector; @@ -17,6 +17,9 @@ public BandHitCandidate(int sector, int layer, int component, int order, int adc this._adc = adc; this._ftdc = ftdc; this._tdc = tdc; + + this._indexAdc = idadc; + this._indexTdc = idtdc; //System.out.println("Created BandHitCandidate: adc "+ this._adc +" tdc "+this._tdc+" ftdc "+this._ftdc+ " AttCorr " + this._AttCorr + " tcorr "+ this._tCorr); @@ -29,7 +32,8 @@ public BandHitCandidate(int sector, int layer, int component, int order, int adc private int _layer; // layer in which the signal is registered private int _component; // component in which the signal is registered private int _side; // side of Hit. Side 0 for left PMT on a bar or side 1 for right PMT on a bar - + private int _indexTdc, _indexAdc; //pointer to the hit in BANK::ADC and BANK::TDC + private double _tCorr; // Time (ns) corrected for offset private int _adc; // Raw adc @@ -68,6 +72,14 @@ public double GetTdc() { public float GetFtdc() { return _ftdc; } + + public int GetIndexTdc() { + return _indexTdc; + } + + public int GetIndexAdc() { + return _indexAdc; + } } From a342dcefa69f6d338410c8a796d6fe2e3711b23b Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Sun, 16 Feb 2020 18:19:52 -0500 Subject: [PATCH 04/47] TOF: updates to clustering to implement energy sorting and time/distance cuts, pointers from hits to clusters added to hits banks --- etc/bankdefs/hipo4/tof.json | 36 +++- .../jlab/rec/tof/banks/ctof/HitReader.java | 18 +- .../rec/tof/banks/ctof/RecoBankWriter.java | 20 +- .../jlab/rec/tof/banks/ftof/HitReader.java | 23 +- .../rec/tof/banks/ftof/RecoBankWriter.java | 9 +- .../org/jlab/rec/tof/cluster/Cluster.java | 8 +- .../jlab/rec/tof/cluster/ClusterFinder.java | 196 ++++++++++++------ .../rec/tof/cluster/ftof/ClusterMatcher.java | 4 +- .../main/java/org/jlab/rec/tof/hit/AHit.java | 35 +++- .../java/org/jlab/rec/tof/hit/ctof/Hit.java | 28 +-- .../java/org/jlab/rec/tof/hit/ftof/Hit.java | 18 -- .../org/jlab/service/ctof/CTOFEngine.java | 20 +- .../org/jlab/service/ftof/FTOFEngine.java | 48 ++--- 13 files changed, 285 insertions(+), 178 deletions(-) diff --git a/etc/bankdefs/hipo4/tof.json b/etc/bankdefs/hipo4/tof.json index fb1c8ad830..8efb5b5928 100644 --- a/etc/bankdefs/hipo4/tof.json +++ b/etc/bankdefs/hipo4/tof.json @@ -49,6 +49,7 @@ {"name":"adc_idx2", "type":"S", "info":"index of hit with ADCR in adc bank, starts at zero"}, {"name":"tdc_idx1", "type":"S", "info":"index of hit with TDCL in tdc bank, starts at zero"}, {"name":"tdc_idx2", "type":"S", "info":"index of hit with TDCR in tdc bank, starts at zero"}, + {"name":"clusterid", "type":"S", "info":"pointer to the cluster"}, {"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 "} ] @@ -81,7 +82,8 @@ {"name":"adc_idx1", "type":"S", "info":"index of hit with ADCL in adc bank, starts at zero"}, {"name":"adc_idx2", "type":"S", "info":"index of hit with ADCR in adc bank, starts at zero"}, {"name":"tdc_idx1", "type":"S", "info":"index of hit with TDCL in tdc bank, starts at zero"}, - {"name":"tdc_idx2", "type":"S", "info":"index of hit with TDCR in tdc bank, starts at zero"}, + {"name":"tdc_idx2", "type":"S", "info":"index of hit with TDCR in tdc bank, starts at zero"}, + {"name":"clusterid", "type":"S", "info":"pointer to the cluster"}, {"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 "} ] @@ -92,12 +94,13 @@ "item": 32, "info": "reconstructed clusters from FTOF", "entries": [ - {"name":"id", "type":"S", "info":"id of the hit"}, + {"name":"id", "type":"S", "info":"id of the hit"}, {"name":"status", "type":"S", "info":"status of the cluster"}, {"name":"trackid", "type":"S", "info":"matched DC track id"}, - {"name":"sector", "type":"B", "info":"sector of FTOF"}, + {"name":"size", "type":"S", "info":"cluster size"}, + {"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 hit with lowest paddle id in cluster "}, + {"name":"component", "type":"S", "info":"paddle id of FTOF cluster seed"}, {"name":"energy", "type":"F", "info":"E dep (MeV) of the cluster"}, {"name":"time", "type":"F", "info":"Cluster hit time (ns)"}, {"name":"energy_unc", "type":"F", "info":"E dep unc (MeV) of the cluster"}, @@ -176,10 +179,33 @@ {"name":"adc_idx2", "type":"S", "info":"index of hit with ADCD in adc bank, starts at zero"}, {"name":"tdc_idx1", "type":"S", "info":"index of hit with TDCU in tdc bank, starts at zero"}, {"name":"tdc_idx2", "type":"S", "info":"index of hit with TDCD in tdc bank, starts at zero"}, + {"name":"clusterid", "type":"S", "info":"pointer to the cluster"}, {"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::clusters", + "group": 20400, + "item": 22, + "info": "reconstructed clusters from CTOF", + "entries": [ + {"name":"id", "type":"S", "info":"id of the hit"}, + {"name":"status", "type":"S", "info":"status of the cluster"}, + {"name":"trackid", "type":"S", "info":"matched DC track id"}, + {"name":"size", "type":"S", "info":"cluster size"}, + {"name":"sector", "type":"B", "info":"sector of CTOF"}, + {"name":"layer", "type":"B", "info":"panel id of CTOF"}, + {"name":"component", "type":"S", "info":"paddle id of CTOF cluster seed"}, + {"name":"energy", "type":"F", "info":"E dep (MeV) of the cluster"}, + {"name":"time", "type":"F", "info":"Cluster seed time (ns)"}, + {"name":"energy_unc", "type":"F", "info":"E dep unc (MeV) of the cluster"}, + {"name":"time_unc", "type":"F", "info":"Cluster seed time unc (ns)"}, + {"name":"x", "type":"F", "info":"Global X coor (cm) of cluster seed"}, + {"name":"y", "type":"F", "info":"Global Y coor (cm) of cluster seed"}, + {"name":"z", "type":"F", "info":"Global Z coor (cm) of cluster seed"} + ] + } ] diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ctof/HitReader.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ctof/HitReader.java index bfdea2d7fc..b73b1d27b9 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ctof/HitReader.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ctof/HitReader.java @@ -16,6 +16,7 @@ import org.jlab.rec.tof.banks.BaseHit; import org.jlab.rec.tof.banks.BaseHitReader; import org.jlab.rec.tof.banks.IMatchedHit; +import org.jlab.rec.tof.cluster.Cluster; import org.jlab.rec.tof.hit.ctof.Hit; import org.jlab.rec.tof.track.Track; import org.jlab.utils.groups.IndexedList; @@ -274,7 +275,7 @@ private List matchHitsToCVTTrk(List CTOFhits, CTOFGeant4Factory ctofDe } if(matchedTrk!=null) { CTOFDetHit trkHit = new CTOFDetHit(matchedTrk.getHit()); - ctofHit._AssociatedTrkId = matchedTrk.getId(); + ctofHit.set_TrkId(matchedTrk.getId()); ctofHit.set_matchedTrackHit(trkHit); ctofHit.set_matchedTrack(matchedTrk.getLine()); ctofHit.set_TrkPathLenThruBar(trkHit.origin().distance(trkHit.end())); @@ -573,4 +574,19 @@ private double getTriggerPhase(long timestamp, IndexedTable table) { // System.out.println(period + " " + phase + " " + cycles + " " + timestamp + " " + triggerphase); return triggerphase; } + + public void setHitPointersToClusters(List hits, List clusters) { + for(int j=0; j hitlist) { bank.setFloat("tx", i, (float) hitlist.get(i).get_TrkPosition().x()); bank.setFloat("ty", i, (float) hitlist.get(i).get_TrkPosition().y()); bank.setFloat("tz", i, (float) hitlist.get(i).get_TrkPosition().z()); - bank.setShort("trkID", i, (short) hitlist.get(i)._AssociatedTrkId); + bank.setShort("trkID", i, (short) hitlist.get(i).get_TrkId()); } else { bank.setShort("trkID", i, (short) -1); } @@ -101,6 +101,7 @@ public DataBank fillRecHitsBank(DataEvent event, List hitlist) { bank.setShort("adc_idx2",i, (short) hitlist.get(i).get_ADCbankHitIdx2()); bank.setShort("tdc_idx1",i, (short) hitlist.get(i).get_TDCbankHitIdx1()); bank.setShort("tdc_idx2",i, (short) hitlist.get(i).get_TDCbankHitIdx2()); + bank.setShort("clusterid", i, (short) hitlist.get(i).get_AssociatedClusterID()); bank.setFloat("pathLength", i, (float) hitlist.get(i) .get_TrkPathLen()); bank.setFloat("pathLengthThruBar", i, (float) hitlist.get(i) @@ -126,9 +127,11 @@ public DataBank fillClustersBank(DataEvent event, List cluslist) { } for (int i = 0; i < cluslist.size(); i++) { bank.setShort("id", i, (short) cluslist.get(i).get_Id()); + bank.setShort("trackid", i, (short) cluslist.get(i).get(0).get_TrkId()); + bank.setShort("size", i, (short) cluslist.get(i).size()); bank.setByte("sector", i, (byte) cluslist.get(i).get_Sector()); bank.setByte("layer", i, (byte) cluslist.get(i).get_Panel()); - bank.setShort("component", i, (short) cluslist.get(i).get(0).get_Paddle()); // paddle id of hit with lowest paddle id in cluster [Check the sorting!!!] + bank.setShort("component", i, (short) cluslist.get(i).get(0).get_Paddle()); // paddle id of cluster seed int status = 0; if (Integer.parseInt(cluslist.get(i).get_StatusWord()) == 1111) { status = 1; @@ -136,14 +139,11 @@ public DataBank fillClustersBank(DataEvent event, List cluslist) { bank.setShort("status", i, (short) status); bank.setFloat("energy", i, (float) cluslist.get(i).get_Energy()); bank.setFloat("energy_unc", i, (float) cluslist.get(i).get_EnergyUnc()); - bank.setFloat("time", i, (float) cluslist.get(i).get_t()); - bank.setFloat("time_unc", i, (float) cluslist.get(i).get_tUnc()); - bank.setFloat("x", i, (float) cluslist.get(i).get_x()); - bank.setFloat("y", i, (float) cluslist.get(i).get_y()); - bank.setFloat("z", i, (float) cluslist.get(i).get_z()); - bank.setFloat("x_unc", i, 5); // At this stage the uncertainty is not calculated - bank.setFloat("y_unc", i, (float) cluslist.get(i).get_y_locUnc()); - bank.setFloat("z_unc", i, 10); // At this stage the uncertainty is not calculated + bank.setFloat("time", i, (float) cluslist.get(i).get(0).get_t()); + bank.setFloat("time_unc", i, (float) cluslist.get(i).get(0).get_tUnc()); + bank.setFloat("x", i, (float) cluslist.get(i).get(0).get_Position().x()); + bank.setFloat("y", i, (float) cluslist.get(i).get(0).get_Position().y()); + bank.setFloat("z", i, (float) cluslist.get(i).get(0).get_Position().z()); // At this stage the uncertainty is not calculated } return bank; diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/HitReader.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/HitReader.java index 615361ec39..78ccd1cd98 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/HitReader.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ftof/HitReader.java @@ -11,6 +11,7 @@ import org.jlab.rec.tof.banks.BaseHit; import org.jlab.rec.tof.banks.BaseHitReader; import org.jlab.rec.tof.banks.IMatchedHit; +import org.jlab.rec.tof.cluster.Cluster; import org.jlab.rec.tof.hit.ftof.Hit; import org.jlab.rec.tof.track.Track; import org.jlab.utils.groups.IndexedList; @@ -222,11 +223,11 @@ private List removeDuplicatedHits(List updated_hits) { } for (Hit h : updated_hits) { - if (h._AssociatedTrkId == -1) { + if (h.get_TrkId() == -1) { unique_hits.add(h); } - if (h._AssociatedTrkId != -1) { - lists.get(h._AssociatedTrkId - 1).add(h); + if (h.get_TrkId() != -1) { + lists.get(h.get_TrkId() - 1).add(h); } } for (int j = 0; j < this._numTrks; j++) { @@ -385,7 +386,7 @@ private List matchHitsToDCTrk(List FTOFhits, } if(matchedTrk!=null) { FTOFDetHit trkHit = new FTOFDetHit(matchedTrk.getHit()); - ftofHit._AssociatedTrkId = matchedTrk.getId(); + ftofHit.set_TrkId(matchedTrk.getId()); ftofHit.set_matchedTrackHit(trkHit); ftofHit.set_matchedTrack(matchedTrk.getLine()); ftofHit.set_TrkPathLenThruBar(trkHit.origin().distance(trkHit.end())); @@ -606,6 +607,20 @@ private double getTriggerPhase(long timestamp, IndexedTable table) { return triggerphase; } + public void setHitPointersToClusters(List hits, List clusters) { + for(int j=0; j hitlist, String hitsT bank.setFloat("tz", i, (float) hitlist.get(i).get_TrkPosition() .z()); bank.setShort("trackid", i, - (short) hitlist.get(i)._AssociatedTrkId); + (short) hitlist.get(i).get_TrkId()); } else { bank.setShort("trackid", i, (short) -1); } @@ -139,6 +139,7 @@ public DataBank fillRecHitsBank(DataEvent event, List hitlist, String hitsT .get_TDCbankHitIdx1()); bank.setShort("tdc_idx2", i, (short) hitlist.get(i) .get_TDCbankHitIdx2()); + bank.setShort("clusterid", i, (short) hitlist.get(i).get_AssociatedClusterID()); bank.setFloat("pathLength", i, (float) hitlist.get(i) .get_TrkPathLen()); bank.setFloat("pathLengthThruBar", i, (float) hitlist.get(i) @@ -169,12 +170,12 @@ public DataBank fillClustersBank(DataEvent event, List cluslist, String } for (int i = 0; i < cluslist.size(); i++) { bank.setShort("id", i, (short) cluslist.get(i).get_Id()); - bank.setShort("trackid", i, (short) cluslist.get(i).get(0)._AssociatedTrkId); + bank.setShort("trackid", i, (short) cluslist.get(i).get(0).get_TrkId()); + bank.setShort("size", i, (short) cluslist.get(i).size()); bank.setByte("sector", i, (byte) cluslist.get(i).get_Sector()); bank.setByte("layer", i, (byte) cluslist.get(i).get_Panel()); bank.setShort("component", i, (short) cluslist.get(i).get(0) - .get_Paddle()); // paddle id of hit with lowest paddle id in - // cluster [Check the sorting!!!] + .get_Paddle()); // paddle id of the cluster seed int status = 0; if (Integer.parseInt(cluslist.get(i).get_StatusWord()) == 1111) { status = 1; diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/Cluster.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/Cluster.java index bffd8d873f..6344d507d4 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/Cluster.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/Cluster.java @@ -317,19 +317,19 @@ public void matchToTrack() { int id =0; int[] iClusHitsMatchedToTrk = new int[this.size()]; int totNbMatches = 0; - if(this.size()<1 || this.get(0)._AssociatedTrkId<1) + if(this.size()<1 || this.get(0).get_TrkId()<1) return; - id = this.get(0)._AssociatedTrkId; + id = this.get(0).get_TrkId(); for (int i = 0; i < this.size(); i++) { iClusHitsMatchedToTrk[i] = -1; AHit h = this.get(i); if (h.get_TrkPosition() == null - || Double.isNaN(h.get_TrkPosition().x()) || this.get(i)._AssociatedTrkId!=id) { + || Double.isNaN(h.get_TrkPosition().x()) || this.get(i).get_TrkId()!=id) { continue; } - id = h._AssociatedTrkId; + id = h.get_TrkId(); xTrk = h.get_TrkPosition().x(); yTrk = h.get_TrkPosition().y(); zTrk = h.get_TrkPosition().z(); diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java index af25ec9657..1018f38843 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java @@ -1,106 +1,164 @@ package org.jlab.rec.tof.cluster; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.List; import org.jlab.rec.ctof.Constants; import org.jlab.rec.tof.hit.AHit; +import org.jlab.utils.groups.IndexedList; +import org.jlab.utils.groups.IndexedTable; /** * - * @author ziegler + * @author ziegler, ahobart, devita * */ public class ClusterFinder { + private double minEnergy = Constants.MINENERGY; + private double maxDistance = 20; // default set to 20 cm + private double deltaTime = 10; // default set to 10 ns + private int maxSize = 2 ; // default set to cluster size of 2 + private IndexedTable clusterPar = null; + + private boolean debug = false; + public ClusterFinder() { // TODO Auto-generated constructor stub } - /** - * int panel, int sector, int paddle paddle = strip, panel = layer, - */ - AHit[][][] HitArray; + public ClusterFinder(IndexedTable clusterPar) { + this.clusterPar=clusterPar; + } - public ArrayList findClusters(List hits2, int nsectors, - int npanels, int[] npaddles) { - ArrayList clusters = new ArrayList(); - if (hits2 != null) { - int maxNumPad = 0; - for (int i = 0; i < npaddles.length; i++) { - if (npaddles[i] > maxNumPad) { - maxNumPad = npaddles[i]; - } - } - // a Hit Array is used to identify clusters, panel1B is the one with - // the maximum number of scintillator bars - HitArray = new AHit[maxNumPad][npanels][nsectors]; + public void setDebug(boolean debug) { + this.debug = debug; + } - // initializing non-zero Hit Array entries - // with valid hits - for (int i = 0; i < hits2.size(); i++) { - if (((AHit) hits2.get(i)).get_Energy() < Constants.MINENERGY) { - continue; - } + + public ArrayList findClusters(List hits2, int nsectors, int npanels, int[] npaddles) { + // allocate list of hits for each sector and layer + IndexedList> HitList = new IndexedList>(2); - int w = ((AHit) hits2.get(i)).get_Paddle(); - int l = ((AHit) hits2.get(i)).get_Panel(); - int s = ((AHit) hits2.get(i)).get_Sector(); + // create cluster list + ArrayList clusters = new ArrayList(); + + // loop over list of hits + if (hits2 != null) { - if (s > 0 && s <= nsectors && l > 0 && l <= npanels && w > 0 - && w <= npaddles[l - 1]) { - HitArray[w - 1][l - 1][s - 1] = (AHit) hits2.get(i); + if(debug) { + System.out.println(); + System.out.println("Unsorted"); + } + // initializing array lists + for (int i = 0; i < hits2.size(); i++) { + AHit thisHit = (AHit) hits2.get(i); + int l = thisHit.get_Panel(); + int s = thisHit.get_Sector(); + // if list for sector s and layer l doesn't exist yet, create it + if(!HitList.hasItem(s,l)) HitList.add(new ArrayList(), s,l); + // add hit to relevant list + HitList.getItem(s,l).add(thisHit); + if(debug) System.out.println(s + " " + l + " " + thisHit.get_Paddle() + " " + thisHit.get_Energy() + " " + thisHit.get_t()); + } + + // sort lists by energy + if(debug) System.out.println("Sorted"); + for (int s = 1; s <= nsectors; s++) { + for (int l = 1; l <= npanels; l++) { + if(HitList.hasItem(s,l)) { + if(debug) System.out.println(s + " " + l); + ArrayList hitList = HitList.getItem(s,l); + Collections.sort(hitList, new sortByEnergy()); + if(debug) { + for(int i=0; i hits = new ArrayList(); - try { - while (HitArray[si][l][s] != null - && si < npaddles[l]) { - AHit clusteredHit = HitArray[si][l][s]; - hits.add(clusteredHit); - si++; - } - } catch (ArrayIndexOutOfBoundsException exception) { + + // create clusters within each sector and panel + for (int s = 1; s <= nsectors; s++) { + for (int l = 1; l <= npanels; l++) { + if(HitList.hasItem(s,l)) { + // use constants from CCDB if available to set cluster parameters + if(this.clusterPar!=null) { + this.minEnergy = clusterPar.getDoubleValue("minEnergy", s, l, 0); + this.maxDistance = clusterPar.getDoubleValue("maxDistance", s, l, 0); + this.deltaTime = clusterPar.getDoubleValue("maxTimeDifference", s, l, 0); + this.maxSize = clusterPar.getIntValue("maxClusterSize", s, l, 0); + if(debug) System.out.println("Setting cluster parameters to " + this.minEnergy + "/" + this.maxDistance + " " + this.deltaTime + "/" + this.maxSize); + } + // get hit list for given sector and layer + ArrayList hitList = HitList.getItem(s,l); + for(int i=0; i { + @Override + public int compare(AHit a, AHit b) { + if(a.get_Energy() ClusterDoublet(Cluster C1a, Cluster C1b, DataEvent eve if (C1b.get_xTrk() == null || C1a.get_xTrk() == null) { return null; // no tracking info } - if (C1a.get(0)._AssociatedTrkId != C1b.get(0)._AssociatedTrkId) { + if (C1a.get(0).get_TrkId() != C1b.get(0).get_TrkId()) { return null; // not from the stame track } ArrayList ClsDoublet = new ArrayList(2); @@ -112,7 +112,7 @@ public ArrayList ClusterDoublet(Cluster C1a, Cluster C1b, DataEvent eve int rows = bank.rows(); for (int i = 0; i < rows; i++) { if (bank.getByte("detector", i) == 6 && - bank.getShort("index", i) == C1a.get(0)._AssociatedTrkId - 1) { + bank.getShort("index", i) == C1a.get(0).get_TrkId() - 1) { this.Beta = event.getBank("RECHB::Particle").getFloat("beta", bank.getShort("pindex", i)); } diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/hit/AHit.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/hit/AHit.java index a0c8414e5c..02e5b82e2f 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/hit/AHit.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/hit/AHit.java @@ -32,7 +32,7 @@ public abstract class AHit implements Comparable { private int _TDCbankHitIdx1 = -1; private int _TDCbankHitIdx2 = -1; - public int _AssociatedTrkId = -1; + private int _AssociatedTrkId = -1; public AHit(int id, int panel, int sector, int paddle, int aDC1, int tDC1, int aDC2, int tDC2) { @@ -315,6 +315,14 @@ public double get_barthickness() { return this._barThickness; } + public int get_TrkId() { + return _AssociatedTrkId; + } + + public void set_TrkId(int id) { + this._AssociatedTrkId=id; + } + public Point3D get_TrkPosition() { return _TrkPosition; } @@ -1311,6 +1319,31 @@ private double calc_Hpos(double y, double hposa, double hposb, double hposc, dou return hposa*Math.exp(hposb*y); } + @Override + public int compareTo(AHit arg) { + // Sort by sector, panel, paddle + int return_val = 0; + int CompSec = this.get_Sector() < arg.get_Sector() ? -1 : this + .get_Sector() == arg.get_Sector() ? 0 : 1; + int CompPan = this.get_Panel() < arg.get_Panel() ? -1 : this + .get_Panel() == arg.get_Panel() ? 0 : 1; + int CompPad = this.get_Paddle() < arg.get_Paddle() ? -1 : this + .get_Paddle() == arg.get_Paddle() ? 0 : 1; + + int return_val1 = ((CompPan == 0) ? CompPad : CompPan); + return_val = ((CompSec == 0) ? return_val1 : CompSec); + + return return_val; + } + + public boolean isAdjacent(AHit arg0) { + boolean isClose = false; + if(this.get_Sector()==arg0.get_Sector() && this.get_Panel()==arg0.get_Panel()) { + if(this.get_Paddle()==arg0.get_Paddle()-1 || this.get_Paddle()==arg0.get_Paddle()+1) isClose=true; + } + return isClose; + } + public void printInfo() { DecimalFormat form = new DecimalFormat("#.##"); String s = " FTOF Hit in " + " Sector " + this.get_Sector() + " Panel " diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/hit/ctof/Hit.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/hit/ctof/Hit.java index 2703299091..5235729e15 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/hit/ctof/Hit.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/hit/ctof/Hit.java @@ -178,6 +178,15 @@ private Point3D calc_hitPosition() { return hitPosition; } + @Override + public boolean isAdjacent(AHit arg0) { + boolean isClose = false; + if(this.get_Paddle()==arg0.get_Paddle()-1 || this.get_Paddle()==arg0.get_Paddle()+1) isClose=true; + if((this.get_Paddle()==1 && arg0.get_Paddle()==Constants.NPAD[0]) || + (arg0.get_Paddle()==1 && this.get_Paddle()==Constants.NPAD[0])) isClose=true; + return isClose; + } + public void printInfo() { DecimalFormat form = new DecimalFormat("#.##"); String s = " CTOF Hit in Paddle " + this.get_Paddle() @@ -204,24 +213,7 @@ public void printInfo() { } System.out.println(s); } - - @Override - public int compareTo(AHit arg) { - // Sort by sector, panel, paddle - int return_val = 0; - int CompSec = this.get_Sector() < arg.get_Sector() ? -1 : this - .get_Sector() == arg.get_Sector() ? 0 : 1; - int CompPan = this.get_Panel() < arg.get_Panel() ? -1 : this - .get_Panel() == arg.get_Panel() ? 0 : 1; - int CompPad = this.get_Paddle() < arg.get_Paddle() ? -1 : this - .get_Paddle() == arg.get_Paddle() ? 0 : 1; - - int return_val1 = ((CompPan == 0) ? CompPad : CompPan); - return_val = ((CompSec == 0) ? return_val1 : CompSec); - - return return_val; - } - + @Override public double TW01(IndexedTable tab) { //double TW0U = CCDBConstants.getTW0U()[this.get_Sector() - 1][this diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/hit/ftof/Hit.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/hit/ftof/Hit.java index 9d6434f04b..20622849b2 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/hit/ftof/Hit.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/hit/ftof/Hit.java @@ -218,24 +218,6 @@ public void printInfo() { } System.out.println(s); } - - @Override - public int compareTo(AHit arg) { - // Sort by sector, panel, paddle - int return_val = 0; - int CompSec = this.get_Sector() < arg.get_Sector() ? -1 : this - .get_Sector() == arg.get_Sector() ? 0 : 1; - int CompPan = this.get_Panel() < arg.get_Panel() ? -1 : this - .get_Panel() == arg.get_Panel() ? 0 : 1; - int CompPad = this.get_Paddle() < arg.get_Paddle() ? -1 : this - .get_Paddle() == arg.get_Paddle() ? 0 : 1; - - int return_val1 = ((CompPan == 0) ? CompPad : CompPan); - return_val = ((CompSec == 0) ? return_val1 : CompSec); - - return return_val; - } - @Override public double TW01(IndexedTable tab) { diff --git a/reconstruction/tof/src/main/java/org/jlab/service/ctof/CTOFEngine.java b/reconstruction/tof/src/main/java/org/jlab/service/ctof/CTOFEngine.java index 43e243ea57..b9cba99e31 100644 --- a/reconstruction/tof/src/main/java/org/jlab/service/ctof/CTOFEngine.java +++ b/reconstruction/tof/src/main/java/org/jlab/service/ctof/CTOFEngine.java @@ -62,7 +62,8 @@ public boolean init() { "/calibration/ctof/gain_balance", "/calibration/ctof/time_jitter", "/calibration/ctof/fadc_offset", - "/calibration/ctof/hpos" + "/calibration/ctof/hpos", + "/calibration/ctof/cluster" }; requireConstants(Arrays.asList(ctofTables)); @@ -142,7 +143,8 @@ public boolean processDataEvent(DataEvent event) { Collections.sort(hits); // 2) find the clusters from these hits - ClusterFinder clusFinder = new ClusterFinder(); + ClusterFinder clusFinder = new ClusterFinder(this.getConstantsManager().getConstants(newRun, "/calibration/ctof/cluster")); +// clusFinder.setDebug(true); int[] npaddles = Constants.NPAD; int npanels = 1; int nsectors = 1; @@ -154,6 +156,8 @@ public boolean processDataEvent(DataEvent event) { if (CTOFClusters != null) { clusters.addAll(CTOFClusters); + // assign cluster IDs to hits + hitRead.setHitPointersToClusters(hits, clusters); } // 2.1) exit if cluster list is empty but save the hits @@ -161,6 +165,7 @@ public boolean processDataEvent(DataEvent event) { rbc.appendCTOFBanks(event, hits, null); return true; } + // continuing ... there are clusters if (Constants.DEBUGMODE) { // if running in DEBUG MODE print out the // reconstructed info about the hits and the @@ -181,15 +186,8 @@ public boolean processDataEvent(DataEvent event) { .println("---------------------------------------------"); } } - //rbc.appendCTOFBanks( event, hits, clusters); - rbc.appendCTOFBanks(event, hits, null); // json file needs clusters... -// if(event.hasBank("CTOF::adc")) { -// if(event.hasBank("CTOF::adc")) event.getBank("CTOF::adc").show(); -// if(event.hasBank("CTOF::tdc")) event.getBank("CTOF::tdc").show(); -// if(event.hasBank("CTOF::rawhits")) event.getBank("CTOF::rawhits").show(); -// if(event.hasBank("CTOF::hits")) event.getBank("CTOF::hits").show(); -// if(event.hasBank("CVTRec::Tracks")) event.getBank("CVTRec::Tracks").show(); -// } + rbc.appendCTOFBanks(event, hits, clusters); // json file needs clusters... + return true; } diff --git a/reconstruction/tof/src/main/java/org/jlab/service/ftof/FTOFEngine.java b/reconstruction/tof/src/main/java/org/jlab/service/ftof/FTOFEngine.java index b806f341d9..f38df92c48 100644 --- a/reconstruction/tof/src/main/java/org/jlab/service/ftof/FTOFEngine.java +++ b/reconstruction/tof/src/main/java/org/jlab/service/ftof/FTOFEngine.java @@ -134,9 +134,9 @@ public boolean processDataEvent(DataEvent event) { // 1) get the hits List FTOF1AHits = hitRead.get_FTOF1AHits(); List FTOF1BHits = hitRead.get_FTOF1BHits(); - List FTOF2Hits = hitRead.get_FTOF2Hits(); + List FTOF2Hits = hitRead.get_FTOF2Hits(); - // 1.1) exit if hit list is empty + // 2) exit if hit list is empty if (FTOF1AHits != null) { hits.addAll(FTOF1AHits); } @@ -150,9 +150,8 @@ public boolean processDataEvent(DataEvent event) { if (hits.size() == 0) { return true; } - - // 1.2) Sort the hits for clustering - Collections.sort(hits); + // 2.1) Sort the hits according to sector/layer/component + Collections.sort(hits); if (Constants.DEBUGMODE) { // if running in DEBUG MODE print out the // reconstructed info about the hits and the // clusters @@ -162,42 +161,27 @@ public boolean processDataEvent(DataEvent event) { hit.printInfo(); } } - // 2) find the clusters from these hits + + // 3) find the clusters from these hits ClusterFinder clusFinder = new ClusterFinder(); int[] npaddles = Constants.NPAD; int npanels = 3; int nsectors = 6; - List FTOF1AClusters = null; - List FTOF1BClusters = null; - List FTOF2Clusters = null; - if (FTOF1AHits != null && FTOF1AHits.size() > 0) { - FTOF1AClusters = clusFinder.findClusters(FTOF1AHits, nsectors, - npanels, npaddles); - } - if (FTOF1BHits != null && FTOF1BHits.size() > 0) { - FTOF1BClusters = clusFinder.findClusters(FTOF1BHits, nsectors, + if (hits != null && hits.size() > 0) { + clusters = clusFinder.findClusters(hits, nsectors, npanels, npaddles); } - if (FTOF2Hits != null && FTOF2Hits.size() > 0) { - FTOF2Clusters = clusFinder.findClusters(FTOF2Hits, nsectors, - npanels, npaddles); + // 3.1) assign cluster IDs to hits + if (clusters != null && clusters.size()>0) { + hitRead.setHitPointersToClusters(hits, clusters); } - - // next write results to banks - if (FTOF1AClusters != null) { - clusters.addAll(FTOF1AClusters); - } - if (FTOF1BClusters != null) { - clusters.addAll(FTOF1BClusters); - } - if (FTOF2Clusters != null) { - clusters.addAll(FTOF2Clusters); - } - // 2.1) exit if cluster list is empty but save the hits + + // 3.2) exit if cluster list is empty but save the hits if (clusters.size() == 0) { rbc.appendFTOFBanks(event, hits, null, null, TrkType); return true; } + // continuing ... there are clusters if (Constants.DEBUGMODE) { // if running in DEBUG MODE print out the // reconstructed info about the hits and the @@ -219,7 +203,7 @@ public boolean processDataEvent(DataEvent event) { } } - // matching ... not used at this stage... + // 4) matching clusters ... not used at this stage... ClusterMatcher clsMatch = new ClusterMatcher(); ArrayList> matchedClusters = clsMatch .MatchedClusters(clusters, event); @@ -228,6 +212,8 @@ public boolean processDataEvent(DataEvent event) { return true; } + + // 3.4) exit if cluster list is empty but save the hits rbc.appendFTOFBanks(event, hits, clusters, matchedClusters, TrkType); // if (event.hasBank("FTOF::adc")) { // if (event.hasBank("FTOF::adc")) { From d1666498ce08fa0d770c415dc5dac5486677ac39 Mon Sep 17 00:00:00 2001 From: hauenst Date: Mon, 17 Feb 2020 15:20:27 -0500 Subject: [PATCH 05/47] * Updated BAND.json files for new order * Updated RecoBankWriter - fillBandHitBanks write now BAND::laser bank based on status entry of first hit in hitlist - appendBANDBanks checks length of ArrayList before trying to write banks and append to the event. The input values were changed as well * BANDEngine: Modified to use the updated appendBANDBanks function of RecoBankWriter --- etc/bankdefs/hipo/BAND.json | 83 ++++++++++++++----- etc/bankdefs/hipo4/band.json | 54 +++--------- .../jlab/rec/band/banks/RecoBankWriter.java | 82 +++++++++++------- .../org/jlab/service/band/BANDEngine.java | 11 +-- 4 files changed, 129 insertions(+), 101 deletions(-) diff --git a/etc/bankdefs/hipo/BAND.json b/etc/bankdefs/hipo/BAND.json index 58440aaec0..e48a5a8a59 100644 --- a/etc/bankdefs/hipo/BAND.json +++ b/etc/bankdefs/hipo/BAND.json @@ -4,26 +4,67 @@ "group": 22121, "info": "reconstructed coincidence hits from BAND", "items": [ - {"name":"id", "id":1, "type":"int16", "info":"id of the coincidence hit"}, - {"name":"sector", "id":2, "type":"int8", "info":"sector of BAND"}, - {"name":"layer", "id":3, "type":"int8", "info":"layer or column id of BAND"}, - {"name":"component", "id":4, "type":"int16", "info":"paddle or bad id of BAND"}, - {"name":"meantimeTdc", "id":5, "type":"float", "info":"Calibrated meantime of L and R on a bar (ns) from TDC"}, - {"name":"meantimeFadc", "id":6, "type":"float", "info":"Calibrated meantime of L and R on a bar (ns) from FADC"}, - {"name":"difftimeTdc", "id":7, "type":"float", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, - {"name":"difftimeFadc", "id":8, "type":"float", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, - {"name":"adcLcorr", "id":9, "type":"float", "info":"Calibrated ADC of left PMT of coincidence hit"}, - {"name":"adcRcorr", "id":10, "type":"float", "info":"Calibrated ADC of right PMT of coincidence hit"}, - {"name":"tFadcLcorr", "id":11, "type":"float", "info":"Calibrated time from FADC of left PMT in ns of coincidence hit"}, - {"name":"tFadcRcorr", "id":12, "type":"float", "info":"Calibrated time from FADC of right PMT in ns of coincidence hit"}, - {"name":"tTdcLcorr", "id":13, "type":"float", "info":"Calibrated time from TDC of left PMT in ns of coincidence hit"}, - {"name":"tTdcRcorr", "id":14, "type":"float", "info":"Calibrated time from TDC of right PMT in ns of coincidence hit"}, - {"name":"x", "id":15, "type":"float", "info":"X coor (cm) of coincidence hit"}, - {"name":"y", "id":16, "type":"float", "info":"Y coor (cm) of coincidence hit"}, - {"name":"z", "id":17, "type":"float", "info":"Z coor (cm) of coincidence hit"}, - {"name":"ux", "id":18, "type":"float", "info":"X coor uncertainty (cm) of coincidence hit"}, - {"name":"uy", "id":19, "type":"float", "info":"Y coor uncertainty (cm) of coincidence hit"}, - {"name":"uz", "id":20, "type":"float", "info":"Z coor uncertainty (cm) of coincidence hit"} - ] + {"name":"id", "type":"S", "info":"id of the coincidence hit"}, + {"name":"sector", "type":"B", "info":"sector of BAND"}, + {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, + {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, + {"name":"energy", "type":"F", "info":"Geometric mean of L and R ADC"}, + {"name":"time", "type":"F", "info":"Meantime from TDC from L and R hit (ns)"}, + {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, + {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, + {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, + {"name":"ex", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, + {"name":"ey", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, + {"name":"ez", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"}, + {"name":"timeFadc", "type":"F", "info":"Meantime from FADC from L and R hit (ns)"}, + {"name":"difftime", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, + {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, + {"name":"indexLpmt", "type":"S", "info":"index of rawhit from Left PMT, starts at zero"}, + {"name":"indexRpmt", "type":"S", "info":"index of rawhit from Right PMT, starts at zero"}, + {"name":"status", "type":"S", "info":"status of the hit"} + ] + }, + { + "name": "BAND::rawhits", + "group": 22122, + "info": "single PMT hits from BAND", + "items": [ + {"name":"id", "type":"S", "info":"id of the coincidence hit"}, + {"name":"sector", "type":"B", "info":"sector of BAND"}, + {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, + {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, + {"name":"side", "type":"S", "info":"side of bar (L = 0 and R = 1)"}, + {"name":"adc", "type":"F", "info":"Raw ADC from FADC"}, + {"name":"time", "type":"F", "info":"Raw Time (ns) from TDC"}, + {"name":"timeFadc", "type":"F", "info":"Raw Time (ns) from FADC"}, + {"name":"timeCorr", "type":"F", "info":"Raw Time (ns) from TDC corrected for trigger phase"}, + {"name":"indexTdc", "type":"S", "info":"index to raw information in BAND::TDC bank"}, + {"name":"indexAdc", "type":"S", "info":"index to raw information in BAND::ADC bank"} + ] + }, + { + "name": "BAND::laser", + "group": 22123, + "info": "laser hits from BAND", + "items": [ + {"name":"id", "type":"S", "info":"id of the coincidence hit"}, + {"name":"sector", "type":"B", "info":"sector of BAND"}, + {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, + {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, + {"name":"energy", "type":"F", "info":"Geometric mean of L and R ADC"}, + {"name":"time", "type":"F", "info":"Meantime from TDC from L and R hit (ns)"}, + {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, + {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, + {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, + {"name":"ex", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, + {"name":"ey", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, + {"name":"ez", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"}, + {"name":"timeFadc", "type":"F", "info":"Meantime from FADC from L and R hit (ns)"}, + {"name":"difftime", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, + {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, + {"name":"indexLpmt", "type":"S", "info":"index of rawhit from Left PMT, starts at zero"}, + {"name":"indexRpmt", "type":"S", "info":"index of rawhit from Right PMT, starts at zero"}, + {"name":"status", "type":"S", "info":"status of the hit"} + ] } ] diff --git a/etc/bankdefs/hipo4/band.json b/etc/bankdefs/hipo4/band.json index f723e3beae..9dde7c46fd 100644 --- a/etc/bankdefs/hipo4/band.json +++ b/etc/bankdefs/hipo4/band.json @@ -11,17 +11,17 @@ {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, {"name":"energy", "type":"F", "info":"Geometric mean of L and R ADC"}, {"name":"time", "type":"F", "info":"Meantime from TDC from L and R hit (ns)"}, - {"name":"timeFadc", "type":"F", "info":"Meantime from FADC from L and R hit (ns)"}, - {"name":"difftime", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, - {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, - {"name":"indexLpmt", "type":"S", "info":"index of rawhit from Left PMT, starts at zero"}, - {"name":"indexRpmt", "type":"S", "info":"index of rawhit from Right PMT, starts at zero"}, {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, {"name":"ex", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, {"name":"ey", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, {"name":"ez", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"}, + {"name":"timeFadc", "type":"F", "info":"Meantime from FADC from L and R hit (ns)"}, + {"name":"difftime", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, + {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, + {"name":"indexLpmt", "type":"S", "info":"index of rawhit from Left PMT, starts at zero"}, + {"name":"indexRpmt", "type":"S", "info":"index of rawhit from Right PMT, starts at zero"}, {"name":"status", "type":"S", "info":"status of the hit"} ] }, @@ -36,12 +36,12 @@ {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, {"name":"side", "type":"S", "info":"side of bar (L = 0 and R = 1)"}, + {"name":"adc", "type":"F", "info":"Raw ADC from FADC"}, {"name":"time", "type":"F", "info":"Raw Time (ns) from TDC"}, {"name":"timeFadc", "type":"F", "info":"Raw Time (ns) from FADC"}, {"name":"timeCorr", "type":"F", "info":"Raw Time (ns) from TDC corrected for trigger phase"}, - {"name":"adc", "type":"F", "info":"Raw ADC from FADC"}, - {"name":"indexTdc", "type":"S", "info":"index to raw information in BAND::TDC bank"}, - {"name":"indexAdc", "type":"S", "info":"index to raw information in BAND::ADC bank"} + {"name":"indexTdc", "type":"S", "info":"index to raw information in BAND::TDC bank"}, + {"name":"indexAdc", "type":"S", "info":"index to raw information in BAND::ADC bank"} ] }, { @@ -56,46 +56,18 @@ {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, {"name":"energy", "type":"F", "info":"Geometric mean of L and R ADC"}, {"name":"time", "type":"F", "info":"Meantime from TDC from L and R hit (ns)"}, - {"name":"timeFadc", "type":"F", "info":"Meantime from FADC from L and R hit (ns)"}, - {"name":"difftime", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, - {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, - {"name":"indexLpmt", "type":"S", "info":"index of rawhit from Left PMT, starts at zero"}, - {"name":"indexRpmt", "type":"S", "info":"index of rawhit from Right PMT, starts at zero"}, {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, {"name":"ex", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, {"name":"ey", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, {"name":"ez", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"}, - {"name":"status", "type":"S", "info":"status of the hit"} - ] - }, - { - "name": "BAND::oldHits", - "group": 22100, - "item" : 24, - "info": " hits from BAND (old version)", - "entries": [ - {"name":"id", "type":"S", "info":"id of the coincidence hit"}, - {"name":"sector", "type":"B", "info":"sector of BAND"}, - {"name":"layer", "type":"B", "info":"layer or column id of BAND"}, - {"name":"component", "type":"S", "info":"paddle or bad id of BAND"}, - {"name":"meantimeTdc", "type":"F", "info":"Calibrated meantime of L and R on a bar (ns) from TDC"}, - {"name":"meantimeFadc", "type":"F", "info":"Calibrated meantime of L and R on a bar (ns) from FADC"}, - {"name":"difftimeTdc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, + {"name":"timeFadc", "type":"F", "info":"Meantime from FADC from L and R hit (ns)"}, + {"name":"difftime", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from TDC"}, {"name":"difftimeFadc", "type":"F", "info":"Calibrated time difference of L and R on a bar(ns) from FADC"}, - {"name":"adcLcorr", "type":"F", "info":"Calibrated ADC of left PMT of coincidence hit"}, - {"name":"adcRcorr", "type":"F", "info":"Calibrated ADC of right PMT of coincidence hit"}, - {"name":"tFadcLcorr", "type":"F", "info":"Calibrated time from FADC of left PMT in ns of coincidence hit"}, - {"name":"tFadcRcorr", "type":"F", "info":"Calibrated time from FADC of right PMT in ns of coincidence hit"}, - {"name":"tTdcLcorr", "type":"F", "info":"Calibrated time from TDC of left PMT in ns of coincidence hit"}, - {"name":"tTdcRcorr", "type":"F", "info":"Calibrated time from TDC of right PMT in ns of coincidence hit"}, - {"name":"x", "type":"F", "info":"X coor (cm) of coincidence hit"}, - {"name":"y", "type":"F", "info":"Y coor (cm) of coincidence hit"}, - {"name":"z", "type":"F", "info":"Z coor (cm) of coincidence hit"}, - {"name":"ux", "type":"F", "info":"X coor uncertainty (cm) of coincidence hit"}, - {"name":"uy", "type":"F", "info":"Y coor uncertainty (cm) of coincidence hit"}, - {"name":"uz", "type":"F", "info":"Z coor uncertainty (cm) of coincidence hit"} + {"name":"indexLpmt", "type":"S", "info":"index of rawhit from Left PMT, starts at zero"}, + {"name":"indexRpmt", "type":"S", "info":"index of rawhit from Right PMT, starts at zero"}, + {"name":"status", "type":"S", "info":"status of the hit"} ] } ] diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java index ab54e5e109..908aae8f04 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java @@ -2,7 +2,8 @@ import java.util.ArrayList; -import org.apache.commons.math3.analysis.function.Sqrt; +import javax.net.ssl.ExtendedSSLSession; + import org.jlab.io.base.DataBank; import org.jlab.io.base.DataEvent; import org.jlab.rec.band.hit.BandHit; @@ -19,16 +20,24 @@ public static DataBank fillBandHitBanks(DataEvent event, ArrayList hitl if (hitlist == null) { return null; } - DataBank bank = event.createBank("BAND::hits", hitlist.size()); - + //Get status for first hit. If it is 1 assume that the BandHit array contains laser hits + short test_status = (short) hitlist.get(0).GetStatus(); + + DataBank bank; + if (test_status == 1) { //Initialize BAND::laser if status is 1 of the first hit + bank = event.createBank("BAND::laser", hitlist.size()); + } + else { //in all other cases the data is something else (cosmics or real data)->Store in BAND::hits + bank = event.createBank("BAND::hits", hitlist.size()); + } + if (bank == null) { - //System.err.println("COULD NOT CREATE A BAND::Hits BANK!!!!!!"); + System.err.println("COULD NOT CREATE A BAND::Hits/laser BANK in RecoBankWriter.fillBandHitBanks!!!!!!"); return null; } - - //i should only go to 1 but keep for loop for future extensions if more hits are required - for(int i =0; i hitl bank.setShort("component",i, (short) hitlist.get(i).GetComponent()); bank.setFloat("energy", i, (float) Math.sqrt(hitlist.get(i).GetAdcLeft() * hitlist.get(i).GetAdcRight())); - bank.setFloat("time",i, (float) hitlist.get(i).GetMeanTime_TDC()); - bank.setFloat("timeFadc",i, (float) hitlist.get(i).GetMeanTime_FADC()); - - bank.setFloat("difftime",i, (float) hitlist.get(i).GetDiffTime_TDC()); - bank.setFloat("difftimeFadc",i, (float) hitlist.get(i).GetDiffTime_FADC()); - - bank.setShort("indexLpmt",i, (short) hitlist.get(i).GetIndexLpmt()); - bank.setShort("indexRpmt",i, (short) hitlist.get(i).GetIndexRpmt()); - + bank.setFloat("x",i, (float) (hitlist.get(i).GetX())); bank.setFloat("y",i, (float) (hitlist.get(i).GetY())); bank.setFloat("z",i, (float) (hitlist.get(i).GetZ())); @@ -53,13 +54,20 @@ public static DataBank fillBandHitBanks(DataEvent event, ArrayList hitl bank.setFloat("ey",i, (float) (hitlist.get(i).GetUy())); bank.setFloat("ez",i, (float) (hitlist.get(i).GetUz())); + bank.setFloat("timeFadc",i, (float) hitlist.get(i).GetMeanTime_FADC()); + bank.setFloat("difftime",i, (float) hitlist.get(i).GetDiffTime_TDC()); + bank.setFloat("difftimeFadc",i, (float) hitlist.get(i).GetDiffTime_FADC()); + + bank.setShort("indexLpmt",i, (short) hitlist.get(i).GetIndexLpmt()); + bank.setShort("indexRpmt",i, (short) hitlist.get(i).GetIndexRpmt()); + bank.setShort("status",i, (short) hitlist.get(i).GetStatus()); } return bank; } - public static DataBank fillBandCandidateBanks(DataEvent event, ArrayList candidatelist) { + public static DataBank fillBandCandidateBank(DataEvent event, ArrayList candidatelist) { if (candidatelist == null) { return null; @@ -67,12 +75,11 @@ public static DataBank fillBandCandidateBanks(DataEvent event, ArrayList hitlist) { - - DataBank bank = fillBandHitBanks((DataEvent) event, hitlist); - if (bank != null) { - //bank.show(); - event.appendBank(bank); + public static void appendBANDBanks(DataEvent event,ArrayList candidatelist, ArrayList hitlist) { + + //check if candidatelist is not empty (just to be sure, this is also checked in BANDEngine. + if(candidatelist.size()>0){ + DataBank rawhits = fillBandCandidateBank((DataEvent) event, candidatelist); + if (rawhits != null) { + event.appendBank(rawhits); + } + else { + System.err.println("COULD NOT APPEND BAND::rawhits to the event in RecoBankWriter.appendBANDBanks!"); + } + } + //check if hitlist is not empty + if(hitlist.size()>0){ + DataBank hits = fillBandHitBanks((DataEvent) event, hitlist); + if (hits != null) { + event.appendBank(hits); + } + else { + System.err.println("COULD NOT APPEND BAND::hits/laser to the event in RecoBankWriter.appendBANDBanks!"); + } } } diff --git a/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java b/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java index 506fb98863..768184ccaa 100755 --- a/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java +++ b/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java @@ -44,7 +44,7 @@ public boolean processDataEvent(DataEvent event) { //1) Search for valid PMT hits based on FADC/TDC for each PMT candidates = HitReader.getBandCandidates(event) ; - // exit if candidates list is empty + // exit if candidates list is empty, neither BAND::rawhits nor BAND::hits is filled in this case if(candidates.size()==0 ) return true; @@ -52,13 +52,8 @@ public boolean processDataEvent(DataEvent event) { BandHitFinder hitFinder = new BandHitFinder(); hits = hitFinder.findGoodHits(candidates); - - if(hits.size()>0){ - //event.show(); - //System.out.println("in process event "); - RecoBankWriter.appendBANDBanks(event,hits); - - } + //3) Write candidates and hits to the banks. + RecoBankWriter.appendBANDBanks(event,candidates,hits); return true; From 76e02250df9d046eb122c3de9604f3b033bd4f36 Mon Sep 17 00:00:00 2001 From: hauenst Date: Mon, 17 Feb 2020 16:14:51 -0500 Subject: [PATCH 06/47] * Updated CalibrationConstantLoader to get information for BAND cuts from ccdb * Add boolean for veto hits to BandHitFinder::findGoodHits() * Updated BandHitFinder::advancedHitFinder for new logic on status values --- .../constants/CalibrationConstantsLoader.java | 14 +++++- .../org/jlab/rec/band/hit/BandHitFinder.java | 48 +++++++++---------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java b/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java index 3799c4e168..29e7cd1d2d 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java @@ -42,6 +42,8 @@ public CalibrationConstantsLoader() { public static double JITTER_PERIOD = 0; public static int JITTER_PHASE = 0; public static int JITTER_CYCLES = 0; + public static int CUT_NHITS_BAND = 5; + public static int CUT_LASERHITS_BAND = 100; public static synchronized void Load(int runno, String var, ConstantsManager manager) { @@ -57,7 +59,17 @@ public static synchronized void Load(int runno, String var, ConstantsManager man IndexedTable paddleoffs_fadc = manager.getConstants(runno, "/calibration/band/paddle_offsets"); IndexedTable layeroffs_fadc = manager.getConstants(runno, "/calibration/band/layer_offsets"); IndexedTable paddleoffs_tdc = manager.getConstants(runno, "/calibration/band/paddle_offsets_tdc"); - IndexedTable layeroffs_tdc = manager.getConstants(runno, "/calibration/band/layer_offsets_tdc"); + IndexedTable layeroffs_tdc = manager.getConstants(runno, "/calibration/band/layer_offsets_tdc"); + IndexedTable cutvalues = manager.getConstants(runno, "/calibration/band/cuts"); + + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Cut Values + for( int i = 0; i < cutvalues.getRowCount(); i++){ + CUT_NHITS_BAND = cutvalues.getIntValue("nhitsband", 0,0,0); + CUT_LASERHITS_BAND = cutvalues.getIntValue("nlaserhits", 0,0,0); + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Time offsets diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java index 663b715a4d..75c02aa69c 100644 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java @@ -6,7 +6,6 @@ import org.jlab.rec.band.constants.CalibrationConstantsLoader; import org.jlab.rec.band.constants.Parameters; -import org.netlib.util.doubleW; public class BandHitFinder { @@ -31,7 +30,7 @@ public ArrayList findGoodHits(ArrayList candidates) { ArrayList coincidences = new ArrayList(); Map hasMatch = new HashMap(); - + boolean hasvetohit = false; // Loop through the candidates array to find possible combinations of left and right. if(candidates.size() > 0) { @@ -85,7 +84,7 @@ public ArrayList findGoodHits(ArrayList candidates) { // Print for debugging: //Hit.Print(); - + hasvetohit = true; coincidences.add(Hit); continue; //return new ArrayList(); @@ -246,7 +245,7 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT // At this stage an array of coincidence hits from type BandHit exists. Now we can skim those coincidence // hits for some neutral candidate particles - if( coincidences.size() > 0 ) return advancedHitFinder(coincidences); + if( coincidences.size() > 0 ) return advancedHitFinder(coincidences, hasvetohit); else{ return new ArrayList(); } @@ -257,34 +256,33 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT } // findHits function - public ArrayList advancedHitFinder(ArrayList coincidences) + public ArrayList advancedHitFinder(ArrayList coincidences, boolean hasvetohit) { - /** author: Efrain Segarra. - Currently this function just searches if veto layer hit in the coincidence list. - Otherwise, returns 'betterHits'. In the future we'd like to do some more sophisticated - neutral candidate searching. - Cut on Layer 6 is removed for now to have cosmics and laser data in the output as well. - */ + /** author: Efrain Segarra, Florian Hauenstein + * Currently this function sets status flags for EACH hit in an event. This depends on the length of the BandHit array and + * if a veto hit was found in the data from the findGoodHits function. Laserhits will get status 1. The rest either 0, 2 or 3 + **/ ArrayList betterHits = new ArrayList(); - //Set status bits for each hit, good hit status is 0 for each hit when #hits is < 5. - //If #hits > 100, status will be set to 1 (laser hits), other possibilities it will be 2 - int status_temp = -1; - if (coincidences.size() > 100) { status_temp = 1; } - else if (coincidences.size() < 5) { status_temp = 0; } //coincidences.size > 0 is already checked before advanceHitFinder is called - else { status_temp = 2; } + int status_temp = -1; + //Set status bits for each hit, good hit status is 0 for each hit when #hits is < bandhits (standard 5). + //If #hits > laserhitcutvalue (standard 100), status will be set to 1 (laser hits), other possibilities it will be 2 + //If there will be a veto hit the status values are changed to 3 from 0 or 2 (exlude if laser hit + + if (coincidences.size() > CalibrationConstantsLoader.CUT_LASERHITS_BAND) { status_temp = 1; } //laser hits + else if (coincidences.size() < CalibrationConstantsLoader.CUT_NHITS_BAND) { status_temp = 0; } //coincidences.size > 0 is already checked before advanceHitFinder is called + else { status_temp = 2; } //cosmics or other data, no veto hit + + //if hasvetohit flag is true and it is not a laser hit set status to 3 for all hits + if (hasvetohit && status_temp != 1) { status_temp = 3; } + + for( int hit = 0 ; hit < coincidences.size() ; hit++){ BandHit thisHit = coincidences.get(hit); - thisHit.SetStatus(status_temp); - //if( thisHit.GetLayer() == 6 ){ - // return new ArrayList(); - //} - //else{ - betterHits.add( thisHit ); - //} - + thisHit.SetStatus(status_temp); + betterHits.add( thisHit ); } return betterHits; } From f1d7f9bea17e5b7cc2984364a7f1c66dbdaea5a9 Mon Sep 17 00:00:00 2001 From: hauenst Date: Mon, 17 Feb 2020 16:38:17 -0500 Subject: [PATCH 07/47] * Added Amplitude row to BAND::rawhits (json-files, BANK writer, Hit reader) * Added ADC amplitude to BandHitCandidate * BandHitFinder: - Read Amplitude for later corrections on time-walk and algorithm updates (not done yet) - Add IndexL/R pmts for Veto hits --- etc/bankdefs/hipo/BAND.json | 1 + etc/bankdefs/hipo4/band.json | 1 + .../org/jlab/rec/band/banks/HitReader.java | 9 ++++++-- .../jlab/rec/band/banks/RecoBankWriter.java | 1 + .../jlab/rec/band/hit/BandHitCandidate.java | 9 ++++++-- .../org/jlab/rec/band/hit/BandHitFinder.java | 23 ++++++++++++++++++- 6 files changed, 39 insertions(+), 5 deletions(-) diff --git a/etc/bankdefs/hipo/BAND.json b/etc/bankdefs/hipo/BAND.json index e48a5a8a59..4ae5fb1156 100644 --- a/etc/bankdefs/hipo/BAND.json +++ b/etc/bankdefs/hipo/BAND.json @@ -35,6 +35,7 @@ {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, {"name":"side", "type":"S", "info":"side of bar (L = 0 and R = 1)"}, {"name":"adc", "type":"F", "info":"Raw ADC from FADC"}, + {"name":"ampl", "type":"F", "info":"ADC ampl from FADC"}, {"name":"time", "type":"F", "info":"Raw Time (ns) from TDC"}, {"name":"timeFadc", "type":"F", "info":"Raw Time (ns) from FADC"}, {"name":"timeCorr", "type":"F", "info":"Raw Time (ns) from TDC corrected for trigger phase"}, diff --git a/etc/bankdefs/hipo4/band.json b/etc/bankdefs/hipo4/band.json index 9dde7c46fd..47c12576ab 100644 --- a/etc/bankdefs/hipo4/band.json +++ b/etc/bankdefs/hipo4/band.json @@ -37,6 +37,7 @@ {"name":"component", "type":"S", "info":"paddle or row id of BAND"}, {"name":"side", "type":"S", "info":"side of bar (L = 0 and R = 1)"}, {"name":"adc", "type":"F", "info":"Raw ADC from FADC"}, + {"name":"ampl", "type":"F", "info":"ADC ampl from FADC"}, {"name":"time", "type":"F", "info":"Raw Time (ns) from TDC"}, {"name":"timeFadc", "type":"F", "info":"Raw Time (ns) from FADC"}, {"name":"timeCorr", "type":"F", "info":"Raw Time (ns) from TDC corrected for trigger phase"}, diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java index d045ad7a93..43fc15ce54 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java @@ -26,13 +26,13 @@ public class HitReader { public static ArrayList getBandCandidates(DataEvent event) { Map fadcInt = new HashMap(); + Map fadcAmpl = new HashMap(); Map fadcTimes = new HashMap(); Map tdcTimes = new HashMap(); Map fadcIndex = new HashMap(); Map tdcIndex = new HashMap(); - if(event==null) return new ArrayList(); // Grab trigger phase for TDC vs FADC matching @@ -60,6 +60,7 @@ public static ArrayList getBandCandidates(DataEvent event) { int o = bankADC.getByte("order",i); int adc = bankADC.getInt("ADC",i); + int ampl= bankADC.getInt("amplitude", i); float ftdc = bankADC.getFloat("time",i); if( adc <= 0 || ftdc <= 0 ) continue; @@ -71,15 +72,18 @@ public static ArrayList getBandCandidates(DataEvent event) { // Check if this PMT has been stored before, and if it has, then // replace it only if it has a larger ADC value. Otherwise, add to map + //NOTE F.H. Feb 17 2020: Should we do some update to also check Amplitude here? if (fadcInt.containsKey( Integer.valueOf(key) ) ) { if( fadcInt.get( Integer.valueOf(key) ) < adc ) { fadcInt.put( Integer.valueOf(key) , Integer.valueOf(adc) ); + fadcAmpl.put(Integer.valueOf(key), Integer.valueOf(ampl)); fadcTimes.put( Integer.valueOf(key), Float.valueOf(ftdc) ); fadcIndex.put( Integer.valueOf(key), Integer.valueOf(i)); } } else { fadcInt.put( Integer.valueOf(key) , Integer.valueOf(adc) ); + fadcAmpl.put(Integer.valueOf(key), Integer.valueOf(ampl)); fadcTimes.put( Integer.valueOf(key), Float.valueOf(ftdc) ); fadcIndex.put( Integer.valueOf(key), Integer.valueOf(i)); } @@ -135,6 +139,7 @@ public static ArrayList getBandCandidates(DataEvent event) { int order = Integer.parseInt( id.substring(3,4) ); int adc = fadcInt.get(keys); + int ampl= fadcAmpl.get(keys); float ftdc = fadcTimes.get(keys); double tdc = tdcTimes.get(keys); int indexadc = fadcIndex.get(keys); @@ -142,7 +147,7 @@ public static ArrayList getBandCandidates(DataEvent event) { //System.out.println("Found a candidate PMT hit! slco: "+sector+" "+layer+" "+component+" "+order+" "+adc+" "+ftdc+" "+tdc); BandHitCandidate newHit = new BandHitCandidate( sector,layer,component,order, - adc, tdc, ftdc ,triggerPhase, indexadc, indextdc); + adc, ampl,tdc, ftdc ,triggerPhase, indexadc, indextdc); candidates.add(newHit); } diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java index 908aae8f04..6b5432348b 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java @@ -88,6 +88,7 @@ public static DataBank fillBandCandidateBank(DataEvent event, ArrayList findGoodHits(ArrayList candidates) { Hit.SetUx(0.); Hit.SetUy(0.); Hit.SetUz(0.); + + if (hit1.GetSide() == 1) { //Veto has a left side PMT + Hit.SetIndexLpmt(i); + Hit.SetIndexRpmt(0); + } + else if (hit1.GetSide() == 1) { //Veto has a right side PMT + Hit.SetIndexLpmt(0); + Hit.SetIndexRpmt(i); + } + else { + System.err.println("BAND HIT FINDER. Side of Veto PMT could not be assigned"); + continue; + } + // Print for debugging: //Hit.Print(); @@ -116,6 +130,8 @@ public ArrayList findGoodHits(ArrayList candidates) { double tdcright = -1; double adcleft = -1; double adcright = -1; + double amplleft = -1; + double amplright= -1; float ftdcleft = -1; float ftdcright = -1; int indexleft = -1; @@ -127,6 +143,8 @@ public ArrayList findGoodHits(ArrayList candidates) { ftdcright = hit2.GetFtdc(); adcleft = hit1.GetAdc(); adcright = hit2.GetAdc(); + amplleft = hit1.GetAmpl(); + amplright = hit2.GetAmpl(); indexleft = i; indexright = j; } @@ -137,6 +155,8 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT ftdcright = hit1.GetFtdc(); adcleft = hit2.GetAdc(); adcright = hit1.GetAdc(); + amplleft = hit2.GetAmpl(); + amplright = hit1.GetAmpl(); indexright = j; indexleft = i; } @@ -144,7 +164,8 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT System.err.println("BAND HIT FINDER. Found two hits with left and right side but can not assign which hide belongs to which side"); continue; } - + //TODO: Update Time Walk Correction with Amplitude instead of ADC + //TODO: Update Algorithm // ----------------------------------------------------------------------------------------------- // Time-walk correction double time_walk_paramsL[] = CalibrationConstantsLoader.TIMEWALK_L.get( Integer.valueOf(barKey) ); From ca25080883afb91ca56d0d0a6fc2722801f229e9 Mon Sep 17 00:00:00 2001 From: Efrain Patrick Segarra Date: Thu, 20 Feb 2020 17:35:44 -0500 Subject: [PATCH 08/47] Corrected our Engine to read in CCDB table and updated schema for new bankdefs --- etc/bankdefs/util/bankSplit.py | 4 +- .../constants/CalibrationConstantsLoader.java | 64 +++++++++---------- .../org/jlab/service/band/BANDEngine.java | 3 +- 3 files changed, 36 insertions(+), 35 deletions(-) diff --git a/etc/bankdefs/util/bankSplit.py b/etc/bankdefs/util/bankSplit.py index 1dec3498e1..bbef8bf9dd 100644 --- a/etc/bankdefs/util/bankSplit.py +++ b/etc/bankdefs/util/bankSplit.py @@ -50,8 +50,8 @@ def createdirandlinks(dirname, banklist): # create dst, calibration and monitoring directories dst = ["RUN::config","RAW::epics","RAW::scaler","REC::Event","REC::Particle","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::ForwardTagger","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RICH::tdc","RICH::ringCher","RUN::scaler","HEL::flip","HEL::online","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True"] -calibration = ["BAND::adc","BAND::tdc","BAND::hits","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTOF::adc","FTOF::hits","FTOF::tdc","HEL::flip","HEL::online","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True","RAW::epics","RAW::scaler","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::Event","REC::ForwardTagger","REC::Particle","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RF::adc","RF::tdc","RICH::tdc","RICH::hits","RICH::hadrons","RICH::photons","RUN::config","RUN::rf","RUN::scaler","RUN::trigger","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory"] -monitoring = ["BAND::adc","BAND::tdc","BAND::hits","BMT::adc","BMTRec::Clusters","BMTRec::Crosses","BMTRec::Hits","BMTRec::LayerEffs","BST::adc","BSTRec::Clusters","BSTRec::Crosses","BSTRec::Hits","BSTRec::LayerEffs","CND::adc","CND::clusters","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","CVTRec::Trajectory","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::hits","ECAL::peaks","ECAL::tdc","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTOF::adc","FTOF::hits","FTOF::tdc","HEL::adc","HEL::flip","HEL::online","HitBasedTrkg::HBTracks","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True","RAW::epics","RAW::scaler","RAW::vtp","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::Event","REC::ForwardTagger","REC::Particle","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RECHB::Calorimeter","RECHB::Cherenkov","RECHB::Event","RECHB::ForwardTagger","RECHB::Particle","RECHB::Scintillator","RECHB::Track","RF::adc","RF::tdc","RICH::tdc","RICH::hits","RICH::hadrons","RICH::photons","RUN::config","RUN::rf","RUN::scaler","RUN::trigger","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory"] +calibration = ["BAND::rawhits","BAND::laser","BAND::adc","BAND::tdc","BAND::hits","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTOF::adc","FTOF::hits","FTOF::tdc","HEL::flip","HEL::online","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True","RAW::epics","RAW::scaler","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::Event","REC::ForwardTagger","REC::Particle","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RF::adc","RF::tdc","RICH::tdc","RICH::hits","RICH::hadrons","RICH::photons","RUN::config","RUN::rf","RUN::scaler","RUN::trigger","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory"] +monitoring = ["BAND::rawhits","BAND::laser","BAND::adc","BAND::tdc","BAND::hits","BMT::adc","BMTRec::Clusters","BMTRec::Crosses","BMTRec::Hits","BMTRec::LayerEffs","BST::adc","BSTRec::Clusters","BSTRec::Crosses","BSTRec::Hits","BSTRec::LayerEffs","CND::adc","CND::clusters","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","CVTRec::Trajectory","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::hits","ECAL::peaks","ECAL::tdc","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTOF::adc","FTOF::hits","FTOF::tdc","HEL::adc","HEL::flip","HEL::online","HitBasedTrkg::HBTracks","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True","RAW::epics","RAW::scaler","RAW::vtp","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::Event","REC::ForwardTagger","REC::Particle","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RECHB::Calorimeter","RECHB::Cherenkov","RECHB::Event","RECHB::ForwardTagger","RECHB::Particle","RECHB::Scintillator","RECHB::Track","RF::adc","RF::tdc","RICH::tdc","RICH::hits","RICH::hadrons","RICH::photons","RUN::config","RUN::rf","RUN::scaler","RUN::trigger","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory"] createdirandlinks("dst/", dst) createdirandlinks("calibration/", calibration) createdirandlinks("monitoring/", monitoring) diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java b/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java index 29e7cd1d2d..452f064c03 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java @@ -49,35 +49,35 @@ public static synchronized void Load(int runno, String var, ConstantsManager man //System.out.println("*Loading calibration constants*"); manager.setVariation(var); - - IndexedTable lroffsets = manager.getConstants(runno, "/calibration/band/lr_offsets"); - IndexedTable timewalkL = manager.getConstants(runno, "/calibration/band/time_walk_corr_left"); - IndexedTable timewalkR = manager.getConstants(runno, "/calibration/band/time_walk_corr_right"); - IndexedTable effvel = manager.getConstants(runno, "/calibration/band/effective_velocity"); - IndexedTable timejitter = manager.getConstants(runno, "/calibration/band/time_jitter"); - IndexedTable attenuation= manager.getConstants(runno, "/calibration/band/attenuation_lengths"); - IndexedTable paddleoffs_fadc = manager.getConstants(runno, "/calibration/band/paddle_offsets"); - IndexedTable layeroffs_fadc = manager.getConstants(runno, "/calibration/band/layer_offsets"); - IndexedTable paddleoffs_tdc = manager.getConstants(runno, "/calibration/band/paddle_offsets_tdc"); - IndexedTable layeroffs_tdc = manager.getConstants(runno, "/calibration/band/layer_offsets_tdc"); - IndexedTable cutvalues = manager.getConstants(runno, "/calibration/band/cuts"); - - + + IndexedTable lroffsets = manager.getConstants(runno, "/calibration/band/lr_offsets"); + IndexedTable timewalkL = manager.getConstants(runno, "/calibration/band/time_walk_corr_left"); + IndexedTable timewalkR = manager.getConstants(runno, "/calibration/band/time_walk_corr_right"); + IndexedTable effvel = manager.getConstants(runno, "/calibration/band/effective_velocity"); + IndexedTable timejitter = manager.getConstants(runno, "/calibration/band/time_jitter"); + IndexedTable attenuation= manager.getConstants(runno, "/calibration/band/attenuation_lengths"); + IndexedTable paddleoffs_fadc = manager.getConstants(runno, "/calibration/band/paddle_offsets"); + IndexedTable layeroffs_fadc = manager.getConstants(runno, "/calibration/band/layer_offsets"); + IndexedTable paddleoffs_tdc = manager.getConstants(runno, "/calibration/band/paddle_offsets_tdc"); + IndexedTable layeroffs_tdc = manager.getConstants(runno, "/calibration/band/layer_offsets_tdc"); + IndexedTable cutvalues = manager.getConstants(runno, "/calibration/band/cuts"); + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Cut Values - for( int i = 0; i < cutvalues.getRowCount(); i++){ + for( int i = 0; i < cutvalues.getRowCount(); i++){ CUT_NHITS_BAND = cutvalues.getIntValue("nhitsband", 0,0,0); CUT_LASERHITS_BAND = cutvalues.getIntValue("nlaserhits", 0,0,0); } - - + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Time offsets for(int i = 0; i < lroffsets.getRowCount(); i++) { // Get sector, layer, component int sector = Integer.parseInt((String)lroffsets.getValueAt(i, 0)); - int layer = Integer.parseInt((String)lroffsets.getValueAt(i, 1)); - int component = Integer.parseInt((String)lroffsets.getValueAt(i, 2)); + int layer = Integer.parseInt((String)lroffsets.getValueAt(i, 1)); + int component = Integer.parseInt((String)lroffsets.getValueAt(i, 2)); // Get the actual offsets double tdc_off = lroffsets.getDoubleValue("tdc_off", sector, layer, component); double fadc_off = lroffsets.getDoubleValue("fadc_off", sector, layer, component); @@ -92,8 +92,8 @@ public static synchronized void Load(int runno, String var, ConstantsManager man for(int i = 0; i < timewalkL.getRowCount(); i++) { // Get sector, layer, component int sector = Integer.parseInt((String)timewalkL.getValueAt(i, 0)); - int layer = Integer.parseInt((String)timewalkL.getValueAt(i, 1)); - int component = Integer.parseInt((String)timewalkL.getValueAt(i, 2)); + int layer = Integer.parseInt((String)timewalkL.getValueAt(i, 1)); + int component = Integer.parseInt((String)timewalkL.getValueAt(i, 2)); // Get parameters double parA = timewalkL.getDoubleValue("par_a", sector, layer, component); double parB = timewalkL.getDoubleValue("par_b", sector, layer, component); @@ -111,9 +111,9 @@ public static synchronized void Load(int runno, String var, ConstantsManager man for(int i = 0; i < timewalkR.getRowCount(); i++) { // Get sector, layer, component int sector = Integer.parseInt((String)timewalkR.getValueAt(i, 0)); - int layer = Integer.parseInt((String)timewalkR.getValueAt(i, 1)); - int component = Integer.parseInt((String)timewalkR.getValueAt(i, 2)); - // Get parameters + int layer = Integer.parseInt((String)timewalkR.getValueAt(i, 1)); + int component = Integer.parseInt((String)timewalkR.getValueAt(i, 2)); + // Get parameters double parA = timewalkR.getDoubleValue("par_a", sector, layer, component); double parB = timewalkR.getDoubleValue("par_b", sector, layer, component); // Get errors @@ -139,7 +139,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man int key = sector*100+layer*10+component; TDC_VEFF.put( Integer.valueOf(key), Double.valueOf(veff_tdc) ); FADC_VEFF.put( Integer.valueOf(key), Double.valueOf(veff_fadc) ); - + } //////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -149,7 +149,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man JITTER_PHASE = timejitter.getIntValue("phase", 0,0,0); JITTER_CYCLES = timejitter.getIntValue("cycles", 0,0,0); } - + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Paddle-to-paddle offsets FADC for(int i =0; i < paddleoffs_fadc.getRowCount(); i++) { @@ -166,7 +166,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man FADC_MT_P2P_RES.put( Integer.valueOf(key), Double.valueOf(p2p_res_fadc) ); } - + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Layer-to-layer offsets FADC for(int i =0; i < layeroffs_fadc.getRowCount(); i++) { @@ -182,7 +182,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man FADC_MT_L2L_OFFSET.put( Integer.valueOf(key), Double.valueOf(l2l_off_fadc) ); FADC_MT_L2L_RES.put( Integer.valueOf(key), Double.valueOf(l2l_res_fadc) ); } - + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Paddle-to-paddle offsets for(int i =0; i < paddleoffs_tdc.getRowCount(); i++) { @@ -214,8 +214,8 @@ public static synchronized void Load(int runno, String var, ConstantsManager man int key = sector*100+layer*10+component; TDC_MT_L2L_OFFSET.put( Integer.valueOf(key), Double.valueOf(l2l_off_tdc) ); TDC_MT_L2L_RES.put( Integer.valueOf(key), Double.valueOf(l2l_res_tdc) ); -} - + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Attenuation constants for( int i=0; i < attenuation.getRowCount(); i++){ @@ -234,7 +234,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man CSTLOADED = true; //System.out.println("SUCCESSFULLY LOADED band CALIBRATION CONSTANTS...."); - + } @@ -251,6 +251,6 @@ public static final void setDB(DatabaseConstantProvider dB) { } public static void main (String arg[]) { - // CalibrationConstantsLoader.Load(10,"default"); + // CalibrationConstantsLoader.Load(10,"default"); } } diff --git a/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java b/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java index 768184ccaa..2b640428ad 100755 --- a/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java +++ b/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java @@ -72,7 +72,8 @@ public boolean init() { "/calibration/band/layer_offsets_tdc", "/calibration/band/attenuation_lengths", "/calibration/band/time_walk_corr_left", - "/calibration/band/time_walk_corr_right" + "/calibration/band/time_walk_corr_right", + "/calibration/band/cuts" }; requireConstants(Arrays.asList(bandTables)); From 59f863b0e57ed4f7989c3b7e89eff011ddeeb7be Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Thu, 20 Feb 2020 17:58:52 -0500 Subject: [PATCH 09/47] EB: switching to read CTOF clusters instead of hits --- .../eb/src/main/java/org/jlab/service/eb/EBEngine.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java index e94f422319..e178846ecb 100644 --- a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java +++ b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java @@ -93,7 +93,7 @@ public boolean processDataEvent(DataEvent de,EBScalers ebs) { List responseECAL = CalorimeterResponse.readHipoEvent(de, "ECAL::clusters", DetectorType.ECAL,"ECAL::moments"); List responseFTOF = ScintillatorResponse.readHipoEvent(de, ftofHitsType, DetectorType.FTOF); - List responseCTOF = ScintillatorResponse.readHipoEvent(de, "CTOF::hits", DetectorType.CTOF); + List responseCTOF = ScintillatorResponse.readHipoEvent(de, "CTOF::clusters", DetectorType.CTOF); List responseCND = ScintillatorResponse.readHipoEvent(de, "CND::clusters", DetectorType.CND); List responseHTCC = CherenkovResponse.readHipoEvent(de,"HTCC::rec",DetectorType.HTCC); List responseLTCC = CherenkovResponse.readHipoEvent(de,"LTCC::clusters",DetectorType.LTCC); From aec8e380a18a2a624dfc3bbcfeae92b83e56f3da Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Thu, 20 Feb 2020 18:51:44 -0500 Subject: [PATCH 10/47] TOF: added pathLengthThruBar to clusters and reading of FTOF cluster parameters from CCDB --- etc/bankdefs/hipo4/tof.json | 7 +++---- .../jlab/rec/tof/banks/ctof/RecoBankWriter.java | 3 ++- .../jlab/rec/tof/banks/ftof/RecoBankWriter.java | 6 +----- .../java/org/jlab/rec/tof/cluster/Cluster.java | 15 +++++++++++++++ .../java/org/jlab/service/ftof/FTOFEngine.java | 3 ++- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/etc/bankdefs/hipo4/tof.json b/etc/bankdefs/hipo4/tof.json index 8efb5b5928..836db598fa 100644 --- a/etc/bankdefs/hipo4/tof.json +++ b/etc/bankdefs/hipo4/tof.json @@ -108,9 +108,7 @@ {"name":"x", "type":"F", "info":"Global X coor (cm) of cluster hit"}, {"name":"y", "type":"F", "info":"Global Y coor (cm) of cluster hit"}, {"name":"z", "type":"F", "info":"Global Z coor (cm) of cluster hit"}, - {"name":"x_unc", "type":"F", "info":"Global X coor unc (cm) of cluster hit"}, - {"name":"y_unc", "type":"F", "info":"Global Y coor unc (cm) of cluster hit"}, - {"name":"z_unc", "type":"F", "info":"Global Z coor unc (cm) of cluster hit"} + {"name":"pathLengthThruBar", "type":"F", "info":"pathlength of the track from the entrance point to the exit point through the cluster bars "} ] }, { @@ -204,7 +202,8 @@ {"name":"time_unc", "type":"F", "info":"Cluster seed time unc (ns)"}, {"name":"x", "type":"F", "info":"Global X coor (cm) of cluster seed"}, {"name":"y", "type":"F", "info":"Global Y coor (cm) of cluster seed"}, - {"name":"z", "type":"F", "info":"Global Z coor (cm) of cluster seed"} + {"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 "} ] } diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ctof/RecoBankWriter.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ctof/RecoBankWriter.java index e8424b9b34..56d868e976 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ctof/RecoBankWriter.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/banks/ctof/RecoBankWriter.java @@ -143,7 +143,8 @@ public DataBank fillClustersBank(DataEvent event, List cluslist) { bank.setFloat("time_unc", i, (float) cluslist.get(i).get(0).get_tUnc()); bank.setFloat("x", i, (float) cluslist.get(i).get(0).get_Position().x()); bank.setFloat("y", i, (float) cluslist.get(i).get(0).get_Position().y()); - bank.setFloat("z", i, (float) cluslist.get(i).get(0).get_Position().z()); // At this stage the uncertainty is not calculated + bank.setFloat("z", i, (float) cluslist.get(i).get(0).get_Position().z()); + bank.setFloat("pathLengthThruBar", i, (float) cluslist.get(i).get_PathLengthThruBar()); } return bank; 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 f88bccf14e..78429ab809 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 @@ -189,11 +189,7 @@ public DataBank fillClustersBank(DataEvent event, List cluslist, String bank.setFloat("x", i, (float) cluslist.get(i).get_x()); bank.setFloat("y", i, (float) cluslist.get(i).get_y()); bank.setFloat("z", i, (float) cluslist.get(i).get_z()); - bank.setFloat("x_unc", i, 5); // At this stage the uncertainty is - // not calculated - bank.setFloat("y_unc", i, (float) cluslist.get(i).get_y_locUnc()); - bank.setFloat("z_unc", i, 10); // At this stage the uncertainty is - // not calculated + bank.setFloat("pathLengthThruBar", i, (float) cluslist.get(i).get_PathLengthThruBar()); } return bank; diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/Cluster.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/Cluster.java index 6344d507d4..b162b7dd28 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/Cluster.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/Cluster.java @@ -47,6 +47,9 @@ public class Cluster extends ArrayList implements Comparable { private double _tUn; // uncertainty in cluster time private String _StatusWord; // a status word for each hit: 1111 - fully + + private double _pathLengthThruBar; // total pathlength of the track throught the bars of the cluster + // functioning, 0111-noADC[L,U], // 1011-noTDC[L,U], 1101-noADC[R,D], // 1110-noTDC[R,D]; the cluster word is the @@ -186,6 +189,14 @@ public void set_tUnc(double _tUn) { this._tUn = _tUn; } + public double get_PathLengthThruBar() { + return _pathLengthThruBar; + } + + public void set_PathLengthThruBar(double _pathLengthThruBar) { + this._pathLengthThruBar = _pathLengthThruBar; + } + /** * * @return the energy-weighted strip number @@ -207,6 +218,7 @@ public void calc_Centroids() { double averageZ = 0; // average z double weightedYloc = 0; // weighted local y double weightedT = 0; // weighted time + double pathThroughCluster = 0.; // pathlength through the cluster bars double errESq = 0; // contribution factor to uncertainty in E double errYlocSq = 0; // contribution factor to uncertainty in local @@ -259,6 +271,8 @@ public void calc_Centroids() { errTSq += E * thehit.get_tUnc() * E * thehit.get_tUnc() + thehit.get_t() * thehit.get_EnergyUnc() * thehit.get_t() * thehit.get_EnergyUnc(); + + pathThroughCluster += thehit.get_TrkPathLenThruBar(); } @@ -283,6 +297,7 @@ public void calc_Centroids() { this.set_EnergyUnc(Math.sqrt(errESq)); this.set_y_locUnc(Math.sqrt(errYlocSq) / totEn); this.set_tUnc(Math.sqrt(errTSq) / totEn); + this.set_PathLengthThruBar(pathThroughCluster); this.set_StatusWord(statusWord); } diff --git a/reconstruction/tof/src/main/java/org/jlab/service/ftof/FTOFEngine.java b/reconstruction/tof/src/main/java/org/jlab/service/ftof/FTOFEngine.java index f38df92c48..cd7d4bd393 100644 --- a/reconstruction/tof/src/main/java/org/jlab/service/ftof/FTOFEngine.java +++ b/reconstruction/tof/src/main/java/org/jlab/service/ftof/FTOFEngine.java @@ -65,6 +65,7 @@ public boolean init() { "/calibration/ftof/time_walk_pos", "/calibration/ftof/time_walk_exp", "/calibration/ftof/fadc_offset", + "/calibration/ftof/cluster" }; requireConstants(Arrays.asList(ftofTables)); @@ -163,7 +164,7 @@ public boolean processDataEvent(DataEvent event) { } // 3) find the clusters from these hits - ClusterFinder clusFinder = new ClusterFinder(); + ClusterFinder clusFinder = new ClusterFinder(this.getConstantsManager().getConstants(newRun, "/calibration/ftof/cluster")); int[] npaddles = Constants.NPAD; int npanels = 3; int nsectors = 6; From ce3917c3144cf2e1a92e0707b18b05c36447f1ed Mon Sep 17 00:00:00 2001 From: Efrain Patrick Segarra Date: Tue, 25 Feb 2020 16:50:37 -0500 Subject: [PATCH 11/47] fixed small bug and readying update to amplitude as well as change to TDC --- .../src/main/java/org/jlab/rec/band/hit/BandHitFinder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java index a9e208124f..3f97affe1e 100644 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java @@ -86,7 +86,7 @@ public ArrayList findGoodHits(ArrayList candidates) { Hit.SetIndexLpmt(i); Hit.SetIndexRpmt(0); } - else if (hit1.GetSide() == 1) { //Veto has a right side PMT + else if (hit1.GetSide() == 2) { //Veto has a right side PMT Hit.SetIndexLpmt(0); Hit.SetIndexRpmt(i); } @@ -172,10 +172,12 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT double parA_L = time_walk_paramsL[0]; double parB_L = time_walk_paramsL[1]; tdcleft = tdcleft - (parA_L/Math.sqrt(adcleft ) + parB_L); + //tdcleft = tdcleft - (parA_L/Math.pow( ampleft , parB_L) + parC_L); double time_walk_paramsR[] = CalibrationConstantsLoader.TIMEWALK_R.get( Integer.valueOf(barKey) ); double parA_R = time_walk_paramsR[0]; double parB_R = time_walk_paramsR[1]; tdcright = tdcright - (parA_R/Math.sqrt(adcright) + parB_R); + //tdcright = tdcright - (parA_R/Math.sqrt( ampright , parB_R) + parC_R ); // ----------------------------------------------------------------------------------------------- // Form the L-R time @@ -210,6 +212,7 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT double xpos_tdc = (-1./2.)* tdiff_tdc * CalibrationConstantsLoader.TDC_VEFF.get( Integer.valueOf(barKey) ); double xpos_fadc = (-1./2.)* tdiff_fadc * CalibrationConstantsLoader.FADC_VEFF.get( Integer.valueOf(barKey) ); xposHit = (xpos_tdc+xpos_fadc)/2.; + //xposHit = xpos_tdc; // Grab global position from parameters class Double[] globPos = Parameters.barGeo.get( Integer.valueOf(barKey) ); From 9ffbd21899dd51dfb3a9d1e92c79e02f5966c911 Mon Sep 17 00:00:00 2001 From: Efrain Patrick Segarra Date: Fri, 28 Feb 2020 17:23:23 -0500 Subject: [PATCH 12/47] Updated reco code for new alogirthms and tables --- .../org/jlab/rec/band/banks/HitReader.java | 32 +++- .../constants/CalibrationConstantsLoader.java | 66 +++++-- .../jlab/rec/band/hit/BandHitCandidate.java | 2 +- .../org/jlab/rec/band/hit/BandHitFinder.java | 169 ++++++++++++++++-- .../org/jlab/service/band/BANDEngine.java | 8 +- 5 files changed, 248 insertions(+), 29 deletions(-) diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java index 43fc15ce54..03df3da6d6 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java @@ -35,6 +35,7 @@ public static ArrayList getBandCandidates(DataEvent event) { if(event==null) return new ArrayList(); + // Grab trigger phase for TDC vs FADC matching double triggerPhase = getTriggerPhase(event); @@ -51,7 +52,8 @@ public static ArrayList getBandCandidates(DataEvent event) { int nadc = bankADC.rows(); // number of adc values int ntdc = bankTDC.rows(); // number of tdc values - + System.out.println("PROCESSING ALL ADCs"); + System.out.flush(); // Loop over the event and add all the FADC information to arrays for processing for( int i = 0 ; i < nadc ; i++ ){ int s = bankADC.getByte("sector",i); // one of the 5 sectors @@ -67,14 +69,19 @@ public static ArrayList getBandCandidates(DataEvent event) { int key = s*1000 + l*100 + c*10 + o; - //System.out.println("s,l,c,o: "+key+" adc,ftdc: "+adc+" "+ftdc); + System.out.println("s,l,c,o: "+key+" adc,ftdc: "+adc+" "+ftdc+" amp,index: "+ampl+" " +i); + System.out.flush(); // Check if this PMT has been stored before, and if it has, then // replace it only if it has a larger ADC value. Otherwise, add to map //NOTE F.H. Feb 17 2020: Should we do some update to also check Amplitude here? if (fadcInt.containsKey( Integer.valueOf(key) ) ) { + System.out.println("\tPMT has prev save."); + System.out.flush(); if( fadcInt.get( Integer.valueOf(key) ) < adc ) { + System.out.println("\t\treplacing PMT information for: "+key+" adc,ftdc: "+adc+" "+ftdc); + System.out.flush(); fadcInt.put( Integer.valueOf(key) , Integer.valueOf(adc) ); fadcAmpl.put(Integer.valueOf(key), Integer.valueOf(ampl)); fadcTimes.put( Integer.valueOf(key), Float.valueOf(ftdc) ); @@ -82,6 +89,8 @@ public static ArrayList getBandCandidates(DataEvent event) { } } else { + System.out.println("\tPMT doesnt have prev save. saving as s,l,c,o: "+key+" adc,ftdc: "+adc+" "+ftdc); + System.out.flush(); fadcInt.put( Integer.valueOf(key) , Integer.valueOf(adc) ); fadcAmpl.put(Integer.valueOf(key), Integer.valueOf(ampl)); fadcTimes.put( Integer.valueOf(key), Float.valueOf(ftdc) ); @@ -89,6 +98,8 @@ public static ArrayList getBandCandidates(DataEvent event) { } } // end fadc loop + System.out.println("PROCESSING ALL TDCs"); + System.out.flush(); // Now loop over the TDC information and try to find best match for( int j = 0 ; j < ntdc ; j++ ){ int s = bankTDC.getByte("sector", j); @@ -102,12 +113,14 @@ public static ArrayList getBandCandidates(DataEvent event) { if( tdc <= 0 ) continue; - //System.out.println("s,l,c,o: "+key+" tdc: "+tdc); + System.out.println("s,l,c,o: "+key+" tdc, index: "+tdc+" "+j); + System.out.flush(); // Make sure that we have FADC information for this PMT -- if not, skip it if( !fadcInt.containsKey(key) || !fadcTimes.containsKey(key) ) continue; - //System.out.println("\t*Found match for this PMT!*"); + System.out.println("\t*Found match for this PMT! Saving TDC information*"); + System.out.flush(); // If we have already stored a TDC for this PMT, need to compare with // FADC time and take the smallest tdiff one. @@ -115,12 +128,18 @@ public static ArrayList getBandCandidates(DataEvent event) { double thisDiff = fadcTimes.get( Integer.valueOf(key) ) - tdc; double prevDiff = fadcTimes.get( Integer.valueOf(key) ) - tdcTimes.get( Integer.valueOf(key) ); + System.out.println("\tPMT TDC has prev save."); + System.out.flush(); if( Math.abs(thisDiff) < Math.abs(prevDiff) ) { + System.out.println("\t\treplacing PMT TDC information for: "+key+" tdc: "+tdc); + System.out.flush(); tdcTimes.put( Integer.valueOf(key), Double.valueOf(tdc) ); tdcIndex.put( Integer.valueOf(key), Integer.valueOf(j)); } } else { + System.out.println("\tPMT TDC doesnt have prev save. saving as s,l,c,o: "+key+" tdc: "+tdc); + System.out.flush(); tdcTimes.put( Integer.valueOf(key), Double.valueOf(tdc) ); tdcIndex.put( Integer.valueOf(key), Integer.valueOf(j)); } @@ -135,7 +154,7 @@ public static ArrayList getBandCandidates(DataEvent event) { String id = Integer.toString(keys); int sector = Integer.parseInt( id.substring(0,1) ); int layer = Integer.parseInt( id.substring(1,2) ); - int component = Integer.parseInt( id.substring(2,3) ); + int component = Integer.parseInt( id.substring(2,3) ); int order = Integer.parseInt( id.substring(3,4) ); int adc = fadcInt.get(keys); @@ -144,7 +163,8 @@ public static ArrayList getBandCandidates(DataEvent event) { double tdc = tdcTimes.get(keys); int indexadc = fadcIndex.get(keys); int indextdc = tdcIndex.get(keys); - //System.out.println("Found a candidate PMT hit! slco: "+sector+" "+layer+" "+component+" "+order+" "+adc+" "+ftdc+" "+tdc); + System.out.println("Found a candidate PMT hit! slco: "+sector+" "+layer+" "+component+" "+order+" adc,ftdc "+adc+" "+ftdc+" tdc: "+tdc+" adcInd,tdcInd: "+indexadc+" "+indextdc); + System.out.flush(); BandHitCandidate newHit = new BandHitCandidate( sector,layer,component,order, adc, ampl,tdc, ftdc ,triggerPhase, indexadc, indextdc); diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java b/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java index 452f064c03..a9fa04026e 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java @@ -31,10 +31,12 @@ public CalibrationConstantsLoader() { public static Map FADC_MT_P2P_RES = new HashMap (); // FADC mean time paddle resolution [ns] public static Map FADC_MT_L2L_OFFSET = new HashMap (); // FADC mean time layer-by-layer offset [ns] public static Map FADC_MT_L2L_RES = new HashMap (); // FADC mean time layer resolution [ns] + public static Map FADC_GLOB_OFFSET = new HashMap (); // FADC mean time global offset per bar per run [ns] public static Map TDC_MT_P2P_OFFSET = new HashMap (); // TDC mean time paddle-to-paddle offset [ns] public static Map TDC_MT_P2P_RES = new HashMap (); // TDC mean time paddle resolution [ns] public static Map TDC_MT_L2L_OFFSET = new HashMap (); // TDC mean time layer-by-layer offset [ns] public static Map TDC_MT_L2L_RES = new HashMap (); // TDC mean time layer resolution [ns] + public static Map TDC_GLOB_OFFSET = new HashMap (); // TDC mean time global offset per bar per run [ns] public static Map FADC_ATTEN_LENGTH = new HashMap (); // FADC attenuation length [cm] public static Map TIMEWALK_L = new HashMap(); // Parameters for time-walk correction for L PMTs public static Map TIMEWALK_R = new HashMap(); // Parameters for time-walk correction for R PMTs @@ -51,8 +53,8 @@ public static synchronized void Load(int runno, String var, ConstantsManager man manager.setVariation(var); IndexedTable lroffsets = manager.getConstants(runno, "/calibration/band/lr_offsets"); - IndexedTable timewalkL = manager.getConstants(runno, "/calibration/band/time_walk_corr_left"); - IndexedTable timewalkR = manager.getConstants(runno, "/calibration/band/time_walk_corr_right"); + IndexedTable timewalkL = manager.getConstants(runno, "/calibration/band/time_walk_amp_left"); + IndexedTable timewalkR = manager.getConstants(runno, "/calibration/band/time_walk_amp_right"); IndexedTable effvel = manager.getConstants(runno, "/calibration/band/effective_velocity"); IndexedTable timejitter = manager.getConstants(runno, "/calibration/band/time_jitter"); IndexedTable attenuation= manager.getConstants(runno, "/calibration/band/attenuation_lengths"); @@ -61,13 +63,31 @@ public static synchronized void Load(int runno, String var, ConstantsManager man IndexedTable paddleoffs_tdc = manager.getConstants(runno, "/calibration/band/paddle_offsets_tdc"); IndexedTable layeroffs_tdc = manager.getConstants(runno, "/calibration/band/layer_offsets_tdc"); IndexedTable cutvalues = manager.getConstants(runno, "/calibration/band/cuts"); + IndexedTable globaloffsets = manager.getConstants(runno, "/calibration/band/global_offsets"); + //IndexedTable timewalkL = manager.getConstants(runno, "/calibration/band/time_walk_corr_left"); + //IndexedTable timewalkR = manager.getConstants(runno, "/calibration/band/time_walk_corr_right"); //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Cut Values for( int i = 0; i < cutvalues.getRowCount(); i++){ CUT_NHITS_BAND = cutvalues.getIntValue("nhitsband", 0,0,0); - CUT_LASERHITS_BAND = cutvalues.getIntValue("nlaserhits", 0,0,0); + CUT_LASERHITS_BAND = cutvalues.getIntValue("nlaserhits", 0,0,0); + } + + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Global offsets for each bar for FADC and TDC + for(int i = 0; i < globaloffsets.getRowCount(); i++) { + int sector = Integer.parseInt((String)globaloffsets.getValueAt(i, 0)); + int layer = Integer.parseInt((String)globaloffsets.getValueAt(i, 1)); + int component = Integer.parseInt((String)globaloffsets.getValueAt(i, 2)); + // Get the offsets for each bar and for each FADC and TDC + double tdc_off = globaloffsets.getDoubleValue("tdc_glob_off", sector, layer, component); + double fadc_off = globaloffsets.getDoubleValue("fadc_glob_off", sector, layer, component); + // Put in the maps + int key = sector*100+layer*10+component; + TDC_GLOB_OFFSET.put( Integer.valueOf(key), Double.valueOf(tdc_off) ); + FADC_GLOB_OFFSET.put( Integer.valueOf(key), Double.valueOf(fadc_off) ); } @@ -94,6 +114,18 @@ public static synchronized void Load(int runno, String var, ConstantsManager man int sector = Integer.parseInt((String)timewalkL.getValueAt(i, 0)); int layer = Integer.parseInt((String)timewalkL.getValueAt(i, 1)); int component = Integer.parseInt((String)timewalkL.getValueAt(i, 2)); + // Get the values for the TW correction + double parA1 = timewalkL.getDoubleValue("par_a1", sector, layer, component); + double parB1 = timewalkL.getDoubleValue("par_b1", sector, layer, component); + double parC1 = timewalkL.getDoubleValue("par_c1", sector, layer, component); + double parA2 = timewalkL.getDoubleValue("par_a2", sector, layer, component); + double parB2 = timewalkL.getDoubleValue("par_b2", sector, layer, component); + double parC2 = timewalkL.getDoubleValue("par_c2", sector, layer, component); + // Put TW in map + int key = sector*100+layer*10+component; + double time_walk_params[] = {parA1,parB1,parC1,parA2,parB2,parC2}; + TIMEWALK_L.put(Integer.valueOf(key), time_walk_params); + /* // Get parameters double parA = timewalkL.getDoubleValue("par_a", sector, layer, component); double parB = timewalkL.getDoubleValue("par_b", sector, layer, component); @@ -104,6 +136,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man int key = sector*100+layer*10+component; double time_walk_params[] = {parA,parB,errA,errB}; TIMEWALK_L.put(Integer.valueOf(key), time_walk_params); + */ } //////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -113,6 +146,18 @@ public static synchronized void Load(int runno, String var, ConstantsManager man int sector = Integer.parseInt((String)timewalkR.getValueAt(i, 0)); int layer = Integer.parseInt((String)timewalkR.getValueAt(i, 1)); int component = Integer.parseInt((String)timewalkR.getValueAt(i, 2)); + // Get the values for the TW correction + double parA1 = timewalkR.getDoubleValue("par_a1", sector, layer, component); + double parB1 = timewalkR.getDoubleValue("par_b1", sector, layer, component); + double parC1 = timewalkR.getDoubleValue("par_c1", sector, layer, component); + double parA2 = timewalkR.getDoubleValue("par_a2", sector, layer, component); + double parB2 = timewalkR.getDoubleValue("par_b2", sector, layer, component); + double parC2 = timewalkR.getDoubleValue("par_c2", sector, layer, component); + // Put TW in map + int key = sector*100+layer*10+component; + double time_walk_params[] = {parA1,parB1,parC1,parA2,parB2,parC2}; + TIMEWALK_R.put(Integer.valueOf(key), time_walk_params); + /* // Get parameters double parA = timewalkR.getDoubleValue("par_a", sector, layer, component); double parB = timewalkR.getDoubleValue("par_b", sector, layer, component); @@ -123,6 +168,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man int key = sector*100+layer*10+component; double time_walk_params[] = {parA,parB,errA,errB}; TIMEWALK_R.put(Integer.valueOf(key), time_walk_params); + */ } //////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -131,7 +177,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man // Get sector, layer, component int sector = Integer.parseInt((String)effvel.getValueAt(i, 0)); int layer = Integer.parseInt((String)effvel.getValueAt(i, 1)); - int component = Integer.parseInt((String)effvel.getValueAt(i, 2)); + int component = Integer.parseInt((String)effvel.getValueAt(i, 2)); // Get the velocities double veff_tdc = effvel.getDoubleValue("veff_tdc", sector, layer, component); double veff_fadc = effvel.getDoubleValue("veff_fadc", sector, layer, component); @@ -156,7 +202,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man // Get sector, layer, component int sector = Integer.parseInt((String)paddleoffs_fadc.getValueAt(i, 0)); int layer = Integer.parseInt((String)paddleoffs_fadc.getValueAt(i, 1)); - int component = Integer.parseInt((String)paddleoffs_fadc.getValueAt(i, 2)); + int component = Integer.parseInt((String)paddleoffs_fadc.getValueAt(i, 2)); // Get offset and resolution for FADC double p2p_off_fadc = paddleoffs_fadc.getDoubleValue("offset_fadc", sector, layer, component); double p2p_res_fadc = paddleoffs_fadc.getDoubleValue("resolution_fadc", sector, layer, component); @@ -173,7 +219,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man // Get sector, layer, component int sector = Integer.parseInt((String)layeroffs_fadc.getValueAt(i, 0)); int layer = Integer.parseInt((String)layeroffs_fadc.getValueAt(i, 1)); - int component = Integer.parseInt((String)layeroffs_fadc.getValueAt(i, 2)); + int component = Integer.parseInt((String)layeroffs_fadc.getValueAt(i, 2)); // Get offset and resolution for FADC double l2l_off_fadc = layeroffs_fadc.getDoubleValue("offset_fadc", sector, layer, component); double l2l_res_fadc = layeroffs_fadc.getDoubleValue("resolution_fadc", sector, layer, component); @@ -189,13 +235,13 @@ public static synchronized void Load(int runno, String var, ConstantsManager man // Get sector, layer, component int sector = Integer.parseInt((String)paddleoffs_tdc.getValueAt(i, 0)); int layer = Integer.parseInt((String)paddleoffs_tdc.getValueAt(i, 1)); - int component = Integer.parseInt((String)paddleoffs_tdc.getValueAt(i, 2)); + int component = Integer.parseInt((String)paddleoffs_tdc.getValueAt(i, 2)); // Get offset and resolution for FADC double p2p_off_tdc = paddleoffs_tdc.getDoubleValue("offset_tdc", sector, layer, component); double p2p_res_tdc = paddleoffs_tdc.getDoubleValue("resolution_tdc", sector, layer, component); // Put in maps int key = sector*100+layer*10+component; - TDC_MT_P2P_OFFSET.put( Integer.valueOf(key), Double.valueOf(p2p_off_tdc) ); + TDC_MT_P2P_OFFSET.put( Integer.valueOf(key), Double.valueOf(p2p_off_tdc) ); TDC_MT_P2P_RES.put( Integer.valueOf(key), Double.valueOf(p2p_res_tdc) ); } @@ -206,7 +252,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man // Get sector, layer, component int sector = Integer.parseInt((String)layeroffs_tdc.getValueAt(i, 0)); int layer = Integer.parseInt((String)layeroffs_tdc.getValueAt(i, 1)); - int component = Integer.parseInt((String)layeroffs_tdc.getValueAt(i, 2)); + int component = Integer.parseInt((String)layeroffs_tdc.getValueAt(i, 2)); // Get offset and resolution for FADC double l2l_off_tdc = layeroffs_tdc.getDoubleValue("offset_tdc", sector, layer, component); double l2l_res_tdc = layeroffs_tdc.getDoubleValue("resolution_tdc", sector, layer, component); @@ -222,7 +268,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man // Get sector, layer, component int sector = Integer.parseInt((String)attenuation.getValueAt(i, 0)); int layer = Integer.parseInt((String)attenuation.getValueAt(i, 1)); - int component = Integer.parseInt((String)attenuation.getValueAt(i, 2)); + int component = Integer.parseInt((String)attenuation.getValueAt(i, 2)); // Grab attenuation length double atten = attenuation.getDoubleValue("atten_len", sector, layer, component); double atten_err = attenuation.getDoubleValue("atten_len_err", sector, layer, component); diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitCandidate.java b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitCandidate.java index a8bf859158..3602af5e59 100644 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitCandidate.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitCandidate.java @@ -22,7 +22,7 @@ public BandHitCandidate(int sector, int layer, int component, int order, int adc this._indexTdc = idtdc; - //System.out.println("Created BandHitCandidate: adc "+ this._adc +" tdc "+this._tdc+" ftdc "+this._ftdc+ " AttCorr " + this._AttCorr + " tcorr "+ this._tCorr); + System.out.println("Created BandHitCandidate: adc "+ this._adc +" tdc "+this._tdc+" ftdc "+this._ftdc); diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java index 3f97affe1e..04974c2f77 100644 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java @@ -31,6 +31,8 @@ public ArrayList findGoodHits(ArrayList candidates) { Map hasMatch = new HashMap(); boolean hasvetohit = false; + System.out.println("***** STARTING HIT CANDIDATE SKIMMER *****"); + System.out.flush(); // Loop through the candidates array to find possible combinations of left and right. if(candidates.size() > 0) { @@ -47,7 +49,8 @@ public ArrayList findGoodHits(ArrayList candidates) { //check if hit is in the veto counter (layer 6). if (hit1.GetLayer() == 6) { - + System.out.println("Candidate hit is veto hit"); + System.out.flush(); // Vetos only have one PMT, so call them 'left' and add them to our // coincidence list and move on @@ -108,9 +111,9 @@ else if (hit1.GetSide() == 2) { //Veto has a right side PMT // is an associated hit on the other side of the bar int sector = hit1.GetSector(); int layer = hit1.GetLayer(); - int component = hit1.GetComponent(); + int component = hit1.GetComponent(); int side = hit1.GetSide(); - int barKey = sector*100+layer*10+component; + int barKey = sector*100+layer*10+component; // Now loop through the candidates again and match any which has same sector,layer,component but // different side. Off-set the start of the list to make sure no repeats: @@ -126,6 +129,8 @@ else if (hit1.GetSide() == 2) { //Veto has a right side PMT // Sanity check if side differs by one (there should be no multi hits stored) if (Math.abs(hit2.GetSide() - side) != 1) continue; + System.err.println("\tWiill attempt to pair s l c o " + (barKey*10+side) + " with " + (hit2.GetSector()*1000+hit2.GetLayer()*100+hit2.GetComponent()*10+hit2.GetSide())); + double tdcleft = -1; double tdcright = -1; double adcleft = -1; @@ -164,28 +169,161 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT System.err.println("BAND HIT FINDER. Found two hits with left and right side but can not assign which hide belongs to which side"); continue; } + System.out.println("\tCandidate hit information ordered as:"); + System.out.println("\t\ttdcleft = " + tdcleft); + System.out.println("\t\tftdcleft = " +ftdcleft); + System.out.println("\t\tadcleft = " + adcleft ); + System.out.println("\t\tamplleft = " +amplleft ); + System.out.println("\t\ttdcright = " + tdcright); + System.out.println("\t\tftdcright = " +ftdcright); + System.out.println("\t\tadcright = " + adcright ); + System.out.println("\t\tamplright = " +amplright ); + System.out.flush(); + + + + // ----------------------------------------------------------------------------------------------- + // First correction to apply is time-walk on TDC (FADC is assumed to have no TW correction): + // for the left PMT: + double time_walk_paramsL[] = CalibrationConstantsLoader.TIMEWALK_L.get( Integer.valueOf(barKey) ); + double parA1_L = time_walk_paramsL[0]; + double parB1_L = time_walk_paramsL[1]; + double parC1_L = time_walk_paramsL[2]; + double parA2_L = time_walk_paramsL[3]; + double parB2_L = time_walk_paramsL[4]; + double parC2_L = time_walk_paramsL[5]; + tdcleft = tdcleft - ( parA1_L + parB1_L / Math.pow( amplleft , parC1_L ) ) - ( parA2_L + parB2_L / Math.pow( amplleft , parC2_L ) ); + // for the right PMT: + double time_walk_paramsR[] = CalibrationConstantsLoader.TIMEWALK_R.get( Integer.valueOf(barKey) ); + double parA1_R = time_walk_paramsR[0]; + double parB1_R = time_walk_paramsR[1]; + double parC1_R = time_walk_paramsR[2]; + double parA2_R = time_walk_paramsR[3]; + double parB2_R = time_walk_paramsR[4]; + double parC2_R = time_walk_paramsR[5]; + tdcright = tdcright - ( parA1_R + parB1_R / Math.pow( amplright , parC1_R ) ) - ( parA2_R + parB2_R / Math.pow( amplright , parC2_R ) ); + + + // ----------------------------------------------------------------------------------------------- + // Next we form (L-R) time and correct for the offset between the two for both TDC and FADC times: + double tdiff_tdc = (tdcleft - tdcright) - CalibrationConstantsLoader.TDC_T_OFFSET.get( Integer.valueOf(barKey) ); + double tdiff_fadc = (ftdcleft - ftdcright) - CalibrationConstantsLoader.FADC_T_OFFSET.get( Integer.valueOf(barKey) ); + + + + // ----------------------------------------------------------------------------------------------- + // Now we can load effective velocity in the bar and require that the time difference is + // less than the max allowed for the bar length with 10% safety net on the edge of the bar: + double maxDiff_tdc = Parameters.barLengthSector[sector-1]/ + CalibrationConstantsLoader.TDC_VEFF.get( Integer.valueOf(barKey) ); + double maxDiff_fadc = Parameters.barLengthSector[sector-1]/ + CalibrationConstantsLoader.FADC_VEFF.get( Integer.valueOf(barKey) ); + if( Math.abs(tdiff_tdc) > 1.1*maxDiff_tdc )continue; + if( Math.abs(tdiff_fadc) > 1.1*maxDiff_fadc )continue; + + + // ----------------------------------------------------------------------------------------------- + // Form the mean time for TDC and FADC and fix any offsets that are different layer-by-layer and + // paddle-by-paddle, which are given by the laser calibration runs. Then also subtract off a global + // offset per bar which is a final re-calibration to the photon peak for each bar for each run number + double mtime_tdc = + ( tdcleft + tdcright )/2. + - Math.abs(CalibrationConstantsLoader.TDC_T_OFFSET.get( Integer.valueOf(barKey) ))/2. + - CalibrationConstantsLoader.TDC_MT_P2P_OFFSET.get(Integer.valueOf(barKey) ) + - CalibrationConstantsLoader.TDC_MT_L2L_OFFSET.get(Integer.valueOf(barKey) ) + - CalibrationConstantsLoader.TDC_GLOB_OFFSET.get(Integer.valueOf(barKey) ); + double mtime_fadc = + ( ftdcleft + ftdcright )/2. + - Math.abs(CalibrationConstantsLoader.FADC_T_OFFSET.get( Integer.valueOf(barKey) ))/2. + - CalibrationConstantsLoader.FADC_MT_P2P_OFFSET.get(Integer.valueOf(barKey) ) + - CalibrationConstantsLoader.FADC_MT_L2L_OFFSET.get(Integer.valueOf(barKey) ) + - CalibrationConstantsLoader.FADC_GLOB_OFFSET.get(Integer.valueOf(barKey) ); + + // ----------------------------------------------------------------------------------------------- + // Using the effective velocity for each bar, get the position of the hit in x based on the TDC time + // and then form the global position in the lab system: + double xpos_tdc = (-1./2.)* tdiff_tdc * CalibrationConstantsLoader.TDC_VEFF.get( Integer.valueOf(barKey) ); + double xpos_fadc = (-1./2.)* tdiff_fadc * CalibrationConstantsLoader.FADC_VEFF.get( Integer.valueOf(barKey) ); + xposHit = xpos_tdc; + + Double[] globPos = Parameters.barGeo.get( Integer.valueOf(barKey) ); + xposHit += globPos[0]; + yposHit = globPos[1]; + zposHit = globPos[2]; + xposHitUnc = 0.5 * CalibrationConstantsLoader.TDC_VEFF.get( Integer.valueOf(barKey) ) * 0.3; // Estimation of error, not perfect + yposHitUnc = Parameters.thickness / Math.sqrt(12.); + zposHitUnc = Parameters.thickness / Math.sqrt(12.); + + + + // ----------------------------------------------------------------------------------------------- + // Correct FADC ADC for attenuation length + double sectorLen = Parameters.barLengthSector[sector-1]; + double mu_cm = CalibrationConstantsLoader.FADC_ATTEN_LENGTH.get( Integer.valueOf(barKey) ); // in [cm] + double adcL_corr = adcleft * Math.exp( (sectorLen/2.-xpos_fadc) / mu_cm ); + double adcR_corr = adcright* Math.exp( (sectorLen/2.+xpos_fadc) / mu_cm ); + + + // ----------------------------------------------------------------------------------------------- + // Create a new BandHit and fill it with the relevant info: + BandHit Hit = new BandHit(); + + Hit.SetSector(sector); + Hit.SetLayer(layer); + Hit.SetComponent(component); + + Hit.SetMeanTime_TDC(mtime_tdc); + Hit.SetMeanTime_FADC(mtime_fadc); + + Hit.SetDiffTime_TDC(tdiff_tdc); + Hit.SetDiffTime_FADC(tdiff_fadc); + + Hit.SetAdcLeft(adcL_corr); + Hit.SetAdcRight(adcR_corr); + + Hit.SetTLeft_FADC(ftdcleft); + Hit.SetTRight_FADC(ftdcright); + + Hit.SetTLeft_TDC(tdcleft); + Hit.SetTRight_TDC(tdcright); + + Hit.SetX(xposHit); + Hit.SetY(yposHit); + Hit.SetZ(zposHit); + Hit.SetUx(xposHitUnc); + Hit.SetUy(yposHitUnc); + Hit.SetUz(zposHitUnc); + + Hit.SetIndexLpmt(indexleft); + Hit.SetIndexRpmt(indexright); + + coincidences.add(Hit); + break; // Found a hit match for this bar, so let's move on to the next possible bar + //TODO: Update Time Walk Correction with Amplitude instead of ADC //TODO: Update Algorithm // ----------------------------------------------------------------------------------------------- // Time-walk correction + /* double time_walk_paramsL[] = CalibrationConstantsLoader.TIMEWALK_L.get( Integer.valueOf(barKey) ); double parA_L = time_walk_paramsL[0]; double parB_L = time_walk_paramsL[1]; tdcleft = tdcleft - (parA_L/Math.sqrt(adcleft ) + parB_L); - //tdcleft = tdcleft - (parA_L/Math.pow( ampleft , parB_L) + parC_L); double time_walk_paramsR[] = CalibrationConstantsLoader.TIMEWALK_R.get( Integer.valueOf(barKey) ); double parA_R = time_walk_paramsR[0]; double parB_R = time_walk_paramsR[1]; tdcright = tdcright - (parA_R/Math.sqrt(adcright) + parB_R); - //tdcright = tdcright - (parA_R/Math.sqrt( ampright , parB_R) + parC_R ); // ----------------------------------------------------------------------------------------------- - + */ + + /* // Form the L-R time double tdiff_tdc = (tdcleft - tdcright) - CalibrationConstantsLoader.TDC_T_OFFSET.get( Integer.valueOf(barKey) ); double tdiff_fadc = (ftdcleft - ftdcright) - CalibrationConstantsLoader.FADC_T_OFFSET.get( Integer.valueOf(barKey) ); + */ - //System.out.println("*Found a candidate BAR with tdiff: "+tdiff_tdc+" "+tdiff_fadc); // Check if the time difference is within the length of the bar: + /* double maxDiff_tdc = Parameters.barLengthSector[sector-1]/ CalibrationConstantsLoader.TDC_VEFF.get( Integer.valueOf(barKey) ); double maxDiff_fadc = Parameters.barLengthSector[sector-1]/ @@ -194,7 +332,9 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT //System.out.println("\tmax time diff allowed: "+maxDiff_tdc+" " +maxDiff_fadc); if( Math.abs(tdiff_tdc) > maxDiff_tdc )continue; if( Math.abs(tdiff_fadc) > maxDiff_fadc )continue; + */ + /* // Form mean time double mtime_tdc = ( tdcleft + tdcright )/2. @@ -206,14 +346,17 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT - Math.abs(CalibrationConstantsLoader.FADC_T_OFFSET.get( Integer.valueOf(barKey) ))/2. - CalibrationConstantsLoader.FADC_MT_P2P_OFFSET.get(Integer.valueOf(barKey) ) - CalibrationConstantsLoader.FADC_MT_L2L_OFFSET.get(Integer.valueOf(barKey) ) ; + */ + /* // Get position from mean time, but multiply by -1 because we define left to be position x, so if // L-R < 0, that means position is closer to left side, which is positive x. double xpos_tdc = (-1./2.)* tdiff_tdc * CalibrationConstantsLoader.TDC_VEFF.get( Integer.valueOf(barKey) ); double xpos_fadc = (-1./2.)* tdiff_fadc * CalibrationConstantsLoader.FADC_VEFF.get( Integer.valueOf(barKey) ); xposHit = (xpos_tdc+xpos_fadc)/2.; //xposHit = xpos_tdc; - + */ + /* // Grab global position from parameters class Double[] globPos = Parameters.barGeo.get( Integer.valueOf(barKey) ); xposHit += globPos[0]; @@ -223,16 +366,18 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT * CalibrationConstantsLoader.FADC_VEFF.get( Integer.valueOf(barKey) ); yposHitUnc = Parameters.thickness / 2.; zposHitUnc = Parameters.thickness / 2.; + */ - + /* // Correct FADC ADC for attenuation length double sectorLen = Parameters.barLengthSector[sector-1]; double mu_cm = CalibrationConstantsLoader.FADC_ATTEN_LENGTH.get( Integer.valueOf(barKey) ); // in [cm] double adcL_corr = adcleft * Math.exp( (sectorLen/2.-xpos_fadc) / mu_cm ); double adcR_corr = adcright* Math.exp( (sectorLen/2.+xpos_fadc) / mu_cm ); //System.out.println(barKey+"\t"+xpos_fadc+"\t"+(adcleft-adcright)+"\t"+(adcL_corr-adcR_corr)); + */ - + /* // Create a new BandHit and fill it with the relevant info: BandHit Hit = new BandHit(); @@ -258,11 +403,15 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT Hit.SetIndexLpmt(indexleft); Hit.SetIndexRpmt(indexright); // Print for debugging: + //System.out.println("\tKept this candidate!"); //Hit.Print(); + //System.out.println(""); + //System.out.flush(); coincidences.add(Hit); break; + */ } // close loop over j } // close loop over i diff --git a/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java b/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java index 2b640428ad..08f87f1bfb 100755 --- a/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java +++ b/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java @@ -36,6 +36,7 @@ public BANDEngine() { @Override public boolean processDataEvent(DataEvent event) { + System.out.println("**** NEW EVENT ****"); // update calibration constants based on run number if changed setRunConditionsParameters(event); @@ -71,9 +72,12 @@ public boolean init() { "/calibration/band/paddle_offsets_tdc", "/calibration/band/layer_offsets_tdc", "/calibration/band/attenuation_lengths", - "/calibration/band/time_walk_corr_left", - "/calibration/band/time_walk_corr_right", + "/calibration/band/time_walk_amp_left", + "/calibration/band/time_walk_amp_right", + "/calibration/band/global_offsets", "/calibration/band/cuts" + //"/calibration/band/time_walk_corr_left", + //"/calibration/band/time_walk_corr_right", }; requireConstants(Arrays.asList(bandTables)); From 1fc0a144cfd1d393644969ba93a4eea5ec348a2e Mon Sep 17 00:00:00 2001 From: Pierre Chatagnon <33055626+PChatagnon@users.noreply.github.com> Date: Tue, 3 Mar 2020 11:40:58 +0100 Subject: [PATCH 13/47] Use swimmer for track matching, pathlegth and path in bar --- .../org/jlab/rec/cnd/hit/CvtGetHTrack.java | 233 ++++++++++++------ 1 file changed, 158 insertions(+), 75 deletions(-) diff --git a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java index 1ac890f0d9..62994166e4 100755 --- a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java +++ b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java @@ -3,42 +3,118 @@ import java.util.ArrayList; import java.util.List; +import org.jlab.geom.prim.Arc3D; +import org.jlab.geom.prim.Cylindrical3D; import org.jlab.geom.prim.Point3D; +import org.jlab.geometry.prim.Line3d; import org.jlab.io.base.DataBank; import org.jlab.io.base.DataEvent; import org.jlab.rec.cnd.constants.CalibrationConstantsLoader; import org.jlab.rec.cnd.constants.Parameters; import org.jlab.rec.cvt.trajectory.Helix; +import eu.mihosoft.vrl.v3d.Vector3d; + public class CvtGetHTrack { // this class is used to extract helical tracks from the cvt event bank. - public CvtGetHTrack() { - helices = new ArrayList(); - } + public CvtGetHTrack() { + helices = new ArrayList(); + } - private List helices; + private List helices; - public List getHelices() { - return helices; - } + public List getHelices() { + return helices; + } - public void setHelices(List helices) { - this.helices = helices; - } + public void setHelices(List helices) { + this.helices = helices; + } - public void getCvtHTrack(DataEvent event, CalibrationConstantsLoader ccdb) { + public void getCvtHTrack(DataEvent event, CalibrationConstantsLoader ccdb) { - helices.clear(); + helices.clear(); - if (event == null) { // check if there is an event - //System.out.println(" no event"); - } + if (event == null) { // check if there is an event + //System.out.println(" no event"); + } - if (event.hasBank("CVTRec::Tracks") == false) { + if (event.hasBank("CVTRec::Trajectory") == false) { + // check if there are some cvt tracks in the event + //System.out.println(" no cvt tracks"); + } + + System.out.println(); + + if (event.hasBank("CVTRec::Trajectory") == true) { + + DataBank bank = event.getBank("CVTRec::Trajectory"); + + int nt = bank.rows(); // number of tracks in the cvt event + + for (int i = 0; i < nt; i++) { + + + if(bank.getByte("detector", i)==3 && bank.getByte("layer", i)==1) { //make use of the fact that the 3 cnd layer are in order so find layer 1 and loop through the 2 next entries + CVTTrack trk = new CVTTrack(); + for(int j=0; j<3;j++) { + + int id = (bank.getShort("id", i+j))-1; + int layer = bank.getByte("layer", i+j); + double x = bank.getFloat("x", i+j); + double y = bank.getFloat("y", i+j); + double z = bank.getFloat("z", i+j); + double theta = bank.getFloat("theta", i+j); + double phi = bank.getFloat("phi", i+j); + double ux = Math.sin(theta)*Math.cos(phi); + double uy = Math.sin(theta)*Math.sin(phi); + double uz = Math.cos(theta); + double path = bank.getFloat("path", i+j); + + + trk.set_Id(id); + + double entryradius = (ccdb.INNERRADIUS[0] + (layer - 1) * ccdb.THICKNESS[0] + (layer - 1) * Parameters.LayerGap)/10.; + double escaperadius = (ccdb.INNERRADIUS[0] + (layer) * ccdb.THICKNESS[0] + (layer - 1) * Parameters.LayerGap)/10.; + + //find intercept of line defined by interaction point + director cosines with cylinder of radius defined above + + double b = 2*(ux*x+uy*y); + double a = ux*ux+uy*uy; + double co = x*x+y*y-((escaperadius*escaperadius)); + double ci = x*x+y*y-((entryradius*entryradius)); + + double uo1 = (-b+Math.sqrt(b*b-4*a*co))/(2*a); + double ui1 = (-b+Math.sqrt(b*b-4*a*ci))/(2*a); + + + Point3D entryPoint = new Point3D((x+ui1*ux)*10,(y+ui1*uy)*10,(z+ui1*uz)*10); + Point3D midPoint = new Point3D(x*10,y*10,z*10); + Point3D exitPoint = new Point3D((x+uo1*ux)*10,(y+uo1*uy)*10,(z+uo1*uz)*10); + + trk._TrkInters.get(layer - 1).add(entryPoint); + trk._TrkInters.get(layer - 1).add(midPoint); + trk._TrkInters.get(layer - 1).add(exitPoint); + + trk._TrkLengths.add(path*10); + + helices.add(trk); + //System.out.println(layer + " "+id +"path in paddle new "+entryPoint.distance(exitPoint)+ " pathlength "+ trk._TrkInters.get(layer-1)+ " id "+id); + + } + } + + } + + } + + + //old code (kept only for quick reference) + + /* if (event.hasBank("CVTRec::Tracks") == false) { // check if there are some cvt tracks in the event //System.out.println(" no cvt tracks"); } - if (event.hasBank("CVTRec::Tracks") == true) { //System.out.println(" cvt tracks present"); @@ -62,7 +138,7 @@ public void getCvtHTrack(DataEvent event, CalibrationConstantsLoader ccdb) { int q = bank.getInt("q", i); double pt = bank.getFloat("pt", i); // use the formula R=pt/qB to get the curvature (see cvt reconstruction class Track)/Pt is in Gev - double rho = (0.000299792458 * q * 5. * config.getFloat("solenoid", 0)) / pt; + double rho = (0.000299792458 * q * 5. * -1.) / pt; // the max value of B is set to 5.Tesla //double p=bank.getFloat("p", i); @@ -113,71 +189,78 @@ public void getCvtHTrack(DataEvent event, CalibrationConstantsLoader ccdb) { double r = Math.sqrt(Xm.x() * Xm.x() + Xm.y() * Xm.y()); double par = 1. - ((r * r - dca * dca) * rho * rho) / (2. * (1. + dca * Math.abs(rho))); double pathLengthXY = Math.abs(Math.acos(par) / rho); - + double pathLength = Math.sqrt((Xm.z() - z0 )*(Xm.z() - z0 )+pathLengthXY*pathLengthXY); trk._TrkLengths.add(pathLength); - } - helices.add(trk); - } - - } - - } - - /** - * A class to hold the CVT track information relevant for CND analysis - * - * @author ziegler - * - */ - public class CVTTrack { + + System.out.println(lay + " "+trkID +"path in paddle old "+trk.get_Helix().getPointAtRadius(entryradius).distance(trk.get_Helix().getPointAtRadius(escaperadius))+ " pathlength "+ trk._TrkInters.get(lay-1)+ " id "+trkID); - private Helix _Helix; - private int _Id; + } + - // The position of the tracks at the relevant radii is accessed as an ordered List of List: - // first index 0...2 is layer index - // second index 0...2 corresponds to entrance, middle and exit of track wrt the counter - private List> _TrkInters = new ArrayList>(); // intersection point wrt front middle and end of counter - private List _TrkLengths = new ArrayList(); //the pathlength of the track from the doca to the beam line to the middle of the CND counter - - public CVTTrack() { - for (int i = 0; i < 3; i++) { - _TrkInters.add(new ArrayList()); + // helices.add(trk); } - } - - public Helix get_Helix() { - return _Helix; - } - - public void set_Helix(Helix _Helix) { - this._Helix = _Helix; - } - - public int get_Id() { - return _Id; - } - - public void set_Id(int _Id) { - this._Id = _Id; - } - public List> get_TrkInters() { - return _TrkInters; - } + }//end + + */ - public void set_TrkInters(List> _TrkInters) { - this._TrkInters = _TrkInters; - } + } - public List get_TrkLengths() { - return _TrkLengths; - } + /** + * A class to hold the CVT track information relevant for CND analysis + * + * @author ziegler + * + */ + public class CVTTrack { - public void set_TrkLengths(List _PathLengths) { - this._TrkLengths = _PathLengths; - } + private Helix _Helix; // not in use since swimmer point is used + private int _Id; - } + // The position of the tracks at the relevant radii is accessed as an ordered List of List: + // first index 0...2 is layer index + // second index 0...2 corresponds to entrance, middle and exit of track wrt the counter + private List> _TrkInters = new ArrayList>(); // intersection point wrt front middle and end of counter + private List _TrkLengths = new ArrayList(); //the pathlength of the track from the doca to the beam line to the middle of the CND counter + + public CVTTrack() { + for (int i = 0; i < 3; i++) { + _TrkInters.add(new ArrayList()); + } + } + + public Helix get_Helix() { + return _Helix; + } + + public void set_Helix(Helix _Helix) { + this._Helix = _Helix; + } + + public int get_Id() { + return _Id; + } + + public void set_Id(int _Id) { + this._Id = _Id; + } + + public List> get_TrkInters() { + return _TrkInters; + } + + public void set_TrkInters(List> _TrkInters) { + this._TrkInters = _TrkInters; + } + + public List get_TrkLengths() { + return _TrkLengths; + } + + public void set_TrkLengths(List _PathLengths) { + this._TrkLengths = _PathLengths; + } + + } } From 8bd7ad02b2b041b6f5f8fedc680bee68de40a731 Mon Sep 17 00:00:00 2001 From: Efrain Patrick Segarra Date: Tue, 3 Mar 2020 18:20:48 -0500 Subject: [PATCH 14/47] Updated and validated new changes to reconstruction --- .../org/jlab/rec/band/banks/HitReader.java | 53 ++++++++++--------- .../jlab/rec/band/hit/BandHitCandidate.java | 2 +- .../org/jlab/rec/band/hit/BandHitFinder.java | 36 +++++++------ .../org/jlab/service/band/BANDEngine.java | 2 +- 4 files changed, 51 insertions(+), 42 deletions(-) diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java index 03df3da6d6..23e6cf477b 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/HitReader.java @@ -52,8 +52,8 @@ public static ArrayList getBandCandidates(DataEvent event) { int nadc = bankADC.rows(); // number of adc values int ntdc = bankTDC.rows(); // number of tdc values - System.out.println("PROCESSING ALL ADCs"); - System.out.flush(); + //System.out.println("PROCESSING ALL ADCs"); + //System.out.flush(); // Loop over the event and add all the FADC information to arrays for processing for( int i = 0 ; i < nadc ; i++ ){ int s = bankADC.getByte("sector",i); // one of the 5 sectors @@ -64,24 +64,27 @@ public static ArrayList getBandCandidates(DataEvent event) { int adc = bankADC.getInt("ADC",i); int ampl= bankADC.getInt("amplitude", i); float ftdc = bankADC.getFloat("time",i); - + int ped = bankADC.getShort("ped",i); + //System.out.println("ampl, ped = "+ampl+" "+ped); + ampl = ampl - ped; + if( adc <= 0 || ftdc <= 0 ) continue; int key = s*1000 + l*100 + c*10 + o; - System.out.println("s,l,c,o: "+key+" adc,ftdc: "+adc+" "+ftdc+" amp,index: "+ampl+" " +i); - System.out.flush(); + //System.out.println("s,l,c,o: "+key+" adc,ftdc: "+adc+" "+ftdc+" amp,index: "+ampl+" " +i+"\n"); + //System.out.flush(); // Check if this PMT has been stored before, and if it has, then // replace it only if it has a larger ADC value. Otherwise, add to map //NOTE F.H. Feb 17 2020: Should we do some update to also check Amplitude here? if (fadcInt.containsKey( Integer.valueOf(key) ) ) { - System.out.println("\tPMT has prev save."); - System.out.flush(); + //System.out.println("\tPMT has prev save."); + //System.out.flush(); if( fadcInt.get( Integer.valueOf(key) ) < adc ) { - System.out.println("\t\treplacing PMT information for: "+key+" adc,ftdc: "+adc+" "+ftdc); - System.out.flush(); + //System.out.println("\t\treplacing PMT information for: "+key+" adc,ftdc: "+adc+" "+ftdc); + //System.out.flush(); fadcInt.put( Integer.valueOf(key) , Integer.valueOf(adc) ); fadcAmpl.put(Integer.valueOf(key), Integer.valueOf(ampl)); fadcTimes.put( Integer.valueOf(key), Float.valueOf(ftdc) ); @@ -89,8 +92,8 @@ public static ArrayList getBandCandidates(DataEvent event) { } } else { - System.out.println("\tPMT doesnt have prev save. saving as s,l,c,o: "+key+" adc,ftdc: "+adc+" "+ftdc); - System.out.flush(); + //System.out.println("\tPMT doesnt have prev save. saving as s,l,c,o: "+key+" adc,ftdc: "+adc+" "+ftdc); + //System.out.flush(); fadcInt.put( Integer.valueOf(key) , Integer.valueOf(adc) ); fadcAmpl.put(Integer.valueOf(key), Integer.valueOf(ampl)); fadcTimes.put( Integer.valueOf(key), Float.valueOf(ftdc) ); @@ -98,8 +101,8 @@ public static ArrayList getBandCandidates(DataEvent event) { } } // end fadc loop - System.out.println("PROCESSING ALL TDCs"); - System.out.flush(); + //System.out.println("PROCESSING ALL TDCs"); + //System.out.flush(); // Now loop over the TDC information and try to find best match for( int j = 0 ; j < ntdc ; j++ ){ int s = bankTDC.getByte("sector", j); @@ -113,14 +116,14 @@ public static ArrayList getBandCandidates(DataEvent event) { if( tdc <= 0 ) continue; - System.out.println("s,l,c,o: "+key+" tdc, index: "+tdc+" "+j); - System.out.flush(); + //System.out.println("s,l,c,o: "+key+" tdc, index: "+tdc+" "+j); + //System.out.flush(); // Make sure that we have FADC information for this PMT -- if not, skip it if( !fadcInt.containsKey(key) || !fadcTimes.containsKey(key) ) continue; - System.out.println("\t*Found match for this PMT! Saving TDC information*"); - System.out.flush(); + //System.out.println("\t*Found match for this PMT! Saving TDC information*"); + //System.out.flush(); // If we have already stored a TDC for this PMT, need to compare with // FADC time and take the smallest tdiff one. @@ -128,18 +131,18 @@ public static ArrayList getBandCandidates(DataEvent event) { double thisDiff = fadcTimes.get( Integer.valueOf(key) ) - tdc; double prevDiff = fadcTimes.get( Integer.valueOf(key) ) - tdcTimes.get( Integer.valueOf(key) ); - System.out.println("\tPMT TDC has prev save."); - System.out.flush(); + //System.out.println("\tPMT TDC has prev save."); + //System.out.flush(); if( Math.abs(thisDiff) < Math.abs(prevDiff) ) { - System.out.println("\t\treplacing PMT TDC information for: "+key+" tdc: "+tdc); - System.out.flush(); + //System.out.println("\t\treplacing PMT TDC information for: "+key+" tdc: "+tdc); + //System.out.flush(); tdcTimes.put( Integer.valueOf(key), Double.valueOf(tdc) ); tdcIndex.put( Integer.valueOf(key), Integer.valueOf(j)); } } else { - System.out.println("\tPMT TDC doesnt have prev save. saving as s,l,c,o: "+key+" tdc: "+tdc); - System.out.flush(); + //System.out.println("\tPMT TDC doesnt have prev save. saving as s,l,c,o: "+key+" tdc: "+tdc); + //System.out.flush(); tdcTimes.put( Integer.valueOf(key), Double.valueOf(tdc) ); tdcIndex.put( Integer.valueOf(key), Integer.valueOf(j)); } @@ -163,8 +166,8 @@ public static ArrayList getBandCandidates(DataEvent event) { double tdc = tdcTimes.get(keys); int indexadc = fadcIndex.get(keys); int indextdc = tdcIndex.get(keys); - System.out.println("Found a candidate PMT hit! slco: "+sector+" "+layer+" "+component+" "+order+" adc,ftdc "+adc+" "+ftdc+" tdc: "+tdc+" adcInd,tdcInd: "+indexadc+" "+indextdc); - System.out.flush(); + //System.out.println("Found a candidate PMT hit! slco: "+sector+" "+layer+" "+component+" "+order+" adc,ftdc "+adc+" "+ftdc+" tdc: "+tdc+" adcInd,tdcInd: "+indexadc+" "+indextdc); + //System.out.flush(); BandHitCandidate newHit = new BandHitCandidate( sector,layer,component,order, adc, ampl,tdc, ftdc ,triggerPhase, indexadc, indextdc); diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitCandidate.java b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitCandidate.java index 3602af5e59..7e7775736a 100644 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitCandidate.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitCandidate.java @@ -22,7 +22,7 @@ public BandHitCandidate(int sector, int layer, int component, int order, int adc this._indexTdc = idtdc; - System.out.println("Created BandHitCandidate: adc "+ this._adc +" tdc "+this._tdc+" ftdc "+this._ftdc); + //System.out.println("Created BandHitCandidate: adc "+ this._adc +" tdc "+this._tdc+" ftdc "+this._ftdc); diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java index 04974c2f77..00de20b095 100644 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java @@ -31,8 +31,8 @@ public ArrayList findGoodHits(ArrayList candidates) { Map hasMatch = new HashMap(); boolean hasvetohit = false; - System.out.println("***** STARTING HIT CANDIDATE SKIMMER *****"); - System.out.flush(); + //System.out.println("***** STARTING HIT CANDIDATE SKIMMER *****"); + //System.out.flush(); // Loop through the candidates array to find possible combinations of left and right. if(candidates.size() > 0) { @@ -49,8 +49,8 @@ public ArrayList findGoodHits(ArrayList candidates) { //check if hit is in the veto counter (layer 6). if (hit1.GetLayer() == 6) { - System.out.println("Candidate hit is veto hit"); - System.out.flush(); + //System.out.println("Candidate hit is veto hit"); + //System.out.flush(); // Vetos only have one PMT, so call them 'left' and add them to our // coincidence list and move on @@ -129,7 +129,7 @@ else if (hit1.GetSide() == 2) { //Veto has a right side PMT // Sanity check if side differs by one (there should be no multi hits stored) if (Math.abs(hit2.GetSide() - side) != 1) continue; - System.err.println("\tWiill attempt to pair s l c o " + (barKey*10+side) + " with " + (hit2.GetSector()*1000+hit2.GetLayer()*100+hit2.GetComponent()*10+hit2.GetSide())); + //System.err.println("\tWiill attempt to pair s l c o " + (barKey*10+side) + " with " + (hit2.GetSector()*1000+hit2.GetLayer()*100+hit2.GetComponent()*10+hit2.GetSide())); double tdcleft = -1; double tdcright = -1; @@ -169,16 +169,16 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT System.err.println("BAND HIT FINDER. Found two hits with left and right side but can not assign which hide belongs to which side"); continue; } - System.out.println("\tCandidate hit information ordered as:"); - System.out.println("\t\ttdcleft = " + tdcleft); - System.out.println("\t\tftdcleft = " +ftdcleft); - System.out.println("\t\tadcleft = " + adcleft ); - System.out.println("\t\tamplleft = " +amplleft ); - System.out.println("\t\ttdcright = " + tdcright); - System.out.println("\t\tftdcright = " +ftdcright); - System.out.println("\t\tadcright = " + adcright ); - System.out.println("\t\tamplright = " +amplright ); - System.out.flush(); + //System.out.println("\tCandidate hit information ordered as:"); + //System.out.println("\t\ttdcleft = " + tdcleft); + //System.out.println("\t\tftdcleft = " +ftdcleft); + //System.out.println("\t\tadcleft = " + adcleft ); + //System.out.println("\t\tamplleft = " +amplleft ); + //System.out.println("\t\ttdcright = " + tdcright); + //System.out.println("\t\tftdcright = " +ftdcright); + //System.out.println("\t\tadcright = " + adcright ); + //System.out.println("\t\tamplright = " +amplright ); + //System.out.flush(); @@ -192,7 +192,9 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT double parA2_L = time_walk_paramsL[3]; double parB2_L = time_walk_paramsL[4]; double parC2_L = time_walk_paramsL[5]; + //System.out.println("Hit info before TW left: "+tdcleft+" "+parA1_L+" "+parB1_L+" "+parC1_L); tdcleft = tdcleft - ( parA1_L + parB1_L / Math.pow( amplleft , parC1_L ) ) - ( parA2_L + parB2_L / Math.pow( amplleft , parC2_L ) ); + //System.out.println("\t\tafter: "+tdcleft); // for the right PMT: double time_walk_paramsR[] = CalibrationConstantsLoader.TIMEWALK_R.get( Integer.valueOf(barKey) ); double parA1_R = time_walk_paramsR[0]; @@ -201,13 +203,16 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT double parA2_R = time_walk_paramsR[3]; double parB2_R = time_walk_paramsR[4]; double parC2_R = time_walk_paramsR[5]; + //System.out.println("Hit info before TW right: "+tdcright+" "+parA1_R+" "+parB1_R+" "+parC1_R); tdcright = tdcright - ( parA1_R + parB1_R / Math.pow( amplright , parC1_R ) ) - ( parA2_R + parB2_R / Math.pow( amplright , parC2_R ) ); + //System.out.println("\t\tafter: "+tdcright); // ----------------------------------------------------------------------------------------------- // Next we form (L-R) time and correct for the offset between the two for both TDC and FADC times: double tdiff_tdc = (tdcleft - tdcright) - CalibrationConstantsLoader.TDC_T_OFFSET.get( Integer.valueOf(barKey) ); double tdiff_fadc = (ftdcleft - ftdcright) - CalibrationConstantsLoader.FADC_T_OFFSET.get( Integer.valueOf(barKey) ); + //System.out.println("Offset: "+CalibrationConstantsLoader.TDC_T_OFFSET.get( Integer.valueOf(barKey) )); @@ -238,6 +243,7 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT - CalibrationConstantsLoader.FADC_MT_P2P_OFFSET.get(Integer.valueOf(barKey) ) - CalibrationConstantsLoader.FADC_MT_L2L_OFFSET.get(Integer.valueOf(barKey) ) - CalibrationConstantsLoader.FADC_GLOB_OFFSET.get(Integer.valueOf(barKey) ); + //System.out.println("Global offsets: " + CalibrationConstantsLoader.TDC_GLOB_OFFSET.get(Integer.valueOf(barKey) )+" "+CalibrationConstantsLoader.FADC_GLOB_OFFSET.get(Integer.valueOf(barKey) )); // ----------------------------------------------------------------------------------------------- // Using the effective velocity for each bar, get the position of the hit in x based on the TDC time diff --git a/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java b/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java index 08f87f1bfb..40ea0a4b4c 100755 --- a/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java +++ b/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java @@ -36,7 +36,7 @@ public BANDEngine() { @Override public boolean processDataEvent(DataEvent event) { - System.out.println("**** NEW EVENT ****"); + //System.out.println("**** NEW EVENT ****"); // update calibration constants based on run number if changed setRunConditionsParameters(event); From 2d09b2bcecddc3dfb04fd6c3f76e4b753e932247 Mon Sep 17 00:00:00 2001 From: hauenst Date: Tue, 3 Mar 2020 23:54:15 -0500 Subject: [PATCH 15/47] Removed some old code --- .../org/jlab/rec/band/hit/BandHitFinder.java | 129 +++--------------- 1 file changed, 16 insertions(+), 113 deletions(-) diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java index 00de20b095..ed14ff1aaf 100644 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java @@ -207,6 +207,20 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT tdcright = tdcright - ( parA1_R + parB1_R / Math.pow( amplright , parC1_R ) ) - ( parA2_R + parB2_R / Math.pow( amplright , parC2_R ) ); //System.out.println("\t\tafter: "+tdcright); + // OLD Time-walk correction + /* + double time_walk_paramsL[] = CalibrationConstantsLoader.TIMEWALK_L.get( Integer.valueOf(barKey) ); + double parA_L = time_walk_paramsL[0]; + double parB_L = time_walk_paramsL[1]; + tdcleft = tdcleft - (parA_L/Math.sqrt(adcleft ) + parB_L); + double time_walk_paramsR[] = CalibrationConstantsLoader.TIMEWALK_R.get( Integer.valueOf(barKey) ); + double parA_R = time_walk_paramsR[0]; + double parB_R = time_walk_paramsR[1]; + tdcright = tdcright - (parA_R/Math.sqrt(adcright) + parB_R); + // ----------------------------------------------------------------------------------------------- + */ + + // ----------------------------------------------------------------------------------------------- // Next we form (L-R) time and correct for the offset between the two for both TDC and FADC times: @@ -250,6 +264,7 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT // and then form the global position in the lab system: double xpos_tdc = (-1./2.)* tdiff_tdc * CalibrationConstantsLoader.TDC_VEFF.get( Integer.valueOf(barKey) ); double xpos_fadc = (-1./2.)* tdiff_fadc * CalibrationConstantsLoader.FADC_VEFF.get( Integer.valueOf(barKey) ); + //OLD xposHit = (xpos_tdc+xpos_fadc)/2.; xposHit = xpos_tdc; Double[] globPos = Parameters.barGeo.get( Integer.valueOf(barKey) ); @@ -305,119 +320,7 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT coincidences.add(Hit); break; // Found a hit match for this bar, so let's move on to the next possible bar - - //TODO: Update Time Walk Correction with Amplitude instead of ADC - //TODO: Update Algorithm - // ----------------------------------------------------------------------------------------------- - // Time-walk correction - /* - double time_walk_paramsL[] = CalibrationConstantsLoader.TIMEWALK_L.get( Integer.valueOf(barKey) ); - double parA_L = time_walk_paramsL[0]; - double parB_L = time_walk_paramsL[1]; - tdcleft = tdcleft - (parA_L/Math.sqrt(adcleft ) + parB_L); - double time_walk_paramsR[] = CalibrationConstantsLoader.TIMEWALK_R.get( Integer.valueOf(barKey) ); - double parA_R = time_walk_paramsR[0]; - double parB_R = time_walk_paramsR[1]; - tdcright = tdcright - (parA_R/Math.sqrt(adcright) + parB_R); - // ----------------------------------------------------------------------------------------------- - */ - - /* - // Form the L-R time - double tdiff_tdc = (tdcleft - tdcright) - CalibrationConstantsLoader.TDC_T_OFFSET.get( Integer.valueOf(barKey) ); - double tdiff_fadc = (ftdcleft - ftdcright) - CalibrationConstantsLoader.FADC_T_OFFSET.get( Integer.valueOf(barKey) ); - */ - - // Check if the time difference is within the length of the bar: - /* - double maxDiff_tdc = Parameters.barLengthSector[sector-1]/ - CalibrationConstantsLoader.TDC_VEFF.get( Integer.valueOf(barKey) ); - double maxDiff_fadc = Parameters.barLengthSector[sector-1]/ - CalibrationConstantsLoader.FADC_VEFF.get( Integer.valueOf(barKey) ); - - //System.out.println("\tmax time diff allowed: "+maxDiff_tdc+" " +maxDiff_fadc); - if( Math.abs(tdiff_tdc) > maxDiff_tdc )continue; - if( Math.abs(tdiff_fadc) > maxDiff_fadc )continue; - */ - - /* - // Form mean time - double mtime_tdc = - ( tdcleft + tdcright )/2. - - Math.abs(CalibrationConstantsLoader.TDC_T_OFFSET.get( Integer.valueOf(barKey) ))/2. - - CalibrationConstantsLoader.TDC_MT_P2P_OFFSET.get(Integer.valueOf(barKey) ) - - CalibrationConstantsLoader.TDC_MT_L2L_OFFSET.get(Integer.valueOf(barKey) ) ; - double mtime_fadc = - ( ftdcleft + ftdcright )/2. - - Math.abs(CalibrationConstantsLoader.FADC_T_OFFSET.get( Integer.valueOf(barKey) ))/2. - - CalibrationConstantsLoader.FADC_MT_P2P_OFFSET.get(Integer.valueOf(barKey) ) - - CalibrationConstantsLoader.FADC_MT_L2L_OFFSET.get(Integer.valueOf(barKey) ) ; - */ - - /* - // Get position from mean time, but multiply by -1 because we define left to be position x, so if - // L-R < 0, that means position is closer to left side, which is positive x. - double xpos_tdc = (-1./2.)* tdiff_tdc * CalibrationConstantsLoader.TDC_VEFF.get( Integer.valueOf(barKey) ); - double xpos_fadc = (-1./2.)* tdiff_fadc * CalibrationConstantsLoader.FADC_VEFF.get( Integer.valueOf(barKey) ); - xposHit = (xpos_tdc+xpos_fadc)/2.; - //xposHit = xpos_tdc; - */ - /* - // Grab global position from parameters class - Double[] globPos = Parameters.barGeo.get( Integer.valueOf(barKey) ); - xposHit += globPos[0]; - yposHit = globPos[1]; - zposHit = globPos[2]; - xposHitUnc = CalibrationConstantsLoader.FADC_MT_P2P_RES.get( Integer.valueOf(barKey) ) - * CalibrationConstantsLoader.FADC_VEFF.get( Integer.valueOf(barKey) ); - yposHitUnc = Parameters.thickness / 2.; - zposHitUnc = Parameters.thickness / 2.; - */ - - /* - // Correct FADC ADC for attenuation length - double sectorLen = Parameters.barLengthSector[sector-1]; - double mu_cm = CalibrationConstantsLoader.FADC_ATTEN_LENGTH.get( Integer.valueOf(barKey) ); // in [cm] - double adcL_corr = adcleft * Math.exp( (sectorLen/2.-xpos_fadc) / mu_cm ); - double adcR_corr = adcright* Math.exp( (sectorLen/2.+xpos_fadc) / mu_cm ); - //System.out.println(barKey+"\t"+xpos_fadc+"\t"+(adcleft-adcright)+"\t"+(adcL_corr-adcR_corr)); - */ - - /* - // Create a new BandHit and fill it with the relevant info: - BandHit Hit = new BandHit(); - - Hit.SetSector(sector); - Hit.SetLayer(layer); - Hit.SetComponent(component); - Hit.SetMeanTime_TDC(mtime_tdc); - Hit.SetMeanTime_FADC(mtime_fadc); - Hit.SetDiffTime_TDC(tdiff_tdc); - Hit.SetDiffTime_FADC(tdiff_fadc); - Hit.SetAdcLeft(adcL_corr); - Hit.SetAdcRight(adcR_corr); - Hit.SetTLeft_FADC(ftdcleft); - Hit.SetTRight_FADC(ftdcright); - Hit.SetTLeft_TDC(tdcleft); - Hit.SetTRight_TDC(tdcright); - Hit.SetX(xposHit); - Hit.SetY(yposHit); - Hit.SetZ(zposHit); - Hit.SetUx(xposHitUnc); - Hit.SetUy(yposHitUnc); - Hit.SetUz(zposHitUnc); - Hit.SetIndexLpmt(indexleft); - Hit.SetIndexRpmt(indexright); - // Print for debugging: - //System.out.println("\tKept this candidate!"); - //Hit.Print(); - //System.out.println(""); - //System.out.flush(); - - coincidences.add(Hit); - - break; - */ + } // close loop over j } // close loop over i From 2432c333260d90a9f1ec9ec87782e1148d51e3e0 Mon Sep 17 00:00:00 2001 From: Pierre Chatagnon <33055626+PChatagnon@users.noreply.github.com> Date: Wed, 4 Mar 2020 09:41:43 +0100 Subject: [PATCH 16/47] Update CvtGetHTrack.java --- .../cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java | 1 - 1 file changed, 1 deletion(-) diff --git a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java index 62994166e4..3229a925ee 100755 --- a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java +++ b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java @@ -44,7 +44,6 @@ public void getCvtHTrack(DataEvent event, CalibrationConstantsLoader ccdb) { //System.out.println(" no cvt tracks"); } - System.out.println(); if (event.hasBank("CVTRec::Trajectory") == true) { From 7682e901354d56696f0eb5d88488909415a8ac42 Mon Sep 17 00:00:00 2001 From: Pierre Chatagnon <33055626+PChatagnon@users.noreply.github.com> Date: Wed, 4 Mar 2020 09:59:29 +0100 Subject: [PATCH 17/47] Update CvtGetHTrack.java --- .../org/jlab/rec/cnd/hit/CvtGetHTrack.java | 96 ++++++++++--------- 1 file changed, 50 insertions(+), 46 deletions(-) diff --git a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java index 3229a925ee..2221efba34 100755 --- a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java +++ b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java @@ -3,6 +3,7 @@ import java.util.ArrayList; import java.util.List; +import org.jlab.detector.base.DetectorType; import org.jlab.geom.prim.Arc3D; import org.jlab.geom.prim.Cylindrical3D; import org.jlab.geom.prim.Point3D; @@ -43,74 +44,77 @@ public void getCvtHTrack(DataEvent event, CalibrationConstantsLoader ccdb) { // check if there are some cvt tracks in the event //System.out.println(" no cvt tracks"); } - - + if (event.hasBank("CVTRec::Trajectory") == true) { DataBank bank = event.getBank("CVTRec::Trajectory"); int nt = bank.rows(); // number of tracks in the cvt event + CVTTrack trk = new CVTTrack(); + int indexTrack = 0; for (int i = 0; i < nt; i++) { - - if(bank.getByte("detector", i)==3 && bank.getByte("layer", i)==1) { //make use of the fact that the 3 cnd layer are in order so find layer 1 and loop through the 2 next entries - CVTTrack trk = new CVTTrack(); - for(int j=0; j<3;j++) { - int id = (bank.getShort("id", i+j))-1; - int layer = bank.getByte("layer", i+j); - double x = bank.getFloat("x", i+j); - double y = bank.getFloat("y", i+j); - double z = bank.getFloat("z", i+j); - double theta = bank.getFloat("theta", i+j); - double phi = bank.getFloat("phi", i+j); - double ux = Math.sin(theta)*Math.cos(phi); - double uy = Math.sin(theta)*Math.sin(phi); - double uz = Math.cos(theta); - double path = bank.getFloat("path", i+j); + if(bank.getByte("detector", i)==DetectorType.CND.getDetectorId()) { //assume layer 1 match hit comes first, layer 2 second and layer 3 last + + + int id = (bank.getShort("id", i))-1; + if(id!=indexTrack) { + trk = new CVTTrack(); + indexTrack = id; + } + + int layer = bank.getByte("layer", i); + double x = bank.getFloat("x", i); + double y = bank.getFloat("y", i); + double z = bank.getFloat("z", i); + double theta = bank.getFloat("theta", i); + double phi = bank.getFloat("phi", i); + double ux = Math.sin(theta)*Math.cos(phi); + double uy = Math.sin(theta)*Math.sin(phi); + double uz = Math.cos(theta); + double path = bank.getFloat("path", i); - trk.set_Id(id); + trk.set_Id(id); - double entryradius = (ccdb.INNERRADIUS[0] + (layer - 1) * ccdb.THICKNESS[0] + (layer - 1) * Parameters.LayerGap)/10.; - double escaperadius = (ccdb.INNERRADIUS[0] + (layer) * ccdb.THICKNESS[0] + (layer - 1) * Parameters.LayerGap)/10.; + double entryradius = (ccdb.INNERRADIUS[0] + (layer - 1) * ccdb.THICKNESS[0] + (layer - 1) * Parameters.LayerGap)/10.; + double escaperadius = (ccdb.INNERRADIUS[0] + (layer) * ccdb.THICKNESS[0] + (layer - 1) * Parameters.LayerGap)/10.; - //find intercept of line defined by interaction point + director cosines with cylinder of radius defined above + //find intercept of line defined by interaction point + director cosines with cylinder of radius defined above - double b = 2*(ux*x+uy*y); - double a = ux*ux+uy*uy; - double co = x*x+y*y-((escaperadius*escaperadius)); - double ci = x*x+y*y-((entryradius*entryradius)); + double b = 2*(ux*x+uy*y); + double a = ux*ux+uy*uy; + double co = x*x+y*y-((escaperadius*escaperadius)); + double ci = x*x+y*y-((entryradius*entryradius)); - double uo1 = (-b+Math.sqrt(b*b-4*a*co))/(2*a); - double ui1 = (-b+Math.sqrt(b*b-4*a*ci))/(2*a); - + double uo1 = (-b+Math.sqrt(b*b-4*a*co))/(2*a); + double ui1 = (-b+Math.sqrt(b*b-4*a*ci))/(2*a); - Point3D entryPoint = new Point3D((x+ui1*ux)*10,(y+ui1*uy)*10,(z+ui1*uz)*10); - Point3D midPoint = new Point3D(x*10,y*10,z*10); - Point3D exitPoint = new Point3D((x+uo1*ux)*10,(y+uo1*uy)*10,(z+uo1*uz)*10); - trk._TrkInters.get(layer - 1).add(entryPoint); - trk._TrkInters.get(layer - 1).add(midPoint); - trk._TrkInters.get(layer - 1).add(exitPoint); + Point3D entryPoint = new Point3D((x+ui1*ux)*10,(y+ui1*uy)*10,(z+ui1*uz)*10); + Point3D midPoint = new Point3D(x*10,y*10,z*10); + Point3D exitPoint = new Point3D((x+uo1*ux)*10,(y+uo1*uy)*10,(z+uo1*uz)*10); - trk._TrkLengths.add(path*10); + trk._TrkInters.get(layer - 1).add(entryPoint); + trk._TrkInters.get(layer - 1).add(midPoint); + trk._TrkInters.get(layer - 1).add(exitPoint); - helices.add(trk); - //System.out.println(layer + " "+id +"path in paddle new "+entryPoint.distance(exitPoint)+ " pathlength "+ trk._TrkInters.get(layer-1)+ " id "+id); + trk._TrkLengths.add(path*10); - } - } + helices.add(trk); + //System.out.println(layer + " "+id +"path in paddle new "+entryPoint.distance(exitPoint)+ " pathlength "+ trk._TrkInters.get(layer-1)+ " id "+id); + } } } +/* + //old code (kept only for quick reference) - //old code (kept only for quick reference) - - /* if (event.hasBank("CVTRec::Tracks") == false) { + if (event.hasBank("CVTRec::Tracks") == false) { // check if there are some cvt tracks in the event //System.out.println(" no cvt tracks"); } @@ -191,18 +195,18 @@ public void getCvtHTrack(DataEvent event, CalibrationConstantsLoader ccdb) { double pathLength = Math.sqrt((Xm.z() - z0 )*(Xm.z() - z0 )+pathLengthXY*pathLengthXY); trk._TrkLengths.add(pathLength); - + System.out.println(lay + " "+trkID +"path in paddle old "+trk.get_Helix().getPointAtRadius(entryradius).distance(trk.get_Helix().getPointAtRadius(escaperadius))+ " pathlength "+ trk._TrkInters.get(lay-1)+ " id "+trkID); } - + // helices.add(trk); } }//end - - */ + + */ } From 0a9f3702029c4774c9beb165161d79c84914235b Mon Sep 17 00:00:00 2001 From: Pierre Chatagnon <33055626+PChatagnon@users.noreply.github.com> Date: Thu, 5 Mar 2020 09:49:29 +0100 Subject: [PATCH 18/47] Add check on track crossing a CND paddle --- .../org/jlab/rec/cnd/hit/CvtGetHTrack.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java index 2221efba34..80ddefc25f 100755 --- a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java +++ b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CvtGetHTrack.java @@ -91,8 +91,9 @@ public void getCvtHTrack(DataEvent event, CalibrationConstantsLoader ccdb) { double uo1 = (-b+Math.sqrt(b*b-4*a*co))/(2*a); double ui1 = (-b+Math.sqrt(b*b-4*a*ci))/(2*a); - - + + if((Double.isNaN(uo1)) || (Double.isNaN(ui1)) )continue; //check if the track crosses the paddle. If not then go to the next swimmer intersection + Point3D entryPoint = new Point3D((x+ui1*ux)*10,(y+ui1*uy)*10,(z+ui1*uz)*10); Point3D midPoint = new Point3D(x*10,y*10,z*10); Point3D exitPoint = new Point3D((x+uo1*ux)*10,(y+uo1*uy)*10,(z+uo1*uz)*10); @@ -104,16 +105,20 @@ public void getCvtHTrack(DataEvent event, CalibrationConstantsLoader ccdb) { trk._TrkLengths.add(path*10); helices.add(trk); - //System.out.println(layer + " "+id +"path in paddle new "+entryPoint.distance(exitPoint)+ " pathlength "+ trk._TrkInters.get(layer-1)+ " id "+id); + //System.out.println("layer from swimmer "+layer+ " x "+trk._TrkInters.get(layer-1).get(0).x()+ " "+y+" "+z); + + //System.out.println(layer + " "+id +" path in paddle new "+entryPoint.distance(exitPoint)+ " pathlength "+ trk._TrkInters.get(layer-1)+ " id "+id); } + + //add } } -/* - //old code (kept only for quick reference) + //old code (kept only for quick reference) +/* if (event.hasBank("CVTRec::Tracks") == false) { // check if there are some cvt tracks in the event //System.out.println(" no cvt tracks"); @@ -205,8 +210,8 @@ public void getCvtHTrack(DataEvent event, CalibrationConstantsLoader ccdb) { } }//end - - */ +*/ + } From 1b9147419dcfeeb47780bafb59fae65aa81efafa Mon Sep 17 00:00:00 2001 From: Pierre Chatagnon <33055626+PChatagnon@users.noreply.github.com> Date: Thu, 5 Mar 2020 09:51:05 +0100 Subject: [PATCH 19/47] Update matching of tracks and hit Add a check for a hit having an intersection with a given track --- .../main/java/org/jlab/rec/cnd/hit/CndHitFinder.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CndHitFinder.java b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CndHitFinder.java index 68c1b7d59b..89febe9b60 100644 --- a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CndHitFinder.java +++ b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/hit/CndHitFinder.java @@ -334,6 +334,14 @@ public double findLength(CndHit hit, List helices, int flag, Calibrati // the following line give the point at which the cnd hit would occur according to the cvt track //Point3D hitCndfromCvt = helices.get(i).get_Helix().getPointAtRadius(radius); + + //System.out.print("helices size "+helices.get(i).get_TrkInters().size()); + //System.out.println("layer "+lay+ " helice "+i); + ArrayList hitCndfromCvtList = helices.get(i).get_TrkInters().get(lay-1); // middle of the counter + + if(hitCndfromCvtList.isEmpty())continue; //Check if a layer as a swimmer intersection. If not go to the next track + + Point3D hitCndfromCvt = helices.get(i).get_TrkInters().get(lay-1).get(1); // middle of the counter double xj=hitCndfromCvt.x(); // retrieve CndFromCvt hit coordinates @@ -381,6 +389,8 @@ public double findLength(CndHit hit, List helices, int flag, Calibrati else {length = helices.get(i).get_TrkInters().get(lay-1).get(0).distance(helices.get(i).get_TrkInters().get(lay-1).get(2)); } + + //System.out.println(length); } } return length; From abf4fcea96e7f846e0cf3cd64321135c52ea8f87 Mon Sep 17 00:00:00 2001 From: Efrain Patrick Segarra Date: Thu, 5 Mar 2020 22:30:46 -0500 Subject: [PATCH 20/47] Updated to have calibration table for energy depsoit --- .../constants/CalibrationConstantsLoader.java | 15 +++++++++++++++ .../org/jlab/rec/band/hit/BandHitFinder.java | 17 +++++++++++++---- .../java/org/jlab/service/band/BANDEngine.java | 3 ++- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java b/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java index a9fa04026e..577e8eb7f1 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/constants/CalibrationConstantsLoader.java @@ -40,6 +40,7 @@ public CalibrationConstantsLoader() { public static Map FADC_ATTEN_LENGTH = new HashMap (); // FADC attenuation length [cm] public static Map TIMEWALK_L = new HashMap(); // Parameters for time-walk correction for L PMTs public static Map TIMEWALK_R = new HashMap(); // Parameters for time-walk correction for R PMTs + public static Map ENERGY_CONVERT = new HashMap(); // Energy conversion correction for ADC->MeV public static double JITTER_PERIOD = 0; public static int JITTER_PHASE = 0; @@ -64,6 +65,7 @@ public static synchronized void Load(int runno, String var, ConstantsManager man IndexedTable layeroffs_tdc = manager.getConstants(runno, "/calibration/band/layer_offsets_tdc"); IndexedTable cutvalues = manager.getConstants(runno, "/calibration/band/cuts"); IndexedTable globaloffsets = manager.getConstants(runno, "/calibration/band/global_offsets"); + IndexedTable energyconvert = manager.getConstants(runno, "/calibration/band/energy_conversion"); //IndexedTable timewalkL = manager.getConstants(runno, "/calibration/band/time_walk_corr_left"); //IndexedTable timewalkR = manager.getConstants(runno, "/calibration/band/time_walk_corr_right"); @@ -75,6 +77,19 @@ public static synchronized void Load(int runno, String var, ConstantsManager man CUT_LASERHITS_BAND = cutvalues.getIntValue("nlaserhits", 0,0,0); } + for( int i = 0; i < energyconvert.getRowCount(); i++){ + int sector = Integer.parseInt((String)energyconvert.getValueAt(i, 0)); + int layer = Integer.parseInt((String)energyconvert.getValueAt(i, 1)); + int component = Integer.parseInt((String)energyconvert.getValueAt(i, 2)); + double parA = energyconvert.getDoubleValue("par_a", sector, layer, component); + double parB = energyconvert.getDoubleValue("par_b", sector, layer, component); + double parC = energyconvert.getDoubleValue("par_c", sector, layer, component); + // Put TW in map + int key = sector*100+layer*10+component; + double convert_params[] = {parA,parB,parC}; + ENERGY_CONVERT.put(Integer.valueOf(key), convert_params); + } + //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Global offsets for each bar for FADC and TDC for(int i = 0; i < globaloffsets.getRowCount(); i++) { diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java index 00de20b095..709da00312 100644 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java @@ -263,12 +263,18 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT // ----------------------------------------------------------------------------------------------- - // Correct FADC ADC for attenuation length + // Correct FADC ADC for attenuation length and convert to MeV double sectorLen = Parameters.barLengthSector[sector-1]; double mu_cm = CalibrationConstantsLoader.FADC_ATTEN_LENGTH.get( Integer.valueOf(barKey) ); // in [cm] double adcL_corr = adcleft * Math.exp( (sectorLen/2.-xpos_fadc) / mu_cm ); double adcR_corr = adcright* Math.exp( (sectorLen/2.+xpos_fadc) / mu_cm ); - + // convert from ADC to MeV + double energyconvert_params[] = CalibrationConstantsLoader.ENERGY_CONVERT.get( Integer.valueOf(barKey) ); + double parA = energyconvert_params[0]; + double parB = energyconvert_params[1]; + double parC = energyconvert_params[2]; + double combo_adc = Math.sqrt(adcL_corr*adcR_corr); + combo_adc = parA + parB*combo_adc + parC*combo_adc*combo_adc; // ----------------------------------------------------------------------------------------------- // Create a new BandHit and fill it with the relevant info: @@ -284,8 +290,11 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT Hit.SetDiffTime_TDC(tdiff_tdc); Hit.SetDiffTime_FADC(tdiff_fadc); - Hit.SetAdcLeft(adcL_corr); - Hit.SetAdcRight(adcR_corr); + //Hit.SetAdcLeft(adcL_corr); + //Hit.SetAdcRight(adcR_corr); + Hit.SetAdcLeft(combo_adc); + Hit.SetAdcRight(combo_adc); + Hit.SetTLeft_FADC(ftdcleft); Hit.SetTRight_FADC(ftdcright); diff --git a/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java b/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java index 40ea0a4b4c..4273a0cfee 100755 --- a/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java +++ b/reconstruction/band/src/main/java/org/jlab/service/band/BANDEngine.java @@ -75,7 +75,8 @@ public boolean init() { "/calibration/band/time_walk_amp_left", "/calibration/band/time_walk_amp_right", "/calibration/band/global_offsets", - "/calibration/band/cuts" + "/calibration/band/cuts", + "/calibration/band/energy_conversion" //"/calibration/band/time_walk_corr_left", //"/calibration/band/time_walk_corr_right", }; From f7c4c6f31b4dae1f471751e99c18892266d1e247 Mon Sep 17 00:00:00 2001 From: Efrain Patrick Segarra Date: Thu, 5 Mar 2020 23:36:30 -0500 Subject: [PATCH 21/47] Fixed where the conversion should go to MeV --- .../org/jlab/rec/band/banks/RecoBankWriter.java | 14 ++++++++++++-- .../java/org/jlab/rec/band/hit/BandHitFinder.java | 15 +++------------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java index 6b5432348b..7869153145 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java @@ -8,6 +8,7 @@ import org.jlab.io.base.DataEvent; import org.jlab.rec.band.hit.BandHit; import org.jlab.rec.band.hit.BandHitCandidate; +import org.jlab.rec.band.constants.CalibrationConstantsLoader; @@ -43,8 +44,17 @@ public static DataBank fillBandHitBanks(DataEvent event, ArrayList hitl bank.setByte("sector",i, (byte) hitlist.get(i).GetSector()); bank.setByte("layer",i, (byte) hitlist.get(i).GetLayer()); bank.setShort("component",i, (short) hitlist.get(i).GetComponent()); - - bank.setFloat("energy", i, (float) Math.sqrt(hitlist.get(i).GetAdcLeft() * hitlist.get(i).GetAdcRight())); + + int barKey = hitlist.get(i).GetSector()*100+hitlist.get(i).GetLayer()*10+hitlist.get(i).GetComponent(); + double energyconvert_params[] = CalibrationConstantsLoader.ENERGY_CONVERT.get( Integer.valueOf(barKey) ); + double parA = energyconvert_params[0]; + double parB = energyconvert_params[1]; + double parC = energyconvert_params[2]; + double combo_adc = Math.sqrt(hitlist.get(i).GetAdcLeft() * hitlist.get(i).GetAdcRight()); + combo_adc = parA + parB*combo_adc + parC*combo_adc*combo_adc; + + //bank.setFloat("energy", i, (float) Math.sqrt(hitlist.get(i).GetAdcLeft() * hitlist.get(i).GetAdcRight())); + bank.setFloat("energy", i, (float) combo_adc); bank.setFloat("time",i, (float) hitlist.get(i).GetMeanTime_TDC()); bank.setFloat("x",i, (float) (hitlist.get(i).GetX())); diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java index 709da00312..b3e956d080 100644 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/hit/BandHitFinder.java @@ -263,18 +263,11 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT // ----------------------------------------------------------------------------------------------- - // Correct FADC ADC for attenuation length and convert to MeV + // Correct FADC ADC for attenuation length double sectorLen = Parameters.barLengthSector[sector-1]; double mu_cm = CalibrationConstantsLoader.FADC_ATTEN_LENGTH.get( Integer.valueOf(barKey) ); // in [cm] double adcL_corr = adcleft * Math.exp( (sectorLen/2.-xpos_fadc) / mu_cm ); double adcR_corr = adcright* Math.exp( (sectorLen/2.+xpos_fadc) / mu_cm ); - // convert from ADC to MeV - double energyconvert_params[] = CalibrationConstantsLoader.ENERGY_CONVERT.get( Integer.valueOf(barKey) ); - double parA = energyconvert_params[0]; - double parB = energyconvert_params[1]; - double parC = energyconvert_params[2]; - double combo_adc = Math.sqrt(adcL_corr*adcR_corr); - combo_adc = parA + parB*combo_adc + parC*combo_adc*combo_adc; // ----------------------------------------------------------------------------------------------- // Create a new BandHit and fill it with the relevant info: @@ -290,10 +283,8 @@ else if (hit1.GetSide() == 2) { //Hit1 is from right side PMT Hit.SetDiffTime_TDC(tdiff_tdc); Hit.SetDiffTime_FADC(tdiff_fadc); - //Hit.SetAdcLeft(adcL_corr); - //Hit.SetAdcRight(adcR_corr); - Hit.SetAdcLeft(combo_adc); - Hit.SetAdcRight(combo_adc); + Hit.SetAdcLeft(adcL_corr); + Hit.SetAdcRight(adcR_corr); Hit.SetTLeft_FADC(ftdcleft); From 04ef75ca430fc2ed138214051356987846afb925 Mon Sep 17 00:00:00 2001 From: hauenst Date: Fri, 6 Mar 2020 08:34:33 -0500 Subject: [PATCH 22/47] Added new BAND banks to mon, calib and dst schema --- etc/bankdefs/util/bankSplit.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/bankdefs/util/bankSplit.py b/etc/bankdefs/util/bankSplit.py index aa9fe261c0..1612c1529e 100644 --- a/etc/bankdefs/util/bankSplit.py +++ b/etc/bankdefs/util/bankSplit.py @@ -49,9 +49,9 @@ def createdirandlinks(dirname, banklist): print("Single json files saved in " + workdirectory + singledirectory) # create dst, calibration and monitoring directories -dst = ["RUN::config","RAW::epics","RAW::scaler","REC::Event","REC::Particle","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::ForwardTagger","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RICH::tdc","RICH::ringCher","RICH::hadCher","RUN::scaler","HEL::flip","HEL::online","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True"] -calibration = ["BAND::adc","BAND::tdc","BAND::hits","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTOF::adc","FTOF::hits","FTOF::tdc","HEL::flip","HEL::online","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True","RAW::epics","RAW::scaler","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::Event","REC::ForwardTagger","REC::Particle","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RF::adc","RF::tdc","RICH::tdc","RICH::hits","RICH::hadCher","RICH::hadrons","RICH::photons","RUN::config","RUN::rf","RUN::scaler","RUN::trigger","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory"] -monitoring = ["BAND::adc","BAND::tdc","BAND::hits","BMT::adc","BMTRec::Clusters","BMTRec::Crosses","BMTRec::Hits","BMTRec::LayerEffs","BST::adc","BSTRec::Clusters","BSTRec::Crosses","BSTRec::Hits","BSTRec::LayerEffs","CND::adc","CND::clusters","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","CVTRec::Trajectory","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::hits","ECAL::peaks","ECAL::tdc","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTOF::adc","FTOF::hits","FTOF::tdc","HEL::adc","HEL::flip","HEL::online","HitBasedTrkg::HBTracks","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True","RAW::epics","RAW::scaler","RAW::vtp","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::Event","REC::ForwardTagger","REC::Particle","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RECHB::Calorimeter","RECHB::Cherenkov","RECHB::Event","RECHB::ForwardTagger","RECHB::Particle","RECHB::Scintillator","RECHB::Track","RF::adc","RF::tdc","RICH::tdc","RICH::hits","RICH::hadrons","RICH::photons","RUN::config","RUN::rf","RUN::scaler","RUN::trigger","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory"] +dst = ["BAND::laser","RUN::config","RAW::epics","RAW::scaler","REC::Event","REC::Particle","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::ForwardTagger","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RICH::tdc","RICH::ringCher","RICH::hadCher","RUN::scaler","HEL::flip","HEL::online","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True"] +calibration = ["BAND::adc","BAND::tdc","BAND::hits","BAND::laser","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTOF::adc","FTOF::hits","FTOF::tdc","HEL::flip","HEL::online","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True","RAW::epics","RAW::scaler","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::Event","REC::ForwardTagger","REC::Particle","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RF::adc","RF::tdc","RICH::tdc","RICH::hits","RICH::hadCher","RICH::hadrons","RICH::photons","RUN::config","RUN::rf","RUN::scaler","RUN::trigger","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory"] +monitoring = ["BAND::adc","BAND::tdc","BAND::rawhits","BAND::laser","BAND::hits","BMT::adc","BMTRec::Clusters","BMTRec::Crosses","BMTRec::Hits","BMTRec::LayerEffs","BST::adc","BSTRec::Clusters","BSTRec::Crosses","BSTRec::Hits","BSTRec::LayerEffs","CND::adc","CND::clusters","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","CVTRec::Trajectory","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::hits","ECAL::peaks","ECAL::tdc","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTOF::adc","FTOF::hits","FTOF::tdc","HEL::adc","HEL::flip","HEL::online","HitBasedTrkg::HBTracks","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True","RAW::epics","RAW::scaler","RAW::vtp","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::Event","REC::ForwardTagger","REC::Particle","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RECHB::Calorimeter","RECHB::Cherenkov","RECHB::Event","RECHB::ForwardTagger","RECHB::Particle","RECHB::Scintillator","RECHB::Track","RF::adc","RF::tdc","RICH::tdc","RICH::hits","RICH::hadrons","RICH::photons","RUN::config","RUN::rf","RUN::scaler","RUN::trigger","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory"] ebrerun=list(dst) ebrerun.extend(["FTOF::hits","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory","TimeBasedTrkg::TBCovMat","HitBasedTrkg::HBTracks","FTOF::hbhits","ECAL::clusters","CTOF::hits","CND::clusters","HTCC::rec","LTCC::clusters","ECAL::moments","CVTRec::Tracks","CVTRec::Trajectory","FT::particles","FTCAL::clusters","FTHODO::clusters","RUN:rf"]) createdirandlinks("dst/", dst) From 75450704ace9894c3a7f107cb9ab39bac243ffc2 Mon Sep 17 00:00:00 2001 From: baltzell Date: Fri, 6 Mar 2020 18:22:10 -0500 Subject: [PATCH 23/47] add band to eventbuiler --- .../clas/detector/DetectorParticleStatus.java | 8 ++++++++ .../jlab/clas/detector/ScintillatorResponse.java | 2 +- .../java/org/jlab/service/eb/EBAnalyzer.java | 6 +++++- .../main/java/org/jlab/service/eb/EBEngine.java | 7 ++++++- .../java/org/jlab/service/eb/EventBuilder.java | 16 ++++++++++++++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorParticleStatus.java b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorParticleStatus.java index dce6c87859..deb0ef18da 100644 --- a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorParticleStatus.java +++ b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorParticleStatus.java @@ -17,6 +17,7 @@ public class DetectorParticleStatus { public static final int SCINTILLATOR=100; public static final int CALORIMETER=10; public static final int CHERENKOV=1; + public static final int BAND=8; public static final int CENTRAL=4; public static final int FORWARD=2; public static final int TAGGER=1; @@ -25,6 +26,7 @@ public class DetectorParticleStatus { private boolean isForward=false; private boolean isCentral=false; private boolean isTagger=false; + private boolean isBand=false; private int nScintillator=0; private int nCalorimeter=0; private int nCherenkov=0; @@ -36,6 +38,7 @@ private void setValue(int status) { this.isForward = ( (int)(Math.abs(this.status)/REGION) & FORWARD ) > 0; this.isCentral = ( (int)(Math.abs(this.status)/REGION) & CENTRAL ) > 0; this.isTagger = ( (int)(Math.abs(this.status)/REGION) & TAGGER ) > 0; + this.isBand = ( (int)(Math.abs(this.status)/REGION) & BAND ) > 0; this.nCherenkov = Math.abs(this.status)%(10*CHERENKOV)/CHERENKOV; this.nCalorimeter = Math.abs(this.status)%(10*CALORIMETER)/CALORIMETER; this.nScintillator = Math.abs(this.status)%(10*SCINTILLATOR)/SCINTILLATOR; @@ -45,6 +48,7 @@ private void setValue(int status) { public boolean isForward() { return this.isForward; } public boolean isCentral() { return this.isCentral; } public boolean isTagger() { return this.isTagger; } + public boolean isBAND() { return this.isBand; } public int getScintillatorCount() { return this.nScintillator; } public int getCalorimeterCount() { return this.nCalorimeter; } public int getCherenkovCount() { return this.nCherenkov; } @@ -93,6 +97,9 @@ else if (DetectorType.getType(trackType)==DetectorType.CVT) { else if (DetectorType.getType(trackType)==DetectorType.DC) { status += FORWARD*REGION; } + else if (p.hasHit(DetectorType.BAND)) { + status += BAND*REGION; + } // tagger: // need to fix broken response classes inheritance @@ -110,6 +117,7 @@ else if (DetectorType.getType(trackType)==DetectorType.DC) { status += SCINTILLATOR*p.countResponses(DetectorType.FTOF); status += SCINTILLATOR*p.countResponses(DetectorType.CTOF); status += SCINTILLATOR*p.countResponses(DetectorType.FTHODO); + status += SCINTILLATOR*p.countResponses(DetectorType.BAND); // calorimeters: status += CALORIMETER*p.countResponses(DetectorType.CND); diff --git a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java index 0ee6fef4f2..0a35383666 100644 --- a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java +++ b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java @@ -48,7 +48,7 @@ public static List readHipoEvent(DataEvent event, response.setStatus(bank.getInt("status",row)); // CND clusters do not have path length in bar (but its hits do!): - if (type != DetectorType.CND) { + if (type != DetectorType.CND && type != DetectorType.BAND) { float dx = bank.getFloat("pathLengthThruBar",row); if (dx>0) response.setDedx(bank.getFloat("energy", row)/dx); } diff --git a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBAnalyzer.java b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBAnalyzer.java index 49b0b0847f..492e17c59a 100644 --- a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBAnalyzer.java +++ b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBAnalyzer.java @@ -57,6 +57,7 @@ public EBAnalyzer(EBCCDBConstants ccdb,EBRadioFrequency ebrf) { neutralBetaDetectors.put(DetectorType.ECAL,Arrays.asList(1,4,7)); neutralBetaDetectors.put(DetectorType.CND,Arrays.asList(0)); neutralBetaDetectors.put(DetectorType.FTCAL,Arrays.asList(0)); + neutralBetaDetectors.put(DetectorType.BAND,Arrays.asList(0)); //neutralBetaDetectors.put(DetectorType.FTOF,Arrays.asList(2,1,3)); //neutralBetaDetectors.put(DetectorType.CTOF,Arrays.asList(0)); } @@ -280,7 +281,7 @@ public void assignNeutralMomenta(DetectorEvent de) { p.vector().setMag(p.getEnergy(DetectorType.ECAL) / SamplingFractions.getMean(22,p,ccdb)); } - else if (p.hasHit(DetectorType.CND)) { + else if (p.hasHit(DetectorType.CND) || p.hasHit(DetectorType.BAND)) { // CND has no handle on photon energy, so we set momentum to zero, // and let user get direction from REC::Scintillator.x/y/z. p.vector().setMag(0.0); @@ -479,6 +480,9 @@ public int bestPidFromTiming(DetectorParticle p) { else if (p.hasHit(DetectorType.CND)) { bestPid = p.getBeta() responseFTOF = ScintillatorResponse.readHipoEvent(de, ftofHitsType, DetectorType.FTOF); List responseCTOF = ScintillatorResponse.readHipoEvent(de, "CTOF::hits", DetectorType.CTOF); List responseCND = ScintillatorResponse.readHipoEvent(de, "CND::clusters", DetectorType.CND); + List responseBAND = ScintillatorResponse.readHipoEvent(de, "BAND::hits", DetectorType.BAND); List responseHTCC = CherenkovResponse.readHipoEvent(de,"HTCC::rec",DetectorType.HTCC); List responseLTCC = CherenkovResponse.readHipoEvent(de,"LTCC::clusters",DetectorType.LTCC); - + eb.addDetectorResponses(responseFTOF); eb.addDetectorResponses(responseCTOF); eb.addDetectorResponses(responseCND); + eb.addDetectorResponses(responseBAND); eb.addDetectorResponses(responseECAL); eb.addDetectorResponses(responseHTCC); eb.addDetectorResponses(responseLTCC); @@ -130,6 +132,9 @@ public boolean processDataEvent(DataEvent de,EBScalers ebs) { // Create central neutrals: ebm.addCentralNeutrals(eb.getEvent()); + // Add BAND particles: + eb.processBAND(responseBAND); + // Do PID etc: EBAnalyzer analyzer = new EBAnalyzer(ccdb,rf); analyzer.processEvent(eb.getEvent()); diff --git a/reconstruction/eb/src/main/java/org/jlab/service/eb/EventBuilder.java b/reconstruction/eb/src/main/java/org/jlab/service/eb/EventBuilder.java index 5147c83e87..c5572ce3a5 100644 --- a/reconstruction/eb/src/main/java/org/jlab/service/eb/EventBuilder.java +++ b/reconstruction/eb/src/main/java/org/jlab/service/eb/EventBuilder.java @@ -19,6 +19,7 @@ import org.jlab.clas.detector.DetectorTrack; import org.jlab.clas.detector.TaggerResponse; import org.jlab.clas.detector.CherenkovResponse; +import org.jlab.clas.physics.Vector3; import org.jlab.rec.eb.EBCCDBConstants; import org.jlab.rec.eb.EBCCDBEnum; @@ -277,6 +278,21 @@ public void processForwardTagger(DataEvent de) { forwardTaggerIDMatching(); } + public void processBAND(List bandHits) { + Vector3 vtx=new Vector3(0,0,0); + DetectorParticle trig=this.detectorEvent.getTriggerParticle(); + if (trig!=null) vtx.copy(trig.vertex()); + for (DetectorResponse r : bandHits) { + if (r.getDescriptor().getType()==DetectorType.BAND) { + // Non-zero BAND hits are ignored: + if (r.getStatus()!=0) continue; + DetectorParticle p=DetectorParticle.createNeutral(r, vtx); + r.setAssociation(this.detectorEvent.getParticles().size()); + this.detectorEvent.addParticle(p); + } + } + } + /* * processNeutralTracks From 42f91984dd62149fbda4c850417e115011bc1586 Mon Sep 17 00:00:00 2001 From: gavalian Date: Mon, 9 Mar 2020 11:40:36 -0400 Subject: [PATCH 24/47] EvioDataEvent now skips events larger than 500kb --- .../jlab/detector/decode/CLASDecoder4.java | 81 ++++++++++--------- .../detector/decode/CodaEventDecoder.java | 7 ++ .../jlab/io/evio/EvioDataEventHandler.java | 18 +++-- 3 files changed, 61 insertions(+), 45 deletions(-) diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CLASDecoder4.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CLASDecoder4.java index d6443a8731..d6a8bac187 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CLASDecoder4.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CLASDecoder4.java @@ -100,49 +100,52 @@ public CodaEventDecoder getCodaEventDecoder() { public void initEvent(DataEvent event){ if(event instanceof EvioDataEvent){ - try { - - dataList = codaDecoder.getDataEntries( (EvioDataEvent) event); - - //dataList = new ArrayList(); - //----------------------------------------------------------------------------- - // This part reads the BITPACKED FADC data from tag=57638 Format (cmcms) - // Then unpacks into Detector Digigitized data, and appends to existing buffer - // Modified on 9/5/2018 - //----------------------------------------------------------------------------- - - List fadcPacked = codaDecoder.getADCEntries((EvioDataEvent) event); - - /*for(FADCData data : fadcPacked){ + EvioDataEvent evioEvent = (EvioDataEvent) event; + if(evioEvent.getHandler().getStructure()!=null){ + try { + + dataList = codaDecoder.getDataEntries( (EvioDataEvent) event); + + //dataList = new ArrayList(); + //----------------------------------------------------------------------------- + // This part reads the BITPACKED FADC data from tag=57638 Format (cmcms) + // Then unpacks into Detector Digigitized data, and appends to existing buffer + // Modified on 9/5/2018 + //----------------------------------------------------------------------------- + + List fadcPacked = codaDecoder.getADCEntries((EvioDataEvent) event); + + /*for(FADCData data : fadcPacked){ data.show(); - }*/ - - if(fadcPacked!=null){ - List fadcUnpacked = FADCData.convert(fadcPacked); - dataList.addAll(fadcUnpacked); - } - // END of Bitpacked section - //----------------------------------------------------------------------------- - //this.decoderDebugMode = 4; - if(this.decoderDebugMode>0){ - System.out.println("\n>>>>>>>>> RAW decoded data"); - for(DetectorDataDgtz data : dataList){ - System.out.println(data); + }*/ + + if(fadcPacked!=null){ + List fadcUnpacked = FADCData.convert(fadcPacked); + dataList.addAll(fadcUnpacked); } - } - int runNumberCoda = codaDecoder.getRunNumber(); - this.setRunNumber(runNumberCoda); - - detectorDecoder.translate(dataList); - detectorDecoder.fitPulses(dataList); - if(this.decoderDebugMode>0){ - System.out.println("\n>>>>>>>>> TRANSLATED data"); - for(DetectorDataDgtz data : dataList){ - System.out.println(data); + // END of Bitpacked section + //----------------------------------------------------------------------------- + //this.decoderDebugMode = 4; + if(this.decoderDebugMode>0){ + System.out.println("\n>>>>>>>>> RAW decoded data"); + for(DetectorDataDgtz data : dataList){ + System.out.println(data); + } + } + int runNumberCoda = codaDecoder.getRunNumber(); + this.setRunNumber(runNumberCoda); + + detectorDecoder.translate(dataList); + detectorDecoder.fitPulses(dataList); + if(this.decoderDebugMode>0){ + System.out.println("\n>>>>>>>>> TRANSLATED data"); + for(DetectorDataDgtz data : dataList){ + System.out.println(data); + } } + } catch (Exception e) { + e.printStackTrace(); } - } catch (Exception e) { - e.printStackTrace(); } } diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CodaEventDecoder.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CodaEventDecoder.java index f42791afda..3908e00bd3 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CodaEventDecoder.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/CodaEventDecoder.java @@ -60,6 +60,13 @@ public CodaEventDecoder(){ * @return */ public List getDataEntries(EvioDataEvent event){ + + int event_size = event.getHandler().getStructure().getByteBuffer().array().length; + if(event_size>600*1024){ + System.out.println("error: >>>> EVENT SIZE EXCEEDS 600 kB"); + return new ArrayList(); + } + List rawEntries = new ArrayList(); List branches = this.getEventBranches(event); for(EvioTreeBranch branch : branches){ diff --git a/common-tools/clas-io/src/main/java/org/jlab/io/evio/EvioDataEventHandler.java b/common-tools/clas-io/src/main/java/org/jlab/io/evio/EvioDataEventHandler.java index 99052563e7..a7f519dc1a 100644 --- a/common-tools/clas-io/src/main/java/org/jlab/io/evio/EvioDataEventHandler.java +++ b/common-tools/clas-io/src/main/java/org/jlab/io/evio/EvioDataEventHandler.java @@ -30,12 +30,18 @@ public class EvioDataEventHandler { public EvioDataEventHandler(byte[] buffer, ByteOrder b_order){ evioBuffer = ByteBuffer.wrap(buffer); evioBuffer.order(b_order); - try { - structure = new EvioCompactStructureHandler(evioBuffer,DataType.BANK); - //eventNodes = structure.getChildNodes(); - eventNodes = structure.getNodes(); - } catch (EvioException ex) { - Logger.getLogger(EvioDataEvent.class.getName()).log(Level.SEVERE, null, ex); + if(buffer.length>500*1024){ + System.out.println("error >>> evio event hadler : buffer size ecceeds 500 kB"); + structure = null; + eventNodes = null; + } else { + try { + structure = new EvioCompactStructureHandler(evioBuffer,DataType.BANK); + //eventNodes = structure.getChildNodes(); + eventNodes = structure.getNodes(); + } catch (EvioException ex) { + Logger.getLogger(EvioDataEvent.class.getName()).log(Level.SEVERE, null, ex); + } } //this.list(); } From d838a58a71e983fdb18444514fea393f523cb29e Mon Sep 17 00:00:00 2001 From: Adam Hobart Date: Mon, 23 Mar 2020 10:09:38 +0100 Subject: [PATCH 25/47] new cnd cluster algorithm with carged particle veto flag --- etc/bankdefs/hipo4/cnd.json | 7 +- .../org/jlab/rec/cnd/cluster/CNDCluster.java | 49 +- .../rec/cnd/cluster/CNDClusterFinder.java | 609 +++++++++++------- .../service/cnd/CNDCalibrationEngine.java | 7 + 4 files changed, 448 insertions(+), 224 deletions(-) diff --git a/etc/bankdefs/hipo4/cnd.json b/etc/bankdefs/hipo4/cnd.json index 4fed5ace67..fca525e712 100644 --- a/etc/bankdefs/hipo4/cnd.json +++ b/etc/bankdefs/hipo4/cnd.json @@ -48,7 +48,12 @@ {"name":"y", "type":"F", "info":"center of Y coor (cm) of the hits"}, {"name":"z", "type":"F", "info":"center of Z coor (cm) of the hits"}, {"name":"time", "type":"F", "info":"center of time (ns) of the hits"}, - {"name":"status", "type":"S", "info":"cluster status"} + {"name":"status", "type":"S", "info":"cluster status"}, + {"name":"veto", "type":"B", "info":"charged particle veto"}, + {"name":"layermultip", "type":"B", "info":"layer multiplicity"}, + {"name":"layer1", "type":"B", "info":"firt layer hit"}, + {"name":"layer2", "type":"B", "info":"second layer hit"}, + {"name":"layer3", "type":"B", "info":"third layer hit"} ] } ] diff --git a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/cluster/CNDCluster.java b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/cluster/CNDCluster.java index 6341acbcc1..d9d8e2b279 100644 --- a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/cluster/CNDCluster.java +++ b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/cluster/CNDCluster.java @@ -18,7 +18,15 @@ public class CNDCluster extends ArrayList implements Comparable _cndhits; @@ -29,6 +37,45 @@ public CNDCluster(int id, int sector, int layer){ _cndhits = new ArrayList(); } + //get_veto and set_veto methods + + public int get_veto(){ + return _veto; + } + public void set_veto(int veto){ + _veto = veto; + } + + //get_layermultip and set_layermultip methods + + public int get_layermultip(){ + return _layermultip; + } + public void set_layermultip(int layermultip){ + _layermultip = layermultip; + } + + public int get_layer1(){ + return _layer1; + } + public void set_layer1(int layer1){ + _layer1 = layer1; + } + + public int get_layer2(){ + return _layer2; + } + public void set_layer2(int layer2){ + _layer2 = layer2; + } + public int get_layer3(){ + return _layer3; + } + public void set_layer3(int layer3){ + _layer3 = layer3; + } + + public int get_id(){ return _id; } diff --git a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/cluster/CNDClusterFinder.java b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/cluster/CNDClusterFinder.java index cecf7452e8..3b639d86a4 100644 --- a/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/cluster/CNDClusterFinder.java +++ b/reconstruction/cnd/src/main/java/org/jlab/rec/cnd/cluster/CNDClusterFinder.java @@ -20,235 +20,400 @@ public class CNDClusterFinder { + + private double cluster_size_ = 5;//apparently 5 cm according to Rong, no!!! + + public CNDClusterFinder() { + // TODO Auto-generated constructor stub + } + + public ArrayList findClusters(ArrayList hits) { + ArrayList clusters = new ArrayList(); + + + + /// variables for clustering of hits + int size = 0; + double hitenergy_temp = 0.0; + ArrayList clusters_nhits;//hit multiplicity?? + ArrayList clusters_energysum; + ArrayList clusters_hitenergy; + ArrayList clusters_x; + ArrayList clusters_y; + ArrayList clusters_z; + ArrayList clusters_time; + ArrayList clusters_xTimesEdep; + ArrayList clusters_yTimesEdep; + ArrayList clusters_zTimesEdep; + ArrayList clusters_timeTimesEdep; + ArrayList clusters_sector; + ArrayList clusters_layer; + ArrayList clusters_component; + ArrayList clusters_status; + double[] closest_distance = new double[1]; + int[] subA = new int[1]; + int[] subB = new int[1]; + + //ArrayList clusters_veto; + ArrayList clusters_layermultip; + ArrayList clusters_layer1; + ArrayList clusters_layer2; + ArrayList clusters_layer3; + + ///// get good hit informations for the clustering + clusters_nhits = new ArrayList(); + clusters_energysum = new ArrayList(); + clusters_hitenergy = new ArrayList(); + clusters_x = new ArrayList(); + clusters_y = new ArrayList(); + clusters_z = new ArrayList(); + clusters_time = new ArrayList(); + clusters_xTimesEdep = new ArrayList(); + clusters_yTimesEdep = new ArrayList(); + clusters_zTimesEdep = new ArrayList(); + clusters_timeTimesEdep = new ArrayList(); + clusters_sector = new ArrayList(); + clusters_layer = new ArrayList(); + clusters_component = new ArrayList(); + clusters_status = new ArrayList(); + + + //veto + //clusters_veto = new ArrayList(); + //implement layer multiplicity + clusters_layermultip = new ArrayList(); + clusters_layer1 = new ArrayList(); + clusters_layer2 = new ArrayList(); + clusters_layer3 = new ArrayList(); + - private double cluster_size_ = 5; + + + size = hits.size(); + for (int i = 0; i < size; i++) { + if( hits.get(i).Edep()<1.0 )continue; //energy threshold?? + clusters_nhits.add(1); + //energysum and energy hit are the same? + clusters_energysum.add(hits.get(i).Edep()); + clusters_hitenergy.add(hits.get(i).Edep()); + //// using the unit cm instead of mm, so divided by 10 + clusters_x.add(hits.get(i).X() /10.0); + clusters_y.add(hits.get(i).Y() /10.0); + clusters_z.add(hits.get(i).Z() /10.0); + clusters_time.add(hits.get(i).Time()); + clusters_xTimesEdep.add(hits.get(i).X() /10.0*hits.get(i).Edep()); + clusters_yTimesEdep.add(hits.get(i).Y() /10.0*hits.get(i).Edep()); + clusters_zTimesEdep.add(hits.get(i).Z() /10.0*hits.get(i).Edep()); + clusters_timeTimesEdep.add(hits.get(i).Time()*hits.get(i).Edep()); + clusters_sector.add(hits.get(i).Sector()); + clusters_layer.add(hits.get(i).Layer()); + clusters_component.add(hits.get(i).Component()); + clusters_status.add(0); + clusters_layermultip.add(1); + //clusters_veto.add(-99); + + + if(hits.get(i).Layer()==1){ + clusters_layer1.add(1); + clusters_layer2.add(0); + clusters_layer3.add(0); + } + else if(hits.get(i).Layer()==2){ + clusters_layer1.add(0); + clusters_layer2.add(1); + clusters_layer3.add(0); + } + else{ + clusters_layer1.add(0); + clusters_layer2.add(0); + clusters_layer3.add(1); + } + + } + + //// clustering of the CND hits + /// only one hit, no need to do clustering + if(clusters_nhits.size()==1){ + //// do nothing. + } + ///the case for two good cnd hits + else if(clusters_nhits.size()==2){ + /// combine the two hits or not... s=sqrt(DeltaX^2 + DeltaY^2 + DeltaZ^2 + DeltaT^2) ??? + double distance = sqrt( (clusters_x.get(0)-clusters_x.get(1))*(clusters_x.get(0)-clusters_x.get(1))/sigmaX(clusters_x.get(0))/sigmaX(clusters_x.get(1)) + +(clusters_y.get(0)-clusters_y.get(1))*(clusters_y.get(0)-clusters_y.get(1))/sigmaY(clusters_y.get(0))/sigmaY(clusters_y.get(1)) + +(clusters_z.get(0)-clusters_z.get(1))*(clusters_z.get(0)-clusters_z.get(1))/sigmaZ(clusters_z.get(0))/sigmaZ(clusters_z.get(1)) + +(clusters_time.get(0)-clusters_time.get(1))*(clusters_time.get(0)-clusters_time.get(1))/sigmaTime(clusters_time.get(0))/sigmaTime(clusters_time.get(1)) ); + //the 5 thing criteria... + if(distance < cluster_size_){ + + + + + if(clusters_layer1.get(0) ==1 || clusters_layer1.get(1)==1){ + clusters_layer1.set(0, 1); + } + if(clusters_layer2.get(0) ==1 || clusters_layer2.get(1)==1){ + clusters_layer2.set(0, 1); + } + if(clusters_layer3.get(0) ==1 || clusters_layer3.get(1)==1){ + clusters_layer3.set(0, 1); + } + + + clusters_layermultip.set(0, clusters_layer1.get(0)+clusters_layer2.get(0)+clusters_layer3.get(0)); + - public CNDClusterFinder() { - // TODO Auto-generated constructor stub - } + + if(clusters_energysum.get(0)2){ + int clusters_number = clusters_x.size(); + while(true){ + closest_distance[0] = 1.0e15; + subA[0] = -1; + subB[0] = -1; + find_closest(0, clusters_x, clusters_y, clusters_z, clusters_time, subA, subB, closest_distance); + if(subA[0]==-1 || subB[0]==-1)break; + else{ - public ArrayList findClusters(ArrayList hits) { - ArrayList clusters = new ArrayList(); + + int clusters_number_now = clusters_x.size(); + - /// variables for clustering of hits - int size = 0; - double hitenergy_temp = 0.0; - ArrayList clusters_nhits; - ArrayList clusters_energysum; - ArrayList clusters_hitenergy; - ArrayList clusters_x; - ArrayList clusters_y; - ArrayList clusters_z; - ArrayList clusters_time; - ArrayList clusters_xTimesEdep; - ArrayList clusters_yTimesEdep; - ArrayList clusters_zTimesEdep; - ArrayList clusters_timeTimesEdep; - ArrayList clusters_sector; - ArrayList clusters_layer; - ArrayList clusters_component; - ArrayList clusters_status; - double[] closest_distance = new double[1]; - int[] subA = new int[1]; - int[] subB = new int[1]; + + if(clusters_layer1.get(subA[0]) ==1 || clusters_layer1.get(subB[0])==1){ + clusters_layer1.set(subA[0], 1); + } + if(clusters_layer2.get(subA[0]) ==1 || clusters_layer2.get(subB[0])==1){ + clusters_layer2.set(subA[0], 1); + } + if(clusters_layer3.get(subA[0]) ==1 || clusters_layer3.get(subB[0])==1){ + clusters_layer3.set(subA[0], 1); + } + + + + clusters_layermultip.set(subA[0], clusters_layer1.get(subA[0])+clusters_layer2.get(subA[0])+clusters_layer3.get(subA[0])); + - ///// get good hit informations for the clustering - clusters_nhits = new ArrayList(); - clusters_energysum = new ArrayList(); - clusters_hitenergy = new ArrayList(); - clusters_x = new ArrayList(); - clusters_y = new ArrayList(); - clusters_z = new ArrayList(); - clusters_time = new ArrayList(); - clusters_xTimesEdep = new ArrayList(); - clusters_yTimesEdep = new ArrayList(); - clusters_zTimesEdep = new ArrayList(); - clusters_timeTimesEdep = new ArrayList(); - clusters_sector = new ArrayList(); - clusters_layer = new ArrayList(); - clusters_component = new ArrayList(); - clusters_status = new ArrayList(); + + + //// mark down the sector, layer, component of the dominant hit + if(clusters_hitenergy.get(subA[0]) < clusters_hitenergy.get(subB[0])){ + clusters_sector.set(subA[0], clusters_sector.get(subB[0]) ); + clusters_layer.set(subA[0], clusters_layer.get(subB[0]) ); + clusters_component.set(subA[0], clusters_component.get(subB[0]) ); + clusters_hitenergy.set(subA[0], clusters_hitenergy.get(subB[0]) ); + + + clusters_x.set(subA[0], clusters_x.get(subB[0])); + clusters_y.set(subA[0], clusters_y.get(subB[0])); + clusters_z.set(subA[0], clusters_z.get(subB[0])); + clusters_time.set(subA[0], clusters_time.get(subB[0])); + + } + + /* + + clusters_xTimesEdep.set(subA[0], clusters_xTimesEdep.get(subA[0]) + clusters_xTimesEdep.get(subB[0]) ); + clusters_yTimesEdep.set(subA[0], clusters_yTimesEdep.get(subA[0]) + clusters_yTimesEdep.get(subB[0]) ); + clusters_zTimesEdep.set(subA[0], clusters_zTimesEdep.get(subA[0]) + clusters_zTimesEdep.get(subB[0]) ); + clusters_timeTimesEdep.set(subA[0], clusters_timeTimesEdep.get(subA[0]) + clusters_timeTimesEdep.get(subB[0]) ); + */ - size = hits.size(); - for (int i = 0; i < size; i++) { - if( hits.get(i).Edep()<2.50 )continue; - clusters_nhits.add(1); - clusters_energysum.add(hits.get(i).Edep()); - clusters_hitenergy.add(hits.get(i).Edep()); - //// using the unit cm instead of mm, so divided by 10 - clusters_x.add(hits.get(i).X() /10.0); - clusters_y.add(hits.get(i).Y() /10.0); - clusters_z.add(hits.get(i).Z() /10.0); - clusters_time.add(hits.get(i).Time()); - clusters_xTimesEdep.add(hits.get(i).X() /10.0*hits.get(i).Edep()); - clusters_yTimesEdep.add(hits.get(i).Y() /10.0*hits.get(i).Edep()); - clusters_zTimesEdep.add(hits.get(i).Z() /10.0*hits.get(i).Edep()); - clusters_timeTimesEdep.add(hits.get(i).Time()*hits.get(i).Edep()); - clusters_sector.add(hits.get(i).Sector()); - clusters_layer.add(hits.get(i).Layer()); - clusters_component.add(hits.get(i).Component()); - clusters_status.add(0); - } - - //// clustering of the CND hits - /// only one hit, no need to do clustering - if(clusters_nhits.size()==1){ - //// do nothing. - } - ///the case for two good cnd hits - else if(clusters_nhits.size()==2){ - /// combine the two hits or not... - double distance = sqrt( (clusters_x.get(0)-clusters_x.get(1))*(clusters_x.get(0)-clusters_x.get(1))/sigmaX(clusters_x.get(0))/sigmaX(clusters_x.get(1)) - +(clusters_y.get(0)-clusters_y.get(1))*(clusters_y.get(0)-clusters_y.get(1))/sigmaY(clusters_y.get(0))/sigmaY(clusters_y.get(1)) - +(clusters_z.get(0)-clusters_z.get(1))*(clusters_z.get(0)-clusters_z.get(1))/sigmaZ(clusters_z.get(0))/sigmaZ(clusters_z.get(1)) - +(clusters_time.get(0)-clusters_time.get(1))*(clusters_time.get(0)-clusters_time.get(1))/sigmaTime(clusters_time.get(0))/sigmaTime(clusters_time.get(1)) ); - - if(distance < cluster_size_){ - if(clusters_energysum.get(0)2){ - int clusters_number = clusters_x.size(); - while(true){ - closest_distance[0] = 1.0e15; - subA[0] = -1; - subB[0] = -1; - find_closest(0, clusters_x, clusters_y, clusters_z, clusters_time, subA, subB, closest_distance); - if(subA[0]==-1 || subB[0]==-1)break; - else{ - int clusters_number_now = clusters_x.size(); - clusters_x.set(subA[0], - (clusters_x.get(subA[0])*(1+clusters_number-clusters_number_now)+clusters_x.get(subB[0]))/(2.0+clusters_number-clusters_number_now) ); - clusters_y.set(subA[0], - (clusters_y.get(subA[0])*(1+clusters_number-clusters_number_now)+clusters_y.get(subB[0]))/(2.0+clusters_number-clusters_number_now) ); - clusters_z.set(subA[0], - (clusters_z.get(subA[0])*(1+clusters_number-clusters_number_now)+clusters_z.get(subB[0]))/(2.0+clusters_number-clusters_number_now) ); - clusters_time.set(subA[0], - (clusters_time.get(subA[0])*(1+clusters_number-clusters_number_now)+clusters_time.get(subB[0]))/(2.0+clusters_number-clusters_number_now) ); - clusters_xTimesEdep.set(subA[0], clusters_xTimesEdep.get(subA[0]) + clusters_xTimesEdep.get(subB[0]) ); - clusters_yTimesEdep.set(subA[0], clusters_yTimesEdep.get(subA[0]) + clusters_yTimesEdep.get(subB[0]) ); - clusters_zTimesEdep.set(subA[0], clusters_zTimesEdep.get(subA[0]) + clusters_zTimesEdep.get(subB[0]) ); - clusters_timeTimesEdep.set(subA[0], clusters_timeTimesEdep.get(subA[0]) + clusters_timeTimesEdep.get(subB[0]) ); - //// mark down the sector, layer, component of the dominant hit - if(clusters_hitenergy.get(subA[0]) < clusters_hitenergy.get(subB[0])){ - clusters_sector.set(subA[0], clusters_sector.get(subB[0]) ); - clusters_layer.set(subA[0], clusters_layer.get(subB[0]) ); - clusters_component.set(subA[0], clusters_component.get(subB[0]) ); - clusters_hitenergy.set(subA[0], clusters_hitenergy.get(subB[0]) ); - } - if(clusters_status.get(subB[0]) !=0) clusters_status.set(subA[0], clusters_status.get(subB[0])); - clusters_nhits.set(subA[0], clusters_nhits.get(subA[0]) + 1); - clusters_nhits.remove(subB[0]); - clusters_energysum.set(subA[0], clusters_energysum.get(subA[0])+clusters_energysum.get(subB[0])); - clusters_energysum.remove(subB[0]); - clusters_hitenergy.remove(subB[0]); - clusters_x.remove(subB[0]); - clusters_y.remove(subB[0]); - clusters_z.remove(subB[0]); - clusters_time.remove(subB[0]); - clusters_xTimesEdep.remove(subB[0]); - clusters_yTimesEdep.remove(subB[0]); - clusters_zTimesEdep.remove(subB[0]); - clusters_timeTimesEdep.remove(subB[0]); - clusters_sector.remove(subB[0]); - clusters_layer.remove(subB[0]); - clusters_component.remove(subB[0]); - clusters_status.remove(subB[0]); - } - } - - /// calculate the Edep-weighted average - for(int i = 0; i < clusters_x.size(); i++){ - clusters_x.set(i, clusters_xTimesEdep.get(i)/clusters_energysum.get(i)); - clusters_y.set(i, clusters_yTimesEdep.get(i)/clusters_energysum.get(i)); - clusters_z.set(i, clusters_zTimesEdep.get(i)/clusters_energysum.get(i)); - clusters_time.set(i, clusters_timeTimesEdep.get(i)/clusters_energysum.get(i)); - } - - } - - for(int i = 0; i < clusters_x.size(); i++){ - CNDCluster acluster = new CNDCluster(i+1, clusters_sector.get(i), clusters_layer.get(i) ); - acluster.set_component(clusters_component.get(i)); - acluster.set_x(clusters_x.get(i)); - acluster.set_y(clusters_y.get(i)); - acluster.set_z(clusters_z.get(i)); - acluster.set_time(clusters_time.get(i)); - acluster.set_nhits(clusters_nhits.get(i)); - acluster.set_energysum(clusters_energysum.get(i)); - acluster.set_status(clusters_status.get(i)); - clusters.add(acluster); - } - - return clusters; - } - - /// resolutions of CND hits - /// unit : cm - private double sigmaX(double x){ return 1.6; } - /// unit : cm - private double sigmaY(double y){ return 1.6; } - /// unit : cm - private double sigmaZ(double z){ return 3.0; } - /// unit : ns - private double sigmaTime(double t){ return 0.14; } - /// unit : deg. - private double sigmaTheta(double theta){ return 2.5; } - /// unit : deg. - private double sigmaPhi(double phi){ return 2.8; } - /// beta = v/c. - private double sigmaBeta(double beta){ return 0.065*beta; } - - /// find the two closest hits among all the hits - private void find_closest(int begin, ArrayList x, ArrayList y, ArrayList z, ArrayList time, - int[] subA, int[] subB, double[] closest_distance){ - if((begin+1)>=x.size())return; - - for(int i=begin+1;i cluster_size_)continue; - else{ - if(distance type; array of cluster found in the event + } + + /// resolutions of CND hits + /// unit : cm + private double sigmaX(double x){ return 1.6; } + /// unit : cm + private double sigmaY(double y){ return 1.6; } + /// unit : cm + private double sigmaZ(double z){ return 3.0; } + /// unit : ns + private double sigmaTime(double t){ return 0.14; } + /// unit : deg. + private double sigmaTheta(double theta){ return 2.5; } + /// unit : deg. + private double sigmaPhi(double phi){ return 2.8; } + /// beta = v/c. + private double sigmaBeta(double beta){ return 0.065*beta; } + + /// find the two closest hits among all the hits + private void find_closest(int begin, ArrayList x, ArrayList y, ArrayList z, ArrayList time, + int[] subA, int[] subB, double[] closest_distance){ + if((begin+1)>=x.size())return; + + + + for(int i=begin+1;i cluster_size_){ + // + continue; + } + else{ + if(distance10 && nhits<3) || (energysum<=10 && nhits<4)){ + alpha++; + } + //CND related condition for CND and CTOF veto + if((energysum<30 && layermultip==1)){ + alpha++; + alpha++; + } + if(((energysum)<10 && nhits<3 && layermultip==2)){ + alpha++; + alpha++; + alpha++; + alpha++; + } + + + return alpha; + + } + + + + } diff --git a/reconstruction/cnd/src/main/java/org/jlab/service/cnd/CNDCalibrationEngine.java b/reconstruction/cnd/src/main/java/org/jlab/service/cnd/CNDCalibrationEngine.java index 09b7034686..a49bb6af9d 100644 --- a/reconstruction/cnd/src/main/java/org/jlab/service/cnd/CNDCalibrationEngine.java +++ b/reconstruction/cnd/src/main/java/org/jlab/service/cnd/CNDCalibrationEngine.java @@ -185,6 +185,13 @@ public boolean processDataEvent(DataEvent event) { bank2.setFloat("z",i, (float)(1.0* cndclusters.get(i).get_z()) ); bank2.setFloat("time",i, (float)(1.0* cndclusters.get(i).get_time()) ); bank2.setShort("status",i, (short) cndclusters.get(i).get_status()); + //should add here the flag from kitty's veto as + bank2.setByte("veto",i, (byte) cndclusters.get(i).get_veto() ); + //should add here the layer multiplicity + bank2.setByte("layermultip",i, (byte) cndclusters.get(i).get_layermultip() ); + bank2.setByte("layer1",i, (byte) cndclusters.get(i).get_layer1() ); + bank2.setByte("layer2",i, (byte) cndclusters.get(i).get_layer2() ); + bank2.setByte("layer3",i, (byte) cndclusters.get(i).get_layer3() ); } event.appendBanks(bank2); } From 39cbccf922ce8efa581df66f8a96cfb61d893883 Mon Sep 17 00:00:00 2001 From: hauenst Date: Thu, 26 Mar 2020 14:25:57 -0400 Subject: [PATCH 26/47] Added BANK::rawhits bank to calibration schema in bankSplit.py --- etc/bankdefs/util/bankSplit.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/bankdefs/util/bankSplit.py b/etc/bankdefs/util/bankSplit.py index bf8d895f49..764b1c6a7d 100644 --- a/etc/bankdefs/util/bankSplit.py +++ b/etc/bankdefs/util/bankSplit.py @@ -50,7 +50,7 @@ def createdirandlinks(dirname, banklist): # create dst, calibration and monitoring directories dst = ["BAND::laser","RUN::config","RAW::epics","RAW::scaler","REC::Event","REC::Particle","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::ForwardTagger","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RICH::tdc","RICH::ringCher","RICH::hadCher","RUN::scaler","HEL::flip","HEL::online","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True"] -calibration = ["BAND::adc","BAND::tdc","BAND::hits","BAND::laser","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTOF::adc","FTOF::hits","FTOF::tdc","HEL::flip","HEL::online","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True","RAW::epics","RAW::scaler","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::Event","REC::ForwardTagger","REC::Particle","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RF::adc","RF::tdc","RICH::tdc","RICH::hits","RICH::hadCher","RICH::hadrons","RICH::photons","RICH::ringCher","RUN::config","RUN::rf","RUN::scaler","RUN::trigger","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory"] +calibration = ["BAND::adc","BAND::tdc","BAND::hits","BAND::rawhits","BAND::laser","CND::adc","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::peaks","ECAL::tdc","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTOF::adc","FTOF::hits","FTOF::tdc","HEL::flip","HEL::online","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True","RAW::epics","RAW::scaler","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::Event","REC::ForwardTagger","REC::Particle","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RF::adc","RF::tdc","RICH::tdc","RICH::hits","RICH::hadCher","RICH::hadrons","RICH::photons","RICH::ringCher","RUN::config","RUN::rf","RUN::scaler","RUN::trigger","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory"] monitoring = ["BAND::adc","BAND::tdc","BAND::rawhits","BAND::laser","BAND::hits","BMT::adc","BMTRec::Clusters","BMTRec::Crosses","BMTRec::Hits","BMTRec::LayerEffs","BST::adc","BSTRec::Clusters","BSTRec::Crosses","BSTRec::Hits","BSTRec::LayerEffs","CND::adc","CND::clusters","CND::hits","CND::tdc","CTOF::adc","CTOF::hits","CTOF::tdc","CVTRec::Tracks","CVTRec::Trajectory","ECAL::adc","ECAL::calib","ECAL::clusters","ECAL::hits","ECAL::peaks","ECAL::tdc","FT::particles","FTCAL::adc","FTCAL::clusters","FTCAL::hits","FTHODO::adc","FTHODO::clusters","FTHODO::hits","FTOF::adc","FTOF::hits","FTOF::tdc","HEL::adc","HEL::flip","HEL::online","HitBasedTrkg::HBTracks","HTCC::adc","HTCC::rec","LTCC::adc","LTCC::clusters","MC::Event","MC::Header","MC::Lund","MC::Particle","MC::True","RAW::epics","RAW::scaler","RAW::vtp","REC::Calorimeter","REC::Cherenkov","REC::CovMat","REC::Event","REC::ForwardTagger","REC::Particle","REC::Scintillator","REC::Track","REC::Traj","RECFT::Event","RECFT::Particle","RECHB::Calorimeter","RECHB::Cherenkov","RECHB::Event","RECHB::ForwardTagger","RECHB::Particle","RECHB::Scintillator","RECHB::Track","RF::adc","RF::tdc","RICH::tdc","RICH::hits","RICH::hadCher","RICH::hadrons","RICH::photons","RICH::ringCher","RUN::config","RUN::rf","RUN::scaler","RUN::trigger","TimeBasedTrkg::TBCrosses","TimeBasedTrkg::TBHits","TimeBasedTrkg::TBSegments","TimeBasedTrkg::TBSegmentTrajectory","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory"] ebrerun=list(dst) ebrerun.extend(["FTOF::hits","TimeBasedTrkg::TBTracks","TimeBasedTrkg::Trajectory","TimeBasedTrkg::TBCovMat","HitBasedTrkg::HBTracks","FTOF::hbhits","ECAL::clusters","CTOF::hits","CND::clusters","HTCC::rec","LTCC::clusters","ECAL::moments","CVTRec::Tracks","CVTRec::Trajectory","FT::particles","FTCAL::clusters","FTHODO::clusters","RUN:rf"]) From 7a09352b4dea77a277d36e6d02ad4942dbe8648a Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Mon, 30 Mar 2020 20:21:54 -0400 Subject: [PATCH 27/47] update eb tests to gemc 4.3.2, with new gemc conventions on gemc gcard names and locations --- validation/{README.md => README-deprecated.md} | 0 validation/advanced-tests/run-eb-tests-all.sh | 5 ----- validation/advanced-tests/run-eb-tests.sh | 2 +- validation/advanced-tests/src/eb/scripts/.gitignore | 1 + validation/advanced-tests/src/eb/scripts/gemc.csh | 10 +++++++--- validation/advanced-tests/src/eb/scripts/list.txt | 1 - 6 files changed, 9 insertions(+), 10 deletions(-) rename validation/{README.md => README-deprecated.md} (100%) diff --git a/validation/README.md b/validation/README-deprecated.md similarity index 100% rename from validation/README.md rename to validation/README-deprecated.md diff --git a/validation/advanced-tests/run-eb-tests-all.sh b/validation/advanced-tests/run-eb-tests-all.sh index 31a14e6707..ccd5116fd8 100755 --- a/validation/advanced-tests/run-eb-tests-all.sh +++ b/validation/advanced-tests/run-eb-tests-all.sh @@ -6,11 +6,6 @@ for xx in `awk '{print$1}' src/eb/scripts/list.txt` do - if [ "$xx" == "electrongammaC" ] - then - echo "This test is ignored (pid is not assigned for central photons): $xx" - continue - fi ./run-eb-tests.sh -100 $xx if [ $? != 0 ] then diff --git a/validation/advanced-tests/run-eb-tests.sh b/validation/advanced-tests/run-eb-tests.sh index 3e4fbae68d..0a24c5944f 100755 --- a/validation/advanced-tests/run-eb-tests.sh +++ b/validation/advanced-tests/run-eb-tests.sh @@ -1,7 +1,7 @@ #!/bin/bash webDir=http://clasweb.jlab.org/clas12offline/distribution/coatjava/validation_files/eb -webVersion=4.3.0-fid-r11 +webVersion=4.3.2-fid-r11 webDir=$webDir/$webVersion # coatjava must already be built at ../../coatjava/ diff --git a/validation/advanced-tests/src/eb/scripts/.gitignore b/validation/advanced-tests/src/eb/scripts/.gitignore index 2211df63dd..418708b2b4 100644 --- a/validation/advanced-tests/src/eb/scripts/.gitignore +++ b/validation/advanced-tests/src/eb/scripts/.gitignore @@ -1 +1,2 @@ *.txt +*.gz diff --git a/validation/advanced-tests/src/eb/scripts/gemc.csh b/validation/advanced-tests/src/eb/scripts/gemc.csh index 685b7d5b3c..591b75a132 100755 --- a/validation/advanced-tests/src/eb/scripts/gemc.csh +++ b/validation/advanced-tests/src/eb/scripts/gemc.csh @@ -9,10 +9,14 @@ if ( -e "$1.evio" ) then exit endif -source /group/clas12/gemc/environment.csh 4.3.0 +source /group/clas12/packages/setup.csh +module load ccdb +module load root +module load gemc/4.3.2 + set run = 11 -set nEvents = 1000 -set gcard = ${GEMC}/../clas12.gcard +set nEvents = 100 +set gcard = ${GEMC}/../../gcards/clas12-default.gcard gemc \ $gcard \ diff --git a/validation/advanced-tests/src/eb/scripts/list.txt b/validation/advanced-tests/src/eb/scripts/list.txt index 7dfef2c0a3..d718b264f9 100644 --- a/validation/advanced-tests/src/eb/scripts/list.txt +++ b/validation/advanced-tests/src/eb/scripts/list.txt @@ -8,7 +8,6 @@ electrongammaFT -pid 22 -ft electronprotonC -pid 2212 -cd electronkaonC -pid 321 -cd electronpionC -pid 211 -cd -electrongammaC -pid 22 -cd electronneutronC -pid 2112 -cd electronFTpion -pid -211 -ft electronFTproton -pid -2212 -ft From ecaa269188fed42d9bee003243b132ecd301fbcd Mon Sep 17 00:00:00 2001 From: baltzell Date: Sun, 5 Apr 2020 13:01:37 -0400 Subject: [PATCH 28/47] new cnd neutral veto from Adam --- .../clas/detector/ScintillatorResponse.java | 7 +++- .../src/main/java/org/jlab/rec/eb/EBUtil.java | 41 +++++++++++++++++++ .../java/org/jlab/service/eb/EBAnalyzer.java | 6 ++- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java index 0ee6fef4f2..1f7994b6b8 100644 --- a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java +++ b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java @@ -14,9 +14,11 @@ public class ScintillatorResponse extends DetectorResponse { private float dedx=0; + private byte neutralVeto=0; public float getDedx() { return dedx; } public void setDedx(float dedx) { this.dedx=dedx; } + public byte getNeutralVeto() { return neutralVeto; } public ScintillatorResponse(){ super(); @@ -48,7 +50,10 @@ public static List readHipoEvent(DataEvent event, response.setStatus(bank.getInt("status",row)); // CND clusters do not have path length in bar (but its hits do!): - if (type != DetectorType.CND) { + if (type == DetectorType.CND) { + response.neutralVeto = bank.getByte("veto",row); + } + else { float dx = bank.getFloat("pathLengthThruBar",row); if (dx>0) response.setDedx(bank.getFloat("energy", row)/dx); } diff --git a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java index 13fe86df54..0aadc6dfb3 100644 --- a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java +++ b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java @@ -5,11 +5,52 @@ import java.util.List; import org.jlab.clas.detector.DetectorResponse; import org.jlab.clas.detector.DetectorParticle; +import org.jlab.clas.detector.ScintillatorResponse; import org.jlab.detector.base.DetectorType; import org.jlab.clas.pdg.PhysicsConstants; public class EBUtil { + /** + * Central neutral veto logic from Adam Hobart. + * + * @param p + * @return whether to veto neutrality of p + * + * FIXME: magic veto bits + * FIXME: move float parameters to CCDB + */ + public static boolean centralNeutralVeto(DetectorParticle p) { + + ScintillatorResponse cnd=(ScintillatorResponse)p.getHit(DetectorType.CND); + ScintillatorResponse ctof=(ScintillatorResponse)p.getHit(DetectorType.CTOF); + + if (cnd!=null || ctof!=null) { + if (cnd==null) { + if ( ctof.getEnergy() >= 18.0 ) { + return true; + } + } + else if (ctof==null) { + if ( (cnd.getNeutralVeto() & 1) == 0 ) { + return true; + } + } + else if ( ctof.getEnergy() >= 10.0 ) { + return true; + } + else if ( (cnd.getNeutralVeto() & (1<<1)) == 0 ) { + if ( ctof.getEnergy()+cnd.getEnergy() >= 10.0 ) { + return true; + } + else if ( (cnd.getNeutralVeto() & (1<<2) ) == 0) { + return true; + } + } + } + return false; + } + /** * Perform a basic true/false identification for electrons. */ diff --git a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBAnalyzer.java b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBAnalyzer.java index 49b0b0847f..eb1db4fa6e 100644 --- a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBAnalyzer.java +++ b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBAnalyzer.java @@ -477,7 +477,11 @@ public int bestPidFromTiming(DetectorParticle p) { bestPid = p.getBeta() Date: Thu, 2 Apr 2020 16:29:30 -0400 Subject: [PATCH 29/47] evio2hipo: added conversion of CND fADC time --- .../src/main/java/org/jlab/clas/reco/io/EvioHipoEvent4.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/io/EvioHipoEvent4.java b/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/io/EvioHipoEvent4.java index 7c59940255..423772384f 100644 --- a/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/io/EvioHipoEvent4.java +++ b/common-tools/clas-reco/src/main/java/org/jlab/clas/reco/io/EvioHipoEvent4.java @@ -294,12 +294,16 @@ public void fillHipoEventCND(Event hipoEvent, EvioDataEvent evioEvent){ hipoADC.putShort("component", index, (short) evioBank.getInt("component",i)); hipoADC.putByte("order", index,(byte) 0); hipoADC.putInt("ADC", index, evioBank.getInt("ADCL", i)); + double tdcl = (double) evioBank.getInt("TDCL", i); + hipoADC.putFloat("time", index, (float) (tdcl*24.0/1000)); hipoADC.putByte("sector", index+1, (byte) evioBank.getInt("sector",i)); hipoADC.putByte("layer", index+1, (byte) evioBank.getInt("layer",i)); hipoADC.putShort("component", index+1, (short) evioBank.getInt("component",i)); hipoADC.putByte("order", index+1,(byte) 1); hipoADC.putInt("ADC", index+1, evioBank.getInt("ADCR", i)); + double tdcr = (double) evioBank.getInt("TDCR", i); + hipoADC.putFloat("time", index+1, (float) (tdcr*24.0/1000)); hipoTDC.putByte("sector", index, (byte) evioBank.getInt("sector",i)); hipoTDC.putByte("layer", index, (byte) evioBank.getInt("layer",i)); From 4b586a899829aa382df05f11123028d507e0e3a6 Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Sat, 18 Apr 2020 18:48:52 -0400 Subject: [PATCH 30/47] Update RecoBankWriter.java --- .../src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java index 7869153145..ebc092c31f 100755 --- a/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java +++ b/reconstruction/band/src/main/java/org/jlab/rec/band/banks/RecoBankWriter.java @@ -2,8 +2,6 @@ import java.util.ArrayList; -import javax.net.ssl.ExtendedSSLSession; - import org.jlab.io.base.DataBank; import org.jlab.io.base.DataEvent; import org.jlab.rec.band.hit.BandHit; From d6d9409e1da55cb3af65a0f3ae7c2b30eb34f3f6 Mon Sep 17 00:00:00 2001 From: baltzell Date: Sat, 18 Apr 2020 19:00:09 -0400 Subject: [PATCH 31/47] bugfix on gated beam charge --- .../main/java/org/jlab/analysis/postprocess/Tag1ToEvent.java | 2 +- .../src/main/java/org/jlab/detector/decode/DaqScalers.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Tag1ToEvent.java b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Tag1ToEvent.java index 5f5bf6026b..3dfa2246ac 100644 --- a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Tag1ToEvent.java +++ b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/Tag1ToEvent.java @@ -115,7 +115,7 @@ public static void main(String[] args) { else { goodCharge++; if (doBeamCharge) { - recEventBank.putFloat("beamCharge",0,ds.getBeamCharge()); + recEventBank.putFloat("beamCharge",0,ds.getBeamChargeGated()); recEventBank.putDouble("liveTime",0,ds.getLivetime()); } } diff --git a/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/DaqScalers.java b/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/DaqScalers.java index 8102364c9d..6656cf9c47 100644 --- a/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/DaqScalers.java +++ b/common-tools/clas-detector/src/main/java/org/jlab/detector/decode/DaqScalers.java @@ -85,7 +85,7 @@ public static DaqScalers create(Bank rawScalerBank,IndexedTable fcupTable,double if (dsc2.getClock() > 0) { - float live = dsc2.getGatedSlm() / dsc2.getSlm(); + float live = (float)dsc2.getGatedSlm() / dsc2.getSlm(); float q = (float)(dsc2.getFcup() - fcup_offset * seconds ); float qg = (float)(dsc2.getGatedFcup() - fcup_offset * seconds * live); q *= fcup_atten / fcup_slope; From dd6114a3d6c807a2024e86644ecf17b282e22653 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Mon, 20 Apr 2020 16:51:16 -0400 Subject: [PATCH 32/47] moved CND veto logic to EB centralNeutralVeto --- .../clas/detector/ScintillatorResponse.java | 10 +++++++--- etc/bankdefs/hipo4/cnd.json | 3 +-- .../jlab/service/cnd/CNDCalibrationEngine.java | 14 ++++++-------- .../src/main/java/org/jlab/rec/eb/EBUtil.java | 17 ++++++++--------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java index 1f7994b6b8..ef89458e56 100644 --- a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java +++ b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java @@ -14,11 +14,14 @@ public class ScintillatorResponse extends DetectorResponse { private float dedx=0; - private byte neutralVeto=0; + private short clusterSize=0; + private byte layerMultip=0; public float getDedx() { return dedx; } public void setDedx(float dedx) { this.dedx=dedx; } - public byte getNeutralVeto() { return neutralVeto; } + public short getClusterSize() { return clusterSize; } + public void setClusterSize(short size) { this.clusterSize=size; } + public byte getLayerMultip() { return layerMultip; } public ScintillatorResponse(){ super(); @@ -51,7 +54,8 @@ public static List readHipoEvent(DataEvent event, // CND clusters do not have path length in bar (but its hits do!): if (type == DetectorType.CND) { - response.neutralVeto = bank.getByte("veto",row); + response.clusterSize = bank.getShort("size",row); + response.layerMultip = bank.getByte("layermultip",row); } else { float dx = bank.getFloat("pathLengthThruBar",row); diff --git a/etc/bankdefs/hipo4/cnd.json b/etc/bankdefs/hipo4/cnd.json index fca525e712..b26c76090f 100644 --- a/etc/bankdefs/hipo4/cnd.json +++ b/etc/bankdefs/hipo4/cnd.json @@ -42,14 +42,13 @@ {"name":"sector", "type":"B", "info":"sector of the cluster's seed hit"}, {"name":"layer", "type":"B", "info":"layer of the cluster's seed hit"}, {"name":"component", "type":"S", "info":"component of the cluster's seed hit"}, - {"name":"nhits", "type":"S", "info":"number of hits of the cluster"}, + {"name":"size", "type":"S", "info":"number of hits of the cluster"}, {"name":"energy", "type":"F", "info":"Sum of E dep (MeV) of the hits"}, {"name":"x", "type":"F", "info":"center of X coor (cm) of the hits"}, {"name":"y", "type":"F", "info":"center of Y coor (cm) of the hits"}, {"name":"z", "type":"F", "info":"center of Z coor (cm) of the hits"}, {"name":"time", "type":"F", "info":"center of time (ns) of the hits"}, {"name":"status", "type":"S", "info":"cluster status"}, - {"name":"veto", "type":"B", "info":"charged particle veto"}, {"name":"layermultip", "type":"B", "info":"layer multiplicity"}, {"name":"layer1", "type":"B", "info":"firt layer hit"}, {"name":"layer2", "type":"B", "info":"second layer hit"}, diff --git a/reconstruction/cnd/src/main/java/org/jlab/service/cnd/CNDCalibrationEngine.java b/reconstruction/cnd/src/main/java/org/jlab/service/cnd/CNDCalibrationEngine.java index a49bb6af9d..57a4d9352c 100644 --- a/reconstruction/cnd/src/main/java/org/jlab/service/cnd/CNDCalibrationEngine.java +++ b/reconstruction/cnd/src/main/java/org/jlab/service/cnd/CNDCalibrationEngine.java @@ -175,7 +175,7 @@ public boolean processDataEvent(DataEvent event) { } for(int i =0; i< size; i++) { bank2.setShort("id",i, (short) cndclusters.get(i).get_id() ); - bank2.setShort("nhits",i, (short) cndclusters.get(i).get_nhits() ); + bank2.setShort("size",i, (short) cndclusters.get(i).get_nhits() ); bank2.setByte("sector",i, (byte)(1* cndclusters.get(i).get_sector()) ); bank2.setByte("layer",i, (byte)(1* cndclusters.get(i).get_layer()) ); bank2.setShort("component",i, (short) cndclusters.get(i).get_component() ); @@ -185,13 +185,11 @@ public boolean processDataEvent(DataEvent event) { bank2.setFloat("z",i, (float)(1.0* cndclusters.get(i).get_z()) ); bank2.setFloat("time",i, (float)(1.0* cndclusters.get(i).get_time()) ); bank2.setShort("status",i, (short) cndclusters.get(i).get_status()); - //should add here the flag from kitty's veto as - bank2.setByte("veto",i, (byte) cndclusters.get(i).get_veto() ); - //should add here the layer multiplicity - bank2.setByte("layermultip",i, (byte) cndclusters.get(i).get_layermultip() ); - bank2.setByte("layer1",i, (byte) cndclusters.get(i).get_layer1() ); - bank2.setByte("layer2",i, (byte) cndclusters.get(i).get_layer2() ); - bank2.setByte("layer3",i, (byte) cndclusters.get(i).get_layer3() ); + //should add here the layer multiplicity + bank2.setByte("layermultip",i, (byte) cndclusters.get(i).get_layermultip() ); + bank2.setByte("layer1",i, (byte) cndclusters.get(i).get_layer1() ); + bank2.setByte("layer2",i, (byte) cndclusters.get(i).get_layer2() ); + bank2.setByte("layer3",i, (byte) cndclusters.get(i).get_layer3() ); } event.appendBanks(bank2); } diff --git a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java index 0aadc6dfb3..96dd563901 100644 --- a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java +++ b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java @@ -17,7 +17,6 @@ public class EBUtil { * @param p * @return whether to veto neutrality of p * - * FIXME: magic veto bits * FIXME: move float parameters to CCDB */ public static boolean centralNeutralVeto(DetectorParticle p) { @@ -32,20 +31,20 @@ public static boolean centralNeutralVeto(DetectorParticle p) { } } else if (ctof==null) { - if ( (cnd.getNeutralVeto() & 1) == 0 ) { - return true; + if ((cnd.getEnergy()>10 && cnd.getClusterSize()<3) || (cnd.getEnergy()<=10 && cnd.getClusterSize()<4) ) { + return false; } + else return true; } else if ( ctof.getEnergy() >= 10.0 ) { return true; } - else if ( (cnd.getNeutralVeto() & (1<<1)) == 0 ) { - if ( ctof.getEnergy()+cnd.getEnergy() >= 10.0 ) { - return true; - } - else if ( (cnd.getNeutralVeto() & (1<<2) ) == 0) { - return true; + else { + if ( (cnd.getEnergy()<30 && cnd.getLayerMultip()==1) || + (cnd.getClusterSize()<3 && cnd.getLayerMultip()==2 && (cnd.getEnergy()+ctof.getEnergy())<10) ) { + return false; } + else return true; } } return false; From 214778d6db6e7630a9b76c951d79bdf332088cd8 Mon Sep 17 00:00:00 2001 From: Nathan Baltzell Date: Mon, 20 Apr 2020 18:45:08 -0400 Subject: [PATCH 33/47] make CND veto more readable --- .../clas/detector/ScintillatorResponse.java | 6 +-- .../src/main/java/org/jlab/rec/eb/EBUtil.java | 43 +++++++++++++------ 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java index ef89458e56..2894cec55c 100644 --- a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java +++ b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/ScintillatorResponse.java @@ -15,13 +15,13 @@ public class ScintillatorResponse extends DetectorResponse { private float dedx=0; private short clusterSize=0; - private byte layerMultip=0; + private byte layerMultiplicity=0; public float getDedx() { return dedx; } public void setDedx(float dedx) { this.dedx=dedx; } public short getClusterSize() { return clusterSize; } public void setClusterSize(short size) { this.clusterSize=size; } - public byte getLayerMultip() { return layerMultip; } + public byte getLayerMultiplicity() { return layerMultiplicity; } public ScintillatorResponse(){ super(); @@ -55,7 +55,7 @@ public static List readHipoEvent(DataEvent event, // CND clusters do not have path length in bar (but its hits do!): if (type == DetectorType.CND) { response.clusterSize = bank.getShort("size",row); - response.layerMultip = bank.getByte("layermultip",row); + response.layerMultiplicity = bank.getByte("layermultip",row); } else { float dx = bank.getFloat("pathLengthThruBar",row); diff --git a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java index 96dd563901..d603251d34 100644 --- a/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java +++ b/reconstruction/eb/src/main/java/org/jlab/rec/eb/EBUtil.java @@ -25,26 +25,45 @@ public static boolean centralNeutralVeto(DetectorParticle p) { ScintillatorResponse ctof=(ScintillatorResponse)p.getHit(DetectorType.CTOF); if (cnd!=null || ctof!=null) { - if (cnd==null) { - if ( ctof.getEnergy() >= 18.0 ) { + + // CTOF-only veto: + if (cnd == null) { + if (ctof.getEnergy() >= 18.0) { return true; } } - else if (ctof==null) { - if ((cnd.getEnergy()>10 && cnd.getClusterSize()<3) || (cnd.getEnergy()<=10 && cnd.getClusterSize()<4) ) { - return false; + + // CND-only veto: + else if (ctof == null) { + if (cnd.getClusterSize() > 3) { + return true; + } + else if (cnd.getClusterSize() > 2) { + if (cnd.getEnergy() > 10) { + return true; + } } - else return true; } - else if ( ctof.getEnergy() >= 10.0 ) { + + // CTOF/CND-veto: + else if (ctof.getEnergy() >= 10.0) { return true; } - else { - if ( (cnd.getEnergy()<30 && cnd.getLayerMultip()==1) || - (cnd.getClusterSize()<3 && cnd.getLayerMultip()==2 && (cnd.getEnergy()+ctof.getEnergy())<10) ) { - return false; + else if (cnd.getLayerMultiplicity()==1) { + if (cnd.getEnergy() >= 30.0) { + return true; } - else return true; + } + else if (cnd.getLayerMultiplicity()==2) { + if (cnd.getClusterSize() > 2) { + return true; + } + else if (cnd.getEnergy()+ctof.getEnergy() >= 10.0) { + return true; + } + } + else { + return true; } } return false; From 24cd3c5ceb03c72d403caa939a2c9ff83770b9d7 Mon Sep 17 00:00:00 2001 From: baltzell Date: Thu, 23 Apr 2020 15:05:21 -0400 Subject: [PATCH 34/47] add RUN::scaler rebuilder script --- bin/rebuild-scalers | 7 ++ .../analysis/postprocess/RebuildScalers.java | 103 ++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100755 bin/rebuild-scalers create mode 100644 common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/RebuildScalers.java diff --git a/bin/rebuild-scalers b/bin/rebuild-scalers new file mode 100755 index 0000000000..18e769610c --- /dev/null +++ b/bin/rebuild-scalers @@ -0,0 +1,7 @@ +#!/bin/bash + +source `dirname $0`/env.sh + +MALLOC_ARENA_MAX=1; export MALLOC_ARENA_MAX + +java -Xmx768m -Xms768m -cp "$CLAS12DIR/lib/clas/*:$CLAS12DIR/lib/services/*:$CLAS12DIR/lib/utils/*" org.jlab.analysis.postprocess.RebuildScalers $* diff --git a/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/RebuildScalers.java b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/RebuildScalers.java new file mode 100644 index 0000000000..b4e4133439 --- /dev/null +++ b/common-tools/clas-analysis/src/main/java/org/jlab/analysis/postprocess/RebuildScalers.java @@ -0,0 +1,103 @@ +package org.jlab.analysis.postprocess; + +import java.sql.Time; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import org.jlab.detector.calib.utils.ConstantsManager; +import org.jlab.detector.calib.utils.RCDBConstants; +import org.jlab.detector.decode.DaqScalers; +import org.jlab.jnp.hipo4.data.Bank; +import org.jlab.jnp.hipo4.data.Event; +import org.jlab.jnp.hipo4.io.HipoReader; +import org.jlab.jnp.hipo4.io.HipoWriterSorted; +import org.jlab.utils.groups.IndexedTable; +import org.jlab.utils.options.OptionParser; +import org.jlab.utils.system.ClasUtilsFile; + +/** + * Rebuild RUN::scaler from RAW::scaler + * + * @author baltzell + */ +public class RebuildScalers { + + static final String CCDB_FCUP_TABLE="/runcontrol/fcup"; + + public static void main(String[] args) { + + OptionParser parser = new OptionParser("rebuildscaler"); + parser.addRequired("-o","output.hipo"); + parser.parse(args); + List inputList = parser.getInputList(); + if(inputList.isEmpty()==true){ + parser.printUsage(); + System.err.println("\n >>>> error : no input file is specified....\n"); + System.exit(1); + } + + HipoWriterSorted writer = new HipoWriterSorted(); + writer.getSchemaFactory().initFromDirectory(ClasUtilsFile.getResourceDir("COATJAVA", "etc/bankdefs/hipo4")); + writer.setCompressionType(1); + writer.open(parser.getOption("-o").stringValue()); + + Event event = new Event(); + Bank rawScalerBank = new Bank(writer.getSchemaFactory().getSchema("RAW::scaler")); + Bank runScalerBank = new Bank(writer.getSchemaFactory().getSchema("RUN::scaler")); + Bank runConfigBank = new Bank(writer.getSchemaFactory().getSchema("RUN::config")); + + ConstantsManager conman = new ConstantsManager(); + conman.init(Arrays.asList(new String[]{CCDB_FCUP_TABLE})); + + for (String filename : inputList) { + + HipoReader reader = new HipoReader(); + reader.open(filename); + + RCDBConstants rcdb = null; + IndexedTable ccdb = null; + + while (reader.hasNext()) { + + // read the event and necessary banks: + reader.nextEvent(event); + event.read(runConfigBank); + event.read(runScalerBank); + event.read(rawScalerBank); + + // this is the bank we're here to rebuild: + event.remove(runScalerBank.getSchema()); + + // get CCDB/RCDB constants: + if (runConfigBank.getInt("run",0) >= 100) { + ccdb = conman.getConstants(runConfigBank.getInt("run",0),CCDB_FCUP_TABLE); + rcdb = conman.getRcdbConstants(runConfigBank.getInt("run",0)); + } + + // now rebuild the RUN::scaler bank: + if (rcdb!=null && ccdb !=null && rawScalerBank.getRows()>0) { + + // Run duration in seconds. Nasty but works, until RCDB (uses java.sql.Time) + // is changed to support full date and not just HH:MM:SS. Meanwhile just + // requires that runs last less than 24 hours. + Date uet = new Date(runConfigBank.getInt("unixtime",0)*1000L); + Time rst = rcdb.getTime("run_start_time"); + final double s1 = rst.getSeconds()+60*rst.getMinutes()+60*60*rst.getHours(); + final double s2 = uet.getSeconds()+60*uet.getMinutes()+60*60*uet.getHours(); + final double seconds = s2 Date: Sat, 18 Apr 2020 15:20:57 -0400 Subject: [PATCH 35/47] TOF cluster: prevent one hit to be associated to more than one cluster --- .../main/java/org/jlab/rec/tof/cluster/ClusterFinder.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java index 1018f38843..28a665aadb 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java @@ -23,7 +23,7 @@ public class ClusterFinder { private int maxSize = 2 ; // default set to cluster size of 2 private IndexedTable clusterPar = null; - private boolean debug = false; + private boolean debug = true; public ClusterFinder() { // TODO Auto-generated constructor stub @@ -106,6 +106,7 @@ public ArrayList findClusters(List hits2, int nsectors, int npanels, continue; } // loop over all clusters + addHitToCluster: for(int j=0; j findClusters(List hits2, int nsectors, int npanels, if(debug) System.out.println("Adding hit " + hit.get_Sector() + " " + hit.get_Panel() + " " + hit.get_Paddle() + " " + hit.get_Energy() + " " + hit.get_t() + " " + hit.get_y() + " to cluster " + cluster.get_Id()); - break; + // as soon as hit is associated to a cluster stop looping over clusters + break addHitToCluster; } } } From 98ed790cd88b5efb5109e4a7cd7557421693a6c0 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Mon, 20 Apr 2020 18:32:27 -0400 Subject: [PATCH 36/47] turning off debugging printouts in tof clustering --- .../src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java b/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java index 28a665aadb..fd46632195 100644 --- a/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java +++ b/reconstruction/tof/src/main/java/org/jlab/rec/tof/cluster/ClusterFinder.java @@ -23,7 +23,7 @@ public class ClusterFinder { private int maxSize = 2 ; // default set to cluster size of 2 private IndexedTable clusterPar = null; - private boolean debug = true; + private boolean debug = false; public ClusterFinder() { // TODO Auto-generated constructor stub From b25c03b2cce3c3a56102f81a6aa31dab388d8070 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Wed, 6 May 2020 18:08:00 -0400 Subject: [PATCH 37/47] add REC::ScintExtras bank with dE/dx and cluster info --- .../org/jlab/clas/detector/DetectorData.java | 18 ++++++++++++ .../clas/detector/ScintillatorResponse.java | 7 +++-- etc/bankdefs/hipo4/cnd.json | 2 +- etc/bankdefs/hipo4/event.json | 28 ++++++++++++++++--- .../service/cnd/CNDCalibrationEngine.java | 2 +- .../java/org/jlab/service/eb/EBEngine.java | 7 +++++ .../java/org/jlab/service/eb/EBHBEngine.java | 1 + .../java/org/jlab/service/eb/EBTBEngine.java | 1 + .../advanced-tests/src/eb/EBTwoTrackTest.java | 2 +- 9 files changed, 59 insertions(+), 9 deletions(-) diff --git a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorData.java b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorData.java index e6ec1529d1..e9dafb2379 100644 --- a/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorData.java +++ b/common-tools/clas-reco/src/main/java/org/jlab/clas/detector/DetectorData.java @@ -281,7 +281,25 @@ public static DataBank getScintillatorResponseBank(List respon bank.setFloat("energy", row, (float) r.getEnergy()); bank.setFloat("chi2", row, (float) 0.0); bank.setShort("status",row,(short) r.getStatus()); + row++; + } + } + return bank; + } + + public static DataBank getScintExtrasResponseBank(List responses, DataEvent event, String bank_name){ + int nrows=0; + for(int iresp=0; iresp readHipoEvent(DataEvent event, float dx = bank.getFloat("pathLengthThruBar",row); if (dx>0) response.setDedx(bank.getFloat("energy", row)/dx); } - else if (type == DetectorType.CND) { + if (type == DetectorType.CTOF) { response.clusterSize = bank.getShort("size",row); - response.layerMultiplicity = bank.getByte("layermultip",row); + } + if (type == DetectorType.CND) { + response.clusterSize = bank.getShort("size",row); + response.layerMultiplicity = bank.getByte("layermult",row); } responseList.add(response); diff --git a/etc/bankdefs/hipo4/cnd.json b/etc/bankdefs/hipo4/cnd.json index b26c76090f..1471d36496 100644 --- a/etc/bankdefs/hipo4/cnd.json +++ b/etc/bankdefs/hipo4/cnd.json @@ -49,7 +49,7 @@ {"name":"z", "type":"F", "info":"center of Z coor (cm) of the hits"}, {"name":"time", "type":"F", "info":"center of time (ns) of the hits"}, {"name":"status", "type":"S", "info":"cluster status"}, - {"name":"layermultip", "type":"B", "info":"layer multiplicity"}, + {"name":"layermult", "type":"B", "info":"layer multiplicity"}, {"name":"layer1", "type":"B", "info":"firt layer hit"}, {"name":"layer2", "type":"B", "info":"second layer hit"}, {"name":"layer3", "type":"B", "info":"third layer hit"} diff --git a/etc/bankdefs/hipo4/event.json b/etc/bankdefs/hipo4/event.json index b338e0a6f7..b333096af3 100644 --- a/etc/bankdefs/hipo4/event.json +++ b/etc/bankdefs/hipo4/event.json @@ -140,8 +140,18 @@ {"name":"hx", "type":"F", "info":"X coordinate of the matched hit (cm)"}, {"name":"hy", "type":"F", "info":"Y coordinate of the mathced hit (cm)"}, {"name":"hz", "type":"F", "info":"Z coordinate of the matched hit (cm)"}, - {"name":"status", "type":"S", "info":"hit status"}, - {"name":"dedx", "type":"F", "info":"Energy deposition per distance travelled (MeV/cm)"} + {"name":"status", "type":"S", "info":"hit status"} + ] + }, + { + "name": "RECHB::ScintExtras", + "group": 300, + "item" : 23, + "info": "Scintillator Cluster Parameters", + "entries": [ + {"name":"dedx", "type":"F", "info":"Energy deposition per distance travelled (MeV/cm)"}, + {"name":"size", "type":"S", "info":"cluster size"}, + {"name":"layermult","type":"B", "info":"cluster layer multiplicity"} ] }, { @@ -321,8 +331,18 @@ {"name":"hx", "type":"F", "info":"X coordinate of the matched hit (cm)"}, {"name":"hy", "type":"F", "info":"Y coordinate of the mathced hit (cm)"}, {"name":"hz", "type":"F", "info":"Z coordinate of the matched hit (cm)"}, - {"name":"status", "type":"S", "info":"hit status"}, - {"name":"dedx", "type":"F", "info":"Energy deposition per distance travelled (MeV/cm)"} + {"name":"status", "type":"S", "info":"hit status"} + ] + }, + { + "name": "REC::ScintExtras", + "group": 300, + "item" : 43, + "info": "Scintillator Cluster Parameters", + "entries": [ + {"name":"dedx", "type":"F", "info":"Energy deposition per distance travelled (MeV/cm)"}, + {"name":"size", "type":"S", "info":"cluster size"}, + {"name":"layermult","type":"B", "info":"cluster layer multiplicity"} ] }, { diff --git a/reconstruction/cnd/src/main/java/org/jlab/service/cnd/CNDCalibrationEngine.java b/reconstruction/cnd/src/main/java/org/jlab/service/cnd/CNDCalibrationEngine.java index 57a4d9352c..f968b002b6 100644 --- a/reconstruction/cnd/src/main/java/org/jlab/service/cnd/CNDCalibrationEngine.java +++ b/reconstruction/cnd/src/main/java/org/jlab/service/cnd/CNDCalibrationEngine.java @@ -186,7 +186,7 @@ public boolean processDataEvent(DataEvent event) { bank2.setFloat("time",i, (float)(1.0* cndclusters.get(i).get_time()) ); bank2.setShort("status",i, (short) cndclusters.get(i).get_status()); //should add here the layer multiplicity - bank2.setByte("layermultip",i, (byte) cndclusters.get(i).get_layermultip() ); + bank2.setByte("layermult",i, (byte) cndclusters.get(i).get_layermultip() ); bank2.setByte("layer1",i, (byte) cndclusters.get(i).get_layer1() ); bank2.setByte("layer2",i, (byte) cndclusters.get(i).get_layer2() ); bank2.setByte("layer3",i, (byte) cndclusters.get(i).get_layer3() ); diff --git a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java index 1a33387077..2904b831ff 100644 --- a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java +++ b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBEngine.java @@ -32,6 +32,7 @@ public class EBEngine extends ReconstructionEngine { String particleBankFT = null; String calorimeterBank = null; String scintillatorBank = null; + String scintextrasBank = null; String cherenkovBank = null; String trackBank = null; String crossBank = null; @@ -165,6 +166,8 @@ public boolean processDataEvent(DataEvent de,EBScalers ebs) { if(scintillatorBank!=null && scintillators.size()>0) { DataBank bankSci = DetectorData.getScintillatorResponseBank(scintillators, de, scintillatorBank); de.appendBanks(bankSci); + DataBank eaxtbankSci = DetectorData.getScintExtrasResponseBank(scintillators, de, scintextrasBank); + de.appendBanks(eaxtbankSci); } List cherenkovs = eb.getEvent().getCherenkovResponseList(); if(cherenkovBank!=null && cherenkovs.size()>0) { @@ -229,6 +232,10 @@ public void setScintillatorBank(String scintillatorBank) { this.scintillatorBank = scintillatorBank; } + public void setScintClusterBank(String scintclusterBank) { + this.scintextrasBank = scintclusterBank; + } + public void setCherenkovBank(String cherenkovBank) { this.cherenkovBank = cherenkovBank; } diff --git a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBHBEngine.java b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBHBEngine.java index ba460f9e90..8eee67cab9 100644 --- a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBHBEngine.java +++ b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBHBEngine.java @@ -29,6 +29,7 @@ public void initBankNames() { this.setCalorimeterBank("RECHB::Calorimeter"); this.setCherenkovBank("RECHB::Cherenkov"); this.setScintillatorBank("RECHB::Scintillator"); + this.setScintClusterBank("RECHB::ScintExtras"); this.setTrackBank("RECHB::Track"); this.setCrossBank("RECHB::TrackCross"); this.setTrackType("HitBasedTrkg::HBTracks"); diff --git a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBTBEngine.java b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBTBEngine.java index 2e95035b5d..567762488d 100644 --- a/reconstruction/eb/src/main/java/org/jlab/service/eb/EBTBEngine.java +++ b/reconstruction/eb/src/main/java/org/jlab/service/eb/EBTBEngine.java @@ -31,6 +31,7 @@ public void initBankNames() { this.setCalorimeterBank("REC::Calorimeter"); this.setCherenkovBank("REC::Cherenkov"); this.setScintillatorBank("REC::Scintillator"); + this.setScintClusterBank("REC::ScintExtras"); this.setTrackBank("REC::Track"); this.setCrossBank("REC::TrackCross"); this.setCovMatrixBank("REC::CovMat"); diff --git a/validation/advanced-tests/src/eb/EBTwoTrackTest.java b/validation/advanced-tests/src/eb/EBTwoTrackTest.java index 0d13051307..f3b8e41a9c 100644 --- a/validation/advanced-tests/src/eb/EBTwoTrackTest.java +++ b/validation/advanced-tests/src/eb/EBTwoTrackTest.java @@ -457,7 +457,7 @@ private void checkResults() { else assertEquals(kEff>0.60,true); break; case 211: - if (isCentral) assertEquals(piEff>0.75,true); + if (isCentral) assertEquals(piEff>0.72,true); else assertEquals(piEff>0.75,true); break; case 22: From 89ac98082ea766667eb981bcbe61f2af49daa824 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Sun, 10 May 2020 19:32:43 -0400 Subject: [PATCH 38/47] SwimToBoundayPlane: removing check on track vertex --- .../java/org/jlab/clas/swimtools/Swim.java | 63 ++++++------------- 1 file changed, 18 insertions(+), 45 deletions(-) diff --git a/common-tools/swim-tools/src/main/java/org/jlab/clas/swimtools/Swim.java b/common-tools/swim-tools/src/main/java/org/jlab/clas/swimtools/Swim.java index db7149ca84..4d146ee87b 100644 --- a/common-tools/swim-tools/src/main/java/org/jlab/clas/swimtools/Swim.java +++ b/common-tools/swim-tools/src/main/java/org/jlab/clas/swimtools/Swim.java @@ -601,56 +601,29 @@ public double[] SwimToPlaneBoundary(double d_cm, Vector3D n, int dir) { SwimTrajectory st; try { - // swim backwards? - double vertexR = Math.sqrt(_x0 * _x0 + _y0 * _y0 + _z0 * _z0); - if ((vertexR > d) && (dir > 0)) { - - //trying to swim forward, but already beyond the plane. Just return the starting values - double thetaRad = Math.toRadians(_theta); - double phiRad = Math.toRadians(_phi); - double pz = _pTot * Math.cos(thetaRad); - double pperp = _pTot * Math.sin(thetaRad); - double px = pperp * Math.cos(phiRad); - double py = pperp * Math.sin(phiRad); - - value[0] = _x0 * 100; // convert back to cm - value[1] = _y0 * 100; // convert back to cm - value[2] = _z0 * 100; // convert back to cm - - value[3] = px; - value[4] = py; - value[5] = pz; - value[6] = 0; - value[7] = 0; - - return value; + st = PC.CF.swim(_charge, _x0, _y0, _z0, _pTot, _theta, _phi, plane, accuracy, _maxPathLength, stepSize, + cnuphys.swim.Swimmer.CLAS_Tolerance, hdata); - } - - else { - st = PC.CF.swim(_charge, _x0, _y0, _z0, _pTot, _theta, _phi, plane, accuracy, _maxPathLength, stepSize, - cnuphys.swim.Swimmer.CLAS_Tolerance, hdata); - - st.computeBDL(PC.CP); + st.computeBDL(PC.CP); - double[] lastY = st.lastElement(); + double[] lastY = st.lastElement(); - value[0] = lastY[0] * 100; // convert back to cm - value[1] = lastY[1] * 100; // convert back to cm - value[2] = lastY[2] * 100; // convert back to cm - value[3] = lastY[3] * _pTot; // normalized values - value[4] = lastY[4] * _pTot; - value[5] = lastY[5] * _pTot; - value[6] = lastY[6] * 100; - value[7] = lastY[7] * 10; // Conversion from kG.m to T.cm + value[0] = lastY[0] * 100; // convert back to cm + value[1] = lastY[1] * 100; // convert back to cm + value[2] = lastY[2] * 100; // convert back to cm + value[3] = lastY[3] * _pTot; // normalized values + value[4] = lastY[4] * _pTot; + value[5] = lastY[5] * _pTot; + value[6] = lastY[6] * 100; + value[7] = lastY[7] * 10; // Conversion from kG.m to T.cm - // System.out.println("\nCOMPARE plane swims DIRECTION = " + - // dir); - // for (int i = 0; i < 8; i++) { - // System.out.print(String.format("%-8.5f ", value[i])); - // } + // System.out.println("\nCOMPARE plane swims DIRECTION = " + + // dir); + // for (int i = 0; i < 8; i++) { + // System.out.print(String.format("%-8.5f ", value[i])); + // } - } + } catch (RungeKuttaException e) { e.printStackTrace(); } From 8d32e3c8a7df0e4a69a8879566ae6902cd38d205 Mon Sep 17 00:00:00 2001 From: Raffaella De Vita Date: Sun, 10 May 2020 19:35:59 -0400 Subject: [PATCH 39/47] version bump --- common-tools/clas-analysis/pom.xml | 14 +++++++------- common-tools/clas-detector/pom.xml | 10 +++++----- common-tools/clas-eventmerger/pom.xml | 10 +++++----- common-tools/clas-geometry/pom.xml | 4 ++-- common-tools/clas-io/pom.xml | 6 +++--- common-tools/clas-jcsg/pom.xml | 8 ++++---- common-tools/clas-math/pom.xml | 4 ++-- common-tools/clas-physics/pom.xml | 4 ++-- common-tools/clas-reco/pom.xml | 14 +++++++------- common-tools/clas-utils/pom.xml | 4 ++-- common-tools/cnuphys/ced/pom.xml | 8 ++++---- common-tools/cnuphys/magfield/pom.xml | 2 +- common-tools/cnuphys/swimmer/pom.xml | 2 +- common-tools/coat-lib/deployDistribution.sh | 2 +- common-tools/coat-lib/pom.xml | 20 ++++++++++---------- common-tools/parent/pom.xml | 2 +- common-tools/pom.xml | 4 ++-- common-tools/swim-tools/pom.xml | 6 +++--- parent/pom.xml | 2 +- pom.xml | 4 ++-- reconstruction/band/pom.xml | 2 +- reconstruction/cnd/pom.xml | 2 +- reconstruction/cvt/pom.xml | 10 +++++----- reconstruction/dc/pom.xml | 12 ++++++------ reconstruction/eb/pom.xml | 10 +++++----- reconstruction/ec/pom.xml | 14 +++++++------- reconstruction/ft/pom.xml | 8 ++++---- reconstruction/fvt/pom.xml | 6 +++--- reconstruction/htcc/pom.xml | 8 ++++---- reconstruction/ltcc/pom.xml | 6 +++--- reconstruction/pom.xml | 4 ++-- reconstruction/rich/pom.xml | 8 ++++---- reconstruction/rtpc/pom.xml | 6 +++--- reconstruction/tof/pom.xml | 4 ++-- 34 files changed, 115 insertions(+), 115 deletions(-) diff --git a/common-tools/clas-analysis/pom.xml b/common-tools/clas-analysis/pom.xml index 5084834e49..67e84ee857 100644 --- a/common-tools/clas-analysis/pom.xml +++ b/common-tools/clas-analysis/pom.xml @@ -3,14 +3,14 @@ 4.0.0 org.jlab.clas clas-analysis - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT jar org.jlab.clas clas12rec ../../parent/pom.xml - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT @@ -30,31 +30,31 @@ org.jlab.clas clas-utils - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT org.jlab.clas clas-physics - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT org.jlab.clas clas-io - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT org.jlab.clas clas-geometry - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT org.jlab.clas clas-detector - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT diff --git a/common-tools/clas-detector/pom.xml b/common-tools/clas-detector/pom.xml index 70d0c9216f..9c9214a672 100644 --- a/common-tools/clas-detector/pom.xml +++ b/common-tools/clas-detector/pom.xml @@ -3,14 +3,14 @@ 4.0.0 org.jlab.clas clas-detector - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT jar org.jlab.clas clas12rec ../../parent/pom.xml - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT @@ -30,7 +30,7 @@ org.jlab.clas clas-utils - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT @@ -42,13 +42,13 @@ org.jlab.clas clas-io - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT org.jlab.clas clas-geometry - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT diff --git a/common-tools/clas-eventmerger/pom.xml b/common-tools/clas-eventmerger/pom.xml index e241ff73b1..f7947fa335 100644 --- a/common-tools/clas-eventmerger/pom.xml +++ b/common-tools/clas-eventmerger/pom.xml @@ -2,14 +2,14 @@ 4.0.0 clas-eventmerger - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT jar org.jlab.clas clas12rec ../../parent/pom.xml - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT @@ -29,19 +29,19 @@ org.jlab.clas clas-utils - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT org.jlab.clas clas-io - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT org.jlab.clas clas-geometry - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT diff --git a/common-tools/clas-geometry/pom.xml b/common-tools/clas-geometry/pom.xml index 526777c603..220af4f96a 100644 --- a/common-tools/clas-geometry/pom.xml +++ b/common-tools/clas-geometry/pom.xml @@ -3,14 +3,14 @@ 4.0.0 org.jlab.clas clas-geometry - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT jar org.jlab.clas clas12rec ../../parent/pom.xml - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT diff --git a/common-tools/clas-io/pom.xml b/common-tools/clas-io/pom.xml index c5053b4df5..0aa1f63ad4 100644 --- a/common-tools/clas-io/pom.xml +++ b/common-tools/clas-io/pom.xml @@ -3,14 +3,14 @@ 4.0.0 org.jlab.clas clas-io - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT jar org.jlab.clas clas12rec ../../parent/pom.xml - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT @@ -75,7 +75,7 @@ org.jlab.clas clas-utils - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT diff --git a/common-tools/clas-jcsg/pom.xml b/common-tools/clas-jcsg/pom.xml index 656e33385a..cc6696ffe0 100644 --- a/common-tools/clas-jcsg/pom.xml +++ b/common-tools/clas-jcsg/pom.xml @@ -3,14 +3,14 @@ 4.0.0 org.jlab.clas clas-jcsg - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT jar org.jlab.clas clas12rec ../../parent/pom.xml - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT @@ -40,12 +40,12 @@ org.jlab.clas clas-geometry - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT org.jlab.clas clas-detector - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT java3d diff --git a/common-tools/clas-math/pom.xml b/common-tools/clas-math/pom.xml index 790940f672..7536b3b171 100644 --- a/common-tools/clas-math/pom.xml +++ b/common-tools/clas-math/pom.xml @@ -3,14 +3,14 @@ 4.0.0 org.jlab.clas clas-math - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT jar org.jlab.clas clas12rec ../../parent/pom.xml - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT diff --git a/common-tools/clas-physics/pom.xml b/common-tools/clas-physics/pom.xml index 80cf6f5d5a..6f80e22e6b 100644 --- a/common-tools/clas-physics/pom.xml +++ b/common-tools/clas-physics/pom.xml @@ -4,7 +4,7 @@ org.jlab.clas clas-physics - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT jar @@ -23,7 +23,7 @@ org.jlab.clas clas12rec ../../parent/pom.xml - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT diff --git a/common-tools/clas-reco/pom.xml b/common-tools/clas-reco/pom.xml index b2de69f536..fb424a285e 100644 --- a/common-tools/clas-reco/pom.xml +++ b/common-tools/clas-reco/pom.xml @@ -3,14 +3,14 @@ 4.0.0 org.jlab.clas clas-reco - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT jar org.jlab.clas clas12rec ../../parent/pom.xml - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT @@ -67,7 +67,7 @@ org.jlab.clas clas-math - 6c.5.4-SNAPSHOT + 6c.5.7-SNAPSHOT