test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
reweight::PoissonMeanShifter Class Reference

#include <LumiReWeighting.h>

Public Member Functions

 PoissonMeanShifter ()
 
 PoissonMeanShifter (float Shift)
 
 PoissonMeanShifter ()
 
 PoissonMeanShifter (float Shift)
 
double ShiftWeight (int ibin)
 
double ShiftWeight (float pvnum)
 
double ShiftWeight (int ibin)
 
double ShiftWeight (float pvnum)
 

Private Attributes

double Pweight_ [25]
 

Detailed Description

Definition at line 31 of file LumiReWeighting.h.

Constructor & Destructor Documentation

reweight::PoissonMeanShifter::PoissonMeanShifter ( )
inline

Definition at line 35 of file LumiReWeighting.h.

35 { };
reweight::PoissonMeanShifter::PoissonMeanShifter ( float  Shift)
inline

Definition at line 37 of file LumiReWeighting.h.

References constexpr, create_public_lumi_plots::exp, and Pweight_.

37  {
38 
39  // these are the polynomial or exponential coefficients for each bin of a 25-bin sequence that
40  // convert the Distribution of the 2011 luminosity to something with a lower or higher peak luminosity.
41  // The distributions aren't quite poisson because they model luminosity decreasing during a fill. This implies that
42  // they do get wider as the mean increases, so the weights are not linear with increasing mean.
43 
44  constexpr double p0_minus[20] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
45  constexpr double p1_minus[20] = {
46  -0.677786,
47  -0.619614,
48  -0.49465,
49  -0.357963,
50  -0.238359,
51  -0.110002,
52  0.0348629,
53  0.191263,
54  0.347648,
55  0.516615,
56  0.679646,
57  0.836673,
58  0.97764,
59  1.135,
60  1.29922,
61  1.42467,
62  1.55901,
63  1.61762,
64  1.67275,
65  1.96008
66  };
67  constexpr double p2_minus[20] = {
68  0.526164,
69  0.251816,
70  0.11049,
71  0.026917,
72  -0.0464692,
73  -0.087022,
74  -0.0931581,
75  -0.0714295,
76  -0.0331772,
77  0.0347473,
78  0.108658,
79  0.193048,
80  0.272314,
81  0.376357,
82  0.4964,
83  0.58854,
84  0.684959,
85  0.731063,
86  0.760044,
87  1.02386
88  };
89 
90  constexpr double p1_expoM[5] = {
91  1.63363e-03,
92  6.79290e-04,
93  3.69900e-04,
94  2.24349e-04,
95  9.87156e-06
96  };
97 
98  constexpr double p2_expoM[5] = {
99  2.64692,
100  3.26585,
101  3.53229,
102  4.18035,
103  5.64027
104  };
105 
106 
107  constexpr double p0_plus[20] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
108  constexpr double p1_plus[20] = {
109  -0.739059,
110  -0.594445,
111  -0.477276,
112  -0.359707,
113  -0.233573,
114  -0.103458,
115  0.0373401,
116  0.176571,
117  0.337617,
118  0.499074,
119  0.675126,
120  0.840522,
121  1.00917,
122  1.15847,
123  1.23816,
124  1.44271,
125  1.52982,
126  1.46385,
127  1.5802,
128  0.988689
129  };
130  constexpr double p2_plus[20] = {
131  0.208068,
132  0.130033,
133  0.0850356,
134  0.0448344,
135  0.000749832,
136  -0.0331347,
137  -0.0653281,
138  -0.0746009,
139  -0.0800667,
140  -0.0527636,
141  -0.00402649,
142  0.103338,
143  0.261261,
144  0.491084,
145  0.857966,
146  1.19495,
147  1.75071,
148  2.65559,
149  3.35433,
150  5.48835
151  };
152 
153  constexpr double p1_expoP[5] = {
154  1.42463e-01,
155  4.18966e-02,
156  1.12697e-01,
157  1.66197e-01,
158  1.50768e-01
159  };
160 
161  constexpr double p2_expoP[5] = {
162  1.98758,
163  2.27217,
164  2.26799,
165  2.38455,
166  2.52428
167  };
168 
169  // initialize weights based on desired Shift
170 
171 
172 
173  for (int ibin=0;ibin<20;ibin++) {
174 
175  if( Shift < .0) {
176  Pweight_[ibin] = p0_minus[ibin] + p1_minus[ibin]*Shift + p2_minus[ibin]*Shift*Shift;
177  }
178  else {
179  Pweight_[ibin] = p0_plus[ibin] + p1_plus[ibin]*Shift + p2_plus[ibin]*Shift*Shift;
180  }
181  }
182 
183  // last few bins fit better to an exponential...
184 
185  for (int ibin=20;ibin<25;ibin++) {
186  if( Shift < 0.) {
187  Pweight_[ibin] = p1_expoM[ibin-20]*exp(p2_expoM[ibin-20]*Shift);
188  }
189  else {
190  Pweight_[ibin] = p1_expoP[ibin-20]*exp(p2_expoP[ibin-20]*Shift);
191  }
192  }
193 
194  };
#define constexpr
reweight::PoissonMeanShifter::PoissonMeanShifter ( )
inline

Definition at line 43 of file LumiReweightingStandAlone.h.

43 { };
reweight::PoissonMeanShifter::PoissonMeanShifter ( float  Shift)
inline

Definition at line 45 of file LumiReweightingStandAlone.h.

References create_public_lumi_plots::exp, and Pweight_.

45  {
46 
47  // these are the polynomial or exponential coefficients for each bin of a 25-bin sequence that
48  // convert the Distribution of the 2011 luminosity to something with a lower or higher peak luminosity.
49  // The distributions aren't quite poisson because they model luminosity decreasing during a fill. This implies that
50  // they do get wider as the mean increases, so the weights are not linear with increasing mean.
51 
52  static const double p0_minus[20] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
53  static const double p1_minus[20] = {
54  -0.677786,
55  -0.619614,
56  -0.49465,
57  -0.357963,
58  -0.238359,
59  -0.110002,
60  0.0348629,
61  0.191263,
62  0.347648,
63  0.516615,
64  0.679646,
65  0.836673,
66  0.97764,
67  1.135,
68  1.29922,
69  1.42467,
70  1.55901,
71  1.61762,
72  1.67275,
73  1.96008
74  };
75  static const double p2_minus[20] = {
76  0.526164,
77  0.251816,
78  0.11049,
79  0.026917,
80  -0.0464692,
81  -0.087022,
82  -0.0931581,
83  -0.0714295,
84  -0.0331772,
85  0.0347473,
86  0.108658,
87  0.193048,
88  0.272314,
89  0.376357,
90  0.4964,
91  0.58854,
92  0.684959,
93  0.731063,
94  0.760044,
95  1.02386
96  };
97 
98  static const double p1_expoM[5] = {
99  1.63363e-03,
100  6.79290e-04,
101  3.69900e-04,
102  2.24349e-04,
103  9.87156e-06
104  };
105 
106  static const double p2_expoM[5] = {
107  2.64692,
108  3.26585,
109  3.53229,
110  4.18035,
111  5.64027
112  };
113 
114 
115  static const double p0_plus[20] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
116  static const double p1_plus[20] = {
117  -0.739059,
118  -0.594445,
119  -0.477276,
120  -0.359707,
121  -0.233573,
122  -0.103458,
123  0.0373401,
124  0.176571,
125  0.337617,
126  0.499074,
127  0.675126,
128  0.840522,
129  1.00917,
130  1.15847,
131  1.23816,
132  1.44271,
133  1.52982,
134  1.46385,
135  1.5802,
136  0.988689
137  };
138  static const double p2_plus[20] = {
139  0.208068,
140  0.130033,
141  0.0850356,
142  0.0448344,
143  0.000749832,
144  -0.0331347,
145  -0.0653281,
146  -0.0746009,
147  -0.0800667,
148  -0.0527636,
149  -0.00402649,
150  0.103338,
151  0.261261,
152  0.491084,
153  0.857966,
154  1.19495,
155  1.75071,
156  2.65559,
157  3.35433,
158  5.48835
159  };
160 
161  static const double p1_expoP[5] = {
162  1.42463e-01,
163  4.18966e-02,
164  1.12697e-01,
165  1.66197e-01,
166  1.50768e-01
167  };
168 
169  static const double p2_expoP[5] = {
170  1.98758,
171  2.27217,
172  2.26799,
173  2.38455,
174  2.52428
175  };
176 
177  // initialize weights based on desired Shift
178 
179 
180 
181  for (int ibin=0;ibin<20;ibin++) {
182 
183  if( Shift < .0) {
184  Pweight_[ibin] = p0_minus[ibin] + p1_minus[ibin]*Shift + p2_minus[ibin]*Shift*Shift;
185  }
186  else {
187  Pweight_[ibin] = p0_plus[ibin] + p1_plus[ibin]*Shift + p2_plus[ibin]*Shift*Shift;
188  }
189  }
190 
191  // last few bins fit better to an exponential...
192 
193  for (int ibin=20;ibin<25;ibin++) {
194  if( Shift < 0.) {
195  Pweight_[ibin] = p1_expoM[ibin-20]*exp(p2_expoM[ibin-20]*Shift);
196  }
197  else {
198  Pweight_[ibin] = p1_expoP[ibin-20]*exp(p2_expoP[ibin-20]*Shift);
199  }
200  }
201 
202  };

Member Function Documentation

double reweight::PoissonMeanShifter::ShiftWeight ( int  ibin)
inline

Definition at line 196 of file LumiReWeighting.h.

References Pweight_.

Referenced by ShiftWeight().

196  {
197  if(ibin<25 && ibin>=0) { return Pweight_[ibin]; }
198  else { return 0;}
199 
200  };
double reweight::PoissonMeanShifter::ShiftWeight ( float  pvnum)
inline

Definition at line 202 of file LumiReWeighting.h.

References ShiftWeight().

202  {
203  return ShiftWeight(int(pvnum));
204  };
double reweight::PoissonMeanShifter::ShiftWeight ( int  ibin)
inline

Definition at line 204 of file LumiReweightingStandAlone.h.

References Pweight_.

204  {
205 
206  if(ibin<25 && ibin>=0) { return Pweight_[ibin]; }
207  else { return 0;}
208 
209  };
double reweight::PoissonMeanShifter::ShiftWeight ( float  pvnum)
inline

Definition at line 211 of file LumiReweightingStandAlone.h.

References Pweight_.

211  {
212 
213  int ibin = int(pvnum);
214 
215  if(ibin<25 && ibin>=0) { return Pweight_[ibin]; }
216  else { return 0;}
217 
218  };

Member Data Documentation

double reweight::PoissonMeanShifter::Pweight_
private

Definition at line 204 of file LumiReWeighting.h.

Referenced by PoissonMeanShifter(), and ShiftWeight().