Go to the documentation of this file.00001
00002 #include "RecoLocalTracker/SiStripRecHitConverter/interface/StripCPEfromTemplate.h"
00003 #include "Geometry/CommonTopologies/interface/StripTopology.h"
00004
00005
00006
00007 namespace {
00008 inline
00009 float stripErrorSquared(const unsigned N, const float uProj) {
00010 if( (float(N)-uProj) > 3.5f )
00011 return float(N*N)/12.f;
00012 else {
00013 const float P1=-0.339f;
00014 const float P2=0.90f;
00015 const float P3=0.279f;
00016 const float uerr = P1*uProj*std::exp(-uProj*P2)+P3;
00017 return uerr*uerr;
00018 }
00019 }
00020 }
00021
00022 StripClusterParameterEstimator::LocalValues
00023 StripCPEfromTemplate::localParameters( const SiStripCluster& cluster,
00024 const GeomDetUnit& det,
00025 const LocalTrajectoryParameters& ltp) const
00026 {
00027 StripClusterParameterEstimator::LocalValues final_lv;
00028
00029 LocalPoint final_lp;
00030 LocalError final_le;
00031
00032
00033
00034 StripCPE::Param const& p = param( det );
00035
00036 LocalVector track = ltp.momentum();
00037 track *=
00038 ( track.z()<0 ) ? fabs( p.thickness/track.z() ) :
00039 ( track.z()>0 ) ? -fabs( p.thickness/track.z() ) :
00040 p.maxLength/track.mag() ;
00041
00042 const unsigned N = cluster.amplitudes().size();
00043
00044 const float fullProjection = p.coveredStrips( track+p.drift, ltp.position());
00045
00046 const float strip = cluster.barycenter() - 0.5f*(1.f-p.backplanecorrection) * fullProjection
00047 + 0.5f*p.coveredStrips(track, ltp.position());
00048
00049 LocalPoint default_lp = p.topology->localPosition( strip, ltp.vector() );
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 float uerr2 = -99999.9;
00060 float split_cluster_error = cluster.getSplitClusterError();
00061
00062 float local_pitch = p.topology->localPitch( default_lp );
00063
00064 if ( split_cluster_error > 0.0 && use_strip_split_cluster_errors )
00065 {
00066
00067
00068
00069
00070 uerr2 =
00071 (split_cluster_error/10000.0 / local_pitch ) *
00072 (split_cluster_error/10000.0 / local_pitch );
00073 }
00074 else
00075 {
00076
00077
00078 uerr2 = stripErrorSquared( N, fabs(fullProjection) );
00079 }
00080
00081
00082 LocalError default_le = p.topology->localError( strip, uerr2, ltp.vector() );
00083
00084
00085
00086
00087
00088 int ierr = 9999999;
00089 float template_x_pos = -9999999.9;
00090 float template_x_err = -9999999.9;
00091
00092
00093
00094
00095 if ( use_template_reco )
00096 {
00097
00098 int id = -9999999;
00099
00100 SiStripDetId ssdid = SiStripDetId( det.geographicalId() );
00101
00102 int is_stereo = (int)( ssdid.stereo() );
00103
00104 if ( p.moduleGeom == 1 )
00105 {
00106 if ( !is_stereo )
00107 id = 11;
00108 else
00109 id = 12;
00110 }
00111 else if ( p.moduleGeom == 2 )
00112 {
00113 id = 13;
00114 }
00115 else if ( p.moduleGeom == 3 )
00116 {
00117 id = 16;
00118 }
00119 else if ( p.moduleGeom == 4 )
00120 {
00121 if ( !is_stereo )
00122 id = 14;
00123 else
00124 id = 15;
00125 }
00126
00127
00128
00129 StripGeomDetUnit* stripdet = (StripGeomDetUnit*)(&det);
00130
00131 if ( (id > -9999999) && !(stripdet == 0) )
00132 {
00133
00134 float cotalpha = -9999999.9;
00135 float cotbeta = -9999999.9;
00136 float locBy = -9999999.9;
00137 std::vector<float> vec_cluster_charge;
00138
00139
00140 float xrec = -9999999.9;
00141 float sigmax = -9999999.9;
00142 float probx = -9999999.9;
00143 int qbin = -9999999 ;
00144 int speed = template_reco_speed ;
00145 float probQ = -9999999.9;
00146
00147
00148 LocalVector lbfield = ( stripdet->surface() ).toLocal( magfield_.inTesla( stripdet->surface().position() ) );
00149 locBy = lbfield.y();
00150
00151
00152 LocalVector localDir = ltp.momentum()/ltp.momentum().mag();
00153 float locx = localDir.x();
00154 float locy = localDir.y();
00155 float locz = localDir.z();
00156 cotalpha = locx/locz;
00157 cotbeta = locy/locz;
00158
00159
00160 int cluster_size = (int)( (cluster.amplitudes()).size() );
00161 for (int i=0; i<cluster_size; ++i)
00162 {
00163 vec_cluster_charge.push_back( (float)( (cluster.amplitudes())[i] ) );
00164 }
00165
00166
00167 float measurement_position_first_strip_center = (float)(cluster.firstStrip()) + 0.5;
00168
00169 LocalPoint local_position_first_strip_center
00170 = p.topology->localPosition( measurement_position_first_strip_center, ltp.vector() );
00171
00172
00173 ierr = SiStripTemplateReco::StripTempReco1D( id,
00174 cotalpha,
00175 cotbeta,
00176 locBy,
00177 vec_cluster_charge,
00178 templ,
00179 xrec,
00180 sigmax,
00181 probx,
00182 qbin,
00183 speed,
00184 probQ );
00185
00186
00187
00188
00189
00190
00191
00192 template_x_pos = xrec / 10000.0 + local_position_first_strip_center.x();
00193
00194 if ( split_cluster_error > 0.0 && use_strip_split_cluster_errors )
00195 {
00196 template_x_err = split_cluster_error/10000.0;
00197 }
00198 else
00199 {
00200 template_x_err = sigmax/10000.0;
00201 }
00202
00203
00204 }
00205
00206 }
00207
00208
00209 if ( use_template_reco && ierr == 0 )
00210 {
00211
00212
00213 LocalPoint template_lp( template_x_pos , default_lp.y() , default_lp.z() );
00214 LocalError template_le( template_x_err*template_x_err, default_le.xy(), default_le.yy() );
00215
00216
00217 final_lv = std::make_pair( template_lp, template_le );
00218
00219 }
00220 else
00221 {
00222
00223
00224 final_lv = std::make_pair( default_lp, default_le );
00225 }
00226
00227 return final_lv;
00228
00229
00230 }
00231
00232
00233