DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Loading...
Searching...
No Matches
TimeTagger.cpp
Go to the documentation of this file.
1// This file is part of DynExp.
2
3#include "stdafx.h"
4#include "TimeTagger.h"
5
6namespace DynExpInstr
7{
9 {
10 auto InstrParams = DynExp::dynamic_Params_cast<TimeTagger>(Instance.ParamsGetter());
11 auto InstrData = DynExp::dynamic_InstrumentData_cast<TimeTagger>(Instance.InstrumentDataGetter());
12
14 InstrData->GetSampleStream()->SetStreamSize(InstrParams->StreamSizeParams.StreamSize);
15
16 InstrData->SetValueUnit(DataStreamInstrumentData::UnitType::Counts);
17 InstrData->SetStreamMode(InstrParams->StreamMode);
18
20 }
21
23 {
24 auto InstrParams = DynExp::dynamic_Params_cast<TimeTagger>(Instance.ParamsGetter());
25 auto InstrData = DynExp::dynamic_InstrumentData_cast<TimeTagger>(Instance.InstrumentDataGetter());
26
27 InstrData->GetSampleStream()->SetStreamSize(InstrParams->StreamSizeParams.StreamSize);
28
29 return {};
30 }
31
33 {
34 Enabled = false;
35 EventCounts = 0;
36 IntegrationTime = std::chrono::microseconds(0);
37
38 ResultVector.clear();
39 }
40
41 void TimeTaggerData::SetStreamMode(StreamModeType StreamMode) const noexcept
42 {
43 this->StreamMode = StreamMode;
44 StreamModeChanged = true;
45 }
46
48 {
49 StreamMode = StreamModeType::Counts;
50 HBTResults.Reset();
51
53 }
54
56 {
58 { "Sample accumulated counts detected within an exposure interval.", TimeTaggerData::StreamModeType::Counts },
59 { "Sample time tags denoting the occurrence of single counts.", TimeTaggerData::StreamModeType::Events }
60 };
61
62 return List;
63 }
64
68
72
76
77 void TimeTagger::ConfigureInput(bool UseRisingEdge, double ThresholdInVolts, DynExp::TaskBase::CallbackType CallbackFunc) const
78 {
80 }
81
86
91
96
97 void TimeTagger::SetHBTActive(bool Enable, DynExp::TaskBase::CallbackType CallbackFunc) const
98 {
100 }
101
102 void TimeTagger::ConfigureHBT(Util::picoseconds BinWidth, size_t BinCount, DynExp::TaskBase::CallbackType CallbackFunc) const
103 {
105 }
106
111
116}
Defines a time tagging meta instrument to assign timestamps to (e.g. photon) detection events.
@ Counts
Count rate in counts per second (cps)
StreamModeType
Type to determine whether the instrument reads out all time-tagged events or summarized count rates....
Definition TimeTagger.h:134
@ Counts
Read out summarized count rates in Hz.
Definition TimeTagger.h:135
@ Events
Read out the timestamps of all time-tagged events.
Definition TimeTagger.h:136
void ResetImpl(dispatch_tag< DataStreamInstrumentData >) override final
void SetStreamMode(StreamModeType StreamMode) const noexcept
Setter for StreamMode. Adjustable by modules. Sets StreamModeChanged to true.
static Util::TextValueListType< TimeTaggerData::StreamModeType > StreamModeTypeStrList()
Maps description strings to the TimeTaggerData::StreamModeType enum's items.
virtual bool ApplyDataStreamSizeFromParams() const noexcept
Determines whether to update the TimeTagger's data stream size according to the instrument parameters...
Definition TimeTagger.h:46
void InitFuncImpl(dispatch_tag< DataStreamInstrumentTasks::InitTask >, DynExp::InstrumentInstance &Instance) override final
Initializes the respective instrument within the instrument inheritance hierarchy....
Definition TimeTagger.cpp:8
virtual DynExp::TaskResultType RunChild(DynExp::InstrumentInstance &Instance) override
Runs the task. Override RunChild() to define a derived task's action(s). Any exception leaving RunChi...
virtual void ConfigureInput(bool UseRisingEdge, double ThresholdInVolts, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Configures the input channel of the physical device related to this instrument.
virtual void SetCoincidenceWindow(Util::picoseconds CoincidenceWindow, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Configures the time tagger's coincidence window.
virtual void ConfigureHBT(Util::picoseconds BinWidth, size_t BinCount, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Configures the time tagger's HBT unit for g^(2) measurements.
virtual void ResetHBT(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Resets the time tagger's HBT unit for g^(2) measurements.
virtual void SetHBTActive(bool Enable, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Enables or disables the time tagger's HBT unit for g^(2) measurements.
void ResetImpl(dispatch_tag< DataStreamInstrument >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
virtual void SetDelay(Util::picoseconds Delay, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Configures the time tagger's channel delay. This is useful to compensate different signal delays betw...
virtual void SetExposureTime(Util::picoseconds ExposureTime, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Configures the time tagger's exposure time. This is e.g. relevant to determine count rates in the Tim...
Refer to DynExp::ParamsBase::dispatch_tag.
Refer to ParamsBase::dispatch_tag.
Definition Instrument.h:146
Defines data for a thread belonging to a InstrumentBase instance. Refer to RunnableInstance.
Definition Instrument.h:772
const InstrumentBase::InstrumentDataGetterType InstrumentDataGetter
Getter for instrument's data. Refer to InstrumentBase::InstrumentDataGetterType.
Definition Instrument.h:791
Refer to ParamsBase::dispatch_tag.
Definition Object.h:2018
const Object::ParamsGetterType ParamsGetter
Invoke to obtain the parameters (derived from ParamsBase) of Owner.
Definition Object.h:3671
std::function< void(const TaskBase &, ExceptionContainer &)> CallbackType
Type of a callback function which is invoked when a task has finished, failed or has been aborted....
Definition Instrument.h:939
Defines the return type of task functions.
Definition Instrument.h:824
Thrown when a requested feature is either under development and thus not implemented yet or when a sp...
Definition Exception.h:299
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
std::chrono::duration< double, std::pico > picoseconds
Extends std::chrono by a duration data type for picoseconds.
Definition Util.h:762
std::vector< std::pair< TextType, ValueType > > TextValueListType
Type of a list containing key-value pairs where key is a text of type Util::TextType.
Definition QtUtil.h:37
Accumulates include statements to provide a precompiled header.
void Reset()
Sets Enabled to false, EventCounts as well as IntegrationTime to zero, and clears ResultVector.