CMS 3D CMS Logo

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

#include <SeedGeneratorFromProtoTracksEDProducer.h>

Inheritance diagram for SeedGeneratorFromProtoTracksEDProducer:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &ev, const edm::EventSetup &es) override
 
 SeedGeneratorFromProtoTracksEDProducer (const edm::ParameterSet &cfg)
 
 ~SeedGeneratorFromProtoTracksEDProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const SeedFromProtoTrack::Config config_
 
const bool includeFourthHit_
 
const double originHalfLength
 
const double originRadius
 
SeedFromConsecutiveHitsCreator seedCreator_
 
const edm::EDGetTokenT< reco::TrackCollectiontheInputCollectionTag
 
const edm::EDGetTokenT< reco::VertexCollectiontheInputVertexCollectionTag
 
const bool useEventsWithNoVertex
 
const bool useProtoTrackKinematics
 
const bool usePV_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 11 of file SeedGeneratorFromProtoTracksEDProducer.h.

Constructor & Destructor Documentation

◆ SeedGeneratorFromProtoTracksEDProducer()

SeedGeneratorFromProtoTracksEDProducer::SeedGeneratorFromProtoTracksEDProducer ( const edm::ParameterSet cfg)

Definition at line 63 of file SeedGeneratorFromProtoTracksEDProducer.cc.

64  : originHalfLength(cfg.getParameter<double>("originHalfLength")),
65  originRadius(cfg.getParameter<double>("originRadius")),
66  useProtoTrackKinematics(cfg.getParameter<bool>("useProtoTrackKinematics")),
67  useEventsWithNoVertex(cfg.getParameter<bool>("useEventsWithNoVertex")),
68  usePV_(cfg.getParameter<bool>("usePV")),
69  includeFourthHit_(cfg.getParameter<bool>("includeFourthHit")),
70  theInputCollectionTag(consumes<reco::TrackCollection>(cfg.getParameter<InputTag>("InputCollection"))),
72  consumes<reco::VertexCollection>(cfg.getParameter<InputTag>("InputVertexCollection"))),
73  seedCreator_(cfg.getParameter<edm::ParameterSet>("SeedCreatorPSet"), consumesCollector()),
74  config_(consumesCollector()) {
75  produces<TrajectorySeedCollection>();
76 }
const edm::EDGetTokenT< reco::TrackCollection > theInputCollectionTag
const edm::EDGetTokenT< reco::VertexCollection > theInputVertexCollectionTag

◆ ~SeedGeneratorFromProtoTracksEDProducer()

SeedGeneratorFromProtoTracksEDProducer::~SeedGeneratorFromProtoTracksEDProducer ( )
inlineoverride

Definition at line 14 of file SeedGeneratorFromProtoTracksEDProducer.h.

14 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 37 of file SeedGeneratorFromProtoTracksEDProducer.cc.

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

37  {
39  desc.add<InputTag>("InputCollection", InputTag("pixelTracks"));
40  desc.add<InputTag>("InputVertexCollection", InputTag(""));
41  desc.add<double>("originHalfLength", 1E9);
42  desc.add<double>("originRadius", 1E9);
43  desc.add<bool>("useProtoTrackKinematics", false);
44  desc.add<bool>("useEventsWithNoVertex", true);
45  desc.add<std::string>("TTRHBuilder", "TTRHBuilderWithoutAngle4PixelTriplets");
46  desc.add<bool>("usePV", false);
47  desc.add<bool>("includeFourthHit", false);
48 
50  psd0.add<std::string>("ComponentName", std::string("SeedFromConsecutiveHitsCreator"));
51  psd0.add<std::string>("propagator", std::string("PropagatorWithMaterial"));
52  psd0.add<double>("SeedMomentumForBOFF", 5.0);
53  psd0.add<double>("OriginTransverseErrorMultiplier", 1.0);
54  psd0.add<double>("MinOneOverPtError", 1.0);
55  psd0.add<std::string>("magneticField", std::string(""));
56  psd0.add<std::string>("TTRHBuilder", std::string("WithTrackAngle"));
57  psd0.add<bool>("forceKinematicWithRegionDirection", false);
58  desc.add<edm::ParameterSetDescription>("SeedCreatorPSet", psd0);
59 
60  descriptions.add("SeedGeneratorFromProtoTracksEDProducer", desc);
61 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void SeedGeneratorFromProtoTracksEDProducer::produce ( edm::Event ev,
const edm::EventSetup es 
)
override

need optimization: all es stuff should go out of the loop

Definition at line 78 of file SeedGeneratorFromProtoTracksEDProducer.cc.

References config_, makeMEIFBenchmarkPlots::ev, hfClusterShapes_cfi::hits, includeFourthHit_, SeedFromProtoTrack::isValid(), gpuVertexFinder::iv, reco::TrackBase::momentum(), eostools::move(), nHits, originHalfLength, originRadius, reco::Track::recHit(), reco::Track::recHitsSize(), rpcPointValidation_cfi::refHit, HLT_2022v12_cff::region, mps_fire::result, seedCreator_, jetUpdater_cfi::sort, sqr(), mathSSE::sqrt(), theInputCollectionTag, theInputVertexCollectionTag, SeedFromProtoTrack::trajectorySeed(), hltEgammaHLTExtra_cfi::trks, useEventsWithNoVertex, useProtoTrackKinematics, usePV_, reco::TrackBase::vertex(), AlignmentTracksFromVertexSelector_cfi::vertices, and extraflags_cff::vtx.

78  {
79  auto result = std::make_unique<TrajectorySeedCollection>();
81  ev.getByToken(theInputCollectionTag, trks);
82 
83  const TrackCollection& protos = *(trks.product());
84 
86  bool foundVertices = ev.getByToken(theInputVertexCollectionTag, vertices);
87  //const reco::VertexCollection & vertices = *(h_vertices.product());
88 
92  for (TrackCollection::const_iterator it = protos.begin(); it != protos.end(); ++it) {
93  const Track& proto = (*it);
94  GlobalPoint vtx(proto.vertex().x(), proto.vertex().y(), proto.vertex().z());
95 
96  // check the compatibility with a primary vertex
97  bool keepTrack = false;
98  if ((!foundVertices) || vertices->empty()) {
100  keepTrack = true;
101  } else if (usePV_) {
102  GlobalPoint aPV(
103  vertices->begin()->position().x(), vertices->begin()->position().y(), vertices->begin()->position().z());
104  double distR2 = sqr(vtx.x() - aPV.x()) + sqr(vtx.y() - aPV.y());
105  double distZ = fabs(vtx.z() - aPV.z());
106  if (distR2 < sqr(originRadius) && distZ < originHalfLength) {
107  keepTrack = true;
108  }
109  } else {
110  for (reco::VertexCollection::const_iterator iv = vertices->begin(); iv != vertices->end(); ++iv) {
111  GlobalPoint aPV(iv->position().x(), iv->position().y(), iv->position().z());
112  double distR2 = sqr(vtx.x() - aPV.x()) + sqr(vtx.y() - aPV.y());
113  double distZ = fabs(vtx.z() - aPV.z());
114  if (distR2 < sqr(originRadius) && distZ < originHalfLength) {
115  keepTrack = true;
116  break;
117  }
118  }
119  }
120  if (!keepTrack)
121  continue;
122 
124  SeedFromProtoTrack seedFromProtoTrack(config_, proto, es);
125  if (seedFromProtoTrack.isValid())
126  (*result).push_back(seedFromProtoTrack.trajectorySeed());
127  } else {
128  std::vector<Hit> hits;
129  for (unsigned int iHit = 0, nHits = proto.recHitsSize(); iHit < nHits; ++iHit) {
130  TrackingRecHitRef refHit = proto.recHit(iHit);
131  if (refHit->isValid())
132  hits.push_back((Hit) & (*refHit));
133  }
134  sort(hits.begin(), hits.end(), HitLessByRadius());
135 
136  if (hits.size() > 1) {
137  double mom_perp =
138  sqrt(proto.momentum().x() * proto.momentum().x() + proto.momentum().y() * proto.momentum().y());
139  GlobalTrackingRegion region(mom_perp, vtx, 0.2, 0.2);
140 
141  seedCreator_.init(region, es, nullptr);
142  if (hits.size() > 3 and not includeFourthHit_)
143  seedCreator_.makeSeed(*result, {hits[0], hits[1], hits[2]});
144  else
145  seedCreator_.makeSeed(*result, hits);
146  }
147  }
148  }
149 
150  ev.put(std::move(result));
151 }
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
Definition: Track.h:97
int32_t *__restrict__ iv
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
const edm::EDGetTokenT< reco::TrackCollection > theInputCollectionTag
T sqrt(T t)
Definition: SSEVec.h:19
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
Definition: TrackBase.h:676
const edm::EDGetTokenT< reco::VertexCollection > theInputVertexCollectionTag
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.
Definition: Track.h:94
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ config_

const SeedFromProtoTrack::Config SeedGeneratorFromProtoTracksEDProducer::config_
private

Definition at line 28 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ includeFourthHit_

const bool SeedGeneratorFromProtoTracksEDProducer::includeFourthHit_
private

Definition at line 24 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ originHalfLength

const double SeedGeneratorFromProtoTracksEDProducer::originHalfLength
private

Definition at line 19 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ originRadius

const double SeedGeneratorFromProtoTracksEDProducer::originRadius
private

Definition at line 20 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ seedCreator_

SeedFromConsecutiveHitsCreator SeedGeneratorFromProtoTracksEDProducer::seedCreator_
private

Definition at line 27 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ theInputCollectionTag

const edm::EDGetTokenT<reco::TrackCollection> SeedGeneratorFromProtoTracksEDProducer::theInputCollectionTag
private

Definition at line 25 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ theInputVertexCollectionTag

const edm::EDGetTokenT<reco::VertexCollection> SeedGeneratorFromProtoTracksEDProducer::theInputVertexCollectionTag
private

Definition at line 26 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ useEventsWithNoVertex

const bool SeedGeneratorFromProtoTracksEDProducer::useEventsWithNoVertex
private

Definition at line 22 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ useProtoTrackKinematics

const bool SeedGeneratorFromProtoTracksEDProducer::useProtoTrackKinematics
private

Definition at line 21 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ usePV_

const bool SeedGeneratorFromProtoTracksEDProducer::usePV_
private

Definition at line 23 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().