Skip to content

Commit f4ece9f

Browse files
authored
Merge branch 'develop' into feature/bearc_fixmultipart
2 parents 80f82b0 + 54f41b8 commit f4ece9f

8 files changed

Lines changed: 106 additions & 28 deletions

File tree

sbncode/CAFMaker/CAFMakerParams.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,12 @@ namespace caf
363363
"" // sbnd
364364
};
365365

366+
Atom<string> SBNDSoftwareTriggerLabel{
367+
Name("SBNDSoftwareTriggerLabel"),
368+
Comment("Label for software trigger producer"),
369+
"" // sbnd
370+
};
371+
366372
Atom<string> CRTPMTLabel {
367373
Name("CRTPMTLabel"),
368374
Comment("Label for the CRTPMT Matched variables from the crtpmt data product"),

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,6 +1703,8 @@ void CAFMaker::produce(art::Event& evt) noexcept {
17031703
caf::SRTrigger srtrigger;
17041704
if (isValidTrigger) {
17051705
FillTrigger(*extratrig_handle, trig_handle->at(0), srtrigger, triggerShift);
1706+
if (fDet == kICARUS)
1707+
FillTriggerICARUS(*extratrig_handle, srtrigger);
17061708
}
17071709
// Fill trigger emulation information
17081710
if (isValidEmulationTrigger) {
@@ -1739,6 +1741,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
17391741
caf::SRSBNDCRTVeto srsbndcrtveto;
17401742
caf::SRSBNDFrameShiftInfo srsbndframeshiftinfo;
17411743
caf::SRSBNDTimingInfo srsbndtiminginfo;
1744+
caf::SRSoftwareTrigger srsbndsofttrig;
17421745

17431746
// Mapping of (feb, channel) to truth information (AuxDetSimChannel) -- filled for ICARUS
17441747
std::map<std::pair<int, int>, sim::AuxDetSimChannel> crtsimchanmap;
@@ -1841,6 +1844,15 @@ void CAFMaker::produce(art::Event& evt) noexcept {
18411844
sbnd::timing::TimingInfo const& sbndtiminginfo(*sbndtiminginfo_handle);
18421845
FillSBNDTimingInfo(sbndtiminginfo, srsbndtiminginfo);
18431846
}
1847+
1848+
art::Handle<std::vector<sbnd::trigger::pmtSoftwareTrigger>> sbndsofttrig_handle;
1849+
GetByLabelStrict(evt, fParams.SBNDSoftwareTriggerLabel(), sbndsofttrig_handle);
1850+
if (sbndsofttrig_handle.isValid()){
1851+
const std::vector<sbnd::trigger::pmtSoftwareTrigger> &sbndsofttrig = *sbndsofttrig_handle;
1852+
if (sbndsofttrig.size()==1){
1853+
FillSoftwareTriggerSBND(sbndsofttrig.at(0), srsbndsofttrig);
1854+
}
1855+
}
18441856
}
18451857

18461858
// Get all of the CRTPMT Matches
@@ -2523,7 +2535,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
25232535
assert(thisShower.size() == 1);
25242536

25252537
SRShower& shw = pfp.shw;
2526-
FillShowerVars(*thisShower[0], vertex, fmShowerHit.at(iPart), wireReadout, producer, shw);
2538+
FillShowerVars(*thisShower[0], vertex, fmShowerHit.at(iPart), wireReadout, producer, shw, fDet);
25272539

25282540
// We may have many residuals per shower depending on how many showers ar in the slice
25292541
if (fmShowerRazzle.isValid() && fmShowerRazzle.at(iPart).size()==1) {
@@ -2588,6 +2600,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
25882600
rec.nopflashes = srflashes.size();
25892601
rec.sbnd_frames = srsbndframeshiftinfo;
25902602
rec.sbnd_timings = srsbndtiminginfo;
2603+
rec.soft_trig = srsbndsofttrig;
25912604

25922605
if (fParams.FillTrueParticles()) {
25932606
rec.true_particles = true_particles;

sbncode/CAFMaker/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ art_make_library( LIBRARY_NAME sbncode_CAFMaker
4343
art::Framework_Services_System_TriggerNamesService_service
4444
sbncode_Metadata_MetadataSBN_service
4545
larsim::Utils
46-
larevt::SpaceCharge
46+
larevt::SpaceCharge
4747
systematicstools::interface
4848
systematicstools::interpreters
4949
systematicstools::utility
5050
${GENIE_LIB_LIST}
5151
nugen::EventGeneratorBase_GENIE
52+
sbndaq_artdaq_core::sbndaq-artdaq-core_Obj_SBND
5253
)
5354

5455
cet_build_plugin ( CAFMaker art::module

sbncode/CAFMaker/FillReco.cxx

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ namespace caf
391391
const geo::WireReadoutGeom& wireReadout,
392392
unsigned producer,
393393
caf::SRShower &srshower,
394+
Det_t det,
394395
bool allowEmpty)
395396
{
396397

@@ -411,11 +412,56 @@ namespace caf
411412
// It's sth like this but not quite. And will need to pass a simb::MCtruth object vtx position anyway.
412413
// srshower.conversion_gap = (shower.ShowerStart() - vertex.Position()).Mag();
413414

414-
if(shower.best_plane() != -999){
415-
srshower.bestplane = shower.best_plane();
416-
srshower.bestplane_dEdx = srshower.plane[shower.best_plane()].dEdx;
417-
srshower.bestplane_energy = srshower.plane[shower.best_plane()].energy;
418-
}
415+
for(int p = 0; p < 3; ++p) srshower.plane[p].nHits = 0;
416+
for (auto const& hit:hits) ++srshower.plane[hit->WireID().Plane].nHits;
417+
418+
if(det == kSBND)
419+
{
420+
int bestplane_for_energy = -999;
421+
int mosthits = -1;
422+
for(int p = 0; p < 3; ++p)
423+
{
424+
if((int)srshower.plane[p].nHits > mosthits)
425+
{
426+
mosthits = srshower.plane[p].nHits;
427+
bestplane_for_energy = p;
428+
}
429+
}
430+
431+
if(bestplane_for_energy != -999)
432+
{
433+
srshower.bestplane_for_energy = bestplane_for_energy;
434+
srshower.bestplane_energy = srshower.plane[bestplane_for_energy].energy;
435+
}
436+
437+
if(shower.best_plane() != -999 && srshower.plane[shower.best_plane()].dEdx != -999)
438+
{
439+
srshower.bestplane_for_dedx = shower.best_plane();
440+
srshower.bestplane_dEdx = srshower.plane[shower.best_plane()].dEdx;
441+
}
442+
else
443+
{
444+
for(int p = 2; p >= 0; --p)
445+
{
446+
if(srshower.plane[p].dEdx != -999)
447+
{
448+
srshower.bestplane_for_dedx = p;
449+
srshower.bestplane_dEdx = srshower.plane[shower.best_plane()].dEdx;
450+
break;
451+
}
452+
}
453+
}
454+
}
455+
else
456+
{
457+
if(shower.best_plane() != -999)
458+
{
459+
srshower.bestplane_for_energy = shower.best_plane();
460+
srshower.bestplane_for_dedx = shower.best_plane();
461+
srshower.bestplane_dEdx = srshower.plane[shower.best_plane()].dEdx;
462+
srshower.bestplane_energy = srshower.plane[shower.best_plane()].energy;
463+
}
464+
}
419465

420466
if(shower.has_open_angle())
421467
srshower.open_angle = shower.OpenAngle();
@@ -438,9 +484,6 @@ namespace caf
438484
srshower.end = shower.ShowerStart()+ (shower.Length() * shower.Direction());
439485
}
440486

441-
for(int p = 0; p < 3; ++p) srshower.plane[p].nHits = 0;
442-
for (auto const& hit:hits) ++srshower.plane[hit->WireID().Plane].nHits;
443-
444487
for (geo::PlaneGeo const& plane: wireReadout.Iterate<geo::PlaneGeo>()) {
445488

446489
const double angleToVert(wireReadout.WireAngleToVertical(plane.View(), plane.ID()) - 0.5*M_PI);

sbncode/CAFMaker/FillReco.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ namespace caf
7070
const geo::WireReadoutGeom& wireReadout,
7171
unsigned producer,
7272
caf::SRShower& srshower,
73+
Det_t det,
7374
bool allowEmpty = false);
7475

7576
void FillShowerRazzle(const art::Ptr<sbn::MVAPID> razzle,

sbncode/CAFMaker/FillTrigger.cxx

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,16 @@
44
namespace 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
}

sbncode/CAFMaker/FillTrigger.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,32 @@
44
#include "sbnobj/Common/Trigger/ExtraTriggerInfo.h"
55
#include "sbnobj/Common/Trigger/BeamBits.h"
66
#include "sbnanaobj/StandardRecord/SRTrigger.h"
7+
#include "sbnanaobj/StandardRecord/SRSoftwareTrigger.h"
78
#include "sbnanaobj/StandardRecord/SRSBNDTimingInfo.h"
89
#include "lardataobj/RawData/TriggerData.h"
910
#include "art/Framework/Principal/Handle.h"
10-
11-
#include <vector>
11+
#include "sbndaq-artdaq-core/Obj/SBND/pmtSoftwareTrigger.hh"
1212

1313
namespace caf
1414
{
15-
1615
void FillTrigger(const sbn::ExtraTriggerInfo& addltrig_info,
1716
const raw::Trigger& trig_info,
1817
caf::SRTrigger& triggerInfo,
1918
const double time_offset);
2019

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

22+
void FillTriggerICARUS(const sbn::ExtraTriggerInfo& addltrig_info,
23+
caf::SRTrigger& triggerInfo);
24+
2325
void FillTriggerSBND(caf::SRSBNDTimingInfo& timingInfo, caf::SRTrigger& triggerInfo);
2426

2527
void FillTriggerEmulation(art::Handle<std::vector<int>> const& monpulsesFlat,
2628
art::Handle<std::vector<int>> const& monpulseSizes,
2729
art::Handle<int> const& numPairs,
2830
art::Handle<bool> const& passedTrig,
2931
caf::SRTrigger& triggerInfo);
32+
void FillSoftwareTriggerSBND(const sbnd::trigger::pmtSoftwareTrigger& softInfo, caf::SRSoftwareTrigger& caf_softInfo);
3033
}
3134

3235
#endif

sbncode/EventGenerator/MeVPrtl/Tools/Higgs/HiggsMakeDecay_tool.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ double PionPartialWidth(double pion_mass, double higs_mass, double mixing) {
140140
}
141141

142142
double PiPlusPartialWidth(double higs_mass, double mixing) {
143-
return PionPartialWidth(Constants::Instance().piplus_mass, higs_mass, mixing);
143+
return 2*PionPartialWidth(Constants::Instance().piplus_mass, higs_mass, mixing);
144144
}
145145

146146
double PiZeroPartialWidth(double higs_mass, double mixing) {

0 commit comments

Comments
 (0)