Trigger types used: PHYSICS_EVENT
*/
#include "monitor.h"
+#include "event.h"
+#include <AliLog.h>
#include <TSystem.h>
#include <TString.h>
#include <AliFMDParameters.h>
#endif
- Char_t* tableSOD[] = {"SOD","all",NULL};
+ const Char_t* tableSOD[] = {"ALL", "no", "SOD", "all", NULL, NULL};
-
- monitorDeclareTable(tableSOD);
-
-
- Char_t* fileName = argv[1];
-
Bool_t old = kTRUE;
-
+ monitorDeclareTable(const_cast<char**>(tableSOD));
+
AliFMDParameters::Instance()->Init(kFALSE,0);
- AliFMDParameters::Instance()->UseCompleteHeader(!old);
-
- AliRawReader *reader = 0;
- TString fileNam(fileName);
- if (fileNam.EndsWith(".root")) reader = new AliRawReaderRoot(fileName);
- else reader = new AliRawReaderDate(fileName);
- if (!reader) {
- std::cerr << "Don't know how to make reader for " << fileNam
- << std::endl;
- return -2;
+ AliFMDParameters::Instance()->UseCompleteHeader(old);
+ struct eventHeaderStruct *event;
+ int status;
+ /* define data source : this is argument 1 */
+ if (argc < 2) {
+ std::cout << "No monitor source set" << std::endl;
+ return -1;
+ }
+ status=monitorSetDataSource( argv[1] );
+ if (status!=0) {
+ printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
+ return -1;
}
- TStopwatch timer;
- timer.Start();
- AliFMDBaseDA baseDA;
-
- baseDA.Run(reader);
+ if (argc > 2) AliLog::SetModuleDebugLevel("FMD", atoi(argv[2]));
+ /* declare monitoring program */
+ status=monitorDeclareMp( __FILE__ );
+ if (status!=0) {
+ printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
+ return -1;
+ }
- timer.Stop();
- timer.Print();
+ monitorSetNowait();
+ monitorSetNoWaitNetworkTimeout(1000);
- Int_t retval = daqDA_FES_storeFile("conditions.csv", AliFMDParameters::Instance()->GetConditionsShuttleID());
- if (retval != 0) std::cerr << "Base DA failed" << std::endl;
-
+ AliRawReader *reader = 0;
+ AliFMDBaseDA baseDA;
+ Int_t retval = 0;
+ Int_t iev = 0;
+ Bool_t SODread = kFALSE;
+ while(!SODread && iev<1000) {
+
+ /* check shutdown condition */
+ if (daqDA_checkShutdown()) {break;}
+
+ /* get next event (blocking call until timeout) */
+ status=monitorGetEventDynamic((void **)&event);
+ if (status==MON_ERR_EOF) {
+ printf ("End of File detected\n");
+ break; /* end of monitoring file has been reached */
+ }
+
+ if (status!=0) {
+ printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
+ break;
+ }
+
+ /* retry if got no event */
+ if (event==NULL) {
+ continue;
+ }
+
+ iev++;
+
+ switch (event->eventType){
+
+ case START_OF_DATA:
+ reader = new AliRawReaderDate((void*)event);
+ baseDA.Run(reader);
+ SODread = kTRUE;
+ retval =
+ daqDA_FES_storeFile("conditions.csv",
+ AliFMDParameters::Instance()->GetConditionsShuttleID());
+ if (retval != 0) std::cerr << "Base DA failed" << std::endl;
+
+ break;
+
+ default:
+ break;
+
+ }
+ }
+
+
return retval;
}