3 Contact: r.bailhache@gsi.de
7 Number of events needed: 100
8 Input Files: raw files of the TRD
9 Output Files: trdCalibration.root,to be exported to the DAQ FXS
14 #define RESULT_FILE "trdCalibration.root"
29 #include <TStopwatch.h>
31 #include "TPluginManager.h"
35 #include "AliRawReader.h"
36 #include "AliRawReaderDate.h"
37 #include "AliTRDrawStreamTB.h"
38 #include "AliTRDrawStreamBase.h"
39 #include "AliCDBManager.h"
41 // AliRoot TRD calib classes
43 #include "AliTRDCalibPadStatus.h"
47 Arguments: list of DATE raw data files
49 int main(int argc, char **argv) {
51 /* magic line from Rene */
52 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
61 /* log start of process */
62 printf("TRD DA PEDESTAL started\n");
65 /* check that we got some arguments = list of files */
67 printf("Wrong number of arguments\n");
72 /* copy locally a file from daq detector config db */
73 //status=daqDA_DB_getFile("myconfig","./myconfig.txt");
75 // printf("Failed to get config file : %d\n",status);
78 /* and possibly use it */
81 /* init some counters */
85 //Instance of AliCDBManager: needed by AliTRDRawStream
86 //AliCDBManager *man = AliCDBManager::Instance();
87 //man->SetDefaultStorage("local://$ALICE_ROOT");
89 // AliTRDCalibPadStatus object
90 AliTRDCalibPadStatus calipad = AliTRDCalibPadStatus();
91 Bool_t passpadstatus = kTRUE;
94 // AliTRDrawStreamTB::SetNoDebug();
95 AliTRDrawStreamTB::SetNoErrorWarning();
96 AliTRDrawStreamTB::SetForceCleanDataOnly();
97 AliTRDrawStreamTB::AllowCorruptedData();
98 //AliTRDrawStreamTB::SetSkipCDH();
99 //AliTRDrawStreamTB::SetExtraWordsFix();
100 //AliTRDrawStreamTB::EnableDebugStream();
101 //AliTRDrawStreamTB::SetDumpHead(320);
102 //AliTRDrawStreamTB::SetDumpHead(80);
104 /* read the data files */
106 for (n=1;n<argc;n++) {
108 /* define data source : this is argument i */
109 printf("Processing file %s\n",argv[n]);
110 status=monitorSetDataSource( argv[n] );
112 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
116 /* read the file until EOF */
118 struct eventHeaderStruct *event;
121 status=monitorGetEventDynamic((void **)&event);
122 if (status==MON_ERR_EOF) {
123 printf("End of File %d detected\n",n);
124 break; /* end of monitoring file has been reached */
127 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
131 /* retry if got no event */
138 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
139 rawReader->Select("TRD");
140 AliTRDrawStreamTB *trdRawStream = new AliTRDrawStreamTB((AliRawReader *)rawReader);
141 //trdRawStream->Init();
142 if(!calipad.ProcessEvent((AliTRDrawStreamBase *)trdRawStream,(Bool_t)nevents_total)) passpadstatus = kFALSE;
157 /* report progress */
158 printf("%d events processed and %d used\n",nevents_total,nevents);
160 /* write file in any case to see what happens in case of problems*/
161 TFile *fileTRD = new TFile(RESULT_FILE,"recreate");
162 calipad.AnalyseHisto();
163 calipad.Write("calibpadstatus");
166 /* store the result file on FES */
167 status=daqDA_FES_storeFile(RESULT_FILE,RESULT_FILE);
169 printf("Failed to export file : %d\n",status);