Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /// ---------------------------------------------------------------------------
0002 /*! \file   Constants.h
0003  *  \author Derek Anderson
0004  *  \date   11.16.2023
0005  *
0006  * Various constants used throughout the SColdQcdCorrelatorAnalysis
0007  * namespace are collected here.
0008  */
0009 /// ---------------------------------------------------------------------------
0010 
0011 #ifndef SCORRELATORUTILITIES_CONSTANTS_H
0012 #define SCORRELATORUTILITIES_CONSTANTS_H
0013 
0014 #pragma GCC diagnostic push
0015 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
0016 
0017 // c++ utilities
0018 #include <map>
0019 #include <string>
0020 #include <cstdint>
0021 // fastjet libraries
0022 #include <fastjet/JetDefinition.hh>
0023 #include <fastjet/AreaDefinition.hh>
0024 // sphenix jet base
0025 #include <jetbase/Jet.h>
0026 // sphenix calo base
0027 #include <calobase/RawTowerDefs.h>
0028 
0029 #pragma GCC diagnostic pop
0030 
0031 // make common namespaces implicit
0032 using namespace std;
0033 
0034 
0035 
0036 namespace SColdQcdCorrelatorAnalysis {
0037   namespace Const {
0038 
0039     // enums ==================================================================
0040 
0041     // ------------------------------------------------------------------------
0042     //! Intialization options for analysis types
0043     // ------------------------------------------------------------------------
0044     enum class Init {Minimize, Maximize};
0045 
0046     // ------------------------------------------------------------------------
0047     //! Jet types
0048     // ------------------------------------------------------------------------
0049     enum class JetType {Charged, Cluster, Tower, Full};
0050 
0051     // ------------------------------------------------------------------------
0052     //! Particle charge subsets
0053     // ------------------------------------------------------------------------
0054     enum class Subset {All, Charged, Neutral};
0055 
0056     // ------------------------------------------------------------------------
0057     //! Object types
0058     // ------------------------------------------------------------------------
0059     enum Object {Track, Tower, Cluster, Flow, Particle, Mystery};
0060 
0061     // ------------------------------------------------------------------------
0062     //! Subsystem indices
0063     // ------------------------------------------------------------------------
0064     enum Subsys {Mvtx, Intt, Tpc, EMCal, RECal, IHCal, OHCal};
0065 
0066     // ------------------------------------------------------------------------
0067     //! Calorimeter tower statuses
0068     // ------------------------------------------------------------------------
0069     enum TowerStatus {Good, Hot, BadTime, BadChi, NotInstr, NoCalib, Unknown, NA};
0070 
0071     // ------------------------------------------------------------------------
0072     //! Subevent options
0073     // ------------------------------------------------------------------------
0074     enum SubEvtOpt {Everything, OnlySignal, AllBkgd, PrimaryBkgd, Pileup, Specific};
0075 
0076     // ------------------------------------------------------------------------
0077     //! Special subevent indices
0078     // ------------------------------------------------------------------------
0079     enum SubEvt {
0080       Background     = 0,
0081       NotEmbedSignal = 1,
0082       EmbedSignal    = 2
0083     };
0084 
0085     // ------------------------------------------------------------------------
0086     //! Hard scatter product statuses
0087     // ------------------------------------------------------------------------
0088     enum HardScatterStatus {
0089       First  = 23,
0090       Second = 24
0091     };
0092 
0093     // ------------------------------------------------------------------------
0094     //! Parton pdg codes
0095     // ------------------------------------------------------------------------
0096     enum Parton {
0097       Down    = 1,
0098       Up      = 2,
0099       Strange = 3,
0100       Charm   = 4,
0101       Bottom  = 5,
0102       Top     = 6,
0103       Gluon   = 21
0104     };
0105 
0106 
0107 
0108     // constants ==============================================================
0109 
0110     // ------------------------------------------------------------------------
0111     //! No. of MVTX layers
0112     // ------------------------------------------------------------------------
0113     inline uint16_t const &NMvtxLayer() {
0114       static uint16_t nMvtxLayer = 3;
0115       return nMvtxLayer;
0116     }
0117 
0118     // ------------------------------------------------------------------------
0119     //! No. of INTT layers
0120     // ------------------------------------------------------------------------
0121     inline uint16_t const &NInttLayer() {
0122       static uint16_t nInttLayer = 8;
0123       return nInttLayer;
0124     }
0125 
0126     // ------------------------------------------------------------------------
0127     //! No. of TPC layers
0128     // ------------------------------------------------------------------------
0129     inline uint16_t const &NTpcLayer() {
0130       static uint16_t nTpcLayer = 48;
0131       return nTpcLayer;
0132     }
0133 
0134     // ------------------------------------------------------------------------
0135     //! No. of TPC sectors
0136     // ------------------------------------------------------------------------
0137     inline uint16_t const &NTpcSector() {
0138       static uint16_t nTpcSector = 12;
0139       return nTpcSector;
0140     }
0141 
0142     // ------------------------------------------------------------------------
0143     //! Fit function for calculating DCA nSigma
0144     // ------------------------------------------------------------------------
0145     inline string const &SigmaDcaFunc() {
0146       static string sigmaDcaFunc = "[0]+[1]/x+[2]/(x*x)";
0147       return sigmaDcaFunc;
0148     }
0149 
0150     // ------------------------------------------------------------------------
0151     //! Charged pion mass in GeV/c^2
0152     // ------------------------------------------------------------------------
0153     inline double const &MassPion() {
0154       static double mPion = 0.140;
0155       return mPion;
0156     }
0157 
0158 
0159 
0160     // maps ===================================================================
0161 
0162     // ------------------------------------------------------------------------
0163     //! Map of PID to charges
0164     // ------------------------------------------------------------------------
0165     inline map<int, float> &MapPidOntoCharge() {
0166       static map<int, float> mapPidOntoCharge = {
0167         {1, -1./3.},
0168         {2, 2./3.}, 
0169         {3, -1./3.},
0170         {4, 2./3.},
0171         {5, -1./3},
0172         {6, 2./3.},
0173         {11, -1.},
0174         {12, 0.},
0175         {13, -1.},
0176         {14, 0.},
0177         {15, -1.},
0178         {16, 0.},
0179         {22, 0.},
0180         {23, 0.},
0181         {24, 1.},
0182         {111, 0.},
0183         {130, 0.},
0184         {211, 1.},
0185         {221, 0.},
0186         {310, 0.},
0187         {321, 1.},
0188         {421, 0.},
0189         {431, 1.},
0190         {441, 1.},
0191         {2112, 1.},
0192         {2212, 1.},
0193         {3112, -1.},
0194         {3122, 0.},
0195         {3212, 0.},
0196         {3222, 1.},
0197         {3322, 0.},
0198         {700201, 0.},
0199         {700202, 2.},
0200         {700301, 0.},
0201         {700302, 3.}
0202       };
0203       return mapPidOntoCharge;
0204     }
0205 
0206     // ------------------------------------------------------------------------
0207     //! Map of forbidden strings onto good ones
0208     // ------------------------------------------------------------------------
0209     inline map<string, string> MapBadOntoGoodStrings() {
0210       static map<string, string> mapBadOntoGoodStrings = {
0211         {"/", "_"},
0212         {"(", "_"},
0213         {")", ""},
0214         {"+", "plus"},
0215         {"-", "minus"},
0216         {"*", "star"},
0217       };
0218       return mapBadOntoGoodStrings;
0219     }
0220 
0221     // ------------------------------------------------------------------------
0222     //! Map of strings onto fastjet algorithms
0223     // ------------------------------------------------------------------------
0224     inline map<string, fastjet::JetAlgorithm> MapStringOntoFJAlgo() {
0225       static map<string, fastjet::JetAlgorithm> mapStringOntoAlgo = {
0226         {"kt",            fastjet::JetAlgorithm::kt_algorithm},
0227         {"c/a",           fastjet::JetAlgorithm::cambridge_algorithm},
0228         {"antikt",        fastjet::JetAlgorithm::antikt_algorithm},
0229         {"genkt",         fastjet::JetAlgorithm::genkt_algorithm},
0230         {"c/a_passive",   fastjet::JetAlgorithm::cambridge_for_passive_algorithm},
0231         {"genkt_passive", fastjet::JetAlgorithm::genkt_for_passive_algorithm},
0232         {"ee_kt",         fastjet::JetAlgorithm::ee_kt_algorithm},
0233         {"ee_genkt",      fastjet::JetAlgorithm::ee_genkt_algorithm},
0234         {"plugin",        fastjet::JetAlgorithm::plugin_algorithm},
0235       };
0236       return mapStringOntoAlgo;
0237     }
0238 
0239     // ------------------------------------------------------------------------
0240     //! Map of strings onto fastjet recombination schemes
0241     // ------------------------------------------------------------------------
0242     inline map<string, fastjet::RecombinationScheme> MapStringOntoFJRecomb() {
0243       static map<string, fastjet::RecombinationScheme> mapStringOntoRecomb = {
0244         {"e",        fastjet::RecombinationScheme::E_scheme},
0245         {"pt",       fastjet::RecombinationScheme::pt_scheme},
0246         {"pt2",      fastjet::RecombinationScheme::pt2_scheme},
0247         {"et",       fastjet::RecombinationScheme::Et_scheme},
0248         {"et2",      fastjet::RecombinationScheme::Et2_scheme},
0249         {"bi_pt",    fastjet::RecombinationScheme::BIpt_scheme},
0250         {"bi_pt2",   fastjet::RecombinationScheme::BIpt2_scheme},
0251         {"wta_pt",   fastjet::RecombinationScheme::WTA_pt_scheme},
0252         {"wta_modp", fastjet::RecombinationScheme::WTA_modp_scheme},
0253         {"external", fastjet::RecombinationScheme::external_scheme}
0254       };
0255       return mapStringOntoRecomb;
0256     }
0257 
0258     // ------------------------------------------------------------------------
0259     //! Map of strings onto fastjet area types
0260     // ------------------------------------------------------------------------
0261     inline map<string, fastjet::AreaType> MapStringOntoFJArea() {
0262       static map<string, fastjet::AreaType> mapStringOntoArea = {
0263         {"active",            fastjet::AreaType::active_area},
0264         {"passive",           fastjet::AreaType::passive_area},
0265         {"voronoi",           fastjet::AreaType::voronoi_area},
0266         {"active_explicit",   fastjet::AreaType::active_area_explicit_ghosts},
0267         {"one_ghost_passive", fastjet::AreaType::one_ghost_passive_area}
0268       };
0269       return mapStringOntoArea;
0270     }
0271 
0272     // ------------------------------------------------------------------------
0273     //! Map of subsytem index onto calorimeter ID
0274     // ------------------------------------------------------------------------
0275     inline map<int, int> MapIndexOntoID() {
0276       static map<int, int> mapIndexOntoID = {
0277         {Subsys::EMCal, RawTowerDefs::CalorimeterId::CEMC},
0278         {Subsys::RECal, RawTowerDefs::CalorimeterId::HCALIN},
0279         {Subsys::IHCal, RawTowerDefs::CalorimeterId::HCALIN},
0280         {Subsys::OHCal, RawTowerDefs::CalorimeterId::HCALOUT}
0281       };
0282       return mapIndexOntoID;
0283     }
0284 
0285     // ----------------------------------------------------------------------
0286     //! Map of subsystem index onto raw tower node names
0287     // ----------------------------------------------------------------------
0288     inline map<int, string> MapIndexOntoRawTowers() {
0289       static map<int, string> mapIndexOntoRawTowers = {
0290         {Subsys::EMCal, "TOWER_CALIB_CEMC"},
0291         {Subsys::RECal, "TOWER_CALIB_CEMC_RETOWER"},
0292         {Subsys::IHCal, "TOWER_CALIB_HCALIN"},
0293         {Subsys::OHCal, "TOWER_CALIB_HCALOUT"}
0294       };
0295       return mapIndexOntoRawTowers;
0296     }
0297 
0298     // ----------------------------------------------------------------------
0299     //! Map of subsystem index onto tower info node names
0300     // ----------------------------------------------------------------------
0301     inline map<int, string> MapIndexOntoTowerInfo() {
0302       static map<int, string> mapIndexOntoTowerInfo = {
0303         {Subsys::EMCal, "TOWERINFO_CALIB_CEMC"},
0304         {Subsys::RECal, "TOWERINFO_CALIB_CEMC_RETOWER"},
0305         {Subsys::IHCal, "TOWERINFO_CALIB_HCALIN"},
0306         {Subsys::OHCal, "TOWERINFO_CALIB_HCALOUT"}
0307       };
0308       return mapIndexOntoTowerInfo;
0309     }
0310 
0311     // ------------------------------------------------------------------------
0312     //! Map of subsytem index onto cluster node names
0313     // ------------------------------------------------------------------------
0314     inline map<int, string> MapIndexOntoClusters() {
0315       static map<int, string> mapIndexOntoClusters = {
0316         {Subsys::EMCal, "CLUSTER_CEMC"},
0317         {Subsys::IHCal, "CLUSTER_HCALIN"},
0318         {Subsys::OHCal, "CLUSTER_HCALOUT"}
0319       };
0320       return mapIndexOntoClusters;
0321     }
0322 
0323     // ------------------------------------------------------------------------
0324     //! Map of subsystem index onto raw tower geometry containers
0325     // ------------------------------------------------------------------------
0326     inline map<int, string> MapIndexOntoTowerGeom() {
0327       static map<int, string> mapIndexOntoTowerGeom = {
0328         {Subsys::EMCal, "TOWERGEOM_CEMC"},
0329         {Subsys::RECal, "TOWERGEOM_HCALIN"},
0330         {Subsys::IHCal, "TOWERGEOM_HCALIN"},
0331         {Subsys::OHCal, "TOWERGEOM_HCALOUT"}
0332       };
0333       return mapIndexOntoTowerGeom;
0334     }
0335 
0336     // ------------------------------------------------------------------------
0337     //! Map of subsystem index onto jet source index
0338     // ------------------------------------------------------------------------
0339     // FIXME this might not be necessary...
0340     inline map<int, Jet::SRC> MapIndexOntoSrc() {
0341       static map<int, Jet::SRC> mapIndexOntoSrc = {
0342         {Subsys::EMCal, Jet::SRC::CEMC_CLUSTER},
0343         {Subsys::IHCal, Jet::SRC::HCALIN_CLUSTER},
0344         {Subsys::OHCal, Jet::SRC::HCALOUT_CLUSTER}
0345       };
0346       return mapIndexOntoSrc;
0347     }
0348 
0349     // ------------------------------------------------------------------------
0350     //! Map of jet source index onto input node
0351     // ------------------------------------------------------------------------
0352     inline map<Jet::SRC, string> MapSrcOntoNode() {
0353       static map<Jet::SRC, string> mapSrcOntoNode = {
0354         {Jet::SRC::CEMC_CLUSTER, "CLUSTER_CEMC"},
0355         {Jet::SRC::HCALIN_CLUSTER, "CLUSTER_HCALIN"},
0356         {Jet::SRC::HCALOUT_CLUSTER, "CLUSTER_HCALOUT"},
0357         {Jet::SRC::HCAL_TOPO_CLUSTER, "TOPOCLUSTER_HCAL"},
0358         {Jet::SRC::ECAL_TOPO_CLUSTER, "TOPOCLUSTER_EMCAL"},
0359         {Jet::SRC::ECAL_HCAL_TOPO_CLUSTER, "TOPOCLUSTER_ALLCALO"},
0360         {Jet::SRC::CEMC_TOWER_RETOWER, "TOWER_CALIB_CEMC_RETOWER"},
0361         {Jet::SRC::CEMC_TOWERINFO_RETOWER, "TOWERINFO_CALIB_CEMC_RETOWER"},
0362         {Jet::SRC::CEMC_TOWER, "TOWER_CALIB_CEMC"},
0363         {Jet::SRC::HCALIN_TOWER, "TOWER_CALIB_HCALIN"},
0364         {Jet::SRC::HCALOUT_TOWER, "TOWER_CALIB_HCALOUT"},
0365         {Jet::SRC::CEMC_TOWERINFO, "TOWERINFO_CALIB_CEMC"},
0366         {Jet::SRC::HCALIN_TOWERINFO, "TOWERINFO_CALIB_HCALIN"},
0367         {Jet::SRC::HCALOUT_TOWERINFO, "TOWERINFO_CALIB_HCALOUT"},
0368         {Jet::SRC::CEMC_TOWERINFO_EMBED, "TOWERINFO_CALIB_EMBED_CEMC"},
0369         {Jet::SRC::HCALIN_TOWERINFO_EMBED, "TOWERINFO_CALIB_EMBED_HCALIN"},
0370         {Jet::SRC::HCALOUT_TOWERINFO_EMBED, "TOWERINFO_CALIB_EMBED_HCALOUT"},
0371         {Jet::SRC::CEMC_TOWERINFO_SIM, "TOWERINFO_CALIB_SIM_CEMC"},
0372         {Jet::SRC::HCALIN_TOWERINFO_SIM, "TOWERINFO_CALIB_SIM_HCALIN"},
0373         {Jet::SRC::HCALOUT_TOWERINFO_SIM, "TOWERINFO_CALIB_SIM_HCALOUT"},
0374         {Jet::SRC::CEMC_TOWER_SUB1, "TOWER_CALIB_CEMC_RETOWER_SUB1"},
0375         {Jet::SRC::HCALIN_TOWER_SUB1, "TOWER_CALIB_HCALIN_SUB1"},
0376         {Jet::SRC::HCALOUT_TOWER_SUB1, "TOWER_CALIB_HCALOUT_SUB1"},
0377         {Jet::SRC::CEMC_TOWERINFO_SUB1, "TOWERINFO_CALIB_CEMC_RETOWER_SUB1"},
0378         {Jet::SRC::HCALIN_TOWERINFO_SUB1, "TOWERINFO_CALIB_HCALIN_SUB1"},
0379         {Jet::SRC::HCALOUT_TOWERINFO_SUB1, "TOWERINFO_CALIB_HCALOUT_SUB1"},
0380         {Jet::SRC::CEMC_TOWER_SUB1CS, "TOWER_CALIB_CEMC_RETOWER_SUB1CS"},
0381         {Jet::SRC::HCALIN_TOWER_SUB1CS, "TOWER_CALIB_HCALIN_SUB1CS"},
0382         {Jet::SRC::HCALOUT_TOWER_SUB1CS, "TOWER_CALIB_HCALOUT_SUB1CS"},
0383         {Jet::SRC::TRACK, "SvtxTrackMap"},
0384         {Jet::SRC::PARTICLE, "G4TruthInfo"}
0385       };
0386       return mapSrcOntoNode;
0387     }
0388 
0389   }  // end Const namespace
0390 }  // end SColdQcdCorrealtorAnalysis namespace
0391 
0392 #endif
0393 
0394 // end ------------------------------------------------------------------------