CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
TrackingRegionsFromSuperClustersProducer Class Reference

#include <TrackingRegionsFromSuperClustersProducer.h>

Inheritance diagram for TrackingRegionsFromSuperClustersProducer:
TrackingRegionProducer

Public Types

enum  Charge { Charge::NEG = -1, Charge::POS = +1 }
 

Public Member Functions

std::vector< std::unique_ptr< TrackingRegion > > regions (const edm::Event &iEvent, const edm::EventSetup &iSetup) const override
 
 TrackingRegionsFromSuperClustersProducer (const edm::ParameterSet &cfg, edm::ConsumesCollector &&cc)
 
 ~TrackingRegionsFromSuperClustersProducer () override
 
- Public Member Functions inherited from TrackingRegionProducer
virtual ~TrackingRegionProducer ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

std::unique_ptr< TrackingRegioncreateTrackingRegion (const reco::SuperCluster &superCluster, const GlobalPoint &vtxPos, const double deltaZVertex, const Charge charge, const MeasurementTrackerEvent *measTrackerEvent, const MagneticField &magField) const
 
GlobalPoint getVtxPos (const edm::Event &iEvent, double &deltaZVertex) const
 
void validateConfigSettings () const
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotbeamSpotToken_
 
double defaultZ_
 
double deltaEtaRegion_
 
double deltaPhiRegion_
 
edm::EDGetTokenT< MeasurementTrackerEventmeasTrackerEventToken_
 
double minBSDeltaZ_
 
double nrSigmaForBSDeltaZ_
 
double originHalfLength_
 
double originRadius_
 
bool precise_
 
double ptMin_
 
std::vector< edm::EDGetTokenT< std::vector< reco::SuperClusterRef > > > superClustersTokens_
 
bool useZInBeamspot_
 
bool useZInVertex_
 
edm::EDGetTokenT< reco::VertexCollectionverticesToken_
 
RectangularEtaPhiTrackingRegion::UseMeasurementTracker whereToUseMeasTracker_
 

Detailed Description

Definition at line 87 of file TrackingRegionsFromSuperClustersProducer.h.

Member Enumeration Documentation

Enumerator
NEG 
POS 

Definition at line 89 of file TrackingRegionsFromSuperClustersProducer.h.

89 { NEG = -1, POS = +1 };

Constructor & Destructor Documentation

TrackingRegionsFromSuperClustersProducer::TrackingRegionsFromSuperClustersProducer ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  cc 
)

Definition at line 149 of file TrackingRegionsFromSuperClustersProducer.h.

References AlignmentProducer_cff::beamSpotTag, beamSpotToken_, defaultZ_, deltaEtaRegion_, deltaPhiRegion_, edm::ParameterSet::getParameter(), RectangularEtaPhiTrackingRegion::kNever, measTrackerEventToken_, minBSDeltaZ_, nrSigmaForBSDeltaZ_, originHalfLength_, originRadius_, precise_, ptMin_, AlCaHLTBitMon_QueryRunRegistry::string, superClustersTokens_, GlobalPosition_Frontier_DevDB_cff::tag, useZInBeamspot_, useZInVertex_, validateConfigSettings(), verticesToken_, and whereToUseMeasTracker_.

150  {
151  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
152 
153  ptMin_ = regionPSet.getParameter<double>("ptMin");
154  originRadius_ = regionPSet.getParameter<double>("originRadius");
155  originHalfLength_ = regionPSet.getParameter<double>("originHalfLength");
156  deltaPhiRegion_ = regionPSet.getParameter<double>("deltaPhiRegion");
157  deltaEtaRegion_ = regionPSet.getParameter<double>("deltaEtaRegion");
158  useZInVertex_ = regionPSet.getParameter<bool>("useZInVertex");
159  useZInBeamspot_ = regionPSet.getParameter<bool>("useZInBeamspot");
160  nrSigmaForBSDeltaZ_ = regionPSet.getParameter<double>("nrSigmaForBSDeltaZ");
161  defaultZ_ = regionPSet.getParameter<double>("defaultZ");
162  minBSDeltaZ_ = regionPSet.getParameter<double>("minBSDeltaZ");
163  precise_ = regionPSet.getParameter<bool>("precise");
164  whereToUseMeasTracker_ = strToEnum<RectangularEtaPhiTrackingRegion::UseMeasurementTracker>(
165  regionPSet.getParameter<std::string>("whereToUseMeasTracker"));
166 
168 
169  auto verticesTag = regionPSet.getParameter<edm::InputTag>("vertices");
170  auto beamSpotTag = regionPSet.getParameter<edm::InputTag>("beamSpot");
171  auto superClustersTags = regionPSet.getParameter<std::vector<edm::InputTag>>("superClusters");
172  auto measTrackerEventTag = regionPSet.getParameter<edm::InputTag>("measurementTrackerEvent");
173 
174  if (useZInVertex_) {
175  verticesToken_ = iC.consumes<reco::VertexCollection>(verticesTag);
176  } else {
177  beamSpotToken_ = iC.consumes<reco::BeamSpot>(beamSpotTag);
178  }
180  measTrackerEventToken_ = iC.consumes<MeasurementTrackerEvent>(measTrackerEventTag);
181  }
182  for (const auto& tag : superClustersTags) {
183  superClustersTokens_.emplace_back(iC.consumes<std::vector<reco::SuperClusterRef>>(tag));
184  }
185 }
T getParameter(std::string const &) const
RectangularEtaPhiTrackingRegion::UseMeasurementTracker whereToUseMeasTracker_
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
std::vector< edm::EDGetTokenT< std::vector< reco::SuperClusterRef > > > superClustersTokens_
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
edm::EDGetTokenT< MeasurementTrackerEvent > measTrackerEventToken_
TrackingRegionsFromSuperClustersProducer::~TrackingRegionsFromSuperClustersProducer ( )
inlineoverride

Member Function Documentation

std::unique_ptr< TrackingRegion > TrackingRegionsFromSuperClustersProducer::createTrackingRegion ( const reco::SuperCluster superCluster,
const GlobalPoint vtxPos,
const double  deltaZVertex,
const Charge  charge,
const MeasurementTrackerEvent measTrackerEvent,
const MagneticField magField 
) const
private

Definition at line 281 of file TrackingRegionsFromSuperClustersProducer.h.

References deltaEtaRegion_, deltaPhiRegion_, HCALHighEnergyHPDFilter_cfi::energy, reco::CaloCluster::energy(), FTSFromVertexToPointFactory::get(), FreeTrajectoryState::momentum(), originRadius_, reco::CaloCluster::position(), precise_, ptMin_, and whereToUseMeasTracker_.

Referenced by regions(), and ~TrackingRegionsFromSuperClustersProducer().

287  {
288  const GlobalPoint clusterPos(superCluster.position().x(), superCluster.position().y(), superCluster.position().z());
289  const double energy = superCluster.energy();
290 
291  FreeTrajectoryState freeTrajState =
292  FTSFromVertexToPointFactory::get(magField, clusterPos, vtxPos, energy, static_cast<int>(charge));
293  return std::make_unique<RectangularEtaPhiTrackingRegion>(freeTrajState.momentum(),
294  vtxPos,
295  ptMin_,
297  deltaZVertex,
301  precise_,
302  measTrackerEvent);
303 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:153
static FreeTrajectoryState get(MagneticField const &magField, GlobalPoint const &xmeas, GlobalPoint const &xvert, float momentum, TrackCharge charge)
RectangularEtaPhiTrackingRegion::UseMeasurementTracker whereToUseMeasTracker_
double energy() const
cluster energy
Definition: CaloCluster.h:148
GlobalVector momentum() const
void TrackingRegionsFromSuperClustersProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 187 of file TrackingRegionsFromSuperClustersProducer.h.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), HLT_2018_cff::InputTag, edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by ~TrackingRegionsFromSuperClustersProducer().

187  {
189 
190  desc.add<double>("ptMin", 1.5);
191  desc.add<double>("originRadius", 0.2);
192  desc.add<double>("originHalfLength", 15.0)
193  ->setComment("z range is +/- this value except when using the beamspot (useZInBeamspot=true)");
194  desc.add<double>("deltaPhiRegion", 0.4);
195  desc.add<double>("deltaEtaRegion", 0.1);
196  desc.add<bool>("useZInVertex", false)
197  ->setComment("use the leading vertex position +/-orginHalfLength, mutually exclusive with useZInBeamspot");
198  desc.add<bool>("useZInBeamspot", true)
199  ->setComment(
200  "use the beamspot position +/- nrSigmaForBSDeltaZ* sigmaZ_{bs}, mutually exclusive with useZInVertex");
201  desc.add<double>("nrSigmaForBSDeltaZ", 3.0)
202  ->setComment("# of sigma to extend the z region when using the beamspot, only active if useZInBeamspot=true");
203  desc.add<double>("minBSDeltaZ", 0.0)
204  ->setComment("a minimum value of the beamspot sigma z to use, only active if useZInBeamspot=true");
205  desc.add<double>("defaultZ", 0.)
206  ->setComment("the default z position, only used if useZInVertex and useZInBeamspot are both false");
207  desc.add<bool>("precise", true);
208  desc.add<std::string>("whereToUseMeasTracker", "kNever");
209  desc.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"))
210  ->setComment("only used if useZInBeamspot is true");
211  desc.add<edm::InputTag>("vertices", edm::InputTag())->setComment("only used if useZInVertex is true");
212  desc.add<std::vector<edm::InputTag>>("superClusters",
213  std::vector<edm::InputTag>{edm::InputTag{"hltEgammaSuperClustersToPixelMatch"}});
214  desc.add<edm::InputTag>("measurementTrackerEvent", edm::InputTag());
215 
216  edm::ParameterSetDescription descRegion;
217  descRegion.add<edm::ParameterSetDescription>("RegionPSet", desc);
218 
219  descriptions.add("trackingRegionsFromSuperClusters", descRegion);
220 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
GlobalPoint TrackingRegionsFromSuperClustersProducer::getVtxPos ( const edm::Event iEvent,
double &  deltaZVertex 
) const
private

Definition at line 249 of file TrackingRegionsFromSuperClustersProducer.h.

References beamSpotToken_, qcdUeDQM_cfi::bsPos, defaultZ_, SiStripPI::max, minBSDeltaZ_, nrSigmaForBSDeltaZ_, originHalfLength_, MetAnalyzer::pv(), fftjetvertexadder_cfi::sigmaZ, mathSSE::sqrt(), useZInBeamspot_, useZInVertex_, and verticesToken_.

Referenced by regions(), and ~TrackingRegionsFromSuperClustersProducer().

249  {
250  if (useZInVertex_) {
251  auto verticesHandle = getHandle(iEvent, verticesToken_);
252  //we throw if the vertices are not there but if no vertex is
253  //recoed in the event, we default to 0,0,defaultZ as the vertex
254  if (!verticesHandle->empty()) {
255  deltaZVertex = originHalfLength_;
256  const auto& pv = verticesHandle->front();
257  return GlobalPoint(pv.x(), pv.y(), pv.z());
258  } else {
259  deltaZVertex = originHalfLength_;
260  return GlobalPoint(0, 0, defaultZ_);
261  }
262  } else {
263  auto beamSpotHandle = getHandle(iEvent, beamSpotToken_);
264  const reco::BeamSpot::Point& bsPos = beamSpotHandle->position();
265 
266  if (useZInBeamspot_) {
267  //as this is what has been done traditionally for e/gamma, others just use sigmaZ
268  const double bsSigmaZ = std::sqrt(beamSpotHandle->sigmaZ() * beamSpotHandle->sigmaZ() +
269  beamSpotHandle->sigmaZ0Error() * beamSpotHandle->sigmaZ0Error());
270  const double sigmaZ = std::max(bsSigmaZ, minBSDeltaZ_);
271  deltaZVertex = nrSigmaForBSDeltaZ_ * sigmaZ;
272 
273  return GlobalPoint(bsPos.x(), bsPos.y(), bsPos.z());
274  } else {
275  deltaZVertex = originHalfLength_;
276  return GlobalPoint(bsPos.x(), bsPos.y(), defaultZ_);
277  }
278  }
279 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:27
T sqrt(T t)
Definition: SSEVec.h:19
def pv(vc)
Definition: MetAnalyzer.py:7
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
std::vector< std::unique_ptr< TrackingRegion > > TrackingRegionsFromSuperClustersProducer::regions ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements TrackingRegionProducer.

Definition at line 222 of file TrackingRegionsFromSuperClustersProducer.h.

References createTrackingRegion(), edm::EventSetup::get(), getVtxPos(), edm::EDGetTokenT< T >::isUninitialized(), measTrackerEventToken_, NEG, POS, superClustersTokens_, and hltSeeds_cff::trackingRegions.

Referenced by ~TrackingRegionsFromSuperClustersProducer().

223  {
224  std::vector<std::unique_ptr<TrackingRegion>> trackingRegions;
225 
226  double deltaZVertex = 0;
227  GlobalPoint vtxPos = getVtxPos(iEvent, deltaZVertex);
228 
229  const MeasurementTrackerEvent* measTrackerEvent = nullptr;
231  measTrackerEvent = getHandle(iEvent, measTrackerEventToken_).product();
232  }
233  edm::ESHandle<MagneticField> magFieldHandle;
234  iSetup.get<IdealMagneticFieldRecord>().get(magFieldHandle);
235 
236  for (auto& superClustersToken : superClustersTokens_) {
237  auto superClustersHandle = getHandle(iEvent, superClustersToken);
238  for (auto& superClusterRef : *superClustersHandle) {
239  //do both charge hypothesises
240  trackingRegions.emplace_back(
241  createTrackingRegion(*superClusterRef, vtxPos, deltaZVertex, Charge::POS, measTrackerEvent, *magFieldHandle));
242  trackingRegions.emplace_back(
243  createTrackingRegion(*superClusterRef, vtxPos, deltaZVertex, Charge::NEG, measTrackerEvent, *magFieldHandle));
244  }
245  }
246  return trackingRegions;
247 }
std::vector< edm::EDGetTokenT< std::vector< reco::SuperClusterRef > > > superClustersTokens_
std::unique_ptr< TrackingRegion > createTrackingRegion(const reco::SuperCluster &superCluster, const GlobalPoint &vtxPos, const double deltaZVertex, const Charge charge, const MeasurementTrackerEvent *measTrackerEvent, const MagneticField &magField) const
edm::EDGetTokenT< MeasurementTrackerEvent > measTrackerEventToken_
T get() const
Definition: EventSetup.h:73
bool isUninitialized() const
Definition: EDGetToken.h:70
GlobalPoint getVtxPos(const edm::Event &iEvent, double &deltaZVertex) const
void TrackingRegionsFromSuperClustersProducer::validateConfigSettings ( ) const
private

Definition at line 305 of file TrackingRegionsFromSuperClustersProducer.h.

References Exception, useZInBeamspot_, and useZInVertex_.

Referenced by TrackingRegionsFromSuperClustersProducer(), and ~TrackingRegionsFromSuperClustersProducer().

305  {
307  throw cms::Exception("InvalidConfiguration")
308  << " when constructing TrackingRegionsFromSuperClustersProducer both useZInVertex (" << useZInVertex_
309  << ") and useZInBeamspot (" << useZInBeamspot_ << ") can not be true as they are mutually exclusive options"
310  << std::endl;
311  }
312 }

Member Data Documentation

edm::EDGetTokenT<reco::BeamSpot> TrackingRegionsFromSuperClustersProducer::beamSpotToken_
private
double TrackingRegionsFromSuperClustersProducer::defaultZ_
private
double TrackingRegionsFromSuperClustersProducer::deltaEtaRegion_
private
double TrackingRegionsFromSuperClustersProducer::deltaPhiRegion_
private
edm::EDGetTokenT<MeasurementTrackerEvent> TrackingRegionsFromSuperClustersProducer::measTrackerEventToken_
private
double TrackingRegionsFromSuperClustersProducer::minBSDeltaZ_
private
double TrackingRegionsFromSuperClustersProducer::nrSigmaForBSDeltaZ_
private
double TrackingRegionsFromSuperClustersProducer::originHalfLength_
private
double TrackingRegionsFromSuperClustersProducer::originRadius_
private
bool TrackingRegionsFromSuperClustersProducer::precise_
private
double TrackingRegionsFromSuperClustersProducer::ptMin_
private
std::vector<edm::EDGetTokenT<std::vector<reco::SuperClusterRef> > > TrackingRegionsFromSuperClustersProducer::superClustersTokens_
private
bool TrackingRegionsFromSuperClustersProducer::useZInBeamspot_
private
bool TrackingRegionsFromSuperClustersProducer::useZInVertex_
private
edm::EDGetTokenT<reco::VertexCollection> TrackingRegionsFromSuperClustersProducer::verticesToken_
private
RectangularEtaPhiTrackingRegion::UseMeasurementTracker TrackingRegionsFromSuperClustersProducer::whereToUseMeasTracker_
private