Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:13:17

0001 /// ---------------------------------------------------------------------------
0002 /*! \file   TopoClusterOptions.h
0003  *  \author Derek Anderson
0004  *  \date   04.12.2024
0005  *
0006  * Options for the RawClusterBuilderTopo module
0007  */
0008 /// ---------------------------------------------------------------------------
0009 
0010 #ifndef TOPOCLUSTEROPTIONS_H
0011 #define TOPOCLUSTEROPTIONS_H
0012 
0013 // c++ utilities
0014 #include <string>
0015 #include <vector>
0016 #include <utility>
0017 // calo libraries
0018 #include <caloreco/RawClusterBuilderTopo.h>
0019 
0020 // make common namespaces implicit
0021 using namespace std;
0022 
0023 
0024 
0025 namespace TopoClusterOptions {
0026 
0027   // possible calo combinations ===============================================
0028 
0029   enum Combo {ECalOnly, BothCalos};
0030 
0031 
0032 
0033   // TopoClusterConfig definition =============================================
0034 
0035   // --------------------------------------------------------------------------
0036   //! Topo-Cluster Configuration
0037   // --------------------------------------------------------------------------
0038   /*! A lightweight POD struct consolidating
0039    *  options for the RawClusterBuilderTopo
0040    *  module.
0041    */ 
0042   struct TopoClusterConfig {
0043 
0044     // i/o options
0045     string moduleName;
0046     string nodeName;
0047 
0048     // calo options
0049     bool enableECal;
0050     bool enableHCal;
0051 
0052     // general options
0053     int    verbosity;
0054     bool   doSplit;
0055     bool   allowCorners;
0056     double rShower;
0057 
0058     // growth options
0059     vector<double> noiseLevels;
0060     vector<double> sigValues;
0061     vector<double> localMinEne;
0062 
0063   };  // end TopoClusterConfig
0064 
0065 
0066 
0067   // options ==================================================================
0068 
0069   // calo options
0070   const pair<bool, bool> enableECal = {true,  true};
0071   const pair<bool, bool> enableHCal = {false, true};
0072 
0073   // general options
0074   const bool   doSplit      = true;
0075   const bool   allowCorners = true;
0076   const double showerR      = 0.025;
0077 
0078   // growth options
0079   const vector<double> noiseLevels  = {0.0025, 0.006, 0.03};
0080   const vector<double> significance = {4.0,    2.0,   0.0};
0081   const vector<double> localMinE    = {1.0,    2.0,   0.5};
0082 
0083 
0084 
0085   // set up configuration =====================================================
0086 
0087   // --------------------------------------------------------------------------
0088   //! Generate RawClusterBuilderTopo configuration
0089   // --------------------------------------------------------------------------
0090   TopoClusterConfig GetConfig(const int combo, const int verbosity, const string module, const string node) {
0091 
0092     TopoClusterConfig cfg {
0093       .moduleName   = module,
0094       .nodeName     = node,
0095       .enableECal   = (combo == Combo::ECalOnly) ? enableECal.first : enableECal.second,
0096       .enableHCal   = (combo == Combo::ECalOnly) ? enableHCal.first : enableHCal.second,
0097       .verbosity    = verbosity,
0098       .doSplit      = doSplit,
0099       .allowCorners = allowCorners,
0100       .rShower      = showerR,
0101       .noiseLevels  = noiseLevels,
0102       .sigValues    = significance,
0103       .localMinEne  = localMinE
0104     };
0105     return cfg;
0106 
0107   }  // end 'GetConfig(int)'
0108 
0109 
0110 
0111   // initialize topocluster builder ===========================================
0112 
0113   // --------------------------------------------------------------------------
0114   //! Instantiate RawClusterBuilderTopo module with given configuration
0115   // --------------------------------------------------------------------------
0116   RawClusterBuilderTopo* CreateBuilder(TopoClusterConfig& config) {
0117 
0118     RawClusterBuilderTopo* builder = new RawClusterBuilderTopo(config.moduleName.data());
0119     builder -> Verbosity(config.verbosity);
0120     builder -> set_nodename(config.nodeName.data());
0121     builder -> set_enable_EMCal(config.enableECal);
0122     builder -> set_enable_HCal(config.enableHCal);
0123     builder -> set_do_split(config.doSplit);
0124     builder -> allow_corner_neighbor(config.allowCorners);
0125     builder -> set_R_shower(config.rShower);
0126     builder -> set_noise(
0127       config.noiseLevels.at(0),
0128       config.noiseLevels.at(1),
0129       config.noiseLevels.at(2)
0130     );
0131     builder -> set_significance(
0132       config.sigValues.at(0),
0133       config.sigValues.at(1),
0134       config.sigValues.at(2)
0135     );
0136     builder -> set_minE_local_max(
0137       config.localMinEne.at(0),
0138       config.localMinEne.at(1),
0139       config.localMinEne.at(2)
0140     );
0141     return builder;
0142 
0143   }  // end 'CreateBuilder(TopoClusterConfig&)'
0144 
0145 }  // end TopoClusterOptions namespace
0146 
0147 #endif
0148 
0149 // end ------------------------------------------------------------------------