Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-09-27 07:03:04

0001 // Copyright 2022, David Lawrence
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 //
0004 //
0005 
0006 #include <edm4eic/EDM4eicVersion.h>
0007 #include <Evaluator/DD4hepUnits.h>
0008 #include <JANA/JApplication.h>
0009 #include <math.h>
0010 #include <string>
0011 
0012 #include "algorithms/calorimetry/CalorimeterHitDigiConfig.h"
0013 #include "extensions/jana/JOmniFactoryGeneratorT.h"
0014 #include "factories/calorimetry/CalorimeterClusterRecoCoG_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 #include "factories/calorimetry/TrackClusterMergeSplitter_factory.h"
0020 
0021 extern "C" {
0022     void InitPlugin(JApplication *app) {
0023 
0024         using namespace eicrecon;
0025 
0026         InitJANAPlugin(app);
0027 
0028         // Make sure digi and reco use the same value
0029         decltype(CalorimeterHitDigiConfig::capADC)        EcalEndcapN_capADC = 16384; //65536,  16bit ADC
0030         decltype(CalorimeterHitDigiConfig::dyRangeADC)    EcalEndcapN_dyRangeADC = 20.0 * dd4hep::GeV;
0031         decltype(CalorimeterHitDigiConfig::pedMeanADC)    EcalEndcapN_pedMeanADC = 20;
0032         decltype(CalorimeterHitDigiConfig::pedSigmaADC)   EcalEndcapN_pedSigmaADC = 1;
0033         decltype(CalorimeterHitDigiConfig::resolutionTDC) EcalEndcapN_resolutionTDC = 10 * dd4hep::picosecond;
0034         app->Add(new JOmniFactoryGeneratorT<CalorimeterHitDigi_factory>(
0035           "EcalEndcapNRawHits",
0036           {"EcalEndcapNHits"},
0037 #if EDM4EIC_VERSION_MAJOR >= 7
0038           {"EcalEndcapNRawHits", "EcalEndcapNRawHitAssociations"},
0039 #else
0040           {"EcalEndcapNRawHits"},
0041 #endif
0042           {
0043             .eRes = {0.0 * sqrt(dd4hep::GeV), 0.02, 0.0 * dd4hep::GeV},
0044             .tRes = 0.0 * dd4hep::ns,
0045             .threshold =  0.0 * dd4hep::MeV,  // Use ADC cut instead
0046             .capADC = EcalEndcapN_capADC,
0047             .dyRangeADC = EcalEndcapN_dyRangeADC,
0048             .pedMeanADC = EcalEndcapN_pedMeanADC,
0049             .pedSigmaADC = EcalEndcapN_pedSigmaADC,
0050             .resolutionTDC = EcalEndcapN_resolutionTDC,
0051             .corrMeanScale = "1.0",
0052             .readout = "EcalEndcapNHits",
0053           },
0054           app   // TODO: Remove me once fixed
0055         ));
0056         app->Add(new JOmniFactoryGeneratorT<CalorimeterHitReco_factory>(
0057           "EcalEndcapNRecHits", {"EcalEndcapNRawHits"}, {"EcalEndcapNRecHits"},
0058           {
0059             .capADC = EcalEndcapN_capADC,
0060             .dyRangeADC = EcalEndcapN_dyRangeADC,
0061             .pedMeanADC = EcalEndcapN_pedMeanADC,
0062             .pedSigmaADC = EcalEndcapN_pedSigmaADC,
0063             .resolutionTDC = EcalEndcapN_resolutionTDC,
0064             .thresholdFactor = 0.0,
0065             .thresholdValue = 4.0, // (20. GeV / 16384) * 4 ~= 5 MeV
0066             .sampFrac = "0.998",
0067             .readout = "EcalEndcapNHits",
0068             .sectorField = "sector",
0069           },
0070           app   // TODO: Remove me once fixed
0071         ));
0072         app->Add(new JOmniFactoryGeneratorT<CalorimeterTruthClustering_factory>(
0073           "EcalEndcapNTruthProtoClusters", {"EcalEndcapNRecHits", "EcalEndcapNHits"}, {"EcalEndcapNTruthProtoClusters"},
0074           app   // TODO: Remove me once fixed
0075         ));
0076         app->Add(new JOmniFactoryGeneratorT<CalorimeterIslandCluster_factory>(
0077           "EcalEndcapNIslandProtoClusters", {"EcalEndcapNRecHits"}, {"EcalEndcapNIslandProtoClusters"},
0078           {
0079             .adjacencyMatrix = "(abs(row_1 - row_2) + abs(column_1 - column_2)) == 1",
0080             .peakNeighbourhoodMatrix = "max(abs(row_1 - row_2), abs(column_1 - column_2)) == 1",
0081             .readout = "EcalEndcapNHits",
0082             .sectorDist = 5.0 * dd4hep::cm,
0083             .splitCluster = true,
0084             .minClusterHitEdep = 1.0 * dd4hep::MeV,
0085             .minClusterCenterEdep = 30.0 * dd4hep::MeV,
0086             .transverseEnergyProfileMetric = "globalDistEtaPhi",
0087             .transverseEnergyProfileScale = 0.08,
0088           },
0089           app   // TODO: Remove me once fixed
0090         ));
0091 
0092         app->Add(
0093           new JOmniFactoryGeneratorT<CalorimeterClusterRecoCoG_factory>(
0094              "EcalEndcapNTruthClusters",
0095             {"EcalEndcapNTruthProtoClusters",        // edm4eic::ProtoClusterCollection
0096 #if EDM4EIC_VERSION_MAJOR >= 7
0097              "EcalEndcapNRawHitAssociations"},       // edm4eic::MCRecoCalorimeterHitAssociationCollection
0098 #else
0099              "EcalEndcapNHits"},                     // edm4hep::SimCalorimeterHitCollection
0100 #endif
0101             {"EcalEndcapNTruthClusters",             // edm4eic::Cluster
0102              "EcalEndcapNTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation
0103             {
0104               .energyWeight = "log",
0105               .sampFrac = 1.0,
0106               .logWeightBase = 4.6,
0107               .enableEtaBounds = false
0108             },
0109             app   // TODO: Remove me once fixed
0110           )
0111         );
0112 
0113         app->Add(
0114           new JOmniFactoryGeneratorT<CalorimeterClusterRecoCoG_factory>(
0115              "EcalEndcapNClusters",
0116             {"EcalEndcapNIslandProtoClusters",  // edm4eic::ProtoClusterCollection
0117 #if EDM4EIC_VERSION_MAJOR >= 7
0118              "EcalEndcapNRawHitAssociations"},  // edm4eic::MCRecoCalorimeterHitAssociationCollection
0119 #else
0120              "EcalEndcapNHits"},                // edm4hep::SimCalorimeterHitCollection
0121 #endif
0122             {"EcalEndcapNClusters",             // edm4eic::Cluster
0123              "EcalEndcapNClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation
0124             {
0125               .energyWeight = "log",
0126               .sampFrac = 1.0,
0127               .logWeightBase = 3.6,
0128               .enableEtaBounds = false,
0129             },
0130             app   // TODO: Remove me once fixed
0131           )
0132         );
0133 
0134         app->Add(
0135           new JOmniFactoryGeneratorT<TrackClusterMergeSplitter_factory>(
0136             "EcalEndcapNSplitMergeProtoClusters",
0137             {"EcalEndcapNIslandProtoClusters",
0138              "CalorimeterTrackProjections"},
0139             {"EcalEndcapNSplitMergeProtoClusters"},
0140             {
0141               .idCalo = "EcalEndcapN_ID",
0142               .minSigCut = -1.0,
0143               .avgEP = 1.0,
0144               .sigEP = 0.10,
0145               .drAdd = 0.08,
0146               .sampFrac = 1.0,
0147               .transverseEnergyProfileScale = 1.0
0148             },
0149             app   // TODO: remove me once fixed
0150           )
0151         );
0152 
0153         app->Add(
0154           new JOmniFactoryGeneratorT<CalorimeterClusterRecoCoG_factory>(
0155              "EcalEndcapNSplitMergeClusters",
0156             {"EcalEndcapNSplitMergeProtoClusters",        // edm4eic::ProtoClusterCollection
0157              "EcalEndcapNHits"},                          // edm4hep::SimCalorimeterHitCollection
0158             {"EcalEndcapNSplitMergeClusters",             // edm4eic::Cluster
0159              "EcalEndcapNSplitMergeClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation
0160             {
0161               .energyWeight = "log",
0162               .sampFrac = 1.0,
0163               .logWeightBase = 3.6,
0164               .enableEtaBounds = false
0165             },
0166             app   // TODO: Remove me once fixed
0167           )
0168         );
0169     }
0170 }