|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecticecube.daq.domcal.Calibrator
public class Calibrator
DOM calibration class. This class makes the XML calibration files produced
by the domcal
calibrator accessible to Java-enabled programs.
It parses the XML into a DOM tree and strips the information from there
producing a class with accessor methods to obtain the constants.
Typical usage for this class involves constructing a Calibrator class
from the *.xdc
files emitted by the domcal
. This
can be done either from a local file or from a URI:
... Calibrator cal = new Calibrator(new URL("http://the.domcal.net/kool.xdc")) ...then you can use the various methods to access the calibration info. Consult these Javadocs. The most useful function is probably
atwdCalibrate
- it will take a raw ATWD vector and
turn it into a voltage waveform. Best used in conjunction with
calcAtwdFreq, e.g.:
... // f is in [MHz] double f = cal.calcAtwdFreq(850, 0); double[] t = new double[128]; double[] w, v = cal.atwdCalibrate(atwd_raw, 0, 0); // reverse and subtract off the FE bias and divide by // amplifier to get signal at the FE input for (int i = 0; i < 128; i++) { t[i] = i / (freq*1.E+06); w[i] = (v[128-i]-frontend_bias)/cal.getAmplifierGain(0); }
Constructor Summary | |
---|---|
Calibrator(java.io.InputStream is)
Constructor from initialized InputStream object. |
|
Calibrator(java.io.InputStream is,
CalibratorDB calDB)
Constructor from initialized InputStream object. |
|
Calibrator(java.lang.String mbSerial,
java.util.Date date,
double temp)
Load calibration data from the database. |
|
Calibrator(java.lang.String mbSerial,
java.util.Date date,
double temp,
CalibratorDB calDB)
Load calibration data from the database. |
|
Calibrator(java.net.URL calfile)
Constructor to obtain from URL location. |
Method Summary | |
---|---|
double[] |
atwdCalibrate(short[] atwdin,
int ch,
int offset)
Calibrate raw ATWD counts passed in array atwdin to calibrated volts. |
double[] |
atwdCalibrateToPmtSig(short[] atwdin,
int ch,
int offset,
int biasDAC)
Reconstruct PMT signal given an ATWD array and a bias DAC setting. |
double[] |
atwdCalibrateToPmtSig(short[] atwdin,
int ch,
int offset,
int biasDAC,
int hv)
Reconstruct PMT signal given an ATWD array and a bias DAC setting. |
short[] |
atwdDecalibrate(double[] v,
int ch,
int offset)
Perform inverse calibration to get back to raw quantities. |
double |
calcAtwdFreq(int dac,
int chip)
Find the ATWD frequency corresponding to a given DAC value. |
double |
calcVoltageFromGain(double gain)
Find the voltage required for specified gain. |
void |
close()
Close all open threads, file handles, database connections, etc. |
double[] |
domtestAtwdCalibrate(double[] domtestAtwdIn,
int iChannel)
Method to calibrate domtest-format, pedestalpattern-subtracted and baseline-subtracted input arrays containing raw data into a pulse in units of Volts. |
double[] |
domtestAtwdCalibrate(int[] domtestAtwdIn,
int iChannel)
Method to calibrate domtest-format, pedestalpattern-subtracted and baseline-subtracted input arrays containing raw data into a pulse in units of Volts. |
double[] |
domtestAtwdCalibrate(short[] domtestAtwdIn,
int iChannel)
Method to calibrate domtest-format, pedestalpattern-subtracted and baseline-subtracted input arrays containing raw data into a pulse in units of Volts. |
double[] |
fadcCalibrate(short[] fadcin,
int fadcDAC)
Calibrate the FADC to voltage given an FADC front-end bias DAC setting. |
int |
getADC(int ch)
Return ADC readback values. |
double |
getAmplifierGain(int ch)
Obtain the front end amplifier gains. |
double |
getAmplifierGainError(int ch)
Obtain error estimate on the amplifier gain. |
java.util.Iterator |
getATWDFitKeys(int ch,
int bin)
Obtain the keys used to access data from the ATWD channel bin. |
java.lang.String |
getATWDFitModel(int ch,
int bin)
Obtain the fit model for an ATWD channel. |
double |
getATWDFitParam(int ch,
int bin,
java.lang.String param)
Obtain the fit information for an ATWD channel. |
java.util.Iterator |
getATWDFrequencyFitKeys(int chip)
Obtain the keys used to access data from the ATWD frequency chip. |
java.lang.String |
getATWDFrequencyFitModel(int chip)
Obtain the model for an ATWD frequency chip. |
double |
getATWDFrequencyFitParam(int chip,
java.lang.String param)
Obtain the data for an ATWD frequency chip parameter. |
java.util.Calendar |
getCalendar()
Get the calibration timestamp - that is, when the calibration happened. |
int |
getDAC(int ch)
Return DAC settings on mainboard at startup. |
double |
getDiscriminatorCharge(double dac,
java.lang.String id)
Obtain discriminator charge corresponding to given DAC setting |
java.util.Iterator |
getDiscriminatorFitKeys(java.lang.String id)
Obtain the keys used to access data from the DOM analog front-end discriminator. |
java.lang.String |
getDiscriminatorFitModel(java.lang.String id)
Obtain the fit model for the DOM analog front-end discriminator. |
double |
getDiscriminatorFitParam(java.lang.String param,
java.lang.String id)
Obtain the fit information for the DOM analog front-end discriminator. |
double |
getDiscriminatorSetting(double charge,
java.lang.String id)
Obtain discriminator setting corresponding to given charge |
int |
getDOMCalId()
Get the DOMCalibration database ID. |
java.lang.String |
getDOMId()
Obtain the DOM hardware ID (Dallas ID chip on mainboard). |
int |
getDOMProductId()
Get the unique database ID for the DOM. |
double |
getFadcDeltaT()
Obtain the fadc offset in ns from the ATWD time. |
double |
getFadcDeltaTError()
Obtain error estimate on fadc time offset. |
double |
getFadcFreq()
Return the constant FADC frequency -- NOT measured |
double |
getFadcGain()
Obtain the fadc gain. |
double |
getFadcGainError()
Obtain error estimate on fadc gain. |
double |
getHvGainIntercept()
Get the gain intercept, if present. |
double |
getHvGainRegression()
Get the regression coefficient, if present. |
double |
getHvGainSlope()
Get the gain slope, if present. |
HVHistogram |
getHvHistogram(java.lang.Short key)
Get the histogram data for the specified key, if present. |
java.util.Iterator |
getHvHistogramKeys()
Get the histogram keys, if present. |
int |
getNumberOfADCs()
Get the number of ADC channels. |
int |
getNumberOfAmplifierGainChannels()
Get the number of amplifier gain channels. |
int |
getNumberOfATWDBins(int channel)
Get the number of ATWD bins. |
int |
getNumberOfATWDChannels()
Get the number of ATWD channels. |
int |
getNumberOfATWDFrequencyChips()
Get the number of ATWD frequency chips. |
int |
getNumberOfDACs()
Get the number of DAC channels. |
java.util.Iterator |
getPulserFitKeys()
Obtain the keys used to access data from the DOM analog front-end pulser. |
java.lang.String |
getPulserFitModel()
Obtain the fit model for the DOM analog front-end pulser. |
double |
getPulserFitParam(java.lang.String param)
Obtain the fit information for the DOM analog front-end pulser. |
double |
getRemnantBaseline(double[] wf,
int maxIter)
Get any remnant baseline in a waveform by iteratively removing peaks. |
double |
getTemperature()
Return DOM mainboard temperature. |
double |
getTransitTime(double voltage)
Get the transit time of the PMT and the delay board at a given high voltage setting. |
boolean |
hasHvGainFit()
Is there gain fit data for this calibration file? |
void |
save()
Save the calibration data to the database. |
protected void |
setADCs(int[] adcs)
Set the calibration ADC array. |
protected void |
setAmpGain(double[] gain,
double[] error)
Set the calibration amplifier gain and error arrays. |
protected void |
setATWDFits(java.util.HashMap[][] atwdFits)
Set the calibration ATWD fit array. |
protected void |
setATWDFrequencyFits(java.util.HashMap[] freqs)
Set the calibration ATWD frequency fit array. |
void |
setBaselineMode(java.lang.String mode)
Set mode of baseline subtraction. |
protected void |
setDACs(int[] dacs)
Set the calibration DAC array. |
void |
setDiscriminatorFitModel(java.lang.String model,
java.lang.String id)
Set the fit model for the DOM discriminator. |
void |
setDiscriminatorFitParam(java.lang.String param,
java.lang.String id,
double value)
Set the fit information for the DOM analog front-end pulser. |
protected void |
setDOMCalId(int id)
Set the DOMCalibration database ID. |
protected void |
setDOMProduct(icecube.daq.db.domprodtest.DOMProduct domProd)
Set the cached database information for the DOM. |
protected void |
setHvGain(double slope,
double intercept,
double regression)
Set the high-voltage slope and intercept data |
protected void |
setHvHistograms(HVHistogram[] histo)
Set the high-voltage histogram data |
protected void |
setMain(int domcalId,
java.lang.String mbSerial,
icecube.daq.db.domprodtest.DOMProduct domProd,
java.util.Date date,
double temp)
Set the main table data from the database. |
void |
setPulserFitModel(java.lang.String model)
Set the fit model for the DOM analog front-end pulser. |
void |
setPulserFitParam(java.lang.String param,
double value)
Set the fit information for the DOM analog front-end pulser. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Calibrator(java.net.URL calfile) throws java.io.IOException, DOMCalibrationException
calfile
- URL reference to the XML file.
java.io.IOException
- if there is a problem reading the stream
DOMCalibrationException
- if there is a formatting errorpublic Calibrator(java.io.InputStream is, CalibratorDB calDB) throws java.io.IOException, DOMCalibrationException
is
- an initialized, open InputStream object pointing
to the XML file.
java.io.IOException
- if there is a problem reading the stream
DOMCalibrationException
- if there is a formatting errorpublic Calibrator(java.io.InputStream is) throws java.io.IOException, DOMCalibrationException
is
- an initialized, open InputStream object pointing
to the XML file.
java.io.IOException
- if there is a problem reading the stream
DOMCalibrationException
- if there is a formatting errorpublic Calibrator(java.lang.String mbSerial, java.util.Date date, double temp) throws DOMCalibrationException, java.io.IOException, java.sql.SQLException
mbSerial
- mainboard serial number of DOM being loadeddate
- date of data being loadedtemp
- temperature of data being loaded
DOMCalibrationException
- if an argument is invalid
java.io.IOException
- if there is a problem reading the stream
java.sql.SQLException
- if there is a database problempublic Calibrator(java.lang.String mbSerial, java.util.Date date, double temp, CalibratorDB calDB) throws DOMCalibrationException, java.io.IOException, java.sql.SQLException
mbSerial
- mainboard serial number of DOM being loadeddate
- date of data being loadedtemp
- temperature of data being loaded
DOMCalibrationException
- if an argument is invalid
java.io.IOException
- if there is a problem reading the stream
java.sql.SQLException
- if there is a database problemMethod Detail |
---|
public double[] atwdCalibrate(short[] atwdin, int ch, int offset)
atwdin
- input array of shortsch
- specifies ATWD channel 0-3 ATWD-A, 4-7 ATWD-Boffset
- specifies starting offset in ATWD to atwdin[0].
For example, if offset is 40 then atwdin[0] really holds
the 40th bin of the ATWD.
public double[] atwdCalibrateToPmtSig(short[] atwdin, int ch, int offset, int biasDAC) throws DOMCalibrationException
atwdin
- input array of shortsch
- specifies ATWD channel 0-3 ATWD-A, 4-7 ATWD-Boffset
- specifies starting offset in ATWD to atwdin[0].
For example, if offset is 40 then atwdin[0] really holds
the 40th bin of the ATWD.biasDAC
- DAC bias
DOMCalibrationException
- if there is a problem with the datapublic void setBaselineMode(java.lang.String mode) throws DOMCalibrationException
mode
- string specifying baseline subtraction mode:
"none": no remnant baseline subtraction
"calibrated" : use calibrated baselines in XML file
"dynamic": use dynamic baseline determination
DOMCalibrationException
public double[] atwdCalibrateToPmtSig(short[] atwdin, int ch, int offset, int biasDAC, int hv) throws DOMCalibrationException
atwdin
- input array of shortsch
- specifies ATWD channel 0-3 ATWD-A, 4-7 ATWD-Boffset
- specifies starting offset in ATWD to atwdin[0].
For example, if offset is 40 then atwdin[0] really holds
the 40th bin of the ATWD.biasDAC
- DAC biashv
- HV setting -- baseline is HV dependent!
DOMCalibrationException
- if there is a problem with the datapublic short[] atwdDecalibrate(double[] v, int ch, int offset)
v
- calibrated ATWD vectorch
- ATWD channel (0-3 A), (4-7 B)offset
- offset of first bin
public double calcAtwdFreq(int dac, int chip)
dac
- the ATWD_TRIGGER_BIAS
DAC settingchip
- the ATWD chip 0: 'A', 1: 'B'
public double getFadcFreq()
public double calcVoltageFromGain(double gain) throws DOMCalibrationException
gain
- the target PMT gain of the DOM (e.g. 1.0E+07)
DOMCalibrationException
- if there is no "gain vs. HV" datapublic double getTransitTime(double voltage) throws DOMCalibrationException
voltage
- Voltage applied to PMT
DOMCalibrationException
- if no transit time data is presentpublic double[] fadcCalibrate(short[] fadcin, int fadcDAC) throws DOMCalibrationException
fadcin
- input array of shortsfadcDAC
- front-end bias DAC for the FADC
DOMCalibrationException
- if no FADC data is presentpublic double getRemnantBaseline(double[] wf, int maxIter) throws DOMCalibrationException
wf
- input waveform array in voltsmaxIter
- maximum iterations
DOMCalibrationException
public void close()
public double[] domtestAtwdCalibrate(short[] domtestAtwdIn, int iChannel)
domtestAtwdIn
- The domtest-formatted and pedestalpattern and
baseline subtracted raw waveform in ATWD ticksiChannel
- the channel that was used to record that data
public double[] domtestAtwdCalibrate(int[] domtestAtwdIn, int iChannel)
domtestAtwdIn
- The domtest-formatted and pedestalpattern and
baseline subtracted raw waveform in ATWD ticksiChannel
- the channel that was used to record that data
public double[] domtestAtwdCalibrate(double[] domtestAtwdIn, int iChannel)
domtestAtwdIn
- The domtest-formatted and pedestalpattern and
baseline subtracted raw waveform in ATWD ticksiChannel
- the channel that was used to record that data
public int getADC(int ch)
ch
- ADC channel
public java.util.Iterator getATWDFitKeys(int ch, int bin)
ch
- ATWD channel: channels 0-3 map to physical
channels 0-3 of ATWD 'A' and channels 4-7 map to
physical channels 0-3 of ATWD 'B'.bin
- Sample bin of the ATWD. Each ATWD
has 128 sample bins addressed starting from O.
public double getATWDFitParam(int ch, int bin, java.lang.String param)
ch
- ATWD channel: channels 0-3 map to physical
channels 0-3 of ATWD 'A' and channels 4-7 map to
physical channels 0-3 of ATWD 'B'.bin
- Sample bin of the ATWD. Each ATWD
has 128 sample bins addressed starting from O.param
- Parameter name. Each fit may have
its own set of named fit paramters. Each fit
however must support the "model" parameter and
the "r" parameter.
public java.lang.String getATWDFitModel(int ch, int bin)
ch
- ATWD channel: channels 0-3 map to physical
channels 0-3 of ATWD 'A' and channels 4-7 map to
physical channels 0-3 of ATWD 'B'.bin
- Sample bin of the ATWD. Each ATWD
has 128 sample bins addressed starting from O.
public java.util.Iterator getATWDFrequencyFitKeys(int chip)
chip
- the ATWD chip 0: 'A', 1: 'B'
public java.lang.String getATWDFrequencyFitModel(int chip)
chip
- the ATWD chip 0: 'A', 1: 'B'
public double getATWDFrequencyFitParam(int chip, java.lang.String param)
chip
- the ATWD chip 0: 'A', 1: 'B'param
- parameter name
public double getAmplifierGain(int ch)
ch
- Channel number
public double getAmplifierGainError(int ch)
ch
- Channel number
public double getFadcGain()
public double getFadcGainError()
public double getFadcDeltaT()
public double getFadcDeltaTError()
public double getDiscriminatorSetting(double charge, java.lang.String id) throws DOMCalibrationException
charge
- Discriminator threshold charge
DOMCalibrationException
public double getDiscriminatorCharge(double dac, java.lang.String id) throws DOMCalibrationException
dac
- Discriminator DAC setting
DOMCalibrationException
public java.util.Calendar getCalendar()
public int getDAC(int ch)
ch
- channel of DAC (0=ATWD_TRIGGER_BIAS, ...)
public int getDOMCalId()
public java.lang.String getDOMId()
public int getDOMProductId()
public double getHvGainRegression()
public double getHvGainIntercept()
public double getHvGainSlope()
public HVHistogram getHvHistogram(java.lang.Short key)
key
- Short key
public java.util.Iterator getHvHistogramKeys()
public int getNumberOfADCs()
public int getNumberOfATWDBins(int channel)
channel
- ATWD channel
public int getNumberOfATWDChannels()
public int getNumberOfATWDFrequencyChips()
public int getNumberOfAmplifierGainChannels()
public int getNumberOfDACs()
public java.util.Iterator getPulserFitKeys()
public java.lang.String getPulserFitModel()
public double getPulserFitParam(java.lang.String param)
param
- Named fit paramter. See the description
of the ATWD fit parameters.
public java.util.Iterator getDiscriminatorFitKeys(java.lang.String id) throws DOMCalibrationException
DOMCalibrationException
public java.lang.String getDiscriminatorFitModel(java.lang.String id) throws DOMCalibrationException
DOMCalibrationException
public double getDiscriminatorFitParam(java.lang.String param, java.lang.String id) throws DOMCalibrationException
param
- Named fit paramter. See the description
of the ATWD fit parameters.
DOMCalibrationException
public double getTemperature()
public boolean hasHvGainFit()
public void save() throws DOMCalibrationException, java.io.IOException, java.sql.SQLException
DOMCalibrationException
- if there is a problem with the data
java.io.IOException
- if there is a filesystem probelm
java.sql.SQLException
- if there is a database problemprotected void setADCs(int[] adcs)
adcs
- ADC arrayprotected void setATWDFits(java.util.HashMap[][] atwdFits)
atwdFits
- ATWD fit arrayprotected void setATWDFrequencyFits(java.util.HashMap[] freqs)
freqs
- ATWD frequency fit arrayprotected void setAmpGain(double[] gain, double[] error)
gain
- amplifier gain arrayerror
- amplifier error arrayprotected void setDACs(int[] dacs)
dacs
- DAC arrayprotected void setDOMCalId(int id)
id
- database IDprotected void setDOMProduct(icecube.daq.db.domprodtest.DOMProduct domProd)
domProd
- database DOM informationprotected void setHvGain(double slope, double intercept, double regression)
slope
- slopeintercept
- interceptprotected void setHvHistograms(HVHistogram[] histo)
histo
- histogram arrayprotected void setMain(int domcalId, java.lang.String mbSerial, icecube.daq.db.domprodtest.DOMProduct domProd, java.util.Date date, double temp)
domcalId
- DOMCalibration database IDmbSerial
- DOM ID (main board hardware serial number)domProd
- database DOM informationdate
- DOMCalibration datetemp
- DOMCalibration temperaturepublic void setPulserFitModel(java.lang.String model)
model
- pulser fit model valuepublic void setPulserFitParam(java.lang.String param, double value) throws DOMCalibrationException
param
- Named fit paramter. See the description
of the ATWD fit parameters.value
- pulser fit parameter value
DOMCalibrationException
- if an argument is invalidpublic void setDiscriminatorFitModel(java.lang.String model, java.lang.String id) throws DOMCalibrationException
model
- pulser fit model value
DOMCalibrationException
public void setDiscriminatorFitParam(java.lang.String param, java.lang.String id, double value) throws DOMCalibrationException
param
- Named fit paramter. See the description
of the ATWD fit parameters.value
- pulser fit parameter value
DOMCalibrationException
- if an argument is invalid
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |