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=default
 
- 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::ESGetToken< MagneticField, IdealMagneticFieldRecordtoken_field
 
edm::EDGetTokenT< reco::CandidateViewtoken_input
 
edm::EDGetTokenT< MeasurementTrackerEventtoken_measurementTracker
 
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecordtoken_msmaker
 
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 49 of file CandidateSeededTrackingRegionsProducer.h.

Member Enumeration Documentation

◆ Mode

Constructor & Destructor Documentation

◆ CandidateSeededTrackingRegionsProducer()

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

Definition at line 53 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_msmaker, token_vertex, VERTICES_FIXED, and VERTICES_SIGMA.

54  : token_field(iC.esConsumes()) {
55  edm::ParameterSet regPSet = conf.getParameter<edm::ParameterSet>("RegionPSet");
56 
57  // operation mode
58  std::string modeString = regPSet.getParameter<std::string>("mode");
59  if (modeString == "BeamSpotFixed")
61  else if (modeString == "BeamSpotSigma")
63  else if (modeString == "VerticesFixed")
65  else if (modeString == "VerticesSigma")
67  else
68  edm::LogError("CandidateSeededTrackingRegionsProducer") << "Unknown mode string: " << modeString;
69 
70  // basic inputs
72  m_maxNRegions = regPSet.getParameter<int>("maxNRegions");
74  m_maxNVertices = 1;
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  regPSet.getParameter<std::string>("whereToUseMeasurementTracker"));
91  iC.consumes<MeasurementTrackerEvent>(regPSet.getParameter<edm::InputTag>("measurementTrackerName"));
92  }
93  m_searchOpt = false;
94  if (regPSet.exists("searchOpt"))
95  m_searchOpt = regPSet.getParameter<bool>("searchOpt");
96 
97  // mode-dependent z-halflength of tracking regions
98  if (m_mode == VERTICES_SIGMA)
99  m_nSigmaZVertex = regPSet.getParameter<double>("nSigmaZVertex");
100  if (m_mode == VERTICES_FIXED)
101  m_zErrorVetex = regPSet.getParameter<double>("zErrorVetex");
102  m_nSigmaZBeamSpot = -1.;
103  if (m_mode == BEAM_SPOT_SIGMA) {
104  m_nSigmaZBeamSpot = regPSet.getParameter<double>("nSigmaZBeamSpot");
105  if (m_nSigmaZBeamSpot < 0.)
106  edm::LogError("CandidateSeededTrackingRegionsProducer")
107  << "nSigmaZBeamSpot must be positive for BeamSpotSigma mode!";
108  }
109  if (m_precise) {
110  token_msmaker = iC.esConsumes();
111  }
112  }
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > token_msmaker
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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::ESGetToken< MagneticField, IdealMagneticFieldRecord > token_field
Log< level::Error, false > LogError
edm::EDGetTokenT< MeasurementTrackerEvent > token_measurementTracker

◆ ~CandidateSeededTrackingRegionsProducer()

CandidateSeededTrackingRegionsProducer::~CandidateSeededTrackingRegionsProducer ( )
overridedefault

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 116 of file CandidateSeededTrackingRegionsProducer.h.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, HLT_2022v15_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

116  {
118 
119  desc.add<std::string>("mode", "BeamSpotFixed");
120 
121  desc.add<edm::InputTag>("input", edm::InputTag(""));
122  desc.add<int>("maxNRegions", 10);
123  desc.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
124  desc.add<edm::InputTag>("vertexCollection", edm::InputTag("hltPixelVertices"));
125  desc.add<int>("maxNVertices", 1);
126 
127  desc.add<double>("ptMin", 0.9);
128  desc.add<double>("originRadius", 0.2);
129  desc.add<double>("zErrorBeamSpot", 24.2);
130  desc.add<double>("deltaEta", 0.5);
131  desc.add<double>("deltaPhi", 0.5);
132  desc.add<bool>("precise", true);
133 
134  desc.add<double>("nSigmaZVertex", 3.);
135  desc.add<double>("zErrorVetex", 0.2);
136  desc.add<double>("nSigmaZBeamSpot", 4.);
137 
138  desc.add<std::string>("whereToUseMeasurementTracker", "ForSiStrips");
139  desc.add<edm::InputTag>("measurementTrackerName", edm::InputTag(""));
140 
141  desc.add<bool>("searchOpt", false);
142 
143  // Only for backwards-compatibility
144  edm::ParameterSetDescription descRegion;
145  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
146 
147  descriptions.add("seededTrackingRegionsFromBeamSpotFixedZLength", descRegion);
148  }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ regions()

std::vector<std::unique_ptr<TrackingRegion> > CandidateSeededTrackingRegionsProducer::regions ( const edm::Event e,
const edm::EventSetup es 
) const
inlineoverridevirtual

Implements TrackingRegionProducer.

Definition at line 150 of file CandidateSeededTrackingRegionsProducer.h.

References BEAM_SPOT_FIXED, BEAM_SPOT_SIGMA, cms::cuda::bs, MillePedeFileConverter_cfg::e, dqmdumpme::first, edm::EventSetup::getData(), mps_fire::i, edm::EDGetTokenT< T >::isUninitialized(), dqmiolumiharvest::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, HLTSiStripMonitoring_cff::measurementTracker, L1TPhase2Offline_cfi::objects, edm::Handle< T >::product(), mps_fire::result, edm::second(), token_beamSpot, token_field, token_input, token_measurementTracker, token_msmaker, token_vertex, findQualityFiles::v, AlignmentTracksFromVertexSelector_cfi::vertices, VERTICES_FIXED, VERTICES_SIGMA, x, y, and z.

150  {
151  std::vector<std::unique_ptr<TrackingRegion> > result;
152 
153  // pick up the candidate objects of interest
155  e.getByToken(token_input, objects);
156  size_t n_objects = objects->size();
157  if (n_objects == 0)
158  return result;
159 
160  // always need the beam spot (as a fall back strategy for vertex modes)
162  e.getByToken(token_beamSpot, bs);
163  if (!bs.isValid())
164  return result;
165 
166  // this is a default origin for all modes
167  GlobalPoint default_origin(bs->x0(), bs->y0(), bs->z0());
168 
169  // vector of origin & halfLength pairs:
170  std::vector<std::pair<GlobalPoint, float> > origins;
171 
172  // fill the origins and halfLengths depending on the mode
174  origins.push_back(std::make_pair(
175  default_origin, (m_mode == BEAM_SPOT_FIXED) ? m_zErrorBeamSpot : m_nSigmaZBeamSpot * bs->sigmaZ()));
176  } else if (m_mode == VERTICES_FIXED || m_mode == VERTICES_SIGMA) {
178  e.getByToken(token_vertex, vertices);
179  int n_vert = 0;
180  for (reco::VertexCollection::const_iterator v = vertices->begin();
181  v != vertices->end() && n_vert < m_maxNVertices;
182  ++v) {
183  if (v->isFake() || !v->isValid())
184  continue;
185 
186  origins.push_back(std::make_pair(GlobalPoint(v->x(), v->y(), v->z()),
187  (m_mode == VERTICES_FIXED) ? m_zErrorVetex : m_nSigmaZVertex * v->zError()));
188  ++n_vert;
189  }
190  // no-vertex fall-back case:
191  if (origins.empty()) {
192  origins.push_back(std::make_pair(
193  default_origin, (m_nSigmaZBeamSpot > 0.) ? m_nSigmaZBeamSpot * bs->z0Error() : m_zErrorBeamSpot));
194  }
195  }
196 
200  e.getByToken(token_measurementTracker, hmte);
201  measurementTracker = hmte.product();
202  }
203 
204  const auto& field = es.getData(token_field);
205  const MultipleScatteringParametrisationMaker* msmaker = nullptr;
206  if (m_precise) {
207  msmaker = &es.getData(token_msmaker);
208  }
209 
210  // create tracking regions (maximum MaxNRegions of them) in directions of the
211  // objects of interest (we expect that the collection was sorted in decreasing pt order)
212  int n_regions = 0;
213  for (size_t i = 0; i < n_objects && n_regions < m_maxNRegions; ++i) {
214  const reco::Candidate& object = (*objects)[i];
215  GlobalVector direction(object.momentum().x(), object.momentum().y(), object.momentum().z());
216 
217  for (size_t j = 0; j < origins.size() && n_regions < m_maxNRegions; ++j) {
218  result.push_back(std::make_unique<RectangularEtaPhiTrackingRegion>(direction,
219  origins[j].first,
220  m_ptMin,
222  origins[j].second,
223  m_deltaEta,
224  m_deltaPhi,
225  field,
226  msmaker,
227  m_precise,
230  m_searchOpt));
231  ++n_regions;
232  }
233  }
234  //std::cout<<"n_seeded_regions = "<<n_regions<<std::endl;
235  edm::LogInfo("CandidateSeededTrackingRegionsProducer") << "produced " << n_regions << " regions";
236 
237  return result;
238  }
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > token_msmaker
RectangularEtaPhiTrackingRegion::UseMeasurementTracker m_whereToUseMeasurementTracker
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
T const * product() const
Definition: Handle.h:70
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:104
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
edm::EDGetTokenT< reco::VertexCollection > token_vertex
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > token_field
U second(std::pair< T, U > const &p)
edm::EDGetTokenT< MeasurementTrackerEvent > token_measurementTracker
Log< level::Info, false > LogInfo

Member Data Documentation

◆ m_deltaEta

float CandidateSeededTrackingRegionsProducer::m_deltaEta
private

◆ m_deltaPhi

float CandidateSeededTrackingRegionsProducer::m_deltaPhi
private

◆ m_maxNRegions

int CandidateSeededTrackingRegionsProducer::m_maxNRegions
private

◆ m_maxNVertices

int CandidateSeededTrackingRegionsProducer::m_maxNVertices
private

◆ m_mode

Mode CandidateSeededTrackingRegionsProducer::m_mode
private

◆ m_nSigmaZBeamSpot

float CandidateSeededTrackingRegionsProducer::m_nSigmaZBeamSpot
private

◆ m_nSigmaZVertex

float CandidateSeededTrackingRegionsProducer::m_nSigmaZVertex
private

◆ m_originRadius

float CandidateSeededTrackingRegionsProducer::m_originRadius
private

◆ m_precise

bool CandidateSeededTrackingRegionsProducer::m_precise
private

◆ m_ptMin

float CandidateSeededTrackingRegionsProducer::m_ptMin
private

◆ m_searchOpt

bool CandidateSeededTrackingRegionsProducer::m_searchOpt
private

◆ m_whereToUseMeasurementTracker

RectangularEtaPhiTrackingRegion::UseMeasurementTracker CandidateSeededTrackingRegionsProducer::m_whereToUseMeasurementTracker
private

◆ m_zErrorBeamSpot

float CandidateSeededTrackingRegionsProducer::m_zErrorBeamSpot
private

◆ m_zErrorVetex

float CandidateSeededTrackingRegionsProducer::m_zErrorVetex
private

◆ token_beamSpot

edm::EDGetTokenT<reco::BeamSpot> CandidateSeededTrackingRegionsProducer::token_beamSpot
private

◆ token_field

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> CandidateSeededTrackingRegionsProducer::token_field
private

Definition at line 257 of file CandidateSeededTrackingRegionsProducer.h.

Referenced by regions().

◆ token_input

edm::EDGetTokenT<reco::CandidateView> CandidateSeededTrackingRegionsProducer::token_input
private

◆ token_measurementTracker

edm::EDGetTokenT<MeasurementTrackerEvent> CandidateSeededTrackingRegionsProducer::token_measurementTracker
private

◆ token_msmaker

edm::ESGetToken<MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord> CandidateSeededTrackingRegionsProducer::token_msmaker
private

◆ token_vertex

edm::EDGetTokenT<reco::VertexCollection> CandidateSeededTrackingRegionsProducer::token_vertex
private