45 cfg.getParameter<
unsigned int>(
"minHitsForSharingCut"),
46 cfg.getParameter<
bool>(
"useRiemannFit"),
47 cfg.getParameter<
bool>(
"fitNas4"),
48 cfg.getParameter<
bool>(
"includeJumpingForwardDoublets"),
49 cfg.getParameter<
bool>(
"earlyFishbone"),
50 cfg.getParameter<
bool>(
"lateFishbone"),
51 cfg.getParameter<
bool>(
"fillStatistics"),
52 cfg.getParameter<
bool>(
"doSharedHitCut"),
53 cfg.getParameter<
bool>(
"dupPassThrough"),
54 cfg.getParameter<
bool>(
"useSimpleTripletCleaner")});
58 template <
typename TrackerTraits,
typename Enable =
void>
59 struct topologyCuts {};
61 template <
typename TrackerTraits>
65 cfg.getParameter<
unsigned int>(
"maxNumberOfDoublets"),
66 cfg.getParameter<
unsigned int>(
"minHitsPerNtuplet"),
67 static_cast<float>(
cfg.getParameter<
double>(
"ptmin")),
68 static_cast<float>(
cfg.getParameter<
double>(
"CAThetaCutBarrel")),
69 static_cast<float>(
cfg.getParameter<
double>(
"CAThetaCutForward")),
70 static_cast<float>(
cfg.getParameter<
double>(
"hardCurvCut")),
71 static_cast<float>(
cfg.getParameter<
double>(
"dcaCutInnerTriplet")),
72 static_cast<float>(
cfg.getParameter<
double>(
"dcaCutOuterTriplet")),
77 auto coeff =
pset.getParameter<std::array<double, 2>>(
"chi2Coeff");
78 auto ptMax =
pset.getParameter<
double>(
"chi2MaxPt");
80 coeff[1] = (coeff[1] - coeff[0]) / log2(
ptMax);
82 {(
float)coeff[0], (
float)coeff[1], 0.f, 0.f},
86 (
float)
pset.getParameter<
double>(
"chi2Scale"),
88 {(
float)
pset.getParameter<
double>(
"tripletMaxTip"),
89 (
float)
pset.getParameter<
double>(
"tripletMinPt"),
90 (
float)
pset.getParameter<
double>(
"tripletMaxZip")},
92 {(
float)
pset.getParameter<
double>(
"quadrupletMaxTip"),
93 (
float)
pset.getParameter<
double>(
"quadrupletMinPt"),
94 (
float)
pset.getParameter<
double>(
"quadrupletMaxZip")}};
98 template <
typename TrackerTraits>
102 cfg.getParameter<
unsigned int>(
"minHitsPerNtuplet"),
103 static_cast<float>(
cfg.getParameter<
double>(
"ptmin")),
104 static_cast<float>(
cfg.getParameter<
double>(
"CAThetaCutBarrel")),
105 static_cast<float>(
cfg.getParameter<
double>(
"CAThetaCutForward")),
106 static_cast<float>(
cfg.getParameter<
double>(
"hardCurvCut")),
107 static_cast<float>(
cfg.getParameter<
double>(
"dcaCutInnerTriplet")),
108 static_cast<float>(
cfg.getParameter<
double>(
"dcaCutOuterTriplet"))},
109 {(
bool)
cfg.getParameter<
bool>(
"includeFarForwards")}};
114 static_cast<float>(
pset.getParameter<
double>(
"maxChi2")),
115 static_cast<float>(
pset.getParameter<
double>(
"minPt")),
116 static_cast<float>(
pset.getParameter<
double>(
"maxTip")),
117 static_cast<float>(
pset.getParameter<
double>(
"maxZip")),
125 template <
typename TrackerTraits>
128 cfg.getParameter<
bool>(
"doZ0Cut"),
129 cfg.getParameter<
bool>(
"doPtCut"),
130 cfg.getParameter<
bool>(
"idealConditions"),
131 (
float)
cfg.getParameter<
double>(
"z0Cut"),
132 (
float)
cfg.getParameter<
double>(
"ptCut"),
133 cfg.getParameter<std::vector<int>>(
"phiCuts")};
140 template <
typename TrackerTraits>
143 : m_params(makeCommonParams(
cfg),
144 makeCellCuts<TrackerTraits>(
cfg),
145 topologyCuts<TrackerTraits>::makeQualityCuts(
cfg.
getParameterSet(
"trackQualityCuts")),
146 topologyCuts<TrackerTraits>::makeCACuts(
cfg)) {
147 #ifdef DUMP_GPU_TK_TUPLES 148 printf(
"TK: %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n",
169 template <
typename TrackerTraits>
171 fillDescriptionsCommon(
desc);
173 <<
"Note: this fillDescriptions is a dummy one. Most probably you are missing some parameters. \n" 174 "please implement your TrackerTraits descriptions in CAHitNtupletGeneratorOnGPU. \n";
179 fillDescriptionsCommon(
desc);
181 desc.add<
bool>(
"idealConditions",
true);
182 desc.add<
bool>(
"includeJumpingForwardDoublets",
false);
183 desc.add<
double>(
"z0Cut", 12.0);
184 desc.add<
double>(
"ptCut", 0.5);
187 trackQualityCuts.add<
double>(
"chi2MaxPt", 10.)->setComment(
"max pT used to determine the pT-dependent chi2 cut");
188 trackQualityCuts.add<std::vector<double>>(
"chi2Coeff", {0.9, 1.8})->setComment(
"chi2 at 1GeV and at ptMax above");
191 "Factor to multiply the pT-dependent chi2 cut (currently: 8 for the broken line fit, ?? for the Riemann " 193 trackQualityCuts.add<
double>(
"tripletMinPt", 0.5)->setComment(
"Min pT for triplets, in GeV");
194 trackQualityCuts.add<
double>(
"tripletMaxTip", 0.3)->setComment(
"Max |Tip| for triplets, in cm");
195 trackQualityCuts.add<
double>(
"tripletMaxZip", 12.)->setComment(
"Max |Zip| for triplets, in cm");
196 trackQualityCuts.add<
double>(
"quadrupletMinPt", 0.3)->setComment(
"Min pT for quadruplets, in GeV");
197 trackQualityCuts.add<
double>(
"quadrupletMaxTip", 0.5)->setComment(
"Max |Tip| for quadruplets, in cm");
198 trackQualityCuts.add<
double>(
"quadrupletMaxZip", 12.)->setComment(
"Max |Zip| for quadruplets, in cm");
200 desc.add<std::vector<int>>(
202 ->setComment(
"Cuts in phi for cells");
206 "Quality cuts based on the results of the track fit:\n - apply a pT-dependent chi2 cut;\n - apply \"region " 207 "cuts\" based on the fit results (pT, Tip, Zip).");
212 fillDescriptionsCommon(
desc);
214 desc.add<
bool>(
"idealConditions",
false);
215 desc.add<
bool>(
"includeJumpingForwardDoublets",
false);
216 desc.add<
double>(
"z0Cut", 10.0);
217 desc.add<
double>(
"ptCut", 0.0);
220 trackQualityCuts.add<
double>(
"chi2MaxPt", 10.)->setComment(
"max pT used to determine the pT-dependent chi2 cut");
221 trackQualityCuts.add<std::vector<double>>(
"chi2Coeff", {0.9, 1.8})->setComment(
"chi2 at 1GeV and at ptMax above");
224 "Factor to multiply the pT-dependent chi2 cut (currently: 8 for the broken line fit, ?? for the Riemann " 226 trackQualityCuts.add<
double>(
"tripletMinPt", 0.0)->setComment(
"Min pT for triplets, in GeV");
227 trackQualityCuts.add<
double>(
"tripletMaxTip", 0.1)->setComment(
"Max |Tip| for triplets, in cm");
228 trackQualityCuts.add<
double>(
"tripletMaxZip", 6.)->setComment(
"Max |Zip| for triplets, in cm");
229 trackQualityCuts.add<
double>(
"quadrupletMinPt", 0.0)->setComment(
"Min pT for quadruplets, in GeV");
230 trackQualityCuts.add<
double>(
"quadrupletMaxTip", 0.5)->setComment(
"Max |Tip| for quadruplets, in cm");
231 trackQualityCuts.add<
double>(
"quadrupletMaxZip", 6.)->setComment(
"Max |Zip| for quadruplets, in cm");
233 desc.add<std::vector<int>>(
235 ->setComment(
"Cuts in phi for cells");
239 "Quality cuts based on the results of the track fit:\n - apply a pT-dependent chi2 cut;\n - apply \"region " 240 "cuts\" based on the fit results (pT, Tip, Zip).");
245 fillDescriptionsCommon(
desc);
247 desc.add<
bool>(
"idealConditions",
false);
248 desc.add<
bool>(
"includeFarForwards",
true);
249 desc.add<
bool>(
"includeJumpingForwardDoublets",
true);
250 desc.add<
double>(
"z0Cut", 7.5);
251 desc.add<
double>(
"ptCut", 0.85);
254 trackQualityCuts.add<
double>(
"maxChi2", 5.)->setComment(
"Max normalized chi2");
257 trackQualityCuts.add<
double>(
"maxZip", 12.)->setComment(
"Max |Zip|, in cm");
259 desc.add<std::vector<int>>(
261 ->setComment(
"Cuts in phi for cells");
265 "Quality cuts based on the results of the track fit:\n - apply cuts based on the fit results (pT, Tip, " 269 template <
typename TrackerTraits>
274 desc.add<
double>(
"ptmin", 0.9)->setComment(
"Cut on minimum pt");
275 desc.add<
double>(
"CAThetaCutBarrel", 0.002)->setComment(
"Cut on RZ alignement for Barrel");
276 desc.add<
double>(
"CAThetaCutForward", 0.003)->setComment(
"Cut on RZ alignment for Forward");
277 desc.add<
double>(
"hardCurvCut", 1. / (0.35 * 87.))->setComment(
"Cut on minimum curvature");
278 desc.add<
double>(
"dcaCutInnerTriplet", 0.15)->setComment(
"Cut on origin radius when the inner hit is on BPix1");
279 desc.add<
double>(
"dcaCutOuterTriplet", 0.25)->setComment(
"Cut on origin radius when the outer hit is on BPix1");
280 desc.add<
bool>(
"earlyFishbone",
true);
281 desc.add<
bool>(
"lateFishbone",
false);
282 desc.add<
bool>(
"fillStatistics",
false);
283 desc.add<
unsigned int>(
"minHitsPerNtuplet", 4);
285 desc.add<
unsigned int>(
"minHitsForSharingCut", 10)
286 ->setComment(
"Maximum number of hits in a tuple to clean also if the shared hit is on bpx1");
288 desc.add<
bool>(
"fitNas4",
false)->setComment(
"fit only 4 hits out of N");
289 desc.add<
bool>(
"doClusterCut",
true);
290 desc.add<
bool>(
"doZ0Cut",
true);
291 desc.add<
bool>(
"doPtCut",
true);
292 desc.add<
bool>(
"useRiemannFit",
false)->setComment(
"true for Riemann, false for BrokenLine");
293 desc.add<
bool>(
"doSharedHitCut",
true)->setComment(
"Sharing hit nTuples cleaning");
294 desc.add<
bool>(
"dupPassThrough",
false)->setComment(
"Do not reject duplicate");
295 desc.add<
bool>(
"useSimpleTripletCleaner",
true)->setComment(
"use alternate implementation");
298 template <
typename TrackerTraits>
300 if (m_params.onGPU_) {
309 memset(m_counters, 0,
sizeof(
Counters));
313 template <
typename TrackerTraits>
315 if (m_params.onGPU_) {
319 if (m_params.doStats_) {
323 cudaFree(m_counters);
326 if (m_params.doStats_) {
333 template <
typename TrackerTraits>
342 GPUKernels kernels(m_params);
343 kernels.setCounters(m_counters);
352 if (m_params.useRiemannFit_) {
359 cudaDeviceSynchronize();
361 std::cout <<
"finished building pixel tracks on GPU" << std::endl;
367 template <
typename TrackerTraits>
369 float bfield)
const {
376 CPUKernels kernels(m_params);
377 kernels.setCounters(m_counters);
378 kernels.allocateOnGPU(hits_h.
nHits(),
nullptr);
381 kernels.launchKernels(hits_h.
view(),
tracks.view(),
nullptr);
383 if (0 == hits_h.
nHits())
390 if (m_params.useRiemannFit_) {
396 kernels.classifyTuples(hits_h.
view(),
tracks.view(),
nullptr);
399 std::cout <<
"finished building pixel tracks on CPU" << std::endl;
static void fillDescriptionsCommon(edm::ParameterSetDescription &desc)
static void printCounters(Counters const *counters)
TrackSoAHost makeTuples(HitsOnHost const &hits_d, float bfield) const
CAHitNtupletGeneratorOnGPU(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
constexpr int16_t phicuts[nPairs]
typename std::enable_if< std::is_base_of< Phase2, T >::value >::type isPhase2Topology
caHitNtupletGenerator::Counters Counters
static void fillDescriptions(edm::ParameterSetDescription &desc)
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
uint32_t offsetBPIX2() const
void launchRiemannKernelsOnCPU(const HitConstView &hv, uint32_t nhits, uint32_t maxNumberOfTuples)
TrackSoADevice makeTuplesAsync(HitsOnDevice const &hits_d, float bfield, cudaStream_t stream) const
void launchRiemannKernels(const HitConstView &hv, uint32_t nhits, uint32_t maxNumberOfTuples, cudaStream_t cudaStream)
typename std::enable_if< std::is_base_of< Phase1, T >::value >::type isPhase1Topology
constexpr int16_t phicuts[nPairs]
void launchBrokenLineKernelsOnCPU(const HitConstView &hv, uint32_t nhits, uint32_t maxNumberOfTuples)
void allocateOnGPU(TupleMultiplicity const *tupleMultiplicity, OutputSoAView &helix_fit_results)
ParameterSet const & getParameterSet(ParameterSetID const &id)
Square< F >::type sqr(const F &f)
#define cudaCheck(ARG,...)
Log< level::Warning, false > LogWarning
uint32_t offsetBPIX2() const
void launchBrokenLineKernels(const HitConstView &hv, uint32_t nhits, uint32_t maxNumberOfTuples, cudaStream_t cudaStream)
static void printCounters(Counters const *counters)