Belle II Software  release-05-01-25
B2BIIFixMdstModule_trk.cc
1 //
2 // $Id: B2BIIFixMdst_trk.cc 11331 2011-07-25 11:58:12Z hitoshi $
3 //
4 // $Log$
5 //
6 // Revision 2.0 2015/03/11 tkeck
7 // Conversion to Belle II
8 //
9 // Revision 1.47 2006/05/29
10 // scale_error for exp. 45,47,49
11 //
12 // Revision 1.46 2005/07/28 09:55:00 hitoshi
13 // for exp43 run700-1149 (by Senyo)
14 //
15 // Revision 1.45 2005/07/02 08:07:48 hitoshi
16 // for exp43 run300-699 (by Senyo)
17 //
18 // Revision 1.44 2005/06/06 04:28:01 katayama
19 // New for exp. 43 run - 300 from Miyabayasi and Senyo san
20 //
21 // Revision 1.43 2005/05/14 03:47:34 hitoshi
22 // scale error for exp39 and 41 (by Kusaka)
23 //
24 // Revision 1.42 2005/04/17 09:43:56 hitoshi
25 // for Exp41 r1200-end (by Senyo)
26 //
27 // Revision 1.41 2005/04/15 05:49:28 hitoshi
28 // for Exp41 r800-1199 (by Senyo)
29 //
30 // Revision 1.40 2005/03/31 10:45:30 hitoshi
31 // for Exp41 runno<=799 (by Senyo)
32 //
33 // Revision 1.39 2005/03/08 06:10:02 hitoshi
34 // scale_momenta for Exp39 (by Senyo)
35 //
36 // Revision 1.38 2004/07/26 03:29:46 katayama
37 // scale_error for exp. 37
38 //
39 // Revision 1.37 2004/07/14 07:34:17 katayama
40 // added cassert
41 //
42 // Revision 1.36 2004/07/12 08:27:04 hitoshi
43 // scale error for svd2 (by kusaka)
44 //
45 // Revision 1.35 2004/07/12 05:25:06 hitoshi
46 // scale momenta for exp37 r1400-end (by senyo)
47 //
48 // Revision 1.34 2004/07/09 05:39:37 hitoshi
49 // protection for mis-use for exp>=30
50 //
51 // Revision 1.33 2004/07/09 04:36:07 hitoshi
52 // scale momenta for exp37 run1-1399 (by senyo)
53 //
54 // Revision 1.32 2004/06/23 19:06:55 hitoshi
55 // scale momenta for exp31 (by Senyo)
56 //
57 // Revision 1.31 2004/06/16 06:48:36 hitoshi
58 // scale momenta for exp35 (by Senyo san)
59 //
60 // Revision 1.30 2004/06/06 03:20:47 hitoshi
61 // scale momenta for exp33 (by senyo)
62 //
63 // Revision 1.29 2004/04/25 16:33:33 hitoshi
64 // modified to be able to handle output from low p finder (by kakuno). modified
65 // Benergy to fetch data from DB (by Shibata).
66 //
67 // Revision 1.28 2004/03/09 04:46:00 hitoshi
68 // scale momenta for exp31 run1100-end by Senyo
69 //
70 // Revision 1.27 2004/03/01 03:12:42 hitoshi
71 // scale_momenta for exp31 upto run1099 (by Senyo).
72 //
73 // Revision 1.26 2003/07/31 07:47:58 katayama
74 // New version from Higuhi san
75 //
76 // Revision 1.25 2003/07/11 08:41:23 hitoshi
77 // fixed a bug.
78 //
79 // Revision 1.24 2003/07/11 06:41:22 katayama
80 // for exp. 27 continuum
81 //
82 // Revision 1.23 2003/07/10 13:45:38 hitoshi
83 // update for exp27 run700- (by Sanjay and Senyo).
84 //
85 // Revision 1.22 2003/06/30 22:16:29 hitoshi
86 // update for exp27 (by Miyabayashi, Sanjay, Senyo).
87 //
88 // Revision 1.21 2003/06/24 07:55:17 katayama
89 // Remived unused parameters
90 //
91 // Revision 1.20 2003/06/24 07:38:25 katayama
92 // added cstdio
93 //
94 // Revision 1.19 2003/06/18 12:22:02 katayama
95 // cannot compile with gcc3
96 //
97 // Revision 1.18 2003/06/12 13:25:43 hitoshi
98 // scale_error implemented last year (by Higuchi; valid up to exp19) is incorporated
99 //
100 // Revision 1.17 2003/05/31 09:22:54 hitoshi
101 // updae for exp25 (ny Miyabayashi and Senyo).
102 //
103 // Revision 1.16 2002/12/26 13:35:01 katayama
104 // scale_momenta for exp. 21 and 23 from Senyo san
105 //
106 // Revision 1.15 2002/10/12 15:33:07 hitoshi
107 // A bug fix: 1.46 -> 14.6kG (pointed out by N.root). Negligible effect on V0 mass.
108 //
109 // Revision 1.14 2002/07/04 21:06:44 katayama
110 // Final version
111 //
112 // Revision 1.13 2002/07/03 04:50:54 hitoshi
113 // scale_momenta for exp19 run900 - 1499 (by Senyo san).
114 //
115 // Revision 1.12 2002/06/22 09:40:59 katayama
116 // From Senyo san, for exp. 9 and exp.19 899
117 //
118 // Revision 1.11 2002/06/19 12:10:36 katayama
119 // New for exp. 7 from Senyo and Miyabayashi sans
120 //
121 // Revision 1.10 2002/06/13 00:40:08 hitoshi
122 // added scale momenta factors (from Senyo) for run1000 - end.
123 //
124 // Revision 1.9 2002/06/07 11:54:42 hitoshi
125 // added scale_momenta for run 1 - 999 in e11.
126 //
127 // Revision 1.8 2002/06/04 06:36:34 hitoshi
128 // added scale momenta for e19 runs300-459 (by Senyo).
129 //
130 // Revision 1.7 2002/05/29 07:15:14 hitoshi
131 // added scale momnta factors for exp19 run1-280.
132 //
133 // Revision 1.6 2002/05/24 13:27:45 hitoshi
134 // added scale_momenta for exp13 reprocessed data (by Senyo san).
135 //
136 // Revision 1.5 2002/05/08 12:12:54 hitoshi
137 // added scale_momenta factors for exp17 (by Senyo san).
138 //
139 // Revision 1.4 2002/04/23 15:11:55 hitoshi
140 // new scale factors for e15 mdst reprocessed with 20020405.
141 //
142 // Revision 1.3 2002/04/19 07:24:39 katayama
143 // Added pi0/vertex, calibdedx
144 //
145 // Revision 1.2 2002/04/05 01:19:33 katayama
146 // templates for ecl_primary_vertex
147 //
148 // Revision 1.1 2002/03/13 02:55:20 katayama
149 // First version
150 //
151 //
152 
153 #include <b2bii/modules/B2BIIMdstInput/B2BIIFixMdstModule.h>
154 
155 #include <cstdio>
156 #include <cmath>
157 #include <cfloat>
158 #include <cassert>
159 
160 #include "CLHEP/Vector/ThreeVector.h"
161 #include "CLHEP/Matrix/Vector.h"
162 #include <TRandom.h>
163 
164 #include "belle_legacy/helix/Helix.h"
165 
166 #include "belle_legacy/tables/mdst.h"
167 #include "belle_legacy/tables/belletdf.h"
168 #include "belle_legacy/tables/evtvtx.h"
169 #include "belle_legacy/ip/IpProfile.h"
170 
171 // kfitter
172 #include <analysis/VertexFitting/KFit/VertexFitKFit.h>
173 
174 namespace Belle2 {
181 //==========================================================
182  double B2BIIFixMdstModule::vee_mass_nofit(const Belle::Mdst_vee2& vee2, float scale)
183  {
184 //==========================================================
185 // Calculates V^0 mass with non-constraint fit results.
186 //==========================================================
187 
188  HepPoint3D vtx(vee2.vx(), vee2.vy(), vee2.vz());
189 
190  const double pion_mass = 0.13956995;
191  const double proton_mass = 0.93827231;
192  const double electron_mass = 0.000511;
193 
194  double massp(0.0), massm(0.0);
195  if (1 == vee2.kind()) {
196  massp = pion_mass;
197  massm = pion_mass;
198  } else if (2 == vee2.kind()) {
199  massp = proton_mass;
200  massm = pion_mass;
201  } else if (3 == vee2.kind()) {
202  massp = pion_mass;
203  massm = proton_mass;
204  } else if (4 == vee2.kind()) {
205  massp = electron_mass;
206  massm = electron_mass;
207  }
208 
209 //Calculate mass
210 //in case where decay vtx is outside of beam pipe
211  // if(BsCouTab(MDST_VEE_DAUGHTERS)) {
212  if (vee2.daut()) {
213 
214  Belle::Mdst_vee_daughters& vdau = vee2.daut();
215 
216  CLHEP::HepVector a(5);
217  a[0] = vdau.helix_p(0); a[1] = vdau.helix_p(1);
218  a[2] = vdau.helix_p(2) / scale;
219  a[3] = vdau.helix_p(3); a[4] = vdau.helix_p(4);
220  Belle::Helix helixp(vtx, a);
221 
222  a[0] = vdau.helix_m(0); a[1] = vdau.helix_m(1);
223  a[2] = vdau.helix_m(2) / scale;
224  a[3] = vdau.helix_m(3); a[4] = vdau.helix_m(4);
225  Belle::Helix helixm(vtx, a);
226  // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << "outside bp" << std::endl;
227  CLHEP::HepLorentzVector v0 = helixp.momentum(0., massp) + helixm.momentum(0., massm);
228  return v0.mag();
229 
230 //in case where decay vtx is inside of beam pipe
231  } else {
232 
233  Belle::Mdst_charged& chargedp = vee2.chgd(0);
234  Belle::Mdst_trk& trkp = chargedp.trk();
235  Belle::Mdst_trk_fit& trkfp = trkp.mhyp(2);
236  HepPoint3D pvtp(trkfp.pivot_x(), trkfp.pivot_y(), trkfp.pivot_z());
237  CLHEP::HepVector a(5);
238  a[0] = trkfp.helix(0); a[1] = trkfp.helix(1);
239  a[2] = trkfp.helix(2);
240  a[3] = trkfp.helix(3); a[4] = trkfp.helix(4);
241  Belle::Helix helixp(pvtp, a);
242  helixp.bFieldZ(14.6);
243  helixp.pivot(vtx);
244  a = helixp.a();
245  a[2] = a[2] / scale;
246  helixp.a(a);
247 
248  Belle::Mdst_charged& chargedm = vee2.chgd(1);
249  Belle::Mdst_trk& trkm = chargedm.trk();
250  Belle::Mdst_trk_fit& trkfm = trkm.mhyp(2);
251  HepPoint3D pvtm(trkfm.pivot_x(), trkfm.pivot_y(), trkfm.pivot_z());
252  a[0] = trkfm.helix(0); a[1] = trkfm.helix(1);
253  a[2] = trkfm.helix(2);
254  a[3] = trkfm.helix(3); a[4] = trkfm.helix(4);
255  Belle::Helix helixm(pvtm, a);
256  helixm.bFieldZ(14.6);
257  helixm.pivot(vtx);
258  a = helixm.a();
259  a[2] = a[2] / scale;
260  helixm.a(a);
261  // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << "inside bp" << std::endl;
262  CLHEP::HepLorentzVector v0 = helixp.momentum(0., massp) + helixm.momentum(0., massm);
263  return v0.mag();
264 
265  }
266 
267  }
268 
269 //===============================================================
270  void B2BIIFixMdstModule::scale_momenta(float scale_data, float scale_mc, int mode)
271  {
272 //===============================================================
273 // Scales charged track momenta, track params. and error
274 // matrices.
275 //======================================================
276 
277  // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << "sacel momenta is called" << std::endl;
278 
279 //Check existence of belle_event
280  Belle::Belle_event_Manager& evtmgr = Belle::Belle_event_Manager::get_manager();
281  // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << evtmgr.count() << std::endl;
282  if (0 == evtmgr.count()) return; //do nothing if not exist
283  // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << "after check" << std::endl;
284 
285  Belle::Mdst_event_add_Manager& mevtmgr = Belle::Mdst_event_add_Manager::get_manager();
286  if (mevtmgr.count() > 0 && 1 == mevtmgr[0].flag_scale()) return; //do nothing if already scaled
287 
288 //check mode
289  if (mode < 0 || mode > 2) {
290  B2ERROR("scale_momenta: invalid mode specified;");
291  B2ERROR("mode must be 0, 1, 2");
292  return;
293  }
294 
295 //set scale factor
296  int expmc = evtmgr[0].ExpMC();
297  int expno = evtmgr[0].ExpNo();
298  int runno = evtmgr[0].RunNo();
299 
300  double scale = 1.;
301  if (1 == expmc) {
302  if (mode == 0) {
303  scale = scale_data;
304  } else if (mode >= 1) {
305  // scale_momenta_set( mode, expno, runno, scale);
306  if (m_reprocess_version == 0) {
307  scale_momenta_set_v1(mode, expno, runno, scale);
308  } else if (m_reprocess_version == 1) {
309  scale_momenta_set_v2(mode, expno, runno, scale);
310  }
311  }
312  } else if (2 == expmc) {
313  scale = scale_mc;
314  }
315 
316  if (1. == scale) return; //do nothing if scale=1
317  // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << scale << std::endl;
318 
319 //Turn on flag, save scale factor
320  if (mevtmgr.count() > 0) {
321  mevtmgr[0].flag_scale(1);
322  mevtmgr[0].scale(scale);
323  } else {
324  Belle::Mdst_event_add& meadd = mevtmgr.add();
325  meadd.flag_scale(1);
326  meadd.scale(scale);
327  }
328  // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << mevtmgr[0].flag_scale() << std::endl;
329  // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << mevtmgr[0].scale() << std::endl;
330 
331 
332 //Scale momenta in mdst_charged
333  Belle::Mdst_charged_Manager& chgmgr = Belle::Mdst_charged_Manager::get_manager();
334  for (std::vector<Belle::Mdst_charged>::iterator it = chgmgr.begin();
335  it != chgmgr.end(); ++it) {
336  Belle::Mdst_charged& charged = *it;
337  charged.px(scale * charged.px());
338  charged.py(scale * charged.py());
339  charged.pz(scale * charged.pz());
340  }
341 
342 //Scale momenta in mdst_vee2
343  Belle::Mdst_vee2_Manager& vee2mgr = Belle::Mdst_vee2_Manager::get_manager();
344  for (std::vector<Belle::Mdst_vee2>::iterator it = vee2mgr.begin();
345  it != vee2mgr.end(); ++it) {
346  Belle::Mdst_vee2& vee2 = *it;
347  double v0mass_scale = vee_mass_nofit(vee2, scale);
348  double v0mass_noscl = vee_mass_nofit(vee2);
349  double esq_scale =
350  (v0mass_scale - v0mass_noscl) * (v0mass_scale + v0mass_noscl)
351  + vee2.energy() * vee2.energy() +
352  (scale - 1.) * (scale + 1.) * (vee2.px() * vee2.px() +
353  vee2.py() * vee2.py() +
354  vee2.pz() * vee2.pz());
355  vee2.energy(std::sqrt(esq_scale));
356  vee2.px(scale * vee2.px());
357  vee2.py(scale * vee2.py());
358  vee2.pz(scale * vee2.pz());
359  }
360 
361 //Scale error matrices in mdst_trk_fit
362  double scalei = 1. / scale;
363  double scalei2 = scalei / scale;
364 
365  Belle::Mdst_trk_fit_Manager& trkfmgr = Belle::Mdst_trk_fit_Manager::get_manager();
366  for (std::vector<Belle::Mdst_trk_fit>::iterator it = trkfmgr.begin();
367  it != trkfmgr.end(); ++it) {
368  Belle::Mdst_trk_fit& trkf = *it;
369  trkf.helix(2, scalei * trkf.helix(2));
370  trkf.error(3, scalei * trkf.error(3));
371  trkf.error(4, scalei * trkf.error(4));
372  trkf.error(5, scalei2 * trkf.error(5));
373  trkf.error(8, scalei * trkf.error(8));
374  trkf.error(12, scalei * trkf.error(12));
375  }
376 
377 //Scale error matrices in mdst_daughters
378  Belle::Mdst_vee_daughters_Manager& vdaumgr = Belle::Mdst_vee_daughters_Manager::get_manager();
379  for (std::vector<Belle::Mdst_vee_daughters>::iterator it = vdaumgr.begin();
380  it != vdaumgr.end(); ++it) {
381  Belle::Mdst_vee_daughters& vdau = *it;
382  vdau.helix_p(2, scalei * vdau.helix_p(2));
383  vdau.error_p(3, scalei * vdau.error_p(3));
384  vdau.error_p(4, scalei * vdau.error_p(4));
385  vdau.error_p(5, scalei2 * vdau.error_p(5));
386  vdau.error_p(8, scalei * vdau.error_p(8));
387  vdau.error_p(12, scalei * vdau.error_p(12));
388 
389  vdau.helix_m(2, scalei * vdau.helix_m(2));
390  vdau.error_m(3, scalei * vdau.error_m(3));
391  vdau.error_m(4, scalei * vdau.error_m(4));
392  vdau.error_m(5, scalei2 * vdau.error_m(5));
393  vdau.error_m(8, scalei * vdau.error_m(8));
394  vdau.error_m(12, scalei * vdau.error_m(12));
395  }
396  }
397 
398 //=====================================================================
399  void B2BIIFixMdstModule::scale_momenta_set(const int mode, const int expno,
400  const int runno, double& scale)
401  {
402 //=====================================================================
403 
404  scale = 1.;
405 
406  if (mode == 1) {
407  //factors for 2001 summer confs. analyses
408  if (expno == 7) {scale = 1.001932; return;}
409  if (expno == 9) {scale = 1.001413; return;}
410  if (expno == 11) {scale = 1.001366; return;}
411  // if(expno==13) {scale = 1.000909; return;} //for '01 summer conf. papers; using up to run400
412  if (expno == 13) {scale = 1.001460; return;} //updated factor using up to run1599
413  if (expno >= 15) {B2ERROR("scale_momenta mode=1: not ready for exp >=15");}
414  }
415 
416  if (mode == 2) {
417  if (expno == 7) {
418  if (runno >= 0 && runno <= 99) {scale = 1.00262126; return;}
419  if (runno >= 100 && runno <= 199) {scale = 1.00253537; return;}
420  if (runno >= 200 && runno <= 299) {scale = 1.00246555; return;}
421  if (runno >= 300 && runno <= 399) {scale = 1.0026452 ; return;}
422  if (runno >= 400 && runno <= 499) {scale = 1.00290386; return;}
423  if (runno >= 500 && runno <= 599) {scale = 1.00287753; return;}
424  if (runno >= 600 && runno <= 699) {scale = 1.00266845; return;}
425  if (runno >= 700 && runno <= 799) {scale = 1.00184472; return;}
426  if (runno >= 800 && runno <= 899) {scale = 1.00200021; return;}
427  if (runno >= 900 && runno <= 999) {scale = 1.00178485; return;}
428  if (runno >= 1000 && runno <= 1099) {scale = 1.00196071; return;}
429  if (runno >= 1100 && runno <= 1199) {scale = 1.00224453; return;}
430  if (runno >= 1200 && runno <= 1299) {scale = 1.00209138; return;}
431  if (runno >= 1300 && runno <= 1399) {scale = 1.00145455; return;}
432  if (runno >= 1400 && runno <= 1499) {scale = 1.00119243; return;}
433  if (runno >= 1500 && runno <= 1599) {scale = 1.00115572; return;}
434  if (runno >= 1600 && runno <= 1699) {scale = 1.00133916; return;}
435  if (runno >= 1700 && runno <= 1799) {scale = 1.00186441; return;}
436  if (runno >= 1800 && runno <= 1899) {scale = 1.00206786; return;}
437  if (runno >= 1900 && runno <= 1999) {scale = 1.00184794; return;}
438  if (runno >= 2000 && runno <= 2099) {scale = 1.00187219; return;}
439  if (runno >= 2100 && runno <= 2199) {scale = 1.00214844; return;}
440  if (runno >= 2200 && runno <= 2299) {scale = 1.00154502; return;}
441  if (runno >= 2300 && runno <= 2399) {scale = 1.00179518; return;}
442  if (runno >= 2400 && runno <= 2499) {scale = 1.00198983; return;}
443  if (runno >= 2500 && runno <= 2599) {scale = 1.00219242; return;}
444  if (runno >= 2600 && runno <= 2699) {scale = 1.00227363; return;}
445  if (runno >= 2700 && runno <= 2799) {scale = 1.00202328; return;}
446  if (runno >= 2800 && runno <= 2899) {scale = 1.00193147; return;}
447  } else if (expno == 9) {
448  if (runno >= 0 && runno <= 99) {scale = 1.00126754; return;}
449  if (runno >= 100 && runno <= 199) {scale = 1.00119683; return;}
450  if (runno >= 200 && runno <= 299) {scale = 1.00123771; return;}
451  if (runno >= 300 && runno <= 399) {scale = 1.00142625; return;}
452  if (runno >= 400 && runno <= 499) {scale = 1.00134481; return;}
453  if (runno >= 500 && runno <= 599) {scale = 1.00131973; return;}
454  if (runno >= 600 && runno <= 699) {scale = 1.00145963; return;}
455  if (runno >= 700 && runno <= 799) {scale = 1.00161304; return;}
456  if (runno >= 800 && runno <= 899) {scale = 1.00141795; return;}
457  if (runno >= 900 && runno <= 999) {scale = 1.00137157; return;}
458  if (runno >= 1000 && runno <= 1099) {scale = 1.00126209; return;}
459  if (runno >= 1100 && runno <= 1199) {scale = 1.00147941; return;}
460  if (runno >= 1200 && runno <= 1299) {scale = 1.00145555; return;}
461  } else if (expno == 11) {
462  if (runno >= 0 && runno <= 99) {scale = 1.00149576; return;}
463  if (runno >= 100 && runno <= 199) {scale = 1.00155153; return;}
464  if (runno >= 200 && runno <= 299) {scale = 1.0013597 ; return;}
465  if (runno >= 300 && runno <= 399) {scale = 1.00147504; return;}
466  if (runno >= 400 && runno <= 499) {scale = 1.00138242; return;}
467  if (runno >= 500 && runno <= 599) {scale = 1.00144554; return;}
468  if (runno >= 600 && runno <= 699) {scale = 1.00136961; return;}
469  if (runno >= 700 && runno <= 799) {scale = 1.00141443; return;}
470  if (runno >= 800 && runno <= 899) {scale = 1.00136617; return;}
471  if (runno >= 900 && runno <= 999) {scale = 1.00126262; return;}
472  if (runno >= 1000 && runno <= 1099) {scale = 1.00133337; return;}
473  if (runno >= 1100 && runno <= 1199) {scale = 1.00137906; return;}
474  if (runno >= 1200 && runno <= 1299) {scale = 1.00127944; return;}
475  //assume same factor for runno>=1300
476  if (runno >= 1300 && runno <= 1399) {scale = 1.00127944; return;}
477  } else if (expno == 13) {
478  if (runno >= 0 && runno <= 99) {scale = 1.00110691; return;}
479  if (runno >= 100 && runno <= 199) {scale = 1.00106123; return;}
480  if (runno >= 200 && runno <= 299) {scale = 1.00109934; return;}
481  if (runno >= 300 && runno <= 399) {scale = 1.00105759; return;}
482  if (runno >= 400 && runno <= 499) {scale = 1.000986887; return;}
483  if (runno >= 500 && runno <= 599) {scale = 1.000928764; return;}
484  if (runno >= 600 && runno <= 699) {scale = 1.00103925; return;}
485  if (runno >= 700 && runno <= 799) {scale = 1.0010591 ; return;}
486  if (runno >= 800 && runno <= 899) {scale = 1.00127043; return;}
487  if (runno >= 900 && runno <= 999) {scale = 1.00154033; return;}
488  if (runno >= 1000 && runno <= 1099) {scale = 1.00180656; return;}
489  if (runno >= 1100 && runno <= 1199) {scale = 1.00202059; return;}
490  if (runno >= 1200 && runno <= 1299) {scale = 1.00184308; return;}
491  if (runno >= 1300 && runno <= 1399) {scale = 1.00180153; return;}
492  if (runno >= 1400 && runno <= 1499) {scale = 1.00189577; return;}
493  if (runno >= 1500 && runno <= 1599) {scale = 1.00176026; return;}
494  //assume same factor for runno>=1600
495  if (runno >= 1600 && runno <= 1699) {scale = 1.00176026; return;}
496 
497  } else if (expno == 15) {
498  if (runno >= 0 && runno <= 99) {scale = 1.00178719; return;}
499  if (runno >= 100 && runno <= 199) {scale = 1.00205712; return;}
500  if (runno >= 200 && runno <= 299) {scale = 1.00197622; return;}
501  if (runno >= 300 && runno <= 399) {scale = 1.00191558; return;}
502  if (runno >= 400 && runno <= 499) {scale = 1.00207795; return;}
503  if (runno >= 500 && runno <= 599) {scale = 1.00191871; return;}
504  if (runno >= 600 && runno <= 699) {scale = 1.00187917; return;}
505  if (runno >= 700 && runno <= 799) {scale = 1.0019573 ; return;}
506  if (runno >= 800 && runno <= 899) {scale = 1.00196562; return;}
507  if (runno >= 900 && runno <= 999) {scale = 1.00205215; return;}
508  if (runno >= 1000 && runno <= 1099) {scale = 1.00200559; return;}
509  if (runno >= 1100 && runno <= 1199) {scale = 1.00198568; return;}
510  if (runno >= 1200 && runno <= 1299) {scale = 1.00212539; return;}
511  if (runno >= 1300 && runno <= 1399) {scale = 1.00199158; return;}
512  if (runno >= 1400 && runno <= 1499) {scale = 1.00208257; return;}
513 
514  } else if (expno >= 17) { B2ERROR("scale_momenta mode=2: not ready for exp >=17");}
515 
516  }
517  return;
518  }
519 
520 //=====================================================================
521  void B2BIIFixMdstModule::scale_momenta_set_v1(const int mode, const int expno,
522  const int runno, double& scale)
523  {
524 //=====================================================================
525 
526  //for e15 mdst processed with b20020405
527 
528  scale = 1.;
529 
530  if (mode == 1) {
531  B2ERROR("scale_momenta mode=1 not ready for exp " << expno);
532  return;
533  }
534 
535  if (mode == 2) {
536  if (expno == 7) {
537  if (runno >= 0 && runno <= 99) {scale = 1.00284313; return;}
538  if (runno >= 100 && runno <= 199) {scale = 1.00272563; return;}
539  if (runno >= 200 && runno <= 299) {scale = 1.00276953; return;}
540  if (runno >= 300 && runno <= 399) {scale = 1.00286722; return;}
541  if (runno >= 400 && runno <= 499) {scale = 1.00318492; return;}
542  if (runno >= 500 && runno <= 599) {scale = 1.00304208; return;}
543  if (runno >= 600 && runno <= 699) {scale = 1.00292413; return;}
544  if (runno >= 700 && runno <= 799) {scale = 1.00201286; return;}
545  if (runno >= 800 && runno <= 899) {scale = 1.00225237; return;}
546  if (runno >= 900 && runno <= 999) {scale = 1.00210375; return;}
547  if (runno >= 1000 && runno <= 1099) {scale = 1.00213222; return;}
548  if (runno >= 1100 && runno <= 1199) {scale = 1.00253683; return;}
549  if (runno >= 1200 && runno <= 1299) {scale = 1.00234023; return;}
550  if (runno >= 1300 && runno <= 1399) {scale = 1.00168421; return;}
551  if (runno >= 1400 && runno <= 1499) {scale = 1.00136169; return;}
552  if (runno >= 1500 && runno <= 1599) {scale = 1.00138431; return;}
553  if (runno >= 1600 && runno <= 1699) {scale = 1.00154521; return;}
554  if (runno >= 1700 && runno <= 1799) {scale = 1.00204405; return;}
555  if (runno >= 1800 && runno <= 1899) {scale = 1.00223498; return;}
556  if (runno >= 1900 && runno <= 1999) {scale = 1.00198975; return;}
557  if (runno >= 2000 && runno <= 2099) {scale = 1.00201868; return;}
558  if (runno >= 2100 && runno <= 2199) {scale = 1.00233875; return;}
559  if (runno >= 2200 && runno <= 2299) {scale = 1.00175269; return;}
560  if (runno >= 2300 && runno <= 2399) {scale = 1.00192858; return;}
561  if (runno >= 2400 && runno <= 2499) {scale = 1.00217693; return;}
562  if (runno >= 2500 && runno <= 2599) {scale = 1.00209337; return;}
563  if (runno >= 2600 && runno <= 2699) {scale = 1.00244277; return;}
564  if (runno >= 2700 && runno <= 2799) {scale = 1.00221485; return;}
565  if (runno >= 2800 && runno <= 2899) {scale = 1.00214678; return;}
566  } else if (expno == 9) {
567  if (runno >= 0 && runno <= 99) {scale = 1.00127702; return;}
568  if (runno >= 100 && runno <= 199) {scale = 1.00119957; return;}
569  if (runno >= 200 && runno <= 299) {scale = 1.00132677; return;}
570  if (runno >= 300 && runno <= 399) {scale = 1.0014785 ; return;}
571  if (runno >= 400 && runno <= 499) {scale = 1.00144872; return;}
572  if (runno >= 500 && runno <= 599) {scale = 1.00145376; return;}
573  if (runno >= 600 && runno <= 699) {scale = 1.00151659; return;}
574  if (runno >= 700 && runno <= 799) {scale = 1.00167384; return;}
575  if (runno >= 800 && runno <= 899) {scale = 1.00153754; return;}
576  if (runno >= 900 && runno <= 999) {scale = 1.0014984 ; return;}
577  if (runno >= 1000 && runno <= 1099) {scale = 1.0013764 ; return;}
578  if (runno >= 1100 && runno <= 1199) {scale = 1.00145545; return;}
579  if (runno >= 1200 && runno <= 1299) {scale = 1.0017164 ; return;}
580  } else if (expno == 11) {
581  if (runno >= 0 && runno <= 99) {scale = 1.00159624; return;}
582  if (runno >= 100 && runno <= 199) {scale = 1.00153365; return;}
583  if (runno >= 200 && runno <= 299) {scale = 1.00143809; return;}
584  if (runno >= 300 && runno <= 399) {scale = 1.00148495; return;}
585  if (runno >= 400 && runno <= 499) {scale = 1.00143193; return;}
586  if (runno >= 500 && runno <= 599) {scale = 1.00141905; return;}
587  if (runno >= 600 && runno <= 699) {scale = 1.0013992 ; return;}
588  if (runno >= 700 && runno <= 799) {scale = 1.00148836; return;}
589  if (runno >= 800 && runno <= 899) {scale = 1.00139019; return;}
590  if (runno >= 900 && runno <= 999) {scale = 1.00151389; return;}
591  if (runno >= 1000 && runno <= 1099) {scale = 1.00142988; return;}
592  if (runno >= 1100 && runno <= 1199) {scale = 1.00143519; return;}
593  if (runno >= 1200 && runno <= 1299) {scale = 1.00132641; return;}
594  } else if (expno == 13) {
595  if (runno >= 0 && runno <= 99) {scale = 1.00126317; return;}
596  if (runno >= 100 && runno <= 199) {scale = 1.00118837; return;}
597  if (runno >= 200 && runno <= 299) {scale = 1.00122276; return;}
598  if (runno >= 300 && runno <= 399) {scale = 1.00113233; return;}
599  if (runno >= 400 && runno <= 499) {scale = 1.00111677; return;}
600  if (runno >= 500 && runno <= 599) {scale = 1.00100963; return;}
601  if (runno >= 600 && runno <= 699) {scale = 1.0011474 ; return;}
602  if (runno >= 700 && runno <= 799) {scale = 1.00116245; return;}
603  if (runno >= 800 && runno <= 899) {scale = 1.00139826; return;}
604  if (runno >= 900 && runno <= 999) {scale = 1.0017014 ; return;}
605  if (runno >= 1000 && runno <= 1099) {scale = 1.00190706; return;}
606  if (runno >= 1100 && runno <= 1199) {scale = 1.00214688; return;}
607  if (runno >= 1200 && runno <= 1299) {scale = 1.00207336; return;}
608  if (runno >= 1300 && runno <= 1399) {scale = 1.00192885; return;}
609  if (runno >= 1400 && runno <= 1499) {scale = 1.00196289; return;}
610  if (runno >= 1500 && runno <= 1599) {scale = 1.00185017; return;}
611  if (runno >= 1600 && runno <= 1699) {scale = 1.00191256; return;}
612  } else if (expno == 15) {
613  if (runno >= 0 && runno <= 99) {scale = 1.001953; return;}
614  if (runno >= 100 && runno <= 199) {scale = 1.00210508; return;}
615  if (runno >= 200 && runno <= 299) {scale = 1.002139; return;}
616  if (runno >= 300 && runno <= 399) {scale = 1.00207803; return;}
617  if (runno >= 400 && runno <= 499) {scale = 1.0022331; return;}
618  if (runno >= 500 && runno <= 599) {scale = 1.00206421; return;}
619  if (runno >= 600 && runno <= 699) {scale = 1.00205153; return;}
620  if (runno >= 700 && runno <= 799) {scale = 1.00214664; return;}
621  if (runno >= 800 && runno <= 899) {scale = 1.0021456; return;}
622  if (runno >= 900 && runno <= 999) {scale = 1.00221055; return;}
623  if (runno >= 1000 && runno <= 1099) {scale = 1.00216472; return;}
624  if (runno >= 1100 && runno <= 1199) {scale = 1.00214208; return;}
625  if (runno >= 1200 && runno <= 1299) {scale = 1.00228874; return;}
626  if (runno >= 1300 && runno <= 1399) {scale = 1.00215047; return;}
627  if (runno >= 1400 && runno <= 1499) {scale = 1.00219808; return;}
628  } else if (expno == 17) {
629  if (runno >= 0 && runno <= 99) {scale = 1.00216742; return;}
630  if (runno >= 100 && runno <= 199) {scale = 1.00229433; return;}
631  if (runno >= 200 && runno <= 299) {scale = 1.0022749 ; return;}
632  if (runno >= 300 && runno <= 399) {scale = 1.00231283; return;}
633  if (runno >= 400 && runno <= 499) {scale = 1.00223654; return;}
634  if (runno >= 500 && runno <= 599) {scale = 1.00236524; return;}
635  if (runno >= 600 && runno <= 699) {scale = 1.00229312; return;}
636  if (runno >= 700 && runno <= 799) {scale = 1.002262 ; return;}
637  if (runno >= 800 && runno <= 899) {scale = 1.00220104; return;}
638  if (runno >= 900 && runno <= 999) {scale = 1.00215475; return;}
639  } else if (expno == 19) {
640  if (runno >= 0 && runno <= 99) {scale = 1.00227682; return;}
641  if (runno >= 100 && runno <= 199) {scale = 1.00235795; return;}
642  if (runno >= 200 && runno <= 299) {scale = 1.00251509; return;}
643  if (runno >= 300 && runno <= 399) {scale = 1.0022106 ; return;}
644  if (runno >= 400 && runno <= 499) {scale = 1.00230963; return;}
645  if (runno >= 500 && runno <= 599) {scale = 1.002229 ; return;}
646  if (runno >= 600 && runno <= 699) {scale = 1.00215402; return;}
647  if (runno >= 700 && runno <= 799) {scale = 1.00217892; return;}
648  if (runno >= 800 && runno <= 899) {scale = 1.0022305 ; return;}
649  if (runno >= 900 && runno <= 999) {scale = 1.0021458 ; return;}
650  if (runno >= 1000 && runno <= 1099) {scale = 1.00215792; return;}
651  if (runno >= 1100 && runno <= 1199) {scale = 1.0022667 ; return;}
652  if (runno >= 1200 && runno <= 1299) {scale = 1.00219581; return;}
653  if (runno >= 1300 && runno <= 1399) {scale = 1.00218378; return;}
654  if (runno >= 1400 && runno <= 1499) {scale = 1.00232172; return;}
655  if (runno >= 1500 && runno <= 1599) {scale = 1.00217172; return;}
656  if (runno >= 1600 && runno <= 1700) {scale = 1.00208639; return;}
657  if (runno >= 1700 && runno <= 1799) {scale = 1.00188253; return;}
658  if (runno >= 1800) {
659  B2ERROR("scale_momenta not ready for this exp,run "
660  << expno << "," << runno);
661  }
662  } else if (expno == 21) {
663  if (runno >= 0 && runno <= 99) {scale = 1.00228182; return;}
664  if (runno >= 100 && runno <= 199) {scale = 1.00233446; return;}
665  if (runno >= 200 && runno <= 299) {scale = 1.00238846; return;}
666  if (runno >= 300 && runno <= 399) {scale = 1.00238061 ; return;}
667  if (runno >= 400) {
668  B2ERROR("scale_momenta not ready for this exp,run "
669  << expno << "," << runno);
670  }
671  } else if (expno == 23) {
672  if (runno >= 0 && runno <= 99) {scale = 1.00216089; return;}
673  if (runno >= 100 && runno <= 199) {scale = 1.0019783; return;}
674  if (runno >= 200 && runno <= 299) {scale = 1.00172162; return;}
675  if (runno >= 300 && runno <= 399) {scale = 1.0017938 ; return;}
676  if (runno >= 400 && runno <= 499) {scale = 1.00177832 ; return;}
677  if (runno >= 500 && runno <= 599) {scale = 1.0017609 ; return;}
678  if (runno >= 600 && runno <= 699) {scale = 1.0017756 ; return;}
679  if (runno >= 700) {
680  B2ERROR("scale_momenta not ready for this exp,run "
681  << expno << "," << runno);
682  }
683  } else if (expno == 25) {
684  if (runno >= 0 && runno <= 99) {scale = 1.00190068; return;}
685  if (runno >= 100 && runno <= 199) {scale = 1.00199038; return;}
686  if (runno >= 200 && runno <= 299) {scale = 1.00196171; return;}
687  if (runno >= 300 && runno <= 399) {scale = 1.00200167; return;}
688  if (runno >= 400 && runno <= 499) {scale = 1.0019667 ; return;}
689  if (runno >= 500 && runno <= 599) {scale = 1.00212109; return;}
690  if (runno >= 600 && runno <= 699) {scale = 1.00202115; return;}
691  if (runno >= 700 && runno <= 799) {scale = 1.00196456; return;}
692  if (runno >= 800 && runno <= 899) {scale = 1.00200392; return;}
693  if (runno >= 900 && runno <= 999) {scale = 1.00199495; return;}
694  if (runno >= 1000 && runno <= 1099) {scale = 1.00202212; return;}
695  if (runno >= 1100 && runno <= 1199) {scale = 1.00205312; return;}
696  if (runno >= 1200 && runno <= 1299) {scale = 1.00200891; return;}
697  if (runno >= 1300 && runno <= 1399) {scale = 1.00196866; return;}
698  if (runno >= 1400 && runno <= 1499) {scale = 1.0020257 ; return;}
699  if (runno >= 1500 && runno <= 1599) {scale = 1.00196995; return;}
700  if (runno >= 1600 && runno <= 1699) {scale = 1.00189232; return;}
701  if (runno >= 1700 && runno <= 1799) {scale = 1.00179028; return;}
702  if (runno >= 1800 && runno <= 1899) {scale = 1.00179459; return;}
703  if (runno >= 1900 && runno <= 1999) {scale = 1.001762 ; return;}
704  if (runno >= 2000 && runno <= 2099) {scale = 1.00179514; return;}
705  if (runno >= 2100 && runno <= 2199) {scale = 1.00175211; return;}
706  if (runno >= 2200) {
707  B2ERROR("scale_momenta not ready for this exp,run "
708  << expno << "," << runno);
709  }
710  } else if (expno == 27) {
711  if (runno >= 0 && runno <= 99) {scale = 1.00192647; return;}
712  if (runno >= 100 && runno <= 199) {scale = 1.0019717 ; return;}
713  if (runno >= 200 && runno <= 299) {scale = 1.00196428; return;}
714  if (runno >= 300 && runno <= 399) {scale = 1.00190998; return;}
715  if (runno >= 400 && runno <= 499) {scale = 1.00204645; return;}
716  if (runno >= 500 && runno <= 599) {scale = 1.0020687 ; return;}
717  if (runno >= 600 && runno <= 699) {scale = 1.00198209; return;}
718 
719  if (runno >= 700 && runno <= 800) {scale = 1.00187505; return;}
720  if (runno >= 801 && runno <= 900) {scale = 1.00186805; return;}
721  if (runno >= 901 && runno <= 1000) {scale = 1.00185576; return;}
722  if (runno >= 1001 && runno <= 1079) {scale = 1.00177176; return;}
723  if (runno >= 1080 && runno <= 1100) {scale = 1.00177184; return;}
724  if (runno >= 1101 && runno <= 1200) {scale = 1.00174057; return;}
725  if (runno >= 1201 && runno <= 1251) {scale = 1.00189649; return;}
726  if (runno >= 1252 && runno <= 1300) {scale = 1.00189999; return;}
727  if (runno >= 1301 && runno <= 1400) {scale = 1.0018818 ; return;}
728  if (runno >= 1401 && runno <= 1500) {scale = 1.00200148; return;}
729  if (runno >= 1501 && runno <= 1600) {scale = 1.00220137; return;}
730  if (runno >= 1601 && runno <= 1632) {scale = 1.00217034; return;}
731  if (runno >= 1633) {
732  B2ERROR("scale_momenta not ready for this exp,run "
733  << expno << "," << runno);
734  }
735  } else if (expno == 31) {
736  if (runno >= 0 && runno <= 99) {scale = 1.000373374; return;}
737  if (runno >= 100 && runno <= 199) {scale = 1.000684843; return;}
738  if (runno >= 200 && runno <= 299) {scale = 1.000741216; return;}
739  if (runno >= 300 && runno <= 399) {scale = 1.00092523 ; return;}
740  if (runno >= 400 && runno <= 499) {scale = 1.00104576 ; return;}
741  if (runno >= 500 && runno <= 599) {scale = 1.00103982 ; return;}
742  if (runno >= 600 && runno <= 699) {scale = 1.0010601 ; return;}
743  if (runno >= 700 && runno <= 799) {scale = 1.000982515; return;}
744  if (runno >= 800 && runno <= 899) {scale = 1.00101577 ; return;}
745  if (runno >= 900 && runno <= 999) {scale = 1.000972193; return;}
746  if (runno >= 1000 && runno <= 1099) {scale = 1.00102536 ; return;}
747  if (runno >= 1100 && runno <= 1199) {scale = 1.00127571 ; return;}
748  if (runno >= 1200 && runno <= 1299) {scale = 1.00117938 ; return;}
749  if (runno >= 1300 && runno <= 1399) {scale = 1.00121084 ; return;}
750  if (runno >= 1400 && runno <= 1499) {scale = 1.00125911 ; return;}
751  if (runno >= 1500 && runno <= 1599) {scale = 1.0012907 ; return;}
752  if (runno >= 1600 && runno <= 1699) {scale = 1.00125362 ; return;}
753  if (runno >= 1700 && runno <= 1799) {scale = 1.00131686 ; return;}
754  if (runno >= 1800) {
755  B2ERROR("scale_momenta not ready for this exp,run "
756  << expno << "," << runno);
757  }
758  } else if (expno == 33) {
759  if (runno >= 0 && runno <= 99) {scale = 1.00136407; return;}
760  if (runno >= 100 && runno <= 199) {scale = 1.0013701 ; return;}
761  if (runno >= 200 && runno <= 299) {scale = 1.00156244; return;}
762  if (runno >= 300 && runno <= 399) {scale = 1.00138501; return;}
763  if (runno >= 400 && runno <= 499) {scale = 1.00148468; return;}
764  if (runno >= 500 && runno <= 599) {scale = 1.0013797 ; return;}
765  if (runno >= 600 && runno <= 699) {scale = 1.00152298; return;}
766  if (runno >= 700 && runno <= 799) {scale = 1.001524 ; return;}
767  if (runno >= 800 && runno <= 899) {scale = 1.0014635 ; return;}
768  if (runno >= 900) {
769  B2ERROR("scale_momenta not ready for this exp,run "
770  << expno << "," << runno);
771  }
772  } else if (expno == 35) {
773  if (runno >= 0 && runno <= 99) {scale = 1.00135452; return;}
774  if (runno >= 100 && runno <= 199) {scale = 1.00135798; return;}
775  if (runno >= 200 && runno <= 299) {scale = 1.00139979; return;}
776  if (runno >= 300 && runno <= 399) {scale = 1.00136061; return;}
777  if (runno >= 400 && runno <= 499) {scale = 1.00135776; return;}
778  if (runno >= 500 && runno <= 599) {scale = 1.00118666; return;}
779  if (runno >= 600 && runno <= 699) {scale = 1.0011346 ; return;}
780  if (runno >= 700) {
781  B2ERROR("scale_momenta not ready for this exp,run "
782  << expno << "," << runno);
783  }
784  } else if (expno == 37) {
785  if (runno >= 0 && runno <= 99) {scale = 1.00076522 ; return;}
786  if (runno >= 100 && runno <= 199) {scale = 1.000875154; return;}
787  if (runno >= 200 && runno <= 299) {scale = 1.000946763; return;}
788  if (runno >= 300 && runno <= 399) {scale = 1.000868444; return;}
789  if (runno >= 400 && runno <= 499) {scale = 1.000781409; return;}
790  if (runno >= 500 && runno <= 599) {scale = 1.000781171; return;}
791  if (runno >= 600 && runno <= 699) {scale = 1.000857962; return;}
792  if (runno >= 700 && runno <= 799) {scale = 1.000756082; return;}
793  if (runno >= 800 && runno <= 899) {scale = 1.000727355; return;}
794  if (runno >= 900 && runno <= 999) {scale = 1.000740236; return;}
795  if (runno >= 1000 && runno <= 1099) {scale = 1.000499606; return;}
796  if (runno >= 1100 && runno <= 1199) {scale = 1.000481664; return;}
797  if (runno >= 1200 && runno <= 1299) {scale = 1.000706924; return;}
798  if (runno >= 1300 && runno <= 1399) {scale = 1.000673738; return;}
799  if (runno >= 1400 && runno <= 1499) {scale = 1.000662648; return;}
800  if (runno >= 1500 && runno <= 1599) {scale = 1.000671198; return;}
801  if (runno >= 1600 && runno <= 1699) {scale = 1.000604364; return;}
802  if (runno >= 1700 && runno <= 1799) {scale = 1.000717372; return;}
803  if (runno >= 1800 && runno <= 1899) {scale = 1.000512399; return;}
804  if (runno >= 1900 && runno <= 1999) {scale = 1.000436958; return;}
805  if (runno >= 2000) {
806  B2ERROR("scale_momenta not ready for this exp,run "
807  << expno << "," << runno);
808  }
809  } else if (expno == 39) {
810  if (runno >= 0 && runno <= 99) {scale = 1.000504342; return;}
811  if (runno >= 100 && runno <= 199) {scale = 1.000704544; return;}
812  if (runno >= 200 && runno <= 299) {scale = 1.00094335 ; return;}
813  if (runno >= 300 && runno <= 399) {scale = 1.000928819; return;}
814  if (runno >= 400 && runno <= 499) {scale = 1.000884638; return;}
815  if (runno >= 500 && runno <= 599) {scale = 1.00083459 ; return;}
816  if (runno >= 600 && runno <= 699) {scale = 1.000767604; return;}
817  if (runno >= 700 && runno <= 799) {scale = 1.000882219; return;}
818  if (runno >= 800 && runno <= 899) {scale = 1.000781437; return;}
819  if (runno >= 900 && runno <= 999) {scale = 1.000853168; return;}
820  if (runno >= 1000 && runno <= 1099) {scale = 1.000926527; return;}
821  if (runno >= 1100 && runno <= 1199) {scale = 1.000942882; return;}
822  if (runno >= 1200 && runno <= 1299) {scale = 1.000932802; return;}
823  if (runno >= 1300 && runno <= 1399) {scale = 1.000898892; return;}
824  if (runno >= 1400) {
825  B2ERROR("scale_momenta not ready for this exp,run "
826  << expno << "," << runno);
827  }
828  } else if (expno == 41) {
829  if (runno >= 0 && runno <= 99) {scale = 1.00178427; return;}
830  if (runno >= 100 && runno <= 199) {scale = 1.00188559; return;}
831  if (runno >= 200 && runno <= 299) {scale = 1.0019292 ; return;}
832  if (runno >= 300 && runno <= 399) {scale = 1.00196352; return;}
833  if (runno >= 400 && runno <= 499) {scale = 1.0019078 ; return;}
834  if (runno >= 500 && runno <= 599) {scale = 1.00185598; return;}
835  if (runno >= 600 && runno <= 699) {scale = 1.00191314; return;}
836  if (runno >= 700 && runno <= 799) {scale = 1.00179647; return;}
837  if (runno >= 800 && runno <= 899) {scale = 1.00189776; return;}
838  if (runno >= 900 && runno <= 999) {scale = 1.00184798; return;}
839  if (runno >= 1000 && runno <= 1099) {scale = 1.00177963; return;}
840  if (runno >= 1100 && runno <= 1199) {scale = 1.00176408; return;}
841  if (runno >= 1200 && runno <= 1299) {scale = 1.00171371; return;}
842  if (runno >= 1300) {
843  B2ERROR("scale_momenta not ready for this exp,run "
844  << expno << "," << runno);
845  }
846  } else if (expno == 43) {
847  if (runno >= 0 && runno <= 99) {scale = 1.00142307; return;}
848  if (runno >= 100 && runno <= 199) {scale = 1.000979455; return;}
849  if (runno >= 200 && runno <= 299) {scale = 1.000974458; return;}
850  if (runno >= 300 && runno <= 399) {scale = 1.00103301; return;}
851  if (runno >= 400 && runno <= 499) {scale = 1.001111994; return;}
852  if (runno >= 500 && runno <= 599) {scale = 1.00100635; return;}
853  if (runno >= 600 && runno <= 699) {scale = 1.00105078; return;}
854  if (runno >= 700 && runno <= 799) {scale = 1.00103593; return;}
855  if (runno >= 800 && runno <= 899) {scale = 1.00105158; return;}
856  if (runno >= 900 && runno <= 999) {scale = 1.000955608; return;}
857  if (runno >= 1000 && runno <= 1099) {scale = 1.00099199; return;}
858  if (runno >= 1100 && runno <= 1199) {scale = 1.0011439; return;}
859  if (runno >= 1200) {
860  B2ERROR("scale_momenta not ready for this exp,run "
861  << expno << "," << runno);
862  }
863  } else if (expno == 45) {
864  if (runno >= 0 && runno <= 99) {scale = 1.00126261; return;}
865  if (runno >= 100 && runno <= 199) {scale = 1.00138601; return;}
866  if (runno >= 200 && runno <= 299) {scale = 1.00135372; return;}
867  if (runno >= 300 && runno <= 399) {scale = 1.00141286; return;}
868  if (runno >= 400 && runno <= 499) {scale = 1.00147822; return;}
869  if (runno >= 500) {
870  B2ERROR("scale_momenta not ready for this exp,run "
871  << expno << "," << runno);
872  }
873  } else if (expno == 47) {
874  if (runno >= 0 && runno <= 99) {scale = 1.00156977; return;}
875  if (runno >= 100 && runno <= 199) {scale = 1.00155614; return;}
876  if (runno >= 200 && runno <= 299) {scale = 1.0016555; return;}
877  if (runno >= 300 && runno <= 399) {scale = 1.00167046; return;}
878  if (runno >= 400 && runno <= 499) {scale = 1.00168705; return;}
879  if (runno >= 500 && runno <= 599) {scale = 1.00169555; return;}
880  if (runno >= 600 && runno <= 699) {scale = 1.00175653; return;}
881  if (runno >= 700 && runno <= 799) {scale = 1.00174358; return;}
882  if (runno >= 800 && runno <= 899) {scale = 1.00174004; return;}
883  if (runno >= 900) {
884  B2ERROR("scale_momenta not ready for this exp,run "
885  << expno << "," << runno);
886  }
887  } else if (expno == 49) {
888  if (runno >= 0 && runno <= 99) {scale = 1.00158837; return;}
889  if (runno >= 100 && runno <= 199) {scale = 1.00163884; return;}
890  if (runno >= 200 && runno <= 299) {scale = 1.00160595; return;}
891  if (runno >= 300 && runno <= 399) {scale = 1.00149916; return;}
892  if (runno >= 400 && runno <= 499) {scale = 1.0014956 ; return;}
893  if (runno >= 500 && runno <= 599) {scale = 1.00156212; return;}
894  if (runno >= 600 && runno <= 699) {scale = 1.00121868; return;}
895  if (runno >= 700 && runno <= 799) {scale = 1.00134613; return;}
896  if (runno >= 800 && runno <= 899) {scale = 1.00138985; return;}
897  if (runno >= 900 && runno <= 999) {scale = 1.00129356; return;}
898  if (runno >= 1000 && runno <= 1099) {scale = 1.00119732; return;}
899  if (runno >= 1100 && runno <= 1199) {scale = 1.00121481; return;}
900  if (runno >= 1200 && runno <= 1299) {scale = 1.00121108; return;}
901  if (runno >= 1300) {
902  B2ERROR("scale_momenta not ready for this exp,run "
903  << expno << "," << runno);
904  }
905  } else if (expno == 51) {
906  if (runno >= 0 && runno <= 99) {scale = 1.00160252; return;}
907  if (runno >= 100 && runno <= 199) {scale = 1.00156099; return;}
908  if (runno >= 200 && runno <= 299) {scale = 1.00154760; return;}
909  if (runno >= 300 && runno <= 399) {scale = 1.00146316; return;}
910  if (runno >= 400 && runno <= 499) {scale = 1.00145525; return;}
911  if (runno >= 500 && runno <= 599) {scale = 1.00134429; return;}
912  if (runno >= 600 && runno <= 699) {scale = 1.00135581; return;}
913  if (runno >= 700 && runno <= 799) {scale = 1.00134382; return;}
914  if (runno >= 800 && runno <= 899) {scale = 1.00126462; return;}
915  if (runno >= 900 && runno <= 999) {scale = 1.00130752; return;}
916  if (runno >= 1000 && runno <= 1099) {scale = 1.00130452; return;}
917  if (runno >= 1100 && runno <= 1199) {scale = 1.00131440; return;}
918  if (runno >= 1200 && runno <= 1299) {scale = 1.00130864; return;}
919  if (runno >= 1300 && runno <= 1399) {scale = 1.00105290; return;}
920  if (runno >= 1400 && runno <= 1499) {scale = 1.00126645; return;}
921  if (runno >= 1500 && runno <= 1599) {scale = 1.00126383; return;}
922  if (runno >= 1600 && runno <= 1699) {scale = 1.00141111; return;}
923  if (runno >= 1700 && runno <= 1799) {scale = 1.00126220; return;}
924  if (runno >= 1800 && runno <= 1899) {scale = 1.00105098; return;}
925  if (runno >= 1900) {
926  B2ERROR("scale_momenta not ready for this exp,run "
927  << expno << "," << runno);
928  }
929  } else if (expno == 53) {
930  if (runno >= 0 && runno <= 99) {scale = 1.0011516; return;}
931  if (runno >= 100 && runno <= 199) {scale = 1.00115527; return;}
932  if (runno >= 200 && runno <= 299) {scale = 1.00114844; return;}
933  if (runno >= 300) {
934  B2ERROR("scale_momenta not ready for this exp,run "
935  << expno << "," << runno);
936  }
937  } else if (expno == 55) {
938  if (runno >= 0 && runno <= 99) {scale = 1.00114284; return;}
939  if (runno >= 100 && runno <= 199) {scale = 1.00111458; return;}
940  if (runno >= 200 && runno <= 299) {scale = 1.00109686; return;}
941  if (runno >= 300 && runno <= 399) {scale = 1.00119475; return;}
942  if (runno >= 400 && runno <= 499) {scale = 1.00117818; return;}
943  if (runno >= 500 && runno <= 599) {scale = 1.00115789; return;}
944  if (runno >= 600 && runno <= 699) {scale = 1.00122261; return;}
945  if (runno >= 700 && runno <= 799) {scale = 1.00118454; return;}
946  if (runno >= 800 && runno <= 899) {scale = 1.00118042; return;}
947  if (runno >= 900 && runno <= 999) {scale = 1.00124759; return;}
948  if (runno >= 1000 && runno <= 1099) {scale = 1.00128055; return;}
949  if (runno >= 1100 && runno <= 1199) {scale = 1.00119131; return;}
950  if (runno >= 1200 && runno <= 1299) {scale = 1.00122238; return;}
951  if (runno >= 1300 && runno <= 1399) {scale = 1.00129538; return;}
952  if (runno >= 1400 && runno <= 1499) {scale = 1.00130387; return;}
953  if (runno >= 1500 && runno <= 1599) {scale = 1.00130858; return;}
954  if (runno >= 1600 && runno <= 1699) {scale = 1.00111854; return;}
955  if (runno >= 1700 && runno <= 1799) {scale = 1.00136261; return;}
956  if (runno >= 1800) {
957  B2ERROR("scale_momenta not ready for this exp,run "
958  << expno << "," << runno);
959  }
960  } else if (expno == 61) {
961  if (runno >= 0 && runno <= 99) {scale = 1.0009992; return;}
962  if (runno >= 100 && runno <= 199) {scale = 1.00113704; return;}
963  if (runno >= 200 && runno <= 299) {scale = 1.00129904; return;}
964  if (runno >= 300 && runno <= 399) {scale = 1.00141879; return;}
965  if (runno >= 400 && runno <= 499) {scale = 1.00146707; return;}
966  if (runno >= 500 && runno <= 599) {scale = 1.00150101; return;}
967  if (runno >= 600 && runno <= 699) {scale = 1.00147322; return;}
968  if (runno >= 700 && runno <= 799) {scale = 1.00153929; return;}
969  if (runno >= 800 && runno <= 899) {scale = 1.00159997; return;}
970  if (runno >= 900 && runno <= 999) {scale = 1.00164032; return;}
971  if (runno >= 1000 && runno <= 1099) {scale = 1.00165878; return;}
972  if (runno >= 1100 && runno <= 1199) {scale = 1.00163475; return;}
973  if (runno >= 1200 && runno <= 1207) {scale = 1.00166193; return;}
974  if (runno >= 1208 && runno <= 1299) {scale = 1.00235824; return;}
975  if (runno >= 1300 && runno <= 1399) {scale = 1.00242282; return;}
976  if (runno >= 1400) {
977  B2ERROR("scale_momenta not ready for this exp,run "
978  << expno << "," << runno);
979  }
980  } else if (expno == 65) {
981  if (runno <= 999) {
982  B2ERROR("scale_momenta not ready for this exp,run "
983  << expno << "," << runno);
984  }
985  if (runno >= 1000 && runno <= 1336) {scale = 1.00145234; return;}
986  if (runno >= 1336) {
987  B2ERROR("scale_momenta not ready for this exp,run "
988  << expno << "," << runno);
989  }
990  } else
991  B2ERROR("scale_momenta mode=2 not ready for exp " << expno);
992  }
993  return;
994  }
995 
996 //=====================================================================
997  void B2BIIFixMdstModule::scale_momenta_set_v2(const int mode, const int expno,
998  const int runno, double& scale)
999  {
1000 //=====================================================================
1001 
1002  //for e15 mdst processed with b20020405
1003 
1004  scale = 1.;
1005 
1006  if (mode == 1) {
1007  B2ERROR("scale_momenta mode=1 not ready for exp " << expno);
1008  return;
1009  }
1010 
1011  if (mode == 2) {
1012  if (expno == 7) {
1013 
1014  } else if (expno == 9) {
1015 
1016  } else if (expno == 11) {
1017 
1018  } else if (expno == 13) {
1019 
1020  } else if (expno == 15) {
1021 
1022  } else if (expno == 17) {
1023 
1024  } else if (expno == 19) {
1025  B2ERROR("scale_momenta not ready for this exp,run "
1026  << expno << "," << runno);
1027 
1028  } else if (expno == 21) {
1029  B2ERROR("scale_momenta not ready for this exp,run "
1030  << expno << "," << runno);
1031 
1032  } else if (expno == 23) {
1033  B2ERROR("scale_momenta not ready for this exp,run "
1034  << expno << "," << runno);
1035 
1036  } else if (expno == 25) {
1037  B2ERROR("scale_momenta not ready for this exp,run "
1038  << expno << "," << runno);
1039 
1040  } else if (expno == 27) {
1041  B2ERROR("scale_momenta not ready for this exp,run "
1042  << expno << "," << runno);
1043 
1044  } else if (expno == 31) {
1045  if (runno >= 0 && runno <= 137) {
1046  B2ERROR("scale_momenta not ready for this exp,run "
1047  << expno << "," << runno);
1048  }
1049  if (runno >= 138 && runno <= 199) {scale = 1.000931841; return;}
1050  if (runno >= 200 && runno <= 299) {scale = 1.000916397; return;}
1051  if (runno >= 300 && runno <= 399) {scale = 1.00108023 ; return;}
1052  if (runno >= 400 && runno <= 499) {scale = 1.00118662 ; return;}
1053  if (runno >= 500 && runno <= 599) {scale = 1.00117739 ; return;}
1054  if (runno >= 600 && runno <= 699) {scale = 1.00119542 ; return;}
1055  if (runno >= 700 && runno <= 799) {scale = 1.00110396 ; return;}
1056  if (runno >= 800 && runno <= 899) {scale = 1.00109603 ; return;}
1057  if (runno >= 900 && runno <= 999) {scale = 1.00112795 ; return;}
1058  if (runno >= 1000 && runno <= 1099) {scale = 1.00118365 ; return;}
1059  if (runno >= 1100 && runno <= 1199) {scale = 1.00142214 ; return;}
1060  if (runno >= 1200 && runno <= 1299) {scale = 1.00133150 ; return;}
1061  if (runno >= 1300 && runno <= 1399) {scale = 1.00132831 ; return;}
1062  if (runno >= 1400 && runno <= 1499) {scale = 1.00136554 ; return;}
1063  if (runno >= 1500 && runno <= 1599) {scale = 1.00141187 ; return;}
1064  if (runno >= 1600 && runno <= 1699) {scale = 1.00136628 ; return;}
1065  if (runno >= 1700 && runno <= 1799) {scale = 1.00139273 ; return;}
1066  if (runno >= 1800) {
1067  B2ERROR("scale_momenta not ready for this exp,run "
1068  << expno << "," << runno);
1069  }
1070  } else if (expno == 33) {
1071  if (runno >= 0 && runno <= 99) {scale = 1.00149319; return;}
1072  if (runno >= 100 && runno <= 199) {scale = 1.00150915; return;}
1073  if (runno >= 200 && runno <= 299) {scale = 1.00173040; return;}
1074  if (runno >= 300 && runno <= 399) {scale = 1.00150449; return;}
1075  if (runno >= 400 && runno <= 499) {scale = 1.00161519; return;}
1076  if (runno >= 500 && runno <= 599) {scale = 1.00151670; return;}
1077  if (runno >= 600 && runno <= 699) {scale = 1.00164347; return;}
1078  if (runno >= 700 && runno <= 799) {scale = 1.00164165; return;}
1079  if (runno >= 800 && runno <= 899) {scale = 1.00161369; return;}
1080  if (runno >= 900) {
1081  B2ERROR("scale_momenta not ready for this exp,run "
1082  << expno << "," << runno);
1083  }
1084  } else if (expno == 35) {
1085  if (runno >= 0 && runno <= 99) {scale = 1.00147034; return;}
1086  if (runno >= 100 && runno <= 199) {scale = 1.00148523; return;}
1087  if (runno >= 200 && runno <= 299) {scale = 1.00153372; return;}
1088  if (runno >= 300 && runno <= 399) {scale = 1.00148256; return;}
1089  if (runno >= 400 && runno <= 499) {scale = 1.00144902; return;}
1090  if (runno >= 500 && runno <= 599) {scale = 1.00131501; return;}
1091  if (runno >= 600 && runno <= 699) {scale = 1.00126371; return;}
1092  if (runno >= 700) {
1093  B2ERROR("scale_momenta not ready for this exp,run "
1094  << expno << "," << runno);
1095  }
1096  } else if (expno == 37) {
1097  if (runno >= 0 && runno <= 99) {scale = 1.000916277; return;}
1098  if (runno >= 100 && runno <= 199) {scale = 1.001035310; return;}
1099  if (runno >= 200 && runno <= 299) {scale = 1.001123403; return;}
1100  if (runno >= 300 && runno <= 399) {scale = 1.001017718; return;}
1101  if (runno >= 400 && runno <= 499) {scale = 1.000932890; return;}
1102  if (runno >= 500 && runno <= 599) {scale = 1.000928479; return;}
1103  if (runno >= 600 && runno <= 699) {scale = 1.000997938; return;}
1104  if (runno >= 700 && runno <= 799) {scale = 1.000899663; return;}
1105  if (runno >= 800 && runno <= 899) {scale = 1.000860910; return;}
1106  if (runno >= 900 && runno <= 999) {scale = 1.000882920; return;}
1107  if (runno >= 1000 && runno <= 1099) {scale = 1.000616966; return;}
1108  if (runno >= 1100 && runno <= 1199) {scale = 1.000613018; return;}
1109  if (runno >= 1200 && runno <= 1299) {scale = 1.000832338; return;}
1110  if (runno >= 1300 && runno <= 1399) {scale = 1.000803640; return;}
1111  if (runno >= 1400 && runno <= 1499) {scale = 1.000770454; return;}
1112  if (runno >= 1500 && runno <= 1599) {scale = 1.000786608; return;}
1113  if (runno >= 1600 && runno <= 1699) {scale = 1.000718089; return;}
1114  if (runno >= 1700 && runno <= 1799) {scale = 1.000826042; return;}
1115  if (runno >= 1800 && runno <= 1899) {scale = 1.000638150; return;}
1116  if (runno >= 1900 && runno <= 1999) {scale = 1.000529173; return;}
1117  if (runno >= 2000) {
1118  B2ERROR("scale_momenta not ready for this exp,run "
1119  << expno << "," << runno);
1120  }
1121  } else if (expno == 39) {
1122  if (runno >= 0 && runno <= 99) {scale = 1.000610857; return;}
1123  if (runno >= 100 && runno <= 199) {scale = 1.000838583; return;}
1124  if (runno >= 200 && runno <= 299) {scale = 1.00105918 ; return;}
1125  if (runno >= 300 && runno <= 399) {scale = 1.00105841 ; return;}
1126  if (runno >= 400 && runno <= 499) {scale = 1.001025523; return;}
1127  if (runno >= 500 && runno <= 599) {scale = 1.000967373; return;}
1128  if (runno >= 600 && runno <= 699) {scale = 1.000898585; return;}
1129  if (runno >= 700 && runno <= 799) {scale = 1.001003199; return;}
1130  if (runno >= 800 && runno <= 899) {scale = 1.000897072; return;}
1131  if (runno >= 900 && runno <= 999) {scale = 1.000972551; return;}
1132  if (runno >= 1000 && runno <= 1099) {scale = 1.001044677; return;}
1133  if (runno >= 1100 && runno <= 1199) {scale = 1.00106451 ; return;}
1134  if (runno >= 1200 && runno <= 1299) {scale = 1.00108570 ; return;}
1135  if (runno >= 1300 && runno <= 1399) {scale = 1.00102381 ; return;}
1136  if (runno >= 1400) {
1137  B2ERROR("scale_momenta not ready for this exp,run "
1138  << expno << "," << runno);
1139  }
1140  } else if (expno == 41) {
1141  if (runno >= 0 && runno <= 99) {scale = 1.00189378; return;}
1142  if (runno >= 100 && runno <= 199) {scale = 1.00197304; return;}
1143  if (runno >= 200 && runno <= 299) {scale = 1.00204049; return;}
1144  if (runno >= 300 && runno <= 399) {scale = 1.00205065; return;}
1145  if (runno >= 400 && runno <= 499) {scale = 1.00199205; return;}
1146  if (runno >= 500 && runno <= 599) {scale = 1.00195618; return;}
1147  if (runno >= 600 && runno <= 699) {scale = 1.00200889; return;}
1148  if (runno >= 700 && runno <= 799) {scale = 1.00190365; return;}
1149  if (runno >= 800 && runno <= 899) {scale = 1.00204192; return;}
1150  if (runno >= 900 && runno <= 999) {scale = 1.00196542; return;}
1151  if (runno >= 1000 && runno <= 1099) {scale = 1.00189706; return;}
1152  if (runno >= 1100 && runno <= 1199) {scale = 1.00187422; return;}
1153  if (runno >= 1200 && runno <= 1299) {scale = 1.00183714; return;}
1154  if (runno >= 1300) {
1155  B2ERROR("scale_momenta not ready for this exp,run "
1156  << expno << "," << runno);
1157  }
1158  } else if (expno == 43) {
1159  if (runno >= 0 && runno <= 99) {scale = 1.00151737; return;}
1160  if (runno >= 100 && runno <= 199) {scale = 1.00110489; return;}
1161  if (runno >= 200 && runno <= 299) {scale = 1.00108144; return;}
1162  if (runno >= 300 && runno <= 399) {scale = 1.00114918; return;}
1163  if (runno >= 400 && runno <= 499) {scale = 1.00122723; return;}
1164  if (runno >= 500 && runno <= 599) {scale = 1.00111069; return;}
1165  if (runno >= 600 && runno <= 699) {scale = 1.00115667; return;}
1166  if (runno >= 700 && runno <= 799) {scale = 1.00113759; return;}
1167  if (runno >= 800 && runno <= 899) {scale = 1.00115609; return;}
1168  if (runno >= 900 && runno <= 999) {scale = 1.00105426; return;}
1169  //tentative for quality check of 5S mdst in 2009 Ang.-Sep.
1170  // if (runno>=1000 && runno <=1034) {scale = 1.00099199; return;}
1171  // if (runno>=1035 && runno <=1099) {scale = 1.00111222; return;}
1172  if (runno >= 1000 && runno <= 1099) {scale = 1.00111210; return;}
1173  if (runno >= 1100 && runno <= 1199) {scale = 1.00123104; return;}
1174  if (runno >= 1200) {
1175  B2ERROR("scale_momenta not ready for this exp,run "
1176  << expno << "," << runno);
1177  }
1178  } else if (expno == 45) {
1179  if (runno >= 0 && runno <= 99) {scale = 1.00136477; return;}
1180  if (runno >= 100 && runno <= 199) {scale = 1.00151600; return;}
1181  if (runno >= 200 && runno <= 299) {scale = 1.00146757; return;}
1182  if (runno >= 300 && runno <= 399) {scale = 1.00153299; return;}
1183  if (runno >= 400 && runno <= 499) {scale = 1.00159018; return;}
1184  if (runno >= 500) {
1185  B2ERROR("scale_momenta not ready for this exp,run "
1186  << expno << "," << runno);
1187  }
1188  } else if (expno == 47) {
1189  if (runno >= 0 && runno <= 99) {scale = 1.00166672; return;}
1190  if (runno >= 100 && runno <= 199) {scale = 1.00165120; return;}
1191  if (runno >= 200 && runno <= 299) {scale = 1.00175597; return;}
1192  if (runno >= 300 && runno <= 399) {scale = 1.00177319; return;}
1193  if (runno >= 400 && runno <= 499) {scale = 1.00179552; return;}
1194  if (runno >= 500 && runno <= 599) {scale = 1.00179413; return;}
1195  if (runno >= 600 && runno <= 699) {scale = 1.00186237; return;}
1196  if (runno >= 700 && runno <= 799) {scale = 1.00183016; return;}
1197  if (runno >= 800 && runno <= 899) {scale = 1.00184324; return;}
1198  if (runno >= 900) {
1199  B2ERROR("scale_momenta not ready for this exp,run "
1200  << expno << "," << runno);
1201  }
1202  } else if (expno == 49) {
1203  if (runno >= 0 && runno <= 99) {scale = 1.00171645; return;}
1204  if (runno >= 100 && runno <= 199) {scale = 1.00177728; return;}
1205  if (runno >= 200 && runno <= 299) {scale = 1.00173301; return;}
1206  if (runno >= 300 && runno <= 399) {scale = 1.00162075; return;}
1207  if (runno >= 400 && runno <= 499) {scale = 1.00163153; return;}
1208  if (runno >= 500 && runno <= 599) {scale = 1.00168559; return;}
1209  if (runno >= 600 && runno <= 699) {scale = 1.00139227; return;}
1210  if (runno >= 700 && runno <= 799) {scale = 1.00148583; return;}
1211  if (runno >= 800 && runno <= 899) {scale = 1.00150403; return;}
1212  if (runno >= 900 && runno <= 999) {scale = 1.00142759; return;}
1213  if (runno >= 1000 && runno <= 1099) {scale = 1.00134573; return;}
1214  if (runno >= 1100 && runno <= 1199) {scale = 1.00138313; return;}
1215  if (runno >= 1200 && runno <= 1299) {scale = 1.00151369; return;}
1216  if (runno >= 1300) {
1217  B2ERROR("scale_momenta not ready for this exp,run "
1218  << expno << "," << runno);
1219  }
1220  } else if (expno == 51) {
1221  if (runno >= 0 && runno <= 99) {scale = 1.00165035; return;}
1222  if (runno >= 100 && runno <= 199) {scale = 1.00161504; return;}
1223  if (runno >= 200 && runno <= 299) {scale = 1.00160162; return;}
1224  if (runno >= 300 && runno <= 399) {scale = 1.00152725; return;}
1225  if (runno >= 400 && runno <= 499) {scale = 1.00149943; return;}
1226  if (runno >= 500 && runno <= 599) {scale = 1.00141294; return;}
1227  if (runno >= 600 && runno <= 699) {scale = 1.00140154; return;}
1228  if (runno >= 700 && runno <= 799) {scale = 1.00140759; return;}
1229  if (runno >= 800 && runno <= 899) {scale = 1.00133671; return;}
1230  if (runno >= 900 && runno <= 999) {scale = 1.00136792; return;}
1231  if (runno >= 1000 && runno <= 1099) {scale = 1.00135251; return;}
1232  if (runno >= 1100 && runno <= 1199) {scale = 1.00138229; return;}
1233  if (runno >= 1200 && runno <= 1299) {scale = 1.00134938; return;}
1234  if (runno >= 1300 && runno <= 1399) {scale = 1.00106240; return;}
1235  if (runno >= 1400 && runno <= 1499) {scale = 1.00132666; return;}
1236  if (runno >= 1500 && runno <= 1599) {scale = 1.00132654; return;}
1237  if (runno >= 1600 && runno <= 1699) {scale = 1.00146619; return;}
1238  if (runno >= 1700 && runno <= 1799) {scale = 1.00131902; return;}
1239  if (runno >= 1800 && runno <= 1899) {scale = 1.00114243; return;}
1240  if (runno >= 1900) {
1241  B2ERROR("scale_momenta not ready for this exp,run "
1242  << expno << "," << runno);
1243  }
1244  } else if (expno == 53) {
1245  if (runno >= 0 && runno <= 99) {scale = 1.00125475; return;}
1246  if (runno >= 100 && runno <= 199) {scale = 1.00124954; return;}
1247  if (runno >= 200 && runno <= 299) {scale = 1.00122914; return;}
1248  if (runno >= 300) {
1249  B2ERROR("scale_momenta not ready for this exp,run "
1250  << expno << "," << runno);
1251  }
1252  } else if (expno == 55) {
1253  if (runno >= 0 && runno <= 99) {scale = 1.00119352; return;}
1254  if (runno >= 100 && runno <= 199) {scale = 1.00117130; return;}
1255  if (runno >= 200 && runno <= 299) {scale = 1.00115825; return;}
1256  if (runno >= 300 && runno <= 399) {scale = 1.00125005; return;}
1257  if (runno >= 400 && runno <= 499) {scale = 1.00124720; return;}
1258  if (runno >= 500 && runno <= 599) {scale = 1.00122234; return;}
1259  if (runno >= 600 && runno <= 699) {scale = 1.00128709; return;}
1260  if (runno >= 700 && runno <= 799) {scale = 1.00123081; return;}
1261  if (runno >= 800 && runno <= 899) {scale = 1.00124198; return;}
1262  if (runno >= 900 && runno <= 999) {scale = 1.00131118; return;}
1263  if (runno >= 1000 && runno <= 1099) {scale = 1.00132496; return;}
1264  if (runno >= 1100 && runno <= 1199) {scale = 1.00126186; return;}
1265  if (runno >= 1200 && runno <= 1299) {scale = 1.00127849; return;}
1266  if (runno >= 1300 && runno <= 1399) {scale = 1.00135312; return;}
1267  if (runno >= 1400 && runno <= 1499) {scale = 1.00136637; return;}
1268  if (runno >= 1500 && runno <= 1599) {scale = 1.00136270; return;}
1269  if (runno >= 1600 && runno <= 1699) {scale = 1.00118422; return;}
1270  if (runno >= 1700 && runno <= 1799) {scale = 1.00142667; return;}
1271  if (runno >= 1800) {
1272  B2ERROR("scale_momenta not ready for this exp,run "
1273  << expno << "," << runno);
1274  }
1275  } else if (expno == 61) {
1276  if (runno >= 0 && runno <= 99) {scale = 1.00103013; return;}
1277  if (runno >= 100 && runno <= 199) {scale = 1.00116185; return;}
1278  if (runno >= 200 && runno <= 299) {scale = 1.00133560; return;}
1279  if (runno >= 300 && runno <= 399) {scale = 1.00145027; return;}
1280  if (runno >= 400 && runno <= 499) {scale = 1.00147949; return;}
1281  if (runno >= 500 && runno <= 599) {scale = 1.00151022; return;}
1282  if (runno >= 600 && runno <= 699) {scale = 1.00150439; return;}
1283  if (runno >= 700 && runno <= 799) {scale = 1.00155006; return;}
1284  if (runno >= 800 && runno <= 899) {scale = 1.00162396; return;}
1285  if (runno >= 900 && runno <= 999) {scale = 1.00168542; return;}
1286  if (runno >= 1000 && runno <= 1099) {scale = 1.00168249; return;}
1287  if (runno >= 1100 && runno <= 1207) {scale = 1.00166891; return;}
1288  if (runno >= 1208 && runno <= 1299) {scale = 1.00249956; return;}
1289  if (runno >= 1300 && runno <= 1399) {scale = 1.00255134; return;}
1290  if (runno >= 1400) {
1291  B2ERROR("scale_momenta not ready for this exp,run "
1292  << expno << "," << runno);
1293  }
1294  } else if (expno == 63) {
1295  if (runno >= 0 && runno <= 99) {scale = 1.00129667; return;}
1296  if (runno >= 100 && runno <= 199) {scale = 1.00123725; return;}
1297  if (runno >= 200 && runno <= 299) {scale = 1.00126795; return;}
1298  if (runno >= 300 && runno <= 399) {scale = 1.00122458; return;}
1299  if (runno >= 400 && runno <= 499) {scale = 1.00116489; return;}
1300  if (runno >= 500 && runno <= 599) {scale = 1.00116968; return;}
1301  if (runno >= 600 && runno <= 699) {scale = 1.000918379; return;}
1302  if (runno >= 700 && runno <= 799) {scale = 1.0010429; return;}
1303  if (runno >= 800) {
1304  B2ERROR("scale_momenta not ready for this exp,run "
1305  << expno << "," << runno);
1306  }
1307  } else if (expno == 65) {
1308  if (runno >= 0 && runno <= 99) {scale = 1.00116975; return;}
1309  if (runno >= 100 && runno <= 199) {scale = 1.00111926; return;}
1310  if (runno >= 200 && runno <= 299) {scale = 1.00110162; return;}
1311  if (runno >= 300 && runno <= 399) {scale = 1.00109524; return;}
1312  if (runno >= 400 && runno <= 499) {scale = 1.00106913; return;}
1313  if (runno >= 500 && runno <= 599) {scale = 1.00110941; return;}
1314  if (runno >= 600 && runno <= 699) {scale = 1.000897865; return;}
1315  if (runno >= 700 && runno <= 999) {scale = 1.00104385; return;}
1316  if (runno >= 1000 && runno <= 1299) {scale = 1.000876489; return;}
1317  if (runno >= 1000) {
1318  B2ERROR("scale_momenta not ready for this exp,run "
1319  << expno << "," << runno);
1320  }
1321  } else if (expno == 67) {
1322  if (runno >= 0 && runno <= 199) {scale = 1.000826364; return;}
1323  if (runno >= 200 && runno <= 299) {scale = 1.000836576; return;}
1324  if (runno >= 300 && runno <= 399) {scale = 1.000904815; return;}
1325  if (runno >= 400 && runno <= 499) {scale = 1.000966045; return;}
1326  if (runno >= 500 && runno <= 599) {scale = 1.000988147; return;}
1327  if (runno >= 600 && runno <= 699) {scale = 1.000988147; return;}
1328  if (runno >= 700 && runno <= 742) {scale = 1.000837414; return;}
1329  if (runno >= 1000 && runno <= 1099) {scale = 1.000984865; return;}
1330  if (runno >= 1100 && runno <= 1123) {scale = 1.00105248 ; return;}
1331  if (runno >= 1124) {
1332  B2ERROR("scale_momenta not ready for this exp,run "
1333  << expno << "," << runno);
1334  }
1335  } else if (expno == 69) {
1336  if (runno >= 0 && runno <= 99) {scale = 1.000791450; return;}
1337  if (runno >= 100 && runno <= 199) {scale = 1.000891748; return;}
1338  if (runno >= 200 && runno <= 299) {scale = 1.000866165; return;}
1339  if (runno >= 300 && runno <= 399) {scale = 1.000838834; return;}
1340  if (runno >= 400 && runno <= 499) {scale = 1.000811878; return;}
1341  if (runno >= 500 && runno <= 599) {scale = 1.000779810; return;}
1342  if (runno >= 600 && runno <= 699) {scale = 1.000799086; return;}
1343  if (runno >= 700 && runno <= 799) {scale = 1.000833797; return;}
1344  if (runno >= 800 && runno <= 899) {scale = 1.000875203; return;}
1345  if (runno >= 900 && runno <= 999) {scale = 1.000891998; return;}
1346  if (runno >= 1000 && runno <= 1099) {scale = 1.000921074; return;}
1347  if (runno >= 1100 && runno <= 1199) {scale = 1.000900829; return;}
1348  if (runno >= 1200 && runno <= 1299) {scale = 1.000958405; return;}
1349  if (runno >= 1300 && runno <= 1399) {scale = 1.000836841; return;}
1350  if (runno >= 1400) {
1351  B2ERROR("scale_momenta not ready for this exp,run "
1352  << expno << "," << runno);
1353  }
1354  } else if (expno == 71) {
1355  if (runno >= 0 && runno <= 99) {scale = 1.000962999; return;}
1356  if (runno >= 100 && runno <= 199) {scale = 1.001478932; return;}
1357  if (runno >= 200 && runno <= 300) {scale = 1.001486524; return;}
1358  if (runno >= 301 && runno <= 384) {scale = 1.001430843; return;}
1359  if (runno >= 385 && runno <= 499) {scale = 1.001505696; return;}
1360  if (runno >= 500 && runno <= 599) {scale = 1.001523980; return;}
1361  if (runno >= 600 && runno <= 699) {scale = 1.001480830; return;}
1362  if (runno >= 1000 && runno <= 1013) {scale = 1.001480830; return;}
1363  if (runno >= 2000 && runno <= 2099) {scale = 1.001617882; return;}
1364  if (runno >= 2100 && runno <= 2199) {scale = 1.001644395; return;}
1365  if (runno >= 2200 && runno <= 2299) {scale = 1.001722184; return;}
1366  if (runno >= 700 && runno <= 999) {
1367  B2ERROR("scale_momenta not ready for this exp,run "
1368  << expno << "," << runno);
1369  }
1370  if (runno >= 1014 && runno <= 1999) {
1371  B2ERROR("scale_momenta not ready for this exp,run "
1372  << expno << "," << runno);
1373  }
1374  if (runno >= 2299) {
1375  B2ERROR("scale_momenta not ready for this exp,run "
1376  << expno << "," << runno);
1377  }
1378  } else if (expno == 73) {
1379  if (runno >= 0 && runno <= 99) {scale = 1.000721587; return;}
1380  if (runno >= 100 && runno <= 199) {scale = 1.000707089; return;}
1381  if (runno >= 200 && runno <= 299) {scale = 1.000722517; return;}
1382  if (runno >= 300 && runno <= 399) {scale = 1.000722517; return;} //nodata
1383  if (runno >= 400 && runno <= 499) {scale = 1.000750776; return;}
1384  if (runno >= 500 && runno <= 599) {scale = 1.000729771; return;}
1385  if (runno >= 600 && runno <= 699) {scale = 1.000751190; return;}
1386  if (runno >= 700 && runno <= 799) {scale = 1.000702455; return;}
1387  if (runno >= 800 && runno <= 899) {scale = 1.000771074; return;}
1388  if (runno >= 900 && runno <= 999) {scale = 1.000868463; return;}
1389  if (runno >= 1000) {
1390  B2ERROR("scale_momenta not ready for this exp,run "
1391  << expno << "," << runno);
1392  }
1393 
1394  } else
1395  B2ERROR("scale_momenta mode=2 not ready for exp " << expno);
1396  }
1397  return;
1398  }
1399 
1400 //=====================================================================
1401 
1402 // Scale values are obtained from cosmic data.
1403 //
1404 // [EXP]
1405 // EXP15: 20011205_2146
1406 // EXP : 20010507_0455
1407 // EXP7 : 20000517_1555
1408 // EXP7 : 20001015_1102
1409 // EXP9 : 20001228_1026
1410 // [MC]
1411 // 20011214_0817
1412 // 20010523_0725
1413 // 20001228_1026
1414 // 20000911_2205
1415 // 20000517_1555
1416 // 20000430_1200
1417 
1418 // SE_REMOVE_BELLE_HEADER=1 is used for debug. --> normally 0!!!
1419 //#define SE_REMOVE_BELLE_HEADER 0
1420 
1421 
1422 
1424 // Begin of scale_error() implementation
1426 
1427  static int SE_Message_Level;
1428  static int SE_Reprocess_Version = 0;
1431  typedef void (*cal_scale_error_func_t)(double scale[5], const double pt, const double tanl);
1438  };
1439 
1442  {
1443  return (lhs.m_hadMC == rhs.m_hadMC) && (lhs.m_cosMC == rhs.m_cosMC) && (lhs.m_cosDATA == rhs.m_cosDATA);
1444  }
1445 
1446  /*static bool operator!=(const cal_scale_error_func_set_t& lhs, const cal_scale_error_func_set_t& rhs)
1447  {
1448  return !(lhs == rhs);
1449  }*/
1450 
1452  static void null_scale(double[5], double, double)
1453  {
1454  return;
1455  }
1456 
1457  /***** *****/
1458  /***** misc functions *****/
1459  /***** *****/
1461  static void
1462  get_event_id(int* no_exp, int* no_run, int* no_evt, int* no_frm, int* expmc)
1463  {
1464  *no_exp = -1, *no_run = -1, *no_evt = -1, *no_frm = -1;
1465 
1466  belle_event* belle_event;
1467  belle_event = (struct belle_event*)BsGetEnt(BELLE_EVENT, 1, BBS_No_Index);
1468  if (belle_event) {
1469  *no_exp = belle_event->m_ExpNo;
1470  *no_run = belle_event->m_RunNo;
1471  *no_evt = belle_event->m_EvtNo & 0x0fffffff;
1472  *no_frm = (unsigned int)belle_event->m_EvtNo >> 28;
1473  *expmc = belle_event->m_ExpMC;
1474  }
1475  }
1476 
1478  static bool
1480  {
1481  Belle::Mdst_event_add_Manager& addmgr = Belle::Mdst_event_add_Manager::get_manager();
1482  if (addmgr.count() >= 1) {
1483 
1484  if (addmgr[0].flag_error() == 1) {
1485  if (SE_Message_Level >= 1) B2ERROR("scale_error: already applied");
1486  return true;
1487  } else {
1488  if (SE_Message_Level >= 2) B2ERROR("scale_error: to be applied");
1489  addmgr[0].flag_error(1);
1490  return false;
1491  }
1492 
1493  } else {
1494 
1495  static int first = 1;
1496  B2ERROR("scale_error: no Mdst_event_add");
1497  if (first) {
1498  B2ERROR("scale_error: analysis continues");
1499  B2ERROR("scale_error: scale_error will not be applied");
1500  first = 0;
1501  }
1502  return true;
1503  }
1504  }
1505 
1506 
1507  /***** *****/
1508  /***** misc math functions *****/
1509  /***** *****/
1511  inline double
1512  vfunc(const double x, const double x1, const double yc, const double a1, const double a2)
1513  {
1514  return x < x1 ? (x - x1) * a1 + yc :
1515  (x - x1) * a2 + yc ;
1516  }
1518  inline double
1519  cupfunc(const double x, const double x1, const double x2, const double yc, const double a1, const double a2)
1520  {
1521  return x < x1 ? (x - x1) * a1 + yc :
1522  x > x2 ? (x - x2) * a2 + yc : yc;
1523  }
1525  inline double
1526  rootfunc(const double x, const double x1, const double x2, const double yc, const double a1, const double a2)
1527  {
1528  return x < x1 ? (x - x1) * a1 + yc :
1529  x > x2 ? (x2 - x1) * a2 + yc : (x - x1) * a2 + yc;
1530  }
1531 
1533  inline double
1534  lambdafunc(const double x, const double x1, const double x2, const double yc, const double a1, const double a2, const double a3)
1535  {
1536  return x < x1 ? (x - x1) * a1 + yc :
1537  x < x2 ? (x - x1) * a2 + yc : (x - x2) * a3 + (x2 - x1) * a2 + yc;
1538  }
1539 
1540 
1541 
1542  /***** *****/
1543  /***** scaling parameters for EXP07-EXP23 *****/
1544  /***** *****/
1545 
1546 //
1547 // Scale error for Exp.7-23 Cosmic MC
1548 // old day by somebody
1549 //
1551  static void
1552  cal_scale_error_EXP0723_cosmic_mc(double scale[5], const double pt, const double /*tanl*/)
1553  {
1554  // pt
1555  scale[0] = +1.0115E+00 - 3.6966E-02 * pt;
1556  scale[1] = +9.8369E-01 + 3.2783E-02 * pt;
1557  scale[2] = +6.8401E-01 + 1.0190E-01 * pt;
1558  scale[3] = +1.0968E+00 - 3.3011E-02 * pt;
1559  scale[4] = +1.0992E+00 - 2.7929E-02 * pt;
1560  }
1561 
1562 //
1563 // Scale error for Exp.25-27 Cosmic MC
1564 // old day by somebody
1565 //
1567  static void
1568  cal_scale_error_EXP2527_cosmic_mc(double scale[5], const double pt, const double /*tanl*/)
1569  {
1570  // pt
1571  scale[0] = +1.0257E+00 - 0.30671E-01 * pt;
1572  scale[1] = +1.0503E+00 + 0.97257E-02 * pt;
1573  scale[2] = +0.70751E+00 + 0.93039E-01 * pt;
1574  scale[3] = +1.0720E+00 - 0.15976E-01 * pt;
1575  scale[4] = +1.0530E+00 + 0.63696E-02 * pt;
1576  }
1577 
1578 //
1579 // Scale error for Exp.31 Cosmic MC
1580 // July 09th, 2004, by KUSAKA Akito
1581 //
1583  static void
1584  cal_scale_error_EXP31_cosmic_mc(double scale[5], double pt, double /*tanl*/)
1585  {
1586  // pt
1587  scale[0] = 1.0874 - 0.26640E-01 * pt;
1588  scale[1] = 1.0320 + 0.18869E-01 * pt;
1589  scale[2] = 0.75302 + 0.89109E-01 * pt;
1590  scale[3] = 1.1435 - 0.73830E-01 * pt;
1591  scale[4] = 1.1227 - 0.19112E-01 * pt;
1592  }
1593 
1594 //
1595 // Scale error for Exp.33 Cosmic MC for caseA
1596 // June 21th, 2004, by KUSAKA Akito
1597 // July 07th, 2004, modification on scale[3], by KUSAKA Akito
1598 //
1599 //
1600 // Scale error for Exp.35 Cosmic MC for caseB
1601 // February 3rd, 2010, by Takeo Higuchi
1602 //
1604  static void
1605  cal_scale_error_EXP33_cosmic_mc(double scale[5], double pt, double /*tanl*/)
1606  {
1607  if (SE_Reprocess_Version == 0) {
1608  // pt
1609  scale[0] = 1.1197 - 0.15104E-01 * pt;
1610  scale[1] = 1.0502 + 0.22138E-01 * pt;
1611  scale[2] = 0.75267 + 0.85377E-01 * pt;
1612  // Change to linear fit for robustness (Jul. 07th, 2004. KUSAKA Akito)
1613  // scale[3] = 1.3726 +(-0.31170 + 0.74074E-01*pt)*pt;
1614  scale[3] = 1.1608 - 0.43478E-01 * pt;
1615  scale[4] = 1.0936 + 0.18447E-01 * pt;
1616  } else {
1617  // pt
1618  scale[0] = 0.98971 - 0.12162E-01 * pt;
1619  scale[1] = 1.0132 + 0.22283E-01 * pt;
1620  scale[2] = 0.74947 + 0.81233E-01 * pt;
1621  scale[3] = 1.0601 - 0.54626E-01 * pt;
1622  scale[4] = 1.0454 - 0.33036E-02 * pt;
1623  }
1624  }
1625 
1626 //
1627 // Scale error for Exp.35 Cosmic MC for caseA
1628 // June 21th, 2004, by KUSAKA Akito
1629 //
1630 //
1631 // Scale error for Exp.35 Cosmic MC for caseB
1632 // February 3rd, 2010, by Takeo Higuchi
1633 //
1635  static void
1636  cal_scale_error_EXP35_cosmic_mc(double scale[5], double pt, double tanl)
1637  {
1638  if (SE_Reprocess_Version == 0) {
1639  // pt
1640  scale[0] = 1.0835 + 0.79781E-02 * pt;
1641  scale[1] = 1.0685 + 0.13339E-01 * pt;
1642  scale[2] = 0.72615 + 0.96936E-01 * pt;
1643  scale[3] = 1.1298 - 0.35734E-01 * pt;
1644  scale[4] = 1.0994 + 0.13150E-01 * pt;
1645  } else {
1646  // pt
1647  cal_scale_error_EXP33_cosmic_mc(scale, pt, tanl);
1648  }
1649  }
1650 
1651 //
1652 // Scale error for Exp.37 Cosmic MC
1653 // July 21st, 2004, by KUSAKA Akito
1654 //
1656  static void
1657  cal_scale_error_EXP37_cosmic_mc(double scale[5], double pt, double /*tanl*/)
1658  {
1659  // pt
1660  scale[0] = 1.0694 - 0.19048E-01 * pt;
1661  scale[1] = 1.0732 + 0.95531E-02 * pt;
1662  scale[2] = 0.74888 + 0.89957E-01 * pt;
1663  scale[3] = 1.1107 - 0.57216E-01 * pt;
1664  scale[4] = 1.1098 - 0.13305E-01 * pt;
1665  }
1666 
1667 //
1668 // Scale error for Exp.39,41 Cosmic MC
1669 // (Made from Exp.39 Cosmic MC. Confirmed for exp39,41)
1670 // April, 20th, 2005, by KUSAKA Akito
1671 //
1673  static void
1674  cal_scale_error_EXP3941_cosmic_mc(double scale[5], double pt, double /*tanl*/)
1675  {
1676  // pt
1677  scale[0] = 1.055465 - 0.2863498E-01 * pt;
1678  scale[1] = 1.005986 + 0.2709512E-01 * pt;
1679  scale[2] = 0.7459061 + 0.8352030E-01 * pt;
1680  scale[3] = 1.056039 - 0.6258768E-01 * pt;
1681  scale[4] = 1.043329 - 0.2975207E-03 * pt;
1682  }
1683 
1684 //
1685 // Scale error for Exp.43 Cosmic MC
1686 // Sep., 12th, 2005, by KUSAKA Akito
1687 //
1689  static void
1690  cal_scale_error_EXP43_cosmic_mc(double scale[5], double pt, double /*tanl*/)
1691  {
1692  // pt
1693  scale[0] = 1.013759 - 0.8743831E-02 * pt;
1694  scale[1] = 1.071626 - 0.1333353E-01 * pt;
1695  scale[2] = 0.7507483 + 0.8399138E-01 * pt;
1696  scale[3] = 1.054345 - 0.5644758E-01 * pt;
1697  scale[4] = 1.020721 + 0.1323117E-01 * pt;
1698  }
1699 
1700 //
1701 // Scale error for Exp.45 Cosmic MC
1702 // May., 27th, 2006, by fmiyuki
1703 //
1705  static void
1706  cal_scale_error_EXP45_cosmic_mc(double scale[5], double pt, double /*tanl*/)
1707  {
1708  // pt
1709  scale[0] = 1.011008 - 0.2272887E-01 * pt;
1710  scale[1] = 1.030603 + 0.8892579E-02 * pt;
1711  scale[2] = 0.7181793 + 0.9717058E-01 * pt;
1712  scale[3] = 1.065804 - 0.6852337E-01 * pt;
1713  scale[4] = 1.085136 - 0.2324515E-01 * pt;
1714  }
1715 
1716 //
1717 // Scale error for Exp.47 Cosmic MC
1718 // May., 27th, 2006, by fmiyuki
1719 //
1721  static void
1722  cal_scale_error_EXP47_cosmic_mc(double scale[5], double pt, double /*tanl*/)
1723  {
1724  // pt
1725  scale[0] = 0.9806778 - 0.2010826E-02 * pt;
1726  scale[1] = 0.9996797 + 0.2633917E-01 * pt;
1727  scale[2] = 0.7450445 + 0.7637244E-01 * pt;
1728  scale[3] = 1.084419 - 0.6828102E-01 * pt;
1729  scale[4] = 1.013550 + 0.1201861E-01 * pt;
1730  }
1731 
1732 //
1733 // Scale error for Exp.49 Cosmic MC
1734 // May., 27th, 2006, by fmiyuki
1735 //
1737  static void
1738  cal_scale_error_EXP49_cosmic_mc(double scale[5], double pt, double /*tanl*/)
1739  {
1740  // pt
1741  scale[0] = 1.000635 - 0.1659129E-01 * pt;
1742  scale[1] = 1.046513 - 0.2994663E-02 * pt;
1743  scale[2] = 0.7241409 + 0.9558808E-01 * pt;
1744  scale[3] = 1.062597 - 0.6663921E-01 * pt;
1745  scale[4] = 1.076486 - 0.2023062E-01 * pt;
1746  }
1747 
1748 //
1749 // Scale error for Exp.51 Cosmic MC
1750 // May 24th, 2007 by higuchit
1751 //
1753  static void
1754  cal_scale_error_EXP51_cosmic_mc(double scale[5], double pt, double /*tanl*/)
1755  {
1756  // pt
1757  scale[0] = 0.98242 - 0.71780E-02 * pt;
1758  scale[1] = 1.0465 + 0.44401E-03 * pt;
1759  scale[2] = 0.71433 + 0.10176 * pt;
1760  scale[3] = 1.0875 - 0.80972E-01 * pt;
1761  scale[4] = 1.0777 - 0.20428E-01 * pt;
1762  }
1763 
1764 //
1765 // Scale error for Exp.53 Cosmic MC
1766 // May 24th, 2007 by higuchit
1767 //
1769  static void
1770  cal_scale_error_EXP53_cosmic_mc(double scale[5], double pt, double /*tanl*/)
1771  {
1772  // pt
1773  scale[0] = 0.99832 - 0.17290E-01 * pt;
1774  scale[1] = 1.0434 + 0.47995E-02 * pt;
1775  scale[2] = 0.72111 + 0.10093 * pt;
1776  scale[3] = 1.1022 - 0.87951E-01 * pt;
1777  scale[4] = 1.0643 - 0.11962E-01 * pt;
1778  }
1779 
1780 //
1781 // Scale error for Exp.55 Cosmic MC
1782 // June 21st, 2007 by higuchit
1783 //
1785  static void
1786  cal_scale_error_EXP55_cosmic_mc(double scale[5], double pt, double /*tanl*/)
1787  {
1788  // pt
1789  scale[0] = 0.98871 - 0.88399E-02 * pt;
1790  scale[1] = 1.0159 + 0.16468E-01 * pt;
1791  scale[2] = 0.72813 + 0.94737E-01 * pt;
1792  scale[3] = 1.1060 - 0.88323E-01 * pt;
1793  scale[4] = 1.0914 - 0.30607E-01 * pt;
1794  }
1795 
1796 //
1797 // Scale error for Exp.61-65 Cosmic MC
1798 // March 4th, 2009 by higuchit
1799 //
1801  static void
1802  cal_scale_error_EXP6165_cosmic_mc(double scale[5], double pt, double tanl)
1803  {
1804  // pt
1805  scale[0] = 0.97322 - 0.29003E-02 * pt;
1806  scale[1] = 0.94704 + 0.44719E-01 * pt;
1807  scale[2] = 0.73547 + 0.98431E-01 * pt;
1808  scale[3] = 1.0752 - 0.77818E-01 * pt;
1809  scale[4] = 1.0759 - 0.27057E-01 * pt;
1810 
1811  // tanl
1812  scale[0] *= 0.99600 - 0.97573E-02 * tanl;
1813  scale[1] *= 1.0080 - 0.37122E-01 * tanl;
1814  scale[2] *= 0.99150 - 0.13390E-01 * tanl;
1815  scale[3] *= 0.99758 - 0.43508E-01 * tanl;
1816  scale[4] *= 0.99913 + 0.34211E-01 * tanl;
1817  }
1818 
1819 //
1820 // Scale error for Exp.67 Cosmic MC
1821 // October 8th, 2009 by higuchit
1822 //
1824  static void
1825  cal_scale_error_EXP67_cosmic_mc(double scale[5], double pt, double tanl)
1826  {
1827  // pt
1828  scale[0] = 0.99845 - 0.18739E-01 * pt;
1829  scale[1] = 1.0024 + 0.17833E-01 * pt;
1830  scale[2] = 0.72369 + 0.96994E-01 * pt;
1831  scale[3] = 1.0605 - 0.64072E-01 * pt;
1832  scale[4] = 1.0623 - 0.14320E-01 * pt;
1833 
1834  // tanl
1835  scale[0] *= 0.99597 - 0.13069E-01 * tanl;
1836  scale[1] *= 1.0072 - 0.18622E-01 * tanl;
1837  scale[2] *= 0.99515 - 0.16591E-01 * tanl;
1838  scale[3] *= 0.99466 - 0.14489E-02 * tanl;
1839  scale[4] *= 1.0036 - 0.15095E-01 * tanl;
1840  }
1841 
1842 
1843 //
1844 // Scale error for Exp.69 Cosmic MC
1845 // January 29th, 2010 by higuchit
1846 // Scale error for Exp.71 Cosmic MC
1847 // May 12th, 2010 by higuchit
1848 //
1850  static void
1851  cal_scale_error_EXP6971_cosmic_mc(double scale[5], double pt, double tanl)
1852  {
1853  // pt
1854  scale[0] = 0.96783 - 0.37174E-02 * pt;
1855  scale[1] = 0.97888 + 0.34689E-01 * pt;
1856  scale[2] = 0.80870 + 0.68302E-01 * pt;
1857  scale[3] = 1.0615 - 0.60750E-01 * pt;
1858  scale[4] = 1.0372 - 0.52332E-03 * pt;
1859 
1860  // tanl
1861  scale[0] *= 0.99897 + 0.62207E-02 * tanl;
1862  scale[1] *= 1.0037 + 0.10714E-01 * tanl;
1863  scale[2] *= 0.99129 - 0.92521E-02 * tanl;
1864  scale[3] *= 0.99483 - 0.43402E-02 * tanl;
1865  scale[4] *= 1.0062 + 0.15306E-01 * tanl;
1866  }
1867 
1868 
1869 //
1870 // Scale error for Exp.7-23 Cosmic data
1871 // old day by somebody
1872 //
1874  static void
1875  cal_scale_error_EXP0723_cosmic_data(double scale[5], const double pt, const double /*tanl*/)
1876  {
1877  // pt
1878  scale[0] = +1.1280E+00 - 7.6839E-03 * pt;
1879  scale[1] = +1.1368E+00 + 2.8106E-02 * pt;
1880  scale[2] = +7.6448E-01 + 1.1248E-01 * pt;
1881  scale[3] = +1.1396E+00 - 3.6738E-02 * pt;
1882  scale[4] = +1.1766E+00 - 2.7477E-02 * pt;
1883  }
1884 
1885 //
1886 // Scale error for Exp.25-27 Cosmic data
1887 // old day by somebody
1888 //
1890  static void
1891  cal_scale_error_EXP2527_cosmic_data(double scale[5], const double pt, const double /*tanl*/)
1892  {
1893  // pt
1894  scale[0] = +1.1002E+00 + 3.9852E-02 * pt;
1895  scale[1] = rootfunc(pt, 1.0015, 1.6591, 1.0420, -0.31809, 0.17149);
1896  scale[2] = +8.4706E-01 + 0.8914E-01 * pt;
1897  scale[3] = +1.1067E+00 + 1.0304E-02 * pt;
1898  scale[4] = +1.0495E+00 + 3.9923E-02 * pt;
1899  }
1900 
1901 //
1902 // Scale error for Exp.31 Cosmic data
1903 // July 9th, 2004, by KUSAKA Akito
1904 //
1906  static void
1907  cal_scale_error_EXP31_cosmic_data(double scale[5], double pt, double /*tanl*/)
1908  {
1909  // pt
1910  scale[0] = 1.1908 + 0.20678E-02 * pt;
1911  scale[1] = 1.0304 + 0.54826E-01 * pt;
1912  scale[2] = 1.0806 + 0.33829E-01 * pt;
1913  scale[3] = 1.1325 - 0.34811E-01 * pt;
1914  scale[4] = 1.1549 - 0.20974E-01 * pt;
1915  }
1916 
1917 //
1918 // Scale error for Exp.33 Cosmic data for caseA
1919 // June 21th, 2004, by KUSAKA Akito
1920 //
1921 //
1922 // Scale error for Exp.35 Cosmic data for caseB
1923 // February 3rd, 2010, by Takeo Higuchi
1924 //
1926  static void
1927  cal_scale_error_EXP33_cosmic_data(double scale[5], double pt, double /*tanl*/)
1928  {
1929  if (SE_Reprocess_Version == 0) {
1930  // pt
1931  scale[0] = 1.2175 + 0.14290E-01 * pt;
1932  scale[1] = 1.0362 + 0.80614E-01 * pt;
1933  scale[2] = 1.0313 + 0.12930E-01 * pt;
1934  scale[3] = 1.0411 + 0.17319E-01 * pt;
1935  scale[4] = 1.0445 + 0.27526E-01 * pt;
1936  } else {
1937  // pt
1938  scale[0] = 1.2712 - 0.42098E-01 * pt;
1939  scale[1] = 1.0634 - 0.13652E-01 * pt;
1940  scale[2] = 0.95435 + 0.64895E-01 * pt;
1941  scale[3] = 1.0758 + 0.10778E-01 * pt;
1942  scale[4] = 1.0892 - 0.75700E-02 * pt;
1943  }
1944  }
1945 
1946 //
1947 // Scale error for Exp.35 Cosmic data for caseA
1948 // June 21th, 2004, by KUSAKA Akito
1949 // July 07th, 2004, modification on scale[3], by KUSAKA Akito
1950 //
1951 //
1952 // Scale error for Exp.35 Cosmic data for caseB
1953 // February 3rd, 2010, by Takeo Higuchi
1954 //
1956  static void
1957  cal_scale_error_EXP35_cosmic_data(double scale[5], double pt, double tanl)
1958  {
1959  if (SE_Reprocess_Version == 0) {
1960  // pt
1961  scale[0] = 1.1084 + 0.45825E-01 * pt;
1962  scale[1] = 1.1014 + 0.14211E-01 * pt;
1963  scale[2] = 0.99716 + 0.52509E-01 * pt;
1964  scale[3] = 1.1361 - 0.25355E-01 * pt;
1965  scale[4] = 1.1079 - 0.92563E-02 * pt;
1966  } else {
1967  cal_scale_error_EXP33_cosmic_data(scale, pt, tanl);
1968  }
1969  }
1970 
1971 //
1972 // Scale error for Exp.37 Cosmic data
1973 // July 21st, 2004, by KUSAKA Akito
1974 //
1976  static void
1977  cal_scale_error_EXP37_cosmic_data(double scale[5], double pt, double /*tanl*/)
1978  {
1979  // pt
1980  scale[0] = 1.2129 + 0.36787E-01 * pt;
1981  scale[1] = 1.0750 + 0.32722E-01 * pt;
1982  scale[2] = 0.98340 + 0.39096E-01 * pt;
1983  scale[3] = 1.1768 - 0.43894E-01 * pt;
1984  scale[4] = 1.1275 - 0.12562E-02 * pt;
1985  }
1986 
1987 //
1988 // Scale error for Exp.39,41 Cosmic data
1989 // April 20th, 2004, by KUSAKA Akito
1990 //
1992  static void
1993  cal_scale_error_EXP3941_cosmic_data(double scale[5], double pt, double /*tanl*/)
1994  {
1995  // pt
1996  scale[0] = 1.182285 + 0.4142677E-01 * pt;
1997  scale[1] = 1.090022 + 0.2995044E-01 * pt;
1998  scale[2] = 0.9581690 + 0.5764173E-01 * pt;
1999  scale[3] = 1.119173 - 0.2177483E-01 * pt;
2000  scale[4] = 1.126323 - 0.3786523E-02 * pt;
2001  }
2002 
2003 //
2004 // Scale error for Exp.43 Cosmic data
2005 // Sep., 12th, 2005 by KUSAKA Akito
2006 //
2008  static void
2009  cal_scale_error_EXP43_cosmic_data(double scale[5], double pt, double /*tanl*/)
2010  {
2011  // pt
2012  scale[0] = 1.262359 + 0.1411302E-01 * pt;
2013  scale[1] = 1.051793 + 0.6225422E-01 * pt;
2014  scale[2] = 0.9668697 + 0.5492099E-01 * pt;
2015  scale[3] = 1.110838 - 0.2386986E-01 * pt;
2016  scale[4] = 1.106516 + 0.1239970E-01 * pt;
2017  }
2018 
2019 //
2020 // Scale error for Exp.45+47 Cosmic data
2021 // May., 29th, 2006 by fmiyuki
2022 //
2024  static void
2025  cal_scale_error_EXP4547_cosmic_data(double scale[5], double pt, double /*tanl*/)
2026  {
2027  // pt 8bin
2028  scale[0] = 1.164526 + 0.7671143E-01 * pt;
2029  scale[1] = 1.094987 + 0.2949413E-01 * pt;
2030  scale[2] = 1.084826 + 0.2513991E-01 * pt;
2031  scale[3] = 1.099221 - 0.2389658E-02 * pt;
2032  scale[4] = 1.146892 + 0.2682884E-02 * pt;
2033  }
2034 
2035 //
2036 // Scale error for Exp.49 Cosmic data
2037 // May., 27th, 2006 by fmiyuki
2038 //
2040  static void
2041  cal_scale_error_EXP49_cosmic_data(double scale[5], double pt, double /*tanl*/)
2042  {
2043  // pt 8bin
2044  scale[0] = 1.243211 + 0.5776083E-01 * pt;
2045  scale[1] = 1.209483 - 0.3366023E-01 * pt;
2046  scale[2] = 1.059087 + 0.4300838E-01 * pt;
2047  scale[3] = 1.123665 + 0.6342933E-02 * pt;
2048  scale[4] = 1.208850 - 0.3171053E-01 * pt;
2049  }
2050 
2051 //
2052 // Scale error for Exp.51 Cosmic data
2053 // May 24th, 2007 by higuchit
2054 //
2056  static void
2057  cal_scale_error_EXP51_cosmic_data(double scale[5], double pt, double tanl)
2058  {
2059  // pt 5bin
2060  scale[0] = 1.2097 + 0.36177E-01 * pt;
2061  scale[1] = 1.2218 - 0.84772E-02 * pt;
2062  scale[2] = 0.97937 + 0.26397E-01 * pt;
2063  scale[3] = 1.0944 - 0.12745E-02 * pt;
2064  scale[4] = 1.2140 - 0.56809E-01 * pt;
2065 
2066  // tanl
2067  scale[0] *= 1.0492 + 0.72972E-01 * tanl;
2068  scale[1] *= 1.0298 + 0.40625E-02 * tanl;
2069  scale[2] *= 0.93367 + 0.11969E-01 * tanl;
2070  scale[3] *= 1.0170 + 0.41039E-01 * tanl;
2071  scale[4] *= 1.0677 - 0.41684E-01 * tanl;
2072  }
2073 
2074 //
2075 // Scale error for Exp.53 Cosmic data
2076 // May 24th, 2007 by higuchit
2077 //
2079  static void
2080  cal_scale_error_EXP53_cosmic_data(double scale[5], double pt, double /*tanl*/)
2081  {
2082  // pt 5bin
2083  scale[0] = 1.2587 + 0.32782E-01 * pt;
2084  scale[1] = 1.2413 - 0.36535E-01 * pt;
2085  scale[2] = 0.97465 + 0.22937E-01 * pt;
2086  scale[3] = 1.1197 - 0.59050E-02 * pt;
2087  scale[4] = 1.1877 - 0.32893E-01 * pt;
2088  }
2089 
2090 //
2091 // Scale error for Exp.55 Cosmic data
2092 // June 21st, 2007 by higuchit
2093 //
2095  static void
2096  cal_scale_error_EXP55_cosmic_data(double scale[5], double pt, double tanl)
2097  {
2098  // pt 5bin
2099  scale[0] = 1.2654 + 0.15660E-01 * pt;
2100  scale[1] = 1.0278 + 0.81680E-01 * pt;
2101  scale[2] = 0.94291 + 0.54575E-01 * pt;
2102  scale[3] = 1.1151 - 0.52387E-02 * pt;
2103  scale[4] = 1.1020 + 0.10518E-01 * pt;
2104 
2105  // tanl 5bin
2106  scale[0] *= 1.0334 + 0.10236E-01 * tanl;
2107  scale[1] *= 1.0346 + 0.11024E-01 * tanl;
2108  // scale[2] *= 0.91773 -0.52276E-02*tanl;
2109  scale[3] *= 1.0140 + 0.19030E-01 * tanl;
2110  scale[4] *= 1.0345 - 0.90291E-01 * tanl;
2111  }
2112 
2113 //
2114 // Scale error for Exp.61-65 Cosmic data
2115 // March 4th, 2009 by higuchit
2116 //
2118  static void
2119  cal_scale_error_EXP6165_cosmic_data(double scale[5], double pt, double tanl)
2120  {
2121  // pt 5bin
2122  scale[0] = 1.1184 + 0.55671E-01 * pt;
2123  scale[1] = 1.1142 + 0.74526E-02 * pt;
2124  scale[2] = 0.93626 + 0.66670E-01 * pt;
2125  scale[3] = 1.1003 - 0.11587E-01 * pt;
2126  scale[4] = 1.1589 - 0.40223E-01 * pt;
2127 
2128  // tanl 5bin
2129  scale[0] *= 1.0442 - 0.46775E-01 * tanl;
2130  scale[1] *= 1.0337 + 0.44071E-01 * tanl;
2131  // scale[2] *= 0.91898 -0.28268E-02*tanl;
2132  scale[3] *= 1.0037 + 0.29736E-01 * tanl;
2133  scale[4] *= 1.0378 - 0.73239E-01 * tanl;
2134  }
2135 
2136 //
2137 // Scale error for Exp.67 Cosmic data
2138 // October 8th, 2009 by higuchit
2139 //
2141  static void
2142  cal_scale_error_EXP67_cosmic_data(double scale[5], double pt, double tanl)
2143  {
2144  // pt 5bin
2145  scale[0] = 1.1598 + 0.28880E-01 * pt;
2146  scale[1] = 1.0844 + 0.23384E-01 * pt;
2147  scale[2] = 0.94566 + 0.53157E-01 * pt;
2148  scale[3] = 1.1578 - 0.31156E-01 * pt;
2149  scale[4] = 1.0725 + 0.13714E-01 * pt;
2150 
2151  // tanl 5bin
2152  scale[0] *= 1.0223 - 0.56165E-02 * tanl;
2153  scale[1] *= 1.0203 - 0.81857E-02 * tanl;
2154  // scale[2] *= 0.90812 +0.15679E-01*tanl;
2155  scale[3] *= 0.99703 + 0.14976E-01 * tanl;
2156  scale[4] *= 1.0212 + 0.41300E-01 * tanl;
2157  }
2158 
2159 
2160 //
2161 // Scale error for Exp.69 Cosmic data
2162 // January 29th, 2010 by higuchit
2163 // Scale error for Exp.71 Cosmic data
2164 // May 12th, 2010 by higuchit
2165 //
2167  static void
2168  cal_scale_error_EXP6971_cosmic_data(double scale[5], double pt, double tanl)
2169  {
2170  // pt 5bin
2171  scale[0] = 1.2101 + 0.29496E-01 * pt;
2172  scale[1] = 1.0723 + 0.13773E-01 * pt;
2173  scale[2] = 0.90988 + 0.78667E-01 * pt;
2174  scale[3] = 1.1444 - 0.20780E-01 * pt;
2175  scale[4] = 1.0962 + 0.83309E-02 * pt;
2176 
2177  // tanl 5bin
2178  scale[0] *= 1.0207 - 0.17810E-01 * tanl;
2179  scale[1] *= 1.0272 + 0.61498E-01 * tanl;
2180  // scale[2] *= 0.91584 +0.16138E-01*tanl;
2181  scale[3] *= 0.99766 + 0.32434E-01 * tanl;
2182  scale[4] *= 1.0200 - 0.14935E-01 * tanl;
2183  }
2184 
2185 
2186 //
2187 // Scale error for Exp.7-23 Hadron MC
2188 // old day by somebody
2189 //
2191  static void
2192  cal_scale_error_EXP0723_hadronic_mc(double scale[5], const double pt, const double tanl)
2193  {
2194  // pt
2195  scale[0] = vfunc(pt, 0.34602, 1.0605, -0.36011, 0.38189E-01);
2196  scale[1] = 1.0612;
2197  scale[2] = cupfunc(pt, 0.44599, 1.2989, 0.85646, -0.73968, 0.17425);
2198  scale[3] = 1.1460 - 0.57101E-01 * pt;
2199  scale[4] = 1.0859;
2200 
2201  // tanl
2202  scale[0] *= +1.0122E+00 + 1.3568E-04 * tanl + 1.9856E-02 * tanl * tanl;
2203  scale[1] *= +1.0002E+00 - 4.5128E-03 * tanl + 1.6211E-02 * tanl * tanl;
2204  scale[2] *= +9.7051E-01 + 2.6876E-02 * tanl + 8.2365E-02 * tanl * tanl;
2205  scale[3] *= +9.7198E-01 + 3.8373E-02 * tanl + 4.9111E-02 * tanl * tanl;
2206  scale[4] *= +9.8880E-01 + 2.2090E-02 * tanl + 2.2701E-02 * tanl * tanl;
2207  }
2208 
2209 //
2210 // Scale error for Exp.25-27 Hadron MC
2211 // old day by somebody
2212 //
2214  static void
2215  cal_scale_error_EXP2527_hadronic_mc(double scale[5], const double pt, const double tanl)
2216  {
2217  // pt
2218  scale[0] = 1.092E+00 - 0.86138E-01 * pt;
2219  scale[1] = 1.0448E+00 - 0.26158E-01 * pt;
2220  scale[2] = 1.1942E+00 - 1.0025E+00 * pt + 0.85334 * pt * pt - 0.20305 * pt * pt * pt;
2221  scale[3] = 1.1260E+00 - 0.46048E-01 * pt;
2222  scale[4] = 1.0378E+00 + 0.5109E-01 * pt;
2223 
2224  // tanl
2225  scale[0] *= +1.0136E+00 + 0.15293E-01 * tanl;
2226  scale[1] *= +0.9936E+00 + 0.71983E-02 * tanl + 0.14004E-01 * tanl * tanl;
2227  scale[2] *= +0.97532E+00 + 0.22718E-01 * tanl + 0.73556E-01 * tanl * tanl;
2228  scale[3] *= vfunc(tanl, -0.26650, 0.92765, -0.13393, 0.11704);
2229  scale[4] *= +0.98203E+00 + 0.21612E-01 * tanl + 0.32751E-01 * tanl * tanl;
2230  }
2231 
2232 //
2233 // Scale error for Exp.31 Hadron MC
2234 // July 9th, 2004, by KUSAKA Akito
2235 //
2237  static void
2238  cal_scale_error_EXP31_hadronic_mc(double scale[5], double pt, double tanl)
2239  {
2240  // pt
2241  scale[0] = 1.2619 - 0.11170 * pt;
2242  scale[1] = 1.2263 - 0.24619E-01 * pt;
2243  scale[2] = vfunc(pt, 1.1432, 0.87555, -0.24211, 0.10876);
2244  scale[3] = 1.3254 - 0.21162 * pt;
2245  scale[4] = 1.1609 + 0.73808E-02 * pt;
2246 
2247  // tanl
2248  scale[3] *= vfunc(tanl, -0.12026, 0.95892, -0.71461E-01, 0.69535E-01);
2249  }
2250 
2251 //
2252 // Scale error for Exp.33, 35 Hadron MC
2253 // June 19th, 2004, by KUSAKA Akito
2254 // July 09th, 2004, modification on scale[2](pt) for low pt.
2255 // July 09th, 2004, modification on scale[3](tanl) for high tanl.
2256 //
2258  static void
2259  cal_scale_error_EXP33_hadronic_mc(double scale[5], double pt, double tanl)
2260  {
2261  if (SE_Reprocess_Version == 0) {
2262  // pt
2263  scale[0] = 1.3083 - 0.10894 * pt;
2264  scale[1] = 1.2471 - 0.30959E-01 * pt;
2265  // scale[2] = 0.94594 -0.21216E-01*pt;
2266  scale[2] = vfunc(pt, 0.79736, 0.90954, -0.45673, 0.37072E-02);
2267  scale[3] = 1.3307 - 0.17559 * pt;
2268  scale[4] = 1.2408 - 0.29914E-01 * pt;
2269 
2270  // tanl
2271  // scale[3] *= 0.95593 + (0.39351E-01 + 0.10450*tanl)*tanl;
2272  scale[3] *= vfunc(tanl, -0.63864E-01, 0.95936, -0.11035, 0.10057);
2273  } else {
2274  // pt
2275  scale[0] = vfunc(pt, 1.4506, 1.0599, -0.10534, -0.14118);
2276  scale[1] = lambdafunc(pt, 0.23691, 0.47860, 1.1996, -0.39938E-01, 0.23518, -0.62661E-01);
2277  scale[2] = lambdafunc(pt, 0.45865, 0.92603, 0.95622, -0.51715, -0.12868, 0.45187E-01);
2278  scale[3] = 1.2555 - 0.19038 * pt;
2279  scale[4] = vfunc(pt, 0.68946, 1.1772, 0.15927, -0.79017E-01);
2280  }
2281  }
2282 
2283 //
2284 // Scale error for Exp.35 Hadron MC
2285 // February 3rd, 2010, by Takeo Higuchi for caseB
2286 //
2288  static void
2289  cal_scale_error_EXP35_hadronic_mc(double scale[5], double pt, double tanl)
2290  {
2291  cal_scale_error_EXP33_hadronic_mc(scale, pt, tanl);
2292  }
2293 
2294 //
2295 // Scale error for Exp.37 Hadron MC
2296 // July 21st, 2004, by KUSAKA Akito
2297 //
2299  static void
2300  cal_scale_error_EXP37_hadronic_mc(double scale[5], double pt, double tanl)
2301  {
2302  // pt
2303  scale[0] = 1.2548 - 0.87786E-01 * pt;
2304  scale[1] = 1.2562 - 0.89296E-03 * pt;
2305  scale[2] = vfunc(pt, 0.67905, 0.91705, -0.57837, -0.37276E-02);
2306  scale[3] = 1.3180 - 0.19459 * pt;
2307  scale[4] = 1.1652 + 0.33812E-01 * pt;
2308 
2309  // tanl
2310  scale[3] *= vfunc(tanl, -0.47522E-01, 0.96537, -0.41720E-01, 0.68031E-01);
2311  }
2312 
2313 //
2314 // Scale error for Exp.39,41 Hadron MC
2315 // (Made from Exp.39 Hadron MC. Confirmed for exp39,41)
2316 // April 20th, by KUSAKA Akito
2317 //
2319  static void
2320  cal_scale_error_EXP3941_hadronic_mc(double scale[5], double pt, double /*tanl*/)
2321  {
2322  // pt
2323  scale[0] = 1.236096 - 0.1015809 * pt;
2324  scale[1] = 1.248921 - 0.1130577E-01 * pt;
2325  scale[2] = vfunc(pt, 0.5129282, 0.9300365, -0.9450958, -0.1157168E-01);
2326  scale[3] = vfunc(pt, 1.650362, 0.9371865, -0.2142342, 0.7384746E-01);
2327  scale[4] = vfunc(pt, 0.7497343, 1.204451, 0.1333454, -0.7826934E-01);
2328  }
2329 
2330 //
2331 // Scale error for Exp.43 Hadron MC
2332 // Sep. 12th, 2005 by KUSAKA Akito
2333 //
2335  static void
2336  cal_scale_error_EXP43_hadronic_mc(double scale[5], double pt, double /*tanl*/)
2337  {
2338  // pt
2339  scale[0] = 1.240166 - 0.1051634 * pt;
2340  scale[1] = 1.257180 - 0.3122512E-01 * pt;
2341  scale[2] = vfunc(pt, 0.5272015, 0.9386514, -0.9648152, -0.1623573E-01);
2342  scale[3] = 1.280515 - 0.1991213 * pt;
2343  scale[4] = vfunc(pt, 0.6579201, 1.192409, 0.1197880, -0.5404800E-01);
2344  }
2345 
2346 //
2347 // Scale error for Exp.45 Hadron MC
2348 // May. 27th, 2006 by fmiyuki
2349 //
2351  static void
2352  cal_scale_error_EXP45_hadronic_mc(double scale[5], double pt, double tanl)
2353  {
2354  // pt
2355  scale[0] = 1.213823 - .1029683 * pt;
2356  scale[1] = 1.239279 - .3706657E-01 * pt;
2357  scale[2] = vfunc(pt, 0.6145123 , 0.8834459 , -.4620622 , 0.2099150E-01);
2358  scale[3] = 1.253126 - .1884352 * pt;
2359  scale[4] = vfunc(pt, 0.4928604 , 1.169158 , 0.2063893 , -.5428730E-01);
2360 
2361  // tanl
2362  scale[2] *= vfunc(tanl, -.1240821 , 0.9274375 , -.8750933E-01 , 0.8611448E-01);
2363  }
2364 
2365 //
2366 // Scale error for Exp.47 Hadron MC
2367 // May. 27th, 2006 by fmiyuki
2368 //
2370  static void
2371  cal_scale_error_EXP47_hadronic_mc(double scale[5], double pt, double /*tanl*/)
2372  {
2373  // pt
2374  scale[0] = 1.218633 - .1078999 * pt;
2375  scale[1] = 1.237288 - .2890434E-01 * pt;
2376  scale[2] = vfunc(pt, 0.4334312 , 0.9027213 , -.7119852 , 0.1031877E-01);
2377  scale[3] = 1.252394 - .1835607 * pt;
2378  scale[4] = vfunc(pt, 0.6194937 , 1.168190 , 0.1285120 , -.5815693E-01);
2379  }
2380 
2381 //
2382 // Scale error for Exp.49 Hadron MC
2383 // May. 27th, 2006 by fmiyuki
2384 //
2386  static void
2387  cal_scale_error_EXP49_hadronic_mc(double scale[5], double pt, double /*tanl*/)
2388  {
2389  // pt
2390  scale[0] = 1.217751 - .1075724 * pt;
2391  scale[1] = 1.233774 - .3122749E-01 * pt;
2392  scale[2] = vfunc(pt, 0.5276512 , 0.8852152 , -.7025786 , 0.3136450E-01);
2393  scale[3] = 1.258038 - .1949899 * pt;
2394  scale[4] = vfunc(pt, 0.5924365 , 1.162905 , 0.9632715E-01, -.6221822E-01);
2395 
2396  }
2397 
2398 //
2399 // Scale error for Exp.51 Hadron MC
2400 // May 24th, 2007 by higuchit
2401 //
2403  static void
2404  cal_scale_error_EXP51_hadronic_mc(double scale[5], double pt, double tanl)
2405  {
2406  // pt
2407  scale[0] = vfunc(pt, 0.35776, 1.1919, 0.84229E-01, -0.88550E-01);
2408  scale[1] = vfunc(pt, 0.37833, 1.2394, 0.34089, -0.54440E-01);
2409  scale[2] = lambdafunc(pt, 0.87688, 1.4065, 0.86733, -0.23657, 0.21714E-01, 0.20876);
2410  scale[3] = lambdafunc(pt, 0.39825, 1.0950, 1.2104, 0.11718E-01, -0.21145, -0.89681E-01);
2411  scale[4] = vfunc(pt, 0.48051, 1.1672, 0.19241, -0.32273E-01);
2412 
2413  // tanl
2414  scale[2] *= vfunc(tanl, -0.40697, 0.92948, -0.29453, 0.59416E-01);
2415  }
2416 
2417 //
2418 // Scale error for Exp.53 Hadron MC
2419 // May 24th, 2007 by higuchit
2420 //
2422  static void
2423  cal_scale_error_EXP53_hadronic_mc(double scale[5], double pt, double /*tanl*/)
2424  {
2425  // pt
2426  scale[0] = lambdafunc(pt, 0.50681, 1.2150, 1.2266, 0.99662E-01, -0.23508, -0.52268E-01);
2427  scale[1] = lambdafunc(pt, 0.50787, 1.2308, 1.3108, 0.42334, -0.25502, -0.13522E-01);
2428  scale[2] = vfunc(pt, 1.2149, 0.88700, -0.15323, 0.97993E-01);
2429  scale[3] = lambdafunc(pt, 0.45595, 1.1561, 1.2383, 0.17605, -0.34753, -0.97049E-01);
2430  scale[4] = vfunc(pt, 0.55269, 1.2261, 0.39706, -0.12333);
2431  }
2432 
2433 //
2434 // Scale error for Exp.55 Hadron MC
2435 // June 21st, 2007 by higuchit
2436 //
2438  static void
2439  cal_scale_error_EXP55_hadronic_mc(double scale[5], double pt, double /*tanl*/)
2440  {
2441  // pt
2442  scale[0] = vfunc(pt, 0.34925, 1.1780, 0.89069E-01, -0.10090);
2443  scale[1] = vfunc(pt, 0.35168, 1.2380, 0.41479, -0.63250E-01);
2444  scale[2] = vfunc(pt, 1.2497, 0.88495, -0.14338, 0.94307E-01);
2445  scale[3] = lambdafunc(pt, 0.29565, 1.4502, 1.2139, 0.14353, -0.21211, -0.82968E-01);
2446  scale[4] = vfunc(pt, 1.2496, 1.1216, 0.97174E-02, -0.41166E-01);
2447  }
2448 
2449 //
2450 // Scale error for Exp.61-65 Hadron MC
2451 // March 4th, 2009 by higuchit
2452 //
2454  static void
2455  cal_scale_error_EXP6165_hadronic_mc(double scale[5], double pt, double /*tanl*/)
2456  {
2457  // pt
2458  scale[0] = vfunc(pt, 1.4501, 1.0348, -0.12125, -0.27519E-01);
2459  scale[1] = lambdafunc(pt, 0.48988, 1.5501, 1.2544, 0.21014, -0.10419, 0.74755E-01);
2460  scale[2] = lambdafunc(pt, 0.44993, 1.3616, 0.93316, -0.58441, -0.30814E-01, 0.90806E-01);
2461  scale[3] = 1.2385 - 0.17733 * pt;
2462  scale[4] = vfunc(pt, 0.75590, 1.1726, 0.12749, -0.75183E-01);
2463  }
2464 
2465 //
2466 // Scale error for Exp.67 Hadron MC
2467 // October 8th, 2009 by higuchit
2468 //
2470  static void
2471  cal_scale_error_EXP67_hadronic_mc(double scale[5], double pt, double /*tanl*/)
2472  {
2473  // pt
2474  scale[0] = vfunc(pt, 1.0501, 1.0852, -0.14604, -0.66317E-01);
2475  scale[1] = lambdafunc(pt, 0.37538, 2.5672, 1.2362, 0.14203, -0.58242E-01, 0.28431E-02);
2476  scale[2] = lambdafunc(pt, 0.52700, 1.3506, 0.90327, -0.55627, 0.13131E-02, 0.11059);
2477  scale[3] = 1.2577 - 0.19572 * pt;
2478  scale[4] = vfunc(pt, 0.69484, 1.1636, 0.96169E-01, -0.80421E-01);
2479  }
2480 
2481 
2482 //
2483 // Scale error for Exp.69 Hadron MC
2484 // January 29th, 2010 by higuchit
2485 // Scale error for Exp.71 Hadron MC
2486 // May 12th, 2010 by higuchit
2487 //
2489  static void
2490  cal_scale_error_EXP6971_hadronic_mc(double scale[5], double pt, double /*tanl*/)
2491  {
2492  // pt
2493  scale[0] = vfunc(pt, 1.7258, 1.0126, -0.12693, 0.31924E-01);
2494  scale[1] = lambdafunc(pt, 0.37552, 1.2217, 1.2532, 0.37276, -0.77830E-01, -0.31378E-01);
2495  scale[2] = lambdafunc(pt, 0.40176, 1.1748, 0.95524, -0.72331, -0.53213E-01, 0.90074E-01);
2496  scale[3] = 1.2644 - 0.19783 * pt;
2497  scale[4] = vfunc(pt, 0.56934, 1.1649, 0.13098, -0.52232E-01);
2498  }
2499 
2500 
2501  /***** *****/
2502  /***** scale error core *****/
2503  /***** *****/
2504  static const struct cal_scale_error_func_set_t
2510  },
2516  },
2522  },
2528  },
2534  },
2540  },
2546  },
2552  },
2558  },
2564  },
2570  },
2576  },
2582  },
2588  },
2594  },
2600  },
2606  },
2609  null_scale,
2610  null_scale,
2611  null_scale
2612  };
2613 
2614 
2616  static cal_scale_error_func_set_t
2617  get_scale_error_func_for_exprun(const int no_exp, const int /*no_run*/)
2618  {
2619  return
2620  (7 <= no_exp && no_exp <= 23) ? EXP0723_scale :
2621  (25 <= no_exp && no_exp <= 27) ? EXP2527_scale :
2622  (31 == no_exp) ? EXP31_scale :
2623  (33 == no_exp) ? EXP33_scale :
2624  (35 == no_exp) ? EXP35_scale :
2625  (37 == no_exp) ? EXP37_scale :
2626  (39 == no_exp || 41 == no_exp) ? EXP3941_scale :
2627  (43 == no_exp) ? EXP43_scale :
2628  (45 == no_exp) ? EXP45_scale :
2629  (47 == no_exp) ? EXP47_scale :
2630  (49 == no_exp) ? EXP49_scale :
2631  (51 == no_exp) ? EXP51_scale :
2632  (53 == no_exp) ? EXP53_scale :
2633  (55 == no_exp) ? EXP55_scale :
2634  (61 <= no_exp && no_exp <= 65) ? EXP6165_scale :
2635  (67 == no_exp) ? EXP67_scale :
2636  // ( 69==no_exp || 71==no_exp ) ? EXP6971_scale : DUMMY_scale;
2637  (69 <= no_exp && 73 >= no_exp) ? EXP6971_scale : DUMMY_scale;
2638  }
2640  static void
2642  (double scale[5],
2643  const double pt, const double tanl,
2644  const int expmc, const int no_exp, const int no_run)
2645  {
2646  double scale_error_hadronic_mc[5] = {1.0, 1.0, 1.0, 1.0, 1.0};
2647  double scale_error_cosmic_mc[5] = {1.0, 1.0, 1.0, 1.0, 1.0};
2648  double scale_error_cosmic_data[5] = {1.0, 1.0, 1.0, 1.0, 1.0};
2649 
2650 
2651  struct cal_scale_error_func_set_t cal_func = get_scale_error_func_for_exprun(no_exp, no_run);
2652  if (cal_func == DUMMY_scale) {
2653  B2ERROR("!!!! scale_error: FATAL: FATAL ERROR occured. Abort !!!!");
2654  // Scale error is not prepared for this EXP number!
2655  assert(0);
2656  }
2657 
2658 
2659  static bool first = true;
2660  static int belle_scale_error_debug_mode = 0;
2661  if (first) {
2662  first = false;
2663  char* belle_scale_error_debug = getenv("BELLE_SCALE_ERROR_DEBUG");
2664  // one of NULL, "none", "cosmic_mc", "cosmic_data", "hadronic_mc"
2665 
2666  if (!belle_scale_error_debug)
2667  belle_scale_error_debug_mode = 0;
2668  else if (!strcasecmp(belle_scale_error_debug, "none"))
2669  belle_scale_error_debug_mode = 1;
2670  else if (!strcasecmp(belle_scale_error_debug, "cosmic_mc"))
2671  belle_scale_error_debug_mode = 2;
2672  else if (!strcasecmp(belle_scale_error_debug, "cosmic_data"))
2673  belle_scale_error_debug_mode = 3;
2674  else if (!strcasecmp(belle_scale_error_debug, "hadron_mc") || !strcasecmp(belle_scale_error_debug, "hadronic_mc"))
2675  belle_scale_error_debug_mode = 4;
2676  else {
2677  B2ERROR("BELLE_SCALE_ERROR_DEBUG=" << belle_scale_error_debug << ": bad directive");
2678  assert(0);
2679  }
2680 
2681  if (belle_scale_error_debug)
2682  B2ERROR("BELLE_SCALE_ERROR_DEBUG=" << belle_scale_error_debug << ": applied");
2683  }
2684 
2685 
2686  switch (belle_scale_error_debug_mode) {
2687  case 0:
2688  (cal_func.m_hadMC)(scale_error_hadronic_mc, pt, tanl);
2689  if (expmc == 1) { // Experiment
2690  if (SE_Message_Level >= 2) B2ERROR("scale_error: info: scale on real data");
2691  (cal_func.m_cosMC)(scale_error_cosmic_mc, pt, tanl);
2692  (cal_func.m_cosDATA)(scale_error_cosmic_data, pt, tanl);
2693  } else {
2694  if (SE_Message_Level >= 2) B2ERROR("scale_error: info: scale on MC data");
2695  }
2696  break;
2697 
2698  case 1:
2699  //1;
2700  break;
2701 
2702  case 2:
2703  (cal_func.m_cosMC)(scale_error_hadronic_mc, pt, tanl);
2704  break;
2705 
2706  case 3:
2707  (cal_func.m_cosDATA)(scale_error_hadronic_mc, pt, tanl);
2708  break;
2709 
2710  case 4:
2711  (cal_func.m_hadMC)(scale_error_hadronic_mc, pt, tanl);
2712  break;
2713  }
2714 
2715 
2716  /* compute scaling factor */
2717  for (int i = 0; i < 5; i++)
2718  scale[i] = scale_error_hadronic_mc[i] * scale_error_cosmic_data[i] / scale_error_cosmic_mc[i];
2719 
2720 
2721  /* message out */
2722  if (SE_Message_Level >= 2) {
2723  B2ERROR("scale_error: info: hadronic MC: "
2724  << scale_error_hadronic_mc[0] << " " << scale_error_hadronic_mc[1] << " "
2725  << scale_error_hadronic_mc[2] << " " << scale_error_hadronic_mc[3] << " "
2726  << scale_error_hadronic_mc[4]);
2727 
2728  B2ERROR("scale_error: info: cosmic MC: "
2729  << scale_error_cosmic_mc[0] << " " << scale_error_cosmic_mc[1] << " "
2730  << scale_error_cosmic_mc[2] << " " << scale_error_cosmic_mc[3] << " "
2731  << scale_error_cosmic_mc[4]);
2732 
2733  B2ERROR("scale_error: info: cosmic data: "
2734  << scale_error_cosmic_data[0] << " " << scale_error_cosmic_data[1] << " "
2735  << scale_error_cosmic_data[2] << " " << scale_error_cosmic_data[3] << " "
2736  << scale_error_cosmic_data[4]);
2737 
2738  B2ERROR("scale_error: info: final scale: "
2739  << scale[0] << " " << scale[1] << " " << scale[2] << " "
2740  << scale[3] << " " << scale[4]);
2741  }
2742  /* check parameter limit */
2743  const double scale_lo = 0.5, scale_hi = 4.0;
2744  bool too_lo = false, too_hi = false;
2745  for (int i = 0; i < 5; i++) {
2746  if (scale[i] < scale_lo) { scale[i] = scale_lo; too_lo = true;}
2747  if (scale[i] > scale_hi) { scale[i] = scale_hi; too_hi = true;}
2748  }
2749 
2750  if (SE_Message_Level >= 1 && (too_lo || too_hi)) {
2751  B2ERROR("scale_error: warning: scale factor beyond the limit: "
2752  << scale_error_hadronic_mc[0] * scale_error_cosmic_data[0] / scale_error_cosmic_mc[0] << " "
2753  << scale_error_hadronic_mc[1] * scale_error_cosmic_data[1] / scale_error_cosmic_mc[1] << " "
2754  << scale_error_hadronic_mc[2] * scale_error_cosmic_data[2] / scale_error_cosmic_mc[2] << " "
2755  << scale_error_hadronic_mc[3] * scale_error_cosmic_data[3] / scale_error_cosmic_mc[3] << " "
2756  << scale_error_hadronic_mc[4] * scale_error_cosmic_data[4] / scale_error_cosmic_mc[4]);
2757  }
2758  }
2759 
2760 
2768  static int scale_error_impl(const int message_level, const int reprocess_version)
2769  {
2770  SE_Message_Level = message_level;
2771  SE_Reprocess_Version = reprocess_version;
2772 
2773  int no_exp{0}, no_run{0}, no_evt{0}, no_frm{0}, expmc{0};
2774  get_event_id(&no_exp, &no_run, &no_evt, &no_frm, &expmc);
2775 
2776  if (DUMMY_scale == get_scale_error_func_for_exprun(no_exp, no_run)) return 2;
2777  if (is_already_scaled()) return 1;
2778 
2779  static int first_exp73 = true;
2780  if (no_exp == 73 && first_exp73) {
2781  first_exp73 = false;
2782  B2ERROR(
2783  "scale_error: warning: scale parameters for exp#71 are tentatively used for exp#73.");
2784  }
2785 
2786  double scale[5] = { // ... temporary
2787  1.0, // dr
2788  1.0, // phi0
2789  1.0, // kappa
2790  1.0, // dz
2791  1.0, // tanl
2792  };
2793 
2794 
2795  // scale error matrices in mdst_trk_fit
2796  Belle::Mdst_trk_fit_Manager& fitmgr = Belle::Mdst_trk_fit_Manager::get_manager();
2797  for (std::vector<Belle::Mdst_trk_fit>::iterator it = fitmgr.begin(); it != fitmgr.end(); ++it) {
2798  Belle::Mdst_trk_fit& fit = *it;
2799  if (fit.helix(2) == 0.) continue;
2800 
2801  const double pt = 1. / fabs(fit.helix(2));
2802  const double tanl = fit.helix(4);
2803 
2804  cal_scale_error(scale, pt, tanl, expmc, no_exp, no_run);
2805 
2806  fit.error(0, scale[0]*scale[0]*fit.error(0));
2807  fit.error(1, scale[1]*scale[0]*fit.error(1));
2808  fit.error(2, scale[1]*scale[1]*fit.error(2));
2809  fit.error(3, scale[2]*scale[0]*fit.error(3));
2810  fit.error(4, scale[2]*scale[1]*fit.error(4));
2811  fit.error(5, scale[2]*scale[2]*fit.error(5));
2812  fit.error(6, scale[3]*scale[0]*fit.error(6));
2813  fit.error(7, scale[3]*scale[1]*fit.error(7));
2814  fit.error(8, scale[3]*scale[2]*fit.error(8));
2815  fit.error(9, scale[3]*scale[3]*fit.error(9));
2816  fit.error(10, scale[4]*scale[0]*fit.error(10));
2817  fit.error(11, scale[4]*scale[1]*fit.error(11));
2818  fit.error(12, scale[4]*scale[2]*fit.error(12));
2819  fit.error(13, scale[4]*scale[3]*fit.error(13));
2820  fit.error(14, scale[4]*scale[4]*fit.error(14));
2821  }
2822 
2823 
2824  // scale error matrices in mdst_daughters
2825  Belle::Mdst_vee_daughters_Manager& daumgr = Belle::Mdst_vee_daughters_Manager::get_manager();
2826  for (std::vector<Belle::Mdst_vee_daughters>::iterator it = daumgr.begin(); it != daumgr.end(); ++it) {
2827  Belle::Mdst_vee_daughters& dau = *it;
2828  if (dau.helix_p(2) == 0. || dau.helix_m(2) == 0.) continue;
2829 
2830  // positive track
2831  const double pt_p = 1. / fabs(dau.helix_p(2));
2832  const double tanl_p = dau.helix_p(4);
2833 
2834  cal_scale_error(scale, pt_p, tanl_p, expmc, no_exp, no_run);
2835 
2836  dau.error_p(0, scale[0]*scale[0]*dau.error_p(0));
2837  dau.error_p(1, scale[1]*scale[0]*dau.error_p(1));
2838  dau.error_p(2, scale[1]*scale[1]*dau.error_p(2));
2839  dau.error_p(3, scale[2]*scale[0]*dau.error_p(3));
2840  dau.error_p(4, scale[2]*scale[1]*dau.error_p(4));
2841  dau.error_p(5, scale[2]*scale[2]*dau.error_p(5));
2842  dau.error_p(6, scale[3]*scale[0]*dau.error_p(6));
2843  dau.error_p(7, scale[3]*scale[1]*dau.error_p(7));
2844  dau.error_p(8, scale[3]*scale[2]*dau.error_p(8));
2845  dau.error_p(9, scale[3]*scale[3]*dau.error_p(9));
2846  dau.error_p(10, scale[4]*scale[0]*dau.error_p(10));
2847  dau.error_p(11, scale[4]*scale[1]*dau.error_p(11));
2848  dau.error_p(12, scale[4]*scale[2]*dau.error_p(12));
2849  dau.error_p(13, scale[4]*scale[3]*dau.error_p(13));
2850  dau.error_p(14, scale[4]*scale[4]*dau.error_p(14));
2851 
2852  // negative track
2853  const double pt_m = 1. / fabs(dau.helix_m(2));
2854  const double tanl_m = dau.helix_m(4);
2855 
2856  cal_scale_error(scale, pt_m, tanl_m, expmc, no_exp, no_run);
2857 
2858  dau.error_m(0, scale[0]*scale[0]*dau.error_m(0));
2859  dau.error_m(1, scale[1]*scale[0]*dau.error_m(1));
2860  dau.error_m(2, scale[1]*scale[1]*dau.error_m(2));
2861  dau.error_m(3, scale[2]*scale[0]*dau.error_m(3));
2862  dau.error_m(4, scale[2]*scale[1]*dau.error_m(4));
2863  dau.error_m(5, scale[2]*scale[2]*dau.error_m(5));
2864  dau.error_m(6, scale[3]*scale[0]*dau.error_m(6));
2865  dau.error_m(7, scale[3]*scale[1]*dau.error_m(7));
2866  dau.error_m(8, scale[3]*scale[2]*dau.error_m(8));
2867  dau.error_m(9, scale[3]*scale[3]*dau.error_m(9));
2868  dau.error_m(10, scale[4]*scale[0]*dau.error_m(10));
2869  dau.error_m(11, scale[4]*scale[1]*dau.error_m(11));
2870  dau.error_m(12, scale[4]*scale[2]*dau.error_m(12));
2871  dau.error_m(13, scale[4]*scale[3]*dau.error_m(13));
2872  dau.error_m(14, scale[4]*scale[4]*dau.error_m(14));
2873  }
2874 
2875  return 0;
2876  }
2877 
2878 
2879  void B2BIIFixMdstModule::scale_error(const int message_level)
2880  {
2881  static int result_before = -1;
2882 
2883  const int result = scale_error_impl(message_level, this->m_reprocess_version);
2884 
2885  if (result != result_before) {
2886  switch (result) {
2887  case 0: {
2888  B2INFO(
2889  "scale_error: info: scale error is properly applied.");
2890  break;
2891  }
2892 
2893  case 1: {
2894  B2ERROR(
2895  "scale_error: warning: scale error is not applied. Reason: it has been already applied.");
2896  break;
2897  }
2898 
2899  case 2: {
2900  int no_exp, no_run, no_evt, no_frm, expmc;
2901  get_event_id(&no_exp, &no_run, &no_evt, &no_frm, &expmc);
2902  B2ERROR(
2903  "scale_error: error: scale error is not applied. Reason: it is not available for exp " << no_exp << ". Exit! (I'll crash job.)");
2904  exit(-1);
2905 // break; // redundant
2906  }
2907 
2908  default: assert(0); // Should not be here!
2909  }
2910 
2911  result_before = result;
2912  }
2913  }
2914 
2915 
2917 // End of scale_error() implementation
2919 
2920 
2922  CLHEP::HepSymMatrix& epvtx_err)
2923  {
2924 
2925  Belle::Evtvtx_primary_vertex_Manager& evtvtx_mgr
2926  = Belle::Evtvtx_primary_vertex_Manager::get_manager();
2927 
2928  Belle::Evtvtx_trk_Manager& evttrk_mgr = Belle::Evtvtx_trk_Manager::get_manager();
2929 
2930  Belle::Evtvtx_primary_vertex_Manager::iterator itvtx = evtvtx_mgr.begin();
2931  if (itvtx == evtvtx_mgr.end()) return 4;
2932 
2933  if (!(itvtx->quality() == 2 || itvtx->quality() == 3)) return 3;
2934 
2935  // TKECK fit primary vertex with our kfitter!
2936 
2938  HepPoint3D pvtx(itvtx->PV_x(), itvtx->PV_y(), itvtx->PV_z());
2939 
2940  kv.setInitialVertex(pvtx);
2941 
2942  unsigned int nchrgd(0);
2943  for (Belle::Evtvtx_trk_Manager::iterator i = evttrk_mgr.begin(); i != evttrk_mgr.end(); ++i) {
2944 
2945  const Belle::Mdst_charged& p = i->charged();
2946  if (p.trk().mhyp(2).nhits(3) < 2) continue;
2947  if (p.trk().mhyp(2).nhits(4) < 2) continue;
2948 
2949  int hyp = 2;
2950  const HepPoint3D pivot(p.trk().mhyp(hyp).pivot_x(),
2951  p.trk().mhyp(hyp).pivot_y(),
2952  p.trk().mhyp(hyp).pivot_z());
2953  CLHEP::HepVector a(5);
2954  a[0] = p.trk().mhyp(hyp).helix(0);
2955  a[1] = p.trk().mhyp(hyp).helix(1);
2956  a[2] = p.trk().mhyp(hyp).helix(2);
2957  a[3] = p.trk().mhyp(hyp).helix(3);
2958  a[4] = p.trk().mhyp(hyp).helix(4);
2959  CLHEP::HepSymMatrix Ea(5, 0);
2960  Ea[0][0] = p.trk().mhyp(hyp).error(0);
2961  Ea[1][0] = p.trk().mhyp(hyp).error(1);
2962  Ea[1][1] = p.trk().mhyp(hyp).error(2);
2963  Ea[2][0] = p.trk().mhyp(hyp).error(3);
2964  Ea[2][1] = p.trk().mhyp(hyp).error(4);
2965  Ea[2][2] = p.trk().mhyp(hyp).error(5);
2966  Ea[3][0] = p.trk().mhyp(hyp).error(6);
2967  Ea[3][1] = p.trk().mhyp(hyp).error(7);
2968  Ea[3][2] = p.trk().mhyp(hyp).error(8);
2969  Ea[3][3] = p.trk().mhyp(hyp).error(9);
2970  Ea[4][0] = p.trk().mhyp(hyp).error(10);
2971  Ea[4][1] = p.trk().mhyp(hyp).error(11);
2972  Ea[4][2] = p.trk().mhyp(hyp).error(12);
2973  Ea[4][3] = p.trk().mhyp(hyp).error(13);
2974  Ea[4][4] = p.trk().mhyp(hyp).error(14);
2975  Belle::Helix helix(pivot, a, Ea);
2976 
2977  CLHEP::HepLorentzVector mom;
2978  CLHEP::HepSymMatrix err(7, 0);
2979  HepPoint3D pos(0, 0, 0);
2980  if (pivot.x() != 0. ||
2981  pivot.y() != 0. ||
2982  pivot.z() != 0.) {
2983  helix.pivot(HepPoint3D(0., 0., 0.));
2984  mom = helix.momentum(0., 0.13957f, pos, err);
2985  } else {
2986  mom = helix.momentum(0., 0.13957f, pos, err);
2987  }
2988 
2989  kv.addTrack(mom, pos, err, p.charge());
2990  ++nchrgd;
2991  }
2992 
2993  if (Belle::IpProfile::usable()) {
2994  // event depend. IP position and error matrix
2995  HepPoint3D ip_position = Belle::IpProfile::e_position();
2996  CLHEP::HepSymMatrix ip_err = Belle::IpProfile::e_position_err();
2997  kv.setIpProfile(ip_position, ip_err);
2998  }
2999  // Fit
3000  unsigned int err(1);
3001  if (nchrgd > 2 || (nchrgd > 0 && Belle::IpProfile::usable())) err = kv.doFit();
3002  if (err == 0) {
3003  epvtx = kv.getVertex();
3004  epvtx_err = kv.getVertexError();
3005  }
3006  return err;
3007 
3008  /*
3009  kvertexfitter kv;
3010 
3011  HepPoint3D pvtx(itvtx->PV_x(), itvtx->PV_y(), itvtx->PV_z());
3012 
3013  kv.initialVertex(pvtx);
3014 
3015  Ptype ptype_pi_plus("PI+");
3016  Ptype ptype_pi_minus("PI-");
3017 
3018  unsigned int nchrgd(0);
3019  for(Belle::Evtvtx_trk_Manager::iterator i = evttrk_mgr.begin();
3020  i != evttrk_mgr.end(); ++i){
3021  // if(!good_charged(i->charged())) continue;
3022 
3023  if(i->charged().trk().mhyp(2).nhits(3) < 2) continue;
3024  if(i->charged().trk().mhyp(2).nhits(4) < 2) continue;
3025 
3026  Particle tmp(i->charged(),
3027  (i->charged().charge()>0.0 ? ptype_pi_plus : ptype_pi_minus));
3028  addTrack2fit(kv, tmp);
3029  ++nchrgd;
3030  }
3031 
3032  if(Belle::IpProfile::usable()){
3033 
3034  // event depend. IP position and error matrix
3035  HepPoint3D ip_position = Belle::IpProfile::e_position();
3036  HepSymMatrix ip_err = Belle::IpProfile::e_position_err();
3037  // HepSymMatrix m_ip_err_b = Belle::IpProfile::e_position_err_b_life_smeared();
3038 
3039  // Add IP profile information
3040  addBeam2fit(kv, ip_position, ip_err);
3041  }
3042  // Fit
3043  unsigned int err(1);
3044  if(nchrgd>2||(nchrgd>0&&Belle::IpProfile::usable())) err = kv.fit();
3045  if(err==0) {
3046  epvtx = kv.get_vertex();
3047  epvtx_err = kv.get_err_vertex();
3048  }
3049  return err;
3050  */
3051  }
3052 
3053 
3054 //========================================================
3055 // Add Mdst_trk_extra and Mdst_vee_extra
3056 // to Mdst_trk and Mdst_vee2, respectively.
3057 //=======================================================
3059  extern "C"
3060  void recsim_mdst_propgt_(float*, float[], float[], float[],
3061  float[], float[], int*);
3062 
3063  int
3065  {
3066  Belle::Mdst_event_add_Manager& mevtmgr = Belle::Mdst_event_add_Manager::get_manager();
3067  if (mevtmgr.count() == 0) { // no Belle::Mdst_event_add table
3068  return -2;
3069  } else if (mevtmgr.count() == 1) { // no second entity in Belle::Mdst_event_add table
3070  mevtmgr.add();
3071  }
3072  unsigned flag(mevtmgr[1].flag(0));
3073  if (flag != 0) return -1; // do nothing if already added
3074  Belle::Mdst_trk_extra_Manager& teMgr(Belle::Mdst_trk_extra_Manager::get_manager());
3075  Belle::Mdst_trk_Manager& tMgr(Belle::Mdst_trk_Manager::get_manager());
3076  Belle::Mdst_charged_Manager& chMgr(Belle::Mdst_charged_Manager::get_manager());
3077  const int i_ch(chMgr.count() + 1);
3078  const int i_trk(tMgr.count() + 1);
3079  for (std::vector<Belle::Mdst_trk_extra>::const_iterator i = teMgr.begin();
3080  i != teMgr.end(); ++i) {
3081  Belle::Mdst_trk& trk(tMgr.add());
3082  trk.quality((*i).quality());
3083  for (int j = 0; j < 5; j++) trk.mhyp(j, (*i).mhyp(j));
3084 
3085  // Commented out by A. Zupanc: see below
3086  // Belle::Mdst_trk_fit& tf(trk.mhyp(2));
3087  if (!(trk.quality() & 15u)) {
3088  B2FATAL("recsim_mdst_propgt_ is missing");
3089 
3090  /*
3091  Commented by A.Zupanc: the recsim_mdst_propgt_ is missing therefore this part of the code
3092  can not be executed
3093 
3094  Belle::Mdst_charged& ch(chMgr.add());
3095  ch.charge((tf.helix(2) >= 0) ? 1. : -1.);
3096 
3097  float pivot[3], helix[5], error[15], helix0[5], error0[15];
3098  for (int k = 0; k < 3; k++) pivot[k] = tf.pivot(k);
3099  for (int k = 0; k < 5; k++) helix[k] = tf.helix(k);
3100  for (int k = 0; k < 15; k++) error[k] = tf.error(k);
3101 
3102  float amass = tf.mass();
3103 
3104  // propagate helix to origin
3105  int iret;
3106 
3107  //recsim_mdst_propgt_(&amass, pivot, helix, error,
3108  // helix0, error0, &iret);
3109  if (iret == 0) {
3110  ch.px(-sin(helix0[1]) / fabs(helix0[2]));
3111  ch.py(cos(helix0[1]) / fabs(helix0[2]));
3112  ch.pz(helix0[4] / fabs(helix0[2]));
3113  }
3114  ch.mass(amass);
3115  ch.trk(trk);
3116  */
3117  } else {
3118  B2ERROR("Warning from B2BIIFixMdst: strange track in Belle::Mdst_trk_extra: quality="
3119  << trk.quality());
3120  }
3121  }
3122 
3123 
3124  Belle::Mdst_sim_trk_extra_Manager& steMgr
3125  (Belle::Mdst_sim_trk_extra_Manager::get_manager());
3126  Belle::Mdst_sim_trk_Manager& stMgr(Belle::Mdst_sim_trk_Manager::get_manager());
3127  int ist(0);
3128  for (std::vector<Belle::Mdst_sim_trk_extra>::const_iterator i = steMgr.begin();
3129  i != steMgr.end(); ++i) {
3130  Belle::Mdst_sim_trk& strk(stMgr.add());
3131  int argn = tMgr.count() - teMgr.count() + ist;
3132  if (argn < tMgr.count()) {
3133  strk.trk(tMgr[argn]);
3134  }
3135  ist++;
3136  strk.hepevt((*i).hepevt());
3137  strk.relation(0, (*i).relation(0));
3138  strk.relation(1, (*i).relation(1));
3139  strk.relation(2, (*i).relation(2));
3140  }
3141 
3142 
3143  Belle::Mdst_svd_hit_extra_Manager& sheMgr
3144  (Belle::Mdst_svd_hit_extra_Manager::get_manager());
3145  Belle::Mdst_svd_hit_Manager& shMgr(Belle::Mdst_svd_hit_Manager::get_manager());
3146  for (std::vector<Belle::Mdst_svd_hit_extra>::iterator it = sheMgr.begin();
3147  it != sheMgr.end(); ++it) {
3148  Belle::Mdst_svd_hit_extra& she = *it;
3149  Belle::Mdst_svd_hit& sh(shMgr.add());
3150  sh.lsa(she.lsa());
3151  sh.width(she.width());
3152  sh.electrons(she.electrons());
3153  sh.dssd(she.dssd());
3154  sh.type(she.type());
3155  int argn = tMgr.count() - teMgr.count() + she.trk().get_ID() - 1;
3156  if (argn < tMgr.count()) {
3157  sh.trk(tMgr[argn]);
3158  }
3159  }
3160 
3161 
3162  Belle::Mdst_vee2_Manager& vMgr(Belle::Mdst_vee2_Manager::get_manager());
3163  Belle::Mdst_vee2_extra_Manager& veMgr(Belle::Mdst_vee2_extra_Manager::get_manager());
3164  const int i_vee2(vMgr.count() + 1);
3165  for (std::vector<Belle::Mdst_vee2_extra>::const_iterator i = veMgr.begin();
3166  i != veMgr.end(); ++i) {
3167  Belle::Mdst_vee2& vee(vMgr.add());
3168  vee.kind((*i).kind());
3169 
3170  if ((*i).extra_ID(0)) {
3171  Belle::Mdst_charged& tmp(chMgr[(*i).extra_ID(0) + i_ch - 2]);
3172  vee.chgd(0, tmp);
3173  } else {
3174  vee.chgd(0, (*i).chgd());
3175  }
3176 
3177  if ((*i).extra_ID(1)) {
3178  Belle::Mdst_charged& tmp(chMgr[(*i).extra_ID(1) + i_ch - 2]);
3179  vee.chgd(1, tmp);
3180  } else {
3181  vee.chgd(1, (*i).chgd());
3182  }
3183 
3184  vee.px((*i).px());
3185  vee.py((*i).py());
3186  vee.pz((*i).pz());
3187  vee.energy((*i).energy());
3188  vee.vx((*i).vx());
3189  vee.vy((*i).vy());
3190  vee.vz((*i).vz());
3191  vee.z_dist((*i).z_dist());
3192  vee.chisq((*i).chisq());
3193  vee.type((*i).type());
3194  vee.daut((*i).daut());
3195  }
3196  teMgr.remove();
3197  steMgr.remove();
3198  sheMgr.remove();
3199  veMgr.remove();
3200  if (i_ch & 0xffffff00) B2ERROR("Warning from B2BIIFixMdst: overflow! i_ch = " << i_ch);
3201  if (i_trk & 0xffffff00) B2ERROR("Warning from B2BIIFixMdst: overflow! i_trk = " << i_trk);
3202  if (i_vee2 & 0xffffff00) B2ERROR("Warning from B2BIIFixMdst: overflow! i_vee2 = " << i_vee2);
3203  flag = i_ch & 0xff;
3204  flag |= ((i_trk & 0xff) << 8);
3205  flag |= ((i_vee2 & 0xff) << 16);
3206  mevtmgr[1].flag(0, flag);
3207  return (int)flag;
3208  }
3209 #if 0
3210  int
3212  {
3213  Belle::Mdst_event_add_Manager& mevtmgr = Belle::Mdst_event_add_Manager::get_manager();
3214  if (mevtmgr.count() <= 1) { // no Belle::Mdst_event_add table
3215  return -2;
3216  }
3217  unsigned flag(mevtmgr[1].flag(0));
3218  if (0 == flag) return -1; // do nothing if no extra tracks in Belle::Mdst_charged etc.
3219  const int i_ch(flag & 0xff);
3220  const int i_trk((flag >> 8) & 0xff);
3221  const int i_vee2((flag >> 16) & 0xff);
3222  Belle::Mdst_charged_Manager& chMgr(Belle::Mdst_charged_Manager::get_manager());
3223  Belle::Mdst_trk_Manager& tMgr(Belle::Mdst_trk_Manager::get_manager());
3224  Belle::Mdst_vee2_Manager& veeMgr(Belle::Mdst_vee2_Manager::get_manager());
3225  if (i_ch) {
3226  while (chMgr.count() >= i_ch) chMgr.remove(chMgr[chMgr.count() - 1]);
3227  }
3228  if (i_trk) {
3229  while (tMgr.count() >= i_trk) tMgr.remove(tMgr[tMgr.count() - 1]);
3230  }
3231  if (i_vee2) {
3232  while (veeMgr.count() >= i_vee2) veeMgr.remove(veeMgr[veeMgr.count() - 1]);
3233  }
3234  flag = 0;
3235  mevtmgr[1].flag(0, flag);
3236  return 0;
3237  }
3238 #else
3239  int
3241  {
3242  Belle::Mdst_event_add_Manager& mevtmgr = Belle::Mdst_event_add_Manager::get_manager();
3243  if (mevtmgr.count() <= 1) { // no Belle::Mdst_event_add table
3244  return -2;
3245  }
3246  unsigned flag(mevtmgr[1].flag(0));
3247  if (0 == flag) return -1; // do nothing if no extra tracks in Belle::Mdst_charged etc.
3248  const int i_ch(flag & 0xff);
3249  const int i_trk((flag >> 8) & 0xff);
3250  const int i_vee2((flag >> 16) & 0xff);
3251  //Belle::Mdst_charged_Manager////& chMgr(Belle::Mdst_charged_Manager::get_manager());
3252  Belle::Mdst_trk_Manager& tMgr(Belle::Mdst_trk_Manager::get_manager());
3253  Belle::Mdst_vee2_Manager& veeMgr(Belle::Mdst_vee2_Manager::get_manager());
3254  Belle::Mdst_trk_extra_Manager& teMgr(Belle::Mdst_trk_extra_Manager::get_manager());
3255  Belle::Mdst_vee2_extra_Manager& veeeMgr(Belle::Mdst_vee2_extra_Manager::get_manager());
3256  if (i_trk) {
3257  std::vector<int> extra_ID;
3258  if (teMgr.count()) teMgr.remove();
3259  for (std::vector<Belle::Mdst_trk>::iterator i = tMgr.begin();
3260  i != tMgr.end(); ++i) {
3261  if ((*i).get_ID() < i_trk) {
3262  extra_ID.push_back(0);
3263  continue;
3264  }
3265  if (!((*i).quality() & 16u)) {
3266  B2ERROR("Warning from B2BIIFixMdst: inconsistency between Belle::Mdst_trk and Belle::Mdst_evet_add"
3267  );
3268  }
3269  Belle::Mdst_trk_extra& trk(teMgr.add());
3270  for (int j = 0; j < 5; j++) trk.mhyp(j, (*i).mhyp(j));
3271  trk.quality((*i).quality());
3272  extra_ID.push_back(trk.get_ID());
3273  }
3274  if (i_vee2) {
3275  if (veeeMgr.count()) veeeMgr.remove();
3276  for (std::vector<Belle::Mdst_vee2>::iterator i = veeMgr.begin();
3277  i != veeMgr.end(); ++i) {
3278  if ((*i).get_ID() < i_vee2) continue;
3279  if (!((*i).chgd(0).trk().quality() & 16u) && !((*i).chgd(1).trk().quality() & 16u)) {
3280  B2ERROR("Warning from B2BIIFixMdst: inconsistency between Belle::Mdst_vee2 and Belle::Mdst_evet_add"
3281  );
3282  }
3283  Belle::Mdst_vee2_extra& vee(veeeMgr.add());
3284  vee.kind((*i).kind());
3285  const int extra_id0(extra_ID[(*i).chgd(0).trk_ID() - 1]);
3286  const int extra_id1(extra_ID[(*i).chgd(1).trk_ID() - 1]);
3287  if (extra_id0) {
3288  vee.extra(0, teMgr[extra_id0 - 1]);
3289  } else {
3290  vee.chgd((*i).chgd(0));
3291  }
3292  if (extra_id1) {
3293  vee.extra(1, teMgr[extra_id1 - 1]);
3294  } else {
3295  if (vee.chgd_ID()) {
3296  B2ERROR("Warning from B2BIIFixMdst: both tracks of Belle::Mdst_vee2_extra are good track"
3297  );
3298  }
3299  vee.chgd((*i).chgd(1));
3300  }
3301 
3302  vee.px((*i).px());
3303  vee.py((*i).py());
3304  vee.pz((*i).pz());
3305  vee.energy((*i).energy());
3306  vee.vx((*i).vx());
3307  vee.vy((*i).vy());
3308  vee.vz((*i).vz());
3309  vee.z_dist((*i).z_dist());
3310  vee.chisq((*i).chisq());
3311  vee.type((*i).type());
3312  vee.daut((*i).daut());
3313  }
3314  int id = BsCouTab(MDST_VEE2);
3315  while (id >= i_vee2) BsDelEnt(MDST_VEE2, id--);
3316  }
3317  int id = BsCouTab(MDST_TRK);
3318  while (id >= i_trk) BsDelEnt(MDST_TRK, id--);
3319  }
3320  if (i_ch) {
3321  int id = BsCouTab(MDST_CHARGED);
3322  while (id >= i_ch) BsDelEnt(MDST_CHARGED, id--);
3323  }
3324  flag = 0;
3325  mevtmgr[1].flag(0, flag);
3326  return 0;
3327  }
3328 
3329 //=======================================================================
3330 //Perform extra-smearing for MC tracks. The relevant code is extracted
3331 //from the module smear_trk originally coded by Marko Staric.
3332 //=======================================================================
3333 
3334  static void scale_err_ms(Belle::Mdst_trk_fit& fit, double scale[]);
3335  static void smear_trk_ms(Belle::Mdst_trk_fit& fit, double scale[]);
3336  static void smear_charged();
3338 //==========================
3340  {
3341 //==========================
3342  int expNo = 0, runNo = 0, expmc = 1;
3343  Belle::Belle_event_Manager& evtMgr = Belle::Belle_event_Manager::get_manager();
3344  if (evtMgr.count()) {
3345  expNo = evtMgr[0].ExpNo();
3346  runNo = evtMgr[0].RunNo();
3347  expmc = evtMgr[0].ExpMC();
3348  }
3349  if (expmc == 1) return; // nothing done for real data
3350 
3351  Belle::Mdst_event_add_Manager& addmgr = Belle::Mdst_event_add_Manager::get_manager();
3352  if (addmgr.count() == 0) {
3353  B2ERROR("No Belle::Mdst_event_add table -> kill the job");
3354  exit(-1);
3355  } else if (addmgr.count() >= 2) {
3356  if (addmgr[1].flag(1) != 0) return; //do nothing if already smeared
3357  }
3358 
3359  int flag_err = addmgr[0].flag_error();
3360 
3361  static bool start = true;
3362  if (start) {
3363  start = false;
3364  B2INFO("smear_trk: MC events -> track smearing is ON\n");
3365  }
3366 
3367  double scale_mc[5] = {1, 1, 1, 1, 1};
3368  double scale_rd[5] = {1, 1, 1, 1, 1};
3369  double scale[5];
3370 
3371  Belle::Mdst_trk_fit_Manager& fitmgr = Belle::Mdst_trk_fit_Manager::get_manager();
3372  for (std::vector<Belle::Mdst_trk_fit>::iterator it = fitmgr.begin(); it != fitmgr.end(); ++it) {
3373  Belle::Mdst_trk_fit& fit = *it;
3374  if (fit.helix(2) == 0.) continue;
3375 
3376  double pt = 1. / fabs(fit.helix(2));
3377  double tanl = fit.helix(4);
3378 
3379  cal_scale_error(scale_mc, pt, tanl, 0, expNo, runNo);
3380  cal_scale_error(scale_rd, pt, tanl, 1, expNo, runNo);
3381  for (int i = 0; i < 5; i++) scale[i] = scale_rd[i] / scale_mc[i];
3382 
3383  if (flag_err == 0) scale_err_ms(fit, scale_mc);
3384  smear_trk_ms(fit, scale);
3385  scale_err_ms(fit, scale);
3386  }
3387 
3388  if (m_smear_trk == 2) smear_charged();
3389 
3390  //set flag indicating already-err-scaled
3391  addmgr[0].flag_error(1);
3392 
3393  //set flag indicating already-smeared
3394  if (addmgr.count() == 1) {
3395  Belle::Mdst_event_add& meadd = addmgr.add();
3396  meadd.flag(1, 1);
3397  } else if (addmgr.count() >= 2) {
3398  addmgr[1].flag(1, 1);
3399  }
3400 
3401  }
3402 
3403 //====================================================
3404  void scale_err_ms(Belle::Mdst_trk_fit& fit, double scale[])
3405  {
3406 //====================================================
3407  fit.error(0, scale[0]*scale[0]*fit.error(0));
3408  fit.error(1, scale[1]*scale[0]*fit.error(1));
3409  fit.error(2, scale[1]*scale[1]*fit.error(2));
3410  fit.error(3, scale[2]*scale[0]*fit.error(3));
3411  fit.error(4, scale[2]*scale[1]*fit.error(4));
3412  fit.error(5, scale[2]*scale[2]*fit.error(5));
3413  fit.error(6, scale[3]*scale[0]*fit.error(6));
3414  fit.error(7, scale[3]*scale[1]*fit.error(7));
3415  fit.error(8, scale[3]*scale[2]*fit.error(8));
3416  fit.error(9, scale[3]*scale[3]*fit.error(9));
3417  fit.error(10, scale[4]*scale[0]*fit.error(10));
3418  fit.error(11, scale[4]*scale[1]*fit.error(11));
3419  fit.error(12, scale[4]*scale[2]*fit.error(12));
3420  fit.error(13, scale[4]*scale[3]*fit.error(13));
3421  fit.error(14, scale[4]*scale[4]*fit.error(14));
3422 
3423  }
3424 
3425 //====================================================
3426  void smear_trk_ms(Belle::Mdst_trk_fit& fit, double scale[])
3427  {
3428 //====================================================
3429  const int n = 5;
3430  double a[n][n];
3431  int k = 0;
3432  for (int i = 0; i < n; i++) {
3433  for (int j = 0; j <= i; j++) {
3434  a[i][j] = fit.error(k) * (scale[i] * scale[j] - 1.0);
3435  if (i != j) a[j][i] = a[i][j];
3436  k++;
3437  }
3438  }
3439 
3440  double u[n][n];
3441  //int pozdef = 1;
3442  for (int j = 0; j < n; j++) {
3443  double s = a[j][j];
3444  for (int k2 = 0; k2 < j; k2++) s -= u[j][k2] * u[j][k2];
3445  if (s > 0) {
3446  u[j][j] = sqrt(s);
3447  for (int i = j + 1; i < n; i++) {
3448  s = a[i][j];
3449  for (int k3 = 0; k3 < j; k3++) s -= u[i][k3] * u[j][k3];
3450  u[i][j] = s / u[j][j];
3451  }
3452  } else {
3453  for (int i = j; i < n; i++) u[i][j] = 0;
3454  //pozdef = 0;
3455  }
3456  }
3457 
3458  double g[n];
3459  for (int i = 0; i < n; i++) g[i] = gRandom->Gaus();
3460  double x[n];
3461  for (int i = 0; i < n; i++) {
3462  x[i] = 0;
3463  if (u[i][i] > 0) {
3464  for (int j = 0; j <= i; j++) x[i] += u[i][j] * g[j];
3465  }
3466  }
3467  for (int i = 0; i < n; i++) fit.helix(i, fit.helix(i) + x[i]);
3468 
3469  }
3470 
3471 //====================
3473  {
3474 //====================
3475  Belle::Mdst_charged_Manager& chgmgr = Belle::Mdst_charged_Manager::get_manager();
3476  for (std::vector<Belle::Mdst_charged>::iterator it = chgmgr.begin(); it != chgmgr.end(); ++it) {
3477  Belle::Mdst_charged& c = *it;
3478  Belle::Mdst_trk_fit& t = c.trk().mhyp(2);
3479 
3480  double kp = std::abs(t.helix(2));
3481  kp = std::max(kp, 1.e-10);
3482  kp = std::min(kp, 1.e10);
3483  c.px(-sin(t.helix(1)) / kp);
3484  c.py(cos(t.helix(1)) / kp);
3485  c.pz(t.helix(4) / kp);
3486  }
3487 
3488  }
3489 
3490 #endif
3491 
3492 } // namespace Belle
Belle2::cal_scale_error_EXP49_cosmic_data
static void cal_scale_error_EXP49_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.49 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:2041
Belle2::EXP6165_scale
static const struct cal_scale_error_func_set_t EXP6165_scale
Scale error for Exp.61-65.
Definition: B2BIIFixMdstModule_trk.cc:2590
Belle2::rootfunc
double rootfunc(const double x, const double x1, const double x2, const double yc, const double a1, const double a2)
rootfunc
Definition: B2BIIFixMdstModule_trk.cc:1526
Belle2::cupfunc
double cupfunc(const double x, const double x1, const double x2, const double yc, const double a1, const double a2)
cupfunc
Definition: B2BIIFixMdstModule_trk.cc:1519
Belle2::cal_scale_error_EXP3941_cosmic_mc
static void cal_scale_error_EXP3941_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.39,41 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1674
Belle2::cal_scale_error_func_set_t
Structure type cal_scale_error_func_set_t.
Definition: B2BIIFixMdstModule_trk.cc:1434
Belle2::scale_error_impl
static int scale_error_impl(const int message_level, const int reprocess_version)
The implementation of B2BIIFixMdstModule::scale_error()
Definition: B2BIIFixMdstModule_trk.cc:2768
Belle2::cal_scale_error_EXP3941_hadronic_mc
static void cal_scale_error_EXP3941_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.39,41 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2320
Belle2::analysis::VertexFitKFit::getVertexError
const CLHEP::HepSymMatrix getVertexError(void) const
Get a fitted vertex error matrix.
Definition: VertexFitKFit.cc:133
Belle2::cal_scale_error_EXP6971_hadronic_mc
static void cal_scale_error_EXP6971_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.69,71 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2490
Belle2::EXP37_scale
static const struct cal_scale_error_func_set_t EXP37_scale
Scale error for Exp.37.
Definition: B2BIIFixMdstModule_trk.cc:2536
Belle2::EXP35_scale
static const struct cal_scale_error_func_set_t EXP35_scale
Scale error for Exp.35.
Definition: B2BIIFixMdstModule_trk.cc:2530
Belle2::cal_scale_error_EXP47_cosmic_mc
static void cal_scale_error_EXP47_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.47 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1722
Belle2::cal_scale_error_EXP33_hadronic_mc
static void cal_scale_error_EXP33_hadronic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.33,35 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2259
Belle2::cal_scale_error_EXP43_hadronic_mc
static void cal_scale_error_EXP43_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.43 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2336
Belle2::cal_scale_error_EXP67_cosmic_data
static void cal_scale_error_EXP67_cosmic_data(double scale[5], double pt, double tanl)
Scale error for Exp.67 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:2142
Belle2::DUMMY_scale
static const struct cal_scale_error_func_set_t DUMMY_scale
Dummy scale.
Definition: B2BIIFixMdstModule_trk.cc:2608
Belle2::B2BIIFixMdstModule::add_extra_trk_vee2
int add_extra_trk_vee2()
Add Mdst_trk_extra and Mdst_vee_extra to Mdst_trk and Mdst_vee2, respectively.
Definition: B2BIIFixMdstModule_trk.cc:3064
Belle2::smear_trk_ms
static void smear_trk_ms(Belle::Mdst_trk_fit &fit, double scale[])
Smear MC tracks.
Definition: B2BIIFixMdstModule_trk.cc:3426
Belle2::cal_scale_error_EXP33_cosmic_mc
static void cal_scale_error_EXP33_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.33 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1605
Belle2::analysis::VertexFitKFit::getVertex
const HepPoint3D getVertex(const int flag=KFitConst::kAfterFit) const
Get a vertex position.
Definition: VertexFitKFit.cc:114
Belle2::SE_Reprocess_Version
static int SE_Reprocess_Version
Reprocess verison used in scale_error()
Definition: B2BIIFixMdstModule_trk.cc:1428
Belle2::EXP49_scale
static const struct cal_scale_error_func_set_t EXP49_scale
Scale error for Exp.49.
Definition: B2BIIFixMdstModule_trk.cc:2566
Belle2::B2BIIFixMdstModule::scale_momenta_set_v1
void scale_momenta_set_v1(const int, const int, const int, double &)
Return scale factors set_v1.
Definition: B2BIIFixMdstModule_trk.cc:521
Belle2::operator==
bool operator==(const DecayNode &node1, const DecayNode &node2)
Compare two Decay Nodes: They are equal if All daughter decay nodes are equal or one of the daughter ...
Definition: DecayNode.cc:50
Belle2::EXP33_scale
static const struct cal_scale_error_func_set_t EXP33_scale
Scale error for Exp.33.
Definition: B2BIIFixMdstModule_trk.cc:2524
Belle2::cal_scale_error_func_t
void(* cal_scale_error_func_t)(double scale[5], const double pt, const double tanl)
Function pointer type.
Definition: B2BIIFixMdstModule_trk.cc:1431
Belle2::cal_scale_error_EXP2527_cosmic_data
static void cal_scale_error_EXP2527_cosmic_data(double scale[5], const double pt, const double)
Scale error for Exp.25-27 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:1891
Belle2::B2BIIFixMdstModule::remove_extra_trk_vee2
int remove_extra_trk_vee2()
Remove extra tracks from Mdst_trk and Mdst_vee2.
Definition: B2BIIFixMdstModule_trk.cc:3240
Belle2::cal_scale_error_EXP6971_cosmic_mc
static void cal_scale_error_EXP6971_cosmic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.69-71 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1851
Belle2::cal_scale_error_func_set_t::m_cosMC
cal_scale_error_func_t m_cosMC
For cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1436
Belle2::cal_scale_error_EXP55_cosmic_data
static void cal_scale_error_EXP55_cosmic_data(double scale[5], double pt, double tanl)
Scale error for Exp.55 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:2096
Belle2::cal_scale_error_EXP37_cosmic_data
static void cal_scale_error_EXP37_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.37 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:1977
Belle2::EXP6971_scale
static const struct cal_scale_error_func_set_t EXP6971_scale
Scale error for Exp.69-71.
Definition: B2BIIFixMdstModule_trk.cc:2602
Belle2::cal_scale_error_func_set_t::m_cosDATA
cal_scale_error_func_t m_cosDATA
For cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:1437
Belle2::cal_scale_error_EXP2527_hadronic_mc
static void cal_scale_error_EXP2527_hadronic_mc(double scale[5], const double pt, const double tanl)
Scale error for Exp.25-27 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2215
Belle2::get_event_id
static void get_event_id(int *no_exp, int *no_run, int *no_evt, int *no_frm, int *expmc)
Get event ID.
Definition: B2BIIFixMdstModule_trk.cc:1462
Belle2::cal_scale_error
static void cal_scale_error(double scale[5], const double pt, const double tanl, const int expmc, const int no_exp, const int no_run)
Calculate scale error.
Definition: B2BIIFixMdstModule_trk.cc:2642
Belle2::recsim_mdst_propgt_
void recsim_mdst_propgt_(float *, float[], float[], float[], float[], float[], int *)
recsim_mdst_propgt from legacy C code
Belle2::B2BIIFixMdstModule::scale_momenta_set_v2
void scale_momenta_set_v2(const int, const int, const int, double &)
Return scale factors set_v2.
Definition: B2BIIFixMdstModule_trk.cc:997
Belle2::EXP47_scale
static const struct cal_scale_error_func_set_t EXP47_scale
Scale error for Exp.47.
Definition: B2BIIFixMdstModule_trk.cc:2560
Belle2::get_scale_error_func_for_exprun
static cal_scale_error_func_set_t get_scale_error_func_for_exprun(const int no_exp, const int)
Get scale error fucntion for different Exp.
Definition: B2BIIFixMdstModule_trk.cc:2617
Belle2::cal_scale_error_EXP55_hadronic_mc
static void cal_scale_error_EXP55_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.55 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2439
Belle2::cal_scale_error_EXP3941_cosmic_data
static void cal_scale_error_EXP3941_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.39-41 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:1993
Belle2::cal_scale_error_EXP35_cosmic_data
static void cal_scale_error_EXP35_cosmic_data(double scale[5], double pt, double tanl)
Scale error for Exp.35 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:1957
Belle2::EXP2527_scale
static const struct cal_scale_error_func_set_t EXP2527_scale
Scale error for Exp.25-27.
Definition: B2BIIFixMdstModule_trk.cc:2512
Belle2::EXP43_scale
static const struct cal_scale_error_func_set_t EXP43_scale
Scale error for Exp.43.
Definition: B2BIIFixMdstModule_trk.cc:2548
Belle2::EXP45_scale
static const struct cal_scale_error_func_set_t EXP45_scale
Scale error for Exp.45.
Definition: B2BIIFixMdstModule_trk.cc:2554
Belle2::B2BIIFixMdstModule::m_reprocess_version
int m_reprocess_version
Reprocess version (=0:old; =1:new)
Definition: B2BIIFixMdstModule.h:168
Belle2::cal_scale_error_EXP43_cosmic_mc
static void cal_scale_error_EXP43_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.43 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1690
Belle2::cal_scale_error_EXP37_cosmic_mc
static void cal_scale_error_EXP37_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.37 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1657
Belle2::EXP67_scale
static const struct cal_scale_error_func_set_t EXP67_scale
Scale error for Exp.67.
Definition: B2BIIFixMdstModule_trk.cc:2596
Belle2::analysis::KFitBase::addTrack
enum KFitError::ECode addTrack(const KFitTrack &kp)
Add a track to the fitter object.
Definition: KFitBase.cc:39
Belle2::cal_scale_error_EXP33_cosmic_data
static void cal_scale_error_EXP33_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.33 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:1927
Belle2::EXP3941_scale
static const struct cal_scale_error_func_set_t EXP3941_scale
Scale error for Exp.39,41.
Definition: B2BIIFixMdstModule_trk.cc:2542
Belle2::analysis::VertexFitKFit::setIpProfile
enum KFitError::ECode setIpProfile(const HepPoint3D &ip, const CLHEP::HepSymMatrix &ipe)
Set an IP-ellipsoid shape for the vertex constraint fit.
Definition: VertexFitKFit.cc:65
Belle2::cal_scale_error_EXP6165_cosmic_data
static void cal_scale_error_EXP6165_cosmic_data(double scale[5], double pt, double tanl)
Scale error for Exp.61-65 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:2119
Belle2::B2BIIFixMdstModule::vee_mass_nofit
double vee_mass_nofit(const Belle::Mdst_vee2 &vee2, float scale=1.0)
Calculates V0 mass with non-constraint fit results.
Definition: B2BIIFixMdstModule_trk.cc:182
Belle2::lambdafunc
double lambdafunc(const double x, const double x1, const double x2, const double yc, const double a1, const double a2, const double a3)
lambdafunc
Definition: B2BIIFixMdstModule_trk.cc:1534
Belle2::cal_scale_error_EXP67_hadronic_mc
static void cal_scale_error_EXP67_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.67 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2471
Belle2::EXP0723_scale
static const struct cal_scale_error_func_set_t EXP0723_scale
Scale error for Exp.7-23.
Definition: B2BIIFixMdstModule_trk.cc:2506
Belle2::cal_scale_error_EXP4547_cosmic_data
static void cal_scale_error_EXP4547_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.45,47 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:2025
Belle2::cal_scale_error_EXP35_hadronic_mc
static void cal_scale_error_EXP35_hadronic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.33,35 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2289
Belle2::cal_scale_error_func_set_t::m_hadMC
cal_scale_error_func_t m_hadMC
For hadronic MC.
Definition: B2BIIFixMdstModule_trk.cc:1435
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::cal_scale_error_EXP0723_cosmic_data
static void cal_scale_error_EXP0723_cosmic_data(double scale[5], const double pt, const double)
Scale error for Exp.7-23 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:1875
Belle2::cal_scale_error_EXP53_hadronic_mc
static void cal_scale_error_EXP53_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.53 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2423
Belle2::cal_scale_error_EXP55_cosmic_mc
static void cal_scale_error_EXP55_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.55 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1786
Belle2::EXP51_scale
static const struct cal_scale_error_func_set_t EXP51_scale
Scale error for Exp.51.
Definition: B2BIIFixMdstModule_trk.cc:2572
Belle2::cal_scale_error_EXP6165_hadronic_mc
static void cal_scale_error_EXP6165_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.61-65 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2455
Belle2::cal_scale_error_EXP49_hadronic_mc
static void cal_scale_error_EXP49_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.49 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2387
Belle2::null_scale
static void null_scale(double[5], double, double)
Dummy function.
Definition: B2BIIFixMdstModule_trk.cc:1452
Belle2::cal_scale_error_EXP53_cosmic_mc
static void cal_scale_error_EXP53_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.53 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1770
Belle2::B2BIIFixMdstModule::m_smear_trk
int m_smear_trk
Do extra-smearing for MC tracks.
Definition: B2BIIFixMdstModule.h:142
Belle2::EXP53_scale
static const struct cal_scale_error_func_set_t EXP53_scale
Scale error for Exp.53.
Definition: B2BIIFixMdstModule_trk.cc:2578
Belle2::cal_scale_error_EXP2527_cosmic_mc
static void cal_scale_error_EXP2527_cosmic_mc(double scale[5], const double pt, const double)
Scale error for Exp.25-27 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1568
Belle2::B2BIIFixMdstModule::scale_error
void scale_error(const int message_level=0)
Apply scale error.
Definition: B2BIIFixMdstModule_trk.cc:2879
Belle2::analysis::VertexFitKFit::doFit
enum KFitError::ECode doFit(void)
Perform a vertex-constraint fit.
Definition: VertexFitKFit.cc:216
Belle2::cal_scale_error_EXP53_cosmic_data
static void cal_scale_error_EXP53_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.53 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:2080
Belle2::EXP55_scale
static const struct cal_scale_error_func_set_t EXP55_scale
Scale error for Exp.55.
Definition: B2BIIFixMdstModule_trk.cc:2584
Belle2::SE_Message_Level
static int SE_Message_Level
Message level of scale_error().
Definition: B2BIIFixMdstModule_trk.cc:1427
Belle2::cal_scale_error_EXP37_hadronic_mc
static void cal_scale_error_EXP37_hadronic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.37 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2300
Belle2::cal_scale_error_EXP45_cosmic_mc
static void cal_scale_error_EXP45_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.45 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1706
Belle2::cal_scale_error_EXP51_cosmic_mc
static void cal_scale_error_EXP51_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.51 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1754
Belle2::cal_scale_error_EXP0723_hadronic_mc
static void cal_scale_error_EXP0723_hadronic_mc(double scale[5], const double pt, const double tanl)
Scale error for Exp.7-23 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2192
Belle2::cal_scale_error_EXP51_cosmic_data
static void cal_scale_error_EXP51_cosmic_data(double scale[5], double pt, double tanl)
Scale error for Exp.51 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:2057
Belle2::smear_charged
static void smear_charged()
Smear tracks in Mdst_Charged.
Definition: B2BIIFixMdstModule_trk.cc:3472
Belle2::cal_scale_error_EXP49_cosmic_mc
static void cal_scale_error_EXP49_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.49 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1738
Belle2::cal_scale_error_EXP51_hadronic_mc
static void cal_scale_error_EXP51_hadronic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.51 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2404
Belle2::cal_scale_error_EXP45_hadronic_mc
static void cal_scale_error_EXP45_hadronic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.45 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2352
Belle2::cal_scale_error_EXP6971_cosmic_data
static void cal_scale_error_EXP6971_cosmic_data(double scale[5], double pt, double tanl)
Scale error for Exp.69,71 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:2168
Belle2::scale_err_ms
static void scale_err_ms(Belle::Mdst_trk_fit &fit, double scale[])
Scale error.
Definition: B2BIIFixMdstModule_trk.cc:3404
Belle2::B2BIIFixMdstModule::set_primary_vertex
int set_primary_vertex(HepPoint3D &v, CLHEP::HepSymMatrix &ve)
Set primary vertex assuming all tracks are pions.
Definition: B2BIIFixMdstModule_trk.cc:2921
Belle2::vfunc
double vfunc(const double x, const double x1, const double yc, const double a1, const double a2)
vfunc
Definition: B2BIIFixMdstModule_trk.cc:1512
HepGeom::Point3D< double >
Belle2::cal_scale_error_EXP31_hadronic_mc
static void cal_scale_error_EXP31_hadronic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.31 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2238
Belle2::is_already_scaled
static bool is_already_scaled(void)
Check if event is already scaled.
Definition: B2BIIFixMdstModule_trk.cc:1479
Belle2::cal_scale_error_EXP31_cosmic_data
static void cal_scale_error_EXP31_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.31 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:1907
Belle2::B2BIIFixMdstModule::scale_momenta_set
void scale_momenta_set(const int, const int, const int, double &)
Return scale factors for 2001 summer confs.
Definition: B2BIIFixMdstModule_trk.cc:399
Belle2::cal_scale_error_EXP0723_cosmic_mc
static void cal_scale_error_EXP0723_cosmic_mc(double scale[5], const double pt, const double)
Scale error for Exp.7-23 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1552
Belle2::B2BIIFixMdstModule::scale_momenta
void scale_momenta(float scale_data=1.0, float scale_mc=1.0, int mode=0)
Scale momenta of Mdst_trk.
Definition: B2BIIFixMdstModule_trk.cc:270
Belle2::analysis::VertexFitKFit::setInitialVertex
enum KFitError::ECode setInitialVertex(const HepPoint3D &v)
Set an initial vertex point for the vertex-vertex constraint fit.
Definition: VertexFitKFit.cc:51
Belle2::cal_scale_error_EXP67_cosmic_mc
static void cal_scale_error_EXP67_cosmic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.67 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1825
Belle2::EXP31_scale
static const struct cal_scale_error_func_set_t EXP31_scale
Scale error for Exp.31.
Definition: B2BIIFixMdstModule_trk.cc:2518
Belle2::B2BIIFixMdstModule::smear_trk
void smear_trk()
Apply track smearing (on MC)
Definition: B2BIIFixMdstModule_trk.cc:3339
Belle2::cal_scale_error_EXP43_cosmic_data
static void cal_scale_error_EXP43_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.43 Cosmic data.
Definition: B2BIIFixMdstModule_trk.cc:2009
Belle2::analysis::VertexFitKFit
VertexFitKFit is a derived class from KFitBase to perform vertex-constraint kinematical fit.
Definition: VertexFitKFit.h:33
Belle2::cal_scale_error_EXP47_hadronic_mc
static void cal_scale_error_EXP47_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.47 Hadron MC.
Definition: B2BIIFixMdstModule_trk.cc:2371
Belle2::cal_scale_error_EXP31_cosmic_mc
static void cal_scale_error_EXP31_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.31 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1584
Belle2::cal_scale_error_EXP6165_cosmic_mc
static void cal_scale_error_EXP6165_cosmic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.61-65 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1802
Belle2::cal_scale_error_EXP35_cosmic_mc
static void cal_scale_error_EXP35_cosmic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.35 Cosmic MC.
Definition: B2BIIFixMdstModule_trk.cc:1636