42 if(cfg.
exists(
"SeedComparitorPSet")) {
46 if(comparitorName !=
"none") {
55 desc.
add<
double>(
"extraHitRZtolerance", 0.1);
56 desc.
add<
double>(
"extraHitRPhitolerance", 0.1);
59 descExtraPhi.
add<
double>(
"pt1", 0.1);
60 descExtraPhi.
add<
double>(
"pt2", 0.1);
61 descExtraPhi.
add<
double>(
"value1", 999);
62 descExtraPhi.
add<
double>(
"value2", 0.15);
63 descExtraPhi.
add<
bool>(
"enabled",
false);
67 descMaxChi2.
add<
double>(
"pt1", 0.2);
68 descMaxChi2.add<
double>(
"pt2", 1.5);
69 descMaxChi2.add<
double>(
"value1", 500);
70 descMaxChi2.add<
double>(
"value2", 50);
71 descMaxChi2.add<
bool>(
"enabled",
true);
74 desc.
add<
bool>(
"fitFastCircle",
false);
75 desc.
add<
bool>(
"fitFastCircleChi2Cut",
false);
76 desc.
add<
bool>(
"useBendingCorrection",
false);
80 descComparitor.setAllowAnything();
88 const std::vector<SeedingLayerSetsHits::SeedingLayer>& fourthLayers)
93 std::vector<SeedingLayerSetsHits::SeedingLayer>{tripletLayers[2]});
94 if(triplets.empty())
return;
102 OrderedHitTriplets::const_iterator tripletsBegin,
103 OrderedHitTriplets::const_iterator tripletsEnd,
104 const std::vector<SeedingLayerSetsHits::SeedingLayer>& fourthLayers,
109 const size_t size = fourthLayers.size();
115 std::vector<NodeInfo > layerTree;
116 std::vector<unsigned int> foundNodes;
124 for(
size_t il=0; il!=
size; ++il) {
125 fourthHitMap[il] = &(layerCache)(fourthLayers[il], region, es);
126 auto const&
hits = *fourthHitMap[il];
129 pred.
initLayer(fourthLayers[il].detLayer());
134 float minv=999999.0, maxv= -999999.0;
136 for (
unsigned int i=0;
i!=
hits.size(); ++
i) {
141 float myerr =
hits.dv[
i];
143 layerTree.emplace_back(
i,
angle,
v);
149 KDTreeBox phiZ(minphi, maxphi, minv-0.01
f, maxv+0.01
f);
151 hitTree[il].build(layerTree, phiZ);
152 rzError[il] = maxErr;
159 std::array<float, 4> bc_r;
160 std::array<float, 4> bc_z;
161 std::array<float, 4> bc_errZ2;
162 std::array<GlobalPoint, 4> gps;
163 std::array<GlobalError, 4> ges;
164 std::array<bool, 4> barrels;
167 for(
auto iTriplet = tripletsBegin; iTriplet != tripletsEnd; ++iTriplet) {
168 const auto& triplet = *iTriplet;
169 GlobalPoint gp0 = triplet.inner()->globalPosition();
170 GlobalPoint gp1 = triplet.middle()->globalPosition();
171 GlobalPoint gp2 = triplet.outer()->globalPosition();
178 const float abscurv =
std::abs(curvature);
179 const float thisMaxChi2 = maxChi2Eval.
value(abscurv);
180 const float thisExtraPhiTolerance = extraPhiToleranceEval.
value(abscurv);
184 auto isBarrel = [](
const unsigned id) ->
bool {
188 gps[0] = triplet.inner()->globalPosition();
189 ges[0] = triplet.inner()->globalPositionError();
190 barrels[0] =
isBarrel(triplet.inner()->geographicalId().subdetId());
192 gps[1] = triplet.middle()->globalPosition();
193 ges[1] = triplet.middle()->globalPositionError();
194 barrels[1] =
isBarrel(triplet.middle()->geographicalId().subdetId());
196 gps[2] = triplet.outer()->globalPosition();
197 ges[2] = triplet.outer()->globalPositionError();
198 barrels[2] =
isBarrel(triplet.outer()->geographicalId().subdetId());
200 for(
size_t il=0; il!=
size; ++il) {
201 if(hitTree[il].
empty())
continue;
203 auto const&
hits = *fourthHitMap[il];
204 const DetLayer *layer = fourthLayers[il].detLayer();
205 bool barrelLayer = layer->
isBarrel();
207 auto& predictionRZ = preds[il];
208 predictionRZ.initPropagator(&line);
209 Range rzRange = predictionRZ();
216 phiRange =
Range(phi-thisExtraPhiTolerance, phi+thisExtraPhiTolerance);
219 double phi1 = predictionRPhi.
phi(curvature, rzRange.min());
220 double phi2 = predictionRPhi.
phi(curvature, rzRange.max());
221 phiRange =
Range(
std::min(phi1, phi2)-thisExtraPhiTolerance,
std::max(phi1, phi2)+thisExtraPhiTolerance);
224 KDTreeBox phiZ(phiRange.min(), phiRange.max(),
225 rzRange.min()-nSigmaRZ*rzError[il],
226 rzRange.max()+nSigmaRZ*rzError[il]);
229 hitTree[il].search(phiZ, foundNodes);
231 if(foundNodes.empty()) {
237 for(
auto hitIndex: foundNodes) {
238 const auto&
hit =
hits.theHits[hitIndex].hit();
252 gps[3] =
hit->globalPosition();
253 ges[3] =
hit->globalPositionError();
254 barrels[3] =
isBarrel(
hit->geographicalId().subdetId());
256 float chi2 = std::numeric_limits<float>::quiet_NaN();
260 const float simpleCot = ( gps.back().z()-gps.front().z() )/ (gps.back().perp() - gps.front().perp() );
262 for (
int i=0;
i< 4; ++
i) {
268 bc_errZ2[
i] = (barrels[
i]) ? error.
czz() : error.
rerr(point)*
sqr(simpleCot);
271 chi2 = rzLine.
chi2();
274 RZLine rzLine(gps, ges, barrels);
275 chi2 = rzLine.
chi2();
292 if(chi2 < selectedChi2) {
298 result.emplace_back(triplet.inner(), triplet.middle(), triplet.outer(), selectedHit);
T getParameter(std::string const &) const
QuantityDependsPtEval evaluator(const edm::EventSetup &es) const
GlobalPoint const & origin() const
void initLayer(const DetLayer *layer)
def create(alignables, pedeDump, additionalData, outputFile, config)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
static void fillDescriptions(edm::ParameterSetDescription &desc)
const bool useBendingCorrection
Range curvature(double transverseIP) const
T inversePt(T curvature, const edm::EventSetup &iSetup)
T x() const
Cartesian x coordinate.
BaseTrackerRecHit const * ConstRecHitPointer
T curvature(T InversePt, const edm::EventSetup &iSetup)
PixelRecoRange< float > Range
virtual void hitQuadruplets(const TrackingRegion ®ion, OrderedHitSeeds &result, const edm::Event &ev, const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayerSet &tripletLayers, const std::vector< SeedingLayerSetsHits::SeedingLayer > &fourthLayers) override
Abs< T >::type abs(const T &t)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::unique_ptr< SeedComparitor > theComparitor
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
const QuantityDependsPt extraPhiTolerance
PixelQuadrupletGenerator(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
T rerr(const GlobalPoint &aPoint) const
virtual ~PixelQuadrupletGenerator()
Square< F >::type sqr(const F &f)
const float extraHitRZtolerance
const float extraHitRPhitolerance
#define declareDynArray(T, n, x)
const QuantityDependsPt maxChi2
void initTolerance(float tolerance)
LayerCacheType * theLayerCache
float phi(float curvature, float radius) const
T get(const Candidate &c)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
std::unique_ptr< HitTripletGeneratorFromPairAndLayers > theTripletGenerator
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
float value(float curvature) const
const bool fitFastCircleChi2Cut