File indexing completed on 2024-09-27 07:03:04
0001
0002
0003
0004
0005
0006
0007 #include <DD4hep/Detector.h>
0008 #include <Evaluator/DD4hepUnits.h>
0009 #include <JANA/JApplication.h>
0010 #include <math.h>
0011 #include <algorithm>
0012 #include <gsl/pointers>
0013 #include <memory>
0014 #include <stdexcept>
0015 #include <utility>
0016 #include <vector>
0017
0018
0019 #include "algorithms/digi/PhotoMultiplierHitDigiConfig.h"
0020 #include "algorithms/pid_lut/PIDLookupConfig.h"
0021 #include "extensions/jana/JOmniFactoryGeneratorT.h"
0022
0023 #include "global/digi/PhotoMultiplierHitDigi_factory.h"
0024 #include "global/pid_lut/PIDLookup_factory.h"
0025 #include "services/geometry/dd4hep/DD4hep_service.h"
0026
0027 extern "C" {
0028 void InitPlugin(JApplication *app) {
0029 InitJANAPlugin(app);
0030
0031 using namespace eicrecon;
0032
0033
0034
0035
0036 PhotoMultiplierHitDigiConfig digi_cfg;
0037 digi_cfg.seed = 5;
0038
0039 digi_cfg.hitTimeWindow = 20.0;
0040 digi_cfg.timeResolution = 1/16.0;
0041 digi_cfg.speMean = 80.0;
0042 digi_cfg.speError = 16.0;
0043 digi_cfg.pedMean = 200.0;
0044 digi_cfg.pedError = 3.0;
0045 digi_cfg.enablePixelGaps = true;
0046 digi_cfg.safetyFactor = 0.7;
0047 digi_cfg.enableNoise = false;
0048 digi_cfg.noiseRate = 20000;
0049 digi_cfg.noiseTimeWindow = 20.0 * dd4hep::ns;
0050 digi_cfg.quantumEfficiency.clear();
0051 digi_cfg.quantumEfficiency = {
0052 {315, 0.00},
0053 {325, 0.04},
0054 {340, 0.10},
0055 {350, 0.20},
0056 {370, 0.30},
0057 {400, 0.35},
0058 {450, 0.40},
0059 {500, 0.38},
0060 {550, 0.35},
0061 {600, 0.27},
0062 {650, 0.20},
0063 {700, 0.15},
0064 {750, 0.12},
0065 {800, 0.08},
0066 {850, 0.06},
0067 {900, 0.04},
0068 {1000, 0.00}
0069 };
0070
0071
0072 app->Add(new JOmniFactoryGeneratorT<PhotoMultiplierHitDigi_factory>(
0073 "RICHEndcapNRawHits",
0074 {"RICHEndcapNHits"},
0075 {"RICHEndcapNRawHits", "RICHEndcapNRawHitsAssociations"},
0076 digi_cfg,
0077 app
0078 ));
0079
0080 int BackwardRICH_ID = 0;
0081 try {
0082 auto detector = app->GetService<DD4hep_service>()->detector();
0083 BackwardRICH_ID = detector->constant<int>("BackwardRICH_ID");
0084 } catch(const std::runtime_error&) {
0085
0086 }
0087 PIDLookupConfig pid_cfg {
0088 .filename="calibrations/pfrich.lut",
0089 .system=BackwardRICH_ID,
0090 .pdg_values={11, 211, 321, 2212},
0091 .charge_values={1},
0092 .momentum_edges={0.4, 0.8, 1.2, 1.6, 2, 2.4, 2.8, 3.2, 3.6, 4, 4.4, 4.8, 5.2, 5.6, 6, 6.4, 6.8, 7.2, 7.6, 8, 8.4, 8.8, 9.2, 9.6, 10, 10.4, 10.8, 11.2, 11.6, 12, 12.4, 12.8, 13.2, 13.6, 14, 14.4, 14.8, 15.2},
0093 .polar_edges={2.65, 2.6725, 2.695, 2.7175, 2.74, 2.7625, 2.785, 2.8075, 2.83, 2.8525, 2.875, 2.8975, 2.92, 2.9425, 2.965, 2.9875, 3.01, 3.0325, 3.055, 3.0775},
0094 .azimuthal_binning={0., 2 * M_PI, 2 * M_PI / 120.},
0095 .azimuthal_bin_centers_in_lut=true,
0096 .momentum_bin_centers_in_lut=true,
0097 .polar_bin_centers_in_lut=true,
0098 .use_radians=true,
0099 };
0100
0101 app->Add(new JOmniFactoryGeneratorT<PIDLookup_factory>(
0102 "RICHEndcapNTruthSeededLUTPID",
0103 {
0104 "ReconstructedTruthSeededChargedWithoutPIDParticles",
0105 "ReconstructedTruthSeededChargedWithoutPIDParticleAssociations",
0106 },
0107 {
0108 "ReconstructedTruthSeededChargedWithPFRICHPIDParticles",
0109 "ReconstructedTruthSeededChargedWithPFRICHPIDParticleAssociations",
0110 "RICHEndcapNTruthSeededParticleIDs",
0111 },
0112 pid_cfg,
0113 app
0114 ));
0115
0116 app->Add(new JOmniFactoryGeneratorT<PIDLookup_factory>(
0117 "RICHEndcapNLUTPID",
0118 {
0119 "ReconstructedChargedWithoutPIDParticles",
0120 "ReconstructedChargedWithoutPIDParticleAssociations",
0121 },
0122 {
0123 "ReconstructedChargedWithPFRICHPIDParticles",
0124 "ReconstructedChargedWithPFRICHPIDParticleAssociations",
0125 "RICHEndcapNParticleIDs",
0126 },
0127 pid_cfg,
0128 app
0129 ));
0130 }
0131 }