]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ZDC/ZDCEMDda.cxx
Corrected free(event)
[u/mrichter/AliRoot.git] / ZDC / ZDCEMDda.cxx
index d4bc06689fcb709abc47791cdcacf3d1436a4c9d..d1838809b2fcb7fc3b8d7bcd0a116b192dedbde0 100644 (file)
@@ -1,23 +1,34 @@
 /*
 
-DAcase2.c
+This program reads the DAQ data files passed as argument using the monitoring library.
 
-This program connects to the DAQ data source passed as argument
-and populates local "./result.txt" file with the ids of events received
-during the run.
+It computes the average event size and populates local "./result.txt" file with the 
+result.
 
-The program exits when being asked to shut down (daqDA_checkshutdown)
-or End of Run event.
+The program reports about its processing progress.
 
 Messages on stdout are exported to DAQ log system.
 
-DA for ZDC standalon pedestal runs
-contact: Chiara.Oppedisano@cern.ch
+DA for ZDC standalone CALIBRATION_EMD runs
+
+Contact: Chiara.Oppedisano@to.infn.it
+Link: 
+Run Type: STANDALONE_EMD_RUN
+DA Type: LDC
+Number of events needed: at least ~5*10^3
+Input Files: ZDCPedestal.dat
+Output Files: ZDCEMDCalib.dat, ZDCChMapping.dat
+Trigger Types Used: Standalone Trigger
 
 */
+#define PEDDATA_FILE  "ZDCPedestal.dat"
+#define MAPDATA_FILE  "ZDCChMapping.dat"
+#define ENCALIBDATA_FILE   "ZDCEnergyCalib.dat"
+#define TOWCALIBDATA_FILE  "ZDCTowerCalib.dat"
 
 #include <stdio.h>
 #include <Riostream.h>
+#include <Riostream.h>
 
 // DATE
 #include <daqDA.h>
@@ -25,15 +36,19 @@ contact: Chiara.Oppedisano@cern.ch
 #include <monitor.h>
 
 //ROOT
-#include <TRandom.h>
+#include <TROOT.h>
+#include <TPluginManager.h>
 #include <TH1F.h>
 #include <TH2F.h>
 #include <TProfile.h>
 #include <TF1.h>
 #include <TFile.h>
+#include <TFitter.h>
+#include "TMinuitMinimizer.h"
 
 //AliRoot
 #include <AliRawReaderDate.h>
+#include <AliRawEventHeaderBase.h>
 #include <AliZDCRawStream.h>
 
 
@@ -43,6 +58,32 @@ contact: Chiara.Oppedisano@cern.ch
 */
 int main(int argc, char **argv) {
   
+
+  gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo",
+                                       "*",
+                                       "TStreamerInfo",
+                                       "RIO",
+                                       "TStreamerInfo()"); 
+
+  TMinuitMinimizer m; 
+  gROOT->GetPluginManager()->AddHandler("ROOT::Math::Minimizer", "Minuit","TMinuitMinimizer",
+      "Minuit", "TMinuitMinimizer(const char *)");
+  TVirtualFitter::SetDefaultFitter("Minuit");
+
+  int status = 0;
+  // No. of ZDC cabled ch.
+  int const kNChannels = 24;
+  int const kNScChannels = 32;
+
+  /* log start of process */
+  printf("ZDC EMD program started\n");  
+
+  /* check that we got some arguments = list of files */
+  if (argc<2) {
+    printf("Wrong number of arguments\n");
+    return -1;
+  }
+  
   //
   // --- Preparing histos for EM dissociation spectra
   //
@@ -71,14 +112,6 @@ int main(int argc, char **argv) {
      histoEMDCorr[i] = new TH1F(namhistc,namhistc,100,0.,4000.);
   }
 
-  int status;
-  
-  if (argc!=2) {
-    printf("Wrong number of arguments\n");
-    return -1;
-  }
-
-
   /* open result file */
   FILE *fp=NULL;
   fp=fopen("./result.txt","a");
@@ -87,122 +120,203 @@ int main(int argc, char **argv) {
     return -1;
   }
   
-
-  /* define data source : this is argument 1 */  
-  status = monitorSetDataSource( argv[1] );
-  if(status!=0) {
-    printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
+  FILE *mapFile4Shuttle;
+
+  // *** To analyze EMD events you MUST have a pedestal data file!!!
+  // *** -> check if a pedestal run has been analyzed
+  int read = 0;
+  read = daqDA_DB_getFile(PEDDATA_FILE,PEDDATA_FILE);
+  if(read){
+    printf("\t ERROR!!! ZDCPedestal.dat file NOT FOUND in DAQ db!!!\n");
     return -1;
   }
-
-
-  /* declare monitoring program */
-  status = monitorDeclareMp( __FILE__ );
-  if (status!=0) {
-    printf("monitorDeclareMp() failed : %s\n",monitorDecodeError(status));
+  else printf("\t ZDCPedestal.dat file retrieved from DAQ db\n");
+  
+  FILE *filePed = fopen(PEDDATA_FILE,"r");
+  if (filePed==NULL) {
+    printf("\t ERROR!!! Can't open ZDCPedestal.dat file!!!\n");
     return -1;
   }
 
+  // 144 = 48 in-time + 48 out-of-time + 48 correlations
+  Float_t readValues[2][3*2*kNChannels];
+  Float_t MeanPed[2*kNChannels];
+  Float_t CorrCoeff0[2*kNChannels], CorrCoeff1[2*kNChannels];
+  // ***************************************************
+  //   Unless we have a narrow correlation to fit we
+  //   don't fit and store in-time vs. out-of-time
+  //   histograms -> mean pedstal subtracted!!!!!!
+  // ***************************************************
+  //
+  for(int jj=0; jj<6*kNChannels; jj++){
+    for(int ii=0; ii<2; ii++){
+       fscanf(filePed,"%f",&readValues[ii][jj]);
+    }
+    if(jj<kNChannels && jj<2*kNChannels){
+      MeanPed[jj] = readValues[0][jj];
+      //printf("\t MeanPedhg[%d] = %1.1f\n",jj, MeanPedhg[jj]);
+    }
+    else if(jj>2*kNChannels && jj>4*kNChannels){
+      CorrCoeff0[jj-4*kNChannels] = readValues[0][jj]; 
+      CorrCoeff1[jj-4*kNChannels] = readValues[1][jj];;
+    }
+  }
+
+  /* report progress */
+  daqDA_progressReport(10);
 
-  /* define wait event timeout - 1s max */
-  monitorSetNowait();
-  monitorSetNoWaitNetworkTimeout(1000);
-  
 
-  /* log start of process */
-  printf("ZDC PEDESTAL monitoring program started\n");  
-  
   /* init some counters */
   int nevents_physics=0;
   int nevents_total=0;
 
-  struct equipmentStruct *equipment;
-  int *eventEnd;
-  int *eventData;
-  int *equipmentEnd;
-  int *equipmentData;
-  int *equipmentID;
   struct eventHeaderStruct *event;
   eventTypeType eventT;
-  Int_t iev=0;
-  
-  /* main loop (infinite) */
-  for(;;) {
-  
-    /* check shutdown condition */
-    if (daqDA_checkShutdown()) {break;}
-    
-    /* get next event (blocking call until timeout) */
-    status=monitorGetEventDynamic((void **)&event);
-    if (status==MON_ERR_EOF) {
-      printf ("End of File detected\n");
-      break; /* end of monitoring file has been reached */
-    }
-    
+
+  /* read the data files */
+  int n;
+  for(n=1;n<argc;n++){
+   
+    status=monitorSetDataSource( argv[n] );
     if (status!=0) {
-      printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
-      break;
+      printf("monitorSetDataSource() failed : %s\n",monitorDecodeError(status));
+      return -1;
     }
 
-    /* retry if got no event */
-    if (event==NULL) {
-      continue;
-    }
+    /* report progress */
+    /* in this example, indexed on the number of files */
+    daqDA_progressReport(10+80*n/argc);
 
-    iev++; 
+    /* read the file */
+    for(;;){
 
-    /* use event - here, just write event id to result file */
-    eventT=event->eventType;
-    
-    if(eventT==PHYSICS_EVENT){
-      //
-      // *** To analyze EMD events you MUST have a pedestal data file!!!
-      // *** -> check if a pedestal run has been analyzied
-      FILE *filePed=NULL;
-      filePed=fopen("./ZDCPedestal.dat","r");
-      if (filePed==NULL) {
-        printf("\t ERROR!!! You MUST have a ZDCPedestal.dat file!!!\n");
+      /* get next event */
+      status=monitorGetEventDynamic((void **)&event);
+      if(status==MON_ERR_EOF) break; /* end of monitoring file has been reached */
+      if(status!=0) {
+        printf("monitorGetEventDynamic() failed : %s\n",monitorDecodeError(status));
         return -1;
       }
-      // 132 = 44 in-time + 44 out-of-time + 44 correlations
-      Float_t readValues[2][132], MeanPed[44], MeanPedWidth[44], 
-             MeanPedOOT[44], MeanPedWidthOOT[44],
-             CorrCoeff0[44], CorrCoeff1[44];
-      //
-      for(int jj=0; jj<132; jj++){
-        for(int ii=0; ii<2; ii++){
-           fscanf(filePed,"%f",&readValues[ii][jj]);
-        }
-       if(jj<44){
-         MeanPed[jj] = readValues[0][jj];
-         MeanPedWidth[jj] = readValues[1][jj];
-       }
-       else if(jj>44 && jj<88){
-         MeanPedOOT[jj-44] = readValues[0][jj];
-         MeanPedWidthOOT[jj-44] = readValues[1][jj];
-       }
-       else if(jj>88){
-         CorrCoeff0[jj-88] = readValues[0][jj]; 
-         CorrCoeff1[jj-88] = readValues[1][jj];;
-       }
+
+      /* retry if got no event */
+      if(event==NULL) {
+        break;
       }
-      //
-      //
+      
       // Initalize raw-data reading and decoding
       AliRawReader *reader = new AliRawReaderDate((void*)event);
+      reader->Select("ZDC");
+      // --- Reading event header
+      //UInt_t evtype = reader->GetType();
+      //printf("\n\t ZDCEMDda -> ev. type %d\n",evtype);
+      //printf("\t ZDCEMDda -> run # %d\n",reader->GetRunNumber());
+      //
+      AliZDCRawStream *rawStreamZDC = new AliZDCRawStream(reader);
+        
+
+      /* use event - here, just write event id to result file */
+      eventT=event->eventType;
+      
+      Int_t ich=0;
+      Int_t adcMod[2*kNChannels], adcCh[2*kNChannels], sigCode[2*kNChannels];
+      Int_t det[2*kNChannels], sec[2*kNChannels];
+      for(Int_t y=0; y<2*kNChannels; y++){
+        adcMod[y]=adcCh[y]=sigCode[y]=det[y]=sec[y]=0;
+      }
+      
+      Int_t iScCh=0;
+      Int_t scMod[kNScChannels], scCh[kNScChannels], scSigCode[kNScChannels];
+      Int_t scDet[kNScChannels], scSec[kNScChannels];
+      for(Int_t y=0; y<kNScChannels; y++){
+        scMod[y]=scCh[y]=scSigCode[y]=scDet[y]=scSec[y]=0;
+      }
+      //
+      Int_t modNum=-1, modType=-1;
+      
+      if(eventT==START_OF_DATA){
+               
+       rawStreamZDC->SetSODReading(kTRUE);
+       
+       // --------------------------------------------------------
+       // --- Writing ascii data file for the Shuttle preprocessor
+        mapFile4Shuttle = fopen(MAPDATA_FILE,"w");
+       if(!rawStreamZDC->Next()) printf(" \t No raw data found!! \n");
+        else{
+         while((rawStreamZDC->Next())){
+            if(rawStreamZDC->IsHeaderMapping()){ // mapping header
+              modNum = rawStreamZDC->GetADCModule();
+              modType = rawStreamZDC->GetModType();
+           }
+            if(rawStreamZDC->IsChMapping()){ 
+             if(modType==1){ // ADC mapping ----------------------
+               adcMod[ich]  = rawStreamZDC->GetADCModFromMap(ich);
+               adcCh[ich]   = rawStreamZDC->GetADCChFromMap(ich);
+               sigCode[ich] = rawStreamZDC->GetADCSignFromMap(ich);
+               det[ich]     = rawStreamZDC->GetDetectorFromMap(ich);
+               sec[ich]     = rawStreamZDC->GetTowerFromMap(ich);
+               //
+               fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+                 ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
+               //
+               //printf("  Mapping in DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n",
+               //  ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]);
+               //
+               ich++;
+             }
+             else if(modType==2){ //VME scaler mapping --------------------
+               scMod[iScCh]     = rawStreamZDC->GetScalerModFromMap(iScCh);
+               scCh[iScCh]      = rawStreamZDC->GetScalerChFromMap(iScCh);
+               scSigCode[iScCh] = rawStreamZDC->GetScalerSignFromMap(iScCh);
+               scDet[iScCh]     = rawStreamZDC->GetScDetectorFromMap(iScCh);
+               scSec[iScCh]    = rawStreamZDC->GetScTowerFromMap(iScCh);
+               //
+               fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n",
+                 iScCh,scMod[iScCh],scCh[iScCh],scSigCode[iScCh],scDet[iScCh],scSec[iScCh]);
+               //
+               //printf("  Mapping in DA -> %d Scaler: mod %d ch %d, code %d det %d, sec %d\n",
+               //  iScCh,scMod[iScCh],scCh[iScCh],scSigCode[iScCh],scDet[iScCh],scSec[iScCh]);
+               //
+               iScCh++;
+             }
+           }
+         }
+       }
+        fclose(mapFile4Shuttle);
+      }// SOD event
+    
+    if(eventT==PHYSICS_EVENT){
+      // --- Reading data header
+      reader->ReadHeader();
       const AliRawDataHeader* header = reader->GetDataHeader();
       if(header){
-         UChar_t message = header->GetL1TriggerMessage();
+         UChar_t message = header->GetAttributes();
+        if(message & 0x70){ // DEDICATED EMD RUN
+           //printf("\t STANDALONE_EMD_RUN raw data found\n");
+           continue;
+        }
+        else{
+           printf("\t NO STANDALONE_EMD_RUN raw data found\n");
+           return -1;
+        }
       }
       else{
          printf("\t ATTENTION! No Raw Data Header found!!!\n");
-        return -1;
+         return -1;
       }
-      //
-      AliZDCRawStream *rawStreamZDC = new AliZDCRawStream(reader);
-      //
+      
+      rawStreamZDC->SetSODReading(kTRUE);
+
       if (!rawStreamZDC->Next()) printf(" \t No raw data found!! ");
       //
+      // ----- Setting ch. mapping -----
+      for(Int_t jk=0; jk<2*kNChannels; jk++){
+        rawStreamZDC->SetMapADCMod(jk, adcMod[jk]);
+        rawStreamZDC->SetMapADCCh(jk, adcCh[jk]);
+        rawStreamZDC->SetMapADCSig(jk, sigCode[jk]);
+        rawStreamZDC->SetMapDet(jk, det[jk]);
+        rawStreamZDC->SetMapTow(jk, sec[jk]);
+      }
+      //
       Float_t ZDCRawADC[4], ZDCCorrADC[4], ZDCCorrADCSum[4];
       for(Int_t g=0; g<4; g++){
            ZDCCorrADCSum[g] = 0.;
@@ -210,26 +324,58 @@ int main(int argc, char **argv) {
       }
       //
       while(rawStreamZDC->Next()){
-        if(rawStreamZDC->IsADCDataWord()){
-         Int_t StartIndex[4] = {5,15,29,39};
-         Int_t DetIndex;
-         if(rawStreamZDC->GetSector(0) == 1 || rawStreamZDC->GetSector(0) == 2)
-           DetIndex = rawStreamZDC->GetSector(0)-1;
-         else if(rawStreamZDC->GetSector(0) == 4 || rawStreamZDC->GetSector(0) == 5)
-           DetIndex = rawStreamZDC->GetSector(0)-2;
-
-         if(rawStreamZDC->GetADCGain() == 1){ //EMD -> LR ADC
-           //
-           ZDCRawADC[DetIndex] += (Float_t) rawStreamZDC->GetADCValue();
-           Int_t PedIndex = StartIndex[DetIndex]+rawStreamZDC->GetSector(1);
-           // Mean pedestal subtraction 
-           Float_t Pedestal = MeanPed[PedIndex];
-           // Pedestal subtraction from correlation with out-of-time signals
-           //Float_t Pedestal = ;
-           //
-           ZDCCorrADC[DetIndex] = (rawStreamZDC->GetADCValue()) - Pedestal;
-           ZDCCorrADCSum[DetIndex] += ZDCCorrADC[DetIndex];
-         }       
+       Int_t det = rawStreamZDC->GetSector(0);
+       Int_t quad = rawStreamZDC->GetSector(1);
+        
+       if(rawStreamZDC->IsADCDataWord() && !(rawStreamZDC->IsUnderflow())
+            && !(rawStreamZDC->IsOverflow()) && det!=-1
+            && (rawStreamZDC->GetADCGain() == 1)){ // Selecting LOW RES ch.s
+
+         //printf("  IsADCWord %d, IsUnderflow %d, IsOverflow %d\n",
+         //  rawStreamZDC->IsADCDataWord(),rawStreamZDC->IsUnderflow(),rawStreamZDC->IsOverflow());
+         
+         // Taking LOW RES channels -> channel+kNChannels !!!!
+         Int_t DetIndex=999, PedIndex=999;
+         if(det != 3 && quad != 5){ // Not ZEM nor PMRef
+           if(det == 1){
+             DetIndex = det-1;
+             PedIndex = quad+kNChannels;
+           }
+           else if(det==2){
+             DetIndex = det-1;
+             PedIndex = quad+5+kNChannels;
+           }
+           else if(det == 4){
+             DetIndex = det-2;
+             PedIndex = quad+12+kNChannels;
+           }
+           else if(det == 5){
+             DetIndex = det-2;
+             PedIndex = quad+17+kNChannels;
+           }
+            //EMD -> LR ADCs
+           if(rawStreamZDC->GetADCGain() == 1 && (DetIndex!=999 || PedIndex!=999)){ 
+             //
+             ZDCRawADC[DetIndex] += (Float_t) rawStreamZDC->GetADCValue();
+             //
+             // Mean pedestal subtraction 
+             Float_t Pedestal = MeanPed[PedIndex];
+             // Pedestal subtraction from correlation with out-of-time signals
+             //Float_t Pedestal = CorrCoeff0[PedIndex]+CorrCoeff1[PedIndex]*MeanPedOOT[PedIndex];
+             //
+             ZDCCorrADC[DetIndex] = (rawStreamZDC->GetADCValue()) - Pedestal;
+             ZDCCorrADCSum[DetIndex] += ZDCCorrADC[DetIndex];
+             //
+             /*printf("\t det %d quad %d res %d pedInd %d detInd %d:"
+                "ADCCorr = %d, ZDCCorrADCSum = %d\n", 
+                det,quad,rawStreamZDC->GetADCGain(),PedIndex,DetIndex, 
+                (Int_t) ZDCCorrADC[DetIndex],(Int_t) ZDCCorrADCSum[DetIndex]);
+             */
+           }
+           if(DetIndex==999 || PedIndex==999) 
+               printf(" WARNING! Detector a/o pedestal index are WRONG!!!\n");
+         }  
        }//IsADCDataWord()
         //
        }
@@ -240,25 +386,19 @@ int main(int argc, char **argv) {
           histoEMDRaw[j]->Fill(ZDCRawADC[j]);
           histoEMDCorr[j]->Fill(ZDCCorrADCSum[j]);
        }
-    }
+    }//(if PHYSICS_EVENT)
     
     nevents_total++;
 
+   }
 
-    /* free resources */
-    free(event);
-    
-    /* exit when last event received, no need to wait for TERM signal */
-    if (eventT==END_OF_RUN) {
-      printf("EOR event detected\n");
-      break;
-    }
+   /* free resources */
+   free(event);
   }
-  
+    
   /* Analysis of the histograms */
   //
-  FILE *fileShuttle;
-  fileShuttle = fopen("ZDCEMD.dat","w");
+  FILE *fileShuttle1 = fopen(ENCALIBDATA_FILE,"w");
   //
   Int_t BinMax[4];
   Float_t YMax[4];
@@ -266,40 +406,85 @@ int main(int argc, char **argv) {
   Float_t MeanFitVal[4];
   TF1 *fitfun[4];
   for(Int_t k=0; k<4; k++){
+     if(histoEMDCorr[k]->GetEntries() == 0){
+       printf("\n WARNING! Empty histos -> ending DA WITHOUT writing output\n\n");
+       return -1;
+     } 
      BinMax[k] = histoEMDCorr[k]->GetMaximumBin();
      YMax[k] = (histoEMDCorr[k]->GetXaxis())->GetXmax();
      NBinsx[k] = (histoEMDCorr[k]->GetXaxis())->GetNbins();
-     //printf("\n\t Det%d -> BinMax = %d, ChXMax = %f\n", k+1, BinMax[k], BinMax[k]*YMax[k]/NBinsx[k]);
+//     printf("\n\t Det%d -> BinMax = %d, ChXMax = %f\n", k+1, BinMax[k], BinMax[k]*YMax[k]/NBinsx[k]);
      histoEMDCorr[k]->Fit("gaus","Q","",BinMax[k]*YMax[k]/NBinsx[k]*0.7,BinMax[k]*YMax[k]/NBinsx[k]*1.25);
      fitfun[k] = histoEMDCorr[k]->GetFunction("gaus");
      MeanFitVal[k] = (Float_t) (fitfun[k]->GetParameter(1));
      //printf("\n\t Mean Value from gaussian fit = %f\n", MeanFitVal[k]);
   }
   //
-   Float_t CalibCoeff[6];
-  /*for(Int_t j=0; j<6; j++){
-     if(j<4) CalibCoeff[j] = 2.76/MeanFitVal[j];
-     else  CalibCoeff[j] = 1.;
-     fprintf(fileShuttle,"\t%f\n",CalibCoeff[j]);
-  }
-  */
-  // --- For the moment we have sim data only for ZN1!!!
+  Float_t CalibCoeff[6];     
+  Float_t icoeff[5];
+  //
   for(Int_t j=0; j<6; j++){
-     if(j==0 || j==1) CalibCoeff[j] = 2.76/MeanFitVal[j];
-     else if(j>0 && j<4) CalibCoeff[j] = CalibCoeff[0];
-     else  CalibCoeff[j] = 1.;
-     fprintf(fileShuttle,"\t%f\n",CalibCoeff[j]);
+     if(j<4){
+       CalibCoeff[j] = MeanFitVal[j];
+       fprintf(fileShuttle1,"\t%f\n",CalibCoeff[j]);
+     }
+     // ZEM energy calib. coeff. = 1
+     else if(j==4 || j==5){
+       CalibCoeff[j] = 1.; 
+       fprintf(fileShuttle1,"\t%f\n",CalibCoeff[j]);
+     }
+  }
+  fclose(fileShuttle1);
+  //
+  FILE *fileShuttle2 = fopen(TOWCALIBDATA_FILE,"w");
+  for(Int_t j=0; j<4; j++){
+     // Note -> For the moment the inter-calibration coeff. are set to 1 
+     for(Int_t k=0; k<5; k++){  
+       icoeff[k] = 1.;
+       fprintf(fileShuttle2,"\t%f",icoeff[k]);
+       if(k==4) fprintf(fileShuttle2,"\n");
+     }
+  }
+  fclose(fileShuttle2);
+  
+  for(Int_t ij=0; ij<4; ij++){
+    delete histoEMDRaw[ij];
+    delete histoEMDCorr[ij];
   }
-  //                                                  
-  fclose(fileShuttle);
   
+  //delete minuitFit;
+  TVirtualFitter::SetFitter(0);
 
   /* write report */
   fprintf(fp,"Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total);
 
   /* close result file */
   fclose(fp);
+  
+  /* report progress */
+  daqDA_progressReport(90);
+
+  /* store the result file on FES */
+  status = daqDA_FES_storeFile(MAPDATA_FILE, MAPDATA_FILE);
+  if(status){
+    printf("Failed to export file : %d\n",status);
+    return -1;
+  }
+  //
+  status = daqDA_FES_storeFile(ENCALIBDATA_FILE, ENCALIBDATA_FILE);
+  if(status){
+    printf("Failed to export file : %d\n",status);
+    return -1;
+  }
+  //
+  status = daqDA_FES_storeFile(TOWCALIBDATA_FILE, TOWCALIBDATA_FILE);
+  if(status){
+    printf("Failed to export file : %d\n",status);
+    return -1;
+  }
 
+  /* report progress */
+  daqDA_progressReport(100);
 
   return status;
 }