CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TrackVertexArbitrator Class Reference

Inheritance diagram for TrackVertexArbitrator:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void produce (edm::Event &event, const edm::EventSetup &es)
 TrackVertexArbitrator (const edm::ParameterSet &params)

Private Member Functions

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

Private Attributes

edm::InputTag beamSpotCollection
edm::InputTag primaryVertexCollection
edm::InputTag secondaryVertexCollection
TrackVertexArbitrationtheArbitrator
edm::InputTag trackCollection

Detailed Description

Definition at line 45 of file TrackVertexArbitrator.cc.


Constructor & Destructor Documentation

TrackVertexArbitrator::TrackVertexArbitrator ( const edm::ParameterSet params)

Definition at line 62 of file TrackVertexArbitrator.cc.

References theArbitrator.

                                                                          :
        primaryVertexCollection      (params.getParameter<edm::InputTag>("primaryVertices")),
        secondaryVertexCollection    (params.getParameter<edm::InputTag>("secondaryVertices")),
        trackCollection              (params.getParameter<edm::InputTag>("tracks")),
        beamSpotCollection           (params.getParameter<edm::InputTag>("beamSpot"))
{
        produces<reco::VertexCollection>();
        theArbitrator = new TrackVertexArbitration(params);
}

Member Function Documentation

void TrackVertexArbitrator::produce ( edm::Event event,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 73 of file TrackVertexArbitrator.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, beamSpotCollection, edm::EventSetup::get(), primaryVertexCollection, edm::RefVector< C, T, F >::push_back(), dt_dqm_sourceclient_common_cff::reco, secondaryVertexCollection, theArbitrator, trackCollection, testEve_cfg::tracks, and TrackVertexArbitration::trackVertexArbitrator().

{
        using namespace reco;

        edm::Handle<VertexCollection> secondaryVertices;
        event.getByLabel(secondaryVertexCollection, secondaryVertices);
        VertexCollection theSecVertexColl = *(secondaryVertices.product());

        edm::Handle<VertexCollection> primaryVertices;
        event.getByLabel(primaryVertexCollection, primaryVertices);

        std::auto_ptr<VertexCollection> recoVertices(new VertexCollection);
        if(primaryVertices->size()!=0){ 
        const reco::Vertex &pv = (*primaryVertices)[0];
    
        edm::Handle<TrackCollection> tracks;
        event.getByLabel(trackCollection, tracks);

        edm::ESHandle<TransientTrackBuilder> trackBuilder;
        es.get<TransientTrackRecord>().get("TransientTrackBuilder",
                                           trackBuilder);

        edm::Handle<BeamSpot> beamSpot;
        event.getByLabel(beamSpotCollection, beamSpot);

        
        edm::RefVector< TrackCollection >  selectedTracks;
        for(TrackCollection::const_iterator track = tracks->begin();
            track != tracks->end(); ++track) {
                TrackRef ref(tracks, track - tracks->begin());
                selectedTracks.push_back(ref);
           
        }
        
        
        const edm::RefVector< TrackCollection > tracksForArbitration= selectedTracks;
        reco::VertexCollection  theRecoVertices = theArbitrator->trackVertexArbitrator(beamSpot, pv, trackBuilder, tracksForArbitration,
        theSecVertexColl);
        
        for(unsigned int ivtx=0; ivtx < theRecoVertices.size(); ivtx++){
         recoVertices->push_back(theRecoVertices[ivtx]);
        }

        }       
        event.put(recoVertices);
        
        
        
}
bool TrackVertexArbitrator::trackFilter ( const reco::TrackRef track) const [private]

Member Data Documentation

Definition at line 58 of file TrackVertexArbitrator.cc.

Referenced by produce().

Definition at line 55 of file TrackVertexArbitrator.cc.

Referenced by produce().

Definition at line 56 of file TrackVertexArbitrator.cc.

Referenced by produce().

Definition at line 59 of file TrackVertexArbitrator.cc.

Referenced by produce(), and TrackVertexArbitrator().

Definition at line 57 of file TrackVertexArbitrator.cc.

Referenced by produce().