3 TPCda_pulser.cxx - calibration algorithm for TPC pulser events
5 10/06/2007 sylvain.chapeland@cern.ch : first version - clean skeleton based on DAQ DA case1
6 30/09/2007 haavard.helstrup@cern.ch : created pulser DA based on pedestal code
8 contact: marian.ivanov@cern.ch
11 This process reads RAW data from the files provided as command line arguments
12 and save results in a file (named from RESULT_FILE define - see below).
16 #define RESULT_FILE "tpcPulser.root"
30 #include "TPluginManager.h"
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 "AliTPCCalibPulser.h"
52 Arguments: list of DATE raw data files
54 int main(int argc, char **argv) {
56 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
64 AliTPCCalibPulser calibPulser; // pedestal and noise calibration
67 printf("Wrong number of arguments\n");
72 /* log start of process */
73 printf("TPC Pulser DA started - %s\n",__FILE__);
76 /* declare monitoring program */
77 status=monitorDeclareMp( __FILE__ );
79 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
84 /* loop over RAW data files */
88 /* define data source : this is argument i */
89 printf("Processing file %s\n", argv[i]);
90 status=monitorSetDataSource( argv[i] );
92 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
98 struct eventHeaderStruct *event;
100 /* check shutdown condition */
101 if (daqDA_checkShutdown()) {break;}
103 /* get next event (blocking call until timeout) */
104 status=monitorGetEventDynamic((void **)&event);
105 if (status==MON_ERR_EOF) {
106 printf ("End of File %d detected\n",i);
107 break; /* end of monitoring file has been reached */
111 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
115 /* retry if got no event */
121 // Pulser calibration
123 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
124 calibPulser.ProcessEvent(rawReader);
132 calibPulser.Analyse();
133 printf ("%d events processed\n",nevents);
135 TFile * fileTPC = new TFile (RESULT_FILE,"recreate");
136 calibPulser.Write("calibPulser");
138 printf("Wrote %s\n",RESULT_FILE);