CMS 3D CMS Logo

Public Member Functions | Private Attributes

VZeroProducer Class Reference

#include <VZeroProducer.h>

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

List of all members.

Public Member Functions

virtual void produce (edm::Event &ev, const edm::EventSetup &es)
 VZeroProducer (const edm::ParameterSet &pset)
 ~VZeroProducer ()

Private Attributes

float minImpactNegativeDaughter
float minImpactPositiveDaughter
edm::ParameterSet pset_

Detailed Description

Definition at line 9 of file VZeroProducer.h.


Constructor & Destructor Documentation

VZeroProducer::VZeroProducer ( const edm::ParameterSet pset) [explicit]

Definition at line 20 of file VZeroProducer.cc.

References edm::ParameterSet::getParameter(), minImpactNegativeDaughter, and minImpactPositiveDaughter.

  : pset_(pset)
{
  LogInfo("VZeroProducer") << " constructor";
  produces<reco::VZeroCollection>();

  // Get track level cuts
  minImpactPositiveDaughter =
    pset.getParameter<double>("minImpactPositiveDaughter");
  minImpactNegativeDaughter =
    pset.getParameter<double>("minImpactNegativeDaughter");
}
VZeroProducer::~VZeroProducer ( )

Definition at line 34 of file VZeroProducer.cc.

{
  LogInfo("VZeroProducer") << " destructor";
}

Member Function Documentation

void VZeroProducer::produce ( edm::Event ev,
const edm::EventSetup es 
) [virtual]

Implements edm::EDProducer.

Definition at line 40 of file VZeroProducer.cc.

References reco::Vertex::add(), edm::RefVector< C, T, F >::begin(), DeDxDiscriminatorTools::charge(), VZeroFinder::checkTrackPair(), reco::VZeroData::crossingPoint, data, edm::RefVector< C, T, F >::end(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), i, LogTrace, minImpactNegativeDaughter, minImpactPositiveDaughter, edm::Handle< T >::product(), pset_, edm::RefVector< C, T, F >::push_back(), edm::Event::put(), query::result, edm::RefVector< C, T, F >::size(), testEve_cfg::tracks, and GoodVertex_cfg::vertexCollection.

{
  // Get tracks
  Handle<reco::TrackCollection> trackCollection;
  ev.getByLabel(pset_.getParameter<InputTag>("trackCollection"),
                                              trackCollection);
  const reco::TrackCollection tracks = *(trackCollection.product());

  // Get primary vertices
  Handle<reco::VertexCollection> vertexCollection;
  ev.getByLabel(pset_.getParameter<InputTag>("vertexCollection"),
                                              vertexCollection);
  const reco::VertexCollection* vertices = vertexCollection.product();

  // Find vzeros
  VZeroFinder theFinder(es,pset_);

  // Selection based on track impact parameter
  reco::TrackRefVector positives;
  reco::TrackRefVector negatives;

  for(unsigned int i=0; i<tracks.size(); i++)
  {
    if(tracks[i].charge() > 0 &&
       fabs(tracks[i].d0()) > minImpactPositiveDaughter)
      positives.push_back(reco::TrackRef(trackCollection, i));

    if(tracks[i].charge() < 0 &&
       fabs(tracks[i].d0()) > minImpactNegativeDaughter)
      negatives.push_back(reco::TrackRef(trackCollection, i));
  }

  LogTrace("MinBiasTracking") << "[VZeroProducer] using tracks :"
       << " +" << positives.size()
       << " -" << negatives.size();

  auto_ptr<reco::VZeroCollection> result(new reco::VZeroCollection);

  // Check all combination of positives and negatives
  if(positives.size() > 0 && negatives.size() > 0)
    for(reco::track_iterator ipos = positives.begin();
                             ipos!= positives.end(); ipos++)
    for(reco::track_iterator ineg = negatives.begin();
                             ineg!= negatives.end(); ineg++)
    {
      reco::VZeroData data;

      if(theFinder.checkTrackPair(**ipos,**ineg, vertices, data) == true)
      {
        // Create vertex (creation point)
        reco::Vertex vertex(reco::Vertex::Point(data.crossingPoint.x(),
                                                data.crossingPoint.y(),
                                                data.crossingPoint.z()),
                            reco::Vertex::Error(), 0.,0.,0);

        // Add references to daughters
        vertex.add(reco::TrackBaseRef(*ipos));
        vertex.add(reco::TrackBaseRef(*ineg));

        // Store vzero
        result->push_back(reco::VZero(vertex,data));
      }
    }

  LogTrace("MinBiasTracking")
    << "[VZeroProducer] found candidates : " << result->size();

  // Put result back to the event
  ev.put(result);
}

Member Data Documentation

Definition at line 22 of file VZeroProducer.h.

Referenced by produce(), and VZeroProducer().

Definition at line 22 of file VZeroProducer.h.

Referenced by produce(), and VZeroProducer().

Definition at line 20 of file VZeroProducer.h.

Referenced by produce().