HYDRA_development_version
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
hstart2raw.cc
Go to the documentation of this file.
1 //*-- Modified : 03.12.2009 Ilse Koenig
2 
3 //_HADES_CLASS_DESCRIPTION
4 /////////////////////////////////////////////////////////////////////////////
5 //
6 // HStart2Raw
7 //
8 // Unpacked TRB raw data of the START detector using the TRB for readout
9 //
10 // The class accepts up to 10 (START2_MAX_MULT) hits per channel, each with
11 // time and width. If the number of hits exceeds max, the hit counter
12 // will be incremeted, but no data are stored for these hits.
13 //
14 /////////////////////////////////////////////////////////////////////////////
15 
16 #include "hstart2raw.h"
17 #include "TBuffer.h"
18 
20 
21 Float_t HStart2Raw::getTime(const Int_t n) const
22 {
23  // Returns the time of the nth hit
24  switch (n) {
25  case 1:
26  return fTime1;
27  case 2:
28  return fTime2;
29  case 3:
30  return fTime3;
31  case 4:
32  return fTime4;
33  case 5:
34  return fTime5;
35  case 6:
36  return fTime6;
37  case 7:
38  return fTime7;
39  case 8:
40  return fTime8;
41  case 9:
42  return fTime9;
43  case 10:
44  return fTime10;
45  default:
46  Error("getTime()", "hit number: %i out of range [1,%i]", n,STARTRAWMAX);
47  return -1.;
48  }
49 }
50 
51 Float_t HStart2Raw::getWidth(const Int_t n) const
52 {
53  // Returns the width of the nth hit
54  switch (n) {
55  case 1:
56  return fWidth1;
57  case 2:
58  return fWidth2;
59  case 3:
60  return fWidth3;
61  case 4:
62  return fWidth4;
63  case 5:
64  return fWidth5;
65  case 6:
66  return fWidth6;
67  case 7:
68  return fWidth7;
69  case 8:
70  return fWidth8;
71  case 9:
72  return fWidth9;
73  case 10:
74  return fWidth10;
75  default:
76  Error("getWidht()", "hit number: %i out of range [1,%i]", n,STARTRAWMAX);
77  return -1.;
78  }
79 }
80 
81 void HStart2Raw::getTimeAndWidth(const Int_t n, Float_t& time, Float_t& width)
82 {
83  // Returns the time and width of the nth hit
84  switch (n) {
85  case 1:
86  time = fTime1;
87  width = fWidth1;
88  return;
89  case 2:
90  time = fTime2;
91  width = fWidth2;
92  return;
93  case 3:
94  time = fTime3;
95  width = fWidth3;
96  return;
97  case 4:
98  time = fTime4;
99  width = fWidth4;
100  return;
101  case 5:
102  time = fTime5;
103  width = fWidth5;
104  return;
105  case 6:
106  time = fTime6;
107  width = fWidth6;
108  return;
109  case 7:
110  time = fTime7;
111  width = fWidth7;
112  return;
113  case 8:
114  time = fTime8;
115  width = fWidth8;
116  return;
117  case 9:
118  time = fTime9;
119  width = fWidth9;
120  return;
121  case 10:
122  time = fTime10;
123  width = fWidth10;
124  return;
125  default:
126  Error("getTimeAndWidth", "hit number: %i out of range [1,%i]", n,STARTRAWMAX);
127  time = -1.;
128  width = -1.;
129  return;
130  }
131 }
132 
133 Bool_t HStart2Raw::setTimeAndWidth(const Float_t time, const Float_t width)
134 {
135  // Stores the given time and width in the next data element time* and width*
136  // and sets the multiplicity.
137  // Return kFALSE if max hits are already stored.
138 
139  switch (fMultiplicity) {
140  case 0:
141  fTime1 = time;
142  fWidth1 = width;
143  ++fMultiplicity;
144  return kTRUE;
145  case 1:
146  fTime2 = time;
147  fWidth2 = width;
148  ++fMultiplicity;
149  return kTRUE;
150  case 2:
151  fTime3 = time;
152  fWidth3 = width;
153  ++fMultiplicity;
154  return kTRUE;
155  case 3:
156  fTime4 = time;
157  fWidth4 = width;
158  ++fMultiplicity;
159  return kTRUE;
160  case 4:
161  fTime5 = time;
162  fWidth5 = width;
163  ++fMultiplicity;
164  return kTRUE;
165  case 5:
166  fTime6 = time;
167  fWidth6 = width;
168  ++fMultiplicity;
169  return kTRUE;
170  case 6:
171  fTime7 = time;
172  fWidth7 = width;
173  ++fMultiplicity;
174  return kTRUE;
175  case 7:
176  fTime8 = time;
177  fWidth8 = width;
178  ++fMultiplicity;
179  return kTRUE;
180  case 8:
181  fTime9 = time;
182  fWidth9 = width;
183  ++fMultiplicity;
184  return kTRUE;
185  case 9:
186  fTime10 = time;
187  fWidth10 = width;
188  ++fMultiplicity;
189  return kTRUE;
190  default:
191  if (fMultiplicity >= STARTRAWMAX) {
192  ++fMultiplicity;
193  }
194  return kFALSE;
195  }
196 }
197 
198 void HStart2Raw::Streamer(TBuffer &R__b)
199 {
200  // Stream an object of class HStart2Raw.
201 
202  UInt_t R__s, R__c;
203  if (R__b.IsReading()) {
204  Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
205  TObject::Streamer(R__b);
206  R__b >> fMultiplicity;
207  R__b >> fModule;
208  R__b >> fStrip;
209  R__b >> fTime1;
210  R__b >> fWidth1;
211  R__b >> fTime2;
212  R__b >> fWidth2;
213  R__b >> fTime3;
214  R__b >> fWidth3;
215  R__b >> fTime4;
216  R__b >> fWidth4;
217 
218  if(R__v > 4){
219  R__b >> fTime5;
220  R__b >> fWidth5;
221  R__b >> fTime6;
222  R__b >> fWidth6;
223  R__b >> fTime7;
224  R__b >> fWidth7;
225  R__b >> fTime8;
226  R__b >> fWidth8;
227  R__b >> fTime9;
228  R__b >> fWidth9;
229  R__b >> fTime10;
230  R__b >> fWidth10;
231 
232  } else {
235  }
236  R__b.CheckByteCount(R__s, R__c, HStart2Raw::IsA());
237  } else {
238  R__c = R__b.WriteVersion(HStart2Raw::IsA(), kTRUE);
239  TObject::Streamer(R__b);
240  R__b << fMultiplicity;
241  R__b << fModule;
242  R__b << fStrip;
243  R__b << fTime1;
244  R__b << fWidth1;
245  R__b << fTime2;
246  R__b << fWidth2;
247  R__b << fTime3;
248  R__b << fWidth3;
249  R__b << fTime4;
250  R__b << fWidth4;
251  R__b << fTime5;
252  R__b << fWidth5;
253  R__b << fTime6;
254  R__b << fWidth6;
255  R__b << fTime7;
256  R__b << fWidth7;
257  R__b << fTime8;
258  R__b << fWidth8;
259  R__b << fTime9;
260  R__b << fWidth9;
261  R__b << fTime10;
262  R__b << fWidth10;
263  R__b.SetByteCount(R__c, kTRUE);
264  }
265 }
Float_t getWidth(const Int_t n) const
Definition: hstart2raw.cc:51
Float_t fWidth2
Definition: hstart2raw.h:16
Float_t fTime4
Definition: hstart2raw.h:19
Float_t fTime1
Definition: hstart2raw.h:13
Int_t fMultiplicity
Definition: hstart2raw.h:10
ClassImp(HStart2Raw) Float_t HStart2Raw
Definition: hstart2raw.cc:19
Bool_t setTimeAndWidth(const Float_t time, const Float_t width)
Definition: hstart2raw.cc:133
Float_t fTime2
Definition: hstart2raw.h:15
Float_t fTime5
Definition: hstart2raw.h:21
Int_t n
Float_t fTime6
Definition: hstart2raw.h:23
Float_t fWidth1
Definition: hstart2raw.h:14
Int_t fModule
Definition: hstart2raw.h:11
Float_t fTime8
Definition: hstart2raw.h:27
void getTimeAndWidth(const Int_t n, Float_t &time, Float_t &width)
Definition: hstart2raw.cc:81
Int_t fStrip
Definition: hstart2raw.h:12
Float_t fWidth9
Definition: hstart2raw.h:30
#define STARTRAWMAX
Definition: hstart2raw.h:6
Float_t fTime3
Definition: hstart2raw.h:17
Float_t fWidth4
Definition: hstart2raw.h:20
Float_t fWidth3
Definition: hstart2raw.h:18
Float_t fWidth7
Definition: hstart2raw.h:26
Float_t fTime10
Definition: hstart2raw.h:31
Float_t fWidth5
Definition: hstart2raw.h:22
Float_t fWidth6
Definition: hstart2raw.h:24
Float_t fWidth10
Definition: hstart2raw.h:32
Float_t fWidth8
Definition: hstart2raw.h:28
Float_t fTime7
Definition: hstart2raw.h:25
Float_t fTime9
Definition: hstart2raw.h:29