File indexing completed on 2023-03-17 13:02:39
0001 #include "Geometry/CSCGeometry/interface/CSCGattiFunction.h"
0002 #include "Geometry/CSCGeometry/interface/CSCChamberSpecs.h"
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 #include <cmath>
0005 #ifndef M_PI_2
0006 #define M_PI_2 1.57079632679489661923
0007 #endif
0008
0009 CSCGattiFunction::CSCGattiFunction() : k1(0.), k2(0.), k3(0.), h(0.), norm(0.), sqrtk3(0.), thePreviousSpecs(nullptr) {}
0010
0011 void CSCGattiFunction::initChamberSpecs(const CSCChamberSpecs& chamberSpecs) {
0012 if (&chamberSpecs != thePreviousSpecs) {
0013 LogTrace("CSCGattiFunction") << "CSCGattiFunction::initChamberSpecs setting new values.";
0014 h = chamberSpecs.anodeCathodeSpacing();
0015 double s = chamberSpecs.wireSpacing();
0016 double ra = chamberSpecs.wireRadius();
0017 static const double parm[5] = {.1989337e-02, -.6901542e-04, .8665786, 154.6177, -.6801630e-03};
0018 k3 = (parm[0] * s / h + parm[1]) * (parm[2] * s / ra + parm[3] + parm[4] * s * s / ra / ra);
0019 sqrtk3 = sqrt(k3);
0020 norm = 0.5 / std::atan(sqrtk3);
0021 k2 = M_PI_2 * (1. - sqrtk3 / 2.);
0022 k1 = 0.25 * k2 * sqrtk3 / std::atan(sqrtk3);
0023 thePreviousSpecs = &chamberSpecs;
0024 }
0025
0026 LogTrace("CSCGattiFunction") << "CSCGattiFunction: constants k1=" << k1 << ", k2=" << k2 << ", k3=" << k3
0027 << ", h=" << h << ", norm=" << norm;
0028 }
0029
0030 double CSCGattiFunction::binValue(double x, double stripWidth) const {
0031 double tanh1 = tanh(k2 * (x + stripWidth * 0.5) / h);
0032 double tanh2 = tanh(k2 * (x - stripWidth * 0.5) / h);
0033 return norm * (std::atan(sqrtk3 * tanh1) - std::atan(sqrtk3 * tanh2));
0034 }