CMS 3D CMS Logo

Functions
reco::MustacheKernel Namespace Reference

Functions

bool inDynamicDPhiWindow (const float seedEta, const float seedPhi, const float ClustE, const float ClusEta, const float clusPhi)
 
bool inMustache (const float maxEta, const float maxPhi, const float ClustE, const float ClusEta, const float ClusPhi)
 

Function Documentation

bool reco::MustacheKernel::inDynamicDPhiWindow ( const float  seedEta,
const float  seedPhi,
const float  ClustE,
const float  ClusEta,
const float  clusPhi 
)

Definition at line 68 of file Mustache.cc.

References funct::abs(), constexpr, qjetsadder_cfi::cutoff, muonRecoAnalyzer_cfi::etaBin, Exception, JetChargeProducer_cfi::exp, createfilelist::int, SiStripPI::max, min(), Scenarios_cff::scale, and ApeEstimator_cff::width.

69  {
70  // from Rishi's fits 06 June 2013 in log base 10
71  constexpr double yoffsetEB = 7.151e-02;
72  constexpr double scaleEB = 5.656e-01;
73  constexpr double xoffsetEB = 2.931e-01;
74  constexpr double widthEB = 2.976e-01;
75 
76  constexpr double yoffsetEE_0 = 5.058e-02;
77  constexpr double scaleEE_0 = 7.131e-01;
78  constexpr double xoffsetEE_0 = 1.668e-02;
79  constexpr double widthEE_0 = 4.114e-01;
80 
81  constexpr double yoffsetEE_1 = -9.913e-02;
82  constexpr double scaleEE_1 = 4.404e+01;
83  constexpr double xoffsetEE_1 = -5.326e+00;
84  constexpr double widthEE_1 = 1.184e+00;
85 
86  constexpr double yoffsetEE_2 = -6.346e-01;
87  constexpr double scaleEE_2 = 1.317e+01;
88  constexpr double xoffsetEE_2 = -7.037e+00;
89  constexpr double widthEE_2 = 2.836e+00;
90 
91  const double absSeedEta = std::abs(seedEta);
92  const int etaBin = ((int)(absSeedEta >= 1.479) + (int)(absSeedEta >= 1.75) + (int)(absSeedEta >= 2.0));
93  const double logClustEt = std::log10(ClustE / std::cosh(ClusEta));
94  const double clusDphi = std::abs(TVector2::Phi_mpi_pi(seedPhi - ClusPhi));
95 
96  double yoffset, scale, xoffset, width, saturation, cutoff, maxdphi;
97 
98  switch (etaBin) {
99  case 0: // EB
100  yoffset = yoffsetEB;
101  scale = scaleEB;
102  xoffset = xoffsetEB;
103  width = 1.0 / widthEB;
104  saturation = 0.14;
105  cutoff = 0.60;
106  break;
107  case 1: // 1.479 -> 1.75
108  yoffset = yoffsetEE_0;
109  scale = scaleEE_0;
110  xoffset = xoffsetEE_0;
111  width = 1.0 / widthEE_0;
112  saturation = 0.14;
113  cutoff = 0.55;
114  break;
115  case 2: // 1.75 -> 2.0
116  yoffset = yoffsetEE_1;
117  scale = scaleEE_1;
118  xoffset = xoffsetEE_1;
119  width = 1.0 / widthEE_1;
120  saturation = 0.12;
121  cutoff = 0.45;
122  break;
123  case 3: // 2.0 and up
124  yoffset = yoffsetEE_2;
125  scale = scaleEE_2;
126  xoffset = xoffsetEE_2;
127  width = 1.0 / widthEE_2;
128  saturation = 0.12;
129  cutoff = 0.30;
130  break;
131  default:
132  throw cms::Exception("InValidEtaBin")
133  << "Calculated invalid eta bin = " << etaBin << " in \"inDynamicDPhiWindow\"" << std::endl;
134  }
135 
136  maxdphi = yoffset + scale / (1 + std::exp((logClustEt - xoffset) * width));
137  maxdphi = std::min(maxdphi, cutoff);
138  maxdphi = std::max(maxdphi, saturation);
139 
140  return clusDphi < maxdphi;
141  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T min(T a, T b)
Definition: MathUtil.h:58
#define constexpr
bool reco::MustacheKernel::inMustache ( const float  maxEta,
const float  maxPhi,
const float  ClustE,
const float  ClusEta,
const float  ClusPhi 
)

Definition at line 9 of file Mustache.cc.

References constexpr, f, SiStripPI::max, maxEta, min(), funct::sin(), mathSSE::sqrt(), w10, and w11.

Referenced by reco::Mustache::MustacheClust(), and reco::Mustache::MustacheID().

10  {
11  //bool inMust=false;
12  //float eta0 = maxEta;
13  //float phi0 = maxPhi;
14 
15  constexpr float p00 = -0.107537;
16  constexpr float p01 = 0.590969;
17  constexpr float p02 = -0.076494;
18  constexpr float p10 = -0.0268843;
19  constexpr float p11 = 0.147742;
20  constexpr float p12 = -0.0191235;
21 
22  constexpr float w00 = -0.00571429;
23  constexpr float w01 = -0.002;
24  constexpr float w10 = 0.0135714;
25  constexpr float w11 = 0.001;
26 
27  const float sineta0 = std::sin(maxEta);
28  const float eta0xsineta0 = maxEta * sineta0;
29 
30  //2 parabolas (upper and lower)
31  //of the form: y = a*x*x + b
32 
33  //b comes from a fit to the width
34  //and has a slight dependence on E on the upper edge
35  // this only works because of fine tuning :-D
36  const float sqrt_log10_clustE = std::sqrt(std::log10(ClustE) + 1.1);
37  // we need to have this in two steps, so that we don't improperly shift
38  // the lower bound!
39  float b_upper = w10 * eta0xsineta0 + w11 / sqrt_log10_clustE;
40  float b_lower = w00 * eta0xsineta0 + w01 / sqrt_log10_clustE;
41  const float midpoint = 0.5 * (b_upper + b_lower);
42  b_upper -= midpoint;
43  b_lower -= midpoint;
44 
45  //the curvature comes from a parabolic
46  //fit for many slices in eta given a
47  //slice -0.1 < log10(Et) < 0.1
48  const float curv_up = eta0xsineta0 * (p00 * eta0xsineta0 + p01) + p02;
49  const float curv_low = eta0xsineta0 * (p10 * eta0xsineta0 + p11) + p12;
50 
51  //solving for the curviness given the width of this particular point
52  const float a_upper = (1 / (4 * curv_up)) - fabs(b_upper);
53  const float a_lower = (1 / (4 * curv_low)) - fabs(b_lower);
54 
55  const double dphi = TVector2::Phi_mpi_pi(ClusPhi - maxPhi);
56  const double dphi2 = dphi * dphi;
57  // minimum offset is half a crystal width in either direction
58  // because science.
59  const float upper_cut = (std::max((1. / (4. * a_upper)), 0.0) * dphi2 + std::max(b_upper, 0.0087f)) + 0.0087;
60  const float lower_cut = (std::max((1. / (4. * a_lower)), 0.0) * dphi2 + std::min(b_lower, -0.0087f));
61 
62  //if(deta < upper_cut && deta > lower_cut) inMust=true;
63 
64  const float deta = (1 - 2 * (maxEta < 0)) * (ClusEta - maxEta); // sign flip deta
65  return (deta < upper_cut && deta > lower_cut);
66  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
common ppss p3p6s2 common epss epspn46 common const1 w10
Definition: inclppp.h:1
double maxEta
common ppss p3p6s2 common epss epspn46 common const1 w11
Definition: inclppp.h:1
T sqrt(T t)
Definition: SSEVec.h:19
double f[11][100]
T min(T a, T b)
Definition: MathUtil.h:58
#define constexpr