#ifndef GflashNameSpace_H
#define GflashNameSpace_H

#include "SimGeneral/GFlash/interface/Gflash3Vector.h"

namespace Gflash {

  // unit convention: energy in GeV, length in cm, time in nanosecond

  enum CalorimeterNumber {
    kNULL = -1,  // ECAL Barrel - ESPM
    kESPM,       // ECAL Barrel - ESPM
    kHB,         // HCAL Barrel - HB
    kENCA,       // ECAL Endcap - ENCA
    kHE,         // HCAL Endcap - HE
    kHO,         // HCAL Outer  - HO
    kHF,         // HCAL Forward - HF
    kNumberCalorimeter
  };

  CalorimeterNumber getCalorimeterNumber(const Gflash3Vector &position);
  double rhoBackEB(const Gflash3Vector &position);
  double zBackEE(const Gflash3Vector &position);
  int findShowerType(const Gflash3Vector &position);

  //                                            EB     HB     EE     HE      HO,
  //                                            HF
  const double Zmin[kNumberCalorimeter] = {0.000, 0.000, 317.2, 391.95, 0.000, 1110.0};  // in cm
  const double Zmax[kNumberCalorimeter] = {317.0, 433.2, 399.1, 554.10, 661.0, 1275.0};
  const double Rmin[kNumberCalorimeter] = {123.8, 177.5, 31.6, 31.6, 382.0, 12.5};
  const double Rmax[kNumberCalorimeter] = {177.5, 287.7, 171.1, 263.9, 407.0, 140.0};

  const double EtaMin[kNumberCalorimeter] = {0.000, 0.000, 1.479, 1.479, 0.000, 3.000};
  const double EtaMax[kNumberCalorimeter] = {1.479, 1.479, 3.000, 3.000, 1.262, 5.000};

  const double RFrontCrystalEB = 129.0;  // rho in cm
  const double ZFrontCrystalEE = 320.9;  // z in cm
  const double ROffCrystalEB = 5.2;      // rho in cm
  const double ZOffCrystalEE = 3.7;      // z in cm
  const double LengthCrystalEB = 23.0;
  const double LengthCrystalEE = 22.0;

  // constants needed for GflashHadronShowerModel
  const double energyCutOff = 1.0;

  // cut value for quasi-elastic like interactions on the secondary energy,
  // ratio = (Leading Energy of Secondaries)/(Total Energy)
  const double QuasiElasticLike = 0.95;

  // minimum distance to the back of parameterized envelopes in [cm]
  const double MinDistanceToOut = 10.0;

  // constants needed for GflashHadronShowerProfile

  const double criticalEnergy = 0.0086155;
  const double rMoliere[kNumberCalorimeter] = {2.19, 2.19, 2.19, 2.19, 2.19, 1.72};       // in cm
  const double radLength[kNumberCalorimeter] = {0.89, 1.49, 0.89, 1.49, 1.49, 1.76};      // in cm
  const double intLength[kNumberCalorimeter] = {22.4, 16.42, 22.4, 16.42, 16.42, 16.77};  // in cm
  const double Z[kNumberCalorimeter] = {68.36, 68.36, 68.36, 68.36, 68.36, 55.845};       // mass of molicule

  // The step size of showino along the helix trajectory in cm unit
  const double divisionStep = 1.0;

  // maximum shower depth for the hadronic lateral in interaction length unit
  const double maxShowerDepthforR50 = 6.0;

  // maximum size of the lateral arm for hadronic showers = 12 * interaction
  // length
  const double maxLateralArmforR50 = 197.0;

  // minimum particle energy to trigger HO parameterization in [GeV]
  const double MinEnergyCutOffForHO = 2.5;

  // additional energy scale for the Hcal sensitive detector
  const double scaleSensitiveHB = 0.180;
  //  const double scaleSensitiveHE = 0.220;
  const double scaleSensitiveHE = 0.180;

  // properties for different sub-detectors (calorimeters)

  const double SAMHAD[3][kNumberCalorimeter] = {
      {0.0, 0.89, 0.0, 0.89, 0.89, 0.0}, {0.0, 0.00, 0.0, 0.00, 0.00, 0.0}, {0.0, 0.00, 0.0, 0.00, 0.00, 0.0}};
  const double RLTHAD[kNumberCalorimeter] = {32.7, 23.7, 32.7, 23.7, 23.7, 23.7};

  // parameters for logitudinal/lateral parameterizations and energy responses

  const int NPar = 5;
  const int Nrpar = 4;

  // Pion(-/+) parameters

  const double pion_emscale[2][5] = {{8.4338e-01, 1.8663e-01, -1.1906e+00, 6.8340e-01, -3.1237e-02},
                                     {1.8918e-01, 2.2620e-02, 4.2555e+00, 1.8317e+00, -6.1358e-03}};

  const double pion_hadscale[8][5] = {
      // based on LogNormal of Had Energy - RegionI
      {-4.4752e+00, 3.8163e+00, 2.7962e-01, -7.6887e-01, 9.6721e-01},
      {1.1228e+00, 6.5039e-01, 4.5585e+00, -8.0282e+00, -1.7630e-01},
      {2.8223e+00, 5.9029e+00, -1.5873e-01, -8.7078e-01, 3.8598e-01},
      {-8.2726e-01, 1.0359e-01, 2.2052e+01, 2.9719e+00, 6.4103e-02},
      // LogNormal of Had Energy for mip-like response
      {-8.1787e-02, 8.3243e+00, 3.7488e-03, 3.2653e+00, 9.5662e-01},
      {1.0567e-01, -2.0485e-01, 2.3345e-01, 4.5563e-01, 2.3694e-02},
      // correction of response if ssp is between Ecal and Hcal
      {1.8736e-01, 1.7391e-01, 1.0991e+00, 3.3557e+00, 0.0000e+00},
      {5.3155e-02, 9.3601e-02, 8.8143e-01, 2.3251e+00, -2.1999e-02}};

  const double pion_correl_hadem[5] = {-7.3137e-01, 1.2367e-01, -8.5607e-01, 1.0989e+00, -1.2858e-02};

  // pion longitudinal parameters

  const double pion_par[8 * NPar][5] = {
      {4.4600e-01, 9.8040e-02, 1.4319e+00, 2.3920e+00, 5.8971e-02},  // Mean Ecal ShowerType1
      {3.2392e+00, 5.4986e+00, 1.5979e-01, 3.2165e+00, -6.7426e-01},
      {-2.7502e-01, -2.2450e+00, -2.0636e-01, 2.7225e+00, -3.2656e-01},
      {5.3763e-01, 3.1128e-01, 1.5000e+00, 2.7038e+00, 9.7550e-02},
      {5.8269e+00, 5.9630e+00, 2.3568e-01, 3.2485e+00, -1.2201e+00},

      {1.6324e+00, 1.1370e+00, 3.0111e-01, 4.4501e+00, -2.5984e-01},  // Mean Hcal ShowerType1
      {1.2732e+00, -3.8571e-01, 1.2127e+00, 9.7707e-01, -1.4888e-02},
      {-4.0078e-01, -1.0428e+00, 6.6820e-01, 2.3706e-01, -1.3898e-01},
      {1.9612e+00, -1.4451e+00, 5.2179e-01, 7.7221e-01, 4.1455e-02},
      {2.8888e+00, -3.2074e+00, 3.4082e-01, 3.3507e-01, 2.7346e-02},

      {3.5029e+00, 5.5470e+00, 1.5174e-01, 3.9215e+00, -7.5815e-01},  // Mean Hcal ShowerType2
      {1.2035e+00, -4.3918e-01, 9.8431e-01, 5.3485e-01, -3.4481e-02},
      {2.4186e+01, 2.5653e+01, -6.8909e-01, -2.7461e+00, -1.5702e-01},
      {1.0827e+01, 1.0659e+01, -3.3366e-01, -3.1979e+00, 1.1158e-01},
      {1.5010e+01, -1.5988e+01, 2.2580e-01, -4.3233e+00, 1.1448e-01},

      {4.0761e-01, 5.0999e-02, 1.7222e+00, 2.1085e+00, 5.4258e-02},  // Mean Hcal ShowerType3
      {1.0394e+01, -9.5700e+00, 1.1167e+00, -1.6884e+00, -3.3264e-02},
      {-1.1882e+00, 1.6460e-01, -2.5897e+00, 5.4484e-01, -1.5845e-01},
      {2.7227e+01, 2.6921e+01, -3.5664e-01, -4.8584e+00, 1.1698e-01},
      {2.1544e+01, -2.2048e+01, 2.5227e-01, -5.2186e+00, 6.7578e-02},

      {3.6152e-02, 1.5236e-01, -5.4226e-01, 3.4917e+00, 3.1429e-02},  // Sigma Ecal ShowerType1
      {4.9213e-01, 1.0093e-01, -7.8460e-01, 2.2417e+00, -1.9762e-02},
      {3.6555e-01, 2.2955e-02, -3.3972e+01, 2.7112e+00, -2.0412e-02},
      {7.1526e-01, 3.1537e-01, -4.8117e-01, 1.3809e+00, -1.1832e-02},
      {5.3792e-01, 1.7556e-01, -5.9724e-01, 3.9307e-01, -2.1343e-02},

      {2.7662e-01, 5.6892e-02, -1.0211e+00, 1.5592e+00, -2.0545e-02},  // Sigma Hcal ShowerType1
      {2.1221e+00, 1.7139e+00, 2.9685e-01, 3.0293e+00, -4.9449e-01},
      {9.8715e-01, 1.7377e-01, -1.5715e+00, 1.1948e+00, -7.4157e-02},
      {1.2424e+00, 5.8446e-01, -7.3994e-01, 1.6481e+00, -6.4211e-02},
      {1.2797e+00, 9.5722e-01, -4.1961e-01, 1.5458e+00, -1.9276e-02},

      {5.6503e-01, 3.2484e-01, -6.8870e-01, -9.6941e-01, -2.4937e-02},  // Sigma Hcal ShowerType2
      {7.2561e-01, 5.3369e-02, 9.1553e+00, 1.9652e+00, -5.4515e-02},
      {3.3058e+01, 8.7333e+01, -2.4388e-02, -1.5815e+01, 1.6538e+00},
      {1.1171e+00, 6.8039e-01, -6.0860e-01, 1.2764e+00, -2.1545e-02},
      {2.2385e+00, 2.4309e+00, -2.4251e-01, -8.3314e-01, 4.4941e-02},

      {2.5595e-01, 2.0105e-02, -1.7804e+00, 2.6746e+00, -2.6966e-02},  // Sigma Hcal ShowerType3
      {3.0882e-01, 3.1336e-01, -5.1932e-01, 3.3669e+00, 6.9642e-02},
      {6.1781e-01, 1.1997e-01, 9.2596e-01, -1.3085e+01, -5.1192e-02},
      {1.4680e+00, -1.1644e+00, 4.1119e-01, -2.3604e-01, 3.1277e-03},
      {3.9081e+00, 4.2913e+00, -1.7321e-01, -3.9169e+00, 6.0504e-02}};

  const double pion_rho[8 * NPar][5] = {
      {1.2318e-01, 3.0000e-01, 8.8725e-01, 1.6928e+00, 0.0000e+00},  // Ecal ShowerType1
      {4.1546e-01, 1.6375e-01, 2.0719e+00, 1.2931e+00, -2.3695e-03},
      {-9.4588e-01, 1.7680e+00, 1.1180e+00, -1.7623e+00, 6.6812e-03},
      {-1.8668e-01, 1.5000e-01, -5.0000e+00, 2.4000e+00, 6.0000e-02},
      {1.1945e-01, 1.5393e-01, -1.6983e+00, 2.2457e+00, 5.1813e-02},
      {3.4322e-02, 2.0564e-01, -1.4297e+00, 2.1601e+00, 4.0797e-02},
      {-1.0894e-01, 1.4305e-01, -1.5543e+00, 2.5491e+00, 5.6509e-02},
      {8.1763e-02, 8.0722e-02, -5.8023e+00, 2.4338e+00, 5.4228e-02},
      {9.4796e-02, 1.5509e-01, -1.8610e+00, 2.3388e+00, 3.9771e-02},
      {7.8380e-01, 1.4165e-01, 7.7385e-01, 1.9248e+00, 4.2539e-03},

      {4.2393e-01, 2.7909e-01, 9.2577e-01, 2.7916e+00, -6.8012e-02},  // Hcal ShowerType1
      {5.6826e-01, 2.9822e-01, 8.1516e-01, 2.3029e+00, -9.2674e-02},
      {8.0676e-01, 1.0045e+00, -4.2949e-03, -1.1090e+01, -9.6997e-04},
      {-1.8671e-01, 7.4935e-01, 3.6716e-04, 4.3540e+00, 8.4585e-02},
      {3.7378e-01, 1.8905e+00, 1.3206e-01, 8.3958e-01, -1.4278e-01},
      {2.4541e-01, 1.4579e-01, 1.3386e+00, 1.1209e+00, 1.5902e-03},
      {4.4394e-02, 1.1718e-01, 2.0436e+00, 1.0125e+00, -2.0101e-02},
      {1.5076e-01, 8.8556e-02, -1.8958e+00, 2.2495e+00, 4.6895e-02},
      {5.0817e-01, 1.2550e-01, 2.3684e+00, 1.0669e+00, -1.3888e-02},
      {8.3803e-01, 5.6501e-02, -1.2531e+00, 2.7326e+00, -4.1174e-02},

      {3.0277e-01, 2.1400e-01, 1.2867e+00, 2.3086e+00, -8.7281e-02},  // Hcal ShowerType2
      {5.2508e-01, 2.6391e-01, 1.3357e+00, 1.9172e+00, -9.2390e-02},
      {7.5387e-01, -3.2142e-02, 4.7437e+00, 8.5346e-01, -1.1566e-02},
      {-7.5633e-02, 8.8550e-02, 2.2340e+00, 9.7441e-01, 3.2514e-02},
      {2.0314e-01, 1.2932e-01, 9.9352e-01, 6.6276e-01, 3.2726e-02},
      {-2.6996e+00, 3.9944e+00, -2.3836e-01, 3.4896e+00, 8.5793e-01},
      {1.2888e-01, 2.4009e-01, 9.8654e-01, 9.8778e-01, -4.3265e-02},
      {2.2281e-01, 8.4319e-02, 4.8402e-04, -2.0111e-01, 1.9263e-02},
      {-9.3521e+00, 1.0283e+01, 3.5236e-01, -4.8949e+00, -7.7675e-02},
      {7.6844e-01, -9.0198e-02, 1.0364e+00, 2.3443e+00, -1.4107e-02},

      {3.0154e-01, 3.6790e-01, 7.5730e-01, 1.7676e+00, -9.7870e-02},  // Hcal ShowerType3
      {4.2110e-01, 3.6328e-01, 9.7741e-01, 1.1211e+00, -6.4038e-02},
      {7.6092e-01, 3.5780e-02, 9.7086e-01, 1.9511e+00, -1.2363e-02},
      {-1.4874e+00, 2.4273e+00, -1.0552e-01, 7.3591e+00, 1.7302e-01},
      {-1.6966e+00, 2.9215e+00, -2.2195e-01, 3.3990e+00, 6.0529e-01},
      {1.6144e-01, 2.1615e-01, -7.4824e-01, 3.1003e+00, 0.0000e+00},
      {-2.2588e+00, 3.9894e+01, 5.5166e-02, -1.1180e+00, -2.1166e+00},
      {6.8954e-01, 1.1032e+00, 2.4371e-01, 1.8565e+00, -1.9127e-01},
      {4.7802e-02, 3.0961e+00, 1.4566e-01, -1.0462e+00, -3.6505e-01},
      {6.3815e-01, -5.1494e-01, 3.3634e-01, 1.4517e+00, 8.8357e-02}};

  // pion lateral parameters

  const double pion_rpar[4 * Nrpar][5] = {
      {1.7239e+00, 9.3646e-01, -7.6784e-01, 1.6319e+00, 0.0000e+00},  // Ecal for showerType = 1
      {8.0152e+00, 1.3573e+00, -2.2490e+00, 2.0799e+00, -9.1649e-01},
      {7.3494e-01, 8.7912e-02, -1.9433e+00, 1.2044e+00, -3.4421e-02},
      {-2.2025e-01, 7.3525e-02, 3.1836e+00, 1.4077e+00, 2.3818e-02},

      {2.0617e+01, 2.1354e+00, -1.3979e+00, 2.4424e+00, -2.0928e+00},  // Hcal for showerType = 1
      {1.4732e+02, 1.4804e+02, -1.0534e+00, -2.1180e+00, 1.9513e-02},
      {5.2939e-01, 2.3488e-01, 4.2874e-01, 1.4435e+00, -6.7974e-02},
      {-2.2405e-02, 1.7781e-01, 5.8629e-03, -2.6258e+01, 2.0595e-03},

      {1.3184e+01, 5.3308e+00, -6.5926e-01, 1.4287e+00, -9.1948e-01},  // Hcal for showerType = 2
      {6.0658e+00, 7.6593e+00, -6.9664e-01, -1.7824e+00, 1.5619e-01},
      {5.5211e-01, 0.0000e+00, 0.0000e+00, 0.0000e+00, -2.9011e-02},
      {2.1551e-02, -5.4231e-02, 1.6615e+00, 2.7025e-01, 1.1807e-02},

      {9.0230e-01, 8.7071e-01, -5.9984e-01, 2.7973e+00, 2.4553e-01},  // Hcal for showerType = 3
      {7.5508e+00, 3.6556e+00, -8.3028e-01, 1.1326e+00, -6.4124e-01},
      {2.5737e+01, 2.5165e+01, -5.6146e-01, -4.0345e+00, -2.9592e-02},
      {-3.1200e-01, 2.0000e-01, 2.8915e+00, 7.5519e-01, 1.5230e-02}};

  // Proton paramters

  const double pro_emscale[2][5] = {{6.2614e-01, 1.7633e-01, -1.2677e+00, 1.3193e+00, 2.4973e-03},
                                    {1.6413e-01, 5.2570e-03, 1.8876e+02, 1.2887e+00, -4.0266e-03}};

  const double pro_hadscale[8][5] = {
      // based on LogNormal of Had Energy
      {-1.2767e+02, 1.2691e+02, 2.6892e-01, -8.4621e+00, 9.7956e-01},
      {1.2283e+00, 1.6307e-01, -3.6863e+00, 1.8677e+00, -4.5990e-02},
      {1.8917e+00, 2.0947e+00, -3.6371e-01, 3.7861e-01, 8.8760e-02},
      {-7.6830e-01, 3.1319e-01, 8.2844e-01, 1.5865e+00, 2.4735e-02},
      // LogNormal of Had Energy for mip-like response
      {-1.0927e+01, 1.0727e+01, 2.9922e+00, -8.2073e-01, 9.8722e-01},
      {7.2797e-02, 2.3601e-02, -1.4900e+00, 1.8989e+00, 3.4294e-04},
      // correction of response if ssp is between Ecal and Hcal
      {1.8736e-01, 1.7391e-01, 1.0991e+00, 3.3557e+00, 0.0000e+00},
      {4.7858e-01, 5.8552e-01, 3.9112e-01, 2.6945e+00, -1.7791e-01}};

  const double pro_correl_hadem[5] = {-6.7711e-01, 2.5760e-01, -4.9826e-01, 3.4791e-01, 0.0000e+00};

  // proton longitudinal parameters

  const double pro_par[8 * NPar][5] = {
      {3.5805e-01, 8.2073e-02, 2.4040e+00, 2.8935e+00, 7.1200e-02},  // Mean Ecal ShowerType1
      {8.1351e-01, 9.3288e-02, 4.5959e+00, 4.1930e+00, 8.2825e-02},
      {-1.2342e+00, 1.3826e-01, 8.1966e-01, 3.7141e+00, 2.7493e-02},
      {5.6140e-01, 2.1720e-01, 2.0061e+00, 2.8141e+00, 1.1165e-01},
      {3.9409e+00, 2.6083e+00, 3.0382e-01, 3.2679e+00, -6.3072e-01},

      {1.5450e+00, 1.1047e+00, 2.9732e-01, 4.5325e+00, -2.4096e-01},  // Mean Hcal ShowerType1
      {1.5098e+00, -6.8331e-01, 8.7004e-01, 5.0915e-01, -9.3536e-03},
      {6.9904e+00, -8.9057e+00, 3.8745e-01, -2.9089e+00, -6.0353e-02},
      {1.8465e+00, -1.1548e+00, 7.1662e-01, 9.2467e-01, 7.0536e-03},
      {2.1807e+00, -1.4464e+00, 7.2033e-01, 1.0696e+00, -1.3923e-01},

      {3.9185e+00, 6.1651e+00, 1.4738e-01, 4.2079e+00, -8.1423e-01},  // Mean Hcal ShowerType2
      {8.3119e+00, 7.5628e+00, -4.9561e-01, -2.9352e+00, -3.0061e-02},
      {2.7150e+00, 4.5234e+00, -4.6494e-01, -1.9846e+00, -9.9347e-02},
      {2.2762e+00, 1.7668e+00, -5.3421e-01, -6.4613e-03, 5.3533e-02},
      {2.6187e+00, -2.3479e+00, 4.9602e-01, 1.8344e-01, -5.3695e-02},

      {1.9666e+00, 3.0810e+00, 1.7874e-01, 3.2441e+00, -4.4566e-01},  // Mean Hcal ShowerType3
      {1.6223e+01, 1.7175e+01, -1.3214e-01, -1.0103e+01, 1.9030e-01},
      {8.1636e+01, 8.3368e+01, -5.0505e-01, -5.2201e+00, -1.0340e-01},
      {5.5674e+01, 5.5241e+01, -3.8856e-01, -5.5563e+00, 9.2886e-02},
      {6.1932e+01, 6.2078e+01, -3.2123e-01, -5.9991e+00, 2.2640e-02},

      {7.9984e-02, 1.0177e-01, -4.9195e-01, 3.6549e+00, 1.3986e-02},  // Sigma Ecal ShowerType1
      {4.6155e-01, 1.1266e-01, -1.1120e+00, 2.8973e+00, -7.7394e-03},
      {3.6587e-01, 3.0463e-02, -1.8552e+00, 2.9503e+00, -1.9858e-02},
      {7.0777e-01, 1.5344e-01, -9.7573e-01, 2.2658e+00, -4.3013e-02},
      {3.7488e-01, 3.3388e-01, -3.2414e-01, 1.7099e+00, 2.7456e-02},

      {2.3330e-01, 8.3848e-02, -1.4841e+00, 1.6539e+00, -8.9738e-03},  // Sigma Hcal ShowerType1
      {9.0862e-01, 1.9284e-01, -2.9385e+00, 5.5159e-01, -4.4707e-02},
      {1.0615e+00, 4.0817e-01, -9.2562e-01, 7.7349e-01, -5.2196e-02},
      {1.3044e+00, 6.9523e-01, -8.0370e-01, 1.3130e+00, -6.0052e-02},
      {1.3648e+00, 6.7204e-01, -7.7137e-01, 1.3261e+00, -8.1459e-02},

      {2.3378e-01, 8.4699e-02, -1.2727e+00, 1.3170e+00, -9.0939e-03},  // Sigma Hcal ShowerType2
      {6.7311e-01, 2.6483e-02, -2.3889e+01, 3.3071e+00, -3.8701e-02},
      {1.9157e+01, 1.8483e+01, -6.2208e-01, -3.5409e+00, -6.3584e-02},
      {1.2720e+00, 7.7241e-01, -6.6997e-01, 8.5122e-01, -3.7883e-02},
      {3.2209e+00, 2.8976e+00, -3.4428e-01, -1.5930e+00, -2.2328e-02},

      {2.3064e+00, 2.1994e+00, -2.4570e-01, -6.2275e+00, -6.5378e-03},  // Sigma Hcal ShowerType3
      {6.2645e-01, 1.0763e-01, -2.4655e+00, 3.0694e+00, -2.2801e-02},
      {3.9143e+00, -3.1821e+00, 2.2346e+00, -8.5515e-01, -7.0756e-02},
      {8.8440e+00, 8.6952e+00, -2.8769e-01, -4.4932e+00, 2.0374e-02},
      {7.1745e+00, 7.0713e+00, -2.5061e-01, -4.6686e+00, 1.0573e-02}};

  const double pro_rho[8 * NPar][5] = {
      {1.9717e+00, 6.6780e+00, 1.4425e-01, 2.2917e+00, -8.1369e-01},  // Ecal ShowerType1
      {-6.3565e+00, 7.0824e+00, 1.9663e-01, -7.8033e+00, -2.3854e-02},
      {8.0629e-01, 6.5672e-02, 1.4501e+00, 3.3136e-01, -5.6348e-03},
      {-1.6000e-01, 2.3904e-01, 1.1818e+00, 6.1474e-01, -1.0088e-02},
      {1.0966e-01, 1.8834e-01, -1.4410e+00, 2.6445e+00, 9.0217e-02},
      {1.0565e-02, 2.4379e-01, -1.3677e+00, 2.7338e+00, 7.6137e-02},
      {-3.1898e-02, 1.1508e-01, 1.5916e+00, 6.2431e-01, -9.8921e-03},
      {1.5641e-01, 1.8429e-01, 1.8207e+00, 4.9841e-01, 1.3907e-03},
      {-1.5532e-01, 3.4349e-01, -8.5195e-01, 2.8581e+00, 1.4698e-01},
      {6.9661e-01, 2.0247e-01, 7.0948e-01, 6.1266e-01, 1.0035e-02},

      {2.8900e-01, 1.9972e-01, 1.3997e+00, 2.8253e+00, -3.0914e-02},  // Hcal ShowerType1
      {3.2869e-01, 8.6843e-02, 6.0682e+01, 2.1983e+00, -1.0146e-02},
      {7.8200e-01, 6.8963e-02, -1.9113e+00, 7.5866e-01, 5.9595e-03},
      {9.5356e-01, 1.1469e+00, 3.0959e-01, 1.0238e+01, 7.6437e-02},
      {3.4378e-01, 1.6417e-01, 1.2061e+00, 1.6405e+00, 2.3441e-02},
      {2.8005e-01, 2.0804e-01, 1.3118e+00, 1.1119e+00, -1.9884e-02},
      {-2.7624e-02, 1.0661e-01, 2.7942e+00, 5.8531e-01, -8.9599e-03},
      {2.3749e-01, 2.6046e-02, 1.8467e+01, 6.2294e-01, 9.8564e-03},
      {4.6006e-01, 2.0859e-01, 1.2562e+00, 7.6745e-01, -1.9148e-02},
      {8.1573e-01, 6.8433e-02, -2.1358e+00, 2.2568e+00, -3.8336e-02},

      {1.1195e-01, 1.1879e-01, 2.9551e+00, 1.9034e+00, -2.0542e-02},  // Hcal ShowerType2
      {4.1285e-01, 4.6288e-01, 5.0506e-01, 1.4100e+00, -1.2918e-01},
      {7.7938e-01, -4.7534e-02, 1.8256e+01, 6.8910e-02, -8.8481e-03},
      {2.1819e-01, 2.1512e-01, 7.0238e-01, 3.6517e+00, -2.4946e-02},
      {3.5413e-01, 1.8842e-01, 1.0927e+00, 1.2173e+00, 3.4229e-04},
      {-1.9019e+00, 2.8987e+00, -2.5328e-01, 3.4091e+00, 6.5499e-01},
      {-7.1433e-02, 7.6591e-02, -6.8698e+00, 2.1165e+00, 5.6828e-02},
      {2.2651e-01, 7.3121e-01, 6.9897e-04, 3.5656e+00, 2.7391e-02},
      {-9.1867e+00, 1.0087e+01, 3.4287e-01, -5.2458e+00, -7.1044e-02},
      {7.7621e-01, -9.5476e-02, 1.0892e+00, 1.8212e+00, -1.6587e-02},

      {1.4812e-01, 3.7207e-01, 6.7394e-01, 1.6932e+00, -8.9577e-02},  // Hcal ShowerType3
      {-1.0980e+01, 1.1814e+01, 2.9231e-01, -5.5518e+00, -9.7033e-02},
      {7.8865e-01, -4.6499e-02, 1.0071e+01, -1.7465e-01, -7.8028e-03},
      {-4.8628e-03, 6.8062e-02, 4.0379e-04, -2.9541e+00, 1.4925e-02},
      {3.2583e-01, 2.2048e-01, 1.3796e+00, 7.7019e-01, -1.9870e-02},
      {-4.1067e+00, 8.5741e+00, -1.8161e-01, 3.0661e+00, 1.4121e+00},
      {1.3314e-01, 1.3727e-01, -2.5181e-04, -4.8352e-01, -7.1482e-03},
      {1.8448e-01, -1.0892e-01, 2.0336e-04, -3.5803e+01, 6.2453e-02},
      {-4.3394e+00, 6.7933e+00, 1.2905e-01, -6.7132e+00, -2.7930e-01},
      {7.6150e-01, -1.3613e-01, 9.9347e-01, 1.1661e+00, 5.4822e-03}};

  // proton lateral parameters

  const double pro_rpar[4 * Nrpar][5] = {
      {2.0473e+01, 1.8293e+01, -2.7258e-03, -1.4304e+03, -2.7740e-01},  // Ecal for showerType = 1
      {4.3030e+00, 3.1796e+01, -1.4979e-01, 1.2390e+00, 2.8661e+00},
      {-7.1506e-01, 3.4815e+00, -1.8282e-01, 2.4101e+00, 5.4402e-01},
      {2.5011e+00, 5.3549e+00, 1.7772e-01, 2.9511e+00, -8.8951e-01},

      {2.0252e+01, 1.6754e+00, -3.3596e+00, 2.1412e+00, -2.1051e+00},  // Hcal for showerType = 1
      {-1.6270e+00, 5.0493e+00, -1.6916e-01, 1.5961e+00, 7.2367e-01},
      {5.0396e-01, 7.1958e-02, 1.4915e+00, 1.4498e+00, -4.0554e-02},
      {-1.3402e-01, 1.3657e-01, 2.3093e+00, -3.1556e+00, 5.2742e-03},

      {1.2771e+01, 2.8591e+00, -7.5931e-01, 1.5374e+00, -1.2623e+00},  // Hcal for showerType = 2
      {-4.1051e+00, 3.1735e+00, -3.5820e-01, 3.0133e+00, 1.0538e+00},
      {4.9758e-01, 5.9756e-02, -1.9593e+00, 2.9959e+00, -1.3451e-02},
      {2.0201e-01, 1.0967e-01, 1.2310e+00, 3.3239e+00, -6.2154e-02},

      {-4.8143e+00, 1.0479e+01, -2.1974e-01, 3.0933e+00, 2.0855e+00},  // Hcal for showerType = 3
      {2.5276e+01, 2.1056e+01, -4.4710e-01, -1.7116e+00, -6.7854e-01},
      {-5.8886e-01, 2.6766e+00, -1.9974e-01, 2.6381e+00, 4.3146e-01},
      {-1.7710e-02, 9.4732e-02, 4.2625e+00, 3.3545e+00, -2.9552e-02}};

  // Anti-Proton paramters

  const double pbar_emscale[2][5] = {{1.9246e+01, 1.8870e+01, -3.3127e-01, -4.8509e+00, -2.3785e-02},
                                     {3.5744e+00, 3.3661e+00, -4.9667e-01, -4.1388e+00, -8.8824e-03}};

  const double pbar_hadscale[8][5] = {
      // based on LogNormal of Had Energy
      {-1.8857e+00, 9.4549e-01, 1.0173e+00, 2.3654e+00, 1.0381e+00},
      {1.4276e+00, 8.3835e-01, -9.1466e-01, 2.3945e+00, 0.0000e+00},
      {1.0005e+00, 5.0454e-01, -9.6777e-01, 2.4216e+00, -3.0214e-02},
      {-7.1494e-01, 3.7825e-01, 1.1627e+00, 2.7411e+00, 5.5459e-03},
      // LogNormal of Had Energy for mip-like response
      {1.5770e+00, 1.1215e+00, 4.2471e-01, 3.8321e+00, 5.2852e-01},
      {-6.5624e-02, 2.7895e-01, -3.2639e-01, 2.3605e+00, 6.3871e-02},
      // correction of response if ssp is between Ecal and Hcal
      {1.8736e-01, 1.7391e-01, 1.0991e+00, 3.3557e+00, 0.0000e+00},
      {9.1334e-02, 8.4321e-02, 9.1042e-01, 2.7686e+00, -3.0344e-02}};

  const double pbar_correl_hadem[5] = {-5.8253e-01, 3.6344e-01, -4.6371e-01, 2.8284e-01, 0.0000e+00};

  // anti-proton longitudinal parameters

  const double pbar_par[8 * NPar][5] = {
      {2.2962e+00, 1.8237e+00, 1.5856e-01, 1.1724e+01, -2.5137e-02},  // Mean Ecal ShowerType1
      {5.1688e-01, 2.9636e-02, 3.9787e+01, 3.1512e+00, 1.7428e-01},
      {-1.3058e+00, 4.9530e-02, 1.5425e+00, 4.1539e+00, 5.7473e-02},
      {2.9921e-01, 2.0357e-01, 2.9853e+00, 1.8306e+00, 1.5198e-01},
      {3.8358e+00, 5.0343e+00, 1.3900e-01, 3.2366e+00, -6.1138e-01},

      {9.2918e-01, 3.4905e-01, 4.4705e-01, 4.3199e+00, -1.0055e-01},  // Mean Hcal ShowerType1
      {1.1081e+00, -3.4156e-01, 1.2140e+00, 1.0438e+00, 2.1996e-02},
      {2.5596e+01, -4.7613e+01, 3.8236e-02, -1.6258e+01, 8.3889e-01},
      {1.4731e+00, -8.7282e-01, 7.6302e-01, 1.4135e+00, 4.0020e-02},
      {1.5854e+00, -1.5158e+00, 5.3554e-01, 1.7953e+00, -2.1115e-02},

      {1.6397e+00, 1.4348e+00, 1.8597e-01, 5.0391e+00, -2.1112e-01},  // Mean Hcal ShowerType2
      {1.9561e+00, 9.1382e-01, 5.2437e-01, 3.2069e+00, -3.6565e-01},
      {8.4435e-01, 2.0674e+00, -4.2496e-01, -3.2228e+00, -2.0347e-01},
      {1.3139e+00, 6.8898e-01, -9.0400e-01, 1.1612e+00, 5.2261e-02},
      {1.3894e+00, -2.3487e+00, 3.5770e-01, 1.2953e+00, 1.4271e-01},

      {6.4737e-01, 7.3992e-02, 9.2454e-01, 4.8070e+00, -3.3204e-03},  // Mean Hcal ShowerType3
      {9.6156e-01, 1.5021e-01, 2.1087e+00, 2.7135e+00, -5.6608e-02},
      {-2.9797e+00, 3.7631e+00, -1.8261e-01, 2.8053e+00, 4.3358e-01},
      {1.0332e+00, 4.4820e-01, -1.2826e+00, 9.7747e-01, 9.4973e-02},
      {1.6588e+00, 3.6401e+00, -2.4077e-01, 3.4642e-01, 2.7807e-01},

      {7.9348e-01, 6.0791e-01, -5.2480e-01, -4.1979e+00, -9.7594e-03},  // Sigma Ecal ShowerType1
      {6.7623e-01, 1.1835e-01, 2.5074e+01, 2.9602e+00, -7.6399e-02},
      {4.3953e-01, 5.0370e-02, 4.3043e+01, 2.9560e+00, -3.5965e-02},
      {6.7091e-01, 1.1626e-01, -5.7986e-01, 2.9029e-01, -2.8586e-02},
      {4.2821e-01, 8.0538e-02, -9.3285e-01, 1.2197e+00, -1.3245e-02},

      {2.3715e-01, 6.1849e-02, -7.9327e-01, 2.4567e+00, -1.5569e-02},  // Sigma Hcal ShowerType1
      {7.7529e-01, 8.4253e-02, -2.8453e+00, 6.6960e-01, -2.3133e-02},
      {9.7261e-01, 1.1777e-01, -1.2671e+00, 1.3352e+00, -9.0527e-02},
      {1.1170e+00, 5.7366e-01, -7.9215e-01, 1.8696e+00, -3.2848e-02},
      {1.0912e+00, 5.3449e-01, -8.3799e-01, 2.2648e+00, -5.3589e-02},

      {2.0364e-01, 1.1109e-01, -5.4911e-01, 2.2371e+00, -2.7723e-03},  // Sigma Hcal ShowerType2
      {5.0058e-01, 8.3324e-02, -1.5426e+00, 4.3092e+00, 1.7710e-02},
      {4.8258e+00, -5.3363e+00, -6.9399e-02, 1.3639e+01, -3.1232e-01},
      {1.0654e+00, 4.3313e-01, -8.1864e-01, 1.5794e+00, -5.0301e-02},
      {9.7937e-01, 4.9011e-01, -7.5635e-01, 2.0913e+00, -4.3251e-02},

      {2.4410e-01, 6.9464e-02, -5.7121e-01, 1.5400e+00, -1.8889e-02},  // Sigma Hcal ShowerType3
      {6.8356e-01, 4.4101e-02, 2.0167e+01, 2.9570e+00, -4.3937e-02},
      {2.9627e-01, -4.3021e-01, 1.3628e-01, 1.3540e+01, -5.0582e-02},
      {9.2673e-01, 3.5636e-01, -6.8759e-01, 1.1528e+00, -3.6487e-02},
      {8.1179e-01, 5.0238e-01, -5.7945e-01, 1.8664e+00, -9.9021e-03}};

  const double pbar_rho[8 * NPar][5] = {
      {1.6115e-01, 7.7749e-02, 1.3576e+01, 6.4878e-01, -3.2481e-03},  // Ecal ShowerType1
      {4.1746e-01, 6.4980e-02, -1.8986e+01, 2.9812e+00, 8.2744e-03},
      {8.3730e-01, 5.2519e-02, 1.9080e+01, 2.9734e+00, -7.2551e-04},
      {4.7186e-01, 2.3447e+00, 1.5313e-01, 2.1195e+00, -2.7598e-01},
      {2.6387e-01, 1.2494e-01, 2.0479e+01, 2.9541e+00, 3.9418e-03},
      {1.4487e-01, 1.7347e-01, 2.0829e+01, 2.9708e+00, -1.7575e-02},
      {-3.2116e-02, 1.0593e-01, -3.6256e+00, 2.0405e+00, 3.9701e-02},
      {3.2368e-01, 3.4897e-01, 4.0152e-01, 1.9683e+00, -4.3362e-02},
      {3.3095e-01, 8.8705e-02, 3.0619e+01, 3.2302e+00, -2.6705e-02},
      {6.8646e-01, 1.3220e-01, 1.8172e+00, 1.8252e+00, 2.5609e-02},

      {2.5579e-01, 1.3158e-01, 2.0117e+00, 2.6834e+00, -1.8803e-02},  // Hcal ShowerType1
      {5.4665e-01, 3.5282e-01, 7.0197e-01, 1.8240e+00, -1.2513e-01},
      {7.8407e-01, 4.6267e-02, -1.9313e+00, 1.2055e+00, 3.1770e-03},
      {1.9774e-01, 1.4336e+00, 1.0833e-01, 2.5249e+00, -6.1467e-02},
      {4.8669e-01, 2.5554e-01, 7.8888e-01, 2.7417e+00, 0.0000e+00},
      {2.5270e-01, 1.3412e-01, 7.7256e-01, 1.3281e+00, 1.2302e-02},
      {4.3116e-02, 1.3977e-01, 1.2806e+00, 8.8424e-01, -2.2153e-02},
      {-1.1513e-01, 1.1712e+00, -1.9271e-01, 1.8406e+00, 2.3827e-01},
      {4.8509e-01, 1.9358e-01, 6.8277e-01, 7.8174e-01, -1.2847e-02},
      {6.8735e-01, 1.7148e-01, -8.8434e-01, 2.6390e+00, 1.8336e-02},

      {2.6738e-01, 1.6698e-01, 1.6242e+00, 2.3194e+00, -5.4439e-02},  // Hcal ShowerType2
      {5.1565e-01, 3.1755e-01, 7.6866e-01, 1.4314e+00, -1.2355e-01},
      {1.4488e+00, -1.0738e+00, 1.5373e-01, -4.4945e+00, 5.0825e-02},
      {-5.0531e-02, 5.4899e-01, 6.4605e-04, 6.2060e+00, 5.0480e-02},
      {5.0045e-01, 2.8609e-01, 7.7954e-01, 2.4851e+00, -1.7178e-02},
      {2.4183e-01, 1.1418e-01, 1.1548e+00, 6.8739e-01, 1.4071e-03},
      {-2.7267e-01, 2.9060e-01, -9.2639e-01, 3.3275e+00, 1.3254e-01},
      {3.6510e-01, 6.8755e-02, 1.7529e+00, 3.3932e+00, 3.5968e-03},
      {-2.2256e+00, 4.0953e+00, 1.2237e-01, -6.3486e+00, -1.6487e-01},
      {6.7014e-01, -1.8220e-01, 8.3413e-01, 2.3705e+00, 3.1919e-02},

      {-9.2169e-02, 2.7435e-01, -1.4954e+00, 3.4936e+00, 5.4085e-02},  // Hcal ShowerType3
      {-5.7426e-02, 4.2696e-01, -9.1241e-01, 3.5629e+00, 1.0904e-01},
      {7.4201e-01, 4.7628e-02, 1.5747e+00, -4.6694e+00, -1.4296e-02},
      {1.8949e-02, 1.0836e-01, -1.2242e+00, 2.7149e+00, 1.3031e-02},
      {-1.5217e+00, 2.4872e+00, 8.1875e-02, -1.0666e+01, -1.4661e-03},
      {2.2412e-01, 9.4590e-02, -2.4942e+00, 1.8584e+00, 1.6461e-02},
      {-5.4793e-01, 8.2034e-01, -4.2542e-01, 3.6711e+00, 1.9032e-01},
      {-2.5079e-01, -8.8412e-01, 1.5082e-01, 5.3762e+00, 1.3426e-01},
      {-7.3299e+00, 8.1099e+00, 4.0558e-01, -5.0694e+00, -5.9030e-02},
      {5.6633e-01, -4.7278e-01, 4.1026e-01, 1.7565e+00, 1.1369e-01}};

  // anti-proton lateral parameters
  const double pbar_rpar[4 * Nrpar][5] = {
      {1.8776e+00, 2.8426e-01, 2.3530e+01, 3.0047e+00, -1.7332e-01},  // Ecal for showerType = 1
      {9.1705e+00, 4.0028e+00, -4.4536e-01, 6.4847e-01, -5.9678e-01},
      {5.9148e-01, 7.5552e-02, -3.0172e+01, 1.3417e+00, 2.0513e-02},
      {-1.3812e-01, 8.0542e-02, 5.5994e+01, 1.2251e+00, -1.6587e-02},

      {1.7618e+01, 4.3991e+00, -9.7543e-01, 2.7789e+00, -1.2115e+00},  // Hcal for showerType = 1
      {-7.6558e-02, 1.3021e+00, -1.4519e+00, 1.3966e+00, 1.6778e-01},
      {5.9899e-01, 1.6407e-01, 8.4000e-01, 2.1795e+00, -7.0504e-02},
      {-1.4042e-01, 1.3416e-01, 2.3339e+00, -2.7260e+00, 5.8295e-03},

      {1.2340e+01, 5.3893e+00, -4.9219e-01, 1.5722e+00, -6.8433e-01},  // Hcal for showerType = 2
      {1.0814e-01, 1.6610e+00, -1.1174e+00, -5.0663e+00, 1.9605e-01},
      {4.9994e-01, 0.0000e+00, 0.0000e+00, 0.0000e+00, -2.0081e-02},
      {4.6168e-01, 3.5308e-01, 5.4512e-01, 3.2036e+00, -1.4086e-01},

      {-1.6306e+00, 3.5609e+00, -1.8903e-01, 6.6580e+00, 4.6936e-01},  // Hcal for showerType = 3
      {6.5560e+00, 2.3432e+00, -9.8700e-01, 1.3115e+00, -6.5919e-01},
      {7.4461e-01, 6.6885e-02, -8.9140e-01, -1.2050e+01, -4.5248e-02},
      {-2.4275e-01, 1.6289e-01, -2.9514e-04, -1.1208e+00, 4.3240e-02}};

  // Kaon-Minus paramters

  const double kminus_emscale[2][5] = {{8.3935e-01, 2.4180e-01, -1.4484e+00, 1.0397e+00, -2.2546e-02},
                                       {2.3334e-01, 3.6810e-02, 1.0247e+01, 1.8556e+00, -1.9288e-02}};

  const double kminus_hadscale[8][5] = {
      // based on LogNormal of Had Energy
      {-5.9393e+01, 6.4013e+01, 1.0843e-01, -1.2441e+01, 4.2589e-01},
      {1.3649e+01, 1.2266e+01, -4.9381e-01, -3.6921e+00, -1.1441e-01},
      {1.2102e+00, 4.7458e-01, -9.4128e-01, 2.1482e+00, -5.1031e-02},
      {-6.2018e-01, 2.0288e-01, 1.1271e+00, 2.8535e+00, 0.0000e+00},
      // LogNormal of Had Energy for mip-like response
      {1.7106e-01, 1.3766e-01, 7.3972e-01, 4.1351e+00, 9.0284e-01},
      {5.7520e-01, -1.2499e+00, 8.0351e-02, -4.7481e+00, 6.0937e-02},
      // correction of response if ssp is between Ecal and Hcal
      {1.8736e-01, 1.7391e-01, 1.0991e+00, 3.3557e+00, 0.0000e+00},
      {4.2896e-02, 6.7448e-02, 7.4893e-01, 2.8837e+00, -1.1509e-02}};

  const double kminus_correl_hadem[5] = {-7.3480e-01, 1.8541e-01, -7.6211e-01, 9.4878e-01, 2.5519e-03};

  // kaon-minus longitudinal parameters

  const double kminus_par[8 * NPar][5] = {
      {4.5986e-01, 8.0360e-02, 1.9103e+00, 2.7576e+00, 5.8024e-02},  // Mean Ecal ShowerType1
      {5.6306e-01, 8.6175e-02, 7.5699e+00, 1.9142e+00, 1.4928e-01},
      {-1.4029e+00, 8.6442e-02, 4.7447e+00, 2.0026e+00, 7.8132e-02},
      {5.1022e-01, 3.1763e-01, 1.4969e+00, 2.4374e+00, 1.0470e-01},
      {4.4840e+00, 4.0858e+00, 2.4837e-01, 3.0941e+00, -8.4496e-01},

      {2.0880e+00, 1.9024e+00, 2.2650e-01, 4.5397e+00, -3.5337e-01},  // Mean Hcal ShowerType1
      {1.2654e+00, -3.2827e-01, 1.4255e+00, 9.2278e-01, -2.8213e-02},
      {-8.5073e-01, 4.8949e-01, -1.1802e+00, 8.3284e-01, -1.6258e-01},
      {2.4486e+00, -2.0627e+00, 4.1771e-01, 2.8534e-02, 5.9279e-02},
      {1.0307e+01, -1.2125e+01, 1.8949e-01, -3.5864e+00, 1.9567e-01},

      {3.0833e+00, 4.5830e+00, 1.6380e-01, 3.8496e+00, -6.6617e-01},  // Mean Hcal ShowerType2
      {1.5334e+01, -1.4598e+01, 4.5394e-01, -4.3694e+00, -3.0904e-02},
      {1.1765e+01, 1.3252e+01, -6.1629e-01, -2.8795e+00, -1.5726e-01},
      {1.1343e+01, 1.1615e+01, -2.4147e-01, -4.5126e+00, 1.6850e-01},
      {1.5856e+01, -1.6981e+01, 2.0512e-01, -5.0463e+00, 1.2586e-01},

      {4.3696e-01, 5.9373e-02, 1.5520e+00, 2.8488e+00, 4.4038e-02},  // Mean Hcal ShowerType3
      {5.4176e-01, 4.6653e+00, -1.1337e-01, 6.3126e-01, 4.5058e-01},
      {-1.3576e+00, 1.3274e-01, -2.0240e+00, 7.4848e-01, -1.3586e-01},
      {8.4917e+00, 1.0264e+01, -1.5633e-01, -5.1903e+00, 3.7948e-01},
      {2.4254e+01, -2.5119e+01, 2.1971e-01, -6.2339e+00, 1.1753e-01},

      {6.6849e-02, 1.1461e-01, -6.0693e-01, 3.5849e+00, 2.1510e-02},  // Sigma Ecal ShowerType1
      {4.4751e-01, 6.7414e-02, -1.7351e+00, 3.1800e+00, -1.4204e-02},
      {2.3277e-01, 9.8312e-02, -8.1359e-01, 3.3423e+00, 2.0069e-02},
      {6.0942e-01, 2.5435e-01, -5.7408e-01, 2.2588e+00, -2.7305e-03},
      {4.7227e-01, 6.9822e-01, -1.8614e-01, 5.0224e-01, 5.3256e-02},

      {2.7710e-01, 5.4557e-02, -9.1426e-01, 1.3652e+00, -2.1545e-02},  // Sigma Hcal ShowerType1
      {8.5475e-01, 9.0583e-02, 3.6811e+00, 2.1694e+00, -8.1316e-02},
      {9.9153e-01, 1.7054e-01, -2.3509e+00, 1.0596e+00, -7.7110e-02},
      {1.2402e+00, 6.9760e-01, -5.8527e-01, 1.3975e+00, -4.4764e-02},
      {1.1041e+00, 9.4012e-01, -4.0793e-01, 1.7098e+00, 6.9772e-03},

      {4.5757e-01, 2.2138e-01, -8.3016e-01, -6.5474e-01, -2.5193e-02},  // Sigma Hcal ShowerType2
      {4.6612e-01, 1.1899e-01, -8.7496e-01, 4.0150e+00, 2.3778e-02},
      {3.2115e+01, 3.1746e+01, -2.1227e-01, -1.1088e+01, 0.0000e+00},
      {1.4220e+00, 1.3834e+00, -3.3056e-01, 2.2772e-01, 3.5460e-02},
      {1.0770e+00, 2.3134e+00, -2.0993e-01, 7.6896e-01, 1.7177e-01},

      {1.0333e+00, 8.4267e-01, -2.2255e-01, -6.2499e+00, -2.0389e-02},  // Sigma Hcal ShowerType3
      {4.5615e-01, 1.4719e-01, -1.0516e+00, 3.2503e+00, 2.9697e-02},
      {7.1504e-01, 4.0454e-01, 6.8555e-04, -1.7412e+01, -5.0839e-02},
      {3.4149e+00, 3.8890e+00, -1.8545e-01, -3.4381e+00, 9.7396e-02},
      {3.7946e+00, 4.0784e+00, -1.7896e-01, -3.9979e+00, 5.1072e-02}};

  const double kminus_rho[8 * NPar][5] = {
      {-4.5951e-02, 3.6373e-01, 4.9181e-01, 6.9207e-01, 1.4429e-02},  // Ecal ShowerType1
      {1.6996e-01, 4.2946e-01, 6.2046e-01, -3.7396e-02, -1.4572e-02},
      {8.3137e-01, 2.9433e-02, 3.2221e+00, 1.6200e+00, -8.8843e-04},
      {-1.3483e-01, 9.3124e-02, -4.7555e+01, 1.9746e+00, 4.2961e-02},
      {1.4051e-01, 9.3445e-02, -3.3320e+00, 2.3752e+00, 3.7645e-02},
      {7.8256e-02, 1.2162e-01, -2.9812e+00, 2.1452e+00, 1.7049e-02},
      {-8.5479e-03, 9.6577e-02, -2.5794e+00, 2.1738e+00, 2.0528e-02},
      {1.9550e-01, 9.8667e-02, 2.3510e+00, 9.3278e-01, -1.0451e-02},
      {1.3706e-01, -1.1500e-01, 2.4339e+00, 2.3990e+00, 2.4792e-02},
      {7.8427e-01, 1.6946e-01, 6.7162e-01, 1.6939e+00, -6.8641e-04},

      {3.0252e-01, 2.0969e-01, 1.2233e+00, 2.5744e+00, -3.5561e-02},  // Hcal ShowerType1
      {5.0366e-01, 2.6734e-01, 9.1620e-01, 2.1240e+00, -7.5807e-02},
      {7.6809e-01, 5.2611e-02, -3.3231e+00, 1.0126e+00, 6.1410e-03},
      {-1.7444e-01, 4.5874e-01, 1.0344e-03, 2.5811e+00, 7.8505e-02},
      {2.5192e-01, 6.2636e-02, 1.3799e+00, 1.4204e+00, 6.1673e-02},
      {2.9799e-01, 1.5329e-01, 1.2920e+00, 1.3530e+00, -1.0006e-02},
      {-1.8200e-01, 4.7254e-01, 5.0000e-01, -3.6152e-01, -4.6662e-02},
      {1.6888e-01, -6.7814e-02, 6.5507e+00, 2.1306e+00, 4.1608e-02},
      {4.8725e-01, 1.3573e-01, 1.7021e+00, 8.4936e-01, -1.0376e-02},
      {8.3064e-01, 4.7621e-02, -1.4663e+00, 2.5843e+00, -4.1124e-02},

      {2.5820e-01, 2.1436e-01, 1.3064e+00, 2.1257e+00, -7.9308e-02},  // Hcal ShowerType2
      {4.9118e-01, 2.3914e-01, 2.0019e+00, 1.8543e+00, -8.3488e-02},
      {9.7119e-01, -2.4913e-01, 2.1162e+00, -2.2685e-01, -1.1841e-02},
      {-3.1042e-02, 8.5169e-02, 1.6265e+00, 1.3944e+00, 1.6725e-02},
      {2.8430e-01, 1.0624e-01, 1.2654e+00, 8.8490e-01, 2.1335e-02},
      {-1.7883e+00, 2.5865e+00, -2.6200e-01, 3.5317e+00, 5.8945e-01},
      {-3.4648e-01, 3.0452e-01, -8.5428e-01, 3.7070e+00, 1.4478e-01},
      {9.6655e-01, 1.1316e+00, -1.9048e-01, -3.5009e+00, 8.1655e-02},
      {5.3247e-01, 1.1047e-01, 2.1538e+00, 7.0882e-01, -2.0301e-02},
      {7.7207e-01, -8.5138e-02, 8.8082e-01, 2.0751e+00, -1.7783e-02},

      {4.4074e-02, 1.1797e-01, 9.8745e-01, 1.2754e+00, 0.0000e+00},  // Hcal ShowerType3
      {3.0829e-01, 3.7222e-01, 6.4042e-01, 7.1567e-01, -4.8572e-02},
      {7.2438e-01, 1.3993e-02, 2.8178e+01, 1.1987e+00, -1.8113e-03},
      {3.3772e-02, 5.2144e-02, -2.1020e+01, 2.2369e+00, 0.0000e+00},
      {-8.7740e+01, 8.8231e+01, 5.0000e-01, -6.4849e+00, -2.5865e-02},
      {1.6919e-01, 1.5093e-01, -1.6970e+00, 3.1185e+00, 0.0000e+00},
      {-2.7414e-01, 4.2637e-01, -4.5968e-01, 4.0680e+00, 1.1120e-01},
      {3.5779e-01, 1.3748e+00, 1.5201e-01, 4.5045e-01, -1.4935e-01},
      {-4.4323e+01, 4.5858e+01, 1.4803e-01, -1.5183e+01, -1.7599e-01},
      {4.4308e-01, -1.9361e+00, 1.7101e-01, 1.2267e+00, 2.6132e-01}};

  // kaon-minus lateral parameters

  const double kminus_rpar[4 * Nrpar][5] = {
      {1.5255e+00, 7.1460e-01, -9.6109e-01, 2.1485e+00, 0.0000e+00},  // Ecal for showerType = 1
      {8.1702e+00, 1.1618e+00, -3.2615e+00, 1.9965e+00, -9.8151e-01},
      {8.0394e-01, 1.1379e-01, -5.7818e+01, 1.8315e+00, -3.1074e-02},
      {-3.4073e-01, 1.5998e-01, 5.6939e+01, 1.8305e+00, 1.5185e-02},

      {1.8546e+01, 3.9927e+00, -6.4386e-01, 2.5076e+00, -1.3842e+00},  // Hcal for showerType = 1
      {-2.9410e-01, 6.9922e-01, -7.1734e+01, 1.3073e+00, 8.2441e-02},
      {4.8144e-01, 6.6668e-02, 1.4955e+00, 1.5032e+00, -2.8181e-02},
      {-5.4174e-03, 1.7362e-02, 1.2282e+01, 2.4035e-01, 6.1898e-04},

      {2.0741e+01, 3.9654e+01, -1.8029e-01, -4.2558e-01, 2.5375e+00},  // Hcal for showerType = 2
      {-1.1271e+00, 5.6222e-01, -5.1185e+01, 9.9351e-01, 1.9139e-01},
      {4.8514e-01, 2.6816e-02, -3.7361e+01, 2.7567e+00, -8.2626e-03},
      {-9.0682e-02, 7.2902e-02, 2.3265e+00, -6.5459e+00, 8.8080e-03},

      {-2.9248e+00, 5.6213e+00, -3.2437e-01, 3.0222e+00, 1.5066e+00},  // Hcal for showerType = 3
      {7.4285e+00, 3.1786e+00, -9.1437e-01, 1.1013e+00, -7.0831e-01},
      {9.6057e-01, 3.6162e-01, -3.6673e-01, -8.9691e-01, -3.2462e-02},
      {-2.9505e+01, 2.9362e+01, 1.0665e+00, -2.3946e+00, 1.6595e-02}};

  // Kaon-Plus paramters

  const double kplus_emscale[2][5] = {{7.8775e-01, 2.7022e-01, -1.4291e+00, 1.3980e+00, -1.2795e-02},
                                      {2.2224e-01, 1.7480e-02, 1.1984e+01, 1.8265e+00, -1.6718e-02}};

  const double kplus_hadscale[8][5] = {
      // based on LogNormal of Had Energy
      {-1.1629e+02, 1.1506e+02, 4.8753e-01, -4.4057e+00, 1.0940e+00},
      {2.2018e+00, 1.1327e+00, -6.4208e-01, 1.2240e-01, -7.2109e-02},
      {1.5217e+00, 1.9949e+00, -4.0047e-01, 1.0897e+00, 1.4482e-01},
      {-1.2902e+01, 1.5504e+01, 1.1257e-01, -8.4732e+00, -3.0451e-01},
      // LogNormal of Had Energy for mip-like response
      {3.4887e-01, 1.9201e-01, 8.5205e-01, 3.8457e+00, 8.5097e-01},
      {5.1252e-01, 7.7619e-01, -1.3001e-01, -4.1296e+00, 3.8339e-02},
      // correction of response if ssp is between Ecal and Hcal
      {1.8736e-01, 1.7391e-01, 1.0991e+00, 3.3557e+00, 0.0000e+00},
      {8.2313e-01, 1.3027e+00, 2.5263e-01, 2.8203e+00, -2.8548e-01}};

  const double kplus_correl_hadem[5] = {-6.9227e-01, 1.8762e-01, -7.1395e-01, 7.1711e-01, -7.3016e-03};

  // kaon-plus longitudinal parameters

  const double kplus_par[8 * NPar][5] = {
      {3.8772e-01, 7.5923e-02, 2.3857e+00, 2.8135e+00, 7.0675e-02},  // Mean Ecal ShowerType1
      {1.4815e+00, 9.8518e-01, 3.4748e-01, 3.3609e+00, -1.2142e-01},
      {-7.4688e-01, 7.4632e-01, 3.7387e-01, 3.1767e+00, -1.2898e-01},
      {6.4780e-01, 3.3263e-01, 1.6380e+00, 2.8163e+00, 7.5372e-02},
      {4.8648e+00, 4.4851e+00, 2.5096e-01, 3.1485e+00, -9.4875e-01},

      {1.6983e+00, 1.3064e+00, 2.8039e-01, 4.3610e+00, -2.8089e-01},  // Mean Hcal ShowerType1
      {1.4443e+00, -5.0550e-01, 1.0680e+00, 5.6710e-01, -1.5739e-02},
      {-5.3822e-01, 1.0584e+00, -6.4612e-01, 3.5104e-01, -1.1463e-01},
      {2.3248e+00, -2.2851e+00, 3.6709e-01, 1.3197e-01, 1.2563e-01},
      {2.1837e+00, -2.2043e+00, 4.6015e-01, 9.2583e-01, -7.4904e-03},

      {3.3203e+00, 5.0310e+00, 1.6001e-01, 3.9441e+00, -7.1274e-01},  // Mean Hcal ShowerType2
      {1.1513e+00, -1.8085e-01, 3.3413e+00, 7.0993e-01, -6.3645e-02},
      {1.3898e+01, 1.5638e+01, -4.1890e-01, -3.9674e+00, -1.1401e-01},
      {2.0012e+01, 1.9866e+01, -2.9212e-01, -5.0006e+00, 1.1974e-01},
      {2.4295e+00, -2.2834e+00, 4.8288e-01, 2.9977e-01, -3.0573e-02},

      {3.8408e-01, 6.1344e-02, 1.0667e+00, 3.0242e+00, 5.0278e-02},  // Mean Hcal ShowerType3
      {1.8964e+00, 5.1610e+00, -8.8169e-02, -1.9272e+00, 3.1513e-01},
      {1.4200e+01, 1.6127e+01, -2.8959e-01, -6.1679e+00, -7.4159e-02},
      {2.7497e+01, 2.7062e+01, -3.3540e-01, -5.5799e+00, 1.0200e-01},
      {2.3118e+01, -2.3752e+01, 2.6134e-01, -5.2177e+00, 9.7844e-02},

      {-3.5273e-02, 2.6492e-01, -2.7154e-01, 4.1599e+00, 3.7807e-02},  // Sigma Ecal ShowerType1
      {5.4462e-01, 4.9507e-02, -1.8513e+01, 2.9250e+00, -3.6791e-02},
      {3.7860e-01, 1.8549e-02, -2.9438e+00, 2.4898e+00, -2.2790e-02},
      {6.6597e-01, 6.5499e-02, -2.1924e+01, 2.9525e+00, -4.7980e-02},
      {1.0753e+00, 9.2583e-01, -1.4431e-01, -5.0882e+00, 2.9234e-03},

      {2.6008e-01, 6.1267e-02, -1.7484e+00, 1.6088e+00, -1.7668e-02},  // Sigma Hcal ShowerType1
      {8.6750e-01, 8.7283e-02, 2.5881e+00, 2.5618e+00, -8.5318e-02},
      {1.0368e+00, 2.5737e-01, -1.3413e+00, 8.7206e-01, -7.0973e-02},
      {1.2517e+00, 6.4973e-01, -7.3033e-01, 1.4095e+00, -5.3997e-02},
      {1.9193e+00, 1.9482e+00, -3.0639e-01, 6.6016e-02, 2.9074e-02},

      {2.7361e-01, 5.8267e-02, -1.5294e+00, 1.0185e+00, -2.2741e-02},  // Sigma Hcal ShowerType2
      {5.3653e-01, 1.0764e-01, -6.6807e-01, 4.7074e+00, -3.4054e-03},
      {5.8520e+01, 5.8162e+01, -2.3280e-01, -1.1136e+01, 0.0000e+00},
      {1.2192e+00, 6.9207e-01, -6.8090e-01, 8.9059e-01, -3.8146e-02},
      {3.2972e+00, 2.9315e+00, -3.4433e-01, -1.6434e+00, -2.8242e-02},

      {1.4349e+00, 1.4443e+00, -1.2105e-01, -9.0252e+00, 2.3150e-03},  // Sigma Hcal ShowerType3
      {4.9465e-01, 1.8568e-01, -9.3747e-01, 3.2665e+00, 2.3940e-02},
      {2.3407e+00, -3.8601e+00, 2.9374e-02, -1.4549e+01, 1.4344e-02},
      {4.8451e+00, 4.6687e+00, -2.7170e-01, -3.7684e+00, 1.8616e-02},
      {5.0127e+00, 5.0025e+00, -2.3093e-01, -4.0513e+00, 2.3821e-02}};

  const double kplus_rho[8 * NPar][5] = {
      {3.8772e-01, 7.5923e-02, 2.3857e+00, 2.8135e+00, 7.0675e-02},  // Ecal ShowerType1
      {1.4815e+00, 9.8518e-01, 3.4748e-01, 3.3609e+00, -1.2142e-01},
      {-7.4688e-01, 7.4632e-01, 3.7387e-01, 3.1767e+00, -1.2898e-01},
      {6.4780e-01, 3.3263e-01, 1.6380e+00, 2.8163e+00, 7.5372e-02},
      {4.8648e+00, 4.4851e+00, 2.5096e-01, 3.1485e+00, -9.4875e-01},
      {-3.5273e-02, 2.6492e-01, -2.7154e-01, 4.1599e+00, 3.7807e-02},
      {5.4462e-01, 4.9507e-02, -1.8513e+01, 2.9250e+00, -3.6791e-02},
      {3.7860e-01, 1.8549e-02, -2.9438e+00, 2.4898e+00, -2.2790e-02},
      {6.6597e-01, 6.5499e-02, -2.1924e+01, 2.9525e+00, -4.7980e-02},
      {1.0753e+00, 9.2583e-01, -1.4431e-01, -5.0882e+00, 2.9234e-03},

      {1.6983e+00, 1.3064e+00, 2.8039e-01, 4.3610e+00, -2.8089e-01},  // Hcal ShowerType1
      {1.4443e+00, -5.0550e-01, 1.0680e+00, 5.6710e-01, -1.5739e-02},
      {-5.3822e-01, 1.0584e+00, -6.4612e-01, 3.5104e-01, -1.1463e-01},
      {2.3248e+00, -2.2851e+00, 3.6709e-01, 1.3197e-01, 1.2563e-01},
      {2.1837e+00, -2.2043e+00, 4.6015e-01, 9.2583e-01, -7.4904e-03},
      {2.6008e-01, 6.1267e-02, -1.7484e+00, 1.6088e+00, -1.7668e-02},
      {8.6750e-01, 8.7283e-02, 2.5881e+00, 2.5618e+00, -8.5318e-02},
      {1.0368e+00, 2.5737e-01, -1.3413e+00, 8.7206e-01, -7.0973e-02},
      {1.2517e+00, 6.4973e-01, -7.3033e-01, 1.4095e+00, -5.3997e-02},
      {1.9193e+00, 1.9482e+00, -3.0639e-01, 6.6016e-02, 2.9074e-02},

      {2.4423e-01, 2.2650e-01, 1.3877e+00, 1.8939e+00, -7.5389e-02},  // Hcal ShowerType2
      {4.6760e-01, 2.6361e-01, 1.4374e+00, 1.6434e+00, -9.9844e-02},
      {7.4796e-01, -4.4661e-02, 1.7292e+01, 7.0879e-01, 2.4763e-03},
      {-6.4806e+00, 6.4231e+00, 1.0400e+00, -2.2650e+00, 4.7778e-02},
      {3.4440e-01, 1.1933e-01, 2.1685e+00, 1.3074e+00, 1.5225e-02},
      {-1.1990e+00, 1.8273e+00, -2.2560e-01, 4.3776e+00, 3.3393e-01},
      {-1.3851e+00, 1.7655e+00, -2.6978e-01, 3.6071e+00, 4.2187e-01},
      {2.8248e-01, 4.8579e-02, 1.0095e+00, 3.5771e+00, 1.1249e-02},
      {-4.8075e+00, 5.5604e+00, 5.3060e-01, -3.1000e+00, -4.5298e-02},
      {7.2139e-01, -1.2988e-01, 1.3460e+00, 1.7526e+00, 8.9762e-03},

      {4.7434e-02, 3.1872e+00, 1.6477e-01, 3.0236e-01, -4.2486e-01},  // Hcal ShowerType3
      {9.4033e-02, 5.7792e-01, 6.8058e-01, 2.1194e-01, -8.2046e-02},
      {7.4700e-01, 2.0561e-02, 4.2268e+01, 1.6399e+00, -1.1949e-02},
      {5.2255e-02, 4.6034e-02, -1.7110e+00, 1.8247e+00, 0.0000e+00},
      {-1.0684e+02, 1.0739e+02, 5.0000e-01, -6.3340e+00, -2.6291e-02},
      {2.0912e-01, 1.3043e-01, -4.9417e+00, 2.9813e+00, 0.0000e+00},
      {-1.8831e+00, 3.4253e+00, -1.8757e-01, 3.5963e+00, 5.6274e-01},
      {1.4591e-03, 1.6858e+00, 1.2556e-01, -7.6405e-01, -1.1943e-01},
      {-6.2423e+00, 7.1383e+00, 3.8814e-01, -4.3872e+00, -9.4735e-02},
      {7.2200e-01, -1.1568e-01, 1.3604e+00, 1.3338e+00, 1.6450e-02}};

  // kaon-plus lateral parameters

  const double kplus_rpar[4 * Nrpar][5] = {
      {2.0917e+00, 1.2528e+00, -6.9494e-01, 1.7600e+00, 0.0000e+00},  // Ecal for showerType = 1
      {7.8866e+00, 6.3777e-01, -4.3657e+00, 2.0492e+00, -1.0208e+00},
      {7.3150e-01, 1.6104e-01, -8.4279e+00, 2.0670e+00, -3.3696e-03},
      {-2.4312e-01, 1.8371e-01, 1.5265e+01, 2.0458e+00, -1.6358e-02},

      {2.0008e+01, 2.1622e+00, -3.4949e+00, 1.9954e+00, -2.0569e+00},  // Hcal for showerType = 1
      {-4.1668e-02, 5.4366e-01, -1.3780e+01, 7.0957e-01, -1.1259e-02},
      {5.0855e-01, 1.0979e-01, 1.2233e+00, 1.4132e+00, -4.5390e-02},
      {-5.9436e-02, -1.0396e-01, 3.7419e-01, 1.9661e+00, 3.6075e-02},

      {1.2970e+01, 2.5925e+00, -1.5404e+00, 1.6391e+00, -1.3978e+00},  // Hcal for showerType = 2
      {1.9183e-01, 1.3373e+00, -1.1090e+00, -7.6909e+00, 6.3587e-02},
      {4.3892e-01, 7.0247e-02, -1.8419e+01, 2.9160e+00, 1.2592e-02},
      {6.2448e-02, 6.3318e-02, 6.1143e-01, 2.4479e+00, -2.4459e-02},

      {2.0954e+00, 4.0916e-01, -6.9750e+01, 1.9870e+00, -5.3104e-02},  // Hcal for showerType = 3
      {6.4162e+00, 1.8264e+00, -9.6305e-01, 1.5012e+00, -7.5696e-01},
      {4.3430e+00, 1.3126e+01, -2.5342e-02, -1.0939e+01, 2.1736e-01},
      {-5.0784e+01, 5.0870e+01, 2.0000e-01, -1.3669e+01, -1.2081e-02}};

  // HcalOuter parameters
  const double ho_nonzero[5] = {4.79943e-01, 4.61158e-01, 7.09011e-01, 4.86440e+00, 0.0000e+00};
}  // namespace Gflash

#endif
