21 #include "gsl/gsl_statistics.h"
34 double pt[16] = { 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0. };
37 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 };
48 LogTrace(metname) <<
" Pt MB1 @vtx: " << pt[0] <<
" w: " << spt[0] <<
"\n"
49 <<
" Pt MB2 @vtx: " << pt[1] <<
" w: " << spt[1]<< endl ;
51 LogTrace(metname) <<
" Pt MB2-MB1 " << pt[2] <<
" w: " << spt[2]<<
"\n"
52 <<
" Pt MB3-MB1 " << pt[3] <<
" w: " << spt[3]<<
"\n"
53 <<
" Pt MB3-MB2 " << pt[4] <<
" w: " << spt[4]<<
"\n"
54 <<
" Pt MB4-MB1 " << pt[5] <<
" w: " << spt[5]<<
"\n"
55 <<
" Pt MB4-MB2 " << pt[6] <<
" w: " << spt[6]<<
"\n"
56 <<
" Pt MB4-MB3 " << pt[7] <<
" w: " << spt[7]<< endl ;
66 for(
int i = 0;
i < 8; ++
i)
69 sptmean =
sqrt(sptmean*sptmean + 0.09*ptmean*ptmean/npoints);
72 LogTrace(metname) <<
" Seed Pt: " << ptmean <<
" +/- " << sptmean << endl;
88 for (MuonRecHitContainer::const_iterator iter=barrelHits.begin();
89 iter!=barrelHits.end(); iter++ ) {
91 bool hasZed = ((*iter)->projectionMatrix()[1][1]==1);
94 vector<TrackingRecHit*> slrhs=(*iter)->
recHits();
95 for (vector<TrackingRecHit*>::const_iterator slrh=slrhs.begin(); slrh!=slrhs.end(); ++slrh ) {
96 cur_npt+=(*slrh)->recHits().size();
98 float radius1 = (*iter)->det()->position().perp();
101 if ( cur_npt > best_npt ) {
105 else if ( best && cur_npt == best_npt ) {
107 if (radius1 < radius2) {
114 if ( cur_npt > alt_npt ) {
118 else if ( alter && cur_npt == alt_npt ) {
120 if (radius1 < radius2) {
127 if ( !best ) best = alter;
139 for (MuonRecHitContainer::const_iterator iter=
theRhits.begin(); iter!=
theRhits.end(); iter++ ) {
141 float eta1= (*iter)->globalPosition().eta();
146 for (MuonRecHitContainer::const_iterator iter2=
theRhits.begin(); iter2!=
theRhits.end(); iter2++ ) {
148 if ( iter2 == iter )
continue;
150 float eta2 = (*iter2)->globalPosition().eta();
152 if ( fabs (eta1-eta2) > .2 )
continue;
155 sdeta += fabs (eta1-eta2);
157 if ( Nseg > Maxseg || (Nseg == Maxseg && sdeta < Msdeta) ) {
173 for (MuonRecHitContainer::const_iterator iter=
theRhits.begin(); iter!=
theRhits.end(); iter++ ) {
177 float eta1= (*iter)->globalPosition().eta();
178 if ( fabs (eta1-eta0) > .2 )
continue;
182 if(stat > 2)
continue;
186 if(thispt > ptmax) thispt = ptmax;
187 if(thispt < -ptmax) thispt = -ptmax;
203 for (MuonRecHitContainer::const_iterator iter=
theRhits.begin();
206 float eta1= (*iter)->globalPosition().eta();
207 if ( fabs (eta1-eta0) > .2 )
continue;
209 for (MuonRecHitContainer::const_iterator iter2=
theRhits.begin();
210 iter2!=iter; iter2++ ) {
212 float eta2= (*iter2)->globalPosition().eta();
213 if ( fabs (eta2-eta0) > .2 )
continue;
223 unsigned int st = stat1*10+stat2;
261 float& sptmean)
const {
267 for (
int i=0;
i<=7;
i++) {
279 sptmean=1/
sqrt(spt[igood]);
280 }
else if (nTotal==0) {
290 LogTrace(metname) <<
" GSL: Pt w vtx :" << ptvtx <<
"+/-" <<
304 LogTrace(metname) <<
" GSL: Pt w/o vtx :" << ptMB <<
"+/-" <<
309 if((ptvtx+ptMB)!=0.0) ptpool=(ptvtx-ptMB)/(ptvtx+ptMB);
311 if(fabs(ptpool)>0.2) fromvtx=
false;
312 LogTrace(metname) <<
"From vtx? " <<fromvtx <<
" ptpool "<< ptpool << endl;
316 LogTrace(metname) <<
" GSL Pt :" << ptmean <<
"+/-" << sptmean << endl;
323 bool tossOutlyers,
float& ptmean,
float & sptmean)
const
330 for (
int i=0;
i<sz; ++
i) {
343 sptmean=1/
sqrt(wtTmp[0]);
345 ptmean = gsl_stats_wmean(wtTmp, 1, ptTmp, 1, n);
346 sptmean =
sqrt( gsl_stats_wvariance_m (wtTmp, 1, ptTmp, 1, n, ptmean) );
352 for (
int nm =0; nm<8; nm++ ){
353 if ( ptTmp[nm]!=0 && fabs(ptTmp[nm]-ptmean)>3*(sptmean) ) {
357 ptmean = gsl_stats_wmean(wtTmp, 1, ptTmp, 1, n);
358 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
virtual std::vector< const TrackingRecHit * > recHits() const override
Access to component RecHits (if any)
MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer
const MuonSeedPtExtractor * thePtExtractor
const Surface::PositionType & position() const
The position (origin of the R.F.)
const GeomDet * det() const
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