]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/FMDBaseda.cxx
added verbosity in a Fatal call
[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 */
408bf2b4 53 if (argc < 2) {
54 std::cout << "No monitor source set" << std::endl;
55 return -1;
56 }
d27e6de5 57 status=monitorSetDataSource( argv[1] );
58 if (status!=0) {
59 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
60 return -1;
f05d667d 61 }
62
d27e6de5 63 /* declare monitoring program */
64 status=monitorDeclareMp( __FILE__ );
65 if (status!=0) {
66 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
67 return -1;
68 }
cb45bad5 69
d27e6de5 70 monitorSetNowait();
71 monitorSetNoWaitNetworkTimeout(1000);
cb45bad5 72
d27e6de5 73 AliRawReader *reader = 0;
74 AliFMDBaseDA baseDA;
75 Int_t retval = 0;
76 Int_t iev = 0;
77 Bool_t SODread = kFALSE;
78 while(!SODread && iev<1000) {
79
80 /* check shutdown condition */
81 if (daqDA_checkShutdown()) {break;}
82
83 /* get next event (blocking call until timeout) */
84 status=monitorGetEventDynamic((void **)&event);
85 if (status==MON_ERR_EOF) {
86 printf ("End of File detected\n");
87 break; /* end of monitoring file has been reached */
88 }
89
90 if (status!=0) {
91 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
92 break;
93 }
94
95 /* retry if got no event */
96 if (event==NULL) {
97 continue;
98 }
99
100 iev++;
101
102 switch (event->eventType){
103
104 case START_OF_DATA:
105 reader = new AliRawReaderDate((void*)event);
106 baseDA.Run(reader);
107 SODread = kTRUE;
108 retval = daqDA_FES_storeFile("conditions.csv", AliFMDParameters::Instance()->GetConditionsShuttleID());
109 if (retval != 0) std::cerr << "Base DA failed" << std::endl;
110
111 break;
112
113 default:
114 break;
115
116 }
117 }
118
119
f05d667d 120 return retval;
cb45bad5 121}