5 This program connects to the DAQ data source passed as argument
6 and populates local "./result.txt" file with the ids of events received
9 The program exits when being asked to shut down (daqDA_checkshutdown)
12 Messages on stdout are exported to DAQ log system.
14 contact: alice-datesupport@cern.ch
25 #include <Riostream.h>
30 #include "AliRawReaderDate.h"
31 #include "AliPMDCalibPedestal.h"
36 #include "TBenchmark.h"
41 1- monitoring data source
43 int main(int argc, char **argv) {
45 AliPMDCalibPedestal calibped;
47 TH1F::AddDirectory(0);
50 // decoding the events
55 printf("Wrong number of arguments\n");
59 /* open result file */
61 fp=fopen("./result.txt","a");
63 printf("Failed to open file\n");
67 /* define data source : this is argument 1 */
68 status=monitorSetDataSource( argv[1] );
70 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
74 /* declare monitoring program */
75 status=monitorDeclareMp( __FILE__ );
77 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
81 /* define wait event timeout - 1s max */
83 monitorSetNoWaitNetworkTimeout(1000);
85 /* log start of process */
86 printf("DA example case2 monitoring program started\n");
88 /* init some counters */
89 int nevents_physics=0;
92 struct eventHeaderStruct *event;
96 /* main loop (infinite) */
99 /* check shutdown condition */
100 if (daqDA_checkShutdown()) {break;}
102 /* get next event (blocking call until timeout) */
103 status=monitorGetEventDynamic((void **)&event);
104 if (status==MON_ERR_EOF) {
105 printf ("End of File detected\n");
106 break; /* end of monitoring file has been reached */
110 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
114 /* retry if got no event */
121 /* use event - here, just write event id to result file */
122 eventT=event->eventType;
123 switch (event->eventType){
128 /* END START OF RUN */
135 printf(" event number = %i \n",iev);
136 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
137 calibped.ProcessEvent(rawReader);
147 /* exit when last event received, no need to wait for TERM signal */
148 if (eventT==END_OF_RUN) {
149 printf("EOR event detected\n");
158 //write the Run level file
159 TFile * fileRun = new TFile ("outPMDdaRun.root","RECREATE");
160 TBenchmark *bench = new TBenchmark();
167 fprintf(fp,"Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total);
169 /* close result file */