7 namespace MustacheKernel {
13 const float ClusPhi) {
14 const auto log10ClustE = std::log10(ClustE);
16 if (!parabola_params) {
20 const float sineta0 =
std::sin(maxEta);
21 const float eta0xsineta0 = maxEta * sineta0;
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));
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;
100 MustacheID(clusters.cbegin(), clusters.cend(), nclusters, EoutsideMustache);
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) {
146 unsigned int ncl = clusters.size();
153 for (
unsigned int i = 0;
i < ncl; ++
i) {
163 float eta0 = (clusters[imax]).
eta();
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];
193 OrderedClust.insert(make_pair(clusters[index].
energy(), index));
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;
const DynamicDPhiParameters * dynamicDPhiParameters(double clustE, double absSeedEta) const
void MustacheID(const CaloClusterPtrVector &clusters, int &nclusters, float &EoutsideMustache)
void MustacheClust(const std::vector< CaloCluster > &clusters, std::vector< unsigned int > &insideMust, std::vector< unsigned int > &outsideMust)
const ParabolaParameters * parabolaParameters(float log10ClustE, float absSeedEta) const
float Energy_In_Mustache_
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
bool inMustache(const EcalMustacheSCParameters *params, const float maxEta, const float maxPhi, const float ClustE, const float ClusEta, const float ClusPhi)
Exp< T >::type exp(const T &t)
const_iterator begin() const
float LowestClusterEInMustache_
float Et_Outside_Mustache_
Abs< T >::type abs(const T &t)
const_iterator end() const
float sqrtLogClustETuning() const
bool inDynamicDPhiWindow(const EcalSCDynamicDPhiParameters *params, const float seedEta, const float seedPhi, const float ClustE, const float ClusEta, const float clusPhi)
static int position[264][3]
float Energy_Outside_Mustache_
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
const EcalMustacheSCParameters * mustache_params_
void FillMustacheVar(const std::vector< CaloCluster > &clusters)
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents