Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
packet.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file packet.h
1 #ifndef __PACKET_H__
2 #define __PACKET_H__
3 
4 
5 #include "generalDefinitions.h"
6 
7 #include "event_io.h"
8 
9 #define WINDOWSEXPORT
10 
11 // --------------------------------------------------
12 // the virtual base base class for all Packets.
13 // --------------------------------------------------
14 
15 
19 #ifndef __CINT__
21 #else
22 class Packet
23 #endif
24  {
25 
26  /* @name Description of the interface routines
27  these are the interface routines to get at decoded values.
28  iValue and rValue return int's and float's, respectively.
29  the optional "what" parameter is needed for some devices
30  which have more than one type of information, such as the
31  MIZAR board, which gets ADC and TDC values.
32  iValue(0), iValue(0,""), and iValue("ADC") all
33  return what we call "natural data", which means ADC information
34  (I decided that), while iValue(0,"TDC") gives you the TDC
35  value of channel 0. All Packet classes accept "RAW" as a type,
36  directing them to return unprocessed/undecoded packet raw data.
37 
38  The array-type interface iValue(const int channel,const int iy)
39  is just a convenient call for devices which inherently have
40  two-dimensional arrays of data, such as the Hammond flash ADC
41  board, where you get 8 channels with 512 time samples each.
42  Another example is a group of several, say, LC2249W ADC's read out
43  in one packet, so that iValue(0,2) refers to channel 0 of the
44  second ADC in the group.
45  */
46 
47 
48 
49 
50  public:
52  inline virtual ~Packet() {};
53 
54  // **** getting decoded values ****
55 
56 
57 
59  virtual int iValue(const int /*channel*/) =0;
60 
64  virtual int iValue(const int /*channel*/, const char * /*what*/) =0;
65 
69  virtual int iValue(const int /*channel*/, const int /*y*/, const char * /*what*/) =0;
70 
74  virtual int iValue(const int /*channel*/,const int /*iy*/) =0;
75 
79  virtual int iValue(const int /*channel*/,const int /*iy*/, const int /*iz*/) =0;
80 
84  virtual int iValue(const int /*channel*/,const int /*iy*/, const int /*iz*/, const char */*what*/) =0;
85 
87  virtual float rValue(const int /*channel*/) =0;
88 
90  virtual double dValue(const int channel)
91  {return rValue(channel);};
92 
93  virtual double dValue(const int channel, const char *what)
94  {return iValue(channel, what);};
95 
96  virtual double dValue(const int channel, const int iy)
97  {return iValue(channel, iy);};
98 
100  virtual long long lValue(const int channel)
101  {return iValue(channel);};
102 
103  virtual long long lValue(const int channel, const char *what)
104  {return iValue(channel,what);};
105 
106  virtual long long lValue(const int channel, const int iy)
107  {return iValue(channel, iy);};
108 
109  virtual long long lValue(const int channel, const int iy, const char *what)
110  {return iValue(channel, iy, what);};
111 
115  virtual float rValue(const int /*channel*/, const char * /*what*/) =0;
116 
117 
121  virtual float rValue(const int /*channel*/, const int /*iy*/) =0;
122 
123  virtual void * pValue(const int /*channel*/)
124  {
125  return 0;
126  }
127 
128  virtual void * pValue(const int /*channel*/, const char * /*what*/)
129  {
130  return 0;
131  }
132 
133  virtual void * pValue(const int /*chan*/, const int /*iy*/)
134  {
135  return 0;
136  }
137 
138 
139 
140 
141  // *** now getting all the decoded values in one go ***
142  // these routines get you all the decoded values into an array
143  // of float's or int's. The what parameter has the usual meaning.
144 
148  virtual int getArraylength(const char * what ="") =0;
149 
153  virtual int fillIntArray (int destination[], // the data go here
154  const int /*length*/, // space we have in destination
155  int * /*nw*/, // words actually used
156  const char * what="") = 0; // type of data (see above)
157 
159  virtual int fillFloatArray (float destination[], // the data go here
160  const int /*length*/, // space we have in destination
161  int * /*nw*/, // words actually used
162  const char * what="") = 0; // type of data (see above)
163 
168  virtual int* getIntArray (int * /*nw*/,const char * ="") =0;
169 
171  virtual float* getFloatArray (int * /*nw*/,const char * ="") =0;
172 
173 
175  virtual int is_pointer_type() const = 0;
176 
178  virtual int convert() =0;
179 
180 
181  // access to envelope information:
182 
186  virtual int getLength() const = 0;
187 
188  // virtual int getType() const = 0;
189  // virtual int getDecoding() const = 0;
190 
191  // some more header fields which are not yet implemented, marked "//*"
192  //* virtual int gethdrVersion() const = 0; // Version of header definition
193  //* virtual int getHdrLength() const = 0; // inclusive of alignment data
194  //* virtual int getStatus() const = 0; // Status bits describe frame errors/other
195 
196  virtual int getErrorLength() const = 0; // Length of error block in Dwords
197 
199  virtual int getDebugLength() const = 0;// Length of debug block in Dwords
200 
202  virtual int getIdentifier() const = 0; // Identifier
203 
204  //* virtual int getEndianism() const = 0; // Big/little endian indicator
205 
207  virtual int getPadding() const = 0; // number of padding units
208 
210  virtual int getStructure() const = 0; // Structure of packet
211 
212  //* virtual int getWordSize() const = 0; // "Word" size used to store packet data
213  //* virtual int getAddrLength() const = 0; // number of bytes used for channel address
214  //* virtual int getHitLength() const = 0; // Length of a single "hit" in bytes
215 
217  virtual int getHitFormat() const = 0; // Format of a single hit
218  //* virtual int getNumEntries() const = 0; // Number of "objects" stored in packet
219 
221  virtual int getDataLength() const = 0; // Format of a single hit
222 
223  // debugging-type information
224  // identify will write a short identification message to
225  // standard output or to the iOSTREAM provided. Nice to see.
226 
227 
228  //#ifdef LVL2_WINNT
230  // virtual void identify( std::OSTREAM&os =std::COUT ) const = 0;
231  // virtual void fullIdentify( std::OSTREAM& os =std::COUT ) const
232  // { identify(os);};
233  // virtual void dump ( std::OSTREAM& =std::COUT ) = 0;
234  // virtual void gdump (const int how = EVT_HEXADECIMAL, std::OSTREAM& =std::COUT) const = 0;
235 
236 
238 
239  virtual void identify(std::ostream& os = std::cout) const = 0;
240 
242  virtual int setIdentifier(const int /*newid*/) = 0; // Identifier
243 
245  virtual void fullIdentify(std::ostream& os = std::cout) const
246  { identify(os);};
247 
252  virtual void dump(std::ostream& os = std::cout) = 0;
253 
254 
263  virtual void gdump(const int how = EVT_HEXADECIMAL, std::ostream& os = std::cout) const = 0;
264 
271  virtual int getCheckSumStatus() const { return 0;};
272  virtual int copyMe(int [], const int /*maxlength*/) const { return 0;};
273 
274  virtual int setInternalParameter ( const int p1=0, const int p2=0, const char *what = "") = 0;
275 
276 
277  };
278 
279 // some structures for the LVL triggers
280 
281 // emcal
282 
284 {
285  int channel;
286  int time;
287  int highpost;
288  int lowpost;
289  int highpre;
290  int lowpre;
291 };
292 
293 
294 #define RICH_TIME 0
295 #define RICH_POSTSAMPLE 1
296 #define RICH_PRESAMPLE 2
297 
299 {
300  int channel;
301  int time;
302  int post;
303  int pre;
304 };
305 
307 {
308  int channel;
309  int gain; // 0 = low, else high
310  int time;
311  int post;
312  int pre;
313 
314 };
315 
317 {
318  int channel;
319  int time;
320  int value;
321 
322 };
323 
324 
325 #endif /* __PACKET_H__ */