CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
CandidateSeededTrackingRegionsProducer Class Reference

#include <CandidateSeededTrackingRegionsProducer.h>

Inheritance diagram for CandidateSeededTrackingRegionsProducer:
TrackingRegionProducer

Public Types

enum  Mode { BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, VERTICES_FIXED, VERTICES_SIGMA }
 

Public Member Functions

 CandidateSeededTrackingRegionsProducer (const edm::ParameterSet &conf)
 
virtual std::vector
< TrackingRegion * > 
regions (const edm::Event &e, const edm::EventSetup &es) const
 
virtual ~CandidateSeededTrackingRegionsProducer ()
 
- Public Member Functions inherited from TrackingRegionProducer
virtual ~TrackingRegionProducer ()
 

Private Attributes

edm::InputTag m_beamSpot
 
float m_deltaEta
 
float m_deltaPhi
 
edm::InputTag m_input
 
int m_maxNRegions
 
int m_maxNVertices
 
std::string m_measurementTrackerName
 
Mode m_mode
 
float m_nSigmaZBeamSpot
 
float m_nSigmaZVertex
 
float m_originRadius
 
bool m_precise
 
float m_ptMin
 
bool m_searchOpt
 
edm::InputTag m_vertexCollection
 
float m_whereToUseMeasurementTracker
 
float m_zErrorBeamSpot
 
float m_zErrorVetex
 

Detailed Description

class CandidateSeededTrackingRegionsProducer

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 ("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.

Author
Vadim Khotilovich

Definition at line 44 of file CandidateSeededTrackingRegionsProducer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

CandidateSeededTrackingRegionsProducer::CandidateSeededTrackingRegionsProducer ( const edm::ParameterSet conf)
inlineexplicit

Definition at line 50 of file CandidateSeededTrackingRegionsProducer.h.

References BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), m_beamSpot, m_deltaEta, m_deltaPhi, m_input, m_maxNRegions, m_maxNVertices, m_measurementTrackerName, m_mode, m_nSigmaZBeamSpot, m_nSigmaZVertex, m_originRadius, m_precise, m_ptMin, m_searchOpt, m_vertexCollection, m_whereToUseMeasurementTracker, m_zErrorBeamSpot, m_zErrorVetex, VERTICES_FIXED, and VERTICES_SIGMA.

51  {
52  edm::ParameterSet regPSet = conf.getParameter<edm::ParameterSet>("RegionPSet");
53 
54  // operation mode
55  std::string modeString = regPSet.getParameter<std::string>("mode");
56  if (modeString == "BeamSpotFixed") m_mode = BEAM_SPOT_FIXED;
57  else if (modeString == "BeamSpotSigma") m_mode = BEAM_SPOT_SIGMA;
58  else if (modeString == "VerticesFixed") m_mode = VERTICES_FIXED;
59  else if (modeString == "VerticesSigma") m_mode = VERTICES_SIGMA;
60  else edm::LogError ("CandidateSeededTrackingRegionsProducer")<<"Unknown mode string: "<<modeString;
61 
62  // basic inputs
63  m_input = regPSet.getParameter<edm::InputTag>("input");
64  m_maxNRegions = regPSet.getParameter<int>("maxNRegions");
65  m_beamSpot = regPSet.getParameter<edm::InputTag>("beamSpot");
67  m_maxNVertices = 1;
69  {
70  m_vertexCollection = regPSet.getParameter<edm::InputTag>("vertexCollection");
71  m_maxNVertices = regPSet.getParameter<int>("maxNVertices");
72  }
73 
74  // RectangularEtaPhiTrackingRegion parameters:
75  m_ptMin = regPSet.getParameter<double>("ptMin");
76  m_originRadius = regPSet.getParameter<double>("originRadius");
77  m_zErrorBeamSpot = regPSet.getParameter<double>("zErrorBeamSpot");
78  m_deltaEta = regPSet.getParameter<double>("deltaEta");
79  m_deltaPhi = regPSet.getParameter<double>("deltaPhi");
80  m_precise = regPSet.getParameter<bool>("precise");
83  if (regPSet.exists("measurementTrackerName"))
84  {
85  m_measurementTrackerName = regPSet.getParameter<std::string>("measurementTrackerName");
86  if (regPSet.exists("whereToUseMeasurementTracker"))
87  m_whereToUseMeasurementTracker = regPSet.getParameter<double>("whereToUseMeasurementTracker");
88  }
89  m_searchOpt = false;
90  if (regPSet.exists("searchOpt")) m_searchOpt = regPSet.getParameter<bool>("searchOpt");
91 
92  // mode-dependent z-halflength of tracking regions
93  if (m_mode == VERTICES_SIGMA) m_nSigmaZVertex = regPSet.getParameter<double>("nSigmaZVertex");
94  if (m_mode == VERTICES_FIXED) m_zErrorVetex = regPSet.getParameter<double>("zErrorVetex");
95  m_nSigmaZBeamSpot = -1.;
96  if (m_mode == BEAM_SPOT_SIGMA)
97  {
98  m_nSigmaZBeamSpot = regPSet.getParameter<double>("nSigmaZBeamSpot");
99  if (m_nSigmaZBeamSpot < 0.)
100  edm::LogError ("CandidateSeededTrackingRegionsProducer")<<"nSigmaZBeamSpot must be positive for BeamSpotSigma mode!";
101  }
102  }
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
virtual CandidateSeededTrackingRegionsProducer::~CandidateSeededTrackingRegionsProducer ( )
inlinevirtual

Definition at line 104 of file CandidateSeededTrackingRegionsProducer.h.

104 {}

Member Function Documentation

virtual std::vector<TrackingRegion* > CandidateSeededTrackingRegionsProducer::regions ( const edm::Event e,
const edm::EventSetup es 
) const
inlinevirtual

Implements TrackingRegionProducer.

Definition at line 107 of file CandidateSeededTrackingRegionsProducer.h.

References BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, first, edm::Event::getByLabel(), i, edm::HandleBase::isValid(), j, m_beamSpot, m_deltaEta, m_deltaPhi, m_input, m_maxNRegions, m_maxNVertices, m_measurementTrackerName, m_mode, m_nSigmaZBeamSpot, m_nSigmaZVertex, m_originRadius, m_precise, m_ptMin, m_searchOpt, m_vertexCollection, m_whereToUseMeasurementTracker, m_zErrorBeamSpot, m_zErrorVetex, query::result, edm::second(), v, VERTICES_FIXED, VERTICES_SIGMA, vdt::x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

108  {
109  std::vector<TrackingRegion* > result;
110 
111  // pick up the candidate objects of interest
113  e.getByLabel( m_input, objects );
114  size_t n_objects = objects->size();
115  if (n_objects == 0) return result;
116 
117  // always need the beam spot (as a fall back strategy for vertex modes)
119  e.getByLabel( m_beamSpot, bs );
120  if( !bs.isValid() ) return result;
121 
122  // this is a default origin for all modes
123  GlobalPoint default_origin( bs->x0(), bs->y0(), bs->z0() );
124 
125  // vector of origin & halfLength pairs:
126  std::vector< std::pair< GlobalPoint, float > > origins;
127 
128  // fill the origins and halfLengths depending on the mode
130  {
131  origins.push_back( std::make_pair(
132  default_origin,
134  ));
135  }
136  else if (m_mode == VERTICES_FIXED || m_mode == VERTICES_SIGMA)
137  {
139  e.getByLabel( m_vertexCollection, vertices );
140  int n_vert = 0;
141  for (reco::VertexCollection::const_iterator v = vertices->begin(); v != vertices->end() && n_vert < m_maxNVertices; ++v)
142  {
143  if ( v->isFake() || !v->isValid() ) continue;
144 
145  origins.push_back( std::make_pair(
146  GlobalPoint( v->x(), v->y(), v->z() ),
148  ));
149  ++n_vert;
150  }
151  // no-vertex fall-back case:
152  if (origins.empty())
153  {
154  origins.push_back( std::make_pair(
155  default_origin,
156  (m_nSigmaZBeamSpot > 0.) ? m_nSigmaZBeamSpot*bs->z0Error() : m_zErrorBeamSpot
157  ));
158  }
159  }
160 
161  // create tracking regions (maximum MaxNRegions of them) in directions of the
162  // objects of interest (we expect that the collection was sorted in decreasing pt order)
163  int n_regions = 0;
164  for(size_t i = 0; i < n_objects && n_regions < m_maxNRegions; ++i )
165  {
166  const reco::Candidate & object = (*objects)[i];
167  GlobalVector direction( object.momentum().x(), object.momentum().y(), object.momentum().z() );
168 
169  for (size_t j=0; j<origins.size() && n_regions < m_maxNRegions; ++j)
170  {
171  result.push_back( new RectangularEtaPhiTrackingRegion(
172  direction,
173  origins[j].first,
174  m_ptMin,
176  origins[j].second,
177  m_deltaEta,
178  m_deltaPhi,
180  m_precise,
183  ));
184  ++n_regions;
185  }
186  }
187  //std::cout<<"n_seeded_regions = "<<n_regions<<std::endl;
188  edm::LogInfo ("CandidateSeededTrackingRegionsProducer") << "produced "<<n_regions<<" regions";
189 
190  return result;
191  }
int i
Definition: DBlmapReader.cc:9
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
double double double z
U second(std::pair< T, U > const &p)
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
bool first
Definition: L1TdeRCT.cc:94
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
x
Definition: VDTMath.h:216
mathSSE::Vec4< T > v

Member Data Documentation

edm::InputTag CandidateSeededTrackingRegionsProducer::m_beamSpot
private
float CandidateSeededTrackingRegionsProducer::m_deltaEta
private
float CandidateSeededTrackingRegionsProducer::m_deltaPhi
private
edm::InputTag CandidateSeededTrackingRegionsProducer::m_input
private
int CandidateSeededTrackingRegionsProducer::m_maxNRegions
private
int CandidateSeededTrackingRegionsProducer::m_maxNVertices
private
std::string CandidateSeededTrackingRegionsProducer::m_measurementTrackerName
private
Mode CandidateSeededTrackingRegionsProducer::m_mode
private
float CandidateSeededTrackingRegionsProducer::m_nSigmaZBeamSpot
private
float CandidateSeededTrackingRegionsProducer::m_nSigmaZVertex
private
float CandidateSeededTrackingRegionsProducer::m_originRadius
private
bool CandidateSeededTrackingRegionsProducer::m_precise
private
float CandidateSeededTrackingRegionsProducer::m_ptMin
private
bool CandidateSeededTrackingRegionsProducer::m_searchOpt
private
edm::InputTag CandidateSeededTrackingRegionsProducer::m_vertexCollection
private
float CandidateSeededTrackingRegionsProducer::m_whereToUseMeasurementTracker
private
float CandidateSeededTrackingRegionsProducer::m_zErrorBeamSpot
private
float CandidateSeededTrackingRegionsProducer::m_zErrorVetex
private