3 Contact: r.bailhache@gsi.de
8 Number of events needed: 100
9 Input Files: TRD raw files
10 Output Files: trdCalibration.root
15 #define RESULT_FILE "trdPedestal.root"
16 #define FILE_ID "PADSTATUS"
31 #include <TStopwatch.h>
33 #include "TPluginManager.h"
37 #include "AliRawReader.h"
38 #include "AliRawReaderDate.h"
39 #include "AliTRDrawStreamTB.h"
40 #include "AliTRDrawStreamBase.h"
41 #include "AliCDBManager.h"
43 // AliRoot TRD calib classes
45 #include "AliTRDCalibPadStatus.h"
49 Arguments: list of DATE raw data files
51 int main(int argc, char **argv) {
53 /* magic line from Rene */
54 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
63 /* log start of process */
64 printf("TRD DA PEDESTAL started\n");
67 /* check that we got some arguments = list of files */
69 printf("Wrong number of arguments\n");
74 /* copy locally a file from daq detector config db */
75 //status=daqDA_DB_getFile("myconfig","./myconfig.txt");
77 // printf("Failed to get config file : %d\n",status);
80 /* and possibly use it */
83 /* init some counters */
87 //Instance of AliCDBManager: needed by AliTRDRawStream
88 //AliCDBManager *man = AliCDBManager::Instance();
89 //man->SetDefaultStorage("local://$ALICE_ROOT");
91 // AliTRDCalibPadStatus object
92 AliTRDCalibPadStatus calipad = AliTRDCalibPadStatus();
93 Bool_t passpadstatus = kTRUE;
96 // AliTRDrawStreamTB::SetNoDebug();
97 AliTRDrawStreamTB::SetNoErrorWarning();
98 //AliTRDrawStreamTB::SetForceCleanDataOnly();
99 AliTRDrawStreamTB::AllowCorruptedData();
100 AliTRDrawStreamTB::DisableStackNumberChecker();
101 AliTRDrawStreamTB::DisableStackLinkNumberChecker();
102 //AliTRDrawStreamTB::SetSkipCDH();
103 //AliTRDrawStreamTB::SetExtraWordsFix();
104 //AliTRDrawStreamTB::EnableDebugStream();
105 //AliTRDrawStreamTB::SetDumpHead(320);
106 //AliTRDrawStreamTB::SetDumpHead(80);
108 /* read the data files */
110 for (n=1;n<argc;n++) {
112 /* define data source : this is argument i */
113 printf("Processing file %s\n",argv[n]);
114 status=monitorSetDataSource( argv[n] );
116 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
120 /* read the file until EOF */
122 struct eventHeaderStruct *event;
125 status=monitorGetEventDynamic((void **)&event);
126 if (status==MON_ERR_EOF) {
127 printf("End of File %d detected\n",n);
128 break; /* end of monitoring file has been reached */
131 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
135 /* retry if got no event */
142 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
143 rawReader->Select("TRD");
144 AliTRDrawStreamTB *trdRawStream = new AliTRDrawStreamTB((AliRawReader *)rawReader);
145 //trdRawStream->Init();
146 if(!calipad.ProcessEvent((AliTRDrawStreamBase *)trdRawStream,(Bool_t)nevents_total)) passpadstatus = kFALSE;
161 /* report progress */
162 printf("%d events processed and %d used\n",nevents_total,nevents);
164 /* 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");
170 /* store the result file on FES */
171 status=daqDA_FES_storeFile(RESULT_FILE,FILE_ID);
173 printf("Failed to export file : %d\n",status);