CMS 3D CMS Logo

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

#include <VertexBeamspotOrigins.h>

Public Types

enum  OperationMode { OperationMode::BEAM_SPOT_FIXED, OperationMode::BEAM_SPOT_SIGMA, OperationMode::VERTICES_FIXED, OperationMode::VERTICES_SIGMA }
 
using Origins = std::vector< std::pair< GlobalPoint, float > >
 

Public Member Functions

Origins origins (const edm::Event &iEvent) const
 
 VertexBeamspotOrigins (const edm::ParameterSet &regPSet, edm::ConsumesCollector &&iC)
 
 VertexBeamspotOrigins (const edm::ParameterSet &regPSet, edm::ConsumesCollector &iC)
 
 ~VertexBeamspotOrigins ()=default
 

Static Public Member Functions

static void fillDescriptions (edm::ParameterSetDescription &desc, const std::string &defaultBeamSpot="offlineBeamSpot", const std::string &defaultVertex="firstStepPrimaryVertices", int defaultMaxVertices=-1)
 

Private Attributes

int m_maxNVertices
 
float m_nSigmaZBeamSpot
 
float m_nSigmaZVertex
 
OperationMode m_operationMode
 
float m_zErrorBeamSpot
 
float m_zErrorVertex
 
edm::EDGetTokenT< reco::BeamSpottoken_beamSpot
 
edm::EDGetTokenT< reco::VertexCollectiontoken_vertex
 

Detailed Description

Definition at line 15 of file VertexBeamspotOrigins.h.

Member Typedef Documentation

◆ Origins

using VertexBeamspotOrigins::Origins = std::vector<std::pair<GlobalPoint, float> >

Definition at line 17 of file VertexBeamspotOrigins.h.

Member Enumeration Documentation

◆ OperationMode

Enumerator
BEAM_SPOT_FIXED 
BEAM_SPOT_SIGMA 
VERTICES_FIXED 
VERTICES_SIGMA 

Definition at line 18 of file VertexBeamspotOrigins.h.

18 { BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, VERTICES_FIXED, VERTICES_SIGMA };

Constructor & Destructor Documentation

◆ VertexBeamspotOrigins() [1/2]

VertexBeamspotOrigins::VertexBeamspotOrigins ( const edm::ParameterSet regPSet,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 20 of file VertexBeamspotOrigins.h.

21  : VertexBeamspotOrigins(regPSet, iC) {}

◆ VertexBeamspotOrigins() [2/2]

VertexBeamspotOrigins::VertexBeamspotOrigins ( const edm::ParameterSet regPSet,
edm::ConsumesCollector iC 
)

Definition at line 3 of file VertexBeamspotOrigins.cc.

3  {
4  // operation mode
5  std::string operationModeString = regPSet.getParameter<std::string>("operationMode");
6  if (operationModeString == "BeamSpotFixed")
8  else if (operationModeString == "BeamSpotSigma")
10  else if (operationModeString == "VerticesFixed")
12  else if (operationModeString == "VerticesSigma")
14  else
15  throw cms::Exception("Configuration") << "Unknown operation mode string: " << operationModeString;
16 
18  m_maxNVertices = 1;
20  token_vertex = iC.consumes<reco::VertexCollection>(regPSet.getParameter<edm::InputTag>("vertexCollection"));
21  m_maxNVertices = regPSet.getParameter<int>("maxNVertices");
22  }
23 
24  // mode-dependent z-halflength of tracking regions
25  m_zErrorBeamSpot = regPSet.getParameter<double>("zErrorBeamSpot");
27  m_nSigmaZVertex = regPSet.getParameter<double>("nSigmaZVertex");
29  m_zErrorVertex = regPSet.getParameter<double>("zErrorVertex");
30  m_nSigmaZBeamSpot = -1.;
32  m_nSigmaZBeamSpot = regPSet.getParameter<double>("nSigmaZBeamSpot");
33  if (m_nSigmaZBeamSpot < 0.)
34  throw cms::Exception("Configuration") << "nSigmaZBeamSpot must be positive for BeamSpotSigma mode!";
35  }
36 }

References BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, edm::ConsumesCollector::consumes(), Exception, edm::ParameterSet::getParameter(), m_maxNVertices, m_nSigmaZBeamSpot, m_nSigmaZVertex, m_operationMode, m_zErrorBeamSpot, m_zErrorVertex, AlCaHLTBitMon_QueryRunRegistry::string, token_beamSpot, token_vertex, VERTICES_FIXED, and VERTICES_SIGMA.

◆ ~VertexBeamspotOrigins()

VertexBeamspotOrigins::~VertexBeamspotOrigins ( )
default

Member Function Documentation

◆ fillDescriptions()

void VertexBeamspotOrigins::fillDescriptions ( edm::ParameterSetDescription desc,
const std::string &  defaultBeamSpot = "offlineBeamSpot",
const std::string &  defaultVertex = "firstStepPrimaryVertices",
int  defaultMaxVertices = -1 
)
static

Definition at line 38 of file VertexBeamspotOrigins.cc.

41  {
42  desc.add<std::string>("operationMode", "BeamSpotFixed");
43  desc.add<edm::InputTag>("beamSpot", defaultBeamSpot);
44  desc.add<edm::InputTag>("vertexCollection", defaultVertex);
45  desc.add<int>("maxNVertices", defaultMaxVertices);
46 
47  desc.add<double>("nSigmaZBeamSpot", 4.);
48  desc.add<double>("zErrorBeamSpot", 24.2);
49  desc.add<double>("nSigmaZVertex", 3.);
50  desc.add<double>("zErrorVertex", 0.2);
51 }

References submitPVResolutionJobs::desc, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by PixelInactiveAreaTrackingRegionsSeedingLayersProducer::fillDescriptions(), AreaSeededTrackingRegionsProducer::fillDescriptions(), and CandidatePointSeededTrackingRegionsProducer::fillDescriptions().

◆ origins()

VertexBeamspotOrigins::Origins VertexBeamspotOrigins::origins ( const edm::Event iEvent) const

Definition at line 53 of file VertexBeamspotOrigins.cc.

53  {
54  Origins ret;
55 
56  // always need the beam spot (as a fall back strategy for vertex modes)
58  iEvent.getByToken(token_beamSpot, bs);
59  if (!bs.isValid())
60  return ret;
61 
62  // this is a default origin for all modes
63  GlobalPoint default_origin(bs->x0(), bs->y0(), bs->z0());
64 
65  // fill the origins and halfLengths depending on the mode
67  ret.emplace_back(
68  default_origin,
72  iEvent.getByToken(token_vertex, vertices);
73  int n_vert = 0;
74  for (const auto& v : *vertices) {
75  if (v.isFake() || !v.isValid())
76  continue;
77 
78  ret.emplace_back(
79  GlobalPoint(v.x(), v.y(), v.z()),
81  ++n_vert;
82  if (m_maxNVertices >= 0 && n_vert >= m_maxNVertices) {
83  break;
84  }
85  }
86  // no-vertex fall-back case:
87  if (ret.empty()) {
88  ret.emplace_back(default_origin, (m_nSigmaZBeamSpot > 0.) ? m_nSigmaZBeamSpot * bs->z0Error() : m_zErrorBeamSpot);
89  }
90  }
91 
92  return ret;
93 }

References BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, cms::cuda::bs, iEvent, m_maxNVertices, m_nSigmaZBeamSpot, m_nSigmaZVertex, m_operationMode, m_zErrorBeamSpot, m_zErrorVertex, runTheMatrix::ret, token_beamSpot, token_vertex, findQualityFiles::v, pwdgSkimBPark_cfi::vertices, VERTICES_FIXED, and VERTICES_SIGMA.

Referenced by PixelInactiveAreaTrackingRegionsSeedingLayersProducer::produce(), AreaSeededTrackingRegionsProducer::regions(), and CandidatePointSeededTrackingRegionsProducer::regions().

Member Data Documentation

◆ m_maxNVertices

int VertexBeamspotOrigins::m_maxNVertices
private

Definition at line 38 of file VertexBeamspotOrigins.h.

Referenced by origins(), and VertexBeamspotOrigins().

◆ m_nSigmaZBeamSpot

float VertexBeamspotOrigins::m_nSigmaZBeamSpot
private

Definition at line 40 of file VertexBeamspotOrigins.h.

Referenced by origins(), and VertexBeamspotOrigins().

◆ m_nSigmaZVertex

float VertexBeamspotOrigins::m_nSigmaZVertex
private

Definition at line 42 of file VertexBeamspotOrigins.h.

Referenced by origins(), and VertexBeamspotOrigins().

◆ m_operationMode

OperationMode VertexBeamspotOrigins::m_operationMode
private

Definition at line 33 of file VertexBeamspotOrigins.h.

Referenced by origins(), and VertexBeamspotOrigins().

◆ m_zErrorBeamSpot

float VertexBeamspotOrigins::m_zErrorBeamSpot
private

Definition at line 41 of file VertexBeamspotOrigins.h.

Referenced by origins(), and VertexBeamspotOrigins().

◆ m_zErrorVertex

float VertexBeamspotOrigins::m_zErrorVertex
private

Definition at line 43 of file VertexBeamspotOrigins.h.

Referenced by origins(), and VertexBeamspotOrigins().

◆ token_beamSpot

edm::EDGetTokenT<reco::BeamSpot> VertexBeamspotOrigins::token_beamSpot
private

Definition at line 36 of file VertexBeamspotOrigins.h.

Referenced by origins(), and VertexBeamspotOrigins().

◆ token_vertex

edm::EDGetTokenT<reco::VertexCollection> VertexBeamspotOrigins::token_vertex
private

Definition at line 35 of file VertexBeamspotOrigins.h.

Referenced by origins(), and VertexBeamspotOrigins().

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:542
VertexBeamspotOrigins::m_operationMode
OperationMode m_operationMode
Definition: VertexBeamspotOrigins.h:33
VertexBeamspotOrigins::OperationMode::BEAM_SPOT_FIXED
VertexBeamspotOrigins::OperationMode::VERTICES_SIGMA
reco::VertexCollection
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
findQualityFiles.v
v
Definition: findQualityFiles.py:179
VertexBeamspotOrigins::OperationMode::BEAM_SPOT_SIGMA
edm::Handle< reco::BeamSpot >
cms::cuda::bs
bs
Definition: HistoContainer.h:127
VertexBeamspotOrigins::token_vertex
edm::EDGetTokenT< reco::VertexCollection > token_vertex
Definition: VertexBeamspotOrigins.h:35
VertexBeamspotOrigins::token_beamSpot
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
Definition: VertexBeamspotOrigins.h:36
VertexBeamspotOrigins::m_zErrorVertex
float m_zErrorVertex
Definition: VertexBeamspotOrigins.h:43
VertexBeamspotOrigins::Origins
std::vector< std::pair< GlobalPoint, float > > Origins
Definition: VertexBeamspotOrigins.h:17
VertexBeamspotOrigins::OperationMode::VERTICES_FIXED
reco::BeamSpot
Definition: BeamSpot.h:21
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Point3DBase< float, GlobalTag >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
VertexBeamspotOrigins::m_maxNVertices
int m_maxNVertices
Definition: VertexBeamspotOrigins.h:38
VertexBeamspotOrigins::m_zErrorBeamSpot
float m_zErrorBeamSpot
Definition: VertexBeamspotOrigins.h:41
iEvent
int iEvent
Definition: GenABIO.cc:224
VertexBeamspotOrigins::m_nSigmaZBeamSpot
float m_nSigmaZBeamSpot
Definition: VertexBeamspotOrigins.h:40
VertexBeamspotOrigins::m_nSigmaZVertex
float m_nSigmaZVertex
Definition: VertexBeamspotOrigins.h:42
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
VertexBeamspotOrigins::VertexBeamspotOrigins
VertexBeamspotOrigins(const edm::ParameterSet &regPSet, edm::ConsumesCollector &&iC)
Definition: VertexBeamspotOrigins.h:20
edm::InputTag
Definition: InputTag.h:15
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7