2 contact: Boris.Polishchuk@cern.ch
3 link: http://aliceinfo.cern.ch/static/phpBB3/viewtopic.php?f=4&t=17
4 reference run: /castor/cern.ch/alice/phos/2007/10/02/13/07000008232001.10.root
7 number of events needed: 1000
8 input files: RCU0.data RCU1.data RCU2.data RCU3.data
9 Output files: PHOS_Module2_BCM.root
10 Trigger types used: CALIBRATION_EVENT or PHYSICS
25 #include <TPluginManager.h>
27 #include "AliRawReader.h"
28 #include "AliRawReaderDate.h"
29 #include "AliPHOSDA2.h"
30 #include "AliPHOSRawDecoderv1.h"
31 #include "AliCaloAltroMapping.h"
36 1- monitoring data source
38 int main(int argc, char **argv) {
40 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
49 printf("Wrong number of arguments\n");
54 /* Retrieve mapping files from DAQ DB */
55 const char* mapFiles[4] = {"RCU0.data","RCU1.data","RCU2.data","RCU3.data"};
57 for(Int_t iFile=0; iFile<4; iFile++) {
58 int failed = daqDA_DB_getFile(mapFiles[iFile], mapFiles[iFile]);
60 printf("Cannot retrieve file %s from DAQ DB. Exit.\n",mapFiles[iFile]);
65 /* Open mapping files */
66 AliAltroMapping *mapping[4];
70 for(Int_t i = 0; i < 4; i++) {
74 mapping[i] = new AliCaloAltroMapping(path2.Data());
78 /* define data source : this is argument 1 */
79 status=monitorSetDataSource( argv[1] );
81 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
86 /* declare monitoring program */
87 status=monitorDeclareMp( __FILE__ );
89 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
94 /* define wait event timeout - 1s max */
96 monitorSetNoWaitNetworkTimeout(1000);
99 /* log start of process */
100 printf("DA2 (bad channels search) started.\n");
103 /* init some counters */
104 int nevents_physics=0;
107 AliRawReader *rawReader = NULL;
109 AliPHOSDA2* da2 = new AliPHOSDA2(2); // DA2 ("Checking for bad channels") for module2
111 Float_t q[64][56][2];
118 /* main loop (infinite) */
120 struct eventHeaderStruct *event;
121 eventTypeType eventT;
123 /* check shutdown condition */
124 if (daqDA_checkShutdown()) {break;}
126 /* get next event (blocking call until timeout) */
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 */
134 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
138 /* retry if got no event */
144 /* use event - here, just write event id to result file */
145 eventT=event->eventType;
147 if (eventT==PHYSICS_EVENT || eventT==CALIBRATION_EVENT) {
149 for(Int_t iX=0; iX<64; iX++) {
150 for(Int_t iZ=0; iZ<56; iZ++) {
151 for(Int_t iGain=0; iGain<2; iGain++) {
152 q[iX][iZ][iGain] = 0.;
159 rawReader = new AliRawReaderDate((void*)event);
160 AliPHOSRawDecoderv1 dc(rawReader,mapping);
161 dc.SubtractPedestals(kTRUE);
163 while(dc.NextDigit()) {
166 Z = dc.GetColumn() - 1;
168 if(dc.IsLowGain()) gain = 0;
172 q[X][Z][gain] = dc.GetSampleQuality();
174 if(gain && dc.GetEnergy()>40)
179 da2->FillQualityHistograms(q);
180 da2->FillFiredCellsHistogram(nFired);
181 //da1.UpdateHistoFile();
192 /* exit when last event received, no need to wait for TERM signal */
193 if (eventT==END_OF_RUN) {
194 printf("EOR event detected\n");
199 for(Int_t i = 0; i < 4; i++) delete mapping[i];
201 /* Be sure that all histograms are saved */
204 /* Store output files to the File Exchange Server */
205 daqDA_FES_storeFile("PHOS_Module2_BCM.root","BAD_CHANNELS");