@@ -32,6 +32,7 @@ PatternRecognitionbyCLUE3D<TILES>::PatternRecognitionbyCLUE3D(const edm::Paramet
3232 densityOnSameLayer_(conf.getParameter<bool >(" densityOnSameLayer" )),
3333 criticalEtaPhiDistance_(conf.getParameter<double >(" criticalEtaPhiDistance" )),
3434 outlierMultiplier_(conf.getParameter<double >(" outlierMultiplier" )),
35+ minNumLayerCluster_(conf.getParameter<int >(" minNumLayerCluster" )),
3536 eidInputName_(conf.getParameter<std::string>(" eid_input_name" )),
3637 eidOutputNameEnergy_(conf.getParameter<std::string>(" eid_output_name_energy" )),
3738 eidOutputNameId_(conf.getParameter<std::string>(" eid_output_name_id" )),
@@ -264,6 +265,13 @@ void PatternRecognitionbyCLUE3D<TILES>::makeTracksters(
264265 }
265266 }
266267
268+ result.erase (
269+ std::remove_if (std::begin (result),
270+ std::end (result),
271+ [&](auto const &v) { return static_cast <int >(v.vertices ().size ()) < minNumLayerCluster_; }),
272+ result.end ());
273+ result.shrink_to_fit ();
274+
267275 ticl::assignPCAtoTracksters (result,
268276 input.layerClusters ,
269277 input.layerClustersTime ,
@@ -458,7 +466,7 @@ void PatternRecognitionbyCLUE3D<TILES>::calculateLocalDensity(
458466 minLayer = std::max (layerId - densitySiblingLayers_, minLayer);
459467 maxLayer = std::min (layerId + densitySiblingLayers_, lastLayerPerSide - 1 );
460468 } else {
461- minLayer = std::max (layerId - densitySiblingLayers_, lastLayerPerSide);
469+ minLayer = std::max (layerId - densitySiblingLayers_, lastLayerPerSide + 1 );
462470 maxLayer = std::min (layerId + densitySiblingLayers_, maxLayer);
463471 }
464472 for (unsigned int currentLayer = minLayer; currentLayer <= maxLayer; currentLayer++) {
@@ -483,12 +491,12 @@ void PatternRecognitionbyCLUE3D<TILES>::calculateLocalDensity(
483491 edm::LogVerbatim (" PatternRecogntionbyCLUE3D" ) << " etaBinMin: " << etaBinMin << " , etaBinMax: " << etaBinMax;
484492 edm::LogVerbatim (" PatternRecogntionbyCLUE3D" ) << " phiBinMin: " << phiBinMin << " , phiBinMax: " << phiBinMax;
485493 }
486- for (int ieta = etaBinMin; ieta < etaBinMax; ++ieta) {
494+ for (int ieta = etaBinMin; ieta <= etaBinMax; ++ieta) {
487495 auto offset = ieta * nPhiBin;
488496 if (PatternRecognitionAlgoBaseT<TILES>::algo_verbosity_ > PatternRecognitionAlgoBaseT<TILES>::Advanced) {
489497 edm::LogVerbatim (" PatternRecogntionbyCLUE3D" ) << " offset: " << offset;
490498 }
491- for (int iphi_it = phiBinMin; iphi_it < phiBinMax; ++iphi_it) {
499+ for (int iphi_it = phiBinMin; iphi_it <= phiBinMax; ++iphi_it) {
492500 int iphi = ((iphi_it % nPhiBin + nPhiBin) % nPhiBin);
493501 if (PatternRecognitionAlgoBaseT<TILES>::algo_verbosity_ > PatternRecognitionAlgoBaseT<TILES>::Advanced) {
494502 edm::LogVerbatim (" PatternRecogntionbyCLUE3D" ) << " iphi: " << iphi;
@@ -498,8 +506,12 @@ void PatternRecognitionbyCLUE3D<TILES>::calculateLocalDensity(
498506 for (auto otherClusterIdx : tileOnLayer[offset + iphi]) {
499507 auto const &layerandSoa = layerIdx2layerandSoa[otherClusterIdx];
500508 // Skip masked layer clusters
501- if ((layerandSoa.first == -1 ) && (layerandSoa.second == -1 ))
509+ if ((layerandSoa.first == -1 ) && (layerandSoa.second == -1 )) {
510+ if (PatternRecognitionAlgoBaseT<TILES>::algo_verbosity_ > PatternRecognitionAlgoBaseT<TILES>::Advanced) {
511+ edm::LogVerbatim (" PatternRecogntionbyCLUE3D" ) << " Skipping masked layerIdx " << otherClusterIdx;
512+ }
502513 continue ;
514+ }
503515 auto const &clustersLayer = clusters_[layerandSoa.first ];
504516 if (PatternRecognitionAlgoBaseT<TILES>::algo_verbosity_ > PatternRecognitionAlgoBaseT<TILES>::Advanced) {
505517 edm::LogVerbatim (" PatternRecogntionbyCLUE3D" )
@@ -519,13 +531,22 @@ void PatternRecognitionbyCLUE3D<TILES>::calculateLocalDensity(
519531 clustersLayer.energy [layerandSoa.second ];
520532 }
521533 } else {
522- if (isReachable (clustersOnLayer.eta [i],
523- clusters_[layerandSoa.first ].eta [layerandSoa.second ],
524- clustersOnLayer.phi [i],
525- clusters_[layerandSoa.first ].phi [layerandSoa.second ],
526- densityEtaPhiDistanceSqr_)) {
527- clustersOnLayer.rho [i] += (clustersOnLayer.layerClusterOriginalIdx [i] == otherClusterIdx ? 1 .f : 0 .5f ) *
528- clusters_[layerandSoa.first ].energy [layerandSoa.second ];
534+ if (PatternRecognitionAlgoBaseT<TILES>::algo_verbosity_ > PatternRecognitionAlgoBaseT<TILES>::Advanced) {
535+ edm::LogVerbatim (" PatternRecogntionbyCLUE3D" ) << " Distance: "
536+ << reco::deltaR2 (clustersOnLayer.eta [i],
537+ clustersOnLayer.phi [i],
538+ clustersLayer.eta [layerandSoa.second ],
539+ clustersLayer.phi [layerandSoa.second ]);
540+ }
541+ if (reco::deltaR2 (clustersOnLayer.eta [i],
542+ clustersOnLayer.phi [i],
543+ clustersLayer.eta [layerandSoa.second ],
544+ clustersLayer.phi [layerandSoa.second ]) < densityEtaPhiDistanceSqr_) {
545+ auto energyToAdd = (clustersOnLayer.layerClusterOriginalIdx [i] == otherClusterIdx ? 1 .f : 0 .5f ) *
546+ clustersLayer.energy [layerandSoa.second ];
547+ clustersOnLayer.rho [i] += energyToAdd;
548+ edm::LogVerbatim (" PatternRecogntionbyCLUE3D" )
549+ << " Adding " << energyToAdd << " partial " << clustersOnLayer.rho [i];
529550 }
530551 }
531552 } // end of loop on possible compatible clusters
@@ -562,7 +583,7 @@ void PatternRecognitionbyCLUE3D<TILES>::calculateDistanceToHigher(
562583 minLayer = std::max (layerId - densitySiblingLayers_, minLayer);
563584 maxLayer = std::min (layerId + densitySiblingLayers_, lastLayerPerSide - 1 );
564585 } else {
565- minLayer = std::max (layerId - densitySiblingLayers_, lastLayerPerSide);
586+ minLayer = std::max (layerId - densitySiblingLayers_, lastLayerPerSide + 1 );
566587 maxLayer = std::min (layerId + densitySiblingLayers_, maxLayer);
567588 }
568589 float maxDelta = std::numeric_limits<float >::max ();
@@ -699,10 +720,11 @@ void PatternRecognitionbyCLUE3D<TILES>::fillPSetDescription(edm::ParameterSetDes
699720 iDesc.add <int >(" algo_verbosity" , 0 );
700721 iDesc.add <double >(" criticalDensity" , 4 )->setComment (" in GeV" );
701722 iDesc.add <int >(" densitySiblingLayers" , 3 );
702- iDesc.add <double >(" densityEtaPhiDistanceSqr" , 0.0009 );
723+ iDesc.add <double >(" densityEtaPhiDistanceSqr" , 0.0008 );
703724 iDesc.add <bool >(" densityOnSameLayer" , false );
704725 iDesc.add <double >(" criticalEtaPhiDistance" , 0.035 );
705726 iDesc.add <double >(" outlierMultiplier" , 2 );
727+ iDesc.add <int >(" minNumLayerCluster" , 5 )->setComment (" Not Inclusive" );
706728 iDesc.add <std::string>(" eid_input_name" , " input" );
707729 iDesc.add <std::string>(" eid_output_name_energy" , " output/regressed_energy" );
708730 iDesc.add <std::string>(" eid_output_name_id" , " output/id_probabilities" );
0 commit comments