2 contact: Boris.Polishchuk@cern.ch
3 link: see comments in the $ALICE_ROOT/PHOS/AliPHOSRcuDA1.cxx
4 reference run: /castor/cern.ch/alice/phos/2007/10/04/18/07000008249001.1000.root
5 run type: PHYSICS, STANDALONE
7 number of events needed: 1000
8 input files: RCU0.data RCU1.data RCU2.data RCU3.data
9 Output files: PHOS_Module2_Calib.root
10 trigger types used: L0
25 #include "AliRawReader.h"
26 #include "AliRawReaderDate.h"
27 #include "AliPHOSRcuDA1.h"
28 #include "AliPHOSRawDecoder.h"
29 #include "AliCaloAltroMapping.h"
34 1- monitoring data source
36 int main(int argc, char **argv) {
41 printf("Wrong number of arguments\n");
45 /* Open mapping files */
46 AliAltroMapping *mapping[4];
50 for(Int_t i = 0; i < 4; i++) {
54 mapping[i] = new AliCaloAltroMapping(path2.Data());
58 /* define data source : this is argument 1 */
59 status=monitorSetDataSource( argv[1] );
61 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
66 /* declare monitoring program */
67 status=monitorDeclareMp( __FILE__ );
69 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
74 /* define wait event timeout - 1s max */
76 monitorSetNoWaitNetworkTimeout(1000);
78 /* init some counters */
79 int nevents_physics=0;
82 AliRawReader *rawReader = NULL;
84 AliPHOSRcuDA1 da1(2,-1); // DA1 (Calibration DA) for module2
93 /* main loop (infinite) */
95 struct eventHeaderStruct *event;
98 /* check shutdown condition */
99 if (daqDA_checkShutdown()) {break;}
101 /* get next event (blocking call until timeout) */
102 status=monitorGetEventDynamic((void **)&event);
103 if (status==MON_ERR_EOF) {
104 printf ("End of File detected\n");
105 break; /* end of monitoring file has been reached */
109 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
113 /* retry if got no event */
119 /* use event - here, just write event id to result file */
120 eventT=event->eventType;
122 if (eventT==PHYSICS_EVENT) {
124 for(Int_t iX=0; iX<64; iX++) {
125 for(Int_t iZ=0; iZ<56; iZ++) {
126 for(Int_t iGain=0; iGain<2; iGain++) {
127 e[iX][iZ][iGain] = 0.;
128 t[iX][iZ][iGain] = 0.;
133 rawReader = new AliRawReaderDate((void*)event);
134 // AliPHOSRawDecoderv1 dc(rawReader,mapping);
135 AliPHOSRawDecoder dc(rawReader,mapping);
136 dc.SubtractPedestals(kTRUE);
138 while(dc.NextDigit()) {
141 Z = dc.GetColumn() - 1;
143 if(dc.IsLowGain()) gain = 0;
147 e[X][Z][gain] = dc.GetEnergy();
148 t[X][Z][gain] = dc.GetTime();
152 da1.FillHistograms(e,t);
153 //da1.UpdateHistoFile();
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");
171 for(Int_t i = 0; i < 4; i++) delete mapping[i];