CMS 3D CMS Logo

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, IdealMagneticFieldRecordtoken_field
 
edm::EDGetTokenT< MeasurementTrackerEventtoken_measurementTracker
 
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecordtoken_msmaker
 
edm::EDGetTokenT< reco::VertexCollectiontoken_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

◆ Mode

Constructor & Destructor Documentation

◆ PointSeededTrackingRegionsProducer()

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"));
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)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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

◆ ~PointSeededTrackingRegionsProducer()

PointSeededTrackingRegionsProducer::~PointSeededTrackingRegionsProducer ( )
inlineoverride

Definition at line 123 of file PointSeededTrackingRegionsProducer.h.

123 {}

Member Function Documentation

◆ fillDescriptions()

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, ProducerED_cfi::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)

◆ regions()

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(), MillePedeFileConverter_cfg::e, etaPoints, makeMEIFBenchmarkPlots::ev, JetChargeProducer_cfi::exp, dqmdumpme::first, edm::EventSetup::getData(), mps_fire::i, edm::EDGetTokenT< T >::isUninitialized(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::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, HLTSiStripMonitoring_cff::measurementTracker, phiPoints, edm::Handle< T >::product(), mps_fire::result, edm::second(), funct::sin(), funct::tan(), tauSpinnerTable_cfi::theta, token_beamSpot, token_field, token_measurementTracker, token_msmaker, token_vertex, AlignmentTracksFromVertexSelector_cfi::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 
213  e.getByToken(token_measurementTracker, hmte);
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,
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
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T const * product() const
Definition: Handle.h:70
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:98
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
edm::EDGetTokenT< MeasurementTrackerEvent > token_measurementTracker
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
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
Log< level::Info, false > LogInfo

Member Data Documentation

◆ etaPoints

std::vector<double> PointSeededTrackingRegionsProducer::etaPoints
private

◆ m_deltaEta

float PointSeededTrackingRegionsProducer::m_deltaEta
private

◆ m_deltaPhi

float PointSeededTrackingRegionsProducer::m_deltaPhi
private

◆ m_maxNRegions

int PointSeededTrackingRegionsProducer::m_maxNRegions
private

◆ m_maxNVertices

int PointSeededTrackingRegionsProducer::m_maxNVertices
private

◆ m_mode

Mode PointSeededTrackingRegionsProducer::m_mode
private

◆ m_nSigmaZBeamSpot

float PointSeededTrackingRegionsProducer::m_nSigmaZBeamSpot
private

◆ m_nSigmaZVertex

float PointSeededTrackingRegionsProducer::m_nSigmaZVertex
private

◆ m_originRadius

float PointSeededTrackingRegionsProducer::m_originRadius
private

◆ m_precise

bool PointSeededTrackingRegionsProducer::m_precise
private

◆ m_ptMin

float PointSeededTrackingRegionsProducer::m_ptMin
private

◆ m_searchOpt

bool PointSeededTrackingRegionsProducer::m_searchOpt
private

◆ m_whereToUseMeasurementTracker

RectangularEtaPhiTrackingRegion::UseMeasurementTracker PointSeededTrackingRegionsProducer::m_whereToUseMeasurementTracker
private

◆ m_zErrorBeamSpot

float PointSeededTrackingRegionsProducer::m_zErrorBeamSpot
private

◆ m_zErrorVetex

float PointSeededTrackingRegionsProducer::m_zErrorVetex
private

◆ phiPoints

std::vector<double> PointSeededTrackingRegionsProducer::phiPoints
private

◆ token_beamSpot

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

◆ token_field

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> PointSeededTrackingRegionsProducer::token_field
private

Definition at line 270 of file PointSeededTrackingRegionsProducer.h.

Referenced by regions().

◆ token_measurementTracker

edm::EDGetTokenT<MeasurementTrackerEvent> PointSeededTrackingRegionsProducer::token_measurementTracker
private

◆ token_msmaker

edm::ESGetToken<MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord> PointSeededTrackingRegionsProducer::token_msmaker
private

◆ token_vertex

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