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 number of events needed: 1000
9 input files: Mod0RCU0.data Mod0RCU1.data Mod0RCU2.data Mod0RCU3.data Mod1RCU0.data Mod1RCU1.data Mod1RCU2.data Mod1RCU3.data Mod2RCU0.data Mod2RCU1.data Mod2RCU2.data Mod2RCU3.data Mod3RCU0.data Mod3RCU1.data Mod3RCU2.data Mod3RCU3.data Mod4RCU0.data Mod4RCU1.data Mod4RCU2.data Mod4RCU3.data
10 Output files: PHOS_Module2_BCM.root
11 Trigger types used: CALIBRATION_EVENT
26 #include <TPluginManager.h>
28 #include "AliRawReader.h"
29 #include "AliRawReaderDate.h"
30 #include "AliPHOSDA2.h"
31 #include "AliPHOSRawFitterv1.h"
32 #include "AliCaloAltroMapping.h"
33 #include "AliCaloRawStreamV3.h"
39 1- monitoring data source
41 int main(int argc, char **argv) {
43 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
49 AliLog::SetGlobalDebugLevel(0) ;
50 AliLog::SetGlobalLogLevel(AliLog::kFatal);
55 printf("Wrong number of arguments\n");
59 short offset, threshold;
61 /* Retrieve mapping files from DAQ DB */
62 const char* mapFiles[20] = {
85 for(Int_t iFile=0; iFile<20; iFile++) {
86 int failed = daqDA_DB_getFile(mapFiles[iFile], mapFiles[iFile]);
88 printf("Cannot retrieve file %s from DAQ DB. Exit.\n",mapFiles[iFile]);
93 /* Open mapping files */
94 AliAltroMapping *mapping[20];
102 for(Int_t iMod = 0; iMod < 5; iMod++) {
107 for(Int_t iRCU=0; iRCU<4; iRCU++) {
111 mapping[iMap] = new AliCaloAltroMapping(path3.Data());
116 /* define data source : this is argument 1 */
117 status=monitorSetDataSource( argv[1] );
119 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
124 /* declare monitoring program */
125 status=monitorDeclareMp( __FILE__ );
127 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
132 /* define wait event timeout - 1s max */
134 monitorSetNoWaitNetworkTimeout(1000);
137 /* log start of process */
138 printf("DA2 (bad channels search) started.\n");
141 /* init some counters */
142 int nevents_physics=0;
145 AliRawReader *rawReader = NULL;
147 AliPHOSDA2* da2 = new AliPHOSDA2(2); // DA2 ("Checking for bad channels") for module2
149 Float_t q[64][56][2];
155 Int_t sigStart, sigLength;
158 /* main loop (infinite) */
160 struct eventHeaderStruct *event;
161 eventTypeType eventT;
163 /* check shutdown condition */
164 if (daqDA_checkShutdown()) {break;}
166 /* get next event (blocking call until timeout) */
167 status=monitorGetEventDynamic((void **)&event);
168 if (status==MON_ERR_EOF) {
169 printf ("End of File detected\n");
170 break; /* end of monitoring file has been reached */
174 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
178 /* retry if got no event */
184 /* use event - here, just write event id to result file */
185 eventT=event->eventType;
187 if (eventT==PHYSICS_EVENT || eventT==CALIBRATION_EVENT) {
189 for(Int_t iX=0; iX<64; iX++) {
190 for(Int_t iZ=0; iZ<56; iZ++) {
191 for(Int_t iGain=0; iGain<2; iGain++) {
192 q[iX][iZ][iGain] = 0.;
199 rawReader = new AliRawReaderDate((void*)event);
200 AliCaloRawStreamV3 stream(rawReader,"PHOS",mapping);
201 AliPHOSRawFitterv1 fitter;
202 fitter.SubtractPedestals(kTRUE); // assume that data is non-ZS
204 while (stream.NextDDL()) {
205 while (stream.NextChannel()) {
207 /* Retrieve ZS parameters from data*/
208 short value = stream.GetAltroCFG1();
209 bool ZeroSuppressionEnabled = (value >> 15) & 0x1;
210 bool AutomaticBaselineSubtraction = (value >> 14) & 0x1;
211 if(ZeroSuppressionEnabled) {
212 offset = (value >> 10) & 0xf;
213 threshold = value & 0x3ff;
214 fitter.SubtractPedestals(kFALSE);
215 fitter.SetAmpOffset(offset);
216 fitter.SetAmpThreshold(threshold);
219 cellX = stream.GetCellX();
220 cellZ = stream.GetCellZ();
221 caloFlag = stream.GetCaloFlag(); // 0=LG, 1=HG, 2=TRU
223 if(caloFlag!=0 && caloFlag!=1) continue; //TRU data!
225 // In case of oscillating signals with ZS, a channel can have several bunches
227 while (stream.NextBunch()) {
229 sigStart = stream.GetStartTimeBin();
230 sigLength = stream.GetBunchLength();
231 fitter.SetChannelGeo(stream.GetModule(),cellX,cellZ,caloFlag);
232 fitter.Eval(stream.GetSignals(),sigStart,sigLength);
233 q[cellX][cellZ][caloFlag] = fitter.GetSignalQuality();
234 printf("q[%d][%d][%d] = %.3f\n",cellX,cellZ,caloFlag,q[cellX][cellZ][caloFlag]);
235 } // End of NextBunch()
237 if(caloFlag==1 && fitter.GetEnergy()>40)
242 da2->FillQualityHistograms(q);
243 da2->FillFiredCellsHistogram(nFired);
244 //da1.UpdateHistoFile();
255 /* exit when last event received, no need to wait for TERM signal */
256 if (eventT==END_OF_RUN) {
257 printf("EOR event detected\n");
262 for(Int_t i = 0; i < 20; i++) delete mapping[i];
264 /* Be sure that all histograms are saved */
267 /* Store output files to the File Exchange Server */
268 daqDA_FES_storeFile("PHOS_Module2_BCM.root","BAD_CHANNELS");