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>();
61 for (TrackCollection::const_iterator it=protos.begin(); it!= protos.end(); ++it) {
62 const Track & proto = (*it);
66 bool keepTrack =
false;
67 if ( !foundVertices ) {
70 for (reco::VertexCollection::const_iterator iv=vertices->begin(); iv!= vertices->end(); ++iv) {
71 GlobalPoint aPV(iv->position().x(),iv->position().y(),iv->position().z());
72 double distR2 =
sqr(vtx.x()-aPV.x()) +
sqr(vtx.y()-aPV.y());
73 double distZ = fabs(vtx.z()-aPV.z());
80 if (!keepTrack)
continue;
88 std::vector<Hit> hits;
89 for (
unsigned int iHit = 0, nHits = proto.
recHitsSize(); iHit < nHits; ++iHit) {
91 if(refHit->isValid()) hits.push_back(ttrhbESH->build( &(*refHit) ));
94 assert(hits.size()<4);
95 if (hits.size() > 1) {
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)...
virtual void produce(edm::Event &ev, const edm::EventSetup &es)
std::vector< Track > TrackCollection
collection of Tracks
tuple SeedFromConsecutiveHitsCreator
edm::InputTag theInputCollectionTag
TrajectorySeed trajectorySeed() const
bool useEventsWithNoVertex
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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
T const * product() const
Square< F >::type sqr(const F &f)
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.
TransientTrackingRecHit::ConstRecHitPointer Hit