SSPDiagnosticAna_module.cc
Go to the documentation of this file.
1 // -*- mode: c++; c-basic-offset: 2; -*-
2 ////////////////////////////////////////////////////////////////////////
3 // Class: SSPDiagnosticAna
4 // Module Type: producer
5 // File: SSPDiagnosticAna_module.cc
6 //
7 // Quickly analyze raw data trigger rate in the SSP
8 // and plot pulse amplitudes
9 //
10 // Produces plots for each run, then plots vs run at endJob()
11 //
12 // Jonathan Insler jti3@fnal.gov
13 // Denver Whittington dwwhitti@fnal.gov
14 //
15 ////////////////////////////////////////////////////////////////////////
16 
24 #include "art_root_io/TFileService.h"
25 #include "art_root_io/TFileDirectory.h"
27 #include "fhiclcpp/ParameterSet.h"
29 
30 #include "TH2.h"
31 #include "TProfile.h"
32 #include "TSpectrum.h"
33 #include <memory>
34 #include <iostream>
35 #include <map>
36 #include <set>
37 #include <iomanip>
38 
39 //lbne-artdaq includes
40 #include "lbne-raw-data/Overlays/SSPFragment.hh"
41 #include "lbne-raw-data/Overlays/anlTypes.hh"
42 #include "artdaq-core/Data/Fragment.hh"
43 
44 //larsoft includes
45 #include "lardataobj/RawData/raw.h"
49 
50 //daqinput35t includes
51 
53 #include "SSPReformatterAlgs.h"
54 
55 namespace DAQToOffline {
56  class SSPDiagnosticAna;
57 }
58 
60 public:
61  explicit SSPDiagnosticAna(fhicl::ParameterSet const & pset);
62  // The destructor generated by the compiler is fine for classes
63  // without bare pointers or other resource use.
64 
65  void analyze(art::Event const & evt) override;
66  void reconfigure(fhicl::ParameterSet const& pset);
67  void printParameterSet();
68 
69 
70  // Plugins should not be copied or assigned.
71  SSPDiagnosticAna(SSPDiagnosticAna const &) = delete;
73  SSPDiagnosticAna & operator = (SSPDiagnosticAna const &) = delete;
75 
76 private:
77  void beginJob() override;
78  void endJob () override;
79  void beginRun(art::Run const &run) override;
80  void endRun(art::Run const &run) override;
81  void beginEvent(art::EventNumber_t eventNumber);
82  void endEvent (art::EventNumber_t eventNumber);
83 
89  double fSampleFreq; // Sampling frequency in MHz
90  const int m1_window = 10;
91  const int i1_window = 500;
92  const int i2_window = 500;
93 
94  // Map to store how many waveforms are on one optical channel
95  //std::map< int, TH1D* > averageWaveforms;
96  std::map< int, TH2D* > averageWaveforms;
97  // std::map< int, int > waveformCount;
98  std::map< int, TH1D* > waveformFFTs;
99 
101  std::map< int, TH1D* > PulseAmplitudePerChannel;
102  std::map< int, TH1D* > IntegratedChargePerChannel;
104 
105  std::map< int, TH2D* > PulseAmpVsRun;
106 
107  TSpectrum *specAnalyzer = new TSpectrum( 100 /* max peaks */ );
108 
110 
111  unsigned long int firstTime;
112  unsigned long int lastTime;
113  std::map<int, long int> triggerCount;
114 
115 };
116 
117 
119  : art::EDAnalyzer(pset),
120  sspReform(pset.get<fhicl::ParameterSet>("SSPReformatter"))
121 {
122 
123  this->reconfigure(pset);
124 
125  //first_FirstSample = -1;
126  //first_TimeStamp = -1;
127 }
128 
130 
131  fFragType = pset.get<std::string>("FragType");
132  fRawDataLabel = pset.get<std::string>("RawDataLabel");
133  fInputModule = pset.get<std::string>("InputModule");
134  fInputLabel = pset.get<std::string>("InputLabel");
135  // m1_window = pset.get<int>("SSPm1");
136  // i1_window = pset.get<int>("SSPi1");
137  // i2_window = pset.get<int>("SSPi2");
138 
139  //fDebug = pset.get<bool>("Debug");
140  //fZeroThreshold=0;
141  //fCompression=raw::kNone;
142  // Obtain parameters from TimeService
143  auto const* timeService = lar::providerFrom<detinfo::DetectorClocksService>();
144  fSampleFreq = timeService->OpticalClock().Frequency();
145 
146 
148 
149 }
150 
152 
153  mf::LogDebug("SSPDiagnosticAna") << "====================================" << "\n"
154  << "Parameter Set" << "\n"
155  << "====================================" << "\n"
156  << "fFragType: " << fFragType << "\n"
157  << "fRawDataLabel: " << fRawDataLabel << "\n"
158  << "====================================" << "\n";
159 }
160 
162 {
164  //adc_values_ = tfs->make<TH1D>("adc_values","adc_values",4096,-0.5,4095.5);
165 
166  fPulseAmplitude = tfs->make<TH1D>("pulseamplitude","Pulse Amplitude;leading-edge amplitude [ADC]",125,-50,200);
167 
168  firstTime = (((unsigned long int)1)<<63);
169  lastTime = 0;
170 }
171 
173 {
174  PulseAmplitudePerChannel.clear();
177 }
178 
180 {
181  //reset ADC histogram
182  //adc_values_->Reset();
183  //reset counters
184  //n_adc_counter_ = 0;
185  //adc_cumulative_ = 0;
186 }
187 
189 {
190  //write the ADC histogram for the given event
191  //if(n_adc_counter_)
192  // adc_values_->Write(Form("adc_values:event_%d", eventNumber));
193 }
194 
196 {
197  //delete adc_values_;
198 
199  long int deltaT = lastTime-firstTime;
200  double deltaTus = ((double)deltaT)/sspReform.ClockFrequency();
201 
202 
203  mf::LogVerbatim("SSPDiagnosticAna") << "!! Diagnostic Rate Report." << std::endl;
204  mf::LogVerbatim("SSPDiagnosticAna") << "!! Time: " << deltaTus / 60.e6 << " minutes." << std::endl;
205 
206  for (auto itr = triggerCount.begin(); itr != triggerCount.end(); itr++) {
207  double freq = ((double)itr->second) / deltaTus * 1000.;
208  mf::LogVerbatim("SSPDiagnosticAna") << "!! Channel " << std::setw(3) << itr->first << ": " << freq << " kHz" << std::endl;
209  }
210 
211 
212  /*
213  mf::LogInfo("SSPDiagnosticAna") << "firstSample: " << firstTime << " samples\n"
214  << "lastSample: " << lastTime << " samples\n"
215  << "totalSamples: " << deltaT << " samples\n"
216  << "totalTime: " << deltaTus << " us\n"
217  << "# Channels: " << channels.size() << "\n"
218  << "# Triggers: " << triggerCount << "\n"
219  << "Frequency: " << freq << "kHz\n";
220  */
221 
222  // for (auto iter = averageWaveforms.begin(); iter != averageWaveforms.end(); iter++)
223  // {
224  // mf::LogInfo("Scaling down channel ") << iter->first << " by 1./" << waveformCount[iter->first] << std::endl;
225  // iter->second->Scale(1./waveformCount[iter->first]);
226  // }
227 
228  // Format output plots
229  for ( int i = 0; i < 100; ++i ) {
230  if ( PulseAmplitudePerChannel.find(i) == PulseAmplitudePerChannel.end() ) continue;
231  PulseAmplitudePerChannel[i]->SetStats(false);
232  PulseAmplitudePerChannel[i]->GetXaxis()->SetTitleSize(0.045);
233  IntegratedChargePerChannel[i]->SetStats(false);
234  IntegratedChargePerChannel[i]->GetXaxis()->SetTitleSize(0.045);
235  PulseAmplitudeVsIntegratedChargePerChannel[i]->SetStats(false);
236  PulseAmplitudeVsIntegratedChargePerChannel[i]->SetOption("colz");
237  PulseAmplitudeVsIntegratedChargePerChannel[i]->GetXaxis()->SetTitleSize(0.045);
238  PulseAmplitudeVsIntegratedChargePerChannel[i]->GetYaxis()->SetTitleSize(0.045);
239  averageWaveforms[i]->SetStats(false);
240  averageWaveforms[i]->SetOption("colz");
241  averageWaveforms[i]->GetXaxis()->SetTitleSize(0.045);
242  averageWaveforms[i]->GetYaxis()->SetTitleSize(0.045);
243  }
244 
245  // Analyze plots
246  for ( int i = 0; i < 100; ++i ) {
247  if ( PulseAmplitudePerChannel.find(i) == PulseAmplitudePerChannel.end() ) continue;
248  double ADCperPE(0);
249  double INTperPE(0);
250  { // Calculate leading-edge amplitude per photoelectron
251  int nDiffs(0);
252  int nPeaks = specAnalyzer->Search( PulseAmplitudePerChannel[i], 1.5/*sigma*/, "", 0.001 );
253  auto *peaks = specAnalyzer->GetPositionX(); // ordered by height!
254  std::vector<float> peakVec;
255  for ( int p = 0; p < nPeaks; ++p ) peakVec.push_back(peaks[p]);
256  std::sort(peakVec.begin(),peakVec.end());
257  for ( int p = 1; p < nPeaks-1; ++p ) {
258  double diff = peakVec.at(p+1) - peakVec.at(p);
259  if ( diff > 20 || diff < 10 ) {
260  //std::cout << "Caution! Outlier peak difference at " << p << "/" << p+1 << ". This pair will be skipped." << std::endl;
261  continue;
262  }
263  ADCperPE += diff;
264  nDiffs++;
265  }
266  ADCperPE /= double(nDiffs);
267  }
268  { // Calculate integrated charge per photoelectron
269  int nDiffs(0);
270  int nPeaks = specAnalyzer->Search( IntegratedChargePerChannel[i], 2.5/*sigma*/, "", 0.001 );
271  auto *peaks = specAnalyzer->GetPositionX(); // ordered by height!
272  std::vector<float> peakVec;
273  for ( int p = 0; p < nPeaks; ++p ) peakVec.push_back(peaks[p]);
274  std::sort(peakVec.begin(),peakVec.end());
275  for ( int p = 1; p < nPeaks-1; ++p ) {
276  double diff = peakVec.at(p+1) - peakVec.at(p);
277  if ( diff > 1800 || diff < 1000 ) {
278  //std::cout << "Caution! Outlier peak difference at " << p << "/" << p+1 << ". This pair will be skipped." << std::endl;
279  continue;
280  }
281  INTperPE += diff;
282  nDiffs++;
283  }
284  INTperPE /= double(nDiffs);
285  }
286  std::cout << "OpDet Channel " << i << " :\t LE " << ADCperPE << " ADC/PE" << "\t IC " << INTperPE << " charge/PE" << std::endl;
287  }
288 
289  // FFT of average waveforms
291  art::TFileDirectory RunDir = tfs->mkdir( TString::Format("r%03i", run.run()).Data(), "SSP Diagnostics by Run" );
292  for ( int i = 0; i < 100; ++i ) {
293  if ( PulseAmplitudePerChannel.find(i) == PulseAmplitudePerChannel.end() ) continue;
294  TProfile *profile = averageWaveforms[i]->ProfileX();
295  auto fft = waveformFFTs.find( i );
296  if ( fft == waveformFFTs.end() ) {
297  TString histName = TString::Format("waveformFFT_channel_%03i", i);
298  TString histTitle = TString::Format("Average Waveform FFT for OP Channel %03i;f (MHz);power", i);
299  double dt = averageWaveforms[i]->GetXaxis()->GetBinLowEdge(2) - averageWaveforms[i]->GetXaxis()->GetBinLowEdge(1);
300  double Fmax = 1. / (2*dt);
301  waveformFFTs[i] = RunDir.make< TH1D >(histName, histTitle, averageWaveforms[i]->GetNbinsX()/2, 0., Fmax);
302  }
303  profile->FFT( waveformFFTs[i], "MAG" );
304  waveformFFTs[i]->SetStats(false);
305  waveformFFTs[i]->GetXaxis()->SetTitleSize(0.045);
306  waveformFFTs[i]->GetYaxis()->SetTitleSize(0.045);
307  delete profile;
308  }
309 
310  // Add pulse amplitude histos to pulse amp vs run histograms
311  for ( int i = 0; i < 100; ++i ) {
312  if ( PulseAmplitudePerChannel.find(i) == PulseAmplitudePerChannel.end() ) continue;
313  auto histo = PulseAmpVsRun.find( i );
314  // Make a new histogram if it doesn't already exist.
315  if ( histo == PulseAmpVsRun.end() ) {
316  TString histName = TString::Format("PulseAmpDistVsRun_channel_%03i", i);
317  TString histTitle = TString::Format("Pulse Amplitude Distribution vs Run Number for OP Channel %03i;run number;leading-edge amplitude [ADC]", i);
318  PulseAmpVsRun[i] = new TH2D( histName, histTitle, 1, run.run(), run.run()+1, 125, -20, 230 );
319  } else {
320  // Remake the histogram with extended range
321  TH2D* oldHist = PulseAmpVsRun[i];
322  int firstRun = (int)std::min( double(run.run()), oldHist->GetXaxis()->GetBinLowEdge(1) );
323  int lastRun = (int)std::max( double(run.run()), oldHist->GetXaxis()->GetBinLowEdge( oldHist->GetNbinsX() ) );
324  PulseAmpVsRun[i] = new TH2D( oldHist->GetName(), oldHist->GetTitle(), lastRun-firstRun+1, firstRun, lastRun+1, 125, -20, 230 );
325  for ( int binX = 0; binX <= oldHist->GetNbinsX(); ++binX ) {
326  for ( int binY = 0; binY <= oldHist->GetNbinsY(); ++binY ) {
327  double oldVal = oldHist->GetBinContent( binX, binY );
328  int runNum = oldHist->GetXaxis()->GetBinLowEdge( binX );
329  int targBin = PulseAmpVsRun[i]->GetXaxis()->FindBin( runNum );
330  std::cout << "Transferring into new histogram: " << targBin << " " << binY << " " << oldVal << std::endl;
331  PulseAmpVsRun[i]->SetBinContent( targBin, binY, oldVal );
332  }
333  }
334  delete oldHist;
335  }
336  // Add the new data
337  for ( int binY = 0; binY <= PulseAmplitudePerChannel[i]->GetNbinsX(); ++binY ) {
338  double val = PulseAmplitudePerChannel[i]->GetBinContent(binY);
339  double amp = PulseAmplitudePerChannel[i]->GetBinCenter(binY);
340  std::cout << "Filling histogram with " << run.run() << " " << amp << " " << val << "( PulseAmplitudePerChannel bin " << binY << " )" << std::endl;
341  PulseAmpVsRun[i]->Fill( run.run(), amp, val );
342  }
343 
344  }
345 
346 }
347 
349 {
350  // Register all vs-run histograms.
352  for ( int i = 0; i < 100; ++i ) {
353  auto histo = PulseAmpVsRun.find( i );
354  if ( histo == PulseAmpVsRun.end() ) continue;
355  TH2D *newHist = tfs->make< TH2D >( PulseAmpVsRun[i]->GetName(), PulseAmpVsRun[i]->GetTitle(),
356  PulseAmpVsRun[i]->GetNbinsX(), PulseAmpVsRun[i]->GetXaxis()->GetBinLowEdge(1), PulseAmpVsRun[i]->GetXaxis()->GetBinLowEdge(PulseAmpVsRun[i]->GetNbinsX()+1),
357  PulseAmpVsRun[i]->GetNbinsY(), PulseAmpVsRun[i]->GetYaxis()->GetBinLowEdge(1), PulseAmpVsRun[i]->GetYaxis()->GetBinLowEdge(PulseAmpVsRun[i]->GetNbinsY()+1) );
358  newHist->Add( PulseAmpVsRun[i] );
359  }
360 }
361 
362 
363 
365 {
366 
368  art::TFileDirectory RunDir = tfs->mkdir( TString::Format("r%03i", evt.run()).Data(), "SSP Diagnostics by Run" );
369  //art::ServiceHandle<geo::Geometry> geo;
370 
371  art::Handle<artdaq::Fragments> rawFragments;
372  evt.getByLabel(fRawDataLabel, fFragType, rawFragments);
373 
374  mf::LogInfo("SSPDiagnosticAna") << "Starting event analysis";
375 
376  // Check if there is SSP data in this event
377  // Don't crash code if not present, just don't save anything
378  try { rawFragments->size(); }
379  catch(std::exception const&) {
380  mf::LogWarning("SSPDiagnosticAna") << "WARNING: Raw SSP data not found in event " << evt.event();
381  return;
382  }
383 
384  // Check that the data is valid
385  if(!rawFragments.isValid()){
386  mf::LogError("SSPDiagnosticAna") << "Run: " << evt.run()
387  << ", SubRun: " << evt.subRun()
388  << ", Event: " << evt.event()
389  << " is NOT VALID";
390  throw cet::exception("raw NOT VALID");
391  return;
392  }
393 
394  mf::LogInfo("SSPDiagnosticAna") << "Data is valid!";
395 
396  // Get OpDetWaveforms from the event
398  evt.getByLabel(fInputModule, fInputLabel, waveformHandle);
399 
400  for (size_t i = 0; i < waveformHandle->size(); i++)
401  {
402 
403  // This was probably required to overcome the "const" problem
404  // with OpDetPulse::Waveform()
405  art::Ptr< raw::OpDetWaveform > waveformPtr(waveformHandle, i);
406  raw::OpDetWaveform pulse = *waveformPtr;
407  int channel = pulse.ChannelNumber();
408 
409  // Create the TH1 if it doesn't exist
410  auto waveform = averageWaveforms.find( channel );
411  if ( waveform == averageWaveforms.end() ) {
412  TString histName = TString::Format("avgwaveform_channel_%03i", channel);
413  //averageWaveforms[channel] = RunDir.make< TH1D >(histName, ";t (us);", pulse.size(), 0, double(pulse.size()) / fSampleFreq);
414  TString histTitle = TString::Format("Average Waveform for OP Channel %03i;t (us);amplitude (ADC)", channel);
415  averageWaveforms[channel] = RunDir.make< TH2D >(histName, histTitle, pulse.size(), 0, double(pulse.size()) / fSampleFreq, 2000, 1200, 5200);
416  }
417 
418  // Add this waveform to this histogram
419  for (size_t tick = 0; tick < pulse.size(); tick++) {
420  averageWaveforms[channel]->Fill(double(tick)/fSampleFreq, pulse[tick]);
421 
422  }
423  // // Count number of waveforms on each channel
424  // waveformCount[channel]++;
425 
426 
427  }
428 
429 
430  unsigned int numFragments = rawFragments->size();
431  mf::LogInfo("SSPDiagnosticAna") << "Number of fragments = " << numFragments;
432 
433  for (size_t idx = 0; idx < numFragments; ++idx) {
434 
435  mf::LogInfo("SSPDiagnosticAna") << "Number of fragments = " << idx;
436 
437  const auto& frag((*rawFragments)[idx]);
438  lbne::SSPFragment sspf(frag);
439 
440  unsigned int nTriggers = sspReform.CheckAndGetNTriggers(frag, sspf);
441 
442  mf::LogInfo("SSPDiagnosticAna") << "Triggers = " << nTriggers;
443 
444  const unsigned int* dataPointer = sspf.dataBegin();
445 
446 
447  for (unsigned int triggersProcessed = 0;
448  (nTriggers==0 || triggersProcessed < nTriggers) && dataPointer < sspf.dataEnd();
449  ++triggersProcessed) {
450 
451  //
452  // The elements of the OpDet Pulse
453  //
454  unsigned short OpChannel = -1; ///< Derived Optical channel
455  unsigned long FirstSample = 0; ///< first sample time in ticks
456 
457 
458  // Load the event header, advance the pointer
459  const SSPDAQ::EventHeader* daqHeader=reinterpret_cast<const SSPDAQ::EventHeader*>(dataPointer);
460  dataPointer += sizeof(SSPDAQ::EventHeader)/sizeof(unsigned int);
461 
462  // Get ADC Count, create pointer to adcs
463  unsigned int nADC=(daqHeader->length-sizeof(SSPDAQ::EventHeader)/sizeof(unsigned int))*2;
464 
465  //get the information from the header
466  try {
467  OpChannel = sspReform.GetOpChannel(daqHeader);
468 
469  FirstSample = sspReform.GetGlobalFirstSample(daqHeader);
470  //TimeStamp = ((double)FirstSample)/fNOvAClockFrequency;
471 
472  double peakSum = sspReform.GetPeakSum(daqHeader);
473  double prerise = sspReform.GetBaselineSum(daqHeader);
474  double integratedSum = sspReform.GetIntegratedSum(daqHeader);
475 
476  double PulseAmplitude = -prerise/i2_window*1.0 + peakSum/m1_window*1.0;
477 
478  int channel = (int) OpChannel;
479 
480  // if(channel==94){
481  // if(PulseAmplitude>50&&PulseAmplitude<55)//event with 5 p.e. peak in channel 94
482  // std::cout << "Channel 94 has 5 p.e. peak in event" << evt.event() << std::endl;
483 
484  // if(PulseAmplitude>75&&PulseAmplitude<85)//event with 5 p.e. peak in channel 94
485  // std::cout << "Channel 94 has 7 p.e. peak in event" << evt.event() << std::endl;
486  // }
487 
488  double IntegratedCharge = integratedSum - prerise/i2_window*i1_window*1.0;
489 
490  fPulseAmplitude->Fill(PulseAmplitude);
491  mf::LogInfo("SSPDiagnosticAna") << "Pulse Amplitude: " << PulseAmplitude;
492 
493 
494  auto pulse_amplitude_per_channel = PulseAmplitudePerChannel.find( channel);
495  if( pulse_amplitude_per_channel == PulseAmplitudePerChannel.end() ) {
496  TString histName = TString::Format("pulse_amplitude_channel_%03i", channel);
497  TString histTitle = TString::Format("Pulse Amplitude for OP Channel %03i;leading-edge amplitude [ADC]", channel);
498  PulseAmplitudePerChannel[channel] = RunDir.make< TH1D >(histName, histTitle ,125,-20,230);
499  }
500 
501  PulseAmplitudePerChannel[channel]->Fill(PulseAmplitude);
502 
503  auto integrated_charge_per_channel = IntegratedChargePerChannel.find( channel);
504  if( integrated_charge_per_channel == IntegratedChargePerChannel.end() ) {
505  TString histName = TString::Format("integrated_charge_channel_%03i", channel);
506  TString histTitle = TString::Format("Integrated Charge on OP Channel %03i;integrated charge [ADC*tick]", channel);
507  IntegratedChargePerChannel[channel] = RunDir.make< TH1D >(histName, histTitle ,300,0,3e4);
508  }
509 
510  IntegratedChargePerChannel[channel]->Fill(IntegratedCharge);
511 
512  auto pulse_amplitude_vs_integrated_charge_per_channel = PulseAmplitudeVsIntegratedChargePerChannel.find( channel);
513  if( pulse_amplitude_vs_integrated_charge_per_channel == PulseAmplitudeVsIntegratedChargePerChannel.end() ) {
514  TString histName = TString::Format("pulse_amplitude_vs_integrated_charge_channel_%03i", channel);
515  TString histTitle = TString::Format("Pulse Amplitude vs. Integrated Charge on OP Channel %03i;integrated charge [ADC*tick];leading-edge amplitude [ADC]", channel);
516  PulseAmplitudeVsIntegratedChargePerChannel[channel] = RunDir.make< TH2D >(histName, histTitle ,300,0,3e4,125,-20,230);
517  }
518 
519  PulseAmplitudeVsIntegratedChargePerChannel[channel]->Fill(IntegratedCharge,PulseAmplitude);
520 
521 
522 
523  if (FirstSample < 1e16) {
524  sspReform.PrintHeaderInfo(daqHeader);
525  mf::LogInfo("SSPDiagnosticAna") << "Problem timestamp at " << FirstSample << std::endl;
526  continue;
527  }
528  }
529  catch (cet::exception const&) {
530  continue;
531  }
532 
533  firstTime = std::min(firstTime, FirstSample);
534  lastTime = std::max(lastTime, FirstSample);
535  triggerCount[OpChannel]++;
536 
537  // Advance the dataPointer to the next header
538  dataPointer+=nADC/2;
539 
540  } // End of loop over triggers
541  } // End of loop over fragments (rawFragments)
542 
543 }
544 
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
uint32_t GetPeakSum(const SSPDAQ::EventHeader *daqHeader)
EventNumber_t event() const
Definition: DataViewImpl.cc:96
void endEvent(art::EventNumber_t eventNumber)
Channel_t ChannelNumber() const
Definition: OpDetWaveform.h:69
std::string string
Definition: nybbler.cc:12
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
void analyze(art::Event const &evt) override
SSPDiagnosticAna(fhicl::ParameterSet const &pset)
unsigned int CheckAndGetNTriggers(const artdaq::Fragment &frag, const lbne::SSPFragment sspf)
Load the milislice.
void endRun(art::Run const &run) override
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:27
std::map< int, TH1D * > PulseAmplitudePerChannel
Definition: Run.h:21
bool isValid() const
Definition: Handle.h:183
unsigned long GetBaselineSum(const SSPDAQ::EventHeader *daqHeader)
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:446
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:69
SSPDiagnosticAna & operator=(SSPDiagnosticAna const &)=delete
unsigned long GetIntegratedSum(const SSPDAQ::EventHeader *daqHeader)
parameter set interface
unsigned long GetGlobalFirstSample(const SSPDAQ::EventHeader *daqHeader)
Collect all the RawData header files together.
T get(std::string const &key) const
Definition: ParameterSet.h:231
std::map< int, long int > triggerCount
std::map< int, TH1D * > IntegratedChargePerChannel
tick_as<> tick
Tick number, represented by std::ptrdiff_t.
Definition: electronics.h:74
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:89
RunNumber_t run() const
Definition: DataViewImpl.cc:82
static int max(int a, int b)
unsigned short GetOpChannel(const SSPDAQ::EventHeader *daqHeader)
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
void beginRun(art::Run const &run) override
p
Definition: test.py:223
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
std::map< int, TH2D * > PulseAmplitudeVsIntegratedChargePerChannel
std::map< int, TH2D * > averageWaveforms
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
IDNumber_t< Level::Event > EventNumber_t
Definition: IDNumber.h:118
void beginEvent(art::EventNumber_t eventNumber)
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
TCEvent evt
Definition: DataStructs.cxx:7
auto const & get(AssnsNode< L, R, D > const &r)
Definition: AssnsNode.h:115
void PrintHeaderInfo(const SSPDAQ::EventHeader *daqHeader)
Print out header information.
double ClockFrequency()
Return the NOvAClockFrequency.
Definition: fwd.h:29
void reconfigure(fhicl::ParameterSet const &pset)
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
unsigned int run