using namespace std;
#include "hhodocalpar.h"
#include "hades.h"
#include "hruntimedb.h"
#include "hspectrometer.h"
#include "hhododetector.h"
#include "hpario.h"
#include "hdetpario.h"
#include <iostream>
#include <iomanip>
ClassImp(HHodoCalPar)
ClassImp(HHodoCalParMod)
ClassImp(HHodoCalParChan)
HHodoCalParMod::HHodoCalParMod(Int_t n)
{
array = new TObjArray(n);
for(Int_t i=0 ; i<n ; i++)
array->AddAt( new HHodoCalParChan(),i);
}
HHodoCalParMod::~HHodoCalParMod()
{
array->Delete();
delete array;
}
HHodoCalPar::HHodoCalPar(const Char_t* name,const Char_t* title,
const Char_t* context)
: HParSet(name,title,context)
{
strcpy(detName,"Hodo");
HHodoDetector* det = (HHodoDetector*)gHades->getSetup()->getDetector("Hodo");
Int_t nMod=det->getMaxModInSetup();
Int_t nComp=det->getMaxComponents();
array = new TObjArray(nMod);
for (Int_t i = 0; i < nMod; i++) {
if (det->getModule(-1,i)>0) array->AddAt( new HHodoCalParMod(nComp),i);
else array->AddAt( new HHodoCalParMod(0),i);
}
}
HHodoCalPar::~HHodoCalPar()
{
array->Delete();
delete array;
}
Bool_t HHodoCalPar::init(HParIo* inp,Int_t* set)
{
HDetParIo* input=inp->getDetParIo("HHodoParIo");
if (input) return (input->init(this,set));
return kFALSE;
}
Int_t HHodoCalPar::write(HParIo* output)
{
HDetParIo* out=output->getDetParIo("HHodoParIo");
if (out) return out->write(this);
return -1;
}
void HHodoCalPar::clear()
{
for(Int_t i=0;i<getSize();i++) {
HHodoCalParMod& mod=(*this)[i];
for(Int_t j=0;j<mod.getSize();j++)
mod[j].clear();
}
status=kFALSE;
resetInputVersions();
}
void HHodoCalPar::printParam()
{
printf("Calibration parameters for the HODO detector\n");
printf("module strip TDC.slope TDC.offset ADC.slope ADC.offset\n");
for(Int_t i=0;i<getSize();i++) {
HHodoCalParMod& mod=(*this)[i];
for(Int_t j=0;j<mod.getSize();j++) {
HHodoCalParChan& chan=mod[j];
printf("%4i%4i%10.5f%12.3f%10.5f%12.3f\n",i,j,chan.getTDCSlope(),chan.getTDCOffset(),chan.getADCSlope(),chan.getADCOffset());
}
}
}
void HHodoCalPar::readline(const Char_t *buf, Int_t *set)
{
Int_t mod, strip;
Float_t f[4]={-1,-1,-1,-1};
sscanf(buf,"%i%i%f%f%f%f", &mod, &strip, &f[0],&f[1],&f[2],&f[3]);
if (!set[mod]) return;
(*this)[mod][strip].fill(f);
set[mod]=999;
}
void HHodoCalPar::putAsciiHeader(TString& header)
{
header=
"# Calibration parameters for the HODO detector\n"
"# Format:\n"
"# module strip TDC.slope TDC.offset ADC.slope ADC.offset\n";
}
Bool_t HHodoCalPar::writeline(Char_t *buf, Int_t mod, Int_t strip)
{
HHodoCalParChan& chan=(*this)[mod][strip];
sprintf(buf,"%4i%4i%10.5f%12.3f%10.5f%12.3f\n",
mod, strip, chan.getTDCSlope(),chan.getTDCOffset(),chan.getADCSlope(),chan.getADCOffset());
return kTRUE;
}
Last change: Sat May 22 12:57:18 2010
Last generated: 2010-05-22 12:57
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.