TOF FEE configuration database dump stored in ReferenceData inside Calib/FEEDump
authorrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Jan 2010 14:08:33 +0000 (14:08 +0000)
committerrpreghen <rpreghen@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 13 Jan 2010 14:08:33 +0000 (14:08 +0000)
TOF/AliTOFFEEDump.cxx [new file with mode: 0644]
TOF/AliTOFFEEDump.h [new file with mode: 0644]
TOF/AliTOFPreprocessor.cxx
TOF/ShuttleInput/TOFFEE.20091217.194708.105517 [new file with mode: 0644]
TOF/TOFPreprocessor.C
TOF/TOFbaseLinkDef.h
TOF/libTOFbase.pkg

diff --git a/TOF/AliTOFFEEDump.cxx b/TOF/AliTOFFEEDump.cxx
new file mode 100644 (file)
index 0000000..125c2b6
--- /dev/null
@@ -0,0 +1,168 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/*
+  author: Roberto Preghenella (preghenella@bo.infn.it)
+*/
+///////////////////////////////////////////////////////////////
+//                                                           //
+//   This classes provide the object to store the full dump  //
+//   of TOF FEE configuration database.                      //
+//                                                           //
+///////////////////////////////////////////////////////////////
+
+#include "AliTOFFEEDump.h"
+#include <string.h>
+#include <iostream>
+#include <fstream>
+#include "TSystem.h"
+#include "AliLog.h"
+
+ClassImp(AliTOFFEEDump)
+
+//_______________________________________________________________
+
+AliTOFFEEDump::AliTOFFEEDump() :
+  TObject(),
+  fSize(0),
+  fData(NULL)
+{
+  /* default constructor */
+}
+
+#if 0
+//_______________________________________________________________
+
+AliTOFFEEDump::AliTOFFEEDump(const AliTOFFEEDump &source) :
+  TObject(source),
+  fSize(source.fSize),
+  fData(NULL)
+{
+  /* copy constructor */
+  
+  /* check size */
+  if (fSize == 0) return;
+
+  /* allocate and copy data */
+  fData = new UChar_t[fSize];
+  memcpy(fData, source.fData, fSize);
+}
+
+//_______________________________________________________________
+
+AliTOFFEEDump &
+AliTOFFEEDump::operator=(const AliTOFFEEDump &source)
+{
+  /* operator= */
+  
+  /* check source and destination size */
+  if (source.fSize == 0 || fSize != source.fSize) return *this;
+
+  /* copy data */
+  memcpy(fData, source.fData, fSize);
+  return *this;
+}
+#endif
+
+//_______________________________________________________________
+
+AliTOFFEEDump::~AliTOFFEEDump()
+{
+  /* default destructor */
+
+  if (fData) delete [] fData;
+}
+
+//_______________________________________________________________
+
+Bool_t
+AliTOFFEEDump::operator!=(const AliTOFFEEDump &source)
+{
+  /* operator!= */
+  
+  /* check size */
+  if (fSize != source.fSize) return kTRUE;
+
+  /* check data */
+  if (memcmp(fData, source.fData, fSize) != 0) return kTRUE;
+
+  return kFALSE;
+}
+
+//_______________________________________________________________
+
+Bool_t
+AliTOFFEEDump::ReadFromFile(const Char_t *filename)
+{
+  /* read from file */
+
+  /* open file */
+  Char_t *expandedFileName = gSystem->ExpandPathName(filename);
+  std::ifstream is;
+  is.open(expandedFileName, std::ios::binary);
+  if (!is.is_open()) {
+    AliError(Form("error while opening TOF FEE dump file: %s", filename));
+    return kFALSE;
+  }
+  AliInfo(Form("TOF FEE dump file opened: %s", filename));
+
+  /* get file size */
+  Int_t begin = is.tellg();
+  is.seekg(0, std::ios::end); /* end */
+  Int_t end = is.tellg();
+  Int_t size = end - begin;
+  is.seekg(0, std::ios::beg); /* rewind file */
+  if (size <= 0) {
+    AliError(Form("error while getting TOF FEE dump file size: %d", size));
+    return kFALSE;
+  }
+  AliInfo(Form("got TOF FEE dump file size: %d", size));
+
+  /* check previous allocation */
+  if (fData) {
+    AliWarning("data already allocated, old data will be overwritten");
+    delete [] fData;
+  }
+
+  /* allocate and read data */
+  fSize = size;
+  fData = new UChar_t[fSize];
+  is.read((Char_t *)fData, fSize);
+  AliInfo(Form("TOF FEE dump file stored"));
+
+  /* close file */
+  is.close();
+
+  return kTRUE;
+}
+
+//_______________________________________________________________
+
+void
+AliTOFFEEDump::DumpData() {
+  /* dump data */
+
+  printf("*** TOF FEE dump data ***\n");
+  printf("data size = %d bytes\n", fSize);
+  printf("*************************\n");
+  UInt_t nwords = fSize / 4;
+  UInt_t *data = (UInt_t *)fData;
+  for (Int_t iword = 0; iword < nwords; iword++) {
+    if (iword != 0 && iword % 4 == 0) printf("\n");
+    printf("%08x ", data[iword]);
+  }
+  printf("\n*************************\n");
+  
+}
diff --git a/TOF/AliTOFFEEDump.h b/TOF/AliTOFFEEDump.h
new file mode 100644 (file)
index 0000000..590c6c4
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef ALITOFFEEDUMP_H
+#define ALITOFFEEDUMP_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id: AliTOFDecoder.h,v 1.2 2007/05/08 11:55:24 arcelli Exp $ */
+
+///////////////////////////////////////////////////////////////
+//                                                           //
+//   This classes provide the object to store the full dump  //
+//   of TOF FEE configuration database.                      //
+//                                                           //
+///////////////////////////////////////////////////////////////
+
+#include "TObject.h"
+
+class AliTOFFEEDump :
+public TObject
+{
+
+ public:
+
+  AliTOFFEEDump(); /* default constructor */
+  virtual ~AliTOFFEEDump(); /* default destructor */
+  Bool_t operator!=(const AliTOFFEEDump &source); /* operator!= */
+  Bool_t operator==(const AliTOFFEEDump &source) {return !(*this != source);}; /* operator== */
+
+  UInt_t GetSize() const {return fSize;}; /* get size */
+  UChar_t *GetData() {return fData;}; /* get data */
+  Bool_t ReadFromFile(const Char_t *filename); /* read from file */
+  void DumpData(); /* dump data */
+
+ private:
+
+  AliTOFFEEDump(const AliTOFFEEDump &source); /* copy constructor */
+  AliTOFFEEDump &operator=(const AliTOFFEEDump &source); /* operator= */
+
+  UInt_t fSize; // size
+  UChar_t *fData; //[fSize] data
+
+  ClassDef(AliTOFFEEDump, 1);
+
+};
+
+#endif /* ALITOFFEEDUMP_H */
index 8c73a6f..4952fb8 100644 (file)
@@ -39,6 +39,7 @@
 #include "AliTOFRawStream.h"
 #include "AliTOFCableLengthMap.h"
 #include "AliTOFcalibHisto.h"
+#include "AliTOFFEEDump.h"
 
 
 // TOF preprocessor class.
@@ -989,11 +990,22 @@ UInt_t AliTOFPreprocessor::ProcessFEEData()
 
   TH1C hCurrentFEE("hCurrentFEE","histo with current FEE channel status", fNChannels, 0, fNChannels);
   
-  /* load current TOF FEE config from DCS FXS, parse, 
+  /* load current TOF FEE(dump) from DCS FXS, 
+   * setup TOFFEEdump object */
+
+  const char * toffeeFileName = GetFile(kDCS,"TofFeeMap",""); 
+  AliInfo(Form("toffee file name = %s", toffeeFileName));
+  if (toffeeFileName == NULL) {
+    return 15;
+  } 
+  AliTOFFEEDump feedump;
+  feedump.ReadFromFile(toffeeFileName);
+  
+  /* load current TOF FEE(light) config from DCS FXS, parse, 
    * fill current FEE histogram and set FEE status */
   
   const char * nameFile = GetFile(kDCS,"TofFeeLightMap",""); 
-  AliInfo(Form("nameFile = %s",nameFile));
+  AliInfo(Form("toffeeLight file name = %s",nameFile));
   if (nameFile == NULL) {
          return 15;
   } 
@@ -1066,22 +1078,35 @@ UInt_t AliTOFPreprocessor::ProcessFEEData()
   /* check whether we don't have to store reference data.
    * in this case we return without errors. */
   if (fStoreRefData) {
-         /* store reference data */
-         AliCDBMetaData metaDataHisto;
-         metaDataHisto.SetBeamPeriod(0);
-         metaDataHisto.SetResponsible("Roberto Preghenella");
-         metaDataHisto.SetComment("This preprocessor stores the FEE Ref data of the current run.");
-         AliInfo("Storing FEE reference data");
-         /* store FEE reference data */
-         if (!StoreReferenceData("Calib", "FEEData", &hCurrentFEE, &metaDataHisto)) {
-                 /* failed */
-                 Log("problems while storing FEE reference data");
-                 if (fStatus){
-                         delete fStatus;
-                         fStatus = 0;
-                 }
-                 return 18; /* error return code for problems while storing FEE reference data */
-         }
+    /* store reference data */
+    AliCDBMetaData metaDataHisto;
+    metaDataHisto.SetBeamPeriod(0);
+    metaDataHisto.SetResponsible("Roberto Preghenella");
+    metaDataHisto.SetComment("This preprocessor stores the FEE Ref data of the current run.");
+    AliInfo("Storing FEE reference data");
+    /* store FEE reference data */
+    if (!StoreReferenceData("Calib", "FEEData", &hCurrentFEE, &metaDataHisto)) {
+      /* failed */
+      Log("problems while storing FEE reference data");
+      if (fStatus){
+       delete fStatus;
+       fStatus = 0;
+      }
+      return 18; /* error return code for problems while storing FEE reference data */
+    }
+    
+    /* store TOF FEE dump reference data */
+    AliCDBMetaData metaDatadump;
+    metaDatadump.SetBeamPeriod(0);
+    metaDatadump.SetResponsible("Roberto Preghenella");
+    metaDatadump.SetComment("This preprocessor stores the TOF FEE dump Ref data of the current run.");
+    AliInfo("Storing TOF FEE dump reference data");
+    /* store FEE reference data */
+    if (!StoreReferenceData("Calib", "FEEDump", &feedump, &metaDatadump)) {
+      /* failed */
+      Log("problems while storing TOF FEE dump reference data");
+      return 18; /* error return code for problems while storing FEE reference data */
+    }
   }
 
   /* check whether we don't need to update OCDB.
diff --git a/TOF/ShuttleInput/TOFFEE.20091217.194708.105517 b/TOF/ShuttleInput/TOFFEE.20091217.194708.105517
new file mode 100644 (file)
index 0000000..1c38cf2
Binary files /dev/null and b/TOF/ShuttleInput/TOFFEE.20091217.194708.105517 differ
index bbd4490..4e27115 100644 (file)
@@ -21,7 +21,7 @@ void TOFPreprocessor(Char_t * RunType="PHYSICS")
   AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestReference");
 
   // create AliTestShuttle instance
-  Int_t nrun = 6;
+  Int_t nrun = 7;
   AliTestShuttle* shuttle = new AliTestShuttle(nrun, 30, 980);
   //setting run type to physiscs
   shuttle->SetInputRunType(RunType);
@@ -38,6 +38,7 @@ void TOFPreprocessor(Char_t * RunType="PHYSICS")
   shuttle->AddInputFile(AliTestShuttle::kDAQ, "TOF", "DELAYS", "MON", "$ALICE_ROOT/TOF/ShuttleInput/Total.root");
   shuttle->AddInputFile(AliTestShuttle::kDAQ, "TOF", "RUNLevel", "MON", "$ALICE_ROOT/TOF/ShuttleInput/Partial.root");
   shuttle->AddInputFile(AliTestShuttle::kDCS, "TOF", "TofFeeLightMap", "", "$ALICE_ROOT/TOF/ShuttleInput/TOFFEElight.20090616.102605.8000");
+  shuttle->AddInputFile(AliTestShuttle::kDCS, "TOF", "TofFeeMap", "", "$ALICE_ROOT/TOF/ShuttleInput/TOFFEE.20091217.194708.105517");
 
   TString filename;
   TString LDCname;
index ba98c45..174d905 100644 (file)
 #pragma link C++ class  AliTOFDataDCS+;
 #pragma link C++ class  AliTOFFormatDCS+;
 #pragma link C++ class  AliTOFFEEReader+;
+#pragma link C++ class  AliTOFFEEDump+;
 #pragma link C++ class  AliTOFCableLengthMap+;
 #pragma link C++ class  AliTOFNoiseConfigHandler+;
 #pragma link C++ class  AliTOFcalibHisto+;
 #pragma link C++ class  AliTOFArray+;
-#pragma link C++ class  AliTOFDaConfigHandler+;
 
 
 #endif
index 2ea2f0f..7acf22f 100644 (file)
@@ -22,11 +22,11 @@ SRCS  = AliTOFGeometry.cxx  \
         AliTOFFormatDCS.cxx \
        AliTOFPreprocessorFDR.cxx \
        AliTOFFEEReader.cxx \
+       AliTOFFEEDump.cxx \
        AliTOFCableLengthMap.cxx \
        AliTOFNoiseConfigHandler.cxx \
        AliTOFcalibHisto.cxx \
-       AliTOFArray.cxx \
-       AliTOFDaConfigHandler.cxx
+       AliTOFArray.cxx
 
 
 HDRS:= $(SRCS:.cxx=.h)
@@ -39,5 +39,5 @@ ifeq (win32gcc,$(ALICE_TARGET))
 PACKSOFLAGS:= $(SOFLAGS) -L$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET) \
                          -lSTEER -lCDB -lSTEERBase \
                          -lRAWDatarec -lRAWDatabase \
-                         -L$(ROOTLIBDIR) -lGeom
+                         -L$(shell root-config --libdir) -lGeom
 endif