Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright 2023, Friederike Bock
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 <string>
0010 
0011 #include "algorithms/calorimetry/CalorimeterHitDigiConfig.h"
0012 #include "extensions/jana/JOmniFactoryGeneratorT.h"
0013 #include "factories/calorimetry/CalorimeterClusterRecoCoG_factory.h"
0014 #include "factories/calorimetry/CalorimeterHitDigi_factory.h"
0015 #include "factories/calorimetry/CalorimeterHitReco_factory.h"
0016 #include "factories/calorimetry/CalorimeterHitsMerger_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         // Make sure digi and reco use the same value
0028         decltype(CalorimeterHitDigiConfig::capADC)        HcalEndcapN_capADC = 32768; // assuming 15 bit ADC like FHCal
0029         decltype(CalorimeterHitDigiConfig::dyRangeADC)    HcalEndcapN_dyRangeADC = 200 * dd4hep::MeV; // to be verified with simulations
0030         decltype(CalorimeterHitDigiConfig::pedMeanADC)    HcalEndcapN_pedMeanADC = 10;
0031         decltype(CalorimeterHitDigiConfig::pedSigmaADC)   HcalEndcapN_pedSigmaADC = 2;
0032         decltype(CalorimeterHitDigiConfig::resolutionTDC) HcalEndcapN_resolutionTDC = 10 * dd4hep::picosecond;
0033 
0034         app->Add(new JOmniFactoryGeneratorT<CalorimeterHitDigi_factory>(
0035           "HcalEndcapNRawHits",
0036           {"HcalEndcapNHits"},
0037 #if EDM4EIC_VERSION_MAJOR >= 7
0038           {"HcalEndcapNRawHits", "HcalEndcapNRawHitAssociations"},
0039 #else
0040           {"HcalEndcapNRawHits"},
0041 #endif
0042           {
0043             .tRes = 0.0 * dd4hep::ns,
0044             .capADC = HcalEndcapN_capADC,
0045             .capTime = 100, // given in ns, 4 samples in HGCROC
0046             .dyRangeADC = HcalEndcapN_dyRangeADC,
0047             .pedMeanADC = HcalEndcapN_pedMeanADC,
0048             .pedSigmaADC = HcalEndcapN_pedSigmaADC,
0049             .resolutionTDC = HcalEndcapN_resolutionTDC,
0050             .corrMeanScale = "1.0",
0051             .readout = "HcalEndcapNHits",
0052           },
0053           app   // TODO: Remove me once fixed
0054         ));
0055         app->Add(new JOmniFactoryGeneratorT<CalorimeterHitReco_factory>(
0056           "HcalEndcapNRecHits", {"HcalEndcapNRawHits"}, {"HcalEndcapNRecHits"},
0057           {
0058             .capADC = HcalEndcapN_capADC,
0059             .dyRangeADC = HcalEndcapN_dyRangeADC,
0060             .pedMeanADC = HcalEndcapN_pedMeanADC,
0061             .pedSigmaADC = HcalEndcapN_pedSigmaADC,
0062             .resolutionTDC = HcalEndcapN_resolutionTDC,
0063             .thresholdFactor = 0.0,
0064             .thresholdValue = 41.0, // 0.1875 MeV deposition out of 200 MeV max (per layer) --> adc = 10 + 0.1875 / 200 * 32768 == 41
0065             .sampFrac = "0.0095", // from latest study - implement at level of reco hits rather than clusters
0066             .readout = "HcalEndcapNHits",
0067           },
0068           app   // TODO: Remove me once fixed
0069         ));
0070         app->Add(new JOmniFactoryGeneratorT<CalorimeterHitsMerger_factory>(
0071           "HcalEndcapNMergedHits", {"HcalEndcapNRecHits"}, {"HcalEndcapNMergedHits"},
0072           {
0073             .readout = "HcalEndcapNHits",
0074             .fields = {"layer", "slice"},
0075             .refs = {4, 0}, // place merged hits at ~1 interaction length deep
0076           },
0077           app   // TODO: Remove me once fixed
0078         ));
0079         app->Add(new JOmniFactoryGeneratorT<CalorimeterTruthClustering_factory>(
0080           "HcalEndcapNTruthProtoClusters", {"HcalEndcapNMergedHits", "HcalEndcapNHits"}, {"HcalEndcapNTruthProtoClusters"},
0081           app   // TODO: Remove me once fixed
0082         ));
0083         app->Add(new JOmniFactoryGeneratorT<CalorimeterIslandCluster_factory>(
0084           "HcalEndcapNIslandProtoClusters", {"HcalEndcapNMergedHits"}, {"HcalEndcapNIslandProtoClusters"},
0085           {
0086             .sectorDist = 5.0 * dd4hep::cm,
0087             .localDistXY = {15*dd4hep::cm, 15*dd4hep::cm},
0088             .splitCluster = true,
0089             .minClusterHitEdep = 0.0 * dd4hep::MeV,
0090             .minClusterCenterEdep = 30.0 * dd4hep::MeV,
0091             .transverseEnergyProfileMetric = "globalDistEtaPhi",
0092             .transverseEnergyProfileScale = 1.,
0093           },
0094           app   // TODO: Remove me once fixed
0095         ));
0096         app->Add(
0097           new JOmniFactoryGeneratorT<CalorimeterClusterRecoCoG_factory>(
0098              "HcalEndcapNTruthClusters",
0099             {"HcalEndcapNTruthProtoClusters",        // edm4eic::ProtoClusterCollection
0100 #if EDM4EIC_VERSION_MAJOR >= 7
0101              "HcalEndcapNRawHitAssociations"},       // edm4eic::MCRecoCalorimeterHitAssociationCollection
0102 #else
0103              "HcalEndcapNHits"},                     // edm4hep::SimCalorimeterHitCollection
0104 #endif
0105             {"HcalEndcapNTruthClusters",             // edm4eic::Cluster
0106              "HcalEndcapNTruthClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation
0107             {
0108               .energyWeight = "log",
0109               .sampFrac = 1.0,
0110               .logWeightBase = 6.2,
0111               .enableEtaBounds = false
0112             },
0113             app   // TODO: Remove me once fixed
0114           )
0115         );
0116 
0117         app->Add(
0118           new JOmniFactoryGeneratorT<CalorimeterClusterRecoCoG_factory>(
0119              "HcalEndcapNClusters",
0120             {"HcalEndcapNIslandProtoClusters",  // edm4eic::ProtoClusterCollection
0121 #if EDM4EIC_VERSION_MAJOR >= 7
0122              "HcalEndcapNRawHitAssociations"},  // edm4eic::MCRecoCalorimeterHitAssociationCollection
0123 #else
0124              "HcalEndcapNHits"},                // edm4hep::SimCalorimeterHitCollection
0125 #endif
0126             {"HcalEndcapNClusters",             // edm4eic::Cluster
0127              "HcalEndcapNClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation
0128             {
0129               .energyWeight = "log",
0130               .sampFrac = 1.0,
0131               .logWeightBase = 6.2,
0132               .enableEtaBounds = false,
0133             },
0134             app   // TODO: Remove me once fixed
0135           )
0136         );
0137 
0138         app->Add(
0139           new JOmniFactoryGeneratorT<TrackClusterMergeSplitter_factory>(
0140             "HcalEndcapNSplitMergeProtoClusters",
0141             {"HcalEndcapNIslandProtoClusters",
0142              "CalorimeterTrackProjections"},
0143             {"HcalEndcapNSplitMergeProtoClusters"},
0144             {
0145               .idCalo = "HcalEndcapN_ID",
0146               .minSigCut = -2.0,
0147               .avgEP = 0.60,
0148               .sigEP = 0.40,
0149               .drAdd = 0.40,
0150               .sampFrac = 1.0,
0151               .transverseEnergyProfileScale = 1.0
0152             },
0153             app   // TODO: remove me once fixed
0154           )
0155         );
0156 
0157         app->Add(
0158           new JOmniFactoryGeneratorT<CalorimeterClusterRecoCoG_factory>(
0159              "HcalEndcapNSplitMergeClusters",
0160             {"HcalEndcapNSplitMergeProtoClusters",        // edm4eic::ProtoClusterCollection
0161              "HcalEndcapNHits"},                          // edm4hep::SimCalorimeterHitCollection
0162             {"HcalEndcapNSplitMergeClusters",             // edm4eic::Cluster
0163              "HcalEndcapNSplitMergeClusterAssociations"}, // edm4eic::MCRecoClusterParticleAssociation
0164             {
0165               .energyWeight = "log",
0166               .sampFrac = 1.0,
0167               .logWeightBase = 6.2,
0168               .enableEtaBounds = false
0169             },
0170             app   // TODO: Remove me once fixed
0171           )
0172         );
0173     }
0174 }