#include "hspecparrootfileio.h"
#include "hades.h"
#include "hruntimedb.h"
#include "hspectrometer.h"
#include "hgeomvolume.h"
#include "hgeomshapes.h"
#include "hspecgeompar.h"
#include "hscspar.h"
ClassImp(HSpecParRootFileIo)
HSpecParRootFileIo::HSpecParRootFileIo(HParRootFile* f) : HDetParRootFileIo(f) {
fName="HSpecParIo";
}
Bool_t HSpecParRootFileIo::init(HParSet* pPar,Int_t* set) {
const Text_t* name=pPar->GetName();
if (pFile) {
if (strcmp(name,"SpecGeomPar")==0) return read((HSpecGeomPar*)pPar,set);
if (strcmp(name,"MagnetPar")==0) return HDetParRootFileIo::read(pPar);
if (pPar->InheritsFrom("HScsPar"))
return HDetParRootFileIo::read((HScsPar*)pPar);
if (strcmp(name,"TrbLookup")==0) return HDetParRootFileIo::read(pPar);
}
cerr<<"initialization of "<<name<<" not possible from ROOT file!"<<endl;
return kFALSE;
}
Bool_t HSpecParRootFileIo::read(HSpecGeomPar* pPar,Int_t* set) {
Text_t* name=(Char_t*)pPar->GetName();
Int_t version=findInputVersion(name);
if (version<=0) {
pPar->setInputVersion(-1,inputNumber);
return kFALSE;
}
if (pPar->getInputVersion(inputNumber)==version
&& pPar->getInputVersion(inputNumber)!=-1) return kTRUE;
HSpecGeomPar* r=(HSpecGeomPar*)findContainer(name,version);
pPar->clear();
Bool_t allFound=kTRUE;
pPar->copyComment(*r);
if (pPar->isFirstInitialization()) {
if (set[0]) {
HGeomVolume* cave=r->getCave();
if (cave) {
pPar->addCave(cave);
set[0]=0;
}
else allFound=kFALSE;
}
if (set[1]) {
Int_t n=r->getNumSectors();
if (n>0) {
for(Int_t i=0;i<n;i++) pPar->addSector(r->getSector(i));
set[1]=0;
}
else allFound=kFALSE;
}
} else set[0]=set[1]=0;
if (set[2]) {
Int_t n=r->getNumTargets();
if (n>0) {
for(Int_t i=0;i<n;i++) pPar->addTarget(r->getTarget(i));
set[2]=0;
}
else allFound=kFALSE;
}
pPar->setInputVersion(version,inputNumber);
pPar->setChanged();
delete r;
if (allFound) pPar->setNotFirstInit();
return allFound;
}
Last change: Sat May 22 13:14:26 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.