StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StEmcRawData.cxx
1 /***************************************************************************
2  *
3  * $Id: StEmcRawData.cxx,v 2.2 2004/07/15 16:36:24 ullrich Exp $
4  *
5  * Author: Alex Suaide, Mar 2004
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StEmcRawData.cxx,v $
13  * Revision 2.2 2004/07/15 16:36:24 ullrich
14  * Removed all clone() declerations and definitions. Use StObject::clone() only.
15  *
16  * Revision 2.1 2004/03/26 21:53:45 ullrich
17  * Initial Revision.
18  *
19  **************************************************************************/
20 #include "StEmcRawData.h"
21 
22 static const char rcsid[] = "$Id: StEmcRawData.cxx,v 2.2 2004/07/15 16:36:24 ullrich Exp $";
23 
24 ClassImp(StEmcRawData)
25 
27 {
28  for(int i=0;i<MAXEMCDATABANK;i++) {
29  mHeader[i].Set(0);
30  mData[i].Set(0);
31  }
32 }
33 
34 StEmcRawData::StEmcRawData(const StEmcRawData& h) : StObject(h)
35 {
36  for(int i=0;i<MAXEMCDATABANK;i++) {
37  if(h.header(i) && h.data(i)) {
38  createBank(i,h.sizeHeader(i),h.sizeData(i));
39  setHeader(i,(unsigned short*)h.header(i));
40  setData(i,(unsigned short*)h.data(i));
41  }
42  }
43 }
44 
45 StEmcRawData::~StEmcRawData()
46 {
47  for(int i=0;i<MAXEMCDATABANK;i++) deleteBank(i);
48 }
49 
50 void
51 StEmcRawData::createBank(int bank,int sizeHeader, int sizeData)
52 {
53  deleteBank(bank);
54  mHeader[bank].Set(sizeHeader);
55  mData[bank].Set(sizeData);
56  for(int i = 0;i<sizeHeader;i++) mHeader[bank][i] = 0;
57  for(int i = 0;i<sizeData;i++) mData[bank][i] = 0;
58 }
59 
60 void
61 StEmcRawData::deleteBank(int bank)
62 {
63  mHeader[bank].Set(0);
64  mData[bank].Set(0);
65 }
66 
67 void
68 StEmcRawData::setHeader(int bank,unsigned short* data)
69 {
70  if(sizeHeader(bank)==0) return;
71  mHeader[bank].Set(sizeHeader(bank),(const Short_t*)data);
72 }
73 
74 void
75 StEmcRawData::setData(int bank,unsigned short* data)
76 {
77  if(sizeData(bank)==0) return;
78  mData[bank].Set(sizeData(bank),(const Short_t*)data);
79 }
80 
81 void
82 StEmcRawData::setHeader(int bank,int position, unsigned short data)
83 {
84  if(sizeHeader(bank)==0) return;
85  mHeader[bank][position] = data;
86 }
87 
88 void
89 StEmcRawData::setData(int bank,int position, unsigned short data)
90 {
91  if(sizeData(bank)==0) return;
92  mData[bank][position] = data;
93 }
94 
95 const unsigned short*
96 StEmcRawData::header(int bank) const
97 {
98  return (unsigned short*)mHeader[bank].GetArray();
99 }
100 
101 const unsigned short*
102 StEmcRawData::data(int bank) const
103 {
104  return (unsigned short*)mData[bank].GetArray();
105 }
106 
107 unsigned short*
108 StEmcRawData::header(int bank)
109 {
110  return (unsigned short*)mHeader[bank].GetArray();
111 }
112 
113 unsigned short*
114 StEmcRawData::data(int bank)
115 {
116  return (unsigned short*)mData[bank].GetArray();
117 }
118 
119 unsigned short
120 StEmcRawData::header(int bank,int position)
121 {
122  if(sizeHeader(bank)==0) return 0;
123  return mHeader[bank][position];
124 }
125 
126 unsigned short
127 StEmcRawData::data(int bank,int position)
128 {
129  if(sizeData(bank)==0) return 0;
130  return mData[bank][position];
131 }
132 
133 const unsigned short
134 StEmcRawData::header(int bank,int position) const
135 {
136  if(sizeHeader(bank)==0) return 0;
137  return mHeader[bank][position];
138 }
139 
140 const unsigned short
141 StEmcRawData::data(int bank,int position) const
142 {
143  if(sizeData(bank)==0) return 0;
144  return mData[bank][position];
145 }
146 
147 int
148 StEmcRawData::sizeHeader(int bank)
149 {
150  return mHeader[bank].GetSize();
151 }
152 
153 int
154 StEmcRawData::sizeData(int bank)
155 {
156  return mData[bank].GetSize();
157 }
158 
159 const int
160 StEmcRawData::sizeHeader(int bank) const
161 {
162  return mHeader[bank].GetSize();
163 }
164 
165 const int
166 StEmcRawData::sizeData(int bank) const
167 {
168  return mData[bank].GetSize();
169 }