3 TRDPEDESTALda.cxx - calibration algorithm for the pedestal to be run in parallel on the LDCs
7 AliTRDCalibPadStatus - pad status calibration
9 This program reads the DAQ data files passed as argument using the monitoring library.
11 It fills a TRD calib object AliTRDCalibPadStatus and write it in a local file trdPedestal.root before
12 exporting it to the file exchange server.
14 Messages on stdout are exported to DAQ log system.
16 contact: alice-datesupport@cern.ch
20 #define RESULT_FILE "trdCalibration.root"
35 #include <TStopwatch.h>
40 #include "AliRawReader.h"
41 #include "AliRawReaderDate.h"
42 #include "AliTRDRawStream.h"
43 #include "AliCDBManager.h"
45 // AliRoot TRD calib classes
47 #include "AliTRDCalibPadStatus.h"
51 Arguments: list of DATE raw data files
53 int main(int argc, char **argv) {
58 /* log start of process */
59 printf("TRD DA PEDESTAL started\n");
62 /* check that we got some arguments = list of files */
64 printf("Wrong number of arguments\n");
69 /* copy locally a file from daq detector config db */
70 //status=daqDA_DB_getFile("myconfig","./myconfig.txt");
72 // printf("Failed to get config file : %d\n",status);
75 /* and possibly use it */
78 /* init some counters */
82 //Instance of AliCDBManager: needed by AliTRDRawStream
83 AliCDBManager *man = AliCDBManager::Instance();
84 man->SetDefaultStorage("local://$ALICE_ROOT");
86 // AliTRDCalibPadStatus object
87 AliTRDCalibPadStatus calipad = AliTRDCalibPadStatus();
88 Bool_t passpadstatus = kTRUE;
96 /* read the data files */
98 for (n=1;n<argc;n++) {
100 /* define data source : this is argument i */
101 printf("Processing file %s\n",argv[n]);
102 status=monitorSetDataSource( argv[n] );
104 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
108 /* read the file until EOF */
110 struct eventHeaderStruct *event;
113 status=monitorGetEventDynamic((void **)&event);
114 if (status==MON_ERR_EOF) {
115 printf("End of File %d detected\n",n);
116 break; /* end of monitoring file has been reached */
119 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
123 /* retry if got no event */
130 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
131 AliTRDRawStream *trdRawStream = new AliTRDRawStream((AliRawReader *)rawReader);
132 if(!calipad.ProcessEvent(trdRawStream,(Bool_t)nevents_total)) passpadstatus = kFALSE;
147 /* report progress */
148 printf("%d events processed and %d used\n",nevents_total,nevents);
154 /* write file in any case to see what happens in case of problems*/
155 TFile *fileTRD = new TFile(RESULT_FILE,"recreate");
156 calipad.Write("calibpadstatus");
158 printf("Wrote local file %s\n",RESULT_FILE);
160 /* store the result file on FES */
161 status=daqDA_FES_storeFile(RESULT_FILE,RESULT_FILE);
163 printf("Failed to export file : %d\n",status);
168 /* report progress */
169 daqDA_progressReport(100);