Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions sbncode/CAFMaker/CAFMaker_module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
caf::SRTrigger srtrigger;
if (isValidTrigger) {
FillTrigger(*extratrig_handle, trig_handle->at(0), srtrigger, triggerShift);
FillTriggerICARUS(*extratrig_handle, srtrigger);
Comment on lines 1578 to +1580
Copy link
Member

Choose a reason for hiding this comment

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

What guards FillTriggerICARUS from being called when building CAFs for SBND?
And if so, would it cause an error if the information is not available?

Maybe you should do as below?

f(fDet == kICARUS) FillTriggerICARUS(*extratrig_handle, srtrigger);

Copy link
Member

Choose a reason for hiding this comment

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

I don't believe SBND fills sbn::ExtraTriggerInfo (they could at least in part, and maybe they will in the future), in which case isValidTrigger is false and nothing is filled (!).

At this point, the code is written in such a way that if SBND fills the appropriate information in sbn::ExtraTriggerInfo, it will be correctly copied to the CAF object. On the other end, if we really want this function to also support SBND we should (a) listen to SBND comments and (b) name it accordingly.
For point (a), since there is a new SBN trigger efficiency group, I have added @terezakroupa as reviewer, and we can explain her in short what this is about too.

}
// 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?
Expand Down
28 changes: 20 additions & 8 deletions sbncode/CAFMaker/FillTrigger.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@
namespace caf
{
void FillTrigger(const sbn::ExtraTriggerInfo& addltrig_info,
const raw::Trigger& trig,
caf::SRTrigger& triggerInfo,
const double time_offset = 0.0)
const raw::Trigger& trig,
caf::SRTrigger& triggerInfo,
const double time_offset = 0.0)
{
triggerInfo.global_trigger_time = addltrig_info.triggerTimestamp;
triggerInfo.beam_gate_time_abs = addltrig_info.beamGateTimestamp;
triggerInfo.beam_gate_det_time = trig.BeamGateTime() + time_offset;
triggerInfo.global_trigger_det_time = trig.TriggerTime() + time_offset;
double diff_ts = triggerInfo.global_trigger_det_time - triggerInfo.beam_gate_det_time;
triggerInfo.trigger_within_gate = diff_ts;

triggerInfo.prev_global_trigger_time = addltrig_info.previousTriggerTimestamp;
triggerInfo.source_type = sbn::bits::value(addltrig_info.sourceType);
triggerInfo.trigger_type = sbn::bits::value(addltrig_info.triggerType);
Expand All @@ -25,14 +24,27 @@ namespace caf
triggerInfo.gate_delta = addltrig_info.gateCountFromPreviousTrigger;
}

void FillTriggerMC(double absolute_time, caf::SRTrigger& triggerInfo) {
void FillTriggerMC(double absolute_time, caf::SRTrigger& triggerInfo)
{
triggerInfo.global_trigger_time = absolute_time;
triggerInfo.beam_gate_time_abs = absolute_time;
triggerInfo.trigger_within_gate = 0.; // Set this to 0 since the "MC" trigger is (for now) always at the spill time
}

// Set this to 0 since the "MC" trigger is (for now) always at the spill time
triggerInfo.trigger_within_gate = 0.;
void FillTriggerICARUS(const sbn::ExtraTriggerInfo& addltrig_info,
caf::SRTrigger& triggerInfo)
{
// Choose the cryostat that triggered first (if both are available)
int const cryo = addltrig_info.cryostats[sbn::ExtraTriggerInfo::EastCryostat].beamToTrigger < addltrig_info.cryostats[sbn::ExtraTriggerInfo::WestCryostat].beamToTrigger
? sbn::ExtraTriggerInfo::EastCryostat
: sbn::ExtraTriggerInfo::WestCryostat;

// TODO: fill others?
sbn::ExtraTriggerInfo::CryostatInfo const& cryoInfo = addltrig_info.cryostats[cryo];
if (cryoInfo.hasTrigger()) {
triggerInfo.trigger_cryo_source = cryo;
triggerInfo.trigger_logic_bits = cryoInfo.triggerLogicBits;
triggerInfo.gate_to_trigger_time = static_cast<float>(cryoInfo.beamToTrigger) / 1000.0f; // [us]
}
}

}
5 changes: 2 additions & 3 deletions sbncode/CAFMaker/FillTrigger.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@
#include "sbnanaobj/StandardRecord/SRTrigger.h"
#include "lardataobj/RawData/TriggerData.h"

#include <vector>

namespace caf
{

void FillTrigger(const sbn::ExtraTriggerInfo& addltrig_info,
const raw::Trigger& trig_info,
caf::SRTrigger& triggerInfo,
const double time_offset);

void FillTriggerMC(double absolute_time, caf::SRTrigger& triggerInfo);

void FillTriggerICARUS(const sbn::ExtraTriggerInfo& addltrig_info,
caf::SRTrigger& triggerInfo);
}

#endif