2 TPC DA for online calibration
4 Contact: Haavard.Helstrup@cern.ch
6 Run Type: PHYSICS_RUN STANDALONE DAQ
8 Number of events needed: 500
10 Output Files: tpcCE.root, to be exported to the DAQ FXS
11 Trigger types used: PHYSICS_EVENT
17 TPCCEda.cxx - calibration algorithm for TPC Central Electrode events
19 10/06/2007 sylvain.chapeland@cern.ch : first version - clean skeleton based on DAQ DA case1
20 06/12/2007 haavard.helstrup@cern.ch : created CE DA based on pulser code
22 contact: marian.ivanov@cern.ch
25 This process reads RAW data from the files provided as command line arguments
26 and save results in a file (named from RESULT_FILE define - see below).
30 #define RESULT_FILE "tpcCE.root"
44 #include "TPluginManager.h"
48 #include "AliRawReader.h"
49 #include "AliRawReaderDate.h"
50 #include "AliTPCRawStream.h"
51 #include "AliTPCROC.h"
52 #include "AliTPCCalROC.h"
53 #include "AliTPCCalPad.h"
54 #include "AliMathBase.h"
55 #include "TTreeStream.h"
58 // TPC calibration algorithm includes
60 #include "AliTPCCalibCE.h"
66 Arguments: list of DATE raw data files
68 int main(int argc, char **argv) {
70 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
78 AliTPCCalibCE calibCE; // pedestal and noise calibration
81 printf("Wrong number of arguments\n");
86 /* log start of process */
87 printf("TPC CE DA started - %s\n",__FILE__);
90 /* set time bin range */
91 calibCE.SetRangeTime(800,940);
94 /* declare monitoring program */
95 status=monitorDeclareMp( __FILE__ );
97 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
102 /* loop over RAW data files */
104 for(i=1;i<argc;i++) {
106 /* define data source : this is argument i */
107 printf("Processing file %s\n", argv[i]);
108 status=monitorSetDataSource( argv[i] );
110 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
116 struct eventHeaderStruct *event;
118 /* check shutdown condition */
119 if (daqDA_checkShutdown()) {break;}
121 /* get next event (blocking call until timeout) */
122 status=monitorGetEventDynamic((void **)&event);
123 if (status==MON_ERR_EOF) {
124 printf ("End of File %d detected\n",i);
125 break; /* end of monitoring file has been reached */
129 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
133 /* retry if got no event */
139 // Pulser calibration
141 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
142 calibCE.ProcessEvent(rawReader);
151 printf ("%d events processed\n",nevents);
153 TFile * fileTPC = new TFile (RESULT_FILE,"recreate");
154 calibCE.Write("calibCE");
156 printf("Wrote %s\n",RESULT_FILE);
158 /* store the result file on FES */
160 status=daqDA_FES_storeFile(RESULT_FILE,RESULT_FILE);