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

Member Enumeration Documentation

Enumerator
CANDIDATE_SEEDED 
POINT_SEEDED 
CANDIDATE_POINT_SEEDED 

Definition at line 61 of file CandidatePointSeededTrackingRegionsProducer.h.

61 {CANDIDATE_SEEDED, POINT_SEEDED, CANDIDATE_POINT_SEEDED};

Constructor & Destructor Documentation

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

Definition at line 63 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.

63  :
64  m_origins(conf.getParameter<edm::ParameterSet>("RegionPSet"), iC)
65  {
66  edm::ParameterSet regPSet = conf.getParameter<edm::ParameterSet>("RegionPSet");
67 
68  // seeding mode
69  std::string seedingModeString = regPSet.getParameter<std::string>("seedingMode");
70  if (seedingModeString == "Candidate") m_seedingMode = SeedingMode::CANDIDATE_SEEDED;
71  else if (seedingModeString == "Point") m_seedingMode = SeedingMode::POINT_SEEDED;
72  else if (seedingModeString == "CandidatePoint") m_seedingMode = SeedingMode::CANDIDATE_POINT_SEEDED;
73  else throw edm::Exception(edm::errors::Configuration) << "Unknown seeding mode string: "<<seedingModeString;
74 
75  // basic inputs
78 
79  // Specific points in the detector
82  std::vector<double> etaPoints = points.getParameter<std::vector<double>>("eta");
83  std::vector<double> phiPoints = points.getParameter<std::vector<double>>("phi");
84 
85  if (!(etaPoints.size() == phiPoints.size())) throw edm::Exception(edm::errors::Configuration) << "The parameters 'eta' and 'phi' must have the same size";
86  if (etaPoints.empty()) throw edm::Exception(edm::errors::Configuration) << "At least one point should be defined for point or candidate+point seeding modes";
87 
88  for(size_t i = 0; i < etaPoints.size(); ++i ){
89 
90  m_etaPhiPoints.push_back(std::make_pair(etaPoints[i],phiPoints[i]));
91 
92  double x = std::cos(phiPoints[i]);
93  double y = std::sin(phiPoints[i]);
94  double theta = 2*std::atan(std::exp(-etaPoints[i]));
95  double z = 1./std::tan(theta);
96  GlobalVector direction( x,y,z );
97  m_directionPoints.push_back(direction);
98 
99  }
100 
101  }
102 
103  m_maxNRegions = regPSet.getParameter<unsigned int>("maxNRegions");
104  if(m_maxNRegions==0) throw edm::Exception(edm::errors::Configuration) << "maxNRegions should be greater than or equal to 1";
105 
106  // RectangularEtaPhiTrackingRegion parameters:
107  m_ptMin = regPSet.getParameter<double>("ptMin");
108  m_originRadius = regPSet.getParameter<double>("originRadius");
109 
111  m_deltaEta_Cand = regPSet.getParameter<double>("deltaEta_Cand");
112  m_deltaPhi_Cand = regPSet.getParameter<double>("deltaPhi_Cand");
113  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";
114  }
116  m_deltaEta_Point = regPSet.getParameter<double>("deltaEta_Point");
117  m_deltaPhi_Point = regPSet.getParameter<double>("deltaPhi_Point");
118  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";
119  }
121  m_deltaEta_Cand = regPSet.getParameter<double>("deltaEta_Cand");
122  m_deltaPhi_Cand = regPSet.getParameter<double>("deltaPhi_Cand");
123  m_deltaEta_Point = regPSet.getParameter<double>("deltaEta_Point");
124  m_deltaPhi_Point = regPSet.getParameter<double>("deltaPhi_Point");
125  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";
126  }
127 
128  m_precise = regPSet.getParameter<bool>("precise");
130  if(m_whereToUseMeasurementTracker != RectangularEtaPhiTrackingRegion::UseMeasurementTracker::kNever) {
132  }
133  m_searchOpt = false;
134  if (regPSet.exists("searchOpt")) m_searchOpt = regPSet.getParameter<bool>("searchOpt");
135  }
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 137 of file CandidatePointSeededTrackingRegionsProducer.h.

137 {}

Member Function Documentation

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

Definition at line 139 of file CandidatePointSeededTrackingRegionsProducer.h.

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

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

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