]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDPreprocessor.cxx
Improved quitting Event Display with close button.
[u/mrichter/AliRoot.git] / TRD / AliTRDPreprocessor.cxx
index eb66cfd98063802a9b255ea5fec9424d86141fc2..93a787e2f58e9b3e06e974a00ef1e96f61ca8ae5 100644 (file)
@@ -27,6 +27,7 @@
 //                                                                        //
 // Authors:                                                               //
 //   R. Bailhache (R.Bailhache@gsi.de)                                    //
+//   J. Book (jbook@ikf.uni-frankfurt.de)                                 //
 //   W. Monange   (w.monange@gsi.de)                                      //
 //   F. Kramer    (kramer@ikf.uni-frankfurt.de)                           //
 //                                                                        //
 #include "AliTRDCalibPadStatus.h"
 #include "AliTRDSaxHandler.h"
 #include "AliTRDgeometry.h"
+#include "AliTRDCalibChamberStatus.h"
 #include "Cal/AliTRDCalPad.h"
 #include "Cal/AliTRDCalPadStatus.h"
-#include "Cal/AliTRDCalDCS.h"
+#include "Cal/AliTRDCalDCSv2.h"
 #include "Cal/AliTRDCalSingleChamberStatus.h"
+#include "Cal/AliTRDCalChamberStatus.h"
 #include "Cal/AliTRDCalROC.h"
 
 ClassImp(AliTRDPreprocessor)
@@ -62,19 +65,33 @@ ClassImp(AliTRDPreprocessor)
 //______________________________________________________________________________________________
 AliTRDPreprocessor::AliTRDPreprocessor(AliShuttleInterface *shuttle)
   :AliPreprocessor("TRD", shuttle)
+  ,fCalDCSObjSOR(0)
+  ,fCalDCSObjEOR(0)
   ,fVdriftHLT(0)
 {
   //
   // Constructor
   //
 
+
   AddRunType("PHYSICS");
   AddRunType("STANDALONE");
   AddRunType("PEDESTAL");
   AddRunType("DAQ");
   
+  
+}
+//______________________________________________________________________________________________
+ AliTRDPreprocessor::AliTRDPreprocessor(const AliTRDPreprocessor&  ) :
+   AliPreprocessor("TRD",0),
+   fCalDCSObjSOR(0),
+   fCalDCSObjEOR(0),
+   fVdriftHLT(0)
+{
+  
+  Fatal("AliTRDPreprocessor", "copy constructor not implemented");
+  
 }
-
 //______________________________________________________________________________________________
 AliTRDPreprocessor::~AliTRDPreprocessor()
 {
@@ -82,8 +99,16 @@ AliTRDPreprocessor::~AliTRDPreprocessor()
   // Destructor
   //
 
-}
+  if (fCalDCSObjSOR ) delete fCalDCSObjSOR;
+  if (fCalDCSObjEOR ) delete fCalDCSObjEOR;
 
+}
+//______________________________________________________________________________________________
+AliTRDPreprocessor& AliTRDPreprocessor::operator = (const AliTRDPreprocessor& )
+{
+  Fatal("operator =", "assignment operator not implemented");
+  return *this;
+}
 //______________________________________________________________________________________________
 void AliTRDPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
 {
@@ -92,7 +117,7 @@ void AliTRDPreprocessor::Initialize(Int_t run, UInt_t startTime, UInt_t endTime)
   //
 
   AliPreprocessor::Initialize(run,startTime,endTime);
-
+  
 }
 
 //______________________________________________________________________________________________
@@ -106,9 +131,9 @@ UInt_t AliTRDPreprocessor::Process(TMap* dcsAliasMap)
   Log(Form("runtype %s\n",runType.Data()));
   
   // always process the configuration data
-  Int_t DCSConfigReturn = ProcessDCSConfigData();
-  if(DCSConfigReturn) return DCSConfigReturn; 
-  
+  Int_t dCSConfigReturn = ProcessDCSConfigData();
+  if(dCSConfigReturn) return dCSConfigReturn; 
+
   if (runType=="PEDESTAL"){
     if(ExtractPedestals()) return 1;
     return 0;
@@ -116,19 +141,24 @@ UInt_t AliTRDPreprocessor::Process(TMap* dcsAliasMap)
 
   if ((runType=="PHYSICS") || (runType=="STANDALONE") || (runType=="DAQ")){
     // DCS
-    if(ProcessDCS(dcsAliasMap)) return 1; 
+    if(ProcessDCS(dcsAliasMap)) return 1;
+    /*
     if(runType=="PHYSICS"){
       // HLT if On
       //TString runPar = GetRunParameter("HLTStatus");
       //if(runPar=="1") {
       if(GetHLTStatus()) {
-       if(ExtractHLT()) return 1; // for testing!
+       //if(ExtractHLT()) return 1; // for testing!
+       ExtractHLT();
       } 
       // DAQ if HLT failed
       if(!fVdriftHLT) {
-       if(ExtractDriftVelocityDAQ()) return 1; // for testing!
+       //if(ExtractDriftVelocityDAQ()) return 1; 
+       ExtractDriftVelocityDAQ(); // for testing!
       }
     }
+    */
+   
   }
   
   return 0;  
@@ -165,7 +195,7 @@ Bool_t AliTRDPreprocessor::ProcessDCS(TMap *dcsAliasMap)
 
   Log("****** DCS ******\n");
        
-  TObjArray * list=AliTRDSensorArray::GetList ();
+  TObjArray * list=AliTRDSensorArray::GetList();
        
   if (list == 0x0) {
     Log ("Error during AliTRDSensorArray::GetList");
@@ -267,13 +297,104 @@ Bool_t AliTRDPreprocessor::ProcessDCS(TMap *dcsAliasMap)
   }
   Log ("*********** End of DCS **********");
   
-  delete results;
-  delete nGraph;
+  delete [] results;
+  delete [] nGraph;
 
   return error;
 
 }
+//______________________________________________________________________________________________
+Bool_t AliTRDPreprocessor::ExtractHalfChamberStatusDAQ()
+{
+  //
+  // Half chamber status algorithm running on DAQ
+  //
+
+  Bool_t error = kFALSE;
+
+  AliCDBMetaData metaData;
+  metaData.SetBeamPeriod(0);
+  metaData.SetResponsible("Raphaelle Bailhache");
+  metaData.SetComment("TRD calib test");
+  
+  // Take the output of the DA on DAQ
+  TList * listpad = GetFileSources(kDAQ,"HALFCHAMBERSTATUS");
+  if (!listpad) {
+    Log("No list found for the HalfChamberStatus");
+    return kTRUE;
+  }
+
+  AliTRDCalibChamberStatus *calPed = 0x0;
+    
+  // loop through all files (only one normally)
+  UInt_t index = 0;
+  while (listpad->At(index)!=NULL) {
+    TObjString* fileNameEntry = (TObjString*) listpad->At(index);
+    if (fileNameEntry != NULL)
+      {
+        TString fileName = GetFile(kDAQ, "HALFCHAMBERSTATUS",
+                                  fileNameEntry->GetString().Data());
+       if(fileName.Length() ==0){
+         Log(Form("Error by retrieving the file %d for the halfchamberstatus",(Int_t)index));
+         delete listpad;
+         return kTRUE;
+       }
+       
+       TFile *f = TFile::Open(fileName);
+       f->GetObject("calibchamberstatus",calPed);
+       
+       if(calPed) {
+         
+         // store as reference data
+         TString name("HalfChamberStatus");
+         if(!StoreReferenceData("DAQData",(const char *)name,(TObject *) calPed,&metaData)){
+           Log(Form("Error storing AliTRDCalibPadStatus object %d as reference data",(Int_t)index));
+           error = kTRUE;
+         }
+       } // calPed
+       else Log(Form("Error getting AliTRDCalibChamberStatus onject from file"));
+                
+      } // fileNameEntry
+    ++index;
+  }// while (list)
+
+  Log(Form("%d elements found in the list for the halfchamberstatus",(Int_t)index));
+  if(index!=1){
+    delete listpad;
+    return kTRUE;
+  }
+
+  //
+  // Produce the AliTRDCalChamberStatus  name calHalfChamberStatus
+  //
+  AliTRDCalChamberStatus *calHalfChamberStatus = 0x0;
+  if(calPed) {
+    //calPed->AnalyseHisto();   // check number of events, create calHalfChamberStatus (done on DAQ)
+    if(fCalDCSObjEOR) {
+      calPed->CheckEORStatus((AliTRDCalDCSv2 *)fCalDCSObjEOR);
+    }
+    calHalfChamberStatus=(AliTRDCalChamberStatus *)calPed->GetCalChamberStatus();
+  }
+
+  //
+  // Store  
+  //  
 
+  AliCDBMetaData md3; 
+  md3.SetObjectClassName("AliTRDCalChamberStatus");
+  md3.SetResponsible("Raphaelle Bailhache");
+  md3.SetBeamPeriod(1);
+  md3.SetComment("TRD calib test");
+  if(!Store("Calib","ChamberStatus"    ,(TObject *)calHalfChamberStatus, &md3, 0, kTRUE)){
+    Log("Error storing the pedestal");
+    delete listpad;
+    return kTRUE;
+  }
+  
+  delete listpad;
+  return error; 
+  
+}
 //______________________________________________________________________________________________
 Bool_t AliTRDPreprocessor::ExtractPedestals()
 {
@@ -326,8 +447,6 @@ Bool_t AliTRDPreprocessor::ExtractPedestals()
        
        if(calPed){
          
-         Int_t ldc = 0; 
-
          // analyse
          //calPed->AnalyseHisto();
                  
@@ -336,7 +455,6 @@ Bool_t AliTRDPreprocessor::ExtractPedestals()
            AliTRDCalROC *rocMean  = calPed->GetCalRocMean(idet, kFALSE);
            if ( rocMean )  {
              calPedSum.SetCalRocMean(rocMean,idet);
-             ldc = (Int_t) (idet / 30);
            }
            AliTRDCalROC *rocRMS = calPed->GetCalRocRMS(idet, kFALSE);
            if ( rocRMS )  {
@@ -352,16 +470,9 @@ Bool_t AliTRDPreprocessor::ExtractPedestals()
            }
          }// det loop
 
-         if((ldc==0) || (ldc==1) || (ldc==2)) ldc = 1;
-         if((ldc==3) || (ldc==4) || (ldc==5)) ldc = 2;
-         if((ldc==6) || (ldc==7) || (ldc==8)) ldc = 3;
-         if((ldc==9) || (ldc==10) || (ldc==11)) ldc = 4;
-         if((ldc==12) || (ldc==13) || (ldc==14)) ldc = 5;
-         if((ldc==15) || (ldc==16) || (ldc==17)) ldc = 6;
-       
          // store as reference data
          TString name("PadStatus");
-         name += ldc;
+         name += index;
          if(!StoreReferenceData("DAQData",(const char *)name,(TObject *) calPed,&metaData)){
            Log(Form("Error storing AliTRDCalibPadStatus object %d as reference data",(Int_t)index));
            error = kTRUE;
@@ -495,7 +606,7 @@ Bool_t AliTRDPreprocessor::ExtractPedestals()
 }
 
 //__________________________________________________________________
-Bool_t AliTRDPreprocessor::AreThereDataPedestal(AliTRDCalSingleChamberStatus * const calROCStatus
+Bool_t AliTRDPreprocessor::AreThereDataPedestal(const AliTRDCalSingleChamberStatus * const calROCStatus
                                               , Bool_t second)
 {
 
@@ -679,38 +790,41 @@ Bool_t AliTRDPreprocessor::ExtractDriftVelocityDAQ()
       Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1))
        + 6*  18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1));
       Int_t nbfit        = calibra->GetNumberFit();
+      Int_t nbfitSuccess = calibra->GetNumberFitSuccess();
       Int_t nbE        = calibra->GetNumberEnt();
       
       // if enough statistics store the results
       if ((nbtg >                  0) && 
-         (nbfit        >= 0.5*nbE)) {
+         (nbfit        >= 0.5*nbE) && (nbE > 30) && (nbfitSuccess > 30)) {
        // create the cal objects
+       calibra->RemoveOutliers(1,kTRUE);
        calibra->PutMeanValueOtherVectorFit(1,kTRUE);
+       calibra->RemoveOutliers2(kTRUE);
        calibra->PutMeanValueOtherVectorFit2(1,kTRUE);
        TObjArray object      = calibra->GetVectorFit();
        AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE);
-       TObject *objdriftvelocitypad = calibra->CreatePadObjectVdrift();
+       //      TObject *objdriftvelocitypad = calibra->CreatePadObjectVdrift();
        object              = calibra->GetVectorFit2();
        AliTRDCalDet *objtime0det         = calibra->CreateDetObjectT0(&object,kTRUE);
-       TObject *objtime0pad         = calibra->CreatePadObjectT0();
+       //      TObject *objtime0pad         = calibra->CreatePadObjectT0();
        calibra->ResetVectorFit();
        // store
-       if(!Store("Calib","ChamberVdrift"    ,(TObject *) objdriftvelocitydet,&md1,0,kTRUE)){
-         Log("Error storing the calibration object for the chamber vdrift (DAQ)");
-         error = kTRUE;
-       }
-       if(!Store("Calib","ChamberT0"        ,(TObject *) objtime0det        ,&md1,0,kTRUE)){
-         Log("Error storing the calibration object for the chamber t0 (DAQ)");
-         error = kTRUE;
-       }
-       if(!Store("Calib","LocalVdrift"      ,(TObject *) objdriftvelocitypad,&md2,0,kTRUE)){
-         Log("Error storing the calibration object for the local drift velocity (DAQ)");
-         error = kTRUE;
-       }
-       if(!Store("Calib","LocalT0"          ,(TObject *) objtime0pad        ,&md2,0,kTRUE)){
-         Log("Error storing the calibration object for the local time0 (DAQ)");
-         error = kTRUE;
-       }
+        if(!Store("Calib","ChamberVdrift"    ,(TObject *) objdriftvelocitydet,&md1,0,kTRUE)){
+                 Log("Error storing the calibration object for the chamber vdrift (DAQ)");
+                 error = kTRUE;
+               }
+               if(!Store("Calib","ChamberT0"        ,(TObject *) objtime0det        ,&md1,0,kTRUE)){
+                 Log("Error storing the calibration object for the chamber t0 (DAQ)");
+                 error = kTRUE;
+               }
+       //      if(!Store("Calib","LocalVdrift"      ,(TObject *) objdriftvelocitypad,&md2,0,kTRUE)){
+       //        Log("Error storing the calibration object for the local drift velocity (DAQ)");
+       //        error = kTRUE;
+       //      }
+       //      if(!Store("Calib","LocalT0"          ,(TObject *) objtime0pad        ,&md2,0,kTRUE)){
+       //        Log("Error storing the calibration object for the local time0 (DAQ)");
+       //        error = kTRUE;
+       //      }
       }
       else{
        Log("Not enough statistics for the average pulse height (DAQ)");
@@ -779,8 +893,8 @@ Bool_t AliTRDPreprocessor::ExtractHLT()
     
     // gain
     TH2I *histogain = (TH2I *) filehlt->Get("CH2d");
-    histogain->SetDirectory(0);
     if (histogain) {
+      histogain->SetDirectory(0);
       // store the reference data
       if(!StoreReferenceData("HLTData","Gain",(TObject *) histogain,&metaData)){
        Log("Error storing 2D histos for gain");
@@ -796,21 +910,21 @@ Bool_t AliTRDPreprocessor::ExtractHLT()
       Int_t nbE         = calibra->GetNumberEnt();
       // enough statistics
       if ((nbtg >                  0) && 
-         (nbfit        >= 0.5*nbE)) {
+         (nbfit        >= 0.5*nbE) && (nbE > 30)) {
        // create the cal objects
        calibra->PutMeanValueOtherVectorFit(1,kTRUE);
        TObjArray object           = calibra->GetVectorFit();
        AliTRDCalDet *objgaindet   = calibra->CreateDetObjectGain(&object);
-       TObject *objgainpad        = calibra->CreatePadObjectGain();
+       //      TObject *objgainpad        = calibra->CreatePadObjectGain();
        // store them
        if(!Store("Calib","ChamberGainFactor",(TObject *) objgaindet         ,&md1,0,kTRUE)){
          Log("Error storing the calibration object for the chamber gain");
          error = kTRUE;
        }
-       if(!Store("Calib","LocalGainFactor"  ,(TObject *) objgainpad         ,&md2,0,kTRUE)){
-         Log("Error storing the calibration object for the local gain factor");
-         error = kTRUE;
-       }
+       //      if(!Store("Calib","LocalGainFactor"  ,(TObject *) objgainpad         ,&md2,0,kTRUE)){
+       //        Log("Error storing the calibration object for the local gain factor");
+       //        error = kTRUE;
+       //      }
       }
       calibra->ResetVectorFit();
     }// if histogain
@@ -818,8 +932,8 @@ Bool_t AliTRDPreprocessor::ExtractHLT()
     // vdrift
     fVdriftHLT = kFALSE;
     TProfile2D *histodriftvelocity = (TProfile2D *) filehlt->Get("PH2d");
-    histodriftvelocity->SetDirectory(0);
     if (histodriftvelocity) {
+      histodriftvelocity->SetDirectory(0);
       // store the reference data
       if(!StoreReferenceData("HLTData","VdriftT0",(TObject *) histodriftvelocity,&metaData)){
        Log("Error storing 2D Profile for average pulse height (HLT)");
@@ -832,19 +946,22 @@ Bool_t AliTRDPreprocessor::ExtractHLT()
       Int_t nbtg = 6*4*18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb0(1))
        + 6*  18*((Int_t) ((AliTRDCalibraMode *)calibra->GetCalibraMode())->GetDetChamb2(1));
       Int_t nbfit        = calibra->GetNumberFit();
+      Int_t nbfitSuccess = calibra->GetNumberFitSuccess();
       Int_t nbE          = calibra->GetNumberEnt();
       // enough statistics
       if ((nbtg >                  0) && 
-         (nbfit        >= 0.5*nbE)) {
+         (nbfit        >= 0.5*nbE) && (nbE > 30) && (nbfitSuccess > 30)) {
        // create the cal objects
+       calibra->RemoveOutliers(1,kTRUE);
        calibra->PutMeanValueOtherVectorFit(1,kTRUE);
+       calibra->RemoveOutliers2(kTRUE);
        calibra->PutMeanValueOtherVectorFit2(1,kTRUE);
        TObjArray object  = calibra->GetVectorFit();
        AliTRDCalDet *objdriftvelocitydet = calibra->CreateDetObjectVdrift(&object,kTRUE);
-       TObject *objdriftvelocitypad      = calibra->CreatePadObjectVdrift();
+       //      TObject *objdriftvelocitypad      = calibra->CreatePadObjectVdrift();
        object              = calibra->GetVectorFit2();
        AliTRDCalDet *objtime0det  = calibra->CreateDetObjectT0(&object,kTRUE);
-       TObject *objtime0pad       = calibra->CreatePadObjectT0();
+       //TObject *objtime0pad       = calibra->CreatePadObjectT0();
        // store them
        if(!Store("Calib","ChamberVdrift"    ,(TObject *) objdriftvelocitydet,&md1,0,kTRUE)){
          Log("Error storing the calibration object for the chamber vdrift (HLT)");
@@ -854,23 +971,24 @@ Bool_t AliTRDPreprocessor::ExtractHLT()
          Log("Error storing the calibration object for the chamber t0 (HLT)");
          error = kTRUE;
        }
-       if(!Store("Calib","LocalVdrift"      ,(TObject *) objdriftvelocitypad,&md2,0,kTRUE)){
-         Log("Error storing the calibration object for the local drift velocity (HLT)");
-         error = kTRUE;
-       }
-       if(!Store("Calib","LocalT0"          ,(TObject *) objtime0pad        ,&md2,0,kTRUE)){
-         Log("Error storing the calibration object for the local time0 (HLT)");
-         error = kTRUE;
-       }
+       // if(!Store("Calib","LocalVdrift"      ,(TObject *) objdriftvelocitypad,&md2,0,kTRUE)){
+       //        Log("Error storing the calibration object for the local drift velocity (HLT)");
+       //        error = kTRUE;
+       //      }
+       //      if(!Store("Calib","LocalT0"          ,(TObject *) objtime0pad        ,&md2,0,kTRUE)){
+       //        Log("Error storing the calibration object for the local time0 (HLT)");
+       //        error = kTRUE;
+       //      }
        fVdriftHLT = kTRUE;
       }
       calibra->ResetVectorFit();
     }// if TProfile2D
     
     // prf
+    /*
     TProfile2D *histoprf = (TProfile2D *) filehlt->Get("PRF2d");
-    histoprf->SetDirectory(0);
     if (histoprf) {
+      histoprf->SetDirectory(0);    
       // store reference data
       if(!StoreReferenceData("HLTData","PRF",(TObject *) histoprf,&metaData)){
        Log("Error storing the 2D Profile for Pad Response Function");
@@ -886,7 +1004,7 @@ Bool_t AliTRDPreprocessor::ExtractHLT()
       Int_t nbE          = calibra->GetNumberEnt();
       // enough statistics
       if ((nbtg >                  0) && 
-         (nbfit        >= 0.95*nbE)) {
+         (nbfit        >= 0.95*nbE) && (nbE > 30)) {
        // create cal pad objects 
        TObjArray object            = calibra->GetVectorFit();
        TObject *objPRFpad          = calibra->CreatePadObjectPRF(&object);
@@ -898,6 +1016,7 @@ Bool_t AliTRDPreprocessor::ExtractHLT()
       }
       calibra->ResetVectorFit();
     }// if PRF
+    */
   }// if fileNameEntry
   
   delete listhlt;
@@ -908,158 +1027,110 @@ Bool_t AliTRDPreprocessor::ExtractHLT()
 //_____________________________________________________________________________
 UInt_t AliTRDPreprocessor::ProcessDCSConfigData()
 {
-  // 
   // process the configuration of FEE, PTR and GTU
   // reteive XML filei(s) from the DCS FXS
   // parse it/them and store TObjArrays in the CDB
-  //
-  // return 0 for success, otherwise:
-  //  5 : Could not get the SOR and EOR file from the FXS
-  //  8 : Something wrong with the SOR file
-  //  9 : Something wrong with the EOR file
-  // 10 : SOR XML is not well-formed
-  // 11 : EOR XML is not well-formed
-  // 12 : ERROR in XML SAX validation: something wrong with the content
-  // 14 : ERROR while creating calibration objects in the handler
-  // 15 : ERROR while storing data in the CDB
-  //
 
   Log("Processing the DCS config summary files.");
 
+  if(fCalDCSObjSOR) delete fCalDCSObjSOR;
+  if(fCalDCSObjEOR) delete fCalDCSObjEOR;
+
+  TString xmlFile[2];
+  TString esor[2] = {"SOR", "EOR"};
   // get the XML files
-  Log("Requesting the 2 summaryfiles from the FXS..");
-  const char *xmlFileS = GetFile(kDCS,"CONFIGSUMMARYSOR","");
-  const char *xmlFileE = GetFile(kDCS,"CONFIGSUMMARYEOR","");
-  // Request EOR and SOR files from the fxs, if both are not found exit
-
-  if (xmlFileS == NULL && xmlFileE == NULL) {
-    Log(Form("ERROR: SOR and EOR Files %s and %s not found!",xmlFileS,xmlFileE));
-    return 5;
-  } 
+  xmlFile[0] = GetFile(kDCS,"CONFIGSUMMARYSOR","");
+  xmlFile[1] = GetFile(kDCS,"CONFIGSUMMARYEOR","");
 
-  Bool_t fileExistE = true, fileExistS = true;
 
-  if (xmlFileS == NULL) {
-    Log(Form("Warning: SOR File %s not found!",xmlFileS));
-    fileExistE = false;
-  } else if (xmlFileE == NULL) {
-    Log(Form("Warning: EOR File %s not found!",xmlFileE));
-    fileExistS = false;
-  } else {
-    Log(Form("Both Files (%s and %s) found.",xmlFileS,xmlFileE));
-  }
+  // check both files
+  for (Int_t iFile=0; iFile<2; iFile++) {
 
-  if (fileExistS) {
-    // test the files
-    std::ifstream fileTestS;
-    fileTestS.open(xmlFileS, std::ios_base::binary | std::ios_base::in);
-    if (!fileTestS.good() || fileTestS.eof() || !fileTestS.is_open()) {
-      Log(Form("ERROR: File %s not valid!",xmlFileS));
-      return 8;
-    }
-    fileTestS.seekg(0, std::ios_base::end);
-    if (static_cast<int>(fileTestS.tellg()) < 2) {
-      Log(Form("ERROR: File %s is empty!",xmlFileS));
-      return 8;
+    // check if the file are there
+    if (xmlFile[iFile].IsNull()) {
+      Log(Form("Warning: %s file not found!", esor[iFile].Data()));
+      continue;
     }
-  }
+    Log(Form("%s file found: %s", esor[iFile].Data(), xmlFile[iFile].Data()));
 
-  if (fileExistE) {
-    std::ifstream fileTestE;
-    fileTestE.open(xmlFileE, std::ios_base::binary | std::ios_base::in);
-    if (!fileTestE.good() || fileTestE.eof() || !fileTestE.is_open()) {
-      Log(Form("ERROR: File %s not valid!",xmlFileE));
-      return 9;
-    }
-    fileTestE.seekg(0, std::ios_base::end);
-    if (static_cast<int>(fileTestE.tellg()) < 2) {
-      Log(Form("ERROR: File %s is empty!",xmlFileE));
-      return 9;
+    // test the file
+    std::ifstream fileTest;
+    fileTest.open(xmlFile[iFile].Data(), std::ios_base::binary | std::ios_base::in);
+    if (!fileTest.good() || fileTest.eof() || !fileTest.is_open()) {
+      Log(Form("Warning: %s file not valid!", esor[iFile].Data()));
+      continue;
+    } 
+    // check if the file is empty
+    fileTest.seekg(0, std::ios_base::end);
+    if (static_cast<int>(fileTest.tellg()) < 2) {
+      Log(Form("Warning: %s file empty!", esor[iFile].Data()));
+      continue;
     }
-  }
-
-  Log("Tested files are valid.");   
+    Log(Form("%s file is valid.", esor[iFile].Data()));
 
-  // make a robust XML validation
-  TSAXParser testParser;
-  if (fileExistS && testParser.ParseFile(xmlFileS) < 0 ) {
-    Log("ERROR: XML content (SOR) is not well-formed.");
-    return 10;
-  } else if (fileExistE && testParser.ParseFile(xmlFileE) < 0 ) {
-    Log("ERROR: XML content (EOR) is not well-formed.");
-    return 11;
-  }
-  Log("XML contents are well-formed.");
-
-  // create parser and parse
-  TSAXParser saxParserS, saxParserE;
-  AliTRDSaxHandler saxHandlerS, saxHandlerE;
+    // make a robust XML validation
+    TSAXParser testParser;
+    if (testParser.ParseFile(xmlFile[iFile].Data()) < 0 ) {
+      Log(Form("Warning: %s XML content is not well-formed!", esor[iFile].Data()));
+      continue;
+    }
+    Log(Form("%s XML content is well-formed.", esor[iFile].Data()));
 
-  if (fileExistS) {
-    saxParserS.ConnectToHandler("AliTRDSaxHandler", &saxHandlerS);
-    saxParserS.ParseFile(xmlFileS);
-  }
-  if (fileExistE) {
-    saxParserE.ConnectToHandler("AliTRDSaxHandler", &saxHandlerE);
-    saxParserE.ParseFile(xmlFileE);
-  }
+    // create parser and parse
+    TSAXParser saxParser;
+    AliTRDSaxHandler saxHandler;
+    saxParser.ConnectToHandler("AliTRDSaxHandler", &saxHandler);
+    saxParser.ParseFile(xmlFile[iFile].Data());
 
-  // report errors if present 
-  if (((fileExistS && saxParserS.GetParseCode() == 0) || !fileExistS) && (!fileExistE || (fileExistE && saxParserE.GetParseCode() == 0))) {
-    Log("XML file validation OK.");
-  } else {
-    if (fileExistS) {
-      Log(Form("ERROR in XML file validation. SOR Parse Code: %s", saxParserS.GetParseCode()));
-    }
-    if (fileExistE) {
-      Log(Form("ERROR in XML file validation. EOR Parse Code: %s", saxParserE.GetParseCode()));
-    }
-    return 12;
-  }
-  if (((fileExistS && saxHandlerS.GetHandlerStatus() == 0) || !fileExistS) && (!fileExistE || (saxHandlerE.GetHandlerStatus() == 0))) {
-    Log("SAX handler reports no errors.");
-  } else  {
-    if (fileExistS) {
-      Log(Form("ERROR while creating calibration objects. SOR Error code: %s", saxHandlerS.GetHandlerStatus()));
+    // report errors of the parser if present
+    if (saxParser.GetParseCode() != 0) {
+      Log(Form("Warning: %s XML file validation failed! Parse code: %d", esor[iFile].Data(), saxParser.GetParseCode()));
+      continue;
     }
-    if (fileExistE) {
-      Log(Form("ERROR while creating calibration objects. EOR Error code: %s", saxHandlerE.GetHandlerStatus()));
+    Log(Form("%s XML validation OK.", esor[iFile].Data()));
+
+    // report errors of the handler if present
+    if (saxHandler.GetHandlerStatus() != 0) {
+      Log(Form("Warning: Creating %s calibration object failed! Error code: %d", esor[iFile].Data(), saxHandler.GetHandlerStatus()));
+      continue;
     }
-    return 14;
+    Log(Form("%s SAX handler reports no errors.", esor[iFile].Data()));
+
+    // get the calibration object storing the data from the handler
+    AliTRDCalDCSv2 *calDCSObj = (AliTRDCalDCSv2*)saxHandler.GetCalDCSObj()->Clone();
+    calDCSObj->EvaluateGlobalParameters();
+    calDCSObj->SetRunType(GetRunType());
+    calDCSObj->SetStartTime(GetStartTimeDCSQuery());
+    calDCSObj->SetEndTime(GetEndTimeDCSQuery());
+    if (iFile == 0) fCalDCSObjSOR = calDCSObj;
+    if (iFile == 1) fCalDCSObjEOR = calDCSObj;
   }
 
+  if (!fCalDCSObjSOR && !fCalDCSObjEOR) { Log("ERROR: Failed reading both files!"); return 1; }
+
   // put both objects in one TObjArray to store them
-  TObjArray* fCalObjArray = new TObjArray(2);
-  fCalObjArray->SetOwner();
-
-  // get the calibration object storing the data from the handler
-  if (fileExistS) {
-    AliTRDCalDCS* fCalDCSObjSOR = saxHandlerS.GetCalDCSObj();
-    fCalDCSObjSOR->EvaluateGlobalParameters();
-    fCalObjArray->AddAt(fCalDCSObjSOR,0);
-  }
+  TObjArray* calObjArray = new TObjArray(2);
+  calObjArray->SetOwner();
 
-  if (fileExistE) {
-    AliTRDCalDCS* fCalDCSObjEOR = saxHandlerE.GetCalDCSObj();
-    fCalDCSObjEOR->EvaluateGlobalParameters();
-    fCalObjArray->AddAt(fCalDCSObjEOR,1);
+  if (fCalDCSObjSOR) {
+    calObjArray->AddAt(fCalDCSObjSOR,0);
+    Log("TRDCalDCS object for SOR created.");
+  }
+  if (fCalDCSObjEOR) {
+    calObjArray->AddAt(fCalDCSObjEOR,1);
+    Log("TRDCalDCS object for EOR created.");
   }
 
   // store the DCS calib data in the CDB
   AliCDBMetaData metaData1;
   metaData1.SetBeamPeriod(0);
   metaData1.SetResponsible("Frederick Kramer");
-  metaData1.SetComment("DCS configuration data in two AliTRDCalDCS objects in one TObjArray (0:SOR, 1:EOR).");
-  if (!Store("Calib", "DCS", fCalObjArray, &metaData1, 0, kTRUE)) {
-    Log("problems while storing DCS config data object");
-    return 15;
-  } else {
-    Log("DCS config data object stored.");
-  }
+  metaData1.SetComment("DCS configuration data in two AliTRDCalDCSv2 objects in one TObjArray (0:SOR, 1:EOR).");
+  if (!Store("Calib", "DCS", calObjArray, &metaData1, 0, kTRUE)) { Log("ERROR: Storing DCS config data object failed!"); return 1; }
 
-  //delete fCalObjArray;
+  delete calObjArray;
 
-  Log("Processing of the DCS config summary file DONE.");  
+  Log("SUCCESS: Processing of the DCS config summary file DONE.");  
   return 0;
 }