2 FMD DA for online calibration of conditions
4 Contact: christian.holm.christensen@cern.ch
5 Link: fmd.nbi.dk/fmd/offline
8 Number of events needed: depending on the run, being run-level
10 Output Files: conditions.csv
11 Trigger types used: PHYSICS_EVENT
14 #include <Riostream.h>
20 #include <AliFMDParameters.h>
21 #include <AliRawReader.h>
22 #include <TStopwatch.h>
23 #include <AliFMDBaseDA.h>
24 #include <AliRawReaderDate.h>
25 #include <AliRawReaderRoot.h>
28 #include "TPluginManager.h"
31 usage(std::ostream& o, const char* progname)
33 o << "Usage: " << progname << " FILE [OPTIONS]\n\n"
35 << "\t-h,--help Show this help\n"
36 << "\t-d,--diagnostics Create diagnostics\n"
37 << "\t-D,--debug LEVEL Set the debug level\n"
41 int main(int argc, char **argv)
45 /* magic line from Rene - for future reference! */
46 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
52 AliFMDBaseDA::Runner r;
54 Int_t ret = r.Init(argc, argv, false);
55 if (ret < 0) return -ret;
56 if (ret > 0) return 0;
60 const Char_t* tableSOD[] = {"ALL", "no", "SOD", "all", NULL, NULL};
62 monitorDeclareTable(const_cast<char**>(tableSOD));
64 int status = monitorSetDataSource(r.fSource.Data());
66 printf("monitorSetDataSource() failed for %s: %s\n",
67 r.fSource.Data(), monitorDecodeError(status));
71 /* declare monitoring program */
72 status = monitorDeclareMp( __FILE__ );
74 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
79 monitorSetNoWaitNetworkTimeout(1000);
83 Bool_t sodSeen = false;
84 Bool_t success = false;
85 while(!sodSeen && iev<1000) {
87 /* check shutdown condition */
88 if (daqDA_checkShutdown()) break;
90 /* get next event (blocking call until timeout) */
91 struct eventHeaderStruct *event = 0;
92 status = monitorGetEventDynamic((void **)&event);
93 if (status == MON_ERR_EOF) {
94 printf ("End of File detected\n");
95 break; /* end of monitoring file has been reached */
99 printf("monitorGetEventDynamic() failed : %s\n",
100 monitorDecodeError(status));
104 /* retry if got no event */
105 if (!event) continue;
109 switch (event->eventType) {
110 case START_OF_DATA: {
111 std::cout << "Got START OF DATA event" << std::endl;
112 AliRawReader* reader = new AliRawReaderDate((void*)event);
113 if (!(success = baseDA.Run(reader, r.fAppendRun, true)))
114 std::cout << "Base DA failed" << std::endl;
123 int retval = success ? 0 : 1;
124 if (r.fUpload && success) {
125 std::cout << "Pushing to FXS" << std::endl;
127 daqDA_FES_storeFile("conditions.csv",
128 AliFMDParameters::Instance()
129 ->GetConditionsShuttleID());
130 if (retval != 0) std::cerr << "Base DA failed" << std::endl;
133 std::cout << "End of FMD-Base - return " << retval << std::endl;