-
Notifications
You must be signed in to change notification settings - Fork 35
Add PTB HLT and LLT information to CAF files for real SBND data #614
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,6 +115,8 @@ | |
| #include "sbnobj/Common/POTAccounting/BNBSpillInfo.h" | ||
| #include "sbnobj/Common/POTAccounting/EXTCountInfo.h" | ||
| #include "sbnobj/Common/POTAccounting/NuMISpillInfo.h" | ||
| #include "sbncode/BeamSpillInfoRetriever/POTTools.h" | ||
| #include "artdaq-core/Data/ContainerFragment.hh" | ||
| #include "sbnobj/Common/Trigger/ExtraTriggerInfo.h" | ||
| #include "sbnobj/Common/Reco/CRUMBSResult.h" | ||
| #include "sbnobj/Common/Reco/OpT0FinderResult.h" | ||
|
|
@@ -1711,6 +1713,23 @@ void CAFMaker::produce(art::Event& evt) noexcept { | |
| FillTriggerEmulation(monpulses_handle, monpulse_sizes_handle, pairs_handle, trigemu_handle, srtrigger); | ||
| } | ||
|
|
||
|
|
||
| // Fill PTB (Penn Trigger Board) information for SBND real data | ||
| if (isRealData && fDet == kSBND) { | ||
| art::InputTag PTB_itag("daq", "ContainerPTB"); | ||
| art::Handle<artdaq::Fragments> ptb_frags_handle; | ||
| evt.getByLabel(PTB_itag, ptb_frags_handle); | ||
| if (ptb_frags_handle.isValid()) { | ||
| try { | ||
| std::vector<sbn::pot::PTBInfo_t> ptb_triggers = sbn::pot::extractAllPTBInfo(ptb_frags_handle); | ||
| FillPTBTriggersSBND(ptb_triggers, srtrigger); | ||
| } | ||
| catch (...) { | ||
| std::cout << "CAFMaker: Failed to extract PTB triggers" << std::endl; | ||
| } | ||
|
Comment on lines
+1723
to
+1729
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I strongly recommend to be more precise on this check (general guideline: |
||
| } | ||
| } | ||
|
|
||
| // If not real data, fill in enough of the SRTrigger to make (e.g.) the CRT | ||
| // time referencing work. TODO: add more stuff to a "MC"-Trigger? | ||
| // No longer needed with incorporation of trigger emulation in the MC. | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -73,4 +73,28 @@ namespace caf | |||||||||||||||||||
| caf_softInfo.flash_peakpe = softInfo.peakPE; | ||||||||||||||||||||
| caf_softInfo.flash_peaktime = softInfo.peaktime + softInfo.trig_ts*1e-3; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| void FillPTBTriggersSBND(const std::vector<sbn::pot::PTBInfo_t>& ptb_triggers, caf::SRTrigger& triggerInfo) { | ||||||||||||||||||||
| triggerInfo.ptb_hlt_timestamp.clear(); | ||||||||||||||||||||
| triggerInfo.ptb_hlt_bit.clear(); | ||||||||||||||||||||
| triggerInfo.ptb_llt_timestamp.clear(); | ||||||||||||||||||||
| triggerInfo.ptb_llt_bit.clear(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Decode trigger words: each set bit becomes a separate entry with the same timestamp | ||||||||||||||||||||
| for(const auto& trig : ptb_triggers) { | ||||||||||||||||||||
| std::uint64_t triggerWord = trig.triggerWord; | ||||||||||||||||||||
| for(int bit = 0; bit < 64; ++bit) { | ||||||||||||||||||||
| std::uint64_t bitMask = 1ULL << bit; | ||||||||||||||||||||
| if(triggerWord & bitMask) { | ||||||||||||||||||||
|
Comment on lines
+85
to
+88
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be more expressively be handles with bitsets:
Suggested change
(here I have also integrated another suggestion, which is to reduce the nesting within the loop by flipping the check and using |
||||||||||||||||||||
| if(trig.isHLT) { | ||||||||||||||||||||
| triggerInfo.ptb_hlt_timestamp.push_back(trig.currPTBTimeStamp); | ||||||||||||||||||||
| triggerInfo.ptb_hlt_bit.push_back(bit); | ||||||||||||||||||||
| } else { | ||||||||||||||||||||
| triggerInfo.ptb_llt_timestamp.push_back(trig.currPTBTimeStamp); | ||||||||||||||||||||
| triggerInfo.ptb_llt_bit.push_back(bit); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+89
to
+95
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To reduce code duplication, I suggest to determine the destination(s) separately from the copy. // choose whether to add this trigger to the HLT or LLT list
auto& ptb_timestamp = trig.isHLT? triggerInfo.ptb_hlt_timestamp: triggerInfo.ptb_hlt_timestamp;
auto& ptb_bit = trig.isHLT? triggerInfo.ptb_hlt_bit: triggerInfo.ptb_hlt_bit;and here:
Suggested change
This also makes it more obvious that all the triggers in one PTB record are either HLT or LLT. |
||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend this function to get the fragment directly:
and let the caller extract the data from the handle: it decouples better from the framework (plus, the caller can decide how to... handle an invalid handle).