#include "hmdcevreadout.h"
#include "hmdcmboreadout.h"
#include "hades.h"
#include "hruntimedb.h"
#include "hspectrometer.h"
#include "hmdcdetector.h"
#include "hmdcgeomstruct.h"
#include "hpario.h"
#include "hdetpario.h"
#include "hmessagemgr.h"
#include "TClass.h"
ClassImp(HMdcEvReadout)
ClassImp(HMdcEvReadoutSam)
ClassImp(HMdcEvReadoutRoc)
ClassImp(HMdcEvReadoutBusPos)
ClassImp(HMdcEvReadoutBus)
HMdcEvReadoutBusPos::HMdcEvReadoutBusPos(Int_t n) {
array = new TObjArray(n);
for (Int_t i = 0; i < n; i++) {
array->AddAt(new HMdcEvReadoutBus(),i);
}
}
HMdcEvReadoutBusPos::~HMdcEvReadoutBusPos() {
array->Delete();
delete array;
}
HMdcEvReadoutRoc::HMdcEvReadoutRoc(Int_t n) {
array = new TObjArray(n);
for (Int_t i = 0; i < n; i++) {
array->AddAt(new HMdcEvReadoutBusPos(),i);
}
}
HMdcEvReadoutRoc::~HMdcEvReadoutRoc() {
array->Delete();
delete array;
}
HMdcEvReadoutSam::HMdcEvReadoutSam(Int_t n) {
array = new TObjArray(n);
for (Int_t i = 0; i < n; i++) {
array->AddAt(new HMdcEvReadoutRoc(),i);
}
}
HMdcEvReadoutSam::~HMdcEvReadoutSam() {
array->Delete();
delete array;
}
HMdcEvReadout::HMdcEvReadout(const Char_t* name,const Char_t* title,
const Char_t* context,Int_t n)
: HParSet(name,title,context) {
strcpy(detName,"Mdc");
arrayBaseSize=n;
array = new TObjArray(n);
samNumberToSector = new Int_t[n];
samNumberToModule = new Int_t[n];
HMdcMboReadout* p=0;
p=(HMdcMboReadout*)gHades->getRuntimeDb()->getContainer("MdcMboReadout");
}
HMdcEvReadout::~HMdcEvReadout() {
array->Delete();
delete[] samNumberToSector;
delete[] samNumberToModule;
delete array;
}
Bool_t HMdcEvReadout::init(HParIo*) {
HMdcMboReadout* p=
(HMdcMboReadout*)gHades->getRuntimeDb()->getContainer("MdcMboReadout");
if (!p) return kFALSE;
Int_t v1=p->getInputVersion(1);
Int_t v2=p->getInputVersion(2);
if (v1==versions[1] && v2==versions[2]) return kTRUE;
for (Int_t i = 0; i < arrayBaseSize ; i++)
{
array->AddAt(new HMdcEvReadoutSam(),i);
samNumberToSector[i]=-1;
samNumberToModule[i]=-1;
}
Int_t sam=0;
Int_t samNo=0;
Int_t samP=0;
for(Int_t s=0;s<p->getSize();s++)
{
HMdcMboReadoutSec& sector=(*p)[s];
for(Int_t m=0;m<sector.getSize();m++)
{
HMdcMboReadoutMod& module=sector[m];
for(Int_t l=0;l<module.getSize();l++)
{
HMdcMboReadoutMoth& moth=module[l];
sam=moth.getSam();
samP=moth.getSamPos();
if (sam>=0)
{
samNo=sam*2+samP;
(*this)[samNo][moth.getRoc()][moth.getBusPos()][moth.getBus()].fill(s,m,l);
if (samNumberToSector[samNo]==-1) samNumberToSector[samNo]=s;
if (samNumberToModule[samNo]==-1) samNumberToModule[samNo]=m;
}
}
}
}
versions[1]=v1;
versions[2]=v2;
changed=kTRUE;
return kTRUE;
}
Int_t HMdcEvReadout::write(HParIo*) {
changed=kFALSE;
return 0;
}
void HMdcEvReadout::clear() {
HMdcEvReadout& readout=(*this);
for(Int_t i=0;i<readout.getSize();i++) {
HMdcEvReadoutSam& sam=(*this)[i];
for(Int_t j=0;j<sam.getSize();j++) {
HMdcEvReadoutRoc& roc=sam[j];
for(Int_t l=0;l<roc.getSize();l++) {
HMdcEvReadoutBusPos& busPos=roc[l];
for(Int_t m=0;m<busPos.getSize();m++) {
busPos[m].clear();
}
}
}
}
status=kFALSE;
resetInputVersions();
}
void HMdcEvReadout::printParam() {
INFO_msg(10,HMessageMgr::DET_MDC,"MdcEvReadout container\n");
INFO_msg(10,HMessageMgr::DET_MDC,"SAM SAM-pos ROC BUS-pos BUS Sec Mod Mbo\n\n");
HMdcEvReadout& readout=(*this);
for(Int_t i=0;i<readout.getSize();i++) {
HMdcEvReadoutSam& sam=(*this)[i];
for(Int_t j=0;j<sam.getSize();j++) {
HMdcEvReadoutRoc& roc=sam[j];
for(Int_t l=0;l<roc.getSize();l++) {
HMdcEvReadoutBusPos& busPos=roc[l];
for(Int_t m=0;m<busPos.getSize();m++) {
HMdcEvReadoutBus& bus=busPos[m];
Int_t mbo=bus.getMbo();
if (mbo>=0) {
gHades->getMsg()->info(10,HMessageMgr::DET_MDC,this->GetName()
,"%3i%3i%3i%3i%3i%6i%3i%3i\n",
i/2,i%2,j,l,m,bus.getSec(),bus.getMod(),mbo);
}
}
}
}
}
}
Last change: Sat May 22 13:01:50 2010
Last generated: 2010-05-22 13:01
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.