7 namespace MustacheKernel {
13 const float ClusPhi) {
14 const auto log10ClustE = std::log10(ClustE);
15 const auto parabola_params =
params->parabolaParameters(log10ClustE,
std::abs(ClusEta));
16 if (!parabola_params) {
21 const float eta0xsineta0 =
maxEta * sineta0;
29 const float sqrt_log10_clustE =
std::sqrt(log10ClustE +
params->sqrtLogClustETuning());
31 parabola_params->w1Up[0] * eta0xsineta0 + parabola_params->w1Up[1] / sqrt_log10_clustE -
32 0.5 * (parabola_params->w1Up[0] * eta0xsineta0 + parabola_params->w1Up[1] / sqrt_log10_clustE +
33 parabola_params->w0Up[0] * eta0xsineta0 + parabola_params->w0Up[1] / sqrt_log10_clustE);
35 parabola_params->w0Low[0] * eta0xsineta0 + parabola_params->w0Low[1] / sqrt_log10_clustE -
36 0.5 * (parabola_params->w1Low[0] * eta0xsineta0 + parabola_params->w1Low[1] / sqrt_log10_clustE +
37 parabola_params->w0Low[0] * eta0xsineta0 + parabola_params->w0Low[1] / sqrt_log10_clustE);
43 eta0xsineta0 * (parabola_params->pUp[0] * eta0xsineta0 + parabola_params->pUp[1]) + parabola_params->pUp[2];
44 const float curv_low = eta0xsineta0 * (parabola_params->pLow[0] * eta0xsineta0 + parabola_params->pLow[1]) +
45 parabola_params->pLow[2];
48 const float a_upper = (1. / (4. * curv_up)) -
std::abs(b_upper);
49 const float a_lower = (1. / (4. * curv_low)) -
std::abs(b_lower);
51 const double dphi = TVector2::Phi_mpi_pi(ClusPhi -
maxPhi);
52 const double dphi2 = dphi * dphi;
55 constexpr
float half_crystal_width = 0.0087;
56 const float upper_cut =
57 (
std::max((1. / (4. * a_upper)), 0.0) * dphi2 +
std::max(b_upper, half_crystal_width)) + half_crystal_width;
58 const float lower_cut = (
std::max((1. / (4. * a_lower)), 0.0) * dphi2 +
std::min(b_lower, -half_crystal_width));
60 const float deta = (1 - 2 * (
maxEta < 0)) * (ClusEta -
maxEta);
61 return (deta < upper_cut && deta > lower_cut);
69 const float ClusPhi) {
70 const double absSeedEta =
std::abs(seedEta);
71 const double logClustEt = std::log10(ClustE / std::cosh(ClusEta));
72 const double clusDphi =
std::abs(TVector2::Phi_mpi_pi(seedPhi - ClusPhi));
74 const auto dynamicDPhiParams =
params->dynamicDPhiParameters(ClustE, absSeedEta);
75 if (!dynamicDPhiParams) {
79 auto maxdphi = dynamicDPhiParams->yoffset +
80 dynamicDPhiParams->scale /
81 (1. +
std::exp((logClustEt - dynamicDPhiParams->xoffset) / dynamicDPhiParams->width));
82 maxdphi =
std::min(maxdphi, dynamicDPhiParams->cutoff);
83 maxdphi =
std::max(maxdphi, dynamicDPhiParams->saturation);
85 return clusDphi < maxdphi;
103 template <
class RandomAccessPtrIterator>
105 const RandomAccessPtrIterator&
end,
107 float& EoutsideMustache) {
109 EoutsideMustache = 0;
111 unsigned int ncl =
end - begin;
116 RandomAccessPtrIterator icl = begin;
117 RandomAccessPtrIterator clmax =
end;
119 for (; icl !=
end; ++icl) {
120 const float e = (*icl)->energy();
130 float eta0 = (*clmax)->eta();
131 float phi0 = (*clmax)->phi();
135 for (; icl !=
end; ++icl) {
138 nclusters += (
int)!inMust;
139 EoutsideMustache += (!inMust) * ((*icl)->energy());
144 std::vector<unsigned int>& insideMust,
145 std::vector<unsigned int>& outsideMust) {
153 for (
unsigned int i = 0;
i < ncl; ++
i) {
164 float phi0 = (
clusters[imax]).phi();
166 for (
unsigned int k = 0;
k < ncl;
k++) {
171 outsideMust.push_back(
k);
173 insideMust.push_back(
k);
184 std::multimap<float, unsigned int> OrderedClust;
185 std::vector<unsigned int> insideMust;
186 std::vector<unsigned int> outsideMust;
190 for (
unsigned int i = 0;
i < insideMust.size(); ++
i) {
191 unsigned int index = insideMust[
i];
195 for (
unsigned int i = 0;
i < outsideMust.size(); ++
i) {
196 unsigned int index = outsideMust[
i];
200 std::multimap<float, unsigned int>::iterator it;
201 it = OrderedClust.begin();
202 unsigned int lowEindex = (*it).second;