16 const std::vector<int>& charges,
18 double errorRescaling):theMagfield(mf), theTracker(geom), theBuilder(builder), thePropagatorAlong(propagatorAlong), thePropagatorOpposite(propagatorOpposite), theSetMomentum(momFromPSet), theCharges(charges), theErrorRescaling(errorRescaling){}
25 std::vector<TrajectorySeed*> seeds;
26 if (hits.
size() == 3) {
29 if (seed) seeds.push_back(seed);
33 if(seed) seeds.push_back(seed);
37 }
else if (hits.
size() == 2){
40 if (seed) seeds.push_back(seed);
44 if (seed) seeds.push_back(seed);
48 throw cms::Exception(
"CombinatorialSeedGeneratorForCosmics") <<
" Wrong number of hits in Set: "
49 << hits.
size() <<
", should be 2 or 3 ";
58 if (hits.
size() != 3) {
60 "call to SeedFromGenericPairOrTriplet::seedFromTriplet with " << hits.
size() <<
" hits ";
63 auto innerHit = hits[0];
64 auto middleHit = hits[1];
65 auto outerHit = hits[2];
70 LogDebug(
"SeedFromGenericPairOrTriplet") <<
71 "Using the following hits: outer(r, phi, theta) " << outerHit->geographicalId().subdetId()<<
" (" << outer.
perp()
72 <<
", " << outer.
phi()
73 <<
"," << outer.
theta()
74 <<
") " << middleHit->geographicalId().subdetId() <<
" middle ("
75 << middle.
perp() <<
", "
76 << middle.
phi() <<
","
77 << middle.
theta() <<
") "
78 <<innerHit->geographicalId().subdetId() <<
" inner ("
80 <<
", " << inner.
phi()
81 <<
"," << inner.
theta() <<
") "
82 <<
" (x, y, z) outer ("
85 << inner.
z() <<
") middle ("
91 SeedingHitSet newSet(sdir ? hits[1] : hits[0], sdir ? hits[2] : hits[1]);
103 std::vector<const BaseTrackerRecHit*> trHits;
105 LogDebug(
"SeedFromGenericPairOrTriplet")
106 <<
"Seed from outsideIn alongMomentum OR insideOut oppositeToMomentum";
108 secondPoint = &middle;
110 trHits.push_back(outerHit);
111 trHits.push_back(middleHit);
115 LogDebug(
"SeedFromGenericPairOrTriplet")
116 <<
"Seed from outsideIn oppositeToMomentum OR insideOut alongMomentum";
118 secondPoint = &middle;
120 trHits.push_back(innerHit);
121 trHits.push_back(middleHit);
128 LogDebug(
"SeedFromGenericPairOrTriplet") <<
"originalStartingState " << originalStartingState;
142 if (!
qualityFilter(momentumSign*originalStartingState.momentum()))
return 0;
151 if (hits.
size() != 2) {
153 "call to SeedFromGenericPairOrTriplet::seedFromPair with " << hits.
size() <<
" hits ";
155 auto innerHit = hits[0];
156 auto outerHit = hits[1];
159 LogDebug(
"SeedFromGenericPairOrTriplet") <<
160 "Using the following hits: outer(r, phi, theta) (" << outer.
perp()
161 <<
", " << outer.
phi()
162 <<
"," << outer.
theta()
165 <<
", " << inner.
phi()
166 <<
"," << inner.
theta() <<
")";
169 int momentumSign = 1;
172 std::vector<const BaseTrackerRecHit*> trHits;
175 LogDebug(
"SeedFromGenericPairOrTriplet")
176 <<
"Seed from outsideIn alongMomentum OR insideOut oppositeToMomentum";
178 secondPoint = &
inner;
181 trHits.push_back(outerHit);
182 trHits.push_back(innerHit);
184 LogDebug(
"SeedFromGenericPairOrTriplet")
185 <<
"Seed from outsideIn oppositeToMomentum OR insideOut alongMomentum";
187 secondPoint = &
outer;
191 trHits.push_back(innerHit);
192 trHits.push_back(outerHit);
212 std::vector<const BaseTrackerRecHit*>& trHits,
220 LogDebug(
"SeedFromGenericPairOrTriplet") <<
221 "Using the following hits: first(r, phi, theta) (" << first.
perp()
222 <<
", " << first.
phi()
223 <<
"," << first.
theta()
226 <<
", " << second.
phi()
227 <<
"," << second.
theta() <<
")";
230 auto transHit = trHits[0];
231 LocalVector lmom = transHit->surface()->toLocal(momentum);
233 lmom.
x()/lmom.
z(),lmom.
y()/lmom.
z(),
234 transHit->localPosition().x(),
235 transHit->localPosition().y(),
239 (1.+(lmom.
x()/lmom.
z())*(lmom.
x()/lmom.
z())),
240 (1.+(lmom.
y()/lmom.
z())*(lmom.
y()/lmom.
z())),
247 auto transHit2 = trHits[1];
252 LogDebug(
"SeedFromGenericPairOrTriplet") <<
"first propagation failed";
257 LogDebug(
"SeedFromGenericPairOrTriplet") <<
"first update failed";
260 LogDebug(
"SeedFromGenericPairOrTriplet") <<
"starting TSOS " << seedTSOS ;
266 for (
auto ihits = trHits.begin(); ihits != trHits.end(); ihits++){
302 std::vector<GlobalPoint> gPoints;
303 unsigned int nHits = hits.
size();
304 for (
unsigned int iHit = 0; iHit < nHits; ++iHit) gPoints.push_back(hits[iHit]->globalPosition());
305 unsigned int subid=(*hits[0]).geographicalId().subdetId();
307 LogDebug(
"SeedFromGenericPairOrTriplet")
308 <<
"In the endcaps we cannot decide if hits are aligned with only phi and z";
314 if (circle.
rho() < 500 && circle.
rho() != 0) {
315 LogDebug(
"SeedFromGenericPairOrTriplet") <<
316 "Seed qualityFilter rejected because rho = " << circle.
rho();
327 if (momentum.
perp() <
theP)
return false;
void rescaleError(double factor)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
const Propagator * thePropagatorAlong
int nominalValue() const
The nominal field value for this map in kGauss.
TrajectorySeed * seedFromPair(const SeedingHitSet &hits, const PropagationDirection &dir, const NavigationDirection &seedDir, int charge=-1) const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Geom::Phi< T > phi() const
const Plane & surface() const
The nominal surface of the GeomDet.
Geom::Theta< T > theta() const
U second(std::pair< T, U > const &p)
std::vector< int > theCharges
void update(const LocalTrajectoryParameters &p, const SurfaceType &aSurface, const MagneticField *field, SurfaceSide side=SurfaceSideDefinition::atCenterOfSurface)
TrajectorySeed * seedFromTriplet(const SeedingHitSet &hits, const PropagationDirection &dir, const NavigationDirection &seedDir, const edm::EventSetup &iSetup, int charge=-1) const
std::vector< TrajectorySeed * > seed(const SeedingHitSet &hits, const PropagationDirection &dir, const NavigationDirection &seedDir, const edm::EventSetup &iSetup)
SeedFromGenericPairOrTriplet(const MagneticField *mf, const TrackerGeometry *geom, const TransientTrackingRecHitBuilder *builder, const Propagator *propagatorAlong, const Propagator *propagatorOpposite, const std::vector< int > &charges, bool momFromPSet, double errorRescaling)
bool qualityFilter(const SeedingHitSet &hits) const
TrajectorySeed * buildSeed(const GlobalVector &momentum, int charge, std::vector< const BaseTrackerRecHit * > &trHits, const PropagationDirection &dir) const
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
const MagneticField * theMagfield
unsigned int size() const
const Propagator * thePropagatorOpposite
const TrackerGeometry * theTracker
virtual const TrackerGeomDet * idToDet(DetId) const