160 if (
input.regions.empty())
163 const int eventNumber =
input.ev.eventAuxiliary().event();
185 std::vector<std::pair<int, int>> layerIdx2layerandSoa;
187 layerIdx2layerandSoa.reserve(
input.layerClusters.size());
188 unsigned int layerIdx = 0;
189 for (
auto const &lc :
input.layerClusters) {
190 if (
input.mask[layerIdx] == 0.) {
192 edm::LogVerbatim(
"PatternRecognitionbyCLUE3D") <<
"Skipping masked cluster: " << layerIdx;
194 layerIdx2layerandSoa.emplace_back(-1, -1);
198 const auto firstHitDetId = lc.hitsAndFractions()[0].first;
202 auto detId = lc.hitsAndFractions()[0].first;
204 layerIdx2layerandSoa.emplace_back(
layer, layerClusterIndexInLayer);
207 float sum_sqr_x = 0.;
208 float sum_sqr_y = 0.;
209 float ref_x = lc.x();
210 float ref_y = lc.y();
211 float invClsize = 1. / lc.hitsAndFractions().size();
212 for (
auto const &hitsAndFractions : lc.hitsAndFractions()) {
215 sum_sqr_x += (
point.x() - ref_x) * (
point.x() - ref_x);
217 sum_sqr_y += (
point.y() - ref_y) * (
point.y() - ref_y);
224 float radius_x =
sqrt((sum_sqr_x - (
sum_x *
sum_x) * invClsize) * invClsize);
225 float radius_y =
sqrt((sum_sqr_y - (
sum_y *
sum_y) * invClsize) * invClsize);
228 <<
"cluster rx: " << std::setw(5) << radius_x <<
", ry: " << std::setw(5) << radius_y
229 <<
", r: " << std::setw(5) << (radius_x + radius_y) <<
", cells: " << std::setw(4)
230 << lc.hitsAndFractions().size();
235 if (invClsize == 1.) {
240 edm::LogVerbatim(
"PatternRecognitionbyCLUE3D") <<
"Single cell cluster in silicon, rx: " << std::setw(5)
241 << radius_x <<
", ry: " << std::setw(5) << radius_y;
246 radius_x = radius_y =
point.perp() * eta_phi_window.second;
249 <<
"Single cell cluster in scintillator. rx: " << std::setw(5) << radius_x <<
", ry: " << std::setw(5)
250 << radius_y <<
", eta-span: " << std::setw(5) << eta_phi_window.first <<
", phi-span: " << std::setw(5)
251 << eta_phi_window.second;
270 clusters_[
layer].layerClusterOriginalIdx.emplace_back(layerIdx++);
282 int maxLayer = 2 * lastLayerPerSide - 1;
283 std::vector<int> numberOfClustersPerLayer(maxLayer, 0);
284 for (
int i = 0;
i <= maxLayer;
i++) {
287 for (
int i = 0;
i <= maxLayer;
i++) {
293 edm::LogVerbatim(
"PatternRecognitionbyCLUE3D") <<
"Reconstructed " << nTracksters <<
" tracksters" << std::endl;
298 result.resize(nTracksters);
305 for (
unsigned int lc = 0; lc < thisLayer.x.size(); ++lc) {
307 edm::LogVerbatim(
"PatternRecognitionbyCLUE3D") <<
"Trackster " << thisLayer.clusterIndex[lc];
309 if (thisLayer.clusterIndex[lc] >= 0) {
311 edm::LogVerbatim(
"PatternRecognitionbyCLUE3D") <<
" adding lcIdx: " << thisLayer.layerClusterOriginalIdx[lc];
313 result[thisLayer.clusterIndex[lc]].vertices().push_back(thisLayer.layerClusterOriginalIdx[lc]);
314 result[thisLayer.clusterIndex[lc]].vertex_multiplicity().push_back(1);
316 for (
auto [follower_lyrIdx, follower_soaIdx] : thisLayer.followers[lc]) {
317 std::array<unsigned int, 2> edge = {
318 {(
unsigned int)thisLayer.layerClusterOriginalIdx[lc],
319 (
unsigned int)
clusters_[follower_lyrIdx].layerClusterOriginalIdx[follower_soaIdx]}};
320 result[thisLayer.clusterIndex[lc]].edges().push_back(edge);
325 size_t tracksterIndex = 0;
329 return static_cast<int>(
v.vertices().size()) <
338 auto const &hadProb =
349 input.layerClustersTime,
358 edm::LogVerbatim(
"PatternRecognitionbyCLUE3D") <<
"Barycenter: " <<
t.barycenter();
359 edm::LogVerbatim(
"PatternRecognitionbyCLUE3D") <<
"LCs: " <<
t.vertices().size();
361 edm::LogVerbatim(
"PatternRecognitionbyCLUE3D") <<
"Regressed: " <<
t.regressed_energy();
Log< level::Info, true > LogVerbatim
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void energyRegressionAndID(const std::vector< reco::CaloCluster > &layerClusters, const tensorflow::Session *, std::vector< Trackster > &result)
const std::vector< int > minNumLayerCluster_
void assignPCAtoTracksters(std::vector< Trackster > &tracksters, const std::vector< reco::CaloCluster > &layerClusters, const edm::ValueMap< std::pair< float, float >> &layerClustersTime, double z_limit_em, hgcal::RecHitTools const &rhTools, bool computeLocalTime=false, bool energyWeight=true, bool clean=false, int minLayer=10, int maxLayer=10)
std::vector< ClustersOnLayer > clusters_
void calculateDistanceToHigher(const TILES &, const int layerId, const std::vector< std::pair< int, int >> &)
static std::string const input
hgcal::RecHitTools rhtools_
const bool usePCACleaning_
Abs< T >::type abs(const T &t)
int findAndAssignTracksters(const TILES &, const std::vector< std::pair< int, int >> &)
void dumpClusters(const TILES &tiles, const std::vector< std::pair< int, int >> &layerIdx2layerandSoa, const int) const
void calculateLocalDensity(const TILES &, const int layerId, const std::vector< std::pair< int, int >> &)
const bool computeLocalTime_
std::vector< int > tracksterSeedAlgoId_
std::vector< float > layersPosZ_
int sum_x
More diagnostics.
*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
void dumpTracksters(const std::vector< std::pair< int, int >> &layerIdx2layerandSoa, const int, const std::vector< Trackster > &) const