BmnRoot
Loading...
Searching...
No Matches
CbmStsParRootFileIo.cxx
Go to the documentation of this file.
1//*-- AUTHOR : Denis Bertini
2//*-- Modified : 06/10/2005 by Denis Bertini
3
5// CbmStsParRootFileIo
6//
7// Class for Start parameter input/output from/into ROOT file
8//
9// It is derived from the base class HDetParRootFileIo and
10// inherits from it basic functions e.g. write(...)
11//
13
14#include "CbmStsParRootFileIo.h"
15
16#include "CbmStsDigiPar.h"
17#include "FairParRootFileIo.h"
18#include "FairRuntimeDb.h"
19
20#include <iostream>
21
22using std::cerr;
23using std::cout;
24using std::endl;
25
27 : FairDetParRootFileIo(f)
28{
29 // constructor sets the name of the detector I/O "CbmStsParIo"
30 fName = "CbmStsParIo";
31}
32
34{
35 // destructor
36 /*
37 if (modulesFound) {
38 delete modulesFound;
39 modulesFound=0;
40 }
41 if (initModules) {
42 delete initModules;
43 initModules=0;
44 }
45 */
46}
47
48Bool_t CbmStsParRootFileIo::init(FairParSet* pPar /*, Int_t* set*/)
49{
50 // Initializes a container called by name, but only the modules defined
51 // in the array 'set.
52 // Calls the special read function for this container.
53 // If it is called the first time, it reads the setup found in the file.
54 const Text_t* name = pPar->GetName();
55 if (pFile) {
56 if (!strcmp(name, "StsDigiPar"))
57 return read(pPar); // read((CbmStsDigiPar*)pPar,set);
58 }
59 cerr << "initialization of " << name << " not possible from ROOT file!" << endl;
60 return kFALSE;
61}
62
63Bool_t CbmStsParRootFileIo::read(FairParSet* pPar)
64{
65 // Bool_t CbmStsParRootFileIo::read(CbmStsDigiPar* pPar,Int_t* set) {
66 cout << "-I- CbmStsParRootFileIo : reading " << endl;
67 /*
68 // Reads and fills the container "StsDigiPar"
69 Text_t* name=(char*)pPar->GetName();
70 Int_t version=findInputVersion(name);
71 if (version<=0)
72 {
73 pPar->setInputVersion(-1,inputNumber);
74 return kFALSE; // not in ROOT file
75 }
76 if (pPar->getInputVersion(inputNumber)==version
77 && pPar->getInputVersion(inputNumber)!=-1) return kTRUE;
78 // needs reinitialization
79 CbmStsCalPar* rStart=(CbmStsCalPar*)findContainer(name,version);
80 Bool_t allFound=kTRUE;
81 initModules->Reset();
82 for(Int_t m=0;m<pPar->getSize();m++) {
83 if (set[m]) {
84 CbmStsCalParMod& r=(*rStart)[m];
85 CbmStsCalParMod& p=(*pPar)[m];
86 Int_t pModSize=p.getSize();
87 if (pModSize && r.getSize()==pModSize) {
88 for(Int_t c=0;c<pModSize;c++) p[c].fill(r[c]);
89 initModules->AddAt(m+1,m);
90 } else allFound=kFALSE;
91 }
92 }
93 pPar->setInputVersion(version,inputNumber);
94 pPar->setChanged();
95 printInfo("StartCalPar: module(s) initialized from Root file ");
96 delete rStart;
97 return allFound;
98 */
99 return kTRUE;
100}
float f
Definition P4_F32vec4.h:21
Bool_t read(FairParSet *)
virtual Bool_t init(FairParSet *)
CbmStsParRootFileIo(FairParRootFile *f)