-
Notifications
You must be signed in to change notification settings - Fork 13
Frame Shift Module to Correct Timing in Data - PR For Spring Production #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kjplows
merged 11 commits into
release/SBN2025A
from
lnguyen/frame_shift_pr_spring_production
Sep 5, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
536cf8e
move sbndcode products to sbnobj
VCLanNguyen 9664a0a
fix bug and add doxygen style comments
VCLanNguyen 888b43b
Merge branch 'release/SBN2025A' into lnguyen/frame_shift_pr_spring_pr…
VCLanNguyen 6331084
Update sbnobj/SBND/Timing/FrameShiftInfo.cxx for Doxygen format
VCLanNguyen 5688d6b
Update sbnobj/SBND/Timing/FrameShiftInfo.cxx - fix typo
VCLanNguyen 576d9f4
Update sbnobj/SBND/Timing/FrameShiftInfo.hh - add for doxygen style
VCLanNguyen 5961a2a
Update sbnobj/SBND/Timing/FrameShiftInfo.hh -- add for doxygen style
VCLanNguyen 5034030
Update sbnobj/SBND/Timing/FrameShiftInfo.hh -- add doxygen comment st…
VCLanNguyen 892db00
address doxygen comments and classes def
VCLanNguyen c8a8d02
add doxygen style comment
VCLanNguyen 3a469da
add missing asterisk
VCLanNguyen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /** | ||
| * @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_FRAMESHIFTINFO_CXX | ||
| #define SBND_FRAMESHIFTINFO_CXX | ||
|
|
||
| #include "sbnobj/SBND/Timing/FrameShiftInfo.hh" | ||
|
|
||
| namespace sbnd::timing { | ||
|
|
||
| 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) | ||
| {} | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /** | ||
| * @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 <limits> | ||
|
|
||
| namespace sbnd::timing { | ||
|
|
||
| /** | ||
| * @brief A class to store the shifts across different time reference frames in SBND Data | ||
| * | ||
| * Each shift is in [ns] | ||
| * | ||
| * For more information, see | ||
| * [SBN DocDB 43090](https://sbn-docdb.fnal.gov/cgi-bin/sso/ShowDocument?docid=43090). | ||
| */ | ||
|
|
||
| class FrameShiftInfo { | ||
|
|
||
| public: | ||
| static constexpr uint16_t InvalidTimingType = 99; ///< Invalid timing type for decoded frame | ||
| static constexpr uint64_t NoShift = 0; ///< No shift. | ||
|
|
||
| private: | ||
|
|
||
| uint16_t fTimingType = InvalidTimingType; ///< Types of decoded frames: 0 - SPEC TDC ETRIG, 1 - HLT ETRIG, 2 - Do Nothing | ||
| double fFrameTdcCrtt1 = NoShift; ///< Shift from decoded frame to SPEC-TDC CRT T1 [ns] | ||
| double fFrameTdcBes = NoShift; ///< Shift from decoded frame to SPEC-TDC BES [ns] | ||
| double fFrameTdcRwm = NoShift; ///< Shift from decoded frame to SPEC-TDC RWM [ns] | ||
| double fFrameHltCrtt1 = NoShift; ///< Shift from decoded frame to HLT CRT T1 [ns] | ||
| double fFrameHltBeamGate = NoShift; ///< Shift from decoded frame to HLT Beam Gate [ns] | ||
| double fFrameApplyAtCaf = NoShift; ///< Frame to shift to when running at CAF stage | ||
|
|
||
| public: | ||
|
|
||
| /** | ||
| * Default constructor. | ||
| */ | ||
| FrameShiftInfo() = default; | ||
|
|
||
| /** | ||
| * Constructor to set all frames | ||
| * | ||
| * @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); | ||
|
|
||
| /// @name Getters | ||
| /// @{ | ||
| uint16_t TimingType() const { return fTimingType; } | ||
| double FrameTdcCrtt1() const { return fFrameTdcCrtt1; } | ||
| double FrameTdcBes() const { return fFrameTdcBes; } | ||
| double FrameTdcRwm() const { return fFrameTdcRwm; } | ||
| double FrameHltCrtt1() const { return fFrameHltCrtt1;} | ||
| double FrameHltBeamGate() const { return fFrameHltBeamGate; } | ||
| double FrameApplyAtCaf() const { return fFrameApplyAtCaf; } | ||
| /// @} | ||
|
|
||
| /// @name Setters | ||
| /// @{ | ||
| void SetTimingType(uint16_t type){ fTimingType = type; } | ||
| void SetFrameTdcCrtt1(double frame){ fFrameTdcCrtt1 = frame; } | ||
| void SetFrameTdcBes(double frame){ fFrameTdcBes = frame; } | ||
| void SetFrameTdcRwm(double frame){ fFrameTdcRwm = frame; } | ||
| void SetFrameHltCrtt1(double frame){ fFrameHltCrtt1 = frame; } | ||
| void SetFrameHltBeamGate(double frame){ fFrameHltBeamGate = frame; } | ||
| void SetFrameApplyAtCaf(double frame){ fFrameApplyAtCaf = frame; } | ||
| /// @} | ||
| }; | ||
| } | ||
|
|
||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /** | ||
| * @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(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) | ||
| {} | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 products (docdb#43090). | ||
| * @author Vu Chi Lan Nguyen | ||
| * @date August 29, 2025 | ||
| * | ||
| */ | ||
|
|
||
| #ifndef SBND_TIMINGINFO_HH | ||
| #define SBND_TIMINGINFO_HH | ||
|
|
||
| #include <stdint.h> | ||
|
|
||
| namespace sbnd::timing { | ||
|
|
||
| /** | ||
| * @brief A class to store important timestamps in SBND Data | ||
| * | ||
| * Each timestamp is in UNIX Timestamp Format [ns] | ||
| * | ||
| * For more information, see | ||
| * [SBN DocDB 43090](https://sbn-docdb.fnal.gov/cgi-bin/sso/ShowDocument?docid=43090). | ||
| */ | ||
|
|
||
| class TimingInfo { | ||
|
|
||
| public: | ||
| static constexpr uint64_t InvalidTimestamp = 0; ///< Invalid timestamp | ||
|
|
||
| private: | ||
|
|
||
| uint64_t fRawDAQHeaderTimestamp = InvalidTimestamp; ///< Timestamp when the event is built by the event builder at DAQ-level | ||
| uint64_t fTdcCrtt1 = InvalidTimestamp; ///< Timestamp of BNB stream CRT T1 Reset recorded by the SPEC-TDC | ||
| uint64_t fTdcBes = InvalidTimestamp; ///< Timestamp of BES signal sent by MFTU recorded by the SPEC-TDC | ||
| uint64_t fTdcRwm = InvalidTimestamp; ///< Timestamp of RWM signal recorded by the SPEC-TDC | ||
| uint64_t fTdcEtrig = InvalidTimestamp; ///< Timestamp of Event Trigger (ETRIG) sent by the PTB recorded by the SPEC-TDC | ||
| uint64_t fHltCrtt1 = InvalidTimestamp; ///< Timestamp of BNB and Offbeam stream CRT T1 Reset High Level Trigger (HLT) created by the PTB | ||
| uint64_t fHltEtrig = InvalidTimestamp; ///< Timestamp of ETRIG HLT created by the PTB | ||
| uint64_t fHltBeamGate = InvalidTimestamp; ///< Timestamp of Beam Gate Acceptance HLT created by the PTB | ||
|
|
||
| public: | ||
|
|
||
| /** | ||
| * Default constructor. | ||
| */ | ||
| TimingInfo() = default; | ||
|
|
||
| /** | ||
| * 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); | ||
|
|
||
| /// @name Getters | ||
| /// @{ | ||
| uint64_t RawDAQHeaderTimestamp() const { return fRawDAQHeaderTimestamp; } | ||
| uint64_t TdcCrtt1() const { return fTdcCrtt1; } | ||
| uint64_t TdcBes() const { return fTdcBes; } | ||
| uint64_t TdcRwm() const { return fTdcRwm; } | ||
| uint64_t TdcEtrig() const { return fTdcEtrig; } | ||
| uint64_t HltCrtt1() const { return fHltCrtt1; } | ||
| uint64_t HltEtrig() const { return fHltEtrig; } | ||
| uint64_t HltBeamGate() const { return fHltBeamGate; } | ||
| /// @} | ||
|
|
||
| /// @name Setters | ||
| /// @{ | ||
| void SetRawDAQHeaderTimestamp(uint64_t timestamp){ fRawDAQHeaderTimestamp = timestamp; } | ||
| void SetTdcCrtt1(uint64_t timestamp){ fTdcCrtt1 = timestamp; } | ||
| void SetTdcBes(uint64_t timestamp){ fTdcBes = timestamp; } | ||
| void SetTdcRwm(uint64_t timestamp){ fTdcRwm = timestamp; } | ||
| void SetTdcEtrig(uint64_t timestamp){ fTdcEtrig = timestamp; } | ||
| void SetHltCrtt1(uint64_t timestamp){ fHltCrtt1 = timestamp; } | ||
| void SetHltEtrig(uint64_t timestamp){ fHltEtrig = timestamp; } | ||
| void SetHltBeamGate(uint64_t timestamp){ fHltBeamGate = timestamp; } | ||
| /// @} | ||
|
|
||
| }; | ||
| } | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,18 @@ | ||
| <lcgdict> | ||
| <class name="sbnd::timing::DAQTimestamp" ClassVersion="11"> | ||
| <version ClassVersion="11" checksum="2804806845"/> | ||
| <version ClassVersion="10" checksum="810700615"/> | ||
| <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="10" > | ||
| <version ClassVersion="10" checksum="1023077770"/> | ||
| </class> | ||
| <class name="art::Wrapper<sbnd::timing::TimingInfo>"/> | ||
|
|
||
| <class name="sbnd::timing::FrameShiftInfo" ClassVersion="10" > | ||
| <version ClassVersion="10" checksum="515138667"/> | ||
| </class> | ||
| <class name="art::Wrapper<sbnd::timing::FrameShiftInfo>"/> | ||
| </lcgdict> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.