CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
logintpack Namespace Reference

Functions

int8_t pack8log (double x, double lmin, double lmax, uint8_t base=128)
 
int8_t pack8logCeil (double x, double lmin, double lmax, uint8_t base=128)
 
int8_t pack8logClosed (double x, double lmin, double lmax, uint8_t base=128)
 
double unpack8log (int8_t i, double lmin, double lmax, uint8_t base=128)
 
double unpack8logClosed (int8_t i, double lmin, double lmax, uint8_t base=128)
 reverse of pack8logClosed More...
 

Variables

constexpr int8_t smallestNegative = -1
 
constexpr int8_t smallestPositive = 0
 

Function Documentation

int8_t logintpack::pack8log ( double  x,
double  lmin,
double  lmax,
uint8_t  base = 128 
)
inline

Definition at line 27 of file liblogintpack.h.

References funct::abs(), newFWLiteAna::base, cmsLHEtoEOSManager::l, dqm-mbProfile::log, and alignCSCRings::r.

Referenced by pat::PackedCandidate::packVtx().

28  {
29  if(base>128) base=128;
30  const double l = std::log(std::abs(x));
31  const double centered = (l-lmin)/(lmax-lmin)*base;
32  int8_t r=centered;
33  if(centered >= base-1) r=base-1;
34  if(centered < 0) r=0;
35  if(x<0) r = r==0 ? -1 : -r;
36  return r;
37  }
tuple base
Main Program
Definition: newFWLiteAna.py:91
T x() const
Cartesian x coordinate.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int8_t logintpack::pack8logCeil ( double  x,
double  lmin,
double  lmax,
uint8_t  base = 128 
)
inline

Definition at line 14 of file liblogintpack.h.

References funct::abs(), newFWLiteAna::base, cmsLHEtoEOSManager::l, dqm-mbProfile::log, and alignCSCRings::r.

Referenced by pat::PackedCandidate::packVtx().

15  {
16  if(base>128) base=128;
17  const double l = std::log(std::abs(x));
18  const double centered = (l-lmin)/(lmax-lmin)*base;
19  int8_t r=std::ceil(centered);
20  if(centered >= base-1) r=base-1;
21  if(centered < 0) r=0;
22  if(x<0) r = r==0 ? -1 : -r;
23  return r;
24  }
tuple base
Main Program
Definition: newFWLiteAna.py:91
T x() const
Cartesian x coordinate.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int8_t logintpack::pack8logClosed ( double  x,
double  lmin,
double  lmax,
uint8_t  base = 128 
)
inline

pack a value x distributed in [-1,1], with guarantee that -1 and 1 are preserved exactly in packing and unpacking. tries to keep the best precision for x close to the endpoints, sacrifying that in the middle

Definition at line 42 of file liblogintpack.h.

References funct::abs(), newFWLiteAna::base, cmsLHEtoEOSManager::l, dqm-mbProfile::log, and alignCSCRings::r.

Referenced by pat::PackedCandidate::setPuppiWeight().

43  {
44  if(base>128) base=128;
45  const double l = std::log(std::abs(x));
46  const double centered = (l-lmin)/(lmax-lmin)*(base-1);
47  int8_t r=round(centered);
48  if(centered >= base-1) r=base-1;
49  if(centered < 0) r=0;
50  if(x<0) r = r==0 ? -1 : -r;
51  return r;
52  }
tuple base
Main Program
Definition: newFWLiteAna.py:91
T x() const
Cartesian x coordinate.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double logintpack::unpack8log ( int8_t  i,
double  lmin,
double  lmax,
uint8_t  base = 128 
)
inline

Definition at line 55 of file liblogintpack.h.

References funct::abs(), newFWLiteAna::base, create_public_lumi_plots::exp, cmsLHEtoEOSManager::l, and SpecificationBuilder_cfi::val().

Referenced by pat::PackedCandidate::unpackVtx().

56  {
57  if(base>128) base=128;
58  const double basef=base;
59  const double l=lmin+std::abs(i)/basef*(lmax-lmin);
60  const double val=std::exp(l);
61  if(i<0) return -val; else return val;
62  }
tuple base
Main Program
Definition: newFWLiteAna.py:91
int i
Definition: DBlmapReader.cc:9
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double logintpack::unpack8logClosed ( int8_t  i,
double  lmin,
double  lmax,
uint8_t  base = 128 
)
inline

reverse of pack8logClosed

Definition at line 66 of file liblogintpack.h.

References funct::abs(), newFWLiteAna::base, create_public_lumi_plots::exp, cmsLHEtoEOSManager::l, and SpecificationBuilder_cfi::val().

Referenced by pat::PackedCandidate::puppiWeight(), and pat::PackedCandidate::puppiWeightNoLep().

67  {
68  if(base>128) base=128;
69  const double basef=base-1;
70  double l=lmin+std::abs(i)/basef*(lmax-lmin);
71  if (std::abs(i) == base-1) l = lmax;
72  const double val=std::exp(l);
73  if(i<0) return -val; else return val;
74  }
tuple base
Main Program
Definition: newFWLiteAna.py:91
int i
Definition: DBlmapReader.cc:9
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Variable Documentation

constexpr int8_t logintpack::smallestNegative = -1

Definition at line 11 of file liblogintpack.h.

constexpr int8_t logintpack::smallestPositive = 0

Definition at line 8 of file liblogintpack.h.