CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
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...
 

Function Documentation

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

Definition at line 20 of file liblogintpack.h.

References newFWLiteAna::base, prof2calltree::l, cmsBatch::log, and alignCSCRings::r.

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

21  {
22  if(base>128) base=128;
23  float l =log(fabs(x));
24  float centered = (l-lmin)/(lmax-lmin)*base;
25  int8_t r=centered;
26  if(centered >= base-1) r=base-1;
27  if(centered < 0) r=0;
28  if(x<0) r=-r;
29  return r;
30  }
tuple base
Main Program
Definition: newFWLiteAna.py:92
Definition: DDAxes.h:10
tuple log
Definition: cmsBatch.py:347
int8_t logintpack::pack8logCeil ( double  x,
double  lmin,
double  lmax,
uint8_t  base = 128 
)

Definition at line 8 of file liblogintpack.h.

References newFWLiteAna::base, prof2calltree::l, cmsBatch::log, and alignCSCRings::r.

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

9  {
10  if(base>128) base=128;
11  float l =log(fabs(x));
12  float centered = (l-lmin)/(lmax-lmin)*base;
13  int8_t r=ceil(centered);
14  if(centered >= base-1) r=base-1;
15  if(centered < 0) r=0;
16  if(x<0) r=-r;
17  return r;
18  }
tuple base
Main Program
Definition: newFWLiteAna.py:92
Definition: DDAxes.h:10
tuple log
Definition: cmsBatch.py:347
int8_t logintpack::pack8logClosed ( double  x,
double  lmin,
double  lmax,
uint8_t  base = 128 
)

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 34 of file liblogintpack.h.

References newFWLiteAna::base, prof2calltree::l, cmsBatch::log, and alignCSCRings::r.

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

35  {
36  if(base>128) base=128;
37  float l =log(fabs(x));
38  float centered = (l-lmin)/(lmax-lmin)*(base-1);
39  int8_t r=round(centered);
40  if(centered >= base-1) r=base-1;
41  if(centered < 0) r=0;
42  if(x<0) r=-r;
43  return r;
44  }
tuple base
Main Program
Definition: newFWLiteAna.py:92
Definition: DDAxes.h:10
tuple log
Definition: cmsBatch.py:347
double logintpack::unpack8log ( int8_t  i,
double  lmin,
double  lmax,
uint8_t  base = 128 
)

Definition at line 47 of file liblogintpack.h.

References funct::abs(), newFWLiteAna::base, create_public_lumi_plots::exp, and prof2calltree::l.

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

48  {
49  if(base>128) base=128;
50  float basef=base;
51  float l=lmin+abs(i)/basef*(lmax-lmin);
52  float val=exp(l);
53  if(i<0) return -val; else return val;
54  }
tuple base
Main Program
Definition: newFWLiteAna.py:92
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 
)

reverse of pack8logClosed

Definition at line 57 of file liblogintpack.h.

References funct::abs(), newFWLiteAna::base, create_public_lumi_plots::exp, and prof2calltree::l.

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

58  {
59  if(base>128) base=128;
60  float basef=base-1;
61  float l=lmin+abs(i)/basef*(lmax-lmin);
62  if (abs(i) == base-1) l = lmax;
63  float val=exp(l);
64  if(i<0) return -val; else return val;
65  }
tuple base
Main Program
Definition: newFWLiteAna.py:92
int i
Definition: DBlmapReader.cc:9
Abs< T >::type abs(const T &t)
Definition: Abs.h:22