3 TPCda_pedestal.cxx - calibration algorithm for TPC pedestal runs
5 10/06/2007 sylvain.chapeland@cern.ch : first version - clean skeleton based on DAQ DA case1
7 contact: marian.ivanov@cern.ch
10 This process reads RAW data from the files provided as command line arguments
11 and save results in a file (named from RESULT_FILE define - see below).
15 #define RESULT_FILE "tpcPedestal.root"
34 #include "AliRawReader.h"
35 #include "AliRawReaderDate.h"
36 #include "AliTPCRawStream.h"
37 #include "AliTPCROC.h"
38 #include "AliTPCCalROC.h"
39 #include "AliTPCCalPad.h"
40 #include "AliMathBase.h"
41 #include "TTreeStream.h"
44 // TPC calibration algorithm includes
46 #include "AliTPCCalibPedestal.h"
52 Arguments: list of DATE raw data files
54 int main(int argc, char **argv) {
57 AliTPCCalibPedestal calibPedestal; // pedestal and noise calibration
60 printf("Wrong number of arguments\n");
65 /* log start of process */
66 printf("TPC DA started - %s\n",__FILE__);
69 /* declare monitoring program */
70 status=monitorDeclareMp( __FILE__ );
72 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
77 /* loop over RAW data files */
81 /* define data source : this is argument i */
82 printf("Processing file %s\n", argv[i]);
83 status=monitorSetDataSource( argv[i] );
85 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
91 struct eventHeaderStruct *event;
93 /* check shutdown condition */
94 if (daqDA_checkShutdown()) {break;}
96 /* get next event (blocking call until timeout) */
97 status=monitorGetEventDynamic((void **)&event);
98 if (status==MON_ERR_EOF) {
99 printf ("End of File %d detected\n",i);
100 break; /* end of monitoring file has been reached */
104 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
108 /* retry if got no event */
114 // Pedestal calibration
115 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
116 calibPedestal.ProcessEvent(rawReader);
124 calibPedestal.Analyse();
125 printf ("%d events processed\n",nevents);
127 TFile * fileTPC = new TFile (RESULT_FILE,"recreate");
128 calibPedestal.Write("calibPedestal");
130 printf("Wrote %s\n",RESULT_FILE);