]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/FMDBaseda.cxx
technical changes:
[u/mrichter/AliRoot.git] / FMD / FMDBaseda.cxx
CommitLineData
cb45bad5 1/*
2
3 FMD DA for online calibration of conditions
4
5 Contact: canute@nbi.dk
6 Link: fmd.nbi.dk/fmd/offline
7 Run Type: PHYSICS
c56bdf45 8 DA Type: MON
cb45bad5 9 Number of events needed: depending on the run, being run-level
10 Input Files: raw data
11 Output Files: conditions.csv
12 Trigger types used: PHYSICS_EVENT
13*/
c56bdf45 14#include "monitor.h"
d27e6de5 15#include "event.h"
cb45bad5 16#include <TSystem.h>
f05d667d 17#include <TString.h>
cb45bad5 18#include <AliFMDParameters.h>
19#include <AliRawReader.h>
20#include <TStopwatch.h>
21#include <AliFMDBaseDA.h>
64c49452 22#include <AliRawReaderDate.h>
f05d667d 23#include <AliRawReaderRoot.h>
24#include "daqDA.h"
cb45bad5 25#include "TROOT.h"
26#include "TPluginManager.h"
27
28
29
30int main(int argc, char **argv)
31{
32
33#if 0
34 /* magic line from Rene - for future reference! */
35 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
36 "*",
37 "TStreamerInfo",
38 "RIO",
39 "TStreamerInfo()");
40#endif
41
42
aa947269 43 const Char_t* tableSOD[] = {"ALL", "no", "SOD", "all", NULL, NULL};
c851f39a 44
d27e6de5 45 Bool_t old = kTRUE;
aa947269 46 monitorDeclareTable(const_cast<char**>(tableSOD));
c851f39a 47
cb45bad5 48 AliFMDParameters::Instance()->Init(kFALSE,0);
d27e6de5 49 AliFMDParameters::Instance()->UseCompleteHeader(old);
50 struct eventHeaderStruct *event;
51 int status;
52 /* define data source : this is argument 1 */
53 status=monitorSetDataSource( argv[1] );
54 if (status!=0) {
55 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
56 return -1;
f05d667d 57 }
58
d27e6de5 59 /* declare monitoring program */
60 status=monitorDeclareMp( __FILE__ );
61 if (status!=0) {
62 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
63 return -1;
64 }
cb45bad5 65
d27e6de5 66 monitorSetNowait();
67 monitorSetNoWaitNetworkTimeout(1000);
cb45bad5 68
d27e6de5 69 AliRawReader *reader = 0;
70 AliFMDBaseDA baseDA;
71 Int_t retval = 0;
72 Int_t iev = 0;
73 Bool_t SODread = kFALSE;
74 while(!SODread && iev<1000) {
75
76 /* check shutdown condition */
77 if (daqDA_checkShutdown()) {break;}
78
79 /* get next event (blocking call until timeout) */
80 status=monitorGetEventDynamic((void **)&event);
81 if (status==MON_ERR_EOF) {
82 printf ("End of File detected\n");
83 break; /* end of monitoring file has been reached */
84 }
85
86 if (status!=0) {
87 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
88 break;
89 }
90
91 /* retry if got no event */
92 if (event==NULL) {
93 continue;
94 }
95
96 iev++;
97
98 switch (event->eventType){
99
100 case START_OF_DATA:
101 reader = new AliRawReaderDate((void*)event);
102 baseDA.Run(reader);
103 SODread = kTRUE;
104 retval = daqDA_FES_storeFile("conditions.csv", AliFMDParameters::Instance()->GetConditionsShuttleID());
105 if (retval != 0) std::cerr << "Base DA failed" << std::endl;
106
107 break;
108
109 default:
110 break;
111
112 }
113 }
114
115
f05d667d 116 return retval;
cb45bad5 117}