Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-08 07:53:31

0001 // SPDX-License-Identifier: LGPL-3.0-or-later
0002 // Copyright (C) 2022, 2023, Christopher Dilks
0003 
0004 #include <JANA/JApplicationFwd.h>
0005 #include <math.h>
0006 #include <memory>
0007 
0008 #include "algorithms/interfaces/WithPodConfig.h"
0009 #include "algorithms/pid_lut/PIDLookupConfig.h"
0010 #include "extensions/jana/JOmniFactoryGeneratorT.h"
0011 // factories
0012 #include "factories/pid_lut/PIDLookup_factory.h"
0013 
0014 extern "C" {
0015 void InitPlugin(JApplication* app) {
0016   InitJANAPlugin(app);
0017 
0018   using namespace eicrecon;
0019 
0020   //-------------------------------------------------------------------------
0021   // PFRICH PID
0022   //-------------------------------------------------------------------------
0023   PIDLookupConfig pfrich_pid_cfg{
0024       .filename       = "calibrations/pfrich.lut",
0025       .system         = "BackwardRICH_ID",
0026       .pdg_values     = {11, 211, 321, 2212},
0027       .charge_values  = {1},
0028       .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,
0029                          5.6,  6,    6.4,  6.8, 7.2,  7.6,  8,    8.4,  8.8, 9.2,  9.6,  10,  10.4,
0030                          10.8, 11.2, 11.6, 12,  12.4, 12.8, 13.2, 13.6, 14,  14.4, 14.8, 15.2},
0031       .polar_edges    = {2.65,  2.6725, 2.695, 2.7175, 2.74,  2.7625, 2.785, 2.8075, 2.83,  2.8525,
0032                          2.875, 2.8975, 2.92,  2.9425, 2.965, 2.9875, 3.01,  3.0325, 3.055, 3.0775},
0033       .azimuthal_binning            = {0., 2 * M_PI, 2 * M_PI / 120.}, // lower, upper, step
0034       .azimuthal_bin_centers_in_lut = true,
0035       .momentum_bin_centers_in_lut  = true,
0036       .polar_bin_centers_in_lut     = true,
0037       .use_radians                  = true,
0038   };
0039 
0040   app->Add(new JOmniFactoryGeneratorT<PIDLookup_factory>(
0041       "RICHEndcapNTruthSeededLUTPID",
0042       {
0043           "ReconstructedTruthSeededChargedWithoutPIDParticles",
0044           "ReconstructedTruthSeededChargedWithoutPIDParticleAssociations",
0045       },
0046       {
0047           "ReconstructedTruthSeededChargedWithPFRICHPIDParticles",
0048           "ReconstructedTruthSeededChargedWithPFRICHPIDParticleAssociations",
0049           "RICHEndcapNTruthSeededParticleIDs",
0050       },
0051       pfrich_pid_cfg, app));
0052 
0053   app->Add(new JOmniFactoryGeneratorT<PIDLookup_factory>(
0054       "RICHEndcapNLUTPID",
0055       {
0056           "ReconstructedChargedWithoutPIDParticles",
0057           "ReconstructedChargedWithoutPIDParticleAssociations",
0058       },
0059       {
0060           "ReconstructedChargedWithPFRICHPIDParticles",
0061           "ReconstructedChargedWithPFRICHPIDParticleAssociations",
0062           "RICHEndcapNParticleIDs",
0063       },
0064       pfrich_pid_cfg, app));
0065 
0066   //-------------------------------------------------------------------------
0067   // TOF PID
0068   //-------------------------------------------------------------------------
0069 
0070   PIDLookupConfig tof_pid_cfg{
0071       .filename       = "calibrations/tof.lut",
0072       .system         = "BarrelTOF_ID",
0073       .pdg_values     = {11, 211, 321, 2212},
0074       .charge_values  = {1},
0075       .momentum_edges = {0.0, 0.3, 0.6, 0.9, 1.2, 1.5, 1.8, 2.1, 2.4, 2.7, 3.0,
0076                          3.3, 3.6, 3.9, 4.2, 4.5, 4.8, 5.1, 5.4, 5.7, 6.0},
0077       .polar_edges    = {2.50, 10.95, 19.40, 27.85, 36.30, 44.75, 53.20, 61.65, 70.10, 78.55, 87.00,
0078                          95.45, 103.90, 112.35, 120.80, 129.25, 137.70, 146.15, 154.60},
0079       .azimuthal_binning           = {0., 360., 360.}, // lower, upper, step
0080       .momentum_bin_centers_in_lut = true,
0081       .polar_bin_centers_in_lut    = true,
0082   };
0083 
0084   app->Add(new JOmniFactoryGeneratorT<PIDLookup_factory>(
0085       "CombinedTOFTruthSeededLUTPID",
0086       {
0087           "ReconstructedTruthSeededChargedWithPFRICHPIDParticles",
0088           "ReconstructedTruthSeededChargedWithPFRICHPIDParticleAssociations",
0089       },
0090       {
0091           "ReconstructedTruthSeededChargedWithPFRICHTOFPIDParticles",
0092           "ReconstructedTruthSeededChargedWithPFRICHTOFPIDParticleAssociations",
0093           "CombinedTOFTruthSeededParticleIDs",
0094       },
0095       tof_pid_cfg, app));
0096 
0097   app->Add(new JOmniFactoryGeneratorT<PIDLookup_factory>(
0098       "CombinedTOFLUTPID",
0099       {
0100           "ReconstructedChargedWithPFRICHPIDParticles",
0101           "ReconstructedChargedWithPFRICHPIDParticleAssociations",
0102       },
0103       {
0104           "ReconstructedChargedWithPFRICHTOFPIDParticles",
0105           "ReconstructedChargedWithPFRICHTOFPIDParticleAssociations",
0106           "CombinedTOFParticleIDs",
0107       },
0108       tof_pid_cfg, app));
0109 
0110   //-------------------------------------------------------------------------
0111   // DIRC PID
0112   //-------------------------------------------------------------------------
0113 
0114   PIDLookupConfig dirc_pid_cfg{
0115       .filename       = "calibrations/hpdirc.lut.gz",
0116       .system         = "BarrelDIRC_ID",
0117       .pdg_values     = {11, 211, 321, 2212},
0118       .charge_values  = {-1, 1},
0119       .momentum_edges = {0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.2,  2.4, 2.6,
0120                          2.8, 3.0, 3.2, 3.4, 3.6, 3.8, 4.0, 4.2, 4.4, 4.6, 4.8,  5.0, 5.2,
0121                          5.4, 5.6, 5.8, 6.0, 6.2, 6.4, 6.6, 6.8, 7.0, 7.2, 7.4,  7.6, 7.8,
0122                          8.0, 8.2, 8.4, 8.6, 8.8, 9.0, 9.2, 9.4, 9.6, 9.8, 10.0, 10.2},
0123       .polar_edges    = {25.0,  26.0,  27.0,  28.0,  29.0,  30.0,  31.0,  32.0,  33.0,  34.0,  35.0,
0124                          36.0,  37.0,  38.0,  39.0,  40.0,  41.0,  42.0,  43.0,  44.0,  45.0,  46.0,
0125                          47.0,  48.0,  49.0,  50.0,  51.0,  52.0,  53.0,  54.0,  55.0,  56.0,  57.0,
0126                          58.0,  59.0,  60.0,  61.0,  62.0,  63.0,  64.0,  65.0,  66.0,  67.0,  68.0,
0127                          69.0,  70.0,  71.0,  72.0,  73.0,  74.0,  75.0,  76.0,  77.0,  78.0,  79.0,
0128                          80.0,  81.0,  82.0,  83.0,  84.0,  85.0,  86.0,  87.0,  88.0,  89.0,  90.0,
0129                          91.0,  92.0,  93.0,  94.0,  95.0,  96.0,  97.0,  98.0,  99.0,  100.0, 101.0,
0130                          102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0, 110.0, 111.0, 112.0,
0131                          113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0, 121.0, 122.0, 123.0,
0132                          124.0, 125.0, 126.0, 127.0, 128.0, 129.0, 130.0, 131.0, 132.0, 133.0, 134.0,
0133                          135.0, 136.0, 137.0, 138.0, 139.0, 140.0, 141.0, 142.0, 143.0, 144.0, 145.0,
0134                          146.0, 147.0, 148.0, 149.0, 150.0, 151.0, 152.0, 153.0, 154.0, 155.0, 156.0,
0135                          157.0, 158.0, 159.0, 160.0},
0136       .azimuthal_binning = {0.0, 30.5, 0.5}, // lower, upper, step
0137   };
0138 
0139   app->Add(new JOmniFactoryGeneratorT<PIDLookup_factory>(
0140       "DIRCTruthSeededLUTPID",
0141       {
0142           "ReconstructedTruthSeededChargedWithPFRICHTOFPIDParticles",
0143           "ReconstructedTruthSeededChargedWithPFRICHTOFPIDParticleAssociations",
0144       },
0145       {
0146           "ReconstructedTruthSeededChargedWithPFRICHTOFDIRCPIDParticles",
0147           "ReconstructedTruthSeededChargedWithPFRICHTOFDIRCPIDParticleAssociations",
0148           "DIRCTruthSeededParticleIDs",
0149       },
0150       dirc_pid_cfg, app));
0151 
0152   app->Add(new JOmniFactoryGeneratorT<PIDLookup_factory>(
0153       "DIRCLUTPID",
0154       {
0155           "ReconstructedChargedWithPFRICHTOFPIDParticles",
0156           "ReconstructedChargedWithPFRICHTOFPIDParticleAssociations",
0157       },
0158       {
0159           "ReconstructedChargedWithPFRICHTOFDIRCPIDParticles",
0160           "ReconstructedChargedWithPFRICHTOFDIRCPIDParticleAssociations",
0161           "DIRCParticleIDs",
0162       },
0163       dirc_pid_cfg, app));
0164 
0165   //-------------------------------------------------------------------------
0166   // DRICH PID
0167   //-------------------------------------------------------------------------
0168 
0169   PIDLookupConfig drich_pid_cfg{
0170       .filename                 = "calibrations/drich.lut",
0171       .system                   = "ForwardRICH_ID",
0172       .pdg_values               = {211, 321, 2212},
0173       .charge_values            = {1},
0174       .momentum_edges           = {0.25,  0.75,  1.25,  1.75,  2.25,  2.75,  3.25,  3.75,  4.25,
0175                                    4.75,  5.25,  5.75,  6.25,  6.75,  7.25,  7.75,  8.25,  8.75,
0176                                    9.25,  9.75,  10.25, 10.75, 11.25, 11.75, 12.25, 12.75, 13.25,
0177                                    13.75, 14.25, 14.75, 15.25, 15.75, 16.25, 16.75, 17.25, 17.75,
0178                                    18.25, 18.75, 19.25, 19.75, 20.50, 21.50, 22.50, 23.50, 24.50,
0179                                    25.50, 26.50, 27.50, 28.50, 29.50, 30.50},
0180       .polar_edges              = {0.060, 0.164, 0.269, 0.439},
0181       .azimuthal_binning        = {0., 2 * M_PI, 2 * M_PI}, // lower, upper, step
0182       .polar_bin_centers_in_lut = true,
0183       .use_radians              = true,
0184       .missing_electron_prob    = true,
0185   };
0186 
0187   app->Add(new JOmniFactoryGeneratorT<PIDLookup_factory>(
0188       "DRICHTruthSeededLUTPID",
0189       {
0190           "ReconstructedTruthSeededChargedWithPFRICHTOFDIRCPIDParticles",
0191           "ReconstructedTruthSeededChargedWithPFRICHTOFDIRCPIDParticleAssociations",
0192       },
0193       {
0194           "ReconstructedTruthSeededChargedParticles",
0195           "ReconstructedTruthSeededChargedParticleAssociations",
0196           "DRICHTruthSeededParticleIDs",
0197       },
0198       drich_pid_cfg, app));
0199 
0200   app->Add(new JOmniFactoryGeneratorT<PIDLookup_factory>(
0201       "DRICHLUTPID",
0202       {
0203           "ReconstructedChargedWithPFRICHTOFDIRCPIDParticles",
0204           "ReconstructedChargedWithPFRICHTOFDIRCPIDParticleAssociations",
0205       },
0206       {
0207           "ReconstructedChargedParticles",
0208           "ReconstructedChargedParticleAssociations",
0209           "DRICHParticleIDs",
0210       },
0211       drich_pid_cfg, app));
0212 }
0213 }