]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Implementation of TOFFEE-DCS FXS file in TOF pp + small bug fixes... (R. Preghenella)
authorzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 14 Mar 2008 15:54:17 +0000 (15:54 +0000)
committerzampolli <zampolli@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 14 Mar 2008 15:54:17 +0000 (15:54 +0000)
TOF/AliTOFFEEConfig.h [new file with mode: 0644]
TOF/AliTOFFEEReader.cxx [new file with mode: 0644]
TOF/AliTOFFEEReader.h [new file with mode: 0644]

diff --git a/TOF/AliTOFFEEConfig.h b/TOF/AliTOFFEEConfig.h
new file mode 100644 (file)
index 0000000..d1b7cee
--- /dev/null
@@ -0,0 +1,213 @@
+#ifndef ALITOFFEECONFIG_H
+#define ALITOFFEECONFIG_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 TOF FEE config object.         //
+//                                                           //
+///////////////////////////////////////////////////////////////
+
+#include <time.h>
+#include "TROOT.h"
+
+class AliTOFDRMConfig
+{
+
+ private:
+
+  Int_t fDRMId; // DRM id
+  Int_t fOptLinkId; // opt link id
+  Int_t fFineDelayTTC; // fine delay TTC
+  Int_t fCoarseDelayTTC; // coarse delay TTC
+  Int_t fSelectTTC; // select TTC
+  Int_t fGhostDDL; // ghost DDL
+  Int_t fActiveTRM; // active TRM
+  Int_t fSlotMask; // slot mask
+  Int_t fPulserPolarity; // pulser polarity
+  Int_t fPulserFlag; // pulser flag
+  Int_t fPulserSection0; // pulser section 0
+  Int_t fPulserSection1; // pulser section 1
+  Int_t fPulserSection2; // pulser section 2
+  Int_t fPrePulseEnable; // pre pulse enable
+  Int_t fSelectMode; // select mode
+
+ public:
+
+  Int_t GetDRMId() const {return fDRMId;}; // get DRM id
+  Int_t GetOptLink() const {return fOptLinkId;}; // get opt link id
+  Int_t GetFineDelayTTC() const {return fFineDelayTTC;}; // get fine delay TTC
+  Int_t GetCoarseDelayTTC() const {return fCoarseDelayTTC;}; // get coarse delay TTC
+  Int_t GetSelectTTC() const {return fSelectTTC;}; // get select TTC
+  Int_t GetGhostDDL() const {return fGhostDDL;}; // get ghost DDL
+  Int_t GetActiveTRM() const {return fActiveTRM;}; // get active TRM
+  Int_t GetSlotMask() const {return fSlotMask;}; // get slot mask
+  Int_t GetPulserPolarity() const {return fPulserPolarity;}; // get pulser polarity
+  Int_t GetPulserFlag() const {return fPulserFlag;}; // get pulser flag
+  Int_t GetPulserSection0() const {return fPulserSection0;}; // get pulser section 0
+  Int_t GetPulserSection1() const {return fPulserSection1;}; // get pulser section 1
+  Int_t GetPulserSection2() const {return fPulserSection2;}; // get pulser section 2
+  Int_t GetPrePulserEnable() const {return fPrePulseEnable;}; // get pre pulse enable
+  Int_t GetSelectMode() const {return fSelectMode;}; // get select mode
+
+};
+
+class AliTOFLTMConfig
+{
+
+ private:
+
+  Int_t fSlotId; // slot id
+  Int_t fSuperModuleId; // super module id
+  Int_t fOptLinkId; // opt link id
+  Int_t fVMEAddress; // VME address
+  Int_t fThreshold; // threshold
+  Int_t fDelayLine0; // delay line 0
+  Int_t fDelayLine1; // delay line 1
+  Int_t fDelayLine2; // delay line 2
+  Int_t fDelayLine3; // delay line 3
+  Int_t fDelayLine4; // delay line 4
+  Int_t fDelayLine5; // delay line 5
+  Int_t fDelayLine6; // delay line 6
+  Int_t fDelayLine7; // delay line 7
+
+ public:
+
+  Int_t GetSlotId() const {return fSlotId;}; // get slot id
+  Int_t GetSuperModuleId() const {return fSuperModuleId;}; // get super module id
+  Int_t GetOptLinkId() const {return fOptLinkId;}; // get opt link id
+  Int_t GetVMEAddress() const {return fVMEAddress;}; // get VME address
+  Int_t GetThreshold() const {return fThreshold;}; // get threshold
+  Int_t GetDelayLine0() const {return fDelayLine0;}; // get delay line 0
+  Int_t GetDelayLine1() const {return fDelayLine1;}; // get delay line 1
+  Int_t GetDelayLine2() const {return fDelayLine2;}; // get delay line 2
+  Int_t GetDelayLine3() const {return fDelayLine3;}; // get delay line 3
+  Int_t GetDelayLine4() const {return fDelayLine4;}; // get delay line 4
+  Int_t GetDelayLine5() const {return fDelayLine5;}; // get delay line 5
+  Int_t GetDelayLine6() const {return fDelayLine6;}; // get delay line 6
+  Int_t GetDelayLine7() const {return fDelayLine7;}; // get delay line 7
+
+};
+
+class AliTOFTRMConfig
+{
+
+ private:
+
+  Int_t fSlotId; // slot id
+  Int_t fSuperModuleId; // super module id
+  Int_t fOptLinkId; // opt link id
+  Int_t fVMEAddress; // VME address
+  Int_t fMatchingWindow; // matching window
+  Int_t fLatencyWindow; // latency window
+  Int_t fTriggerLevelConfig; // trigger level config
+  Int_t fTriggerSubtraction; // trigger subtracion
+  Int_t fEdgeDetection; // edge detection
+  Int_t fPackingFlag; // packing flag
+  Int_t fChainAFlag; // chain A flag
+  Int_t fChainBFlag; // chain B flag
+  Int_t fMaskPB0; // mask PB 0
+  Int_t fMaskPB1; // mask PB 1
+  Int_t fMaskPB2; // mask PB 2
+  Int_t fMaskPB3; // mask PB 3
+  Int_t fMaskPB4; // mask PB 4
+  Int_t fMaskPB5; // mask PB 5
+  Int_t fMaskPB6; // mask PB 6
+  Int_t fMaskPB7; // mask PB 7
+  Int_t fMaskPB8; // mask PB 8
+  Int_t fMaskPB9; // mask PB 9
+
+ public:
+
+  Int_t GetSlotId() const {return fSlotId;}; // get slot id
+  Int_t GetSuperModuleId() const {return fSuperModuleId;}; // get super module id
+  Int_t GetOptLinkId() const {return fOptLinkId;}; // get opt link id
+  Int_t GetVMEAddress() const {return fVMEAddress;}; // get VME address
+  Int_t GetMatchingWindow() const {return fMatchingWindow;}; // get matching window
+  Int_t GetLatencyWindow() const {return fLatencyWindow;}; // get latency window
+  Int_t GetTriggerLevelConfig() const {return fTriggerLevelConfig;}; // get trigger level config
+  Int_t GetTriggerSubtraction() const {return fTriggerSubtraction;}; // get trigger subtracion
+  Int_t GetEdgeDetection() const {return fEdgeDetection;}; // get edge detection
+  Int_t GetPackingFlag() const {return fPackingFlag;}; // get packing flag
+  Int_t GetChainAFlag() const {return fChainAFlag;}; // get chain A flag
+  Int_t GetChainBFlag() const {return fChainBFlag;}; // get chain B flag
+  Int_t GetMaskPB0() const {return fMaskPB0;}; // get mask PB 0
+  Int_t GetMaskPB1() const {return fMaskPB1;}; // get mask PB 1
+  Int_t GetMaskPB2() const {return fMaskPB2;}; // get mask PB 2
+  Int_t GetMaskPB3() const {return fMaskPB3;}; // get mask PB 3
+  Int_t GetMaskPB4() const {return fMaskPB4;}; // get mask PB 4
+  Int_t GetMaskPB5() const {return fMaskPB5;}; // get mask PB 5
+  Int_t GetMaskPB6() const {return fMaskPB6;}; // get mask PB 6
+  Int_t GetMaskPB7() const {return fMaskPB7;}; // get mask PB 7
+  Int_t GetMaskPB8() const {return fMaskPB8;}; // get mask PB 8
+  Int_t GetMaskPB9() const {return fMaskPB9;}; // get mask PB 9
+
+};
+
+
+class AliTOFCrateConfig
+{
+
+ private:
+  
+  static const Int_t fgkNumberOfTRMs = 10; // number of TRMs
+
+  enum EStatus_t {
+    kStatusDisabled = 0,
+    kStatusEnabled = 1
+  };
+
+  Int_t fDRMEnabled; // DRM enabled
+  AliTOFDRMConfig fDRMConfig; // DRM config
+  Int_t fLTMEnabled; // LTM enabled
+  AliTOFLTMConfig fLTMConfig; // LTM config
+  Int_t fCPDMEnabled; // CPDM enabled
+  Int_t fTRMEnabled[fgkNumberOfTRMs]; // TRM enabled array
+  AliTOFTRMConfig fTRMConfig[fgkNumberOfTRMs]; // TRM config array
+
+ public:
+  
+  static Int_t GetNumberOfTRMs() {return fgkNumberOfTRMs;}; // get number of TRMs
+  Int_t GetDRMEnabled() const {return fDRMEnabled;}; // get DRM enabled
+  Bool_t IsDRMEnabled() const {return fDRMEnabled == kStatusEnabled;}; // is DRM enabled
+  AliTOFDRMConfig *GetDRMConfig() {return &fDRMConfig;}; // get DRM config
+  Int_t GetLTMEnabled() const {return fLTMEnabled;}; // get LTM enabled
+  Bool_t IsLTMEnabled() const {return fLTMEnabled == kStatusEnabled;}; // is LTM enabled
+  AliTOFLTMConfig *GetLTMConfig() {return &fLTMConfig;}; // get LTM config
+  Int_t GetCPDMEnabled() const {return fCPDMEnabled;}; // get CPDM enabled
+  Bool_t IsCPDMEnabled() const {return fCPDMEnabled == kStatusEnabled;}; // is CPDM enabled
+  Int_t GetTRMEnabled(UShort_t iTRM) const {return iTRM < GetNumberOfTRMs() ? fTRMEnabled[iTRM] : 0;}; // get TRM enabled
+  Bool_t IsTRMEnabled(UShort_t iTRM) const {return iTRM < GetNumberOfTRMs() ? fTRMEnabled[iTRM] ==  kStatusEnabled : 0;}; // is TRM enabled
+  AliTOFTRMConfig *GetTRMConfig(UShort_t iTRM) {return iTRM < GetNumberOfTRMs() ? &fTRMConfig[iTRM] : NULL;}; // get TRM config
+
+};
+
+class AliTOFFEEConfig
+{
+
+ private:
+
+  static const Int_t fgkNumberOfCrates = 72; // number of crates
+
+  Int_t fVersion; // version
+  time_t fDumpTime; // dump time
+  Int_t fRunNumber; // run number
+  Int_t fRunType; // run type
+  AliTOFCrateConfig fCrateConfig[fgkNumberOfCrates]; // crate config array
+
+ public:
+
+  static Int_t GetNumberOfCrates() {return fgkNumberOfCrates;}; // get number of crates
+  Int_t GetVersion() const {return fVersion;}; // get version
+  time_t GetDumpTime() const {return fDumpTime;}; // get dump time
+  Int_t GetRunNumber() const {return fRunNumber;}; // get run number
+  Int_t GetRunType() const {return fRunType;}; // get run type
+  AliTOFCrateConfig *GetCrateConfig(UShort_t iCrate) {return iCrate < GetNumberOfCrates() ? &fCrateConfig[iCrate] : NULL;}; // get crate config
+
+};
+
+#endif /* ALITOFFEE_H */
diff --git a/TOF/AliTOFFEEReader.cxx b/TOF/AliTOFFEEReader.cxx
new file mode 100644 (file)
index 0000000..6b2430f
--- /dev/null
@@ -0,0 +1,369 @@
+/**************************************************************************
+ * 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 (R+), Roberto.Preghenella@bo.infn.it
+ */
+
+//////////////////////////////////////////////////////////////////////
+//                                                                  //
+//                                                                  //
+//   This class provides the TOF FEE reader.                        //
+//                                                                  //
+//                                                                  //
+//////////////////////////////////////////////////////////////////////
+
+#include "AliTOFFEEReader.h"
+#include "AliTOFFEEConfig.h"
+#include "AliTOFRawStream.h"
+#include "AliLog.h"
+#include <fstream>
+
+ClassImp(AliTOFFEEReader)
+
+//_______________________________________________________________
+
+AliTOFFEEReader::AliTOFFEEReader() :
+  TObject(),
+  fFEEConfig(new AliTOFFEEConfig()),
+  fChannelEnabled()
+{
+  /* 
+   * 
+   * default constructor 
+   *
+   */
+
+}
+
+//_______________________________________________________________
+
+AliTOFFEEReader::AliTOFFEEReader(const AliTOFFEEReader &source) :
+  TObject(source),
+  fFEEConfig(new AliTOFFEEConfig())
+{
+  /* 
+   * 
+   * copy constructor 
+   *
+   */
+
+  memcpy(fFEEConfig, source.fFEEConfig, sizeof(AliTOFFEEConfig));
+}
+
+//_______________________________________________________________
+
+AliTOFFEEReader &
+AliTOFFEEReader::operator=(const AliTOFFEEReader &source)
+{
+  /* 
+   * 
+   * operator = 
+   * 
+   */
+
+  TObject::operator=(source);
+  memcpy(fFEEConfig, source.fFEEConfig, sizeof(AliTOFFEEConfig));
+  return *this;
+}
+
+//_______________________________________________________________
+
+AliTOFFEEReader::~AliTOFFEEReader()
+{
+  /* 
+   *
+   * default destructor 
+   *
+   */
+
+  delete fFEEConfig;
+}
+
+//_______________________________________________________________
+
+void
+AliTOFFEEReader::ResetChannelEnabledArray()
+{
+  /*
+   *
+   * reset channel enabled array
+   *
+   */
+
+  for (Int_t iIndex = 0; iIndex < GetNumberOfIndexes(); iIndex++)
+    fChannelEnabled[iIndex] = kFALSE;
+}
+
+//_______________________________________________________________
+
+void
+AliTOFFEEReader::LoadFEEConfig(const Char_t *FileName)
+{
+  /*
+   *
+   * load FEE config
+   *
+   */
+
+  std::ifstream is;
+  is.open(FileName, std::ios::binary);
+  is.read((Char_t *)fFEEConfig, sizeof(AliTOFFEEConfig));
+  is.close();
+}
+
+//_______________________________________________________________
+
+Int_t
+AliTOFFEEReader::ParseFEEConfig()
+{
+  /* 
+   *
+   * parse FEE config
+   *
+   * loops over all FEE channels, checks whether they are enabled
+   * and sets channel enabled 
+   *
+   */
+
+  AliInfo("parsing TOF FEE config")
+
+  AliTOFRawStream rawStream;
+  Int_t nEnabled = 0;
+  Int_t volume[5], index;
+  Int_t temp;
+
+  ResetChannelEnabledArray();
+
+  /* loop over all FEE channels */
+  for (Int_t iDDL = 0; iDDL < GetNumberOfDDLs(); iDDL++)
+    for (Int_t iTRM = 0; iTRM < GetNumberOfTRMs(); iTRM++)
+      for (Int_t iChain = 0; iChain < GetNumberOfChains(); iChain++)
+       for (Int_t iTDC = 0; iTDC < GetNumberOfTDCs(); iTDC++)
+         for (Int_t iChannel = 0; iChannel < GetNumberOfChannels(); iChannel++)
+           /* check whether FEE channel is enabled */
+           if (IsChannelEnabled(iDDL, iTRM + 3, iChain, iTDC, iChannel)) {
+             /* convert FEE channel indexes into detector indexes */
+             rawStream.EquipmentId2VolumeId(iDDL, iTRM + 3, iChain, iTDC, iChannel, volume);
+             /* swap padx and padz to fit AliTOFGeometry::GetIndex behaviour */
+             temp = volume[4]; volume[4] = volume[3]; volume[3] = temp; 
+             /* convert detector indexes into calibration index */
+             index = AliTOFGeometry::GetIndex(volume);
+             /* check calibration index */
+             if (index != -1 && index < GetNumberOfIndexes()) {
+               /* set calibration channel enabled */
+               fChannelEnabled[index] = kTRUE;
+               nEnabled++;
+             }
+           }
+  return nEnabled;
+}
+
+//_______________________________________________________________
+
+Bool_t 
+AliTOFFEEReader::IsChannelEnabled(Int_t iDDL, Int_t iTRM, Int_t iChain, Int_t iTDC, Int_t iChannel)
+{
+  /*
+   *
+   * is channel enabled
+   *
+   * checks whether a FEE channel is enabled using the
+   * TOF FEE config object.
+   *
+   */
+
+  AliTOFFEEConfig *feeConfig;
+  AliTOFCrateConfig *crateConfig;
+  AliTOFTRMConfig *trmConfig;
+  Int_t maskPB, maskTDC;
+  
+  /* get and check fee config */
+  if (!(feeConfig = GetFEEConfig()))
+    return kFALSE;
+  
+  /* get and check crate config */
+  if (!(crateConfig = feeConfig->GetCrateConfig(iDDL)))
+    return kFALSE;
+  
+  /* get and check TRM config */
+  if (!(trmConfig = crateConfig->GetTRMConfig(iTRM - 3)))
+    return kFALSE;
+
+  /* check DRM enabled */
+  if (!crateConfig->IsDRMEnabled())
+    return kFALSE;
+
+  /* check TRM enabled */
+  if (!crateConfig->IsTRMEnabled(iTRM - 3))
+    return kFALSE;
+
+  /* switch chain */
+  switch (iChain) {
+    /* chain A */
+  case 0:
+    /* check chain enabled */
+    if (trmConfig->GetChainAFlag() != 1)
+      return kFALSE;
+    /* switch TDC */
+    switch (iTDC) {
+    case 0: case 1: case 2:
+      maskPB = trmConfig->GetMaskPB0();
+      break;
+    case 3: case 4: case 5:
+      maskPB = trmConfig->GetMaskPB1();
+      break;
+    case 6: case 7: case 8:
+      maskPB = trmConfig->GetMaskPB2();
+      break;
+    case 9: case 10: case 11:
+      maskPB = trmConfig->GetMaskPB3();
+      break;
+    case 12: case 13: case 14:
+      maskPB = trmConfig->GetMaskPB4();
+      break;
+    default:
+      return kFALSE;
+      break;  
+    } /* switch TDC */
+    break; /* chain A */
+    /* chain B */
+  case 1:
+    /* check chain enabled */
+    if (trmConfig->GetChainBFlag() != 1)
+      return kFALSE;
+    /* switch TDC */
+    switch (iTDC) {
+    case 0: case 1: case 2:
+      maskPB = trmConfig->GetMaskPB5();
+      break;
+    case 3: case 4: case 5:
+      maskPB = trmConfig->GetMaskPB6();
+      break;
+    case 6: case 7: case 8:
+      maskPB = trmConfig->GetMaskPB7();
+      break;
+    case 9: case 10: case 11:
+      maskPB = trmConfig->GetMaskPB8();
+      break;
+    case 12: case 13: case 14:
+      maskPB = trmConfig->GetMaskPB9();
+      break;
+    default:
+      return kFALSE;
+      break;  
+    } /* switch TDC */
+    break; /* chain B */
+  default:
+    return kFALSE;
+    break;
+  } /* switch chain */
+
+  /* check channel enabled */
+  maskTDC = (maskPB & (0xFF << ((iTDC % 3) * 8))) >> ((iTDC % 3) * 8);
+  if (maskTDC & (0x1 << iChannel))
+    return kTRUE;
+  else
+    return kFALSE;
+  
+}
+
+
+void
+AliTOFFEEReader::DumpFEEConfig()
+{
+  /*
+   * 
+   * dump FEE config
+   *
+   */
+
+  AliTOFFEEConfig *feeConfig = GetFEEConfig();
+  AliTOFCrateConfig *crateConfig;
+  AliTOFDRMConfig *drmConfig;
+  AliTOFLTMConfig *ltmConfig;
+  AliTOFTRMConfig *trmConfig;
+
+  AliInfo("-------------------------------------");
+  AliInfo("dumping TOF FEE config");
+  AliInfo("-------------------------------------");
+  AliInfo(Form("version: %d", feeConfig->GetVersion()));
+  AliInfo(Form("dump time: %d", feeConfig->GetDumpTime()));
+  AliInfo(Form("run number: %d", feeConfig->GetRunNumber()));
+  AliInfo(Form("run type: %d", feeConfig->GetRunType()));
+  AliInfo("-------------------------------------");
+  
+  /* loop over crates */
+  for (Int_t iCrate = 0; iCrate < AliTOFFEEConfig::GetNumberOfCrates(); iCrate++) {
+    crateConfig = feeConfig->GetCrateConfig(iCrate);
+    
+    /* check crate config */
+    if (!crateConfig)
+      continue;
+    
+    /* check DRM enabled */
+    if (!crateConfig->IsDRMEnabled())
+    continue;
+
+    AliInfo(Form("crate id: %02d", iCrate));
+
+    /* dump DRM config */
+    drmConfig = crateConfig->GetDRMConfig();
+    AliInfo(Form("DRM is enabled: drmId=%d, slotMask=%03x", drmConfig->GetDRMId(), drmConfig->GetSlotMask()));
+
+    /* dump LTM config if enabled */
+    if (crateConfig->IsLTMEnabled()) {
+      ltmConfig = crateConfig->GetLTMConfig();
+      AliInfo(Form("LTM is enabled: threshold=%d", ltmConfig->GetThreshold()));
+    }
+    
+    /* dump CPDM config if enabled */
+    if (crateConfig->IsCPDMEnabled()) {
+      AliInfo(Form("CPDM is enabled"));
+    }
+    
+    /* loop over TRMs */
+    for (Int_t iTRM = 0; iTRM < AliTOFCrateConfig::GetNumberOfTRMs(); iTRM++) {
+
+      trmConfig = crateConfig->GetTRMConfig(iTRM);
+
+      /* check TRM config */
+      if (!trmConfig)
+       continue;
+      
+      /* check TRM enabled */
+      if (!crateConfig->IsTRMEnabled(iTRM))
+       continue;
+
+      /* dump TRM config */
+      AliInfo(Form("TRM%02d is enabled: matchWin=%d, latWin=%d, packFlag=%d", iTRM + 3, trmConfig->GetMatchingWindow(), trmConfig->GetLatencyWindow(), trmConfig->GetPackingFlag()));
+      
+      /* check TRM chain A flag */
+      if (trmConfig->GetChainAFlag() == 1) {
+       AliInfo(Form("TRM%02d chainA is enabled: PB0=%06X, PB1=%06X, PB2=%06X, PB3=%06X, PB4=%06X", iTRM + 3, trmConfig->GetMaskPB0(), trmConfig->GetMaskPB1(), trmConfig->GetMaskPB2(), trmConfig->GetMaskPB3(), trmConfig->GetMaskPB4()));
+      }
+
+      /* check TRM chain B flag */
+      if (trmConfig->GetChainBFlag() == 1) {
+       AliInfo(Form("TRM%02d chainB is enabled: PB5=%06X, PB6=%06X, PB7=%06X, PB8=%06X, PB9=%06X", iTRM + 3, trmConfig->GetMaskPB5(), trmConfig->GetMaskPB6(), trmConfig->GetMaskPB7(), trmConfig->GetMaskPB8(), trmConfig->GetMaskPB9()));
+      }
+      
+
+      
+    } /* loop over TRMs */
+    AliInfo("-------------------------------------");
+  } /* loop over crates */
+}
+
diff --git a/TOF/AliTOFFEEReader.h b/TOF/AliTOFFEEReader.h
new file mode 100644 (file)
index 0000000..d98da43
--- /dev/null
@@ -0,0 +1,69 @@
+#ifndef ALITOFFEEREADER_H
+#define ALITOFFEEREADER_H
+
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+///////////////////////////////////////////////////////////////
+//                                                           //
+//   This class provides the TOF FEE reader.                 //
+//                                                           //
+///////////////////////////////////////////////////////////////
+
+/* 
+ * author: Roberto Preghenella (R+), Roberto.Preghenella@bo.infn.it
+ */
+
+#include "TObject.h"
+#include "AliTOFGeometry.h"
+
+class AliTOFFEEConfig;
+
+class AliTOFFEEReader :
+public TObject 
+{
+
+ private:
+
+  static const Int_t fgkNumberOfDDLs = 72; // number of DDLs
+  static const Int_t fgkNumberOfTRMs = 10; // number of TRMs
+  static const Int_t fgkNumberOfChains = 2; // number of chains
+  static const Int_t fgkNumberOfTDCs = 15; // number of TDCs
+  static const Int_t fgkNumberOfChannels = 8; // number of channels
+  static const Int_t fgkNumberOfIndexes = 157248; // number of indexes
+
+  AliTOFFEEConfig *fFEEConfig; // FEE config
+  Bool_t fChannelEnabled[fgkNumberOfIndexes]; // channel enabled
+
+ public:
+
+  AliTOFFEEReader(); // default constructor
+  AliTOFFEEReader(const AliTOFFEEReader &source); // copy constructor
+  AliTOFFEEReader &operator=(const AliTOFFEEReader &source); // operator =
+  virtual ~AliTOFFEEReader(); // default destructor
+
+  /* getters */
+  static Int_t GetNumberOfDDLs() {return fgkNumberOfDDLs;}; // get number of DDLs
+  static Int_t GetNumberOfTRMs() {return fgkNumberOfTRMs;}; // get number of TRMs
+  static Int_t GetNumberOfChains() {return fgkNumberOfChains;}; // get number of chains
+  static Int_t GetNumberOfTDCs() {return fgkNumberOfTDCs;}; // get number of TDCs
+  static Int_t GetNumberOfChannels() {return fgkNumberOfChannels;}; // get number of channels
+  static Int_t GetNumberOfIndexes() {return fgkNumberOfIndexes;}; // get number of indexes
+  AliTOFFEEConfig *GetFEEConfig() const {return fFEEConfig;}; // get FEE config
+  Bool_t GetChannelEnabled(Int_t iIndex) const {return iIndex < GetNumberOfIndexes() ? fChannelEnabled[iIndex] : kFALSE;}; // get channel enabled
+  
+  /* setters */
+  
+  /* methods */
+  void LoadFEEConfig(const Char_t *FileName); // load FEE config
+  void DumpFEEConfig(); // dump FEE config
+  Int_t ParseFEEConfig(); // parse FEE config
+  void ResetChannelEnabledArray(); // reset channel enabled array
+  Bool_t IsChannelEnabled(Int_t iDDL, Int_t iTRM, Int_t iChain, Int_t iTDC, Int_t iChannel); // is channel enabled
+  Bool_t IsChannelEnabled(Int_t iIndex) {return GetChannelEnabled(iIndex);}; // is channel enabled
+  
+  ClassDef(AliTOFFEEReader, 1);
+
+};
+
+#endif /* ALITOFFEEREADER_H */