29 const std::string& author,
30 const std::string& comment,
34 calibDrawer->init(def,nChans,objVers,author,comment,timeStamp);
124 const float* iX = std::upper_bound(xBeg,xEnd,energy);
125 unsigned int offset = iX-xBeg;
128 if(iX==xBeg || iX==xEnd){
135 float y1 = *(xEnd+offset );
136 float y0 = *(xEnd+offset-1);
137 y = y0+(energy-x0)*(y1-y0)/(x1-x0);
150 float&
y,
float& dy)
const
179 const float* iX = std::upper_bound(xBeg,xEnd,
x);
180 unsigned int offset = iX-xBeg;
184 const float delta = 1.0e-3;
188 if (
x < (*(xBeg) - delta))
return false;
191 y = *(xEnd+offset-1);
193 if (
x > (*(xEnd-1) + delta))
return false;
200 float y1 = *(xEnd+offset );
201 float y0 = *(xEnd+offset-1);
202 float slope = (y1-y0)/(x1-x0);
207 float xs1 =
x + 0.5 * dx;
208 float xs0 =
x - 0.5 * dx;
209 dy = (
getY(channel, adc, xs1) -
getY(channel, adc, xs0)) / dx;
247 const float* iX = std::upper_bound(xBeg,xEnd,
x);
248 unsigned int offset = iX-xBeg;
256 y = *(xEnd+offset-1);
264 float y1 = *(xEnd+offset );
265 float y0 = *(xEnd+offset-1);
266 float slope = (y1-y0)/(x1-x0);
277 float y(-9999.), dy(-9999.);
uint16_t getNChans() const
uint16_t getObjType() const
uint16_t getNGains() const
static const unsigned int m_hdrSize32
uint16_t getObjVersion() const
uint32_t getObjSizeUint32() const
TileCalibDrawerDat(const coral::Blob &blob)
std::vector< std::vector< float > > DefType
float getData(unsigned int channel, unsigned int adc, unsigned int idx) const
const float * getAddress(unsigned int channel, unsigned int adc) const
Generic class for storing a number of floats (Flt) for each channel or ADC.
static const TileCalibDrawerFlt * getInstance(const coral::Blob &blob)
Returns a pointer to a const TileCalibDrawerFlt.
virtual uint16_t getType() const
Returns TileCalibType::FLT.
float getDY(unsigned int channel, unsigned int adc, float x) const
Returns y for a given x for function blob of type 200.
float getY(unsigned int channel, unsigned int adc, float x) const
Returns y for a given x for function blob of type 200.
bool getYDY(unsigned int channel, unsigned int adc, float x, float &y, float &dy) const
Returns y and derivative dy for a given x for function blob of type 200.
TileCalibDrawerFlt(const coral::Blob &blob)
Ctor (const).
float getCalib(unsigned int channel, unsigned int adc, float energy, bool invert=false) const
Returns the calibrated energy for a given channel/ADC and input energy.
static const unsigned int MAX_CHAN
Number of channels in drawer.
Thrown if coral::Blob does not conform with expected structure.
Thrown to prevent invalid results, eg.
Thrown if object type in BLOB does not agree with class type.
Thrown if object version in BLOB does not agree with class.