8 namespace MustacheKernel {
10 const float ClustE,
const float ClusEta,
28 const float sineta0 =
std::sin(maxEta);
29 const float eta0xsineta0 = maxEta*sineta0;
38 const float sqrt_log10_clustE =
std::sqrt(std::log10(ClustE)+1.1);
41 float b_upper = w10*eta0xsineta0 + w11 / sqrt_log10_clustE;
42 float b_lower = w00*eta0xsineta0 + w01 / sqrt_log10_clustE;
43 const float midpoint = 0.5*( b_upper + b_lower );
50 const float curv_up=eta0xsineta0*(p00*eta0xsineta0+p01)+p02;
51 const float curv_low=eta0xsineta0*(p10*eta0xsineta0+p11)+p12;
54 const float a_upper=(1/(4*curv_up))-fabs(b_upper);
55 const float a_lower = (1/(4*curv_low))-fabs(b_lower);
57 const double dphi=TVector2::Phi_mpi_pi(ClusPhi-maxPhi);
58 const double dphi2 = dphi*dphi;
61 const float upper_cut=(
std::max((1./(4.*a_upper)),0.0)*dphi2 +
63 const float lower_cut=(
std::max((1./(4.*a_lower)),0.0)*dphi2 +
69 const float deta=(1-2*(maxEta<0))*(ClusEta-
maxEta);
70 return (deta < upper_cut && deta > lower_cut);
74 const float ClustE,
const float ClusEta,
75 const float ClusPhi) {
87 constexpr double yoffsetEE_1 = -9.913e-02;
89 constexpr double xoffsetEE_1 = -5.326e+00;
92 constexpr double yoffsetEE_2 = -6.346e-01;
94 constexpr double xoffsetEE_2 = -7.037e+00;
98 const double absSeedEta =
std::abs(seedEta);
99 const int etaBin = ( (
int)(absSeedEta >= 1.479) +
100 (
int)(absSeedEta >= 1.75) +
101 (
int)(absSeedEta >= 2.0) );
102 const double logClustEt = std::log10(ClustE/std::cosh(ClusEta));
103 const double clusDphi =
std::abs(TVector2::Phi_mpi_pi(seedPhi -
118 yoffset = yoffsetEE_0;
120 xoffset = xoffsetEE_0;
121 width = 1.0/widthEE_0;
126 yoffset = yoffsetEE_1;
128 xoffset = xoffsetEE_1;
129 width = 1.0/widthEE_1;
134 yoffset = yoffsetEE_2;
136 xoffset = xoffsetEE_2;
137 width = 1.0/widthEE_2;
143 <<
"Calculated invalid eta bin = " << etaBin
144 <<
" in \"inDynamicDPhiWindow\"" << std::endl;
147 maxdphi = yoffset+scale/(1+
std::exp((logClustEt-xoffset)*width));
149 maxdphi =
std::max(maxdphi,saturation);
151 return clusDphi < maxdphi;
157 float & EoutsideMustache) {
159 nclusters, EoutsideMustache);
164 float & EoutsideMustache) {
165 MustacheID(clusters.
begin(),clusters.
end(),nclusters,EoutsideMustache);
168 void Mustache::MustacheID(
const std::vector<const CaloCluster*>&
clusters,
170 float & EoutsideMustache) {
171 MustacheID(clusters.cbegin(),clusters.cend(),nclusters,EoutsideMustache);
174 template<
class RandomAccessPtrIterator>
175 void Mustache::MustacheID(
const RandomAccessPtrIterator&
begin,
176 const RandomAccessPtrIterator&
end,
178 float & EoutsideMustache) {
180 EoutsideMustache = 0;
182 unsigned int ncl = end-
begin;
186 RandomAccessPtrIterator icl =
begin;
187 RandomAccessPtrIterator clmax =
end;
189 for( ; icl !=
end; ++icl){
190 const float e = (*icl)->energy();
197 if(end == clmax)
return;
199 float eta0 = (*clmax)->eta();
200 float phi0 = (*clmax)->phi();
205 for( ; icl !=
end; ++icl ){
211 nclusters += (
int)!inMust;
212 EoutsideMustache += (!inMust)*((*icl)->energy());
216 void Mustache::MustacheClust(
const std::vector<CaloCluster>&
clusters,
217 std::vector<unsigned int>& insideMust,
218 std::vector<unsigned int>& outsideMust){
219 unsigned int ncl = clusters.size();
225 for(
unsigned int i=0;
i<ncl; ++
i){
226 float e = (clusters[
i]).energy();
234 float eta0 = (clusters[imax]).
eta();
235 float phi0 = (clusters[imax]).phi();
238 for(
unsigned int k=0;
k<ncl;
k++){
241 (clusters[
k]).energy(),
243 (clusters[k]).phi());
246 outsideMust.push_back(k);
249 insideMust.push_back(k);
254 void Mustache::FillMustacheVar(
const std::vector<CaloCluster>&
clusters){
255 Energy_In_Mustache_=0;
256 Energy_Outside_Mustache_=0;
257 LowestClusterEInMustache_=0;
260 std::multimap<float, unsigned int>OrderedClust;
261 std::vector<unsigned int> insideMust;
262 std::vector<unsigned int> outsideMust;
263 MustacheClust(clusters, insideMust, outsideMust);
264 included_=insideMust.size(); excluded_=outsideMust.size();
265 for(
unsigned int i=0;
i<insideMust.size(); ++
i){
266 unsigned int index=insideMust[
i];
267 Energy_In_Mustache_=clusters[
index].energy()+Energy_In_Mustache_;
268 OrderedClust.insert(make_pair(clusters[index].energy(), index));
270 for(
unsigned int i=0;
i<outsideMust.size(); ++
i){
271 unsigned int index=outsideMust[
i];
272 Energy_Outside_Mustache_=clusters[
index].energy()+Energy_Outside_Mustache_;
274 +Et_Outside_Mustache_;
276 std::multimap<float, unsigned int>::iterator it;
277 it=OrderedClust.begin();
278 unsigned int lowEindex=(*it).second;
279 LowestClusterEInMustache_=clusters[lowEindex].energy();
bool inDynamicDPhiWindow(const float seedEta, const float seedPhi, const float ClustE, const float ClusEta, const float clusPhi)
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
common ppss p3p6s2 common epss epspn46 common const1 w10
common ppss p3p6s2 common epss epspn46 common const1 w11
const_iterator begin() const
Abs< T >::type abs(const T &t)
const_iterator end() const
static int position[264][3]
CaloCluster_iterator clustersBegin() const
fist iterator over BasicCluster constituents
bool inMustache(const float maxEta, const float maxPhi, const float ClustE, const float ClusEta, const float ClusPhi)
CaloCluster_iterator clustersEnd() const
last iterator over BasicCluster constituents