19 #include "lbne-raw-data/Overlays/SSPFragment.hh" 20 #include "lbne-raw-data/Overlays/anlTypes.hh" 27 NOvAClockFrequency(pset.
get<double>(
"NOvAClockFrequency")),
28 m1(pset.
get<
int>(
"SSPm1")),
29 i1(pset.
get<
int>(
"SSPi1")),
30 i2(pset.
get<
int>(
"SSPi2")),
31 SPESize(pset.
get<float>(
"SPESize"))
42 std::vector<raw::OpDetWaveform> &opDetWaveformVector,
43 std::vector<recob::OpHit> &opHitVector)
45 unsigned int numFragments = rawFragments.size();
47 for (
size_t idx = 0; idx < numFragments; ++idx) {
48 const auto& frag(rawFragments[idx]);
49 lbne::SSPFragment sspf(frag);
53 const unsigned int* dataPointer = sspf.dataBegin();
56 for (
unsigned int triggersProcessed = 0;
57 (nTriggers==0 || triggersProcessed < nTriggers) && dataPointer < sspf.dataEnd();
58 ++triggersProcessed) {
87 std::vector<raw::OpDetWaveform> opDetWaveformVector;
89 unsigned int numFragments = rawFragments.size();
91 for (
size_t idx = 0; idx < numFragments; ++idx) {
92 const auto& frag(rawFragments[idx]);
93 lbne::SSPFragment sspf(frag);
97 const unsigned int* dataPointer = sspf.dataBegin();
100 for (
unsigned int triggersProcessed = 0;
101 (nTriggers==0 || triggersProcessed < nTriggers) && dataPointer < sspf.dataEnd();
102 ++triggersProcessed) {
115 return opDetWaveformVector;
122 std::vector<recob::OpHit> opHitVector;
124 unsigned int numFragments = rawFragments.size();
127 for (
size_t idx = 0; idx < numFragments; ++idx) {
128 const auto& frag(rawFragments[idx]);
129 lbne::SSPFragment sspf(frag);
132 const unsigned int* dataPointer = sspf.dataBegin();
135 for (
unsigned int triggersProcessed = 0;
136 (nTriggers==0 || triggersProcessed < nTriggers) && dataPointer < sspf.dataEnd();
137 ++triggersProcessed) {
169 <<
"Header: " << daqHeader->header <<
"\n" 170 <<
"Length: " << daqHeader->length <<
"\n" 171 <<
"Trigger type: " << ((daqHeader->group1 & 0xFF00) >> 8) <<
"\n" 172 <<
"Status flags: " << ((daqHeader->group1 & 0x00F0) >> 4) <<
"\n" 173 <<
"Header type: " << ((daqHeader->group1 & 0x000F) >> 0) <<
"\n" 174 <<
"Trigger ID: " << daqHeader->triggerID <<
"\n" 175 <<
"Module ID: " << ((daqHeader->group2 & 0xFFF0) >> 4) <<
"\n" 176 <<
"Channel ID: " << ((daqHeader->group2 & 0x000F) >> 0) <<
"\n" 178 <<
"External (NOvA) timestamp: " << FirstSample <<
" ticks" <<
"\n" 179 <<
" " << TimeStamp <<
" microseconds" <<
"\n" 184 <<
"Peak sum: " <<
GetPeakSum(daqHeader) <<
"\n" 187 <<
"Baseline Sum (Prerise): " <<
GetBaselineSum(daqHeader) <<
"\n" 189 <<
"Baseline: " << daqHeader->baseline <<
"\n" 190 <<
"CFD Timestamp interpolation points: " << daqHeader->cfdPoint[0] <<
" " << daqHeader->cfdPoint[1]
191 <<
" " << daqHeader->cfdPoint[2] <<
" " << daqHeader->cfdPoint[3] <<
"\n" 192 <<
"Internal interpolation point: " << daqHeader->intTimestamp[0] <<
"\n" 193 <<
"Internal timestamp: " << InternalSample <<
" ticks\n" 194 <<
" " << InternalTimeStamp <<
" microseconds" <<
"\n" 209 <<
"SSP fragment " << frag.fragmentID()
210 <<
" has total size: " << sspf.hdr_event_size()
211 <<
" and run number: " << sspf.hdr_run_number()
212 <<
" with " << sspf.total_adc_values() <<
" total ADC values" 216 const SSPDAQ::MillisliceHeader* meta=0;
218 if(frag.hasMetadata())
220 meta = &(frag.metadata<lbne::SSPFragment::Metadata>()->sliceHeader);
223 <<
"===Slice metadata====" <<
"\n" 224 <<
" Start time " << meta->startTime <<
"\n" 225 <<
" End time " << meta->endTime <<
"\n" 226 <<
" Packet length " << meta->length <<
"\n" 227 <<
" Number of triggers " << meta->nTriggers <<
"\n" 228 <<
"=====================";
232 mf::LogWarning(
"DAQToOffline") <<
"SSP fragment has no metadata associated with it.";
236 if (meta == 0)
return 0;
238 return meta->nTriggers;
256 if ( fullname.empty() ) {
259 <<
" not found in FW_SEARCH_PATH, using debugging map!\n";
262 mf::LogVerbatim(
"DAQToOffline") <<
"Build Online->Offline channel Map from " << fullname;
263 std::ifstream
infile(fullname);
264 while (infile.good()) {
265 infile >> onlineChannel >> offlineChannel;
267 mf::LogVerbatim(
"DAQToOffline") <<
" " << onlineChannel <<
" -> " << offlineChannel;
279 const SSPDAQ::EventHeader* daqHeader=
reinterpret_cast<const SSPDAQ::EventHeader*
>(dataPointer);
280 dataPointer +=
sizeof(SSPDAQ::EventHeader)/
sizeof(
unsigned int);
291 uint32_t peaksum = ((daqHeader->group3 & 0x00FF) >> 16) + daqHeader->peakSumLow;
292 if(peaksum & 0x00800000) {
293 peaksum |= 0xFF000000;
305 unsigned short OpChannel = -1;
310 int HardwareChannel = ((daqHeader->group2 & 0x000F) >> 0);
311 int SSPNumber = ((daqHeader->group2 & 0x00F0) >> 4);
312 OpChannel = 100*SSPNumber + HardwareChannel;
318 int HardwareChannel = ((daqHeader->group2 & 0x000F) >> 0);
319 int SSPNumber = ((daqHeader->group2 & 0x00F0) >> 4);
320 mf::LogWarning(
"DAQToOffline") <<
"SSP " << SSPNumber <<
" Channel " << HardwareChannel
321 <<
"(" << daqHeader->group2 <<
") " 322 <<
" not in the map (OK for uninstrumented channels), skipping." <<
std::endl;
335 return ( ( (
unsigned long)daqHeader->timestamp[3] << 48 )
336 + ( (
unsigned long)daqHeader->timestamp[2] << 32 )
337 + ( (
unsigned long)daqHeader->timestamp[1] << 16 )
338 + ( (
unsigned long)daqHeader->timestamp[0] ) );
357 return ((daqHeader->group4 & 0x00FF) << 16) + daqHeader->preriseLow;
365 return ((
unsigned int)(daqHeader->intSumHigh) << 8) + (((
unsigned int)(daqHeader->group4) & 0xFF00) >> 8);
372 return (daqHeader->group3 & 0xFF00) >> 8 ;
380 unsigned int nADC=(daqHeader->length-
sizeof(SSPDAQ::EventHeader)/
sizeof(
unsigned int))*2;
388 const unsigned int* &dataPointer)
401 const unsigned short* adcPointer =
reinterpret_cast<const unsigned short*
>(dataPointer);
407 for(
size_t idata = 0; idata < nADC; idata++) {
408 const unsigned short* adc = adcPointer + idata;
409 Waveform.push_back(*adc);
428 auto const* ts = lar::providerFrom<detinfo::DetectorClocksService>();
430 double peakTime = ((double)
GetPeakTime(daqHeader)) * ts->OpticalClock().TickPeriod();
431 double width = ((double)
i1) * ts->OpticalClock().TickPeriod();
435 double peak = ((double)
GetPeakSum(daqHeader)) / ((
double)
m1) - pedestal;
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
T get(std::string const &key) const
unsigned __int64 uint64_t
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::string find_file(std::string const &filename) const
auto const & get(AssnsNode< L, R, D > const &r)
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)