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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const std::string builderName
 
const bool includeFourthHit_
 
const double originHalfLength
 
const double originRadius
 
const edm::ParameterSet theConfig
 
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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 15 of file SeedGeneratorFromProtoTracksEDProducer.h.

Constructor & Destructor Documentation

◆ SeedGeneratorFromProtoTracksEDProducer()

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

Definition at line 66 of file SeedGeneratorFromProtoTracksEDProducer.cc.

67  : theConfig(cfg),
68  originHalfLength(cfg.getParameter<double>("originHalfLength")),
69  originRadius(cfg.getParameter<double>("originRadius")),
70  useProtoTrackKinematics(cfg.getParameter<bool>("useProtoTrackKinematics")),
71  useEventsWithNoVertex(cfg.getParameter<bool>("useEventsWithNoVertex")),
72  builderName(cfg.getParameter<std::string>("TTRHBuilder")),
73  usePV_(cfg.getParameter<bool>("usePV")),
74  includeFourthHit_(cfg.getParameter<bool>("includeFourthHit")),
75  theInputCollectionTag(consumes<reco::TrackCollection>(cfg.getParameter<InputTag>("InputCollection"))),
77  consumes<reco::VertexCollection>(cfg.getParameter<InputTag>("InputVertexCollection"))) {
78  produces<TrajectorySeedCollection>();
79 }

◆ ~SeedGeneratorFromProtoTracksEDProducer()

SeedGeneratorFromProtoTracksEDProducer::~SeedGeneratorFromProtoTracksEDProducer ( )
inlineoverride

Definition at line 18 of file SeedGeneratorFromProtoTracksEDProducer.h.

18 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 40 of file SeedGeneratorFromProtoTracksEDProducer.cc.

40  {
42  desc.add<InputTag>("InputCollection", InputTag("pixelTracks"));
43  desc.add<InputTag>("InputVertexCollection", InputTag(""));
44  desc.add<double>("originHalfLength", 1E9);
45  desc.add<double>("originRadius", 1E9);
46  desc.add<bool>("useProtoTrackKinematics", false);
47  desc.add<bool>("useEventsWithNoVertex", true);
48  desc.add<std::string>("TTRHBuilder", "TTRHBuilderWithoutAngle4PixelTriplets");
49  desc.add<bool>("usePV", false);
50  desc.add<bool>("includeFourthHit", false);
51 
53  psd0.add<std::string>("ComponentName", std::string("SeedFromConsecutiveHitsCreator"));
54  psd0.add<std::string>("propagator", std::string("PropagatorWithMaterial"));
55  psd0.add<double>("SeedMomentumForBOFF", 5.0);
56  psd0.add<double>("OriginTransverseErrorMultiplier", 1.0);
57  psd0.add<double>("MinOneOverPtError", 1.0);
58  psd0.add<std::string>("magneticField", std::string(""));
59  psd0.add<std::string>("TTRHBuilder", std::string("WithTrackAngle"));
60  psd0.add<bool>("forceKinematicWithRegionDirection", false);
61  desc.add<edm::ParameterSetDescription>("SeedCreatorPSet", psd0);
62 
63  descriptions.add("SeedGeneratorFromProtoTracksEDProducer", desc);
64 }

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

◆ 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 81 of file SeedGeneratorFromProtoTracksEDProducer.cc.

81  {
82  auto result = std::make_unique<TrajectorySeedCollection>();
84  ev.getByToken(theInputCollectionTag, trks);
85 
86  const TrackCollection& protos = *(trks.product());
87 
89  bool foundVertices = ev.getByToken(theInputVertexCollectionTag, vertices);
90  //const reco::VertexCollection & vertices = *(h_vertices.product());
91 
95  for (TrackCollection::const_iterator it = protos.begin(); it != protos.end(); ++it) {
96  const Track& proto = (*it);
97  GlobalPoint vtx(proto.vertex().x(), proto.vertex().y(), proto.vertex().z());
98 
99  // check the compatibility with a primary vertex
100  bool keepTrack = false;
101  if ((!foundVertices) || vertices->empty()) {
103  keepTrack = true;
104  } else if (usePV_) {
105  GlobalPoint aPV(
106  vertices->begin()->position().x(), vertices->begin()->position().y(), vertices->begin()->position().z());
107  double distR2 = sqr(vtx.x() - aPV.x()) + sqr(vtx.y() - aPV.y());
108  double distZ = fabs(vtx.z() - aPV.z());
109  if (distR2 < sqr(originRadius) && distZ < originHalfLength) {
110  keepTrack = true;
111  }
112  } else {
113  for (reco::VertexCollection::const_iterator iv = vertices->begin(); iv != vertices->end(); ++iv) {
114  GlobalPoint aPV(iv->position().x(), iv->position().y(), iv->position().z());
115  double distR2 = sqr(vtx.x() - aPV.x()) + sqr(vtx.y() - aPV.y());
116  double distZ = fabs(vtx.z() - aPV.z());
117  if (distR2 < sqr(originRadius) && distZ < originHalfLength) {
118  keepTrack = true;
119  break;
120  }
121  }
122  }
123  if (!keepTrack)
124  continue;
125 
127  SeedFromProtoTrack seedFromProtoTrack(proto, es);
128  if (seedFromProtoTrack.isValid())
129  (*result).push_back(seedFromProtoTrack.trajectorySeed());
130  } else {
132  es.get<TransientRecHitRecord>().get(builderName, ttrhbESH);
133  std::vector<Hit> hits;
134  for (unsigned int iHit = 0, nHits = proto.recHitsSize(); iHit < nHits; ++iHit) {
135  TrackingRecHitRef refHit = proto.recHit(iHit);
136  if (refHit->isValid())
137  hits.push_back((Hit) & (*refHit));
138  }
139  sort(hits.begin(), hits.end(), HitLessByRadius());
140 
141  if (hits.size() > 1) {
142  double mom_perp =
143  sqrt(proto.momentum().x() * proto.momentum().x() + proto.momentum().y() * proto.momentum().y());
144  GlobalTrackingRegion region(mom_perp, vtx, 0.2, 0.2);
145 
146  edm::ParameterSet seedCreatorPSet = theConfig.getParameter<edm::ParameterSet>("SeedCreatorPSet");
147  SeedFromConsecutiveHitsCreator seedCreator(seedCreatorPSet);
148  seedCreator.init(region, es, nullptr);
149  seedCreator.makeSeed(
150  *result,
151  SeedingHitSet(hits[0],
152  hits[1],
153  hits.size() > 2 ? hits[2] : SeedingHitSet::nullPtr(),
154  (includeFourthHit_ && hits.size() > 3) ? hits[3] : SeedingHitSet::nullPtr()));
155  }
156  }
157  }
158 
159  ev.put(std::move(result));
160 }

References builderName, ev, edm::EventSetup::get(), get, edm::ParameterSet::getParameter(), hfClusterShapes_cfi::hits, includeFourthHit_, SeedFromProtoTrack::isValid(), gpuVertexFinder::iv, reco::TrackBase::momentum(), eostools::move(), nHits, SeedingHitSet::nullPtr(), originHalfLength, originRadius, reco::Track::recHit(), reco::Track::recHitsSize(), rpcPointValidation_cfi::refHit, HLT_FULL_cff::region, mps_fire::result, SeedFromConsecutiveHitsCreator_cfi::SeedFromConsecutiveHitsCreator, jetUpdater_cfi::sort, sqr(), mathSSE::sqrt(), theConfig, theInputCollectionTag, theInputVertexCollectionTag, SeedFromProtoTrack::trajectorySeed(), hltEgammaHLTExtra_cfi::trks, useEventsWithNoVertex, useProtoTrackKinematics, usePV_, reco::TrackBase::vertex(), pwdgSkimBPark_cfi::vertices, and extraflags_cff::vtx.

Member Data Documentation

◆ builderName

const std::string SeedGeneratorFromProtoTracksEDProducer::builderName
private

Definition at line 28 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ includeFourthHit_

const bool SeedGeneratorFromProtoTracksEDProducer::includeFourthHit_
private

Definition at line 30 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ originHalfLength

const double SeedGeneratorFromProtoTracksEDProducer::originHalfLength
private

Definition at line 24 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ originRadius

const double SeedGeneratorFromProtoTracksEDProducer::originRadius
private

Definition at line 25 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ theConfig

const edm::ParameterSet SeedGeneratorFromProtoTracksEDProducer::theConfig
private

Definition at line 23 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ theInputCollectionTag

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

Definition at line 31 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ theInputVertexCollectionTag

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

Definition at line 32 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ useEventsWithNoVertex

const bool SeedGeneratorFromProtoTracksEDProducer::useEventsWithNoVertex
private

Definition at line 27 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ useProtoTrackKinematics

const bool SeedGeneratorFromProtoTracksEDProducer::useProtoTrackKinematics
private

Definition at line 26 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

◆ usePV_

const bool SeedGeneratorFromProtoTracksEDProducer::usePV_
private

Definition at line 29 of file SeedGeneratorFromProtoTracksEDProducer.h.

Referenced by produce().

Hit
Definition: HitCollection.h:12
SeedFromProtoTrack
Definition: SeedFromProtoTrack.h:16
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
SeedingHitSet
Definition: SeedingHitSet.h:6
SeedGeneratorFromProtoTracksEDProducer::useProtoTrackKinematics
const bool useProtoTrackKinematics
Definition: SeedGeneratorFromProtoTracksEDProducer.h:26
gpuVertexFinder::iv
int32_t *__restrict__ iv
Definition: gpuClusterTracksDBSCAN.h:42
SeedFromConsecutiveHitsCreator_cfi.SeedFromConsecutiveHitsCreator
SeedFromConsecutiveHitsCreator
Definition: SeedFromConsecutiveHitsCreator_cfi.py:3
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
TransientRecHitRecord
Definition: TransientRecHitRecord.h:14
SeedGeneratorFromProtoTracksEDProducer::usePV_
const bool usePV_
Definition: SeedGeneratorFromProtoTracksEDProducer.h:29
rpcPointValidation_cfi.refHit
refHit
Definition: rpcPointValidation_cfi.py:6
edm::Handle< reco::TrackCollection >
GlobalTrackingRegion
Definition: GlobalTrackingRegion.h:13
edm::Ref
Definition: AssociativeIterator.h:58
SeedGeneratorFromProtoTracksEDProducer::theInputCollectionTag
const edm::EDGetTokenT< reco::TrackCollection > theInputCollectionTag
Definition: SeedGeneratorFromProtoTracksEDProducer.h:31
reco::Track::recHitsSize
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits).
Definition: Track.h:97
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
HitLessByRadius
Definition: SeedGeneratorFromProtoTracksEDProducer.cc:36
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
nHits
const caConstants::TupleMultiplicity *__restrict__ const HitsOnGPU *__restrict__ double *__restrict__ float *__restrict__ double *__restrict__ uint32_t nHits
Definition: BrokenLineFitOnGPU.h:27
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::Track
Definition: Track.h:27
edm::ESHandle< TransientTrackingRecHitBuilder >
Point3DBase< float, GlobalTag >
sqr
T sqr(T t)
Definition: SeedGeneratorFromProtoTracksEDProducer.cc:31
SeedGeneratorFromProtoTracksEDProducer::includeFourthHit_
const bool includeFourthHit_
Definition: SeedGeneratorFromProtoTracksEDProducer.h:30
SeedGeneratorFromProtoTracksEDProducer::builderName
const std::string builderName
Definition: SeedGeneratorFromProtoTracksEDProducer.h:28
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
SeedingHitSet::nullPtr
static ConstRecHitPointer nullPtr()
Definition: SeedingHitSet.h:12
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88271
SeedGeneratorFromProtoTracksEDProducer::originRadius
const double originRadius
Definition: SeedGeneratorFromProtoTracksEDProducer.h:25
SeedGeneratorFromProtoTracksEDProducer::originHalfLength
const double originHalfLength
Definition: SeedGeneratorFromProtoTracksEDProducer.h:24
get
#define get
SeedGeneratorFromProtoTracksEDProducer::theInputVertexCollectionTag
const edm::EDGetTokenT< reco::VertexCollection > theInputVertexCollectionTag
Definition: SeedGeneratorFromProtoTracksEDProducer.h:32
reco::Track::recHit
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.
Definition: Track.h:94
reco::TrackBase::vertex
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead
Definition: TrackBase.h:676
SeedGeneratorFromProtoTracksEDProducer::useEventsWithNoVertex
const bool useEventsWithNoVertex
Definition: SeedGeneratorFromProtoTracksEDProducer.h:27
looper.cfg
cfg
Definition: looper.py:297
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
extraflags_cff.vtx
vtx
Definition: extraflags_cff.py:18
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
hltEgammaHLTExtra_cfi.trks
trks
Definition: hltEgammaHLTExtra_cfi.py:43
mps_fire.result
result
Definition: mps_fire.py:311
reco::TrackBase::momentum
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
pwdgSkimBPark_cfi.vertices
vertices
Definition: pwdgSkimBPark_cfi.py:7
SeedGeneratorFromProtoTracksEDProducer::theConfig
const edm::ParameterSet theConfig
Definition: SeedGeneratorFromProtoTracksEDProducer.h:23