StRoot
1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
StEEmcUtil
database
macros
upload
src
EEmcDbIO.h
1
// -*-C++-*-
2
// $Id: EEmcDbIO.h,v 1.1 2013/01/25 16:46:48 stevens4 Exp $:
3
#ifndef __EEMC_DBIO_H_
4
#define __EEMC_DBIO_H_
5
6
// should move it to EEmcGeom_EEmcDefs_h
7
const
int
kEEmcMaxSect = 12;
8
const
int
kEEmcMaxBox = 9;
9
const
int
kEEmcMaxInput = 12;
10
const
int
kEEmcMaxIndex = kEEmcMaxSect*kEEmcMaxBox*kEEmcMaxInput;
11
const
char
*
const
kEEmcBoxInp[] = {
"TA"
,
"TB"
,
"TC"
,
"TD"
,
"TE"
,
"S1"
,
"S2"
,
"S3"
,
"P1"
,
""
};
12
13
14
extern
char
*packString (
char
*buf,
int
pos,
int
maxlen,
char
*str);
15
extern
char
*unpackString(
char
*buf,
int
pos,
int
maxlen,
char
*str);
16
extern
int
indexFromString(
const
char
*name,
const
int
MaxInp=kEEmcMaxIndex);
17
18
// ------------------------------------------------------------------
19
class
EEmcDbIOBase
{
20
public
:
21
EEmcDbIOBase
(
int
nmemb=0 ,
int
sz=1);
22
virtual
~
EEmcDbIOBase
();
23
virtual
int
read (FILE *f) = 0;
24
virtual
int
write(FILE *f) = 0;
25
virtual
char
* setComment(
char
*c) { comment = c;
return
comment; };
26
virtual
char
* getComment() {
return
comment; };
27
void
setData(
char
*ptr) { bytePtr = ptr; };
28
void
resetData(
int
sz=0) { memset(bytePtr,0x00,(sz>0) ? sz : bytes); };
29
char
*getData() {
return
(bytePtr); };
30
int
*getIndices(){
return
(indexArr); };
31
int
getBytes() {
return
(bytes) ; };
32
int
getSize() {
return
(nElem); };
33
bool
checkLine(
const
char
* line);
34
35
protected
:
36
char
*bytePtr;
// pointer to data
37
int
bytes;
// array size
38
int
nElem;
// size of one element
39
int
*indexArr;
// array of indices
40
char
*comment;
41
};
42
43
// ------------------------------------------------------------------
44
// CC - calibration constants type database
45
// ------------------------------------------------------------------
46
template
<
class
T>
47
class
EEmcDbCCIO
:
public
EEmcDbIOBase
{
48
public
:
49
EEmcDbCCIO
(
int
n) :
EEmcDbIOBase
(1,
sizeof
(T)) { nElem=n; };
50
virtual
int
read (FILE *f);
51
virtual
int
write(FILE *f);
52
protected
:
53
T *
data
() {
return
(T *)bytePtr ; };
54
int
scan (
const
char
*str,
char
*name,
int
i);
55
int
print (
char
*str,
char
*name,
int
i);
56
};
57
58
// ------------------------------------------------------------------
59
// QA - quality assurance type database
60
// ------------------------------------------------------------------
61
template
<
class
T>
62
class
EEmcDbQAIO
:
public
EEmcDbIOBase
{
63
public
:
64
EEmcDbQAIO
(
int
n) :
EEmcDbIOBase
(n,
sizeof
(T)) {};
65
virtual
int
read (FILE *f);
66
virtual
int
write(FILE *f);
67
protected
:
68
T *
data
(
int
i=0) {
return
( (T *)bytePtr + i ); };
69
int
scan (
const
char
*str ,
int
i);
70
int
print (
char
*str ,
int
i);
71
};
72
73
// ------------------------------------------------------------------
74
// HV - HVsys type database
75
// ------------------------------------------------------------------
76
template
<
class
T>
77
class
EEmcDbHVIO
:
public
EEmcDbIOBase
{
78
public
:
79
EEmcDbHVIO
(
int
n) :
EEmcDbIOBase
(n,
sizeof
(T)) {};
80
virtual
int
read (FILE *f);
81
virtual
int
write(FILE *f);
82
protected
:
83
T *
data
(
int
i=0) {
return
( (T *)bytePtr + i ); };
84
int
scan (
const
char
*str ,
int
i);
85
int
print (
char
*str ,
int
i);
86
int
str2index (
const
char
*str);
87
};
88
89
// ------------------------------------------------------------------
90
// XML data
91
// ------------------------------------------------------------------
92
template
<
class
T>
93
class
EEmcDbXML
:
public
EEmcDbIOBase
{
94
public
:
95
EEmcDbXML
(
int
n) :
EEmcDbIOBase
(n,
sizeof
(T)) {};
96
virtual
int
read (FILE *f);
97
virtual
int
write(FILE *f);
98
protected
:
99
T *
data
() {
return
( (T *)bytePtr); };
100
};
101
102
103
// ------------------------------------------------------------------
104
struct
kretDbBlobS
;
105
class
KretDbBlobSIO
:
public
EEmcDbIOBase
{
106
public
:
107
KretDbBlobSIO
(
int
n);
108
int
read (FILE *f);
109
int
write(FILE *f);
110
protected
:
111
kretDbBlobS
*
data
(
int
i=0);
// { return ( (kretDbWCM *)bytePtr + i ); };
112
};
113
114
#endif
115
116
117
// $Log: EEmcDbIO.h,v $
118
// Revision 1.1 2013/01/25 16:46:48 stevens4
119
// Scripts used to upload EEMC tables to the DB
120
//
121
// Revision 1.5 2004/01/13 16:43:22 zolnie
122
// allowed for inline comments
123
// lines starting with # will be ignored (except the first one
124
// which contains the signature)
125
// for EEmcDbCCIO, EEmcDbQAIO, EEmcDbHVIO
126
// but no for EEmcDbXML, KretDbBlobSIO
127
//
128
// Revision 1.4 2003/10/28 21:18:49 zolnie
129
// updates for Run2004
130
//
131
// Revision 1.3 2003/04/10 21:44:25 zolnie
132
// *** empty log message ***
133
//
134
// Revision 1.2 2003/02/04 18:10:08 zolnie
135
// added eemcHVtemp online database
136
//
137
// Revision 1.1 2003/01/28 23:22:18 balewski
138
// start
139
//
140
// Revision 1.8 2003/01/25 20:09:18 balewski
141
// add BlobS, remove old kret*
142
//
143
// Revision 1.7 2003/01/24 20:54:32 zolnie
144
// merger with Jan + updates for "HVindex" stuff
145
//
146
// Revision 1.6 2003/01/24 17:11:34 balewski
147
// cleanup
148
//
149
// Revision 1.5 2003/01/24 16:44:48 balewski
150
// added WCM+someRing online info
151
//
152
// Revision 1.4 2003/01/10 18:48:34 zolnie
153
// submision version
154
//
155
// Revision 1.3 2003/01/10 04:52:03 zolnie
156
// updates to Tcl/Tk interface (czyli Zadana Pana Jana)
157
//
158
// Revision 1.2 2003/01/03 21:14:49 zolnie
159
// fixed string packing in EEmcDbCCIO<T>::read(FILE *f)
160
// added resetString
161
// first version of tkEEmcDb
162
//
EEmcDbCCIO
Definition:
EEmcDbIO.h:47
KretDbBlobSIO
Definition:
EEmcDbIO.h:105
EEmcDbHVIO
Definition:
EEmcDbIO.h:77
kretDbBlobS
Definition:
kretDbBlobS.hh:7
EEmcDbQAIO
Definition:
EEmcDbIO.h:62
EEmcDbIOBase
Definition:
EEmcDbIO.h:19
EEmcDbXML
Definition:
EEmcDbIO.h:93
data
Definition:
PMD_Reader.hh:62
Generated by
1.8.5