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
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
< TrackingRegion * > 
regions (const edm::Event &e, const edm::EventSetup &es) const
 
virtual ~PointSeededTrackingRegionsProducer ()
 
- Public Member Functions inherited from TrackingRegionProducer
virtual ~TrackingRegionProducer ()
 

Private Attributes

double eta_input
 
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
 
double phi_input
 
edm::EDGetTokenT< reco::BeamSpottoken_beamSpot
 
edm::EDGetTokenT
< MeasurementTrackerEvent
token_measurementTracker
 
edm::EDGetTokenT
< reco::VertexCollection
token_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, RectangularEtaPhiTrackingRegion::doubleToUseMeasurementTracker(), eta_input, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), RectangularEtaPhiTrackingRegion::kForSiStrips, 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, phi_input, AlCaHLTBitMon_QueryRunRegistry::string, 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 inputs
68  edm::ParameterSet point_input = regPSet.getParameter<edm::ParameterSet>("point_input");
69  eta_input = point_input.getParameter<double>("eta");
70  phi_input = point_input.getParameter<double>("phi");
71  m_maxNRegions = regPSet.getParameter<int>("maxNRegions");
73  m_maxNVertices = 1;
75  {
76  token_vertex = iC.consumes<reco::VertexCollection>(regPSet.getParameter<edm::InputTag>("vertexCollection"));
77  m_maxNVertices = regPSet.getParameter<int>("maxNVertices");
78  }
79 
80  // RectangularEtaPhiTrackingRegion parameters:
81  m_ptMin = regPSet.getParameter<double>("ptMin");
82  m_originRadius = regPSet.getParameter<double>("originRadius");
83  m_zErrorBeamSpot = regPSet.getParameter<double>("zErrorBeamSpot");
84  m_deltaEta = regPSet.getParameter<double>("deltaEta");
85  m_deltaPhi = regPSet.getParameter<double>("deltaPhi");
86  m_precise = regPSet.getParameter<bool>("precise");
88  if (regPSet.exists("measurementTrackerName"))
89  {
90  // FIXME: when next time altering the configuration of this
91  // class, please change the types of the following parameters:
92  // - whereToUseMeasurementTracker to at least int32 or to a string
93  // corresponding to the UseMeasurementTracker enumeration
94  // - measurementTrackerName to InputTag
95  if (regPSet.exists("whereToUseMeasurementTracker"))
96  m_whereToUseMeasurementTracker = RectangularEtaPhiTrackingRegion::doubleToUseMeasurementTracker(regPSet.getParameter<double>("whereToUseMeasurementTracker"));
97  if(m_whereToUseMeasurementTracker != RectangularEtaPhiTrackingRegion::UseMeasurementTracker::kNever)
98  token_measurementTracker = iC.consumes<MeasurementTrackerEvent>(regPSet.getParameter<std::string>("measurementTrackerName"));
99  }
100  m_searchOpt = false;
101  if (regPSet.exists("searchOpt")) m_searchOpt = regPSet.getParameter<bool>("searchOpt");
102 
103  // mode-dependent z-halflength of tracking regions
104  if (m_mode == VERTICES_SIGMA) m_nSigmaZVertex = regPSet.getParameter<double>("nSigmaZVertex");
105  if (m_mode == VERTICES_FIXED) m_zErrorVetex = regPSet.getParameter<double>("zErrorVetex");
106  m_nSigmaZBeamSpot = -1.;
107  if (m_mode == BEAM_SPOT_SIGMA)
108  {
109  m_nSigmaZBeamSpot = regPSet.getParameter<double>("nSigmaZBeamSpot");
110  if (m_nSigmaZBeamSpot < 0.)
111  edm::LogError ("PointSeededTrackingRegionsProducer")<<"nSigmaZBeamSpot must be positive for BeamSpotSigma mode!";
112  }
113  }
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
edm::EDGetTokenT< MeasurementTrackerEvent > token_measurementTracker
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
edm::EDGetTokenT< reco::VertexCollection > token_vertex
static UseMeasurementTracker doubleToUseMeasurementTracker(double value)
virtual PointSeededTrackingRegionsProducer::~PointSeededTrackingRegionsProducer ( )
inlinevirtual

Definition at line 115 of file PointSeededTrackingRegionsProducer.h.

115 {}

Member Function Documentation

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

Implements TrackingRegionProducer.

Definition at line 118 of file PointSeededTrackingRegionsProducer.h.

References BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, eta_input, ev, plotBeamSpotDB::first, edm::Event::getByToken(), i, edm::EDGetTokenT< T >::isUninitialized(), edm::HandleBase::isValid(), 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, HLT_25ns14e33_v1_cff::measurementTracker, phi_input, edm::Handle< T >::product(), query::result, edm::second(), theta(), token_beamSpot, token_measurementTracker, token_vertex, HLT_25ns14e33_v1_cff::vertices, VERTICES_FIXED, VERTICES_SIGMA, x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

119  {
120  std::vector<TrackingRegion* > result;
121 
122  // always need the beam spot (as a fall back strategy for vertex modes)
124  e.getByToken( token_beamSpot, bs );
125  if( !bs.isValid() ) return result;
126 
127  // this is a default origin for all modes
128  GlobalPoint default_origin( bs->x0(), bs->y0(), bs->z0() );
129 
130  // vector of origin & halfLength pairs:
131  std::vector< std::pair< GlobalPoint, float > > origins;
132 
133  // fill the origins and halfLengths depending on the mode
135  origins.push_back( std::make_pair( default_origin,
137  ));
138  } else if (m_mode == VERTICES_FIXED || m_mode == VERTICES_SIGMA) {
140  e.getByToken( token_vertex, vertices );
141  int n_vert = 0;
142  for (reco::VertexCollection::const_iterator iv = vertices->begin(), ev = vertices->end();
143  iv != ev && n_vert < m_maxNVertices; ++iv) {
144  if ( iv->isFake() || !iv->isValid() ) continue;
145 
146  origins.push_back( std::make_pair( GlobalPoint( iv->x(), iv->y(), iv->z() ),
147  (m_mode == VERTICES_FIXED) ? m_zErrorVetex : m_nSigmaZVertex*iv->zError()
148  ));
149  ++n_vert;
150  }
151  // no-vertex fall-back case:
152  if ( origins.empty() ) {
153  origins.push_back( std::make_pair( default_origin,
154  (m_nSigmaZBeamSpot > 0.) ? m_nSigmaZBeamSpot*bs->z0Error() : m_zErrorBeamSpot
155  ));
156  }
157  }
158 
163  measurementTracker = hmte.product();
164  }
165 
166  // create tracking regions (maximum MaxNRegions of them) in directions of the
167  // points of interest
168  size_t n_points = 1;
169  int n_regions = 0;
170  for(size_t i = 0; i < n_points && n_regions < m_maxNRegions; ++i ) {
171 
172  double x = TMath::Cos(phi_input);
173  double y = TMath::Sin(phi_input);
174  double theta = 2*TMath::ATan(TMath::Exp(-eta_input));
175  double z = (x*x+y*y)/TMath::Tan(theta);
176 
177  GlobalVector direction( x,y,z );
178 
179  for (size_t j=0; j<origins.size() && n_regions < m_maxNRegions; ++j) {
180 
181  result.push_back( new RectangularEtaPhiTrackingRegion(
182  direction, // GlobalVector
183  origins[j].first, // GlobalPoint
184  m_ptMin,
186  origins[j].second,
187  m_deltaEta,
188  m_deltaPhi,
190  m_precise,
191  measurementTracker,
193  ));
194  ++n_regions;
195  }
196  }
197  //std::cout<<"n_seeded_regions = "<<n_regions<<std::endl;
198  edm::LogInfo ("PointSeededTrackingRegionsProducer") << "produced "<<n_regions<<" regions";
199 
200  return result;
201  }
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< reco::BeamSpot > token_beamSpot
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
Geom::Theta< T > theta() const
bool ev
edm::EDGetTokenT< MeasurementTrackerEvent > token_measurementTracker
float float float z
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
U second(std::pair< T, U > const &p)
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< reco::VertexCollection > token_vertex
bool isValid() const
Definition: HandleBase.h:75
T const * product() const
Definition: Handle.h:81
bool isUninitialized() const
Definition: EDGetToken.h:71
Definition: DDAxes.h:10

Member Data Documentation

double PointSeededTrackingRegionsProducer::eta_input
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
double PointSeededTrackingRegionsProducer::phi_input
private
edm::EDGetTokenT<reco::BeamSpot> PointSeededTrackingRegionsProducer::token_beamSpot
private
edm::EDGetTokenT<MeasurementTrackerEvent> PointSeededTrackingRegionsProducer::token_measurementTracker
private
edm::EDGetTokenT<reco::VertexCollection> PointSeededTrackingRegionsProducer::token_vertex
private