Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
706c4d8
Update SystToolsEventWeight for dependent dials
jedori0228 Jun 2, 2023
f0c3c49
Duplicated declaration of fParameterSet removed
jedori0228 Jun 12, 2023
1407062
Updated to TriggerV3
Jun 21, 2023
f24eba3
Updated to Trigger V3
Jun 21, 2023
515724c
Update CAFMaker to save offbeam gate count
jacoblarkin Jun 22, 2023
c0f90b5
Update Params to match Joseph's PR
jacoblarkin Jun 23, 2023
0af7a05
Check whether both numi/bnb and offbeam/onbeam are filled and print e…
jacoblarkin Jun 23, 2023
12aa749
Update logger for SystToolsEventWeight_module.cc
jedori0228 Jun 25, 2023
0651c08
make check for multiple spill products more robust
jacoblarkin Jun 26, 2023
58c6946
Update SystToolsEventWeight module to treat isCorrection=true paramhe…
jedori0228 Jul 27, 2023
73c8201
Add the MicroBooNE weight calculator that interfaces with geant4reweight
sjgardiner Jul 25, 2023
2bf4884
Some tweaks to adjust for larsim EventWeight (used by uB) vs.
sjgardiner Jul 25, 2023
444f8c1
geant4reweight interface updates + generic sbn fcls
mastbaum Jul 26, 2023
192a028
g4reweight bugfix and temporary parameter storage
mastbaum Jul 27, 2023
60b48df
Fill true trajectory points.
Jul 28, 2023
8ccae1d
Disable cross-plane stub merging.
Jul 28, 2023
99d77ce
For cosmics that are crossing the cathode we added T0 information in …
gMoreno05 Sep 19, 2023
1ce518e
exclude region feature
Sep 15, 2023
d4af5fe
restructure, skip out of fv hits
Sep 18, 2023
3d2e2c8
Allow time shift in trigger to IFBeam timing. Skip first event in str…
Jul 28, 2023
cbc6213
Merge branch 'feature/jskim_SystToolsUpdate_v09_72_00_03' into featur…
Oct 22, 2023
7a40e9e
Merge branch 'gray_g4rwgt' into feature/gputnam-configs
Oct 22, 2023
e15fa37
Merge branch 'feature/Zennnamo_POT_Trigv3_fix_production_branch' into…
Oct 22, 2023
6f09e1b
Update sbndata
Oct 22, 2023
e2a5cd8
Update systematics versions.
Oct 22, 2023
e32adbc
Include Geant4 libraries for buiding
Oct 22, 2023
b03a6e5
Fix ALP mass suppression.
Oct 22, 2023
abaafef
Merge branch 'feature/jlarkin_offbeam_gates_prod' into feature/gputna…
Oct 22, 2023
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 CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ find_package( CLHEP REQUIRED )
find_package( ROOT REQUIRED )
find_package( Geant4 REQUIRED )
find_package( Boost COMPONENTS system filesystem REQUIRED )
find_package( geant4reweight REQUIRED )

# macros for dictionary and simple_plugin
include(ArtDictionary)
Expand Down
2 changes: 2 additions & 0 deletions fcl/caf/cafmaker_common_defs.fcl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "eventweight_geant4_sbn.fcl"
#include "eventweight_genie_sbn.fcl"
#include "eventweight_flux_sbn.fcl"

Expand All @@ -15,6 +16,7 @@ cafmaker_common_producers: {
rns: { module_type: "RandomNumberSaver" }
genieweight: @local::sbn_eventweight_genie
fluxweight: @local::sbn_eventweight_flux
geant4weight: @local::sbn_eventweight_geant4
}

END_PROLOG
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is probably best left for this PR:
#394

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
////////////////////////////////////////////////////////////////////////
// Class: EXTRetriever
// Class: BNBEXTRetriever
// Plugin Type: producer
// File: EXTRetriever_module.cc
// File: BNBEXTRetriever_module.cc
//
// Created by hand Thurs June 24th 2021 by J. Zennamo (FNAL)
//
Expand All @@ -22,7 +22,7 @@
#include "larcorealg/Geometry/Exceptions.h"

#include "artdaq-core/Data/Fragment.hh"
#include "sbndaq-artdaq-core/Overlays/ICARUS/ICARUSTriggerUDPFragment.hh"
#include "sbndaq-artdaq-core/Overlays/ICARUS/ICARUSTriggerV3Fragment.hh"

#include "lardataalg/DetectorInfo/DetectorPropertiesStandard.h"
#include "lardata/DetectorInfoServices/DetectorPropertiesService.h"
Expand All @@ -36,10 +36,10 @@
#include <time.h>

namespace sbn {
class EXTRetriever;
class BNBEXTRetriever;
}

class sbn::EXTRetriever : public art::EDProducer {
class sbn::BNBEXTRetriever : public art::EDProducer {
public:

struct Config {
Expand All @@ -57,15 +57,15 @@ class sbn::EXTRetriever : public art::EDProducer {
using Parameters = art::EDProducer::Table<Config>;


explicit EXTRetriever(Parameters const& params);
explicit BNBEXTRetriever(Parameters const& params);
// The compiler-generated destructor is fine for non-base
// classes without bare pointers or other resource use.

// Plugins should not be copied or assigned.
EXTRetriever(EXTRetriever const&) = delete;
EXTRetriever(EXTRetriever&&) = delete;
EXTRetriever& operator=(EXTRetriever const&) = delete;
EXTRetriever& operator=(EXTRetriever&&) = delete;
BNBEXTRetriever(BNBEXTRetriever const&) = delete;
BNBEXTRetriever(BNBEXTRetriever&&) = delete;
BNBEXTRetriever& operator=(BNBEXTRetriever const&) = delete;
BNBEXTRetriever& operator=(BNBEXTRetriever&&) = delete;

// Required functions.
void produce(art::Event& e) override;
Expand All @@ -82,7 +82,7 @@ class sbn::EXTRetriever : public art::EDProducer {
};


sbn::EXTRetriever::EXTRetriever(Parameters const& params)
sbn::BNBEXTRetriever::BNBEXTRetriever(Parameters const& params)
: EDProducer{params},
raw_data_label_(params().RawDataLabel())
{
Expand All @@ -91,7 +91,7 @@ sbn::EXTRetriever::EXTRetriever(Parameters const& params)
TotalEXTCounts = 0;
}

void sbn::EXTRetriever::produce(art::Event& e)
void sbn::BNBEXTRetriever::produce(art::Event& e)
{

//Here we read in the artdaq Fragments and extract three pieces of information:
Expand All @@ -100,19 +100,22 @@ void sbn::EXTRetriever::produce(art::Event& e)
// 3. the number of beam spills since the previously triggered event, number_of_gates_since_previous_event

int gate_type = 0;
auto const & raw_data = e.getProduct< std::vector<artdaq::Fragment> >({ raw_data_label_, "ICARUSTriggerUDP" });
auto const & raw_data = e.getProduct< std::vector<artdaq::Fragment> >({ raw_data_label_, "ICARUSTriggerV3" });

unsigned int number_of_gates_since_previous_event = 0;

for(auto raw_datum : raw_data){

icarus::ICARUSTriggerUDPFragment frag(raw_datum);
icarus::ICARUSTriggerV3Fragment frag(raw_datum);
std::string data = frag.GetDataString();
char *buffer = const_cast<char*>(data.c_str());
icarus::ICARUSTriggerInfo datastream_info = icarus::parse_ICARUSTriggerString(buffer);
icarus::ICARUSTriggerInfo datastream_info = icarus::parse_ICARUSTriggerV3String(buffer);
gate_type = datastream_info.gate_type;
number_of_gates_since_previous_event = frag.getDeltaGatesBNB();
number_of_gates_since_previous_event = frag.getDeltaGatesBNBOffMaj();

std::cout << "BNB OFF MAJ : " << frag.getDeltaGatesBNBOffMaj() << std::endl;
std::cout << "NuMI OFF MAJ : " << frag.getDeltaGatesNuMIOffMaj() << std::endl;

}

//We only want to process EXT gates, i.e. type 3
Expand All @@ -135,13 +138,13 @@ void sbn::EXTRetriever::produce(art::Event& e)
} //end loop over events


void sbn::EXTRetriever::beginSubRun(art::SubRun& sr)
void sbn::BNBEXTRetriever::beginSubRun(art::SubRun& sr)
{
return;
}

//____________________________________________________________________________
void sbn::EXTRetriever::endSubRun(art::SubRun& sr)
void sbn::BNBEXTRetriever::endSubRun(art::SubRun& sr)
{
// We will add all of the EXTCountInfo data-products to the
// art::SubRun so it persists
Expand All @@ -152,4 +155,4 @@ void sbn::EXTRetriever::endSubRun(art::SubRun& sr)
return;
}

DEFINE_ART_MODULE(sbn::EXTRetriever)
DEFINE_ART_MODULE(sbn::BNBEXTRetriever)
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is probably best left for this PR:
#394

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

cet_build_plugin(EXTRetriever art::module
cet_build_plugin(BNBEXTRetriever art::module
LIBRARIES
art::Persistency_Common
art::Utilities canvas::canvas
Expand Down
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is probably best left for this PR:
#394

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "larcorealg/CoreUtils/counter.h"

#include "artdaq-core/Data/Fragment.hh"
#include "sbndaq-artdaq-core/Overlays/ICARUS/ICARUSTriggerV2Fragment.hh"
#include "sbndaq-artdaq-core/Overlays/ICARUS/ICARUSTriggerV3Fragment.hh"

#include "sbnobj/Common/POTAccounting/BNBSpillInfo.h"

Expand Down Expand Up @@ -245,23 +245,23 @@ sbn::BNBRetriever::TriggerInfo_t sbn::BNBRetriever::extractTriggerInfo(art::Even
// 2. the time of the previously triggered event, t_previous_event (NOTE: Events are non-sequential!)
// 3. the number of beam spills since the previously triggered event, number_of_gates_since_previous_event

auto const & raw_data = e.getProduct< std::vector<artdaq::Fragment> >({ raw_data_label, "ICARUSTriggerV2" });
auto const & raw_data = e.getProduct< std::vector<artdaq::Fragment> >({ raw_data_label, "ICARUSTriggerV3" });

TriggerInfo_t triggerInfo;

for(auto raw_datum : raw_data){

uint64_t artdaq_ts = raw_datum.timestamp();
icarus::ICARUSTriggerV2Fragment frag(raw_datum);
icarus::ICARUSTriggerV3Fragment frag(raw_datum);
std::string data = frag.GetDataString();
char *buffer = const_cast<char*>(data.c_str());
icarus::ICARUSTriggerInfo datastream_info = icarus::parse_ICARUSTriggerV2String(buffer);
icarus::ICARUSTriggerInfo datastream_info = icarus::parse_ICARUSTriggerV3String(buffer);
triggerInfo.gate_type = datastream_info.gate_type;
triggerInfo.number_of_gates_since_previous_event = frag.getDeltaGatesBNB();
triggerInfo.number_of_gates_since_previous_event = frag.getDeltaGatesBNBMaj();

triggerInfo.t_current_event = static_cast<double>(artdaq_ts)/(1000000000.0); //check this offset...
if(triggerInfo.gate_type == 1)
triggerInfo.t_previous_event = (static_cast<double>(frag.getLastTimestampBNB()))/(1e9);
triggerInfo.t_previous_event = (static_cast<double>(frag.getLastTimestampBNBMaj()))/(1e9);
else
triggerInfo.t_previous_event = (static_cast<double>(frag.getLastTimestampOther()))/(1000000000.0);

Expand Down
3 changes: 2 additions & 1 deletion sbncode/BeamSpillInfoRetriever/CMakeLists.txt
Copy link
Contributor

Choose a reason for hiding this comment

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

This change is probably best left for this PR:
#394

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_subdirectory(BNBRetriever)
add_subdirectory(NuMIRetriever)
add_subdirectory(EXTRetriever)
add_subdirectory(BNBEXTRetriever)
add_subdirectory(NuMIEXTRetriever)
add_subdirectory(job)

install_headers()
Expand Down
20 changes: 20 additions & 0 deletions sbncode/BeamSpillInfoRetriever/NuMIEXTRetriever/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

cet_build_plugin(NuMIEXTRetriever art::module
LIBRARIES
art::Persistency_Common
art::Utilities canvas::canvas
cetlib::cetlib cetlib_except::cetlib_except
messagefacility::MF_MessageLogger
sbnobj::Common_POTAccounting
sbndaq_artdaq_core::sbndaq-artdaq-core_Overlays_Common
sbndaq_artdaq_core::sbndaq-artdaq-core_Overlays
sbndaq_artdaq_core::sbndaq-artdaq-core_Overlays_ICARUS
artdaq_core::artdaq-core_Utilities
lardata::Utilities
larcore::Geometry_AuxDetGeometry_service
)

install_headers()
install_fhicl()
install_source()

Copy link
Contributor

Choose a reason for hiding this comment

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

This looks good, I might add a portion which corrects for the minbias gates directly to this accounting, something like this:

  if(evtCount != 0 && totalMinBias != 0)
    scale_factor = 1. - (evtCount/totalMinBias);

from https://github.com/SBNSoftware/sbncode/pull/394/files

Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
////////////////////////////////////////////////////////////////////////
// Class: NuMIEXTRetriever
// Plugin Type: producer
// File: NuMIEXTRetriever_module.cc
//
// Created by hand Thurs June 24th 2021 by J. Zennamo (FNAL)
//
////////////////////////////////////////////////////////////////////////

#include "art/Framework/Core/EDProducer.h"
#include "art/Framework/Core/ModuleMacros.h"
#include "art/Framework/Principal/Event.h"
#include "art/Framework/Principal/Handle.h"
#include "art/Framework/Principal/Run.h"
#include "art/Framework/Principal/SubRun.h"
#include "canvas/Utilities/InputTag.h"
#include "fhiclcpp/types/Atom.h"
#include "messagefacility/MessageLogger/MessageLogger.h"
#include "lardata/Utilities/AssociationUtil.h"
#include "lardataobj/Utilities/sparse_vector.h"
#include "larcoreobj/SimpleTypesAndConstants/RawTypes.h"
#include "larcorealg/Geometry/Exceptions.h"

#include "artdaq-core/Data/Fragment.hh"
#include "sbndaq-artdaq-core/Overlays/ICARUS/ICARUSTriggerV3Fragment.hh"

#include "lardataalg/DetectorInfo/DetectorPropertiesStandard.h"
#include "lardata/DetectorInfoServices/DetectorPropertiesService.h"
#include "sbnobj/Common/POTAccounting/EXTCountInfo.h"

#include <memory>
#include <optional>
#include <vector>
#include <stdio.h>
#include <string.h>
#include <time.h>

namespace sbn {
class NuMIEXTRetriever;
}

class sbn::NuMIEXTRetriever : public art::EDProducer {
public:

struct Config {

using Name = fhicl::Name;
using Comment = fhicl::Comment;

fhicl::Atom<std::string> RawDataLabel {
Name{ "raw_data_label" },
Comment{ "art data product instance name for trigger information (product label is 'daq')" }
};

}; // Config

using Parameters = art::EDProducer::Table<Config>;


explicit NuMIEXTRetriever(Parameters const& params);
// The compiler-generated destructor is fine for non-base
// classes without bare pointers or other resource use.

// Plugins should not be copied or assigned.
NuMIEXTRetriever(NuMIEXTRetriever const&) = delete;
NuMIEXTRetriever(NuMIEXTRetriever&&) = delete;
NuMIEXTRetriever& operator=(NuMIEXTRetriever const&) = delete;
NuMIEXTRetriever& operator=(NuMIEXTRetriever&&) = delete;

// Required functions.
void produce(art::Event& e) override;
void beginSubRun(art::SubRun& sr) override;
void endSubRun(art::SubRun& sr) override;

private:
std::vector< sbn::EXTCountInfo > fOutExtInfos;

// input labels
std::string raw_data_label_;
int TotalEXTCounts;

};


sbn::NuMIEXTRetriever::NuMIEXTRetriever(Parameters const& params)
: EDProducer{params},
raw_data_label_(params().RawDataLabel())
{

produces< std::vector< sbn::EXTCountInfo >, art::InSubRun >();
TotalEXTCounts = 0;
}

void sbn::NuMIEXTRetriever::produce(art::Event& e)
{

//Here we read in the artdaq Fragments and extract three pieces of information:
// 1. The time of the current event, t_current_event
// 2. the time of the previously triggered event, t_previous_event (NOTE: Events are non-sequential!)
// 3. the number of beam spills since the previously triggered event, number_of_gates_since_previous_event

//int gate_type = 0;
auto const & raw_data = e.getProduct< std::vector<artdaq::Fragment> >({ raw_data_label_, "ICARUSTriggerV3" });

unsigned int number_of_gates_since_previous_event = 0;

for(auto raw_datum : raw_data){

icarus::ICARUSTriggerV3Fragment frag(raw_datum);
std::string data = frag.GetDataString();
char *buffer = const_cast<char*>(data.c_str());
icarus::ICARUSTriggerInfo datastream_info = icarus::parse_ICARUSTriggerV3String(buffer);
//gate_type = datastream_info.gate_type;
number_of_gates_since_previous_event = frag.getDeltaGatesNuMIOffMaj();


}

//We only want to process EXT gates, i.e. type 3

// Keep track of the number of beam gates the DAQ thinks
// are in this file
TotalEXTCounts += number_of_gates_since_previous_event;

//Store everything in our data-product
sbn::EXTCountInfo extInfo;
extInfo.gates_since_last_trigger = number_of_gates_since_previous_event;

fOutExtInfos.push_back(extInfo);
// We do not write these to the art::Events because
// we can filter events but want to keep all the POT
// information, so we'll write it to the SubRun


} //end loop over events


void sbn::NuMIEXTRetriever::beginSubRun(art::SubRun& sr)
{
return;
}

//____________________________________________________________________________
void sbn::NuMIEXTRetriever::endSubRun(art::SubRun& sr)
{
// We will add all of the EXTCountInfo data-products to the
// art::SubRun so it persists
auto p = std::make_unique< std::vector< sbn::EXTCountInfo > >(fOutExtInfos);

sr.put(std::move(p));

return;
}

DEFINE_ART_MODULE(sbn::NuMIEXTRetriever)
Loading