23 #include "gsl/gsl_statistics.h"
36 double pt[16] = { 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. };
39 double spt[8] = { 1/0.048 , 1/0.075 , 1/0.226 , 1/0.132 , 1/0.106 , 1/0.175 , 1/0.125 , 1/0.185 };
50 LogTrace(metname) <<
" Pt MB1 @vtx: " << pt[0] <<
" w: " << spt[0] <<
"\n"
51 <<
" Pt MB2 @vtx: " << pt[1] <<
" w: " << spt[1]<< endl ;
53 LogTrace(metname) <<
" Pt MB2-MB1 " << pt[2] <<
" w: " << spt[2]<<
"\n"
54 <<
" Pt MB3-MB1 " << pt[3] <<
" w: " << spt[3]<<
"\n"
55 <<
" Pt MB3-MB2 " << pt[4] <<
" w: " << spt[4]<<
"\n"
56 <<
" Pt MB4-MB1 " << pt[5] <<
" w: " << spt[5]<<
"\n"
57 <<
" Pt MB4-MB2 " << pt[6] <<
" w: " << spt[6]<<
"\n"
58 <<
" Pt MB4-MB3 " << pt[7] <<
" w: " << spt[7]<< endl ;
68 for(
int i = 0;
i < 8; ++
i)
69 if(pt[
i] != 0) ++npoints;
71 sptmean =
sqrt(sptmean*sptmean + 0.09*ptmean*ptmean/npoints);
74 LogTrace(metname) <<
" Seed Pt: " << ptmean <<
" +/- " << sptmean << endl;
90 for (MuonRecHitContainer::const_iterator iter=barrelHits.begin();
91 iter!=barrelHits.end(); iter++ ) {
93 bool hasZed = ((*iter)->projectionMatrix()[1][1]==1);
96 vector<TrackingRecHit*> slrhs=(*iter)->recHits();
97 for (vector<TrackingRecHit*>::const_iterator slrh=slrhs.begin(); slrh!=slrhs.end(); ++slrh ) {
98 cur_npt+=(*slrh)->recHits().size();
100 float radius1 = (*iter)->det()->position().perp();
103 if ( cur_npt > best_npt ) {
107 else if ( best && cur_npt == best_npt ) {
108 float radius2 = best->det()->position().perp();
109 if (radius1 < radius2) {
116 if ( cur_npt > alt_npt ) {
120 else if ( alter && cur_npt == alt_npt ) {
121 float radius2 = alter->det()->position().perp();
122 if (radius1 < radius2) {
129 if ( !best ) best = alter;
141 for (MuonRecHitContainer::const_iterator iter=
theRhits.begin(); iter!=
theRhits.end(); iter++ ) {
143 float eta1= (*iter)->globalPosition().eta();
148 for (MuonRecHitContainer::const_iterator iter2=
theRhits.begin(); iter2!=
theRhits.end(); iter2++ ) {
150 if ( iter2 == iter )
continue;
152 float eta2 = (*iter2)->globalPosition().eta();
154 if ( fabs (eta1-eta2) > .2 )
continue;
157 sdeta += fabs (eta1-eta2);
159 if ( Nseg > Maxseg || (Nseg == Maxseg && sdeta < Msdeta) ) {
175 for (MuonRecHitContainer::const_iterator iter=
theRhits.begin(); iter!=
theRhits.end(); iter++ ) {
179 float eta1= (*iter)->globalPosition().eta();
180 if ( fabs (eta1-eta0) > .2 )
continue;
184 if(stat > 2)
continue;
188 if(thispt > ptmax) thispt = ptmax;
189 if(thispt < -ptmax) thispt = -ptmax;
205 for (MuonRecHitContainer::const_iterator iter=
theRhits.begin();
208 float eta1= (*iter)->globalPosition().eta();
209 if ( fabs (eta1-eta0) > .2 )
continue;
211 for (MuonRecHitContainer::const_iterator iter2=
theRhits.begin();
212 iter2!=iter; iter2++ ) {
214 float eta2= (*iter2)->globalPosition().eta();
215 if ( fabs (eta2-eta0) > .2 )
continue;
225 unsigned int st = stat1*10+stat2;
263 float& sptmean)
const {
269 for (
int i=0;
i<=7;
i++) {
281 sptmean=1/
sqrt(spt[igood]);
282 }
else if (nTotal==0) {
292 LogTrace(metname) <<
" GSL: Pt w vtx :" << ptvtx <<
"+/-" <<
306 LogTrace(metname) <<
" GSL: Pt w/o vtx :" << ptMB <<
"+/-" <<
311 if((ptvtx+ptMB)!=0.0) ptpool=(ptvtx-ptMB)/(ptvtx+ptMB);
313 if(fabs(ptpool)>0.2) fromvtx=
false;
314 LogTrace(metname) <<
"From vtx? " <<fromvtx <<
" ptpool "<< ptpool << endl;
318 LogTrace(metname) <<
" GSL Pt :" << ptmean <<
"+/-" << sptmean << endl;
325 bool tossOutlyers,
float& ptmean,
float & sptmean)
const
332 for (
int i=0;
i<sz; ++
i) {
345 sptmean=1/
sqrt(wtTmp[0]);
347 ptmean = gsl_stats_wmean(wtTmp, 1, ptTmp, 1, n);
348 sptmean =
sqrt( gsl_stats_wvariance_m (wtTmp, 1, ptTmp, 1, n, ptmean) );
354 for (
int nm =0; nm<8; nm++ ){
355 if ( ptTmp[nm]!=0 && fabs(ptTmp[nm]-ptmean)>3*(sptmean) ) {
359 ptmean = gsl_stats_wmean(wtTmp, 1, ptTmp, 1, n);
360 sptmean =
sqrt( gsl_stats_wvariance_m (wtTmp, 1, ptTmp, 1, n, ptmean) );
ConstMuonRecHitPointer bestBarrelHit(const MuonRecHitContainer &barrelHits) const
void computePtWithVtx(double *pt, double *spt) const
void computeBestPt(double *pt, double *spt, float &ptmean, float &sptmean) const
const std::string metname
MuonTransientTrackingRecHit::MuonRecHitContainer theRhits
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
const MuonSeedPtExtractor * thePtExtractor
void computeMean(const double *pt, const double *weights, int sz, bool tossOutlyers, float &ptmean, float &sptmean) const
void computePtWithoutVtx(double *pt, double *spt) const
virtual TrajectorySeed seed() const
std::vector< std::vector< double > > tmp
TrajectorySeed createSeed(float ptmean, float sptmean, MuonTransientTrackingRecHit::ConstMuonRecHitPointer last) const