Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-08 08:53:00

0001 /// ===========================================================================
0002 /*! \file    ClusterMergedHitsProcessor.c
0003  *  \authors Derek Anderson
0004  *  \date    05.28.2025
0005  *
0006  *  A small EICrecon plugin to cluster
0007  *  merged BHCal hits.
0008  */
0009 /// ===========================================================================
0010 
0011 // plugin definition
0012 #include "ClusterMergedHitsProcessor.h"
0013 
0014 // general dependencies
0015 #include <edm4eic/EDM4eicVersion.h>
0016 #include <Evaluator/DD4hepUnits.h>
0017 #include <JANA/JApplication.h>
0018 #include <memory>
0019 
0020 // eicrecon-specific components
0021 #include <extensions/jana/JOmniFactoryGeneratorT.h>
0022 #include <factories/calorimetry/CalorimeterClusterRecoCoG_factory.h>
0023 #include <factories/calorimetry/CalorimeterClusterShape_factory.h>
0024 #include <factories/calorimetry/CalorimeterIslandCluster_factory.h>
0025 #include <services/rootfile/RootFile_service.h>
0026 
0027 
0028 
0029 // the following makes this a JANA plugin and adds relevant factories
0030 extern "C" {
0031 
0032   // --------------------------------------------------------------------------
0033   //! Initialize plugin and add to app
0034   // --------------------------------------------------------------------------
0035   /*! This initializes the plugins and wires in
0036    *  the following factories:
0037    *    - HcalBarrelMergedHitIslandProtoClusters
0038    *    - HcalBarrelMergedHitClustersWithoutShapes
0039    *    - HcalBarrelMergedHitClusters
0040    */ 
0041   void InitPlugin(JApplication* app) {
0042 
0043     // supress eicrecon namespace
0044     using namespace eicrecon;
0045 
0046     // initialize, add to app
0047     InitJANAPlugin(app);
0048     app -> Add(new ClusterMergedHitsProcessor);
0049 
0050     // run island clustering on merged hits
0051     app->Add(
0052       new JOmniFactoryGeneratorT<CalorimeterIslandCluster_factory>(
0053          "HcalBarrelMergedHitIslandProtoClusters",
0054         {"HcalBarrelMergedHits"},
0055         {"HcalBarrelMergedHitIslandProtoClusters"},
0056         {
0057           .adjacencyMatrix =
0058             "("
0059             "  ( (abs(eta_1 - eta_2) == 1) && (abs(phi_1 - phi_2) == 0) ) ||"
0060             "  ( (abs(eta_1 - eta_2) == 0) && (abs(phi_1 - phi_2) == 1) ) ||"
0061             "  ( (abs(eta_1 - eta_2) == 0) && (abs(phi_1 - phi_2) == (320 - 1)) )"
0062             ") == 1",
0063           .readout = "HcalBarrelHits",
0064           .sectorDist = 5.0 * dd4hep::cm,
0065           .splitCluster = false,
0066           .minClusterHitEdep = 5.0 * dd4hep::MeV,
0067           .minClusterCenterEdep = 30.0 * dd4hep::MeV,
0068           .transverseEnergyProfileMetric = "globalDistEtaPhi",
0069           .transverseEnergyProfileScale = 1.,
0070         },
0071         app   // TODO: Remove me once fixed
0072       )
0073     );
0074 
0075     // run CoG reconstruction on merged hit clusters
0076     app->Add(
0077       new JOmniFactoryGeneratorT<CalorimeterClusterRecoCoG_factory>(
0078          "HcalBarrelMergedHitClustersWithoutShapes",
0079         {"HcalBarrelMergedHitIslandProtoClusters",
0080          "HcalBarrelRawHitAssociations"},
0081         {"HcalBarrelMergedHitClustersWithoutShapes",
0082          "HcalBarrelMergedHitClusterAssociationsWithoutShapes"},
0083         {
0084           .energyWeight = "log",
0085           .sampFrac = 1.0,
0086           .logWeightBase = 6.2,
0087           .enableEtaBounds = false
0088         },
0089         app   // TODO: Remove me once fixed
0090       )
0091     );
0092 
0093     // run cluster shape calculation on merged hit cluters
0094     app->Add(
0095       new JOmniFactoryGeneratorT<CalorimeterClusterShape_factory>(
0096          "HcalBarrelMergedHitClusters",
0097         {"HcalBarrelMergedHitClustersWithoutShapes",
0098          "HcalBarrelMergedHitClusterAssociationsWithoutShapes"},
0099         {"HcalBarrelMergedHitClusters",
0100          "HcalBarrelMergedHitClusterAssociations"},
0101         {
0102           .energyWeight = "log",
0103           .logWeightBase = 6.2
0104         },
0105         app
0106       )
0107     );
0108 
0109   }  // end 'InitPlugin(JApplication*)'
0110 
0111 }  // end extern "C"
0112 
0113 /// end =======================================================================