Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:17:11

0001 #ifndef JETBASE_FASTJETOPTIONS
0002 #define JETBASE_FASTJETOPTIONS
0003 
0004 #include "Jet.h"
0005 
0006 #include <ostream>
0007 #include <vector>
0008 
0009 // This is a structure that the FastJetAlgo class uses for its optoins. The users
0010 // can initialize it as a double-brace enclosed list which is a mix of
0011 // Something like this:
0012 //
0013 // FastJetOptions fj_opt {{ Jet::ALGO::ANTIKT, DO_SOFTDROP, SD_BETA, 0.0, SD_ZCUT 0.1, JET_R, 0.4 }};
0014 // jet_reco_obj->add_algo(new FastJetAlgo(fj_opt), "AntiKt_Tower_r04");
0015 // /* can also update it */
0016 // jet_reco_obj->add_algo(new FastJetAlgo(fj_opt({{JET_R,0.5}}), "AntiKt_Tower_r05");
0017 
0018 enum FastJetOptEnum
0019 {
0020   JET_R,               // required
0021   JET_MIN_PT,          // optional, not set
0022   JET_MAX_ETA,         // optional, not set
0023   CONSTITUENT_MIN_PT,  // optional, not set
0024   CONSTITUENT_MIN_E,   // default 0
0025   DO_SOFTDROP,         // optional; off
0026   SD_BETA,             // defaults to 0
0027   SD_ZCUT,             // defaults to 0
0028   SD_JET_MIN_PT,       // defaults to 5.
0029   CALC_AREA,           // optional, is off
0030   GHOST_AREA,          // defaults to 0.01
0031   GHOST_MAX_RAP,       // defaults to 5 or JET_MAX_ETA+JET_R
0032   CALC_RhoMedDens,     // optional; default off
0033   CUT_RhoMedNHardest,  // optional; default 2
0034   NONE,
0035   FJCS_doConstSub,           // FastJet Constituent Subtraction. Optional. Default: false
0036   FJCS_max_eta,              // defaults to 1.1
0037   FJCS_GridMedBkgEst_Size,   // defaults to 0.5, may want smaller value, see http://fastjet.fr/repo/fastjet-doc-3.4.2.pdf
0038   FJCS_max_dist,             // add to vector of max dist; can add multiple times. If not added at all, defualts to { .1, 0.15}
0039   FJCS_alpha,                // same as above, but for alpha. Defaults to {{0., 0.}} if no entries
0040   FJCS_max_pt,               // max pt for constituents to be adjusted -- defaults to -1. (i.e. doesn't use selector)
0041   FJCS_ghost_area,           // max pt for constituents to be adjusted -- defaults to -1. (i.e. doesn't use selector)
0042   SAVE_JET_COMPONENTS,       // optional; default true (I think this is what is hitting the e- spectra)
0043   DONT_SAVE_JET_COMPONENTS,  // set save_jet_components to false
0044   VERBOSITY                  // optional
0045 };
0046 
0047 struct FastJetOptItem
0048 {  // All the things you can feed into FastJetAlgo
0049   FastJetOptEnum opt{FastJetOptEnum::NONE};
0050   bool is_opt{false};
0051 
0052   float val{0.};
0053   bool is_val{false};
0054 
0055   Jet::ALGO algo{};
0056   bool is_algo{false};
0057 
0058   FastJetOptItem(float _val)
0059     : val{_val}
0060     , is_val{true} {};
0061   FastJetOptItem(Jet::ALGO _algo)
0062     : algo{_algo}
0063     , is_algo{true} {};
0064   FastJetOptItem(FastJetOptEnum _opt)
0065     : opt{_opt}
0066     , is_opt{true} {};
0067 };
0068 
0069 struct FastJetOptions
0070 {
0071   FastJetOptions() {};
0072   FastJetOptions(const std::vector<FastJetOptItem>& _vitem) { update(_vitem); };
0073   FastJetOptions& update(std::vector<FastJetOptItem>);
0074   FastJetOptions& operator()(const std::vector<FastJetOptItem>& _vitem) { return update(_vitem); };
0075 
0076   void print(std::ostream& os = std::cout);
0077 
0078   static float next_val(unsigned int i, std::vector<FastJetOptItem>&);
0079   void initialize();  // updates run with the first call
0080   float jet_R{0.4};
0081   Jet::ALGO algo{Jet::ALGO::ANTIKT};
0082 
0083   bool use_jet_max_eta{false};
0084   float jet_max_eta{0};
0085   /* bool  handset_maxeta              {false}; // If user uses jet_max_eta, then cut_edge_eta won't reset eta at all */
0086   /* bool  cut_edge_eta                {false}; */
0087 
0088   bool use_jet_min_pt{false};
0089   float jet_min_pt{0};
0090 
0091   bool use_constituent_min_pt{false};
0092   float constituent_min_pt{0.};
0093 
0094   float constituent_min_E{0.};
0095 
0096   bool save_jet_components{true};
0097 
0098   // softdrop
0099   bool doSoftDrop{false};
0100   float SD_beta{0};
0101   float SD_zcut{0};
0102   float SD_jet_min_pt{5.};
0103 
0104   // calculate area
0105   bool calc_area{false};
0106   float ghost_area{0.01};
0107   float ghost_max_rap{0};  // will default to min(jet_max_eta+Jet_R., 5)
0108 
0109   // calculate jet median background density
0110   bool calc_jetmedbkgdens{false};
0111   float nhardestcut_jetmedbkgdens{2};
0112   float etahardestcut_jetmedbkgdens{0.};  // will default to jet_max_eta or ghost_max_rap
0113 
0114   // calculate constituent subtraction
0115   bool cs_calc_constsub{false};
0116   float cs_max_eta{1.1};
0117   float cs_max_pt{-1.};  // max pt of which constituents are corrected
0118   float cs_gridmedestsize{0.5};
0119   float cs_max_dist{0.3};
0120   float cs_alpha{1.};
0121   float cs_ghost_area{0.01};
0122 
0123   int verbosity{0};
0124 
0125   // for convenience when running FastJetAlgo
0126   bool use_jet_selection{false};  // set when initialized
0127 };
0128 
0129 #endif