Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 08:29:10

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2022 - 2025 Whitney Armstrong, Sylvester Joosten, Chao Peng, David Lawrence, Wouter Deconinck, Kolja Kauder, Nathan Brei, Dmitry Kalinkin, Derek Anderson, Michael Pitt
0003 
0004 #include <Evaluator/DD4hepUnits.h>
0005 #include <JANA/JApplicationFwd.h>
0006 #include <JANA/Utils/JTypeInfo.h>
0007 #include <cmath>
0008 #include <string>
0009 #include <variant>
0010 #include <vector>
0011 
0012 #include "extensions/jana/JOmniFactoryGeneratorT.h"
0013 #include "factories/calorimetry/CalorimeterClusterRecoCoG_factory.h"
0014 #include "factories/calorimetry/CalorimeterClusterShape_factory.h"
0015 #include "factories/calorimetry/CalorimeterHitDigi_factory.h"
0016 #include "factories/calorimetry/CalorimeterHitReco_factory.h"
0017 #include "factories/calorimetry/CalorimeterIslandCluster_factory.h"
0018 #include "factories/calorimetry/CalorimeterTruthClustering_factory.h"
0019 
0020 extern "C" {
0021 void InitPlugin(JApplication* app) {
0022 
0023   using namespace eicrecon;
0024 
0025   InitJANAPlugin(app);
0026 
0027   app->Add(new JOmniFactoryGeneratorT<CalorimeterHitDigi_factory>(
0028       "B0ECalRawHits", {"EventHeader", "B0ECalHits"},
0029       {"B0ECalRawHits", "B0ECalRawHitLinks", "B0ECalRawHitAssociations"},
0030       {
0031           // The stochastic term is set using light yield in PbOW4 of N_photons = 145.75 / GeV / mm, for 6x6 mm2 sensors with PDE=0.18 (a=1/sqrt(145.75*36*0.18))
0032           .eRes          = {0.0326 * sqrt(dd4hep::GeV), 0.00, 0.0 * dd4hep::GeV},
0033           .tRes          = 0.0 * dd4hep::ns,
0034           .threshold     = 5.0 * dd4hep::MeV,
0035           .capADC        = 16384,
0036           .dyRangeADC    = 170 * dd4hep::GeV,
0037           .pedMeanADC    = 100,
0038           .pedSigmaADC   = 1,
0039           .resolutionTDC = 1e-11,
0040           .corrMeanScale = "1.0",
0041           .readout       = "B0ECalHits",
0042       },
0043       app));
0044   app->Add(new JOmniFactoryGeneratorT<CalorimeterHitReco_factory>(
0045       "B0ECalRecHits", {"B0ECalRawHits"}, {"B0ECalRecHits"},
0046       {
0047           .capADC          = 16384,
0048           .dyRangeADC      = 170. * dd4hep::GeV,
0049           .pedMeanADC      = 100,
0050           .pedSigmaADC     = 1,
0051           .resolutionTDC   = 1e-11,
0052           .thresholdFactor = 0.0,
0053           .thresholdValue  = 1.0, // using threshold of 10 photons = 10 MeV = 1 ADC
0054           .sampFrac        = "0.998",
0055           .readout         = "B0ECalHits",
0056           .sectorField     = "sector",
0057       },
0058       app));
0059   app->Add(new JOmniFactoryGeneratorT<CalorimeterTruthClustering_factory>(
0060       "B0ECalTruthProtoClusters", {"B0ECalRecHits", "B0ECalRawHitLinks"},
0061       {"B0ECalTruthProtoClusters"}, app));
0062   app->Add(new JOmniFactoryGeneratorT<CalorimeterIslandCluster_factory>(
0063       "B0ECalIslandProtoClusters", {"B0ECalRecHits"}, {"B0ECalIslandProtoClusters"},
0064       {
0065           .adjacencyMatrix{},
0066           .peakNeighbourhoodMatrix{},
0067           .readout{},
0068           .sectorDist = 5.0 * dd4hep::cm,
0069           .localDistXY{},
0070           .localDistXZ{},
0071           .localDistYZ{},
0072           .globalDistRPhi{},
0073           .globalDistEtaPhi{},
0074           .dimScaledLocalDistXY          = {1.8, 1.8},
0075           .splitCluster                  = false,
0076           .minClusterHitEdep             = 1.0 * dd4hep::MeV,
0077           .minClusterCenterEdep          = 30.0 * dd4hep::MeV,
0078           .transverseEnergyProfileMetric = "globalDistEtaPhi",
0079           .transverseEnergyProfileScale  = 1.,
0080           .transverseEnergyProfileScaleUnits{},
0081       },
0082       app));
0083 
0084   app->Add(new JOmniFactoryGeneratorT<CalorimeterClusterRecoCoG_factory>(
0085       "B0ECalClustersWithoutShapes",
0086       {
0087           "B0ECalIslandProtoClusters", // edm4eic::ProtoClusterCollection
0088           "B0ECalRawHitLinks",         // edm4eic::MCRecoCalorimeterHitLink
0089           "B0ECalRawHitAssociations"   // edm4eic::MCRecoCalorimeterHitAssociationCollection
0090       },
0091       {"B0ECalClustersWithoutShapes", // edm4eic::Cluster
0092        "B0ECalClusterLinksWithoutShapes",
0093        "B0ECalClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation
0094       {.energyWeight = "log", .sampFrac = 1.0, .logWeightBase = 3.6, .enableEtaBounds = false},
0095       app));
0096 
0097   app->Add(new JOmniFactoryGeneratorT<CalorimeterClusterShape_factory>(
0098       "B0ECalClusters", {"B0ECalClustersWithoutShapes", "B0ECalClusterLinksWithoutShapes"},
0099       {"B0ECalClusters", "B0ECalClusterLinks", "B0ECalClusterAssociations"},
0100       {.energyWeight = "log", .logWeightBase = 3.6}, app));
0101 
0102   app->Add(new JOmniFactoryGeneratorT<CalorimeterClusterRecoCoG_factory>(
0103       "B0ECalTruthClustersWithoutShapes",
0104       {
0105           "B0ECalTruthProtoClusters", // edm4eic::ProtoClusterCollection
0106           "B0ECalRawHitLinks",        // edm4eic::MCRecoCalorimeterHitLink
0107           "B0ECalRawHitAssociations"  // edm4eic::MCRecoCalorimeterHitAssociationCollection
0108       },
0109       {"B0ECalTruthClustersWithoutShapes", // edm4eic::Cluster
0110        "B0ECalTruthClusterLinksWithoutShapes",
0111        "B0ECalTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation
0112       {.energyWeight = "log", .sampFrac = 1.0, .logWeightBase = 6.2, .enableEtaBounds = false},
0113       app));
0114 
0115   app->Add(new JOmniFactoryGeneratorT<CalorimeterClusterShape_factory>(
0116       "B0ECalTruthClusters",
0117       {"B0ECalTruthClustersWithoutShapes", "B0ECalTruthClusterLinksWithoutShapes"},
0118       {"B0ECalTruthClusters", "B0ECalTruthClusterLinks", "B0ECalTruthClusterAssociations"},
0119       {.energyWeight = "log", .logWeightBase = 6.2}, app));
0120 }
0121 }