SSPReformatterAlgs.h
Go to the documentation of this file.
1 // -*- mode: c++; c-basic-offset: 2; -*-
2 #ifndef SSPReformatterAlgs_h
3 #define SSPReformatterAlgs_h
4 
5 //artdaq includes
6 #include "artdaq-core/Data/Fragment.hh"
7 
8 
9 //larsoft includes
10 #include "lardataobj/RawData/raw.h"
13 #include "fhiclcpp/ParameterSet.h"
14 
15 // lbne-raw-data includes
16 #include "lbne-raw-data/Overlays/SSPFragment.hh"
17 #include "lbne-raw-data/Overlays/anlTypes.hh"
18 
19 //lbnecode/daqinput35t includes
21 #include <vector>
22 #include <map>
23 
24 // Unpack the given artdaq::Fragment objects, and create a vector of raw::OpDetWaveform objects. The
25 // Fragments are expected to be carrying Optical Detector data; this is not
26 // checked.
27 
28 namespace DAQToOffline {
29 
31  {
32 
33  public:
35 
36  /**
37  * Construct OpDetWaveform objects from triggers with full waveforms and
38  * construct OpHit objects from triggers which only have headers.
39  */
40  void SSPFragmentToWaveformsAndHits(artdaq::Fragments const& rawFragments,
41  std::vector<raw::OpDetWaveform> &opDetWaveformVector,
42  std::vector<recob::OpHit> &opHitVector);
43 
44  /// Construct a waveform from each trigger
45  std::vector<raw::OpDetWaveform> SSPFragmentToOpDetWaveform(artdaq::Fragments const& raw);
46  std::vector<recob::OpHit> SSPHeaderToOpHit(artdaq::Fragments const& raw);
47 
48  /// Print out header information
49  void PrintHeaderInfo(const SSPDAQ::EventHeader *daqHeader);
50 
51  /// Load the milislice
52  unsigned int CheckAndGetNTriggers(const artdaq::Fragment& frag, const lbne::SSPFragment sspf);
53 
54  /// Load the header
55  const SSPDAQ::EventHeader* GetHeaderAndAdvance(const unsigned int* &dataPointer);
56 
57  // Extract data from the header
58  uint32_t GetPeakSum(const SSPDAQ::EventHeader* daqHeader);
59  unsigned short GetOpChannel(const SSPDAQ::EventHeader* daqHeader);
60  unsigned long GetGlobalFirstSample(const SSPDAQ::EventHeader* daqHeader);
61  unsigned long GetInternalFirstSample(const SSPDAQ::EventHeader *daqHeader);
62  unsigned long GetBaselineSum(const SSPDAQ::EventHeader *daqHeader);
63  unsigned long GetIntegratedSum(const SSPDAQ::EventHeader *daqHeader);
64  unsigned int GetPeakTime(const SSPDAQ::EventHeader *daqHeader);
65  unsigned int GetWaveformLength(const SSPDAQ::EventHeader *daqHeader);
66 
67  /// Return the NOvAClockFrequency
68  double ClockFrequency() { return NOvAClockFrequency; }
69 
70  private:
71  /// Construct a waveform from the adc vector, advance the data pointer when done
72  raw::OpDetWaveform ConstructWaveformAndAdvance(const SSPDAQ::EventHeader* daqHeader,
73  const unsigned int* &dataPointer);
74  /// Construct an OpHit object from the daqHeader
75  recob::OpHit ConstructOpHit(const SSPDAQ::EventHeader* daqHeader);
76 
77 
79  std::map<int,int> theChannelMap;
80 
81  int m1;
82  int i1;
83  int i2;
84  double SPESize;
85 
86 
87 
88  void BuildOpDetChannelMap(std::string fChannelMapFile);
89 
90  };
91 
92 }
93 #endif
recob::OpHit ConstructOpHit(const SSPDAQ::EventHeader *daqHeader)
Construct an OpHit object from the daqHeader.
uint32_t GetPeakSum(const SSPDAQ::EventHeader *daqHeader)
unsigned int GetPeakTime(const SSPDAQ::EventHeader *daqHeader)
void SSPFragmentToWaveformsAndHits(artdaq::Fragments const &rawFragments, std::vector< raw::OpDetWaveform > &opDetWaveformVector, std::vector< recob::OpHit > &opHitVector)
SSPReformatterAlgs(fhicl::ParameterSet const &pset)
raw::OpDetWaveform ConstructWaveformAndAdvance(const SSPDAQ::EventHeader *daqHeader, const unsigned int *&dataPointer)
Construct a waveform from the adc vector, advance the data pointer when done.
std::string string
Definition: nybbler.cc:12
unsigned int CheckAndGetNTriggers(const artdaq::Fragment &frag, const lbne::SSPFragment sspf)
Load the milislice.
unsigned long GetInternalFirstSample(const SSPDAQ::EventHeader *daqHeader)
Raw data description.
unsigned int GetWaveformLength(const SSPDAQ::EventHeader *daqHeader)
const SSPDAQ::EventHeader * GetHeaderAndAdvance(const unsigned int *&dataPointer)
Load the header.
unsigned long GetBaselineSum(const SSPDAQ::EventHeader *daqHeader)
unsigned int uint32_t
Definition: stdint.h:126
unsigned long GetIntegratedSum(const SSPDAQ::EventHeader *daqHeader)
unsigned long GetGlobalFirstSample(const SSPDAQ::EventHeader *daqHeader)
Collect all the RawData header files together.
std::vector< recob::OpHit > SSPHeaderToOpHit(artdaq::Fragments const &raw)
unsigned short GetOpChannel(const SSPDAQ::EventHeader *daqHeader)
void BuildOpDetChannelMap(std::string fChannelMapFile)
void PrintHeaderInfo(const SSPDAQ::EventHeader *daqHeader)
Print out header information.
std::vector< raw::OpDetWaveform > SSPFragmentToOpDetWaveform(artdaq::Fragments const &raw)
Construct a waveform from each trigger.
double ClockFrequency()
Return the NOvAClockFrequency.