30 template <
class T>
T sqr(
T t) {
return t*
t;}
33 struct HitLessByRadius {
bool operator() (
const Hit& h1,
const Hit & h2) {
return h1->globalPosition().perp2() < h2->globalPosition().perp2(); } };
37 theInputCollectionTag(cfg.getParameter<
InputTag>(
"InputCollection")),
38 theInputVertexCollectionTag(cfg.getParameter<
InputTag>(
"InputVertexCollection")),
41 useProtoTrackKinematics(cfg.getParameter<bool>(
"useProtoTrackKinematics")),
42 useEventsWithNoVertex(cfg.getParameter<bool>(
"useEventsWithNoVertex")),
43 builderName(cfg.getParameter<std::
string>(
"TTRHBuilder"))
46 produces<TrajectorySeedCollection>();
64 for (TrackCollection::const_iterator it=protos.begin(); it!= protos.end(); ++it) {
65 const Track & proto = (*it);
69 bool keepTrack =
false;
70 if ( !foundVertices ) {
73 for (reco::VertexCollection::const_iterator iv=vertices->begin(); iv!= vertices->end(); ++iv) {
74 GlobalPoint aPV(iv->position().x(),iv->position().y(),iv->position().z());
75 double distR2 =
sqr(vtx.x()-aPV.x()) +
sqr(vtx.y()-aPV.y());
76 double distZ = fabs(vtx.z()-aPV.z());
83 if (!keepTrack)
continue;
91 std::vector<Hit> hits;
92 for (
unsigned int iHit = 0, nHits = proto.
recHitsSize(); iHit < nHits; ++iHit) {
94 if(refHit->isValid()) hits.push_back(ttrhbESH->build( &(*refHit) ));
97 assert(hits.size()<4);
98 if (hits.size() > 1) {
102 seedCreator.
init(region, es, 0);
edm::InputTag theInputVertexCollectionTag
SeedGeneratorFromProtoTracksEDProducer(const edm::ParameterSet &cfg)
const Vector & momentum() const
track momentum vector
size_t recHitsSize() const
Get number of RecHits. (Warning, this includes invalid hits, which are not physical hits)...
std::vector< Track > TrackCollection
collection of Tracks
edm::InputTag theInputCollectionTag
TrajectorySeed trajectorySeed() const
bool useEventsWithNoVertex
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual void init(const TrackingRegion ®ion, const edm::EventSetup &es, const SeedComparitor *filter) GCC11_FINAL
static ConstRecHitPointer nullPtr()
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
bool useProtoTrackKinematics
virtual void produce(edm::Event &ev, const edm::EventSetup &es) override
T const * product() const
Square< F >::type sqr(const F &f)
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.
virtual void makeSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits) GCC11_FINAL
TransientTrackingRecHit::ConstRecHitPointer Hit