Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 07:55:47

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2021 - 2025, Chao Peng, Sylvester Joosten, Whitney Armstrong, David Lawrence, Friederike Bock, Wouter Deconinck, Kolja Kauder, Sebouh Paul
0003 
0004 #include <Evaluator/DD4hepUnits.h>
0005 #include <JANA/JApplicationFwd.h>
0006 #include <cmath>
0007 #include <edm4eic/EDM4eicVersion.h>
0008 #include <string>
0009 
0010 #include "algorithms/calorimetry/CalorimeterHitDigiConfig.h"
0011 #include "extensions/jana/JOmniFactoryGeneratorT.h"
0012 #include "factories/calorimetry/CalorimeterClusterRecoCoG_factory.h"
0013 #include "factories/calorimetry/CalorimeterHitDigi_factory.h"
0014 #include "factories/calorimetry/CalorimeterHitReco_factory.h"
0015 #include "factories/calorimetry/CalorimeterIslandCluster_factory.h"
0016 #include "factories/calorimetry/CalorimeterTruthClustering_factory.h"
0017 #include "factories/calorimetry/CalorimeterClusterShape_factory.h"
0018 #include "factories/calorimetry/TrackClusterMergeSplitter_factory.h"
0019 
0020 extern "C" {
0021 void InitPlugin(JApplication* app) {
0022 
0023   using namespace eicrecon;
0024 
0025   InitJANAPlugin(app);
0026   // Make sure digi and reco use the same value
0027   decltype(CalorimeterHitDigiConfig::capADC) EcalEndcapP_capADC =
0028       16384; //16384, assuming 14 bits. For approximate HGCROC resolution use 65536
0029   decltype(CalorimeterHitDigiConfig::dyRangeADC) EcalEndcapP_dyRangeADC   = 3 * dd4hep::GeV;
0030   decltype(CalorimeterHitDigiConfig::pedMeanADC) EcalEndcapP_pedMeanADC   = 200;
0031   decltype(CalorimeterHitDigiConfig::pedSigmaADC) EcalEndcapP_pedSigmaADC = 2.4576;
0032   decltype(CalorimeterHitDigiConfig::resolutionTDC) EcalEndcapP_resolutionTDC =
0033       10 * dd4hep::picosecond;
0034   app->Add(new JOmniFactoryGeneratorT<CalorimeterHitDigi_factory>(
0035       "EcalEndcapPRawHits", {"EcalEndcapPHits"},
0036 #if EDM4EIC_VERSION_MAJOR >= 7
0037       {"EcalEndcapPRawHits", "EcalEndcapPRawHitAssociations"},
0038 #else
0039       {"EcalEndcapPRawHits"},
0040 #endif
0041       {
0042           .eRes      = {0.11333 * sqrt(dd4hep::GeV), 0.03,
0043                         0.0 * dd4hep::GeV}, // (11.333% / sqrt(E)) \oplus 3%
0044           .tRes      = 0.0,
0045           .threshold = 0.0,
0046           // .threshold = 15 * dd4hep::MeV for a single tower, applied on ADC level
0047           .capADC        = EcalEndcapP_capADC,
0048           .capTime       = 100, // given in ns, 4 samples in HGCROC
0049           .dyRangeADC    = EcalEndcapP_dyRangeADC,
0050           .pedMeanADC    = EcalEndcapP_pedMeanADC,
0051           .pedSigmaADC   = EcalEndcapP_pedSigmaADC,
0052           .resolutionTDC = EcalEndcapP_resolutionTDC,
0053           .corrMeanScale = "0.03",
0054           .readout       = "EcalEndcapPHits",
0055       },
0056       app // TODO: Remove me once fixed
0057       ));
0058   app->Add(new JOmniFactoryGeneratorT<CalorimeterHitReco_factory>(
0059       "EcalEndcapPRecHits", {"EcalEndcapPRawHits"}, {"EcalEndcapPRecHits"},
0060       {
0061           .capADC          = EcalEndcapP_capADC,
0062           .dyRangeADC      = EcalEndcapP_dyRangeADC,
0063           .pedMeanADC      = EcalEndcapP_pedMeanADC,
0064           .pedSigmaADC     = EcalEndcapP_pedSigmaADC,
0065           .resolutionTDC   = EcalEndcapP_resolutionTDC,
0066           .thresholdFactor = 0.0,
0067           .thresholdValue =
0068               2, // The ADC of a 15 MeV particle is adc = 200 + 15 * 0.03 * ( 1.0 + 0) / 3000 * 16384 = 200 + 2.4576
0069           .sampFrac = "0.03",
0070           .readout  = "EcalEndcapPHits",
0071       },
0072       app // TODO: Remove me once fixed
0073       ));
0074   app->Add(new JOmniFactoryGeneratorT<CalorimeterTruthClustering_factory>(
0075       "EcalEndcapPTruthProtoClusters", {"EcalEndcapPRecHits", "EcalEndcapPHits"},
0076       {"EcalEndcapPTruthProtoClusters"},
0077       app // TODO: Remove me once fixed
0078       ));
0079   app->Add(new JOmniFactoryGeneratorT<CalorimeterIslandCluster_factory>(
0080       "EcalEndcapPIslandProtoClusters", {"EcalEndcapPRecHits"}, {"EcalEndcapPIslandProtoClusters"},
0081       {.adjacencyMatrix{},
0082        .peakNeighbourhoodMatrix{},
0083        .readout{},
0084        .sectorDist = 5.0 * dd4hep::cm,
0085        .localDistXY{},
0086        .localDistXZ{},
0087        .localDistYZ{},
0088        .globalDistRPhi{},
0089        .globalDistEtaPhi{},
0090        .dimScaledLocalDistXY          = {1.5, 1.5},
0091        .splitCluster                  = false,
0092        .minClusterHitEdep             = 0.0 * dd4hep::MeV,
0093        .minClusterCenterEdep          = 60.0 * dd4hep::MeV,
0094        .transverseEnergyProfileMetric = "dimScaledLocalDistXY",
0095        .transverseEnergyProfileScale  = 1.,
0096        .transverseEnergyProfileScaleUnits{}},
0097       app // TODO: Remove me once fixed
0098       ));
0099 
0100   app->Add(new JOmniFactoryGeneratorT<CalorimeterClusterRecoCoG_factory>(
0101       "EcalEndcapPTruthClustersWithoutShapes",
0102       {
0103         "EcalEndcapPTruthProtoClusters", // edm4eic::ProtoClusterCollection
0104 #if EDM4EIC_VERSION_MAJOR >= 7
0105             "EcalEndcapPRawHitAssociations"
0106       }, // edm4eic::MCRecoCalorimeterHitAssociationCollection
0107 #else
0108             "EcalEndcapPHits"
0109       }, // edm4hep::SimCalorimeterHitCollection
0110 #endif
0111       {"EcalEndcapPTruthClustersWithoutShapes",             // edm4eic::Cluster
0112        "EcalEndcapPTruthClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation
0113       {.energyWeight = "log", .sampFrac = 1.0, .logWeightBase = 6.2, .enableEtaBounds = true},
0114       app // TODO: Remove me once fixed
0115       ));
0116 
0117   app->Add(new JOmniFactoryGeneratorT<CalorimeterClusterShape_factory>(
0118       "EcalEndcapPTruthClusters",
0119       {"EcalEndcapPTruthClustersWithoutShapes", "EcalEndcapPTruthClusterAssociationsWithoutShapes"},
0120       {"EcalEndcapPTruthClusters", "EcalEndcapPTruthClusterAssociations"},
0121       {.energyWeight = "log", .logWeightBase = 6.2}, app));
0122 
0123   app->Add(new JOmniFactoryGeneratorT<CalorimeterClusterRecoCoG_factory>(
0124       "EcalEndcapPClustersWithoutShapes",
0125       {
0126         "EcalEndcapPIslandProtoClusters", // edm4eic::ProtoClusterCollection
0127 #if EDM4EIC_VERSION_MAJOR >= 7
0128             "EcalEndcapPRawHitAssociations"
0129       }, // edm4eic::MCRecoCalorimeterHitAssociationCollection
0130 #else
0131             "EcalEndcapPHits"
0132       }, // edm4hep::SimCalorimeterHitCollection
0133 #endif
0134       {"EcalEndcapPClustersWithoutShapes",             // edm4eic::Cluster
0135        "EcalEndcapPClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation
0136       {
0137           .energyWeight    = "log",
0138           .sampFrac        = 1.0,
0139           .logWeightBase   = 3.6,
0140           .enableEtaBounds = false,
0141       },
0142       app // TODO: Remove me once fixed
0143       ));
0144 
0145   app->Add(new JOmniFactoryGeneratorT<CalorimeterClusterShape_factory>(
0146       "EcalEndcapPClusters",
0147       {"EcalEndcapPClustersWithoutShapes", "EcalEndcapPClusterAssociationsWithoutShapes"},
0148       {"EcalEndcapPClusters", "EcalEndcapPClusterAssociations"},
0149       {.energyWeight = "log", .logWeightBase = 3.6}, app));
0150 
0151   app->Add(new JOmniFactoryGeneratorT<TrackClusterMergeSplitter_factory>(
0152       "EcalEndcapPSplitMergeProtoClusters",
0153       {"EcalEndcapPIslandProtoClusters", "CalorimeterTrackProjections"},
0154       {"EcalEndcapPSplitMergeProtoClusters"},
0155       {.idCalo                       = "EcalEndcapP_ID",
0156        .minSigCut                    = -2.0,
0157        .avgEP                        = 1.0,
0158        .sigEP                        = 0.10,
0159        .drAdd                        = 0.30,
0160        .sampFrac                     = 1.0,
0161        .transverseEnergyProfileScale = 1.0},
0162       app // TODO: remove me once fixed
0163       ));
0164 
0165   app->Add(new JOmniFactoryGeneratorT<CalorimeterClusterRecoCoG_factory>(
0166       "EcalEndcapPSplitMergeClustersWithoutShapes",
0167       {
0168         "EcalEndcapPSplitMergeProtoClusters", // edm4eic::ProtoClusterCollection
0169 #if EDM4EIC_VERSION_MAJOR >= 7
0170             "EcalEndcapPRawHitAssociations"
0171       }, // edm4hep::MCRecoCalorimeterHitAssociationCollection
0172 #else
0173             "EcalEndcapPHits"
0174       }, // edm4hep::SimCalorimeterHitCollection
0175 #endif
0176       {"EcalEndcapPSplitMergeClustersWithoutShapes",             // edm4eic::Cluster
0177        "EcalEndcapPSplitMergeClusterAssociationsWithoutShapes"}, // edm4eic::MCRecoClusterParticleAssociation
0178       {.energyWeight = "log", .sampFrac = 1.0, .logWeightBase = 3.6, .enableEtaBounds = false},
0179       app // TODO: Remove me once fixed
0180       ));
0181 
0182   app->Add(new JOmniFactoryGeneratorT<CalorimeterClusterShape_factory>(
0183       "EcalEndcapPSplitMergeClusters",
0184       {"EcalEndcapPSplitMergeClustersWithoutShapes",
0185        "EcalEndcapPSplitMergeClusterAssociationsWithoutShapes"},
0186       {"EcalEndcapPSplitMergeClusters", "EcalEndcapPSplitMergeClusterAssociations"},
0187       {.energyWeight = "log", .logWeightBase = 3.6}, app));
0188 }
0189 }