]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDParameters.cxx
Woops. TObject::MakeZombie is irrevertable. Made
[u/mrichter/AliRoot.git] / FMD / AliFMDParameters.cxx
index a0d58609cee342dd09d01c6066deba55d6be6f66..b5673afa8fd9d4daed3abc3357e7bcb26ad243b7 100644 (file)
@@ -1,4 +1,4 @@
-/**************************************************************************
+/*************************************************************************
  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
  *                                                                        *
  * Author: The ALICE Off-line Project.                                    *
  * 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.                  *
- **************************************************************************/
-/* $Id$ */
-/** @file    AliFMDParameters.cxx
-    @author  Christian Holm Christensen <cholm@nbi.dk>
-    @date    Mon Mar 27 12:44:26 2006
-    @brief   Manager of FMD parameters     
-*/
+ *************************************************************************
+ * $Id$ */
+/**
+ * @file    AliFMDParameters.cxx
+ * @author  Christian Holm Christensen <cholm@nbi.dk>
+ * @date    Mon Mar 27 12:44:26 2006
+ * @brief   Manager of FMD parameters     
+ */
 //____________________________________________________________________
 //                                                                          
 // Forward Multiplicity Detector based on Silicon wafers. 
@@ -58,20 +59,24 @@ ClassImp(AliFMDParameters)
 AliFMDParameters* AliFMDParameters::fgInstance = 0;
 
 //____________________________________________________________________
-const char* AliFMDParameters::fgkPulseGain      = "FMD/Calib/PulseGain";
-const char* AliFMDParameters::fgkPedestal       = "FMD/Calib/Pedestal";
-const char* AliFMDParameters::fgkDead           = "FMD/Calib/Dead";
-const char* AliFMDParameters::fgkSampleRate     = "FMD/Calib/SampleRate";
-const char* AliFMDParameters::fgkAltroMap       = "FMD/Calib/AltroMap";
-const char* AliFMDParameters::fgkZeroSuppression = "FMD/Calib/ZeroSuppression";
-const char* AliFMDParameters::fgkStripRange     = "FMD/Calib/StripRange";
-
+const char* AliFMDParameters::fgkPulseGain         = "FMD/Calib/PulseGain";
+const char* AliFMDParameters::fgkPedestal          = "FMD/Calib/Pedestal";
+const char* AliFMDParameters::fgkDead              = "FMD/Calib/Dead";
+const char* AliFMDParameters::fgkSampleRate        = "FMD/Calib/SampleRate";
+const char* AliFMDParameters::fgkAltroMap          = "FMD/Calib/AltroMap";
+const char* AliFMDParameters::fgkZeroSuppression    = "FMD/Calib/ZeroSuppression";
+const char* AliFMDParameters::fgkStripRange        = "FMD/Calib/StripRange";
+const char* AliFMDParameters::fkPedestalShuttleID   = "pedestals";
+const char* AliFMDParameters::fkGainShuttleID       = "gains";
+const char* AliFMDParameters::fkConditionsShuttleID = "conditions";
 
 //____________________________________________________________________
 AliFMDParameters* 
 AliFMDParameters::Instance() 
 {
+  // 
   // Get static instance 
+  //
   if (!fgInstance) fgInstance = new AliFMDParameters;
   return fgInstance;
 }
@@ -84,24 +89,31 @@ AliFMDParameters::AliFMDParameters()
     fAltroChannelSize(0),
     fChannelsPerAltro(0),
     fPedestalFactor(0),
-    fFixedPedestal(0),
-    fFixedPedestalWidth(0),
-    fFixedZeroSuppression(0),
-    fFixedSampleRate(0),
+    fZSPre(1),
+    fZSPost(1),
+    fZSPedSubtract(kTRUE),
+    fFixedPedestal(100),
+    fFixedPedestalWidth(2),
+    fFixedZeroSuppression(1),
+    fFixedSampleRate(2),
     fFixedThreshold(0),
     fFixedMinStrip(0),
-    fFixedMaxStrip(0),
-    fFixedPulseGain(0), 
+    fFixedMaxStrip(127),
+    fFixedPulseGain(2), 
     fEdepMip(0),
+    fHasCompleteHeader(kTRUE),
     fZeroSuppression(0), 
     fSampleRate(0), 
     fPedestal(0), 
     fPulseGain(0), 
     fDeadMap(0), 
     fAltroMap(0), 
-    fStripRange(0)
+  fStripRange(0),
+  fRunNo(-1)
 {
+  //
   // Default constructor 
+  //
   SetVA1MipRange();
   SetAltroChannelSize();
   SetChannelsPerAltro();
@@ -112,41 +124,217 @@ AliFMDParameters::AliFMDParameters()
   SetPedestalFactor();
   SetThreshold();
   SetStripRange();
+  SetGain();
+  fAltroMap = new AliFMDAltroMapping;
 }
 
 //__________________________________________________________________
-void
+Bool_t
+AliFMDParameters::CheckForNewRun()
+{
+  Int_t run = AliCDBManager::Instance()->GetRun();
+  if (run != fRunNo) { 
+    fIsInit = false;
+    fRunNo = run;
+  }
+  return run != fRunNo;
+}
+
+//__________________________________________________________________
+UShort_t
 AliFMDParameters::Init(Bool_t forceReInit, UInt_t what)
 {
-  // Initialize the parameters manager.  We need to get stuff from the
-  // CDB here. 
+  // 
+  // Initialize the manager.  This tries to read the parameters from
+  // CDB.  If that fails, the class uses the hard-coded parameters.
+  // 
+  // Parameters:
+  //    forceReInit Force (re-)initalize flag
+  //    what        What to initialize 
+  //
   if (forceReInit) fIsInit = kFALSE;
-  if (fIsInit) return;
-  if (what & kPulseGain)       InitPulseGain();
-  if (what & kPedestal)        InitPedestal();
-  if (what & kDeadMap)         InitDeadMap();
-  if (what & kSampleRate)      InitSampleRate();
-  if (what & kZeroSuppression) InitZeroSuppression();
-  if (what & kAltroMap)        InitAltroMap();
+  CheckForNewRun();
+
+  if (fIsInit) return 0;
+
+  UShort_t errMask = 0;
+  if (what & kPulseGain)       errMask |= InitPulseGain();
+  if (what & kPedestal)        errMask |= InitPedestal();
+  if (what & kDeadMap)         errMask |= InitDeadMap();
+  if (what & kSampleRate)      errMask |= InitSampleRate();
+  if (what & kZeroSuppression) errMask |= InitZeroSuppression();
+  if (what & kAltroMap)        errMask |= InitAltroMap();
+  if (what & kStripRange)      errMask |= InitStripRange();
   fIsInit = kTRUE;
+
+  return errMask;
 }
 //__________________________________________________________________
-void
+UShort_t
 AliFMDParameters::Init(AliFMDPreprocessor* pp, Bool_t forceReInit, UInt_t what)
 {
-  // Initialize the parameters manager.  We need to get stuff from the
-  // CDB here. 
+  // 
+  // Initialize the manager.  This tries to read the parameters from
+  // CDB.  If that fails, the class uses the hard-coded parameters.
+  // 
+  // Parameters:
+  //    pp          Preprocessor 
+  //    forceReInit Force (re-)initalize flag
+  //    what        What to initialize 
+  //
   if (forceReInit) fIsInit = kFALSE;
-  if (fIsInit) return;
-  if (what & kPulseGain)       InitPulseGain(pp);
-  if (what & kPedestal)        InitPedestal(pp);
-  if (what & kDeadMap)         InitDeadMap(pp);
-  if (what & kSampleRate)      InitSampleRate(pp);
-  if (what & kZeroSuppression) InitZeroSuppression(pp);
-  if (what & kAltroMap)        InitAltroMap(pp);
+  CheckForNewRun();
+
+  if (fIsInit) return 0;
+
+  UShort_t errMask = 0;
+  if (what & kPulseGain)       errMask |= InitPulseGain(pp);
+  if (what & kPedestal)        errMask |= InitPedestal(pp);
+  if (what & kDeadMap)         errMask |= InitDeadMap(pp);
+  if (what & kSampleRate)      errMask |= InitSampleRate(pp);
+  if (what & kZeroSuppression) errMask |= InitZeroSuppression(pp);
+  if (what & kAltroMap)        errMask |= InitAltroMap(pp);
+  if (what & kStripRange)      errMask |= InitStripRange(pp);
   fIsInit = kTRUE;
+
+  return errMask;
 }
 
+//__________________________________________________________________
+Bool_t
+AliFMDParameters::CheckFile(const char* prefix, 
+                           const char* path, 
+                           int         number, 
+                           TString&    f) const
+{
+  // 
+  // Check if the file <i>prefix</i><i>number</i> exists in @a path, 
+  // and write the full path to @a f.  
+  // 
+  // Parameters:
+  //    prefix  File prefix (cond, peds, gains, ...)
+  //    path    Path to files
+  //    number  Detector number (1, 2, or 3)
+  //    f       On return full path to file (if found)
+  // 
+  // Return:
+  //    @c true if file exists and is readable, @c false otherwise
+  //
+  f = (Form("%s%d.csv", prefix, number));
+  AliFMDDebug(5, ("Checking if %s exists in %s ...", f.Data(), path));
+  f = gSystem->Which(path, f.Data());
+  AliFMDDebug(5, ("Got back '%s'", f.Data()));
+  return !f.IsNull();
+}
+
+//__________________________________________________________________
+UShort_t
+AliFMDParameters::Init(const char* path, Bool_t forceReInit, UInt_t what)
+{
+  // 
+  // Initialize the manager.  This will try to read some calibrations
+  // (sample rate, strip range, gains, pedestals) from local comma
+  // separated value (CSV) files in the directory pointed at by @a
+  // path.  If they are not found, then they will be retrieved from
+  // OCDB as appropriately.   Other calibrations are always read from
+  // OCDB.  
+  // 
+  // The CSV files should be named as 
+  // 
+  // - Pedestals: <tt>peds</tt><i>det_number</i><tt>.csv</tt>
+  // - Gains: <tt>gains</tt><i>det_number</i><tt>.csv</tt>
+  // - Sample Rate: <tt>conditions</tt><i>det_number</i><tt>.csv</tt>
+  // - Strip Range: <tt>conditions</tt><i>det_number</i><tt>.csv</tt>
+  //
+  // where <i>det_number</i> is the detector number (1, 2, or 3). 
+  // 
+  // Parameters:
+  //    path        Where to look for the CSV files
+  //    forceReInit Always reinitialise 
+  //    what        What calibrations to load. 
+  //  
+  if (forceReInit) fIsInit = kFALSE;
+  CheckForNewRun();
+
+  if (fIsInit) return 0;
+
+  AliFMDCalibStripRange*  range = 0;
+  AliFMDCalibSampleRate*  rate  = 0;
+  AliFMDCalibPedestal*    peds  = 0;
+  AliFMDCalibGain*        gains = 0;
+
+  for (Int_t i = 1; i <= 3; i++) { 
+    TString f;
+    if (((what & kSampleRate) || (what & kStripRange)) && 
+       CheckFile("conditions", path, i, f)) {
+      if (!rate  && (what & kSampleRate)) rate  = new AliFMDCalibSampleRate;
+      if (!range && (what & kStripRange)) range = new AliFMDCalibStripRange;
+      std::ifstream in(f.Data());
+      if (range) range->ReadFromFile(in);
+      if (rate)  rate->ReadFromFile(in);
+      in.close();
+    }
+    if ((what & kPedestal) && CheckFile("peds", path, i, f)) {
+      if (!peds) peds  = new AliFMDCalibPedestal;
+      std::ifstream in(f.Data());
+      peds->ReadFromFile(in);
+      in.close();
+    }
+    if ((what & kPulseGain) && CheckFile("gains", path, i, f)) { 
+      if (!gains) gains = new AliFMDCalibGain;
+      std::ifstream in(f.Data());
+      gains->ReadFromFile(in);
+      in.close();
+    }
+  }
+
+  if (range) what &= ~kStripRange;
+  if (rate)  what &= ~kSampleRate;
+  if (peds)  what &= ~kPedestal;
+  if (gains) what &= ~kPulseGain;
+
+  UShort_t ret = Init(kFALSE, what);
+  
+  if (range) SetStripRange(range);
+  if (rate)  SetSampleRate(rate);
+  if (peds)  SetPedestal(peds);
+  if (gains) SetGain(gains);
+
+  fIsInit = kTRUE;
+
+  return ret;
+}
+
+//__________________________________________________________________
+void
+AliFMDParameters::MakeDeadMap(Float_t maxNoise, 
+                             Float_t minGain, 
+                             Float_t maxGain)
+{
+  // 
+  // Automatically generate a dead map from the pedestals and gains.
+  // A channel is marked as dead of the noise is too high (currently
+  // more than 10 ADC counts), or the gain is unreasonable (currently
+  // larger than 10, or smaller than 0.1). 
+  // 
+  // The procedure does not overwrite channels previously marked as
+  // dead - e.g., channels marked as dead in the calibration loaded
+  // from OCDB will continue to be marked as dead.  That is, this
+  // procedure will never make a channel un-dead. 
+  // 
+  // Parameters:
+  //    maxNoise  Maximum noise value before a channel is marked
+  // as dead. 
+  //    minGain   Minimum value of the calibrated gain before a
+  // channel is considered dead. 
+  //    maxGain   Maximum value of the calibrated gain before a
+  // channel is considered dead. 
+  //
+  if (fPedestal)  
+    fDeadMap = fPedestal->MakeDeadMap(maxNoise, fDeadMap);
+  if (fPulseGain) 
+    fDeadMap = fPulseGain->MakeDeadMap(minGain, maxGain, fDeadMap);
+}
 //__________________________________________________________________
 #define DET2IDX(det,ring,sec,str) \
   (det * 1000 + (ring == 'I' ? 0 : 512) + str)  
@@ -155,41 +343,56 @@ AliFMDParameters::Init(AliFMDPreprocessor* pp, Bool_t forceReInit, UInt_t what)
 void
 AliFMDParameters::Draw(Option_t* option)
 {
+  // 
+  // Draw parameters. 
+  // 
+  // Parameters:
+  //    option What to draw. Should be one of 
+  // - dead      Dead channels
+  // - threshold Threshold
+  // - gain      Gain
+  // - pedestal  Pedestal
+  // - noise     Noise (or pedestal width)
+  // - zero      Zero suppression
+  // - rate      Sampling rate (VA1 clock / ALTRO clock)
+  // - min       Minimum strip read out
+  // - max       Maximum strip read out
+  // - map       hardware address
+  //
   TString opt(option);
   enum {
-    kPulseGain,       // Path to PulseGain calib object
-    kThreshold,       // Path to PulseGain calib object
-    kPedestal,        // Path to Pedestal calib object
-    kPedestalWidth,   // Path to Pedestal calib object
-    kDead,            // Path to Dead calib object
-    kSampleRate,      // Path to SampleRate calib object
-    kAltroMap,        // Path to AltroMap calib object
-    kZeroSuppression, // Path to ZeroSuppression cal object
-    kMinStripRange,   // Path to strip range cal object
-    kMaxStripRange    // Path to strip range cal object
+    kLocalPulseGain,       // Path to PulseGain calib object
+    kLocalThreshold,       // Path to PulseGain calib object
+    kLocalPedestal,        // Path to Pedestal calib object
+    kLocalPedestalWidth,   // Path to Pedestal calib object
+    kLocalDead,            // Path to Dead calib object
+    kLocalSampleRate,      // Path to SampleRate calib object
+    kLocalAltroMap,        // Path to AltroMap calib object
+    kLocalZeroSuppression, // Path to ZeroSuppression cal object
+    kLocalMinStripRange,   // Path to strip range cal object
+    kLocalMaxStripRange    // Path to strip range cal object
   } what;
-  
     
   if      (opt.Contains("dead", TString::kIgnoreCase)) 
-    what = kDead;
+    what = kLocalDead;
   else if (opt.Contains("threshold",TString::kIgnoreCase)) 
-    what = kThreshold;
+    what = kLocalThreshold;
   else if (opt.Contains("gain",TString::kIgnoreCase)) 
-    what = kPulseGain;
+    what = kLocalPulseGain;
   else if (opt.Contains("pedestal",TString::kIgnoreCase)) 
-    what = kPedestal;
+    what = kLocalPedestal;
   else if (opt.Contains("noise",TString::kIgnoreCase)) 
-    what = kPedestalWidth;
+    what = kLocalPedestalWidth;
   else if (opt.Contains("zero",TString::kIgnoreCase)) 
-    what = kZeroSuppression;
+    what = kLocalZeroSuppression;
   else if (opt.Contains("rate",TString::kIgnoreCase)) 
-    what = kSampleRate;
+    what = kLocalSampleRate;
   else if (opt.Contains("min",TString::kIgnoreCase)) 
-    what = kMinStripRange;
+    what = kLocalMinStripRange;
   else if (opt.Contains("max",TString::kIgnoreCase)) 
-    what = kMaxStripRange;
+    what = kLocalMaxStripRange;
   else if (opt.Contains("map",TString::kIgnoreCase)) 
-    what = kAltroMap;
+    what = kLocalAltroMap;
   else {
     Warning("Draw", "unknown parameter: %s\n\tShould be one of\n\t"
            "dead, threshold, gain, pedestal, noise, zero, rate, "
@@ -224,7 +427,7 @@ AliFMDParameters::Draw(Option_t* option)
     }
   }
   TArrayD ybins(41);
-  for (Int_t i = 0; i < ybins.fN; i++) ybins[i] = Float_t(i - .5);
+  for (/*Int_t*/ i = 0; i < ybins.fN; i++) ybins[i] = Float_t(i - .5);
   TH2D* hist = new TH2D("calib", Form("Calibration %s", option), 
                        xbins.fN-1, xbins.fArray,  
                        ybins.fN-1, ybins.fArray);
@@ -243,29 +446,29 @@ AliFMDParameters::Draw(Option_t* option)
       for (UShort_t sec = 0; sec < nSector; sec++) {
        for (UShort_t str = 0; str < nStrip; str++) {
          Int_t idx = DET2IDX(det, ring, sec, str);
-         UInt_t ddl, addr;
+         UShort_t ddl, addr, time, sam=0;
          Double_t val = 0;
          switch (what) {
-         case kPulseGain:       // Path to PulseGain calib object
+         case kLocalPulseGain:       // Path to PulseGain calib object
             val = GetPulseGain(det,ring,sec,str); break;
-         case kThreshold:       // Path to PulseGain calib object
+         case kLocalThreshold:       // Path to PulseGain calib object
             val = GetThreshold(); break;
-         case kPedestal:        // Path to Pedestal calib object
+         case kLocalPedestal:        // Path to Pedestal calib object
             val = GetPedestal(det,ring,sec,str); break;
-         case kPedestalWidth:   // Path to Pedestal calib object
+         case kLocalPedestalWidth:   // Path to Pedestal calib object
             val = GetPedestalWidth(det,ring,sec,str); break;
-         case kDead:            // Path to Dead calib object
+         case kLocalDead:            // Path to Dead calib object
             val = IsDead(det,ring,sec,str); break;
-         case kSampleRate:      // Path to SampleRate calib object
+         case kLocalSampleRate:      // Path to SampleRate calib object
             val = GetSampleRate(det,ring,sec,str); break;
-         case kAltroMap:        // Path to AltroMap calib object
-           Detector2Hardware(det,ring,sec,str, ddl, addr); 
+         case kLocalAltroMap:        // Path to AltroMap calib object
+           Detector2Hardware(det,ring,sec,str,sam,ddl,addr,time); 
             val = addr; break;
-         case kZeroSuppression: // Path to ZeroSuppression cal object
+         case kLocalZeroSuppression: // Path to ZeroSuppression cal object
             val = GetZeroSuppression(det,ring,sec,str); break;
-         case kMinStripRange:   // Path to strip range cal object
+         case kLocalMinStripRange:   // Path to strip range cal object
             val = GetMinStrip(det,ring,sec,str); break;
-         case kMaxStripRange:    // Path to strip range cal object
+         case kLocalMaxStripRange:    // Path to strip range cal object
             val = GetMaxStrip(det,ring,sec,str); break;
          }
          hist->Fill(idx,sec,val);
@@ -302,9 +505,12 @@ AliFMDParameters::Print(Option_t* option) const
   
   
   if (opt.Contains("fmd",TString::kIgnoreCase)) {
-    showStrips    = kTRUE;
-    size_t   i    = opt.Index("fmd",TString::kIgnoreCase);
-    size_t   j    = opt.Index("]",TString::kIgnoreCase);
+    Int_t   i    = opt.Index("fmd",TString::kIgnoreCase);
+    Int_t   j    = opt.Index("]",TString::kIgnoreCase);
+    if (j != kNPOS)
+      showStrips    = kTRUE;
+    else 
+      j = opt.Length();
     enum {
       kReadDet, 
       kReadRing, 
@@ -398,17 +604,20 @@ AliFMDParameters::Print(Option_t* option) const
       if (det == 1 && ring == 'O') continue;
       UShort_t min  = GetMinStrip(det, ring, 0, 0);
       UShort_t max  = GetMaxStrip(det, ring, 0, 0);
-      UShort_t rate = GetSampleRate(det, ring, 0, 0);
       std::cout << "FMD" << det << ring 
                << "  Strip range: " 
                << std::setw(3) << min << "," 
-               << std::setw(3) << max << "  Rate: " 
-               << std::setw(2) << rate << std::endl;
+               << std::setw(3) << max << std::endl;
 
-      if (!showStrips) continue;
       UShort_t nSec = ( ring == 'I' ? 20  :  40 );
       UShort_t nStr = ( ring == 'I' ? 512 : 256 );
       for (UShort_t sec = minSector; sec < maxSector && sec < nSec; sec++) {
+
+       UShort_t rate = GetSampleRate(det, ring, sec, 0);
+       std::cout << "FMD" << det << ring << "[" << std::setw(2) << sec 
+                 << "] sample rate: " << rate << std::endl;
+
+       if (!showStrips) continue;
        std::cout 
          << "  Strip |     Pedestal      |    Gain    | ZS thr. | Address\n" 
          << "--------+-------------------+------------+---------+---------" 
@@ -421,8 +630,8 @@ AliFMDParameters::Print(Option_t* option) const
            std::cout << "dead" << std::endl;
            continue;
          }
-         UInt_t ddl, addr;
-         Detector2Hardware(det, ring, sec, str, ddl, addr);
+         UShort_t ddl, addr, time, sam=0;
+         Detector2Hardware(det, ring, sec, str, sam, ddl, addr, time);
          std::cout << std::setw(7) << GetPedestal(det, ring, sec, str) 
                    << "+/-" << std::setw(7) 
                    << GetPedestalWidth(det, ring, sec, str) 
@@ -443,21 +652,22 @@ AliFMDParameters::Print(Option_t* option) const
   
 }
 
-//__________________________________________________________________
-void
-AliFMDParameters::SetStripRange(UShort_t min, UShort_t max) 
-{
-  // Set fixed strip range 
-  fFixedMinStrip = min;
-  fFixedMaxStrip = max;
-}
-
 //__________________________________________________________________
 AliCDBEntry*
 AliFMDParameters::GetEntry(const char* path, AliFMDPreprocessor* pp, 
                           Bool_t fatal) const
 {
-  // Get an entry from the CDB or via preprocessor 
+  // 
+  // Get an entry from either global AliCDBManager or passed
+  // AliFMDPreprocessor. 
+  // 
+  // Parameters:
+  //    path  Path to CDB object. 
+  //    pp    AliFMDPreprocessor 
+  //    fatal If true, raise a fatal flag if we didn't get the entry.
+  // Return:
+  //    AliCDBEntry if found 
+  // 
   AliCDBEntry* entry = 0;
   if (!pp) {
     AliCDBManager* cdb = AliCDBManager::Instance();
@@ -477,99 +687,202 @@ AliFMDParameters::GetEntry(const char* path, AliFMDPreprocessor* pp,
                               __LINE__);
     return 0;
   }
+  if (entry && AliLog::GetDebugLevel("FMD", "") > 0) { 
+    AliInfoF("Got entry %p for %s", entry, path);
+    entry->PrintId();
+    entry->PrintMetaData();                    
+    entry->Print();
+  }
   return entry;
 }
 
     
 //__________________________________________________________________
-void
+UShort_t
 AliFMDParameters::InitPulseGain(AliFMDPreprocessor* pp)
 {
-  // Get pulse gain from CDB or used fixed 
+  // 
+  // Initialize gains.  Try to get them from CDB 
+  // 
+  // Parameters:
+  //    pp Pre-processor if called from shuttle
+  //
   AliCDBEntry*   gain     = GetEntry(fgkPulseGain, pp);
-  if (!gain) return;
+  if (!gain) return kPulseGain;
   
-  AliFMDDebug(1, ("Got gain from CDB"));
+  AliFMDDebug(5, ("Got gain from CDB"));
   fPulseGain = dynamic_cast<AliFMDCalibGain*>(gain->GetObject());
-  if (!fPulseGain) AliFatal("Invalid pulser gain object from CDB");
+  if (!fPulseGain) { 
+    AliError("Invalid pulser gain object from CDB");
+    return kPulseGain;
+  }
+  if (!fPulseGain->Values().Ptr()) {
+    AliError("Empty pulser gain object from CDB");
+    return kPulseGain;
+  }
+  return 0;
 }
 //__________________________________________________________________
-void
+UShort_t
 AliFMDParameters::InitPedestal(AliFMDPreprocessor* pp)
 {
-  // Initialize the pedestals from CDB 
+  //
+  // Initialize pedestals.  Try to get them from CDB
+  // 
+  // Parameters:
+  //    pp Pre-processor if called from shuttle
+  //
   AliCDBEntry*   pedestal = GetEntry(fgkPedestal, pp);
-  if (!pedestal) return;
+  if (!pedestal) return kPedestal;
 
-  AliFMDDebug(1, ("Got pedestal from CDB"));
+  AliFMDDebug(5, ("Got pedestal from CDB"));
   fPedestal = dynamic_cast<AliFMDCalibPedestal*>(pedestal->GetObject());
-  if (!fPedestal) AliFatal("Invalid pedestal object from CDB");
+  if (!fPedestal) {
+    AliError("Invalid pedestal object from CDB");
+    return kPedestal;
+  }
+  if (!fPedestal->Values().Ptr()) {
+    AliError("Empty pedestal object from CDB");
+    return kPedestal;
+  }
+  return 0;
 }
 
 //__________________________________________________________________
-void
+UShort_t
 AliFMDParameters::InitDeadMap(AliFMDPreprocessor* pp)
 {
-  // Get Dead-channel-map from CDB 
+  //
+  // Initialize dead map.  Try to get it from CDB
+  // 
+  // Parameters:
+  //    pp Pre-processor if called from shuttle
+  //
   AliCDBEntry*   deadMap  = GetEntry(fgkDead, pp);
-  if (!deadMap) return;
+  if (!deadMap) return kDeadMap;
   
-  AliFMDDebug(1, ("Got dead map from CDB"));
+  AliFMDDebug(5, ("Got dead map from CDB"));
   fDeadMap = dynamic_cast<AliFMDCalibDeadMap*>(deadMap->GetObject());
-  if (!fDeadMap) AliFatal("Invalid dead map object from CDB");
+  if (!fDeadMap) { 
+    AliError("Invalid dead map object from CDB");
+    return kDeadMap;
+  }
+  if (!fDeadMap->Ptr()) {
+    AliError("Empty dead map object from CDB");
+    return kDeadMap;
+  }
+  return 0;
 }
 
 //__________________________________________________________________
-void
+UShort_t
 AliFMDParameters::InitZeroSuppression(AliFMDPreprocessor* pp)
 {
-  // Get 0-suppression from CDB 
+  //
+  // Initialize zero suppression thresholds.  Try to get them from CDB
+  // 
+  // Parameters:
+  //    pp Pre-processor if called from shuttle
+  //
   AliCDBEntry*   zeroSup  = GetEntry(fgkZeroSuppression, pp);
-  if (!zeroSup) return;
-  AliFMDDebug(1, ("Got zero suppression from CDB"));
+  if (!zeroSup) return kZeroSuppression;
+
+  AliFMDDebug(5, ("Got zero suppression from CDB"));
   fZeroSuppression = 
     dynamic_cast<AliFMDCalibZeroSuppression*>(zeroSup->GetObject());
-  if (!fZeroSuppression)AliFatal("Invalid zero suppression object from CDB");
+  if (!fZeroSuppression) {
+    AliError("Invalid zero suppression object from CDB");
+    return kZeroSuppression;
+  }
+  if (!fZeroSuppression->Ptr()) {
+    AliWarningF("Empty zero suppression object from CDB, assuming %d",
+               fFixedZeroSuppression);
+    AliCDBManager* cdbMan = AliCDBManager::Instance();
+    if(!cdbMan || !cdbMan->GetCacheFlag())
+      delete fZeroSuppression;
+    fZeroSuppression = 0;
+  }
+  return 0;
 }
 
 //__________________________________________________________________
-void
+UShort_t
 AliFMDParameters::InitSampleRate(AliFMDPreprocessor* pp)
 {
-  // get Sample rate from CDB
+  //
+  // Initialize sample rates.  Try to get them from CDB
+  // 
+  // Parameters:
+  //    pp Pre-processor if called from shuttle
+  //
   AliCDBEntry*   sampRat  = GetEntry(fgkSampleRate, pp);
-  if (!sampRat) return;
-  AliFMDDebug(1, ("Got zero suppression from CDB"));
+  if (!sampRat) return kSampleRate;
+
+  AliFMDDebug(5, ("Got zero suppression from CDB"));
   fSampleRate = dynamic_cast<AliFMDCalibSampleRate*>(sampRat->GetObject());
-  if (!fSampleRate) AliFatal("Invalid zero suppression object from CDB");
+  if (!fSampleRate) {
+    AliError("Invalid sample rate object from CDB");
+    return kSampleRate;
+  }
+  if (!fSampleRate->Rates().Ptr()) { 
+    AliError("empty sample rate object from CDB");
+    return kSampleRate;
+  }
+  return 0;
 }
 
 //__________________________________________________________________
-void
+UShort_t
 AliFMDParameters::InitAltroMap(AliFMDPreprocessor* pp)
 {
-  // Get hardware mapping from CDB
-  AliCDBEntry*   hwMap    = GetEntry(fgkAltroMap, pp);       
-  if (!hwMap) return;
-
-  AliFMDDebug(1, ("Got ALTRO map from CDB"));
-  fAltroMap = dynamic_cast<AliFMDAltroMapping*>(hwMap->GetObject());
+  //
+  // Initialize hardware map.  Try to get it from CDB
+  // 
+  // Parameters:
+  //    pp Pre-processor if called from shuttle
+  //
+  if (fAltroMap) { 
+    delete fAltroMap;
+    fAltroMap = 0;
+  }
+  AliCDBEntry*   hwMap    = GetEntry(fgkAltroMap, pp, kFALSE);       
+  if (hwMap) {
+    AliFMDDebug(5, ("Got ALTRO map from CDB"));
+    fAltroMap = dynamic_cast<AliFMDAltroMapping*>(hwMap->GetObject());
+  }
   if (!fAltroMap) {
-    AliFatal("Invalid ALTRO map object from CDB");
+    AliError("Invalid ALTRO map object from CDB");
     fAltroMap = new AliFMDAltroMapping;
+    // return kAltroMap;
   }
+  return 0;
 }
 
 //__________________________________________________________________
-void
+UShort_t
 AliFMDParameters::InitStripRange(AliFMDPreprocessor* pp)
 {
-  // Get strips read-out from CDB
+  //
+  // Initialize strip range.  Try to get it from CDB
+  // 
+  // Parameters:
+  //    pp Pre-processor if called from shuttle
+  //
   AliCDBEntry*   range    = GetEntry(fgkStripRange, pp);
-  if (!range) return;
-  AliFMDDebug(1, ("Got strip range from CDB"));
+  if (!range) return kStripRange;
+
+  AliFMDDebug(5, ("Got strip range from CDB"));
   fStripRange = dynamic_cast<AliFMDCalibStripRange*>(range->GetObject());
-  if (!fStripRange) AliFatal("Invalid strip range object from CDB");
+
+  if (!fStripRange) {
+    AliError("Invalid strip range object from CDB");
+    return kStripRange;
+  }
+  if (!fStripRange->Ranges().Ptr()) {
+    AliError("Empty strip range object from CDB");
+    return kStripRange;
+  }
+  return 0;
 }
 
 
@@ -577,7 +890,13 @@ AliFMDParameters::InitStripRange(AliFMDPreprocessor* pp)
 Float_t
 AliFMDParameters::GetThreshold() const
 {
-  // Get threshold from CDB
+  // 
+  // Get the threshold in the pulser gain 
+  // 
+  // 
+  // Return:
+  //    Threshold from pulser 
+  //
   if (!fPulseGain) return fFixedThreshold;
   return fPulseGain->Threshold();
 }
@@ -587,15 +906,25 @@ Float_t
 AliFMDParameters::GetPulseGain(UShort_t detector, Char_t ring, 
                               UShort_t sector, UShort_t strip) const
 {
-  // Returns the pulser calibrated gain for strip # strip in sector #
-  // sector or ring id ring of detector # detector. 
   // 
-  // For simulation, this is normally set to 
+  // Gain of pre-amp. for strip, sector, ring, detector 
+  //
+  // For simulations this is normally set to 
+  //
+  // @f[ 
+  //  \frac{\mbox{VA1_MIP_Range}{\mbox{ALTRO_channel_size}}\mbox{MIP_Energy_Loss}
+  // @f]
   // 
-  //       VA1_MIP_Range 
-  //    ------------------ * MIP_Energy_Loss
-  //    ALTRO_channel_size
   // 
+  // Parameters:
+  //    detector Detector # (1-3)
+  //    ring     Ring ID ('I' or 'O')
+  //    sector   Sector number (0-39)
+  //    strip    Strip number (0-511)
+  //
+  // Return:
+  //    Gain of pre-amp.  
+  //
   if (!fPulseGain) { 
     if (fFixedPulseGain <= 0)
       fFixedPulseGain = fVA1MipRange * GetEdepMip() / fAltroChannelSize;
@@ -612,7 +941,19 @@ Bool_t
 AliFMDParameters::IsDead(UShort_t detector, Char_t ring, 
                         UShort_t sector, UShort_t strip) const
 {
-  // Check if the channel is dead 
+  // 
+  // Whether the strip is considered dead
+  // 
+  // Parameters:
+  //    detector Detector # (1-3)
+  //    ring     Ring ID ('I' or 'O')
+  //    sector   Sector number (0-39)
+  //    strip    Strip number (0-511)
+  //
+  // Return:
+  //    @c true if the strip is considered dead, @c false if it's
+  // OK.
+  //
   if (!fDeadMap) return kFALSE;
   AliFMDDebug(50, ("Dead for FMD%d%c[%2d,%3d]=%s",
                    detector, ring, sector, strip,
@@ -626,10 +967,26 @@ UShort_t
 AliFMDParameters::GetZeroSuppression(UShort_t detector, Char_t ring, 
                                     UShort_t sector, UShort_t strip) const
 {
-  // Get zero suppression threshold 
+  // 
+  // zero suppression threshold (in ADC counts)
+  // 
+  // Parameters:
+  //    detector Detector # (1-3)
+  //    ring     Ring ID ('I' or 'O')
+  //    sector   Sector number (0-39)
+  //    strip    Strip number (0-511)
+  //
+  // Return:
+  //    zero suppression threshold (in ADC counts) 
+  //
   if (!fZeroSuppression) return fFixedZeroSuppression;
+
+  // In case of empty zero suppression objects. 
+  if (!fZeroSuppression->Ptr() || 
+      fZeroSuppression->MaxIndex() <= 0) return fFixedZeroSuppression;
+
   // Need to map strip to ALTRO chip. 
-  AliFMDDebug(50, ("zero sup. for FMD%d%c[%2d,%3d]=%f",
+  AliFMDDebug(50, ("zero sup. for FMD%d%c[%2d,%3d]=%d",
                    detector, ring, sector, strip,
                    fZeroSuppression->operator()(detector, ring, 
                                                 sector, strip)));
@@ -641,7 +998,18 @@ UShort_t
 AliFMDParameters::GetSampleRate(UShort_t det, Char_t ring, UShort_t sector, 
                                UShort_t str) const
 {
-  // Get sampl rate 
+  // 
+  // Get the sampling rate
+  // 
+  // Parameters:
+  //    detector Detector # (1-3)
+  //    ring     Ring ID ('I' or 'O')
+  //    sector   Sector number (0-39)
+  //    strip    Strip number (0-511)
+  //
+  // Return:
+  //    The sampling rate 
+  //
   if (!fSampleRate) return fFixedSampleRate;
   // Need to map sector to digitizier card. 
   UInt_t ret = fSampleRate->Rate(det, ring, sector, str);
@@ -655,7 +1023,18 @@ UShort_t
 AliFMDParameters::GetMinStrip(UShort_t det, Char_t ring, UShort_t sector, 
                              UShort_t str) const
 {
-  // Get strip range read out 
+  // 
+  // Get the minimum strip in the read-out range
+  // 
+  // Parameters:
+  //    detector Detector # (1-3)
+  //    ring     Ring ID ('I' or 'O')
+  //    sector   Sector number (0-39)
+  //    strip    Strip number (0-511)
+  //
+  // Return:
+  //    Minimum strip 
+  //
   if (!fStripRange) return fFixedMinStrip;
   // Need to map sector to digitizier card. 
   UInt_t ret = fStripRange->Min(det, ring, sector, str);
@@ -669,7 +1048,18 @@ UShort_t
 AliFMDParameters::GetMaxStrip(UShort_t det, Char_t ring, UShort_t sector, 
                              UShort_t str) const
 {
-  // Get strip range read out 
+  // 
+  // Get the maximum strip in the read-out range
+  // 
+  // Parameters:
+  //    detector Detector # (1-3)
+  //    ring     Ring ID ('I' or 'O')
+  //    sector   Sector number (0-39)
+  //    strip    Strip number (0-511)
+  //
+  // Return:
+  //    Maximum strip 
+  //
   if (!fStripRange) return fFixedMaxStrip;
   // Need to map sector to digitizier card. 
   UInt_t ret = fStripRange->Max(det, ring, sector, str);
@@ -683,7 +1073,18 @@ Float_t
 AliFMDParameters::GetPedestal(UShort_t detector, Char_t ring, 
                              UShort_t sector, UShort_t strip) const
 {
-  // Get the pedesal 
+  // 
+  // Get mean of pedestal
+  // 
+  // Parameters:
+  //    detector Detector # (1-3)
+  //    ring     Ring ID ('I' or 'O')
+  //    sector   Sector number (0-39)
+  //    strip    Strip number (0-511)
+  //
+  // Return:
+  //    Mean of pedestal 
+  //
   if (!fPedestal) return fFixedPedestal;
   AliFMDDebug(50, ("pedestal for FMD%d%c[%2d,%3d]=%f",
                    detector, ring, sector, strip,
@@ -696,7 +1097,18 @@ Float_t
 AliFMDParameters::GetPedestalWidth(UShort_t detector, Char_t ring, 
                                   UShort_t sector, UShort_t strip) const
 {
-  // Get the pedesal 
+  // 
+  // Width of pedestal
+  // 
+  // Parameters:
+  //    detector Detector # (1-3)
+  //    ring     Ring ID ('I' or 'O')
+  //    sector   Sector number (0-39)
+  //    strip    Strip number (0-511)
+  //
+  // Return:
+  //    Width of pedestal 
+  //
   if (!fPedestal) return fFixedPedestalWidth;
   AliFMDDebug(50, ("pedetal width for FMD%d%c[%2d,%3d]=%f",
                    detector, ring, sector, strip,
@@ -708,54 +1120,176 @@ AliFMDParameters::GetPedestalWidth(UShort_t detector, Char_t ring,
 AliFMDAltroMapping*
 AliFMDParameters::GetAltroMap() const
 {
-  // Get the hardware address to detector index map 
+  // 
+  // Get the map that translates hardware to detector coordinates 
+  //
+  // Return:
+  //    Get the map that translates hardware to detector
+  // coordinates 
+  // 
   return fAltroMap;
 }
 
 
-//__________________________________________________________________
-Bool_t
-AliFMDParameters::Hardware2Detector(UInt_t    ddl,  UInt_t    board, 
-                                   UInt_t    chip, UInt_t    chan,
-                                   UShort_t& det,  Char_t&   ring, 
-                                   UShort_t& sec,  UShort_t& str) const
+//____________________________________________________________________
+Bool_t 
+AliFMDParameters::Hardware2Detector(UShort_t  ddl,       UShort_t addr,
+                                   UShort_t  timebin,   
+                                   UShort_t& det,       Char_t&  ring, 
+                                   UShort_t& sec,       Short_t& str,
+                                   UShort_t& sam) const
 {
-  // Map hardware address to detector index
+  // 
+  // Map a hardware address into a detector index. 
+  // 
+  // Parameters:
+  //    ddl        Hardware DDL number 
+  //    addr       Hardware address.  
+  //    timebin    Timebin 
+  //    det        On return, the detector #
+  //    ring       On return, the ring ID
+  //    sec        On return, the sector #
+  //    str        On return, the base of strip #
+  //    sam        On return, the sample number for this strip
+  //
+  // Return:
+  //    @c true on success, false otherwise 
+  //
   if (!fAltroMap) return kFALSE;
-  return fAltroMap->Hardware2Detector(ddl,board,chip,chan, det,ring,sec,str);
+  UShort_t board, chip, chan;
+  fAltroMap->ChannelAddress(addr, board, chip, chan);
+  return Hardware2Detector(ddl,board,chip,chan,timebin,det,ring,sec,str,sam);
 }
-//__________________________________________________________________
-Bool_t
-AliFMDParameters::Hardware2Detector(UInt_t    ddl,  UInt_t    addr, 
-                                   UShort_t& det,  Char_t&   ring, 
-                                   UShort_t& sec,  UShort_t& str) const
+//____________________________________________________________________
+Bool_t 
+AliFMDParameters::Hardware2Detector(UShort_t  ddl,       UShort_t   board,
+                                   UShort_t  chip,      UShort_t   chan,
+                                   UShort_t  timebin,   
+                                   UShort_t& det,       Char_t&   ring, 
+                                   UShort_t& sec,       Short_t& str,
+                                   UShort_t& sam) const
 {
-  // Map hardware address to detector index
-  if (!fAltroMap) return kFALSE;
-  return fAltroMap->Hardware2Detector(ddl, addr, det, ring, sec, str);
+  // 
+  // Map a hardware address into a detector index. 
+  // 
+  // Parameters:
+  //    ddl        Hardware DDL number 
+  //    board      FEC number
+  //    altro      ALTRO number 
+  //    channel    Channel number 
+  //    timebin    Timebin 
+  //    det        On return, the detector #
+  //    ring       On return, the ring ID
+  //    sec        On return, the sector #
+  //    str        On return, the base of strip #
+  //    sam        On return, the sample number for this strip
+  //
+  // Return:
+  //    @c true on success, false otherwise 
+  //
+  if (!fAltroMap) {
+    AliFMDDebug(1, ("No ALTRO map available"));
+    return kFALSE;
+  }
+  if (fAltroMap->DDL2Detector(ddl) < 0) { 
+    AliFMDDebug(1, ("Invalid DDL number %d", ddl));
+    return kFALSE;
+  }
+  det = fAltroMap->DDL2Detector(ddl);
+  Short_t stripBase = 0;
+  if (!fAltroMap->Channel2StripBase(board,chip,chan, ring, sec, stripBase)) {
+    AliFMDDebug(1, ("Failed to translate  "
+                   "%d/0x%02x/0x%x/0x%x/%04d -> "
+                   "FMD%d%c[%2d,%3d] to detector", 
+                   ddl, board, chip, chan, timebin, 
+                   det, ring, sec, stripBase));
+    return kFALSE;
+  }
+  UShort_t preSamples = GetPreSamples(det, ring, sec, stripBase);
+  UShort_t sampleRate = GetSampleRate(det, ring, sec, stripBase);
+  Short_t stripOff = 0;
+  fAltroMap->Timebin2Strip(sec, timebin, preSamples, sampleRate, stripOff, sam);
+  str = stripBase + stripOff;
+  AliFMDDebug(50, ("%d/0x%02x/0x%x/0x%x/%04d -> FMD%d%c[%02d,%03d]-%d"
+                 " (pre=%2d, rate=%d)", 
+                  ddl, board, chip, chan, timebin, 
+                  det, ring, sec, str, sam, preSamples, sampleRate));
+  return kTRUE;
 }
 
-//__________________________________________________________________
-Bool_t
-AliFMDParameters::Detector2Hardware(UShort_t det,  Char_t   ring, 
-                                   UShort_t sec,  UShort_t str, 
-                                   UInt_t&  ddl,  UInt_t&  board, 
-                                   UInt_t&  chip, UInt_t&  chan) const
+
+//____________________________________________________________________
+Bool_t 
+AliFMDParameters::Detector2Hardware(UShort_t  det,        Char_t    ring, 
+                                   UShort_t  sec,        UShort_t  str,
+                                   UShort_t  sam, 
+                                   UShort_t& ddl,        UShort_t& board, 
+                                   UShort_t& altro,      UShort_t& channel, 
+                                   UShort_t& timebin) const
 {
-  // Map detector index to hardware address
-  if (!fAltroMap) return kFALSE;
-  return fAltroMap->Detector2Hardware(det,ring,sec,str, ddl,board,chip,chan);
+  // 
+  // Map a detector index into a hardware address. 
+  // 
+  // Parameters:
+  //    det         The detector #
+  //    ring        The ring ID
+  //    sec         The sector #
+  //    str         The strip #
+  //    sam         The sample number 
+  //    ddl         On return, hardware DDL number 
+  //    board       On return, the FEC board address (local to DDL)
+  //    altro       On return, the ALTRO number (local to FEC)
+  //    channel     On return, the channel number (local to ALTRO)
+  //    timebin     On return, the timebin number (local to ALTRO)
+  //
+  // Return:
+  //    @c true on success, false otherwise 
+  //
+  if (!fAltroMap) { 
+    AliFMDDebug(1, ("No ALTRO map available"));
+    return kFALSE;
+  }
+  UShort_t preSamples = GetPreSamples(det, ring, sec, str);
+  UShort_t sampleRate = GetSampleRate(det, ring, sec, str);
+  UShort_t strip      = str - GetMinStrip(det,ring,sec,str);
+  return fAltroMap->Detector2Hardware(det, ring, sec, strip, sam,
+                                     preSamples, sampleRate,
+                                     ddl, board, altro, channel, timebin);
 }
 
-//__________________________________________________________________
-Bool_t
-AliFMDParameters::Detector2Hardware(UShort_t det, Char_t   ring, 
-                                   UShort_t sec, UShort_t str, 
-                                   UInt_t&  ddl, UInt_t&  addr) const
+  
+
+//____________________________________________________________________
+Bool_t 
+AliFMDParameters::Detector2Hardware(UShort_t  det,        Char_t    ring, 
+                                   UShort_t  sec,        UShort_t  str,
+                                   UShort_t  sam, 
+                                   UShort_t&   ddl,        UShort_t&   addr,
+                                   UShort_t& timebin) const
 {
-  // Map detector index to hardware address
+  // 
+  // Map a detector index into a hardware address. 
+  // 
+  // Parameters:
+  //    det         The detector #
+  //    ring        The ring ID
+  //    sec         The sector #
+  //    str         The strip #
+  //    sam         The sample number 
+  //    ddl         On return, hardware DDL number 
+  //    addr      On return, hardware address.  
+  //    timebin     On return, the timebin number (local to ALTRO)
+  //
+  // Return:
+  //    @c true on success, false otherwise 
+  //
   if (!fAltroMap) return kFALSE;
-  return fAltroMap->Detector2Hardware(det, ring, sec, str, ddl, addr);
+  UShort_t preSamples = GetPreSamples(det, ring, sec, str);
+  UShort_t sampleRate = GetSampleRate(det, ring, sec, str);
+  UShort_t strip      = str - GetMinStrip(det,ring,sec,str);
+  return fAltroMap->Detector2Hardware(det, ring, sec, strip, sam,
+                                     preSamples, sampleRate,
+                                     ddl, addr, timebin);
 }
 
 
@@ -763,7 +1297,10 @@ AliFMDParameters::Detector2Hardware(UShort_t det, Char_t   ring,
 Float_t
 AliFMDParameters::GetEdepMip() const 
 { 
-  // Get energy deposited by a MIP in the silicon sensors
+  // 
+  // Return:
+  //    The average energy deposited by one MIP 
+  //
   if (fEdepMip <= 0){
     AliFMDGeometry* fmd = AliFMDGeometry::Instance();
     fEdepMip = (fkSiDeDxMip 
@@ -772,11 +1309,22 @@ AliFMDParameters::GetEdepMip() const
   }
   return fEdepMip;
 }
-
-
-  
-  
+//____________________________________________________________________
+Float_t  
+AliFMDParameters::GetDACPerMIP() const
+{
+  // 
+  // This is the conversion from Digital-to-Analog-Converter setting
+  // to the number of MIPs. The number was measured in the NBI lab during
+  // August 2008.
+  //
+  // Return:
+  //    The conversion factor from DAC to ADC 
+  //
+  return 29.67;
   
+}
 //____________________________________________________________________
 //
 // EOF