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=
std::max(eta0xsineta0*(p00*eta0xsineta0+p01)+p02,
52 const float curv_low=
std::max(eta0xsineta0*(p10*eta0xsineta0+p11)+p12,
56 const float a_upper=(1/(4*curv_up))-fabs(b_upper);
57 const float a_lower = (1/(4*curv_low))-fabs(b_lower);
60 const double dphi2 = dphi*dphi;
63 const float upper_cut=(
std::max((1./(4.*a_upper)),0.0)*dphi2 +
65 const float lower_cut=(
std::max((1./(4.*a_lower)),0.0)*dphi2 +
70 const float deta=(1-2*(maxEta<0))*(ClusEta-
maxEta);
71 return (deta < upper_cut && deta > lower_cut);
75 const float ClustE,
const float ClusEta,
76 const float ClusPhi) {
90 const double logClustEt =
std::log(ClustE/std::cosh(ClusEta));
94 maxdphi = (yoffsetEB + scaleEB/(1+
std::exp((logClustEt -
95 xoffsetEB)/widthEB)));
97 maxdphi = (yoffsetEE + scaleEE/(1+
std::exp((logClustEt -
98 xoffsetEE)/widthEE)));
100 maxdphi = ( logClustEt > 2.0 ) ? 0.15 : maxdphi;
101 maxdphi = ( logClustEt < -1.0 ) ? 0.6 : maxdphi;
103 return clusDphi < maxdphi;
109 float & EoutsideMustache) {
111 nclusters, EoutsideMustache);
116 float & EoutsideMustache) {
117 MustacheID(clusters.
begin(),clusters.
end(),nclusters,EoutsideMustache);
120 void Mustache::MustacheID(
const std::vector<const CaloCluster*>& clusters,
122 float & EoutsideMustache) {
123 MustacheID(clusters.cbegin(),clusters.cend(),nclusters,EoutsideMustache);
126 template<
class RandomAccessPtrIterator>
127 void Mustache::MustacheID(
const RandomAccessPtrIterator&
begin,
128 const RandomAccessPtrIterator&
end,
130 float & EoutsideMustache) {
132 EoutsideMustache = 0;
134 unsigned int ncl = end-
begin;
138 RandomAccessPtrIterator icl =
begin;
139 RandomAccessPtrIterator clmax =
end;
141 for( ; icl !=
end; ++icl){
142 const float e = (*icl)->energy();
149 if(end == clmax)
return;
151 float eta0 = (*clmax)->eta();
152 float phi0 = (*clmax)->phi();
157 for( ; icl !=
end; ++icl ){
163 nclusters += (int)!inMust;
164 EoutsideMustache += (!inMust)*((*icl)->energy());
168 void Mustache::MustacheClust(
const std::vector<CaloCluster>& clusters,
169 std::vector<unsigned int>& insideMust,
170 std::vector<unsigned int>& outsideMust){
171 unsigned int ncl = clusters.size();
177 for(
unsigned int i=0;
i<ncl; ++
i){
186 float eta0 = (clusters[imax]).
eta();
187 float phi0 = (clusters[imax]).
phi();
190 for(
unsigned int k=0;
k<ncl;
k++){
195 (clusters[k]).
phi());
198 outsideMust.push_back(k);
201 insideMust.push_back(k);
206 void Mustache::FillMustacheVar(
const std::vector<CaloCluster>& clusters){
207 Energy_In_Mustache_=0;
208 Energy_Outside_Mustache_=0;
209 LowestClusterEInMustache_=0;
212 std::multimap<float, unsigned int>OrderedClust;
213 std::vector<unsigned int> insideMust;
214 std::vector<unsigned int> outsideMust;
215 MustacheClust(clusters, insideMust, outsideMust);
216 included_=insideMust.size(); excluded_=outsideMust.size();
217 for(
unsigned int i=0;
i<insideMust.size(); ++
i){
218 unsigned int index=insideMust[
i];
219 Energy_In_Mustache_=clusters[
index].energy()+Energy_In_Mustache_;
220 OrderedClust.insert(make_pair(clusters[index].
energy(), index));
222 for(
unsigned int i=0;
i<outsideMust.size(); ++
i){
223 unsigned int index=outsideMust[
i];
224 Energy_Outside_Mustache_=clusters[
index].energy()+Energy_Outside_Mustache_;
226 +Et_Outside_Mustache_;
228 std::multimap<float, unsigned int>::iterator it;
229 it=OrderedClust.begin();
230 unsigned int lowEindex=(*it).second;
231 LowestClusterEInMustache_=clusters[lowEindex].energy();
bool inDynamicDPhiWindow(const bool isEE, 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
double Phi_mpi_pi(double x)
static int position[TOTALCHAMBERS][3]
common ppss p3p6s2 common epss epspn46 common const1 w11
const_iterator begin() const
const T & max(const T &a, const T &b)
const_iterator end() const
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