RunHistoryDUNE.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // RunHistoryDUNE.h
3 //
4 // Data provider class for run history
5 //
6 // jpaley@fnal.gov
7 //
8 ////////////////////////////////////////////////////////////////////////
9 #ifndef RUNHISTORYDUNE_H
10 #define RUNHISTORYDUNE_H
11 
12 #include <string>
13 #include <vector>
14 #include <map>
15 #include <unordered_map>
16 #include <memory>
17 
18 #include "fhiclcpp/ParameterSet.h"
19 
21 #include "nuevdb/IFDatabase/Table.h"
22 
23 ///General LArSoft Utilities
24 namespace dune {
25 
26  class ASICSetting {
27  public:
29  ASICSetting(float g, float s, int b) {gain=g; shape=s; base=b;};
31  float gain;
32  float shape;
33  int base;
34  };
35 
36  class SubRunDUNE : public detinfo::SubRun {
37  public:
38  SubRunDUNE() : fTStart(0) {};
39  SubRunDUNE(SubRunDUNE const&) = delete;
40  virtual ~SubRunDUNE() {};
41 
42  virtual uint64_t TStart() const override { return fTStart; }
43  void SetTStart(uint64_t t) { fTStart = t; }
44 
45  private:
47  };
48 
50  public:
51  typedef enum {
52  kUnknownDet = 0,
57  kNDUNEDetectors
58  } DetId_t;
59 
60  static std::string DetIdToString(int detId) {
61  if (detId == k35t) return std::string("dune35t");
62  else return std::string("UNKNOWN_DET");
63  }
64 
65  static int DetNameToId(std::string detStr) {
66  if (detStr == "dune35t" || detStr == "DUNE35t" ||
67  detStr == "35t") return k35t;
68  else return kUnknownDet;
69  }
70 
71 
72  public:
73  RunHistoryDUNE(int detid, int runnum);
74  RunHistoryDUNE(RunHistoryDUNE const&) = delete;
75  virtual ~RunHistoryDUNE();
76 
77  virtual bool Update(uint64_t ts=0) override;
78 
79  virtual int RunNumber() const override{ return fRun; }
80  int DetId() const { return fDetId; }
81  virtual int NSubruns() const override{ return fNSubruns; }
82  virtual int RunType() const override{ return fRunType; }
83  virtual std::string RunTypeAsString() const override;
84  virtual uint64_t TStart() const override { return fTStart; }
85  virtual uint64_t TStop() const override { return fTStop; }
86  virtual uint64_t Duration() const override { return fTStop-fTStart; }
87 
88  std::vector<std::string> Shifters() { return fShifter; }
89  std::vector<std::string> Components() {return fComponents; }
90 
91  void SetNSubruns(int nsr) { fNSubruns = nsr;}
92  void SetRunType(int rt) { fRunType = rt; }
93  void SetTStart(uint64_t t) { fTStart = t; }
94  void SetTStop(uint64_t t) { fTStop = t; }
95  void AddShifter(std::string sh) { fShifter.push_back(sh); }
96  void SetShifters(std::vector<std::string> sh) { fShifter = sh; }
97 
98  std::string CfgLabel() const { return fCfgLabel; }
99  std::string TStartAsString() const { return fTStartStr; }
100  std::string TStopAsString() const { return fTStopStr; }
101 
102  void DumpSCData();
103  void DumpASICSettings();
104 
105  private:
106 
107  bool LoadSCChanMap();
108  bool LoadSCData();
109  bool LoadASICSettings();
110 
111  protected:
112  int fRun;
114  int fRunType;
115  int fDetId;
116 
119 
120  std::vector<std::string> fShifter;
121  std::vector<std::string> fComponents;
126 
127  std::vector<SubRunDUNE> fSubrun;
128  std::unordered_map<std::string,int> fSCChanMap;
129  std::unordered_map<int,std::string> fSCInvChanMap;
130  std::unordered_map<int,ASICSetting> fASICSettingsMap;
131 
132  std::unique_ptr<nutools::dbi::Table> fSCDataTable;
133  std::unique_ptr<nutools::dbi::Table> fASICSettingsTable;
134 
135  }; // class RunHistoryDUNE
136 } //namespace dune
137 #endif // RUNHISTORYDUNE_H
virtual uint64_t TStart() const override
Pedestal provider class for DUNE.
std::vector< std::string > fShifter
std::string TStopAsString() const
virtual int RunType() const override
std::unordered_map< int, std::string > fSCInvChanMap
std::string string
Definition: nybbler.cc:12
virtual uint64_t Duration() const override
static int DetNameToId(std::string detStr)
std::unique_ptr< nutools::dbi::Table > fASICSettingsTable
std::string TStartAsString() const
void SetTStart(uint64_t t)
static const double g
Definition: Units.h:145
virtual int NSubruns() const override
void SetTStart(uint64_t t)
static std::string DetIdToString(int detId)
std::unordered_map< std::string, int > fSCChanMap
std::vector< SubRunDUNE > fSubrun
std::unique_ptr< nutools::dbi::Table > fSCDataTable
void SetRunType(int rt)
unsigned __int64 uint64_t
Definition: stdint.h:136
bool Update(TCSlice &slc, PFPStruct &pfp, bool prt)
Definition: PFPUtils.cxx:1017
ASICSetting(float g, float s, int b)
std::vector< std::string > Shifters()
virtual int RunNumber() const override
virtual uint64_t TStop() const override
virtual ~SubRunDUNE()
std::vector< std::string > Components()
void SetTStop(uint64_t t)
void SetShifters(std::vector< std::string > sh)
void AddShifter(std::string sh)
void SetNSubruns(int nsr)
std::string CfgLabel() const
virtual uint64_t TStart() const override
std::unordered_map< int, ASICSetting > fASICSettingsMap
static bool * b
Definition: config.cpp:1043
std::vector< std::string > fComponents
static QCString * s
Definition: config.cpp:1042