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"
42 //#include "AliCDBManager.h"
50 // AliRoot TRD calib classes
52 #include "AliTRDCalibChamberStatus.h"
54 //functios, implementation below
55 //void SendToAmoreDB(TObject *o, unsigned long32 runNb);
58 Arguments: list of DATE raw data files
60 int main(int argc, char **argv) {
62 /* magic line from Rene */
63 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
72 /* log start of process */
73 printf("TRD DA HALFCHAMBERSTATUS started\n");
76 printf("Wrong number of arguments\n");
81 /* define data source : this is argument 1 */
82 status=monitorSetDataSource( argv[1] );
84 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
89 /* declare monitoring program */
90 status=monitorDeclareMp( __FILE__ );
92 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
97 /* define wait event timeout - 1s max */
99 monitorSetNoWaitNetworkTimeout(1000);
101 /* init some counters */
105 //Instance of AliCDBManager: needed by AliTRDRawStream
106 //AliCDBManager *man = AliCDBManager::Instance();
107 //man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
109 // AliTRDCalibPadStatus object
110 AliTRDCalibChamberStatus calipad = AliTRDCalibChamberStatus();
112 //unsigned long32 runNb=0; //run number
115 AliTRDrawFastStream::DisableSkipData();
116 AliLog::SetGlobalLogLevel(AliLog::kFatal);
118 /* read the file until EOF */
120 struct eventHeaderStruct *event;
121 eventTypeType eventT;
123 /* check shutdown condition */
124 if (daqDA_checkShutdown()) {break;}
127 status=monitorGetEventDynamic((void **)&event);
128 if (status==MON_ERR_EOF) {
129 printf("End of File detected\n");
130 break; /* end of monitoring file has been reached */
133 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
137 /* retry if got no event */
142 /* use event - here, just write event id to result file */
143 eventT=event->eventType;
145 if(eventT==PHYSICS_EVENT){
147 AliRawReader *rawReader = new AliRawReaderDate((void*)event);
148 rawReader->Select("TRD");
150 calipad.ProcessEvent((AliRawReader *) rawReader,nevents);
158 // get the run number
159 //runNb = event->eventRunNb;
164 /* exit when last event received, no need to wait for TERM signal */
165 if (eventT==END_OF_RUN) {
166 printf("EOR event detected\n");
172 /* report progress */
173 printf("%d events processed and %d used\n",nevents_total,nevents);
175 /* write file in any case to see what happens in case of problems*/
176 TFile *fileTRD = new TFile(RESULT_FILE,"recreate");
177 calipad.AnalyseHisto();
178 calipad.Write("calibchamberstatus");
181 /* store the result file on FES */
182 status=daqDA_FES_storeFile(RESULT_FILE,FILE_ID);
184 printf("Failed to export file : %d\n",status);