3 Contact: r.bailhache@gsi.de
4 Link: http://www-linux.gsi.de/~bailhach/PEDESTAL/raw.root.date
5 Run Type: dedicated pedestals run
7 Number of events needed: 100
8 Input Files: no config files, no previous result files, RAW DATA files from DDL = 1024 to DDL = 1041 included
9 Output Files: trdCalibration.root, trdCalibration.root, no persitent file over runs
10 Trigger types used: PEDESTAL_RUN
14 #define RESULT_FILE "trdCalibration.root"
29 #include <TStopwatch.h>
34 #include "AliRawReader.h"
35 #include "AliRawReaderDate.h"
36 #include "AliTRDrawStreamTB.h"
37 #include "AliTRDrawStreamBase.h"
38 #include "AliCDBManager.h"
40 // AliRoot TRD calib classes
42 #include "AliTRDCalibPadStatus.h"
46 Arguments: list of DATE raw data files
48 int main(int argc, char **argv) {
53 /* log start of process */
54 printf("TRD DA PEDESTAL started\n");
57 /* check that we got some arguments = list of files */
59 printf("Wrong number of arguments\n");
64 /* copy locally a file from daq detector config db */
65 //status=daqDA_DB_getFile("myconfig","./myconfig.txt");
67 // printf("Failed to get config file : %d\n",status);
70 /* and possibly use it */
73 /* init some counters */
77 //Instance of AliCDBManager: needed by AliTRDRawStream
78 //AliCDBManager *man = AliCDBManager::Instance();
79 //man->SetDefaultStorage("local://$ALICE_ROOT");
81 // AliTRDCalibPadStatus object
82 AliTRDCalibPadStatus calipad = AliTRDCalibPadStatus();
83 Bool_t passpadstatus = kTRUE;
91 // AliTRDrawStreamTB::SetNoDebug();
92 AliTRDrawStreamTB::SetNoErrorWarning();
93 AliTRDrawStreamTB::SetForceCleanDataOnly();
94 AliTRDrawStreamTB::AllowCorruptedData();
95 //AliTRDrawStreamTB::SetSkipCDH();
96 //AliTRDrawStreamTB::SetExtraWordsFix();
97 //AliTRDrawStreamTB::EnableDebugStream();
98 //AliTRDrawStreamTB::SetDumpHead(320);
99 //AliTRDrawStreamTB::SetDumpHead(80);
101 /* read the data files */
103 for (n=1;n<argc;n++) {
105 /* define data source : this is argument i */
106 printf("Processing file %s\n",argv[n]);
107 status=monitorSetDataSource( argv[n] );
109 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
113 /* read the file until EOF */
115 struct eventHeaderStruct *event;
118 status=monitorGetEventDynamic((void **)&event);
119 if (status==MON_ERR_EOF) {
120 printf("End of File %d detected\n",n);
121 break; /* end of monitoring file has been reached */
124 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
128 /* retry if got no event */
135 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
136 rawReader->Select("TRD");
137 AliTRDrawStreamTB *trdRawStream = new AliTRDrawStreamTB((AliRawReader *)rawReader);
138 //trdRawStream->Init();
139 if(!calipad.ProcessEvent((AliTRDrawStreamBase *)trdRawStream,(Bool_t)nevents_total)) passpadstatus = kFALSE;
154 /* report progress */
155 printf("%d events processed and %d used\n",nevents_total,nevents);
161 /* write file in any case to see what happens in case of problems*/
165 TFile *fileTRD = new TFile(RESULT_FILE,"recreate");
166 calipad.AnalyseHisto();
167 calipad.Write("calibpadstatus");
169 printf("Wrote local file %s\n",RESULT_FILE);
174 /* store the result file on FES */
175 status=daqDA_FES_storeFile(RESULT_FILE,RESULT_FILE);
177 printf("Failed to export file : %d\n",status);
182 /* report progress */
183 daqDA_progressReport(100);