TDCBase

Functions
tdchg2.h File Reference

Heralded g(2) Functions. More...

`#include "tdcdecl.h"`

Go to the source code of this file.

## Functions
TDC_API int TDC_CC | TDC_enableHg2 (Bln32 enable)
| Enable HG2 Calculations. More...
TDC_API int TDC_CC | TDC_setHg2Params (Int32 binWidth, Int32 binCount)
| Set Correlation Function Parameters. More...
TDC_API int TDC_CC | TDC_getHg2Params (Int32 *binWidth, Int32 *binCount)
| Get Correlation Function Parameters. More...
TDC_API int TDC_CC | TDC_setHg2Input (Int32 idler, Int32 channel1, Int32 channel2)
| Set TDC Channels for Input. More...
TDC_API int TDC_CC | TDC_getHg2Input (Int32 *idler, Int32 *channel1, Int32 *channel2)
| Get TDC Channels for Input. More...
TDC_API int TDC_CC | TDC_resetHg2Correlations ()
| Reset Correlation Functions. More...
TDC_API int TDC_CC | TDC_calcHg2G2 (double *buffer, Int32 *bufSize, Bln32 reset)
| Calculate g(2) Function. More...
TDC_API int TDC_CC | TDC_calcHg2Tcp (Int64 **buffers, Bln32 reset)
| 2D triple coincidence count More...
TDC_API int TDC_CC | TDC_calcHg2Tcp1D (Int64 *buffer, Int32 *bufSize, Bln32 reset)
| 2D triple coincidence count - alternative interface More...
TDC_API int TDC_CC | TDC_getHg2Raw (Int64 *evtIdler, Int64 *evtCoinc, Int64 *bufSsi, Int64 *bufS2i, Int32 *bufSize)
| Raw counts. More...

## Detailed Description

Heralded g(2) Functions.

The header provides functions to calculate "heralded g(2) functions" from TDC data. They are based on 3 signals: the "idler" and two photo detectors.

Use the functions of tdcbase.h to control the device. Set input channels parameters with TDC_setHg2Params and TDC_setHg2Input. Enable the collection of data with TDC_enableHg2. When enabled, all incoming events on the selected channels contribute to the correlation functions. Use TDC_calcHg2G2, TDC_calcHg2Tcp, and TDC_calcHg2Tcp1D to calculate g(2) functions and triple coincidence counts ("TCP").

Definition in file tdchg2.h.

## Function Documentation

## ◆ TDC_calcHg2G2()

TDC_API int TDC_CC TDC_calcHg2G2 | ( | double * | buffer,
|  | Int32 * | bufSize,
|  | Bln32 | reset
| ) |  |

Calculate g(2) Function.

Calculates the g(2) function based on the current state of the correlation functions.

Parameters

  buffer | Output: g(2) function values. An array of at least binCount elements must be provided.
  bufSize | Input: Number of elements of buffer Output: Number of elements used (=binCount)
  reset | If the Correlation functions should be cleared after calculation

Returns
  Error code

## ◆ TDC_calcHg2Tcp()

TDC_API int TDC_CC TDC_calcHg2Tcp | ( | Int64 ** | buffers,
|  | Bln32 | reset
| ) |  |

2D triple coincidence count

Retreives the 2D triple coincidence count in an array of buffers.

Parameters

  buffers | Output: two dimensional array of event counts. buffers[a][b] will contain the number of triple coincidence events with time differences a and b. An array of at least binCount buffers with binCount elements must be provided.
  reset | If the histogram should be cleared after the call

Returns
  Error code

## ◆ TDC_calcHg2Tcp1D()

TDC_API int TDC_CC TDC_calcHg2Tcp1D | ( | Int64 * | buffer,
|  | Int32 * | bufSize,
|  | Bln32 | reset
| ) |  |

2D triple coincidence count - alternative interface

Retreives the 2D triple coincidence count in a single buffer.

Parameters

  buffer | Output: array of event counts. buffer[a + b * binCount] will contain the number of triple coincidence events with time differences a and b. An array of at least binCount^2 elements most be provided.
  bufSize | Input: Number of elements of buffer Output: Number of elements used (=binCount^2)
  reset | If the histogram should be cleared after the call

Returns
  Error code

## ◆ TDC_enableHg2()

TDC_API int TDC_CC TDC_enableHg2 | ( | Bln32 | enable | ) |

Enable HG2 Calculations.

Enables the calculation of 2nd order cross correlation functions as the base of g(2) functions. When enabled, all incoming events on the selected TDC channels to the correlation functions. When disabled, all HG2 functions are unavailable. The function implicitly clears the correlation functions. Use TDC_freezeBuffers to interrupt the accumulation of events without clearing the functions and TDC_resetHg2Correlations to clear without interrupt.

Parameters

  enable | Enable or disable

Returns
  Error code

## ◆ TDC_getHg2Input()

TDC_API int TDC_CC TDC_getHg2Input | ( | Int32 * | idler,
|  | Int32 * | channel1,
|  | Int32 * | channel2
| ) |  |

Get TDC Channels for Input.

Retrieves the parameters set by TDC_setHg2Input. All output parameters may be NULL to ignore the value.

Parameters

  idler | Output: Idler channel number
  channel1 | Output: First channel number
  channel2 | Output: Second channel number

Returns
  Error code

## ◆ TDC_getHg2Params()

TDC_API int TDC_CC TDC_getHg2Params | ( | Int32 * | binWidth,
|  | Int32 * | binCount
| ) |  |

Get Correlation Function Parameters.

Retrieves the parameters set by TDC_setHg2Params.

Parameters

  binWidth | Output: Width of a bin in units of the TDC Time Base.
  binCount | Number of bins for the correlation functions. g(2) functions will consist of 2*n-1 bins.

Returns
  Error code

## ◆ TDC_getHg2Raw()

TDC_API int TDC_CC TDC_getHg2Raw | ( | Int64 * | evtIdler,
|  | Int64 * | evtCoinc,
|  | Int64 * | bufSsi,
|  | Int64 * | bufS2i,
|  | Int32 * | bufSize
| ) |  |

Raw counts.

Retreives the raw histograms as counted for the g(2) function. All pointers may be NULL to ignore the corresponding values.

Parameters

  evtIdler | Output: Number of idler/trigger events registered and analyzed
  evtCoinc | Output: Number of coincidences signal1 + idler with time diff < binwidth/2
  bufSsi | Output: Array of numbers of triple coincidences signal1 + signal2 + idler for every bin. The histogram is always centered around the zero-bin. An array of at least binCount elements most be provided.
  bufS2i | Output: Array of numbers of coincidences signal2 and idler for every bin. The histogram is always centered around the zero-bin An array of at least binCount elements most be provided.
  bufSize | Input: Number of elements of the buffers Output: Number of elements used (=binCount)

Returns
  Error code

## ◆ TDC_resetHg2Correlations()

TDC_API int TDC_CC TDC_resetHg2Correlations | ( |  | ) |

Reset Correlation Functions.

Clears the accumulated correlation functions.

Returns
  Error code

## ◆ TDC_setHg2Input()

TDC_API int TDC_CC TDC_setHg2Input | ( | Int32 | idler,
|  | Int32 | channel1,
|  | Int32 | channel2
| ) |  |

Set TDC Channels for Input.

Sets the idler, the first and second input channel for correlation function calculation. If the function is not called, default values are in place. The function implicitly clears the correlation functions.

Parameters

  idler | Idler channel number, Range = 1...96, default = 1
  channel1 | First channel number, Range = 1...96, default = 2
  channel2 | Second channel number, Range = 1...96, default = 3

Returns
  Error code

## ◆ TDC_setHg2Params()

TDC_API int TDC_CC TDC_setHg2Params | ( | Int32 | binWidth,
|  | Int32 | binCount
| ) |  |

Set Correlation Function Parameters.

Sets parameters for the correlation functions and g(2) functions. If the function is not called, default values are in place. When the function is called, all collected data are cleared.

Parameters

  binWidth | Width of a bin in units of the TDC Time Base, see TDC_getTimebase . Range = 1 ... 1M, default = 1.
  binCount | Number of bins in the buffers. Range = 16 ... 64k, default = 256.

Returns
  Error code