2626
2727#include " sbnobj/Common/POTAccounting/BNBSpillInfo.h"
2828
29+ #include " sbncode/BeamSpillInfoRetriever/POTTools.h"
30+ #include " sbncode/BeamSpillInfoRetriever/getFOM.h"
31+
2932#include " ifdh_art/IFBeamService/IFBeam_service.h"
3033#include " ifbeam_c.h"
3134#include " MWRData.h"
@@ -130,6 +133,8 @@ class sbn::BNBRetriever : public art::EDProducer {
130133 //
131134 art::ServiceHandle<ifbeam_ns::IFBeam> ifbeam_handle;
132135 std::unique_ptr<ifbeam_ns::BeamFolder> bfp;
136+ std::unique_ptr<ifbeam_ns::BeamFolder> offsets;
137+ std::unique_ptr<ifbeam_ns::BeamFolder> vp873;
133138 std::unique_ptr<ifbeam_ns::BeamFolder> bfp_mwr;
134139
135140 //
@@ -260,6 +265,8 @@ sbn::BNBRetriever::BNBRetriever(Parameters const& params)
260265 raw_data_label(params().RawDataLabel()),
261266 fDeviceUsedForTiming(params().DeviceUsedForTiming()),
262267 bfp( ifbeam_handle->getBeamFolder (params().Bundle(), params().URL(), params().TimeWindow())),
268+ vp873( ifbeam_handle->getBeamFolder (params().VP873Bundle(), params().URL(), params().TimeWindow())),
269+ offsets( ifbeam_handle->getBeamFolder (params().OffsetBundle(), params().URL(), params().TimeWindow())),
263270 bfp_mwr( ifbeam_handle->getBeamFolder (params().MultiWireBundle(), params().URL(), params().MWR_TimeWindow())),
264271 fTriggerDatabaseFile(params().TriggerDatabaseFile())
265272{
@@ -278,7 +285,9 @@ sbn::BNBRetriever::BNBRetriever(Parameters const& params)
278285 //
279286 bfp->set_epsilon (0.02 ); // 20 ms, this was tuned by hand and compared to IFBeamDB times
280287 bfp_mwr->set_epsilon (0.5 );
281-
288+ vp873->set_epsilon (0.02 );
289+ offsets->set_epsilon (600 );
290+
282291 // bfp_mwr->setValidWindow(86400);
283292 bfp_mwr->setValidWindow (3605 );
284293 produces< std::vector< sbn::BNBSpillInfo >, art::InSubRun >();
@@ -633,8 +642,9 @@ int sbn::BNBRetriever::matchMultiWireData(
633642
634643 }// end loop over MWR devices
635644
636- sbn::BNBSpillInfo spillInfo = makeBNBSpillInfo (eventID, times_temps[i], MWRdata, matched_MWR);
637-
645+ sbn::BNBSpillInfo spillInfo = sbn::pot::makeBNBSpillInfo (eventID, times_temps[i], MWRdata, matched_MWR, bfp, offsets, vp873);
646+ double const spillFOM = sbn::getBNBqualityFOM (spillInfo);
647+ spillInfo.FOM = spillFOM;
638648 beamInfos.push_back (std::move (spillInfo));
639649
640650 // We do not write these to the art::Events because
0 commit comments