Virtually all objects in the event handling system provide an "identify" member function, which is defined asvirtual void identify(ostream& os = cout);So if we just want to see what kind of objects we have in the previous example, we could modify the "channel57" function to
int channel57( Event *evt) { // the Event object creates a Packet object // and returns a pointer to the Packet object to us. evt->identify(); Packet *p = evt->getPacket(8002); if (p) { // yes, we got the packet, and we ask it now to get channel 57 for us p->identify(); int channel57 = p->iValue(57); cout << "Channel 57 is " << channel57 << endl; delete p; return 0; } return -1; }Note the two "identify" statements, one for the Event object and one for the Packet object. This gives>> ./channel57_id /export/data1/dcm_data/emc/run_03006.dat | more -- Event 1 Run: 3006 length: 8 frames: 0 type: 9 (Begin Run Event) -- Event 2 Run: 3006 length: 1017 frames: 3 type: 1 (Data Event) Packet 8002 985 0 (Unformatted) 408 (IDPBSC_DCM0) Channel 57 is 3538 -- Event 3 Run: 3006 length: 1017 frames: 3 type: 1 (Data Event) Packet 8002 985 0 (Unformatted) 408 (IDPBSC_DCM0) Channel 57 is 3532 -- Event 4 Run: 3006 length: 1017 frames: 3 type: 1 (Data Event) Packet 8002 985 0 (Unformatted) 408 (IDPBSC_DCM0) Channel 57 is 3530 -- Event 5 Run: 3006 length: 1017 frames: 3 type: 1 (Data Event) Packet 8002 985 0 (Unformatted) 408 (IDPBSC_DCM0) Channel 57 is 3538 -- Event 6 Run: 3006 length: 1017 frames: 3 type: 1 (Data Event) Packet 8002 985 0 (Unformatted) 408 (IDPBSC_DCM0) Channel 57 is 3536Note: In a later chapter we will present a comprehensive list of ready-made tools which let you identify the events of various data streams, list packets within events, and much more. You do not normally need to write your own utilities to do that.So we get some information about the Event object, the run number it belongs to (3006), its overall length (1017), the number of Frames it contains (3) and what type it is (we have one "Begin Run Event" and many "Data Events"; if we would run this file to its end, we would also see an "end run event"). The begin and end run events hold data about the run itself (in this file, they just exist but are empty). In the Begin Run event, one would typically store some configuration data, some description what the beam was, and so on, while the End Run event can be used to hold scaler, beam counter, and other information needed to calculate cross sections. The other important purpose is that the analysis processes, when fed a continuous stream of events, can take special action on receipt of the Begin-run or End-run events, such as update database information, or write out control histograms, or whatever is needed. In a general analysis routine, one would take different action for different types of events, such as
int analyze_event( Event *evt) { // the Event object creates a Packet object // and returns a pointer to the Packet object to us. evt->identify(); switch( evt->getEvtType() ) { case DATAEVENT: return channel57(evt); break; case BEGRUNEVENT: // ... do something for the begin-run event break; case ENDRUNEVENT: // ... do something for the end-run event break; } return 0; }You pick up the definitons for DATAEVENT etc with the "Event.h" file. Also, if you want to get at the envelope information in your program (such as the "getEvtType()" above), there is a comprehensive set of accessor functions defined for the objects (see the reference section).
In the output above we see that the Begin-Run event is just empty, and we also see that after its "identify" output, there is no "packet" information, simply because the Begin-Run event doesn't have a packet with id 8002.
The Packet's "identify()" function tell us its Id, its length, its format ("unformatted"), and its identity tag (408,"IDPBSC_DCM0"). This latter tag tells the event handling system which decoding function to use in the end. At this time there are about 60 of those tags defined.
Alphabetic index Hierarchy of classes