Skip to content

Commit d227faf

Browse files
authored
Merge branch 'develop' into feature/lynnt_Fall25_pmtmetrics
2 parents 55b7f12 + b9afc9f commit d227faf

6 files changed

Lines changed: 79 additions & 26 deletions

File tree

sbncode/CAFMaker/CAFMaker_module.cc

Lines changed: 3 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) {
@@ -2533,7 +2535,7 @@ void CAFMaker::produce(art::Event& evt) noexcept {
25332535
assert(thisShower.size() == 1);
25342536

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

25382540
// We may have many residuals per shower depending on how many showers ar in the slice
25392541
if (fmShowerRazzle.isValid() && fmShowerRazzle.at(iPart).size()==1) {

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: 20 additions & 13 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

sbncode/CAFMaker/FillTrigger.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
#include "art/Framework/Principal/Handle.h"
1111
#include "sbndaq-artdaq-core/Obj/SBND/pmtSoftwareTrigger.hh"
1212

13-
#include <vector>
14-
1513
namespace caf
1614
{
17-
1815
void FillTrigger(const sbn::ExtraTriggerInfo& addltrig_info,
1916
const raw::Trigger& trig_info,
2017
caf::SRTrigger& triggerInfo,
2118
const double time_offset);
2219

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

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

2727
void FillTriggerEmulation(art::Handle<std::vector<int>> const& monpulsesFlat,

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)