CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/Geometry/CSCGeometry/src/CSCGattiFunction.cc

Go to the documentation of this file.
00001 #include "Geometry/CSCGeometry/interface/CSCGattiFunction.h"
00002 #include "Geometry/CSCGeometry/interface/CSCChamberSpecs.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include <cmath>
00005 #ifndef M_PI_2
00006 #define M_PI_2 1.57079632679489661923
00007 #endif
00008 
00009 
00010 CSCGattiFunction::CSCGattiFunction()
00011 : k1(0.), 
00012   k2(0.), 
00013   k3(0.), 
00014   h(0.),
00015   norm(0.),
00016   sqrtk3(0.),
00017   thePreviousSpecs(0)
00018 {
00019 }
00020 
00021 
00022 void CSCGattiFunction::initChamberSpecs(const CSCChamberSpecs & chamberSpecs) {
00023   if(&chamberSpecs != thePreviousSpecs) {
00024     LogTrace("CSCGattiFunction") << "CSCGattiFunction::initChamberSpecs setting new values.";
00025     h = chamberSpecs.anodeCathodeSpacing();
00026     double s = chamberSpecs.wireSpacing();
00027     double ra = chamberSpecs.wireRadius();
00028     static const double parm[5] = {.1989337e-02, -.6901542e-04,  .8665786, 
00029                                    154.6177, -.6801630e-03 };
00030     k3 = (parm[0]*s/h + parm[1]) 
00031            * (parm[2]*s/ra + parm[3] + parm[4]*s*s/ra/ra);
00032     sqrtk3 = sqrt(k3);
00033     norm = 0.5 / std::atan( sqrtk3 );
00034     k2 = M_PI_2 * (1. - sqrtk3/2.);
00035     k1 = 0.25 * k2 * sqrtk3 / std::atan(sqrtk3);
00036     thePreviousSpecs = &chamberSpecs;
00037   }
00038 
00039   LogTrace("CSCGattiFunction")  << "CSCGattiFunction: constants k1=" << 
00040       k1 << ", k2=" << k2 << ", k3=" << k3 << 
00041       ", h=" << h << ", norm=" << norm;
00042 }
00043 
00044 
00045 double CSCGattiFunction::binValue( double x, double stripWidth) const {
00046   double tanh1 = tanh(k2 * (x+stripWidth*0.5)/h );
00047   double tanh2 = tanh(k2 * (x-stripWidth*0.5)/h );
00048   return norm * ( std::atan(sqrtk3*tanh1) - std::atan(sqrtk3*tanh2) );
00049 }
00050