//*-- Author : Georgy Kornakov //*-- Created : 27.01.2016 //_HADES_CLASS_DESCRIPTION ///////////////////////////////////////////////////////////// // HStsDigiGeomPar // // Container class of Forward Straw detector Digi par // ///////////////////////////////////////////////////////////// #include "hstsstatuspar.h" #include "hparamlist.h" #include "hpario.h" const Int_t field_width = 4; ClassImp(HStsStatusPar) HStsStatusPar::HStsStatusPar(const Char_t *name, const Char_t *title, const Char_t *context) : HParCond(name, title, context) { clear(); } void HStsStatusPar::clear() { memset(feb_status, 0, max_straws * sizeof(Int_t)); } void HStsStatusPar::putParams(HParamList *l) { // puts all parameters to the parameter list, which is used by the io if (!l) return; Int_t ncount = 0; Int_t feb_status_tmp[field_width * max_straws] = { 0 }; for (Int_t m = 0; m < STS_MAX_MODULES; ++m) for (Int_t l = 0; l < STS_MAX_LAYERS; ++l) for (Int_t c = 0; c < STS_MAX_UDCELLS; ++c) if (feb_status[m][l][c]) { feb_status_tmp[ncount * field_width + 0] = m; feb_status_tmp[ncount * field_width + 1] = l; feb_status_tmp[ncount * field_width + 2] = c; feb_status_tmp[ncount * field_width + 3] = feb_status[m][l][c]; ++ncount; } Int_t s = ncount * field_width; if (s == 0) s = 1; TArrayI feb_status_arr(s, feb_status_tmp); l->add("nStrawStatus", feb_status_arr); } Bool_t HStsStatusPar::getParams(HParamList *l) { // gets all parameters from the parameter list, which is used by the io if (!l) return kFALSE; TArrayI feb_status_arr; if (!(l->fill("nStrawStatus", &feb_status_arr))) return kFALSE; if (feb_status_arr.GetSize() != 1 && feb_status_arr.GetSize() % field_width) { Error("HStsStatusPar::getParams(HParamList* l)", "Array size of nStrawStatus=%d does not fit to number of fields=%d*k", feb_status_arr.GetSize(), field_width); return kFALSE; } clear(); Int_t nStraws = feb_status_arr.GetSize() / field_width; for (Int_t i = 0; i < nStraws; ++i) { Int_t m = feb_status_arr[i * field_width + 0]; Int_t l = feb_status_arr[i * field_width + 1]; Int_t c = feb_status_arr[i * field_width + 2]; feb_status[m][l][c] = feb_status_arr[i * field_width + 3]; } return kTRUE; } void HStsStatusPar::printParams() { std::cout << "\n---------------------------------------------\n"; std::cout << "----- " << GetName() << " -----\n"; if (!paramContext.IsNull()) std::cout << "-- Context/Purpose: " << paramContext << '\n'; if (!author.IsNull()) std::cout << "-- Author: " << author << '\n'; if (!description.IsNull()) std::cout << "-- Description: " << description << '\n'; std::cout << "---------------------------------------------\n"; Int_t i = 0; for (Int_t m = 0; m < STS_MAX_MODULES; ++m) for (Int_t l = 0; l < STS_MAX_LAYERS; ++l) for (Int_t c = 0; c < STS_MAX_UDCELLS; ++c) if (feb_status[m][l][c]) printf(" [%3d] m=%1d l=%1d c=%31d status=%d\n", i++, m, l, c, feb_status[m][l][c]); std::cout << "---------------------------------------------\n\n"; }