12 #include "art_root_io/TFileService.h" 15 #include "lbne-raw-data/Overlays/SSPFragment.hh" 16 #include "lbne-raw-data/Overlays/anlTypes.hh" 17 #include "artdaq-core/Data/Fragment.hh" 80 adc_values_ = tfs->make<TH1D>(
"adc_values",
"adc_values",4096,-0.5,4095.5);
96 adc_values_->Write(Form(
"adc_values:event_%d", eventNumber));
124 std::cout <<
"######################################################################" <<
std::endl;
126 std::cout <<
"Run " << evt.
run() <<
", subrun " << evt.
subRun()
127 <<
", event " << eventNumber <<
" has " << raw->size()
130 for (
size_t idx = 0; idx < raw->size(); ++idx) {
131 const auto& frag((*raw)[idx]);
133 SSPFragment sspf(frag);
136 std::cout <<
"SSP fragment " << frag.fragmentID()
137 <<
" has total size: " << sspf.hdr_event_size()
138 <<
" and run number: " << sspf.hdr_run_number()
139 <<
" with " << sspf.total_adc_values() <<
" total ADC values" 143 const SSPDAQ::MillisliceHeader* meta=0;
145 if(frag.hasMetadata())
147 meta = &(frag.metadata<SSPFragment::Metadata>()->sliceHeader);
150 <<
"===Slice metadata:"<<std::endl
151 <<
"Start time "<<meta->startTime<<std::endl
152 <<
"End time "<<meta->endTime<<std::endl
153 <<
"Packet length "<<meta->length<<std::endl
154 <<
"Number of triggers "<<meta->nTriggers<<std::endl<<
std::endl;
158 std::cout <<
"SSP fragment has no metadata associated with it." <<
std::endl;
161 const unsigned int* dataPointer = sspf.dataBegin();
163 unsigned int triggersProcessed=0;
164 while((meta==0||triggersProcessed<meta->nTriggers)&&dataPointer<sspf.dataEnd()){
165 const SSPDAQ::EventHeader* daqHeader=
reinterpret_cast<const SSPDAQ::EventHeader*
>(dataPointer);
167 uint32_t peaksum = ((daqHeader->group3 & 0x00FF) >> 16) + daqHeader->peakSumLow;
168 if(peaksum & 0x00800000) {
169 peaksum |= 0xFF000000;
173 <<
"Header: " << daqHeader->header << std::endl
174 <<
"Length: " << daqHeader->length << std::endl
175 <<
"Trigger type: " << ((daqHeader->group1 & 0xFF00) >> 8) << std::endl
176 <<
"Status flags: " << ((daqHeader->group1 & 0x00F0) >> 4) << std::endl
177 <<
"Header type: " << ((daqHeader->group1 & 0x000F) >> 0) << std::endl
178 <<
"Trigger ID: " << daqHeader->triggerID << std::endl
179 <<
"Module ID: " << ((daqHeader->group2 & 0xFFF0) >> 4) << std::endl
180 <<
"Channel ID: " << ((daqHeader->group2 & 0x000F) >> 0) << std::endl
181 <<
"External timestamp (FP mode): " << std::endl
182 <<
" Sync delay: " << ((
unsigned int)(daqHeader->timestamp[1]) << 16) + (
unsigned int)(daqHeader->timestamp[0]) << std::endl
183 <<
" Sync count: " << ((
unsigned int)(daqHeader->timestamp[3]) << 16) + (
unsigned int)(daqHeader->timestamp[2]) << std::endl
184 <<
"External timestamp (NOvA mode): " << (
unsigned long)daqHeader->timestamp[3] << 48 + (
unsigned long)daqHeader->timestamp[2] << 32
185 + (
unsigned long)daqHeader->timestamp[1] << 16 + (
unsigned long)daqHeader->timestamp[0] <<std::endl
186 <<
"Peak sum: " << peaksum << std::endl
187 <<
"Peak time: " << ((daqHeader->group3 & 0xFF00) >> 8) << std::endl
188 <<
"Prerise: " << ((daqHeader->group4 & 0x00FF) << 16) + daqHeader->preriseLow << std::endl
189 <<
"Integrated sum: " << ((
unsigned int)(daqHeader->intSumHigh) << 8) + (((
unsigned int)(daqHeader->group4) & 0xFF00) >> 8) << std::endl
190 <<
"Baseline: " << daqHeader->baseline << std::endl
191 <<
"CFD Timestamp interpolation points: " << daqHeader->cfdPoint[0] <<
" " << daqHeader->cfdPoint[1] <<
" " << daqHeader->cfdPoint[2] <<
" " << daqHeader->cfdPoint[3] << std::endl
192 <<
"Internal interpolation point: " << daqHeader->intTimestamp[0] << std::endl
196 dataPointer+=
sizeof(SSPDAQ::EventHeader)/
sizeof(
unsigned int);
200 bool verb_values =
true;
201 unsigned int nADC=(daqHeader->length-
sizeof(SSPDAQ::EventHeader)/
sizeof(
unsigned int))*2;
202 const unsigned short* adcPointer=
reinterpret_cast<const unsigned short*
>(dataPointer);
204 sprintf(histName,
"event%d",triggersProcessed);
207 for(
size_t idata = 0; idata < nADC; idata++) {
211 std::cout <<
"Data values: ";
213 const unsigned short* adc = adcPointer + idata;
220 std::cout << *adc <<
" ";
224 std::cout<<std::endl<<
"Triggers processed: "<<triggersProcessed<<std::endl<<
std::endl;
227 std::cout << std::endl
230 <<
"Event ADC average is (from histogram): " <<
adc_values_->GetMean()
234 std::cout <<
"Run " << evt.
run() <<
", subrun " << evt.
subRun()
235 <<
", event " << eventNumber <<
" has zero"
EventNumber_t event() const
SSPDump(fhicl::ParameterSet const &pset)
EDAnalyzer(fhicl::ParameterSet const &pset)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
#define DEFINE_ART_MODULE(klass)
std::string raw_data_label_
void endEvent(art::EventNumber_t eventNumber)
void beginEvent(art::EventNumber_t eventNumber)
virtual void analyze(art::Event const &evt) override
unsigned __int64 uint64_t
SubRunNumber_t subRun() const
IDNumber_t< Level::Event > EventNumber_t
auto const & get(AssnsNode< L, R, D > const &r)
QTextStream & endl(QTextStream &s)