EIC 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 
113  virtual float rValue(const int channel, const char * what) =0;
114 
115 
119  virtual float rValue(const int channel, const int iy) =0;
120 
121  virtual void * pValue(const int chan)
122  {
123  return 0;
124  }
125 
126  virtual void * pValue(const int chan, const char *what)
127  {
128  return 0;
129  }
130 
131  virtual void * pValue(const int chan, const int iy)
132  {
133  return 0;
134  }
135 
136 
137 
138 
139  // *** now getting all the decoded values in one go ***
140  // these routines get you all the decoded values into an array
141  // of float's or int's. The what parameter has the usual meaning.
142 
146  virtual int getArraylength(const char * what ="") =0;
147 
151  virtual int fillIntArray (int destination[], // the data go here
152  const int length, // space we have in destination
153  int * nw, // words actually used
154  const char * what="") = 0; // type of data (see above)
155 
157  virtual int fillFloatArray (float destination[], // the data go here
158  const int length, // space we have in destination
159  int * nw, // words actually used
160  const char * what="") = 0; // type of data (see above)
161 
166  virtual int* getIntArray (int * nw,const char * ="") =0;
167 
169  virtual float* getFloatArray (int * nw,const char * ="") =0;
170 
171 
173  virtual int is_pointer_type() const = 0;
174 
176  virtual int convert() =0;
177 
178 
179  // access to envelope information:
180 
184  virtual int getLength() const = 0;
185 
186  // virtual int getType() const = 0;
187  // virtual int getDecoding() const = 0;
188 
189  // some more header fields which are not yet implemented, marked "//*"
190  //* virtual int gethdrVersion() const = 0; // Version of header definition
191  //* virtual int getHdrLength() const = 0; // inclusive of alignment data
192  //* virtual int getStatus() const = 0; // Status bits describe frame errors/other
193 
194  virtual int getErrorLength() const = 0; // Length of error block in Dwords
195 
197  virtual int getDebugLength() const = 0;// Length of debug block in Dwords
198 
200  virtual int getIdentifier() const = 0; // Identifier
201 
202  //* virtual int getEndianism() const = 0; // Big/little endian indicator
203 
205  virtual int getPadding() const = 0; // number of padding units
206 
208  virtual int getStructure() const = 0; // Structure of packet
209 
210  //* virtual int getWordSize() const = 0; // "Word" size used to store packet data
211  //* virtual int getAddrLength() const = 0; // number of bytes used for channel address
212  //* virtual int getHitLength() const = 0; // Length of a single "hit" in bytes
213 
215  virtual int getHitFormat() const = 0; // Format of a single hit
216  //* virtual int getNumEntries() const = 0; // Number of "objects" stored in packet
217 
219  virtual int getDataLength() const = 0; // Format of a single hit
220 
221  // debugging-type information
222  // identify will write a short identification message to
223  // standard output or to the iOSTREAM provided. Nice to see.
224 
225 
226  //#ifdef LVL2_WINNT
228  // virtual void identify( std::OSTREAM&os =std::COUT ) const = 0;
229  // virtual void fullIdentify( std::OSTREAM& os =std::COUT ) const
230  // { identify(os);};
231  // virtual void dump ( std::OSTREAM& =std::COUT ) = 0;
232  // virtual void gdump (const int how = EVT_HEXADECIMAL, std::OSTREAM& =std::COUT) const = 0;
233 
234 
236 
237  virtual void identify(std::ostream& os = std::cout) const = 0;
238 
239 
240 
242  virtual void fullIdentify(std::ostream& os = std::cout) const
243  { identify(os);};
244 
249  virtual void dump(std::ostream& os = std::cout) = 0;
250 
251 
260  virtual void gdump(const int how = EVT_HEXADECIMAL, std::ostream& os = std::cout) const = 0;
261 
268  virtual int getCheckSumStatus() const { return 0;};
269  virtual int copyMe(int [], const int maxlength) const { return 0;};
270 
271  virtual int setInternalParameter ( const int p1=0, const int p2=0, const char *what = "") = 0;
272 
273 
274  };
275 
276 // some structures for the LVL triggers
277 
278 // emcal
279 
281 {
282  int channel;
283  int time;
284  int highpost;
285  int lowpost;
286  int highpre;
287  int lowpre;
288 };
289 
290 
291 #define RICH_TIME 0
292 #define RICH_POSTSAMPLE 1
293 #define RICH_PRESAMPLE 2
294 
296 {
297  int channel;
298  int time;
299  int post;
300  int pre;
301 };
302 
304 {
305  int channel;
306  int gain; // 0 = low, else high
307  int time;
308  int post;
309  int pre;
310 
311 };
312 
314 {
315  int channel;
316  int time;
317  int value;
318 
319 };
320 
321 
322 #endif /* __PACKET_H__ */