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