CMS 3D CMS Logo

Public Member Functions | Private Attributes

GlobalTrackingRegionWithVerticesProducer Class Reference

#include <GlobalTrackingRegionWithVerticesProducer.h>

Inheritance diagram for GlobalTrackingRegionWithVerticesProducer:
TrackingRegionProducer

List of all members.

Public Member Functions

 GlobalTrackingRegionWithVerticesProducer (const edm::ParameterSet &cfg)
virtual std::vector
< TrackingRegion * > 
regions (const edm::Event &ev, const edm::EventSetup &) const
virtual ~GlobalTrackingRegionWithVerticesProducer ()

Private Attributes

edm::InputTag theBeamSpotTag
double theFixedError
double theNSigmaZ
double theOriginRadius
bool thePrecise
double thePtMin
double theSigmaZVertex
bool theUseFixedError
bool theUseFoundVertices
edm::InputTag vertexCollName

Detailed Description

Definition at line 14 of file GlobalTrackingRegionWithVerticesProducer.h.


Constructor & Destructor Documentation

GlobalTrackingRegionWithVerticesProducer::GlobalTrackingRegionWithVerticesProducer ( const edm::ParameterSet cfg) [inline]

Definition at line 18 of file GlobalTrackingRegionWithVerticesProducer.h.

References edm::ParameterSet::getParameter(), theBeamSpotTag, theFixedError, theNSigmaZ, theOriginRadius, thePrecise, thePtMin, theSigmaZVertex, theUseFixedError, theUseFoundVertices, and vertexCollName.

  { 
    edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");

    thePtMin            = regionPSet.getParameter<double>("ptMin");
    theOriginRadius     = regionPSet.getParameter<double>("originRadius");
    theNSigmaZ          = regionPSet.getParameter<double>("nSigmaZ");
    theBeamSpotTag      = regionPSet.getParameter<edm::InputTag>("beamSpot");
    thePrecise          = regionPSet.getParameter<bool>("precise"); 

    theSigmaZVertex     = regionPSet.getParameter<double>("sigmaZVertex");
    theFixedError       = regionPSet.getParameter<double>("fixedError");

    theUseFoundVertices = regionPSet.getParameter<bool>("useFoundVertices");
    theUseFixedError    = regionPSet.getParameter<bool>("useFixedError");
    vertexCollName      = regionPSet.getParameter<edm::InputTag>("VertexCollection");
  }   
virtual GlobalTrackingRegionWithVerticesProducer::~GlobalTrackingRegionWithVerticesProducer ( ) [inline, virtual]

Definition at line 36 of file GlobalTrackingRegionWithVerticesProducer.h.

{}

Member Function Documentation

virtual std::vector<TrackingRegion* > GlobalTrackingRegionWithVerticesProducer::regions ( const edm::Event ev,
const edm::EventSetup  
) const [inline, virtual]

Implements TrackingRegionProducer.

Definition at line 39 of file GlobalTrackingRegionWithVerticesProducer.h.

References Exception, edm::Event::getByLabel(), edm::HandleBase::isValid(), query::result, reco::BeamSpot::sigmaZ(), theBeamSpotTag, theFixedError, theNSigmaZ, theOriginRadius, thePrecise, thePtMin, theSigmaZVertex, theUseFixedError, theUseFoundVertices, GoodVertex_cfg::vertexCollection, vertexCollName, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

  {
    std::vector<TrackingRegion* > result;

    GlobalPoint theOrigin;
    edm::Handle<reco::BeamSpot> bsHandle;
    ev.getByLabel( theBeamSpotTag, bsHandle);
    double bsSigmaZ;
    if(bsHandle.isValid()) {
      const reco::BeamSpot & bs = *bsHandle; 
      bsSigmaZ = theNSigmaZ*bs.sigmaZ();
      theOrigin = GlobalPoint(bs.x0(), bs.y0(), bs.z0());
    }else{
      throw cms::Exception("Seeding") << "ERROR: input beamSpot is not valid in GlobalTrackingRegionWithVertices";
    }

    if(theUseFoundVertices)
    {
      edm::Handle<reco::VertexCollection> vertexCollection;
      ev.getByLabel(vertexCollName,vertexCollection);

      for(reco::VertexCollection::const_iterator iV=vertexCollection->begin(); iV != vertexCollection->end() ; iV++) {
          if (iV->isFake() || !iV->isValid()) continue;
          GlobalPoint theOrigin_       = GlobalPoint(iV->x(),iV->y(),iV->z());
          double theOriginHalfLength_ = (theUseFixedError ? theFixedError : (iV->zError())*theSigmaZVertex); 
          result.push_back( new GlobalTrackingRegion(thePtMin, theOrigin_, theOriginRadius, theOriginHalfLength_, thePrecise) );
      }
      
      if (result.empty()) {
        result.push_back( new GlobalTrackingRegion(thePtMin, theOrigin, theOriginRadius, bsSigmaZ, thePrecise) );
      }
    }
    else
    {
      result.push_back(
        new GlobalTrackingRegion(thePtMin, theOrigin, theOriginRadius, bsSigmaZ, thePrecise) );
    }

    return result;
  }

Member Data Documentation