8 namespace MustacheKernel {
10 const float maxEta,
const float maxPhi,
const float ClustE,
const float ClusEta,
const float ClusPhi) {
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;
22 constexpr
float w00 = -0.00571429;
23 constexpr
float w01 = -0.002;
24 constexpr
float w10 = 0.0135714;
25 constexpr
float w11 = 0.001;
28 const float eta0xsineta0 =
maxEta * sineta0;
36 const float sqrt_log10_clustE =
std::sqrt(std::log10(ClustE) + 1.1);
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);
48 const float curv_up = eta0xsineta0 * (p00 * eta0xsineta0 + p01) + p02;
49 const float curv_low = eta0xsineta0 * (p10 * eta0xsineta0 + p11) + p12;
52 const float a_upper = (1 / (4 * curv_up)) - fabs(b_upper);
53 const float a_lower = (1 / (4 * curv_low)) - fabs(b_lower);
55 const double dphi = TVector2::Phi_mpi_pi(ClusPhi -
maxPhi);
56 const double dphi2 = dphi * dphi;
59 const float upper_cut = (
std::max((1. / (4. * a_upper)), 0.0) * dphi2 +
std::max(b_upper, 0.0087
f)) + 0.0087;
60 const float lower_cut = (
std::max((1. / (4. * a_lower)), 0.0) * dphi2 +
std::min(b_lower, -0.0087
f));
64 const float deta = (1 - 2 * (
maxEta < 0)) * (ClusEta -
maxEta);
65 return (deta < upper_cut && deta > lower_cut);
69 const float seedEta,
const float seedPhi,
const float ClustE,
const float ClusEta,
const float ClusPhi) {
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;
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;
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;
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;
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));
103 width = 1.0 / widthEB;
108 yoffset = yoffsetEE_0;
110 xoffset = xoffsetEE_0;
111 width = 1.0 / widthEE_0;
116 yoffset = yoffsetEE_1;
118 xoffset = xoffsetEE_1;
119 width = 1.0 / widthEE_1;
124 yoffset = yoffsetEE_2;
126 xoffset = xoffsetEE_2;
127 width = 1.0 / widthEE_2;
133 <<
"Calculated invalid eta bin = " <<
etaBin <<
" in \"inDynamicDPhiWindow\"" << std::endl;
138 maxdphi =
std::max(maxdphi, saturation);
140 return clusDphi < maxdphi;
152 void Mustache::MustacheID(
const std::vector<const CaloCluster*>&
clusters,
int& nclusters,
float& EoutsideMustache) {
153 MustacheID(
clusters.cbegin(),
clusters.cend(), nclusters, EoutsideMustache);
156 template <
class RandomAccessPtrIterator>
157 void Mustache::MustacheID(
const RandomAccessPtrIterator&
begin,
158 const RandomAccessPtrIterator&
end,
160 float& EoutsideMustache) {
162 EoutsideMustache = 0;
169 RandomAccessPtrIterator icl =
begin;
170 RandomAccessPtrIterator clmax =
end;
172 for (; icl !=
end; ++icl) {
173 const float e = (*icl)->energy();
183 float eta0 = (*clmax)->eta();
184 float phi0 = (*clmax)->phi();
188 for (; icl !=
end; ++icl) {
191 nclusters += (
int)!inMust;
192 EoutsideMustache += (!inMust) * ((*icl)->energy());
196 void Mustache::MustacheClust(
const std::vector<CaloCluster>&
clusters,
197 std::vector<unsigned int>& insideMust,
198 std::vector<unsigned int>& outsideMust) {
206 for (
unsigned int i = 0;
i < ncl; ++
i) {
217 float phi0 = (
clusters[imax]).phi();
219 for (
unsigned int k = 0;
k < ncl;
k++) {
224 outsideMust.push_back(
k);
226 insideMust.push_back(
k);
231 void Mustache::FillMustacheVar(
const std::vector<CaloCluster>&
clusters) {
232 Energy_In_Mustache_ = 0;
233 Energy_Outside_Mustache_ = 0;
234 LowestClusterEInMustache_ = 0;
237 std::multimap<float, unsigned int> OrderedClust;
238 std::vector<unsigned int> insideMust;
239 std::vector<unsigned int> outsideMust;
240 MustacheClust(
clusters, insideMust, outsideMust);
241 included_ = insideMust.size();
242 excluded_ = outsideMust.size();
243 for (
unsigned int i = 0;
i < insideMust.size(); ++
i) {
244 unsigned int index = insideMust[
i];
245 Energy_In_Mustache_ =
clusters[
index].energy() + Energy_In_Mustache_;
248 for (
unsigned int i = 0;
i < outsideMust.size(); ++
i) {
249 unsigned int index = outsideMust[
i];
250 Energy_Outside_Mustache_ =
clusters[
index].energy() + Energy_Outside_Mustache_;
253 std::multimap<float, unsigned int>::iterator it;
254 it = OrderedClust.begin();
255 unsigned int lowEindex = (*it).second;
256 LowestClusterEInMustache_ =
clusters[lowEindex].energy();