Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions sbnobj/SBND/Timing/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cet_make_library(
SOURCE
DAQTimestamp.cxx
TimingInfo.cxx
FrameShiftInfo.cxx
LIBRARIES
cetlib_except::cetlib_except
)
Expand Down
55 changes: 55 additions & 0 deletions sbnobj/SBND/Timing/FrameShiftInfo.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
* @file sbnobj/SBND/Timing/FrameShiftInfo.cxx
* @brief Defines data structures for SBND Frame Shift products (docdb#43090).
* @author Vu Chi Lan Nguyen
* @date August 29, 2025
*
*/

#ifndef SBND_FRAMSHIFTINFO_CXX
#define SBND_FRAMSHIFTINFO_CXX
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated

#include "sbnobj/SBND/Timing/FrameShiftInfo.hh"

namespace sbnd::timing {

FrameShiftInfo::FrameShiftInfo()
: fTimingType(99)
, fFrameTdcCrtt1(0)
, fFrameTdcBes(0)
, fFrameTdcRwm(0)
, fFrameHltCrtt1(0)
, fFrameHltBeamGate(0)
, fFrameApplyAtCaf(0)
{}

FrameShiftInfo::FrameShiftInfo(uint16_t _timingType, double _frameTdcCrtt1, double _frameTdcBes, double _frameTdcRwm, double _frameHltCrtt1, double _frameHltBeamGate, double _frameApplyAtCaf)
: fTimingType(_timingType)
, fFrameTdcCrtt1(_frameTdcCrtt1)
, fFrameTdcBes(_frameTdcBes)
, fFrameTdcRwm(_frameTdcRwm)
, fFrameHltCrtt1(_frameHltCrtt1)
, fFrameHltBeamGate(_frameHltBeamGate)
, fFrameApplyAtCaf(_frameApplyAtCaf)
{}

FrameShiftInfo::~FrameShiftInfo() {}

uint16_t FrameShiftInfo::TimingType() const { return fTimingType; }
double FrameShiftInfo::FrameTdcCrtt1() const { return fFrameTdcCrtt1; }
double FrameShiftInfo::FrameTdcBes() const { return fFrameTdcBes; }
double FrameShiftInfo::FrameTdcRwm() const { return fFrameTdcRwm; }
double FrameShiftInfo::FrameHltCrtt1() const { return fFrameHltCrtt1; }
double FrameShiftInfo::FrameHltBeamGate() const { return fFrameHltBeamGate; }
double FrameShiftInfo::FrameApplyAtCaf() const { return fFrameApplyAtCaf; }

void FrameShiftInfo::SetTimingType(uint16_t _type){ fTimingType = _type; }
void FrameShiftInfo::SetFrameTdcCrtt1(double _frame){ fFrameTdcCrtt1 = _frame; }
void FrameShiftInfo::SetFrameTdcBes(double _frame){ fFrameTdcBes = _frame; }
void FrameShiftInfo::SetFrameTdcRwm(double _frame){ fFrameTdcRwm = _frame; }
void FrameShiftInfo::SetFrameHltCrtt1(double _frame){ fFrameHltCrtt1 = _frame; }
void FrameShiftInfo::SetFrameHltBeamGate(double _frame){ fFrameHltBeamGate = _frame; }
void FrameShiftInfo::SetFrameApplyAtCaf(double _frame){ fFrameApplyAtCaf = _frame; }
}

#endif
85 changes: 85 additions & 0 deletions sbnobj/SBND/Timing/FrameShiftInfo.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* @file sbnobj/SBND/Timing/FrameShiftInfo.hh
* @brief Defines data structures for SBND Frame Shift products (docdb#43090).
* @author Vu Chi Lan Nguyen
* @date August 29, 2025
*
*/

#ifndef SBND_FRAMESHIFTINFO_HH
#define SBND_FRAMESHIFTINFO_HH

#include <stdint.h>
#include <string>
#include <array>
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
#include <limits>

namespace sbnd::timing {

/*
* @brief A struct to shifts across different reference frames in SBND Data
*
* Each shift is in [ns]
*
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
*/

class FrameShiftInfo {
Comment thread
VCLanNguyen marked this conversation as resolved.

uint16_t fTimingType; ///< Types of decoded frames: 0 - SPEC TDC ETRIG, 1 - HLT ETRIG, 2 - Do Nothing
double fFrameTdcCrtt1; ///< Shift from decoded frame to SPEC-TDC CRT T1 [ns]
double fFrameTdcBes; ///< Shift from decoded frame to SPEC-TDC BES [ns]
double fFrameTdcRwm; ///< Shift from decoded frame to SPEC-TDC RWM [ns]
double fFrameHltCrtt1; ///< Shift from decoded frame to HLT CRT T1 [ns]
double fFrameHltBeamGate; ///< Shift from decoded frame to HLT Beam Gate [ns]
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
double fFrameApplyAtCaf; ///< Frame to shift to when running at CAF stage

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect the "frame to shift to" to be a frame index, but it is apparently a time shift. I find the description misleading.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Frame here is from Timing Reference Frames.

At SBND, we have recorded multiple important timestamps that can be used as different reference frames depending on the physics needs of analysers.

Like you said, they are technically timing interval intervals between different timestamps.


public:

/*
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
* Default constructor.
*/
FrameShiftInfo();

/*
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
* Constructor to set all timestamps
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
*
* @param _timingType Types of decoded frames
* @param _frameTdcCrtt1 Shift from decoded frame to SPEC-TDC CRT T1 [ns]
* @param _frameTdcBes Shift from decoded frame to SPEC-TDC BES [ns]
* @param _frameTdcRwm Shift from decoded frame to SPEC-TDC RWM [ns]
* @param _frameHltCrtt1 Shift from decoded frame to HLT CRT T1 [ns]
* @param _frameHltBeamGate Shift from decoded frame to HLT Beam Gate [ns]
* @param _frameApplyAtCaf Frame to shift to when running at CAF stage
*/
FrameShiftInfo(uint16_t _timingType, double _frameTdcCrtt1, double _frameTdcBes, double _frameTdcRwm, double _frameHltCrtt1, double _frameHltBeamGate, double _frameApplyAtCaf);
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated

/**
* Destructor
*/
virtual ~FrameShiftInfo();
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated

/**
* Getters
*/
uint16_t TimingType() const;
double FrameTdcCrtt1() const;
double FrameTdcBes() const;
double FrameTdcRwm() const;
double FrameHltCrtt1() const;
double FrameHltBeamGate() const;
double FrameApplyAtCaf() const;
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated

/**
* Getters
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
*/
void SetTimingType(uint16_t _type);
void SetFrameTdcCrtt1(double _frame);
void SetFrameTdcBes(double _frame);
void SetFrameTdcRwm(double _frame);
void SetFrameHltCrtt1(double _frame);
void SetFrameHltBeamGate(double _frame);
void SetFrameApplyAtCaf(double _frame);
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
};
}

#endif
59 changes: 59 additions & 0 deletions sbnobj/SBND/Timing/TimingInfo.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
* @file sbnobj/SBND/Timing/TimingInfo.cxx
* @brief Defines data structures for SBND Timing Product (docdb#43090).
* @author Vu Chi Lan Nguyen
* @date August 29, 2025
*
*/

#ifndef SBND_TIMINGINFO_CXX
#define SBND_TIMINGINFO_CXX

#include "sbnobj/SBND/Timing/TimingInfo.hh"

namespace sbnd::timing {

TimingInfo::TimingInfo()
: fRawDAQHeaderTimestamp(0)
, fTdcCrtt1(0)
, fTdcBes(0)
, fTdcRwm(0)
, fTdcEtrig(0)
, fHltCrtt1(0)
, fHltEtrig(0)
, fHltBeamGate(0)
{}

TimingInfo::TimingInfo(uint64_t _rawDAQHeaderTimestamp, uint64_t _tdcCrtt1, uint64_t _tdcBes, uint64_t _tdcRwm, uint64_t _tdcEtrig, uint64_t _hltCrtt1, uint64_t _hltEtrig, uint64_t _hltBeamGate)
: fRawDAQHeaderTimestamp(_rawDAQHeaderTimestamp)
, fTdcCrtt1(_tdcCrtt1)
, fTdcBes(_tdcBes)
, fTdcRwm(_tdcRwm)
, fTdcEtrig(_tdcEtrig)
, fHltCrtt1(_hltCrtt1)
, fHltEtrig(_hltEtrig)
, fHltBeamGate(_hltBeamGate)
{}

TimingInfo::~TimingInfo() {}

uint64_t TimingInfo::RawDAQHeaderTimestamp() const { return fRawDAQHeaderTimestamp; }
uint64_t TimingInfo::TdcCrtt1() const { return fTdcCrtt1; }
uint64_t TimingInfo::TdcBes() const { return fTdcBes; }
uint64_t TimingInfo::TdcRwm() const { return fTdcRwm; }
uint64_t TimingInfo::TdcEtrig() const { return fTdcEtrig; }
uint64_t TimingInfo::HltCrtt1() const { return fHltCrtt1; }
uint64_t TimingInfo::HltEtrig() const { return fHltEtrig; }
uint64_t TimingInfo::HltBeamGate() const { return fHltBeamGate; }

void TimingInfo::SetRawDAQHeaderTimestamp(uint64_t _timestamp){ fRawDAQHeaderTimestamp = _timestamp; }
void TimingInfo::SetTdcCrtt1(uint64_t _timestamp){ fTdcCrtt1 = _timestamp; }
void TimingInfo::SetTdcBes(uint64_t _timestamp){ fTdcBes = _timestamp; }
void TimingInfo::SetTdcRwm(uint64_t _timestamp){ fTdcRwm = _timestamp; }
void TimingInfo::SetTdcEtrig(uint64_t _timestamp){ fTdcEtrig = _timestamp; }
void TimingInfo::SetHltCrtt1(uint64_t _timestamp){ fHltCrtt1 = _timestamp; }
void TimingInfo::SetHltEtrig(uint64_t _timestamp){ fHltEtrig = _timestamp; }
void TimingInfo::SetHltBeamGate(uint64_t _timestamp){ fHltBeamGate = _timestamp; }
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
}

#endif
89 changes: 89 additions & 0 deletions sbnobj/SBND/Timing/TimingInfo.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* @file sbnobj/SBND/Timing/TimingInfo.hh
* @brief Defines data structures for SBND Timing Product (docdb#43090).
* @author Vu Chi Lan Nguyen
* @date August 29, 2025
*
*/

#ifndef SBND_TIMINGINFO_HH
#define SBND_TIMINGINFO_HH

#include <stdint.h>
#include <string>
#include <array>
#include <limits>
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated

namespace sbnd::timing {

/*
* @brief A struct to store important timestamps in SBND Data
*
* Each timestamp is in UNIX Timestamp Format [ns]
*
*/

class TimingInfo {

uint64_t fRawDAQHeaderTimestamp; ///< Timestamp when the event is built by the event builder at DAQ-level
uint64_t fTdcCrtt1; ///< Timestamp of BNB stream CRT T1 Reset recorded by the SPEC-TDC
uint64_t fTdcBes; ///< Timestamp of BES signal sent by MFTU recorded by the SPEC-TDC
uint64_t fTdcRwm; ///< Timestamp of RWM signal recorded by the SPEC-TDC
uint64_t fTdcEtrig; ///< Timestamp of Event Trigger (ETRIG) sent by the PTB recorded by the SPEC-TDC
uint64_t fHltCrtt1; ///< Timestamp of BNB and Offbeam stream CRT T1 Reset High Level Trigger (HLT) created by the PTB
uint64_t fHltEtrig; ///< Timestamp of ETRIG HLT created by the PTB
uint64_t fHltBeamGate; ///< Timestamp of Beam Gate Acceptance HLT created by the PTB

public:

/*
* Default constructor.
*/
TimingInfo();
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated

/*
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
* Constructor to set all timestamps
*
* @param _rawDAQHeaderTimestamp Raw DAQ Timestamp in UNIX format [ns]
* @param _tdcCrtt1 CRT T1 Timestamp in UNIX format [ns]
* @param _tdcBes BES Timestamp recorded by TDC in UNIX format [ns]
* @param _tdcRwm RWM Timestamp recorded by TDC in UNIX format [ns]
* @param _tdcEtrig ETRIG Timestamp recorded by TDC in UNIX format [ns]
* @param _hltCrtt1 CRT T1 Timestamp created by PTB in UNIX format [ns]
* @param _hltEtrig ETRIG Timestamp created by PTB in UNIX format [ns]
* @param _hltBeamGate Beam Gate Timestamp created by PTB in UNIX format [ns]
*/
TimingInfo(uint64_t _rawDAQHeaderTimestamp, uint64_t _tdcCrtt1, uint64_t _tdcBes, uint64_t _tdcRwm, uint64_t _tdcEtrig, uint64_t _hltCrtt1, uint64_t _hltEtrig, uint64_t _hltBeamGate);

/**
* Destructor
*/
virtual ~TimingInfo();

Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
/**
* Getters
*/
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
uint64_t RawDAQHeaderTimestamp() const;
uint64_t TdcCrtt1() const;
uint64_t TdcBes() const;
uint64_t TdcRwm() const;
uint64_t TdcEtrig() const;
uint64_t HltCrtt1() const;
uint64_t HltEtrig() const;
uint64_t HltBeamGate() const;

/**
* Setters
*/
void SetRawDAQHeaderTimestamp(uint64_t timestamp);
void SetTdcCrtt1(uint64_t timestamp);
void SetTdcBes(uint64_t timestamp);
void SetTdcRwm(uint64_t timestamp);
void SetTdcEtrig(uint64_t timestamp);
void SetHltCrtt1(uint64_t timestamp);
void SetHltEtrig(uint64_t timestamp);
void SetHltBeamGate(uint64_t timestamp);
};
}

#endif
2 changes: 2 additions & 0 deletions sbnobj/SBND/Timing/classes.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "canvas/Persistency/Common/Wrapper.h"
#include "canvas/Persistency/Common/Assns.h"
#include "sbnobj/SBND/Timing/DAQTimestamp.hh"
#include "sbnobj/SBND/Timing/TimingInfo.hh"
#include "sbnobj/SBND/Timing/FrameShiftInfo.hh"
14 changes: 13 additions & 1 deletion sbnobj/SBND/Timing/classes_def.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
<lcgdict>
<class name="sbnd::timing::DAQTimestamp" ClassVersion="11">
<version ClassVersion="11" checksum="2804806845"/>
<version ClassVersion="11" checksum="2804806845"/>
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
<version ClassVersion="10" checksum="810700615"/>
</class>
<class name="std::vector<sbnd::timing::DAQTimestamp>"/>
<class name="art::Wrapper< std::vector<sbnd::timing::DAQTimestamp> >"/>

<class name="sbnd::timing::TimingInfo" ClassVersion="12">
<version ClassVersion="12" checksum="1023077770"/>
<version ClassVersion="11" checksum="2804806845"/>
</class>
<class name="art::Wrapper<sbnd::timing::TimingInfo>"/>

<class name="sbnd::timing::FrameShiftInfo" ClassVersion="12">
<version ClassVersion="12" checksum="515138667"/>
<version ClassVersion="11" checksum="2804806845"/>
</class>
<class name="art::Wrapper<sbnd::timing::FrameShiftInfo>"/>
Comment thread
VCLanNguyen marked this conversation as resolved.
Outdated
</lcgdict>