using namespace std;
#include "hhododetector.h"
#include "hododef.h"
#include "hcategory.h"
#include "hlinearcategory.h"
#include "hmatrixcategory.h"
#include "hades.h"
#include "hevent.h"
#include "hpario.h"
#include "hparrootfileio.h"
#include "hparasciifileio.h"
#include "hdetpario.h"
#include "hhodoparrootfileio.h"
#include "hhodoparasciifileio.h"
#include "TClass.h"
#include "TArrayI.h"
#include <iostream>
#include <iomanip>
ClassImp(HHodoDetector)
HHodoDetector::HHodoDetector(void) : HDetector("Hodo","The Pion Hodoscopes") {
fName="Hodo";
maxSectors=-1;
maxModules=10;
maxComponents=128;
modules=new TArrayI(maxModules);
}
HHodoDetector::~HHodoDetector(void) {
delete modules;
modules=0;
}
HCategory* HHodoDetector::buildLinearCategory(const Text_t *classname,Float_t fillRate) {
HLinearCategory* category=new HLinearCategory(classname,(Int_t)(maxModules*maxComponents*fillRate));
return category;
}
HCategory* HHodoDetector::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* HHodoDetector::buildCategory(Cat_t cat)
{
HCategory *pcat;
pcat=gHades->getCurrentEvent()->getCategory(cat);
if( pcat) return(pcat);
switch (cat) {
case catHodoRaw:
pcat=buildMatrixCategory("HHodoRaw",0.5);
break;
case catHodoCal:
pcat=buildMatrixCategory("HHodoCal",0.5);
break;
case catHodoHit:
pcat=buildLinearCategory("HHodoHit",0.1);
break;
default:
return NULL;
}
if(pcat) gHades->getCurrentEvent()->addCategory(cat,pcat,"Hodo");
return(pcat);
}
void HHodoDetector::activateParIo(HParIo* io) {
if (strcmp(io->IsA()->GetName(),"HParOraIo")==0) {
io->setDetParIo("HHodoParIo");
return;
}
if (strcmp(io->IsA()->GetName(),"HParRootFileIo")==0) {
HHodoParRootFileIo* p=new HHodoParRootFileIo(((HParRootFileIo*)io)->getParRootFile());
io->setDetParIo(p);
}
if (strcmp(io->IsA()->GetName(),"HParAsciiFileIo")==0) {
HHodoParAsciiFileIo* p=new HHodoParAsciiFileIo(((HParAsciiFileIo*)io)->getFile());
io->setDetParIo(p);
}
}
Bool_t HHodoDetector::write(HParIo* output) {
HDetParIo* out=output->getDetParIo("HHodoParIo");
if (out) return out->write(this);
return kFALSE;
}
Int_t HHodoDetector::getMaxModInSetup(void) {
return(maxModules);
}
Last change: Sat May 22 12:57:20 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.