#include "TString.h"
#include "hemcsimulpar.h"
#include "hpario.h"
#include "hdetpario.h"
#include "hparamlist.h"
using namespace std;
ClassImp(HEmcSimulPar)
HEmcSimulPar::HEmcSimulPar(const char* name,const char* title,const char* context)
           : HParCond(name,title,context) {
  
  numRows = 15;
  numCols = 17;
  lookupPmtType.Set(6*numRows*numCols);
  clear();
}
void HEmcSimulPar::clear(void) {
  
  numPmtTypes = 0;
  lookupPmtType.Reset();
}
void HEmcSimulPar::putParams(HParamList* l) {
  
  if (!l) return;
  l->add("numPmtTypes",  numPmtTypes);
  l->add("lookupPmtType",lookupPmtType);
}
Bool_t HEmcSimulPar::getParams(HParamList* l) {
  
  if (!l) return kFALSE;
  if (!(l->fill("numPmtTypes",  &numPmtTypes)))     return kFALSE;
  if (!(l->fill("lookupPmtType",&lookupPmtType)))   return kFALSE;   
  return kTRUE;
}
Bool_t HEmcSimulPar::getLookupArray(Int_t arraySize, Int_t* array) {
  
  
  if (arraySize == lookupPmtType.GetSize()) {
    memcpy(array,lookupPmtType.GetArray(), arraySize*sizeof(Int_t));
    return kTRUE;
  }
  Error("getLookupArray", "Mismatch of array sizes (lookupPmtType: %i)",lookupPmtType.GetSize());
  return kFALSE;
}
void HEmcSimulPar::printLookupPmtType(void) {
  
  
  Int_t i=0, k=0;
  while (k<lookupPmtType.GetSize()) {
    if (i==numCols) {
      cout<<" \\\n";
      i=0;
    }
    cout<<" "<<lookupPmtType[k];
    i++;
    k++;
  }
  cout<<endl;
}