12 #include "art_root_io/TFileService.h" 15 #include "lbne-raw-data/Overlays/TpcMilliSliceFragment.hh" 16 #include "artdaq-core/Data/Fragment.hh" 30 class TpcMilliSliceDump;
66 adc_values_ = tfs->make<TH1D>(
"adc_values",
"adc_values",4096,-0.5,4095.5);
92 std::cout <<
"######################################################################" <<
std::endl;
94 std::cout <<
"Run " << evt.
run() <<
", subrun " << evt.
subRun()
95 <<
", event " << eventNumber <<
" has " << raw->size()
98 for (
size_t idx = 0; idx < raw->size(); ++idx)
100 const auto& frag((*raw)[idx]);
102 TpcMilliSliceFragment msf(frag);
105 std::cout <<
"TpcMilliSlice fragment " << frag.fragmentID() <<
" consists of: " << msf.size() <<
" bytes containing " 106 << msf.microSliceCount() <<
" microslices" <<
std::endl;
109 for (
uint32_t i_ms = 0; i_ms < msf.microSliceCount(); ++i_ms)
113 std::unique_ptr<const TpcMicroSlice> microslice = msf.microSlice(i_ms);
116 throw cet::exception(
"Error in TpcMilliSliceDump module: unable to find requested microslice");
119 if(verb_microslice) {
120 std::cout <<
"TpcMilliSlice fragment " << frag.fragmentID()
121 <<
", microslice " << i_ms
122 <<
" has sequence ID " << microslice->sequence_id()
123 <<
" size " << microslice->size()
124 <<
" and consists of: "<< microslice->nanoSliceCount() <<
" nanoslices" <<
std::endl;
127 if (microslice->nanoSliceCount() == 0)
continue;
134 bool verb_nanoslice_header = verb_microslice;
137 verb_nanoslice_header =
false;
140 std::unique_ptr<const TpcNanoSlice> nanoslice = microslice->nanoSlice(*i_nano);
143 throw cet::exception(
"Error in TpcMilliSliceDump module: Unable to locate requested nanoslice");
145 if (verb_nanoslice_header)
148 std::cout <<
" NanoSlice " << *i_nano <<
" size " << nanoslice->size() <<
" bytes" << std::endl <<
std::endl;
150 const uint64_t* nanoslice_raw = nanoslice->raw();
152 std::cout <<
" Raw Header : 0x" 155 std::cout <<
" Raw Data Payload:" << std::endl <<
" ";
156 uint16_t num_nanoslice_words = (nanoslice->size() -
sizeof(lbne::TpcNanoSlice::Header))/
sizeof(
uint64_t);
157 size_t word_offset =
sizeof(lbne::TpcNanoSlice::Header)/
sizeof(
uint64_t);
159 for (
int i_adc_word = 0; i_adc_word < num_nanoslice_words; i_adc_word++)
162 if ((i_adc_word % 4) == 3) std::cout << std::endl <<
" ";
171 std::cout <<
" Decoded ADC Values:" << std::endl <<
" ";
172 for (
uint32_t i_samp = 0; i_samp < nanoslice->getNChannels(); ++i_samp)
175 nanoslice->sampleValue(i_samp, val);
177 if ((i_samp % 8) == 7) std::cout << std::endl <<
" ";
187 for (
uint32_t i_nano = 0; i_nano < microslice->nanoSliceCount(); i_nano++)
189 std::unique_ptr<const TpcNanoSlice> nanoslice = microslice->nanoSlice(i_nano);
193 throw cet::exception(
"Error in TpcMilliSliceDump module: Unable to find requested nanoslice");
196 for (
uint32_t i_samp = 0; i_samp < nanoslice->sampleCount(); i_samp++)
199 bool success = nanoslice->sampleValue(i_samp, val);
203 throw cet::exception(
"Error in TpcMilliSliceDump module: Unable to find the requested sample value in nanoslice");
214 std::cout << std::endl
215 <<
"Event ADC average is (from counter): " << (double)adc_cumulative/(
double)n_adc_counter
217 <<
"Event ADC average is (from histogram): " <<
adc_values_->GetMean()
222 std::cout <<
"Run " << evt.
run() <<
", subrun " << evt.
subRun()
223 <<
", event " << eventNumber <<
" has zero" 224 <<
" TpcMilliSlice fragments." <<
std::endl;
std::vector< int > verb_microslice_ids_
EventNumber_t event() const
virtual void analyze(art::Event const &evt)
QTextStream & hex(QTextStream &s)
EDAnalyzer(fhicl::ParameterSet const &pset)
std::string raw_data_label_
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
#define DEFINE_ART_MODULE(klass)
TpcMilliSliceDump(fhicl::ParameterSet const &pset)
uint32_t verb_nanoslice_adcs_
unsigned __int64 uint64_t
SubRunNumber_t subRun() const
static int max(int a, int b)
QTextStream & dec(QTextStream &s)
Q_EXPORT QTSManip setw(int w)
std::vector< int > verb_nanoslice_ids_
IDNumber_t< Level::Event > EventNumber_t
auto const & get(AssnsNode< L, R, D > const &r)
Q_EXPORT QTSManip setfill(int f)
virtual ~TpcMilliSliceDump()
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)