#include <stdio.h>
#include "hstartdetector.h"
#include "hades.h"
#include "hpario.h"
#include "hdetpario.h"
#include "hparasciifileio.h"
#include "hparrootfileio.h"
#include "hstartparasciifileio.h"
#include "hstartparrootfileio.h"
#include "hcategory.h"
#include "hmatrixcategory.h"
#include "hlinearcategory.h"
#include "TClass.h"
#define START_MAX_MODULES 6
#define START_MAX_COMPONENTS 32
#define START_MAX_SECTORS -1
ClassImp(HStartDetector)
HStartDetector::HStartDetector() {
fName="Start";
maxSectors = START_MAX_SECTORS;
maxModules = START_MAX_MODULES;
maxComponents= START_MAX_COMPONENTS;
modules= new TArrayI(maxModules);
for(Int_t i=0;i<maxModules;i++) {
modules->AddAt(0,i);
}
}
HStartDetector::~HStartDetector() {
if (modules) delete modules;
modules=0;
}
Bool_t HStartDetector::init(void) {
return kTRUE;
}
void HStartDetector::activateParIo(HParIo* io) {
if (strcmp(io->IsA()->GetName(),"HParOraIo")==0) {
io->setDetParIo("HStartParIo");
return;
}
if (strcmp(io->IsA()->GetName(),"HParRootFileIo")==0) {
HStartParRootFileIo* p=new HStartParRootFileIo(((HParRootFileIo*)io)->getParRootFile());
io->setDetParIo(p);
}
if (strcmp(io->IsA()->GetName(),"HParAsciiFileIo")==0) {
HStartParAsciiFileIo* p=new HStartParAsciiFileIo(((HParAsciiFileIo*)io)->getFile());
io->setDetParIo(p);
}
}
Bool_t HStartDetector::write(HParIo* output) {
HDetParIo* out=output->getDetParIo("HStartParIo");
if (out) return out->write(this);
return kFALSE;
}
HCategory* HStartDetector::buildMatrixCategory(const Text_t* className,Float_t fillRate) {
Int_t maxMod=getMaxModInSetup();
if (maxMod==0) return 0;
Int_t* sizes=new Int_t[2];
sizes[0]=maxMod;
sizes[1]=maxComponents;
HMatrixCategory* category = new HMatrixCategory(className,2,sizes,fillRate);
delete [] sizes;
return category;
}
HCategory* HStartDetector::buildLinearCategory(const Text_t* className) {
Int_t size=getMaxModInSetup()*maxComponents;
if (size) {
HLinearCategory* category = new HLinearCategory(className,size);
return category;
}
return 0;
}
HCategory* HStartDetector::buildCategory(Cat_t cat) {
switch (cat) {
case catStartRaw : return buildMatrixCategory("HStartRaw");
case catStartCal : return buildMatrixCategory("HStartCal");
default : return NULL;
}
}
Int_t HStartDetector::getMaxModInSetup(void) {
Int_t maxMod=-1;
for(Int_t i=0;i<maxModules;i++) {
if (modules->At(i)) maxMod=(i>maxMod)?i:maxMod;
}
maxMod++;
return maxMod;
}
Last change: Sat May 22 13:14:40 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.