17 : m_points ( 0 ), m_hit_E_unattenuated_sum(0.0), m_point_reatten_E_sum(0.0), m_z_target_center(z_target_center), new_point_q(q), m_BCALGeom(locGeom) {
39 if(
phi() > point->
phi() ){
41 if( fabs(
phi() - point->
phi() - 2*TMath::Pi() ) < TMath::Pi() ) point->
add2Pi();
45 if( fabs( point->
phi() -
phi() - 2*TMath::Pi() ) < TMath::Pi() ) point->
sub2Pi();
58 if(
phi() > point->
phi() ){
60 if( fabs(
phi() - point->
phi() - 2*TMath::Pi() ) < TMath::Pi() ) point->
add2Pi();
64 if( fabs( point->
phi() -
phi() - 2*TMath::Pi() ) < TMath::Pi() ) point->
sub2Pi();
85 AddAssociatedObject( hit );
94 vector< const DBCALPoint* > otherPoints = clust.
points();
96 for( vector< const DBCALPoint* >::const_iterator pt = otherPoints.begin();
97 pt != otherPoints.end();
102 if(
phi() > (**pt).phi() ){
104 if( fabs(
phi() - (**pt).phi() - 2*TMath::Pi() ) < TMath::Pi() ) (**pt).add2Pi();
108 if( fabs( (**pt).phi() -
phi() - 2*TMath::Pi() ) < TMath::Pi() ) (**pt).sub2Pi();
114 vector<pair<const DBCALUnifiedHit*,double> > otherHits = clust.
hits();
116 for( vector<pair<const DBCALUnifiedHit*,double> >::const_iterator hit = otherHits.begin();
117 hit != otherHits.end();
122 AddAssociatedObject( hit->first );
167 if (n==0)
printf(
"0 point cluster\n");
169 for( vector< const DBCALPoint* >::const_iterator pt =
m_points.begin();
172 if ((**pt).layer() == 4) n4++;
178 average_layer4 =
true;
181 average_layer4 =
false;
186 double sum_wt1_sq = 0;
188 double sum_wt2_sq = 0;
190 double sum_sin_phi=0;
191 double sum_cos_phi=0;
195 for( vector< const DBCALPoint* >::const_iterator pt =
m_points.begin();
198 double E = (**pt).E();
199 double z = (**pt).z();
207 if ((**pt).layer() == 2)
m_E_L2 += E;
208 if ((**pt).layer() == 3)
m_E_L3 += E;
209 if ((**pt).layer() == 4)
m_E_L4 += E;
212 if ( ( m_point_reatten_E_sum == 0 && ( (**pt).layer() != 4 || average_layer4 ) ) ) {
215 }
else if ( ( (**pt).layer() != 4 || average_layer4 ) && z > min_z && z < max_z ) {
224 sum_wt1_sq += wt1*wt1;
226 sum_wt2_sq += wt2*wt2;
228 m_t += (**pt).tInnerRadius() * wt2;
229 m_sig_t += (**pt).tInnerRadius() * (**pt).tInnerRadius() * wt2;
230 t_mean += (**pt).t();
232 m_theta += (**pt).theta() * wt2;
233 m_sig_theta += (**pt).theta() * (**pt).theta() * wt2;
235 sum_sin_phi +=
sin((**pt).phi()) * wt1;
236 sum_cos_phi += cos((**pt).phi()) * wt1;
238 m_rho += (**pt).rho() * wt2;
239 m_sig_rho += (**pt).rho() * (**pt).rho() * wt2;
247 double n_eff2 = sum_wt2*sum_wt2/sum_wt2_sq;
270 m_phi = atan2(sum_sin_phi,sum_cos_phi);
275 float t_quad_sum = 0.;
277 for( vector< const DBCALPoint* >::const_iterator pt =
m_points.begin();
281 double E = (**pt).E();
284 if ((**pt).layer() != 4) {
290 double deltaPhi = (**pt).phi() -
m_phi;
291 double deltaPhiAlt = ( (**pt).phi() >
m_phi ?
292 (**pt).phi() -
m_phi - 2*TMath::Pi() :
293 m_phi - (**pt).phi() - 2*TMath::Pi() );
294 deltaPhi =
min( fabs( deltaPhi ), fabs( deltaPhiAlt ) );
297 float t = (**pt).t();
298 t_quad_sum += (t-t_mean)*(t-t_mean);
326 if (z > bcal_down) z = bcal_down;
327 if (z < bcal_up) z = bcal_up;
331 if (r > r_max) r = r_max;
332 if (r < r_min) r = r_min;
334 m_theta = atan2(r, (z-m_z_target_center));
335 m_rho =
sqrt(r*r + (z-m_z_target_center)*(z-m_z_target_center));
361 if(
m_phi > 2*TMath::Pi() )
m_phi -= 2*TMath::Pi();
369 AddString(items,
"phi",
"%5.2f",
m_phi );
372 AddString(items,
"theta",
"%5.2f",
m_theta);
374 AddString(items,
"t",
"%5.2f",
m_t );
375 AddString(items,
"E",
"%5.2f",
m_E );
377 AddString(items,
"E_L2",
"%5.2f",
m_E_L2 );
378 AddString(items,
"E_L3",
"%5.2f",
m_E_L3 );
379 AddString(items,
"E_L4",
"%5.2f",
m_E_L4 );
380 AddString(items,
"N_cell",
"%i",
m_points.size() );
381 AddString(items,
"charge",
"%i",
charge );
382 AddString(items,
"t_rms",
"%5.2f",
m_t_rms );
vector< const DBCALPoint * > m_points
void toStrings(vector< pair< string, string > > &items) const
void mergeClust(const DBCALCluster &clust, double point_reatten_E)
const DBCALGeometry * m_BCALGeom
float GetBCAL_length() const
void addHit(const DBCALUnifiedHit *hit, double hit_E_unattenuated)
vector< pair< const DBCALUnifiedHit *, double > > m_single_ended_hits
float m_point_reatten_E_sum
vector< pair< const DBCALUnifiedHit *, double > > hits() const
float GetBCAL_inner_rad() const
float r(int fADC_cellId) const
vector< const DBCALPoint * > points() const
void addPoint(const DBCALPoint *point, int q)
void removePoint(const DBCALPoint *point)
float GetBCAL_center() const
DBCALCluster(double z_target_center, const DBCALGeometry *locGeom)
int cellId(int module, int layer, int sector) const
these functions are about encoding/decoding module/layer/sector info in a cellId
printf("string=%s", string)
float m_hit_E_unattenuated_sum