3 FMD DA for online calibration of conditions
6 Link: fmd.nbi.dk/fmd/offline
9 Number of events needed: depending on the run, being run-level
11 Output Files: conditions.csv
12 Trigger types used: PHYSICS_EVENT
15 #include <Riostream.h>
21 #include <AliFMDParameters.h>
22 #include <AliRawReader.h>
23 #include <TStopwatch.h>
24 #include <AliFMDBaseDA.h>
25 #include <AliRawReaderDate.h>
26 #include <AliRawReaderRoot.h>
29 #include "TPluginManager.h"
32 usage(std::ostream& o, const char* progname)
34 o << "Usage: " << progname << " FILE [OPTIONS]\n\n"
36 << "\t-h,--help Show this help\n"
37 << "\t-d,--diagnostics Create diagnostics\n"
38 << "\t-D,--debug LEVEL Set the debug level\n"
42 int main(int argc, char **argv)
46 /* magic line from Rene - for future reference! */
47 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
55 const Char_t* tableSOD[] = {"ALL", "no", "SOD", "all", NULL, NULL};
58 monitorDeclareTable(const_cast<char**>(tableSOD));
60 AliFMDParameters::Instance()->Init(kFALSE,0);
61 AliFMDParameters::Instance()->UseCompleteHeader(old);
62 struct eventHeaderStruct *event;
66 Bool_t badOption = false;
68 for (int i = 1; i < argc; i++) {
69 if (argv[i][0] == '-') { // Options
70 if (argv[i][1] == '-') { // Long option
71 TString arg(&(argv[i][2]));
72 if (arg.EqualTo("help")) { usage(std::cout, argv[0]); return 0; }
73 if (arg.EqualTo("diagnostics")) { }
74 else if (arg.EqualTo("debug")) debugLevel = atoi(argv[++i]);
75 else badOption = true;
77 else { // Short option
79 case 'h': usage(std::cout, argv[0]); return 0;
81 case 'D': debugLevel = atoi(argv[++i]); break;
82 default: badOption = true;
86 std::cerr << argv[0] << ": Unknown option " << argv[i]
92 if (!source) source = argv[i];
93 else debugLevel = atoi(argv[i]);
97 printf("%s: No data source specified\n", argv[0]);
100 status=monitorSetDataSource(source);
102 printf("monitorSetDataSource() failed for %s: %s\n",
103 source, monitorDecodeError(status));
107 AliLog::SetModuleDebugLevel("FMD", debugLevel);
108 /* declare monitoring program */
109 status=monitorDeclareMp( __FILE__ );
111 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
116 monitorSetNoWaitNetworkTimeout(1000);
118 AliRawReader *reader = 0;
122 Bool_t SODread = kFALSE;
123 while(!SODread && iev<1000) {
125 /* check shutdown condition */
126 if (daqDA_checkShutdown()) {break;}
128 /* get next event (blocking call until timeout) */
129 status=monitorGetEventDynamic((void **)&event);
130 if (status==MON_ERR_EOF) {
131 printf ("End of File detected\n");
132 break; /* end of monitoring file has been reached */
136 printf("monitorGetEventDynamic() failed : %s\n",
137 monitorDecodeError(status));
141 /* retry if got no event */
148 switch (event->eventType){
151 reader = new AliRawReaderDate((void*)event);
155 daqDA_FES_storeFile("conditions.csv",
156 AliFMDParameters::Instance()->GetConditionsShuttleID());
157 if (retval != 0) std::cerr << "Base DA failed" << std::endl;