/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/MdcPatRec/MdcRecoUtil/MdcRecoUtil-00-01-08/MdcRecoUtil/ComPackExpFloat.h

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: ComPackExpFloat.h,v 1.2 2009/12/23 02:59:56 zhangy Exp $
00004 //
00005 // Description:
00006 //      class ComPackExpFloat; pack a floating (double) into a fixed range
00007 //      mantissa with an exponential (power of 2) representation.  With this class, the values
00008 //      stored at the start of the range have the best precision, which
00009 //      gradually decreases to the worst precision when going to the opposite
00010 //      range.  This is equivalent to flat packing of the log of the value,
00011 //      but because the exponent storage space is variable, this class allows
00012 //      the equivalent of scaling the (log) value.
00013 //
00014 // Environment:
00015 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00016 //
00017 // Author List:
00018 //      Dave Brown         10/12/00
00019 //
00020 // Copyright Information:
00021 //      Copyright (C) 2000 LBNL
00022 // 
00023 // History:
00024 //      Migration for BESIII MDC
00025 //
00026 //
00027 //--------------------------------------------------------------------------
00028 
00029 #ifndef COMPACKEXPFLOAT_HH
00030 #define COMPACKEXPFLOAT_HH
00031 
00032 #include "MdcRecoUtil/ComPackBase.h"
00033 #include <iostream>
00034 
00035 class ComPackExpFloat:public ComPackBase<double> {
00036 
00037 public:
00038 // specify the storage space (number of total bits) and the maximum exponent.
00039 // The mantissa will be stored in the bits left over after storing the exponent
00040 // Note that the exponent is -UNSIGNED-.  Note that the stop and start values do
00041 // _not_ have to be monotonic; the order simply defines which end of the range
00042 // has the fine precision (start) vs coarse (stop).  The 'center' command will
00043 // use the start and stop values to define the (exact) range for unpacking data
00044 // (ie the packing bins will be centered about those values).
00045   ComPackExpFloat(unsigned nbits,
00046                   unsigned maxexponent,
00047                   double start,
00048                   double stop,
00049                   bool center=false);
00050   virtual ~ComPackExpFloat();
00051 // ComPackBase functions
00052   virtual StatusCode pack (const double, d_ULong &) const;
00053   virtual StatusCode unpack (const d_ULong, double &) const;
00054   void print(std::ostream& os) const;
00055 private:
00056   unsigned _maxexp; // maximum value of the exponent (+1)
00057   unsigned _expmsk; // exponent storage mask
00058   unsigned _mansft; // mantissa storage shift
00059   unsigned _manmsk; // mantissa storage mask
00060   unsigned _maxman; // maximum integer mantissa
00061   double _invrange; // inverse range
00062 // pre-computed quantities to speed unpacking
00063   double* _expfac;
00064   double* _expoff;
00065 // disallow copy and equivalence
00066   ComPackExpFloat(const ComPackExpFloat&);
00067   ComPackExpFloat& operator = (const ComPackExpFloat&); 
00068 };
00069 
00070 #endif
00071 
00072 
00073 
00074 
00075 
00076 

Generated on Tue Nov 29 23:13:31 2016 for BOSS_7.0.2 by  doxygen 1.4.7