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