Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 69689
b: "refs/heads/CMSSW_6_2_X_SLHC"
c: 6a291c4
h: "refs/heads/CMSSW_6_2_X_SLHC"
i:
  69687: e7a3508
  • Loading branch information
Burt Betchart committed Jul 9, 2009
1 parent b66b87d commit 597b9f3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 50 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
refs/heads/gh-pages: 4bec1f03ca2f14e90d0ca17351c4d42d84ec2c82
"refs/heads/CMSSW_6_2_X_SLHC": 021b10d8291103d81f99dcff5596fe97203f05fe
"refs/heads/CMSSW_6_2_X_SLHC": 6a291c463fb79017e047d00d2a8de0d02f284bf8
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ StripCPEgeometric::StripCPEgeometric( edm::ParameterSet& conf,
thickness_rel_err2(pow(conf.getParameter<double>("ThicknessRelativeUncertainty"), 2)),
noise_threshold(conf.getParameter<double>("NoiseThreshold")),
maybe_noise_threshold(conf.getParameter<double>("MaybeNoiseThreshold")),
scaling_squared(pow(conf.getParameter<double>("UncertaintyScaling"), 2))
scaling_squared(pow(conf.getParameter<double>("UncertaintyScaling"), 2)),
minimum_uncertainty_squared(pow(conf.getParameter<double>("MinimumUncertainty"),2))
{
std::string mode = conf.getParameter<bool>("APVpeakmode") ? "Peak" : "Dec";
crosstalk.resize(7,0);
Expand All @@ -37,19 +38,17 @@ localParameters( const SiStripCluster& cluster, const LocalTrajectoryParameters&
(track.z()>0) ? -fabs(p.thickness/track.z()) :
p.maxLength/track.mag() ;

const std::vector<stats_t<float> > Q = reco::InverseCrosstalkMatrix::unfold( cluster.amplitudes(), crosstalk[p.subdet] );

const stats_t<float> projection = find_projection( p, track, pos );

const std::vector<stats_t<float> > Q = reco::InverseCrosstalkMatrix::unfold( cluster.amplitudes(), crosstalk[p.subdet] );
const stats_t<float> strip = cluster.firstStrip() + offset_from_firstStrip( Q, projection );

const float corrected = p.driftCorrected( strip() , pos );

const float error2 = std::max( strip.error2(), minimum_uncertainty_squared );

return std::make_pair( p.topology->localPosition( corrected ),
p.topology->localError( corrected, strip.error2() ) );
p.topology->localError( corrected, error2 ) );
}


stats_t<float> StripCPEgeometric::
find_projection(const StripCPE::Param& p, const LocalVector& track, const LocalPoint& position) const {
const float projection = fabs( p.coveredStrips( track+p.drift, position ));
Expand All @@ -58,26 +57,23 @@ find_projection(const StripCPE::Param& p, const LocalVector& track, const LocalP
return stats_t<float>::from_relative_uncertainty2( std::max(projection, minProjection), projection_rel_err2);
}


stats_t<float> StripCPEgeometric::
offset_from_firstStrip( const std::vector<stats_t<float> >& Q, const stats_t<float>& proj) const {
WrappedCluster wc(Q);
while( useNMinusOne( wc, proj) )
wc.dropSmallerEdgeStrip();

if( proj() < wc.N-2 || wc.deformed() )
return stats_t<float>( wc.middle(), wc.N * wc.N / 12.);
if( useNPlusOne( wc, proj)) wc.addSuppressedEdgeStrip(); else
while( useNMinusOne( wc, proj)) wc.dropSmallerEdgeStrip();

if( proj > wc.maxProjection() )
return stats_t<float>( wc.centroid()(), 1 / 12.);
if( proj() < wc.N-2 ) return stats_t<float>( wc.middle(), pow(wc.N-proj(),2) / 12.);
if( wc.deformed() ) return stats_t<float>( wc.centroid()(), 1 / 12.);
if( proj() > wc.N+1 ) return stats_t<float>( wc.centroid()(), 1 / 12.);

if( wc.N > 1 && wc.smallerEdgeStrip().sigmaFrom(0) < maybe_noise_threshold ) {
WrappedCluster wc2(wc);
wc2.dropSmallerEdgeStrip();
return between_positions( geometric_position( wc, proj),
geometric_position( wc2, proj) );
if( proj() < wc.N-1 && wc.smallerEdgeStrip().sigmaFrom(0) < maybe_noise_threshold ) {
const stats_t<float> probably = geometric_position( wc, proj);
wc.dropSmallerEdgeStrip();
const stats_t<float> maybe = geometric_position( wc, proj);
return stats_t<float>( probably(), std::max( probably.error2(), maybe.error2() + pow( probably()-maybe() ,2)/12 ) );
}
return geometric_position(wc, proj);
return geometric_position( wc, proj);
}

stats_t<float> StripCPEgeometric::
Expand All @@ -89,41 +85,42 @@ geometric_position(const StripCPEgeometric::WrappedCluster& wc, const stats_t<fl
}

inline
stats_t<float> StripCPEgeometric::
between_positions(const stats_t<float>& one, const stats_t<float>& two) const {
const float position = ( one() + two() ) / 2;
const float error = fabs(position-one()) + std::max(one.error(), two.error());
return stats_t<float>( position, error*error );
}
bool StripCPEgeometric::
useNPlusOne(const WrappedCluster& wc, const stats_t<float>& proj) const
{ return wc.maxProjection() < proj && proj() < wc.N+1; }

inline
bool StripCPEgeometric::
useNMinusOne(const WrappedCluster& wc, const stats_t<float>& proj) const {
if( proj() > wc.N-1 ||
wc.smallerEdgeStrip().sigmaFrom(0) > maybe_noise_threshold )
return false;
if( wc.smallerEdgeStrip() < 0 ||
proj() < wc.N-2)
return true;
if( proj() > wc.N-1) return false;
if( wc.smallerEdgeStrip() < 0 ) return true;
if( proj() < wc.N-3) return false;
if( proj() < wc.N-2) return true;
if( wc.eta().sigmaFrom(0) < 3) return false;

WrappedCluster wcTest(wc); wcTest.dropSmallerEdgeStrip();
if( proj >= wcTest.maxProjection() ||
wc.eta().sigmaFrom(0) < 3 ) return false;
if( proj >= wcTest.maxProjection() ) return false;
if( wc.sign()*wc.eta()() > 1./(wc.N-1) ) return true;
if( wc.N==2 || wc.N==3) {
return wc.smallerEdgeStrip().sigmaFrom(0) < noise_threshold;
}
return wcTest.dedxRatio(proj).sigmaFrom(1) < wc.dedxRatio(proj).sigmaFrom(1) ;

return wc.smallerEdgeStrip().sigmaFrom(0) < noise_threshold;
}


StripCPEgeometric::WrappedCluster::
WrappedCluster(const std::vector<stats_t<float> >& Q) :
N(Q.size()),
Qbegin(Q.begin()),
first(Q.begin())
N(Q.size()-2),
clusterFirst(Q.begin()+1),
first(clusterFirst)
{}

inline
void StripCPEgeometric::WrappedCluster::
addSuppressedEdgeStrip() {
if( *first > last() ) { first--; N+=1; } else
if( last() > *first ) { N+=1; } else
{ first--; N+=2; }
}

inline
void StripCPEgeometric::WrappedCluster::
dropSmallerEdgeStrip() {
Expand All @@ -135,13 +132,13 @@ dropSmallerEdgeStrip() {
inline
float StripCPEgeometric::WrappedCluster::
middle() const
{ return (first-Qbegin) + N/2.;}
{ return (first-clusterFirst) + N/2.;}

inline
stats_t<float> StripCPEgeometric::WrappedCluster::
centroid() const {
stats_t<float> sumXQ(0);
for(std::vector<stats_t<float> >::const_iterator i = first; i<first+N; i++) sumXQ += (i-Qbegin)*(*i);
for(std::vector<stats_t<float> >::const_iterator i = first; i<first+N; i++) sumXQ += (i-clusterFirst)*(*i);
return sumXQ/sumQ() + 0.5;
}

Expand Down Expand Up @@ -170,11 +167,6 @@ stats_t<float> StripCPEgeometric::WrappedCluster::
smallerEdgeStrip() const
{ return std::min(*first, last()); }

inline
stats_t<float> StripCPEgeometric::WrappedCluster::
dedxRatio(const stats_t<float>& projection) const
{ return ( sumQ()/(*first+last()) - 1 ) * ( projection/(N-2) - 1 ); }

inline
int StripCPEgeometric::WrappedCluster::
sign() const
Expand Down

0 comments on commit 597b9f3

Please sign in to comment.