X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=FMD%2FFMDBaseda.cxx;h=398634a1f180e0b666b80b9c2a07af6fd9a06dd6;hb=61cf877f60af39a734a6dfa871054124c8580586;hp=c8e069b9ce2270cfe544253af85b398250bc69de;hpb=cb45bad5d958aef78d2521933fc388aeb8b06d66;p=u%2Fmrichter%2FAliRoot.git diff --git a/FMD/FMDBaseda.cxx b/FMD/FMDBaseda.cxx index c8e069b9ce2..398634a1f18 100644 --- a/FMD/FMDBaseda.cxx +++ b/FMD/FMDBaseda.cxx @@ -11,13 +11,19 @@ Output Files: conditions.csv Trigger types used: PHYSICS_EVENT */ +#include +#include "monitor.h" +#include "event.h" +#include #include -#include +#include #include #include #include #include #include +#include +#include "daqDA.h" #include "TROOT.h" #include "TPluginManager.h" @@ -36,29 +42,85 @@ int main(int argc, char **argv) #endif - Char_t* fileName = argv[1]; - + const Char_t* tableSOD[] = {"ALL", "no", "SOD", "all", NULL, NULL}; + Bool_t old = kTRUE; - - AliCDBManager* cdb = AliCDBManager::Instance(); - cdb->SetRun(0); - cdb->SetDefaultStorage(""); - + monitorDeclareTable(const_cast(tableSOD)); + AliFMDParameters::Instance()->Init(kFALSE,0); - AliFMDParameters::Instance()->UseRcuTrailer(!old); - AliFMDParameters::Instance()->UseCompleteHeader(!old); + AliFMDParameters::Instance()->UseCompleteHeader(old); + struct eventHeaderStruct *event; + int status; + /* define data source : this is argument 1 */ + if (argc < 2) { + cout << "No monitor source set" << endl; + return -1; + } + status=monitorSetDataSource( argv[1] ); + if (status!=0) { + printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status)); + return -1; + } - AliRawReader *reader = new AliRawReaderDate(fileName); - TStopwatch timer; - timer.Start(); - AliFMDBaseDA baseDA; + 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; + } - baseDA.Run(reader); - - timer.Stop(); - timer.Print(); + monitorSetNowait(); + monitorSetNoWaitNetworkTimeout(1000); - - - + 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) cerr << "Base DA failed" << endl; + + break; + + default: + break; + + } + } + + + return retval; }