1 #include "art/Framework/Core/EDAnalyzer.h"
2 #include "art/Framework/Core/ModuleMacros.h"
3 #include "art/Framework/Principal/Event.h"
4 #include "art/Framework/Principal/Handle.h"
6 #include "canvas/Utilities/Exception.h"
8 #include "sbndaq-artdaq-core/Overlays/Common/BernCRTFragment.hh"
9 #include "artdaq-core/Data/Fragment.hh"
10 #include "artdaq-core/Data/ContainerFragment.hh"
11 #include "sbndaq-artdaq-core/Overlays/FragmentType.hh"
13 #include "sbndaq-artdaq-core/Overlays/Common/BernCRTTranslator.hh"
16 #include "art_root_io/TFileService.h"
35 explicit BernCRTAna(fhicl::ParameterSet
const & pset);
44 bool IsTopCRT(icarus::crt::BernCRTTranslator &
hit);
80 art::ServiceHandle<art::TFileService>
tfs;
82 hits = tfs->make<TTree>(
"hits",
"FEB hits");
84 hits->Branch(
"mac5", &
mac5,
"mac5/b");
88 hits->Branch(
"ts0", &
ts0,
"ts0/i");
89 hits->Branch(
"ts1", &
ts1,
"ts1/i");
90 hits->Branch(
"adc", &
adc,
"adc[32]/s");
116 return (hit.fragment_ID & 0x3100) == 0x3100;
122 return (hit.fragment_ID & 0x3200) == 0x3200;
132 std::vector<icarus::crt::BernCRTTranslator> hit_vector;
134 auto fragmentHandles = evt.getMany<artdaq::Fragments>();
135 for (
auto handle : fragmentHandles) {
136 if (!handle.isValid() || handle->size() == 0)
139 auto this_hit_vector = icarus::crt::BernCRTTranslator::getCRTData(*handle);
141 hit_vector.insert(hit_vector.end(),this_hit_vector.begin(),this_hit_vector.end());
145 for(
auto &
hit : hit_vector) {
151 else if(IsTopCRT(
hit)){
157 fragment_timestamp =
hit.timestamp;
158 sequence_id =
hit.sequence_id;
162 lostcpu =
hit.lostcpu;
163 lostfpga =
hit.lostfpga;
168 for(
int ch=0; ch<32; ch++) adc[ch] =
hit.adc[ch];
170 run_start_time =
hit.run_start_time;
171 this_poll_start =
hit.this_poll_start;
172 this_poll_end =
hit.this_poll_end;
173 last_poll_start =
hit.last_poll_start;
174 last_poll_end =
hit.last_poll_end;
175 system_clock_deviation =
hit.system_clock_deviation;
176 feb_hits_in_poll =
hit.hits_in_poll;
177 feb_hit_number =
hit.feb_hit_number;
179 last_accepted_timestamp =
hit.last_accepted_timestamp;
180 lost_hits =
hit.lost_hits;
181 hits_in_fragment =
hit.hits_in_fragment;
int32_t system_clock_deviation
BernCRTAna(fhicl::ParameterSet const &pset)
uint32_t feb_hits_in_poll
bool IsTopCRT(icarus::crt::BernCRTTranslator &hit)
uint16_t hits_in_fragment
uint64_t fragment_timestamp
bool IsSideCRT(icarus::crt::BernCRTTranslator &hit)
art::ServiceHandle< art::TFileService > tfs
virtual void analyze(art::Event const &evt)
uint64_t last_accepted_timestamp