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
 
- 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
 

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 59 of file CandidatePointSeededTrackingRegionsProducer.h.

Member Enumeration Documentation

Enumerator
CANDIDATE_SEEDED 
POINT_SEEDED 
CANDIDATE_POINT_SEEDED 

Definition at line 63 of file CandidatePointSeededTrackingRegionsProducer.h.

63 {CANDIDATE_SEEDED, POINT_SEEDED, CANDIDATE_POINT_SEEDED};

Constructor & Destructor Documentation

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

Definition at line 65 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(), x, y, and z.

65  :
66  m_origins(conf.getParameter<edm::ParameterSet>("RegionPSet"), iC)
67  {
68  edm::ParameterSet regPSet = conf.getParameter<edm::ParameterSet>("RegionPSet");
69 
70  // seeding mode
71  std::string seedingModeString = regPSet.getParameter<std::string>("seedingMode");
72  if (seedingModeString == "Candidate") m_seedingMode = SeedingMode::CANDIDATE_SEEDED;
73  else if (seedingModeString == "Point") m_seedingMode = SeedingMode::POINT_SEEDED;
74  else if (seedingModeString == "CandidatePoint") m_seedingMode = SeedingMode::CANDIDATE_POINT_SEEDED;
75  else 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())) throw edm::Exception(edm::errors::Configuration) << "The parameters 'eta' and 'phi' must have the same size";
88  if (etaPoints.empty()) throw edm::Exception(edm::errors::Configuration) << "At least one point should be defined for point or candidate+point seeding modes";
89 
90  for(size_t i = 0; i < etaPoints.size(); ++i ){
91 
92  m_etaPhiPoints.push_back(std::make_pair(etaPoints[i],phiPoints[i]));
93 
94  double x = std::cos(phiPoints[i]);
95  double y = std::sin(phiPoints[i]);
96  double theta = 2*std::atan(std::exp(-etaPoints[i]));
97  double z = 1./std::tan(theta);
98  GlobalVector direction( x,y,z );
99  m_directionPoints.push_back(direction);
100 
101  }
102 
103  }
104 
105  m_maxNRegions = regPSet.getParameter<unsigned int>("maxNRegions");
106  if(m_maxNRegions==0) throw edm::Exception(edm::errors::Configuration) << "maxNRegions should be greater than or equal to 1";
107 
108  // RectangularEtaPhiTrackingRegion parameters:
109  m_ptMin = regPSet.getParameter<double>("ptMin");
110  m_originRadius = regPSet.getParameter<double>("originRadius");
111 
113  m_deltaEta_Cand = regPSet.getParameter<double>("deltaEta_Cand");
114  m_deltaPhi_Cand = regPSet.getParameter<double>("deltaPhi_Cand");
115  if (m_deltaEta_Cand<0 || m_deltaPhi_Cand<0) throw edm::Exception(edm::errors::Configuration) << "Delta eta and phi parameters must be set for candidates in candidate seeding mode";
116  }
118  m_deltaEta_Point = regPSet.getParameter<double>("deltaEta_Point");
119  m_deltaPhi_Point = regPSet.getParameter<double>("deltaPhi_Point");
120  if (m_deltaEta_Point<0 || m_deltaPhi_Point<0) throw edm::Exception(edm::errors::Configuration) << "Delta eta and phi parameters must be set for points in point seeding mode";
121  }
123  m_deltaEta_Cand = regPSet.getParameter<double>("deltaEta_Cand");
124  m_deltaPhi_Cand = regPSet.getParameter<double>("deltaPhi_Cand");
125  m_deltaEta_Point = regPSet.getParameter<double>("deltaEta_Point");
126  m_deltaPhi_Point = regPSet.getParameter<double>("deltaPhi_Point");
127  if (m_deltaEta_Cand<0 || m_deltaPhi_Cand<0 || m_deltaEta_Point<0 || m_deltaPhi_Point<0) throw edm::Exception(edm::errors::Configuration) << "Delta eta and phi parameters must be set separately for candidates and points in candidate+point seeding mode";
128  }
129 
130  m_precise = regPSet.getParameter<bool>("precise");
132  if(m_whereToUseMeasurementTracker != RectangularEtaPhiTrackingRegion::UseMeasurementTracker::kNever) {
134  }
135  m_searchOpt = false;
136  if (regPSet.exists("searchOpt")) m_searchOpt = regPSet.getParameter<bool>("searchOpt");
137  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
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
CandidatePointSeededTrackingRegionsProducer::~CandidatePointSeededTrackingRegionsProducer ( )
inlineoverride

Definition at line 139 of file CandidatePointSeededTrackingRegionsProducer.h.

139 {}

Member Function Documentation

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

Definition at line 141 of file CandidatePointSeededTrackingRegionsProducer.h.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), VertexBeamspotOrigins::fillDescriptions(), and AlCaHLTBitMon_QueryRunRegistry::string.

141  {
143 
144  desc.add<std::string>("seedingMode", "Candidate");
145 
146  desc.add<edm::InputTag>("input", edm::InputTag(""));
147  edm::ParameterSetDescription descPoints;
148  descPoints.add<std::vector<double>> ("eta", {} );
149  descPoints.add<std::vector<double>> ("phi", {} );
150  desc.add<edm::ParameterSetDescription>("points", descPoints);
151 
152  desc.add<unsigned int>("maxNRegions", 10);
153 
154  VertexBeamspotOrigins::fillDescriptions(desc, "hltOnlineBeamSpot", "hltPixelVertices", 1);
155 
156  desc.add<double>("ptMin", 0.9);
157  desc.add<double>("originRadius", 0.2);
158  desc.add<double>("deltaEta_Cand", -1.);
159  desc.add<double>("deltaPhi_Cand", -1.);
160  desc.add<double>("deltaEta_Point", -1.);
161  desc.add<double>("deltaPhi_Point", -1.);
162  desc.add<bool>("precise", true);
163 
164  desc.add<std::string>("whereToUseMeasurementTracker", "ForSiStrips");
165  desc.add<edm::InputTag>("measurementTrackerName", edm::InputTag(""));
166 
167  desc.add<bool>("searchOpt", false);
168 
169  // Only for backwards-compatibility
170  edm::ParameterSetDescription descRegion;
171  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
172 
173  descriptions.add("candidatePointSeededTrackingRegionsFromBeamSpot", descRegion);
174  }
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)
std::vector<std::unique_ptr<TrackingRegion> > CandidatePointSeededTrackingRegionsProducer::regions ( const edm::Event e,
const edm::EventSetup es 
) const
inlineoverridevirtual

Implements TrackingRegionProducer.

Definition at line 177 of file CandidatePointSeededTrackingRegionsProducer.h.

References funct::abs(), CANDIDATE_POINT_SEEDED, CANDIDATE_SEEDED, funct::cos(), hiPixelPairStep_cff::deltaPhi, JetChargeProducer_cfi::exp, edm::Event::getByToken(), 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, min(), normalizedPhi(), VertexBeamspotOrigins::origins(), POINT_SEEDED, edm::Handle< T >::product(), mps_fire::result, funct::sin(), edm::View< T >::size(), funct::tan(), theta(), x, y, and z.

178  {
179  std::vector<std::unique_ptr<TrackingRegion> > result;
180 
181  // pick up the candidate objects of interest
183  size_t n_objects = 0;
184 
186  e.getByToken( m_token_input, objects );
187  n_objects = objects->size();
188  if (n_objects == 0) return result;
189  }
190 
191  const auto& objs = *objects;
192 
193  const auto& origins = m_origins.origins(e);
194  if(origins.empty()) {
195  return result;
196  }
197 
198  const MeasurementTrackerEvent *measurementTracker = nullptr;
202  measurementTracker = hmte.product();
203  }
204 
205  // create tracking regions (maximum MaxNRegions of them) in directions of the
206  // objects of interest (we expect that the collection was sorted in decreasing pt order)
207  int n_regions = 0;
208 
210 
211  for(const auto& object : objs) {
212 
213  GlobalVector direction( object.momentum().x(), object.momentum().y(), object.momentum().z() );
214 
215  for(const auto& origin : origins) {
216 
217  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(
218  direction,
219  origin.first,
220  m_ptMin,
222  origin.second,
226  m_precise,
227  measurementTracker,
229  ));
230  ++n_regions;
231  if( n_regions >= m_maxNRegions ) break;
232 
233  }
234 
235  if( n_regions >= m_maxNRegions ) break;
236 
237  }
238 
239  }
240 
241 
243 
244  for( const auto& direction : m_directionPoints ){
245 
246  for(const auto& origin : origins) {
247 
248  result.push_back( std::make_unique<RectangularEtaPhiTrackingRegion>(
249  direction, // GlobalVector
250  origin.first, // GlobalPoint
251  m_ptMin,
253  origin.second,
257  m_precise,
258  measurementTracker,
260  ));
261  ++n_regions;
262  if( n_regions >= m_maxNRegions ) break;
263 
264  }
265 
266  if( n_regions >= m_maxNRegions ) break;
267 
268  }
269 
270  }
271 
272 
274 
275  for(const auto& object : objs) {
276 
277  double eta_Cand = object.eta();
278  double phi_Cand = object.phi();
279 
280  for (const auto& etaPhiPoint : m_etaPhiPoints ){
281 
282  double eta_Point = etaPhiPoint.first;
283  double phi_Point = etaPhiPoint.second;
284  double dEta_Cand_Point = std::abs(eta_Cand-eta_Point);
285  double dPhi_Cand_Point = std::abs(deltaPhi(phi_Cand,phi_Point));
286 
287  //Check if there is an overlap between Candidate- and Point-based regions of interest
288  if(dEta_Cand_Point > (m_deltaEta_Cand + m_deltaEta_Point) || dPhi_Cand_Point > (m_deltaPhi_Cand + m_deltaPhi_Point)) continue;
289 
290  //Determines boundaries of intersection of RoIs
291  double etaMin_RoI = std::max(eta_Cand-m_deltaEta_Cand,eta_Point-m_deltaEta_Point);
292  double etaMax_RoI = std::min(eta_Cand+m_deltaEta_Cand,eta_Point+m_deltaEta_Point);
293 
294  double phi_Cand_minus = normalizedPhi(phi_Cand-m_deltaPhi_Cand);
295  double phi_Point_minus = normalizedPhi(phi_Point-m_deltaPhi_Point);
296  double phi_Cand_plus = normalizedPhi(phi_Cand+m_deltaPhi_Cand);
297  double phi_Point_plus = normalizedPhi(phi_Point+m_deltaPhi_Point);
298 
299  double phiMin_RoI = deltaPhi(phi_Cand_minus,phi_Point_minus)>0. ? phi_Cand_minus : phi_Point_minus ;
300  double phiMax_RoI = deltaPhi(phi_Cand_plus,phi_Point_plus)<0. ? phi_Cand_plus : phi_Point_plus;
301 
302  //Determines position and width of new RoI
303  double eta_RoI = 0.5*(etaMax_RoI+etaMin_RoI);
304  double deltaEta_RoI = etaMax_RoI - eta_RoI;
305 
306  double phi_RoI = 0.5*(phiMax_RoI+phiMin_RoI);
307  if( phiMax_RoI < phiMin_RoI ) phi_RoI-=M_PI;
308  phi_RoI = normalizedPhi(phi_RoI);
309  double deltaPhi_RoI = deltaPhi(phiMax_RoI,phi_RoI);
310 
311  double x = std::cos(phi_RoI);
312  double y = std::sin(phi_RoI);
313  double theta = 2*std::atan(std::exp(-eta_RoI));
314  double z = 1./std::tan(theta);
315 
316  GlobalVector direction( x,y,z );
317 
318  for(const auto& origin : origins) {
319 
320  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(
321  direction,
322  origin.first,
323  m_ptMin,
325  origin.second,
326  deltaEta_RoI,
327  deltaPhi_RoI,
329  m_precise,
330  measurementTracker,
332  ));
333  ++n_regions;
334  if( n_regions >= m_maxNRegions ) break;
335 
336  }
337 
338  if( n_regions >= m_maxNRegions ) break;
339 
340  }
341 
342  if( n_regions >= m_maxNRegions ) break;
343 
344  }
345 
346  }
347 
348  edm::LogInfo ("CandidatePointSeededTrackingRegionsProducer") << "produced "<<n_regions<<" regions";
349 
350  return result;
351  }
Origins origins(const edm::Event &iEvent) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
constexpr T normalizedPhi(T phi)
Definition: normalizedPhi.h:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Theta< T > theta() const
size_type size() const
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
T min(T a, T b)
Definition: MathUtil.h:58
#define M_PI
T const * product() const
Definition: Handle.h:81
bool isUninitialized() const
Definition: EDGetToken.h:73

Member Data Documentation

float CandidatePointSeededTrackingRegionsProducer::m_deltaEta_Cand
private
float CandidatePointSeededTrackingRegionsProducer::m_deltaEta_Point
private
float CandidatePointSeededTrackingRegionsProducer::m_deltaPhi_Cand
private
float CandidatePointSeededTrackingRegionsProducer::m_deltaPhi_Point
private
std::vector<GlobalVector> CandidatePointSeededTrackingRegionsProducer::m_directionPoints
private
std::vector<std::pair<double,double> > CandidatePointSeededTrackingRegionsProducer::m_etaPhiPoints
private
int CandidatePointSeededTrackingRegionsProducer::m_maxNRegions
private
float CandidatePointSeededTrackingRegionsProducer::m_originRadius
private
VertexBeamspotOrigins CandidatePointSeededTrackingRegionsProducer::m_origins
private

Definition at line 355 of file CandidatePointSeededTrackingRegionsProducer.h.

Referenced by regions().

bool CandidatePointSeededTrackingRegionsProducer::m_precise
private
float CandidatePointSeededTrackingRegionsProducer::m_ptMin
private
bool CandidatePointSeededTrackingRegionsProducer::m_searchOpt
private
SeedingMode CandidatePointSeededTrackingRegionsProducer::m_seedingMode
private
edm::EDGetTokenT<reco::CandidateView> CandidatePointSeededTrackingRegionsProducer::m_token_input
private
edm::EDGetTokenT<MeasurementTrackerEvent> CandidatePointSeededTrackingRegionsProducer::m_token_measurementTracker
private
RectangularEtaPhiTrackingRegion::UseMeasurementTracker CandidatePointSeededTrackingRegionsProducer::m_whereToUseMeasurementTracker
private