17 using namespace Diana;
24 ev.
Require<QOFData>(
"COF",
"OFData");
28 ev.
Add<
QInt>(
"MaximumPosition");
29 fSamplesOwner = GetString(
"SamplesOwner",
"COF");
30 ev.
Require<QVector>(fSamplesOwner,
"OF");
33 GlobalHandle<QInt> dHandle(
"Dataset");
34 GlobalData().Get(
"",&dHandle,
"");
35 fDataset = dHandle.Get();
46 const QVector& OFSamplesSide = ev.
Get<QVector>(fSamplesOwner.c_str(),
"OF");
52 string InputFilename = GetString(
"JitterInput",
"jitter.txt");
54 for(
size_t i = 0;i < neighbours.
Size();i++){
57 const QOFData& o_ofData = neighbours[i].Get<QOFData>(
"COF",
"OFData");
59 const QHeader& headerMain = neighbours[i].Get<
QHeader>(
"DAQ",
"Header");
61 GlobalData().Get(
"DAQ",&rHandleMain,
"");
62 const QRunData& MrunData = rHandleMain.Get();
76 cofHandle.SetDataset(fDataset);
77 cofHandle.SetChannel(ch_side);
79 GlobalData().Get(fSamplesOwner,&cofHandle,
"");
81 if(!cofHandle.IsValid()) {
82 Error(
"Channel %d, has no COFData global quantity: %s",ch_side,cofHandle.GetError().GetDescription().c_str());
86 cofData = cofHandle.Get();
98 GlobalData().Get(
"JitterByCoincidence",&jHandleS,InputFilename);
99 GlobalData().Get(
"JitterByCoincidence",&jHandleM,InputFilename);
101 if(!jHandleS.IsValid()) {
102 if(!fBlackList.count(ch_side)) {
103 fBlackList.insert(ch_side);
104 Error(
"Channel %d, has no jitter. Cannot be synced: %s",ch_side,jHandleS.GetError().GetDescription().c_str());
108 else if(!jHandleM.IsValid()) {
109 if(!fBlackList.count(ch_main)) {
110 fBlackList.insert(ch_main);
111 Error(
"Channel %d, has no jitter. Cannot be synced: %s",ch_main,jHandleM.GetError().GetDescription().c_str());
116 Sjitters = jHandleS.Get();
117 Mjitters = jHandleM.Get();
126 double NewPos = (o_ofData.GetDelay()/1000.+jitter)*samplFreq;
127 int IntNewPos = lround( NewPos );
129 if(IntNewPos >= 0 && IntNewPos < (
int)OFSamplesSide.Size()){
130 double sideampl = OFSamplesSide[IntNewPos]*ADC2mV;
131 double nsig = ( sideampl )/resomV;
134 ev.
Get<
QInt>(
"MaximumPosition") = IntNewPos;
#define REGISTER_MODULE(clazz)
module to calculate amplitude of side pulses starting from the main pulse and the jitter
void Do(Diana::QEvent &ev, const Diana::QEventList &neighbours)
Do method. Declare and implement only one of the two versions.
void Init(Diana::QEvent &ev)
Init method.
base types wrapped into a QObject. Currently implemented types are QInt QDouble and QFloat....
general quantities about COF
double fSamplingFrequency
sampling frequency in Hz
double fADC2mV
conversion: mV = ADC * fADC2mV
list of references to const QEvent (s)
size_t Size() const
number of QEvent (s)
void Require(const std::string &owner, const std::string &name) const
notify the QEvent that we need a QObject, if not found an exception is thrown
void Get(const char *owner, ReadHandle< Q > &handle) const
Get a QObject Handle in read mode.
void Add(WriteHandle< Q > &handle)
Add a QObject to the event.
global handle for jitter by coincidence
Raw event: bolometer channel, trigger positions and types.
const int & GetChannelId() const
Get ChannelId.
global handle for QRunData
const QChannelRunData & GetChannelRunData(const int channel) const
get channel based run data quantities
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...