Cleanup of collisions geometries and headers.
[u/mrichter/AliRoot.git] / PHOS / PHOSPEDda.cxx
CommitLineData
9d12ffd1 1/*\r
2contact: Boris.Polishchuk@cern.ch\r
3reference run: /alice/data/2010/LHC10a_PHOS/000112189/raw/10000112189003.10.root\r
4run type: PEDESTAL\r
5DA type: MON \r
6number of events needed: 200\r
7input 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\r
8Output files: PHOS_PED.root\r
e1502193 9Trigger types used: \r
9d12ffd1 10*/\r
11\r
9d12ffd1 12#include "event.h"\r
13#include "monitor.h"\r
14\r
15extern "C" {\r
16#include "daqDA.h"\r
17}\r
18\r
19#include <stdio.h>\r
20#include <stdlib.h>\r
21\r
22#include <TSystem.h>\r
23#include <TROOT.h>\r
24#include <TPluginManager.h>\r
25\r
26#include <TStyle.h>\r
27#include <TFile.h>\r
28#include <TH1F.h>\r
29#include <TH2F.h>\r
30#include <TString.h>\r
31#include "AliRawReader.h"\r
e1502193 32#include "AliRawReaderDate.h"\r
33#include "AliCaloAltroMapping.h"\r
9d12ffd1 34#include "AliCaloRawStreamV3.h"\r
35#include "AliLog.h"\r
36\r
37int main(int argc, char **argv) \r
38{\r
39 // Read raw data, decode it to samples,\r
40 // calculate pedestals from presamples, \r
41 // evaluate the signal amplitude as a maximum sample, \r
42 // and fill histograms with pedestals and amplitudes\r
43\r
44 gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",\r
45 "*",\r
46 "TStreamerInfo",\r
47 "RIO",\r
48 "TStreamerInfo()");\r
49 \r
50 AliLog::SetGlobalDebugLevel(0) ;\r
51 AliLog::SetGlobalLogLevel(AliLog::kFatal);\r
52\r
53 int status;\r
54 \r
55 if (argc!=2) {\r
56 printf("Wrong number of arguments\n");\r
57 return -1;\r
58 }\r
59\r
60 /* Retrieve mapping files from DAQ DB */ \r
61 const char* mapFiles[20] = {\r
62 "Mod0RCU0.data",\r
63 "Mod0RCU1.data",\r
64 "Mod0RCU2.data",\r
65 "Mod0RCU3.data",\r
66 "Mod1RCU0.data",\r
67 "Mod1RCU1.data",\r
68 "Mod1RCU2.data",\r
69 "Mod1RCU3.data",\r
70 "Mod2RCU0.data",\r
71 "Mod2RCU1.data",\r
72 "Mod2RCU2.data",\r
73 "Mod2RCU3.data",\r
74 "Mod3RCU0.data",\r
75 "Mod3RCU1.data",\r
76 "Mod3RCU2.data",\r
77 "Mod3RCU3.data",\r
78 "Mod4RCU0.data",\r
79 "Mod4RCU1.data",\r
80 "Mod4RCU2.data",\r
81 "Mod4RCU3.data"\r
82 };\r
83\r
84 for(Int_t iFile=0; iFile<20; iFile++) {\r
85 int failed = daqDA_DB_getFile(mapFiles[iFile], mapFiles[iFile]);\r
86 if(failed) { \r
87 printf("Cannot retrieve file %s from DAQ DB. Exit.\n",mapFiles[iFile]);\r
88 return -1;\r
89 }\r
90 }\r
91 \r
92 /* Open mapping files */\r
93 AliAltroMapping *mapping[20];\r
94 TString path = "./";\r
95\r
96 path += "Mod";\r
97 TString path2;\r
98 TString path3;\r
99 Int_t iMap = 0;\r
100\r
101 for(Int_t iMod = 0; iMod < 5; iMod++) {\r
102 path2 = path;\r
103 path2 += iMod;\r
104 path2 += "RCU";\r
105\r
106 for(Int_t iRCU=0; iRCU<4; iRCU++) {\r
107 path3 = path2;\r
108 path3 += iRCU;\r
109 path3 += ".data";\r
110 mapping[iMap] = new AliCaloAltroMapping(path3.Data());\r
111 iMap++;\r
112 }\r
113 }\r
114 \r
115 /* define data source : this is argument 1 */ \r
116 status=monitorSetDataSource( argv[1] );\r
117 if (status!=0) {\r
118 printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));\r
119 return -1;\r
120 }\r
121 \r
122 /* declare monitoring program */\r
123 status=monitorDeclareMp( __FILE__ );\r
124 if (status!=0) {\r
125 printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));\r
126 return -1;\r
127 }\r
128 \r
129 /* define wait event timeout - 1s max */\r
130 monitorSetNowait();\r
131 monitorSetNoWaitNetworkTimeout(1000);\r
132 \r
133 /* init some counters */\r
134 int nevents_physics=0;\r
135 int nevents_total=0;\r
136\r
137 AliRawReader * reader = NULL;\r
138 AliCaloRawStreamV3* stream = NULL;\r
139 \r
140 TString baseNamePed ="hPed";\r
141 TString baseTitlePed="Ped in cell (";\r
142 const char* sgain[3]={"LG","HG", "TRU"};\r
143\r
144 const Int_t caloFlagMax=3,modMax=5,cellXMax=64,cellZMax=56;\r
145 TH1F *hPed[5][3][64][56] = {};\r
146\r
147 TH1F *hPedHiMean1m2 = new TH1F("hPedHiMean1m2","Mean pedestals in module 2, high gain" ,100,0.,100.);\r
148 TH1F *hPedHiRMS1m2 = new TH1F("hPedHiRMS1m2" ,"RMS pedestals in module 2, high gain" ,100,0.,50.);\r
149 TH1F *hPedLoMean1m2 = new TH1F("hPedLoMean1m2","Mean pedestals in module 2, low gain" ,100,0.,100.);\r
150 TH1F *hPedLoRMS1m2 = new TH1F("hPedLoRMS1m2" ,"RMS pedestals in module 2, low gain" ,100,0.,50.);\r
151 TH1F *hPedTRUMean1m2 = new TH1F("hPedTRUMean1m2","Mean pedestals in module 2, TRU" ,1000,0.,1000.);\r
152 TH1F *hPedTRURMS1m2 = new TH1F("hPedTRURMS1m2" ,"RMS pedestals in module 2, TRU" ,100,0.,50.);\r
153\r
154 TH1F *hPedHiMean1m3 = new TH1F("hPedHiMean1m3","Mean pedestals in module 3, high gain" ,100,0.,100.);\r
155 TH1F *hPedHiRMS1m3 = new TH1F("hPedHiRMS1m3" ,"RMS pedestals in module 3, high gain" ,100,0.,50.);\r
156 TH1F *hPedLoMean1m3 = new TH1F("hPedLoMean1m3","Mean pedestals in module 3, low gain" ,100,0.,100.);\r
157 TH1F *hPedLoRMS1m3 = new TH1F("hPedLoRMS1m3" ,"RMS pedestals in module 3, low gain" ,100,0.,50.);\r
158 TH1F *hPedTRUMean1m3 = new TH1F("hPedTRUMean1m3","Mean pedestals in module 3, TRU" ,1000,0.,1000.);\r
159 TH1F *hPedTRURMS1m3 = new TH1F("hPedTRURMS1m3" ,"RMS pedestals in module 3, TRU" ,100,0.,50.);\r
160\r
161 TH1F *hPedHiMean1m4 = new TH1F("hPedHiMean1m4","Mean pedestals in module 4, high gain" ,100,0.,100.);\r
162 TH1F *hPedHiRMS1m4 = new TH1F("hPedHiRMS1m4" ,"RMS pedestals in module 4, high gain" ,100,0.,50.);\r
163 TH1F *hPedLoMean1m4 = new TH1F("hPedLoMean1m4","Mean pedestals in module 4, low gain" ,100,0.,100.);\r
164 TH1F *hPedLoRMS1m4 = new TH1F("hPedLoRMS1m4" ,"RMS pedestals in module 4, low gain" ,100,0.,50.);\r
165 TH1F *hPedTRUMean1m4 = new TH1F("hPedTRUMean1m4","Mean pedestals in module 4, TRU" ,1000,0.,1000.);\r
166 TH1F *hPedTRURMS1m4 = new TH1F("hPedTRURMS1m4" ,"RMS pedestals in module 4, TRU" ,100,0.,50.);\r
167\r
168 hPedHiMean1m2->Sumw2();\r
169 hPedHiRMS1m2 ->Sumw2();\r
170 hPedLoMean1m2->Sumw2();\r
171 hPedLoRMS1m2 ->Sumw2();\r
172 hPedTRUMean1m2->Sumw2();\r
173 hPedTRURMS1m2 ->Sumw2();\r
174 hPedHiMean1m3->Sumw2();\r
175 hPedHiRMS1m3 ->Sumw2();\r
176 hPedLoMean1m3->Sumw2();\r
177 hPedLoRMS1m3 ->Sumw2();\r
178 hPedTRUMean1m3->Sumw2();\r
179 hPedTRURMS1m3 ->Sumw2();\r
180 hPedHiMean1m4->Sumw2();\r
181 hPedHiRMS1m4 ->Sumw2();\r
182 hPedLoMean1m4->Sumw2();\r
183 hPedLoRMS1m4 ->Sumw2();\r
184 hPedTRUMean1m4->Sumw2();\r
185 hPedTRURMS1m4 ->Sumw2();\r
186\r
187 TH2F *hPedHiMeanm2 = new TH2F("hPedHiMeanm2","Mean pedestals in module 2, high gain",\r
188 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
189 TH2F *hPedHiRMSm2 = new TH2F("hPedHiRMSm2" ,"R.M.S. of pedestals in module 2, high gain",\r
190 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
191 TH2F *hPedHiNumm2 = new TH2F("hPedHiNumm2" ,"Number of pedestals in module 2, high gain",\r
192 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
193 TH2F *hPedLoMeanm2 = new TH2F("hPedLoMeanm2","Mean pedestals in module 2, low gain",\r
194 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
195 TH2F *hPedLoRMSm2 = new TH2F("hPedLoRMSm2" ,"R.M.S. of pedestals in module 2, low gain",\r
196 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
197 TH2F *hPedLoNumm2 = new TH2F("hPedLoNumm2" ,"Number of pedestals in module 2, low gain",\r
198 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
199\r
200 TH2F *hPedHiMeanm3 = new TH2F("hPedHiMeanm3","Mean pedestals in module 3, high gain",\r
201 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
202 TH2F *hPedHiRMSm3 = new TH2F("hPedHiRMSm3" ,"R.M.S. of pedestals in module 3, high gain",\r
203 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
204 TH2F *hPedHiNumm3 = new TH2F("hPedHiNumm3" ,"Number of pedestals in module 3, high gain",\r
205 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
206 TH2F *hPedLoMeanm3 = new TH2F("hPedLoMeanm3","Mean pedestals in module 3, low gain",\r
207 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
208 TH2F *hPedLoRMSm3 = new TH2F("hPedLoRMSm3" ,"R.M.S. of pedestals in module 3, low gain",\r
209 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
210 TH2F *hPedLoNumm3 = new TH2F("hPedLoNumm3" ,"Number of pedestals in module 3, low gain",\r
211 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
212\r
213 TH2F *hPedHiMeanm4 = new TH2F("hPedHiMeanm4","Mean pedestals in module 4, high gain",\r
214 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
215 TH2F *hPedHiRMSm4 = new TH2F("hPedHiRMSm4" ,"R.M.S. of pedestals in module 4, high gain",\r
216 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
217 TH2F *hPedHiNumm4 = new TH2F("hPedHiNumm4" ,"Number of pedestals in module 4, high gain",\r
218 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
219 TH2F *hPedLoMeanm4 = new TH2F("hPedLoMeanm4","Mean pedestals in module 4, low gain",\r
220 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
221 TH2F *hPedLoRMSm4 = new TH2F("hPedLoRMSm4" ,"R.M.S. of pedestals in module 4, low gain",\r
222 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
223 TH2F *hPedLoNumm4 = new TH2F("hPedLoNumm4" ,"Number of pedestals in module 4, low gain",\r
224 cellXMax,0.,cellXMax, cellZMax,0.,cellZMax);\r
225\r
226 TH1I *hNBunches = new TH1I("hNBunches","Number of bunches",10,0,10);\r
227 TH2I *hHWaddr = new TH2I("hHWaddr","DDL is vs HW addr",216,0,216,4096,0,4096);\r
228 TH1I *hModule = new TH1I("hModule" ,"Module number", 5,0.,5);\r
229\r
230 Int_t runNum=0;\r
231 Int_t module,cellX,cellZ,caloFlag;\r
232\r
233 /* main loop (infinite) */\r
234 for(;;) {\r
235 struct eventHeaderStruct *event;\r
236 eventTypeType eventT;\r
237 \r
238 /* check shutdown condition */\r
239 if (daqDA_checkShutdown()) {break;}\r
240 \r
241 /* get next event (blocking call until timeout) */\r
242 status=monitorGetEventDynamic((void **)&event);\r
243 if (status==MON_ERR_EOF) {\r
244 printf ("End of File detected\n");\r
245 break; /* end of monitoring file has been reached */\r
246 }\r
247 \r
248 if (status!=0) {\r
249 printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));\r
250 break;\r
251 }\r
252 \r
253 /* retry if got no event */\r
254 if (event==NULL) {\r
255 continue;\r
256 }\r
257\r
258 /* use event - here, just write event id to result file */\r
259 eventT=event->eventType;\r
260 \r
261 if (eventT==PHYSICS_EVENT) {\r
e1502193 262 \r
9d12ffd1 263 reader = new AliRawReaderDate((void*)event);\r
264 stream = new AliCaloRawStreamV3(reader,"PHOS",mapping);\r
265\r
e1502193 266 runNum = reader->GetRunNumber();\r
267 while (stream->NextDDL()) {\r
268 while (stream->NextChannel()) {\r
269 module = stream->GetModule();\r
270 cellX = stream->GetCellX();\r
271 cellZ = stream->GetCellZ();\r
272 caloFlag = stream->GetCaloFlag();\r
273 if (caloFlag!=0 && caloFlag!=1) continue;\r
274\r
275 hHWaddr->Fill(stream->GetDDLNumber(),stream->GetHWAddress());\r
276 hModule->Fill(module);\r
277 if (!hPed[module][caloFlag][cellX][cellZ]) {\r
278 TString name = baseNamePed;\r
279 TString title = baseTitlePed;\r
280 name +="_g"; name +=caloFlag;\r
281 name +="_m"; name +=module;\r
282 name +="_x"; name +=cellX;\r
283 name +="_z"; name +=cellZ;\r
284 \r
285 title +=module; title +=",";\r
286 title +=cellX; title +=",";\r
287 title +=cellZ; title +="), ";\r
288 title +=sgain[caloFlag];\r
289 \r
290 hPed[module][caloFlag][cellX][cellZ] = new TH1F(name,title,100,0.,100.);\r
291 hPed[module][caloFlag][cellX][cellZ]->Sumw2();\r
292 hPed[module][caloFlag][cellX][cellZ]->SetMarkerStyle(20);\r
293 hPed[module][caloFlag][cellX][cellZ]->SetOption("eph");\r
294 }\r
295 \r
296 Int_t nBunches = 0;\r
297 while (stream->NextBunch()) {\r
298 nBunches++;\r
299 const UShort_t *sig = stream->GetSignals();\r
300 Int_t sigLength = stream->GetBunchLength();\r
301 for (Int_t i = 0; i < sigLength; i++) {\r
302 hPed[module][caloFlag][cellX][cellZ]->Fill(sig[i]);\r
9d12ffd1 303 }\r
304 }\r
e1502193 305 hNBunches->Fill(nBunches);\r
306 } // end of NextChannel()\r
307 } // end of NextDDL()\r
9d12ffd1 308 \r
e1502193 309 delete reader; \r
9d12ffd1 310 delete stream;\r
311 nevents_physics++;\r
e1502193 312 } // end of if(eventT==PHYSICS_EVENT)\r
9d12ffd1 313 \r
314 nevents_total++;\r
315 \r
316 /* free resources */\r
317 free(event);\r
318 \r
319 /* exit when last event received, no need to wait for TERM signal */\r
320 if (eventT==END_OF_RUN) {\r
321 printf("EOR event detected\n");\r
322 break;\r
323 }\r
324\r
325 } // end of inf. loop over events\r
326 \r
327 for(Int_t i = 0; i < 20; i++) delete mapping[i];\r
e1502193 328\r
329 // Fill 2-dim histograms for mean, rms and n pedestals\r
330 \r
331 for (Int_t mod=2; mod<=4; mod++) {\r
332 for (Int_t caloFlag=0; caloFlag<2; caloFlag++) {\r
333 for (Int_t cellX=0; cellX<cellXMax; cellX++) {\r
334 for (Int_t cellZ=0; cellZ<cellZMax; cellZ++) {\r
335 if (hPed[mod][caloFlag][cellX][cellZ] != 0) {\r
336 if (caloFlag == 0) {\r
337 if (mod==2) {\r
338 hPedLoMean1m2->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
339 hPedLoRMS1m2 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
340 hPedLoMeanm2 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
341 hPedLoRMSm2 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
342 hPedLoNumm2 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
343 }\r
344 else if (mod==3) {\r
345 hPedLoMean1m3->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
346 hPedLoRMS1m3 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
347 hPedLoMeanm3 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
348 hPedLoRMSm3 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
349 hPedLoNumm3 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
350 }\r
351 else if (mod==4) {\r
352 hPedLoMean1m4->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
353 hPedLoRMS1m4 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
354 hPedLoMeanm4 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
355 hPedLoRMSm4 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
356 hPedLoNumm4 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
357 }\r
358 }\r
359 else if (caloFlag == 1) {\r
360 if (mod==2) {\r
361 hPedHiMean1m2->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
362 hPedHiRMS1m2 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
363 hPedHiMeanm2 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
364 hPedHiRMSm2 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
365 hPedHiNumm2 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
366 }\r
367 if (mod==3) {\r
368 hPedHiMean1m3->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
369 hPedHiRMS1m3 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
370 hPedHiMeanm3 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
371 hPedHiRMSm3 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
372 hPedHiNumm3 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
373 }\r
374 if (mod==4) {\r
375 hPedHiMean1m4->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
376 hPedHiRMS1m4 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
377 hPedHiMeanm4 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
378 hPedHiRMSm4 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetRMS());\r
379 hPedHiNumm4 ->Fill( cellX, cellZ, hPed[mod][caloFlag][cellX][cellZ]->GetEntries());\r
380 }\r
381 }\r
382 else if (caloFlag == 2) {\r
383 if (mod==2) {\r
384 hPedTRUMean1m2->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
385 hPedTRURMS1m2 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
386 }\r
387 if (mod==3) {\r
388 hPedTRUMean1m3->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
389 hPedTRURMS1m3 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
390 }\r
391 if (mod==4) {\r
392 hPedTRUMean1m4->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetMean());\r
393 hPedTRURMS1m4 ->Fill( hPed[mod][caloFlag][cellX][cellZ]->GetRMS() );\r
394 }\r
395 }\r
396 }\r
397 }\r
398 }\r
399 }\r
400 }\r
9d12ffd1 401 \r
402 // Write existing histograms to a root file\r
403 \r
404 TString fileName = "PHOS_PED.root";\r
405 TFile *file = new TFile(fileName,"RECREATE");\r
406 \r
407 for (Int_t mod=2; mod<=3; mod++) {\r
408 for (Int_t caloFlag=0; caloFlag<caloFlagMax; caloFlag++) {\r
409 for (Int_t mod=0; mod<modMax; mod++) {\r
410 for (Int_t cellX=0; cellX<cellXMax; cellX++) {\r
411 for (Int_t cellZ=0; cellZ<cellZMax; cellZ++) {\r
412 if (hPed[mod][caloFlag][cellX][cellZ] != 0)\r
413 hPed[mod][caloFlag][cellX][cellZ]->Write();\r
414 }\r
415 }\r
416 }\r
417 }\r
418 }\r
419 \r
420 hPedHiMean1m2->Write();\r
421 hPedHiRMS1m2 ->Write();\r
422 hPedLoMean1m2->Write();\r
423 hPedLoRMS1m2 ->Write();\r
424 hPedHiMeanm2 ->Write();\r
425 hPedHiRMSm2 ->Write();\r
426 hPedHiNumm2 ->Write();\r
427 hPedLoMeanm2 ->Write();\r
428 hPedLoRMSm2 ->Write();\r
429 hPedLoNumm2 ->Write();\r
430 hPedTRUMean1m2->Write();\r
431 hPedTRURMS1m2 ->Write();\r
432 \r
433 hPedHiMean1m3->Write();\r
434 hPedHiRMS1m3 ->Write();\r
435 hPedLoMean1m3->Write();\r
436 hPedLoRMS1m3 ->Write();\r
437 hPedHiMeanm3 ->Write();\r
438 hPedHiRMSm3 ->Write();\r
439 hPedHiNumm3 ->Write();\r
440 hPedLoMeanm3 ->Write();\r
441 hPedLoRMSm3 ->Write();\r
442 hPedLoNumm3 ->Write();\r
443 hPedTRUMean1m3->Write();\r
444 hPedTRURMS1m3 ->Write();\r
445\r
446 hPedHiMean1m4->Write();\r
447 hPedHiRMS1m4 ->Write();\r
448 hPedLoMean1m4->Write();\r
449 hPedLoRMS1m4 ->Write();\r
450 hPedHiMeanm4 ->Write();\r
451 hPedHiRMSm4 ->Write();\r
452 hPedHiNumm4 ->Write();\r
453 hPedLoMeanm4 ->Write();\r
454 hPedLoRMSm4 ->Write();\r
455 hPedLoNumm4 ->Write();\r
456 hPedTRUMean1m4->Write();\r
457 hPedTRURMS1m4 ->Write();\r
458\r
459 hNBunches ->Write();\r
460 hHWaddr ->Write();\r
461 hModule ->Write();\r
462 \r
463 file->Close();\r
464 \r
465 /* Store output files to the File Exchange Server */\r
466 daqDA_FES_storeFile(fileName.Data(),"PED");\r
467 \r
468 printf("%d physics events of %d total processed.\n",nevents_physics,nevents_total);\r
469 return status;\r
470}\r