using namespace std;
#include <iostream>
#include <iomanip>
#include "hrichparrootfileio.h"
#include "hparrootfileio.h"
#include "hades.h"
#include "hspectrometer.h"
#include "hruntimedb.h"
#include "hrichgeometrypar.h"
#include "hrichdigitisationpar.h"
#include "hrichanalysispar.h"
#include "hrichthresholdpar.h"
#include "hrichcalpar.h"
#include "hrichmappingpar.h"
#include "hrichcorrelatorpar.h"
ClassImp(HRichParRootFileIo)
HRichParRootFileIo::HRichParRootFileIo(HParRootFile* f) : HDetParRootFileIo(f) {
fName="HRichParIo";
initModules=new TArrayI(6);
}
HRichParRootFileIo::~HRichParRootFileIo() {
if (modulesFound) {
delete modulesFound;
modulesFound=0;
}
if (initModules) {
delete initModules;
initModules=0;
}
}
Bool_t HRichParRootFileIo::init(HParSet* pPar,Int_t* set) {
using namespace HadAsciiAuxiliaryFunctions;
if (!isActiv) readModules("Rich");
const Text_t* name = ((TNamed*)pPar)->GetName();
if (pFile) {
if (strcmp(name,"RichGeometryParameters")==0) return read((HRichGeometryPar*)pPar,set);
if (strncmp(name,"RichDigitisationParameters",strlen("RichDigitisationParameters"))==0) return HDetParRootFileIo::read(pPar);
if (strncmp(name,"RichAnalysisParameters",strlen("RichAnalysisParameters"))==0) return HDetParRootFileIo::read(pPar);
if (strcmp(name,"RichThresholdPar")==0) return read((HRichThresholdPar*)pPar,set);
if (strcmp(name,"RichCalPar")==0) return read((HRichCalPar*)pPar,set);
if (strcmp(name,"RichMappingParameters")==0) return read((HRichMappingPar*)pPar,set);
if (strncmp(name,"RichCorrelatorParameters",strlen("RichCorrelatorParameters"))==0) return HDetParRootFileIo::read(pPar);
}
ErrorMsg(2,"HRichParRootFileIo::init",
3,"Initialisation of \'",name,"\' container from ROOT file not possible. \
Container of this name is not known.");
return kFALSE;
}
Bool_t HRichParRootFileIo::readObject(HRichParSet *pPar) {
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;
TKey *key = (TKey*)gDirectory->GetKey(name,version);
if(key)
{
key->Read(pPar);
pPar->setInputVersion(version,inputNumber);
pPar->setChanged();
} else {
pPar->setInputVersion(-1,inputNumber);
}
return (key != NULL);
}
Bool_t HRichParRootFileIo::read(HRichGeometryPar* pPar,Int_t* set) {
using namespace HadAsciiAuxiliaryFunctions;
if (!readObject(pPar)) return kFALSE;
ErrorMsg(0,"HRichParRootFileIo::read",
1,"Container \'RichGeometryParameters\' has been read from ROOT file.");
return kTRUE;
}
Bool_t HRichParRootFileIo::read(HRichCalPar* pPar,Int_t* set) {
using namespace HadAsciiAuxiliaryFunctions;
if (!readObject(pPar)) return kFALSE;
ErrorMsg(0,"HRichParRootFileIo::read",
1,"Container \'RichCalPar\' has been read from ROOT file.");
return kTRUE;
}
Bool_t HRichParRootFileIo::read(HRichThresholdPar* pPar,Int_t* set) {
using namespace HadAsciiAuxiliaryFunctions;
if (!readObject(pPar)) return kFALSE;
ErrorMsg(0,"HRichParRootFileIo::read",
1,"Container \'RichThresholdPar\' has been read from ROOT file.");
return kTRUE;
}
Bool_t HRichParRootFileIo::read(HRichMappingPar* pPar,Int_t* set) {
using namespace HadAsciiAuxiliaryFunctions;
if (!readObject(pPar)) return kFALSE;
ErrorMsg(0,"HRichParRootFileIo::read",
1,"Container \'RichMappingPar\' has been read from ROOT file.");
return kTRUE;
}
Last change: Sat May 22 13:09:45 2010
Last generated: 2010-05-22 13:09
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.