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)
 
virtual std::vector< std::unique_ptr< TrackingRegion > > regions (const edm::Event &e, const edm::EventSetup &es) const override
 
virtual ~PointSeededTrackingRegionsProducer ()
 
- 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 54 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, hiPixelPairStep_cff::points, AlCaHLTBitMon_QueryRunRegistry::string, RectangularEtaPhiTrackingRegion::stringToUseMeasurementTracker(), token_beamSpot, token_measurementTracker, token_vertex, VERTICES_FIXED, and VERTICES_SIGMA.

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

Definition at line 107 of file PointSeededTrackingRegionsProducer.h.

107 {}

Member Function Documentation

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

Definition at line 109 of file PointSeededTrackingRegionsProducer.h.

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

109  {
111 
112  edm::ParameterSetDescription descPoints;
113  descPoints.add<std::vector<double>> ("eta", {0.} );
114  descPoints.add<std::vector<double>> ("phi", {0.} );
115  desc.add<edm::ParameterSetDescription>("points", descPoints);
116 
117  desc.add<std::string>("mode", "BeamSpotFixed");
118  desc.add<int>("maxNRegions", 10);
119  desc.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
120  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("hltPixelVertices"));
121  desc.add<int>("maxNVertices", 1);
122 
123  desc.add<double>("ptMin", 0.9);
124  desc.add<double>("originRadius", 0.2);
125  desc.add<double>("zErrorBeamSpot", 24.2);
126  desc.add<double>("deltaEta", 0.5);
127  desc.add<double>("deltaPhi", 0.5);
128  desc.add<bool>("precise", true);
129 
130  desc.add<double>("nSigmaZVertex", 3.);
131  desc.add<double>("zErrorVetex", 0.2);
132  desc.add<double>("nSigmaZBeamSpot", 4.);
133 
134  desc.add<std::string>("whereToUseMeasurementTracker", "ForSiStrips");
135  desc.add<edm::InputTag>("measurementTrackerName", edm::InputTag(""));
136 
137  desc.add<bool>("searchOpt", false);
138 
139  // Only for backwards-compatibility
140  edm::ParameterSetDescription descRegion;
141  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
142  //edm::ParameterSetDescription descPoint;
143  //descPoint.add<edm::ParameterSetDescription>("point_input", desc);
144 
145 
146  descriptions.add("pointSeededTrackingRegion", descRegion);
147  }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual std::vector<std::unique_ptr<TrackingRegion> > PointSeededTrackingRegionsProducer::regions ( const edm::Event e,
const edm::EventSetup es 
) const
inlineoverridevirtual

Implements TrackingRegionProducer.

Definition at line 151 of file PointSeededTrackingRegionsProducer.h.

References BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, funct::cos(), etaPoints, ev, JetChargeProducer_cfi::exp, plotBeamSpotDB::first, edm::Event::getByToken(), mps_fire::i, edm::EDGetTokenT< T >::isUninitialized(), edm::HandleBase::isValid(), 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, MeasurementTrackerEventProducer_cfi::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, ecalDrivenElectronSeedsParameters_cff::vertices, VERTICES_FIXED, VERTICES_SIGMA, x, reco::BeamSpot::x0(), y, reco::BeamSpot::y0(), z, reco::BeamSpot::z0(), and reco::BeamSpot::z0Error().

152  {
153  std::vector<std::unique_ptr<TrackingRegion> > result;
154 
155  // always need the beam spot (as a fall back strategy for vertex modes)
157  e.getByToken( token_beamSpot, bs );
158  if( !bs.isValid() ) return result;
159 
160  // this is a default origin for all modes
161  GlobalPoint default_origin( bs->x0(), bs->y0(), bs->z0() );
162 
163  // vector of origin & halfLength pairs:
164  std::vector< std::pair< GlobalPoint, float > > origins;
165 
166  // fill the origins and halfLengths depending on the mode
168  origins.push_back( std::make_pair( default_origin,
170  ));
171  } else if (m_mode == VERTICES_FIXED || m_mode == VERTICES_SIGMA) {
173  e.getByToken( token_vertex, vertices );
174  int n_vert = 0;
175  for (reco::VertexCollection::const_iterator iv = vertices->begin(), ev = vertices->end();
176  iv != ev && n_vert < m_maxNVertices; ++iv) {
177  if ( iv->isFake() || !iv->isValid() ) continue;
178 
179  origins.push_back( std::make_pair( GlobalPoint( iv->x(), iv->y(), iv->z() ),
180  (m_mode == VERTICES_FIXED) ? m_zErrorVetex : m_nSigmaZVertex*iv->zError()
181  ));
182  ++n_vert;
183  }
184  // no-vertex fall-back case:
185  if ( origins.empty() ) {
186  origins.push_back( std::make_pair( default_origin,
188  ));
189  }
190  }
191 
196  measurementTracker = hmte.product();
197  }
198 
199  // create tracking regions (maximum MaxNRegions of them) in directions of the
200  // points of interest
201  size_t n_points = etaPoints.size();
202  int n_regions = 0;
203  for(size_t i = 0; i < n_points && n_regions < m_maxNRegions; ++i ) {
204 
205  double x = std::cos(phiPoints[i]);
206  double y = std::sin(phiPoints[i]);
207  double theta = 2*std::atan(std::exp(-etaPoints[i]));
208  double z = 1./std::tan(theta);
209 
210  GlobalVector direction( x,y,z );
211 
212  for (size_t j=0; j<origins.size() && n_regions < m_maxNRegions; ++j) {
213 
214  result.push_back( std::make_unique<RectangularEtaPhiTrackingRegion>(
215  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,
226  ));
227  ++n_regions;
228  }
229  }
230  edm::LogInfo ("PointSeededTrackingRegionsProducer") << "produced "<<n_regions<<" regions";
231 
232  return result;
233  }
double z0() const
z coordinate
Definition: BeamSpot.h:68
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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:74
double z0Error() const
error on z
Definition: BeamSpot.h:94
T const * product() const
Definition: Handle.h:81
double sigmaZ() const
sigma z
Definition: BeamSpot.h:80
double y0() const
y coordinate
Definition: BeamSpot.h:66
bool isUninitialized() const
Definition: EDGetToken.h:73
double x0() const
x coordinate
Definition: BeamSpot.h:64

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