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
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 MultipleScatteringParametrisationMaker *msmaker) 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_
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordmagFieldToken_
 
edm::EDGetTokenT< MeasurementTrackerEventmeasTrackerEventToken_
 
double minBSDeltaZ_
 
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecordmsmakerToken_
 
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 88 of file TrackingRegionsFromSuperClustersProducer.cc.

Member Enumeration Documentation

◆ Charge

Enumerator
NEG 
POS 

Definition at line 90 of file TrackingRegionsFromSuperClustersProducer.cc.

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

Constructor & Destructor Documentation

◆ TrackingRegionsFromSuperClustersProducer()

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

Definition at line 154 of file TrackingRegionsFromSuperClustersProducer.cc.

156  : magFieldToken_{iC.esConsumes()} {
157  edm::ParameterSet regionPSet = cfg.getParameter<edm::ParameterSet>("RegionPSet");
158 
159  ptMin_ = regionPSet.getParameter<double>("ptMin");
160  originRadius_ = regionPSet.getParameter<double>("originRadius");
161  originHalfLength_ = regionPSet.getParameter<double>("originHalfLength");
162  deltaPhiRegion_ = regionPSet.getParameter<double>("deltaPhiRegion");
163  deltaEtaRegion_ = regionPSet.getParameter<double>("deltaEtaRegion");
164  useZInVertex_ = regionPSet.getParameter<bool>("useZInVertex");
165  useZInBeamspot_ = regionPSet.getParameter<bool>("useZInBeamspot");
166  nrSigmaForBSDeltaZ_ = regionPSet.getParameter<double>("nrSigmaForBSDeltaZ");
167  defaultZ_ = regionPSet.getParameter<double>("defaultZ");
168  minBSDeltaZ_ = regionPSet.getParameter<double>("minBSDeltaZ");
169  precise_ = regionPSet.getParameter<bool>("precise");
170  whereToUseMeasTracker_ = strToEnum<RectangularEtaPhiTrackingRegion::UseMeasurementTracker>(
171  regionPSet.getParameter<std::string>("whereToUseMeasTracker"));
172 
174 
175  auto verticesTag = regionPSet.getParameter<edm::InputTag>("vertices");
176  auto beamSpotTag = regionPSet.getParameter<edm::InputTag>("beamSpot");
177  auto superClustersTags = regionPSet.getParameter<std::vector<edm::InputTag>>("superClusters");
178  auto measTrackerEventTag = regionPSet.getParameter<edm::InputTag>("measurementTrackerEvent");
179 
180  if (useZInVertex_) {
181  verticesToken_ = iC.consumes(verticesTag);
182  } else {
183  beamSpotToken_ = iC.consumes(beamSpotTag);
184  }
186  measTrackerEventToken_ = iC.consumes(measTrackerEventTag);
187  }
188  for (const auto& tag : superClustersTags) {
189  superClustersTokens_.emplace_back(iC.consumes(tag));
190  }
191  if (precise_) {
192  msmakerToken_ = iC.esConsumes();
193  }
194 }
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
RectangularEtaPhiTrackingRegion::UseMeasurementTracker whereToUseMeasTracker_
std::vector< edm::EDGetTokenT< std::vector< reco::SuperClusterRef > > > superClustersTokens_
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
edm::EDGetTokenT< MeasurementTrackerEvent > measTrackerEventToken_
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > msmakerToken_

◆ ~TrackingRegionsFromSuperClustersProducer()

TrackingRegionsFromSuperClustersProducer::~TrackingRegionsFromSuperClustersProducer ( )
inlineoverride

Definition at line 95 of file TrackingRegionsFromSuperClustersProducer.cc.

95 {}

Member Function Documentation

◆ createTrackingRegion()

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 MultipleScatteringParametrisationMaker msmaker 
) const
private

Definition at line 293 of file TrackingRegionsFromSuperClustersProducer.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, deltaEtaRegion_, deltaPhiRegion_, hcalRecHitTable_cff::energy, reco::CaloCluster::energy(), trackingTools::ftsFromVertexToPoint(), originRadius_, reco::CaloCluster::position(), precise_, ptMin_, and whereToUseMeasTracker_.

Referenced by regions().

300  {
301  const GlobalPoint clusterPos(superCluster.position().x(), superCluster.position().y(), superCluster.position().z());
302  const double energy = superCluster.energy();
303 
304  auto fts = trackingTools::ftsFromVertexToPoint(magField, clusterPos, vtxPos, energy, static_cast<int>(charge));
305  return std::make_unique<RectangularEtaPhiTrackingRegion>(fts.momentum(),
306  vtxPos,
307  ptMin_,
309  deltaZVertex,
312  magField,
313  msmaker,
314  precise_,
316  measTrackerEvent);
317 }
const math::XYZPoint & position() const
cluster centroid position
Definition: CaloCluster.h:153
RectangularEtaPhiTrackingRegion::UseMeasurementTracker whereToUseMeasTracker_
FreeTrajectoryState ftsFromVertexToPoint(MagneticField const &magField, GlobalPoint const &xmeas, GlobalPoint const &xvert, float momentum, TrackCharge charge)
double energy() const
cluster energy
Definition: CaloCluster.h:148

◆ fillDescriptions()

void TrackingRegionsFromSuperClustersProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 196 of file TrackingRegionsFromSuperClustersProducer.cc.

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

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

◆ getVtxPos()

GlobalPoint TrackingRegionsFromSuperClustersProducer::getVtxPos ( const edm::Event iEvent,
double &  deltaZVertex 
) const
private

Definition at line 261 of file TrackingRegionsFromSuperClustersProducer.cc.

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

Referenced by regions().

261  {
262  if (useZInVertex_) {
263  auto verticesHandle = getHandle(iEvent, verticesToken_);
264  //we throw if the vertices are not there but if no vertex is
265  //recoed in the event, we default to 0,0,defaultZ as the vertex
266  if (!verticesHandle->empty()) {
267  deltaZVertex = originHalfLength_;
268  const auto& pv = verticesHandle->front();
269  return GlobalPoint(pv.x(), pv.y(), pv.z());
270  } else {
271  deltaZVertex = originHalfLength_;
272  return GlobalPoint(0, 0, defaultZ_);
273  }
274  } else {
275  auto beamSpotHandle = getHandle(iEvent, beamSpotToken_);
276  const reco::BeamSpot::Point& bsPos = beamSpotHandle->position();
277 
278  if (useZInBeamspot_) {
279  //as this is what has been done traditionally for e/gamma, others just use sigmaZ
280  const double bsSigmaZ = std::sqrt(beamSpotHandle->sigmaZ() * beamSpotHandle->sigmaZ() +
281  beamSpotHandle->sigmaZ0Error() * beamSpotHandle->sigmaZ0Error());
282  const double sigmaZ = std::max(bsSigmaZ, minBSDeltaZ_);
283  deltaZVertex = nrSigmaForBSDeltaZ_ * sigmaZ;
284 
285  return GlobalPoint(bsPos.x(), bsPos.y(), bsPos.z());
286  } else {
287  deltaZVertex = originHalfLength_;
288  return GlobalPoint(bsPos.x(), bsPos.y(), defaultZ_);
289  }
290  }
291 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:27
int iEvent
Definition: GenABIO.cc:224
T sqrt(T t)
Definition: SSEVec.h:19
edm::EDGetTokenT< reco::VertexCollection > verticesToken_

◆ regions()

std::vector< std::unique_ptr< TrackingRegion > > TrackingRegionsFromSuperClustersProducer::regions ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overridevirtual

Implements TrackingRegionProducer.

Definition at line 231 of file TrackingRegionsFromSuperClustersProducer.cc.

References createTrackingRegion(), edm::EventSetup::getData(), getVtxPos(), iEvent, edm::EDGetTokenT< T >::isUninitialized(), magFieldToken_, measTrackerEventToken_, msmakerToken_, NEG, POS, precise_, superClustersTokens_, and hltSeeds_cff::trackingRegions.

232  {
233  std::vector<std::unique_ptr<TrackingRegion>> trackingRegions;
234 
235  double deltaZVertex = 0;
236  GlobalPoint vtxPos = getVtxPos(iEvent, deltaZVertex);
237 
238  const MeasurementTrackerEvent* measTrackerEvent = nullptr;
240  measTrackerEvent = getHandle(iEvent, measTrackerEventToken_).product();
241  }
242  auto const& magField = iSetup.getData(magFieldToken_);
243  const MultipleScatteringParametrisationMaker* msmaker = nullptr;
244  if (precise_) {
245  msmaker = &iSetup.getData(msmakerToken_);
246  }
247 
248  for (auto& superClustersToken : superClustersTokens_) {
249  auto superClustersHandle = getHandle(iEvent, superClustersToken);
250  for (auto& superClusterRef : *superClustersHandle) {
251  //do both charge hypothesises
253  *superClusterRef, vtxPos, deltaZVertex, Charge::POS, measTrackerEvent, magField, msmaker));
255  *superClusterRef, vtxPos, deltaZVertex, Charge::NEG, measTrackerEvent, magField, msmaker));
256  }
257  }
258  return trackingRegions;
259 }
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:104
GlobalPoint getVtxPos(const edm::Event &iEvent, double &deltaZVertex) const
std::vector< edm::EDGetTokenT< std::vector< reco::SuperClusterRef > > > superClustersTokens_
int iEvent
Definition: GenABIO.cc:224
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 MultipleScatteringParametrisationMaker *msmaker) const
edm::EDGetTokenT< MeasurementTrackerEvent > measTrackerEventToken_
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > msmakerToken_

◆ validateConfigSettings()

void TrackingRegionsFromSuperClustersProducer::validateConfigSettings ( ) const
private

Definition at line 319 of file TrackingRegionsFromSuperClustersProducer.cc.

References Exception, useZInBeamspot_, and useZInVertex_.

319  {
321  throw cms::Exception("InvalidConfiguration")
322  << " when constructing TrackingRegionsFromSuperClustersProducer both useZInVertex (" << useZInVertex_
323  << ") and useZInBeamspot (" << useZInBeamspot_ << ") can not be true as they are mutually exclusive options"
324  << std::endl;
325  }
326 }

Member Data Documentation

◆ beamSpotToken_

edm::EDGetTokenT<reco::BeamSpot> TrackingRegionsFromSuperClustersProducer::beamSpotToken_
private

Definition at line 137 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by getVtxPos().

◆ defaultZ_

double TrackingRegionsFromSuperClustersProducer::defaultZ_
private

Definition at line 131 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by getVtxPos().

◆ deltaEtaRegion_

double TrackingRegionsFromSuperClustersProducer::deltaEtaRegion_
private

Definition at line 126 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by createTrackingRegion().

◆ deltaPhiRegion_

double TrackingRegionsFromSuperClustersProducer::deltaPhiRegion_
private

Definition at line 127 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by createTrackingRegion().

◆ magFieldToken_

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> TrackingRegionsFromSuperClustersProducer::magFieldToken_
private

Definition at line 141 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by regions().

◆ measTrackerEventToken_

edm::EDGetTokenT<MeasurementTrackerEvent> TrackingRegionsFromSuperClustersProducer::measTrackerEventToken_
private

Definition at line 138 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by regions().

◆ minBSDeltaZ_

double TrackingRegionsFromSuperClustersProducer::minBSDeltaZ_
private

Definition at line 132 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by getVtxPos().

◆ msmakerToken_

edm::ESGetToken<MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord> TrackingRegionsFromSuperClustersProducer::msmakerToken_
private

Definition at line 142 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by regions().

◆ nrSigmaForBSDeltaZ_

double TrackingRegionsFromSuperClustersProducer::nrSigmaForBSDeltaZ_
private

Definition at line 130 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by getVtxPos().

◆ originHalfLength_

double TrackingRegionsFromSuperClustersProducer::originHalfLength_
private

Definition at line 125 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by getVtxPos().

◆ originRadius_

double TrackingRegionsFromSuperClustersProducer::originRadius_
private

Definition at line 124 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by createTrackingRegion().

◆ precise_

bool TrackingRegionsFromSuperClustersProducer::precise_
private

Definition at line 133 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by createTrackingRegion(), and regions().

◆ ptMin_

double TrackingRegionsFromSuperClustersProducer::ptMin_
private

Definition at line 123 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by createTrackingRegion().

◆ superClustersTokens_

std::vector<edm::EDGetTokenT<std::vector<reco::SuperClusterRef> > > TrackingRegionsFromSuperClustersProducer::superClustersTokens_
private

Definition at line 139 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by regions().

◆ useZInBeamspot_

bool TrackingRegionsFromSuperClustersProducer::useZInBeamspot_
private

◆ useZInVertex_

bool TrackingRegionsFromSuperClustersProducer::useZInVertex_
private

◆ verticesToken_

edm::EDGetTokenT<reco::VertexCollection> TrackingRegionsFromSuperClustersProducer::verticesToken_
private

Definition at line 136 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by getVtxPos().

◆ whereToUseMeasTracker_

RectangularEtaPhiTrackingRegion::UseMeasurementTracker TrackingRegionsFromSuperClustersProducer::whereToUseMeasTracker_
private

Definition at line 134 of file TrackingRegionsFromSuperClustersProducer.cc.

Referenced by createTrackingRegion().