]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/ITSSPDPHYSda.cxx
Resolved problem in method ReadCalibHeader of AliITSRawStreamSPD, needed for the...
[u/mrichter/AliRoot.git] / ITS / ITSSPDPHYSda.cxx
1 /*
2 - Contact: - henrik.tydesjo@cern.ch
3 - Link: - http://tydes.home.cern.ch/tydes/doc/CalibrationOverview/CalibrationAlgorithms/
4 - Run Type: - PHYSICS
5 - DA Type: - MON
6 - Number of events needed:
7 - Input Files: - daq db config files: spd_physics_params ,  previous dead ref: ./calibResults/DeadReferenceTmp/* , previous dead lists: ./calibResults/DeadToFXS/*
8 - Output Files: - Ref Data: ./calibResults/NoisyReference/* ,  Ref Data: ./calibResults/DeadReference/* ,  noisy lists: ./calibResults/NoisyToFXS/* ,  persistent files: ./calibResults/DeadReferenceTmp/*,./calibResults/DeadToFXS/*
9 - Trigger types used: PHYSICS
10 */
11
12 ////////////////////////////////////////////////////////////////////////////////
13 // This program can be compiled in two modes.                                 //
14 //                                                                            //
15 // 1. Online. With the DAQ DA framework. This is the default operating mode.  //
16 //                                                                            //
17 // 2. Offline. Without the DAQ DA framework. Define the SPD_DA_OFF            //
18 //    environment var. Call this program with the name of the executable      //
19 //    followed by the runNr and the data files to process.                    //
20 //                                                                            //
21 ////////////////////////////////////////////////////////////////////////////////
22
23 #ifndef SPD_DA_OFF
24 extern "C" {
25 #include "daqDA.h"
26 }
27 #endif
28 #include "event.h"
29 #include "monitor.h"
30 #include "AliRawReaderDate.h"
31 #include "AliITSRawStreamSPD.h"
32 #include "AliITSOnlineSPDphys.h"
33 #include "AliITSOnlineSPDphysAnalyzer.h"
34 #include "AliITSOnlineCalibrationSPDhandler.h"
35 #include "AliLog.h"
36 #include <iostream>
37 #include <fstream>
38 #include <TROOT.h>
39 #include <TPluginManager.h>
40 #include <TObjArray.h>
41 #include <TString.h>
42
43 int main(int argc, char **argv) {
44   if (argc<2) {
45     printf("Wrong number of arguments\n");
46     return -1;
47   }
48
49   // directory structure, hard coded
50   char *saveDirDead          = "./calibResults/Dead";             // may NOT delete content
51   char *saveDirDeadToFXS     = "./calibResults/DeadToFXS";        //     may delete content
52   char *saveDirDeadRef       = "./calibResults/DeadReference";    //     may delete content
53   char *saveDirDeadRefTmp    = "./calibResults/DeadReferenceTmp"; // may NOT delete content
54   char *saveDirNoisyToFXS    = "./calibResults/NoisyToFXS";       //     may delete content
55   char *saveDirNoisyRef      = "./calibResults/NoisyReference";   //     may delete content
56   char *saveDirIdsToFXS      = "./calibResults/IdsToFXS";         //     may delete content
57   char *configFilesDir       = "./configFiles";                   //     may delete content
58   // make sure the directory structure is put up correctly:
59   system("mkdir ./calibResults >& /dev/null");
60   system("mkdir ./calibResults/Dead >& /dev/null");
61   system("mkdir ./calibResults/DeadToFXS >& /dev/null");
62   system("mkdir ./calibResults/DeadReference >& /dev/null");
63   system("mkdir ./calibResults/DeadReferenceTmp >& /dev/null");
64   system("mkdir ./calibResults/NoisyToFXS >& /dev/null");
65   system("mkdir ./calibResults/NoisyReference >& /dev/null");
66   system("mkdir ./calibResults/IdsToFXS >& /dev/null");
67   system("mkdir ./configFiles >& /dev/null");
68   // parameters config file
69   TString paramsFileName = Form("%s/physics_params.txt",configFilesDir);
70
71   // This line is needed in case of a stand-alone application w/o
72   // $ROOTSYS/etc/system.rootrc file
73   gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
74                                         "*",
75                                         "TStreamerInfo",
76                                         "RIO",
77                                         "TStreamerInfo()");
78
79   // turn off annoying warning messages
80   new AliLog;
81   AliLog::Instance()->SetGlobalDebugLevel(-20);
82
83
84   // ********* STEP 0: Get configuration files from db (if there are any) , then read parameters*********
85   UInt_t nrTuningParams = 0;
86   TObjArray paramNames;  paramNames.SetOwner(kTRUE);
87   TObjArray paramVals;  paramVals.SetOwner(kTRUE);
88   
89   // tuning parameters:
90   Int_t par_status = 0;
91 #ifndef SPD_DA_OFF
92   TString idp = "spd_physics_params";
93   par_status=daqDA_DB_getFile(idp.Data(),paramsFileName.Data());
94   if (par_status) {
95     printf("Failed to get config file %s: status=%d. Using default tuning parameters.\n",idp.Data(),par_status);
96   }
97 #endif
98   if (par_status==0) {
99     ifstream paramsFile;
100     paramsFile.open(paramsFileName.Data(), ifstream::in);
101     if (paramsFile.fail()) {
102       printf("No config file (%s) present. Using default tuning parameters.\n",paramsFileName.Data());
103     }
104     else {
105       while(1) {
106         Char_t paramN[50];
107         Char_t paramV[50];
108         paramsFile >> paramN;
109         if (paramsFile.eof()) break;
110         paramsFile >> paramV;
111         TString* paramNS = new TString(paramN);
112         TString* paramVS = new TString(paramV);
113         paramNames.AddAtAndExpand((TObject*)paramNS,nrTuningParams);
114         paramVals.AddAtAndExpand((TObject*)paramVS,nrTuningParams);
115         nrTuningParams++;
116         if (paramsFile.eof()) break;
117       }
118       paramsFile.close();
119     }
120   }
121   //  for (UInt_t i=0; i<nrTuningParams; i++) {
122   //    printf("Entry %d: N=%s , V=%s\n",i,((TString*)paramNames.At(i))->Data(),((TString*)paramVals.At(i))->Data());
123   //  }
124
125
126
127
128
129   // ********* STEP 1: Produce phys container files (Reference Data). ***********************************
130
131 #ifndef SPD_DA_OFF
132   int runNr = atoi(getenv("DATE_RUN_NUMBER"));
133 #else
134   int runNr = atoi(argv[1]);
135   int startSeg = 2;
136 #endif
137
138
139   // container objects
140   AliITSOnlineSPDphys *physObj[20];
141   Bool_t bPhysInit[20];
142   for (UInt_t eqId=0; eqId<20; eqId++) {
143     physObj[eqId]=NULL;
144     bPhysInit[eqId]=kFALSE;
145   }
146
147
148   // loop over run segments in case of offline mode
149 #ifdef SPD_DA_OFF
150   for (int segNr=startSeg; segNr<argc; segNr++) {
151 #endif
152
153     int status;
154
155     /* define data source : */  
156 #ifndef SPD_DA_OFF
157     status=monitorSetDataSource( argv[1] ); // should be "^SPD" in order to get full detector online
158 #else
159     status=monitorSetDataSource( argv[segNr] );
160 #endif
161     if (status!=0) {
162       printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
163       return -1;
164     }
165     /* declare monitoring program */
166     status=monitorDeclareMp("ITS_SPD_PHYS");
167     if (status!=0) {
168       printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
169       return -1;
170     }
171     /* define wait event timeout - 1s max */
172     monitorSetNowait();
173     monitorSetNoWaitNetworkTimeout(1000);
174
175
176     UInt_t eventNr=0;
177
178     /* main loop (infinite) */
179     for(;;) {
180
181       struct eventHeaderStruct *event;
182       eventTypeType eventT;
183
184       /* check shutdown condition */
185 #ifndef SPD_DA_OFF
186       if (daqDA_checkShutdown()) {break;}
187 #endif
188
189       /* get next event (blocking call until timeout) */
190       status=monitorGetEventDynamic((void **)&event);
191       if (status==MON_ERR_EOF) {
192         printf ("End of File detected\n");
193         break; /* end of monitoring file has been reached */
194       }
195
196       if (status!=0) {
197         printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
198         break;
199       }
200
201       /* retry if got no event */
202       if (event==NULL) {
203         continue;
204       }
205
206       eventT=event->eventType;
207       if (eventT == PHYSICS_EVENT){
208
209         eventNr++;
210         //      printf("eventNr %d\n",eventNr);
211
212         AliRawReader *reader = new AliRawReaderDate((void*)event);
213         AliITSRawStreamSPD *str = new AliITSRawStreamSPD(reader);
214
215         //      for (UInt_t eqId=0; eqId<20; eqId++) {
216         //        reader->Reset();
217         //        reader->Select("ITSSPD",eqId,eqId);
218
219         while (str->Next()) {
220
221           Int_t eqId = reader->GetDDLID();
222           if (eqId>=0 && eqId<20) {
223             if (!bPhysInit[eqId]) {
224               TString fileName = Form("%s/SPDphys_run_%d_eq_%d.root",saveDirNoisyRef,runNr,eqId);
225               physObj[eqId] = new AliITSOnlineSPDphys(fileName.Data());
226               physObj[eqId]->AddRunNr(runNr);
227               physObj[eqId]->SetEqNr(eqId);
228               bPhysInit[eqId]=kTRUE;
229             }
230             
231             UInt_t hs = str->GetHalfStaveNr();
232             UInt_t chip = str->GetChipAddr();
233             physObj[eqId]->IncrementHits(hs,chip,str->GetChipCol(),str->GetChipRow());
234             
235           }
236         }
237         
238         for (UInt_t eqId=0; eqId<20; eqId++) {
239           if (bPhysInit[eqId]) {
240             physObj[eqId]->IncrementNrEvents();
241           }
242         }
243
244         //      }
245
246         delete str;
247         delete reader;
248
249       }
250
251       /* free resources */
252       free(event);
253
254     }
255     
256
257 #ifdef SPD_DA_OFF
258     printf("progress: %d\n",(unsigned int)( ((Float_t)(segNr-startSeg+1))/(argc-startSeg)*50 ));
259   }
260 #endif
261   
262   // clean up phys objects (also saves them)
263   for (UInt_t eqId=0; eqId<20; eqId++) {
264     if (physObj[eqId]!=NULL) delete physObj[eqId];
265   }
266
267
268
269
270
271   // ********* STEP 2: Analyze phys container files. ************************************************
272
273   // clear noisyToFXS dir:
274   TString command;
275   command = Form("cd %s; rm -f *",saveDirNoisyToFXS);
276   system(command.Data());
277   // clear deadToFXS dir:
278   command = Form("cd %s; rm -f *",saveDirDeadToFXS);
279   system(command.Data());
280
281
282   // create calibration handler and read dead from previous calibrations
283   AliITSOnlineCalibrationSPDhandler* handler = new AliITSOnlineCalibrationSPDhandler();
284   handler->SetFileLocation(saveDirDead);
285   handler->ReadDeadFromFiles();
286
287
288   UInt_t firstRunNrDead = runNr;
289
290
291   UInt_t nrEnoughStatNoisy = 0;
292   UInt_t nrEqActiveNoisy = 0;
293   Bool_t eqActiveNoisy[20];
294
295   // *** *** *** start loop over equipments (eq_id)
296   for (UInt_t eqId=0; eqId<20; eqId++) {
297     eqActiveNoisy[eqId] = kFALSE;
298
299     // create analyzer for this eq
300     TString fileName = Form("%s/SPDphys_run_%d_eq_%d.root",saveDirNoisyRef,runNr,eqId);
301     AliITSOnlineSPDphysAnalyzer *noisyAnalyzer = new AliITSOnlineSPDphysAnalyzer(fileName.Data(),handler);
302
303     // check data in container
304     if (noisyAnalyzer->GetEqNr() != eqId) {
305       if (noisyAnalyzer->GetEqNr() != 999) {
306         printf("Error: Mismatching EqId in Container data and filename (%d!=%d). Skipping.\n",
307                noisyAnalyzer->GetEqNr(),eqId);
308       }
309       delete noisyAnalyzer;
310       continue;
311     }
312
313     nrEqActiveNoisy++;
314     eqActiveNoisy[eqId] = kTRUE;
315
316     // configure analyzer with tuning parameters etc:
317     for (UInt_t i=0; i<nrTuningParams; i++) {
318       noisyAnalyzer->SetParam(((TString*)paramNames.At(i))->Data(),((TString*)paramVals.At(i))->Data());
319     }
320
321     printf("SPD phys STEP 2: Noisy search for eq %d\n",eqId);  
322
323     // search for noisy pixels:
324     nrEnoughStatNoisy += noisyAnalyzer->ProcessNoisyPixels();
325
326     // copy this phys obj to temporary dead reference dir to process after noisy search
327     TString fileNameDead = Form("%s/SPDphys_dead_run_0_0_eq_%d.root",saveDirDeadRefTmp,eqId);
328     AliITSOnlineSPDphys* physObj = new AliITSOnlineSPDphys(fileNameDead.Data());
329     physObj->AddPhys(noisyAnalyzer->GetOnlinePhys());
330     if (physObj->GetNrRuns()>0) {
331       UInt_t firstRunNr = physObj->GetRunNr(0);
332       if (firstRunNrDead>firstRunNr) {
333         firstRunNrDead=firstRunNr;
334       }
335     }
336     // remove noisy pixels from dead hitmap
337     for (UInt_t hs=0; hs<6; hs++) {
338       for (UInt_t chip=0; chip<10; chip++) {
339         for (UInt_t ind=0; ind<handler->GetNrNoisyC(eqId,hs,chip); ind++) {
340           UInt_t col  = handler->GetNoisyColAtC(eqId,hs,chip,ind);
341           UInt_t row  = handler->GetNoisyRowAtC(eqId,hs,chip,ind);
342           physObj->AddHits(hs,chip,col,row,-noisyAnalyzer->GetOnlinePhys()->GetHits(hs,chip,col,row));
343         }
344       }
345     }
346
347     delete physObj;
348     delete noisyAnalyzer;
349
350 #ifndef SPD_DA_OFF
351     daqDA_progressReport((unsigned int)((eqId+1)*2.5));
352 #else
353     printf("progress: %d\n",(unsigned int)(50+(eqId+1)*1.25));
354 #endif
355   }
356   // *** *** *** end loop over equipments (eq_id)
357
358   printf("Noisy search finished. %d noisy pixels found. %d chips (%d) had enough statistics.\n",
359          handler->GetNrNoisy(),nrEnoughStatNoisy,nrEqActiveNoisy*60);
360   handler->SetFileLocation(saveDirNoisyToFXS);
361   handler->WriteNoisyToFiles();
362
363
364
365
366
367
368
369
370   UInt_t nrEnoughStatChips = 0;
371   UInt_t nrDeadChips = 0;
372   UInt_t nrInefficientChips = 0;
373   UInt_t nrEqActiveDead = 0;
374   Bool_t eqActiveDead[20];
375
376   // *** *** *** start loop over equipments (eq_id)
377   for (UInt_t eqId=0; eqId<20; eqId++) {
378     eqActiveDead[eqId] = kFALSE;
379
380     // setup analyzer for dead search
381     TString fileNameDead = Form("%s/SPDphys_dead_run_0_0_eq_%d.root",saveDirDeadRefTmp,eqId);
382     AliITSOnlineSPDphys* physObj = new AliITSOnlineSPDphys(fileNameDead.Data());
383     AliITSOnlineSPDphysAnalyzer* deadAnalyzer = new AliITSOnlineSPDphysAnalyzer(physObj,handler);
384     // check data in container
385     if (deadAnalyzer->GetEqNr() != eqId) {
386       if (deadAnalyzer->GetEqNr() != 999) {
387         printf("Error: Mismatching EqId in Dead Container data and filename (%d!=%d). Skipping.\n",
388                deadAnalyzer->GetEqNr(),eqId);
389       }
390       delete deadAnalyzer;
391       continue;
392     }
393
394     nrEqActiveDead++;
395     eqActiveDead[eqId] = kTRUE;
396
397     // configure analyzer with tuning parameters etc:
398     for (UInt_t i=0; i<nrTuningParams; i++) {
399       deadAnalyzer->SetParam(((TString*)paramNames.At(i))->Data(),((TString*)paramVals.At(i))->Data());
400     }
401
402     printf("SPD phys STEP 2: Dead search for eq %d\n",eqId);  
403
404     // search for dead pixels:
405     nrEnoughStatChips += deadAnalyzer->ProcessDeadPixels();
406     nrDeadChips += deadAnalyzer->GetNrDeadChips();
407     nrInefficientChips += deadAnalyzer->GetNrInefficientChips();
408
409     delete deadAnalyzer;
410
411 #ifndef SPD_DA_OFF
412     daqDA_progressReport((unsigned int)(50+(eqId+1)*2.5));
413 #else
414     printf("progress: %d\n",(unsigned int)(75+(eqId+1)*1.25));
415 #endif
416   }
417   // *** *** *** end loop over equipments (eq_id)
418
419   
420   printf("Dead search finished. %d dead pixels in total.\n%d chips (%d) had enough statistics. %d chips were dead. %d chips were inefficient.\n",handler->GetNrDead(),nrEnoughStatChips,nrEqActiveDead*60,nrDeadChips,nrInefficientChips);
421   handler->SetFileLocation(saveDirDead);
422   handler->WriteDeadToFilesAlways();
423
424   handler->SetFileLocation(saveDirDeadToFXS);
425   handler->WriteDeadToFilesAlways();
426 // *** old code (used if not all dead data should be uploaded)
427 //  UInt_t nrDeadFilesToTar = 0;
428 //  handler->SetFileLocation(saveDirDeadToFXS);
429 //  for (UInt_t eqId=0; eqId<20; eqId++) {
430 //    if (eqActiveDead[eqId]) {
431 //      handler->WriteDeadToFile(eqId);
432 //      nrDeadFilesToTar++;
433 //    }
434 //  }
435 //***  
436
437   TString idsFXSFileName = Form("%s/FXSids_run_%d.txt",saveDirIdsToFXS,runNr);
438   ofstream idsFXSfile;
439   idsFXSfile.open(idsFXSFileName.Data());
440
441
442   // if there is no chip in category "needsMoreStat"
443   if (nrEnoughStatChips+nrDeadChips+nrInefficientChips == nrEqActiveDead*60) {
444     // calibration is complete
445     printf("Dead calibration is complete.\n");
446
447
448
449     // send reference data for dead pixels to FXS
450     TString tarFiles = "";
451     for (UInt_t eqId=0; eqId<20; eqId++) {
452       if (eqActiveDead[eqId]) {
453         // move file to ref dir
454         TString fileName = Form("%s/SPDphys_dead_run_0_0_eq_%d.root",saveDirDeadRefTmp,eqId);
455         TString newFileName = Form("%s/SPDphys_dead_run_%d_%d_eq_%d.root",saveDirDeadRef,firstRunNrDead,runNr,eqId);
456         TString command = Form("mv -f %s %s",fileName.Data(),newFileName.Data());
457         system(command.Data());
458
459         tarFiles.Append(Form("SPDphys_dead_run_%d_%d_eq_%d.root ",firstRunNrDead,runNr,eqId));
460       }
461     }
462     TString send_command = Form("cd %s; tar -cf ref_phys_dead.tar %s",saveDirDeadRef,tarFiles.Data());
463     system(send_command.Data());
464     TString fileName = Form("%s/ref_phys_dead.tar",saveDirDeadRef);
465     TString id = "SPD_ref_phys_dead";
466 #ifndef SPD_DA_OFF
467     status = daqDA_FES_storeFile(fileName.Data(),id.Data());
468     if (status!=0) {
469       printf("Failed to export file %s , status %d\n",fileName.Data(),status);
470       return -1;
471     }
472 #endif
473     idsFXSfile << Form("%s\n",id.Data());
474 //    for (UInt_t eqId=0; eqId<20; eqId++) { // OLD CODE NOT TARED
475 //      if (eqActiveDead[eqId]) {
476 //      TString fileName = Form("%s/SPDphys_dead_run_0_0_eq_%d.root",saveDirDeadRefTmp,eqId);
477 //      // move file to ref dir
478 //      TString newFileName = Form("%s/SPDphys_dead_run_%d_%d_eq_%d.root",saveDirDeadRef,firstRunNrDead,runNr,eqId);
479 //      TString command = Form("mv -f %s %s",fileName.Data(),newFileName.Data());
480 //      system(command.Data());
481 //      // send ref data to FXS
482 //      TString id = Form("SPD_ref_phys_dead_%d",eqId);
483 //#ifndef SPD_DA_OFF
484 //      Int_t status = daqDA_FES_storeFile(newFileName.Data(),id.Data());
485 //      if (status!=0) {
486 //        printf("Failed to export file %s , status %d\n",newFileName.Data(),status);
487 //        return -1;
488 //      }
489 //#endif
490 //      idsFXSfile << Form("%s\n",id.Data());
491 //      }
492 //      else {
493 //      TString command = Form("rm -f %s/SPDphys_dead_run_0_0_eq_%d.root",saveDirDeadRefTmp,eqId);
494 //      system(command.Data());
495 //      }
496 //    }
497   }
498
499
500   // send reference data for this run to FXS
501   TString tarFiles = "";
502   for (UInt_t eqId=0; eqId<20; eqId++) {
503     if (eqActiveNoisy[eqId]) {
504       tarFiles.Append(Form("SPDphys_run_%d_eq_%d.root ",runNr,eqId));
505     }
506   }
507   TString send_command = Form("cd %s; tar -cf ref_phys.tar %s",saveDirNoisyRef,tarFiles.Data());
508   system(send_command.Data());
509   TString fileName = Form("%s/ref_phys.tar",saveDirNoisyRef);
510   TString id = "SPD_ref_phys";
511 #ifndef SPD_DA_OFF
512   status = daqDA_FES_storeFile(fileName.Data(),id.Data());
513   if (status!=0) {
514     printf("Failed to export file %s , status %d\n",fileName.Data(),status);
515     return -1;
516   }
517 #endif
518   idsFXSfile << Form("%s\n",id.Data());
519
520
521 //  // send reference data for this run to FXS - OLD CODE NOT TARED
522 //  for (UInt_t eqId=0; eqId<20; eqId++) {
523 //    if (eqActiveNoisy[eqId]) {
524 //      TString fileName = Form("%s/SPDphys_run_%d_eq_%d.root",saveDirNoisyRef,runNr,eqId);
525 //      TString id = Form("SPD_ref_phys_%d",eqId);
526 //#ifndef SPD_DA_OFF
527 //      Int_t status = daqDA_FES_storeFile(fileName.Data(),id.Data());
528 //      if (status!=0) {
529 //      printf("Failed to export file %s , status %d\n",fileName.Data(),status);
530 //      return -1;
531 //      }
532 //      idsFXSfile << Form("%s\n",id.Data());
533 //    }
534 //  }
535 //#endif
536
537
538   // send dead pixels to FXS
539   //  if (nrDeadFilesToTar>0) { //*** old code (used if not all dead data should be uploaded)
540   // send a tared file of all the dead files
541   send_command = Form("cd %s; tar -cf dead_phys.tar *",saveDirDeadToFXS);
542   //  printf("\n\n%s\n\n",command.Data());
543   system(send_command.Data());
544   fileName = Form("%s/dead_phys.tar",saveDirDeadToFXS);
545   id = "SPD_phys_dead";
546 #ifndef SPD_DA_OFF
547   Int_t send_status = daqDA_FES_storeFile(fileName.Data(),id.Data());
548   if (send_status!=0) {
549     printf("Failed to export file %s , status %d\n",fileName.Data(),send_status);
550     return -1;
551   }
552 #endif
553   idsFXSfile << Form("%s\n",id.Data());
554   //  } //*** old code (used if not all dead data should be uploaded)
555
556
557   // send noisy pixels to FXS
558   if (handler->GetNrNoisy()>0) { // there must be at least one file created
559     // send a tared file of all the noisy files
560     TString command = Form("cd %s; tar -cf noisy_phys.tar *",saveDirNoisyToFXS);
561     //    printf("\n\n%s\n\n",command.Data());
562     system(command.Data());
563     TString fileName = Form("%s/noisy_phys.tar",saveDirNoisyToFXS);
564     TString id = "SPD_phys_noisy";
565 #ifndef SPD_DA_OFF
566     status = daqDA_FES_storeFile(fileName.Data(),id.Data());
567     if (status!=0) {
568       printf("Failed to export file %s , status %d\n",fileName.Data(),status);
569       return -1;
570     }
571 #endif
572     idsFXSfile << Form("%s\n",id.Data());
573   }
574
575
576   // send ids file to FXS
577   idsFXSfile.close();
578   id = "SPD_id_list";
579 #ifndef SPD_DA_OFF
580   status = daqDA_FES_storeFile(idsFXSFileName.Data(),id.Data());
581   if (status!=0) {
582     printf("Failed to export file %s , status %d\n",fileName.Data(),status);
583     return -1;
584   }
585 #endif
586
587
588
589
590   delete handler;
591
592
593   return 0;
594 }