CMS 3D CMS Logo

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

#include <CandidatePointSeededTrackingRegionsProducer.h>

Inheritance diagram for CandidatePointSeededTrackingRegionsProducer:
TrackingRegionProducer

Public Types

enum  SeedingMode { SeedingMode::CANDIDATE_SEEDED, SeedingMode::POINT_SEEDED, SeedingMode::CANDIDATE_POINT_SEEDED }
 

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

float m_deltaEta_Cand
 
float m_deltaEta_Point
 
float m_deltaPhi_Cand
 
float m_deltaPhi_Point
 
std::vector< GlobalVectorm_directionPoints
 
std::vector< std::pair< double, double > > m_etaPhiPoints
 
int m_maxNRegions
 
float m_originRadius
 
VertexBeamspotOrigins m_origins
 
bool m_precise
 
float m_ptMin
 
bool m_searchOpt
 
SeedingMode m_seedingMode
 
edm::EDGetTokenT< reco::CandidateViewm_token_input
 
edm::EDGetTokenT< MeasurementTrackerEventm_token_measurementTracker
 
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordtoken_field
 
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecordtoken_msmaker
 

Detailed Description

class CandidatePointSeededTrackingRegionsProducer

eta-phi TrackingRegions producer in directions defined by Candidate-based objects of interest from a collection defined by the "input" parameter.

Four operational modes are supported ("operationMode" 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.

Three seeding modes are supported ("seedingMode" parameter):

Candidate-seeded: defines regions around candidates from the "input" collection Point-seeded: defines regions around fixed points in the detector (previously in PointSeededTrackingRegionsProducer) Candidate+point-seeded: defines regions as intersections of regions around candidates from the "input" collections and around fixed points in the detector

Authors
Vadim Khotilovich + Thomas Strebler

Definition at line 58 of file CandidatePointSeededTrackingRegionsProducer.h.

Member Enumeration Documentation

◆ SeedingMode

Enumerator
CANDIDATE_SEEDED 
POINT_SEEDED 
CANDIDATE_POINT_SEEDED 

Definition at line 60 of file CandidatePointSeededTrackingRegionsProducer.h.

60 { CANDIDATE_SEEDED, POINT_SEEDED, CANDIDATE_POINT_SEEDED };

Constructor & Destructor Documentation

◆ CandidatePointSeededTrackingRegionsProducer()

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

Definition at line 62 of file CandidatePointSeededTrackingRegionsProducer.h.

References CANDIDATE_POINT_SEEDED, CANDIDATE_SEEDED, edm::errors::Configuration, funct::cos(), Exception, edm::ParameterSet::exists(), JetChargeProducer_cfi::exp, edm::ParameterSet::getParameter(), mps_fire::i, RectangularEtaPhiTrackingRegion::kNever, m_deltaEta_Cand, m_deltaEta_Point, m_deltaPhi_Cand, m_deltaPhi_Point, m_directionPoints, m_etaPhiPoints, m_maxNRegions, m_originRadius, m_precise, m_ptMin, m_searchOpt, m_seedingMode, m_token_input, m_token_measurementTracker, m_whereToUseMeasurementTracker, POINT_SEEDED, hiPixelPairStep_cff::points, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, RectangularEtaPhiTrackingRegion::stringToUseMeasurementTracker(), funct::tan(), theta(), token_msmaker, x, y, and z.

63  : m_origins(conf.getParameter<edm::ParameterSet>("RegionPSet"), iC), token_field(iC.esConsumes()) {
64  edm::ParameterSet regPSet = conf.getParameter<edm::ParameterSet>("RegionPSet");
65 
66  // seeding mode
67  std::string seedingModeString = regPSet.getParameter<std::string>("seedingMode");
68  if (seedingModeString == "Candidate")
70  else if (seedingModeString == "Point")
72  else if (seedingModeString == "CandidatePoint")
74  else
75  throw edm::Exception(edm::errors::Configuration) << "Unknown seeding mode string: " << seedingModeString;
76 
77  // basic inputs
80 
81  // Specific points in the detector
84  std::vector<double> etaPoints = points.getParameter<std::vector<double>>("eta");
85  std::vector<double> phiPoints = points.getParameter<std::vector<double>>("phi");
86 
87  if (!(etaPoints.size() == phiPoints.size()))
88  throw edm::Exception(edm::errors::Configuration) << "The parameters 'eta' and 'phi' must have the same size";
89  if (etaPoints.empty())
91  << "At least one point should be defined for point or candidate+point seeding modes";
92 
93  for (size_t i = 0; i < etaPoints.size(); ++i) {
94  m_etaPhiPoints.push_back(std::make_pair(etaPoints[i], phiPoints[i]));
95 
96  double x = std::cos(phiPoints[i]);
97  double y = std::sin(phiPoints[i]);
98  double theta = 2 * std::atan(std::exp(-etaPoints[i]));
99  double z = 1. / std::tan(theta);
100  GlobalVector direction(x, y, z);
101  m_directionPoints.push_back(direction);
102  }
103  }
104 
105  m_maxNRegions = regPSet.getParameter<unsigned int>("maxNRegions");
106  if (m_maxNRegions == 0)
107  throw edm::Exception(edm::errors::Configuration) << "maxNRegions should be greater than or equal to 1";
108 
109  // RectangularEtaPhiTrackingRegion parameters:
110  m_ptMin = regPSet.getParameter<double>("ptMin");
111  m_originRadius = regPSet.getParameter<double>("originRadius");
112 
114  m_deltaEta_Cand = regPSet.getParameter<double>("deltaEta_Cand");
115  m_deltaPhi_Cand = regPSet.getParameter<double>("deltaPhi_Cand");
116  if (m_deltaEta_Cand < 0 || m_deltaPhi_Cand < 0)
118  << "Delta eta and phi parameters must be set for candidates in candidate seeding mode";
120  m_deltaEta_Point = regPSet.getParameter<double>("deltaEta_Point");
121  m_deltaPhi_Point = regPSet.getParameter<double>("deltaPhi_Point");
122  if (m_deltaEta_Point < 0 || m_deltaPhi_Point < 0)
124  << "Delta eta and phi parameters must be set for points in point seeding mode";
126  m_deltaEta_Cand = regPSet.getParameter<double>("deltaEta_Cand");
127  m_deltaPhi_Cand = regPSet.getParameter<double>("deltaPhi_Cand");
128  m_deltaEta_Point = regPSet.getParameter<double>("deltaEta_Point");
129  m_deltaPhi_Point = regPSet.getParameter<double>("deltaPhi_Point");
131  throw edm::Exception(edm::errors::Configuration) << "Delta eta and phi parameters must be set separately for "
132  "candidates and points in candidate+point seeding mode";
133  }
134 
135  m_precise = regPSet.getParameter<bool>("precise");
137  regPSet.getParameter<std::string>("whereToUseMeasurementTracker"));
140  iC.consumes<MeasurementTrackerEvent>(regPSet.getParameter<edm::InputTag>("measurementTrackerName"));
141  }
142  m_searchOpt = false;
143  if (regPSet.exists("searchOpt"))
144  m_searchOpt = regPSet.getParameter<bool>("searchOpt");
145 
146  if (m_precise) {
147  token_msmaker = iC.esConsumes();
148  }
149  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
bool exists(std::string const &parameterName) const
checks if a parameter exists
static UseMeasurementTracker stringToUseMeasurementTracker(const std::string &name)
edm::EDGetTokenT< MeasurementTrackerEvent > m_token_measurementTracker
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > token_field
Geom::Theta< T > theta() const
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > token_msmaker

◆ ~CandidatePointSeededTrackingRegionsProducer()

CandidatePointSeededTrackingRegionsProducer::~CandidatePointSeededTrackingRegionsProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 153 of file CandidatePointSeededTrackingRegionsProducer.h.

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

153  {
155 
156  desc.add<std::string>("seedingMode", "Candidate");
157 
158  desc.add<edm::InputTag>("input", edm::InputTag(""));
159  edm::ParameterSetDescription descPoints;
160  descPoints.add<std::vector<double>>("eta", {});
161  descPoints.add<std::vector<double>>("phi", {});
162  desc.add<edm::ParameterSetDescription>("points", descPoints);
163 
164  desc.add<unsigned int>("maxNRegions", 10);
165 
166  VertexBeamspotOrigins::fillDescriptions(desc, "hltOnlineBeamSpot", "hltPixelVertices", 1);
167 
168  desc.add<double>("ptMin", 0.9);
169  desc.add<double>("originRadius", 0.2);
170  desc.add<double>("deltaEta_Cand", -1.);
171  desc.add<double>("deltaPhi_Cand", -1.);
172  desc.add<double>("deltaEta_Point", -1.);
173  desc.add<double>("deltaPhi_Point", -1.);
174  desc.add<bool>("precise", true);
175 
176  desc.add<std::string>("whereToUseMeasurementTracker", "ForSiStrips");
177  desc.add<edm::InputTag>("measurementTrackerName", edm::InputTag(""));
178 
179  desc.add<bool>("searchOpt", false);
180 
181  // Only for backwards-compatibility
182  edm::ParameterSetDescription descRegion;
183  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
184 
185  descriptions.add("candidatePointSeededTrackingRegionsFromBeamSpot", descRegion);
186  }
static void fillDescriptions(edm::ParameterSetDescription &desc, const std::string &defaultBeamSpot="offlineBeamSpot", const std::string &defaultVertex="firstStepPrimaryVertices", int defaultMaxVertices=-1)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ regions()

std::vector<std::unique_ptr<TrackingRegion> > CandidatePointSeededTrackingRegionsProducer::regions ( const edm::Event e,
const edm::EventSetup es 
) const
inlineoverridevirtual

Implements TrackingRegionProducer.

Definition at line 188 of file CandidatePointSeededTrackingRegionsProducer.h.

References funct::abs(), CANDIDATE_POINT_SEEDED, CANDIDATE_SEEDED, funct::cos(), SiPixelRawToDigiRegional_cfi::deltaPhi, MillePedeFileConverter_cfg::e, JetChargeProducer_cfi::exp, edm::EventSetup::getData(), edm::EDGetTokenT< T >::isUninitialized(), m_deltaEta_Cand, m_deltaEta_Point, m_deltaPhi_Cand, m_deltaPhi_Point, m_directionPoints, m_etaPhiPoints, m_maxNRegions, m_originRadius, m_origins, M_PI, m_precise, m_ptMin, m_searchOpt, m_seedingMode, m_token_input, m_token_measurementTracker, m_whereToUseMeasurementTracker, SiStripPI::max, HLTSiStripMonitoring_cff::measurementTracker, SiStripPI::min, normalizedPhi(), L1TPhase2Offline_cfi::objects, HLTEGTnPMonitor_cfi::objs, VertexBeamspotOrigins::origins(), POINT_SEEDED, edm::Handle< T >::product(), mps_fire::result, funct::sin(), funct::tan(), theta(), token_field, token_msmaker, x, y, and z.

188  {
189  std::vector<std::unique_ptr<TrackingRegion>> result;
190 
191  // pick up the candidate objects of interest
193  size_t n_objects = 0;
194 
196  e.getByToken(m_token_input, objects);
197  n_objects = objects->size();
198  if (n_objects == 0)
199  return result;
200  }
201 
202  const auto& objs = *objects;
203 
204  const auto& origins = m_origins.origins(e);
205  if (origins.empty()) {
206  return result;
207  }
208 
212  e.getByToken(m_token_measurementTracker, hmte);
213  measurementTracker = hmte.product();
214  }
215 
216  const auto& field = es.getData(token_field);
217  const MultipleScatteringParametrisationMaker* msmaker = nullptr;
218  if (m_precise) {
219  msmaker = &es.getData(token_msmaker);
220  }
221 
222  // create tracking regions (maximum MaxNRegions of them) in directions of the
223  // objects of interest (we expect that the collection was sorted in decreasing pt order)
224  int n_regions = 0;
225 
227  for (const auto& object : objs) {
228  GlobalVector direction(object.momentum().x(), object.momentum().y(), object.momentum().z());
229 
230  for (const auto& origin : origins) {
231  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(direction,
232  origin.first,
233  m_ptMin,
235  origin.second,
238  field,
239  msmaker,
240  m_precise,
243  m_searchOpt));
244  ++n_regions;
245  if (n_regions >= m_maxNRegions)
246  break;
247  }
248 
249  if (n_regions >= m_maxNRegions)
250  break;
251  }
252 
253  }
254 
256  for (const auto& direction : m_directionPoints) {
257  for (const auto& origin : origins) {
258  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(direction, // GlobalVector
259  origin.first, // GlobalPoint
260  m_ptMin,
262  origin.second,
265  field,
266  msmaker,
267  m_precise,
270  m_searchOpt));
271  ++n_regions;
272  if (n_regions >= m_maxNRegions)
273  break;
274  }
275 
276  if (n_regions >= m_maxNRegions)
277  break;
278  }
279 
280  }
281 
283  for (const auto& object : objs) {
284  double eta_Cand = object.eta();
285  double phi_Cand = object.phi();
286 
287  for (const auto& etaPhiPoint : m_etaPhiPoints) {
288  double eta_Point = etaPhiPoint.first;
289  double phi_Point = etaPhiPoint.second;
290  double dEta_Cand_Point = std::abs(eta_Cand - eta_Point);
291  double dPhi_Cand_Point = std::abs(deltaPhi(phi_Cand, phi_Point));
292 
293  //Check if there is an overlap between Candidate- and Point-based regions of interest
294  if (dEta_Cand_Point > (m_deltaEta_Cand + m_deltaEta_Point) ||
295  dPhi_Cand_Point > (m_deltaPhi_Cand + m_deltaPhi_Point))
296  continue;
297 
298  //Determines boundaries of intersection of RoIs
299  double etaMin_RoI = std::max(eta_Cand - m_deltaEta_Cand, eta_Point - m_deltaEta_Point);
300  double etaMax_RoI = std::min(eta_Cand + m_deltaEta_Cand, eta_Point + m_deltaEta_Point);
301 
302  double phi_Cand_minus = normalizedPhi(phi_Cand - m_deltaPhi_Cand);
303  double phi_Point_minus = normalizedPhi(phi_Point - m_deltaPhi_Point);
304  double phi_Cand_plus = normalizedPhi(phi_Cand + m_deltaPhi_Cand);
305  double phi_Point_plus = normalizedPhi(phi_Point + m_deltaPhi_Point);
306 
307  double phiMin_RoI = deltaPhi(phi_Cand_minus, phi_Point_minus) > 0. ? phi_Cand_minus : phi_Point_minus;
308  double phiMax_RoI = deltaPhi(phi_Cand_plus, phi_Point_plus) < 0. ? phi_Cand_plus : phi_Point_plus;
309 
310  //Determines position and width of new RoI
311  double eta_RoI = 0.5 * (etaMax_RoI + etaMin_RoI);
312  double deltaEta_RoI = etaMax_RoI - eta_RoI;
313 
314  double phi_RoI = 0.5 * (phiMax_RoI + phiMin_RoI);
315  if (phiMax_RoI < phiMin_RoI)
316  phi_RoI -= M_PI;
317  phi_RoI = normalizedPhi(phi_RoI);
318  double deltaPhi_RoI = deltaPhi(phiMax_RoI, phi_RoI);
319 
320  double x = std::cos(phi_RoI);
321  double y = std::sin(phi_RoI);
322  double theta = 2 * std::atan(std::exp(-eta_RoI));
323  double z = 1. / std::tan(theta);
324 
325  GlobalVector direction(x, y, z);
326 
327  for (const auto& origin : origins) {
328  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(direction,
329  origin.first,
330  m_ptMin,
332  origin.second,
333  deltaEta_RoI,
334  deltaPhi_RoI,
335  field,
336  msmaker,
337  m_precise,
340  m_searchOpt));
341  ++n_regions;
342  if (n_regions >= m_maxNRegions)
343  break;
344  }
345 
346  if (n_regions >= m_maxNRegions)
347  break;
348  }
349 
350  if (n_regions >= m_maxNRegions)
351  break;
352  }
353  }
354 
355  edm::LogInfo("CandidatePointSeededTrackingRegionsProducer") << "produced " << n_regions << " regions";
356 
357  return result;
358  }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
constexpr T normalizedPhi(T phi)
Definition: normalizedPhi.h:8
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:104
edm::EDGetTokenT< MeasurementTrackerEvent > m_token_measurementTracker
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
Log< level::Info, false > LogInfo
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > token_field
Origins origins(const edm::Event &iEvent) const
Geom::Theta< T > theta() const
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > token_msmaker

Member Data Documentation

◆ m_deltaEta_Cand

float CandidatePointSeededTrackingRegionsProducer::m_deltaEta_Cand
private

◆ m_deltaEta_Point

float CandidatePointSeededTrackingRegionsProducer::m_deltaEta_Point
private

◆ m_deltaPhi_Cand

float CandidatePointSeededTrackingRegionsProducer::m_deltaPhi_Cand
private

◆ m_deltaPhi_Point

float CandidatePointSeededTrackingRegionsProducer::m_deltaPhi_Point
private

◆ m_directionPoints

std::vector<GlobalVector> CandidatePointSeededTrackingRegionsProducer::m_directionPoints
private

◆ m_etaPhiPoints

std::vector<std::pair<double, double> > CandidatePointSeededTrackingRegionsProducer::m_etaPhiPoints
private

◆ m_maxNRegions

int CandidatePointSeededTrackingRegionsProducer::m_maxNRegions
private

◆ m_originRadius

float CandidatePointSeededTrackingRegionsProducer::m_originRadius
private

◆ m_origins

VertexBeamspotOrigins CandidatePointSeededTrackingRegionsProducer::m_origins
private

Definition at line 361 of file CandidatePointSeededTrackingRegionsProducer.h.

Referenced by regions().

◆ m_precise

bool CandidatePointSeededTrackingRegionsProducer::m_precise
private

◆ m_ptMin

float CandidatePointSeededTrackingRegionsProducer::m_ptMin
private

◆ m_searchOpt

bool CandidatePointSeededTrackingRegionsProducer::m_searchOpt
private

◆ m_seedingMode

SeedingMode CandidatePointSeededTrackingRegionsProducer::m_seedingMode
private

◆ m_token_input

edm::EDGetTokenT<reco::CandidateView> CandidatePointSeededTrackingRegionsProducer::m_token_input
private

◆ m_token_measurementTracker

edm::EDGetTokenT<MeasurementTrackerEvent> CandidatePointSeededTrackingRegionsProducer::m_token_measurementTracker
private

◆ m_whereToUseMeasurementTracker

RectangularEtaPhiTrackingRegion::UseMeasurementTracker CandidatePointSeededTrackingRegionsProducer::m_whereToUseMeasurementTracker
private

◆ token_field

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

Definition at line 379 of file CandidatePointSeededTrackingRegionsProducer.h.

Referenced by regions().

◆ token_msmaker

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