00001 00008 #ifndef _QAPOLLO_CALIB_HH_ 00009 #define _QAPOLLO_CALIB_HH_ 00010 00011 #include "QCuore.hh" 00012 #include "QDbDetector.hh" 00013 #include <map> 00014 #include <vector> 00015 00016 using namespace Cuore; 00017 00018 class QApolloCalib 00019 { 00020 public: 00021 00023 enum QCalibType_t { 00024 QCalibADC16, 00028 QCalibADC18, 00032 QCalibmV 00035 }; 00036 00041 QApolloCalib(const QDbDetector::DetectorName detName); 00042 00044 virtual ~QApolloCalib(); 00045 00052 bool SetRun(const int run); 00053 00061 bool SetLg(const int lg); 00062 00078 size_t Scale(const QVector& inVector, 00079 QVector& outVector, 00080 const QCalibType_t calType, 00081 const size_t howmany, 00082 const size_t first = 0) const; 00083 00093 bool Scale2mV(const long val, float& scaled) const; 00094 00105 bool Scale2ADC16(const long val, unsigned short& scaled) const; 00106 00116 bool Scale2ADC18(const long val, long& scaled) const; 00117 00118 private: 00119 00121 std::map<int,int> fBoards; 00122 00124 std::map<int,std::vector<double> > fCoeffs; 00125 00127 int fCurrentBoard; 00128 00130 const std::vector<double>* fCurrentCalibCoeffs; 00131 00136 const QDbDetector::DetectorName fDetectorName; 00137 00142 void FillMaps(const int run); 00143 00154 bool Scale2mVDouble(const long val, double& scaled) const; 00155 00156 }; 00157 #endif