Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ public void add(DaqScaler other) {
protected void calibrate(IndexedTable fcupTable,IndexedTable slmTable,double seconds,double liveSeconds) {

if (this.clock > 0) {

String prefix = String.format("clockbug [%s]", this.getClass().getSimpleName());
if(Math.abs(this.clockFreq - ((1e6)+1)) < 0.1)
System.err.println(String.format("%s: used hard-coded clockFreq from Dsc2Scaler(bank,table,table,seconds)", prefix));
else if(Math.abs(this.clockFreq - ((1e6)+2)) < 0.1)
System.err.println(String.format("%s: used hard-coded clockFreq from StruckScaler()", prefix));
else if(Math.abs(this.clockFreq - ((1e6)+3)) < 0.1)
System.err.println(String.format("%s: used hard-coded clockFreq from StruckScaler(table,table,table)", prefix));
else
System.err.println(String.format("%s: clockFreq OK (value=%f)", prefix, this.clockFreq));
System.err.println(String.format("%s: %s", prefix, this.toString()));

final double fcup_slope = fcupTable.getDoubleValue("slope",0,0,0); // Hz/nA
final double fcup_offset = fcupTable.getDoubleValue("offset",0,0,0); // Hz
final double fcup_atten = fcupTable.getDoubleValue("atten",0,0,0); // attenuation
Expand All @@ -97,6 +109,7 @@ protected void calibrate(IndexedTable fcupTable,IndexedTable slmTable,double sec
this.beamCharge = q * fcup_atten / fcup_slope;
this.beamChargeGated = qg * fcup_atten / fcup_slope;
}
System.err.println(String.format("%s: beamCharge=%f beamChargeGated=%f", prefix, this.beamCharge, this.beamChargeGated));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public Dsc2Scaler() {}
* @param seconds dwell time, provided in case the clock rolls over
*/
public Dsc2Scaler(Bank bank, IndexedTable fcupTable, IndexedTable slmTable, double seconds) {
this.clockFreq=1e6;
this.clockFreq=(1e6)+1;
this.read(bank);
this.calibrate(fcupTable,slmTable,seconds);
}
Expand Down Expand Up @@ -110,4 +110,4 @@ public final void read(Bank bank) {
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public final Interval getStableInterval(Bank bank, IndexedTable helTable) {
}

public StruckScaler() {
this.clockFreq = 1e6;
this.clockFreq = (1e6)+2;
}

/**
Expand All @@ -178,7 +178,7 @@ public StruckScaler() {
public StruckScaler(Bank bank,IndexedTable fcupTable, IndexedTable slmTable, IndexedTable helTable) {

// the STRUCK's clock is 1 MHz
this.clockFreq = 1e6;
this.clockFreq = (1e6)+3;

// Here we're going to assume the stable period is the same Struck
// period throughout a single readout. Almost always correct ...
Expand Down Expand Up @@ -239,4 +239,4 @@ else if (Input.equals(Input.CLOCK, chan)) {

this.calibrate(fcupTable,slmTable);
}
}
}