31 template <
class T>
T sqr(
T t) {
return t*
t;}
34 struct HitLessByRadius {
bool operator() (
const Hit& h1,
const Hit & h2) {
return h1->globalPosition().perp2() < h2->globalPosition().perp2(); } };
40 desc.
add<
double>(
"originHalfLength", 1E9);
41 desc.
add<
double>(
"originRadius", 1E9);
42 desc.
add<
bool>(
"useProtoTrackKinematics",
false);
43 desc.
add<
bool>(
"useEventsWithNoVertex",
true);
44 desc.
add<
std::string>(
"TTRHBuilder",
"TTRHBuilderWithoutAngle4PixelTriplets");
45 desc.
add<
bool>(
"usePV",
false);
46 descriptions.
add(
"SeedGeneratorFromProtoTracksEDProducer", desc);
53 produces<TrajectorySeedCollection>();
80 for (TrackCollection::const_iterator it=protos.begin(); it!= protos.end(); ++it) {
81 const Track & proto = (*it);
85 bool keepTrack =
false;
86 if ( (!foundVertices) || vertices->empty() ) {
91 GlobalPoint aPV(vertices->begin()->position().x(),vertices->begin()->position().y(),vertices->begin()->position().z());
92 double distR2 =
sqr(vtx.x()-aPV.x()) +
sqr(vtx.y()-aPV.y());
93 double distZ = fabs(vtx.z()-aPV.z());
99 for (reco::VertexCollection::const_iterator iv=vertices->begin(); iv!= vertices->end(); ++iv) {
100 GlobalPoint aPV(iv->position().x(),iv->position().y(),iv->position().z());
101 double distR2 =
sqr(vtx.x()-aPV.x()) +
sqr(vtx.y()-aPV.y());
102 double distZ = fabs(vtx.z()-aPV.z());
109 if (!keepTrack)
continue;
117 std::vector<Hit> hits;
118 for (
unsigned int iHit = 0, nHits = proto.
recHitsSize(); iHit < nHits; ++iHit) {
120 if(refHit->isValid()) hits.push_back((
Hit)&(*refHit));
123 assert(hits.size()<4);
124 if (hits.size() > 1) {
128 seedCreator.
init(region, es, 0);
T getParameter(std::string const &) const
SeedGeneratorFromProtoTracksEDProducer(const edm::ParameterSet &cfg)
const Vector & momentum() const
track momentum vector
edm::EDGetTokenT< reco::VertexCollection > theInputVertexCollectionTag
bool getByToken(EDGetToken token, Handle< PROD > &result) const
virtual void init(const TrackingRegion ®ion, const edm::EventSetup &es, const SeedComparitor *filter)
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::EDGetTokenT< reco::TrackCollection > theInputCollectionTag
TrajectorySeed trajectorySeed() const
bool useEventsWithNoVertex
BaseTrackerRecHit const * ConstRecHitPointer
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
static ConstRecHitPointer nullPtr()
virtual void makeSeed(TrajectorySeedCollection &seedCollection, const SeedingHitSet &hits)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
SeedingHitSet::ConstRecHitPointer Hit
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
void add(std::string const &label, ParameterSetDescription const &psetDescription)
T const * product() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Square< F >::type sqr(const F &f)
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.