3 Contact: r.bailhache@gsi.de
8 Number of events needed: many
9 Input Files: TRD raw files
10 Output Files: trdCalibrationhcs.root
11 Trigger types used: PHYSICS_EVENT
15 #define RESULT_FILE "trdHalfChamberStatus.root"
16 #define FILE_ID "HALFCHAMBERSTATUS"
31 #include <TStopwatch.h>
33 #include "TPluginManager.h"
37 #include "AliRawReader.h"
38 #include "AliRawReaderDate.h"
39 #include "AliTRDrawFastStream.h"
40 #include "AliTRDrawStreamBase.h"
41 //#include "AliCDBManager.h"
49 // AliRoot TRD calib classes
51 #include "AliTRDCalibChamberStatus.h"
53 //functios, implementation below
54 //void SendToAmoreDB(TObject *o, unsigned long32 runNb);
57 Arguments: list of DATE raw data files
59 int main(int argc, char **argv) {
61 /* magic line from Rene */
62 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
71 /* log start of process */
72 printf("TRD DA HALFCHAMBERSTATUS started\n");
75 /* check that we got some arguments = list of files */
77 printf("Wrong number of arguments\n");
82 /* copy locally a file from daq detector config db */
83 //status=daqDA_DB_getFile("myconfig","./myconfig.txt");
85 // printf("Failed to get config file : %d\n",status);
88 /* and possibly use it */
91 /* init some counters */
95 //Instance of AliCDBManager: needed by AliTRDRawStream
96 //AliCDBManager *man = AliCDBManager::Instance();
97 //man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
99 // AliTRDCalibPadStatus object
100 AliTRDCalibChamberStatus calipad = AliTRDCalibChamberStatus();
102 //unsigned long32 runNb=0; //run number
105 AliTRDrawFastStream::DisableSkipData();
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;
123 eventTypeType eventT;
126 status=monitorGetEventDynamic((void **)&event);
127 if (status==MON_ERR_EOF) {
128 printf("End of File %d detected\n",n);
129 break; /* end of monitoring file has been reached */
132 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
136 /* retry if got no event */
141 /* use event - here, just write event id to result file */
142 eventT=event->eventType;
144 if(eventT==PHYSICS_EVENT){
146 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
147 rawReader->Select("TRD");
149 calipad.ProcessEvent((AliRawReader *) rawReader,nevents);
157 // get the run number
158 //runNb = event->eventRunNb;
166 /* report progress */
167 printf("%d events processed and %d used\n",nevents_total,nevents);
169 /* write file in any case to see what happens in case of problems*/
170 TFile *fileTRD = new TFile(RESULT_FILE,"recreate");
171 calipad.AnalyseHisto();
172 calipad.Write("calibchamberstatus");
175 /* store the result file on FES */
176 status=daqDA_FES_storeFile(RESULT_FILE,FILE_ID);
178 printf("Failed to export file : %d\n",status);