XYZCalibProtoDUNE.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // \file CalibProtoDUNE.h
3 //
4 // \brief header of class for accessing calibration data for ProtoDUNE
5 //
6 // \author jpaley@fnal.gov
7 //
8 ////////////////////////////////////////////////////////////////////////
9 #ifndef CALIB_XYZCALIBPROTODUNE_H
10 #define CALIB_XYZCALIBPROTODUNE_H
11 
12 
13 // FHiCL libraries
14 #include "fhiclcpp/ParameterSet.h"
15 
16 // ROOT includes
17 #include "TH1F.h"
18 #include "TH2F.h"
19 
20 // C/C++ standard libraries
21 #include <string>
22 #include <vector>
23 #include <map>
24 
25 // dunetpc includes
27 
28 namespace calib {
29 
30  typedef struct {
31  double corr;
32  double corr_err;
33  } NormCorr_t;
34 
35  typedef struct {
36  double x;
37  double dx;
38  double corr;
39  double corr_err;
40  } XCorr_t;
41 
42  bool operator<(const XCorr_t& a, const XCorr_t& b)
43  {
44  return (a.x < b.x);
45  }
46 
47  typedef struct {
48  double y;
49  double dy;
50  double z;
51  double dz;
52  double corr;
53  double corr_err;
54  } YZCorr_t;
55 
56  bool operator<(const YZCorr_t& a, const YZCorr_t& b)
57  {
58  double dy = a.y - b.y;
59  if (dy < -1.e-5) return true;
60  else if (dy > 1.e-5) return false;
61  else return (a.z < b.z);
62  }
63 
64  class XYZCalibProtoDUNE : public XYZCalib {
65 
66  public:
67 
70  XYZCalibProtoDUNE(XYZCalibProtoDUNE const&) = delete;
71  virtual ~XYZCalibProtoDUNE() = default;
72 
73  bool Configure(fhicl::ParameterSet const& pset);
74  bool Update(uint64_t ts=0);
75 
76  virtual double GetNormCorr(int plane) override;
77  virtual double GetXCorr(int plane, double x) override;
78  virtual double GetYZCorr(int plane, int side, double y, double z) override;
79 
80  void SetIsMC(bool v) { fIsMC = v; }
81  void SetNormCorr(int plane, double val);
82  void SetXCorr(int plane, double x, double dx, double val);
83  void SetYZCorr(int plane, int side, double y, double dx, double val);
84  void SetUseCondb(bool v) { fUseCondbXYZCorr = v; }
88 
89  void SetInterpolate(bool v) { fInterpolate = v; }
90 
91  protected:
92  bool LoadNormCorr();
93  bool LoadXCorr();
94  bool LoadYZCorr();
95 
96  protected:
101  bool fIsMC;
103  uint64_t fCurrentTS;
104 
111 
112  std::map<int,NormCorr_t> fNormCorr;
113  std::map<int,TH1F> fXCorrHist;
114  std::map<int,TH2F> fYZCorrHist;
115 
116  }; // class XYZCalibProtoDUNE
117 } //namespace calib
118 #endif // CALIB_XYZCALIBPROTODUNE_H
std::map< int, TH1F > fXCorrHist
bool Update(uint64_t ts=0)
virtual double GetNormCorr(int plane) override
std::string string
Definition: nybbler.cc:12
bool Configure(fhicl::ParameterSet const &pset)
void SetXCorr(int plane, double x, double dx, double val)
void SetNormCorr(int plane, double val)
void SetYZCorr(int plane, int side, double y, double dx, double val)
void SetYZCorrFileName(std::string f)
virtual double GetYZCorr(int plane, int side, double y, double z) override
std::map< int, TH2F > fYZCorrHist
std::map< int, NormCorr_t > fNormCorr
const double e
void SetNormCorrFileName(std::string f)
const double a
void SetXCorrFileName(std::string f)
virtual ~XYZCalibProtoDUNE()=default
static bool * b
Definition: config.cpp:1043
list x
Definition: train.py:276
virtual double GetXCorr(int plane, double x) override
bool operator<(const XCorr_t &a, const XCorr_t &b)