![]() |
|
|||
File indexing completed on 2025-08-03 08:20:45
0001 // -*- c++ -*- 0002 #ifndef __EVENT_H__ 0003 #define __EVENT_H__ 0004 0005 //#include <stddef.h> 0006 #include <vector> 0007 0008 #include "packet.h" 0009 #include <ctime> 0010 0011 // virtual base class for an "event" 0012 0013 const char *get_evt_mnemonic(const int); 0014 0015 /** 0016 This is the abstract Event class. 0017 0018 It defines all interfaces to deal with Event data. It is a pure 0019 virtual class which does not define any implementation details (it has 0020 only member function defintions, no data members). It is meant to be 0021 subclassed by the classes which define the actual implementation. 0022 */ 0023 0024 //class PHLeanTimeStamp; 0025 0026 #ifndef __CINT__ 0027 class WINDOWSEXPORT Event { 0028 #else 0029 class Event { 0030 #endif 0031 0032 public: 0033 inline virtual ~Event(){}; 0034 0035 // **** info & debug utils ****** 0036 /** getEvtLength() returns the length of the event raw data 0037 in longwords (32bit). If you want to copy the event somewhere, 0038 you can find out whether or not you have enough space left. 0039 */ 0040 virtual unsigned int getEvtLength() const =0; 0041 0042 /** 0043 getEvtType() returns the type of the event. Most of the 0044 events have the type DATAEVENT, but there are also 0045 BEGRUNEVENT, SPILLONEVENT, SPILLOFFEVENT, ENDRUNEVENT, 0046 and so on. 0047 */ 0048 virtual int getEvtType() const =0; 0049 0050 /** 0051 getEvtSequence() returns the number of the event in a 0052 particular run. This number is a property of the event. Its run number and the 0053 sequence number uniquely indentify an event. It has nothing to do with the position 0054 of the event in any given data file. 0055 */ 0056 virtual int getEvtSequence() const =0; 0057 0058 /** 0059 getRunNumber() returns the number of the run to which this 0060 event belongs. 0061 */ 0062 virtual int getRunNumber() const =0; 0063 0064 /** 0065 identify will write a short identification message to 0066 standard output or to the ostream provided. 0067 */ 0068 0069 0070 virtual void identify(std::ostream& os = std::cout) const = 0; 0071 0072 /** 0073 listFrame will write a short descriptor of the frame header to the output stream 0074 provided. If id == 0, it will list all frame headers. Otherwise it will list 0075 the header of the frame in which the packet with id resides. 0076 */ 0077 0078 0079 virtual void listFrame( const int /*id*/=0, std::ostream& /*os*/=std::cout) const {}; 0080 0081 virtual void listHistory( const int /*id*/=0, std::ostream& /*os*/=std::cout) const {}; 0082 virtual void listError( const int /*id*/=0, std::ostream& /*os*/=std::cout) const {}; 0083 0084 /** 0085 getFrameEntry will return a particular entry from the frame header which contains 0086 the packet with the specidied id. If id == 0, the first frame will be selected. 0087 0088 keywords to return are: 0089 0090 FRAMELENGTH 0091 FRAMEMARK 0092 FRAMEHDRVERSION 0093 FRAMEHDRLENGTH 0094 FRAMESTATUS 0095 FRAMESOURCEID 0096 FRAMEDATATYPE 0097 FRAMETYPE 0098 FRAMEALIGNLENGTH 0099 FRAMEALIGNMENTWORD[index] 0100 0101 The last FRAMEALIGNMENTWORD is an array, you need to call 0102 getFrameEntry(id,"FRAMEALIGNMENTWORD",1) to get the index 1, and so on. 0103 Asking for a word beyond the number of such words will return 0. 0104 */ 0105 0106 virtual unsigned int getFrameEntry( const char * /*what*/, const int /*id*/=0, const int /*index */=0) const { return 0; }; 0107 0108 0109 // ***** packet handling ***** 0110 /** 0111 getPacket creates and returns a pointer to the 0112 packet object with the specified packet id (think of it 0113 as a house number). 0114 */ 0115 virtual Packet* getPacket(const int)=0; 0116 0117 /** 0118 This interface allows to override the hitformat of the packet. 0119 For debugging purposes mostly. 0120 0121 */ 0122 virtual Packet* getPacket(const int, const int /*hitFormat*/)=0; 0123 0124 /** 0125 getPacketList returns a simple-minded array of pointers 0126 to the packets in the given event. It returns the number 0127 of packets returned in the array. The second parameter tells 0128 the packet how long the array is. 0129 */ 0130 virtual int getPacketList(Packet*[], const int /*length*/) =0; 0131 0132 /** 0133 getPacketVector returns a stdd:vector of the packet pointers. 0134 */ 0135 virtual std::vector<Packet *> getPacketVector() =0; 0136 0137 /** 0138 existPacket returns 1 if such a packet exists in the 0139 event. 0 else. 0140 */ 0141 virtual int existPacket (const int /*packetid*/)=0; 0142 0143 // **** event copying ***** 0144 /** 0145 the event's raw data are copied to destination. length is the 0146 size of destination, and nw is the number of words 0147 actually copied. 0148 0149 if what = "RAW" then we just copy the payload data without the event header. 0150 */ 0151 virtual int Copy ( int *destination, const unsigned int /*length*/, int *nw, const char * /*what */="" )=0; 0152 0153 0154 /** 0155 getErrorCode() returns a non-zero error code if something in the event 0156 structure is wrong. Test for 0 to see that the event passes some 0157 consistency checks. 0158 */ 0159 virtual int getErrorCode() {return 0;}; 0160 0161 0162 /** 0163 getTagWord() returns the bit pattern that the event builder may have put into 0164 the header for fast event selection purposes. This is mainly used by the 0165 ET system to distribute events based on its properties. 0166 */ 0167 virtual unsigned int getTagWord( const int /*i*/ =0) const { return 0;}; 0168 0169 virtual int is_pointer_type() const =0; 0170 0171 // **** convert event from pointer- to data-based ***** 0172 /** 0173 converting the Event object means that the actual data it manages 0174 are copied to an internal location and are thus safe from being overwritten. 0175 For efficiency, most Event objects initially maintain a pointer to the 0176 external raw data only. They are referred to as being pointer-based. 0177 If an Event object has already been converted, a second convert operation 0178 has no effect. 0179 */ 0180 virtual int convert ()=0; 0181 0182 virtual int getDate() = 0; 0183 virtual time_t getTime() const = 0; 0184 0185 virtual void setOriginBuffer(const int n) = 0; 0186 virtual int getOriginBuffer() const =0; 0187 0188 0189 }; 0190 0191 #endif /* __EVENT_H__ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |