]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Put back XML handler
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Jun 2008 13:51:52 +0000 (13:51 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Jun 2008 13:51:52 +0000 (13:51 +0000)
TRD/AliTRDPreprocessor.cxx
TRD/AliTRDSaxHandler.cxx
TRD/TRDbaseLinkDef.h
TRD/libTRDbase.pkg

index 5612438efbb7edd4c8fc757286d38ee00d76045b..7bab21cbf39745842904e68e78c2ecac7b29aa0b 100644 (file)
 // and stores both reference data and spline fits results                 //
 // in the CDB                                                             //
 //                                                                        //
-// Author                                                               //
+// Authors:                                                               //
 //   R. Bailhache (R.Bailhache@gsi.de)                                    //
 //   W. Monange   (w.monange@gsi.de)                                      //
+//   F. Kramer    (kramer@ikf.uni-frankfurt.de)                           //
 //                                                                        //
 ////////////////////////////////////////////////////////////////////////////
 
@@ -38,6 +39,7 @@
 #include <TString.h>
 #include <TList.h>
 #include <TCollection.h>
+#include <TSAXParser.h>
 
 #include "AliCDBMetaData.h"
 #include "AliLog.h"
 #include "AliTRDCalibraFit.h"
 #include "AliTRDCalibraMode.h"
 #include "AliTRDCalibPadStatus.h"
+#include "AliTRDSaxHandler.h"
 #include "Cal/AliTRDCalDet.h"
 #include "Cal/AliTRDCalPadStatus.h"
+#include "Cal/AliTRDCalDCS.h"
 
 ClassImp(AliTRDPreprocessor)
 
@@ -97,6 +101,11 @@ UInt_t AliTRDPreprocessor::Process(TMap* dcsAliasMap)
   TString runType = GetRunType();
   Log(Form("runtype %s\n",runType.Data()));
   
+  // always process the configuration data
+/*  Int_t resultDCSC = */ProcessDCSConfigData(); // for testing!
+  // if there was an error, return with its code
+//  if (resultDCSC != 0) return resultDCSC; // for testing!
+
   if (runType=="PEDESTAL"){
     if(ExtractPedestals()) return 1;
     return 0;
@@ -107,11 +116,11 @@ UInt_t AliTRDPreprocessor::Process(TMap* dcsAliasMap)
     //TString runPar = GetRunParameter("HLTStatus");
     //if(runPar=="1") {
     if(GetHLTStatus()) {
-      if(ExtractHLT()) return 1;
+      /*if(*/ExtractHLT()/*) return 1*/; // for testing!
     } 
     // DAQ if HLT failed
     if(!fVdriftHLT) {
-      if(ExtractDriftVelocityDAQ()) return 1;
+      /*if(*/ExtractDriftVelocityDAQ()/*) return 1*/; // for testing!
     }
     // DCS
     if(ProcessDCS(dcsAliasMap)) return 1;
@@ -677,3 +686,62 @@ Bool_t AliTRDPreprocessor::ExtractHLT()
   return error;
   
 }
+
+//_____________________________________________________________________________
+UInt_t AliTRDPreprocessor::ProcessDCSConfigData()
+{
+  // 
+  // process the configuration of FEE, PTR and GTU
+  // reteive XML file from the DCS FXS
+  // parse it and store TObjArrays in the CDB
+  // return 0 for success, otherwise:
+  // 5: could not get the file from the FXS
+  // 6: ERROR in XML validation: something wrong with the file
+  // 7: ERROR while creating calibration objects in the handler
+  // 8: error while storing data in the CDB
+  // > 100: SaxHandler error code
+  //
+
+  Log("Processing the DCS config summary file.");
+
+  // get the XML file
+  const char * xmlFile = GetFile(kDCS,"CONFIGSUMMARY","");
+  if (xmlFile == NULL) {
+    return 5;
+    Log(Form("File %s not found!",xmlFile));
+  }
+
+  // create parser and parse
+  TSAXParser saxParser;
+  AliTRDSaxHandler saxHandler;
+  saxParser.ConnectToHandler("AliTRDSaxHandler", &saxHandler);
+  saxParser.ParseFile(xmlFile);
+
+  // report errors if present
+  if (saxParser.GetParseCode() == 0) {
+    Log("XML file validation OK");
+  } else {
+    Log(Form("ERROR in XML file validation. Parsecode: %s", saxParser.GetParseCode()));
+    return 6;
+  }
+  if (saxHandler.GetHandlerStatus() != 0) {
+    Log(Form("ERROR while creating calibration objects. Error code: %s", saxHandler.GetHandlerStatus()));
+    return 7;
+  }
+
+  // get the calibration object storing the data from the handler
+  AliTRDCalDCS* fCalDCSObj = saxHandler.GetCalDCSObj();
+
+  // store the DCS calib data in the CDB
+  AliCDBMetaData metaData1;
+  metaData1.SetBeamPeriod(0);
+  metaData1.SetResponsible("Frederick Kramer");
+  metaData1.SetComment("DCS configuration data in one AliTRDCalDCS object.");
+  if (!Store("Calib", "DCSCONFIG", fCalDCSObj, &metaData1, 0, kTRUE)) {
+    Log("problems while storing DCS config data object");
+    return 8;
+  }
+
+  return 0;
+}
+
index 2782af21f23a21a93f2da633e04479eb500714fd..924ce9c31a5e4e358de60f96bd7872ff1f3d78ed 100644 (file)
@@ -26,9 +26,9 @@
 
 #include <Riostream.h>
 #include <TList.h>
-#include <TObjArray.h>
 #include <TXMLAttr.h>
-#include <TObject.h>
+#include <TSAXParser.h>
+#include <TObjArray.h>
 
 #include "AliLog.h"
 
@@ -109,10 +109,24 @@ AliTRDSaxHandler::~AliTRDSaxHandler()
   //
   // AliTRDSaxHandler destructor
   //
-  delete fFEEArr;
-  delete fPTRArr;
-  delete fGTUArr;
-  delete fCalDCSObj;
+
+  if (fFEEArr) {
+    delete fFEEArr;
+    fFEEArr    = 0x0;
+  }
+  if (fPTRArr) {
+    delete fPTRArr;
+    fPTRArr    = 0x0;
+  }
+  if (fGTUArr) {
+    delete fGTUArr;
+    fGTUArr    = 0x0;
+  }
+  if (fCalDCSObj) {
+    delete fCalDCSObj;
+    fCalDCSObj = 0x0;
+  }
+
 }
 
 //_____________________________________________________________________________
@@ -280,7 +294,7 @@ void AliTRDSaxHandler::OnError(const char *text)
 }
 
 //_____________________________________________________________________________
-vois AliTRDSaxHandler::OnFatalError(const char *text)
+void AliTRDSaxHandler::OnFatalError(const char *text)
 {
   // process fatal errors here
   AliError(Form("Fatal error: %s",text)); // use AliFatal?
index 2e78ddea38e6f14ba78a2972a6afef058c39c4b7..c050816e5fe0c9fb326fb722e746eff8b4a4140e 100644 (file)
@@ -69,6 +69,7 @@
 #pragma link C++ class  AliTRDCalibPadStatus+;
 
 #pragma link C++ class  AliTRDPreprocessor+;
+#pragma link C++ class  AliTRDSaxHandler+;
 
 #pragma link C++ class  AliTRDDataDCS+;
 #pragma link C++ class  AliTRDSensor+;
index b95d8c678545a2eb80b422bd355b0c728489427e..6e7be5ccf078a46c4e974f1ed8da41a9cee3c70e 100644 (file)
@@ -47,6 +47,7 @@ SRCS= AliTRDarrayI.cxx \
       AliTRDCalibPadStatus.cxx \
       AliTRDQAChecker.cxx \
       AliTRDPreprocessor.cxx \
+      AliTRDSaxHandler.cxx \
       AliTRDDataDCS.cxx \
       AliTRDSensor.cxx \
       AliTRDSensorArray.cxx \