//_HADES_CLASS_DESCRIPTION ///////////////////////////////////////////////////////////// // HiTofParRootFileIo // // Class for iTof parameter input/output from/into ROOT file // // It is derived from the base class HDetParFileIo and // inherits from it basic functions e.g. write(...) // ///////////////////////////////////////////////////////////// using namespace std; #include "hitofparrootfileio.h" #include "hparrootfileio.h" #include "hdetparrootfileio.h" #include "hades.h" #include "hspectrometer.h" #include "hruntimedb.h" #include "hitofcalpar.h" #include "hitoftrb3lookup.h" #include "hitofgeompar.h" ClassImp(HiTofParRootFileIo) HiTofParRootFileIo::HiTofParRootFileIo(HParRootFile* f) : HDetParRootFileIo(f) { // constructor sets the name of the detector I/O "HiTofParIo" fName = "HiTofParIo"; initModules = new TArrayI(6); } HiTofParRootFileIo::~HiTofParRootFileIo() { // destructor if (modulesFound) { delete modulesFound; modulesFound = 0; } if (initModules) { delete initModules; initModules = 0; } } Bool_t HiTofParRootFileIo::init(HParSet* pPar,Int_t* set) { // initializes a container called by name, but only the modules // defined in the array 'set' // calls the special read function for this container // If it is called the first time it reads the setup found in the file if (!isActiv) readModules("iTof"); const Text_t* name = ((TNamed*)pPar)->GetName(); printf("iTof par file io init - %s\n", name); if (pFile) { if (0 == strncmp(name, "iTofGeomPar", strlen("iTofGeomPar"))) return HDetParRootFileIo::read((HiTofGeomPar *)pPar, set); if (strcmp(name,"iTofCalPar")==0) return read((HiTofCalPar*)pPar,set); if (strcmp(name,"iTofTrb3Lookup")==0) return HDetParRootFileIo::read((HiTofTrb3Lookup*)pPar); } cerr<<"initialization of "<GetName(); Int_t version=findInputVersion(name); if (version<=0) { pCalPar->setInputVersion(-1,inputNumber); return kFALSE; } // not in ROOT file if (pCalPar->getInputVersion(inputNumber)==version && pCalPar->getInputVersion(inputNumber)!=-1) return kTRUE; // needs reinitialization HiTofCalPar* ri=(HiTofCalPar*)findContainer(name,version); Bool_t allFound=kTRUE; Int_t pos; initModules->Reset(); HiTofCalPar& r=*ri; HiTofCalPar& p=*pCalPar; for(Int_t s=0;sAddAt(pos+1,pos); } } } } pCalPar->setInputVersion(version,inputNumber); pCalPar->setChanged(); Char_t message[200]; sprintf(message,"%s%s",name,": module(s) initialized from Root file "); printInfo(message); delete ri; return allFound; }