CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static 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, edm::ConsumesCollector &&iC)
 
std::vector< std::unique_ptr< TrackingRegion > > regions (const edm::Event &e, const edm::EventSetup &es) const override
 
 ~CandidateSeededTrackingRegionsProducer () override
 
- Public Member Functions inherited from TrackingRegionProducer
virtual ~TrackingRegionProducer ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

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
 
edm::EDGetTokenT< reco::BeamSpottoken_beamSpot
 
edm::EDGetTokenT< reco::CandidateViewtoken_input
 
edm::EDGetTokenT< MeasurementTrackerEventtoken_measurementTracker
 
edm::EDGetTokenT< reco::VertexCollectiontoken_vertex
 

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 45 of file CandidateSeededTrackingRegionsProducer.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 51 of file CandidateSeededTrackingRegionsProducer.h.

References BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, 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, AlCaHLTBitMon_QueryRunRegistry::string, RectangularEtaPhiTrackingRegion::stringToUseMeasurementTracker(), token_beamSpot, token_input, token_measurementTracker, token_vertex, VERTICES_FIXED, and VERTICES_SIGMA.

53  {
54  edm::ParameterSet regPSet = conf.getParameter<edm::ParameterSet>("RegionPSet");
55 
56  // operation mode
57  std::string modeString = regPSet.getParameter<std::string>("mode");
58  if (modeString == "BeamSpotFixed") m_mode = BEAM_SPOT_FIXED;
59  else if (modeString == "BeamSpotSigma") m_mode = BEAM_SPOT_SIGMA;
60  else if (modeString == "VerticesFixed") m_mode = VERTICES_FIXED;
61  else if (modeString == "VerticesSigma") m_mode = VERTICES_SIGMA;
62  else edm::LogError ("CandidateSeededTrackingRegionsProducer")<<"Unknown mode string: "<<modeString;
63 
64  // basic inputs
66  m_maxNRegions = regPSet.getParameter<int>("maxNRegions");
68  m_maxNVertices = 1;
70  {
71  token_vertex = iC.consumes<reco::VertexCollection>(regPSet.getParameter<edm::InputTag>("vertexCollection"));
72  m_maxNVertices = regPSet.getParameter<int>("maxNVertices");
73  }
74 
75  // RectangularEtaPhiTrackingRegion parameters:
76  m_ptMin = regPSet.getParameter<double>("ptMin");
77  m_originRadius = regPSet.getParameter<double>("originRadius");
78  m_zErrorBeamSpot = regPSet.getParameter<double>("zErrorBeamSpot");
79  m_deltaEta = regPSet.getParameter<double>("deltaEta");
80  m_deltaPhi = regPSet.getParameter<double>("deltaPhi");
81  m_precise = regPSet.getParameter<bool>("precise");
83  if(m_whereToUseMeasurementTracker != RectangularEtaPhiTrackingRegion::UseMeasurementTracker::kNever) {
85  }
86  m_searchOpt = false;
87  if (regPSet.exists("searchOpt")) m_searchOpt = regPSet.getParameter<bool>("searchOpt");
88 
89  // mode-dependent z-halflength of tracking regions
90  if (m_mode == VERTICES_SIGMA) m_nSigmaZVertex = regPSet.getParameter<double>("nSigmaZVertex");
91  if (m_mode == VERTICES_FIXED) m_zErrorVetex = regPSet.getParameter<double>("zErrorVetex");
92  m_nSigmaZBeamSpot = -1.;
93  if (m_mode == BEAM_SPOT_SIGMA)
94  {
95  m_nSigmaZBeamSpot = regPSet.getParameter<double>("nSigmaZBeamSpot");
96  if (m_nSigmaZBeamSpot < 0.)
97  edm::LogError ("CandidateSeededTrackingRegionsProducer")<<"nSigmaZBeamSpot must be positive for BeamSpotSigma mode!";
98  }
99  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< reco::VertexCollection > token_vertex
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
static UseMeasurementTracker stringToUseMeasurementTracker(const std::string &name)
edm::EDGetTokenT< MeasurementTrackerEvent > token_measurementTracker
CandidateSeededTrackingRegionsProducer::~CandidateSeededTrackingRegionsProducer ( )
inlineoverride

Definition at line 101 of file CandidateSeededTrackingRegionsProducer.h.

101 {}

Member Function Documentation

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

Definition at line 103 of file CandidateSeededTrackingRegionsProducer.h.

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

103  {
105 
106  desc.add<std::string>("mode", "BeamSpotFixed");
107 
108  desc.add<edm::InputTag>("input", edm::InputTag(""));
109  desc.add<int>("maxNRegions", 10);
110  desc.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
111  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("hltPixelVertices"));
112  desc.add<int>("maxNVertices", 1);
113 
114  desc.add<double>("ptMin", 0.9);
115  desc.add<double>("originRadius", 0.2);
116  desc.add<double>("zErrorBeamSpot", 24.2);
117  desc.add<double>("deltaEta", 0.5);
118  desc.add<double>("deltaPhi", 0.5);
119  desc.add<bool>("precise", true);
120 
121  desc.add<double>("nSigmaZVertex", 3.);
122  desc.add<double>("zErrorVetex", 0.2);
123  desc.add<double>("nSigmaZBeamSpot", 4.);
124 
125  desc.add<std::string>("whereToUseMeasurementTracker", "ForSiStrips");
126  desc.add<edm::InputTag>("measurementTrackerName", edm::InputTag(""));
127 
128  desc.add<bool>("searchOpt", false);
129 
130  // Only for backwards-compatibility
131  edm::ParameterSetDescription descRegion;
132  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
133 
134  descriptions.add("seededTrackingRegionsFromBeamSpotFixedZLength", descRegion);
135  }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::vector<std::unique_ptr<TrackingRegion> > CandidateSeededTrackingRegionsProducer::regions ( const edm::Event e,
const edm::EventSetup es 
) const
inlineoverridevirtual

Implements TrackingRegionProducer.

Definition at line 138 of file CandidateSeededTrackingRegionsProducer.h.

References BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, 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, edm::Handle< T >::product(), mps_fire::result, edm::second(), reco::BeamSpot::sigmaZ(), edm::View< T >::size(), token_beamSpot, token_input, token_measurementTracker, token_vertex, findQualityFiles::v, electrons_cff::vertices, VERTICES_FIXED, VERTICES_SIGMA, x, reco::BeamSpot::x0(), y, reco::BeamSpot::y0(), z, reco::BeamSpot::z0(), and reco::BeamSpot::z0Error().

139  {
140  std::vector<std::unique_ptr<TrackingRegion> > result;
141 
142  // pick up the candidate objects of interest
144  e.getByToken( token_input, objects );
145  size_t n_objects = objects->size();
146  if (n_objects == 0) return result;
147 
148  // always need the beam spot (as a fall back strategy for vertex modes)
150  e.getByToken( token_beamSpot, bs );
151  if( !bs.isValid() ) return result;
152 
153  // this is a default origin for all modes
154  GlobalPoint default_origin( bs->x0(), bs->y0(), bs->z0() );
155 
156  // vector of origin & halfLength pairs:
157  std::vector< std::pair< GlobalPoint, float > > origins;
158 
159  // fill the origins and halfLengths depending on the mode
161  {
162  origins.push_back( std::make_pair(
163  default_origin,
165  ));
166  }
167  else if (m_mode == VERTICES_FIXED || m_mode == VERTICES_SIGMA)
168  {
170  e.getByToken( token_vertex, vertices );
171  int n_vert = 0;
172  for (reco::VertexCollection::const_iterator v = vertices->begin(); v != vertices->end() && n_vert < m_maxNVertices; ++v)
173  {
174  if ( v->isFake() || !v->isValid() ) continue;
175 
176  origins.push_back( std::make_pair(
177  GlobalPoint( v->x(), v->y(), v->z() ),
179  ));
180  ++n_vert;
181  }
182  // no-vertex fall-back case:
183  if (origins.empty())
184  {
185  origins.push_back( std::make_pair(
186  default_origin,
188  ));
189  }
190  }
191 
192  const MeasurementTrackerEvent *measurementTracker = nullptr;
196  measurementTracker = hmte.product();
197  }
198 
199  // create tracking regions (maximum MaxNRegions of them) in directions of the
200  // objects of interest (we expect that the collection was sorted in decreasing pt order)
201  int n_regions = 0;
202  for(size_t i = 0; i < n_objects && n_regions < m_maxNRegions; ++i )
203  {
204  const reco::Candidate & object = (*objects)[i];
205  GlobalVector direction( object.momentum().x(), object.momentum().y(), object.momentum().z() );
206 
207  for (size_t j=0; j<origins.size() && n_regions < m_maxNRegions; ++j)
208  {
209  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(
210  direction,
211  origins[j].first,
212  m_ptMin,
214  origins[j].second,
215  m_deltaEta,
216  m_deltaPhi,
218  m_precise,
219  measurementTracker,
221  ));
222  ++n_regions;
223  }
224  }
225  //std::cout<<"n_seeded_regions = "<<n_regions<<std::endl;
226  edm::LogInfo ("CandidateSeededTrackingRegionsProducer") << "produced "<<n_regions<<" regions";
227 
228  return result;
229  }
double z0() const
z coordinate
Definition: BeamSpot.h:68
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
size_type size() const
edm::EDGetTokenT< reco::VertexCollection > token_vertex
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< MeasurementTrackerEvent > token_measurementTracker
bool isValid() const
Definition: HandleBase.h:74
double z0Error() const
error on z
Definition: BeamSpot.h:94
T const * product() const
Definition: Handle.h:74
double sigmaZ() const
sigma z
Definition: BeamSpot.h:80
double y0() const
y coordinate
Definition: BeamSpot.h:66
bool isUninitialized() const
Definition: EDGetToken.h:70
double x0() const
x coordinate
Definition: BeamSpot.h:64

Member Data Documentation

float CandidateSeededTrackingRegionsProducer::m_deltaEta
private
float CandidateSeededTrackingRegionsProducer::m_deltaPhi
private
int CandidateSeededTrackingRegionsProducer::m_maxNRegions
private
int CandidateSeededTrackingRegionsProducer::m_maxNVertices
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
RectangularEtaPhiTrackingRegion::UseMeasurementTracker CandidateSeededTrackingRegionsProducer::m_whereToUseMeasurementTracker
private
float CandidateSeededTrackingRegionsProducer::m_zErrorBeamSpot
private
float CandidateSeededTrackingRegionsProducer::m_zErrorVetex
private
edm::EDGetTokenT<reco::BeamSpot> CandidateSeededTrackingRegionsProducer::token_beamSpot
private
edm::EDGetTokenT<reco::CandidateView> CandidateSeededTrackingRegionsProducer::token_input
private
edm::EDGetTokenT<MeasurementTrackerEvent> CandidateSeededTrackingRegionsProducer::token_measurementTracker
private
edm::EDGetTokenT<reco::VertexCollection> CandidateSeededTrackingRegionsProducer::token_vertex
private