Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:30:14

0001 //-------------------------------------------------
0002 //
0003 //   Class: DTBNormParam.cc
0004 //
0005 //   Description:
0006 //       Provide time_vs_x correction functions for different normal B field
0007 //       values
0008 //
0009 //
0010 //   Author List:
0011 //   P. Ronchese           INFN - PADOVA
0012 //   Modifications:
0013 //
0014 //
0015 //--------------------------------------------------
0016 
0017 //-----------------------
0018 // This Class's Header --
0019 //-----------------------
0020 #include "DTBNormParam.h"
0021 
0022 //-------------
0023 // C Headers --
0024 //-------------
0025 #include <cmath>
0026 
0027 //---------------
0028 // C++ Headers --
0029 //---------------
0030 
0031 //-------------------------------
0032 // Collaborating Class Headers --
0033 //-------------------------------
0034 
0035 //----------------
0036 // Constructors --
0037 //----------------
0038 
0039 DTBNormParam::DTBNormParam()
0040     :  // default constructor : assume 0 field
0041       _bnorm(0.0),
0042       l_func(0),
0043       h_func(1) {}
0044 
0045 DTBNormParam::DTBNormParam(float bnorm) {
0046   // determine Bnorm bin in 0.0/1.0 range by steps of 0.1
0047 
0048   float x_bno = fabs(bnorm) * 10.0;
0049   int i_bno = static_cast<int>(x_bno);
0050   int l_bin;
0051 
0052   if (i_bno > 9)
0053     l_bin = 9;
0054   else
0055     l_bin = i_bno;
0056 
0057   int h_bin = l_bin + 1;
0058 
0059   // store actual Bnorm and function parameters for lower/higher bin bounds
0060   _bnorm = bnorm;
0061   l_func = ParamFunc(l_bin);
0062   h_func = ParamFunc(h_bin);
0063 }
0064 
0065 //--------------
0066 // Destructor --
0067 //--------------
0068 
0069 DTBNormParam::~DTBNormParam() {}
0070 
0071 //--------------
0072 // Operations --
0073 //--------------
0074 
0075 float DTBNormParam::tcor(float xpos) const {
0076   // compute drift time for lower/higher bin bounds
0077   float l_tcor = l_func.tcor(xpos);
0078   float h_tcor = h_func.tcor(xpos);
0079 
0080   // interpolate time corrections for actual Bnorm
0081   return l_tcor + ((h_tcor - l_tcor) * l_func.dist(_bnorm) / l_func.dist(h_func));
0082 }
0083 
0084 const float DTBNormParam::table_offsc[11] = {0.0,
0085                                              0.51630E-03,
0086                                              0.31628E-02,
0087                                              0.49082E-02,
0088                                              0.75994E-02,
0089                                              0.10643E-01,
0090                                              0.13419E-01,
0091                                              0.16636E-01,
0092                                              0.20108E-01,
0093                                              0.24405E-01,
0094                                              0.28550E-01};
0095 
0096 const float DTBNormParam::table_coeff[11] = {0.0,
0097                                              0.13900E-03,
0098                                              -0.16361E-02,
0099                                              -0.25234E-02,
0100                                              -0.39586E-02,
0101                                              -0.56774E-02,
0102                                              -0.70548E-02,
0103                                              -0.86567E-02,
0104                                              -0.10549E-01,
0105                                              -0.12765E-01,
0106                                              -0.14833E-01};
0107 
0108 DTBNormParam::ParamFunc::ParamFunc() {
0109   /*
0110    // default constructor: assume central bin ( 0 field )
0111    bin_bnorm = 0.0;
0112    offsc     = table_offsc;
0113    coeff     = table_coeff;
0114   */
0115 }
0116 
0117 DTBNormParam::ParamFunc::ParamFunc(int bin) {
0118   // store bound
0119   bin_bnorm = bin * 0.1;
0120   // select parameters inside tables
0121   offsc = table_offsc + bin;
0122   coeff = table_coeff + bin;
0123 }
0124 
0125 /*
0126 void DTBNormParam::ParamFunc::set(int bin) {
0127 
0128  // reset bound
0129  bin_bnorm = bin*0.1;
0130  // select parameters inside tables
0131  offsc     = table_offsc+bin;
0132  coeff     = table_coeff+bin;
0133 
0134 }
0135 */
0136 
0137 DTBNormParam::ParamFunc::~ParamFunc() {}
0138 
0139 float DTBNormParam::ParamFunc::tcor(float xpos) const {
0140   // compute drift time correction
0141   return *offsc + (*coeff * xpos);
0142 }