IcebergDataInterfaceFELIXBufferMarch2021.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // IcebergDataInterfaceFELIXBufferMarch2021.h
3 //
4 // Tool to unpack RCE and FELIX fragments. A restructuring from the IcebergRawDecoder module
5 //
6 // These methods take references to vectors of raw::RawDigit, raw::RDTimeStamp, and raw::RDStatus data products as arguments.
7 // These vectors are not cleared on input, and so when data are retrieved, they are appended to any existing data already
8 // in the vectors. The RDStatus vector is an exception, where just one RDStatus instance will be in the vector. Previously
9 // accumulated RDStatus values from previous calls will be logically ORed into the single RDStatus instances contents.
10 //
11 // Methods are provided to retrieve all data from fragments on an input label, or by specified APA list. In cases where
12 // data from a specified APA are requested but no labels are provided by the caller, labels are input via FCL parameters.
13 // This is true because data from an APA may appear with different labels during the course of the ProtoDUNE-SP run.
14 //
15 /////////////////////////////////////////////////////////////////////////
16 #ifndef IcebergDataInterfaceFELIXBufferMarch2021_H
17 #define IcebergDataInterfaceFELIXBufferMarch2021_H
18 
19 #include <vector>
20 
22 #include "fhiclcpp/ParameterSet.h"
25 //#include "art/Framework/Principal/Run.h"
26 //#include "art/Framework/Principal/SubRun.h"
33 
35 
36  public:
37 
39 
40  int retrieveData(art::Event &evt, std::string inputlabel, std::vector<raw::RawDigit> &raw_digits, std::vector<raw::RDTimeStamp> &rd_timestamps,
41  std::vector<raw::RDStatus> &rdstatuses );
42 
43  // method to get raw digits, RDTimeStamps, RDStatuses from input files
44  // specified in the fcl configuration
45 
46  int retrieveDataAPAListWithLabels(art::Event &evt, std::string inputlabel, std::vector<raw::RawDigit> &raw_digits, std::vector<raw::RDTimeStamp> &rd_timestamps,
47  std::vector<raw::RDStatus> &rdstatuses,
48  std::vector<int> &apalist);
49 
50  // method to get raw digits, RDTimeStamps, RDStatuses for a specified list of APA's. The list of possible labels on which to find
51  // APA data is proved by fcl configuration.
52 
53  int retrieveDataForSpecifiedAPAs(art::Event &evt, std::vector<raw::RawDigit> &raw_digits, std::vector<raw::RDTimeStamp> &rd_timestamps,
54  std::vector<raw::RDStatus> &rdstatuses,
55  std::vector<int> &apalist);
56 
57  // inputLabel examples: "daq:TPC" or "daq::ContainerTPC" for RCE, "daq:FELIX" or "daq::ContainerFELIX" for FELIX
58  // returns: 0: success, or 1: discarded corrupted data, or 2: kept some corrupted data
59 
60  private:
61 
62  // open files
63 
64  std::vector<FILE*> fInputFilePointers;
65 
66  // configuration parameters
67 
68  std::vector<std::string> fInputFiles;
69  size_t fNSamples;
72  bool fFirstRead;
73 
74  // some convenience typedefs for porting old code
75 
76  typedef std::vector<raw::RawDigit> RawDigits;
77  typedef std::vector<raw::RDTimeStamp> RDTimeStamps;
78  typedef std::vector<raw::RDStatus> RDStatuses;
79 
80  // private methods
81 
82  void unpack14(const uint32_t *packed, uint16_t *unpacked);
83 
85  float &median,
86  float &sigma);
87 
88 };
89 
90 
91 #endif
int retrieveData(art::Event &evt, std::string inputlabel, std::vector< raw::RawDigit > &raw_digits, std::vector< raw::RDTimeStamp > &rd_timestamps, std::vector< raw::RDStatus > &rdstatuses)
std::string string
Definition: nybbler.cc:12
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition: RawDigit.h:73
static constexpr double ps
Definition: Units.h:99
int retrieveDataAPAListWithLabels(art::Event &evt, std::string inputlabel, std::vector< raw::RawDigit > &raw_digits, std::vector< raw::RDTimeStamp > &rd_timestamps, std::vector< raw::RDStatus > &rdstatuses, std::vector< int > &apalist)
void unpack14(const uint32_t *packed, uint16_t *unpacked)
int retrieveDataForSpecifiedAPAs(art::Event &evt, std::vector< raw::RawDigit > &raw_digits, std::vector< raw::RDTimeStamp > &rd_timestamps, std::vector< raw::RDStatus > &rdstatuses, std::vector< int > &apalist)
void computeMedianSigma(raw::RawDigit::ADCvector_t &v_adc, float &median, float &sigma)
TCEvent evt
Definition: DataStructs.cxx:7
double median(sqlite3 *db, std::string const &table_name, std::string const &column_name)
Definition: statistics.cc:26