Skip to content
This repository has been archived by the owner on May 18, 2023. It is now read-only.

updates to DCRB jitter correction and yamls #953

Merged
merged 11 commits into from
Sep 29, 2022
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,6 @@ public List<DetectorDataDgtz> getDataEntries_57622(Integer crate, EvioNode node
Byte slot = (Byte) cdataitems.get(position);
//Integer trig = (Integer) cdataitems.get(position+1);
Long time = (Long) cdataitems.get(position+2);
// swap first and second 24 bits
Long ts = (Long) (((time&0x0000ffffff000000L)>>24)|((time&0x0000000000ffffffL)<<24));
Integer nchannels = (Integer) cdataitems.get(position+3);
int counter = 0;
position = position + 4;
Expand All @@ -941,7 +939,7 @@ public List<DetectorDataDgtz> getDataEntries_57622(Integer crate, EvioNode node
counter++;
DetectorDataDgtz entry = new DetectorDataDgtz(crate,slot,channel);
entry.addTDC(new TDCData(tdc));
entry.setTimeStamp(ts);
entry.setTimeStamp(time);
entries.add(entry);
}
}
Expand Down
11 changes: 2 additions & 9 deletions etc/services/data-ai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ services:
name: RTPC
configuration:
global:
variation: rga_fall2018
variation: rgb_spring2019
# timestamp: 12/31/2020-00:00:00
io-services:
writer:
Expand All @@ -73,15 +73,8 @@ configuration:
MAGFIELDS:
magfieldSolenoidMap: Symm_solenoid_r601_phi1_z1201_13June2018.dat
magfieldTorusMap: Full_torus_r251_phi181_z251_25Jan2021.dat
DCCR:
dcWireDistortion: "true"
DCHAI:
dcWireDistortion: "true"
outputBankPrefix: "HB"
DCTB:
dcWireDistortion: "true"
MLTD:
run: "5038"
run: "6302"

mime-types:
- binary/data-hipo
12 changes: 2 additions & 10 deletions etc/services/data-aicv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ services:
name: RTPC
configuration:
global:
variation: rga_fall2018
variation: rgb_spring2019
# timestamp: 12/31/2020-00:00:00
io-services:
writer:
Expand All @@ -84,20 +84,12 @@ configuration:
MAGFIELDS:
magfieldSolenoidMap: Symm_solenoid_r601_phi1_z1201_13June2018.dat
magfieldTorusMap: Full_torus_r251_phi181_z251_25Jan2021.dat
DCCR:
dcWireDistortion: "true"
DCHB:
dcWireDistortion: "true"
DCHAI:
dcWireDistortion: "true"
outputBankPrefix: "AI"
DCTB:
dcWireDistortion: "true"
DCTAI:
dcWireDistortion: "true"
outputBankPrefix: "AI"
MLTD:
run: "5038"
run: "6302"
EBTAI:
outputBankPrefix: "RECAI"

Expand Down
10 changes: 2 additions & 8 deletions etc/services/data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ services:
name: RTPC
configuration:
global:
variation: rga_fall2018
variation: rgb_spring2019
# timestamp: 12/31/2020-00:00:00
# triggerMask: "0x1"
io-services:
Expand All @@ -72,12 +72,6 @@ configuration:
MAGFIELDS:
magfieldSolenoidMap: Symm_solenoid_r601_phi1_z1201_13June2018.dat
magfieldTorusMap: Full_torus_r251_phi181_z251_25Jan2021.dat
DCCR:
dcWireDistortion: "true"
DCHB:
dcWireDistortion: "true"
DCTB:
dcWireDistortion: "true"


mime-types:
- binary/data-hipo
2 changes: 1 addition & 1 deletion etc/services/dcalign.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ services:
name: RTPC
configuration:
global:
variation: rga_fall2018
variation: rgb_spring2019
# timestamp: 12/31/2020-00:00:00
io-services:
writer:
Expand Down
2 changes: 1 addition & 1 deletion etc/services/kpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ configuration:
# EBTB:
# variation: default
# timestamp: 08/22/2018
DCRC:
DCCR:
dcT2DFunc: "Exponential"
DCHB:
dcT2DFunc: "Exponential"
Expand Down
24 changes: 24 additions & 0 deletions reconstruction/dc/src/main/java/org/jlab/rec/dc/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public static Constants getInstance() {
private boolean CHECKBETA = false;
private int T2D = 1; // 1=polynomial, 0=exponential
private boolean USEDOUBLETS = false;
private boolean DCRBJITTER = false;
private boolean SWAPDCRBBITS = false;

// DATABASE TABLES
public static final String TT = "/daq/tt/dc";
Expand Down Expand Up @@ -311,6 +313,22 @@ public boolean USEDOUBLETS() {
public void setUSEDOUBLETS(boolean USEDOUBLETS) {
this.USEDOUBLETS = USEDOUBLETS;
}

public boolean useDCRBJITTER() {
return DCRBJITTER;
}

public void setDCRBJITTER(boolean DCRBJITTER) {
this.DCRBJITTER = DCRBJITTER;
}

public boolean isSWAPDCRBBITS() {
return SWAPDCRBBITS;
}

public void setSWAPDCRBBITS(boolean SWAPDCRBBITS) {
this.SWAPDCRBBITS = SWAPDCRBBITS;
}

public synchronized void initialize(String engine,
String variation,
Expand All @@ -319,6 +337,8 @@ public synchronized void initialize(String engine,
boolean useBetaCut,
int t2d,
boolean useDoublets,
boolean dcrbJitter,
boolean swapDCRBBits,
int nSuperLayer,
int selectedSector,
double[][] shifts) {
Expand All @@ -332,6 +352,8 @@ public synchronized void initialize(String engine,
CHECKBETA = useBetaCut;
T2D = t2d;
USEDOUBLETS = useDoublets;
DCRBJITTER = dcrbJitter;
SWAPDCRBBITS = swapDCRBBits;
NSUPERLAYERTRACKING = nSuperLayer;
SECTORSELECT = selectedSector;

Expand Down Expand Up @@ -367,6 +389,8 @@ public void printConfig(String engine) {
LOGGER.log(Level.INFO, "["+engine+"] run with with Beta cut = " + CHECKBETA);
LOGGER.log(Level.INFO, "["+engine+"] run with time to distance function set to exponential/polynomial (0/1) = " + T2D);
LOGGER.log(Level.INFO, "["+engine+"] run with with hit doublets recovery = " + USEDOUBLETS);
LOGGER.log(Level.INFO, "["+engine+"] run with with DCRB jitter correction = " + SWAPDCRBBITS);
LOGGER.log(Level.INFO, "["+engine+"] run with with DCRB timestamp bit swap = " + SWAPDCRBBITS);
LOGGER.log(Level.INFO, "["+engine+"] run with with Five-out-of-six-superlayer-trkg = " + NSUPERLAYERTRACKING);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private int getTIJitter() {
return jitter;
}

private void getDCRBJitters() {
private void getDCRBJitters(boolean swapBits) {

if(tiTimeStamp>=0 && event.hasBank(bankNames.getTimeStampBank())) {

Expand All @@ -163,6 +163,9 @@ private void getDCRBJitters() {
int crate = bankTS.getByte("crate", i);
int slot = bankTS.getByte("slot", i);
long timestamp = bankTS.getLong("timestamp", i);
if(swapBits) {
timestamp = (Long) (((timestamp&0x0000ffffff000000L)>>24)|((timestamp&0x0000000000ffffffL)<<24));
}
int jitter = (int) (tiTimeStamp-(2*timestamp-4))*4;
dcrbjitters.addEntry(crate, slot);
dcrbjitters.setIntValue(jitter, "jitter", crate, slot);
Expand All @@ -188,6 +191,14 @@ private int getDCRBJitter(int sector, int layer, int wire, int order) {
return jitter;
}

private int getJitter(int sector, int layer, int wire, int order) {
int jitter = this.getTIJitter(); // use TI jitter correction by default, but replace with DCRB correction if available
if(Constants.getInstance().useDCRBJITTER() && dcrbjitters!=null && reverseTT!=null) {
jitter = this.getDCRBJitter(sector, layer, wire, order);
}
return jitter;
}

public void fetch_DCHits(DataEvent event, Clas12NoiseAnalysis noiseAnalysis,
NoiseReductionParameters parameters,
Clas12NoiseResult results) {
Expand Down Expand Up @@ -217,7 +228,7 @@ private void fetch_DCHits(Clas12NoiseAnalysis noiseAnalysis,
return;
}

this.getDCRBJitters();
this.getDCRBJitters(Constants.getInstance().isSWAPDCRBBITS());

DataBank bankDGTZ = event.getBank(bankNames.getTdcBank());

Expand All @@ -237,13 +248,8 @@ private void fetch_DCHits(Clas12NoiseAnalysis noiseAnalysis,
superlayer[i] = (bankDGTZ.getByte("layer", i)-1)/6 + 1;
wire[i] = bankDGTZ.getShort("component", i);
order[i] = bankDGTZ.getByte("order", i);
tdc[i] = bankDGTZ.getInt("TDC", i);
jitter[i] = this.getTIJitter(); // use TI jitter correction by default, but replace with DCRB correction if available
if(dcrbjitters!=null && reverseTT!=null) {
jitter[i] = this.getDCRBJitter(sector[i], bankDGTZ.getByte("layer", i), wire[i], order[i]);
// if(jitter[i]!=-4*bankDGTZ.getByte("order", i)) System.out.println(jitter[i] + " " + -4*bankDGTZ.getByte("order", i));
}
tdc[i] -= jitter[i];
jitter[i] = this.getJitter(sector[i], bankDGTZ.getByte("layer", i), wire[i], order[i]);
tdc[i] = bankDGTZ.getInt("TDC", i) - jitter[i];
}


Expand Down
15 changes: 13 additions & 2 deletions reconstruction/dc/src/main/java/org/jlab/service/dc/DCEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.jlab.io.base.DataEvent;
import org.jlab.rec.dc.Constants;
import org.jlab.rec.dc.banks.Banks;
import org.jlab.utils.groups.IndexedTable;

public class DCEngine extends ReconstructionEngine {

Expand All @@ -21,7 +20,9 @@ public class DCEngine extends ReconstructionEngine {
private boolean wireDistortion = false;
private boolean useStartTime = true;
private boolean useBetaCut = false;
private boolean useDoublets = false;
private boolean useDoublets = true;
private boolean dcrbJitter = false;
private boolean swapDCRBBits = false;
private int t2d = 1;
private int nSuperLayer = 5;
private String geoVariation = "default";
Expand Down Expand Up @@ -72,6 +73,14 @@ else if(this.getEngineConfigString("dcT2DFunc").equalsIgnoreCase("Polynomial"))
if(this.getEngineConfigString("dcDoublets")!=null)
useDoublets = Boolean.valueOf(this.getEngineConfigString("dcDoublets"));

//Apply the jitter correction based on DCRB timestamps
if(this.getEngineConfigString("dcrbJitter")!=null)
dcrbJitter = Boolean.valueOf(this.getEngineConfigString("dcrbJitter"));

//Swap DCRB timestamp bits
if(this.getEngineConfigString("swapDCRBBits")!=null)
swapDCRBBits = Boolean.valueOf(this.getEngineConfigString("swapDCRBBits"));

//NSUPERLAYERTRACKING
if(this.getEngineConfigString("dcFOOST")!=null)
if(!Boolean.valueOf(this.getEngineConfigString("dcFOOST"))) {
Expand Down Expand Up @@ -139,6 +148,8 @@ public boolean init() {
useBetaCut,
t2d,
useDoublets,
dcrbJitter,
swapDCRBBits,
nSuperLayer,
selectedSector,
shifts);
Expand Down