44namespace caf
55{
66 void FillTrigger (const sbn::ExtraTriggerInfo& addltrig_info,
7- const raw::Trigger& trig,
8- caf::SRTrigger& triggerInfo,
9- const double time_offset = 0.0 )
7+ const raw::Trigger& trig,
8+ caf::SRTrigger& triggerInfo,
9+ const double time_offset = 0.0 )
1010 {
1111 triggerInfo.global_trigger_time = addltrig_info.triggerTimestamp ;
1212 triggerInfo.beam_gate_time_abs = addltrig_info.beamGateTimestamp ;
1313 triggerInfo.beam_gate_det_time = trig.BeamGateTime () + time_offset;
1414 triggerInfo.global_trigger_det_time = trig.TriggerTime () + time_offset;
15- std::cout << " Gen triggerInfo.global_trigger_det_time: " << triggerInfo.global_trigger_det_time << std::endl;
16- std::cout << " Gen triggerInfo.beam_gate_det_time: " << triggerInfo.beam_gate_det_time << std::endl;
1715 double diff_ts = triggerInfo.global_trigger_det_time - triggerInfo.beam_gate_det_time ;
18- std::cout << " diff_ts: " << diff_ts << std::endl;
1916 triggerInfo.trigger_within_gate = diff_ts;
20-
2117 triggerInfo.prev_global_trigger_time = addltrig_info.previousTriggerTimestamp ;
2218 triggerInfo.source_type = sbn::bits::value (addltrig_info.sourceType );
2319 triggerInfo.trigger_type = sbn::bits::value (addltrig_info.triggerType );
@@ -29,23 +25,34 @@ namespace caf
2925
3026 }
3127
32- void FillTriggerMC (double absolute_time, caf::SRTrigger& triggerInfo) {
28+ void FillTriggerMC (double absolute_time, caf::SRTrigger& triggerInfo)
29+ {
3330 triggerInfo.global_trigger_time = absolute_time;
3431 triggerInfo.beam_gate_time_abs = absolute_time;
32+ triggerInfo.trigger_within_gate = 0 .; // Set this to 0 since the "MC" trigger is (for now) always at the spill time
33+ }
3534
36- // Set this to 0 since the "MC" trigger is (for now) always at the spill time
37- triggerInfo.trigger_within_gate = 0 .;
35+ void FillTriggerICARUS (const sbn::ExtraTriggerInfo& addltrig_info,
36+ caf::SRTrigger& triggerInfo)
37+ {
38+ // Choose the cryostat that triggered first (if both are available)
39+ int const cryo = addltrig_info.cryostats [sbn::ExtraTriggerInfo::EastCryostat].beamToTrigger < addltrig_info.cryostats [sbn::ExtraTriggerInfo::WestCryostat].beamToTrigger
40+ ? sbn::ExtraTriggerInfo::EastCryostat
41+ : sbn::ExtraTriggerInfo::WestCryostat;
3842
43+ sbn::ExtraTriggerInfo::CryostatInfo const & cryoInfo = addltrig_info.cryostats [cryo];
44+ if (cryoInfo.hasTrigger ()) {
45+ triggerInfo.trigger_cryo_source = cryo;
46+ triggerInfo.trigger_logic_bits = cryoInfo.triggerLogicBits ;
47+ triggerInfo.gate_to_trigger_time = static_cast <float >(cryoInfo.beamToTrigger ) / 1000 .0f ; // [us]
48+ }
3949 }
4050
4151 void FillTriggerSBND (caf::SRSBNDTimingInfo& timingInfo, caf::SRTrigger& triggerInfo){
4252
4353 triggerInfo.global_trigger_time = timingInfo.hltEtrig ;
4454 triggerInfo.beam_gate_time_abs = timingInfo.hltBeamGate ;
45- std::cout << " triggerInfo.global_trigger_det_time: " << triggerInfo.global_trigger_det_time << std::endl;
46- std::cout << " triggerInfo.beam_gate_det_time: " << triggerInfo.beam_gate_det_time << std::endl;
4755 double diff_ts = triggerInfo.global_trigger_det_time - triggerInfo.beam_gate_det_time ;
48- std::cout << " diff_ts: " << diff_ts << std::endl;
4956 triggerInfo.trigger_within_gate = diff_ts;
5057 }
5158
@@ -59,7 +66,11 @@ namespace caf
5966 triggerInfo.monpulse_sizes = *monpulseSizes;
6067 triggerInfo.num_pairs_over_threshold = *numPairs;
6168 triggerInfo.passed_trigger = *passedTrig;
62-
6369 }
6470
71+ void FillSoftwareTriggerSBND (const sbnd::trigger::pmtSoftwareTrigger& softInfo, caf::SRSoftwareTrigger& caf_softInfo){
72+ caf_softInfo.npmts = softInfo.nAboveThreshold ;
73+ caf_softInfo.flash_peakpe = softInfo.peakPE ;
74+ caf_softInfo.flash_peaktime = softInfo.peaktime + softInfo.trig_ts *1e-3 ;
75+ }
6576}
0 commit comments