CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

VertexMerging Class Reference

#include <VertexMerging.h>

List of all members.

Public Member Functions

reco::VertexCollection mergeVertex (reco::VertexCollection &secondaryVertices)
 VertexMerging (const edm::ParameterSet &params)

Private Member Functions

bool trackFilter (const reco::TrackRef &track) const

Private Attributes

double maxFraction
double minSignificance

Detailed Description

Definition at line 17 of file VertexMerging.h.


Constructor & Destructor Documentation

VertexMerging::VertexMerging ( const edm::ParameterSet params)

Definition at line 4 of file VertexMerging.cc.

                                                          :
        maxFraction(params.getParameter<double>("maxFraction")),
        minSignificance(params.getParameter<double>("minSignificance"))
{
        
}

Member Function Documentation

reco::VertexCollection VertexMerging::mergeVertex ( reco::VertexCollection secondaryVertices)

Definition at line 37 of file VertexMerging.cc.

References computeSharedTracks(), VertexDistance3D::distance(), maxFraction, minSignificance, and Measurement1D::significance().

                                                 {



        
        VertexDistance3D dist;
        reco::VertexCollection recoVertices;
        for(std::vector<reco::Vertex>::const_iterator sv = secondaryVertices.begin();
            sv != secondaryVertices.end(); ++sv) {
          recoVertices.push_back(*sv);
        }
       for(std::vector<reco::Vertex>::iterator sv = recoVertices.begin();
            sv != recoVertices.end(); ++sv) {

        bool shared=false;
       for(std::vector<reco::Vertex>::iterator sv2 = recoVertices.begin();
            sv2 != recoVertices.end(); ++sv2) {
                  double fr=computeSharedTracks(*sv2, *sv);
        //        std::cout << sv2-recoVertices->begin() << " vs " << sv-recoVertices->begin() << " : " << fr << " "  <<  computeSharedTracks(*sv, *sv2) << " sig " << dist.distance(*sv,*sv2).significance() << std::endl;
          //      std::cout << (fr > maxFraction) << " && " << (dist.distance(*sv,*sv2).significance() < 2)  <<  " && " <<  (sv-sv2!=0)  << " && " <<  (fr >= computeSharedTracks(*sv2, *sv))  << std::endl;
                if (fr > maxFraction && dist.distance(*sv,*sv2).significance() < minSignificance && sv-sv2!=0 
                    && fr >= computeSharedTracks(*sv, *sv2) )
                  {
                      shared=true; 
                     // std::cout << "shared " << sv-recoVertices->begin() << " and "  << sv2-recoVertices->begin() << " fractions: " << fr << " , "  << computeSharedTracks(*sv2, *sv) << " sig: " <<  dist.distance(*sv,*sv2).significance() <<  std::endl;
         
                  }
                 

        }
        if(shared) { sv=recoVertices.erase(sv)-1; }
     //    std::cout << "it = " <<  sv-recoVertices->begin() << " new size is: " << recoVertices->size() <<   std::endl;
       }

        return recoVertices;


}
bool VertexMerging::trackFilter ( const reco::TrackRef track) const [private]

Member Data Documentation

double VertexMerging::maxFraction [private]

Definition at line 28 of file VertexMerging.h.

Referenced by mergeVertex().

Definition at line 29 of file VertexMerging.h.

Referenced by mergeVertex().