using namespace std;
#include "hstartcalpar.h"
#include "hades.h"
#include "hruntimedb.h"
#include "hspectrometer.h"
#include "hstartdetector.h"
#include "hpario.h"
#include "hdetpario.h"
#include <iostream>
#include <iomanip>
ClassImp(HStartCalPar)
ClassImp(HStartCalParMod)
ClassImp(HStartCalParChan)
void HStartCalParChan::Streamer(TBuffer &R__b)
{
UInt_t R__s, R__c;
if (R__b.IsReading()) {
Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
TObject::Streamer(R__b);
if(R__v==1){
R__b >> slope;
R__b >> offset;
}
else{
R__b >> slope;
R__b >> offset;
R__b >> slopeL;
R__b >> slopeR;
R__b >> slopeM;
R__b >> vGroup;
R__b >> posOffset;
}
R__b.CheckByteCount(R__s, R__c, HStartCalParChan::IsA());
} else {
R__c = R__b.WriteVersion(HStartCalParChan::IsA(), kTRUE);
TObject::Streamer(R__b);
R__b << slope;
R__b << offset;
R__b << slopeL;
R__b << slopeR;
R__b << slopeM;
R__b << vGroup;
R__b << posOffset;
R__b.SetByteCount(R__c, kTRUE);
}
}
HStartCalParMod::HStartCalParMod(Int_t n) {
array = new TObjArray(n);
for(Int_t i=0 ; i<n ; i++)
array->AddAt( new HStartCalParChan(),i);
}
HStartCalParMod::~HStartCalParMod() {
array->Delete();
delete array;
}
HStartCalPar::HStartCalPar(const Char_t* name,const Char_t* title,
const Char_t* context)
: HParSet(name,title,context) {
strcpy(detName,"Start");
HStartDetector* det =
(HStartDetector*)gHades->getSetup()->getDetector("Start");
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 HStartCalParMod(nComp),i);
else array->AddAt( new HStartCalParMod(0),i);
}
}
HStartCalPar::~HStartCalPar() {
array->Delete();
delete array;
}
Bool_t HStartCalPar::init(HParIo* inp,Int_t* set) {
HDetParIo* input=inp->getDetParIo("HStartParIo");
if (input) return (input->init(this,set));
return kFALSE;
}
Int_t HStartCalPar::write(HParIo* output) {
HDetParIo* out=output->getDetParIo("HStartParIo");
if (out) return out->write(this);
return -1;
}
void HStartCalPar::clear() {
for(Int_t i=0;i<getSize();i++) {
HStartCalParMod& mod=(*this)[i];
for(Int_t j=0;j<mod.getSize();j++)
mod[j].clear();
}
status=kFALSE;
resetInputVersions();
}
void HStartCalPar::printParam() {
printf("Calibration parameters for the START detector\n");
printf("module strip slope tim.offset slopeL slopeR slopeM vGroup posOffset\n");
for(Int_t i=0;i<getSize();i++) {
HStartCalParMod& mod=(*this)[i];
for(Int_t j=0;j<mod.getSize();j++) {
HStartCalParChan& chan=mod[j];
printf("%4i%4i%10.5f%9.3f%10.5f%10.5f%10.5f%10.3f%8.3f\n",i,j,chan.getSlope(),chan.getOffset(),chan.getSlopeL(),chan.getSlopeR(),chan.getSlopeM(),chan.getVGroup(),chan.getPosOffset());
}
}
}
void HStartCalPar::readline(const Char_t *buf, Int_t *set) {
Int_t mod, strip;
Float_t f[7]={-1,-1,-1,-1,-1,-1,-1};
sscanf(buf,"%i%i%f%f%f%f%f%f%f", &mod, &strip, &f[0],&f[1],&f[2],&f[3],&f[4],&f[5],&f[6]);
if (!set[mod]) return;
(*this)[mod][strip].fill(f);
set[mod]=999;
}
void HStartCalPar::putAsciiHeader(TString& header) {
header=
"# Calibration parameters for the START detector\n"
"# Format:\n"
"# module strip slope tim.offset slopeL slopeR slopeM vGroup pos.Offset\n";
}
Bool_t HStartCalPar::writeline(Char_t *buf, Int_t mod, Int_t strip) {
HStartCalParChan& chan=(*this)[mod][strip];
sprintf(buf,"%4i%4i%10.5f%9.3f%10.5f%10.5f%10.5f%10.3f%8.3f\n",
mod, strip, chan.getSlope(),chan.getOffset(),chan.getSlopeL(),chan.getSlopeR(),chan.getSlopeM(),chan.getVGroup(),chan.getPosOffset());
return kTRUE;
}
Last change: Sat May 22 13:14:35 2010
Last generated: 2010-05-22 13:14
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.