CMS 3D CMS Logo

NuclearLikelihood.cc

Go to the documentation of this file.
00001 #include "RecoVertex/NuclearInteractionProducer/interface/NuclearLikelihood.h"
00002 
00003 void NuclearLikelihood::calculate( const reco::Vertex& vtx ) {
00004       likelihood_ = 0.0;
00005       if( vtx.isValid() ) {
00006            if(vtx.tracksSize() > 1) {
00007                likelihood_ = 0.3;
00008                int idBest;
00009                int secMaxHits = secondaryTrackMaxHits( vtx, idBest );
00010                if( secMaxHits > 3 ) likelihood_ =0.5;
00011                if( secMaxHits > 4 ) likelihood_ =0.7;
00012                if( (*(vtx.tracks_begin()+idBest))->normalizedChi2() < 3.0) likelihood_=1.0;
00013            }
00014       }
00015 }
00016 
00017 int NuclearLikelihood::secondaryTrackMaxHits( const reco::Vertex& vtx , int& id) {
00018       int maxHits = 0;
00019       if( vtx.tracksSize() < 2 )  return 0;
00020       int i=1;
00021       for( reco::Vertex::trackRef_iterator it = vtx.tracks_begin()+1; it != vtx.tracks_end(); ++it){
00022             int nhits = (*it)->numberOfValidHits();
00023             if( nhits > maxHits ) { maxHits = nhits; id=i; }
00024             i++;
00025       }
00026       return maxHits;
00027 }

Generated on Tue Jun 9 17:46:12 2009 for CMSSW by  doxygen 1.5.4