CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes
PointSeededTrackingRegionsProducer Class Reference

#include <PointSeededTrackingRegionsProducer.h>

Inheritance diagram for PointSeededTrackingRegionsProducer:
TrackingRegionProducer

Public Types

enum  Mode { BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, VERTICES_FIXED, VERTICES_SIGMA }
 

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

std::vector< double > etaPoints
 
float m_deltaEta
 
float m_deltaPhi
 
int m_maxNRegions
 
int m_maxNVertices
 
Mode m_mode
 
float m_nSigmaZBeamSpot
 
float m_nSigmaZVertex
 
float m_originRadius
 
bool m_precise
 
float m_ptMin
 
bool m_searchOpt
 
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
 
float m_zErrorBeamSpot
 
float m_zErrorVetex
 
std::vector< double > phiPoints
 
edm::EDGetTokenT< reco::BeamSpottoken_beamSpot
 
edm::ESGetToken< MagneticField,
IdealMagneticFieldRecord
token_field
 
edm::EDGetTokenT
< MeasurementTrackerEvent
token_measurementTracker
 
edm::ESGetToken
< MultipleScatteringParametrisationMaker,
TrackerMultipleScatteringRecord
token_msmaker
 
edm::EDGetTokenT
< reco::VertexCollection
token_vertex
 

Detailed Description

class PointSeededTrackingRegionsProducer

eta-phi TrackingRegions producer in directions defined by Point-based objects of interest from the "input" parameters.

Four operational modes are supported ("mode" parameter):

BeamSpotFixed: origin is defined by the beam spot z-half-length is defined by a fixed zErrorBeamSpot parameter BeamSpotSigma: origin is defined by the beam spot z-half-length is defined by nSigmaZBeamSpot * beamSpot.sigmaZ VerticesFixed: origins are defined by vertices from VertexCollection (use maximum MaxNVertices of them) z-half-length is defined by a fixed zErrorVetex parameter VerticesSigma: origins are defined by vertices from VertexCollection (use maximum MaxNVertices of them) z-half-length is defined by nSigmaZVertex * vetex.zError

If, while using one of the "Vertices" modes, there's no vertices in an event, we fall back into either BeamSpotSigma or BeamSpotFixed mode, depending on the positiveness of nSigmaZBeamSpot.

Definition at line 52 of file PointSeededTrackingRegionsProducer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

PointSeededTrackingRegionsProducer::PointSeededTrackingRegionsProducer ( const edm::ParameterSet conf,
edm::ConsumesCollector &&  iC 
)
inlineexplicit

Definition at line 56 of file PointSeededTrackingRegionsProducer.h.

References BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, edm::errors::Configuration, etaPoints, Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), RectangularEtaPhiTrackingRegion::kNever, m_deltaEta, m_deltaPhi, m_maxNRegions, m_maxNVertices, m_mode, m_nSigmaZBeamSpot, m_nSigmaZVertex, m_originRadius, m_precise, m_ptMin, m_searchOpt, m_whereToUseMeasurementTracker, m_zErrorBeamSpot, m_zErrorVetex, phiPoints, AlCaHLTBitMon_QueryRunRegistry::string, RectangularEtaPhiTrackingRegion::stringToUseMeasurementTracker(), token_beamSpot, token_measurementTracker, token_msmaker, token_vertex, VERTICES_FIXED, and VERTICES_SIGMA.

57  : token_field(iC.esConsumes()) {
58  edm::ParameterSet regPSet = conf.getParameter<edm::ParameterSet>("RegionPSet");
59 
60  // operation mode
61  std::string modeString = regPSet.getParameter<std::string>("mode");
62  if (modeString == "BeamSpotFixed")
64  else if (modeString == "BeamSpotSigma")
66  else if (modeString == "VerticesFixed")
68  else if (modeString == "VerticesSigma")
70  else
71  edm::LogError("PointSeededTrackingRegionsProducer") << "Unknown mode string: " << modeString;
72 
73  // basic inputsi
74  edm::ParameterSet points = regPSet.getParameter<edm::ParameterSet>("points");
75  etaPoints = points.getParameter<std::vector<double>>("eta");
76  phiPoints = points.getParameter<std::vector<double>>("phi");
77  if (!(etaPoints.size() == phiPoints.size()))
78  throw edm::Exception(edm::errors::Configuration) << "The parameters 'eta' and 'phi' must have the same size";
79  ;
80  m_maxNRegions = regPSet.getParameter<int>("maxNRegions");
82  m_maxNVertices = 1;
84  token_vertex = iC.consumes<reco::VertexCollection>(regPSet.getParameter<edm::InputTag>("vertexCollection"));
85  m_maxNVertices = regPSet.getParameter<int>("maxNVertices");
86  }
87 
88  // RectangularEtaPhiTrackingRegion parameters:
89  m_ptMin = regPSet.getParameter<double>("ptMin");
90  m_originRadius = regPSet.getParameter<double>("originRadius");
91  m_zErrorBeamSpot = regPSet.getParameter<double>("zErrorBeamSpot");
92  m_deltaEta = regPSet.getParameter<double>("deltaEta");
93  m_deltaPhi = regPSet.getParameter<double>("deltaPhi");
94  m_precise = regPSet.getParameter<bool>("precise");
96  regPSet.getParameter<std::string>("whereToUseMeasurementTracker"));
97  if (m_whereToUseMeasurementTracker != RectangularEtaPhiTrackingRegion::UseMeasurementTracker::kNever) {
99  iC.consumes<MeasurementTrackerEvent>(regPSet.getParameter<edm::InputTag>("measurementTrackerName"));
100  }
101  m_searchOpt = false;
102  if (regPSet.exists("searchOpt"))
103  m_searchOpt = regPSet.getParameter<bool>("searchOpt");
104 
105  // mode-dependent z-halflength of tracking regions
106  if (m_mode == VERTICES_SIGMA)
107  m_nSigmaZVertex = regPSet.getParameter<double>("nSigmaZVertex");
108  if (m_mode == VERTICES_FIXED)
109  m_zErrorVetex = regPSet.getParameter<double>("zErrorVetex");
110  m_nSigmaZBeamSpot = -1.;
111  if (m_mode == BEAM_SPOT_SIGMA) {
112  m_nSigmaZBeamSpot = regPSet.getParameter<double>("nSigmaZBeamSpot");
113  if (m_nSigmaZBeamSpot < 0.)
114  edm::LogError("PointSeededTrackingRegionsProducer")
115  << "nSigmaZBeamSpot must be positive for BeamSpotSigma mode!";
116  }
117 
118  if (m_precise) {
119  token_msmaker = iC.esConsumes();
120  }
121  }
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > token_field
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > token_msmaker
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
static UseMeasurementTracker stringToUseMeasurementTracker(const std::string &name)
Log< level::Error, false > LogError
edm::EDGetTokenT< MeasurementTrackerEvent > token_measurementTracker
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
edm::EDGetTokenT< reco::VertexCollection > token_vertex
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PointSeededTrackingRegionsProducer::~PointSeededTrackingRegionsProducer ( )
inlineoverride

Definition at line 123 of file PointSeededTrackingRegionsProducer.h.

123 {}

Member Function Documentation

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

Definition at line 125 of file PointSeededTrackingRegionsProducer.h.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, HLT_FULL_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

125  {
127 
128  edm::ParameterSetDescription descPoints;
129  descPoints.add<std::vector<double>>("eta", {0.});
130  descPoints.add<std::vector<double>>("phi", {0.});
131  desc.add<edm::ParameterSetDescription>("points", descPoints);
132 
133  desc.add<std::string>("mode", "BeamSpotFixed");
134  desc.add<int>("maxNRegions", 10);
135  desc.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
136  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("hltPixelVertices"));
137  desc.add<int>("maxNVertices", 1);
138 
139  desc.add<double>("ptMin", 0.9);
140  desc.add<double>("originRadius", 0.2);
141  desc.add<double>("zErrorBeamSpot", 24.2);
142  desc.add<double>("deltaEta", 0.5);
143  desc.add<double>("deltaPhi", 0.5);
144  desc.add<bool>("precise", true);
145 
146  desc.add<double>("nSigmaZVertex", 3.);
147  desc.add<double>("zErrorVetex", 0.2);
148  desc.add<double>("nSigmaZBeamSpot", 4.);
149 
150  desc.add<std::string>("whereToUseMeasurementTracker", "ForSiStrips");
151  desc.add<edm::InputTag>("measurementTrackerName", edm::InputTag(""));
152 
153  desc.add<bool>("searchOpt", false);
154 
155  // Only for backwards-compatibility
156  edm::ParameterSetDescription descRegion;
157  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
158  //edm::ParameterSetDescription descPoint;
159  //descPoint.add<edm::ParameterSetDescription>("point_input", desc);
160 
161  descriptions.add("pointSeededTrackingRegion", descRegion);
162  }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector<std::unique_ptr<TrackingRegion> > PointSeededTrackingRegionsProducer::regions ( const edm::Event e,
const edm::EventSetup es 
) const
inlineoverridevirtual

Implements TrackingRegionProducer.

Definition at line 164 of file PointSeededTrackingRegionsProducer.h.

References BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, cms::cuda::bs, funct::cos(), etaPoints, makeMEIFBenchmarkPlots::ev, funct::exp(), first, edm::Event::getByToken(), edm::EventSetup::getData(), mps_fire::i, edm::EDGetTokenT< T >::isUninitialized(), edm::HandleBase::isValid(), gpuVertexFinder::iv, dqmiolumiharvest::j, m_deltaEta, m_deltaPhi, m_maxNRegions, m_maxNVertices, m_mode, m_nSigmaZBeamSpot, m_nSigmaZVertex, m_originRadius, m_precise, m_ptMin, m_searchOpt, m_whereToUseMeasurementTracker, m_zErrorBeamSpot, m_zErrorVetex, HLT_FULL_cff::measurementTracker, phiPoints, edm::Handle< T >::product(), mps_fire::result, edm::second(), funct::sin(), funct::tan(), theta(), token_beamSpot, token_field, token_measurementTracker, token_msmaker, token_vertex, beam_dqm_sourceclient-live_cfg::vertices, VERTICES_FIXED, VERTICES_SIGMA, x, y, and z.

164  {
165  std::vector<std::unique_ptr<TrackingRegion>> result;
166 
167  // always need the beam spot (as a fall back strategy for vertex modes)
169  e.getByToken(token_beamSpot, bs);
170  if (!bs.isValid())
171  return result;
172 
173  const auto& field = es.getData(token_field);
174  const MultipleScatteringParametrisationMaker* msmaker = nullptr;
175  if (m_precise) {
176  msmaker = &es.getData(token_msmaker);
177  }
178 
179  // this is a default origin for all modes
180  GlobalPoint default_origin(bs->x0(), bs->y0(), bs->z0());
181 
182  // vector of origin & halfLength pairs:
183  std::vector<std::pair<GlobalPoint, float>> origins;
184 
185  // fill the origins and halfLengths depending on the mode
187  origins.push_back(std::make_pair(
188  default_origin, (m_mode == BEAM_SPOT_FIXED) ? m_zErrorBeamSpot : m_nSigmaZBeamSpot * bs->sigmaZ()));
189  } else if (m_mode == VERTICES_FIXED || m_mode == VERTICES_SIGMA) {
191  e.getByToken(token_vertex, vertices);
192  int n_vert = 0;
193  for (reco::VertexCollection::const_iterator iv = vertices->begin(), ev = vertices->end();
194  iv != ev && n_vert < m_maxNVertices;
195  ++iv) {
196  if (iv->isFake() || !iv->isValid())
197  continue;
198 
199  origins.push_back(std::make_pair(GlobalPoint(iv->x(), iv->y(), iv->z()),
200  (m_mode == VERTICES_FIXED) ? m_zErrorVetex : m_nSigmaZVertex * iv->zError()));
201  ++n_vert;
202  }
203  // no-vertex fall-back case:
204  if (origins.empty()) {
205  origins.push_back(std::make_pair(
206  default_origin, (m_nSigmaZBeamSpot > 0.) ? m_nSigmaZBeamSpot * bs->z0Error() : m_zErrorBeamSpot));
207  }
208  }
209 
214  measurementTracker = hmte.product();
215  }
216 
217  // create tracking regions (maximum MaxNRegions of them) in directions of the
218  // points of interest
219  size_t n_points = etaPoints.size();
220  int n_regions = 0;
221  for (size_t i = 0; i < n_points && n_regions < m_maxNRegions; ++i) {
222  double x = std::cos(phiPoints[i]);
223  double y = std::sin(phiPoints[i]);
224  double theta = 2 * std::atan(std::exp(-etaPoints[i]));
225  double z = 1. / std::tan(theta);
226 
227  GlobalVector direction(x, y, z);
228 
229  for (size_t j = 0; j < origins.size() && n_regions < m_maxNRegions; ++j) {
230  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(direction, // GlobalVector
231  origins[j].first, // GlobalPoint
232  m_ptMin,
234  origins[j].second,
235  m_deltaEta,
236  m_deltaPhi,
237  field,
238  msmaker,
239  m_precise,
241  measurementTracker,
242  m_searchOpt));
243  ++n_regions;
244  }
245  }
246  edm::LogInfo("PointSeededTrackingRegionsProducer") << "produced " << n_regions << " regions";
247 
248  return result;
249  }
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > token_field
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > token_msmaker
int32_t *__restrict__ iv
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
tuple measurementTracker
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:99
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
edm::EDGetTokenT< MeasurementTrackerEvent > token_measurementTracker
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
tuple result
Definition: mps_fire.py:311
bool getData(T &iHolder) const
Definition: EventSetup.h:122
U second(std::pair< T, U > const &p)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
edm::EDGetTokenT< reco::VertexCollection > token_vertex
bool isValid() const
Definition: HandleBase.h:70
Log< level::Info, false > LogInfo
T const * product() const
Definition: Handle.h:70

Member Data Documentation

std::vector<double> PointSeededTrackingRegionsProducer::etaPoints
private
float PointSeededTrackingRegionsProducer::m_deltaEta
private
float PointSeededTrackingRegionsProducer::m_deltaPhi
private
int PointSeededTrackingRegionsProducer::m_maxNRegions
private
int PointSeededTrackingRegionsProducer::m_maxNVertices
private
Mode PointSeededTrackingRegionsProducer::m_mode
private
float PointSeededTrackingRegionsProducer::m_nSigmaZBeamSpot
private
float PointSeededTrackingRegionsProducer::m_nSigmaZVertex
private
float PointSeededTrackingRegionsProducer::m_originRadius
private
bool PointSeededTrackingRegionsProducer::m_precise
private
float PointSeededTrackingRegionsProducer::m_ptMin
private
bool PointSeededTrackingRegionsProducer::m_searchOpt
private
RectangularEtaPhiTrackingRegion::UseMeasurementTracker PointSeededTrackingRegionsProducer::m_whereToUseMeasurementTracker
private
float PointSeededTrackingRegionsProducer::m_zErrorBeamSpot
private
float PointSeededTrackingRegionsProducer::m_zErrorVetex
private
std::vector<double> PointSeededTrackingRegionsProducer::phiPoints
private
edm::EDGetTokenT<reco::BeamSpot> PointSeededTrackingRegionsProducer::token_beamSpot
private
edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> PointSeededTrackingRegionsProducer::token_field
private

Definition at line 270 of file PointSeededTrackingRegionsProducer.h.

Referenced by regions().

edm::EDGetTokenT<MeasurementTrackerEvent> PointSeededTrackingRegionsProducer::token_measurementTracker
private
edm::ESGetToken<MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord> PointSeededTrackingRegionsProducer::token_msmaker
private
edm::EDGetTokenT<reco::VertexCollection> PointSeededTrackingRegionsProducer::token_vertex
private