CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
GlobalTrackingRegionWithVerticesProducer Class Reference

#include <GlobalTrackingRegionWithVerticesProducer.h>

Inheritance diagram for GlobalTrackingRegionWithVerticesProducer:
TrackingRegionProducer

Public Member Functions

 GlobalTrackingRegionWithVerticesProducer (const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
 
virtual std::vector< std::unique_ptr< TrackingRegion > > regions (const edm::Event &ev, const edm::EventSetup &) const override
 
virtual ~GlobalTrackingRegionWithVerticesProducer ()
 
- Public Member Functions inherited from TrackingRegionProducer
virtual ~TrackingRegionProducer ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

edm::InputTag theBeamSpotTag
 
double theFixedError
 
int theMaxNVertices
 
double theNSigmaZ
 
double theOriginRadius
 
bool thePrecise
 
double thePtMin
 
double theSigmaZVertex
 
bool theUseFakeVertices
 
bool theUseFixedError
 
bool theUseFoundVertices
 
bool theUseMS
 
edm::EDGetTokenT< reco::BeamSpottoken_beamSpot
 
edm::EDGetTokenT< reco::VertexCollectiontoken_vertex
 

Detailed Description

Definition at line 15 of file GlobalTrackingRegionWithVerticesProducer.h.

Constructor & Destructor Documentation

GlobalTrackingRegionWithVerticesProducer::GlobalTrackingRegionWithVerticesProducer ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 19 of file GlobalTrackingRegionWithVerticesProducer.h.

References edm::ParameterSet::getParameter(), theFixedError, theMaxNVertices, theNSigmaZ, theOriginRadius, thePrecise, thePtMin, theSigmaZVertex, theUseFakeVertices, theUseFixedError, theUseFoundVertices, theUseMS, token_beamSpot, and token_vertex.

21  {
22  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
23 
24  thePtMin = regionPSet.getParameter<double>("ptMin");
25  theOriginRadius = regionPSet.getParameter<double>("originRadius");
26  theNSigmaZ = regionPSet.getParameter<double>("nSigmaZ");
27  token_beamSpot = iC.consumes<reco::BeamSpot>(regionPSet.getParameter<edm::InputTag>("beamSpot"));
28  thePrecise = regionPSet.getParameter<bool>("precise");
29  theUseMS = regionPSet.getParameter<bool>("useMultipleScattering");
30 
31  theSigmaZVertex = regionPSet.getParameter<double>("sigmaZVertex");
32  theFixedError = regionPSet.getParameter<double>("fixedError");
33 
34  theMaxNVertices = regionPSet.getParameter<int>("maxNVertices");
35 
36  theUseFoundVertices = regionPSet.getParameter<bool>("useFoundVertices");
37  theUseFakeVertices = regionPSet.getParameter<bool>("useFakeVertices");
38  theUseFixedError = regionPSet.getParameter<bool>("useFixedError");
39  token_vertex = iC.consumes<reco::VertexCollection>(regionPSet.getParameter<edm::InputTag>("VertexCollection"));
40  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::VertexCollection > token_vertex
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
virtual GlobalTrackingRegionWithVerticesProducer::~GlobalTrackingRegionWithVerticesProducer ( )
inlinevirtual

Definition at line 42 of file GlobalTrackingRegionWithVerticesProducer.h.

42 {}

Member Function Documentation

static void GlobalTrackingRegionWithVerticesProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 44 of file GlobalTrackingRegionWithVerticesProducer.h.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and regions().

44  {
46 
47  desc.add<bool>("precise", true);
48  desc.add<bool>("useMultipleScattering", false);
49  desc.add<edm::InputTag>("beamSpot", edm::InputTag("offlineBeamSpot"));
50  desc.add<bool>("useFixedError", true);
51  desc.add<double>("originRadius", 0.2);
52  desc.add<double>("sigmaZVertex", 3.0);
53  desc.add<double>("fixedError", 0.2);
54  desc.add<edm::InputTag>("VertexCollection", edm::InputTag("firstStepPrimaryVertices"));
55  desc.add<double>("ptMin", 0.9);
56  desc.add<bool>("useFoundVertices", true);
57  desc.add<bool>("useFakeVertices", false);
58  desc.add<int>("maxNVertices", -1)->setComment("-1 for all vertices");
59  desc.add<double>("nSigmaZ", 4.0);
60 
61  // Only for backwards-compatibility
63  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
64 
65  descriptions.add("globalTrackingRegionWithVertices", descRegion);
66  }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual std::vector<std::unique_ptr<TrackingRegion> > GlobalTrackingRegionWithVerticesProducer::regions ( const edm::Event ev,
const edm::EventSetup  
) const
inlineoverridevirtual

Implements TrackingRegionProducer.

Definition at line 69 of file GlobalTrackingRegionWithVerticesProducer.h.

References Exception, edm::Event::getByToken(), edm::HandleBase::isValid(), mps_fire::result, reco::BeamSpot::sigmaZ(), theFixedError, theMaxNVertices, theNSigmaZ, theOriginRadius, thePrecise, thePtMin, theSigmaZVertex, theUseFakeVertices, theUseFixedError, theUseFoundVertices, theUseMS, token_beamSpot, token_vertex, particleFlowSuperClusterECAL_cfi::vertexCollection, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

Referenced by fillDescriptions().

70  {
71  std::vector<std::unique_ptr<TrackingRegion> > result;
72 
73  GlobalPoint theOrigin;
75  ev.getByToken( token_beamSpot, bsHandle);
76  double bsSigmaZ;
77  if(bsHandle.isValid()) {
78  const reco::BeamSpot & bs = *bsHandle;
79  bsSigmaZ = theNSigmaZ*bs.sigmaZ();
80  theOrigin = GlobalPoint(bs.x0(), bs.y0(), bs.z0());
81  }else{
82  throw cms::Exception("Seeding") << "ERROR: input beamSpot is not valid in GlobalTrackingRegionWithVertices";
83  }
84 
86  {
88  ev.getByToken(token_vertex,vertexCollection);
89 
90  for(reco::VertexCollection::const_iterator iV=vertexCollection->begin(); iV != vertexCollection->end() ; iV++) {
91  if (!iV->isValid()) continue;
92  if (iV->isFake() && !(theUseFakeVertices && theUseFixedError)) continue;
93  GlobalPoint theOrigin_ = GlobalPoint(iV->x(),iV->y(),iV->z());
94  double theOriginHalfLength_ = (theUseFixedError ? theFixedError : (iV->zError())*theSigmaZVertex);
95  result.push_back( std::make_unique<GlobalTrackingRegion>(thePtMin, theOrigin_, theOriginRadius, theOriginHalfLength_, thePrecise, theUseMS) );
96  if(theMaxNVertices >= 0 && result.size() >= static_cast<unsigned>(theMaxNVertices))
97  break;
98  }
99 
100  if (result.empty()) {
101  result.push_back( std::make_unique<GlobalTrackingRegion>(thePtMin, theOrigin, theOriginRadius, bsSigmaZ, thePrecise, theUseMS) );
102  }
103  }
104  else
105  {
106  result.push_back(
107  std::make_unique<GlobalTrackingRegion>(thePtMin, theOrigin, theOriginRadius, bsSigmaZ, thePrecise, theUseMS) );
108  }
109 
110  return result;
111  }
double z0() const
z coordinate
Definition: BeamSpot.h:68
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
edm::EDGetTokenT< reco::VertexCollection > token_vertex
bool isValid() const
Definition: HandleBase.h:74
double sigmaZ() const
sigma z
Definition: BeamSpot.h:80
double y0() const
y coordinate
Definition: BeamSpot.h:66
double x0() const
x coordinate
Definition: BeamSpot.h:64

Member Data Documentation

edm::InputTag GlobalTrackingRegionWithVerticesProducer::theBeamSpotTag
private

Definition at line 117 of file GlobalTrackingRegionWithVerticesProducer.h.

double GlobalTrackingRegionWithVerticesProducer::theFixedError
private
int GlobalTrackingRegionWithVerticesProducer::theMaxNVertices
private
double GlobalTrackingRegionWithVerticesProducer::theNSigmaZ
private
double GlobalTrackingRegionWithVerticesProducer::theOriginRadius
private
bool GlobalTrackingRegionWithVerticesProducer::thePrecise
private
double GlobalTrackingRegionWithVerticesProducer::thePtMin
private
double GlobalTrackingRegionWithVerticesProducer::theSigmaZVertex
private
bool GlobalTrackingRegionWithVerticesProducer::theUseFakeVertices
private
bool GlobalTrackingRegionWithVerticesProducer::theUseFixedError
private
bool GlobalTrackingRegionWithVerticesProducer::theUseFoundVertices
private
bool GlobalTrackingRegionWithVerticesProducer::theUseMS
private
edm::EDGetTokenT<reco::BeamSpot> GlobalTrackingRegionWithVerticesProducer::token_beamSpot
private
edm::EDGetTokenT<reco::VertexCollection> GlobalTrackingRegionWithVerticesProducer::token_vertex
private