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::EDGetTokenT< MeasurementTrackerEventtoken_measurementTracker
 
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 48 of file PointSeededTrackingRegionsProducer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 52 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, HLT_2018_cff::points, AlCaHLTBitMon_QueryRunRegistry::string, RectangularEtaPhiTrackingRegion::stringToUseMeasurementTracker(), token_beamSpot, token_measurementTracker, token_vertex, VERTICES_FIXED, and VERTICES_SIGMA.

52  {
53  edm::ParameterSet regPSet = conf.getParameter<edm::ParameterSet>("RegionPSet");
54 
55  // operation mode
56  std::string modeString = regPSet.getParameter<std::string>("mode");
57  if (modeString == "BeamSpotFixed")
59  else if (modeString == "BeamSpotSigma")
61  else if (modeString == "VerticesFixed")
63  else if (modeString == "VerticesSigma")
65  else
66  edm::LogError("PointSeededTrackingRegionsProducer") << "Unknown mode string: " << modeString;
67 
68  // basic inputsi
70  etaPoints = points.getParameter<std::vector<double>>("eta");
71  phiPoints = points.getParameter<std::vector<double>>("phi");
72  if (!(etaPoints.size() == phiPoints.size()))
73  throw edm::Exception(edm::errors::Configuration) << "The parameters 'eta' and 'phi' must have the same size";
74  ;
75  m_maxNRegions = regPSet.getParameter<int>("maxNRegions");
77  m_maxNVertices = 1;
79  token_vertex = iC.consumes<reco::VertexCollection>(regPSet.getParameter<edm::InputTag>("vertexCollection"));
80  m_maxNVertices = regPSet.getParameter<int>("maxNVertices");
81  }
82 
83  // RectangularEtaPhiTrackingRegion parameters:
84  m_ptMin = regPSet.getParameter<double>("ptMin");
85  m_originRadius = regPSet.getParameter<double>("originRadius");
86  m_zErrorBeamSpot = regPSet.getParameter<double>("zErrorBeamSpot");
87  m_deltaEta = regPSet.getParameter<double>("deltaEta");
88  m_deltaPhi = regPSet.getParameter<double>("deltaPhi");
89  m_precise = regPSet.getParameter<bool>("precise");
91  regPSet.getParameter<std::string>("whereToUseMeasurementTracker"));
92  if (m_whereToUseMeasurementTracker != RectangularEtaPhiTrackingRegion::UseMeasurementTracker::kNever) {
94  iC.consumes<MeasurementTrackerEvent>(regPSet.getParameter<edm::InputTag>("measurementTrackerName"));
95  }
96  m_searchOpt = false;
97  if (regPSet.exists("searchOpt"))
98  m_searchOpt = regPSet.getParameter<bool>("searchOpt");
99 
100  // mode-dependent z-halflength of tracking regions
101  if (m_mode == VERTICES_SIGMA)
102  m_nSigmaZVertex = regPSet.getParameter<double>("nSigmaZVertex");
103  if (m_mode == VERTICES_FIXED)
104  m_zErrorVetex = regPSet.getParameter<double>("zErrorVetex");
105  m_nSigmaZBeamSpot = -1.;
106  if (m_mode == BEAM_SPOT_SIGMA) {
107  m_nSigmaZBeamSpot = regPSet.getParameter<double>("nSigmaZBeamSpot");
108  if (m_nSigmaZBeamSpot < 0.)
109  edm::LogError("PointSeededTrackingRegionsProducer")
110  << "nSigmaZBeamSpot must be positive for BeamSpotSigma mode!";
111  }
112  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
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)
edm::EDGetTokenT< MeasurementTrackerEvent > token_measurementTracker
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
edm::EDGetTokenT< reco::VertexCollection > token_vertex
PointSeededTrackingRegionsProducer::~PointSeededTrackingRegionsProducer ( )
inlineoverride

Definition at line 114 of file PointSeededTrackingRegionsProducer.h.

114 {}

Member Function Documentation

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

Definition at line 116 of file PointSeededTrackingRegionsProducer.h.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

116  {
118 
119  edm::ParameterSetDescription descPoints;
120  descPoints.add<std::vector<double>>("eta", {0.});
121  descPoints.add<std::vector<double>>("phi", {0.});
122  desc.add<edm::ParameterSetDescription>("points", descPoints);
123 
124  desc.add<std::string>("mode", "BeamSpotFixed");
125  desc.add<int>("maxNRegions", 10);
126  desc.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
127  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("hltPixelVertices"));
128  desc.add<int>("maxNVertices", 1);
129 
130  desc.add<double>("ptMin", 0.9);
131  desc.add<double>("originRadius", 0.2);
132  desc.add<double>("zErrorBeamSpot", 24.2);
133  desc.add<double>("deltaEta", 0.5);
134  desc.add<double>("deltaPhi", 0.5);
135  desc.add<bool>("precise", true);
136 
137  desc.add<double>("nSigmaZVertex", 3.);
138  desc.add<double>("zErrorVetex", 0.2);
139  desc.add<double>("nSigmaZBeamSpot", 4.);
140 
141  desc.add<std::string>("whereToUseMeasurementTracker", "ForSiStrips");
142  desc.add<edm::InputTag>("measurementTrackerName", edm::InputTag(""));
143 
144  desc.add<bool>("searchOpt", false);
145 
146  // Only for backwards-compatibility
147  edm::ParameterSetDescription descRegion;
148  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
149  //edm::ParameterSetDescription descPoint;
150  //descPoint.add<edm::ParameterSetDescription>("point_input", desc);
151 
152  descriptions.add("pointSeededTrackingRegion", descRegion);
153  }
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 155 of file PointSeededTrackingRegionsProducer.h.

References BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, funct::cos(), etaPoints, ev, JetChargeProducer_cfi::exp, dqmdumpme::first, edm::Event::getByToken(), mps_fire::i, edm::EDGetTokenT< T >::isUninitialized(), edm::HandleBase::isValid(), 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(), reco::BeamSpot::sigmaZ(), funct::sin(), funct::tan(), theta(), token_beamSpot, token_measurementTracker, token_vertex, pwdgSkimBPark_cfi::vertices, VERTICES_FIXED, VERTICES_SIGMA, x, reco::BeamSpot::x0(), y, reco::BeamSpot::y0(), z, reco::BeamSpot::z0(), and reco::BeamSpot::z0Error().

155  {
156  std::vector<std::unique_ptr<TrackingRegion>> result;
157 
158  // always need the beam spot (as a fall back strategy for vertex modes)
160  e.getByToken(token_beamSpot, bs);
161  if (!bs.isValid())
162  return result;
163 
164  // this is a default origin for all modes
165  GlobalPoint default_origin(bs->x0(), bs->y0(), bs->z0());
166 
167  // vector of origin & halfLength pairs:
168  std::vector<std::pair<GlobalPoint, float>> origins;
169 
170  // fill the origins and halfLengths depending on the mode
172  origins.push_back(std::make_pair(
173  default_origin, (m_mode == BEAM_SPOT_FIXED) ? m_zErrorBeamSpot : m_nSigmaZBeamSpot * bs->sigmaZ()));
174  } else if (m_mode == VERTICES_FIXED || m_mode == VERTICES_SIGMA) {
176  e.getByToken(token_vertex, vertices);
177  int n_vert = 0;
178  for (reco::VertexCollection::const_iterator iv = vertices->begin(), ev = vertices->end();
179  iv != ev && n_vert < m_maxNVertices;
180  ++iv) {
181  if (iv->isFake() || !iv->isValid())
182  continue;
183 
184  origins.push_back(std::make_pair(GlobalPoint(iv->x(), iv->y(), iv->z()),
185  (m_mode == VERTICES_FIXED) ? m_zErrorVetex : m_nSigmaZVertex * iv->zError()));
186  ++n_vert;
187  }
188  // no-vertex fall-back case:
189  if (origins.empty()) {
190  origins.push_back(std::make_pair(
191  default_origin, (m_nSigmaZBeamSpot > 0.) ? m_nSigmaZBeamSpot * bs->z0Error() : m_zErrorBeamSpot));
192  }
193  }
194 
199  measurementTracker = hmte.product();
200  }
201 
202  // create tracking regions (maximum MaxNRegions of them) in directions of the
203  // points of interest
204  size_t n_points = etaPoints.size();
205  int n_regions = 0;
206  for (size_t i = 0; i < n_points && n_regions < m_maxNRegions; ++i) {
207  double x = std::cos(phiPoints[i]);
208  double y = std::sin(phiPoints[i]);
209  double theta = 2 * std::atan(std::exp(-etaPoints[i]));
210  double z = 1. / std::tan(theta);
211 
212  GlobalVector direction(x, y, z);
213 
214  for (size_t j = 0; j < origins.size() && n_regions < m_maxNRegions; ++j) {
215  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(direction, // GlobalVector
216  origins[j].first, // GlobalPoint
217  m_ptMin,
219  origins[j].second,
220  m_deltaEta,
221  m_deltaPhi,
223  m_precise,
224  measurementTracker,
225  m_searchOpt));
226  ++n_regions;
227  }
228  }
229  edm::LogInfo("PointSeededTrackingRegionsProducer") << "produced " << n_regions << " regions";
230 
231  return result;
232  }
double z0() const
z coordinate
Definition: BeamSpot.h:65
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
bool ev
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
bool isValid() const
Definition: HandleBase.h:70
double z0Error() const
error on z
Definition: BeamSpot.h:90
T const * product() const
Definition: Handle.h:69
double sigmaZ() const
sigma z
Definition: BeamSpot.h:76
double y0() const
y coordinate
Definition: BeamSpot.h:63
bool isUninitialized() const
Definition: EDGetToken.h:70
double x0() const
x coordinate
Definition: BeamSpot.h:61

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::EDGetTokenT<MeasurementTrackerEvent> PointSeededTrackingRegionsProducer::token_measurementTracker
private
edm::EDGetTokenT<reco::VertexCollection> PointSeededTrackingRegionsProducer::token_vertex
private