-
Notifications
You must be signed in to change notification settings - Fork 35
Configurations Enabling ICARUS NuMI Analysis #391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
706c4d8
f0c3c49
1407062
f24eba3
515724c
c0f90b5
0af7a05
12aa749
0651c08
58c6946
73c8201
2bf4884
444f8c1
192a028
60b48df
8ccae1d
99d77ce
1ce518e
d4af5fe
3d2e2c8
cbc6213
7a40e9e
e15fa37
6f09e1b
e2a5cd8
e32adbc
b03a6e5
abaafef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is probably best left for this PR: |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is probably best left for this PR: |
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change is probably best left for this PR: |
| 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() | ||
|
|
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: 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) |
There was a problem hiding this comment.
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