#include "hrtmatchingpar.h" #include #include "hparamlist.h" //_HADES_CLASS_DESCRIPTION //////////////////////////////////////////////// HRtMatchingPar::HRtMatchingPar(const Char_t* name, const Char_t *title, const Char_t *context) : HParCond(name,title,context) { } HRtMatchingPar::~HRtMatchingPar(void) { } void HRtMatchingPar::readFrom(const HRtMatchingPar &par) { fTotalBins = par.fTotalBins; fIdx = par.fIdx; fCells = par.fCells; fMin = par.fMin; fMax = par.fMax; fBinSize = par.fBinSize; fBins = par.fBins; } void HRtMatchingPar::putParams(HParamList* l) { if (!l) return; l->add("fTotalBins", fTotalBins); l->add("fIdx", fIdx); l->add("fCells", fCells); l->add("fMin", fMin); l->add("fMax", fMax); l->add("fBinSize", fBinSize); l->add("fBins", fBins); } Bool_t HRtMatchingPar::getParams(HParamList* l) { if (!l) return kFALSE; if (!l->fill("fTotalBins", &fTotalBins)) return kFALSE; if (!l->fill("fIdx", &fIdx)) return kFALSE; if (!l->fill("fCells", &fCells)) return kFALSE; if (!l->fill("fMin", &fMin)) return kFALSE; if (!l->fill("fMax", &fMax)) return kFALSE; if (!l->fill("fBinSize", &fBinSize)) return kFALSE; if (!l->fill("fBins", &fBins)) return kFALSE; return kTRUE; } Char_t &HRtMatchingPar::bin(Int_t idx[]) { Int_t address = idx[0]; Int_t *bins = fBins.GetArray(); if (idx[0]fMax[i]) { //Error("bin","Out of bounds %f>%f",a[i],fMin[i]); return fCells[fTotalBins]; } else { idx[i] = int(floor((a[i]-fMin[i])/fBinSize[i])); } } return bin(idx); } void HRtMatchingPar::setDimension(Int_t n,Int_t bins[]) { fMin.Set(n); fIdx.Set(n); fMax.Set(n); fBinSize.Set(n); fBins.Set(n); fTotalBins = 1; for (Int_t i=0;i