Belle II Software development
b2bii modules

Classes

class  B2BIIMCParticlesMonitorModule
 Declaration of class B2BIIMCParticlesMonitor. More...
 
class  B2BIIConvertBeamParamsModule
 Convert the IpProfile and Benergy to BeamParameters, BeamSpot, CollisionInvariantMass and CollisionBoostVector. More...
 
class  B2BIIConvertMdstModule
 Module converts Belle MDST objects (Panther records) to Belle II MDST objects. More...
 
class  B2BIIFixMdstModule
 Declaration of class B2BIIFixMdst. More...
 
class  MuidProb
 Class computes probability density for Muid calculation. More...
 
class  B2BIIMdstInputModule
 Module reads Belle MDST files and converts Belle_event record to Belle II EventMetaData StoreObjectPointer. More...
 
struct  cal_scale_error_func_set_t
 Structure type cal_scale_error_func_set_t. More...
 
class  BelleMCOutputModule
 KLM digitization module. More...
 

Macros

#define NOMINAL_ENERGY   5.290024915
 Nomial beam energy.
 

Typedefs

typedef void(* cal_scale_error_func_t) (double scale[5], const double pt, const double tanl)
 Function pointer type.
 

Functions

 REG_MODULE (B2BIIConvertBeamParams)
 Register the module.
 
static double ecl_adhoc_corr (int Exp, int Run, int iflag05th, double Energy, double)
 The function giving correction factor.
 
static double ecl_adhoc_corr_45 (int exp, int, int cid)
 The function giving correction factor in Exp.45.
 
static double ecl_mcx3_corr (int, int, double energy, double)
 Correct energy scale (MC) to make pi0 peak nominal.
 
static double mpi0pdg (double Energy)
 Make MC mass peak to PDG value.
 
static bool operator== (const cal_scale_error_func_set_t &lhs, const cal_scale_error_func_set_t &rhs)
 Operator definition for cal_scale_error_func_set_t.
 
static void null_scale (double[5], double, double)
 Dummy function.
 
static void get_event_id (int *no_exp, int *no_run, int *no_evt, int *no_frm, int *expmc)
 Get event ID.
 
static bool is_already_scaled (void)
 Check if event is already scaled.
 
double vfunc (const double x, const double x1, const double yc, const double a1, const double a2)
 vfunc
 
double cupfunc (const double x, const double x1, const double x2, const double yc, const double a1, const double a2)
 cupfunc
 
double rootfunc (const double x, const double x1, const double x2, const double yc, const double a1, const double a2)
 rootfunc
 
double lambdafunc (const double x, const double x1, const double x2, const double yc, const double a1, const double a2, const double a3)
 lambdafunc
 
static void cal_scale_error_EXP0723_cosmic_mc (double scale[5], const double pt, const double)
 Scale error for Exp.7-23 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.
 
static void cal_scale_error_EXP31_cosmic_mc (double scale[5], double pt, double)
 Scale error for Exp.31 Cosmic MC.
 
static void cal_scale_error_EXP33_cosmic_mc (double scale[5], double pt, double)
 Scale error for Exp.33 Cosmic MC.
 
static void cal_scale_error_EXP35_cosmic_mc (double scale[5], double pt, double tanl)
 Scale error for Exp.35 Cosmic MC.
 
static void cal_scale_error_EXP37_cosmic_mc (double scale[5], double pt, double)
 Scale error for Exp.37 Cosmic MC.
 
static void cal_scale_error_EXP3941_cosmic_mc (double scale[5], double pt, double)
 Scale error for Exp.39,41 Cosmic MC.
 
static void cal_scale_error_EXP43_cosmic_mc (double scale[5], double pt, double)
 Scale error for Exp.43 Cosmic MC.
 
static void cal_scale_error_EXP45_cosmic_mc (double scale[5], double pt, double)
 Scale error for Exp.45 Cosmic MC.
 
static void cal_scale_error_EXP47_cosmic_mc (double scale[5], double pt, double)
 Scale error for Exp.47 Cosmic MC.
 
static void cal_scale_error_EXP49_cosmic_mc (double scale[5], double pt, double)
 Scale error for Exp.49 Cosmic MC.
 
static void cal_scale_error_EXP51_cosmic_mc (double scale[5], double pt, double)
 Scale error for Exp.51 Cosmic MC.
 
static void cal_scale_error_EXP53_cosmic_mc (double scale[5], double pt, double)
 Scale error for Exp.53 Cosmic MC.
 
static void cal_scale_error_EXP55_cosmic_mc (double scale[5], double pt, double)
 Scale error for Exp.55 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.
 
static void cal_scale_error_EXP67_cosmic_mc (double scale[5], double pt, double tanl)
 Scale error for Exp.67 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.
 
static void cal_scale_error_EXP0723_cosmic_data (double scale[5], const double pt, const double)
 Scale error for Exp.7-23 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.
 
static void cal_scale_error_EXP31_cosmic_data (double scale[5], double pt, double)
 Scale error for Exp.31 Cosmic data.
 
static void cal_scale_error_EXP33_cosmic_data (double scale[5], double pt, double)
 Scale error for Exp.33 Cosmic data.
 
static void cal_scale_error_EXP35_cosmic_data (double scale[5], double pt, double tanl)
 Scale error for Exp.35 Cosmic data.
 
static void cal_scale_error_EXP37_cosmic_data (double scale[5], double pt, double)
 Scale error for Exp.37 Cosmic data.
 
static void cal_scale_error_EXP3941_cosmic_data (double scale[5], double pt, double)
 Scale error for Exp.39-41 Cosmic data.
 
static void cal_scale_error_EXP43_cosmic_data (double scale[5], double pt, double)
 Scale error for Exp.43 Cosmic data.
 
static void cal_scale_error_EXP4547_cosmic_data (double scale[5], double pt, double)
 Scale error for Exp.45,47 Cosmic data.
 
static void cal_scale_error_EXP49_cosmic_data (double scale[5], double pt, double)
 Scale error for Exp.49 Cosmic data.
 
static void cal_scale_error_EXP51_cosmic_data (double scale[5], double pt, double tanl)
 Scale error for Exp.51 Cosmic data.
 
static void cal_scale_error_EXP53_cosmic_data (double scale[5], double pt, double)
 Scale error for Exp.53 Cosmic data.
 
static void cal_scale_error_EXP55_cosmic_data (double scale[5], double pt, double tanl)
 Scale error for Exp.55 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.
 
static void cal_scale_error_EXP67_cosmic_data (double scale[5], double pt, double tanl)
 Scale error for Exp.67 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.
 
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.
 
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.
 
static void cal_scale_error_EXP31_hadronic_mc (double scale[5], double pt, double tanl)
 Scale error for Exp.31 Hadron MC.
 
static void cal_scale_error_EXP33_hadronic_mc (double scale[5], double pt, double tanl)
 Scale error for Exp.33,35 Hadron MC.
 
static void cal_scale_error_EXP35_hadronic_mc (double scale[5], double pt, double tanl)
 Scale error for Exp.33,35 Hadron MC.
 
static void cal_scale_error_EXP37_hadronic_mc (double scale[5], double pt, double tanl)
 Scale error for Exp.37 Hadron MC.
 
static void cal_scale_error_EXP3941_hadronic_mc (double scale[5], double pt, double)
 Scale error for Exp.39,41 Hadron MC.
 
static void cal_scale_error_EXP43_hadronic_mc (double scale[5], double pt, double)
 Scale error for Exp.43 Hadron MC.
 
static void cal_scale_error_EXP45_hadronic_mc (double scale[5], double pt, double tanl)
 Scale error for Exp.45 Hadron MC.
 
static void cal_scale_error_EXP47_hadronic_mc (double scale[5], double pt, double)
 Scale error for Exp.47 Hadron MC.
 
static void cal_scale_error_EXP49_hadronic_mc (double scale[5], double pt, double)
 Scale error for Exp.49 Hadron MC.
 
static void cal_scale_error_EXP51_hadronic_mc (double scale[5], double pt, double tanl)
 Scale error for Exp.51 Hadron MC.
 
static void cal_scale_error_EXP53_hadronic_mc (double scale[5], double pt, double)
 Scale error for Exp.53 Hadron MC.
 
static void cal_scale_error_EXP55_hadronic_mc (double scale[5], double pt, double)
 Scale error for Exp.55 Hadron MC.
 
static void cal_scale_error_EXP6165_hadronic_mc (double scale[5], double pt, double)
 Scale error for Exp.61-65 Hadron MC.
 
static void cal_scale_error_EXP67_hadronic_mc (double scale[5], double pt, double)
 Scale error for Exp.67 Hadron MC.
 
static void cal_scale_error_EXP6971_hadronic_mc (double scale[5], double pt, double)
 Scale error for Exp.69,71 Hadron MC.
 
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.
 
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.
 
static int scale_error_impl (const int message_level, const int reprocess_version)
 The implementation of B2BIIFixMdstModule::scale_error()
 
void recsim_mdst_propgt_ (float *, float[], float[], float[], float[], float[], int *)
 recsim_mdst_propgt from legacy C code
 
static void scale_err_ms (Belle::Mdst_trk_fit &fit, const double scale[])
 Scale error.
 
static void smear_trk_ms (Belle::Mdst_trk_fit &fit, const double scale[])
 Smear MC tracks.
 
static void smear_charged ()
 Smear tracks in Mdst_Charged.
 
 B2BIIConvertBeamParamsModule ()
 Create parameters.
 
void initialize () override
 Initialize phanter banks.
 
void beginRun () override
 Set run info in panther and load IPProfile/Benergy and convert the values to payloads.
 
 B2BIIFixMdstModule ()
 Constructor.
 
virtual void initialize () override
 Initialize the module.
 
virtual void terminate () override
 Terminates the module.
 
virtual void event () override
 Called for each event.
 
virtual void beginRun () override
 Called when a new run is started.
 

Variables

static int SE_Message_Level
 Message level of scale_error().
 
static int SE_Reprocess_Version = 0
 Reprocess verison used in scale_error()
 
static const struct cal_scale_error_func_set_t EXP0723_scale
 Scale error for Exp.7-23.
 
static const struct cal_scale_error_func_set_t EXP2527_scale
 Scale error for Exp.25-27.
 
static const struct cal_scale_error_func_set_t EXP31_scale
 Scale error for Exp.31.
 
static const struct cal_scale_error_func_set_t EXP33_scale
 Scale error for Exp.33.
 
static const struct cal_scale_error_func_set_t EXP35_scale
 Scale error for Exp.35.
 
static const struct cal_scale_error_func_set_t EXP37_scale
 Scale error for Exp.37.
 
static const struct cal_scale_error_func_set_t EXP3941_scale
 Scale error for Exp.39,41.
 
static const struct cal_scale_error_func_set_t EXP43_scale
 Scale error for Exp.43.
 
static const struct cal_scale_error_func_set_t EXP45_scale
 Scale error for Exp.45.
 
static const struct cal_scale_error_func_set_t EXP47_scale
 Scale error for Exp.47.
 
static const struct cal_scale_error_func_set_t EXP49_scale
 Scale error for Exp.49.
 
static const struct cal_scale_error_func_set_t EXP51_scale
 Scale error for Exp.51.
 
static const struct cal_scale_error_func_set_t EXP53_scale
 Scale error for Exp.53.
 
static const struct cal_scale_error_func_set_t EXP55_scale
 Scale error for Exp.55.
 
static const struct cal_scale_error_func_set_t EXP6165_scale
 Scale error for Exp.61-65.
 
static const struct cal_scale_error_func_set_t EXP67_scale
 Scale error for Exp.67.
 
static const struct cal_scale_error_func_set_t EXP6971_scale
 Scale error for Exp.69-71.
 
static const struct cal_scale_error_func_set_t DUMMY_scale
 Dummy scale.
 
static double s_benergy_value = NOMINAL_ENERGY
 Beam energy.
 

Muid user parameters (set via basf)

int get_reprocess_version ()
 Get reprocess version of input mdst.
 
bool good_event ()
 Check if event correspondes to the period when Belle detector not in good condition.
 
double Benergy (int expnum=0, int runnum=0)
 Return Beam energy.
 
void fix_pi0_brecon (void)
 Fix relation gamma<->pi0 in brecon table.
 
static double pi0resol (double, double, const char *, bool, int, int)
 Treat pi0 mass width as a func.
 
void correct_ecl (int, int)
 Correct photon's momenta and error matrix.
 
void make_pi0 (int, double, double)
 Create Mdst_pi0 from Mdst_gamma and Mdst_ecl to let people get mass-constraint fitted momentum of pi0 after ad_hoc correction.
 
void make_pi0_primary_vertex (int, double, double, const HepPoint3D &, const CLHEP::HepSymMatrix &)
 Fill Mdst_pi0 based on the fit result.
 
void correct_ecl_primary_vertex (const HepPoint3D &, const CLHEP::HepSymMatrix &)
 Correct ecl using primary vertex.
 
void shift_tof (const int mode)
 Shift tof times to account for residuals.
 
void shift_tof_set (const int expno, const int runno, const int mode, const int im, const double pmom, const double sgn, double &shift)
 Return time shifts for different exp.
 
double vee_mass_nofit (const Belle::Mdst_vee2 &vee2, float scale=1.0)
 Calculates V0 mass with non-constraint fit results.
 
void scale_momenta (float scale_data=1.0, float scale_mc=1.0, int mode=0)
 Scale momenta of Mdst_trk.
 
void scale_momenta_set (const int, const int, const int, double &)
 Return scale factors for 2001 summer confs.
 
void scale_momenta_set_v1 (const int, const int, const int, double &)
 Return scale factors set_v1.
 
void scale_momenta_set_v2 (const int, const int, const int, double &)
 Return scale factors set_v2.
 
void scale_error (const int message_level=0)
 Apply scale error.
 
int set_primary_vertex (HepPoint3D &v, CLHEP::HepSymMatrix &ve)
 Set primary vertex assuming all tracks are pions.
 
int add_extra_trk_vee2 ()
 Add Mdst_trk_extra and Mdst_vee_extra to Mdst_trk and Mdst_vee2, respectively.
 
int remove_extra_trk_vee2 ()
 Remove extra tracks from Mdst_trk and Mdst_vee2.
 
void smear_trk ()
 Apply track smearing (on MC)
 

Detailed Description

Macro Definition Documentation

◆ NOMINAL_ENERGY

#define NOMINAL_ENERGY   5.290024915

Nomial beam energy.

Definition at line 162 of file B2BIIFixMdstModule.cc.

Typedef Documentation

◆ cal_scale_error_func_t

typedef void(* cal_scale_error_func_t) (double scale[5], const double pt, const double tanl)

Function pointer type.

Definition at line 1438 of file B2BIIFixMdstModule_trk.cc.

Function Documentation

◆ add_extra_trk_vee2()

int add_extra_trk_vee2 ( )
private

Add Mdst_trk_extra and Mdst_vee_extra to Mdst_trk and Mdst_vee2, respectively.

Definition at line 3071 of file B2BIIFixMdstModule_trk.cc.

3072 {
3073 Belle::Mdst_event_add_Manager& mevtmgr = Belle::Mdst_event_add_Manager::get_manager();
3074 if (mevtmgr.count() == 0) { // no Belle::Mdst_event_add table
3075 return -2;
3076 } else if (mevtmgr.count() == 1) { // no second entity in Belle::Mdst_event_add table
3077 mevtmgr.add();
3078 }
3079 unsigned flag(mevtmgr[1].flag(0));
3080 if (flag != 0) return -1; // do nothing if already added
3081 Belle::Mdst_trk_extra_Manager& teMgr(Belle::Mdst_trk_extra_Manager::get_manager());
3082 Belle::Mdst_trk_Manager& tMgr(Belle::Mdst_trk_Manager::get_manager());
3083 Belle::Mdst_charged_Manager& chMgr(Belle::Mdst_charged_Manager::get_manager());
3084 const int i_ch(chMgr.count() + 1);
3085 const int i_trk(tMgr.count() + 1);
3086 for (std::vector<Belle::Mdst_trk_extra>::const_iterator i = teMgr.begin();
3087 i != teMgr.end(); ++i) {
3088 Belle::Mdst_trk& trk(tMgr.add());
3089 trk.quality((*i).quality());
3090 for (int j = 0; j < 5; j++) trk.mhyp(j, (*i).mhyp(j));
3091
3092 // Commented out by A. Zupanc: see below
3093 // Belle::Mdst_trk_fit& tf(trk.mhyp(2));
3094 if (!(trk.quality() & 15u)) {
3095 B2FATAL("recsim_mdst_propgt_ is missing");
3096
3097 /*
3098 Commented by A.Zupanc: the recsim_mdst_propgt_ is missing therefore this part of the code
3099 can not be executed
3100
3101 Belle::Mdst_charged& ch(chMgr.add());
3102 ch.charge((tf.helix(2) >= 0) ? 1. : -1.);
3103
3104 float pivot[3], helix[5], error[15], helix0[5], error0[15];
3105 for (int k = 0; k < 3; k++) pivot[k] = tf.pivot(k);
3106 for (int k = 0; k < 5; k++) helix[k] = tf.helix(k);
3107 for (int k = 0; k < 15; k++) error[k] = tf.error(k);
3108
3109 float amass = tf.mass();
3110
3111 // propagate helix to origin
3112 int iret;
3113
3114 //recsim_mdst_propgt_(&amass, pivot, helix, error,
3115 // helix0, error0, &iret);
3116 if (iret == 0) {
3117 ch.px(-sin(helix0[1]) / fabs(helix0[2]));
3118 ch.py(cos(helix0[1]) / fabs(helix0[2]));
3119 ch.pz(helix0[4] / fabs(helix0[2]));
3120 }
3121 ch.mass(amass);
3122 ch.trk(trk);
3123 */
3124 } else {
3125 B2ERROR("Warning from B2BIIFixMdst: strange track in Belle::Mdst_trk_extra: quality="
3126 << trk.quality());
3127 }
3128 }
3129
3130
3131 Belle::Mdst_sim_trk_extra_Manager& steMgr
3132 (Belle::Mdst_sim_trk_extra_Manager::get_manager());
3133 Belle::Mdst_sim_trk_Manager& stMgr(Belle::Mdst_sim_trk_Manager::get_manager());
3134 int ist(0);
3135 for (std::vector<Belle::Mdst_sim_trk_extra>::const_iterator i = steMgr.begin();
3136 i != steMgr.end(); ++i) {
3137 Belle::Mdst_sim_trk& strk(stMgr.add());
3138 int argn = tMgr.count() - teMgr.count() + ist;
3139 if (argn < tMgr.count()) {
3140 strk.trk(tMgr[argn]);
3141 }
3142 ist++;
3143 strk.hepevt((*i).hepevt());
3144 strk.relation(0, (*i).relation(0));
3145 strk.relation(1, (*i).relation(1));
3146 strk.relation(2, (*i).relation(2));
3147 }
3148
3149
3150 Belle::Mdst_svd_hit_extra_Manager& sheMgr
3151 (Belle::Mdst_svd_hit_extra_Manager::get_manager());
3152 Belle::Mdst_svd_hit_Manager& shMgr(Belle::Mdst_svd_hit_Manager::get_manager());
3153 for (std::vector<Belle::Mdst_svd_hit_extra>::iterator it = sheMgr.begin();
3154 it != sheMgr.end(); ++it) {
3155 Belle::Mdst_svd_hit_extra& she = *it;
3156 Belle::Mdst_svd_hit& sh(shMgr.add());
3157 sh.lsa(she.lsa());
3158 sh.width(she.width());
3159 sh.electrons(she.electrons());
3160 sh.dssd(she.dssd());
3161 sh.type(she.type());
3162 int argn = tMgr.count() - teMgr.count() + she.trk().get_ID() - 1;
3163 if (argn < tMgr.count()) {
3164 sh.trk(tMgr[argn]);
3165 }
3166 }
3167
3168
3169 Belle::Mdst_vee2_Manager& vMgr(Belle::Mdst_vee2_Manager::get_manager());
3170 Belle::Mdst_vee2_extra_Manager& veMgr(Belle::Mdst_vee2_extra_Manager::get_manager());
3171 const int i_vee2(vMgr.count() + 1);
3172 for (std::vector<Belle::Mdst_vee2_extra>::const_iterator i = veMgr.begin();
3173 i != veMgr.end(); ++i) {
3174 Belle::Mdst_vee2& vee(vMgr.add());
3175 vee.kind((*i).kind());
3176
3177 if ((*i).extra_ID(0)) {
3178 Belle::Mdst_charged& tmp(chMgr[(*i).extra_ID(0) + i_ch - 2]);
3179 vee.chgd(0, tmp);
3180 } else {
3181 vee.chgd(0, (*i).chgd());
3182 }
3183
3184 if ((*i).extra_ID(1)) {
3185 Belle::Mdst_charged& tmp(chMgr[(*i).extra_ID(1) + i_ch - 2]);
3186 vee.chgd(1, tmp);
3187 } else {
3188 vee.chgd(1, (*i).chgd());
3189 }
3190
3191 vee.px((*i).px());
3192 vee.py((*i).py());
3193 vee.pz((*i).pz());
3194 vee.energy((*i).energy());
3195 vee.vx((*i).vx());
3196 vee.vy((*i).vy());
3197 vee.vz((*i).vz());
3198 vee.z_dist((*i).z_dist());
3199 vee.chisq((*i).chisq());
3200 vee.type((*i).type());
3201 vee.daut((*i).daut());
3202 }
3203 teMgr.remove();
3204 steMgr.remove();
3205 sheMgr.remove();
3206 veMgr.remove();
3207 if (i_ch & 0xffffff00) B2ERROR("Warning from B2BIIFixMdst: overflow! i_ch = " << i_ch);
3208 if (i_trk & 0xffffff00) B2ERROR("Warning from B2BIIFixMdst: overflow! i_trk = " << i_trk);
3209 if (i_vee2 & 0xffffff00) B2ERROR("Warning from B2BIIFixMdst: overflow! i_vee2 = " << i_vee2);
3210 flag = i_ch & 0xff;
3211 flag |= ((i_trk & 0xff) << 8);
3212 flag |= ((i_vee2 & 0xff) << 16);
3213 mevtmgr[1].flag(0, flag);
3214 return (int)flag;
3215 }

◆ B2BIIConvertBeamParamsModule()

Create parameters.

Definition at line 65 of file B2BIIConvertBeamParamsModule.cc.

66 {
67 addParam("mcFlag", m_mcFlag, "which mc flag to use", m_mcFlag);
68 addParam("missingBenergy", m_missingBenergy, "where to store information about runs with missing database info", m_missingBenergy);
69 addParam("missingIp", m_missingIp, "where to store information about runs with missing IP profile info", m_missingIp);
70 addParam("smearEnergy", m_SmearEnergy, "Allow beam energy smearing for MC generation", true);
71 addParam("smearDirection", m_SmearDirection, "Allow beam direction smearing for MC generation", true);
72 addParam("smearVertex", m_SmearVertex, "Allow IP position smearing for MC generation", true);
73 addParam("generateCMS", m_GenerateCMS, "Generate events in CMS, not lab system.", false);
74 addParam("storeBeamParameters", m_storeBeamParameters, "Store the BeamParameters payloads in the localDB", true);
75 addParam("storeCollisionAxisCMS", m_storeCollisionAxisCMS,
76 "Store the CollisionAxisCMS payloads in the localDB",
77 true);
78 addParam("storeCollisionInvariantMass", m_storeCollisionInvariantMass, "Store the CollisionInvariantMass payloads in the localDB",
79 true);
80 addParam("storeCollisionBoostVector", m_storeCollisionBoostVector, "Store the CollisionBoostVector payloads in the localDB", true);
81 addParam("storeBeamSpot", m_storeBeamSpot, "Store the BeamSpot payloads in the localDB", true);
82 }
bool m_SmearDirection
Smear beam direction when generating initial events.
std::string m_missingBenergy
Where to store information about runs without beam energy information.
bool m_storeCollisionAxisCMS
Store the CollisionAxisCMS payloads in the local database.
std::string m_missingIp
Where to store information about runs without IP profile information.
bool m_storeCollisionInvariantMass
Store the CollisionInvariantMass payloads in the local database.
bool m_SmearVertex
Smear vertex position when generating initial events.
bool m_storeBeamParameters
Store the BeamParameters payloads in the local database.
bool m_GenerateCMS
Generate events in CMS, not lab system.
bool m_storeBeamSpot
Store the BeamSpot payloads in the local database.
bool m_SmearEnergy
Smear energy when generating initial events.
bool m_storeCollisionBoostVector
Store the CollisionBoostVector payloads in the local database.
int m_mcFlag
mcFlag to use when getting belle database content
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560

◆ B2BIIFixMdstModule()

Constructor.

Definition at line 166 of file B2BIIFixMdstModule.cc.

166 : Module()
167 {
168
169 setDescription("Used to fix the old Belle I mdst files before processing. This module was taken from the old Belle I code and converted into a basf2 module."
170 "There are a lot of magic numbers in this module, where do they come from? Noone knows..."
171 "Return value is -1 if something went wrong, do not use these events!");
172
173 addParam("Scale_momenta", m_scale_momenta, "Apply scale_momenta", 1);
174 addParam("scale_momenta_scale_data", m_scale_momenta_scale_data, "scale_momenta scale_data", 0.0f);
175 addParam("scale_momenta_scale_mc", m_scale_momenta_scale_mc, "scale_momenta scale_mc", 1.0f);
176 addParam("scale_momenta_mode", m_scale_momenta_mode, "scale_momenta_mode", 2);
177 addParam("Scale_error", m_scale_error, "Apply scale_error", 1);
178
179 addParam("Smear_trk", m_smear_trk, "Do extra-smearing for MC tracks", 2);
181 "1: add to Mdst_charged etc, -1: remove (move to Mdst_*_extra), 0:do nothing", 0);
182
183 addParam("Correct_ecl", m_correct_ecl, "Apply correct_ecl", 1);
184 addParam("Correct_ecl_pv", m_correct_ecl_primary_vertex, "Apply correct_ecl_pv", 0);
185 addParam("Correct_ecl_option", m_correct_ecl_option, "Set correct_ecl option", 0);
186 addParam("Correct_ecl_version", m_correct_ecl_version, "Set correct_ecl version", 2);
187 addParam("Correct_ecl_5s", m_correct_ecl_5s, "Correct_ecl flag for 5S runs", 0); // KM 20080608
188
189 addParam("Make_pi0", m_make_pi0, "Apply make_pi0 (after correct_ecl)", 1);
190 addParam("Make_pi0_pv", m_make_pi0_primary_vertex, "Apply make_pi0_pv (after correct_ecl)", 0);
191 addParam("Make_pi0_option", m_make_pi0_option, "Set make_pi0 option", 0);
192 addParam("Make_pi0_lower_limit", m_make_pi0_lower_limit, "Set make_pi0 lower mass limit", 0.0);
193 addParam("Make_pi0_upper_limit", m_make_pi0_upper_limit, "Set make_pi0 upper mass limit", 0.0);
194
195 addParam("Benergy", m_benergy, "Apply Benergy", 1);
196 addParam("BenergyDB", m_benergy_db, "Apply Benergy from DB or file ", 0);
197 addParam("BenergyMCDB", m_benergy_mcdb, "Apply Benergy from DB or default value in MC", 0);
198
199 addParam("Good_event", m_good_event, "Select good event only", 1);
200 addParam("HadronA", m_hadron_a_only, "Select Hadron A event only", 1);
201 addParam("HadronB", m_hadron_b_only, "Select Hadron B event only", 1);
202 addParam("Level4passed", m_l4passed_only, "Select level4-passed event only", 1);
203
204 addParam("Scale_error_dataset", m_scale_error_dataset_name, "Set scale_error_dataset name", std::string(""));
205 addParam("Calib_dedx", m_calib_dedx, "Do dedx calibration", 1);
206 addParam("Shift_tof_mode", m_shift_tof_mode, "Do tof_correction", 1);
207 addParam("Endcap_MX_layer", m_eklm_max_layer, "Max layer number of KLM endcap", 11);
208 addParam("UseECL", m_use_ecl, "Use (1) or don't use (0) ECL in muid", 0);
209 addParam("ExpNo", m_expno, "Use data's exp # (0) or this value (>0) in muid", 0);
210
211 addParam("Table_size", m_table_size, "Check table sizes", 1);
212 addParam("Limit_mdst_ecl_trk", m_limit_mdst_ecl_trk, "Limit of mdst_ecl_trk table size", 600);
213 addParam("Limit_mdst_klm_cluster_hit", m_limit_mdst_klm_cluster_hit, "Limit of mdst_klm_cluster_hit table size", 450);
214
216 addParam("Reprocess_version", m_reprocess_version_specified, "Specify reprocess version", -1);
217 addParam("5Srun", m_5Srun, "5S,2S,1S run or not", 0);
218 addParam("Check_version_consistency", m_check_version_consistency, "Check consistency betw. env. variable and mdst version", 1);
219 addParam("SaveResultExtraInfo", m_saveResultExtraInfo,
220 "Whether to save result as EventExtraInfo.", false);
221 }
int m_expno
parameter ExpNo: Experiment number for muid (default=0) 0 ==> use experiment number stored in data fi...
std::string m_scale_error_dataset_name
Set scale_error_dataset name.
int m_benergy_db
Apply Benergy from DB or file.
float m_scale_momenta_scale_mc
Set parameter scale_mc for scale_momenta.
bool m_saveResultExtraInfo
Whether to save result as EventExtraInfo.
int m_calib_dedx
Do dedx calibration.
int m_smear_trk
Do extra-smearing for MC tracks.
int m_scale_momenta
Apply scale_momenta.
int m_correct_ecl_option
Apply correct_ecl_option.
int m_use_ecl
parameter UseECL: Use (1) or don't use (0) ECL in muid (default=0)
int m_l4passed_only
Select level4-passed event only.
int m_correct_ecl
Apply correct_ecl.
double m_make_pi0_lower_limit
Set make_pi0 lower mass limit.
int m_make_pi0
Apply make_pi0 (after correct_ecl)
int m_shift_tof_mode
Do tof_correction.
int m_correct_ecl_primary_vertex
Apply correct_ecl_primary_vertex.
int m_reprocess_version_specified
Specify reprocess version.
float m_scale_momenta_scale_data
Set parameter scale_data for scale_momenta.
int m_correct_ecl_version
Apply correct_ecl_version.
int m_scale_error
Apply scale_error.
int m_scale_momenta_mode
Set parameter mode for scale_momenta.
int m_check_version_consistency
Check consistency between environment variable and mdst version.
int m_table_size
Check table sizes.
int m_limit_mdst_ecl_trk
Limit of mdst_ecl_trk table size.
int m_add_or_remove_extra_trk_vee2
(1) to add to Mdst_charged etc, (-1) to remove (move to Mdst_*_extra), (0) do nothing
int m_make_pi0_primary_vertex
Apply make_pi0_primary_vertex (after correct_ecl)
int m_correct_ecl_5s
For run indep.
int m_reprocess_version
Reprocess version (=0:old; =1:new)
int m_limit_mdst_klm_cluster_hit
Limit of mdst_klm_cluster_hit table size.
int m_hadron_b_only
Select Hadron B event only.
int m_good_event
Select good event only.
int m_hadron_a_only
Select Hadron A event only.
int m_benergy_mcdb
Apply Benergy from DB or default value in MC.
double m_make_pi0_upper_limit
Set make_pi0 upper mass limit.
int m_5Srun
5S,2S,1S run or not
int m_eklm_max_layer
parameter Endcap_MX_layer: Max layer # of KLM endcap (default=11) 0 ==> use same value as was used by...
int m_make_pi0_option
Set make_pi0 option.
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
Module()
Constructor.
Definition: Module.cc:30

◆ beginRun() [1/2]

void beginRun ( void  )
overridevirtual

Set run info in panther and load IPProfile/Benergy and convert the values to payloads.

Reimplemented from Module.

Definition at line 90 of file B2BIIConvertBeamParamsModule.cc.

91 {
92 // Fudge a runhead record with all the info we need to be able to get the
93 // Beamenergy/IpProfile from the database
94 BsClrTab(BBS_CLEAR);
95 Belle::Belle_runhead_Manager& runMgr = Belle::Belle_runhead_Manager::get_manager();
96 runMgr.add();
97 Belle::Belle_runhead& runhead = runMgr[0];
98 runhead.ExpMC(m_mcFlag);
99 runhead.ExpNo(m_event->getExperiment());
100 runhead.RunNo(m_event->getRun());
101 B2INFO("Obtaining values for exp " << m_event->getExperiment() << ", run " << m_event->getRun());
102 // and then get the values from the database
103 Belle::BeamEnergy::flag_database(0);
104 Belle::IpProfile::begin_run();
105 Belle::Ip_profile_general_Manager& ipMgr = Belle::Ip_profile_general_Manager::get_manager();
106
107 if (!Belle::BeamEnergy::usable()) {
108 FileSystem::Lock lock(m_missingBenergy);
109 if (!lock.lock()) {
110 B2ERROR("No BeamEnergy for exp " << m_event->getExperiment() << ", run " << m_event->getRun());
111 } else {
112 std::ofstream file(m_missingBenergy.c_str(), std::ios::app);
113 file << m_event->getExperiment() << "," << m_event->getRun() << std::endl;
114 }
115 return;
116 }
117
118 const double Eher = Belle::BeamEnergy::E_HER();
119 const double Eler = Belle::BeamEnergy::E_LER();
120 const double crossingAngle = Belle::BeamEnergy::Cross_angle();
121 const double angleLer = M_PI; //parallel to negative z axis (different from Belle II!)
122 const double angleHer = crossingAngle; //in positive z and x direction, verified to be consistent with Upsilon(4S) momentum
123
124 // Beam energy spread taken from the hard-coded values in the Belle evtgen:
125 // /sw/belle/belle/b20090127_0910/src/util/evtgenutil/basf_if/evtgen.cc
126 // The beam energy spread seems not have been logged in the belle DB at all.
127 // If you are reading this and you know how to access the run-dependent beam energy spread,
128 // please fix this (April 2021)!
129 std::vector<double> covarianceHer = {0.00513 * 0.00513}; // Energy spread only. No idea about the direction spread
130 std::vector<double> covarianceLer = {0.002375 * 0.002375}; // Energy spread only. No idea about the direction spread
131
132 IntervalOfValidity iov(m_event->getExperiment(), m_event->getRun(), m_event->getExperiment(), m_event->getRun());
133
134 BeamParameters beamParams;
135 beamParams.setLER(Eler, angleLer, 0, covarianceLer);
136 beamParams.setHER(Eher, angleHer, 0, covarianceHer);
137
138 // set the flags according to the module settings.
139 int flags = 0;
140 if (m_GenerateCMS)
142 if (m_SmearEnergy)
146 if (m_SmearVertex)
148 beamParams.setGenerationFlags(flags);
149
150 CollisionAxisCMS collisionAxisCMS;
151 CollisionBoostVector collisionBoostVector;
152 CollisionInvariantMass collisionInvM;
153 ROOT::Math::PxPyPzEVector momentumHER = beamParams.getHER();
154 ROOT::Math::PxPyPzEVector cms = momentumHER + beamParams.getLER();
155 ROOT::Math::XYZVector boost = -cms.BoostToCM();
156 ROOT::Math::VectorUtil::boost(momentumHER, boost);
157 double angleXZ = std::atan(momentumHER.X() / momentumHER.Z());
158 double angleYZ = std::atan(momentumHER.Y() / momentumHER.Z());
159 collisionAxisCMS.setAngles(angleXZ, angleYZ, TMatrixTSym<double>(2));
160 collisionAxisCMS.setSpread(TMatrixTSym<double>(2), 0, 0, 0);
161 collisionBoostVector.setBoost(B2Vector3D(boost), TMatrixTSym<double>(3));
162 //note: maybe we could use Belle::BeamEnergy::E_beam_corr(), Belle::BeamEnergy::E_beam_err()
163 collisionInvM.setMass(cms.M(), 0.0, 0.0);
164
165 // Boost vector and invariant mass are not intra-run dependent, store now
168 "CollisionAxisCMS", &collisionAxisCMS, iov);
169 }
172 "CollisionBoostVector", &collisionBoostVector, iov);
173 }
176 "CollisionInvariantMass", &collisionInvM, iov);
177 }
178
179 // and now we continue with the vertex
180 if (!Belle::IpProfile::usable()) {
181 FileSystem::Lock lock(m_missingIp);
182 if (!lock.lock()) {
183 B2ERROR("No IpProfile for exp " << m_event->getExperiment() << ", run " << m_event->getRun());
184 } else {
185 std::ofstream file(m_missingIp.c_str(), std::ios::app);
186 file << m_event->getExperiment() << "," << m_event->getRun() << std::endl;
187 }
188 std::vector<double> covariance; // 0 = no error
189 beamParams.setVertex(ROOT::Math::XYZVector(
190 std::numeric_limits<double>::quiet_NaN(),
191 std::numeric_limits<double>::quiet_NaN(),
192 std::numeric_limits<double>::quiet_NaN()), covariance);
194 Database::Instance().storeData("BeamParameters", &beamParams, iov);
195
196 BeamSpot beamSpot;
197 beamSpot.setIP(
198 TVector3(std::numeric_limits<double>::quiet_NaN(),
199 std::numeric_limits<double>::quiet_NaN(),
200 std::numeric_limits<double>::quiet_NaN()
201 ), TMatrixTSym<double>(3)
202 );
203 if (m_storeBeamSpot) {
204 Database::Instance().storeData("BeamSpot", &beamSpot, iov);
205 B2INFO("No IpProfile, created BeamSpot Payload");
206 }
207 return;
208 }
209
210 int nbins = std::max(ipMgr.count() - 1, 1);
211 B2INFO("exp " << m_event->getExperiment() << ", run " << m_event->getRun() << ": " << nbins << " IpProfile bins");
212
213 // need to keep the objects alive until we created the payloads
214 std::list<BeamParameters> beamparamsList;
215 std::list<BeamSpot> beamspotList;
216 // and we want them to be intra-run dependent
217 std::unique_ptr<EventDependency> beamparams;
218 std::unique_ptr<EventDependency> beamspots;
219
220 Belle::Belle_event_Manager& evtMgr = Belle::Belle_event_Manager::get_manager();
221 if (!evtMgr.count()) evtMgr.add();
222 for (int i = 0; i < nbins; ++i) {
223 int evtNr = i * BIN_EVENTS;
224 // fudge belle event record to get the correct run dependent ip profile
225 Belle::Belle_event& evt = evtMgr[0];
226 evt.ExpMC(m_mcFlag);
227 evt.ExpNo(m_event->getExperiment());
228 evt.RunNo(m_event->getRun());
229 evt.EvtNo(evtNr);
230 Belle::IpProfile::set_evtbin_number();
231 B2ASSERT("something wrong: " << Belle::IpProfile::EvtBinNo() << "!=" << i, Belle::IpProfile::EvtBinNo() == i);
232
233 // and convert
234 HepPoint3D ip = Belle::IpProfile::e_position();
235 HepSymMatrix ipErr = Belle::IpProfile::e_position_err();
236
237 beamParams.setVertex(ROOT::Math::XYZVector(ip.x(), ip.y(), ip.z()));
238 beamParams.setCovVertex(CLHEPtoROOT(ipErr));
239 beamparamsList.emplace_back(beamParams);
240
241 BeamSpot beamSpot;
242 beamSpot.setIP(CLHEPtoROOT(ip), CLHEPtoROOT(ipErr));
243 beamspotList.emplace_back(beamSpot);
244
245 if (!beamparams) {
246 beamparams = std::make_unique<EventDependency>(&beamparamsList.back(), false);
247 beamspots = std::make_unique<EventDependency>(&beamspotList.back(), false);
248 } else {
249 beamparams->add(evtNr, &beamparamsList.back());
250 beamspots->add(evtNr, &beamspotList.back());
251 }
252 }
253 if (beamparamsList.size() < 1) {
254 B2ERROR("Something is wrong with exp " << m_event->getExperiment() << ", run " << m_event->getRun() << ": no bins found");
255 return;
256 }
257 if (beamparamsList.size() == 1) {
258 // just one bin? no need to store event dependency
260 Database::Instance().storeData("BeamParameters", &beamparamsList.back(), iov);
261 if (m_storeBeamSpot)
262 Database::Instance().storeData("BeamSpot", &beamspotList.back(), iov);
263 B2INFO("Created event independent payload");
264 } else {
265 // otherwise store full information
267 Database::Instance().storeData("BeamParameters", beamparams.get(), iov);
268 if (m_storeBeamSpot)
269 Database::Instance().storeData("BeamSpot", beamspots.get(), iov);
270 B2INFO("Created event dependent payload with " << beamparamsList.size() << " entries");
271 }
272 }
StoreObjPtr< EventMetaData > m_event
Event metadata.
@ c_generateCMS
generate initial event in CMS instead of lab
@ c_smearBeamEnergy
smear energy of HER and LER (but not direction)
@ c_smearBeamDirection
smear direction of HER and LER (but not energy)
static Database & Instance()
Instance of a singleton Database.
Definition: Database.cc:42
bool storeData(const std::string &name, TObject *object, const IntervalOfValidity &iov)
Store an object in the database.
Definition: Database.cc:141
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition: B2Vector3.h:516

◆ beginRun() [2/2]

void beginRun ( void  )
overridevirtual

Called when a new run is started.

Reimplemented from Module.

Definition at line 379 of file B2BIIFixMdstModule.cc.

380 {
381
382 if (m_5Srun == 0 && m_correct_ecl_5s == 1) m_5Srun = 1;
383
385 B2INFO("reprocess version= " << m_reprocess_version);
386
387 Belle::IpProfile::begin_run();
388
389 if (m_benergy_db == 0) Belle::BeamEnergy::begin_run();
390
391 Belle::Belle_runhead_Manager& evtmgr = Belle::Belle_runhead_Manager::get_manager();
392 Belle::Belle_runhead_Manager::const_iterator belleevt = evtmgr.begin();
393 if (belleevt != evtmgr.end() && (*belleevt)) {
394 int expmc = belleevt->ExpMC();
395 int exp = belleevt->ExpNo();
396 int run = belleevt->RunNo();
397 //if(m_benergy==1 && expmc==1) s_benergy_value = Benergy(exp, run);
398
399 if (((31 <= exp && exp <= 55) || (69 <= exp && exp <= 73)) && m_check_version_consistency == 1) {
400 char* env = std::getenv("USE_GRAND_REPROCESS_DATA");
401 if ((env && m_reprocess_version == 0) ||
402 (!env && m_reprocess_version == 1)) {
403 B2ERROR("Env. variable USE_GRAND_REPROCESS_DATA and input mdst reprocess version=" << m_reprocess_version <<
404 " (=0:old; =1:new) are inconsistent -> kill the job. Set USE_GRAND_REPROCESS_DATA or input mdst file properly and retry.");
405 exit(-1);
406 }
407 }
408
409 if (m_calib_dedx != 0) {
410 if (expmc == 1 || m_reprocess_version == 0 || m_calib_dedx == -1)
411 Belle::Calib_dEdx_begin_run(m_reprocess_version, m_5Srun);
412 }
413
414 if (m_mapped_expno > 0) Muid_begin_run(expmc, exp, run);
415
416 } else {
417 B2ERROR("[B2BIIFixMdst] Error: Cannot read \"Belle::Belle_RunHead\".");
418 }
419 }
void Muid_begin_run(const int, const int, const int)
Called for each new run.
int m_mapped_expno
Mapped value of m_old_exp_no.
int get_reprocess_version()
Get reprocess version of input mdst.

◆ Benergy()

double Benergy ( int  expnum = 0,
int  runnum = 0 
)
private

Return Beam energy.

Definition at line 540 of file B2BIIFixMdstModule.cc.

541 {
542
543 double energy(NOMINAL_ENERGY);
544 double factor(0.001);
545
546 // if( m_benergy_db == 0 && BsCouTab(BELLE_EVENT) > 0 ){
547 if (m_benergy_db == 0) {
548 Belle::Belle_event_Manager& bevt_mgr = Belle::Belle_event_Manager::get_manager();
549 Belle::Belle_event_Manager::const_iterator bevt = bevt_mgr.begin();
550 if (bevt != bevt_mgr.end() && (*bevt)) {
551 if (bevt->ExpMC() == 1) energy = Belle::BeamEnergy::E_beam2();
552 if (bevt->ExpMC() == 2) {
553 if (m_benergy_mcdb == 0) return energy; //energy = 5.290000;
554 else energy = Belle::BeamEnergy::E_beam2();
555 }
556 return energy;
557 }
558 }
559
560 if ((expnum == 0 || runnum == 0) && BsCouTab(BELLE_EVENT) > 0) {
561 Belle::Belle_event& bevt = Belle::Belle_event_Manager::get_manager()[0];
562 if (bevt.ExpMC() == 1) {
563 expnum = bevt.ExpNo();
564 runnum = bevt.RunNo();
565 }
566 }
567
568 if (expnum == 5) {
569 if (runnum >= 74 && runnum <= 472) energy += -0.540 * factor;
570 } else if (expnum == 7) {
571 if (runnum >= 6 && runnum <= 475) energy += 0.305 * factor;
572 else if (runnum >= 538 && runnum <= 895) energy += -1.016 * factor;
573 else if (runnum >= 904 && runnum <= 1079) energy += -1.065 * factor;
574 else if (runnum >= 1101 && runnum <= 1248) energy += -0.608 * factor;
575 else if (runnum >= 1257 && runnum <= 1399) energy += -1.132 * factor;
576 else if (runnum >= 1400 && runnum <= 1599) energy += -1.446 * factor;
577 else if (runnum >= 1600 && runnum <= 1799) energy += -1.836 * factor;
578 else if (runnum >= 1800 && runnum <= 1999) energy += -1.829 * factor;
579 else if (runnum >= 2000 && runnum <= 2156) energy += -1.732 * factor;
580 else if (runnum >= 2294 && runnum <= 2599) energy += -2.318 * factor;
581 else if (runnum >= 2600 && runnum <= 2865) energy += -1.363 * factor;
582 } else if (expnum == 9) {
583 if (runnum >= 17 && runnum <= 399) energy += -2.767 * factor;
584 else if (runnum >= 400 && runnum <= 499) energy += -2.826 * factor;
585 else if (runnum >= 500 && runnum <= 593) energy += -2.311 * factor;
586 else if (runnum >= 601 && runnum <= 699) energy += -2.138 * factor;
587 else if (runnum >= 700 && runnum <= 899) energy += -2.267 * factor;
588 else if (runnum >= 900 && runnum <= 999) energy += -2.412 * factor;
589 else if (runnum >= 1000 && runnum <= 1099) energy += -2.229 * factor;
590 else if (runnum >= 1100 && runnum <= 1220) energy += -1.842 * factor;
591 //new(2001/06/23)
592 } else if (expnum == 11) {
593 if (runnum >= 1 && runnum <= 161) energy += -2.173 * factor;
594 if (runnum >= 261 && runnum <= 399) energy += -1.392 * factor;
595 if (runnum >= 400 && runnum <= 499) energy += -1.321 * factor;
596 if (runnum >= 500 && runnum <= 599) energy += -1.394 * factor;
597 if (runnum >= 600 && runnum <= 699) energy += -1.827 * factor;
598 if (runnum >= 700 && runnum <= 799) energy += -1.912 * factor;
599 if (runnum >= 800 && runnum <= 899) energy += -1.603 * factor;
600 if (runnum >= 900 && runnum <= 998) energy += -1.759 * factor;
601 if (runnum >= 1001 && runnum <= 1099) energy += -1.915 * factor;
602 if (runnum >= 1100 && runnum <= 1199) energy += -1.513 * factor;
603 if (runnum >= 1200 && runnum <= 1287) energy += -0.639 * factor;
604 } else if (expnum == 13) {
605 if (runnum >= 1 && runnum <= 99) energy += 0.279 * factor;
606 if (runnum >= 100 && runnum <= 198) energy += 0.140 * factor;
607 if (runnum >= 200 && runnum <= 297) energy += -0.095 * factor;
608 if (runnum >= 301 && runnum <= 440) energy += 0.232 * factor;
609 if (runnum >= 551 && runnum <= 699) energy += -0.385 * factor;
610 if (runnum >= 700 && runnum <= 799) energy += -0.654 * factor;
611 if (runnum >= 800 && runnum <= 899) energy += -0.972 * factor;
612 if (runnum >= 900 && runnum <= 999) energy += -0.770 * factor;
613 if (runnum >= 1000 && runnum <= 1099) energy += -0.353 * factor;
614 if (runnum >= 1100 && runnum <= 1199) energy += -0.490 * factor;
615 if (runnum >= 1200 && runnum <= 1299) energy += -0.687 * factor;
616 if (runnum >= 1300 && runnum <= 1399) energy += -0.545 * factor;
617 //if ( runnum >=1400 && runnum <=1523 ) energy += -0.783*factor;
618 if (runnum >= 1400) energy += -0.783 * factor;
619 // there isn't sufficient amount of data between 1589..1623 (0.1 fb-1),
620 // so we decided to take the value of last run range, which should be
621 // better than 0 correction. (c.f. dcpvrare_ml:0146 and 0147)
622
623 } else if (expnum == 15) {
624 // // new February 15, 2002
625 // if(runnum < 764 ) energy = 5.288103;
626 // if(runnum > 763 && runnum < 951 ) energy = 5.286505;
627 // if(runnum > 950 ) energy = 5.287404;
628 // new February 20, 2002
629 if (runnum < 764) energy = 5.288103;
630 if (runnum > 763 && runnum < 951) energy = 5.287005;
631 if (runnum > 950 && runnum < 1251) energy = 5.287804;
632 if (runnum > 1250) energy = 5.288603;
633
634 } else if (expnum == 17) {
635 if (runnum <= 199) energy = 5.288702;
636 if (runnum >= 200 && runnum <= 399) energy = 5.289202;
637 if (runnum >= 400 && runnum <= 485) energy = 5.289401;
638 if (runnum >= 545 && runnum <= 799) energy = 5.289501;
639 if (runnum >= 800 && runnum <= 937) energy = 5.289401;
640
641 } else if (expnum == 19) {
642 if (runnum >= 64 && runnum <= 199) energy = 5.2887023;
643 if (runnum >= 200 && runnum <= 299) energy = 5.2886025;
644 if (runnum >= 300 && runnum <= 399) energy = 5.28830299;
645 if (runnum >= 400 && runnum <= 459) energy = 5.28820313;
646 if (runnum >= 461 && runnum <= 599) energy = 5.28830299;
647 if (runnum >= 600 && runnum <= 666) energy = 5.28780366;
648 if (runnum >= 763 && runnum <= 999) energy = 5.28820313;
649 if (runnum >= 1000 && runnum <= 1099) energy = 5.28780366;
650 if (runnum >= 1100 && runnum <= 1199) energy = 5.28770378;
651 if (runnum >= 1200 && runnum <= 1399) energy = 5.28750402;
652 if (runnum >= 1400 && runnum <= 1499) energy = 5.28740413;
653 if (runnum >= 1500 && runnum <= 1599) energy = 5.28720434;
654 if (runnum >= 1600 && runnum <= 1643) energy = 5.28760390;
655
656
657 // Dec 28th, 2002
658
659 } else if (expnum == 21) {
660 if (runnum >= 0 && runnum <= 180) energy = 5.28650496;
661 if (runnum >= 181 && runnum <= 324) energy = 5.2880034;
662 } else if (expnum == 23) {
663 if (runnum >= 0 && runnum <= 238) energy = 5.28860254;
664 if (runnum >= 357 && runnum <= 607) energy = 5.28880222;
665
666 //May 31st, 2003
667
668 } else if (expnum == 25) {
669 if (runnum >= 0 && runnum <= 99) energy = 5.28950099;
670 if (runnum >= 100 && runnum <= 199) energy = 5.28870238;
671 if (runnum >= 200 && runnum <= 299) energy = 5.28910171;
672 if (runnum >= 300 && runnum <= 399) energy = 5.28890205;
673 if (runnum >= 400 && runnum <= 799) energy = 5.28850269;
674 if (runnum >= 800 && runnum <= 899) energy = 5.28790353;
675 if (runnum >= 900 && runnum <= 999) energy = 5.28810326;
676 if (runnum >= 1000 && runnum <= 1099) energy = 5.28830298;
677 if (runnum >= 1100 && runnum <= 1199) energy = 5.28820313;
678 if (runnum >= 1200 && runnum <= 1299) energy = 5.28780366;
679 if (runnum >= 1300 && runnum <= 1462) energy = 5.28820313;
680 if (runnum >= 1600 && runnum <= 1699) energy = 5.28830299;
681 if (runnum >= 1700 && runnum <= 1799) energy = 5.28780366;
682 if (runnum >= 1800 && runnum <= 1899) energy = 5.28810327;
683 if (runnum >= 1900 && runnum <= 2122) energy = 5.28830299;
684
685 //June 30th , 2003
686
687 } else if (expnum == 27) {
688 if (runnum >= 0 && runnum <= 180) energy = 5.28860254;
689 if (runnum >= 181 && runnum <= 288) energy = 5.28870238;
690 if (runnum >= 367 && runnum <= 499) energy = 5.28880222;
691 if (runnum >= 500 && runnum <= 590) energy = 5.28890206;
692 if (runnum >= 591 && runnum <= 699) energy = 5.28910172;
693 if (runnum >= 700 && runnum <= 1079) energy = 5.28900189;
694 if (runnum >= 1252 && runnum <= 1299) energy = 5.28850269;
695 if (runnum >= 1300 && runnum <= 1632) energy = 5.28870238;
696
697 //March 9th , 2004
698
699 } else if (expnum == 31) {
700 if (runnum >= 0 && runnum <= 166) energy = 5.287404131;
701 if (runnum >= 231 && runnum <= 470) energy = 5.287903534;
702 if (runnum >= 471 && runnum <= 698) energy = 5.28810327;
703 if (runnum >= 699 && runnum <= 804) energy = 5.288602541;
704 if (runnum >= 805 && runnum <= 936) energy = 5.288702384;
705 if (runnum >= 1071 && runnum <= 1440) energy = 5.288902;
706 if (runnum >= 1441 && runnum <= 1715) energy = 5.289301;
707
708 } else if (expnum >= 32) {
709 B2ERROR("Warning: Benergy is not ready for exp >=32.");
710 }
711 return energy;
712 }
#define NOMINAL_ENERGY
Nomial beam energy.

◆ 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 
)
static

Calculate scale error.

Definition at line 2648 of file B2BIIFixMdstModule_trk.cc.

2652 {
2653 double scale_error_hadronic_mc[5] = {1.0, 1.0, 1.0, 1.0, 1.0};
2654 double scale_error_cosmic_mc[5] = {1.0, 1.0, 1.0, 1.0, 1.0};
2655 double scale_error_cosmic_data[5] = {1.0, 1.0, 1.0, 1.0, 1.0};
2656
2657
2658 struct cal_scale_error_func_set_t cal_func = get_scale_error_func_for_exprun(no_exp, no_run);
2659 if (cal_func == DUMMY_scale) {
2660 B2ERROR("!!!! scale_error: FATAL: FATAL ERROR occured. Abort !!!!");
2661 // Scale error is not prepared for this EXP number!
2662 assert(0);
2663 }
2664
2665
2666 static bool first = true;
2667 static int belle_scale_error_debug_mode = 0;
2668 if (first) {
2669 first = false;
2670 char* belle_scale_error_debug = getenv("BELLE_SCALE_ERROR_DEBUG");
2671 // one of NULL, "none", "cosmic_mc", "cosmic_data", "hadronic_mc"
2672
2673 if (!belle_scale_error_debug)
2674 belle_scale_error_debug_mode = 0;
2675 else if (!strcasecmp(belle_scale_error_debug, "none"))
2676 belle_scale_error_debug_mode = 1;
2677 else if (!strcasecmp(belle_scale_error_debug, "cosmic_mc"))
2678 belle_scale_error_debug_mode = 2;
2679 else if (!strcasecmp(belle_scale_error_debug, "cosmic_data"))
2680 belle_scale_error_debug_mode = 3;
2681 else if (!strcasecmp(belle_scale_error_debug, "hadron_mc") || !strcasecmp(belle_scale_error_debug, "hadronic_mc"))
2682 belle_scale_error_debug_mode = 4;
2683 else {
2684 B2ERROR("BELLE_SCALE_ERROR_DEBUG=" << belle_scale_error_debug << ": bad directive");
2685 assert(0);
2686 }
2687
2688 if (belle_scale_error_debug)
2689 B2ERROR("BELLE_SCALE_ERROR_DEBUG=" << belle_scale_error_debug << ": applied");
2690 }
2691
2692
2693 switch (belle_scale_error_debug_mode) {
2694 case 0:
2695 (cal_func.m_hadMC)(scale_error_hadronic_mc, pt, tanl);
2696 if (expmc == 1) { // Experiment
2697 if (SE_Message_Level >= 2) B2ERROR("scale_error: info: scale on real data");
2698 (cal_func.m_cosMC)(scale_error_cosmic_mc, pt, tanl);
2699 (cal_func.m_cosDATA)(scale_error_cosmic_data, pt, tanl);
2700 } else {
2701 if (SE_Message_Level >= 2) B2ERROR("scale_error: info: scale on MC data");
2702 }
2703 break;
2704
2705 case 1:
2706 //1;
2707 break;
2708
2709 case 2:
2710 (cal_func.m_cosMC)(scale_error_hadronic_mc, pt, tanl);
2711 break;
2712
2713 case 3:
2714 (cal_func.m_cosDATA)(scale_error_hadronic_mc, pt, tanl);
2715 break;
2716
2717 case 4:
2718 (cal_func.m_hadMC)(scale_error_hadronic_mc, pt, tanl);
2719 break;
2720 }
2721
2722
2723 /* compute scaling factor */
2724 for (int i = 0; i < 5; i++)
2725 scale[i] = scale_error_hadronic_mc[i] * scale_error_cosmic_data[i] / scale_error_cosmic_mc[i];
2726
2727
2728 /* message out */
2729 if (SE_Message_Level >= 2) {
2730 B2ERROR("scale_error: info: hadronic MC: "
2731 << scale_error_hadronic_mc[0] << " " << scale_error_hadronic_mc[1] << " "
2732 << scale_error_hadronic_mc[2] << " " << scale_error_hadronic_mc[3] << " "
2733 << scale_error_hadronic_mc[4]);
2734
2735 B2ERROR("scale_error: info: cosmic MC: "
2736 << scale_error_cosmic_mc[0] << " " << scale_error_cosmic_mc[1] << " "
2737 << scale_error_cosmic_mc[2] << " " << scale_error_cosmic_mc[3] << " "
2738 << scale_error_cosmic_mc[4]);
2739
2740 B2ERROR("scale_error: info: cosmic data: "
2741 << scale_error_cosmic_data[0] << " " << scale_error_cosmic_data[1] << " "
2742 << scale_error_cosmic_data[2] << " " << scale_error_cosmic_data[3] << " "
2743 << scale_error_cosmic_data[4]);
2744
2745 B2ERROR("scale_error: info: final scale: "
2746 << scale[0] << " " << scale[1] << " " << scale[2] << " "
2747 << scale[3] << " " << scale[4]);
2748 }
2749 /* check parameter limit */
2750 const double scale_lo = 0.5, scale_hi = 4.0;
2751 bool too_lo = false, too_hi = false;
2752 for (int i = 0; i < 5; i++) {
2753 if (scale[i] < scale_lo) { scale[i] = scale_lo; too_lo = true;}
2754 if (scale[i] > scale_hi) { scale[i] = scale_hi; too_hi = true;}
2755 }
2756
2757 if (SE_Message_Level >= 1 && (too_lo || too_hi)) {
2758 B2ERROR("scale_error: warning: scale factor beyond the limit: "
2759 << scale_error_hadronic_mc[0] * scale_error_cosmic_data[0] / scale_error_cosmic_mc[0] << " "
2760 << scale_error_hadronic_mc[1] * scale_error_cosmic_data[1] / scale_error_cosmic_mc[1] << " "
2761 << scale_error_hadronic_mc[2] * scale_error_cosmic_data[2] / scale_error_cosmic_mc[2] << " "
2762 << scale_error_hadronic_mc[3] * scale_error_cosmic_data[3] / scale_error_cosmic_mc[3] << " "
2763 << scale_error_hadronic_mc[4] * scale_error_cosmic_data[4] / scale_error_cosmic_mc[4]);
2764 }
2765 }
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.

◆ cal_scale_error_EXP0723_cosmic_data()

static void cal_scale_error_EXP0723_cosmic_data ( double  scale[5],
const double  pt,
const double   
)
static

Scale error for Exp.7-23 Cosmic data.

Definition at line 1882 of file B2BIIFixMdstModule_trk.cc.

1883 {
1884 // pt
1885 scale[0] = +1.1280E+00 - 7.6839E-03 * pt;
1886 scale[1] = +1.1368E+00 + 2.8106E-02 * pt;
1887 scale[2] = +7.6448E-01 + 1.1248E-01 * pt;
1888 scale[3] = +1.1396E+00 - 3.6738E-02 * pt;
1889 scale[4] = +1.1766E+00 - 2.7477E-02 * pt;
1890 }

◆ cal_scale_error_EXP0723_cosmic_mc()

static void cal_scale_error_EXP0723_cosmic_mc ( double  scale[5],
const double  pt,
const double   
)
static

Scale error for Exp.7-23 Cosmic MC.

Definition at line 1559 of file B2BIIFixMdstModule_trk.cc.

1560 {
1561 // pt
1562 scale[0] = +1.0115E+00 - 3.6966E-02 * pt;
1563 scale[1] = +9.8369E-01 + 3.2783E-02 * pt;
1564 scale[2] = +6.8401E-01 + 1.0190E-01 * pt;
1565 scale[3] = +1.0968E+00 - 3.3011E-02 * pt;
1566 scale[4] = +1.0992E+00 - 2.7929E-02 * pt;
1567 }

◆ cal_scale_error_EXP0723_hadronic_mc()

static void cal_scale_error_EXP0723_hadronic_mc ( double  scale[5],
const double  pt,
const double  tanl 
)
static

Scale error for Exp.7-23 Hadron MC.

Definition at line 2199 of file B2BIIFixMdstModule_trk.cc.

2200 {
2201 // pt
2202 scale[0] = vfunc(pt, 0.34602, 1.0605, -0.36011, 0.38189E-01);
2203 scale[1] = 1.0612;
2204 scale[2] = cupfunc(pt, 0.44599, 1.2989, 0.85646, -0.73968, 0.17425);
2205 scale[3] = 1.1460 - 0.57101E-01 * pt;
2206 scale[4] = 1.0859;
2207
2208 // tanl
2209 scale[0] *= +1.0122E+00 + 1.3568E-04 * tanl + 1.9856E-02 * tanl * tanl;
2210 scale[1] *= +1.0002E+00 - 4.5128E-03 * tanl + 1.6211E-02 * tanl * tanl;
2211 scale[2] *= +9.7051E-01 + 2.6876E-02 * tanl + 8.2365E-02 * tanl * tanl;
2212 scale[3] *= +9.7198E-01 + 3.8373E-02 * tanl + 4.9111E-02 * tanl * tanl;
2213 scale[4] *= +9.8880E-01 + 2.2090E-02 * tanl + 2.2701E-02 * tanl * tanl;
2214 }
double vfunc(const double x, const double x1, const double yc, const double a1, const double a2)
vfunc
double cupfunc(const double x, const double x1, const double x2, const double yc, const double a1, const double a2)
cupfunc

◆ cal_scale_error_EXP2527_cosmic_data()

static void cal_scale_error_EXP2527_cosmic_data ( double  scale[5],
const double  pt,
const double   
)
static

Scale error for Exp.25-27 Cosmic data.

Definition at line 1898 of file B2BIIFixMdstModule_trk.cc.

1899 {
1900 // pt
1901 scale[0] = +1.1002E+00 + 3.9852E-02 * pt;
1902 scale[1] = rootfunc(pt, 1.0015, 1.6591, 1.0420, -0.31809, 0.17149);
1903 scale[2] = +8.4706E-01 + 0.8914E-01 * pt;
1904 scale[3] = +1.1067E+00 + 1.0304E-02 * pt;
1905 scale[4] = +1.0495E+00 + 3.9923E-02 * pt;
1906 }
double rootfunc(const double x, const double x1, const double x2, const double yc, const double a1, const double a2)
rootfunc

◆ cal_scale_error_EXP2527_cosmic_mc()

static void cal_scale_error_EXP2527_cosmic_mc ( double  scale[5],
const double  pt,
const double   
)
static

Scale error for Exp.25-27 Cosmic MC.

Definition at line 1575 of file B2BIIFixMdstModule_trk.cc.

1576 {
1577 // pt
1578 scale[0] = +1.0257E+00 - 0.30671E-01 * pt;
1579 scale[1] = +1.0503E+00 + 0.97257E-02 * pt;
1580 scale[2] = +0.70751E+00 + 0.93039E-01 * pt;
1581 scale[3] = +1.0720E+00 - 0.15976E-01 * pt;
1582 scale[4] = +1.0530E+00 + 0.63696E-02 * pt;
1583 }

◆ cal_scale_error_EXP2527_hadronic_mc()

static void cal_scale_error_EXP2527_hadronic_mc ( double  scale[5],
const double  pt,
const double  tanl 
)
static

Scale error for Exp.25-27 Hadron MC.

Definition at line 2222 of file B2BIIFixMdstModule_trk.cc.

2223 {
2224 // pt
2225 scale[0] = 1.092E+00 - 0.86138E-01 * pt;
2226 scale[1] = 1.0448E+00 - 0.26158E-01 * pt;
2227 scale[2] = 1.1942E+00 - 1.0025E+00 * pt + 0.85334 * pt * pt - 0.20305 * pt * pt * pt;
2228 scale[3] = 1.1260E+00 - 0.46048E-01 * pt;
2229 scale[4] = 1.0378E+00 + 0.5109E-01 * pt;
2230
2231 // tanl
2232 scale[0] *= +1.0136E+00 + 0.15293E-01 * tanl;
2233 scale[1] *= +0.9936E+00 + 0.71983E-02 * tanl + 0.14004E-01 * tanl * tanl;
2234 scale[2] *= +0.97532E+00 + 0.22718E-01 * tanl + 0.73556E-01 * tanl * tanl;
2235 scale[3] *= vfunc(tanl, -0.26650, 0.92765, -0.13393, 0.11704);
2236 scale[4] *= +0.98203E+00 + 0.21612E-01 * tanl + 0.32751E-01 * tanl * tanl;
2237 }

◆ cal_scale_error_EXP31_cosmic_data()

static void cal_scale_error_EXP31_cosmic_data ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.31 Cosmic data.

Definition at line 1914 of file B2BIIFixMdstModule_trk.cc.

1915 {
1916 // pt
1917 scale[0] = 1.1908 + 0.20678E-02 * pt;
1918 scale[1] = 1.0304 + 0.54826E-01 * pt;
1919 scale[2] = 1.0806 + 0.33829E-01 * pt;
1920 scale[3] = 1.1325 - 0.34811E-01 * pt;
1921 scale[4] = 1.1549 - 0.20974E-01 * pt;
1922 }

◆ cal_scale_error_EXP31_cosmic_mc()

static void cal_scale_error_EXP31_cosmic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.31 Cosmic MC.

Definition at line 1591 of file B2BIIFixMdstModule_trk.cc.

1592 {
1593 // pt
1594 scale[0] = 1.0874 - 0.26640E-01 * pt;
1595 scale[1] = 1.0320 + 0.18869E-01 * pt;
1596 scale[2] = 0.75302 + 0.89109E-01 * pt;
1597 scale[3] = 1.1435 - 0.73830E-01 * pt;
1598 scale[4] = 1.1227 - 0.19112E-01 * pt;
1599 }

◆ cal_scale_error_EXP31_hadronic_mc()

static void cal_scale_error_EXP31_hadronic_mc ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.31 Hadron MC.

Definition at line 2245 of file B2BIIFixMdstModule_trk.cc.

2246 {
2247 // pt
2248 scale[0] = 1.2619 - 0.11170 * pt;
2249 scale[1] = 1.2263 - 0.24619E-01 * pt;
2250 scale[2] = vfunc(pt, 1.1432, 0.87555, -0.24211, 0.10876);
2251 scale[3] = 1.3254 - 0.21162 * pt;
2252 scale[4] = 1.1609 + 0.73808E-02 * pt;
2253
2254 // tanl
2255 scale[3] *= vfunc(tanl, -0.12026, 0.95892, -0.71461E-01, 0.69535E-01);
2256 }

◆ cal_scale_error_EXP33_cosmic_data()

static void cal_scale_error_EXP33_cosmic_data ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.33 Cosmic data.

Definition at line 1934 of file B2BIIFixMdstModule_trk.cc.

1935 {
1936 if (SE_Reprocess_Version == 0) {
1937 // pt
1938 scale[0] = 1.2175 + 0.14290E-01 * pt;
1939 scale[1] = 1.0362 + 0.80614E-01 * pt;
1940 scale[2] = 1.0313 + 0.12930E-01 * pt;
1941 scale[3] = 1.0411 + 0.17319E-01 * pt;
1942 scale[4] = 1.0445 + 0.27526E-01 * pt;
1943 } else {
1944 // pt
1945 scale[0] = 1.2712 - 0.42098E-01 * pt;
1946 scale[1] = 1.0634 - 0.13652E-01 * pt;
1947 scale[2] = 0.95435 + 0.64895E-01 * pt;
1948 scale[3] = 1.0758 + 0.10778E-01 * pt;
1949 scale[4] = 1.0892 - 0.75700E-02 * pt;
1950 }
1951 }

◆ cal_scale_error_EXP33_cosmic_mc()

static void cal_scale_error_EXP33_cosmic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.33 Cosmic MC.

Definition at line 1612 of file B2BIIFixMdstModule_trk.cc.

1613 {
1614 if (SE_Reprocess_Version == 0) {
1615 // pt
1616 scale[0] = 1.1197 - 0.15104E-01 * pt;
1617 scale[1] = 1.0502 + 0.22138E-01 * pt;
1618 scale[2] = 0.75267 + 0.85377E-01 * pt;
1619 // Change to linear fit for robustness (Jul. 07th, 2004. KUSAKA Akito)
1620 // scale[3] = 1.3726 +(-0.31170 + 0.74074E-01*pt)*pt;
1621 scale[3] = 1.1608 - 0.43478E-01 * pt;
1622 scale[4] = 1.0936 + 0.18447E-01 * pt;
1623 } else {
1624 // pt
1625 scale[0] = 0.98971 - 0.12162E-01 * pt;
1626 scale[1] = 1.0132 + 0.22283E-01 * pt;
1627 scale[2] = 0.74947 + 0.81233E-01 * pt;
1628 scale[3] = 1.0601 - 0.54626E-01 * pt;
1629 scale[4] = 1.0454 - 0.33036E-02 * pt;
1630 }
1631 }

◆ cal_scale_error_EXP33_hadronic_mc()

static void cal_scale_error_EXP33_hadronic_mc ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.33,35 Hadron MC.

Definition at line 2266 of file B2BIIFixMdstModule_trk.cc.

2267 {
2268 if (SE_Reprocess_Version == 0) {
2269 // pt
2270 scale[0] = 1.3083 - 0.10894 * pt;
2271 scale[1] = 1.2471 - 0.30959E-01 * pt;
2272 // scale[2] = 0.94594 -0.21216E-01*pt;
2273 scale[2] = vfunc(pt, 0.79736, 0.90954, -0.45673, 0.37072E-02);
2274 scale[3] = 1.3307 - 0.17559 * pt;
2275 scale[4] = 1.2408 - 0.29914E-01 * pt;
2276
2277 // tanl
2278 // scale[3] *= 0.95593 + (0.39351E-01 + 0.10450*tanl)*tanl;
2279 scale[3] *= vfunc(tanl, -0.63864E-01, 0.95936, -0.11035, 0.10057);
2280 } else {
2281 // pt
2282 scale[0] = vfunc(pt, 1.4506, 1.0599, -0.10534, -0.14118);
2283 scale[1] = lambdafunc(pt, 0.23691, 0.47860, 1.1996, -0.39938E-01, 0.23518, -0.62661E-01);
2284 scale[2] = lambdafunc(pt, 0.45865, 0.92603, 0.95622, -0.51715, -0.12868, 0.45187E-01);
2285 scale[3] = 1.2555 - 0.19038 * pt;
2286 scale[4] = vfunc(pt, 0.68946, 1.1772, 0.15927, -0.79017E-01);
2287 }
2288 }
double lambdafunc(const double x, const double x1, const double x2, const double yc, const double a1, const double a2, const double a3)
lambdafunc

◆ cal_scale_error_EXP35_cosmic_data()

static void cal_scale_error_EXP35_cosmic_data ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.35 Cosmic data.

Definition at line 1964 of file B2BIIFixMdstModule_trk.cc.

1965 {
1966 if (SE_Reprocess_Version == 0) {
1967 // pt
1968 scale[0] = 1.1084 + 0.45825E-01 * pt;
1969 scale[1] = 1.1014 + 0.14211E-01 * pt;
1970 scale[2] = 0.99716 + 0.52509E-01 * pt;
1971 scale[3] = 1.1361 - 0.25355E-01 * pt;
1972 scale[4] = 1.1079 - 0.92563E-02 * pt;
1973 } else {
1974 cal_scale_error_EXP33_cosmic_data(scale, pt, tanl);
1975 }
1976 }
static void cal_scale_error_EXP33_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.33 Cosmic data.

◆ cal_scale_error_EXP35_cosmic_mc()

static void cal_scale_error_EXP35_cosmic_mc ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.35 Cosmic MC.

Definition at line 1643 of file B2BIIFixMdstModule_trk.cc.

1644 {
1645 if (SE_Reprocess_Version == 0) {
1646 // pt
1647 scale[0] = 1.0835 + 0.79781E-02 * pt;
1648 scale[1] = 1.0685 + 0.13339E-01 * pt;
1649 scale[2] = 0.72615 + 0.96936E-01 * pt;
1650 scale[3] = 1.1298 - 0.35734E-01 * pt;
1651 scale[4] = 1.0994 + 0.13150E-01 * pt;
1652 } else {
1653 // pt
1654 cal_scale_error_EXP33_cosmic_mc(scale, pt, tanl);
1655 }
1656 }
static void cal_scale_error_EXP33_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.33 Cosmic MC.

◆ cal_scale_error_EXP35_hadronic_mc()

static void cal_scale_error_EXP35_hadronic_mc ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.33,35 Hadron MC.

Definition at line 2296 of file B2BIIFixMdstModule_trk.cc.

2297 {
2298 cal_scale_error_EXP33_hadronic_mc(scale, pt, tanl);
2299 }
static void cal_scale_error_EXP33_hadronic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.33,35 Hadron MC.

◆ cal_scale_error_EXP37_cosmic_data()

static void cal_scale_error_EXP37_cosmic_data ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.37 Cosmic data.

Definition at line 1984 of file B2BIIFixMdstModule_trk.cc.

1985 {
1986 // pt
1987 scale[0] = 1.2129 + 0.36787E-01 * pt;
1988 scale[1] = 1.0750 + 0.32722E-01 * pt;
1989 scale[2] = 0.98340 + 0.39096E-01 * pt;
1990 scale[3] = 1.1768 - 0.43894E-01 * pt;
1991 scale[4] = 1.1275 - 0.12562E-02 * pt;
1992 }

◆ cal_scale_error_EXP37_cosmic_mc()

static void cal_scale_error_EXP37_cosmic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.37 Cosmic MC.

Definition at line 1664 of file B2BIIFixMdstModule_trk.cc.

1665 {
1666 // pt
1667 scale[0] = 1.0694 - 0.19048E-01 * pt;
1668 scale[1] = 1.0732 + 0.95531E-02 * pt;
1669 scale[2] = 0.74888 + 0.89957E-01 * pt;
1670 scale[3] = 1.1107 - 0.57216E-01 * pt;
1671 scale[4] = 1.1098 - 0.13305E-01 * pt;
1672 }

◆ cal_scale_error_EXP37_hadronic_mc()

static void cal_scale_error_EXP37_hadronic_mc ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.37 Hadron MC.

Definition at line 2307 of file B2BIIFixMdstModule_trk.cc.

2308 {
2309 // pt
2310 scale[0] = 1.2548 - 0.87786E-01 * pt;
2311 scale[1] = 1.2562 - 0.89296E-03 * pt;
2312 scale[2] = vfunc(pt, 0.67905, 0.91705, -0.57837, -0.37276E-02);
2313 scale[3] = 1.3180 - 0.19459 * pt;
2314 scale[4] = 1.1652 + 0.33812E-01 * pt;
2315
2316 // tanl
2317 scale[3] *= vfunc(tanl, -0.47522E-01, 0.96537, -0.41720E-01, 0.68031E-01);
2318 }

◆ cal_scale_error_EXP3941_cosmic_data()

static void cal_scale_error_EXP3941_cosmic_data ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.39-41 Cosmic data.

Definition at line 2000 of file B2BIIFixMdstModule_trk.cc.

2001 {
2002 // pt
2003 scale[0] = 1.182285 + 0.4142677E-01 * pt;
2004 scale[1] = 1.090022 + 0.2995044E-01 * pt;
2005 scale[2] = 0.9581690 + 0.5764173E-01 * pt;
2006 scale[3] = 1.119173 - 0.2177483E-01 * pt;
2007 scale[4] = 1.126323 - 0.3786523E-02 * pt;
2008 }

◆ cal_scale_error_EXP3941_cosmic_mc()

static void cal_scale_error_EXP3941_cosmic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.39,41 Cosmic MC.

Definition at line 1681 of file B2BIIFixMdstModule_trk.cc.

1682 {
1683 // pt
1684 scale[0] = 1.055465 - 0.2863498E-01 * pt;
1685 scale[1] = 1.005986 + 0.2709512E-01 * pt;
1686 scale[2] = 0.7459061 + 0.8352030E-01 * pt;
1687 scale[3] = 1.056039 - 0.6258768E-01 * pt;
1688 scale[4] = 1.043329 - 0.2975207E-03 * pt;
1689 }

◆ cal_scale_error_EXP3941_hadronic_mc()

static void cal_scale_error_EXP3941_hadronic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.39,41 Hadron MC.

Definition at line 2327 of file B2BIIFixMdstModule_trk.cc.

2328 {
2329 // pt
2330 scale[0] = 1.236096 - 0.1015809 * pt;
2331 scale[1] = 1.248921 - 0.1130577E-01 * pt;
2332 scale[2] = vfunc(pt, 0.5129282, 0.9300365, -0.9450958, -0.1157168E-01);
2333 scale[3] = vfunc(pt, 1.650362, 0.9371865, -0.2142342, 0.7384746E-01);
2334 scale[4] = vfunc(pt, 0.7497343, 1.204451, 0.1333454, -0.7826934E-01);
2335 }

◆ cal_scale_error_EXP43_cosmic_data()

static void cal_scale_error_EXP43_cosmic_data ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.43 Cosmic data.

Definition at line 2016 of file B2BIIFixMdstModule_trk.cc.

2017 {
2018 // pt
2019 scale[0] = 1.262359 + 0.1411302E-01 * pt;
2020 scale[1] = 1.051793 + 0.6225422E-01 * pt;
2021 scale[2] = 0.9668697 + 0.5492099E-01 * pt;
2022 scale[3] = 1.110838 - 0.2386986E-01 * pt;
2023 scale[4] = 1.106516 + 0.1239970E-01 * pt;
2024 }

◆ cal_scale_error_EXP43_cosmic_mc()

static void cal_scale_error_EXP43_cosmic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.43 Cosmic MC.

Definition at line 1697 of file B2BIIFixMdstModule_trk.cc.

1698 {
1699 // pt
1700 scale[0] = 1.013759 - 0.8743831E-02 * pt;
1701 scale[1] = 1.071626 - 0.1333353E-01 * pt;
1702 scale[2] = 0.7507483 + 0.8399138E-01 * pt;
1703 scale[3] = 1.054345 - 0.5644758E-01 * pt;
1704 scale[4] = 1.020721 + 0.1323117E-01 * pt;
1705 }

◆ cal_scale_error_EXP43_hadronic_mc()

static void cal_scale_error_EXP43_hadronic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.43 Hadron MC.

Definition at line 2343 of file B2BIIFixMdstModule_trk.cc.

2344 {
2345 // pt
2346 scale[0] = 1.240166 - 0.1051634 * pt;
2347 scale[1] = 1.257180 - 0.3122512E-01 * pt;
2348 scale[2] = vfunc(pt, 0.5272015, 0.9386514, -0.9648152, -0.1623573E-01);
2349 scale[3] = 1.280515 - 0.1991213 * pt;
2350 scale[4] = vfunc(pt, 0.6579201, 1.192409, 0.1197880, -0.5404800E-01);
2351 }

◆ cal_scale_error_EXP4547_cosmic_data()

static void cal_scale_error_EXP4547_cosmic_data ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.45,47 Cosmic data.

Definition at line 2032 of file B2BIIFixMdstModule_trk.cc.

2033 {
2034 // pt 8bin
2035 scale[0] = 1.164526 + 0.7671143E-01 * pt;
2036 scale[1] = 1.094987 + 0.2949413E-01 * pt;
2037 scale[2] = 1.084826 + 0.2513991E-01 * pt;
2038 scale[3] = 1.099221 - 0.2389658E-02 * pt;
2039 scale[4] = 1.146892 + 0.2682884E-02 * pt;
2040 }

◆ cal_scale_error_EXP45_cosmic_mc()

static void cal_scale_error_EXP45_cosmic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.45 Cosmic MC.

Definition at line 1713 of file B2BIIFixMdstModule_trk.cc.

1714 {
1715 // pt
1716 scale[0] = 1.011008 - 0.2272887E-01 * pt;
1717 scale[1] = 1.030603 + 0.8892579E-02 * pt;
1718 scale[2] = 0.7181793 + 0.9717058E-01 * pt;
1719 scale[3] = 1.065804 - 0.6852337E-01 * pt;
1720 scale[4] = 1.085136 - 0.2324515E-01 * pt;
1721 }

◆ cal_scale_error_EXP45_hadronic_mc()

static void cal_scale_error_EXP45_hadronic_mc ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.45 Hadron MC.

Definition at line 2359 of file B2BIIFixMdstModule_trk.cc.

2360 {
2361 // pt
2362 scale[0] = 1.213823 - .1029683 * pt;
2363 scale[1] = 1.239279 - .3706657E-01 * pt;
2364 scale[2] = vfunc(pt, 0.6145123, 0.8834459, -.4620622, 0.2099150E-01);
2365 scale[3] = 1.253126 - .1884352 * pt;
2366 scale[4] = vfunc(pt, 0.4928604, 1.169158, 0.2063893, -.5428730E-01);
2367
2368 // tanl
2369 scale[2] *= vfunc(tanl, -.1240821, 0.9274375, -.8750933E-01, 0.8611448E-01);
2370 }

◆ cal_scale_error_EXP47_cosmic_mc()

static void cal_scale_error_EXP47_cosmic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.47 Cosmic MC.

Definition at line 1729 of file B2BIIFixMdstModule_trk.cc.

1730 {
1731 // pt
1732 scale[0] = 0.9806778 - 0.2010826E-02 * pt;
1733 scale[1] = 0.9996797 + 0.2633917E-01 * pt;
1734 scale[2] = 0.7450445 + 0.7637244E-01 * pt;
1735 scale[3] = 1.084419 - 0.6828102E-01 * pt;
1736 scale[4] = 1.013550 + 0.1201861E-01 * pt;
1737 }

◆ cal_scale_error_EXP47_hadronic_mc()

static void cal_scale_error_EXP47_hadronic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.47 Hadron MC.

Definition at line 2378 of file B2BIIFixMdstModule_trk.cc.

2379 {
2380 // pt
2381 scale[0] = 1.218633 - .1078999 * pt;
2382 scale[1] = 1.237288 - .2890434E-01 * pt;
2383 scale[2] = vfunc(pt, 0.4334312, 0.9027213, -.7119852, 0.1031877E-01);
2384 scale[3] = 1.252394 - .1835607 * pt;
2385 scale[4] = vfunc(pt, 0.6194937, 1.168190, 0.1285120, -.5815693E-01);
2386 }

◆ cal_scale_error_EXP49_cosmic_data()

static void cal_scale_error_EXP49_cosmic_data ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.49 Cosmic data.

Definition at line 2048 of file B2BIIFixMdstModule_trk.cc.

2049 {
2050 // pt 8bin
2051 scale[0] = 1.243211 + 0.5776083E-01 * pt;
2052 scale[1] = 1.209483 - 0.3366023E-01 * pt;
2053 scale[2] = 1.059087 + 0.4300838E-01 * pt;
2054 scale[3] = 1.123665 + 0.6342933E-02 * pt;
2055 scale[4] = 1.208850 - 0.3171053E-01 * pt;
2056 }

◆ cal_scale_error_EXP49_cosmic_mc()

static void cal_scale_error_EXP49_cosmic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.49 Cosmic MC.

Definition at line 1745 of file B2BIIFixMdstModule_trk.cc.

1746 {
1747 // pt
1748 scale[0] = 1.000635 - 0.1659129E-01 * pt;
1749 scale[1] = 1.046513 - 0.2994663E-02 * pt;
1750 scale[2] = 0.7241409 + 0.9558808E-01 * pt;
1751 scale[3] = 1.062597 - 0.6663921E-01 * pt;
1752 scale[4] = 1.076486 - 0.2023062E-01 * pt;
1753 }

◆ cal_scale_error_EXP49_hadronic_mc()

static void cal_scale_error_EXP49_hadronic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.49 Hadron MC.

Definition at line 2394 of file B2BIIFixMdstModule_trk.cc.

2395 {
2396 // pt
2397 scale[0] = 1.217751 - .1075724 * pt;
2398 scale[1] = 1.233774 - .3122749E-01 * pt;
2399 scale[2] = vfunc(pt, 0.5276512, 0.8852152, -.7025786, 0.3136450E-01);
2400 scale[3] = 1.258038 - .1949899 * pt;
2401 scale[4] = vfunc(pt, 0.5924365, 1.162905, 0.9632715E-01, -.6221822E-01);
2402
2403 }

◆ cal_scale_error_EXP51_cosmic_data()

static void cal_scale_error_EXP51_cosmic_data ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.51 Cosmic data.

Definition at line 2064 of file B2BIIFixMdstModule_trk.cc.

2065 {
2066 // pt 5bin
2067 scale[0] = 1.2097 + 0.36177E-01 * pt;
2068 scale[1] = 1.2218 - 0.84772E-02 * pt;
2069 scale[2] = 0.97937 + 0.26397E-01 * pt;
2070 scale[3] = 1.0944 - 0.12745E-02 * pt;
2071 scale[4] = 1.2140 - 0.56809E-01 * pt;
2072
2073 // tanl
2074 scale[0] *= 1.0492 + 0.72972E-01 * tanl;
2075 scale[1] *= 1.0298 + 0.40625E-02 * tanl;
2076 scale[2] *= 0.93367 + 0.11969E-01 * tanl;
2077 scale[3] *= 1.0170 + 0.41039E-01 * tanl;
2078 scale[4] *= 1.0677 - 0.41684E-01 * tanl;
2079 }

◆ cal_scale_error_EXP51_cosmic_mc()

static void cal_scale_error_EXP51_cosmic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.51 Cosmic MC.

Definition at line 1761 of file B2BIIFixMdstModule_trk.cc.

1762 {
1763 // pt
1764 scale[0] = 0.98242 - 0.71780E-02 * pt;
1765 scale[1] = 1.0465 + 0.44401E-03 * pt;
1766 scale[2] = 0.71433 + 0.10176 * pt;
1767 scale[3] = 1.0875 - 0.80972E-01 * pt;
1768 scale[4] = 1.0777 - 0.20428E-01 * pt;
1769 }

◆ cal_scale_error_EXP51_hadronic_mc()

static void cal_scale_error_EXP51_hadronic_mc ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.51 Hadron MC.

Definition at line 2411 of file B2BIIFixMdstModule_trk.cc.

2412 {
2413 // pt
2414 scale[0] = vfunc(pt, 0.35776, 1.1919, 0.84229E-01, -0.88550E-01);
2415 scale[1] = vfunc(pt, 0.37833, 1.2394, 0.34089, -0.54440E-01);
2416 scale[2] = lambdafunc(pt, 0.87688, 1.4065, 0.86733, -0.23657, 0.21714E-01, 0.20876);
2417 scale[3] = lambdafunc(pt, 0.39825, 1.0950, 1.2104, 0.11718E-01, -0.21145, -0.89681E-01);
2418 scale[4] = vfunc(pt, 0.48051, 1.1672, 0.19241, -0.32273E-01);
2419
2420 // tanl
2421 scale[2] *= vfunc(tanl, -0.40697, 0.92948, -0.29453, 0.59416E-01);
2422 }

◆ cal_scale_error_EXP53_cosmic_data()

static void cal_scale_error_EXP53_cosmic_data ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.53 Cosmic data.

Definition at line 2087 of file B2BIIFixMdstModule_trk.cc.

2088 {
2089 // pt 5bin
2090 scale[0] = 1.2587 + 0.32782E-01 * pt;
2091 scale[1] = 1.2413 - 0.36535E-01 * pt;
2092 scale[2] = 0.97465 + 0.22937E-01 * pt;
2093 scale[3] = 1.1197 - 0.59050E-02 * pt;
2094 scale[4] = 1.1877 - 0.32893E-01 * pt;
2095 }

◆ cal_scale_error_EXP53_cosmic_mc()

static void cal_scale_error_EXP53_cosmic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.53 Cosmic MC.

Definition at line 1777 of file B2BIIFixMdstModule_trk.cc.

1778 {
1779 // pt
1780 scale[0] = 0.99832 - 0.17290E-01 * pt;
1781 scale[1] = 1.0434 + 0.47995E-02 * pt;
1782 scale[2] = 0.72111 + 0.10093 * pt;
1783 scale[3] = 1.1022 - 0.87951E-01 * pt;
1784 scale[4] = 1.0643 - 0.11962E-01 * pt;
1785 }

◆ cal_scale_error_EXP53_hadronic_mc()

static void cal_scale_error_EXP53_hadronic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.53 Hadron MC.

Definition at line 2430 of file B2BIIFixMdstModule_trk.cc.

2431 {
2432 // pt
2433 scale[0] = lambdafunc(pt, 0.50681, 1.2150, 1.2266, 0.99662E-01, -0.23508, -0.52268E-01);
2434 scale[1] = lambdafunc(pt, 0.50787, 1.2308, 1.3108, 0.42334, -0.25502, -0.13522E-01);
2435 scale[2] = vfunc(pt, 1.2149, 0.88700, -0.15323, 0.97993E-01);
2436 scale[3] = lambdafunc(pt, 0.45595, 1.1561, 1.2383, 0.17605, -0.34753, -0.97049E-01);
2437 scale[4] = vfunc(pt, 0.55269, 1.2261, 0.39706, -0.12333);
2438 }

◆ cal_scale_error_EXP55_cosmic_data()

static void cal_scale_error_EXP55_cosmic_data ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.55 Cosmic data.

Definition at line 2103 of file B2BIIFixMdstModule_trk.cc.

2104 {
2105 // pt 5bin
2106 scale[0] = 1.2654 + 0.15660E-01 * pt;
2107 scale[1] = 1.0278 + 0.81680E-01 * pt;
2108 scale[2] = 0.94291 + 0.54575E-01 * pt;
2109 scale[3] = 1.1151 - 0.52387E-02 * pt;
2110 scale[4] = 1.1020 + 0.10518E-01 * pt;
2111
2112 // tanl 5bin
2113 scale[0] *= 1.0334 + 0.10236E-01 * tanl;
2114 scale[1] *= 1.0346 + 0.11024E-01 * tanl;
2115 // scale[2] *= 0.91773 -0.52276E-02*tanl;
2116 scale[3] *= 1.0140 + 0.19030E-01 * tanl;
2117 scale[4] *= 1.0345 - 0.90291E-01 * tanl;
2118 }

◆ cal_scale_error_EXP55_cosmic_mc()

static void cal_scale_error_EXP55_cosmic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.55 Cosmic MC.

Definition at line 1793 of file B2BIIFixMdstModule_trk.cc.

1794 {
1795 // pt
1796 scale[0] = 0.98871 - 0.88399E-02 * pt;
1797 scale[1] = 1.0159 + 0.16468E-01 * pt;
1798 scale[2] = 0.72813 + 0.94737E-01 * pt;
1799 scale[3] = 1.1060 - 0.88323E-01 * pt;
1800 scale[4] = 1.0914 - 0.30607E-01 * pt;
1801 }

◆ cal_scale_error_EXP55_hadronic_mc()

static void cal_scale_error_EXP55_hadronic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.55 Hadron MC.

Definition at line 2446 of file B2BIIFixMdstModule_trk.cc.

2447 {
2448 // pt
2449 scale[0] = vfunc(pt, 0.34925, 1.1780, 0.89069E-01, -0.10090);
2450 scale[1] = vfunc(pt, 0.35168, 1.2380, 0.41479, -0.63250E-01);
2451 scale[2] = vfunc(pt, 1.2497, 0.88495, -0.14338, 0.94307E-01);
2452 scale[3] = lambdafunc(pt, 0.29565, 1.4502, 1.2139, 0.14353, -0.21211, -0.82968E-01);
2453 scale[4] = vfunc(pt, 1.2496, 1.1216, 0.97174E-02, -0.41166E-01);
2454 }

◆ cal_scale_error_EXP6165_cosmic_data()

static void cal_scale_error_EXP6165_cosmic_data ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.61-65 Cosmic data.

Definition at line 2126 of file B2BIIFixMdstModule_trk.cc.

2127 {
2128 // pt 5bin
2129 scale[0] = 1.1184 + 0.55671E-01 * pt;
2130 scale[1] = 1.1142 + 0.74526E-02 * pt;
2131 scale[2] = 0.93626 + 0.66670E-01 * pt;
2132 scale[3] = 1.1003 - 0.11587E-01 * pt;
2133 scale[4] = 1.1589 - 0.40223E-01 * pt;
2134
2135 // tanl 5bin
2136 scale[0] *= 1.0442 - 0.46775E-01 * tanl;
2137 scale[1] *= 1.0337 + 0.44071E-01 * tanl;
2138 // scale[2] *= 0.91898 -0.28268E-02*tanl;
2139 scale[3] *= 1.0037 + 0.29736E-01 * tanl;
2140 scale[4] *= 1.0378 - 0.73239E-01 * tanl;
2141 }

◆ cal_scale_error_EXP6165_cosmic_mc()

static void cal_scale_error_EXP6165_cosmic_mc ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.61-65 Cosmic MC.

Definition at line 1809 of file B2BIIFixMdstModule_trk.cc.

1810 {
1811 // pt
1812 scale[0] = 0.97322 - 0.29003E-02 * pt;
1813 scale[1] = 0.94704 + 0.44719E-01 * pt;
1814 scale[2] = 0.73547 + 0.98431E-01 * pt;
1815 scale[3] = 1.0752 - 0.77818E-01 * pt;
1816 scale[4] = 1.0759 - 0.27057E-01 * pt;
1817
1818 // tanl
1819 scale[0] *= 0.99600 - 0.97573E-02 * tanl;
1820 scale[1] *= 1.0080 - 0.37122E-01 * tanl;
1821 scale[2] *= 0.99150 - 0.13390E-01 * tanl;
1822 scale[3] *= 0.99758 - 0.43508E-01 * tanl;
1823 scale[4] *= 0.99913 + 0.34211E-01 * tanl;
1824 }

◆ cal_scale_error_EXP6165_hadronic_mc()

static void cal_scale_error_EXP6165_hadronic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.61-65 Hadron MC.

Definition at line 2462 of file B2BIIFixMdstModule_trk.cc.

2463 {
2464 // pt
2465 scale[0] = vfunc(pt, 1.4501, 1.0348, -0.12125, -0.27519E-01);
2466 scale[1] = lambdafunc(pt, 0.48988, 1.5501, 1.2544, 0.21014, -0.10419, 0.74755E-01);
2467 scale[2] = lambdafunc(pt, 0.44993, 1.3616, 0.93316, -0.58441, -0.30814E-01, 0.90806E-01);
2468 scale[3] = 1.2385 - 0.17733 * pt;
2469 scale[4] = vfunc(pt, 0.75590, 1.1726, 0.12749, -0.75183E-01);
2470 }

◆ cal_scale_error_EXP67_cosmic_data()

static void cal_scale_error_EXP67_cosmic_data ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.67 Cosmic data.

Definition at line 2149 of file B2BIIFixMdstModule_trk.cc.

2150 {
2151 // pt 5bin
2152 scale[0] = 1.1598 + 0.28880E-01 * pt;
2153 scale[1] = 1.0844 + 0.23384E-01 * pt;
2154 scale[2] = 0.94566 + 0.53157E-01 * pt;
2155 scale[3] = 1.1578 - 0.31156E-01 * pt;
2156 scale[4] = 1.0725 + 0.13714E-01 * pt;
2157
2158 // tanl 5bin
2159 scale[0] *= 1.0223 - 0.56165E-02 * tanl;
2160 scale[1] *= 1.0203 - 0.81857E-02 * tanl;
2161 // scale[2] *= 0.90812 +0.15679E-01*tanl;
2162 scale[3] *= 0.99703 + 0.14976E-01 * tanl;
2163 scale[4] *= 1.0212 + 0.41300E-01 * tanl;
2164 }

◆ cal_scale_error_EXP67_cosmic_mc()

static void cal_scale_error_EXP67_cosmic_mc ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.67 Cosmic MC.

Definition at line 1832 of file B2BIIFixMdstModule_trk.cc.

1833 {
1834 // pt
1835 scale[0] = 0.99845 - 0.18739E-01 * pt;
1836 scale[1] = 1.0024 + 0.17833E-01 * pt;
1837 scale[2] = 0.72369 + 0.96994E-01 * pt;
1838 scale[3] = 1.0605 - 0.64072E-01 * pt;
1839 scale[4] = 1.0623 - 0.14320E-01 * pt;
1840
1841 // tanl
1842 scale[0] *= 0.99597 - 0.13069E-01 * tanl;
1843 scale[1] *= 1.0072 - 0.18622E-01 * tanl;
1844 scale[2] *= 0.99515 - 0.16591E-01 * tanl;
1845 scale[3] *= 0.99466 - 0.14489E-02 * tanl;
1846 scale[4] *= 1.0036 - 0.15095E-01 * tanl;
1847 }

◆ cal_scale_error_EXP67_hadronic_mc()

static void cal_scale_error_EXP67_hadronic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.67 Hadron MC.

Definition at line 2478 of file B2BIIFixMdstModule_trk.cc.

2479 {
2480 // pt
2481 scale[0] = vfunc(pt, 1.0501, 1.0852, -0.14604, -0.66317E-01);
2482 scale[1] = lambdafunc(pt, 0.37538, 2.5672, 1.2362, 0.14203, -0.58242E-01, 0.28431E-02);
2483 scale[2] = lambdafunc(pt, 0.52700, 1.3506, 0.90327, -0.55627, 0.13131E-02, 0.11059);
2484 scale[3] = 1.2577 - 0.19572 * pt;
2485 scale[4] = vfunc(pt, 0.69484, 1.1636, 0.96169E-01, -0.80421E-01);
2486 }

◆ cal_scale_error_EXP6971_cosmic_data()

static void cal_scale_error_EXP6971_cosmic_data ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.69,71 Cosmic data.

Definition at line 2175 of file B2BIIFixMdstModule_trk.cc.

2176 {
2177 // pt 5bin
2178 scale[0] = 1.2101 + 0.29496E-01 * pt;
2179 scale[1] = 1.0723 + 0.13773E-01 * pt;
2180 scale[2] = 0.90988 + 0.78667E-01 * pt;
2181 scale[3] = 1.1444 - 0.20780E-01 * pt;
2182 scale[4] = 1.0962 + 0.83309E-02 * pt;
2183
2184 // tanl 5bin
2185 scale[0] *= 1.0207 - 0.17810E-01 * tanl;
2186 scale[1] *= 1.0272 + 0.61498E-01 * tanl;
2187 // scale[2] *= 0.91584 +0.16138E-01*tanl;
2188 scale[3] *= 0.99766 + 0.32434E-01 * tanl;
2189 scale[4] *= 1.0200 - 0.14935E-01 * tanl;
2190 }

◆ cal_scale_error_EXP6971_cosmic_mc()

static void cal_scale_error_EXP6971_cosmic_mc ( double  scale[5],
double  pt,
double  tanl 
)
static

Scale error for Exp.69-71 Cosmic MC.

Definition at line 1858 of file B2BIIFixMdstModule_trk.cc.

1859 {
1860 // pt
1861 scale[0] = 0.96783 - 0.37174E-02 * pt;
1862 scale[1] = 0.97888 + 0.34689E-01 * pt;
1863 scale[2] = 0.80870 + 0.68302E-01 * pt;
1864 scale[3] = 1.0615 - 0.60750E-01 * pt;
1865 scale[4] = 1.0372 - 0.52332E-03 * pt;
1866
1867 // tanl
1868 scale[0] *= 0.99897 + 0.62207E-02 * tanl;
1869 scale[1] *= 1.0037 + 0.10714E-01 * tanl;
1870 scale[2] *= 0.99129 - 0.92521E-02 * tanl;
1871 scale[3] *= 0.99483 - 0.43402E-02 * tanl;
1872 scale[4] *= 1.0062 + 0.15306E-01 * tanl;
1873 }

◆ cal_scale_error_EXP6971_hadronic_mc()

static void cal_scale_error_EXP6971_hadronic_mc ( double  scale[5],
double  pt,
double   
)
static

Scale error for Exp.69,71 Hadron MC.

Definition at line 2497 of file B2BIIFixMdstModule_trk.cc.

2498 {
2499 // pt
2500 scale[0] = vfunc(pt, 1.7258, 1.0126, -0.12693, 0.31924E-01);
2501 scale[1] = lambdafunc(pt, 0.37552, 1.2217, 1.2532, 0.37276, -0.77830E-01, -0.31378E-01);
2502 scale[2] = lambdafunc(pt, 0.40176, 1.1748, 0.95524, -0.72331, -0.53213E-01, 0.90074E-01);
2503 scale[3] = 1.2644 - 0.19783 * pt;
2504 scale[4] = vfunc(pt, 0.56934, 1.1649, 0.13098, -0.52232E-01);
2505 }

◆ correct_ecl()

void correct_ecl ( int  option,
int  version 
)
private

Correct photon's momenta and error matrix.

Definition at line 1226 of file B2BIIFixMdstModule_ecl.cc.

1227 {
1228
1229 int ecl_threshold(0);
1230 if (m_reprocess_version == 0) {
1231 ecl_threshold = 1;
1232 } else if (m_reprocess_version == 1) {
1233 ecl_threshold = 0;
1234 }
1235
1236 //dout(Debugout::INFO,"B2BIIFixMdst_ecl") << "This is version1.2.1" << std::endl;
1237 // dout(Debugout::INFO,"B2BIIFixMdst_ecl") << "entering correct_ecl()" << std::endl;
1238 // Check whether "version" is supported.
1239 if (version < 1 || version > 2) {
1240 B2WARNING("correct_ecl :: Warning! ");
1241 B2WARNING("version=" << version << " is not supported! ");
1242 B2WARNING("Exit doing nothing!");
1243 }
1244
1245 //---------------------
1246 // Control sequence based on belle_event table.
1247 //---------------------
1248 Belle::Belle_event_Manager& evtmgr = Belle::Belle_event_Manager::get_manager();
1249 if (0 == evtmgr.count()) {
1250 // Do nothing if not exist, because we can not know whether
1251 // this event is Exp. data or MC.
1252 return;
1253 }
1254 //Check data or mc. Data:expmc=1, MC:expmc=2.
1255 int expmc = evtmgr[0].ExpMC();
1256 // Exp, Run, number to be given to correction func.
1257 int Eno = evtmgr[0].ExpNo();
1258 int Rno = evtmgr[0].RunNo();
1259
1260 // If option is 0 and this event is MC, do nothing.
1261 // Modify : Exp.61 processed by b20080502, MC is also corrected.
1262 //org if( option==0 && expmc==2 )
1263 if (option == 0 && expmc == 2) {
1264 //if( Eno<55) //test
1265 //std::cout<<"ecl_threshold="<<ecl_threshold<<std::endl;
1266 // if( Eno<60 || ( Eno==61 && Rno>1209 ) /* 5S scan runs. */
1267 // || ( Eno==61 && m_correct_ecl_5s==1 ) /* Exp.61 old lib case.*/
1268 // || ( Eno==65 && Rno>1000 ) /* 1S runs.*/
1269 // || ( Eno==65 && m_correct_ecl_5s==1 ) /* Exp.65 old lib case.*/)
1270 if (ecl_threshold == 1) {
1271 return;
1272 }
1273 }
1274
1275 // Correction curve version control.
1276 int i_previous(0);
1277 // Mdst_event_add table is there?
1278 Belle::Mdst_event_add_Manager& mevtmgr = Belle::Mdst_event_add_Manager::get_manager();
1279 // When Mdst_event_add exists,
1280 if (mevtmgr.count() > 0) {
1281 // Up to Exp.13, same treatment as V1.0 2001/Nov./30th
1282 //if( Eno <= 13 )
1283 // Modify; Exp.13 moved to same treatment as Exp.15 or later.
1284 // 20020524 Kenkichi Miyabayashi.
1285 if (Eno <= 11) {
1286 // If already the energy is corrected, exit.
1287 if (mevtmgr[0].flag(3) == 1) {
1288 return;
1289 }
1290 // Otherwise, set the flag at proper entity, flag(3).
1291 // Note that frag(1) and frag(2) have already been used
1292 // in scale_momenta().
1293 mevtmgr[0].flag(3, 1);
1294 }
1295 // Exp.13 and later...last update 2002/May./24 K.Miya.
1296 else { // Exp.15 and later...last update 2002/Feb./20
1297 // If well-established version was already applied, exit.
1298 if (mevtmgr[0].flag(3) >= version) {
1299 return;
1300 }
1301 // Otherwise, check the previous version.
1302 i_previous = mevtmgr[0].flag(3);
1303 if (i_previous == 0 || i_previous == 1) {
1304 mevtmgr[0].flag(3, version);
1305 } else { // Previous version is unsupported one.
1306 // Make Warning and exit.
1307 B2WARNING("correct_ecl :: Warning! ");
1308 B2WARNING("Previously, uncorrect version was used. ");
1309 B2WARNING(" Exit doing nothing");
1310 return;
1311 }
1312 }
1313 } else { // Create Mdst_event_add and set flag.
1314 Belle::Mdst_event_add& meadd = mevtmgr.add();
1315 // Up to Exp.13, same treatment as before.
1316 if (Eno <= 13) {
1317 meadd.flag(3, 1);
1318 } else { // For Exp.15, set version.
1319 meadd.flag(3, version);
1320 }
1321 }
1322
1323 //--------------------------
1324 // If no ad_hoc correction has been applied so far or
1325 // correction curve is new version,
1326 // overwrite proper panther tables.
1327 //--------------------------
1328 // Get Mdst_ecl and Mdst_gamma.
1329 Belle::Mdst_ecl_Manager& eclmgr = Belle::Mdst_ecl_Manager::get_manager();
1330 Belle::Mdst_gamma_Manager& gammamgr = Belle::Mdst_gamma_Manager::get_manager();
1331
1332 // Get Mdst_ecl_aux. Added 20060413
1333 Belle::Mdst_ecl_aux_Manager& eclauxmgr = Belle::Mdst_ecl_aux_Manager::get_manager();
1334 std::vector<Belle::Mdst_ecl_aux>::iterator itaux = eclauxmgr.begin();
1335
1336 // Correct energy and error matrix in Mdst_ecl.
1337 double factor;
1338 double factor13;
1339
1340 for (std::vector<Belle::Mdst_ecl>::iterator itecl = eclmgr.begin();
1341 itecl != eclmgr.end(); ++itecl) {
1342 Belle::Mdst_ecl& shower = *itecl;
1343 // Shower energy and polar angle
1344 double shower_energy = shower.energy();
1345 double shower_theta = shower.theta();
1346
1347 // Fix wrong calib. for Exp. 45.
1348 // if( Eno==45 )
1349 if (expmc == 1 && m_reprocess_version == 0 && Eno == 45) {
1350 int cellID = (*itaux).cId();
1351 double factor45 = ecl_adhoc_corr_45(Eno, Rno, cellID);
1352 //if( factor45!=1.0 )
1353 //{
1354 //int idecl=shower.get_ID();
1355 // dout(Debugout::DDEBUG,"B2BIIFixBelle::Mdst_ecl")<<"Exp45 fix idecl="<<idecl<<" cellID="<<cellID
1356 //<<" factor45="<<factor45<<std::endl;
1357 //}
1358
1359 shower.energy(shower.energy() / factor45);
1360 double factor452 = factor45 * factor45;
1361 shower.error(0, shower.error(0) / factor452); // Energy diagonal.
1362 shower.error(1, shower.error(1) / factor45); // Energy-phi.
1363 shower.error(3, shower.error(3) / factor45); // Energy-theta.
1364
1365 // Here, also take care of Belle::Mdst_gamma.
1366 for (std::vector<Belle::Mdst_gamma>::iterator itgam45 = gammamgr.begin();
1367 itgam45 != gammamgr.end(); ++itgam45) {
1368 Belle::Mdst_gamma& gamma45 = *itgam45;
1369 if (gamma45.ecl().get_ID() == shower.get_ID()) {
1370 gamma45.px(gamma45.px() / factor45);
1371 gamma45.py(gamma45.py() / factor45);
1372 gamma45.pz(gamma45.pz() / factor45);
1373 //int idgam=gamma45.get_ID();
1374 //if( factor45!=1.0 )
1375 //{
1376 // dout(Debugout::DDEBUG,"B2BIIFixBelle::Mdst_ecl")<< "Exp45 fix idgamma="<<idgam<<std::endl;
1377 //}
1378 }
1379 }
1380 }
1381
1382 // control sequence by option and expmc.
1383 // option=0
1384 switch (option) {
1385 case 0: // Option set as default.
1386 if (expmc == 2) { // This event record is MC data.
1387 // processed b20080331 or older, already skip.
1388 //KM std::cout<<"mdst_ecl"<<std::endl;
1389 factor
1390 = ecl_mcx3_corr(Eno, Rno, shower_energy, cos(shower_theta));
1391 } else { // Exp. data.
1392 //Original definition.
1393 //factor
1394 // = ecl_adhoc_corr( Eno, Rno,
1395 // shower_energy, cos(shower_theta));
1396 //Modified 20081222
1397 factor
1398 = ecl_adhoc_corr(Eno, Rno, ecl_threshold,
1399 shower_energy, cos(shower_theta));
1400 // Special treatment of Exp.15 processed by b20020125.
1401 if (Eno == 15 && i_previous == 1) {
1402 // dout(Debugout::INFO,"B2BIIFixBelle::Mdst_ecl") << "Exp.15 version=1 applied case!" << std::endl;
1403 //dout(Debugout::INFO,"B2BIIFixBelle::Mdst_ecl") << "ecl factor=" << factor << " " ;
1404 // Original scaling is done by Exp.13 curve.
1405 //Original definition.
1406 //factor13
1407 //= ecl_adhoc_corr( 13, 1,
1408 //shower_energy, cos(shower_theta));
1409 //Modified 20081222
1410 factor13
1411 = ecl_adhoc_corr(13, 1, ecl_threshold,
1412 shower_energy, cos(shower_theta));
1413 factor = factor / factor13;
1414 //dout(Debugout::INFO,"B2BIIFixBelle::Mdst_ecl") << "factor(rel)=" << factor << " ";
1415 }
1416 }
1417 break;
1418 case 1:
1419 if (expmc == 2) { // This event record is MC data.
1420 factor = 1.0 / mpi0pdg(shower.energy());
1421
1422 } else { // This event record is real data.
1423 //Original definition.
1424 //factor
1425 // = ecl_adhoc_corr( Eno, Rno,
1426 // shower.energy(), cos(shower.theta()));
1427 //Modified 20081222
1428 factor
1429 = ecl_adhoc_corr(Eno, Rno, ecl_threshold,
1430 shower.energy(), cos(shower.theta()));
1431 // Special treatment of Exp.15 processed by b20020125.
1432 if (Eno == 15 && i_previous == 1) {
1433 // Original scaling is done by Exp.13 curve.
1434 //Original definition.
1435 //factor13
1436 // = ecl_adhoc_corr( 13, 1,
1437 // shower_energy, cos(shower_theta));
1438 //Modified 20081222
1439 factor13
1440 = ecl_adhoc_corr(13, 1, ecl_threshold,
1441 shower_energy, cos(shower_theta));
1442 factor = factor / factor13;
1443 //dout(Debugout::INFO,"B2BIIFixBelle::Mdst_ecl") << "factor(rel)=" << factor << " ";
1444 }
1445
1446 factor = factor / mpi0pdg(shower.energy());
1447 }
1448 break;
1449 default:
1450 factor = 1.0;
1451 }
1452
1453 // energy correction.
1454 shower.energy(shower.energy() / factor);
1455
1456 // error matrix correction.
1457 double factor2 = factor * factor;
1458 shower.error(0, shower.error(0) / factor2); // Energy diagonal.
1459 shower.error(1, shower.error(1) / factor); // Energy-phi.
1460 shower.error(3, shower.error(3) / factor); // Energy-theta.
1461
1462 // Incriment Belle::Mdst_ecl_aux pointer.
1463 ++itaux;
1464 }
1465
1466 // Correct energy in Belle::Mdst_gamma.
1467 for (std::vector<Belle::Mdst_gamma>::iterator itgam = gammamgr.begin();
1468 itgam != gammamgr.end(); ++itgam) {
1469 Belle::Mdst_gamma& gamma = *itgam;
1470 // Create the gamma's 3vector
1471 CLHEP::Hep3Vector gamma_3v(gamma.px(), gamma.py(), gamma.pz());
1472 double gamma_energy = gamma_3v.mag();
1473 double gamma_cos = gamma_3v.cosTheta();
1474
1475 // control sequence by option and expmc.
1476 switch (option) {
1477 case 0: // Option as default.
1478 if (expmc == 2) { // This event record is MC data.
1479 // processed b20080331 or older, already skip.
1480 //KM std::cout<<"mdst_gamma"<<std::endl;
1481 factor
1482 = ecl_mcx3_corr(Eno, Rno, gamma_energy, gamma_cos);
1483 } else { // Exp. data.
1484 //Original definition
1485 //factor
1486 // = ecl_adhoc_corr( Eno, Rno,
1487 // gamma_energy, gamma_cos);
1488 //Modified 20081222
1489 factor
1490 = ecl_adhoc_corr(Eno, Rno, ecl_threshold,
1491 gamma_energy, gamma_cos);
1492 // Special treatment of Exp.15 processed by b20020125.
1493 if (Eno == 15 && i_previous == 1) {
1494 // dout(Debugout::INFO,"B2BIIFixBelle::Mdst_ecl") << "Exp.15 version=1 applied case!" << std::endl;
1495 //dout(Debugout::INFO,"B2BIIFixBelle::Mdst_ecl") << "factor=" << factor << " " ;
1496 // Original scaling is done by Exp.13 curve.
1497 //Original definition.
1498 //factor13
1499 // = ecl_adhoc_corr( 13, 1,
1500 // gamma_energy, gamma_cos);
1501 //Modified 20081222
1502 factor13
1503 = ecl_adhoc_corr(13, 1, ecl_threshold,
1504 gamma_energy, gamma_cos);
1505 factor = factor / factor13;
1506 //dout(Debugout::INFO,"B2BIIFixBelle::Mdst_ecl") << "gamma factor(rel)=" << factor << " " << std::endl;
1507 }
1508 }
1509 break;
1510 case 1:
1511 if (expmc == 2) {
1512 factor = 1.0 / mpi0pdg(gamma_3v.mag());
1513
1514 } else {
1515 //Original definition.
1516 //factor
1517 // = ecl_adhoc_corr( Eno, Rno,
1518 // gamma_3v.mag(), gamma_3v.cosTheta());
1519 //Modified 20081222
1520 factor
1521 = ecl_adhoc_corr(Eno, Rno, ecl_threshold,
1522 gamma_3v.mag(), gamma_3v.cosTheta());
1523 // Special treatment of Exp.15 processed by b20020125.
1524 if (Eno == 15 && i_previous == 1) {
1525 // dout(Debugout::INFO,"B2BIIFixBelle::Mdst_ecl") << "Exp.15 version=1 applied case!" << std::endl;
1526 //dout(Debugout::INFO,"B2BIIFixBelle::Mdst_ecl") << "factor=" << factor << " " ;
1527 // Original scaling is done by Exp.13 curve.
1528 //Original definition.
1529 //factor13
1530 // = ecl_adhoc_corr( 13, 1,
1531 // gamma_energy, gamma_cos);
1532 //Modified 20081222
1533 factor13
1534 = ecl_adhoc_corr(13, 1, ecl_threshold,
1535 gamma_energy, gamma_cos);
1536 factor = factor / factor13;
1537 //dout(Debugout::INFO,"B2BIIFixBelle::Mdst_ecl") << "gamma factor(rel)=" << factor << " " << std::endl;
1538 }
1539 factor = factor / mpi0pdg(gamma_3v.mag());
1540 }
1541 break;
1542 default:
1543 factor = 1.0;
1544 }
1545
1546 // factor should be used as a division.
1547 gamma.px(gamma.px() / factor);
1548 gamma.py(gamma.py() / factor);
1549 gamma.pz(gamma.pz() / factor);
1550 }
1551 }
static double ecl_adhoc_corr(int Exp, int Run, int iflag05th, double Energy, double)
The function giving correction factor.
static double ecl_adhoc_corr_45(int exp, int, int cid)
The function giving correction factor in Exp.45.
static double ecl_mcx3_corr(int, int, double energy, double)
Correct energy scale (MC) to make pi0 peak nominal.
static double mpi0pdg(double Energy)
Make MC mass peak to PDG value.

◆ correct_ecl_primary_vertex()

void correct_ecl_primary_vertex ( const HepPoint3D epvtx,
const CLHEP::HepSymMatrix &  epvtx_err 
)
private

Correct ecl using primary vertex.

Definition at line 2275 of file B2BIIFixMdstModule_ecl.cc.

2277 {
2278
2279 Belle::Mdst_gamma_Manager& Gamma = Belle::Mdst_gamma_Manager::get_manager();
2280
2281 for (std::vector<Belle::Mdst_gamma>::iterator
2282 it = Gamma.begin(); it != Gamma.end(); ++it) {
2283 double r(it->ecl().r());
2284 double theta(it->ecl().theta());
2285 double phi(it->ecl().phi());
2286 // double stheta(std::sqrt(it->ecl().error(2)));
2287 // double sphi(std::sqrt(it->ecl().error(5)));
2288 double st(std::sin(theta));
2289 double ct(std::cos(theta));
2290 double sp(std::sin(phi));
2291 double cp(std::cos(phi));
2292 HepPoint3D gamma_pos(r * st * cp, r * st * sp, r * ct);
2293 CLHEP::Hep3Vector gamma_vec(gamma_pos - epvtx);
2294 double hsq(gamma_vec.perp2());
2295 double rsq(gamma_vec.mag2());
2296 double stheta_sq_new = it->ecl().error(5) + epvtx_err(3, 3) * (hsq / (rsq * rsq));
2297 CLHEP::Hep3Vector gamma_dir(gamma_vec.unit());
2298 double e(it->ecl().energy());
2299 it->px(e * gamma_dir.x());
2300 it->py(e * gamma_dir.y());
2301 it->pz(e * gamma_dir.z());
2302 it->ecl().theta(gamma_dir.theta());
2303 it->ecl().r(gamma_vec.mag());
2304 it->ecl().error(5, stheta_sq_new);
2305 }
2306 }

◆ cupfunc()

double cupfunc ( const double  x,
const double  x1,
const double  x2,
const double  yc,
const double  a1,
const double  a2 
)
inline

cupfunc

Definition at line 1526 of file B2BIIFixMdstModule_trk.cc.

1527 {
1528 return x < x1 ? (x - x1) * a1 + yc :
1529 x > x2 ? (x - x2) * a2 + yc : yc;
1530 }

◆ ecl_adhoc_corr()

static double ecl_adhoc_corr ( int  Exp,
int  Run,
int  iflag05th,
double  Energy,
double   
)
static

The function giving correction factor.

Corresponding Data/MC so that energy in data should be divided by this.

Definition at line 155 of file B2BIIFixMdstModule_ecl.cc.

157 {
158 double return_value;
159
160 // Default.
161 return_value = 1.0;
162
163 double x = std::log10(Energy * 1000.0);
164 switch (Exp) {
165 case 7:
166 //if( x < 2.5 )
167 //{
168 // return_value = 0.85445 + 0.89162e-1*x
169 // -0.96202e-2*x*x -0.10944e-2*x*x*x;
170 //}
171 // New curve for b20020416 processed mdst.
172 if (x < 2.6) {
173 return_value = 0.85878 + 0.81947e-1 * x - 0.99708e-2 * x * x
174 - 0.28161e-3 * x * x * x;
175 }
176 break;
177 case 9:
178 //if( x < 3.0 )
179 //{
180 // return_value = 0.83416 + 0.93534e-1*x
181 // -0.71632e-2*x*x -0.19072e-2*x*x*x;
182 //}
183 // New curve for b20020416 processed mdst.
184 if (x < 3.2) {
185 return_value = 0.86582 + 0.63194e-1 * x - 0.59391e-2 * x * x
186 + 0.17727e-2 * x * x * x - 0.62325e-3 * x * x * x * x;
187 }
188 break;
189 case 11:
190 // Proper curve for b20010507 processed mdst.
191 //if( x < 3.0 )
192 //{
193 // return_value = 0.84927 + 0.86308e-1*x
194 // -0.93898e-2*x*x -0.10557e-2*x*x*x;
195 //}
196 //
197 // Proper curve for b20020416 processed mdst.
198 if (x < 3.7) {
199 if (x < 3.0) {
200 return_value = 0.88989 + 0.41082e-1 * x
201 - 0.21919e-2 * x * x + 0.27116e-2 * x * x * x - 0.89113e-3 * x * x * x * x;
202 } else { // Linear extrapolation to unity.
203 return_value = 0.994441 + 4.90176e-3 * (x - 3.0);
204 }
205 }
206 break;
207 case 13:
208 // Proper curve for b20010507 processed mdst.
209 //if( x < 3.0 )
210 //{
211 //return_value = 0.78138 + 0.17899*x
212 // -0.48821e-1*x*x +0.43692e-2*x*x*x;
213 //}
214 //
215 // Proper curve for b20020416 processed mdst.
216 if (x < 3.2) {
217 return_value = 0.87434 + 0.62145e-1 * x
218 - 0.29691e-2 * x * x - 0.15843e-2 * x * x * x + 0.86858e-4 * x * x * x * x;
219 }
220 break;
221 case 15:
222 // Proper curve for b20020125 processed mdst.
223 //if( x < 3.0 )
224 //{
225 // return_value = 0.86858 + 0.75587e-1*x
226 // -0.11150e-1*x*x -0.21454e-4*x*x*x;
227 //}
228 //else if( x < 3.67 ) // Lenear extrapolation to be unity.
229 //{
230 // return_value = 0.994412 + 8.11e-3*( x - 3.0 );
231 //}
232 // Proper curve for b20020416 processed mdst.
233 if (x < 3.2) {
234 return_value = 0.83073 + 0.10137 * x
235 - 0.59946e-2 * x * x - 0.56516e-2 * x * x * x + 0.87225e-3 * x * x * x * x;
236 }
237
238 break;
239 case 17:
240 // Proper curve for b20020416 processed mdst.
241 if (x < 3.0) {
242 return_value = 0.89260 + 0.54731e-1 * x
243 - 0.25736e-2 * x * x - 0.16493e-2 * x * x * x + 0.1032e-3 * x * x * x * x;
244 } else if (x < 3.5) {
245 return_value = 0.997459 + 0.0059039 * (x - 3.0);
246 }
247 break;
248 case 19:
249 // Correction curve obtained by Run001-299 HadronB
250 // processed by b20020416.
251 if (Run < 300) {
252 if (x < 3.0) {
253 return_value = 0.86432 + 0.87554e-1 * x
254 - 0.84182e-2 * x * x - 0.39880e-2 * x * x * x + 0.69435e-3 * x * x * x * x;
255 }
256 }
257 if (299 < Run && Run < 900) { // For Run300-899 or later by b20020416.
258 if (x < 2.9) {
259 return_value = 0.92082 + 0.45896e-1 * x
260 - 0.68067e-2 * x * x + 0.94055e-3 * x * x * x - 0.27717e-3 * x * x * x * x;
261 }
262 }
263 if (899 < Run) { // Till the end.
264 if (x < 3.1) {
265 return_value = 0.85154 + 0.97812e-1 * x
266 - 0.85774e-2 * x * x - 0.59092e-2 * x * x * x + 0.1121e-2 * x * x * x * x;
267 }
268 }
269 break;
270 case 21:
271 // Proper curve for b20021205 processed mdst.
272 if (x < 3.0) {
273 return_value = 0.84940 + 0.86266e-1 * x
274 - 0.82204e-2 * x * x - 0.12912e-2 * x * x * x;
275 }
276 break;
277 case 23:
278 // Proper curve for b20021205 processed mdst.
279 if (x < 3.1) {
280 return_value = 0.85049 + 0.85418e-1 * x
281 - 0.45747e-2 * x * x - 0.40081e-2 * x * x * x + 0.52113e-3 * x * x * x * x;
282 }
283 break;
284 case 25:
285 if (x < 3.0) {
286 return_value = 0.87001 + 0.73693e-1 * x
287 - 0.80094e-2 * x * x - 0.78527e-3 * x * x * x + 0.25888e-4 * x * x * x * x;
288 }
289 break;
290 case 27: // It turned out no signif. change through all the runs.
291 if (x < 2.85) {
292 return_value = 0.90051 + 0.56094e-1 * x
293 - 0.14842e-1 * x * x + 0.55555e-2 * x * x * x - 0.10378e-2 * x * x * x * x;
294 }
295 break;
296 case 31:
297 if (iflag05th == 1) { // For 0.5MeV threshold.
298 // For b20040429.
299 if (x < 2.95) {
300 return_value = 0.80295 + 0.13395 * x
301 - 0.10773e-1 * x * x - 0.85861e-2 * x * x * x + 0.15331e-2 * x * x * x * x;
302 }
303 } else { // For theta-dep. threshold.
304 if (x < 3.25) {
305 return_value = 0.57169 + 0.32548 * x
306 - 0.41157e-1 * x * x - 0.21971e-1 * x * x * x + 0.50114e-2 * x * x * x * x;
307 }
308 }
309 break;
310 case 33:
311 if (iflag05th == 1) { // For 0.5MeV threshold.
312 // For b20040429.
313 if (x < 2.64) {
314 return_value = 0.81153 + 0.10847 * x
315 - 0.24652e-2 * x * x - 0.54738e-2 * x * x * x + 0.41243e-3 * x * x * x * x;
316 }
317 } else { // For theta-dep. threshold, b20090127.
318 if (x < 3.15) {
319 return_value = 0.59869 + 0.29276 * x
320 - 0.15849e-1 * x * x - 0.31322e-1 * x * x * x + 0.62491e-2 * x * x * x * x;
321 }
322 }
323 break;
324 case 35:
325 if (iflag05th == 1) { // For 0.5MeV threshold.
326 // For b20040429.
327 if (x < 2.54) {
328 return_value = 0.83528 + 0.10402 * x
329 - 0.62047e-2 * x * x - 0.62411e-2 * x * x * x + 0.10312e-2 * x * x * x * x;
330 }
331 } else { // For theta-dep. threshold, b20090127.
332 if (x < 3.2) {
333 return_value = 0.58155 + 0.30642 * x
334 - 0.16981e-1 * x * x - 0.32609e-1 * x * x * x + 0.64874e-2 * x * x * x * x;
335 }
336 }
337 break;
338 case 37:
339 if (iflag05th == 1) { // For 0.5MeV threshold.
340 if (x < 2.5) {
341 return_value = 0.83706 + 0.10726 * x
342 - 0.62423e-2 * x * x - 0.42425e-2 * x * x * x;
343 }
344 } else { // For theta-dep. threshold.
345 if (x < 3.15) {
346 return_value = 0.58801 + 0.30569 * x
347 - 0.18832e-1 * x * x - 0.32116e-1 * x * x * x + 0.64899e-2 * x * x * x * x;
348 }
349 }
350 break;
351 case 39:
352 if (iflag05th == 1) { // For 0.5MeV threshold.
353 if (x < 3.0) {
354 if (x < 2.8) {
355 return_value = 0.80827 + 0.095353 * x
356 - 0.14818e-2 * x * x - 0.23854e-2 * x * x * x - 0.22454e-3 * x * x * x * x;
357 } else {
358 return_value = 0.0112468 * (x - 2.8) + 0.997847;
359 }
360 }
361 } else { // For theta-dep. threshold.
362 if (x < 3.25) {
363 return_value = 0.61133 + 0.27115 * x
364 - 0.12724e-1 * x * x - 0.28167e-1 * x * x * x + 0.54699e-2 * x * x * x * x;
365 }
366 }
367 break;
368 case 41:
369 if (iflag05th == 1) { // For 0.5MeV threshold.
370 if (Run < 800) {
371 if (x < 2.5) {
372 return_value = 0.90188 + 0.76563e-1 * x
373 - 0.16328e-1 * x * x + 0.56816e-3 * x * x * x;
374 }
375 }
376 if (799 < Run) { // Run1200-1261 no signif. change from Run800-1199.
377 if (x < 2.95) {
378 return_value = 0.88077 + 0.71720e-1 * x
379 - 0.92197e-2 * x * x - 0.15932e-2 * x * x * x + 0.38133e-3 * x * x * x * x;
380 }
381 }
382 } else { // For theta-dep. threshold.
383 if (x < 3.2) {
384 return_value = 0.57808 + 0.31083 * x
385 - 0.20247e-1 * x * x - 0.31658e-1 * x * x * x + 0.64087e-2 * x * x * x * x;
386 }
387 }
388 break;
389 case 43: // modified 20090829.
390 if (iflag05th == 1) { // For 0.5MeV threshold.
391 if (Run < 300) {
392 if (x < 3.3) {
393 return_value = 0.85592 + 0.93352e-1 * x
394 - 0.93144e-2 * x * x - 0.43681e-2 * x * x * x + 0.7971e-3 * x * x * x * x;
395 }
396 }
397 if (299 < Run && Run < 700) { // added 20050630.
398 if (x < 3.0) {
399 return_value = 0.89169 + 0.73301e-1 * x
400 - 0.13856e-1 * x * x + 0.47303e-3 * x * x * x;
401 }
402 }
403 if (699 < Run) { // added 20050727
404 if (x < 3.1) {
405 return_value = 0.90799 + 0.69815e-1 * x
406 - 0.17490e-1 * x * x + 0.14651e-2 * x * x * x;
407 }
408 }
409 } else { // For theta-dep. threshold b20090127.
410 if (x < 3.25) {
411 return_value = 0.58176 + 0.30245 * x - 0.16390e-1 * x * x
412 - 0.32258e-1 * x * x * x + 0.64121e-2 * x * x * x * x;
413 }
414 //if( 999 < Run ){// For 5S runs, 2/fb, obsolete 20091209.
415 //if( x < 3.3 ){
416 //return_value = 0.58463 + 0.29780*x -0.14441e-1*x*x
417 //-0.32323e-1*x*x*x + 0.63607e-2*x*x*x*x;
418 //}
419 //}
420 }
421 break;
422 case 45:
423 if (iflag05th == 1) { // For 0.5MeV threshold.
424 if (x < 3.1) { // added 20060413
425 return_value = 0.84823 + 0.10394 * x
426 - 0.92233e-2 * x * x - 0.72700e-2 * x * x * x + 0.14552e-2 * x * x * x * x;
427 }
428 } else { // For theta-dep. threshold b20090127.
429 if (x < 3.25) {
430 return_value = 0.62797 + 0.23897 * x
431 + 0.10261e-1 * x * x - 0.35700e-1 * x * x * x + 0.63846e-2 * x * x * x * x;
432 }
433 }
434 break;
435 case 47:
436 if (iflag05th == 1) { // For 0.5MeV threshold.
437 if (x < 3.1) { // added 20060420
438 return_value = 0.86321 + 0.82987e-1 * x
439 - 0.12139e-1 * x * x - 0.12920e-3 * x * x * x;
440 }
441 } else { // For theta-dep. threshold b20090127.
442 if (x < 3.25) {
443 return_value = 0.58061 + 0.30399 * x
444 - 0.17520e-1 * x * x - 0.31559e-1 * x * x * x + 0.62681e-2 * x * x * x * x;
445 }
446 }
447 break;
448 case 49:
449 if (iflag05th == 1) { // For 0.5MeV threshold.
450 if (x < 3.13) { // added 20060511
451 if (x < 2.80) {
452 return_value = 0.85616 + 0.78041e-1 * x
453 - 0.38987e-2 * x * x - 0.31224e-2 * x * x * x + 0.33374e-3 * x * x * x * x;
454 } else {
455 return_value = ((1.0 - 0.99608) / (3.13 - 2.80)) * (x - 2.80) + 0.99608;
456 }
457 }
458 } else { // For theta-dep. threshold b20090127.
459 if (x < 3.3) {
460 return_value = 0.57687 + 0.29948 * x
461 - 0.10594e-1 * x * x - 0.34561e-1 * x * x * x + 0.67064e-2 * x * x * x * x;
462 }
463 }
464 break;
465 case 51:
466 if (iflag05th == 1) { // For 0.5MeV threshold, added 20070323.
467 if (x < 3.07) {
468 return_value = 0.89063 + 0.72152e-1 * x
469 - 0.14143e-1 * x * x + 0.73116e-3 * x * x * x;
470 }
471 } else { // For theta-dep. threshold b20090127.
472 if (x < 3.3) {
473 return_value = 0.59310 + 0.28618 * x
474 - 0.13858e-1 * x * x - 0.30230e-1 * x * x * x + 0.59173e-2 * x * x * x * x;
475 }
476 }
477 break;
478 case 53: // modified 20090807.
479 if (iflag05th == 1) { // For 0.5MeV threshold.
480 if (x < 2.63) {
481 //std::cout<<"Exp.53 0.5MeV threshold."<<std::endl;
482 return_value = 0.83425 + 0.10468 * x
483 - 0.53641e-2 * x * x - 0.60276e-2 * x * x * x + 0.77763e-3 * x * x * x * x;
484 }
485 } else { // For theta-dep. threshold b20090127.
486 if (x < 3.1) {
487 //std::cout<<"Exp.53 theta-dep. threshold."<<std::endl;
488 return_value = 0.66100 + 0.25192 * x
489 - 0.16419e-1 * x * x - 0.25720e-1 * x * x * x + 0.52189e-2 * x * x * x * x;
490 }
491 }
492 break;
493 case 55:
494 if (iflag05th == 1) { // For 0.5MeV threshold.
495 if (x < 3.3) {
496 return_value = 0.86202 + 0.79575e-1 * x
497 - 0.66721e-2 * x * x - 0.28609e-2 * x * x * x + 0.42784e-3 * x * x * x * x;
498 }
499 } else { // For theta-dep. threshold b20090127.
500 if (x < 3.25) {
501 return_value = 0.58789 + 0.29310 * x
502 - 0.15784e-1 * x * x - 0.30619e-1 * x * x * x + 0.60648e-2 * x * x * x * x;
503 }
504 }
505 break;
506 case 61:
507 if (Run < 1210) { // On 4S by Th.-dep. threshold.
508 if (x < 3.5) {
509 return_value = 0.68839 + 0.18218 * x
510 - 0.23140e-2 * x * x - 0.17439e-1 * x * x * x + 0.29960e-2 * x * x * x * x;
511 }
512 }
513 if (Run > 1209) { // 5S scan.
514 if (iflag05th == 1) { // processed by 0.5MeV threshold.
515 if (x < 3.3) {
516 if (x < 2.8) {
517 return_value = 0.94294 - 0.77497e-2 * x
518 - 0.43464e-3 * x * x + 0.99837e-2 * x * x * x - 0.23726e-2 * x * x * x * x;
519 } else {
520 return_value = 0.0162997 * (x - 2.80) + 0.991162;
521 }
522 }
523 } else { // 5S scan. by Th.-dep. threshold.
524 if (x < 3.5) {
525 return_value = 0.64816 + 0.22492 * x
526 - 0.91745e-2 * x * x - 0.21736e-1 * x * x * x + 0.41333e-2 * x * x * x * x;
527 }
528 }
529 }
530 break;
531 case 63:
532 if (x < 3.4) {
533 return_value = 0.69302 + 0.18393 * x
534 - 0.10983e-1 * x * x - 0.14148e-1 * x * x * x + 0.27298e-2 * x * x * x * x;
535 }
536 break;
537 case 65:
538 if (Run > 1000) { // 1S run turned out to be same as 5S scan.
539 if (iflag05th == 1) { // For 0.5MeV threshold.
540 if (x < 3.3) {
541 if (x < 2.8) {
542 return_value = 0.94294 - 0.77497e-2 * x
543 - 0.43464e-3 * x * x + 0.99837e-2 * x * x * x - 0.23726e-2 * x * x * x * x;
544 } else {
545 return_value = 0.0162997 * (x - 2.80) + 0.991162;
546 }
547 }
548 } else { // For theta-dep. threshold, b20090127.
549 if (x < 3.6) {
550 return_value = 0.70987 + 0.16230 * x
551 - 0.64867e-2 * x * x - 0.12021e-1 * x * x * x + 0.20874e-2 * x * x * x * x;
552 }
553 }
554 } else { // 4S runs processed with new lib.
555 if (x < 3.4) {
556 return_value = 0.66833 + 0.20602 * x
557 - 0.14322e-1 * x * x - 0.15712e-1 * x * x * x + 0.31114e-2 * x * x * x * x;
558 }
559 }
560 break;
561 case 67:
562 if (x < 3.4) {
563 return_value = 0.64196 + 0.23069 * x
564 - 0.20303e-1 * x * x - 0.15680e-1 * x * x * x + 0.31611e-2 * x * x * x * x;
565 }
566 break;
567 case 69:
568 if (x < 3.35) {
569 //return_value = 0.64196 + 0.23752*x
570 //-0.85197e-2*x*x -0.24366e-1*x*x*x +0.46397e-2*x*x*x*x;
571 return_value = 0.99 * (0.64196 + 0.23752 * x
572 - 0.85197e-2 * x * x - 0.24366e-1 * x * x * x
573 + 0.46397e-2 * x * x * x * x);
574 }
575 break;
576 case 71:
577 if (x < 3.35) {
578 return_value = 0.66541 + 0.12579 * x
579 + 0.89999e-1 * x * x - 0.58305e-1 * x * x * x + 0.86969e-2 * x * x * x * x;
580 }
581 break;
582 case 73:
583 if (x < 3.45) {
584 return_value = 0.62368 + 0.24142 * x
585 - 0.11677e-1 * x * x - 0.22477e-1 * x * x * x + 0.42765e-2 * x * x * x * x;
586 }
587 break;
588 }
589 // This return value has to be used as division.
590 // i.e. E_corrected = E_original/return_vale.
591 return return_value;
592 }

◆ ecl_adhoc_corr_45()

static double ecl_adhoc_corr_45 ( int  exp,
int  ,
int  cid 
)
static

The function giving correction factor in Exp.45.

Definition at line 598 of file B2BIIFixMdstModule_ecl.cc.

599 {
600
601 const int bcid[] = {
602 243, 244, 316, 317, 318, 412, 413, 414, 508, 509, 510, 604, 605, 606
603 };
604
605 const double bcfact[] = {
606 1.06215, 1.06589, 0.953827, 1.06607, 0.943696, 0.910855, 1.01201,
607 1.01704, 0.954612, 1.02761, 1.00716, 1.0319, 1.03135, 1.05782
608 };
609
610 if (exp != 45) return 1.;
611
612 for (int i = 0 ; i < 14 ; i++)
613 if (bcid[i] == cid)
614 return bcfact[i];
615
616 return 1.;
617 }

◆ ecl_mcx3_corr()

static double ecl_mcx3_corr ( int  ,
int  ,
double  energy,
double   
)
static

Correct energy scale (MC) to make pi0 peak nominal.

Definition at line 623 of file B2BIIFixMdstModule_ecl.cc.

624 {
625 //KM std::cout<<"ecl_mcx3_corr called."<<std::endl;
626 double return_value;
627 double x = std::log10(energy * 1000.0);
628 return_value = 1.0;
629 if (x < 3.2) {
630 return_value = 0.72708 + 0.22735 * x
631 - 0.20603e-1 * x * x - 0.24644e-1 * x * x * x + 0.53480e-2 * x * x * x * x;
632 }
633 //std::cout<<"energy="<<energy<<" ecl_mcx3="<<return_value<<std::endl;
634 return return_value;
635 }

◆ event()

void event ( void  )
overridevirtual

Called for each event.

Reimplemented from Module.

Definition at line 235 of file B2BIIFixMdstModule.cc.

236 {
237 int result;
238
239 if (!m_eventExtraInfo.isValid())
240 m_eventExtraInfo.create();
241
242 if ((BsCouTab(BELLE_EVENT) == 0) || (BsCouTab(MDST_EVENT_ADD) == 0)) {
243 B2INFO("Warning from B2BIIFixMdst: No Belle_event or Mdst_event_add table; no correction for event");
245 m_eventExtraInfo->addExtraInfo("FixMdstResult", -1);
246 setReturnValue(-1);
247 return;
248 }
249
252 } else if (m_add_or_remove_extra_trk_vee2 == -1) {
254 }
255
259
260 if (m_scale_error == 1) scale_error();
261
262 if (m_smear_trk != 0) smear_trk();
263
265
266 HepPoint3D pv;
267 CLHEP::HepSymMatrix dpv(3, 0);
268 int err(1);
270 err = set_primary_vertex(pv, dpv);
271 if (err == 0)correct_ecl_primary_vertex(pv, dpv);
272 }
273
274 if (m_make_pi0 == 1 || m_make_pi0_primary_vertex == 1) {
275 if (m_make_pi0_primary_vertex == 1 && err == 0) {
277 } else {
279 }
281 }
282
283 if (m_benergy == 1) s_benergy_value = Benergy();
284
285 if (m_good_event == 1) {
286 if (good_event()) {
287 result = 1;
288 } else {
290 m_eventExtraInfo->addExtraInfo("FixMdstResult", -1);
291 setReturnValue(-1);
292 B2DEBUG(99, "B2BIIFixMdst: Not a good event");
293 return;
294 }
295 } else {
296 result = 0;
297 }
298
299 if (m_l4passed_only == 1) {
300 if (BsCouTab(L4_SUMMARY)) {
301 struct l4_summary* l =
302 (struct l4_summary*) BsGetEnt(L4_SUMMARY, 1, BBS_No_Index);
303 if (l->m_type == 0) {
305 m_eventExtraInfo->addExtraInfo("FixMdstResult", -1);
306 setReturnValue(-1);
307 B2DEBUG(99, "B2BIIFixMdst: L4 cut");
308 return;
309 }
310 }
311 }
312
313 if (m_hadron_a_only == 1) {
314 Belle::Evtcls_flag_Manager& EvtFlagMgr = Belle::Evtcls_flag_Manager::get_manager();
315 Belle::Evtcls_flag_Manager::iterator it1 = EvtFlagMgr.begin();
316 if (it1 != EvtFlagMgr.end() && *it1) {
317 if ((*it1).flag(0) < 10) {
319 m_eventExtraInfo->addExtraInfo("FixMdstResult", -1);
320 setReturnValue(-1);
321 B2DEBUG(99, "B2BIIFixMdst: HadA cut");
322 return;
323 }
324 }
325 }
326
327 if (m_hadron_b_only == 1) {
328 Belle::Evtcls_hadronic_flag_Manager& HadMgr
329 = Belle::Evtcls_hadronic_flag_Manager::get_manager();
330 Belle::Evtcls_hadronic_flag_Manager::iterator ith = HadMgr.begin();
331 if (ith != HadMgr.end() && *ith) {
332 if ((*ith).hadronic_flag(2) <= 0) {
334 m_eventExtraInfo->addExtraInfo("FixMdstResult", -1);
335 setReturnValue(-1);
336 B2DEBUG(99, "B2BIIFixMdst: HadB cut");
337 return;
338 }
339 }
340 }
341
342 if (m_table_size == 1) {
343 Belle::Belle_event_Manager& bevt = Belle::Belle_event_Manager::get_manager();
344 // if( bevt[0].ExpNo() >=39 ) {
345 if ((m_reprocess_version == 0 && bevt.count() > 0 && bevt[0].ExpNo() >= 39) ||
346 (m_reprocess_version >= 1)) {
347 if (Belle::Mdst_ecl_trk_Manager::get_manager().count() > m_limit_mdst_ecl_trk) {
349 m_eventExtraInfo->addExtraInfo("FixMdstResult", -1);
350 setReturnValue(-1);
351 B2INFO("B2BIIFixMdst: " << Belle::Mdst_ecl_trk_Manager::get_manager().count() << " " << m_limit_mdst_ecl_trk);
352 return;
353 }
354 if (Belle::Mdst_klm_cluster_hit_Manager::get_manager().count()
357 m_eventExtraInfo->addExtraInfo("FixMdstResult", -1);
358 setReturnValue(-1);
359 B2INFO("B2BIIFixMdst: " << Belle::Mdst_klm_cluster_hit_Manager::get_manager().count() << " " << m_limit_mdst_klm_cluster_hit);
360 return;
361 }
362 }
363 }
364
365 if (m_calib_dedx != 0) {
366 Belle::Belle_event_Manager& bevt = Belle::Belle_event_Manager::get_manager();
367 if (bevt[0].ExpMC() == 1 || m_reprocess_version == 0 || m_calib_dedx == -1) Belle::Calib_dEdx();
368 }
369
371
372 if (m_mapped_expno > 0) Muid_event();
373
375 m_eventExtraInfo->addExtraInfo("FixMdstResult", result);
376 setReturnValue(result);
377 }
void Muid_event(void)
Called for each event.
StoreObjPtr< EventExtraInfo > m_eventExtraInfo
Event ExtraInfo.
void setReturnValue(int value)
Sets the return value for this module as integer.
Definition: Module.cc:220
void fix_pi0_brecon(void)
Fix relation gamma<->pi0 in brecon table.
void make_pi0(int, double, double)
Create Mdst_pi0 from Mdst_gamma and Mdst_ecl to let people get mass-constraint fitted momentum of pi0...
void shift_tof(const int mode)
Shift tof times to account for residuals.
void make_pi0_primary_vertex(int, double, double, const HepPoint3D &, const CLHEP::HepSymMatrix &)
Fill Mdst_pi0 based on the fit result.
void smear_trk()
Apply track smearing (on MC)
double Benergy(int expnum=0, int runnum=0)
Return Beam energy.
int remove_extra_trk_vee2()
Remove extra tracks from Mdst_trk and Mdst_vee2.
void correct_ecl_primary_vertex(const HepPoint3D &, const CLHEP::HepSymMatrix &)
Correct ecl using primary vertex.
void correct_ecl(int, int)
Correct photon's momenta and error matrix.
int add_extra_trk_vee2()
Add Mdst_trk_extra and Mdst_vee_extra to Mdst_trk and Mdst_vee2, respectively.
int set_primary_vertex(HepPoint3D &v, CLHEP::HepSymMatrix &ve)
Set primary vertex assuming all tracks are pions.
static double s_benergy_value
Beam energy.
void scale_momenta(float scale_data=1.0, float scale_mc=1.0, int mode=0)
Scale momenta of Mdst_trk.
bool good_event()
Check if event correspondes to the period when Belle detector not in good condition.
void scale_error(const int message_level=0)
Apply scale error.

◆ fix_pi0_brecon()

void fix_pi0_brecon ( void  )
private

Fix relation gamma<->pi0 in brecon table.

Definition at line 36 of file B2BIIFixMdstModule_brecon.cc.

37 {
38 Belle::Brecon_Manager& breconmgr = Belle::Brecon_Manager::get_manager();
39 if (!breconmgr.count()) return;
40 Belle::Mdst_pi0_Manager& pi0mgr = Belle::Mdst_pi0_Manager::get_manager();
41
42 for (std::vector<Belle::Brecon>::iterator it = breconmgr.begin();
43 it != breconmgr.end(); ++it) {
44
45 // select the table of pi0->gamma gamma
46 if (std::abs((*it).pcode()) != 111) continue;
47 const int da_first((*it).daFirst());
48 const int da_last((*it).daLast());
49 if (da_first < 1 || da_last < 1) continue;
50 if (da_last - da_first != 1) continue;
51 const Belle::Brecon& gamma1(breconmgr[da_first - 1]);
52 const Belle::Brecon& gamma2(breconmgr[da_last - 1]);
53 if (gamma1.stable() != 2 || gamma2.stable() != 2) continue;
54
55 // find corresponding Mdst_pi0
56 int pi0_ID(-1);
57 const Belle::Panther_ID g1(gamma1.idmdst());
58 const Belle::Panther_ID g2(gamma2.idmdst());
59 for (std::vector<Belle::Mdst_pi0>::const_iterator it2 = pi0mgr.begin();
60 it2 != pi0mgr.end(); ++it2) {
61 const Belle::Panther_ID da1((*it2).gamma_ID(0));
62 const Belle::Panther_ID da2((*it2).gamma_ID(1));
63 if ((g1 == da1 && g2 == da2) || (g1 == da2 && g2 == da1)) {
64 pi0_ID = (int)(*it2).get_ID();
65 break;
66 }
67 }
68
69 // modify brecon table
70 switch (pi0_ID) {
71 case -1: // corresponding Mdst_pi0 is not found after make_pi0
72 (*it).stable(0);
73 (*it).idmdst(0);
74 break;
75 default:
76 (*it).stable(4);
77 (*it).idmdst(pi0_ID);
78 break;
79 }
80 }
81 }

◆ get_event_id()

static void get_event_id ( int *  no_exp,
int *  no_run,
int *  no_evt,
int *  no_frm,
int *  expmc 
)
static

Get event ID.

Definition at line 1469 of file B2BIIFixMdstModule_trk.cc.

1470 {
1471 *no_exp = -1, *no_run = -1, *no_evt = -1, *no_frm = -1;
1472
1473 belle_event* belle_event;
1474 belle_event = (struct belle_event*)BsGetEnt(BELLE_EVENT, 1, BBS_No_Index);
1475 if (belle_event) {
1476 *no_exp = belle_event->m_ExpNo;
1477 *no_run = belle_event->m_RunNo;
1478 *no_evt = belle_event->m_EvtNo & 0x0fffffff;
1479 *no_frm = (unsigned int)belle_event->m_EvtNo >> 28;
1480 *expmc = belle_event->m_ExpMC;
1481 }
1482 }

◆ get_reprocess_version()

int get_reprocess_version ( )
private

Get reprocess version of input mdst.

Definition at line 422 of file B2BIIFixMdstModule.cc.

423 {
424
425 int version(0);
426 Belle::Belle_version_Manager& bvmgr = Belle::Belle_version_Manager::get_manager();
427
429 //*** version set forcedly ***
431 B2INFO("reprocess version forcedly set to " << version);
432
433 } else {
434 //*** version set based on info. in run-header ***
435 Belle::Belle_processing_Manager& bpmgr = Belle::Belle_processing_Manager::get_manager();
436 Belle::Belle_runhead_Manager& evtmgr = Belle::Belle_runhead_Manager::get_manager();
437 Belle::Belle_runhead_Manager::const_iterator belleevt = evtmgr.begin();
438
439 int expmc(0), exp(0), run(0);
440 if (belleevt != evtmgr.end() && (*belleevt)) {
441 expmc = belleevt->ExpMC();
442 exp = belleevt->ExpNo();
443 run = belleevt->RunNo();
444 }
445
446 int B_l_d = 0;
447 //int Date = 0;
448 if (bpmgr.count() > 0) {
449 int i = bpmgr.count() - 1;
450 B_l_d = bpmgr[i].Belle_level_date();
451 //Date = bpmgr[i].Date();
452 }
453
454 if (bvmgr.count() > 0) {
455 //Belle::Belle_version is in run-header: MC or (DATA with level > 20081107)
456 // int j = bvmgr.count() - 1;
457 int j = 0;
458 int chk = std::abs(bvmgr[j].SVD())
459 + std::abs(bvmgr[j].CDC())
460 + std::abs(bvmgr[j].ECL());
461 if (chk == 0) {
462 version = 0;
463 } else {
464 version = 1;
465 }
466 } else {
467 //no Belle::Belle_version in run-header: DATA with level <= 20081107
468 if (expmc == 2 || (expmc == 1
469 && B_l_d > 20081107))
470 B2ERROR("No Belle::Belle_version table in run-header for MC or (Data processed with Belle_level > 20081107). Strange !");
471
472 if (B_l_d == 20081107) {
473 version = 1;
474 //exception: U(1S) run w/old tracking & old ECL
475 // if( exp==65 && run >= 1000 && Date <= 20081130 ) version = 0;
476 if (exp == 65 && run >= 1000) version = 0;
477 } else {
478 version = 0;
479 }
480 }
481 }
482
483 if (bvmgr.count() == 0) {
484 Belle::Belle_version& bv = bvmgr.add();
485 bv.SVD(version);
486 bv.CDC(version);
487 bv.ECL(version);
488 } else if (bvmgr.count() > 0) {
489 if (bvmgr[0].SVD() != version) {
490 B2WARNING("Belle::Belle_version_SVD(=" << bvmgr[0].SVD() << ") is inconsistent with version(=" << version <<
491 "); replace it anyway");
492 bvmgr[0].SVD(version);
493 }
494 if (bvmgr[0].CDC() != version) {
495 B2WARNING("Belle::Belle_version_CDC(=" << bvmgr[0].CDC() << ") is inconsistent with version(=" << version <<
496 "); replace it anyway");
497 bvmgr[0].CDC(version);
498 }
499 if (bvmgr[0].ECL() != version) {
500 B2WARNING("Belle::Belle_version_ECL(=" << bvmgr[0].ECL() << ") is inconsistent with version(=" << version <<
501 "); replace it anyway");
502 bvmgr[0].ECL(version);
503 }
504 }
505
506 return version;
507 }

◆ 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   
)
static

Get scale error fucntion for different Exp.

Definition at line 2624 of file B2BIIFixMdstModule_trk.cc.

2625 {
2626 return
2627 (7 <= no_exp && no_exp <= 23) ? EXP0723_scale :
2628 (25 <= no_exp && no_exp <= 27) ? EXP2527_scale :
2629 (31 == no_exp) ? EXP31_scale :
2630 (33 == no_exp) ? EXP33_scale :
2631 (35 == no_exp) ? EXP35_scale :
2632 (37 == no_exp) ? EXP37_scale :
2633 (39 == no_exp || 41 == no_exp) ? EXP3941_scale :
2634 (43 == no_exp) ? EXP43_scale :
2635 (45 == no_exp) ? EXP45_scale :
2636 (47 == no_exp) ? EXP47_scale :
2637 (49 == no_exp) ? EXP49_scale :
2638 (51 == no_exp) ? EXP51_scale :
2639 (53 == no_exp) ? EXP53_scale :
2640 (55 == no_exp) ? EXP55_scale :
2641 (61 <= no_exp && no_exp <= 65) ? EXP6165_scale :
2642 (67 == no_exp) ? EXP67_scale :
2643 // ( 69==no_exp || 71==no_exp ) ? EXP6971_scale : DUMMY_scale;
2644 (69 <= no_exp && 73 >= no_exp) ? EXP6971_scale : DUMMY_scale;
2645 }
static const struct cal_scale_error_func_set_t EXP6165_scale
Scale error for Exp.61-65.
static const struct cal_scale_error_func_set_t EXP45_scale
Scale error for Exp.45.
static const struct cal_scale_error_func_set_t EXP3941_scale
Scale error for Exp.39,41.
static const struct cal_scale_error_func_set_t EXP31_scale
Scale error for Exp.31.
static const struct cal_scale_error_func_set_t EXP6971_scale
Scale error for Exp.69-71.
static const struct cal_scale_error_func_set_t EXP53_scale
Scale error for Exp.53.
static const struct cal_scale_error_func_set_t EXP0723_scale
Scale error for Exp.7-23.
static const struct cal_scale_error_func_set_t DUMMY_scale
Dummy scale.
static const struct cal_scale_error_func_set_t EXP35_scale
Scale error for Exp.35.
static const struct cal_scale_error_func_set_t EXP49_scale
Scale error for Exp.49.

◆ good_event()

bool good_event ( )
private

Check if event correspondes to the period when Belle detector not in good condition.

Definition at line 509 of file B2BIIFixMdstModule.cc.

510 {
511
512 bool ret = true;
513
514 Belle::Mdst_quality_Manager& qmgr = Belle::Mdst_quality_Manager::get_manager();
515 if (0 == qmgr.count()) return ret; //do nothing if not exist
516
517 for (std::vector<Belle::Mdst_quality>::iterator it = qmgr.begin();
518 it != qmgr.end(); ++it) {
519 Belle::Mdst_quality& q = *it;
520 std::string c(q.name()());
521 // if((strcmp(c,"SVD ")==0) && (q.quality() & 0x02)) ret = false;
522 //also to remove exp9 bad svd events
523 if ((strcmp(c.c_str(), "SVD ") == 0) && (q.quality() & 0x8002)) ret = false;
524 }
525 return ret;
526 }

◆ initialize() [1/2]

void initialize ( void  )
overridevirtual

Initialize phanter banks.

Reimplemented from Module.

Definition at line 84 of file B2BIIConvertBeamParamsModule.cc.

85 {
86 BsInit(0);
87 m_event.isRequired();
88 }

◆ initialize() [2/2]

void initialize ( void  )
overridevirtual

Initialize the module.

Reimplemented from Module.

Definition at line 223 of file B2BIIFixMdstModule.cc.

224 {
225 Muid_init();
227 m_eventExtraInfo.registerInDataStore();
228 }
void Muid_init(void)
Initialize the Muid module.

◆ is_already_scaled()

static bool is_already_scaled ( void  )
static

Check if event is already scaled.

Definition at line 1486 of file B2BIIFixMdstModule_trk.cc.

1487 {
1488 Belle::Mdst_event_add_Manager& addmgr = Belle::Mdst_event_add_Manager::get_manager();
1489 if (addmgr.count() >= 1) {
1490
1491 if (addmgr[0].flag_error() == 1) {
1492 if (SE_Message_Level >= 1) B2ERROR("scale_error: already applied");
1493 return true;
1494 } else {
1495 if (SE_Message_Level >= 2) B2ERROR("scale_error: to be applied");
1496 addmgr[0].flag_error(1);
1497 return false;
1498 }
1499
1500 } else {
1501
1502 static int first = 1;
1503 B2ERROR("scale_error: no Mdst_event_add");
1504 if (first) {
1505 B2ERROR("scale_error: analysis continues");
1506 B2ERROR("scale_error: scale_error will not be applied");
1507 first = 0;
1508 }
1509 return true;
1510 }
1511 }

◆ lambdafunc()

double lambdafunc ( const double  x,
const double  x1,
const double  x2,
const double  yc,
const double  a1,
const double  a2,
const double  a3 
)
inline

lambdafunc

Definition at line 1541 of file B2BIIFixMdstModule_trk.cc.

1542 {
1543 return x < x1 ? (x - x1) * a1 + yc :
1544 x < x2 ? (x - x1) * a2 + yc : (x - x2) * a3 + (x2 - x1) * a2 + yc;
1545 }

◆ make_pi0()

void make_pi0 ( int  option,
double  low_limit,
double  up_limit 
)
private

Create Mdst_pi0 from Mdst_gamma and Mdst_ecl to let people get mass-constraint fitted momentum of pi0 after ad_hoc correction.

Definition at line 1569 of file B2BIIFixMdstModule_ecl.cc.

1570 {
1571 //---------------------
1572 // Check Exp. number and Data/MC.
1573 //---------------------
1574 Belle::Belle_event_Manager& evtmgr = Belle::Belle_event_Manager::get_manager();
1575 if (0 == evtmgr.count()) {
1576 // Do nothing if not exist, because we can not know whether
1577 // this event is Exp. data or MC.
1578 return;
1579 }
1580 //Check data or mc. Data:expmc=1, MC:expmc=2.
1581 int expmc = evtmgr[0].ExpMC();
1582 // Check Exp. number.
1583 int Eno = evtmgr[0].ExpNo();
1584 // Set mcdata frag to be compatible with pi0resol func.
1585 bool mcdata = 0;
1586 if (expmc == 2) {
1587 mcdata = 1;
1588 }
1589
1590 // pi0 mass of PDG.
1591 const double mpi0_pdg = 0.1349739;
1592
1593 // Default mass window.
1594 // const double low_default = 0.1178;
1595 // const double up_default = 0.1502;
1596 const double low_default = 0.080; // modified 20040606
1597 const double up_default = 0.180; // modified 20040606
1598
1599 // Maximum iteration of fit.
1600 const int iter_max = 5;
1601
1602 // Check whether proper option and mass window are given.
1603 switch (option) {
1604 case 0: // option=0 case, set default mass window.
1605 low_limit = low_default;
1606 up_limit = up_default;
1607 break;
1608 case 1: // option=1 case, check given mass window.
1609 if (mpi0_pdg < low_limit || up_limit < mpi0_pdg) {
1610 // If mass window is not correct, do nothing.
1611 B2ERROR("Invalid mass window between ");
1612 B2ERROR(" and " << up_limit);
1613 return;
1614 }
1615 break;
1616 case 2: // pi0 cand. are selected by -Xsigma < Mgg-Mpi0 < +Xsigma.
1617 // dout(Debugout::DDEBUG,"B2BIIFixBelle::Mdst_ecl") << "option=2 was selected." << std::endl;
1618 //dbg dout(Debugout::INFO,"B2BIIFixBelle::Mdst_ecl") << "mass window is " << low_limit << " & ";
1619 //dbg dout(Debugout::INFO,"B2BIIFixBelle::Mdst_ecl") << up_limit << std::endl;
1620 if (0.0 < low_limit || up_limit < 0.0) {
1621 B2ERROR("option=2 was selected. ");
1622 B2ERROR("Invalid mass window! " << low_limit);
1623 B2ERROR(" should be negative, and " << up_limit);
1624 B2ERROR(" should be positive.");
1625 return;
1626 }
1627 break;
1628 default: // Otherwise, invalid option, do nothing.
1629 B2ERROR("Invalid option=" << option);
1630 return;
1631 }
1632
1633 // At first, clear already existing Belle::Mdst_pi0.
1634 Belle::Mdst_pi0_Manager::get_manager().remove();
1635
1636 // Get Belle::Mdst_gamma for photon's momentum
1637 // and get Belle::Mdst_ecl for error matrix.
1638 Belle::Mdst_gamma_Manager& gammamgr = Belle::Mdst_gamma_Manager::get_manager();
1639
1640 // Re-allocate Belle::Mdst_pi0 table.
1641 Belle::Mdst_pi0_Manager& pi0mgr = Belle::Mdst_pi0_Manager::get_manager();
1642
1643 // If Only one photon in the event, no need to do anything.
1644 if (gammamgr.count() < 2) {
1645 return;
1646 }
1647
1648 // Make combination of two Belle::Mdst_gamma.
1649 for (std::vector<Belle::Mdst_gamma>::iterator itgamma = gammamgr.begin();
1650 itgamma != gammamgr.end(); ++itgamma) {
1651 Belle::Mdst_gamma& gamma1 = *itgamma;
1652 CLHEP::Hep3Vector gamma1_3v(gamma1.px(), gamma1.py(), gamma1.pz());
1653 CLHEP::HepLorentzVector gamma1_lv(gamma1_3v, gamma1_3v.mag());
1654
1655 Belle::Mdst_ecl& ecl1 = gamma1.ecl();
1656
1657 for (std::vector<Belle::Mdst_gamma>::iterator jtgamma = itgamma + 1;
1658 jtgamma != gammamgr.end(); ++jtgamma) {
1659 Belle::Mdst_gamma& gamma2 = *jtgamma;
1660 CLHEP::Hep3Vector gamma2_3v(gamma2.px(), gamma2.py(), gamma2.pz());
1661 CLHEP::HepLorentzVector gamma2_lv(gamma2_3v, gamma2_3v.mag());
1662
1663 Belle::Mdst_ecl& ecl2 = gamma2.ecl();
1664
1665 // Invariant mass before const. fit.
1666 CLHEP::HepLorentzVector gamgam_lv = gamma1_lv + gamma2_lv;
1667 const double mass_before = gamgam_lv.mag();
1668
1669 // In the case of option=0 or 1, criteria is controlled
1670 // by the inv. mass.
1671 double mass_ctrl{0};
1672 if (option == 0 || option == 1) {
1673 mass_ctrl = mass_before;
1674 }
1675 if (option == 2) {
1676 // Asymmetric lineshape is taken into account.
1677 if (mass_before * mpi0pdg(mass_before) < mpi0_pdg) {
1678 mass_ctrl = (mass_before * mpi0pdg(mass_before) - mpi0_pdg) /
1679 pi0resol(gamgam_lv.vect().mag(),
1680 gamgam_lv.theta() * 180. / M_PI, "lower",
1681 mcdata, Eno, option);
1682 } else {
1683 mass_ctrl = (mass_before * mpi0pdg(mass_before) - mpi0_pdg) /
1684 pi0resol(gamgam_lv.vect().mag(),
1685 gamgam_lv.theta() * 180. / M_PI, "higher",
1686 mcdata, Eno, option);
1687 }
1688 }
1689
1690 // If invariant mass is inside the window,
1691 // if( low_limit < mass_before && mass_before < up_limit ) // old.
1692 if (low_limit < mass_ctrl && mass_ctrl < up_limit) {
1693 // dout(Debugout::DDEBUG,"B2BIIFixBelle::Mdst_ecl")<<"mass="<<mass_before;
1694 // dout(Debugout::DDEBUG,"B2BIIFixBelle::Mdst_ecl")<<" p="<<gamgam_lv.vect().mag()<<" theta=";
1695 // dout(Debugout::DDEBUG,"B2BIIFixBelle::Mdst_ecl")<<gamgam_lv.theta()<<" mcdata="<<mcdata;
1696 // dout(Debugout::DDEBUG,"B2BIIFixBelle::Mdst_ecl")<<" higher="<<
1697 // pi0resol(gamgam_lv.vect().mag(),
1698 // gamgam_lv.theta()*180./M_PI,
1699 // "higher",mcdata, Eno, option )<<" or ";
1700 // dout(Debugout::DDEBUG,"B2BIIFixBelle::Mdst_ecl")<<" lower="<<
1701 // pi0resol(gamgam_lv.vect().mag(),
1702 // gamgam_lv.theta()*180./M_PI,
1703 // "lower",mcdata, Eno, option )<<std::endl;
1704 // Error matrix(covariant matrix)
1705 CLHEP::HepMatrix V(6, 6, 0);
1706
1707 V[0][0] = ecl1.error(0);
1708 V[0][1] = V[1][0] = ecl1.error(1);
1709 V[1][1] = ecl1.error(2);
1710 V[0][2] = V[2][0] = ecl1.error(3);
1711 V[1][2] = V[2][1] = ecl1.error(4);
1712 V[2][2] = ecl1.error(5);
1713 V[3][3] = ecl2.error(0);
1714 V[3][4] = V[4][3] = ecl2.error(1);
1715 V[4][4] = ecl2.error(2);
1716 V[3][5] = V[5][3] = ecl2.error(3);
1717 V[4][5] = V[5][4] = ecl2.error(4);
1718 V[5][5] = ecl2.error(5);
1719
1720 // Measurements; i.e. initial parameters.
1721 CLHEP::HepMatrix y0(6, 1);
1722 y0[0][0] = ecl1.energy();
1723 y0[1][0] = ecl1.phi();
1724 y0[2][0] = ecl1.theta();
1725 y0[3][0] = ecl2.energy();
1726 y0[4][0] = ecl2.phi();
1727 y0[5][0] = ecl2.theta();
1728
1729 // Copy them to proper matrix which is given to fit.
1730 CLHEP::HepMatrix y(y0);
1731 // Delivative.
1732 CLHEP::HepMatrix Dy(6, 1, 0);
1733
1734 int iter = 0;
1735 double f_old = DBL_MAX;
1736 double chi2_old = DBL_MAX;
1737 double /*mass_gg,*/ chi2 = DBL_MAX;
1738 bool exit_flag = false;
1739
1740 // Set parameters to decide whether converged.
1741 const double Df_limit = 0.1;
1742 const double Dchi2_limit = 0.1;
1743 // Do mass constraint fit; iterate until convergence.
1744 while (1) {
1745 const double& E1 = y[0][0];
1746 const double& E2 = y[3][0];
1747 const double sin_theta1 = std::sin(y[2][0]);
1748 const double cos_theta1 = std::cos(y[2][0]);
1749 const double sin_theta2 = std::sin(y[5][0]);
1750 const double cos_theta2 = std::cos(y[5][0]);
1751 const double Dphi = y[1][0] - y[4][0];
1752 const double cos_Dphi = std::cos(Dphi);
1753 const double sin_Dphi = std::sin(Dphi);
1754 const double open_angle = sin_theta1 * sin_theta2 * cos_Dphi
1755 + cos_theta1 * cos_theta2;
1756 const double mass2_gg = 2 * E1 * E2 * (1 - open_angle);
1757 //mass_gg = (mass2_gg > 0) ? std::sqrt(mass2_gg) : -std::sqrt(-mass2_gg);
1758
1759 // No more iteration. Break to return.
1760 if (exit_flag || ++iter > iter_max)
1761 break;
1762
1763 // constraint
1764 CLHEP::HepMatrix f(1, 1);
1765 f[0][0] = mass2_gg - (mpi0_pdg * mpi0_pdg);
1766
1767 // dG/dq_i, G = (M_gg - M_pi0) = 0 is the constraint.
1768 CLHEP::HepMatrix B(1, 6);
1769 B[0][0] = mass2_gg / E1;
1770 B[0][1] = 2 * E1 * E2 * sin_theta1 * sin_theta2 * sin_Dphi;
1771 B[0][2] = 2 * E1 * E2 * (-cos_theta1 * sin_theta2 * cos_Dphi
1772 + sin_theta1 * cos_theta2);
1773 B[0][3] = mass2_gg / E2;
1774 B[0][4] = -B[0][1];
1775 B[0][5] = 2 * E1 * E2 * (-sin_theta1 * cos_theta2 * cos_Dphi
1776 + cos_theta1 * sin_theta2);
1777
1778 const double sigma2_mass2_gg = (B * V * B.T())[0][0];
1779
1780 // Proceed one step to get newer value y.
1781 Dy = V * B.T() * (B * Dy - f) / sigma2_mass2_gg;
1782 y = y0 + Dy;
1783 int ierr;
1784 chi2 = (Dy.T() * V.inverse(ierr) * Dy)[0][0];
1785 double Dchi2 = fabs(chi2 - chi2_old);
1786 chi2_old = chi2;
1787 double Df = fabs(f[0][0] - f_old);
1788 f_old = f[0][0];
1789
1790 // When chi-sq. change is small enough and mass is
1791 if (Dchi2 < Dchi2_limit && Df < Df_limit)
1792 exit_flag = true;;
1793
1794 }
1795 // Sort fitted result into proper variables.
1796 double pi0_E = y[0][0] + y[3][0];
1797 double pi0_px = y[0][0] * std::cos(y[1][0]) * std::sin(y[2][0])
1798 + y[3][0] * std::cos(y[4][0]) * std::sin(y[5][0]);
1799 double pi0_py = y[0][0] * std::sin(y[1][0]) * std::sin(y[2][0])
1800 + y[3][0] * std::sin(y[4][0]) * std::sin(y[5][0]);
1801 double pi0_pz = y[0][0] * std::cos(y[2][0]) + y[3][0] * std::cos(y[5][0]);
1802 double pi0_mass = mass_before;
1803
1804 // m_chi2 = chi2; // protect...
1805 double pi0_chi2 = (chi2 > FLT_MAX) ? FLT_MAX : chi2;
1806
1807 // Fill Belle::Mdst_pi0 based on the fit result.
1808 Belle::Mdst_pi0& pi0 = pi0mgr.add();
1809 pi0.gamma(0, gamma1);
1810 pi0.gamma(1, gamma2);
1811 pi0.px(pi0_px);
1812 pi0.py(pi0_py);
1813 pi0.pz(pi0_pz);
1814 pi0.energy(pi0_E);
1815 pi0.mass(pi0_mass);
1816 pi0.chisq(pi0_chi2);
1817 }
1818 }
1819 }
1820 }
static double pi0resol(double, double, const char *, bool, int, int)
Treat pi0 mass width as a func.

◆ make_pi0_primary_vertex()

void make_pi0_primary_vertex ( int  option,
double  low_limit,
double  up_limit,
const HepPoint3D ,
const CLHEP::HepSymMatrix &  epvtx_err 
)
private

Fill Mdst_pi0 based on the fit result.

Definition at line 1822 of file B2BIIFixMdstModule_ecl.cc.

1825 {
1826#if 0
1827 // pi0 mass of PDG.
1828 const double mpi0_pdg = 0.1349739;
1829
1830 // Default mass window.
1831 const double low_default = 0.1178;
1832 const double up_default = 0.1502;
1833
1834 // Maximum iteration of fit.
1835 const int iter_max = 5;
1836
1837 // Check whether proper option and mass window are given.
1838 switch (option) {
1839 case 0: // option=0 case, set default mass window.
1840 low_limit = low_default;
1841 up_limit = up_default;
1842 break;
1843 case 1: // option=1 case, check given mass window.
1844 if (mpi0_pdg < low_limit || up_limit < mpi0_pdg) {
1845 // If mass window is not correct, do nothing.
1846 dout(Debugout::ERR, "B2BIIFixBelle::Mdst_ecl") << "Invalid mass window between " << low_limit;
1847 dout(Debugout::ERR, "B2BIIFixBelle::Mdst_ecl") << " and " << up_limit << std::endl;
1848 return;
1849 }
1850 break;
1851 default: // Otherwise, invalid option, do nothing.
1852 dout(Debugout::ERR, "B2BIIFixBelle::Mdst_ecl") << "Invalid option=" << option << std::endl;
1853 return;
1854 }
1855
1856 // At first, clear already existing Belle::Mdst_pi0.
1857 Belle::Mdst_pi0_Manager::get_manager().remove();
1858
1859 // Get Belle::Mdst_gamma for photon's momentum
1860 // and get Belle::Mdst_ecl for error matrix.
1861 Belle::Mdst_gamma_Manager& gammamgr = Belle::Mdst_gamma_Manager::get_manager();
1862
1863 // Re-allocate Belle::Mdst_pi0 table.
1864 Belle::Mdst_pi0_Manager& pi0mgr = Belle::Mdst_pi0_Manager::get_manager();
1865
1866 // If Only one photon in the event, no need to do anything.
1867 if (gammamgr.count() < 2) {
1868 return;
1869 }
1870
1871 // Make combination of two Belle::Mdst_gamma.
1872 for (std::vector<Belle::Mdst_gamma>::iterator itgamma = gammamgr.begin();
1873 itgamma != gammamgr.end(); ++itgamma) {
1874 Belle::Mdst_gamma& gamma1 = *itgamma;
1875 CLHEP::Hep3Vector gamma1_3v(gamma1.px(), gamma1.py(), gamma1.pz());
1876 CLHEP::HepLorentzVector gamma1_lv(gamma1_3v, gamma1_3v.mag());
1877
1878 Belle::Mdst_ecl& ecl1 = gamma1.ecl();
1879
1880 const double r_i = ecl1.r();
1881 const double dzr_i = std::sqrt(epvtx_err[2][2]) / r_i;
1882
1883 const double theta_i0 = ecl1.theta();
1884 const double sin_th_i0 = std::sin(theta_i0);
1885
1886 for (std::vector<Belle::Mdst_gamma>::iterator jtgamma = itgamma + 1;
1887 jtgamma != gammamgr.end(); ++jtgamma) {
1888 Belle::Mdst_gamma& gamma2 = *jtgamma;
1889 CLHEP::Hep3Vector gamma2_3v(gamma2.px(), gamma2.py(), gamma2.pz());
1890 CLHEP::HepLorentzVector gamma2_lv(gamma2_3v, gamma2_3v.mag());
1891
1892 Belle::Mdst_ecl& ecl2 = gamma2.ecl();
1893
1894 // Invariant mass before const. fit.
1895 CLHEP::HepLorentzVector gamgam_lv = gamma1_lv + gamma2_lv;
1896 const double mass_before = gamgam_lv.mag();
1897
1898 // If invariant mass is inside the window,
1899 if (low_limit < mass_before && mass_before < up_limit) {
1900 // Error matrix(covariant matrix)
1901 CLHEP::HepMatrix V(6, 6, 0);
1902
1903 V[0][0] = ecl1.error(0);
1904 V[0][1] = V[1][0] = ecl1.error(1);
1905 V[1][1] = ecl1.error(2);
1906 V[0][2] = V[2][0] = ecl1.error(3);
1907 V[1][2] = V[2][1] = ecl1.error(4);
1908 V[2][2] = ecl1.error(5);
1909 V[3][3] = ecl2.error(0);
1910 V[3][4] = V[4][3] = ecl2.error(1);
1911 V[4][4] = ecl2.error(2);
1912 V[3][5] = V[5][3] = ecl2.error(3);
1913 V[4][5] = V[5][4] = ecl2.error(4);
1914 V[5][5] = ecl2.error(5);
1915
1916 // Correlation term
1917 const double r_j = ecl2.r();
1918 const double dzr_j = sqrt(epvtx_err[2][2]) / r_j;
1919
1920 const double theta_j0 = ecl2.theta();
1921 const double sin_th_j0 = std::sin(theta_j0);
1922
1923 V[2][5] = V[5][2] = dzr_i * sin_th_i0 * dzr_j * sin_th_j0;
1924 // Measurements; i.e. initial parameters.
1925 CLHEP::HepMatrix y0(6, 1);
1926 y0[0][0] = ecl1.energy();
1927 y0[1][0] = ecl1.phi();
1928 y0[2][0] = ecl1.theta();
1929 y0[3][0] = ecl2.energy();
1930 y0[4][0] = ecl2.phi();
1931 y0[5][0] = ecl2.theta();
1932
1933 // Copy them to proper matrix which is given to fit.
1934 CLHEP::HepMatrix y(y0);
1935 // Delivative.
1936 CLHEP::HepMatrix Dy(6, 1, 0);
1937
1938 int iter = 0;
1939 double Df, f_old = DBL_MAX;
1940 double Dchi2, chi2_old = DBL_MAX;
1941 double mass_gg, chi2 = DBL_MAX;
1942 bool exit_flag = false;
1943
1944 // Set parameters to decide whether converged.
1945 const double Df_limit = 0.1;
1946 const double Dchi2_limit = 0.1;
1947 // Do mass constraint fit; iterate until convergence.
1948 while (1) {
1949 const double& E1 = y[0][0];
1950 const double& E2 = y[3][0];
1951 const double sin_theta1 = std::sin(y[2][0]);
1952 const double cos_theta1 = std::cos(y[2][0]);
1953 const double sin_theta2 = std::sin(y[5][0]);
1954 const double cos_theta2 = std::cos(y[5][0]);
1955 const double Dphi = y[1][0] - y[4][0];
1956 const double cos_Dphi = std::cos(Dphi);
1957 const double sin_Dphi = std::sin(Dphi);
1958 const double open_angle = sin_theta1 * sin_theta2 * cos_Dphi
1959 + cos_theta1 * cos_theta2;
1960 const double mass2_gg = 2 * E1 * E2 * (1 - open_angle);
1961 mass_gg = (mass2_gg > 0) ? std::sqrt(mass2_gg) : -std::sqrt(-mass2_gg);
1962
1963 // No more iteration. Break to return.
1964 if (exit_flag || ++iter > iter_max)
1965 break;
1966
1967 // constraint
1968 CLHEP::HepMatrix f(1, 1);
1969 f[0][0] = mass2_gg - (mpi0_pdg * mpi0_pdg);
1970
1971 // dG/dq_i, G = (M_gg - M_pi0) = 0 is the constraint.
1972 CLHEP::HepMatrix B(1, 6);
1973 B[0][0] = mass2_gg / E1;
1974 B[0][1] = 2 * E1 * E2 * sin_theta1 * sin_theta2 * sin_Dphi;
1975 B[0][2] = 2 * E1 * E2 * (-cos_theta1 * sin_theta2 * cos_Dphi
1976 + sin_theta1 * cos_theta2);
1977 B[0][3] = mass2_gg / E2;
1978 B[0][4] = -B[0][1];
1979 B[0][5] = 2 * E1 * E2 * (-sin_theta1 * cos_theta2 * cos_Dphi
1980 + cos_theta1 * sin_theta2);
1981
1982 const double sigma2_mass2_gg = (B * V * B.T())[0][0];
1983
1984 // Proceed one step to get newer value y.
1985 Dy = V * B.T() * (B * Dy - f) / sigma2_mass2_gg;
1986 y = y0 + Dy;
1987 int ierr;
1988 chi2 = (Dy.T() * V.inverse(ierr) * Dy)[0][0];
1989 Dchi2 = fabs(chi2 - chi2_old);
1990 chi2_old = chi2;
1991 Df = fabs(f[0][0] - f_old);
1992 f_old = f[0][0];
1993
1994 // When chi-sq. change is small enough and mass is
1995 if (Dchi2 < Dchi2_limit && Df < Df_limit)
1996 exit_flag = true;;
1997
1998 }
1999 // Sort fitted result into proper variables.
2000 double pi0_E = y[0][0] + y[3][0];
2001 double pi0_px = y[0][0] * std::cos(y[1][0]) * std::sin(y[2][0])
2002 + y[3][0] * std::cos(y[4][0]) * std::sin(y[5][0]);
2003 double pi0_py = y[0][0] * std::sin(y[1][0]) * std::sin(y[2][0])
2004 + y[3][0] * std::sin(y[4][0]) * std::sin(y[5][0]);
2005 double pi0_pz = y[0][0] * std::cos(y[2][0]) + y[3][0] * std::cos(y[5][0]);
2006 double pi0_mass = mass_before;
2007
2008 // m_chi2 = chi2; // protect...
2009 double pi0_chi2 = (chi2 > FLT_MAX) ? FLT_MAX : chi2;
2010
2011 // Fill Belle::Mdst_pi0 based on the fit result.
2012 Belle::Mdst_pi0& pi0 = pi0mgr.add();
2013 pi0.gamma(0, gamma1);
2014 pi0.gamma(1, gamma2);
2015 pi0.px(pi0_px);
2016 pi0.py(pi0_py);
2017 pi0.pz(pi0_pz);
2018 pi0.energy(pi0_E);
2019 pi0.mass(pi0_mass);
2020 pi0.chisq(pi0_chi2);
2021 }
2022 }
2023 }
2024#else
2025 // pi0 mass of PDG. ;
2026 const double mpi0_pdg = 0.1349739;
2027 const double m2pi0_pdg = mpi0_pdg * mpi0_pdg;
2028 // Default mass window.;
2029 const double low_default = 0.1178;
2030 const double up_default = 0.1502;
2031 // Maximum iteration of fit.;
2032 const int iter_max = 5;
2033
2034 // Check whether proper option and mass window are given.;
2035 switch (option) {
2036 case 0: // option=0 case, set default mass window.;
2037 low_limit = low_default;
2038 up_limit = up_default;
2039 break;
2040 case 1: // option=1 case, check given mass window.;
2041 if (mpi0_pdg < low_limit || up_limit < mpi0_pdg) {
2042 // If mass window is not correct, do nothing.;
2043 B2ERROR("Invalid mass window between " << low_limit);
2044 B2ERROR(" and " << up_limit);
2045 return;
2046 }
2047 break;
2048 default: // Otherwise, invalid option, do nothing.;
2049 B2ERROR("Invalid option=" << option);
2050 return;
2051 }
2052 Belle::Mdst_pi0_Manager& pi0_mgr = Belle::Mdst_pi0_Manager::get_manager();
2053 Belle::Mdst_gamma_Manager& gamma_mgr = Belle::Mdst_gamma_Manager::get_manager();
2054
2055 // At first, clear already existing Belle::Mdst_pi0.;
2056 Belle::Mdst_pi0_Manager::get_manager().remove();
2057 // If Only one photon in the event, no need to do anything.;
2058 if (gamma_mgr.count() < 2) {
2059 return;
2060 }
2061
2062 for (std::vector<Belle::Mdst_gamma>::iterator i = gamma_mgr.begin();
2063 i != gamma_mgr.end(); ++i) {
2064 const Belle::Mdst_gamma& gamma_i = *i;
2065 if (!gamma_i.ecl()) {
2066 continue;
2067 }
2068 const Belle::Mdst_ecl& ecl_i = gamma_i.ecl();
2069 const double r_i = ecl_i.r();
2070 const double e_i0 = ecl_i.energy();
2071 const double phi_i0 = ecl_i.phi();
2072 const double theta_i0 = ecl_i.theta();
2073
2074 const double sin_th_i0 = std::sin(theta_i0);
2075 const double cos_th_i0 = std::cos(theta_i0);
2076
2077 CLHEP::HepSymMatrix err_i(3, 0);
2078 err_i[0][0] = ecl_i.error(0);
2079 err_i[1][0] = ecl_i.error(1); err_i[1][1] = ecl_i.error(2);
2080 err_i[2][0] = ecl_i.error(3); err_i[2][1] = ecl_i.error(4); err_i[2][2] = ecl_i.error(5);
2081
2082 const double dzr_i = std::sqrt(epvtx_err[2][2]) / r_i;
2083
2084 for (std::vector<Belle::Mdst_gamma>::iterator j = i + 1; j != gamma_mgr.end(); ++j) {
2085 const Belle::Mdst_gamma& gamma_j = *j;
2086 if (!gamma_j.ecl()) {
2087 continue;
2088 }
2089 const Belle::Mdst_ecl& ecl_j = gamma_j.ecl();
2090 const double r_j = ecl_j.r();
2091 const double e_j0 = ecl_j.energy();
2092 const double phi_j0 = ecl_j.phi();
2093 const double theta_j0 = ecl_j.theta();
2094
2095 const double sin_th_j0 = std::sin(theta_j0);
2096 const double cos_th_j0 = std::cos(theta_j0);
2097
2098 CLHEP::HepSymMatrix err_j(3, 0);
2099 err_j[0][0] = ecl_j.error(0);
2100 err_j[1][0] = ecl_j.error(1); err_j[1][1] = ecl_j.error(2);
2101 err_j[2][0] = ecl_j.error(3); err_j[2][1] = ecl_j.error(4); err_j[2][2] = ecl_j.error(5);
2102
2103 const double dzr_j = sqrt(epvtx_err[2][2]) / r_j;
2104
2105 // -------------------------------------------------------------------- ;
2106
2107 double dth_i_x_dth_j = dzr_i * sin_th_i0 * dzr_j * sin_th_j0;
2108
2109 double det = err_i[2][2] * err_j[2][2] - dth_i_x_dth_j * dth_i_x_dth_j;
2110
2111
2112 double e_i = e_i0, phi_i = phi_i0, sin_th_i = sin_th_i0, cos_th_i = cos_th_i0;
2113 double e_j = e_j0, phi_j = phi_j0, sin_th_j = sin_th_j0, cos_th_j = cos_th_j0;
2114
2115
2116 double dphi = phi_i - phi_j;
2117 double sin_dphi = std::sin(dphi);
2118 double cos_dphi = std::cos(dphi);
2119
2120 // Cos of opening angle ;
2121 double cos_th_ij = sin_th_i * sin_th_j * cos_dphi + cos_th_i * cos_th_j;
2122 double m2_ij = 2.0 * e_i * e_j * (1.0 - cos_th_ij);
2123 double mass = std::sqrt(m2_ij);
2124
2125 if (mass < low_limit || mass > up_limit)
2126 continue;
2127
2128 double de_i = 0.0, dphi_i = 0.0, dtheta_i = 0.0;
2129 double de_j = 0.0, dphi_j = 0.0, dtheta_j = 0.0;
2130
2131 int it = 0;
2132
2133 double f = 1.0e+6;
2134 double chisq = 1.0e+6;
2135 double df = 0.0, dchisq = 0.0;
2136
2137 const double del_chisq = 0.1;
2138 const double del_f = 0.1;
2139 //const int icovar = 1;
2140
2141 double mass0 = 0.0;
2142 double dmass0 = 0.0;
2143 //double dmass = 0.0;
2144 //double sdev = 0.0;
2145
2146 do {
2147
2148 const double dcos_th_ij_dphi_i = -sin_th_i * sin_th_j * sin_dphi;
2149 const double dcos_th_ij_dphi_j = sin_th_i * sin_th_j * sin_dphi;
2150 const double dcos_th_ij_dth_i = cos_th_i * sin_th_j * cos_dphi - sin_th_i * cos_th_j;
2151 const double dcos_th_ij_dth_j = cos_th_j * sin_th_i * cos_dphi - sin_th_j * cos_th_i;
2152
2153 const double dm2_de_i = m2_ij / e_i;
2154 const double dm2_de_j = m2_ij / e_j;
2155
2156 const double dm2_dcos_th_ij = -2.0 * e_i * e_j;
2157
2158 const double dm2_dphi_i = dm2_dcos_th_ij * dcos_th_ij_dphi_i;
2159 const double dm2_dphi_j = dm2_dcos_th_ij * dcos_th_ij_dphi_j;
2160 const double dm2_dth_i = dm2_dcos_th_ij * dcos_th_ij_dth_i;
2161 const double dm2_dth_j = dm2_dcos_th_ij * dcos_th_ij_dth_j;
2162
2163 double dm2_2
2164 = dm2_de_i * dm2_de_i * err_i[0][0]
2165 + dm2_de_j * dm2_de_j * err_j[0][0]
2166 + dm2_dphi_i * dm2_dphi_i * err_i[1][0]
2167 + dm2_dphi_j * dm2_dphi_j * err_j[1][0]
2168 + dm2_dth_i * dm2_dth_i * err_i[2][0]
2169 + dm2_dth_j * dm2_dth_j * err_j[2][0]
2170 + 2.0 * dm2_dth_i * dm2_dth_j * dth_i_x_dth_j;
2171
2172 if (dm2_2 < 0.0) {
2173 dm2_2 = 0.0;
2174 }
2175 if (it++ == 0) {
2176 mass0 = mass;
2177 dmass0 = std::sqrt(dm2_2);
2178 /*if (mass0 > 0.0) {
2179 dmass = 0.5 * dmass0 / mass;
2180 }*/
2181 }
2182 //const double residual = mass - mpi0_pdg;
2183 //const double pull = residual / dmass;
2184 if (it >= iter_max ||
2185 mass < low_default || mass > up_default) {
2186 //sdev = (dmass > 0.0) ? pull : -100;
2187 break;
2188 }
2189
2190 const double del_m2
2191 = (m2pi0_pdg - m2_ij
2192 + dm2_de_i * de_i
2193 + dm2_de_j * de_j
2194 + dm2_dphi_i * dphi_i
2195 + dm2_dphi_j * dphi_j
2196 + dm2_dth_i * dtheta_i
2197 + dm2_dth_j * dtheta_j) / dm2_2;
2198
2199 de_i = del_m2 * dm2_de_i * err_i[0][0];
2200 de_j = del_m2 * dm2_de_j * err_j[0][0];
2201 dphi_i = del_m2 * dm2_dphi_i * err_i[1][1];
2202 dphi_j = del_m2 * dm2_dphi_j * err_j[1][1];
2203 dtheta_i = del_m2 * (dm2_dth_i * err_i[2][2] + dm2_dth_j * dth_i_x_dth_j);
2204 dtheta_j = del_m2 * (dm2_dth_j * err_j[2][2] + dm2_dth_i * dth_i_x_dth_j);
2205
2206
2207 dchisq = chisq;
2208 chisq
2209 = de_i * de_i / err_i[0][0]
2210 + de_j * de_j / err_j[0][0]
2211 + dphi_i * dphi_i / err_i[1][1]
2212 + dphi_j * dphi_j / err_j[1][1]
2213 + (dtheta_i * dtheta_i * err_i[2][2]
2214 + dtheta_j * dtheta_j * err_j[2][2]
2215 + 2.0 * dtheta_i * dtheta_j * dth_i_x_dth_j) / det;
2216 dchisq -= chisq;
2217
2218
2219 e_i = e_i0 + de_i;
2220 e_j = e_j0 + de_j;
2221 phi_i = phi_i0 + dphi_i;
2222 phi_j = phi_j0 + dphi_j;
2223 double theta_i = theta_i0 + dtheta_i;
2224 double theta_j = theta_j0 + dtheta_j;
2225
2226 sin_th_i = std::sin(theta_i);
2227 cos_th_i = std::cos(theta_i);
2228 sin_th_j = std::sin(theta_j);
2229 cos_th_j = std::cos(theta_j);
2230
2231 dth_i_x_dth_j = dzr_i * sin_th_i * dzr_j * sin_th_j;
2232 det = err_i[2][2] * err_j[2][2] - dth_i_x_dth_j * dth_i_x_dth_j;
2233
2234 dphi = phi_i - phi_j;
2235 sin_dphi = std::sin(dphi);
2236 cos_dphi = std::cos(dphi);
2237
2238 cos_th_ij = sin_th_i * sin_th_j * cos_dphi + cos_th_i * cos_th_j;
2239 m2_ij = 2.0 * e_i * e_j * (1.0 - cos_th_ij);
2240 mass = std::sqrt(m2_ij);
2241
2242 df = f;
2243 f = fabs(m2pi0_pdg - m2_ij) / dmass0;
2244 df -= f;
2245 ++it;
2246 } while (std::fabs(df) > del_f || std::fabs(dchisq) > del_chisq);
2247 const double cos_phi_i = std::cos(phi_i);
2248 const double cos_phi_j = std::cos(phi_j);
2249 const double sin_phi_i = std::sin(phi_i);
2250 const double sin_phi_j = std::sin(phi_j);
2251
2252 const CLHEP::HepLorentzVector p4_i(e_i * sin_th_i * cos_phi_i,
2253 e_i * sin_th_i * sin_phi_i, e_i * cos_th_i, e_i);
2254 const CLHEP::HepLorentzVector p4_j(e_j * sin_th_j * cos_phi_j,
2255 e_j * sin_th_j * sin_phi_j, e_j * cos_th_j, e_j);
2256
2257 const CLHEP::HepLorentzVector p4_pi0(p4_i + p4_j);
2258
2259 // Fill Belle::Mdst_pi0 based on the fit result.;
2260 Belle::Mdst_pi0& pi0 = pi0_mgr.add();
2261 pi0.gamma(0, gamma_i);
2262 pi0.gamma(1, gamma_j);
2263 pi0.px(p4_pi0.x());
2264 pi0.py(p4_pi0.y());
2265 pi0.pz(p4_pi0.z());
2266 pi0.energy(p4_pi0.e());
2267 pi0.mass(mass0);
2268 pi0.chisq(chisq);
2269 }
2270 }
2271#endif
2272 return;
2273 }
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

◆ mpi0pdg()

static double mpi0pdg ( double  Energy)
static

Make MC mass peak to PDG value.

Definition at line 642 of file B2BIIFixMdstModule_ecl.cc.

643 {
644 // return value.
645 double return_value;
646 // pi0 mass in PDG.
647 const double m_pdg = 134.9766;
648
649 // default = do nothing.
650 return_value = 1.0;
651
652 if (0.1 < Energy && Energy < 1.0) {
653 double x = log10(Energy * 1000.0);
654 // Curve given by S.Uchida at 2001/07/17.
655 return_value
656 = m_pdg / (135.21 + 5.3812 * x - 4.2160 * x * x + 0.74650 * x * x * x);
657 }
658 // This return value has to be used as product.
659 // i.e. E_corrected = E_original*return_value.
660 return return_value;
661 }

◆ null_scale()

static void null_scale ( double  [5],
double  ,
double   
)
static

Dummy function.

Definition at line 1459 of file B2BIIFixMdstModule_trk.cc.

1460 {
1461 return;
1462 }

◆ operator==()

static bool operator== ( const cal_scale_error_func_set_t lhs,
const cal_scale_error_func_set_t rhs 
)
static

Operator definition for cal_scale_error_func_set_t.

Definition at line 1448 of file B2BIIFixMdstModule_trk.cc.

1449 {
1450 return (lhs.m_hadMC == rhs.m_hadMC) && (lhs.m_cosMC == rhs.m_cosMC) && (lhs.m_cosDATA == rhs.m_cosDATA);
1451 }

◆ pi0resol()

double pi0resol ( double  p,
double  theta,
const char *  side,
bool  mcdata,
int  ,
int   
)
staticprivate

Treat pi0 mass width as a func.

of pi0 momentum.

Definition at line 685 of file B2BIIFixMdstModule_ecl.cc.

687 {
688// option is added to become compatible with future gsim modification.
689 int iside = 0;
690
691 if (!strcmp(side, "lower")) iside = 1;
692 if (!strcmp(side, "higher")) iside = 2;
693 if (iside == 0) {
694 B2ERROR("Error pi0resol. Wrong input parameter=" << side);
695 return -1;
696 }
697// dout(Debugout::INFO,"B2BIIFixMdst_ecl") <<" iside="<<iside<<std::endl;
698//----------------------------------------------------
699// 20 <= theta <= 45
700//----------------------------------------------------
701// 0.15 < p < 0.8
702// -- data L: lower side H: higher side
703 const double data_thf_pl_L[] = { 9.8233, -13.3489, 18.3271, -7.6668};
704 const double derr_thf_pl_L[] = { 0.3274, 0.755, 0.8611, 0.521};
705 const double data_thf_pl_H[] = { 6.1436, -7.9668, 12.4766, -5.3201};
706 const double derr_thf_pl_H[] = { 0.2903, 0.6754, 0.7724, 0.466};
707// 0.8 < p < 5.3
708// -- data L: lower side H: higher side
709 const double data_thf_ph_L[] = { 7.1936, -0.6378, 0.5912, -0.075};
710 const double derr_thf_ph_L[] = { 0.1975, 0.2036, 0.0793, 0.0121};
711 const double data_thf_ph_H[] = { 4.4923, 0.5532, 0.2658, -0.0343};
712 const double derr_thf_ph_H[] = { 0.1883, 0.2019, 0.0803, 0.0122};
713//----------------------------------------------------
714// 20 <= theta <= 45
715//----------------------------------------------------
716// 0.15 < p < 0.8
717// -- MC L: lower side H: higher side
718 const double mc_thf_pl_L[] = { 4.8093, 3.4567, -3.7898, 1.7553};
719 const double merr_thf_pl_L[] = { 0.2145, 0.527, 0.6153, 0.3712};
720 const double mc_thf_pl_H[] = { 4.6176, -2.9049, 4.2994, -1.4776};
721 const double merr_thf_pl_H[] = { 0.1969, 0.4826, 0.555, 0.3346};
722// 0.8 < p < 5.3
723// -- MC L: lower side H: higher side
724 const double mc_thf_ph_L[] = { 6.3166, -0.5993, 0.5845, -0.0695};
725 const double merr_thf_ph_L[] = { 0.1444, 0.1468, 0.0571, 0.0087};
726 const double mc_thf_ph_H[] = { 2.9719, 1.7999, -0.2418, 0.028};
727 const double merr_thf_ph_H[] = { 0.1318, 0.1362, 0.0538, 0.0082};
728
729//----------------------------------------------------
730// 45 <= theta <= 100
731//----------------------------------------------------
732// 0.15 < p < 0.8
733// -- data L: lower side H: higher side
734 const double data_thm_pl_L[] = { 7.7573, -4.8855, 6.5561, -2.4788};
735 const double derr_thm_pl_L[] = { 0.1621, 0.4894, 0.6882, 0.4985};
736 const double data_thm_pl_H[] = { 6.9075, -10.5036, 18.5196, -9.224};
737 const double derr_thm_pl_H[] = { 0.1458, 0.4383, 0.639, 0.4726};
738// 0.8 < p < 5.3
739// -- data L: lower side H: higher side
740 const double data_thm_ph_L[] = { 5.2347, 2.1827, -0.6563, 0.1545};
741 const double derr_thm_ph_L[] = { 0.0986, 0.1281, 0.0627, 0.0117};
742 const double data_thm_ph_H[] = { 3.2114, 3.3806, -0.8635, 0.1371};
743 const double derr_thm_ph_H[] = { 0.0927, 0.1205, 0.058, 0.0106};
744//
745//----------------------------------------------------
746// 45 <= theta <= 100
747//----------------------------------------------------
748// 0.15 < p < 0.8
749// -- MC L: lower side H: higher side
750 const double mc_thm_pl_L[] = { 6.1774, -2.1831, 3.6615, -1.1813};
751 const double merr_thm_pl_L[] = { 0.11, 0.327, 0.476, 0.3655};
752 const double mc_thm_pl_H[] = { 4.0239, -0.7485, 3.6203, -1.4823};
753 const double merr_thm_pl_H[] = { 0.0991, 0.3034, 0.4223, 0.3069};
754// 0.8 < p < 5.3
755// -- MC L: lower side H: higher side
756 const double mc_thm_ph_L[] = { 4.5966, 2.261, -0.4938, 0.0984};
757 const double merr_thm_ph_L[] = { 0.0711, 0.0917, 0.0448, 0.0081};
758 const double mc_thm_ph_H[] = { 3.4609, 2.0069, -0.0498, -0.0018};
759 const double merr_thm_ph_H[] = { 0.0966, 0.1314, 0.0574, 0.0086};
760//
761//----------------------------------------------------
762// 100 <= theta <= 150
763//----------------------------------------------------
764// 0.15 < p < 0.8
765// -- data L: lower side H: higher side
766 const double data_thb_pl_L[] = {11.5829, -21.6715, 30.2368, -13.0389};
767 const double derr_thb_pl_L[] = { 0.2742, 0.7256, 0.9139, 0.6006};
768 const double data_thb_pl_H[] = { 8.0227, -14.7387, 23.1042, -10.4233};
769 const double derr_thb_pl_H[] = { 0.2466, 0.6512, 0.8239, 0.5419};
770// 0.8 < p < 5.3
771// -- data L: lower side H: higher side
772 const double data_thb_ph_L[] = { 7.5872, -1.8994, 1.6526, -0.2755};
773 const double derr_thb_ph_L[] = { 0.1999, 0.2638, 0.1422, 0.0335};
774 const double data_thb_ph_H[] = { 6.3542, -2.5164, 2.5763, -0.4803};
775 const double derr_thb_ph_H[] = { 0.1885, 0.2527, 0.136, 0.0318};
776//----------------------------------------------------
777// 100 <= theta <= 150
778//----------------------------------------------------
779// 0.15 < p < 0.8
780// -- MC L: lower side H: higher side
781 const double mc_thb_pl_L[] = { 5.2707, 2.5607, -3.1377, 1.8434};
782 const double merr_thb_pl_L[] = { 0.1801, 0.5048, 0.6741, 0.4343};
783
784 const double mc_thb_pl_H[] = { 2.5867, 7.6982, -10.0677, 5.312};
785 const double merr_thb_pl_H[] = { 0.1658, 0.4651, 0.6063, 0.3925};
786// 0.8 < p < 5.3
787// -- MC L: lower side H: higher side
788 const double mc_thb_ph_L[] = { 6.5206, -1.5103, 1.9054, -0.3609};
789 const double merr_thb_ph_L[] = { 0.1521, 0.2048, 0.1108, 0.0255};
790 const double mc_thb_ph_H[] = { 3.4397, 2.2372, -0.1214, -0.0004};
791 const double merr_thb_ph_H[] = { 0.1324, 0.1822, 0.1065, 0.0252};
792
793//
794 double resol;
795 double para[4] = { };
796 double error[4] = { };
797
798 double pbuf = p;
799//--
800// theta< 45
801//---
802 if (theta <= 45.) {
803//--
804// p-low
805//---
806 if (pbuf <= 0.8) {
807 if (!mcdata) {
808 //-- data
809 for (int i = 0; i <= 3; i++) {
810 if (iside == 1) {
811 para[i] = data_thf_pl_L[i];
812 error[i] = derr_thf_pl_L[i];
813 } else {
814 para[i] = data_thf_pl_H[i];
815 error[i] = derr_thf_pl_H[i];
816 }
817 } // for
818 } else {
819 //-- mc
820 for (int i = 0; i <= 3; i++) {
821 if (iside == 1) {
822 para[i] = mc_thf_pl_L[i];
823 error[i] = merr_thf_pl_L[i];
824 } else {
825 para[i] = mc_thf_pl_H[i];
826 error[i] = merr_thf_pl_H[i];
827 }
828 } //for
829 }
830 } else {
831//--
832// p-high
833//---
834// use p= 5.2 value if p >= 5.2 for forward region
835 if (pbuf >= 5.2) {pbuf = 5.2;}
836 if (!mcdata) {
837 //-- data
838 for (int i = 0; i <= 3; i++) {
839 if (iside == 1) {
840 para[i] = data_thf_ph_L[i];
841 error[i] = derr_thf_ph_L[i];
842 } else {
843 para[i] = data_thf_ph_H[i];
844 error[i] = derr_thf_ph_H[i];
845 }
846 }// for
847 } else {
848 //-- mc
849 for (int i = 0; i <= 3; i++) {
850 if (iside == 1) {
851 para[i] = mc_thf_ph_L[i];
852 error[i] = merr_thf_ph_L[i];
853 } else {
854 para[i] = mc_thf_ph_H[i];
855 error[i] = merr_thf_ph_H[i];
856 }
857 }// for
858 }
859 } // p-range
860//--
861// 45< theta< 100
862//---
863 } else if (theta <= 100.) {
864//--
865// p-low
866//---
867 if (pbuf <= 0.8) {
868 if (!mcdata) {
869 //-- data
870 for (int i = 0; i <= 3; i++) {
871 if (iside == 1) {
872 para[i] = data_thm_pl_L[i];
873 error[i] = derr_thm_pl_L[i];
874 } else {
875 para[i] = data_thm_pl_H[i];
876 error[i] = derr_thm_pl_H[i];
877 }
878 } // for
879 } else {
880 //-- mc
881 for (int i = 0; i <= 3; i++) {
882 if (iside == 1) {
883 para[i] = mc_thm_pl_L[i];
884 error[i] = merr_thm_pl_L[i];
885 } else {
886 para[i] = mc_thm_pl_H[i];
887 error[i] = merr_thm_pl_H[i];
888 }
889 } //for
890 }
891 } else {
892//--
893// p-high
894//---
895// use p= 5.2 value if p >= 5.2 for middle region
896 if (pbuf >= 5.2) {pbuf = 5.2;}
897 if (!mcdata) {
898 //-- data
899 for (int i = 0; i <= 3; i++) {
900 if (iside == 1) {
901 para[i] = data_thm_ph_L[i];
902 error[i] = derr_thm_ph_L[i];
903 } else {
904 para[i] = data_thm_ph_H[i];
905 error[i] = derr_thm_ph_H[i];
906 }
907 } //for
908 } else {
909 //-- mc
910 for (int i = 0; i <= 3; i++) {
911 if (iside == 1) {
912 para[i] = mc_thm_ph_L[i];
913 error[i] = merr_thm_ph_L[i];
914 } else {
915 para[i] = mc_thm_ph_H[i];
916 error[i] = merr_thm_ph_H[i];
917 }
918 } //for
919 }
920 } // p-range
921//--
922// theta> 100
923//---
924 } else {
925//--
926// p-low
927//---
928 if (pbuf <= 0.8) {
929 if (!mcdata) {
930 //-- data
931 for (int i = 0; i <= 3; i++) {
932 if (iside == 1) {
933 para[i] = data_thb_pl_L[i];
934 error[i] = derr_thb_pl_L[i];
935 } else {
936 para[i] = data_thb_pl_H[i];
937 error[i] = derr_thb_pl_H[i];
938 }
939 } //for
940 } else {
941 //-- mc
942 for (int i = 0; i <= 3; i++) {
943 if (iside == 1) {
944 para[i] = mc_thb_pl_L[i];
945 error[i] = merr_thb_pl_L[i];
946 } else {
947 para[i] = mc_thb_pl_H[i];
948 error[i] = merr_thb_pl_H[i];
949 }
950 } //for
951 }
952 } else {
953//--
954// p-high
955//---
956// use p= 3.0 value if p >= 3.0 for backward region
957 if (pbuf >= 3.0) {pbuf = 3.0;}
958 if (!mcdata) {
959 //-- data
960 for (int i = 0; i <= 3; i++) {
961 if (iside == 1) {
962 para[i] = data_thb_ph_L[i];
963 error[i] = derr_thb_ph_L[i];
964 } else {
965 para[i] = data_thb_ph_H[i];
966 error[i] = derr_thb_ph_H[i];
967 }
968 } //for
969 } else {
970 //-- mc
971 for (int i = 0; i <= 3; i++) {
972 if (iside == 1) {
973 para[i] = mc_thb_ph_L[i];
974 error[i] = merr_thb_ph_L[i];
975 } else {
976 para[i] = mc_thb_ph_H[i];
977 error[i] = merr_thb_ph_H[i];
978 }
979 } //for
980 }
981 } // p-range
982
983
984 } //theta range
985//--
986// evaluate resolution in the unit of GeV.
987//--
988 resol = para[0] + para[1] * pbuf + para[2] * pbuf * pbuf +
989 para[3] * pbuf * pbuf * pbuf;
990 resol = resol / 1000.;
991
992//--
993// Evaluate the error od sigma using diagonal errors.
994//--
995 double eresol = error[0] * error[0] + (pbuf * error[1]) * (pbuf * error[1])
996 + (pbuf * pbuf * error[2]) * (pbuf * pbuf * error[2])
997 + (pbuf * pbuf * pbuf * error[3]) * (pbuf * pbuf * pbuf * error[3]);
998 eresol = sqrt(eresol) / 1000.;
999
1000 B2DEBUG(19, "B2BIIFixMdst_ecl" << LogVar("theta", theta) << LogVar("p", pbuf)
1001 << LogVar("para0", para[0]) << LogVar("para1", para[1]) << LogVar("para2", para[2]) << LogVar("para3", para[3])
1002 << LogVar("resol", resol) << LogVar("er", eresol));
1003 return resol;
1004 }
Class to store variables with their name which were sent to the logging service.

◆ remove_extra_trk_vee2()

int remove_extra_trk_vee2 ( )
private

Remove extra tracks from Mdst_trk and Mdst_vee2.

Definition at line 3247 of file B2BIIFixMdstModule_trk.cc.

3248 {
3249 Belle::Mdst_event_add_Manager& mevtmgr = Belle::Mdst_event_add_Manager::get_manager();
3250 if (mevtmgr.count() <= 1) { // no Belle::Mdst_event_add table
3251 return -2;
3252 }
3253 unsigned flag(mevtmgr[1].flag(0));
3254 if (0 == flag) return -1; // do nothing if no extra tracks in Belle::Mdst_charged etc.
3255 const int i_ch(flag & 0xff);
3256 const int i_trk((flag >> 8) & 0xff);
3257 const int i_vee2((flag >> 16) & 0xff);
3258 //Belle::Mdst_charged_Manager////& chMgr(Belle::Mdst_charged_Manager::get_manager());
3259 Belle::Mdst_trk_Manager& tMgr(Belle::Mdst_trk_Manager::get_manager());
3260 Belle::Mdst_vee2_Manager& veeMgr(Belle::Mdst_vee2_Manager::get_manager());
3261 Belle::Mdst_trk_extra_Manager& teMgr(Belle::Mdst_trk_extra_Manager::get_manager());
3262 Belle::Mdst_vee2_extra_Manager& veeeMgr(Belle::Mdst_vee2_extra_Manager::get_manager());
3263 if (i_trk) {
3264 std::vector<int> extra_ID;
3265 if (teMgr.count()) teMgr.remove();
3266 for (std::vector<Belle::Mdst_trk>::iterator i = tMgr.begin();
3267 i != tMgr.end(); ++i) {
3268 if ((*i).get_ID() < i_trk) {
3269 extra_ID.push_back(0);
3270 continue;
3271 }
3272 if (!((*i).quality() & 16u)) {
3273 B2ERROR("Warning from B2BIIFixMdst: inconsistency between Belle::Mdst_trk and Belle::Mdst_evet_add"
3274 );
3275 }
3276 Belle::Mdst_trk_extra& trk(teMgr.add());
3277 for (int j = 0; j < 5; j++) trk.mhyp(j, (*i).mhyp(j));
3278 trk.quality((*i).quality());
3279 extra_ID.push_back(trk.get_ID());
3280 }
3281 if (i_vee2) {
3282 if (veeeMgr.count()) veeeMgr.remove();
3283 for (std::vector<Belle::Mdst_vee2>::iterator i = veeMgr.begin();
3284 i != veeMgr.end(); ++i) {
3285 if ((*i).get_ID() < i_vee2) continue;
3286 if (!((*i).chgd(0).trk().quality() & 16u) && !((*i).chgd(1).trk().quality() & 16u)) {
3287 B2ERROR("Warning from B2BIIFixMdst: inconsistency between Belle::Mdst_vee2 and Belle::Mdst_evet_add"
3288 );
3289 }
3290 Belle::Mdst_vee2_extra& vee(veeeMgr.add());
3291 vee.kind((*i).kind());
3292 const int extra_id0(extra_ID[(*i).chgd(0).trk_ID() - 1]);
3293 const int extra_id1(extra_ID[(*i).chgd(1).trk_ID() - 1]);
3294 if (extra_id0) {
3295 vee.extra(0, teMgr[extra_id0 - 1]);
3296 } else {
3297 vee.chgd((*i).chgd(0));
3298 }
3299 if (extra_id1) {
3300 vee.extra(1, teMgr[extra_id1 - 1]);
3301 } else {
3302 if (vee.chgd_ID()) {
3303 B2ERROR("Warning from B2BIIFixMdst: both tracks of Belle::Mdst_vee2_extra are good track"
3304 );
3305 }
3306 vee.chgd((*i).chgd(1));
3307 }
3308
3309 vee.px((*i).px());
3310 vee.py((*i).py());
3311 vee.pz((*i).pz());
3312 vee.energy((*i).energy());
3313 vee.vx((*i).vx());
3314 vee.vy((*i).vy());
3315 vee.vz((*i).vz());
3316 vee.z_dist((*i).z_dist());
3317 vee.chisq((*i).chisq());
3318 vee.type((*i).type());
3319 vee.daut((*i).daut());
3320 }
3321 int id = BsCouTab(MDST_VEE2);
3322 while (id >= i_vee2) BsDelEnt(MDST_VEE2, id--);
3323 }
3324 int id = BsCouTab(MDST_TRK);
3325 while (id >= i_trk) BsDelEnt(MDST_TRK, id--);
3326 }
3327 if (i_ch) {
3328 int id = BsCouTab(MDST_CHARGED);
3329 while (id >= i_ch) BsDelEnt(MDST_CHARGED, id--);
3330 }
3331 flag = 0;
3332 mevtmgr[1].flag(0, flag);
3333 return 0;
3334 }

◆ rootfunc()

double rootfunc ( const double  x,
const double  x1,
const double  x2,
const double  yc,
const double  a1,
const double  a2 
)
inline

rootfunc

Definition at line 1533 of file B2BIIFixMdstModule_trk.cc.

1534 {
1535 return x < x1 ? (x - x1) * a1 + yc :
1536 x > x2 ? (x2 - x1) * a2 + yc : (x - x1) * a2 + yc;
1537 }

◆ scale_err_ms()

void scale_err_ms ( Belle::Mdst_trk_fit &  fit,
const double  scale[] 
)
static

Scale error.

Definition at line 3411 of file B2BIIFixMdstModule_trk.cc.

3412 {
3413//====================================================
3414 fit.error(0, scale[0]*scale[0]*fit.error(0));
3415 fit.error(1, scale[1]*scale[0]*fit.error(1));
3416 fit.error(2, scale[1]*scale[1]*fit.error(2));
3417 fit.error(3, scale[2]*scale[0]*fit.error(3));
3418 fit.error(4, scale[2]*scale[1]*fit.error(4));
3419 fit.error(5, scale[2]*scale[2]*fit.error(5));
3420 fit.error(6, scale[3]*scale[0]*fit.error(6));
3421 fit.error(7, scale[3]*scale[1]*fit.error(7));
3422 fit.error(8, scale[3]*scale[2]*fit.error(8));
3423 fit.error(9, scale[3]*scale[3]*fit.error(9));
3424 fit.error(10, scale[4]*scale[0]*fit.error(10));
3425 fit.error(11, scale[4]*scale[1]*fit.error(11));
3426 fit.error(12, scale[4]*scale[2]*fit.error(12));
3427 fit.error(13, scale[4]*scale[3]*fit.error(13));
3428 fit.error(14, scale[4]*scale[4]*fit.error(14));
3429
3430 }

◆ scale_error()

void scale_error ( const int  message_level = 0)
private

Apply scale error.

Definition at line 2886 of file B2BIIFixMdstModule_trk.cc.

2887 {
2888 static int result_before = -1;
2889
2890 const int result = scale_error_impl(message_level, this->m_reprocess_version);
2891
2892 if (result != result_before) {
2893 switch (result) {
2894 case 0: {
2895 B2INFO(
2896 "scale_error: info: scale error is properly applied.");
2897 break;
2898 }
2899
2900 case 1: {
2901 B2ERROR(
2902 "scale_error: warning: scale error is not applied. Reason: it has been already applied.");
2903 break;
2904 }
2905
2906 case 2: {
2907 int no_exp, no_run, no_evt, no_frm, expmc;
2908 get_event_id(&no_exp, &no_run, &no_evt, &no_frm, &expmc);
2909 B2ERROR(
2910 "scale_error: error: scale error is not applied. Reason: it is not available for exp " << no_exp << ". Exit! (I'll crash job.)");
2911 exit(-1);
2912// break; // redundant
2913 }
2914
2915 default: assert(0); // Should not be here!
2916 }
2917
2918 result_before = result;
2919 }
2920 }
static void get_event_id(int *no_exp, int *no_run, int *no_evt, int *no_frm, int *expmc)
Get event ID.
static int scale_error_impl(const int message_level, const int reprocess_version)
The implementation of B2BIIFixMdstModule::scale_error()

◆ scale_error_impl()

static int scale_error_impl ( const int  message_level,
const int  reprocess_version 
)
static

The implementation of B2BIIFixMdstModule::scale_error()

Returns
0 if scale error is properly applied. 1 if scale error is already applied. 2 if scale error for this exp is not available.
See also
B2BIIFixMdstModule::scale_error()

Definition at line 2775 of file B2BIIFixMdstModule_trk.cc.

2776 {
2777 SE_Message_Level = message_level;
2778 SE_Reprocess_Version = reprocess_version;
2779
2780 int no_exp{0}, no_run{0}, no_evt{0}, no_frm{0}, expmc{0};
2781 get_event_id(&no_exp, &no_run, &no_evt, &no_frm, &expmc);
2782
2783 if (DUMMY_scale == get_scale_error_func_for_exprun(no_exp, no_run)) return 2;
2784 if (is_already_scaled()) return 1;
2785
2786 static int first_exp73 = true;
2787 if (no_exp == 73 && first_exp73) {
2788 first_exp73 = false;
2789 B2ERROR(
2790 "scale_error: warning: scale parameters for exp#71 are tentatively used for exp#73.");
2791 }
2792
2793 double scale[5] = { // ... temporary
2794 1.0, // dr
2795 1.0, // phi0
2796 1.0, // kappa
2797 1.0, // dz
2798 1.0, // tanl
2799 };
2800
2801
2802 // scale error matrices in mdst_trk_fit
2803 Belle::Mdst_trk_fit_Manager& fitmgr = Belle::Mdst_trk_fit_Manager::get_manager();
2804 for (std::vector<Belle::Mdst_trk_fit>::iterator it = fitmgr.begin(); it != fitmgr.end(); ++it) {
2805 Belle::Mdst_trk_fit& fit = *it;
2806 if (fit.helix(2) == 0.) continue;
2807
2808 const double pt = 1. / fabs(fit.helix(2));
2809 const double tanl = fit.helix(4);
2810
2811 cal_scale_error(scale, pt, tanl, expmc, no_exp, no_run);
2812
2813 fit.error(0, scale[0]*scale[0]*fit.error(0));
2814 fit.error(1, scale[1]*scale[0]*fit.error(1));
2815 fit.error(2, scale[1]*scale[1]*fit.error(2));
2816 fit.error(3, scale[2]*scale[0]*fit.error(3));
2817 fit.error(4, scale[2]*scale[1]*fit.error(4));
2818 fit.error(5, scale[2]*scale[2]*fit.error(5));
2819 fit.error(6, scale[3]*scale[0]*fit.error(6));
2820 fit.error(7, scale[3]*scale[1]*fit.error(7));
2821 fit.error(8, scale[3]*scale[2]*fit.error(8));
2822 fit.error(9, scale[3]*scale[3]*fit.error(9));
2823 fit.error(10, scale[4]*scale[0]*fit.error(10));
2824 fit.error(11, scale[4]*scale[1]*fit.error(11));
2825 fit.error(12, scale[4]*scale[2]*fit.error(12));
2826 fit.error(13, scale[4]*scale[3]*fit.error(13));
2827 fit.error(14, scale[4]*scale[4]*fit.error(14));
2828 }
2829
2830
2831 // scale error matrices in mdst_daughters
2832 Belle::Mdst_vee_daughters_Manager& daumgr = Belle::Mdst_vee_daughters_Manager::get_manager();
2833 for (std::vector<Belle::Mdst_vee_daughters>::iterator it = daumgr.begin(); it != daumgr.end(); ++it) {
2834 Belle::Mdst_vee_daughters& dau = *it;
2835 if (dau.helix_p(2) == 0. || dau.helix_m(2) == 0.) continue;
2836
2837 // positive track
2838 const double pt_p = 1. / fabs(dau.helix_p(2));
2839 const double tanl_p = dau.helix_p(4);
2840
2841 cal_scale_error(scale, pt_p, tanl_p, expmc, no_exp, no_run);
2842
2843 dau.error_p(0, scale[0]*scale[0]*dau.error_p(0));
2844 dau.error_p(1, scale[1]*scale[0]*dau.error_p(1));
2845 dau.error_p(2, scale[1]*scale[1]*dau.error_p(2));
2846 dau.error_p(3, scale[2]*scale[0]*dau.error_p(3));
2847 dau.error_p(4, scale[2]*scale[1]*dau.error_p(4));
2848 dau.error_p(5, scale[2]*scale[2]*dau.error_p(5));
2849 dau.error_p(6, scale[3]*scale[0]*dau.error_p(6));
2850 dau.error_p(7, scale[3]*scale[1]*dau.error_p(7));
2851 dau.error_p(8, scale[3]*scale[2]*dau.error_p(8));
2852 dau.error_p(9, scale[3]*scale[3]*dau.error_p(9));
2853 dau.error_p(10, scale[4]*scale[0]*dau.error_p(10));
2854 dau.error_p(11, scale[4]*scale[1]*dau.error_p(11));
2855 dau.error_p(12, scale[4]*scale[2]*dau.error_p(12));
2856 dau.error_p(13, scale[4]*scale[3]*dau.error_p(13));
2857 dau.error_p(14, scale[4]*scale[4]*dau.error_p(14));
2858
2859 // negative track
2860 const double pt_m = 1. / fabs(dau.helix_m(2));
2861 const double tanl_m = dau.helix_m(4);
2862
2863 cal_scale_error(scale, pt_m, tanl_m, expmc, no_exp, no_run);
2864
2865 dau.error_m(0, scale[0]*scale[0]*dau.error_m(0));
2866 dau.error_m(1, scale[1]*scale[0]*dau.error_m(1));
2867 dau.error_m(2, scale[1]*scale[1]*dau.error_m(2));
2868 dau.error_m(3, scale[2]*scale[0]*dau.error_m(3));
2869 dau.error_m(4, scale[2]*scale[1]*dau.error_m(4));
2870 dau.error_m(5, scale[2]*scale[2]*dau.error_m(5));
2871 dau.error_m(6, scale[3]*scale[0]*dau.error_m(6));
2872 dau.error_m(7, scale[3]*scale[1]*dau.error_m(7));
2873 dau.error_m(8, scale[3]*scale[2]*dau.error_m(8));
2874 dau.error_m(9, scale[3]*scale[3]*dau.error_m(9));
2875 dau.error_m(10, scale[4]*scale[0]*dau.error_m(10));
2876 dau.error_m(11, scale[4]*scale[1]*dau.error_m(11));
2877 dau.error_m(12, scale[4]*scale[2]*dau.error_m(12));
2878 dau.error_m(13, scale[4]*scale[3]*dau.error_m(13));
2879 dau.error_m(14, scale[4]*scale[4]*dau.error_m(14));
2880 }
2881
2882 return 0;
2883 }
static int SE_Reprocess_Version
Reprocess verison used in scale_error()
static int SE_Message_Level
Message level of 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.
static bool is_already_scaled(void)
Check if event is already scaled.

◆ scale_momenta()

void scale_momenta ( float  scale_data = 1.0,
float  scale_mc = 1.0,
int  mode = 0 
)
private

Scale momenta of Mdst_trk.

Definition at line 277 of file B2BIIFixMdstModule_trk.cc.

278 {
279//===============================================================
280// Scales charged track momenta, track params. and error
281// matrices.
282//======================================================
283
284 // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << "sacel momenta is called" << std::endl;
285
286//Check existence of belle_event
287 Belle::Belle_event_Manager& evtmgr = Belle::Belle_event_Manager::get_manager();
288 // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << evtmgr.count() << std::endl;
289 if (0 == evtmgr.count()) return; //do nothing if not exist
290 // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << "after check" << std::endl;
291
292 Belle::Mdst_event_add_Manager& mevtmgr = Belle::Mdst_event_add_Manager::get_manager();
293 if (mevtmgr.count() > 0 && 1 == mevtmgr[0].flag_scale()) return; //do nothing if already scaled
294
295//check mode
296 if (mode < 0 || mode > 2) {
297 B2ERROR("scale_momenta: invalid mode specified;");
298 B2ERROR("mode must be 0, 1, 2");
299 return;
300 }
301
302//set scale factor
303 int expmc = evtmgr[0].ExpMC();
304 int expno = evtmgr[0].ExpNo();
305 int runno = evtmgr[0].RunNo();
306
307 double scale = 1.;
308 if (1 == expmc) {
309 if (mode == 0) {
310 scale = scale_data;
311 } else {
312 // scale_momenta_set( mode, expno, runno, scale);
313 if (m_reprocess_version == 0) {
314 scale_momenta_set_v1(mode, expno, runno, scale);
315 } else if (m_reprocess_version == 1) {
316 scale_momenta_set_v2(mode, expno, runno, scale);
317 }
318 }
319 } else if (2 == expmc) {
320 scale = scale_mc;
321 }
322
323 if (1. == scale) return; //do nothing if scale=1
324 // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << scale << std::endl;
325
326//Turn on flag, save scale factor
327 if (mevtmgr.count() > 0) {
328 mevtmgr[0].flag_scale(1);
329 mevtmgr[0].scale(scale);
330 } else {
331 Belle::Mdst_event_add& meadd = mevtmgr.add();
332 meadd.flag_scale(1);
333 meadd.scale(scale);
334 }
335 // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << mevtmgr[0].flag_scale() << std::endl;
336 // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << mevtmgr[0].scale() << std::endl;
337
338
339//Scale momenta in mdst_charged
340 Belle::Mdst_charged_Manager& chgmgr = Belle::Mdst_charged_Manager::get_manager();
341 for (std::vector<Belle::Mdst_charged>::iterator it = chgmgr.begin();
342 it != chgmgr.end(); ++it) {
343 Belle::Mdst_charged& charged = *it;
344 charged.px(scale * charged.px());
345 charged.py(scale * charged.py());
346 charged.pz(scale * charged.pz());
347 }
348
349//Scale momenta in mdst_vee2
350 Belle::Mdst_vee2_Manager& vee2mgr = Belle::Mdst_vee2_Manager::get_manager();
351 for (std::vector<Belle::Mdst_vee2>::iterator it = vee2mgr.begin();
352 it != vee2mgr.end(); ++it) {
353 Belle::Mdst_vee2& vee2 = *it;
354 double v0mass_scale = vee_mass_nofit(vee2, scale);
355 double v0mass_noscl = vee_mass_nofit(vee2);
356 double esq_scale =
357 (v0mass_scale - v0mass_noscl) * (v0mass_scale + v0mass_noscl)
358 + vee2.energy() * vee2.energy() +
359 (scale - 1.) * (scale + 1.) * (vee2.px() * vee2.px() +
360 vee2.py() * vee2.py() +
361 vee2.pz() * vee2.pz());
362 vee2.energy(std::sqrt(esq_scale));
363 vee2.px(scale * vee2.px());
364 vee2.py(scale * vee2.py());
365 vee2.pz(scale * vee2.pz());
366 }
367
368//Scale error matrices in mdst_trk_fit
369 double scalei = 1. / scale;
370 double scalei2 = scalei / scale;
371
372 Belle::Mdst_trk_fit_Manager& trkfmgr = Belle::Mdst_trk_fit_Manager::get_manager();
373 for (std::vector<Belle::Mdst_trk_fit>::iterator it = trkfmgr.begin();
374 it != trkfmgr.end(); ++it) {
375 Belle::Mdst_trk_fit& trkf = *it;
376 trkf.helix(2, scalei * trkf.helix(2));
377 trkf.error(3, scalei * trkf.error(3));
378 trkf.error(4, scalei * trkf.error(4));
379 trkf.error(5, scalei2 * trkf.error(5));
380 trkf.error(8, scalei * trkf.error(8));
381 trkf.error(12, scalei * trkf.error(12));
382 }
383
384//Scale error matrices in mdst_daughters
385 Belle::Mdst_vee_daughters_Manager& vdaumgr = Belle::Mdst_vee_daughters_Manager::get_manager();
386 for (std::vector<Belle::Mdst_vee_daughters>::iterator it = vdaumgr.begin();
387 it != vdaumgr.end(); ++it) {
388 Belle::Mdst_vee_daughters& vdau = *it;
389 vdau.helix_p(2, scalei * vdau.helix_p(2));
390 vdau.error_p(3, scalei * vdau.error_p(3));
391 vdau.error_p(4, scalei * vdau.error_p(4));
392 vdau.error_p(5, scalei2 * vdau.error_p(5));
393 vdau.error_p(8, scalei * vdau.error_p(8));
394 vdau.error_p(12, scalei * vdau.error_p(12));
395
396 vdau.helix_m(2, scalei * vdau.helix_m(2));
397 vdau.error_m(3, scalei * vdau.error_m(3));
398 vdau.error_m(4, scalei * vdau.error_m(4));
399 vdau.error_m(5, scalei2 * vdau.error_m(5));
400 vdau.error_m(8, scalei * vdau.error_m(8));
401 vdau.error_m(12, scalei * vdau.error_m(12));
402 }
403 }
void scale_momenta_set_v2(const int, const int, const int, double &)
Return scale factors set_v2.
void scale_momenta_set_v1(const int, const int, const int, double &)
Return scale factors set_v1.
double vee_mass_nofit(const Belle::Mdst_vee2 &vee2, float scale=1.0)
Calculates V0 mass with non-constraint fit results.

◆ scale_momenta_set()

void scale_momenta_set ( const int  mode,
const int  expno,
const int  runno,
double &  scale 
)
private

Return scale factors for 2001 summer confs.

analyses, only for exp < 17

Definition at line 406 of file B2BIIFixMdstModule_trk.cc.

408 {
409//=====================================================================
410
411 scale = 1.;
412
413 if (mode == 1) {
414 //factors for 2001 summer confs. analyses
415 if (expno == 7) {scale = 1.001932; return;}
416 if (expno == 9) {scale = 1.001413; return;}
417 if (expno == 11) {scale = 1.001366; return;}
418 // if(expno==13) {scale = 1.000909; return;} //for '01 summer conf. papers; using up to run400
419 if (expno == 13) {scale = 1.001460; return;} //updated factor using up to run1599
420 if (expno >= 15) {B2ERROR("scale_momenta mode=1: not ready for exp >=15");}
421 }
422
423 if (mode == 2) {
424 if (expno == 7) {
425 if (runno >= 0 && runno <= 99) {scale = 1.00262126; return;}
426 if (runno >= 100 && runno <= 199) {scale = 1.00253537; return;}
427 if (runno >= 200 && runno <= 299) {scale = 1.00246555; return;}
428 if (runno >= 300 && runno <= 399) {scale = 1.0026452 ; return;}
429 if (runno >= 400 && runno <= 499) {scale = 1.00290386; return;}
430 if (runno >= 500 && runno <= 599) {scale = 1.00287753; return;}
431 if (runno >= 600 && runno <= 699) {scale = 1.00266845; return;}
432 if (runno >= 700 && runno <= 799) {scale = 1.00184472; return;}
433 if (runno >= 800 && runno <= 899) {scale = 1.00200021; return;}
434 if (runno >= 900 && runno <= 999) {scale = 1.00178485; return;}
435 if (runno >= 1000 && runno <= 1099) {scale = 1.00196071; return;}
436 if (runno >= 1100 && runno <= 1199) {scale = 1.00224453; return;}
437 if (runno >= 1200 && runno <= 1299) {scale = 1.00209138; return;}
438 if (runno >= 1300 && runno <= 1399) {scale = 1.00145455; return;}
439 if (runno >= 1400 && runno <= 1499) {scale = 1.00119243; return;}
440 if (runno >= 1500 && runno <= 1599) {scale = 1.00115572; return;}
441 if (runno >= 1600 && runno <= 1699) {scale = 1.00133916; return;}
442 if (runno >= 1700 && runno <= 1799) {scale = 1.00186441; return;}
443 if (runno >= 1800 && runno <= 1899) {scale = 1.00206786; return;}
444 if (runno >= 1900 && runno <= 1999) {scale = 1.00184794; return;}
445 if (runno >= 2000 && runno <= 2099) {scale = 1.00187219; return;}
446 if (runno >= 2100 && runno <= 2199) {scale = 1.00214844; return;}
447 if (runno >= 2200 && runno <= 2299) {scale = 1.00154502; return;}
448 if (runno >= 2300 && runno <= 2399) {scale = 1.00179518; return;}
449 if (runno >= 2400 && runno <= 2499) {scale = 1.00198983; return;}
450 if (runno >= 2500 && runno <= 2599) {scale = 1.00219242; return;}
451 if (runno >= 2600 && runno <= 2699) {scale = 1.00227363; return;}
452 if (runno >= 2700 && runno <= 2799) {scale = 1.00202328; return;}
453 if (runno >= 2800 && runno <= 2899) {scale = 1.00193147; return;}
454 } else if (expno == 9) {
455 if (runno >= 0 && runno <= 99) {scale = 1.00126754; return;}
456 if (runno >= 100 && runno <= 199) {scale = 1.00119683; return;}
457 if (runno >= 200 && runno <= 299) {scale = 1.00123771; return;}
458 if (runno >= 300 && runno <= 399) {scale = 1.00142625; return;}
459 if (runno >= 400 && runno <= 499) {scale = 1.00134481; return;}
460 if (runno >= 500 && runno <= 599) {scale = 1.00131973; return;}
461 if (runno >= 600 && runno <= 699) {scale = 1.00145963; return;}
462 if (runno >= 700 && runno <= 799) {scale = 1.00161304; return;}
463 if (runno >= 800 && runno <= 899) {scale = 1.00141795; return;}
464 if (runno >= 900 && runno <= 999) {scale = 1.00137157; return;}
465 if (runno >= 1000 && runno <= 1099) {scale = 1.00126209; return;}
466 if (runno >= 1100 && runno <= 1199) {scale = 1.00147941; return;}
467 if (runno >= 1200 && runno <= 1299) {scale = 1.00145555; return;}
468 } else if (expno == 11) {
469 if (runno >= 0 && runno <= 99) {scale = 1.00149576; return;}
470 if (runno >= 100 && runno <= 199) {scale = 1.00155153; return;}
471 if (runno >= 200 && runno <= 299) {scale = 1.0013597 ; return;}
472 if (runno >= 300 && runno <= 399) {scale = 1.00147504; return;}
473 if (runno >= 400 && runno <= 499) {scale = 1.00138242; return;}
474 if (runno >= 500 && runno <= 599) {scale = 1.00144554; return;}
475 if (runno >= 600 && runno <= 699) {scale = 1.00136961; return;}
476 if (runno >= 700 && runno <= 799) {scale = 1.00141443; return;}
477 if (runno >= 800 && runno <= 899) {scale = 1.00136617; return;}
478 if (runno >= 900 && runno <= 999) {scale = 1.00126262; return;}
479 if (runno >= 1000 && runno <= 1099) {scale = 1.00133337; return;}
480 if (runno >= 1100 && runno <= 1199) {scale = 1.00137906; return;}
481 if (runno >= 1200 && runno <= 1299) {scale = 1.00127944; return;}
482 //assume same factor for runno>=1300
483 if (runno >= 1300 && runno <= 1399) {scale = 1.00127944; return;}
484 } else if (expno == 13) {
485 if (runno >= 0 && runno <= 99) {scale = 1.00110691; return;}
486 if (runno >= 100 && runno <= 199) {scale = 1.00106123; return;}
487 if (runno >= 200 && runno <= 299) {scale = 1.00109934; return;}
488 if (runno >= 300 && runno <= 399) {scale = 1.00105759; return;}
489 if (runno >= 400 && runno <= 499) {scale = 1.000986887; return;}
490 if (runno >= 500 && runno <= 599) {scale = 1.000928764; return;}
491 if (runno >= 600 && runno <= 699) {scale = 1.00103925; return;}
492 if (runno >= 700 && runno <= 799) {scale = 1.0010591 ; return;}
493 if (runno >= 800 && runno <= 899) {scale = 1.00127043; return;}
494 if (runno >= 900 && runno <= 999) {scale = 1.00154033; return;}
495 if (runno >= 1000 && runno <= 1099) {scale = 1.00180656; return;}
496 if (runno >= 1100 && runno <= 1199) {scale = 1.00202059; return;}
497 if (runno >= 1200 && runno <= 1299) {scale = 1.00184308; return;}
498 if (runno >= 1300 && runno <= 1399) {scale = 1.00180153; return;}
499 if (runno >= 1400 && runno <= 1499) {scale = 1.00189577; return;}
500 if (runno >= 1500 && runno <= 1599) {scale = 1.00176026; return;}
501 //assume same factor for runno>=1600
502 if (runno >= 1600 && runno <= 1699) {scale = 1.00176026; return;}
503
504 } else if (expno == 15) {
505 if (runno >= 0 && runno <= 99) {scale = 1.00178719; return;}
506 if (runno >= 100 && runno <= 199) {scale = 1.00205712; return;}
507 if (runno >= 200 && runno <= 299) {scale = 1.00197622; return;}
508 if (runno >= 300 && runno <= 399) {scale = 1.00191558; return;}
509 if (runno >= 400 && runno <= 499) {scale = 1.00207795; return;}
510 if (runno >= 500 && runno <= 599) {scale = 1.00191871; return;}
511 if (runno >= 600 && runno <= 699) {scale = 1.00187917; return;}
512 if (runno >= 700 && runno <= 799) {scale = 1.0019573 ; return;}
513 if (runno >= 800 && runno <= 899) {scale = 1.00196562; return;}
514 if (runno >= 900 && runno <= 999) {scale = 1.00205215; return;}
515 if (runno >= 1000 && runno <= 1099) {scale = 1.00200559; return;}
516 if (runno >= 1100 && runno <= 1199) {scale = 1.00198568; return;}
517 if (runno >= 1200 && runno <= 1299) {scale = 1.00212539; return;}
518 if (runno >= 1300 && runno <= 1399) {scale = 1.00199158; return;}
519 if (runno >= 1400 && runno <= 1499) {scale = 1.00208257; return;}
520
521 } else if (expno >= 17) { B2ERROR("scale_momenta mode=2: not ready for exp >=17");}
522
523 }
524 return;
525 }

◆ scale_momenta_set_v1()

void scale_momenta_set_v1 ( const int  mode,
const int  expno,
const int  runno,
double &  scale 
)
private

Return scale factors set_v1.

Definition at line 528 of file B2BIIFixMdstModule_trk.cc.

530 {
531//=====================================================================
532
533 //for e15 mdst processed with b20020405
534
535 scale = 1.;
536
537 if (mode == 1) {
538 B2ERROR("scale_momenta mode=1 not ready for exp " << expno);
539 return;
540 }
541
542 if (mode == 2) {
543 if (expno == 7) {
544 if (runno >= 0 && runno <= 99) {scale = 1.00284313; return;}
545 if (runno >= 100 && runno <= 199) {scale = 1.00272563; return;}
546 if (runno >= 200 && runno <= 299) {scale = 1.00276953; return;}
547 if (runno >= 300 && runno <= 399) {scale = 1.00286722; return;}
548 if (runno >= 400 && runno <= 499) {scale = 1.00318492; return;}
549 if (runno >= 500 && runno <= 599) {scale = 1.00304208; return;}
550 if (runno >= 600 && runno <= 699) {scale = 1.00292413; return;}
551 if (runno >= 700 && runno <= 799) {scale = 1.00201286; return;}
552 if (runno >= 800 && runno <= 899) {scale = 1.00225237; return;}
553 if (runno >= 900 && runno <= 999) {scale = 1.00210375; return;}
554 if (runno >= 1000 && runno <= 1099) {scale = 1.00213222; return;}
555 if (runno >= 1100 && runno <= 1199) {scale = 1.00253683; return;}
556 if (runno >= 1200 && runno <= 1299) {scale = 1.00234023; return;}
557 if (runno >= 1300 && runno <= 1399) {scale = 1.00168421; return;}
558 if (runno >= 1400 && runno <= 1499) {scale = 1.00136169; return;}
559 if (runno >= 1500 && runno <= 1599) {scale = 1.00138431; return;}
560 if (runno >= 1600 && runno <= 1699) {scale = 1.00154521; return;}
561 if (runno >= 1700 && runno <= 1799) {scale = 1.00204405; return;}
562 if (runno >= 1800 && runno <= 1899) {scale = 1.00223498; return;}
563 if (runno >= 1900 && runno <= 1999) {scale = 1.00198975; return;}
564 if (runno >= 2000 && runno <= 2099) {scale = 1.00201868; return;}
565 if (runno >= 2100 && runno <= 2199) {scale = 1.00233875; return;}
566 if (runno >= 2200 && runno <= 2299) {scale = 1.00175269; return;}
567 if (runno >= 2300 && runno <= 2399) {scale = 1.00192858; return;}
568 if (runno >= 2400 && runno <= 2499) {scale = 1.00217693; return;}
569 if (runno >= 2500 && runno <= 2599) {scale = 1.00209337; return;}
570 if (runno >= 2600 && runno <= 2699) {scale = 1.00244277; return;}
571 if (runno >= 2700 && runno <= 2799) {scale = 1.00221485; return;}
572 if (runno >= 2800 && runno <= 2899) {scale = 1.00214678; return;}
573 } else if (expno == 9) {
574 if (runno >= 0 && runno <= 99) {scale = 1.00127702; return;}
575 if (runno >= 100 && runno <= 199) {scale = 1.00119957; return;}
576 if (runno >= 200 && runno <= 299) {scale = 1.00132677; return;}
577 if (runno >= 300 && runno <= 399) {scale = 1.0014785 ; return;}
578 if (runno >= 400 && runno <= 499) {scale = 1.00144872; return;}
579 if (runno >= 500 && runno <= 599) {scale = 1.00145376; return;}
580 if (runno >= 600 && runno <= 699) {scale = 1.00151659; return;}
581 if (runno >= 700 && runno <= 799) {scale = 1.00167384; return;}
582 if (runno >= 800 && runno <= 899) {scale = 1.00153754; return;}
583 if (runno >= 900 && runno <= 999) {scale = 1.0014984 ; return;}
584 if (runno >= 1000 && runno <= 1099) {scale = 1.0013764 ; return;}
585 if (runno >= 1100 && runno <= 1199) {scale = 1.00145545; return;}
586 if (runno >= 1200 && runno <= 1299) {scale = 1.0017164 ; return;}
587 } else if (expno == 11) {
588 if (runno >= 0 && runno <= 99) {scale = 1.00159624; return;}
589 if (runno >= 100 && runno <= 199) {scale = 1.00153365; return;}
590 if (runno >= 200 && runno <= 299) {scale = 1.00143809; return;}
591 if (runno >= 300 && runno <= 399) {scale = 1.00148495; return;}
592 if (runno >= 400 && runno <= 499) {scale = 1.00143193; return;}
593 if (runno >= 500 && runno <= 599) {scale = 1.00141905; return;}
594 if (runno >= 600 && runno <= 699) {scale = 1.0013992 ; return;}
595 if (runno >= 700 && runno <= 799) {scale = 1.00148836; return;}
596 if (runno >= 800 && runno <= 899) {scale = 1.00139019; return;}
597 if (runno >= 900 && runno <= 999) {scale = 1.00151389; return;}
598 if (runno >= 1000 && runno <= 1099) {scale = 1.00142988; return;}
599 if (runno >= 1100 && runno <= 1199) {scale = 1.00143519; return;}
600 if (runno >= 1200 && runno <= 1299) {scale = 1.00132641; return;}
601 } else if (expno == 13) {
602 if (runno >= 0 && runno <= 99) {scale = 1.00126317; return;}
603 if (runno >= 100 && runno <= 199) {scale = 1.00118837; return;}
604 if (runno >= 200 && runno <= 299) {scale = 1.00122276; return;}
605 if (runno >= 300 && runno <= 399) {scale = 1.00113233; return;}
606 if (runno >= 400 && runno <= 499) {scale = 1.00111677; return;}
607 if (runno >= 500 && runno <= 599) {scale = 1.00100963; return;}
608 if (runno >= 600 && runno <= 699) {scale = 1.0011474 ; return;}
609 if (runno >= 700 && runno <= 799) {scale = 1.00116245; return;}
610 if (runno >= 800 && runno <= 899) {scale = 1.00139826; return;}
611 if (runno >= 900 && runno <= 999) {scale = 1.0017014 ; return;}
612 if (runno >= 1000 && runno <= 1099) {scale = 1.00190706; return;}
613 if (runno >= 1100 && runno <= 1199) {scale = 1.00214688; return;}
614 if (runno >= 1200 && runno <= 1299) {scale = 1.00207336; return;}
615 if (runno >= 1300 && runno <= 1399) {scale = 1.00192885; return;}
616 if (runno >= 1400 && runno <= 1499) {scale = 1.00196289; return;}
617 if (runno >= 1500 && runno <= 1599) {scale = 1.00185017; return;}
618 if (runno >= 1600 && runno <= 1699) {scale = 1.00191256; return;}
619 } else if (expno == 15) {
620 if (runno >= 0 && runno <= 99) {scale = 1.001953; return;}
621 if (runno >= 100 && runno <= 199) {scale = 1.00210508; return;}
622 if (runno >= 200 && runno <= 299) {scale = 1.002139; return;}
623 if (runno >= 300 && runno <= 399) {scale = 1.00207803; return;}
624 if (runno >= 400 && runno <= 499) {scale = 1.0022331; return;}
625 if (runno >= 500 && runno <= 599) {scale = 1.00206421; return;}
626 if (runno >= 600 && runno <= 699) {scale = 1.00205153; return;}
627 if (runno >= 700 && runno <= 799) {scale = 1.00214664; return;}
628 if (runno >= 800 && runno <= 899) {scale = 1.0021456; return;}
629 if (runno >= 900 && runno <= 999) {scale = 1.00221055; return;}
630 if (runno >= 1000 && runno <= 1099) {scale = 1.00216472; return;}
631 if (runno >= 1100 && runno <= 1199) {scale = 1.00214208; return;}
632 if (runno >= 1200 && runno <= 1299) {scale = 1.00228874; return;}
633 if (runno >= 1300 && runno <= 1399) {scale = 1.00215047; return;}
634 if (runno >= 1400 && runno <= 1499) {scale = 1.00219808; return;}
635 } else if (expno == 17) {
636 if (runno >= 0 && runno <= 99) {scale = 1.00216742; return;}
637 if (runno >= 100 && runno <= 199) {scale = 1.00229433; return;}
638 if (runno >= 200 && runno <= 299) {scale = 1.0022749 ; return;}
639 if (runno >= 300 && runno <= 399) {scale = 1.00231283; return;}
640 if (runno >= 400 && runno <= 499) {scale = 1.00223654; return;}
641 if (runno >= 500 && runno <= 599) {scale = 1.00236524; return;}
642 if (runno >= 600 && runno <= 699) {scale = 1.00229312; return;}
643 if (runno >= 700 && runno <= 799) {scale = 1.002262 ; return;}
644 if (runno >= 800 && runno <= 899) {scale = 1.00220104; return;}
645 if (runno >= 900 && runno <= 999) {scale = 1.00215475; return;}
646 } else if (expno == 19) {
647 if (runno >= 0 && runno <= 99) {scale = 1.00227682; return;}
648 if (runno >= 100 && runno <= 199) {scale = 1.00235795; return;}
649 if (runno >= 200 && runno <= 299) {scale = 1.00251509; return;}
650 if (runno >= 300 && runno <= 399) {scale = 1.0022106 ; return;}
651 if (runno >= 400 && runno <= 499) {scale = 1.00230963; return;}
652 if (runno >= 500 && runno <= 599) {scale = 1.002229 ; return;}
653 if (runno >= 600 && runno <= 699) {scale = 1.00215402; return;}
654 if (runno >= 700 && runno <= 799) {scale = 1.00217892; return;}
655 if (runno >= 800 && runno <= 899) {scale = 1.0022305 ; return;}
656 if (runno >= 900 && runno <= 999) {scale = 1.0021458 ; return;}
657 if (runno >= 1000 && runno <= 1099) {scale = 1.00215792; return;}
658 if (runno >= 1100 && runno <= 1199) {scale = 1.0022667 ; return;}
659 if (runno >= 1200 && runno <= 1299) {scale = 1.00219581; return;}
660 if (runno >= 1300 && runno <= 1399) {scale = 1.00218378; return;}
661 if (runno >= 1400 && runno <= 1499) {scale = 1.00232172; return;}
662 if (runno >= 1500 && runno <= 1599) {scale = 1.00217172; return;}
663 if (runno >= 1600 && runno <= 1700) {scale = 1.00208639; return;}
664 if (runno >= 1700 && runno <= 1799) {scale = 1.00188253; return;}
665 if (runno >= 1800) {
666 B2ERROR("scale_momenta not ready for this exp,run "
667 << expno << "," << runno);
668 }
669 } else if (expno == 21) {
670 if (runno >= 0 && runno <= 99) {scale = 1.00228182; return;}
671 if (runno >= 100 && runno <= 199) {scale = 1.00233446; return;}
672 if (runno >= 200 && runno <= 299) {scale = 1.00238846; return;}
673 if (runno >= 300 && runno <= 399) {scale = 1.00238061 ; return;}
674 if (runno >= 400) {
675 B2ERROR("scale_momenta not ready for this exp,run "
676 << expno << "," << runno);
677 }
678 } else if (expno == 23) {
679 if (runno >= 0 && runno <= 99) {scale = 1.00216089; return;}
680 if (runno >= 100 && runno <= 199) {scale = 1.0019783; return;}
681 if (runno >= 200 && runno <= 299) {scale = 1.00172162; return;}
682 if (runno >= 300 && runno <= 399) {scale = 1.0017938 ; return;}
683 if (runno >= 400 && runno <= 499) {scale = 1.00177832 ; return;}
684 if (runno >= 500 && runno <= 599) {scale = 1.0017609 ; return;}
685 if (runno >= 600 && runno <= 699) {scale = 1.0017756 ; return;}
686 if (runno >= 700) {
687 B2ERROR("scale_momenta not ready for this exp,run "
688 << expno << "," << runno);
689 }
690 } else if (expno == 25) {
691 if (runno >= 0 && runno <= 99) {scale = 1.00190068; return;}
692 if (runno >= 100 && runno <= 199) {scale = 1.00199038; return;}
693 if (runno >= 200 && runno <= 299) {scale = 1.00196171; return;}
694 if (runno >= 300 && runno <= 399) {scale = 1.00200167; return;}
695 if (runno >= 400 && runno <= 499) {scale = 1.0019667 ; return;}
696 if (runno >= 500 && runno <= 599) {scale = 1.00212109; return;}
697 if (runno >= 600 && runno <= 699) {scale = 1.00202115; return;}
698 if (runno >= 700 && runno <= 799) {scale = 1.00196456; return;}
699 if (runno >= 800 && runno <= 899) {scale = 1.00200392; return;}
700 if (runno >= 900 && runno <= 999) {scale = 1.00199495; return;}
701 if (runno >= 1000 && runno <= 1099) {scale = 1.00202212; return;}
702 if (runno >= 1100 && runno <= 1199) {scale = 1.00205312; return;}
703 if (runno >= 1200 && runno <= 1299) {scale = 1.00200891; return;}
704 if (runno >= 1300 && runno <= 1399) {scale = 1.00196866; return;}
705 if (runno >= 1400 && runno <= 1499) {scale = 1.0020257 ; return;}
706 if (runno >= 1500 && runno <= 1599) {scale = 1.00196995; return;}
707 if (runno >= 1600 && runno <= 1699) {scale = 1.00189232; return;}
708 if (runno >= 1700 && runno <= 1799) {scale = 1.00179028; return;}
709 if (runno >= 1800 && runno <= 1899) {scale = 1.00179459; return;}
710 if (runno >= 1900 && runno <= 1999) {scale = 1.001762 ; return;}
711 if (runno >= 2000 && runno <= 2099) {scale = 1.00179514; return;}
712 if (runno >= 2100 && runno <= 2199) {scale = 1.00175211; return;}
713 if (runno >= 2200) {
714 B2ERROR("scale_momenta not ready for this exp,run "
715 << expno << "," << runno);
716 }
717 } else if (expno == 27) {
718 if (runno >= 0 && runno <= 99) {scale = 1.00192647; return;}
719 if (runno >= 100 && runno <= 199) {scale = 1.0019717 ; return;}
720 if (runno >= 200 && runno <= 299) {scale = 1.00196428; return;}
721 if (runno >= 300 && runno <= 399) {scale = 1.00190998; return;}
722 if (runno >= 400 && runno <= 499) {scale = 1.00204645; return;}
723 if (runno >= 500 && runno <= 599) {scale = 1.0020687 ; return;}
724 if (runno >= 600 && runno <= 699) {scale = 1.00198209; return;}
725
726 if (runno >= 700 && runno <= 800) {scale = 1.00187505; return;}
727 if (runno >= 801 && runno <= 900) {scale = 1.00186805; return;}
728 if (runno >= 901 && runno <= 1000) {scale = 1.00185576; return;}
729 if (runno >= 1001 && runno <= 1079) {scale = 1.00177176; return;}
730 if (runno >= 1080 && runno <= 1100) {scale = 1.00177184; return;}
731 if (runno >= 1101 && runno <= 1200) {scale = 1.00174057; return;}
732 if (runno >= 1201 && runno <= 1251) {scale = 1.00189649; return;}
733 if (runno >= 1252 && runno <= 1300) {scale = 1.00189999; return;}
734 if (runno >= 1301 && runno <= 1400) {scale = 1.0018818 ; return;}
735 if (runno >= 1401 && runno <= 1500) {scale = 1.00200148; return;}
736 if (runno >= 1501 && runno <= 1600) {scale = 1.00220137; return;}
737 if (runno >= 1601 && runno <= 1632) {scale = 1.00217034; return;}
738 if (runno >= 1633) {
739 B2ERROR("scale_momenta not ready for this exp,run "
740 << expno << "," << runno);
741 }
742 } else if (expno == 31) {
743 if (runno >= 0 && runno <= 99) {scale = 1.000373374; return;}
744 if (runno >= 100 && runno <= 199) {scale = 1.000684843; return;}
745 if (runno >= 200 && runno <= 299) {scale = 1.000741216; return;}
746 if (runno >= 300 && runno <= 399) {scale = 1.00092523 ; return;}
747 if (runno >= 400 && runno <= 499) {scale = 1.00104576 ; return;}
748 if (runno >= 500 && runno <= 599) {scale = 1.00103982 ; return;}
749 if (runno >= 600 && runno <= 699) {scale = 1.0010601 ; return;}
750 if (runno >= 700 && runno <= 799) {scale = 1.000982515; return;}
751 if (runno >= 800 && runno <= 899) {scale = 1.00101577 ; return;}
752 if (runno >= 900 && runno <= 999) {scale = 1.000972193; return;}
753 if (runno >= 1000 && runno <= 1099) {scale = 1.00102536 ; return;}
754 if (runno >= 1100 && runno <= 1199) {scale = 1.00127571 ; return;}
755 if (runno >= 1200 && runno <= 1299) {scale = 1.00117938 ; return;}
756 if (runno >= 1300 && runno <= 1399) {scale = 1.00121084 ; return;}
757 if (runno >= 1400 && runno <= 1499) {scale = 1.00125911 ; return;}
758 if (runno >= 1500 && runno <= 1599) {scale = 1.0012907 ; return;}
759 if (runno >= 1600 && runno <= 1699) {scale = 1.00125362 ; return;}
760 if (runno >= 1700 && runno <= 1799) {scale = 1.00131686 ; return;}
761 if (runno >= 1800) {
762 B2ERROR("scale_momenta not ready for this exp,run "
763 << expno << "," << runno);
764 }
765 } else if (expno == 33) {
766 if (runno >= 0 && runno <= 99) {scale = 1.00136407; return;}
767 if (runno >= 100 && runno <= 199) {scale = 1.0013701 ; return;}
768 if (runno >= 200 && runno <= 299) {scale = 1.00156244; return;}
769 if (runno >= 300 && runno <= 399) {scale = 1.00138501; return;}
770 if (runno >= 400 && runno <= 499) {scale = 1.00148468; return;}
771 if (runno >= 500 && runno <= 599) {scale = 1.0013797 ; return;}
772 if (runno >= 600 && runno <= 699) {scale = 1.00152298; return;}
773 if (runno >= 700 && runno <= 799) {scale = 1.001524 ; return;}
774 if (runno >= 800 && runno <= 899) {scale = 1.0014635 ; return;}
775 if (runno >= 900) {
776 B2ERROR("scale_momenta not ready for this exp,run "
777 << expno << "," << runno);
778 }
779 } else if (expno == 35) {
780 if (runno >= 0 && runno <= 99) {scale = 1.00135452; return;}
781 if (runno >= 100 && runno <= 199) {scale = 1.00135798; return;}
782 if (runno >= 200 && runno <= 299) {scale = 1.00139979; return;}
783 if (runno >= 300 && runno <= 399) {scale = 1.00136061; return;}
784 if (runno >= 400 && runno <= 499) {scale = 1.00135776; return;}
785 if (runno >= 500 && runno <= 599) {scale = 1.00118666; return;}
786 if (runno >= 600 && runno <= 699) {scale = 1.0011346 ; return;}
787 if (runno >= 700) {
788 B2ERROR("scale_momenta not ready for this exp,run "
789 << expno << "," << runno);
790 }
791 } else if (expno == 37) {
792 if (runno >= 0 && runno <= 99) {scale = 1.00076522 ; return;}
793 if (runno >= 100 && runno <= 199) {scale = 1.000875154; return;}
794 if (runno >= 200 && runno <= 299) {scale = 1.000946763; return;}
795 if (runno >= 300 && runno <= 399) {scale = 1.000868444; return;}
796 if (runno >= 400 && runno <= 499) {scale = 1.000781409; return;}
797 if (runno >= 500 && runno <= 599) {scale = 1.000781171; return;}
798 if (runno >= 600 && runno <= 699) {scale = 1.000857962; return;}
799 if (runno >= 700 && runno <= 799) {scale = 1.000756082; return;}
800 if (runno >= 800 && runno <= 899) {scale = 1.000727355; return;}
801 if (runno >= 900 && runno <= 999) {scale = 1.000740236; return;}
802 if (runno >= 1000 && runno <= 1099) {scale = 1.000499606; return;}
803 if (runno >= 1100 && runno <= 1199) {scale = 1.000481664; return;}
804 if (runno >= 1200 && runno <= 1299) {scale = 1.000706924; return;}
805 if (runno >= 1300 && runno <= 1399) {scale = 1.000673738; return;}
806 if (runno >= 1400 && runno <= 1499) {scale = 1.000662648; return;}
807 if (runno >= 1500 && runno <= 1599) {scale = 1.000671198; return;}
808 if (runno >= 1600 && runno <= 1699) {scale = 1.000604364; return;}
809 if (runno >= 1700 && runno <= 1799) {scale = 1.000717372; return;}
810 if (runno >= 1800 && runno <= 1899) {scale = 1.000512399; return;}
811 if (runno >= 1900 && runno <= 1999) {scale = 1.000436958; return;}
812 if (runno >= 2000) {
813 B2ERROR("scale_momenta not ready for this exp,run "
814 << expno << "," << runno);
815 }
816 } else if (expno == 39) {
817 if (runno >= 0 && runno <= 99) {scale = 1.000504342; return;}
818 if (runno >= 100 && runno <= 199) {scale = 1.000704544; return;}
819 if (runno >= 200 && runno <= 299) {scale = 1.00094335 ; return;}
820 if (runno >= 300 && runno <= 399) {scale = 1.000928819; return;}
821 if (runno >= 400 && runno <= 499) {scale = 1.000884638; return;}
822 if (runno >= 500 && runno <= 599) {scale = 1.00083459 ; return;}
823 if (runno >= 600 && runno <= 699) {scale = 1.000767604; return;}
824 if (runno >= 700 && runno <= 799) {scale = 1.000882219; return;}
825 if (runno >= 800 && runno <= 899) {scale = 1.000781437; return;}
826 if (runno >= 900 && runno <= 999) {scale = 1.000853168; return;}
827 if (runno >= 1000 && runno <= 1099) {scale = 1.000926527; return;}
828 if (runno >= 1100 && runno <= 1199) {scale = 1.000942882; return;}
829 if (runno >= 1200 && runno <= 1299) {scale = 1.000932802; return;}
830 if (runno >= 1300 && runno <= 1399) {scale = 1.000898892; return;}
831 if (runno >= 1400) {
832 B2ERROR("scale_momenta not ready for this exp,run "
833 << expno << "," << runno);
834 }
835 } else if (expno == 41) {
836 if (runno >= 0 && runno <= 99) {scale = 1.00178427; return;}
837 if (runno >= 100 && runno <= 199) {scale = 1.00188559; return;}
838 if (runno >= 200 && runno <= 299) {scale = 1.0019292 ; return;}
839 if (runno >= 300 && runno <= 399) {scale = 1.00196352; return;}
840 if (runno >= 400 && runno <= 499) {scale = 1.0019078 ; return;}
841 if (runno >= 500 && runno <= 599) {scale = 1.00185598; return;}
842 if (runno >= 600 && runno <= 699) {scale = 1.00191314; return;}
843 if (runno >= 700 && runno <= 799) {scale = 1.00179647; return;}
844 if (runno >= 800 && runno <= 899) {scale = 1.00189776; return;}
845 if (runno >= 900 && runno <= 999) {scale = 1.00184798; return;}
846 if (runno >= 1000 && runno <= 1099) {scale = 1.00177963; return;}
847 if (runno >= 1100 && runno <= 1199) {scale = 1.00176408; return;}
848 if (runno >= 1200 && runno <= 1299) {scale = 1.00171371; return;}
849 if (runno >= 1300) {
850 B2ERROR("scale_momenta not ready for this exp,run "
851 << expno << "," << runno);
852 }
853 } else if (expno == 43) {
854 if (runno >= 0 && runno <= 99) {scale = 1.00142307; return;}
855 if (runno >= 100 && runno <= 199) {scale = 1.000979455; return;}
856 if (runno >= 200 && runno <= 299) {scale = 1.000974458; return;}
857 if (runno >= 300 && runno <= 399) {scale = 1.00103301; return;}
858 if (runno >= 400 && runno <= 499) {scale = 1.001111994; return;}
859 if (runno >= 500 && runno <= 599) {scale = 1.00100635; return;}
860 if (runno >= 600 && runno <= 699) {scale = 1.00105078; return;}
861 if (runno >= 700 && runno <= 799) {scale = 1.00103593; return;}
862 if (runno >= 800 && runno <= 899) {scale = 1.00105158; return;}
863 if (runno >= 900 && runno <= 999) {scale = 1.000955608; return;}
864 if (runno >= 1000 && runno <= 1099) {scale = 1.00099199; return;}
865 if (runno >= 1100 && runno <= 1199) {scale = 1.0011439; return;}
866 if (runno >= 1200) {
867 B2ERROR("scale_momenta not ready for this exp,run "
868 << expno << "," << runno);
869 }
870 } else if (expno == 45) {
871 if (runno >= 0 && runno <= 99) {scale = 1.00126261; return;}
872 if (runno >= 100 && runno <= 199) {scale = 1.00138601; return;}
873 if (runno >= 200 && runno <= 299) {scale = 1.00135372; return;}
874 if (runno >= 300 && runno <= 399) {scale = 1.00141286; return;}
875 if (runno >= 400 && runno <= 499) {scale = 1.00147822; return;}
876 if (runno >= 500) {
877 B2ERROR("scale_momenta not ready for this exp,run "
878 << expno << "," << runno);
879 }
880 } else if (expno == 47) {
881 if (runno >= 0 && runno <= 99) {scale = 1.00156977; return;}
882 if (runno >= 100 && runno <= 199) {scale = 1.00155614; return;}
883 if (runno >= 200 && runno <= 299) {scale = 1.0016555; return;}
884 if (runno >= 300 && runno <= 399) {scale = 1.00167046; return;}
885 if (runno >= 400 && runno <= 499) {scale = 1.00168705; return;}
886 if (runno >= 500 && runno <= 599) {scale = 1.00169555; return;}
887 if (runno >= 600 && runno <= 699) {scale = 1.00175653; return;}
888 if (runno >= 700 && runno <= 799) {scale = 1.00174358; return;}
889 if (runno >= 800 && runno <= 899) {scale = 1.00174004; return;}
890 if (runno >= 900) {
891 B2ERROR("scale_momenta not ready for this exp,run "
892 << expno << "," << runno);
893 }
894 } else if (expno == 49) {
895 if (runno >= 0 && runno <= 99) {scale = 1.00158837; return;}
896 if (runno >= 100 && runno <= 199) {scale = 1.00163884; return;}
897 if (runno >= 200 && runno <= 299) {scale = 1.00160595; return;}
898 if (runno >= 300 && runno <= 399) {scale = 1.00149916; return;}
899 if (runno >= 400 && runno <= 499) {scale = 1.0014956 ; return;}
900 if (runno >= 500 && runno <= 599) {scale = 1.00156212; return;}
901 if (runno >= 600 && runno <= 699) {scale = 1.00121868; return;}
902 if (runno >= 700 && runno <= 799) {scale = 1.00134613; return;}
903 if (runno >= 800 && runno <= 899) {scale = 1.00138985; return;}
904 if (runno >= 900 && runno <= 999) {scale = 1.00129356; return;}
905 if (runno >= 1000 && runno <= 1099) {scale = 1.00119732; return;}
906 if (runno >= 1100 && runno <= 1199) {scale = 1.00121481; return;}
907 if (runno >= 1200 && runno <= 1299) {scale = 1.00121108; return;}
908 if (runno >= 1300) {
909 B2ERROR("scale_momenta not ready for this exp,run "
910 << expno << "," << runno);
911 }
912 } else if (expno == 51) {
913 if (runno >= 0 && runno <= 99) {scale = 1.00160252; return;}
914 if (runno >= 100 && runno <= 199) {scale = 1.00156099; return;}
915 if (runno >= 200 && runno <= 299) {scale = 1.00154760; return;}
916 if (runno >= 300 && runno <= 399) {scale = 1.00146316; return;}
917 if (runno >= 400 && runno <= 499) {scale = 1.00145525; return;}
918 if (runno >= 500 && runno <= 599) {scale = 1.00134429; return;}
919 if (runno >= 600 && runno <= 699) {scale = 1.00135581; return;}
920 if (runno >= 700 && runno <= 799) {scale = 1.00134382; return;}
921 if (runno >= 800 && runno <= 899) {scale = 1.00126462; return;}
922 if (runno >= 900 && runno <= 999) {scale = 1.00130752; return;}
923 if (runno >= 1000 && runno <= 1099) {scale = 1.00130452; return;}
924 if (runno >= 1100 && runno <= 1199) {scale = 1.00131440; return;}
925 if (runno >= 1200 && runno <= 1299) {scale = 1.00130864; return;}
926 if (runno >= 1300 && runno <= 1399) {scale = 1.00105290; return;}
927 if (runno >= 1400 && runno <= 1499) {scale = 1.00126645; return;}
928 if (runno >= 1500 && runno <= 1599) {scale = 1.00126383; return;}
929 if (runno >= 1600 && runno <= 1699) {scale = 1.00141111; return;}
930 if (runno >= 1700 && runno <= 1799) {scale = 1.00126220; return;}
931 if (runno >= 1800 && runno <= 1899) {scale = 1.00105098; return;}
932 if (runno >= 1900) {
933 B2ERROR("scale_momenta not ready for this exp,run "
934 << expno << "," << runno);
935 }
936 } else if (expno == 53) {
937 if (runno >= 0 && runno <= 99) {scale = 1.0011516; return;}
938 if (runno >= 100 && runno <= 199) {scale = 1.00115527; return;}
939 if (runno >= 200 && runno <= 299) {scale = 1.00114844; return;}
940 if (runno >= 300) {
941 B2ERROR("scale_momenta not ready for this exp,run "
942 << expno << "," << runno);
943 }
944 } else if (expno == 55) {
945 if (runno >= 0 && runno <= 99) {scale = 1.00114284; return;}
946 if (runno >= 100 && runno <= 199) {scale = 1.00111458; return;}
947 if (runno >= 200 && runno <= 299) {scale = 1.00109686; return;}
948 if (runno >= 300 && runno <= 399) {scale = 1.00119475; return;}
949 if (runno >= 400 && runno <= 499) {scale = 1.00117818; return;}
950 if (runno >= 500 && runno <= 599) {scale = 1.00115789; return;}
951 if (runno >= 600 && runno <= 699) {scale = 1.00122261; return;}
952 if (runno >= 700 && runno <= 799) {scale = 1.00118454; return;}
953 if (runno >= 800 && runno <= 899) {scale = 1.00118042; return;}
954 if (runno >= 900 && runno <= 999) {scale = 1.00124759; return;}
955 if (runno >= 1000 && runno <= 1099) {scale = 1.00128055; return;}
956 if (runno >= 1100 && runno <= 1199) {scale = 1.00119131; return;}
957 if (runno >= 1200 && runno <= 1299) {scale = 1.00122238; return;}
958 if (runno >= 1300 && runno <= 1399) {scale = 1.00129538; return;}
959 if (runno >= 1400 && runno <= 1499) {scale = 1.00130387; return;}
960 if (runno >= 1500 && runno <= 1599) {scale = 1.00130858; return;}
961 if (runno >= 1600 && runno <= 1699) {scale = 1.00111854; return;}
962 if (runno >= 1700 && runno <= 1799) {scale = 1.00136261; return;}
963 if (runno >= 1800) {
964 B2ERROR("scale_momenta not ready for this exp,run "
965 << expno << "," << runno);
966 }
967 } else if (expno == 61) {
968 if (runno >= 0 && runno <= 99) {scale = 1.0009992; return;}
969 if (runno >= 100 && runno <= 199) {scale = 1.00113704; return;}
970 if (runno >= 200 && runno <= 299) {scale = 1.00129904; return;}
971 if (runno >= 300 && runno <= 399) {scale = 1.00141879; return;}
972 if (runno >= 400 && runno <= 499) {scale = 1.00146707; return;}
973 if (runno >= 500 && runno <= 599) {scale = 1.00150101; return;}
974 if (runno >= 600 && runno <= 699) {scale = 1.00147322; return;}
975 if (runno >= 700 && runno <= 799) {scale = 1.00153929; return;}
976 if (runno >= 800 && runno <= 899) {scale = 1.00159997; return;}
977 if (runno >= 900 && runno <= 999) {scale = 1.00164032; return;}
978 if (runno >= 1000 && runno <= 1099) {scale = 1.00165878; return;}
979 if (runno >= 1100 && runno <= 1199) {scale = 1.00163475; return;}
980 if (runno >= 1200 && runno <= 1207) {scale = 1.00166193; return;}
981 if (runno >= 1208 && runno <= 1299) {scale = 1.00235824; return;}
982 if (runno >= 1300 && runno <= 1399) {scale = 1.00242282; return;}
983 if (runno >= 1400) {
984 B2ERROR("scale_momenta not ready for this exp,run "
985 << expno << "," << runno);
986 }
987 } else if (expno == 65) {
988 if (runno <= 999) {
989 B2ERROR("scale_momenta not ready for this exp,run "
990 << expno << "," << runno);
991 }
992 if (runno >= 1000 && runno <= 1336) {scale = 1.00145234; return;}
993 if (runno >= 1336) {
994 B2ERROR("scale_momenta not ready for this exp,run "
995 << expno << "," << runno);
996 }
997 } else
998 B2ERROR("scale_momenta mode=2 not ready for exp " << expno);
999 }
1000 return;
1001 }

◆ scale_momenta_set_v2()

void scale_momenta_set_v2 ( const int  mode,
const int  expno,
const int  runno,
double &  scale 
)
private

Return scale factors set_v2.

Definition at line 1004 of file B2BIIFixMdstModule_trk.cc.

1006 {
1007//=====================================================================
1008
1009 //for e15 mdst processed with b20020405
1010
1011 scale = 1.;
1012
1013 if (mode == 1) {
1014 B2ERROR("scale_momenta mode=1 not ready for exp " << expno);
1015 return;
1016 }
1017
1018 if (mode == 2) {
1019 if (expno == 7) {
1020
1021 } else if (expno == 9) {
1022
1023 } else if (expno == 11) {
1024
1025 } else if (expno == 13) {
1026
1027 } else if (expno == 15) {
1028
1029 } else if (expno == 17) {
1030
1031 } else if (expno == 19) {
1032 B2ERROR("scale_momenta not ready for this exp,run "
1033 << expno << "," << runno);
1034
1035 } else if (expno == 21) {
1036 B2ERROR("scale_momenta not ready for this exp,run "
1037 << expno << "," << runno);
1038
1039 } else if (expno == 23) {
1040 B2ERROR("scale_momenta not ready for this exp,run "
1041 << expno << "," << runno);
1042
1043 } else if (expno == 25) {
1044 B2ERROR("scale_momenta not ready for this exp,run "
1045 << expno << "," << runno);
1046
1047 } else if (expno == 27) {
1048 B2ERROR("scale_momenta not ready for this exp,run "
1049 << expno << "," << runno);
1050
1051 } else if (expno == 31) {
1052 if (runno >= 0 && runno <= 137) {
1053 B2ERROR("scale_momenta not ready for this exp,run "
1054 << expno << "," << runno);
1055 }
1056 if (runno >= 138 && runno <= 199) {scale = 1.000931841; return;}
1057 if (runno >= 200 && runno <= 299) {scale = 1.000916397; return;}
1058 if (runno >= 300 && runno <= 399) {scale = 1.00108023 ; return;}
1059 if (runno >= 400 && runno <= 499) {scale = 1.00118662 ; return;}
1060 if (runno >= 500 && runno <= 599) {scale = 1.00117739 ; return;}
1061 if (runno >= 600 && runno <= 699) {scale = 1.00119542 ; return;}
1062 if (runno >= 700 && runno <= 799) {scale = 1.00110396 ; return;}
1063 if (runno >= 800 && runno <= 899) {scale = 1.00109603 ; return;}
1064 if (runno >= 900 && runno <= 999) {scale = 1.00112795 ; return;}
1065 if (runno >= 1000 && runno <= 1099) {scale = 1.00118365 ; return;}
1066 if (runno >= 1100 && runno <= 1199) {scale = 1.00142214 ; return;}
1067 if (runno >= 1200 && runno <= 1299) {scale = 1.00133150 ; return;}
1068 if (runno >= 1300 && runno <= 1399) {scale = 1.00132831 ; return;}
1069 if (runno >= 1400 && runno <= 1499) {scale = 1.00136554 ; return;}
1070 if (runno >= 1500 && runno <= 1599) {scale = 1.00141187 ; return;}
1071 if (runno >= 1600 && runno <= 1699) {scale = 1.00136628 ; return;}
1072 if (runno >= 1700 && runno <= 1799) {scale = 1.00139273 ; return;}
1073 if (runno >= 1800) {
1074 B2ERROR("scale_momenta not ready for this exp,run "
1075 << expno << "," << runno);
1076 }
1077 } else if (expno == 33) {
1078 if (runno >= 0 && runno <= 99) {scale = 1.00149319; return;}
1079 if (runno >= 100 && runno <= 199) {scale = 1.00150915; return;}
1080 if (runno >= 200 && runno <= 299) {scale = 1.00173040; return;}
1081 if (runno >= 300 && runno <= 399) {scale = 1.00150449; return;}
1082 if (runno >= 400 && runno <= 499) {scale = 1.00161519; return;}
1083 if (runno >= 500 && runno <= 599) {scale = 1.00151670; return;}
1084 if (runno >= 600 && runno <= 699) {scale = 1.00164347; return;}
1085 if (runno >= 700 && runno <= 799) {scale = 1.00164165; return;}
1086 if (runno >= 800 && runno <= 899) {scale = 1.00161369; return;}
1087 if (runno >= 900) {
1088 B2ERROR("scale_momenta not ready for this exp,run "
1089 << expno << "," << runno);
1090 }
1091 } else if (expno == 35) {
1092 if (runno >= 0 && runno <= 99) {scale = 1.00147034; return;}
1093 if (runno >= 100 && runno <= 199) {scale = 1.00148523; return;}
1094 if (runno >= 200 && runno <= 299) {scale = 1.00153372; return;}
1095 if (runno >= 300 && runno <= 399) {scale = 1.00148256; return;}
1096 if (runno >= 400 && runno <= 499) {scale = 1.00144902; return;}
1097 if (runno >= 500 && runno <= 599) {scale = 1.00131501; return;}
1098 if (runno >= 600 && runno <= 699) {scale = 1.00126371; return;}
1099 if (runno >= 700) {
1100 B2ERROR("scale_momenta not ready for this exp,run "
1101 << expno << "," << runno);
1102 }
1103 } else if (expno == 37) {
1104 if (runno >= 0 && runno <= 99) {scale = 1.000916277; return;}
1105 if (runno >= 100 && runno <= 199) {scale = 1.001035310; return;}
1106 if (runno >= 200 && runno <= 299) {scale = 1.001123403; return;}
1107 if (runno >= 300 && runno <= 399) {scale = 1.001017718; return;}
1108 if (runno >= 400 && runno <= 499) {scale = 1.000932890; return;}
1109 if (runno >= 500 && runno <= 599) {scale = 1.000928479; return;}
1110 if (runno >= 600 && runno <= 699) {scale = 1.000997938; return;}
1111 if (runno >= 700 && runno <= 799) {scale = 1.000899663; return;}
1112 if (runno >= 800 && runno <= 899) {scale = 1.000860910; return;}
1113 if (runno >= 900 && runno <= 999) {scale = 1.000882920; return;}
1114 if (runno >= 1000 && runno <= 1099) {scale = 1.000616966; return;}
1115 if (runno >= 1100 && runno <= 1199) {scale = 1.000613018; return;}
1116 if (runno >= 1200 && runno <= 1299) {scale = 1.000832338; return;}
1117 if (runno >= 1300 && runno <= 1399) {scale = 1.000803640; return;}
1118 if (runno >= 1400 && runno <= 1499) {scale = 1.000770454; return;}
1119 if (runno >= 1500 && runno <= 1599) {scale = 1.000786608; return;}
1120 if (runno >= 1600 && runno <= 1699) {scale = 1.000718089; return;}
1121 if (runno >= 1700 && runno <= 1799) {scale = 1.000826042; return;}
1122 if (runno >= 1800 && runno <= 1899) {scale = 1.000638150; return;}
1123 if (runno >= 1900 && runno <= 1999) {scale = 1.000529173; return;}
1124 if (runno >= 2000) {
1125 B2ERROR("scale_momenta not ready for this exp,run "
1126 << expno << "," << runno);
1127 }
1128 } else if (expno == 39) {
1129 if (runno >= 0 && runno <= 99) {scale = 1.000610857; return;}
1130 if (runno >= 100 && runno <= 199) {scale = 1.000838583; return;}
1131 if (runno >= 200 && runno <= 299) {scale = 1.00105918 ; return;}
1132 if (runno >= 300 && runno <= 399) {scale = 1.00105841 ; return;}
1133 if (runno >= 400 && runno <= 499) {scale = 1.001025523; return;}
1134 if (runno >= 500 && runno <= 599) {scale = 1.000967373; return;}
1135 if (runno >= 600 && runno <= 699) {scale = 1.000898585; return;}
1136 if (runno >= 700 && runno <= 799) {scale = 1.001003199; return;}
1137 if (runno >= 800 && runno <= 899) {scale = 1.000897072; return;}
1138 if (runno >= 900 && runno <= 999) {scale = 1.000972551; return;}
1139 if (runno >= 1000 && runno <= 1099) {scale = 1.001044677; return;}
1140 if (runno >= 1100 && runno <= 1199) {scale = 1.00106451 ; return;}
1141 if (runno >= 1200 && runno <= 1299) {scale = 1.00108570 ; return;}
1142 if (runno >= 1300 && runno <= 1399) {scale = 1.00102381 ; return;}
1143 if (runno >= 1400) {
1144 B2ERROR("scale_momenta not ready for this exp,run "
1145 << expno << "," << runno);
1146 }
1147 } else if (expno == 41) {
1148 if (runno >= 0 && runno <= 99) {scale = 1.00189378; return;}
1149 if (runno >= 100 && runno <= 199) {scale = 1.00197304; return;}
1150 if (runno >= 200 && runno <= 299) {scale = 1.00204049; return;}
1151 if (runno >= 300 && runno <= 399) {scale = 1.00205065; return;}
1152 if (runno >= 400 && runno <= 499) {scale = 1.00199205; return;}
1153 if (runno >= 500 && runno <= 599) {scale = 1.00195618; return;}
1154 if (runno >= 600 && runno <= 699) {scale = 1.00200889; return;}
1155 if (runno >= 700 && runno <= 799) {scale = 1.00190365; return;}
1156 if (runno >= 800 && runno <= 899) {scale = 1.00204192; return;}
1157 if (runno >= 900 && runno <= 999) {scale = 1.00196542; return;}
1158 if (runno >= 1000 && runno <= 1099) {scale = 1.00189706; return;}
1159 if (runno >= 1100 && runno <= 1199) {scale = 1.00187422; return;}
1160 if (runno >= 1200 && runno <= 1299) {scale = 1.00183714; return;}
1161 if (runno >= 1300) {
1162 B2ERROR("scale_momenta not ready for this exp,run "
1163 << expno << "," << runno);
1164 }
1165 } else if (expno == 43) {
1166 if (runno >= 0 && runno <= 99) {scale = 1.00151737; return;}
1167 if (runno >= 100 && runno <= 199) {scale = 1.00110489; return;}
1168 if (runno >= 200 && runno <= 299) {scale = 1.00108144; return;}
1169 if (runno >= 300 && runno <= 399) {scale = 1.00114918; return;}
1170 if (runno >= 400 && runno <= 499) {scale = 1.00122723; return;}
1171 if (runno >= 500 && runno <= 599) {scale = 1.00111069; return;}
1172 if (runno >= 600 && runno <= 699) {scale = 1.00115667; return;}
1173 if (runno >= 700 && runno <= 799) {scale = 1.00113759; return;}
1174 if (runno >= 800 && runno <= 899) {scale = 1.00115609; return;}
1175 if (runno >= 900 && runno <= 999) {scale = 1.00105426; return;}
1176 //tentative for quality check of 5S mdst in 2009 Ang.-Sep.
1177 // if (runno>=1000 && runno <=1034) {scale = 1.00099199; return;}
1178 // if (runno>=1035 && runno <=1099) {scale = 1.00111222; return;}
1179 if (runno >= 1000 && runno <= 1099) {scale = 1.00111210; return;}
1180 if (runno >= 1100 && runno <= 1199) {scale = 1.00123104; return;}
1181 if (runno >= 1200) {
1182 B2ERROR("scale_momenta not ready for this exp,run "
1183 << expno << "," << runno);
1184 }
1185 } else if (expno == 45) {
1186 if (runno >= 0 && runno <= 99) {scale = 1.00136477; return;}
1187 if (runno >= 100 && runno <= 199) {scale = 1.00151600; return;}
1188 if (runno >= 200 && runno <= 299) {scale = 1.00146757; return;}
1189 if (runno >= 300 && runno <= 399) {scale = 1.00153299; return;}
1190 if (runno >= 400 && runno <= 499) {scale = 1.00159018; return;}
1191 if (runno >= 500) {
1192 B2ERROR("scale_momenta not ready for this exp,run "
1193 << expno << "," << runno);
1194 }
1195 } else if (expno == 47) {
1196 if (runno >= 0 && runno <= 99) {scale = 1.00166672; return;}
1197 if (runno >= 100 && runno <= 199) {scale = 1.00165120; return;}
1198 if (runno >= 200 && runno <= 299) {scale = 1.00175597; return;}
1199 if (runno >= 300 && runno <= 399) {scale = 1.00177319; return;}
1200 if (runno >= 400 && runno <= 499) {scale = 1.00179552; return;}
1201 if (runno >= 500 && runno <= 599) {scale = 1.00179413; return;}
1202 if (runno >= 600 && runno <= 699) {scale = 1.00186237; return;}
1203 if (runno >= 700 && runno <= 799) {scale = 1.00183016; return;}
1204 if (runno >= 800 && runno <= 899) {scale = 1.00184324; return;}
1205 if (runno >= 900) {
1206 B2ERROR("scale_momenta not ready for this exp,run "
1207 << expno << "," << runno);
1208 }
1209 } else if (expno == 49) {
1210 if (runno >= 0 && runno <= 99) {scale = 1.00171645; return;}
1211 if (runno >= 100 && runno <= 199) {scale = 1.00177728; return;}
1212 if (runno >= 200 && runno <= 299) {scale = 1.00173301; return;}
1213 if (runno >= 300 && runno <= 399) {scale = 1.00162075; return;}
1214 if (runno >= 400 && runno <= 499) {scale = 1.00163153; return;}
1215 if (runno >= 500 && runno <= 599) {scale = 1.00168559; return;}
1216 if (runno >= 600 && runno <= 699) {scale = 1.00139227; return;}
1217 if (runno >= 700 && runno <= 799) {scale = 1.00148583; return;}
1218 if (runno >= 800 && runno <= 899) {scale = 1.00150403; return;}
1219 if (runno >= 900 && runno <= 999) {scale = 1.00142759; return;}
1220 if (runno >= 1000 && runno <= 1099) {scale = 1.00134573; return;}
1221 if (runno >= 1100 && runno <= 1199) {scale = 1.00138313; return;}
1222 if (runno >= 1200 && runno <= 1299) {scale = 1.00151369; return;}
1223 if (runno >= 1300) {
1224 B2ERROR("scale_momenta not ready for this exp,run "
1225 << expno << "," << runno);
1226 }
1227 } else if (expno == 51) {
1228 if (runno >= 0 && runno <= 99) {scale = 1.00165035; return;}
1229 if (runno >= 100 && runno <= 199) {scale = 1.00161504; return;}
1230 if (runno >= 200 && runno <= 299) {scale = 1.00160162; return;}
1231 if (runno >= 300 && runno <= 399) {scale = 1.00152725; return;}
1232 if (runno >= 400 && runno <= 499) {scale = 1.00149943; return;}
1233 if (runno >= 500 && runno <= 599) {scale = 1.00141294; return;}
1234 if (runno >= 600 && runno <= 699) {scale = 1.00140154; return;}
1235 if (runno >= 700 && runno <= 799) {scale = 1.00140759; return;}
1236 if (runno >= 800 && runno <= 899) {scale = 1.00133671; return;}
1237 if (runno >= 900 && runno <= 999) {scale = 1.00136792; return;}
1238 if (runno >= 1000 && runno <= 1099) {scale = 1.00135251; return;}
1239 if (runno >= 1100 && runno <= 1199) {scale = 1.00138229; return;}
1240 if (runno >= 1200 && runno <= 1299) {scale = 1.00134938; return;}
1241 if (runno >= 1300 && runno <= 1399) {scale = 1.00106240; return;}
1242 if (runno >= 1400 && runno <= 1499) {scale = 1.00132666; return;}
1243 if (runno >= 1500 && runno <= 1599) {scale = 1.00132654; return;}
1244 if (runno >= 1600 && runno <= 1699) {scale = 1.00146619; return;}
1245 if (runno >= 1700 && runno <= 1799) {scale = 1.00131902; return;}
1246 if (runno >= 1800 && runno <= 1899) {scale = 1.00114243; return;}
1247 if (runno >= 1900) {
1248 B2ERROR("scale_momenta not ready for this exp,run "
1249 << expno << "," << runno);
1250 }
1251 } else if (expno == 53) {
1252 if (runno >= 0 && runno <= 99) {scale = 1.00125475; return;}
1253 if (runno >= 100 && runno <= 199) {scale = 1.00124954; return;}
1254 if (runno >= 200 && runno <= 299) {scale = 1.00122914; return;}
1255 if (runno >= 300) {
1256 B2ERROR("scale_momenta not ready for this exp,run "
1257 << expno << "," << runno);
1258 }
1259 } else if (expno == 55) {
1260 if (runno >= 0 && runno <= 99) {scale = 1.00119352; return;}
1261 if (runno >= 100 && runno <= 199) {scale = 1.00117130; return;}
1262 if (runno >= 200 && runno <= 299) {scale = 1.00115825; return;}
1263 if (runno >= 300 && runno <= 399) {scale = 1.00125005; return;}
1264 if (runno >= 400 && runno <= 499) {scale = 1.00124720; return;}
1265 if (runno >= 500 && runno <= 599) {scale = 1.00122234; return;}
1266 if (runno >= 600 && runno <= 699) {scale = 1.00128709; return;}
1267 if (runno >= 700 && runno <= 799) {scale = 1.00123081; return;}
1268 if (runno >= 800 && runno <= 899) {scale = 1.00124198; return;}
1269 if (runno >= 900 && runno <= 999) {scale = 1.00131118; return;}
1270 if (runno >= 1000 && runno <= 1099) {scale = 1.00132496; return;}
1271 if (runno >= 1100 && runno <= 1199) {scale = 1.00126186; return;}
1272 if (runno >= 1200 && runno <= 1299) {scale = 1.00127849; return;}
1273 if (runno >= 1300 && runno <= 1399) {scale = 1.00135312; return;}
1274 if (runno >= 1400 && runno <= 1499) {scale = 1.00136637; return;}
1275 if (runno >= 1500 && runno <= 1599) {scale = 1.00136270; return;}
1276 if (runno >= 1600 && runno <= 1699) {scale = 1.00118422; return;}
1277 if (runno >= 1700 && runno <= 1799) {scale = 1.00142667; return;}
1278 if (runno >= 1800) {
1279 B2ERROR("scale_momenta not ready for this exp,run "
1280 << expno << "," << runno);
1281 }
1282 } else if (expno == 61) {
1283 if (runno >= 0 && runno <= 99) {scale = 1.00103013; return;}
1284 if (runno >= 100 && runno <= 199) {scale = 1.00116185; return;}
1285 if (runno >= 200 && runno <= 299) {scale = 1.00133560; return;}
1286 if (runno >= 300 && runno <= 399) {scale = 1.00145027; return;}
1287 if (runno >= 400 && runno <= 499) {scale = 1.00147949; return;}
1288 if (runno >= 500 && runno <= 599) {scale = 1.00151022; return;}
1289 if (runno >= 600 && runno <= 699) {scale = 1.00150439; return;}
1290 if (runno >= 700 && runno <= 799) {scale = 1.00155006; return;}
1291 if (runno >= 800 && runno <= 899) {scale = 1.00162396; return;}
1292 if (runno >= 900 && runno <= 999) {scale = 1.00168542; return;}
1293 if (runno >= 1000 && runno <= 1099) {scale = 1.00168249; return;}
1294 if (runno >= 1100 && runno <= 1207) {scale = 1.00166891; return;}
1295 if (runno >= 1208 && runno <= 1299) {scale = 1.00249956; return;}
1296 if (runno >= 1300 && runno <= 1399) {scale = 1.00255134; return;}
1297 if (runno >= 1400) {
1298 B2ERROR("scale_momenta not ready for this exp,run "
1299 << expno << "," << runno);
1300 }
1301 } else if (expno == 63) {
1302 if (runno >= 0 && runno <= 99) {scale = 1.00129667; return;}
1303 if (runno >= 100 && runno <= 199) {scale = 1.00123725; return;}
1304 if (runno >= 200 && runno <= 299) {scale = 1.00126795; return;}
1305 if (runno >= 300 && runno <= 399) {scale = 1.00122458; return;}
1306 if (runno >= 400 && runno <= 499) {scale = 1.00116489; return;}
1307 if (runno >= 500 && runno <= 599) {scale = 1.00116968; return;}
1308 if (runno >= 600 && runno <= 699) {scale = 1.000918379; return;}
1309 if (runno >= 700 && runno <= 799) {scale = 1.0010429; return;}
1310 if (runno >= 800) {
1311 B2ERROR("scale_momenta not ready for this exp,run "
1312 << expno << "," << runno);
1313 }
1314 } else if (expno == 65) {
1315 if (runno >= 0 && runno <= 99) {scale = 1.00116975; return;}
1316 if (runno >= 100 && runno <= 199) {scale = 1.00111926; return;}
1317 if (runno >= 200 && runno <= 299) {scale = 1.00110162; return;}
1318 if (runno >= 300 && runno <= 399) {scale = 1.00109524; return;}
1319 if (runno >= 400 && runno <= 499) {scale = 1.00106913; return;}
1320 if (runno >= 500 && runno <= 599) {scale = 1.00110941; return;}
1321 if (runno >= 600 && runno <= 699) {scale = 1.000897865; return;}
1322 if (runno >= 700 && runno <= 999) {scale = 1.00104385; return;}
1323 if (runno >= 1000 && runno <= 1299) {scale = 1.000876489; return;}
1324 if (runno >= 1000) {
1325 B2ERROR("scale_momenta not ready for this exp,run "
1326 << expno << "," << runno);
1327 }
1328 } else if (expno == 67) {
1329 if (runno >= 0 && runno <= 199) {scale = 1.000826364; return;}
1330 if (runno >= 200 && runno <= 299) {scale = 1.000836576; return;}
1331 if (runno >= 300 && runno <= 399) {scale = 1.000904815; return;}
1332 if (runno >= 400 && runno <= 499) {scale = 1.000966045; return;}
1333 if (runno >= 500 && runno <= 599) {scale = 1.000988147; return;}
1334 if (runno >= 600 && runno <= 699) {scale = 1.000988147; return;}
1335 if (runno >= 700 && runno <= 742) {scale = 1.000837414; return;}
1336 if (runno >= 1000 && runno <= 1099) {scale = 1.000984865; return;}
1337 if (runno >= 1100 && runno <= 1123) {scale = 1.00105248 ; return;}
1338 if (runno >= 1124) {
1339 B2ERROR("scale_momenta not ready for this exp,run "
1340 << expno << "," << runno);
1341 }
1342 } else if (expno == 69) {
1343 if (runno >= 0 && runno <= 99) {scale = 1.000791450; return;}
1344 if (runno >= 100 && runno <= 199) {scale = 1.000891748; return;}
1345 if (runno >= 200 && runno <= 299) {scale = 1.000866165; return;}
1346 if (runno >= 300 && runno <= 399) {scale = 1.000838834; return;}
1347 if (runno >= 400 && runno <= 499) {scale = 1.000811878; return;}
1348 if (runno >= 500 && runno <= 599) {scale = 1.000779810; return;}
1349 if (runno >= 600 && runno <= 699) {scale = 1.000799086; return;}
1350 if (runno >= 700 && runno <= 799) {scale = 1.000833797; return;}
1351 if (runno >= 800 && runno <= 899) {scale = 1.000875203; return;}
1352 if (runno >= 900 && runno <= 999) {scale = 1.000891998; return;}
1353 if (runno >= 1000 && runno <= 1099) {scale = 1.000921074; return;}
1354 if (runno >= 1100 && runno <= 1199) {scale = 1.000900829; return;}
1355 if (runno >= 1200 && runno <= 1299) {scale = 1.000958405; return;}
1356 if (runno >= 1300 && runno <= 1399) {scale = 1.000836841; return;}
1357 if (runno >= 1400) {
1358 B2ERROR("scale_momenta not ready for this exp,run "
1359 << expno << "," << runno);
1360 }
1361 } else if (expno == 71) {
1362 if (runno >= 0 && runno <= 99) {scale = 1.000962999; return;}
1363 if (runno >= 100 && runno <= 199) {scale = 1.001478932; return;}
1364 if (runno >= 200 && runno <= 300) {scale = 1.001486524; return;}
1365 if (runno >= 301 && runno <= 384) {scale = 1.001430843; return;}
1366 if (runno >= 385 && runno <= 499) {scale = 1.001505696; return;}
1367 if (runno >= 500 && runno <= 599) {scale = 1.001523980; return;}
1368 if (runno >= 600 && runno <= 699) {scale = 1.001480830; return;}
1369 if (runno >= 1000 && runno <= 1013) {scale = 1.001480830; return;}
1370 if (runno >= 2000 && runno <= 2099) {scale = 1.001617882; return;}
1371 if (runno >= 2100 && runno <= 2199) {scale = 1.001644395; return;}
1372 if (runno >= 2200 && runno <= 2299) {scale = 1.001722184; return;}
1373 if (runno >= 700 && runno <= 999) {
1374 B2ERROR("scale_momenta not ready for this exp,run "
1375 << expno << "," << runno);
1376 }
1377 if (runno >= 1014 && runno <= 1999) {
1378 B2ERROR("scale_momenta not ready for this exp,run "
1379 << expno << "," << runno);
1380 }
1381 if (runno >= 2299) {
1382 B2ERROR("scale_momenta not ready for this exp,run "
1383 << expno << "," << runno);
1384 }
1385 } else if (expno == 73) {
1386 if (runno >= 0 && runno <= 99) {scale = 1.000721587; return;}
1387 if (runno >= 100 && runno <= 199) {scale = 1.000707089; return;}
1388 if (runno >= 200 && runno <= 299) {scale = 1.000722517; return;}
1389 if (runno >= 300 && runno <= 399) {scale = 1.000722517; return;} //nodata
1390 if (runno >= 400 && runno <= 499) {scale = 1.000750776; return;}
1391 if (runno >= 500 && runno <= 599) {scale = 1.000729771; return;}
1392 if (runno >= 600 && runno <= 699) {scale = 1.000751190; return;}
1393 if (runno >= 700 && runno <= 799) {scale = 1.000702455; return;}
1394 if (runno >= 800 && runno <= 899) {scale = 1.000771074; return;}
1395 if (runno >= 900 && runno <= 999) {scale = 1.000868463; return;}
1396 if (runno >= 1000) {
1397 B2ERROR("scale_momenta not ready for this exp,run "
1398 << expno << "," << runno);
1399 }
1400
1401 } else
1402 B2ERROR("scale_momenta mode=2 not ready for exp " << expno);
1403 }
1404 return;
1405 }

◆ set_primary_vertex()

int set_primary_vertex ( HepPoint3D v,
CLHEP::HepSymMatrix &  ve 
)
private

Set primary vertex assuming all tracks are pions.

Definition at line 2928 of file B2BIIFixMdstModule_trk.cc.

2930 {
2931
2932 Belle::Evtvtx_primary_vertex_Manager& evtvtx_mgr
2933 = Belle::Evtvtx_primary_vertex_Manager::get_manager();
2934
2935 Belle::Evtvtx_trk_Manager& evttrk_mgr = Belle::Evtvtx_trk_Manager::get_manager();
2936
2937 Belle::Evtvtx_primary_vertex_Manager::iterator itvtx = evtvtx_mgr.begin();
2938 if (itvtx == evtvtx_mgr.end()) return 4;
2939
2940 if (!(itvtx->quality() == 2 || itvtx->quality() == 3)) return 3;
2941
2942 // TKECK fit primary vertex with our kfitter!
2943
2945 HepPoint3D pvtx(itvtx->PV_x(), itvtx->PV_y(), itvtx->PV_z());
2946
2947 kv.setInitialVertex(pvtx);
2948
2949 unsigned int nchrgd(0);
2950 for (Belle::Evtvtx_trk_Manager::iterator i = evttrk_mgr.begin(); i != evttrk_mgr.end(); ++i) {
2951
2952 const Belle::Mdst_charged& p = i->charged();
2953 if (p.trk().mhyp(2).nhits(3) < 2) continue;
2954 if (p.trk().mhyp(2).nhits(4) < 2) continue;
2955
2956 int hyp = 2;
2957 const HepPoint3D pivot(p.trk().mhyp(hyp).pivot_x(),
2958 p.trk().mhyp(hyp).pivot_y(),
2959 p.trk().mhyp(hyp).pivot_z());
2960 CLHEP::HepVector a(5);
2961 a[0] = p.trk().mhyp(hyp).helix(0);
2962 a[1] = p.trk().mhyp(hyp).helix(1);
2963 a[2] = p.trk().mhyp(hyp).helix(2);
2964 a[3] = p.trk().mhyp(hyp).helix(3);
2965 a[4] = p.trk().mhyp(hyp).helix(4);
2966 CLHEP::HepSymMatrix Ea(5, 0);
2967 Ea[0][0] = p.trk().mhyp(hyp).error(0);
2968 Ea[1][0] = p.trk().mhyp(hyp).error(1);
2969 Ea[1][1] = p.trk().mhyp(hyp).error(2);
2970 Ea[2][0] = p.trk().mhyp(hyp).error(3);
2971 Ea[2][1] = p.trk().mhyp(hyp).error(4);
2972 Ea[2][2] = p.trk().mhyp(hyp).error(5);
2973 Ea[3][0] = p.trk().mhyp(hyp).error(6);
2974 Ea[3][1] = p.trk().mhyp(hyp).error(7);
2975 Ea[3][2] = p.trk().mhyp(hyp).error(8);
2976 Ea[3][3] = p.trk().mhyp(hyp).error(9);
2977 Ea[4][0] = p.trk().mhyp(hyp).error(10);
2978 Ea[4][1] = p.trk().mhyp(hyp).error(11);
2979 Ea[4][2] = p.trk().mhyp(hyp).error(12);
2980 Ea[4][3] = p.trk().mhyp(hyp).error(13);
2981 Ea[4][4] = p.trk().mhyp(hyp).error(14);
2982 Belle::Helix helix(pivot, a, Ea);
2983
2984 CLHEP::HepLorentzVector mom;
2985 CLHEP::HepSymMatrix err(7, 0);
2986 HepPoint3D pos(0, 0, 0);
2987 if (pivot.x() != 0. ||
2988 pivot.y() != 0. ||
2989 pivot.z() != 0.) {
2990 helix.pivot(HepPoint3D(0., 0., 0.));
2991 mom = helix.momentum(0., 0.13957f, pos, err);
2992 } else {
2993 mom = helix.momentum(0., 0.13957f, pos, err);
2994 }
2995
2996 kv.addTrack(mom, pos, err, p.charge());
2997 ++nchrgd;
2998 }
2999
3000 if (Belle::IpProfile::usable()) {
3001 // event depend. IP position and error matrix
3002 HepPoint3D ip_position = Belle::IpProfile::e_position();
3003 CLHEP::HepSymMatrix ip_err = Belle::IpProfile::e_position_err();
3004 kv.setIpProfile(ip_position, ip_err);
3005 }
3006 // Fit
3007 unsigned int err(1);
3008 if (nchrgd > 2 || (nchrgd > 0 && Belle::IpProfile::usable())) err = kv.doFit();
3009 if (err == 0) {
3010 epvtx = kv.getVertex();
3011 epvtx_err = kv.getVertexError();
3012 }
3013 return err;
3014
3015 /*
3016 kvertexfitter kv;
3017
3018 HepPoint3D pvtx(itvtx->PV_x(), itvtx->PV_y(), itvtx->PV_z());
3019
3020 kv.initialVertex(pvtx);
3021
3022 Ptype ptype_pi_plus("PI+");
3023 Ptype ptype_pi_minus("PI-");
3024
3025 unsigned int nchrgd(0);
3026 for(Belle::Evtvtx_trk_Manager::iterator i = evttrk_mgr.begin();
3027 i != evttrk_mgr.end(); ++i){
3028 // if(!good_charged(i->charged())) continue;
3029
3030 if(i->charged().trk().mhyp(2).nhits(3) < 2) continue;
3031 if(i->charged().trk().mhyp(2).nhits(4) < 2) continue;
3032
3033 Particle tmp(i->charged(),
3034 (i->charged().charge()>0.0 ? ptype_pi_plus : ptype_pi_minus));
3035 addTrack2fit(kv, tmp);
3036 ++nchrgd;
3037 }
3038
3039 if(Belle::IpProfile::usable()){
3040
3041 // event depend. IP position and error matrix
3042 HepPoint3D ip_position = Belle::IpProfile::e_position();
3043 HepSymMatrix ip_err = Belle::IpProfile::e_position_err();
3044 // HepSymMatrix m_ip_err_b = Belle::IpProfile::e_position_err_b_life_smeared();
3045
3046 // Add IP profile information
3047 addBeam2fit(kv, ip_position, ip_err);
3048 }
3049 // Fit
3050 unsigned int err(1);
3051 if(nchrgd>2||(nchrgd>0&&Belle::IpProfile::usable())) err = kv.fit();
3052 if(err==0) {
3053 epvtx = kv.get_vertex();
3054 epvtx_err = kv.get_err_vertex();
3055 }
3056 return err;
3057 */
3058 }
enum KFitError::ECode addTrack(const KFitTrack &kp)
Add a track to the fitter object.
Definition: KFitBase.cc:38
VertexFitKFit is a derived class from KFitBase to perform vertex-constraint kinematical fit.
Definition: VertexFitKFit.h:34
enum KFitError::ECode setInitialVertex(const HepPoint3D &v)
Set an initial vertex point for the vertex-vertex constraint fit.
const CLHEP::HepSymMatrix getVertexError(void) const
Get a fitted vertex error matrix.
enum KFitError::ECode doFit(void)
Perform a vertex-constraint fit.
enum KFitError::ECode setIpProfile(const HepPoint3D &ip, const CLHEP::HepSymMatrix &ipe)
Set an IP-ellipsoid shape for the vertex constraint fit.
const HepPoint3D getVertex(const int flag=KFitConst::kAfterFit) const
Get a vertex position.

◆ shift_tof()

void shift_tof ( const int  mode)
private

Shift tof times to account for residuals.

Based on scale_momenta code

Definition at line 59 of file B2BIIFixMdstModule_tof.cc.

60 {
61//===============================================================
62// Shifts tof times to account for residuals.
63// Based on scale_momenta code
64//======================================================
65//Check existence of belle_event
66
67 Belle::Belle_event_Manager& evtmgr = Belle::Belle_event_Manager::get_manager();
68 if (evtmgr.count() == 0) return; //do nothing if no Belle::Belle_Event
69
70 Belle::Mdst_event_add_Manager& addmgr = Belle::Mdst_event_add_Manager::get_manager();
71 if (addmgr.count() == 0) return; //do nothing if no Belle::Mdst_Event_Add
72 if (addmgr[0].flag(4) != 0) return; //do nothing if already shifted
73
74//check mode
75 if (mode < 0 || mode > 2) {
76 B2ERROR("shift_tof: invalid mode specified;");
77 B2ERROR("mode must be 0, 1, 2");
78 return;
79 }
80
81 int expmc = evtmgr[0].ExpMC();
82 int expno = evtmgr[0].ExpNo();
83 int runno = evtmgr[0].RunNo();
84
85 if (expmc == 2) return; //for now, apply no shift to MC
86
87 addmgr[0].flag(4, 1); //set flag
88
89 // Loop over all charged tracks
90
91 Belle::Mdst_charged_Manager& ChgMgr = Belle::Mdst_charged_Manager::get_manager();
92 for (std::vector<Belle::Mdst_charged>::iterator it = ChgMgr.begin();
93 it != ChgMgr.end(); ++it) {
94 Belle::Mdst_charged& Chg = *it;
95 if (Chg) {
96 // Get mdst_tof table for the track
97 Belle::Mdst_tof& Tof = Chg.tof();
98 if (Tof) {
99 // Get momentum and charge of track
100 TVector3 Mom(Chg.px(), Chg.py(), Chg.pz());
101 double pmom = Mom.Mag();
102 double sgn = Chg.charge();
103 // Loop over mass hypotheses
104 for (int im = 0; im < 5; im++) {
105 double shift = 0.;
106 shift_tof_set(expno, runno, mode, im, pmom, sgn, shift);
107 if (fabs(shift) < .005) continue;
108 double ot = Tof.tof_exp(im); //old t (expected)
109 double odt = ot - Tof.tof(); //old dt
110 double opid = Tof.pid(im); //old pid
111// double ocl=Tof.cl(im); //old cl
112 int ndf = (int)(Tof.ndf(im) + .001); //ndf
113 if (opid > 0. && opid < 1.) {
114 double ct = ot + shift; //corr t
115 double cdt = ct - Tof.tof(); //corr dt
116 double err = fabs(odt) / sqrt(-2.*log(opid)); //est error
117 double cch = pow(cdt / err, 2); //corr chisq
118 double cpid = exp(-.5 * cch); //corr pid
119 double ccl = TMath::Prob(cch, ndf); //corr cl
120 Tof.tof_exp(im, ct);
121 Tof.pid(im, cpid);
122 Tof.cl(im, ccl);
123 }
124 }
125 }
126 }
127 }
128 }
void shift_tof_set(const int expno, const int runno, const int mode, const int im, const double pmom, const double sgn, double &shift)
Return time shifts for different exp.

◆ shift_tof_set()

void shift_tof_set ( const int  expno,
const int  runno,
const int  mode,
const int  im,
const double  pmom,
const double  sgn,
double &  shift 
)
private

Return time shifts for different exp.

Definition at line 129 of file B2BIIFixMdstModule_tof.cc.

133 {
134 static const double m[5] = {.000511, .10566, .13957, .49368, .93827};
135 shift = 0.;
136 double beta = pmom / sqrt(pmom * pmom + m[im] * m[im]);
137 switch (expno) {
138 case 7:
139 if (mode == 1) {
140 switch (im) {
141 case 2:
142 if (runno < 536) shift = 0.;
143 else if (runno < 1440) shift = .5054 - .5216 * std::min(beta, .955);
144 else shift = .8321 - .8648 * std::min(beta, .96);
145 break;
146 case 3:
147 if (runno < 536) shift = -.0414 * exp(-pow(beta - .538, 2) / .0569);
148 else if (runno < 1440) shift = -12.3 * exp(-pow(beta + .288, 2) / .1197);
149 else shift = 0.;
150 break;
151 case 4:
152 if (sgn > 0.) {
153 shift = -.876 * exp(-pow(beta + .1818, 2) / .1947);
154 } else {
155 if (runno < 1440)
156 shift = .01 - .1028 * exp(-pow(beta - .4454, 2) / .00272);
157 else shift = .01 - .064 * exp(-pow(beta - .4273, 2) / .00317);
158 }
159 break;
160 default:
161 break;
162 } // end switch(im)
163 } // end if(mode)
164 break;
165 case 9:
166 case 11:
167 case 13:
168 if (mode == 1) {
169 switch (im) {
170 case 2:
171 shift = 1.089 - 1.131 * std::min(beta, .955);
172 break;
173 case 4:
174 if (sgn > 0.) shift = -.876 * exp(-pow(beta + .1818, 2) / .1947);
175 else shift = .01 - .1028 * exp(-pow(beta - .4454, 2) / .00272);
176 break;
177 default:
178 break;
179 } // end switch(im)
180 } // end if(mode)
181 break;
182 case 15:
183 if (mode == 1) {
184 switch (im) {
185 case 2:
186// if(sgn>0.) shift=-4.73+9.853*beta-5.139*beta*beta;
187// The following stmt replaced the one above on 6/7/02 to remove the
188// -16 ps value at beta=1. MWP
189 if (sgn > 0.) shift = -.0183 * exp(-pow(beta - .911, 2) / .00161);
190 break;
191 case 3:
192 shift = -6.6 * exp(-beta / .1);
193 break;
194 case 4:
195 if (sgn > 0.) shift = -.736 * exp(-pow(beta + .04158, 2) / .119);
196 else shift = .02 - .1475 * exp(-pow(beta - .4267, 2) / .00249);
197 break;
198 default:
199 break;
200 } // end switch(im)
201 } // end if(mode)
202 break;
203 case 17:
204 case 19: //same corrections for Exps 17 and 19
205 if (mode == 1) {
206 switch (im) {
207 case 4:
208 if (sgn > 0.) shift = -.3259 * exp(-pow(beta - .1042, 2) / .0817);
209 else shift = .02 - .1475 * exp(-pow(beta - .4267, 2) / .00249);
210 break;
211 default:
212 break;
213 } // end switch(im)
214 } // end if(mode)
215 default:
216 break;
217 } // end switch(expno)
218 }

◆ smear_charged()

void smear_charged ( )
static

Smear tracks in Mdst_Charged.

Definition at line 3479 of file B2BIIFixMdstModule_trk.cc.

3480 {
3481//====================
3482 Belle::Mdst_charged_Manager& chgmgr = Belle::Mdst_charged_Manager::get_manager();
3483 for (std::vector<Belle::Mdst_charged>::iterator it = chgmgr.begin(); it != chgmgr.end(); ++it) {
3484 Belle::Mdst_charged& c = *it;
3485 Belle::Mdst_trk_fit& t = c.trk().mhyp(2);
3486
3487 double kp = std::abs(t.helix(2));
3488 kp = std::max(kp, 1.e-10);
3489 kp = std::min(kp, 1.e10);
3490 c.px(-sin(t.helix(1)) / kp);
3491 c.py(cos(t.helix(1)) / kp);
3492 c.pz(t.helix(4) / kp);
3493 }
3494
3495 }

◆ smear_trk()

void smear_trk ( )
private

Apply track smearing (on MC)

Definition at line 3346 of file B2BIIFixMdstModule_trk.cc.

3347 {
3348//==========================
3349 int expNo = 0, runNo = 0, expmc = 1;
3350 Belle::Belle_event_Manager& evtMgr = Belle::Belle_event_Manager::get_manager();
3351 if (evtMgr.count()) {
3352 expNo = evtMgr[0].ExpNo();
3353 runNo = evtMgr[0].RunNo();
3354 expmc = evtMgr[0].ExpMC();
3355 }
3356 if (expmc == 1) return; // nothing done for real data
3357
3358 Belle::Mdst_event_add_Manager& addmgr = Belle::Mdst_event_add_Manager::get_manager();
3359 if (addmgr.count() == 0) {
3360 B2ERROR("No Belle::Mdst_event_add table -> kill the job");
3361 exit(-1);
3362 } else if (addmgr.count() >= 2) {
3363 if (addmgr[1].flag(1) != 0) return; //do nothing if already smeared
3364 }
3365
3366 int flag_err = addmgr[0].flag_error();
3367
3368 static bool start = true;
3369 if (start) {
3370 start = false;
3371 B2INFO("smear_trk: MC events -> track smearing is ON\n");
3372 }
3373
3374 double scale_mc[5] = {1, 1, 1, 1, 1};
3375 double scale_rd[5] = {1, 1, 1, 1, 1};
3376 double scale[5];
3377
3378 Belle::Mdst_trk_fit_Manager& fitmgr = Belle::Mdst_trk_fit_Manager::get_manager();
3379 for (std::vector<Belle::Mdst_trk_fit>::iterator it = fitmgr.begin(); it != fitmgr.end(); ++it) {
3380 Belle::Mdst_trk_fit& fit = *it;
3381 if (fit.helix(2) == 0.) continue;
3382
3383 double pt = 1. / fabs(fit.helix(2));
3384 double tanl = fit.helix(4);
3385
3386 cal_scale_error(scale_mc, pt, tanl, 0, expNo, runNo);
3387 cal_scale_error(scale_rd, pt, tanl, 1, expNo, runNo);
3388 for (int i = 0; i < 5; i++) scale[i] = scale_rd[i] / scale_mc[i];
3389
3390 if (flag_err == 0) scale_err_ms(fit, scale_mc);
3391 smear_trk_ms(fit, scale);
3392 scale_err_ms(fit, scale);
3393 }
3394
3395 if (m_smear_trk == 2) smear_charged();
3396
3397 //set flag indicating already-err-scaled
3398 addmgr[0].flag_error(1);
3399
3400 //set flag indicating already-smeared
3401 if (addmgr.count() == 1) {
3402 Belle::Mdst_event_add& meadd = addmgr.add();
3403 meadd.flag(1, 1);
3404 } else if (addmgr.count() >= 2) {
3405 addmgr[1].flag(1, 1);
3406 }
3407
3408 }
static void smear_trk_ms(Belle::Mdst_trk_fit &fit, const double scale[])
Smear MC tracks.
static void smear_charged()
Smear tracks in Mdst_Charged.
static void scale_err_ms(Belle::Mdst_trk_fit &fit, const double scale[])
Scale error.

◆ smear_trk_ms()

void smear_trk_ms ( Belle::Mdst_trk_fit &  fit,
const double  scale[] 
)
static

Smear MC tracks.

Definition at line 3433 of file B2BIIFixMdstModule_trk.cc.

3434 {
3435//====================================================
3436 const int n = 5;
3437 double a[n][n];
3438 int k = 0;
3439 for (int i = 0; i < n; i++) {
3440 for (int j = 0; j <= i; j++) {
3441 a[i][j] = fit.error(k) * (scale[i] * scale[j] - 1.0);
3442 if (i != j) a[j][i] = a[i][j];
3443 k++;
3444 }
3445 }
3446
3447 double u[n][n];
3448 //int pozdef = 1;
3449 for (int j = 0; j < n; j++) {
3450 double s = a[j][j];
3451 for (int k2 = 0; k2 < j; k2++) s -= u[j][k2] * u[j][k2];
3452 if (s > 0) {
3453 u[j][j] = sqrt(s);
3454 for (int i = j + 1; i < n; i++) {
3455 s = a[i][j];
3456 for (int k3 = 0; k3 < j; k3++) s -= u[i][k3] * u[j][k3];
3457 u[i][j] = s / u[j][j];
3458 }
3459 } else {
3460 for (int i = j; i < n; i++) u[i][j] = 0;
3461 //pozdef = 0;
3462 }
3463 }
3464
3465 double g[n];
3466 for (int i = 0; i < n; i++) g[i] = gRandom->Gaus();
3467 double x[n];
3468 for (int i = 0; i < n; i++) {
3469 x[i] = 0;
3470 if (u[i][i] > 0) {
3471 for (int j = 0; j <= i; j++) x[i] += u[i][j] * g[j];
3472 }
3473 }
3474 for (int i = 0; i < n; i++) fit.helix(i, fit.helix(i) + x[i]);
3475
3476 }

◆ terminate()

void terminate ( void  )
overridevirtual

Terminates the module.

Reimplemented from Module.

Definition at line 230 of file B2BIIFixMdstModule.cc.

231 {
232 Muid_term();
233 }
void Muid_term(void)
Terminate the Muid module.

◆ vee_mass_nofit()

double vee_mass_nofit ( const Belle::Mdst_vee2 &  vee2,
float  scale = 1.0 
)
private

Calculates V0 mass with non-constraint fit results.

Definition at line 189 of file B2BIIFixMdstModule_trk.cc.

190 {
191//==========================================================
192// Calculates V^0 mass with non-constraint fit results.
193//==========================================================
194
195 HepPoint3D vtx(vee2.vx(), vee2.vy(), vee2.vz());
196
197 const double pion_mass = 0.13956995;
198 const double proton_mass = 0.93827231;
199 const double electron_mass = 0.000511;
200
201 double massp(0.0), massm(0.0);
202 if (1 == vee2.kind()) {
203 massp = pion_mass;
204 massm = pion_mass;
205 } else if (2 == vee2.kind()) {
206 massp = proton_mass;
207 massm = pion_mass;
208 } else if (3 == vee2.kind()) {
209 massp = pion_mass;
210 massm = proton_mass;
211 } else if (4 == vee2.kind()) {
212 massp = electron_mass;
213 massm = electron_mass;
214 }
215
216//Calculate mass
217//in case where decay vtx is outside of beam pipe
218 // if(BsCouTab(MDST_VEE_DAUGHTERS)) {
219 if (vee2.daut()) {
220
221 Belle::Mdst_vee_daughters& vdau = vee2.daut();
222
223 CLHEP::HepVector a(5);
224 a[0] = vdau.helix_p(0); a[1] = vdau.helix_p(1);
225 a[2] = vdau.helix_p(2) / scale;
226 a[3] = vdau.helix_p(3); a[4] = vdau.helix_p(4);
227 Belle::Helix helixp(vtx, a);
228
229 a[0] = vdau.helix_m(0); a[1] = vdau.helix_m(1);
230 a[2] = vdau.helix_m(2) / scale;
231 a[3] = vdau.helix_m(3); a[4] = vdau.helix_m(4);
232 Belle::Helix helixm(vtx, a);
233 // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << "outside bp" << std::endl;
234 CLHEP::HepLorentzVector v0 = helixp.momentum(0., massp) + helixm.momentum(0., massm);
235 return v0.mag();
236
237//in case where decay vtx is inside of beam pipe
238 } else {
239
240 Belle::Mdst_charged& chargedp = vee2.chgd(0);
241 Belle::Mdst_trk& trkp = chargedp.trk();
242 Belle::Mdst_trk_fit& trkfp = trkp.mhyp(2);
243 HepPoint3D pvtp(trkfp.pivot_x(), trkfp.pivot_y(), trkfp.pivot_z());
244 CLHEP::HepVector a(5);
245 a[0] = trkfp.helix(0); a[1] = trkfp.helix(1);
246 a[2] = trkfp.helix(2);
247 a[3] = trkfp.helix(3); a[4] = trkfp.helix(4);
248 Belle::Helix helixp(pvtp, a);
249 helixp.bFieldZ(14.6);
250 helixp.pivot(vtx);
251 a = helixp.a();
252 a[2] = a[2] / scale;
253 helixp.a(a);
254
255 Belle::Mdst_charged& chargedm = vee2.chgd(1);
256 Belle::Mdst_trk& trkm = chargedm.trk();
257 Belle::Mdst_trk_fit& trkfm = trkm.mhyp(2);
258 HepPoint3D pvtm(trkfm.pivot_x(), trkfm.pivot_y(), trkfm.pivot_z());
259 a[0] = trkfm.helix(0); a[1] = trkfm.helix(1);
260 a[2] = trkfm.helix(2);
261 a[3] = trkfm.helix(3); a[4] = trkfm.helix(4);
262 Belle::Helix helixm(pvtm, a);
263 helixm.bFieldZ(14.6);
264 helixm.pivot(vtx);
265 a = helixm.a();
266 a[2] = a[2] / scale;
267 helixm.a(a);
268 // dout(Debugout::DDEBUG,"B2BIIFixMdst_trk") << "inside bp" << std::endl;
269 CLHEP::HepLorentzVector v0 = helixp.momentum(0., massp) + helixm.momentum(0., massm);
270 return v0.mag();
271
272 }
273
274 }

◆ vfunc()

double vfunc ( const double  x,
const double  x1,
const double  yc,
const double  a1,
const double  a2 
)
inline

vfunc

Definition at line 1519 of file B2BIIFixMdstModule_trk.cc.

1520 {
1521 return x < x1 ? (x - x1) * a1 + yc :
1522 (x - x1) * a2 + yc ;
1523 }

Variable Documentation

◆ DUMMY_scale

const struct cal_scale_error_func_set_t DUMMY_scale
static
Initial value:
= {
}
static void null_scale(double[5], double, double)
Dummy function.

Dummy scale.

Definition at line 2615 of file B2BIIFixMdstModule_trk.cc.

◆ EXP0723_scale

const struct cal_scale_error_func_set_t EXP0723_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP0723_cosmic_data(double scale[5], const double pt, const double)
Scale error for Exp.7-23 Cosmic data.
static void cal_scale_error_EXP0723_cosmic_mc(double scale[5], const double pt, const double)
Scale error for Exp.7-23 Cosmic 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.

Scale error for Exp.7-23.

Definition at line 2513 of file B2BIIFixMdstModule_trk.cc.

◆ EXP2527_scale

const struct cal_scale_error_func_set_t EXP2527_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP2527_cosmic_data(double scale[5], const double pt, const double)
Scale error for Exp.25-27 Cosmic data.
static void cal_scale_error_EXP2527_cosmic_mc(double scale[5], const double pt, const double)
Scale error for Exp.25-27 Cosmic 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.

Scale error for Exp.25-27.

Definition at line 2519 of file B2BIIFixMdstModule_trk.cc.

◆ EXP31_scale

const struct cal_scale_error_func_set_t EXP31_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP31_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.31 Cosmic MC.
static void cal_scale_error_EXP31_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.31 Cosmic data.
static void cal_scale_error_EXP31_hadronic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.31 Hadron MC.

Scale error for Exp.31.

Definition at line 2525 of file B2BIIFixMdstModule_trk.cc.

◆ EXP33_scale

const struct cal_scale_error_func_set_t EXP33_scale
static

◆ EXP35_scale

const struct cal_scale_error_func_set_t EXP35_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP35_hadronic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.33,35 Hadron MC.
static void cal_scale_error_EXP35_cosmic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.35 Cosmic MC.
static void cal_scale_error_EXP35_cosmic_data(double scale[5], double pt, double tanl)
Scale error for Exp.35 Cosmic data.

Scale error for Exp.35.

Definition at line 2537 of file B2BIIFixMdstModule_trk.cc.

◆ EXP37_scale

const struct cal_scale_error_func_set_t EXP37_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP37_hadronic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.37 Hadron MC.
static void cal_scale_error_EXP37_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.37 Cosmic data.
static void cal_scale_error_EXP37_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.37 Cosmic MC.

Scale error for Exp.37.

Definition at line 2543 of file B2BIIFixMdstModule_trk.cc.

◆ EXP3941_scale

const struct cal_scale_error_func_set_t EXP3941_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP3941_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.39,41 Cosmic MC.
static void cal_scale_error_EXP3941_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.39,41 Hadron MC.
static void cal_scale_error_EXP3941_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.39-41 Cosmic data.

Scale error for Exp.39,41.

Definition at line 2549 of file B2BIIFixMdstModule_trk.cc.

◆ EXP43_scale

const struct cal_scale_error_func_set_t EXP43_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP43_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.43 Cosmic MC.
static void cal_scale_error_EXP43_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.43 Hadron MC.
static void cal_scale_error_EXP43_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.43 Cosmic data.

Scale error for Exp.43.

Definition at line 2555 of file B2BIIFixMdstModule_trk.cc.

◆ EXP45_scale

const struct cal_scale_error_func_set_t EXP45_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP4547_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.45,47 Cosmic data.
static void cal_scale_error_EXP45_hadronic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.45 Hadron MC.
static void cal_scale_error_EXP45_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.45 Cosmic MC.

Scale error for Exp.45.

Definition at line 2561 of file B2BIIFixMdstModule_trk.cc.

◆ EXP47_scale

const struct cal_scale_error_func_set_t EXP47_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP47_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.47 Hadron MC.
static void cal_scale_error_EXP47_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.47 Cosmic MC.

Scale error for Exp.47.

Definition at line 2567 of file B2BIIFixMdstModule_trk.cc.

◆ EXP49_scale

const struct cal_scale_error_func_set_t EXP49_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP49_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.49 Cosmic data.
static void cal_scale_error_EXP49_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.49 Cosmic MC.
static void cal_scale_error_EXP49_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.49 Hadron MC.

Scale error for Exp.49.

Definition at line 2573 of file B2BIIFixMdstModule_trk.cc.

◆ EXP51_scale

const struct cal_scale_error_func_set_t EXP51_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP51_hadronic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.51 Hadron MC.
static void cal_scale_error_EXP51_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.51 Cosmic MC.
static void cal_scale_error_EXP51_cosmic_data(double scale[5], double pt, double tanl)
Scale error for Exp.51 Cosmic data.

Scale error for Exp.51.

Definition at line 2579 of file B2BIIFixMdstModule_trk.cc.

◆ EXP53_scale

const struct cal_scale_error_func_set_t EXP53_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP53_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.53 Cosmic MC.
static void cal_scale_error_EXP53_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.53 Hadron MC.
static void cal_scale_error_EXP53_cosmic_data(double scale[5], double pt, double)
Scale error for Exp.53 Cosmic data.

Scale error for Exp.53.

Definition at line 2585 of file B2BIIFixMdstModule_trk.cc.

◆ EXP55_scale

const struct cal_scale_error_func_set_t EXP55_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP55_cosmic_mc(double scale[5], double pt, double)
Scale error for Exp.55 Cosmic MC.
static void cal_scale_error_EXP55_cosmic_data(double scale[5], double pt, double tanl)
Scale error for Exp.55 Cosmic data.
static void cal_scale_error_EXP55_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.55 Hadron MC.

Scale error for Exp.55.

Definition at line 2591 of file B2BIIFixMdstModule_trk.cc.

◆ EXP6165_scale

const struct cal_scale_error_func_set_t EXP6165_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP6165_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.61-65 Hadron MC.
static void cal_scale_error_EXP6165_cosmic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.61-65 Cosmic MC.
static void cal_scale_error_EXP6165_cosmic_data(double scale[5], double pt, double tanl)
Scale error for Exp.61-65 Cosmic data.

Scale error for Exp.61-65.

Definition at line 2597 of file B2BIIFixMdstModule_trk.cc.

◆ EXP67_scale

const struct cal_scale_error_func_set_t EXP67_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP67_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.67 Hadron MC.
static void cal_scale_error_EXP67_cosmic_data(double scale[5], double pt, double tanl)
Scale error for Exp.67 Cosmic data.
static void cal_scale_error_EXP67_cosmic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.67 Cosmic MC.

Scale error for Exp.67.

Definition at line 2603 of file B2BIIFixMdstModule_trk.cc.

◆ EXP6971_scale

const struct cal_scale_error_func_set_t EXP6971_scale
static
Initial value:
= {
}
static void cal_scale_error_EXP6971_hadronic_mc(double scale[5], double pt, double)
Scale error for Exp.69,71 Hadron MC.
static void cal_scale_error_EXP6971_cosmic_mc(double scale[5], double pt, double tanl)
Scale error for Exp.69-71 Cosmic MC.
static void cal_scale_error_EXP6971_cosmic_data(double scale[5], double pt, double tanl)
Scale error for Exp.69,71 Cosmic data.

Scale error for Exp.69-71.

Definition at line 2609 of file B2BIIFixMdstModule_trk.cc.

◆ s_benergy_value

double s_benergy_value = NOMINAL_ENERGY
static

Beam energy.

Definition at line 168 of file B2BIIFixMdstModule.h.

◆ SE_Message_Level

int SE_Message_Level
static

Message level of scale_error().

0: none, 1: warning, 2: info

Definition at line 1434 of file B2BIIFixMdstModule_trk.cc.

◆ SE_Reprocess_Version

int SE_Reprocess_Version = 0
static

Reprocess verison used in scale_error()

Definition at line 1435 of file B2BIIFixMdstModule_trk.cc.