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);
50 psd0.add<
double>(
"SeedMomentumForBOFF",5.0);
51 psd0.add<
double>(
"OriginTransverseErrorMultiplier",1.0);
52 psd0.add<
double>(
"MinOneOverPtError",1.0);
55 psd0.add<
bool>(
"forceKinematicWithRegionDirection",
false);
58 descriptions.
add(
"SeedGeneratorFromProtoTracksEDProducer", desc);
65 ,
originRadius ( cfg.getParameter<double>(
"originRadius") )
68 , builderName ( cfg.getParameter<std::
string>(
"TTRHBuilder") )
69 , usePV_ ( cfg.getParameter<bool>(
"usePV" ) )
73 produces<TrajectorySeedCollection>();
95 for (TrackCollection::const_iterator it=protos.begin(); it!= protos.end(); ++it) {
96 const Track & proto = (*it);
100 bool keepTrack =
false;
101 if ( (!foundVertices) || vertices->empty() ) {
106 GlobalPoint aPV(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());
114 for (reco::VertexCollection::const_iterator iv=vertices->begin(); iv!= vertices->end(); ++iv) {
115 GlobalPoint aPV(iv->position().x(),iv->position().y(),iv->position().z());
116 double distR2 =
sqr(vtx.x()-aPV.x()) +
sqr(vtx.y()-aPV.y());
117 double distZ = fabs(vtx.z()-aPV.z());
124 if (!keepTrack)
continue;
132 std::vector<Hit> hits;
133 for (
unsigned int iHit = 0, nHits = proto.
recHitsSize(); iHit < nHits; ++iHit) {
135 if(refHit->isValid()) hits.push_back((
Hit)&(*refHit));
139 if (hits.size() > 1) {
145 seedCreator.init(region, es, 0);
T getParameter(std::string const &) const
tuple useEventsWithNoVertex
SeedGeneratorFromProtoTracksEDProducer(const edm::ParameterSet &cfg)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
tuple useProtoTrackKinematics
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
std::vector< Vertex > VertexCollection
collection of Vertex objects
tuple SeedFromConsecutiveHitsCreator
const std::string builderName
const Vector & momentum() const
track momentum vector
const bool useProtoTrackKinematics
const edm::EDGetTokenT< reco::TrackCollection > theInputCollectionTag
TrajectorySeed trajectorySeed() const
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
BaseTrackerRecHit const * ConstRecHitPointer
std::vector< TrajectorySeed > TrajectorySeedCollection
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
static ConstRecHitPointer nullPtr()
const double originRadius
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< reco::VertexCollection > theInputVertexCollectionTag
SeedingHitSet::ConstRecHitPointer Hit
T const * product() const
const double originHalfLength
virtual void produce(edm::Event &ev, const edm::EventSetup &es) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const bool useEventsWithNoVertex
Square< F >::type sqr(const F &f)
TrackingRecHitRef recHit(size_t i) const
Get i-th hit on the track.
const edm::ParameterSet theConfig