Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Copyright 2022, Dmitry Romanov
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 //
0004 
0005 // SPDX-License-Identifier: LGPL-3.0-or-later
0006 // Copyright (C) 2024, Dmitry Kalinkin
0007 
0008 #include <DD4hep/Detector.h>
0009 #include <Evaluator/DD4hepUnits.h>
0010 #include <JANA/JApplication.h>
0011 #include <algorithm>
0012 #include <gsl/pointers>
0013 #include <memory>
0014 #include <stdexcept>
0015 
0016 #include "algorithms/interfaces/WithPodConfig.h"
0017 #include "algorithms/pid_lut/PIDLookupConfig.h"
0018 #include "extensions/jana/JOmniFactoryGeneratorT.h"
0019 #include "factories/digi/SiliconTrackerDigi_factory.h"
0020 #include "factories/tracking/TrackerHitReconstruction_factory.h"
0021 #include "global/pid_lut/PIDLookup_factory.h"
0022 #include "services/geometry/dd4hep/DD4hep_service.h"
0023 
0024 extern "C" {
0025 void InitPlugin(JApplication *app) {
0026     InitJANAPlugin(app);
0027 
0028     using namespace eicrecon;
0029 
0030     // Digitization
0031     app->Add(new JOmniFactoryGeneratorT<SiliconTrackerDigi_factory>(
0032         "TOFBarrelRawHit",
0033         {
0034           "TOFBarrelHits"
0035         },
0036         {
0037           "TOFBarrelRawHit",
0038           "TOFBarrelRawHitAssociations"
0039         },
0040         {
0041             .threshold = 6.0 * dd4hep::keV,
0042             .timeResolution = 0.025,    // [ns]
0043         },
0044         app
0045     ));
0046 
0047     // Convert raw digitized hits into hits with geometry info (ready for tracking)
0048     app->Add(new JOmniFactoryGeneratorT<TrackerHitReconstruction_factory>(
0049         "TOFBarrelRecHit",
0050         {"TOFBarrelRawHit"},    // Input data collection tags
0051         {"TOFBarrelRecHit"},     // Output data tag
0052         {
0053             .timeResolution = 10,
0054         },
0055         app
0056     ));         // Hit reco default config for factories
0057 
0058     int BarrelTOF_ID = 0;
0059     try {
0060         auto detector = app->GetService<DD4hep_service>()->detector();
0061         BarrelTOF_ID = detector->constant<int>("BarrelTOF_ID");
0062     } catch(const std::runtime_error&) {
0063         // Nothing
0064     }
0065     PIDLookupConfig pid_cfg {
0066       .filename="calibrations/tof.lut",
0067       .system=BarrelTOF_ID,
0068       .pdg_values={11, 211, 321, 2212},
0069       .charge_values={1},
0070       .momentum_edges={0.0, 0.3, 0.6, 0.9, 1.2, 1.5, 1.8, 2.1, 2.4, 2.7, 3.0, 3.3, 3.6, 3.9, 4.2, 4.5, 4.8, 5.1, 5.4, 5.7, 6.0},
0071       .polar_edges={2.50, 10.95, 19.40, 27.85, 36.30, 44.75, 53.20, 61.65, 70.10, 78.55, 87.00, 95.45, 103.90, 112.35, 120.80, 129.25, 137.70, 146.15, 154.60},
0072       .azimuthal_binning={0., 360., 360.}, // lower, upper, step
0073       .momentum_bin_centers_in_lut=true,
0074       .polar_bin_centers_in_lut=true,
0075     };
0076 
0077     app->Add(new JOmniFactoryGeneratorT<PIDLookup_factory>(
0078           "CombinedTOFTruthSeededLUTPID",
0079           {
0080           "ReconstructedTruthSeededChargedWithPFRICHPIDParticles",
0081           "ReconstructedTruthSeededChargedWithPFRICHPIDParticleAssociations",
0082           },
0083           {
0084           "ReconstructedTruthSeededChargedWithPFRICHTOFPIDParticles",
0085           "ReconstructedTruthSeededChargedWithPFRICHTOFPIDParticleAssociations",
0086           "CombinedTOFTruthSeededParticleIDs",
0087           },
0088           pid_cfg,
0089           app
0090           ));
0091 
0092     app->Add(new JOmniFactoryGeneratorT<PIDLookup_factory>(
0093           "CombinedTOFLUTPID",
0094           {
0095           "ReconstructedChargedWithPFRICHPIDParticles",
0096           "ReconstructedChargedWithPFRICHPIDParticleAssociations",
0097           },
0098           {
0099           "ReconstructedChargedWithPFRICHTOFPIDParticles",
0100           "ReconstructedChargedWithPFRICHTOFPIDParticleAssociations",
0101           "CombinedTOFParticleIDs",
0102           },
0103           pid_cfg,
0104           app
0105           ));
0106 }
0107 } // extern "C"