using namespace std;
#include "hstartselfcopar.h"
#include "hades.h"
#include "hruntimedb.h"
#include "hspectrometer.h"
#include "hstartdetector.h"
#include "hpario.h"
#include "hdetpario.h"
#include <iostream>
#include <iomanip>
ClassImp(HStartSelfCoPar)
ClassImp(HStartSelfCoParMod)
ClassImp(HStartSelfCoParChan)
HStartSelfCoParMod::HStartSelfCoParMod(Int_t n) {
array = new TObjArray(n);
for(Int_t i=0 ; i<n ; i++)
array->AddAt( new HStartSelfCoParChan(),i);
}
HStartSelfCoParMod::~HStartSelfCoParMod() {
array->Delete();
delete array;
}
HStartSelfCoPar::HStartSelfCoPar(const Char_t* name,const Char_t* title,
const Char_t* context)
: HParSet(name,title,context) {
strcpy(detName,"Start");
HDetector* det= gHades->getSetup()->getDetector("Start");
Int_t nMod=1;
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 HStartSelfCoParMod(nComp),i);
else array->AddAt(new HStartSelfCoParMod(0),i);
}
}
HStartSelfCoPar::~HStartSelfCoPar() {
array->Delete();
delete array;
}
Bool_t HStartSelfCoPar::init(HParIo* inp,Int_t* set) {
HDetParIo* input=inp->getDetParIo("HStartParIo");
if (input) return (input->init(this,set));
return kFALSE;
}
Int_t HStartSelfCoPar::write(HParIo* output) {
HDetParIo* out=output->getDetParIo("HStartParIo");
if (out) return out->write(this);
return -1;
}
void HStartSelfCoPar::clear() {
for(Int_t i=0;i<getSize();i++) {
HStartSelfCoParMod& mod=(*this)[i];
for(Int_t j=0;j<mod.getSize();j++)
mod[j].clear();
}
status=kFALSE;
resetInputVersions();
}
void HStartSelfCoPar::printParam() {
printf("Selfcoincidence parameters for the START detector\n");
printf("module strip time halfwidth\n");
for(Int_t i=0;i<getSize();i++) {
HStartSelfCoParMod& mod=(*this)[i];
for(Int_t j=0;j<mod.getSize();j++) {
HStartSelfCoParChan& chan=mod[j];
printf("%4i%4i %10.5f%8.3f\n",i,j,chan.getTime(),chan.getHalfWidth());
}
}
}
void HStartSelfCoPar::readline(const Char_t *buf, Int_t *set) {
Int_t mod, strip;
Float_t time, halfwidth;
sscanf(buf,"%i%i%f%f", &mod, &strip, &time, &halfwidth);
if (!set[mod]) return;
(*this)[mod][strip].fill(time,halfwidth);
set[mod]=999;
}
void HStartSelfCoPar::putAsciiHeader(TString& header) {
header=
"# Selfcoincidence parameters for the START detector\n"
"# Format:\n"
"# module strip time halfwidth\n";
}
Bool_t HStartSelfCoPar::writeline(Char_t *buf, Int_t mod, Int_t strip) {
HStartSelfCoParChan& chan=(*this)[mod][strip];
sprintf(buf,"%4i%4i %10.5f%8.3f\n",
mod, strip, chan.getTime(),chan.getHalfWidth());
return kTRUE;
}
Last change: Sat May 22 13:14:55 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.