diff --git a/src/algorithms/calorimetry/CalorimeterClusterRecoCoG.cc b/src/algorithms/calorimetry/CalorimeterClusterRecoCoG.cc index bc890923ff..bb187652ba 100644 --- a/src/algorithms/calorimetry/CalorimeterClusterRecoCoG.cc +++ b/src/algorithms/calorimetry/CalorimeterClusterRecoCoG.cc @@ -20,9 +20,6 @@ #include #include #include -#include -#include -#include // IWYU pragma: keep #include #include #include @@ -178,115 +175,6 @@ std::optional CalorimeterClusterRecoCoG::reconstruct(co debug("Bound cluster position to contributing hits due to {}", (overflow ? "overflow" : "underflow")); } } - - // Additional convenience variables - - //_______________________________________ - // Calculate cluster profile: - // radius, - // dispersion (energy weighted radius), - // theta-phi cluster widths (2D) - // x-y-z cluster widths (3D) - float radius = 0, dispersion = 0, w_sum = 0; - - Eigen::Matrix2f sum2_2D = Eigen::Matrix2f::Zero(); - Eigen::Matrix3f sum2_3D = Eigen::Matrix3f::Zero(); - Eigen::Vector2f sum1_2D = Eigen::Vector2f::Zero(); - Eigen::Vector3f sum1_3D = Eigen::Vector3f::Zero(); - Eigen::Vector2cf eigenValues_2D = Eigen::Vector2cf::Zero(); - Eigen::Vector3cf eigenValues_3D = Eigen::Vector3cf::Zero(); - // the axis is the direction of the eigenvalue corresponding to the largest eigenvalue. - edm4hep::Vector3f axis; - - if (cl.getNhits() > 1) { - for (const auto& hit : pcl.getHits()) { - float w = weightFunc(hit.getEnergy(), totalE, logWeightBase, 0); - - // theta, phi - Eigen::Vector2f pos2D( edm4hep::utils::anglePolar( hit.getPosition() ), edm4hep::utils::angleAzimuthal( hit.getPosition() ) ); - // x, y, z - Eigen::Vector3f pos3D( hit.getPosition().x, hit.getPosition().y, hit.getPosition().z ); - - const auto delta = cl.getPosition() - hit.getPosition(); - radius += delta * delta; - dispersion += delta * delta * w; - - // Weighted Sum x*x, x*y, x*z, y*y, etc. - sum2_2D += w * pos2D * pos2D.transpose(); - sum2_3D += w * pos3D * pos3D.transpose(); - - // Weighted Sum x, y, z - sum1_2D += w * pos2D; - sum1_3D += w * pos3D; - - w_sum += w; - } - - radius = sqrt((1. / (cl.getNhits() - 1.)) * radius); - if( w_sum > 0 ) { - dispersion = sqrt( dispersion / w_sum ); - - // normalize matrices - sum2_2D /= w_sum; - sum2_3D /= w_sum; - sum1_2D /= w_sum; - sum1_3D /= w_sum; - - // 2D and 3D covariance matrices - Eigen::Matrix2f cov2 = sum2_2D - sum1_2D * sum1_2D.transpose(); - Eigen::Matrix3f cov3 = sum2_3D - sum1_3D * sum1_3D.transpose(); - - // Solve for eigenvalues. Corresponds to cluster's 2nd moments (widths) - Eigen::EigenSolver es_2D(cov2, false); // set to true for eigenvector calculation - Eigen::EigenSolver es_3D(cov3, true); // set to true for eigenvector calculation - - // eigenvalues of symmetric real matrix are always real - eigenValues_2D = es_2D.eigenvalues(); - eigenValues_3D = es_3D.eigenvalues(); - //find the eigenvector corresponding to the largest eigenvalue - auto eigenvectors= es_3D.eigenvectors(); - auto max_eigenvalue_it = std::max_element( - eigenValues_3D.begin(), - eigenValues_3D.end(), - [](auto a, auto b) { - return std::real(a) < std::real(b); - } - ); - auto axis_eigen = eigenvectors.col(std::distance( - eigenValues_3D.begin(), - max_eigenvalue_it - )); - axis = { - axis_eigen(0,0).real(), - axis_eigen(1,0).real(), - axis_eigen(2,0).real(), - }; - } - } - - cl.addToShapeParameters( radius ); - cl.addToShapeParameters( dispersion ); - cl.addToShapeParameters( eigenValues_2D[0].real() ); // 2D theta-phi cluster width 1 - cl.addToShapeParameters( eigenValues_2D[1].real() ); // 2D theta-phi cluster width 2 - cl.addToShapeParameters( eigenValues_3D[0].real() ); // 3D x-y-z cluster width 1 - cl.addToShapeParameters( eigenValues_3D[1].real() ); // 3D x-y-z cluster width 2 - cl.addToShapeParameters( eigenValues_3D[2].real() ); // 3D x-y-z cluster width 3 - - - double dot_product = cl.getPosition() * axis; - if (dot_product < 0) { - axis = -1 * axis; - } - - if (m_cfg.longitudinalShowerInfoAvailable) { - cl.setIntrinsicTheta(edm4hep::utils::anglePolar(axis)); - cl.setIntrinsicPhi(edm4hep::utils::angleAzimuthal(axis)); - // TODO intrinsicDirectionError - } else { - cl.setIntrinsicTheta(NAN); - cl.setIntrinsicPhi(NAN); - } - return std::move(cl); } diff --git a/src/algorithms/calorimetry/CalorimeterClusterRecoCoGConfig.h b/src/algorithms/calorimetry/CalorimeterClusterRecoCoGConfig.h index 1b0624462e..f6ea18e2e2 100644 --- a/src/algorithms/calorimetry/CalorimeterClusterRecoCoGConfig.h +++ b/src/algorithms/calorimetry/CalorimeterClusterRecoCoGConfig.h @@ -23,8 +23,6 @@ namespace eicrecon { std::vector logWeightBaseCoeffs{}; double logWeightBase_Eref = 50 * dd4hep::MeV; - bool longitudinalShowerInfoAvailable = false; - // Constrain the cluster position eta to be within // the eta of the contributing hits. This is useful to avoid edge effects // for endcaps. diff --git a/src/algorithms/calorimetry/CalorimeterClusterShape.cc b/src/algorithms/calorimetry/CalorimeterClusterShape.cc new file mode 100644 index 0000000000..c58a490be8 --- /dev/null +++ b/src/algorithms/calorimetry/CalorimeterClusterShape.cc @@ -0,0 +1,194 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2025 Chao Peng, Dhevan Gangadharan, Sebouh Paul, Derek Anderson + +// algorithm definition +#include "CalorimeterClusterShape.h" + +#include +#include +#include +#include +#include +#include + + + +namespace eicrecon { + + // -------------------------------------------------------------------------- + //! Initialize algorithm + // -------------------------------------------------------------------------- + void CalorimeterClusterShape::init() { + + //... nothing to do ...// + + } // end 'init(dd4hep::Detector*)' + + + + // -------------------------------------------------------------------------- + //! Process inputs + // -------------------------------------------------------------------------- + /*! Primary algorithm call: algorithm ingests a collection of clusters + * and computes their cluster shape parameters. Clusters are copied + * onto output with computed shape parameters. If associations are + * provided, they are copied to the output. + * + * Parameters calculated: + * - radius, + * - dispersion (energy weighted radius), + * - theta-phi cluster widths (2D) + * - x-y-z cluster widths (3D) + */ + void CalorimeterClusterShape::process( + const CalorimeterClusterShape::Input& input, + const CalorimeterClusterShape::Output& output + ) const { + + // grab inputs/outputs + const auto [in_clusters, in_associations] = input; + auto [out_clusters, out_associations] = output; + + // exit if no clusters in collection + if (in_clusters->size() == 0) { + debug("No clusters in input collection."); + return; + } + + // loop over input clusters + for (const auto& in_clust : *in_clusters) { + + // copy input cluster + edm4eic::MutableCluster out_clust = in_clust.clone(); + + // ---------------------------------------------------------------------- + // do shape parameter calculation + // ---------------------------------------------------------------------- + { + + // create addresses for quantities we'll need later + float radius = 0, dispersion = 0, w_sum = 0; + + // set up matrices/vectors + Eigen::Matrix2f sum2_2D = Eigen::Matrix2f::Zero(); + Eigen::Matrix3f sum2_3D = Eigen::Matrix3f::Zero(); + Eigen::Vector2f sum1_2D = Eigen::Vector2f::Zero(); + Eigen::Vector3f sum1_3D = Eigen::Vector3f::Zero(); + Eigen::Vector2cf eigenValues_2D = Eigen::Vector2cf::Zero(); + Eigen::Vector3cf eigenValues_3D = Eigen::Vector3cf::Zero(); + + // the axis is the direction of the eigenvalue corresponding to the largest eigenvalue. + edm4hep::Vector3f axis; + if (out_clust.getNhits() > 1) { + for (std::size_t iHit = 0; const auto& hit : out_clust.getHits()) { + + // get weight of hit + const float w = out_clust.getHitContributions()[iHit] / hit.getEnergy(); + + // theta, phi + Eigen::Vector2f pos2D( edm4hep::utils::anglePolar( hit.getPosition() ), edm4hep::utils::angleAzimuthal( hit.getPosition() ) ); + // x, y, z + Eigen::Vector3f pos3D( hit.getPosition().x, hit.getPosition().y, hit.getPosition().z ); + + const auto delta = out_clust.getPosition() - hit.getPosition(); + radius += delta * delta; + dispersion += delta * delta * w; + + // Weighted Sum x*x, x*y, x*z, y*y, etc. + sum2_2D += w * pos2D * pos2D.transpose(); + sum2_3D += w * pos3D * pos3D.transpose(); + + // Weighted Sum x, y, z + sum1_2D += w * pos2D; + sum1_3D += w * pos3D; + + w_sum += w; + ++iHit; + } // end hit loop + + radius = sqrt((1. / (out_clust.getNhits() - 1.)) * radius); + if( w_sum > 0 ) { + dispersion = sqrt( dispersion / w_sum ); + + // normalize matrices + sum2_2D /= w_sum; + sum2_3D /= w_sum; + sum1_2D /= w_sum; + sum1_3D /= w_sum; + + // 2D and 3D covariance matrices + Eigen::Matrix2f cov2 = sum2_2D - sum1_2D * sum1_2D.transpose(); + Eigen::Matrix3f cov3 = sum2_3D - sum1_3D * sum1_3D.transpose(); + + // Solve for eigenvalues. Corresponds to out_cluster's 2nd moments (widths) + Eigen::EigenSolver es_2D(cov2, false); // set to true for eigenvector calculation + Eigen::EigenSolver es_3D(cov3, true); // set to true for eigenvector calculation + + // eigenvalues of symmetric real matrix are always real + eigenValues_2D = es_2D.eigenvalues(); + eigenValues_3D = es_3D.eigenvalues(); + //find the eigenvector corresponding to the largest eigenvalue + auto eigenvectors= es_3D.eigenvectors(); + auto max_eigenvalue_it = std::max_element( + eigenValues_3D.begin(), + eigenValues_3D.end(), + [](auto a, auto b) { + return std::real(a) < std::real(b); + } + ); + auto axis_eigen = eigenvectors.col(std::distance( + eigenValues_3D.begin(), + max_eigenvalue_it + )); + axis = { + axis_eigen(0,0).real(), + axis_eigen(1,0).real(), + axis_eigen(2,0).real(), + }; + } // end if weight sum is nonzero + } // end if n hits > 1 + + // set shape parameters + out_clust.addToShapeParameters( radius ); + out_clust.addToShapeParameters( dispersion ); + out_clust.addToShapeParameters( eigenValues_2D[0].real() ); // 2D theta-phi out_cluster width 1 + out_clust.addToShapeParameters( eigenValues_2D[1].real() ); // 2D theta-phi out_cluster width 2 + out_clust.addToShapeParameters( eigenValues_3D[0].real() ); // 3D x-y-z out_cluster width 1 + out_clust.addToShapeParameters( eigenValues_3D[1].real() ); // 3D x-y-z out_cluster width 2 + out_clust.addToShapeParameters( eigenValues_3D[2].real() ); // 3D x-y-z out_cluster width 3 + + // check axis orientation + double dot_product = out_clust.getPosition() * axis; + if (dot_product < 0) { + axis = -1 * axis; + } + + // set intrinsic theta/phi + if (m_cfg.longitudinalShowerInfoAvailable) { + out_clust.setIntrinsicTheta( edm4hep::utils::anglePolar(axis) ); + out_clust.setIntrinsicPhi( edm4hep::utils::angleAzimuthal(axis) ); + // TODO intrinsicDirectionError + } else { + out_clust.setIntrinsicTheta(NAN); + out_clust.setIntrinsicPhi(NAN); + } + } // end shape parameter calculation + + // ---------------------------------------------------------------------- + // if provided, copy associations + // ---------------------------------------------------------------------- + for (auto in_assoc : *in_associations) { + if (in_assoc.getRec() == in_clust) { + auto mc_par = in_assoc.getSim(); + auto out_assoc = out_associations->create(); + out_assoc.setRecID( out_clust.getObjectID().index ); + out_assoc.setSimID( mc_par.getObjectID().index ); + out_assoc.setRec( out_clust ); + out_assoc.setSim( mc_par ); + out_assoc.setWeight( in_assoc.getWeight() ); + } + } // end input association loop + } // end input cluster loop + } // end 'process(Input&, Output&)' + +} // end eicrecon namespace diff --git a/src/algorithms/calorimetry/CalorimeterClusterShape.h b/src/algorithms/calorimetry/CalorimeterClusterShape.h new file mode 100644 index 0000000000..4f409321e2 --- /dev/null +++ b/src/algorithms/calorimetry/CalorimeterClusterShape.h @@ -0,0 +1,65 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2025 Chao Peng, Dhevan Gangadharan, Sebouh Paul, Derek Anderson + +#pragma once + +#include "algorithms/interfaces/WithPodConfig.h" +#include "CalorimeterClusterShapeConfig.h" + +#include +#include +#include +#include +#include +#include + + + +namespace eicrecon { + + // -------------------------------------------------------------------------- + //! Algorithm input/output + // -------------------------------------------------------------------------- + using CalorimeterClusterShapeAlgorithm = algorithms::Algorithm< + algorithms::Input< + edm4eic::ClusterCollection, + std::optional + >, + algorithms::Output< + edm4eic::ClusterCollection, + std::optional + > + >; + + + + // -------------------------------------------------------------------------- + //! Calculate cluster shapes for provided clusters + // -------------------------------------------------------------------------- + /*! An algorithm which takes a collection of clusters, + * computes their cluster shape parameters, and saves + * outputs the same clusters with computed parameters. + */ + class CalorimeterClusterShape + : public CalorimeterClusterShapeAlgorithm + , public WithPodConfig + { + + public: + + // ctor + CalorimeterClusterShape(std::string_view name) : + CalorimeterClusterShapeAlgorithm { + name, + {"inputClusters", "inputMCClusterAssociations"}, + {"outputClusters", "outputMCClusterAssociations"}, + "Computes cluster shape parameters" + } {} + + // public methods + void init() final; + void process(const Input&, const Output&) const final; + + }; + +} // namespace eicrecon diff --git a/src/algorithms/calorimetry/CalorimeterClusterShapeConfig.h b/src/algorithms/calorimetry/CalorimeterClusterShapeConfig.h new file mode 100644 index 0000000000..10decfd383 --- /dev/null +++ b/src/algorithms/calorimetry/CalorimeterClusterShapeConfig.h @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2025 Derek Anderson + +#pragma once + +namespace eicrecon { + + struct CalorimeterClusterShapeConfig { + + // determines if intrinsic theta/phi + // are calculated + bool longitudinalShowerInfoAvailable = false; + + }; // end CalorimeterClusterShapeConfig + +} // namespace eicrecon diff --git a/src/detectors/B0ECAL/B0ECAL.cc b/src/detectors/B0ECAL/B0ECAL.cc index 2b653f841f..abed5a9241 100644 --- a/src/detectors/B0ECAL/B0ECAL.cc +++ b/src/detectors/B0ECAL/B0ECAL.cc @@ -16,6 +16,7 @@ #include "factories/calorimetry/CalorimeterHitReco_factory.h" #include "factories/calorimetry/CalorimeterIslandCluster_factory.h" #include "factories/calorimetry/CalorimeterTruthClustering_factory.h" +#include "factories/calorimetry/CalorimeterClusterShape_factory.h" extern "C" { void InitPlugin(JApplication *app) { @@ -83,15 +84,15 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "B0ECalClusters", - {"B0ECalIslandProtoClusters", // edm4eic::ProtoClusterCollection + "B0ECalClustersWithoutShapes", + {"B0ECalIslandProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "B0ECalRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "B0ECalRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "B0ECalHits"}, // edm4hep::SimCalorimeterHitCollection + "B0ECalHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"B0ECalClusters", // edm4eic::Cluster - "B0ECalClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"B0ECalClustersWithoutShapes", // edm4eic::Cluster + "B0ECalClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -102,17 +103,29 @@ extern "C" { ) ); + app->Add( + new JOmniFactoryGeneratorT( + "B0ECalClusters", + {"B0ECalClustersWithoutShapes", + "B0ECalClusterAssociationsWithoutShapes"}, + {"B0ECalClusters", + "B0ECalClusterAssociations"}, + {}, + app + ) + ); + app->Add( new JOmniFactoryGeneratorT( - "B0ECalTruthClusters", - {"B0ECalTruthProtoClusters", // edm4eic::ProtoClusterCollection + "B0ECalTruthClustersWithoutShapes", + {"B0ECalTruthProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "B0ECalRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "B0ECalRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "B0ECalHits"}, // edm4hep::SimCalorimeterHitCollection + "B0ECalHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"B0ECalTruthClusters", // edm4eic::Cluster - "B0ECalTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"B0ECalTruthClustersWithoutShapes", // edm4eic::Cluster + "B0ECalTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -122,5 +135,18 @@ extern "C" { app ) ); + + app->Add( + new JOmniFactoryGeneratorT( + "B0ECalTruthClusters", + {"B0ECalTruthClustersWithoutShapes", + "B0ECalTruthClusterAssociationsWithoutShapes"}, + {"B0ECalTruthClusters", + "B0ECalTruthClusterAssociations"}, + {}, + app + ) + ); + } } diff --git a/src/detectors/BEMC/BEMC.cc b/src/detectors/BEMC/BEMC.cc index 7e29d1ed79..3f7c84ce56 100644 --- a/src/detectors/BEMC/BEMC.cc +++ b/src/detectors/BEMC/BEMC.cc @@ -19,6 +19,7 @@ #include "factories/calorimetry/ImagingClusterReco_factory.h" #include "factories/calorimetry/ImagingTopoCluster_factory.h" #include "factories/calorimetry/TruthEnergyPositionClusterMerger_factory.h" +#include "factories/calorimetry/CalorimeterClusterShape_factory.h" extern "C" { @@ -93,25 +94,37 @@ extern "C" { )); app->Add( new JOmniFactoryGeneratorT( - "EcalBarrelScFiClusters", - {"EcalBarrelScFiProtoClusters", // edm4eic::ProtoClusterCollection + "EcalBarrelScFiClustersWithoutShapes", + {"EcalBarrelScFiProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "EcalBarrelScFiRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociation + "EcalBarrelScFiRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociation #else - "EcalBarrelScFiHits"}, // edm4hep::SimCalorimeterHitCollection + "EcalBarrelScFiHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"EcalBarrelScFiClusters", // edm4eic::Cluster - "EcalBarrelScFiClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalBarrelScFiClustersWithoutShapes", // edm4eic::Cluster + "EcalBarrelScFiClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, .logWeightBase = 6.2, - .longitudinalShowerInfoAvailable = true, .enableEtaBounds = false }, app // TODO: Remove me once fixed ) ); + app->Add( + new JOmniFactoryGeneratorT( + "EcalBarrelScFiClusters", + {"EcalBarrelScFiClustersWithoutShapes", + "EcalBarrelScFiClusterAssociationsWithoutShapes"}, + {"EcalBarrelScFiClusters", + "EcalBarrelScFiClusterAssociations"}, + { + .longitudinalShowerInfoAvailable = true + }, + app + ) + ); // Make sure digi and reco use the same value decltype(CalorimeterHitDigiConfig::capADC) EcalBarrelImaging_capADC = 8192; //8192, 13bit ADC diff --git a/src/detectors/BHCAL/BHCAL.cc b/src/detectors/BHCAL/BHCAL.cc index f17e908d8d..6bad9a46d5 100644 --- a/src/detectors/BHCAL/BHCAL.cc +++ b/src/detectors/BHCAL/BHCAL.cc @@ -15,6 +15,7 @@ #include "factories/calorimetry/CalorimeterHitsMerger_factory.h" #include "factories/calorimetry/CalorimeterIslandCluster_factory.h" #include "factories/calorimetry/CalorimeterTruthClustering_factory.h" +#include "factories/calorimetry/CalorimeterClusterShape_factory.h" #include "factories/calorimetry/TrackClusterMergeSplitter_factory.h" extern "C" { @@ -121,15 +122,15 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "HcalBarrelClusters", - {"HcalBarrelIslandProtoClusters", // edm4eic::ProtoClusterCollection + "HcalBarrelClustersWithoutShapes", + {"HcalBarrelIslandProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "HcalBarrelRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "HcalBarrelRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "HcalBarrelHits"}, // edm4hep::SimCalorimeterHitCollection + "HcalBarrelHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"HcalBarrelClusters", // edm4eic::Cluster - "HcalBarrelClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"HcalBarrelClustersWithoutShapes", // edm4eic::Cluster + "HcalBarrelClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -140,17 +141,29 @@ extern "C" { ) ); + app->Add( + new JOmniFactoryGeneratorT( + "HcalBarrelClusters", + {"HcalBarrelClustersWithoutShapes", + "HcalBarrelClusterAssociationsWithoutShapes"}, + {"HcalBarrelClusters", + "HcalBarrelClusterAssociations"}, + {}, + app + ) + ); + app->Add( new JOmniFactoryGeneratorT( - "HcalBarrelTruthClusters", - {"HcalBarrelTruthProtoClusters", // edm4eic::ProtoClusterCollection + "HcalBarrelTruthClustersWithoutShapes", + {"HcalBarrelTruthProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "HcalBarrelRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "HcalBarrelRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "HcalBarrelHits"}, // edm4hep::SimCalorimeterHitCollection + "HcalBarrelHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"HcalBarrelTruthClusters", // edm4eic::Cluster - "HcalBarrelTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"HcalBarrelTruthClustersWithoutShapes", // edm4eic::Cluster + "HcalBarrelTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -161,6 +174,18 @@ extern "C" { ) ); + app->Add( + new JOmniFactoryGeneratorT( + "HcalBarrelTruthClusters", + {"HcalBarrelTruthClustersWithoutShapes", + "HcalBarrelTruthClusterAssociationsWithoutShapes"}, + {"HcalBarrelTruthClusters", + "HcalBarrelTruthClusterAssociations"}, + {}, + app + ) + ); + app->Add( new JOmniFactoryGeneratorT( "HcalBarrelSplitMergeProtoClusters", @@ -182,11 +207,11 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "HcalBarrelSplitMergeClusters", - {"HcalBarrelSplitMergeProtoClusters", // edm4eic::ProtoClusterCollection + "HcalBarrelSplitMergeClustersWithoutShapes", + {"HcalBarrelSplitMergeProtoClusters", // edm4eic::ProtoClusterCollection "HcalBarrelHits"}, // edm4hep::SimCalorimeterHitCollection - {"HcalBarrelSplitMergeClusters", // edm4eic::Cluster - "HcalBarrelSplitMergeClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"HcalBarrelSplitMergeClustersWithoutShapes", // edm4eic::Cluster + "HcalBarrelSplitMergeClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -197,5 +222,17 @@ extern "C" { ) ); + app->Add( + new JOmniFactoryGeneratorT( + "HcalBarrelSplitMergeClusters", + {"HcalBarrelSplitMergeClustersWithoutShapes", + "HcalBarrelSplitMergeClusterAssociationsWithoutShapes"}, + {"HcalBarrelSplitMergeClusters", + "HcalBarrelSplitMergeClusterAssociations"}, + {}, + app + ) + ); + } } diff --git a/src/detectors/EEMC/EEMC.cc b/src/detectors/EEMC/EEMC.cc index 70c40e2ab3..2d0f05349b 100644 --- a/src/detectors/EEMC/EEMC.cc +++ b/src/detectors/EEMC/EEMC.cc @@ -20,6 +20,7 @@ #include "factories/calorimetry/CalorimeterParticleIDPreML_factory.h" #endif #include "factories/calorimetry/CalorimeterTruthClustering_factory.h" +#include "factories/calorimetry/CalorimeterClusterShape_factory.h" #include "factories/calorimetry/TrackClusterMergeSplitter_factory.h" #if EDM4EIC_VERSION_MAJOR >= 8 #include "factories/meta/ONNXInference_factory.h" @@ -97,15 +98,15 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "EcalEndcapNTruthClusters", - {"EcalEndcapNTruthProtoClusters", // edm4eic::ProtoClusterCollection + "EcalEndcapNTruthClustersWithoutShapes", + {"EcalEndcapNTruthProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "EcalEndcapNRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "EcalEndcapNRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "EcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection + "EcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"EcalEndcapNTruthClusters", // edm4eic::Cluster - "EcalEndcapNTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalEndcapNTruthClustersWithoutShapes", // edm4eic::Cluster + "EcalEndcapNTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -116,25 +117,37 @@ extern "C" { ) ); + app->Add( + new JOmniFactoryGeneratorT( + "EcalEndcapNTruthClusters", + {"EcalEndcapNTruthClustersWithoutShapes", + "EcalEndcapNTruthClusterAssociationsWithoutShapes"}, + {"EcalEndcapNTruthClusters", + "EcalEndcapNTruthClusterAssociations"}, + {}, + app + ) + ); + app->Add( new JOmniFactoryGeneratorT( #if EDM4EIC_VERSION_MAJOR >= 8 - "EcalEndcapNClustersWithoutPID", + "EcalEndcapNClustersWithoutPIDAndShapes", #else - "EcalEndcapNClusters", + "EcalEndcapNClustersWithoutShapes", #endif - {"EcalEndcapNIslandProtoClusters", // edm4eic::ProtoClusterCollection + {"EcalEndcapNIslandProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "EcalEndcapNRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "EcalEndcapNRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "EcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection + "EcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection #endif #if EDM4EIC_VERSION_MAJOR >= 8 - {"EcalEndcapNClustersWithoutPID", // edm4eic::Cluster - "EcalEndcapNClusterAssociationsWithoutPID"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalEndcapNClustersWithoutPIDAndShapes", // edm4eic::Cluster + "EcalEndcapNClusterAssociationsWithoutPIDAndShapes"}, // edm4eic::MCRecoClusterParticleAssociation #else - {"EcalEndcapNClusters", // edm4eic::Cluster - "EcalEndcapNClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalEndcapNClustersWithoutShapes", // edm4eic::Cluster + "EcalEndcapNClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation #endif { .energyWeight = "log", @@ -146,6 +159,26 @@ extern "C" { ) ); + app->Add( + new JOmniFactoryGeneratorT( +#if EDM4EIC_VERSION_MAJOR >= 8 + "EcalEndcapNClustersWithoutPIDButWithShapes", + {"EcalEndcapNClustersWithoutPIDAndShapes", + "EcalEndcapNClusterAssociationsWithoutPIDAndShapes"}, + {"EcalEndcapNClustersWithoutPID", + "EcalEndcapNClusterAssociationsWithoutPID"}, +#else + "EcalEndcapNClusters", + {"EcalEndcapNClustersWithoutShapes", + "EcalEndcapNClusterAssociationsWithoutShapes"}, + {"EcalEndcapNClusters", + "EcalEndcapNClusterAssociations"}, +#endif + {}, + app + ) + ); + app->Add( new JOmniFactoryGeneratorT( "EcalEndcapNSplitMergeProtoClusters", @@ -210,11 +243,11 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "EcalEndcapNSplitMergeClusters", - {"EcalEndcapNSplitMergeProtoClusters", // edm4eic::ProtoClusterCollection - "EcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection - {"EcalEndcapNSplitMergeClusters", // edm4eic::Cluster - "EcalEndcapNSplitMergeClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + "EcalEndcapNSplitMergeClustersWithoutShapes", + {"EcalEndcapNSplitMergeProtoClusters", // edm4eic::ProtoClusterCollection + "EcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection + {"EcalEndcapNSplitMergeClustersWithoutShapes", // edm4eic::Cluster + "EcalEndcapNSplitMergeClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -224,5 +257,17 @@ extern "C" { app // TODO: Remove me once fixed ) ); + + app->Add( + new JOmniFactoryGeneratorT( + "EcalEndcapNSplitMergeClusters", + {"EcalEndcapNSplitMergeClustersWithoutShapes", + "EcalEndcapNSplitMergeClusterAssociationsWithoutShapes"}, + {"EcalEndcapNSplitMergeClusters", + "EcalEndcapNSplitMergeClusterAssociations"}, + {}, + app + ) + ); } } diff --git a/src/detectors/EHCAL/EHCAL.cc b/src/detectors/EHCAL/EHCAL.cc index 7d39c01472..919d2cd11f 100644 --- a/src/detectors/EHCAL/EHCAL.cc +++ b/src/detectors/EHCAL/EHCAL.cc @@ -16,6 +16,7 @@ #include "factories/calorimetry/CalorimeterHitsMerger_factory.h" #include "factories/calorimetry/CalorimeterIslandCluster_factory.h" #include "factories/calorimetry/CalorimeterTruthClustering_factory.h" +#include "factories/calorimetry/CalorimeterClusterShape_factory.h" #include "factories/calorimetry/TrackClusterMergeSplitter_factory.h" extern "C" { @@ -94,15 +95,15 @@ extern "C" { )); app->Add( new JOmniFactoryGeneratorT( - "HcalEndcapNTruthClusters", - {"HcalEndcapNTruthProtoClusters", // edm4eic::ProtoClusterCollection + "HcalEndcapNTruthClustersWithoutShapes", + {"HcalEndcapNTruthProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "HcalEndcapNRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "HcalEndcapNRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "HcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection + "HcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"HcalEndcapNTruthClusters", // edm4eic::Cluster - "HcalEndcapNTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"HcalEndcapNTruthClustersWithoutShapes", // edm4eic::Cluster + "HcalEndcapNTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -112,18 +113,28 @@ extern "C" { app // TODO: Remove me once fixed ) ); - + app->Add( + new JOmniFactoryGeneratorT( + "HcalEndcapNTruthClusters", + {"HcalEndcapNTruthClustersWithoutShapes", + "HcalEndcapNTruthClusterAssociationsWithoutShapes"}, + {"HcalEndcapNTruthClusters", + "HcalEndcapNTruthClusterAssociations"}, + {}, + app + ) + ); app->Add( new JOmniFactoryGeneratorT( - "HcalEndcapNClusters", - {"HcalEndcapNIslandProtoClusters", // edm4eic::ProtoClusterCollection + "HcalEndcapNClustersWithoutShapes", + {"HcalEndcapNIslandProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "HcalEndcapNRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "HcalEndcapNRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "HcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection + "HcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"HcalEndcapNClusters", // edm4eic::Cluster - "HcalEndcapNClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"HcalEndcapNClustersWithoutShapes", // edm4eic::Cluster + "HcalEndcapNClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -133,7 +144,17 @@ extern "C" { app // TODO: Remove me once fixed ) ); - + app->Add( + new JOmniFactoryGeneratorT( + "HcalEndcapNClusters", + {"HcalEndcapNClustersWithoutShapes", + "HcalEndcapNClusterAssociationsWithoutShapes"}, + {"HcalEndcapNClusters", + "HcalEndcapNClusterAssociations"}, + {}, + app + ) + ); app->Add( new JOmniFactoryGeneratorT( "HcalEndcapNSplitMergeProtoClusters", @@ -152,14 +173,13 @@ extern "C" { app // TODO: remove me once fixed ) ); - app->Add( new JOmniFactoryGeneratorT( - "HcalEndcapNSplitMergeClusters", - {"HcalEndcapNSplitMergeProtoClusters", // edm4eic::ProtoClusterCollection - "HcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection - {"HcalEndcapNSplitMergeClusters", // edm4eic::Cluster - "HcalEndcapNSplitMergeClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + "HcalEndcapNSplitMergeClustersWithoutShapes", + {"HcalEndcapNSplitMergeProtoClusters", // edm4eic::ProtoClusterCollection + "HcalEndcapNHits"}, // edm4hep::SimCalorimeterHitCollection + {"HcalEndcapNSplitMergeClustersWithoutShapes", // edm4eic::Cluster + "HcalEndcapNSplitMergeClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -169,5 +189,16 @@ extern "C" { app // TODO: Remove me once fixed ) ); + app->Add( + new JOmniFactoryGeneratorT( + "HcalEndcapNSplitMergeClusters", + {"HcalEndcapNSplitMergeClustersWithoutShapes", + "HcalEndcapNSplitMergeClusterAssociationsWithoutShapes"}, + {"HcalEndcapNSplitMergeClusters", + "HcalEndcapNSplitMergeClusterAssociations"}, + {}, + app + ) + ); } } diff --git a/src/detectors/FEMC/FEMC.cc b/src/detectors/FEMC/FEMC.cc index 998e425285..c3d1ea55db 100644 --- a/src/detectors/FEMC/FEMC.cc +++ b/src/detectors/FEMC/FEMC.cc @@ -14,6 +14,7 @@ #include "factories/calorimetry/CalorimeterHitReco_factory.h" #include "factories/calorimetry/CalorimeterIslandCluster_factory.h" #include "factories/calorimetry/CalorimeterTruthClustering_factory.h" +#include "factories/calorimetry/CalorimeterClusterShape_factory.h" #include "factories/calorimetry/TrackClusterMergeSplitter_factory.h" extern "C" { @@ -87,15 +88,15 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "EcalEndcapPTruthClusters", - {"EcalEndcapPTruthProtoClusters", // edm4eic::ProtoClusterCollection + "EcalEndcapPTruthClustersWithoutShapes", + {"EcalEndcapPTruthProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "EcalEndcapPRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "EcalEndcapPRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "EcalEndcapPHits"}, // edm4hep::SimCalorimeterHitCollection + "EcalEndcapPHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"EcalEndcapPTruthClusters", // edm4eic::Cluster - "EcalEndcapPTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalEndcapPTruthClustersWithoutShapes", // edm4eic::Cluster + "EcalEndcapPTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -106,17 +107,29 @@ extern "C" { ) ); + app->Add( + new JOmniFactoryGeneratorT( + "EcalEndcapPTruthClusters", + {"EcalEndcapPTruthClustersWithoutShapes", + "EcalEndcapPTruthClusterAssociationsWithoutShapes"}, + {"EcalEndcapPTruthClusters", + "EcalEndcapPTruthClusterAssociations"}, + {}, + app + ) + ); + app->Add( new JOmniFactoryGeneratorT( - "EcalEndcapPClusters", - {"EcalEndcapPIslandProtoClusters", // edm4eic::ProtoClusterCollection + "EcalEndcapPClustersWithoutShapes", + {"EcalEndcapPIslandProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "EcalEndcapPRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "EcalEndcapPRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "EcalEndcapPHits"}, // edm4hep::SimCalorimeterHitCollection + "EcalEndcapPHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"EcalEndcapPClusters", // edm4eic::Cluster - "EcalEndcapPClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalEndcapPClustersWithoutShapes", // edm4eic::Cluster + "EcalEndcapPClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -127,6 +140,18 @@ extern "C" { ) ); + app->Add( + new JOmniFactoryGeneratorT( + "EcalEndcapPClusters", + {"EcalEndcapPClustersWithoutShapes", + "EcalEndcapPClusterAssociationsWithoutShapes"}, + {"EcalEndcapPClusters", + "EcalEndcapPClusterAssociations"}, + {}, + app + ) + ); + app->Add( new JOmniFactoryGeneratorT( "EcalEndcapPSplitMergeProtoClusters", @@ -148,11 +173,11 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "EcalEndcapPSplitMergeClusters", - {"EcalEndcapPSplitMergeProtoClusters", // edm4eic::ProtoClusterCollection + "EcalEndcapPSplitMergeClustersWithoutShapes", + {"EcalEndcapPSplitMergeProtoClusters", // edm4eic::ProtoClusterCollection "EcalEndcapPHits"}, // edm4hep::SimCalorimeterHitCollection - {"EcalEndcapPSplitMergeClusters", // edm4eic::Cluster - "EcalEndcapPSplitMergeClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalEndcapPSplitMergeClustersWithoutShapes", // edm4eic::Cluster + "EcalEndcapPSplitMergeClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -163,6 +188,18 @@ extern "C" { ) ); + app->Add( + new JOmniFactoryGeneratorT( + "EcalEndcapPSplitMergeClusters", + {"EcalEndcapPSplitMergeClustersWithoutShapes", + "EcalEndcapPSplitMergeClusterAssociationsWithoutShapes"}, + {"EcalEndcapPSplitMergeClusters", + "EcalEndcapPSplitMergeClusterAssociations"}, + {}, + app + ) + ); + // Insert is identical to regular Ecal app->Add(new JOmniFactoryGeneratorT( "EcalEndcapPInsertRawHits", @@ -223,15 +260,15 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "EcalEndcapPInsertTruthClusters", - {"EcalEndcapPInsertTruthProtoClusters", // edm4eic::ProtoClusterCollection + "EcalEndcapPInsertTruthClustersWithoutShapes", + {"EcalEndcapPInsertTruthProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "EcalEndcapPInsertRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitCollection + "EcalEndcapPInsertRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitCollection #else - "EcalEndcapPInsertHits"}, // edm4hep::SimCalorimeterHitCollection + "EcalEndcapPInsertHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"EcalEndcapPInsertTruthClusters", // edm4eic::Cluster - "EcalEndcapPInsertTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalEndcapPInsertTruthClustersWithoutShapes", // edm4eic::Cluster + "EcalEndcapPInsertTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -242,17 +279,29 @@ extern "C" { ) ); + app->Add( + new JOmniFactoryGeneratorT( + "EcalEndcapPInsertTruthClusters", + {"EcalEndcapPInsertTruthClustersWithoutShapes", + "EcalEndcapPInsertTruthClusterAssociationsWithoutShapes"}, + {"EcalEndcapPInsertTruthClusters", + "EcalEndcapPInsertTruthClusterAssociations"}, + {}, + app + ) + ); + app->Add( new JOmniFactoryGeneratorT( - "EcalEndcapPInsertClusters", - {"EcalEndcapPInsertIslandProtoClusters", // edm4eic::ProtoClusterCollection + "EcalEndcapPInsertClustersWithoutShapes", + {"EcalEndcapPInsertIslandProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "EcalEndcapPInsertRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitCollection + "EcalEndcapPInsertRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitCollection #else - "EcalEndcapPInsertHits"}, // edm4hep::SimCalorimeterHitCollection + "EcalEndcapPInsertHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"EcalEndcapPInsertClusters", // edm4eic::Cluster - "EcalEndcapPInsertClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalEndcapPInsertClustersWithoutShapes", // edm4eic::Cluster + "EcalEndcapPInsertClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -263,5 +312,16 @@ extern "C" { ) ); + app->Add( + new JOmniFactoryGeneratorT( + "EcalEndcapPInsertClusters", + {"EcalEndcapPInsertClustersWithoutShapes", + "EcalEndcapPInsertClusterAssociationsWithoutShapes"}, + {"EcalEndcapPInsertClusters", + "EcalEndcapPInsertClusterAssociations"}, + {}, + app + ) + ); } } diff --git a/src/detectors/FHCAL/FHCAL.cc b/src/detectors/FHCAL/FHCAL.cc index 36f7fb4797..9bcefabebf 100644 --- a/src/detectors/FHCAL/FHCAL.cc +++ b/src/detectors/FHCAL/FHCAL.cc @@ -22,6 +22,7 @@ #include "factories/calorimetry/CalorimeterHitsMerger_factory.h" #include "factories/calorimetry/CalorimeterIslandCluster_factory.h" #include "factories/calorimetry/CalorimeterTruthClustering_factory.h" +#include "factories/calorimetry/CalorimeterClusterShape_factory.h" #include "factories/calorimetry/HEXPLIT_factory.h" #include "factories/calorimetry/ImagingTopoCluster_factory.h" #include "factories/calorimetry/TrackClusterMergeSplitter_factory.h" @@ -128,48 +129,74 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "HcalEndcapPInsertTruthClusters", - {"HcalEndcapPInsertTruthProtoClusters", // edm4eic::ProtoClusterCollection + "HcalEndcapPInsertTruthClustersWithoutShapes", + {"HcalEndcapPInsertTruthProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "HcalEndcapPInsertRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "HcalEndcapPInsertRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "HcalEndcapPInsertHits"}, // edm4hep::SimCalorimeterHitCollection + "HcalEndcapPInsertHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"HcalEndcapPInsertTruthClusters", // edm4eic::Cluster - "HcalEndcapPInsertTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"HcalEndcapPInsertTruthClustersWithoutShapes", // edm4eic::Cluster + "HcalEndcapPInsertTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 0.0257, .logWeightBase = 3.6, - .longitudinalShowerInfoAvailable = true, .enableEtaBounds = true }, app // TODO: Remove me once fixed ) ); + app->Add( + new JOmniFactoryGeneratorT( + "HcalEndcapPInsertTruthClusters", + {"HcalEndcapPInsertTruthClustersWithoutShapes", + "HcalEndcapPInsertTruthClusterAssociationsWithoutShapes"}, + {"HcalEndcapPInsertTruthClusters", + "HcalEndcapPInsertTruthClusterAssociations"}, + { + .longitudinalShowerInfoAvailable = true + }, + app + ) + ); + app->Add( new JOmniFactoryGeneratorT( - "HcalEndcapPInsertClusters", - {"HcalEndcapPInsertImagingProtoClusters", // edm4eic::ProtoClusterCollection + "HcalEndcapPInsertClustersWithoutShapes", + {"HcalEndcapPInsertImagingProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "HcalEndcapPInsertRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "HcalEndcapPInsertRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "HcalEndcapPInsertHits"}, // edm4hep::SimCalorimeterHitCollection + "HcalEndcapPInsertHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"HcalEndcapPInsertClusters", // edm4eic::Cluster - "HcalEndcapPInsertClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"HcalEndcapPInsertClustersWithoutShapes", // edm4eic::Cluster + "HcalEndcapPInsertClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 0.0257, .logWeightBase = 6.2, - .longitudinalShowerInfoAvailable = true, .enableEtaBounds = false, }, app // TODO: Remove me once fixed ) ); + app->Add( + new JOmniFactoryGeneratorT( + "HcalEndcapPInsertClusters", + {"HcalEndcapPInsertClustersWithoutShapes", + "HcalEndcapPInsertClusterAssociationsWithoutShapes"}, + {"HcalEndcapPInsertClusters", + "HcalEndcapPInsertClusterAssociations"}, + { + .longitudinalShowerInfoAvailable = true + }, + app + ) + ); + // Make sure digi and reco use the same value decltype(CalorimeterHitDigiConfig::capADC) LFHCAL_capADC = 65536; decltype(CalorimeterHitDigiConfig::dyRangeADC) LFHCAL_dyRangeADC = 1 * dd4hep::GeV; @@ -257,48 +284,74 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "LFHCALTruthClusters", - {"LFHCALTruthProtoClusters", // edm4eic::ProtoClusterCollection + "LFHCALTruthClustersWithoutShapes", + {"LFHCALTruthProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "LFHCALRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "LFHCALRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "LFHCALHits"}, // edm4hep::SimCalorimeterHitCollection + "LFHCALHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"LFHCALTruthClusters", // edm4eic::Cluster - "LFHCALTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"LFHCALTruthClustersWithoutShapes", // edm4eic::Cluster + "LFHCALTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, .logWeightBase = 4.5, - .longitudinalShowerInfoAvailable = true, .enableEtaBounds = false }, app // TODO: Remove me once fixed ) ); + app->Add( + new JOmniFactoryGeneratorT( + "LFHCALTruthClusters", + {"LFHCALTruthClustersWithoutShapes", + "LFHCALTruthClusterAssociationsWithoutShapes"}, + {"LFHCALTruthClusters", + "LFHCALTruthClusterAssociations"}, + { + .longitudinalShowerInfoAvailable = true + }, + app + ) + ); + app->Add( new JOmniFactoryGeneratorT( - "LFHCALClusters", - {"LFHCALIslandProtoClusters", // edm4eic::ProtoClusterCollection + "LFHCALClustersWithoutShapes", + {"LFHCALIslandProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "LFHCALRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "LFHCALRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "LFHCALHits"}, // edm4hep::SimCalorimeterHitCollection + "LFHCALHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"LFHCALClusters", // edm4eic::Cluster - "LFHCALClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"LFHCALClustersWithoutShapes", // edm4eic::Cluster + "LFHCALClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, .logWeightBase = 4.5, - .longitudinalShowerInfoAvailable = true, .enableEtaBounds = false, }, app // TODO: Remove me once fixed ) ); + app->Add( + new JOmniFactoryGeneratorT( + "LFHCALClusters", + {"LFHCALClustersWithoutShapes", + "LFHCALClusterAssociationsWithoutShapes"}, + {"LFHCALClusters", + "LFHCALClusterAssociations"}, + { + .longitudinalShowerInfoAvailable = true + }, + app + ) + ); + app->Add( new JOmniFactoryGeneratorT( "LFHCALSplitMergeProtoClusters", @@ -320,11 +373,11 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "LFHCALSplitMergeClusters", - {"LFHCALSplitMergeProtoClusters", // edm4eic::ProtoClusterCollection - "LFHCALHits"}, // edm4hep::SimCalorimeterHitCollection - {"LFHCALSplitMergeClusters", // edm4eic::Cluster - "LFHCALSplitMergeClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + "LFHCALSplitMergeClustersWithoutShapes", + {"LFHCALSplitMergeProtoClusters", // edm4eic::ProtoClusterCollection + "LFHCALHits"}, // edm4hep::SimCalorimeterHitCollection + {"LFHCALSplitMergeClustersWithoutShapes", // edm4eic::Cluster + "LFHCALSplitMergeClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -334,5 +387,19 @@ extern "C" { app // TODO: Remove me once fixed ) ); + + app->Add( + new JOmniFactoryGeneratorT( + "LFHCALSplitMergeClusters", + {"LFHCALSplitMergeClustersWithoutShapes", + "LFHCALSplitMergeClusterAssociationsWithoutShapes"}, + {"LFHCALSplitMergeClusters", + "LFHCALSplitMergeClusterAssociations"}, + { + .longitudinalShowerInfoAvailable = true + }, + app + ) + ); } } diff --git a/src/detectors/LUMISPECCAL/LUMISPECCAL.cc b/src/detectors/LUMISPECCAL/LUMISPECCAL.cc index 4e724e545e..83735980de 100644 --- a/src/detectors/LUMISPECCAL/LUMISPECCAL.cc +++ b/src/detectors/LUMISPECCAL/LUMISPECCAL.cc @@ -16,6 +16,7 @@ #include "factories/calorimetry/CalorimeterHitReco_factory.h" #include "factories/calorimetry/CalorimeterIslandCluster_factory.h" #include "factories/calorimetry/CalorimeterTruthClustering_factory.h" +#include "factories/calorimetry/CalorimeterClusterShape_factory.h" extern "C" { void InitPlugin(JApplication *app) { @@ -81,15 +82,15 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "EcalLumiSpecClusters", - {"EcalLumiSpecIslandProtoClusters", // edm4eic::ProtoClusterCollection + "EcalLumiSpecClustersWithoutShapes", + {"EcalLumiSpecIslandProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "EcalLumiSpecRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "EcalLumiSpecRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "EcalLumiSpecHits"}, // edm4hep::SimCalorimeterHitCollection + "EcalLumiSpecHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"EcalLumiSpecClusters", // edm4eic::Cluster - "EcalLumiSpecClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalLumiSpecClustersWithoutShapes", // edm4eic::Cluster + "EcalLumiSpecClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -99,18 +100,29 @@ extern "C" { app // TODO: Remove me once fixed ) ); + app->Add( + new JOmniFactoryGeneratorT( + "EcalLumiSpecClusters", + {"EcalLumiSpecClustersWithoutShapes", + "EcalLumiSpecClusterAssociationsWithoutShapes"}, + {"EcalLumiSpecClusters", + "EcalLumiSpecClusterAssociations"}, + {}, + app + ) + ); app->Add( new JOmniFactoryGeneratorT( - "EcalLumiSpecTruthClusters", - {"EcalLumiSpecTruthProtoClusters", // edm4eic::ProtoClusterCollection + "EcalLumiSpecTruthClustersWithoutShapes", + {"EcalLumiSpecTruthProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "EcalLumiSpecRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "EcalLumiSpecRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "EcalLumiSpecHits"}, // edm4hep::SimCalorimeterHitCollection + "EcalLumiSpecHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"EcalLumiSpecTruthClusters", // edm4eic::Cluster - "EcalLumiSpecTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalLumiSpecTruthClustersWithoutShapes", // edm4eic::Cluster + "EcalLumiSpecTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, @@ -120,5 +132,16 @@ extern "C" { app // TODO: Remove me once fixed ) ); + app->Add( + new JOmniFactoryGeneratorT( + "EcalLumiSpecTruthClusters", + {"EcalLumiSpecTruthClustersWithoutShapes", + "EcalLumiSpecTruthClusterAssociationsWithoutShapes"}, + {"EcalLumiSpecTruthClusters", + "EcalLumiSpecTruthClusterAssociations"}, + {}, + app + ) + ); } } diff --git a/src/detectors/ZDC/ZDC.cc b/src/detectors/ZDC/ZDC.cc index 8a6d7954cc..b01cbeffa4 100644 --- a/src/detectors/ZDC/ZDC.cc +++ b/src/detectors/ZDC/ZDC.cc @@ -16,6 +16,7 @@ #include "factories/calorimetry/CalorimeterHitReco_factory.h" #include "factories/calorimetry/CalorimeterIslandCluster_factory.h" #include "factories/calorimetry/CalorimeterTruthClustering_factory.h" +#include "factories/calorimetry/CalorimeterClusterShape_factory.h" #include "factories/calorimetry/HEXPLIT_factory.h" #include "factories/calorimetry/ImagingTopoCluster_factory.h" @@ -82,48 +83,74 @@ extern "C" { app->Add( new JOmniFactoryGeneratorT( - "EcalFarForwardZDCTruthClusters", - {"EcalFarForwardZDCTruthProtoClusters", // edm4eic::ProtoClusterCollection + "EcalFarForwardZDCTruthClustersWithoutShapes", + {"EcalFarForwardZDCTruthProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "EcalFarForwardZDCRawHitAssociations"}, // edm4eic::MCRecoClusterHitAssociationCollection + "EcalFarForwardZDCRawHitAssociations"}, // edm4eic::MCRecoClusterHitAssociationCollection #else - "EcalFarForwardZDCHits"}, // edm4hep::SimCalorimeterHitCollection + "EcalFarForwardZDCHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"EcalFarForwardZDCTruthClusters", // edm4eic::Cluster - "EcalFarForwardZDCTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalFarForwardZDCTruthClustersWithoutShapes", // edm4eic::Cluster + "EcalFarForwardZDCTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, .logWeightBase = 3.6, - .longitudinalShowerInfoAvailable = true, .enableEtaBounds = false }, app // TODO: Remove me once fixed ) ); + app->Add( + new JOmniFactoryGeneratorT( + "EcalFarForwardZDCTruthClusters", + {"EcalFarForwardZDCTruthClustersWithoutShapes", + "EcalFarForwardZDCTruthClusterAssociationsWithoutShapes"}, + {"EcalFarForwardZDCTruthClusters", + "EcalFarForwardZDCTruthClusterAssociations"}, + { + .longitudinalShowerInfoAvailable = true + }, + app + ) + ); + app->Add( new JOmniFactoryGeneratorT( - "EcalFarForwardZDCClusters", - {"EcalFarForwardZDCIslandProtoClusters", // edm4eic::ProtoClusterCollection + "EcalFarForwardZDCClustersWithoutShapes", + {"EcalFarForwardZDCIslandProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "EcalFarForwardZDCRawHitAssociations"}, // edm4eic::MCRecoClusterHitAssociationCollection + "EcalFarForwardZDCRawHitAssociations"}, // edm4eic::MCRecoClusterHitAssociationCollection #else - "EcalFarForwardZDCHits"}, // edm4hep::SimCalorimeterHitCollection + "EcalFarForwardZDCHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"EcalFarForwardZDCClusters", // edm4eic::Cluster - "EcalFarForwardZDCClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"EcalFarForwardZDCClustersWithoutShapes", // edm4eic::Cluster + "EcalFarForwardZDCClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, .logWeightBase = 6.2, - .longitudinalShowerInfoAvailable = true, .enableEtaBounds = false, }, app // TODO: Remove me once fixed ) ); + app->Add( + new JOmniFactoryGeneratorT( + "EcalFarForwardZDCClusters", + {"EcalFarForwardZDCClustersWithoutShapes", + "EcalFarForwardZDCClusterAssociationsWithoutShapes"}, + {"EcalFarForwardZDCClusters", + "EcalFarForwardZDCClusterAssociations"}, + { + .longitudinalShowerInfoAvailable = true + }, + app + ) + ); + app->Add(new JOmniFactoryGeneratorT( "HcalFarForwardZDCRawHits", {"HcalFarForwardZDCHits"}, @@ -205,25 +232,38 @@ extern "C" { )); app->Add(new JOmniFactoryGeneratorT( - "HcalFarForwardZDCClusters", + "HcalFarForwardZDCClustersWithoutShapes", {"HcalFarForwardZDCImagingProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "HcalFarForwardZDCRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "HcalFarForwardZDCRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "HcalFarForwardZDCHits"}, // edm4hep::SimCalorimeterHitCollection + "HcalFarForwardZDCHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"HcalFarForwardZDCClusters", // edm4eic::Cluster - "HcalFarForwardZDCClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"HcalFarForwardZDCClustersWithoutShapes", // edm4eic::Cluster + "HcalFarForwardZDCClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 0.0203, .logWeightBaseCoeffs={5.8,0.65,0.31}, - .logWeightBase_Eref=50*dd4hep::GeV, - .longitudinalShowerInfoAvailable = true, + .logWeightBase_Eref=50*dd4hep::GeV }, app // TODO: Remove me once fixed )); + app->Add( + new JOmniFactoryGeneratorT( + "HcalFarForwardZDCClusters", + {"HcalFarForwardZDCClustersWithoutShapes", + "HcalFarForwardZDCClusterAssociationsWithoutShapes"}, + {"HcalFarForwardZDCClusters", + "HcalFarForwardZDCClusterAssociations"}, + { + .longitudinalShowerInfoAvailable = true + }, + app + ) + ); + app->Add(new JOmniFactoryGeneratorT( "HcalFarForwardZDCTruthProtoClusters", {"HcalFarForwardZDCRecHits", "HcalFarForwardZDCHits"}, {"HcalFarForwardZDCTruthProtoClusters"}, app // TODO: Remove me once fixed @@ -245,45 +285,71 @@ extern "C" { )); app->Add(new JOmniFactoryGeneratorT( - "HcalFarForwardZDCTruthClusters", - {"HcalFarForwardZDCTruthProtoClusters", // edm4eic::ProtoClusterCollection + "HcalFarForwardZDCTruthClustersWithoutShapes", + {"HcalFarForwardZDCTruthProtoClusters", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "HcalFarForwardZDCRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "HcalFarForwardZDCRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "HcalFarForwardZDCHits"}, // edm4hep::SimCalorimeterHitCollection + "HcalFarForwardZDCHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"HcalFarForwardZDCTruthClusters", // edm4eic::Cluster - "HcalFarForwardZDCTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation + {"HcalFarForwardZDCTruthClustersWithoutShapes", // edm4eic::Cluster + "HcalFarForwardZDCTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 1.0, .logWeightBase = 3.6, - .longitudinalShowerInfoAvailable = true, .enableEtaBounds = false }, app // TODO: Remove me once fixed ) ); + app->Add( + new JOmniFactoryGeneratorT( + "HcalFarForwardZDCTruthClusters", + {"HcalFarForwardZDCTruthClustersWithoutShapes", + "HcalFarForwardZDCTruthClusterAssociationsWithoutShapes"}, + {"HcalFarForwardZDCTruthClusters", + "HcalFarForwardZDCTruthClusterAssociations"}, + { + .longitudinalShowerInfoAvailable = true + }, + app + ) + ); + app->Add(new JOmniFactoryGeneratorT( - "HcalFarForwardZDCClustersBaseline", + "HcalFarForwardZDCClustersBaselineWithoutShapes", {"HcalFarForwardZDCIslandProtoClustersBaseline", // edm4eic::ProtoClusterCollection #if EDM4EIC_VERSION_MAJOR >= 7 - "HcalFarForwardZDCRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection + "HcalFarForwardZDCRawHitAssociations"}, // edm4eic::MCRecoCalorimeterHitAssociationCollection #else - "HcalFarForwardZDCHits"}, // edm4hep::SimCalorimeterHitCollection + "HcalFarForwardZDCHits"}, // edm4hep::SimCalorimeterHitCollection #endif - {"HcalFarForwardZDCClustersBaseline", // edm4eic::Cluster - "HcalFarForwardZDCClusterAssociationsBaseline"}, // edm4eic::MCRecoClusterParticleAssociation + {"HcalFarForwardZDCClustersBaselineWithoutShapes", // edm4eic::Cluster + "HcalFarForwardZDCClusterAssociationsBaselineWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation { .energyWeight = "log", .sampFrac = 0.0203, .logWeightBase = 6.2, - .longitudinalShowerInfoAvailable = true, .enableEtaBounds = false, }, app // TODO: Remove me once fixed ) ); + + app->Add( + new JOmniFactoryGeneratorT( + "HcalFarForwardZDCClustersBaselineWithShapes", + {"HcalFarForwardZDCClustersBaselineWithoutShapes", + "HcalFarForwardZDCClusterAssociationsBaselineWithoutShapes"}, + {"HcalFarForwardZDCClustersBaseline", + "HcalFarForwardZDCClusterAssociationsBaseline"}, + { + .longitudinalShowerInfoAvailable = true + }, + app + ) + ); } } diff --git a/src/factories/calorimetry/CalorimeterClusterRecoCoG_factory.h b/src/factories/calorimetry/CalorimeterClusterRecoCoG_factory.h index 7d8bd56eb6..cc5d2c7ded 100644 --- a/src/factories/calorimetry/CalorimeterClusterRecoCoG_factory.h +++ b/src/factories/calorimetry/CalorimeterClusterRecoCoG_factory.h @@ -35,7 +35,6 @@ class CalorimeterClusterRecoCoG_factory : public JOmniFactory m_logWeightBase {this, "logWeightBase", config().logWeightBase}; ParameterRef> m_logWeightBaseCoeffs {this, "logWeightBaseCoeffs", config().logWeightBaseCoeffs}; ParameterRef m_logWeightBase_Eref {this, "logWeightBase_Eref", config().logWeightBase_Eref}; - ParameterRef m_longitudinalShowerInfoAvailable {this, "longitudinalShowerInfoAvailable", config().longitudinalShowerInfoAvailable}; ParameterRef m_enableEtaBounds {this, "enableEtaBounds", config().enableEtaBounds}; Service m_algorithmsInit {this}; diff --git a/src/factories/calorimetry/CalorimeterClusterShape_factory.h b/src/factories/calorimetry/CalorimeterClusterShape_factory.h new file mode 100644 index 0000000000..9e3e88745c --- /dev/null +++ b/src/factories/calorimetry/CalorimeterClusterShape_factory.h @@ -0,0 +1,62 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later +// Copyright (C) 2025 Derek Anderson + +#pragma once + +#include "algorithms/calorimetry/CalorimeterClusterShape.h" +#include "extensions/jana/JOmniFactory.h" +#include "services/algorithms_init/AlgorithmsInit_service.h" + + + +namespace eicrecon { + + class CalorimeterClusterShape_factory + : public JOmniFactory + { + + public: + + using AlgoT = eicrecon::CalorimeterClusterShape; + + private: + + // algorithm to run + std::unique_ptr m_algo; + + // input collections + PodioInput m_clusters_input {this}; + PodioInput m_assocs_input {this}; + + // output collections + PodioOutput m_clusters_output {this}; + PodioOutput m_assocs_output {this}; + + // parameter bindings + ParameterRef m_longitudinalShowerInfoAvailable {this, "longitudinalShowerInfoAvailable", config().longitudinalShowerInfoAvailable}; + + // services + Service m_algoInitSvc {this}; + + public: + + void Configure() { + m_algo = std::make_unique( GetPrefix() ); + m_algo->applyConfig( config() ); + m_algo->init(); + } + + void ChangeRun(int64_t run_number) { + //... nothing to do ...// + } + + void Process(int64_t run_number, int64_t event_number) { + m_algo->process( + {m_clusters_input(), m_assocs_input()}, + {m_clusters_output().get(), m_assocs_output().get()} + ); + } + + }; // end CalorimeterClusterShape_factory + +} // end eicrecon namespace diff --git a/src/tests/algorithms_test/calorimetry_CalorimeterClusterRecoCoG.cc b/src/tests/algorithms_test/calorimetry_CalorimeterClusterRecoCoG.cc index 4d79c63fb2..746077a981 100644 --- a/src/tests/algorithms_test/calorimetry_CalorimeterClusterRecoCoG.cc +++ b/src/tests/algorithms_test/calorimetry_CalorimeterClusterRecoCoG.cc @@ -31,30 +31,42 @@ #include "algorithms/calorimetry/CalorimeterClusterRecoCoG.h" // for CalorimeterClusterRecoCoG #include "algorithms/calorimetry/CalorimeterClusterRecoCoGConfig.h" // for CalorimeterClusterRecoCoGConfig +#include "algorithms/calorimetry/CalorimeterClusterShape.h" // for CalorimeterClusterShape +#include "algorithms/calorimetry/CalorimeterClusterShapeConfig.h" // for CalorimeterClusterShapeConfig using eicrecon::CalorimeterClusterRecoCoG; using eicrecon::CalorimeterClusterRecoCoGConfig; +using eicrecon::CalorimeterClusterShape; +using eicrecon::CalorimeterClusterShapeConfig; using edm4eic::CalorimeterHit; -TEST_CASE( "the calorimeter CoG algorithm runs", "[CalorimeterClusterRecoCoG]" ) { +TEST_CASE( "the calorimeter CoG and shape algorithm runs", "[CalorimeterClusterRecoCoG]" ) { const float EPSILON = 1e-5; - CalorimeterClusterRecoCoG algo("CalorimeterClusterRecoCoG"); + CalorimeterClusterRecoCoG algo_reco("CalorimeterClusterRecoCoG"); + CalorimeterClusterShape algo_shape("CalorimeterClusterShape"); std::shared_ptr logger = spdlog::default_logger()->clone("CalorimeterClusterRecoCoG"); logger->set_level(spdlog::level::trace); - CalorimeterClusterRecoCoGConfig cfg; - cfg.energyWeight = "log"; - cfg.sampFrac = 0.0203; - cfg.logWeightBaseCoeffs = {5.0,0.65,0.31}; - cfg.logWeightBase_Eref = 50 * edm4eic::unit::GeV; - cfg.longitudinalShowerInfoAvailable = true; + // configure RecoCoG + CalorimeterClusterRecoCoGConfig cfg_reco; + cfg_reco.energyWeight = "log"; + cfg_reco.sampFrac = 0.0203; + cfg_reco.logWeightBaseCoeffs = {5.0,0.65,0.31}; + cfg_reco.logWeightBase_Eref = 50 * edm4eic::unit::GeV; + // configure Shape + CalorimeterClusterShapeConfig cfg_shape; + cfg_shape.longitudinalShowerInfoAvailable = true; - algo.applyConfig(cfg); - algo.init(); + // apply configurations + algo_reco.applyConfig(cfg_reco); + algo_reco.init(); + + algo_shape.applyConfig(cfg_shape); + algo_shape.init(); edm4hep::RawCalorimeterHitCollection rawhits_coll; edm4eic::CalorimeterHitCollection hits_coll; @@ -65,8 +77,8 @@ TEST_CASE( "the calorimeter CoG algorithm runs", "[CalorimeterClusterRecoCoG]" ) #endif edm4hep::CaloHitContributionCollection contribs_coll; edm4hep::MCParticleCollection mcparts_coll; - auto assoc_coll = std::make_unique(); - auto clust_coll = std::make_unique(); + auto assoc_coll_reco = std::make_unique(); + auto clust_coll_reco = std::make_unique(); //create a protocluster with 3 hits auto pclust = pclust_coll.create(); @@ -205,30 +217,41 @@ TEST_CASE( "the calorimeter CoG algorithm runs", "[CalorimeterClusterRecoCoG]" ) // Constructing input and output as per the algorithm's expected signature #if EDM4EIC_VERSION_MAJOR >= 7 - auto input = std::make_tuple(&pclust_coll, &hitassocs_coll); + auto input_reco = std::make_tuple(&pclust_coll, &hitassocs_coll); #else - auto input = std::make_tuple(&pclust_coll, &simhits_coll); + auto input_reco = std::make_tuple(&pclust_coll, &simhits_coll); #endif - auto output = std::make_tuple(clust_coll.get(), assoc_coll.get()); + auto output_reco = std::make_tuple(clust_coll_reco.get(), assoc_coll_reco.get()); + + algo_reco.process(input_reco, output_reco); + + // create collections to hold shape output + auto assoc_coll_shape = std::make_unique(); + auto clust_coll_shape = std::make_unique(); + + // collect input/output for shape algorithm + auto input_shape = std::make_tuple(clust_coll_reco.get(), assoc_coll_reco.get()); + auto output_shape = std::make_tuple(clust_coll_shape.get(), assoc_coll_shape.get()); - algo.process(input, output); + // Run shape calculation on output of RecoCoG + algo_shape.process(input_shape, output_shape); - REQUIRE(clust_coll->size() == 1); - auto clust = (*clust_coll)[0]; + REQUIRE(clust_coll_shape->size() == 1); + auto clust = (*clust_coll_shape)[0]; REQUIRE_THAT(clust.getIntrinsicTheta(), Catch::Matchers::WithinAbs(M_PI / 4, EPSILON)); // std::abs() checks if we land on -M_PI REQUIRE_THAT(std::abs(clust.getIntrinsicPhi()), Catch::Matchers::WithinAbs(M_PI, EPSILON)); - REQUIRE(assoc_coll->size() == 2); + REQUIRE(assoc_coll_shape->size() == 2); // Half of the energy comes from mcpart11 and its daughter mcpart12 - REQUIRE_THAT((*assoc_coll)[0].getWeight(), Catch::Matchers::WithinAbs(0.5, EPSILON)); - REQUIRE((*assoc_coll)[0].getRec() == clust); - REQUIRE((*assoc_coll)[0].getSim() == mcpart11); + REQUIRE_THAT((*assoc_coll_shape)[0].getWeight(), Catch::Matchers::WithinAbs(0.5, EPSILON)); + REQUIRE((*assoc_coll_shape)[0].getRec() == clust); + REQUIRE((*assoc_coll_shape)[0].getSim() == mcpart11); // Half of the energy comes from mcpart2 - REQUIRE_THAT((*assoc_coll)[1].getWeight(), Catch::Matchers::WithinAbs(0.5, EPSILON)); - REQUIRE((*assoc_coll)[1].getRec() == clust); - REQUIRE((*assoc_coll)[1].getSim() == mcpart2); + REQUIRE_THAT((*assoc_coll_shape)[1].getWeight(), Catch::Matchers::WithinAbs(0.5, EPSILON)); + REQUIRE((*assoc_coll_shape)[1].getRec() == clust); + REQUIRE((*assoc_coll_shape)[1].getSim() == mcpart2); }