Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 /// ---------------------------------------------------------------------------
0002 /*! \file   JetTreeMakerOptions.h 
0003  *  \author Derek Anderson
0004  *  \date   04.11.2024
0005  *
0006  *  Options for the SCorrelatorJetTreeMaker module
0007  */
0008 /// ---------------------------------------------------------------------------
0009 
0010 #ifndef JETTREEMAKEROPTIONS_H
0011 #define JETTREEMAKEROPTIONS_H
0012 
0013 // c++ utilities
0014 #include <limits>
0015 #include <string>
0016 #include <vector>
0017 #include <utility>
0018 // root libraries
0019 #include <TF1.h>
0020 // analysis utilties
0021 #include <scorrelatorutilities/Types.h>
0022 #include <scorrelatorutilities/Constants.h>
0023 #include <scorrelatorutilities/Interfaces.h>
0024 // module configuration
0025 #include <scorrelatorjettreemaker/SCorrelatorJetTreeMakerConfig.h>
0026 
0027 // make common namespaces implicit
0028 using namespace std;
0029 using namespace SColdQcdCorrelatorAnalysis;
0030 
0031 
0032 
0033 namespace JetTreeMakerOptions {
0034 
0035   // acceptance cuts ==========================================================
0036 
0037   // event acceptances
0038   const pair<float, float> vzEvtRange = {-10., 10.};
0039   const pair<float, float> vrEvtRange = {0.0, 0.418};
0040 
0041   // track acceptances
0042   const pair<int,   int>   nMvtxTrkRange = {2, numeric_limits<int>::max()};
0043   const pair<int,   int>   nInttTrkRange = {1, numeric_limits<int>::max()};
0044   const pair<int,   int>   nTpcTrkRange  = {24, numeric_limits<int>::max()};
0045   const pair<float, float> ptTrkRange    = {0.2, 100.};
0046   const pair<float, float> etaTrkRange   = {-1.1, 1.1};
0047   const pair<float, float> qualTrkRange  = {0., 10.};
0048   const pair<float, float> dcaTrkRangeXY = {-5., 5.};
0049   const pair<float, float> dcaTrkRangeZ  = {-5., 5.};
0050   const pair<float, float> ptErrTrkRange = {0., 0.5};
0051 
0052   // for pt dependent dca cuts
0053   const pair<float, float> dcaPtFitMax    = {15., 15.};
0054   const pair<float, float> nDcaSigmaTrk   = {3., 3.};
0055   const vector<float>      dcaSigmaParsXY = {-0.0095, 0.091, -0.029};
0056   const vector<float>      dcaSigmaParsZ  = {1.73, 26.1, -9.45};
0057 
0058   // particle flow acceptances
0059   const pair<float, float> ptFlowRange  = {0.2, 100.};
0060   const pair<float, float> etaFlowRange = {-1.1, 1.1};
0061 
0062   // calo tower acceptances
0063   const pair<float, float> eETwrRange   = {0.2, 100.};
0064   const pair<float, float> etaETwrRange = {-1.1, 1.1};
0065   const pair<float, float> eHTwrRange   = {0.2, 100.};
0066   const pair<float, float> etaHTwrRange = {-1.1, 1.1};
0067 
0068   // calo cluster acceptances
0069   const pair<float, float> eEClustRange   = {0.3, 100.};
0070   const pair<float, float> etaEClustRange = {-1.1, 1.1};
0071   const pair<float, float> eHClustRange   = {0.3, 100.};
0072   const pair<float, float> etaHClustRange = {-1.1, 1.1};
0073 
0074   // particle acceptances
0075   const pair<float, float> ptParRange  = {0., 100.};
0076   const pair<float, float> etaParRange = {-1.1, 1.1};
0077 
0078 
0079 
0080   // bundle acceptances into pairs ============================================
0081 
0082   // --------------------------------------------------------------------------
0083   //! Bundle track acceptance cuts into a pair
0084   // --------------------------------------------------------------------------
0085   pair<Types::TrkInfo, Types::TrkInfo> GetTrkAccept(const bool doSigmaCut = false) {
0086 
0087     // create maximal range
0088     pair<Types::TrkInfo, Types::TrkInfo> trkAccept = {
0089       Types::TrkInfo(Const::Init::Minimize),
0090       Types::TrkInfo(Const::Init::Maximize)
0091     };
0092 
0093     // set specific bounds
0094     trkAccept.first.SetNMvtxLayer( nMvtxTrkRange.first );
0095     trkAccept.first.SetNInttLayer( nInttTrkRange.first );
0096     trkAccept.first.SetNTpcLayer( nTpcTrkRange.first );
0097     trkAccept.first.SetPT( ptTrkRange.first );
0098     trkAccept.first.SetEta( etaTrkRange.first );
0099     trkAccept.first.SetQuality( qualTrkRange.first );
0100     trkAccept.first.SetPtErr( ptErrTrkRange.first );
0101     trkAccept.second.SetNMvtxLayer( nMvtxTrkRange.second );
0102     trkAccept.second.SetNInttLayer( nInttTrkRange.second );
0103     trkAccept.second.SetNTpcLayer( nTpcTrkRange.second );
0104     trkAccept.second.SetPT( ptTrkRange.second );
0105     trkAccept.second.SetEta( etaTrkRange.second );
0106     trkAccept.second.SetQuality( qualTrkRange.second );
0107     trkAccept.second.SetPtErr( ptErrTrkRange.second );
0108 
0109     // set dca bounds if not doing pt-dependent cut
0110     if (!doSigmaCut) {
0111       trkAccept.first.SetDcaXY( dcaTrkRangeXY.first );
0112       trkAccept.first.SetDcaZ( dcaTrkRangeZ.first );
0113       trkAccept.second.SetDcaXY( dcaTrkRangeXY.second );
0114       trkAccept.second.SetDcaZ( dcaTrkRangeZ.second );
0115     }
0116     return trkAccept;
0117 
0118   }  // end 'GetTrkAccept(bool)'
0119 
0120 
0121 
0122   // --------------------------------------------------------------------------
0123   //! Bundle particle flow acceptance cuts into a pair
0124   // --------------------------------------------------------------------------
0125   pair<Types::FlowInfo, Types::FlowInfo> GetFlowAccept() {
0126 
0127     // create maximal range
0128     pair<Types::FlowInfo, Types::FlowInfo> flowAccept = {
0129       Types::FlowInfo(Const::Init::Minimize),
0130       Types::FlowInfo(Const::Init::Maximize)
0131     };
0132 
0133     // set specific bounds
0134     flowAccept.first.SetPT( ptFlowRange.first );
0135     flowAccept.first.SetEta( etaFlowRange.first );
0136     flowAccept.second.SetPT( ptFlowRange.second );
0137     flowAccept.second.SetEta( etaFlowRange.second );
0138     return flowAccept;
0139 
0140   }  // end 'GetFlowAccept()'
0141 
0142 
0143 
0144   // --------------------------------------------------------------------------
0145   //! Bundle calo tower acceptance cuts into a pair
0146   // --------------------------------------------------------------------------
0147   pair<Types::TwrInfo, Types::TwrInfo> GetTowerAccept(
0148     pair<double, double> eRange,
0149     pair<double, double> etaRange
0150   ) {
0151 
0152     // create maximal range
0153     pair<Types::TwrInfo, Types::TwrInfo> twrAccept = {
0154       Types::TwrInfo(Const::Init::Minimize),
0155       Types::TwrInfo(Const::Init::Maximize)
0156     };
0157 
0158     // set specific bounds
0159     twrAccept.first.SetEne( eRange.first );
0160     twrAccept.first.SetEta( etaRange.first );
0161     twrAccept.second.SetEne( eRange.second );
0162     twrAccept.second.SetEta( etaRange.second );
0163     return twrAccept;
0164 
0165   }  // end 'GetTowerAccept(pair<double, double>, pair<double, double>)'
0166 
0167 
0168 
0169   // --------------------------------------------------------------------------
0170   //! Bundle calo cluster acceptance cuts into a pair
0171   // --------------------------------------------------------------------------
0172   pair<Types::ClustInfo, Types::ClustInfo> GetClustAccept(
0173     pair<double, double> eRange,
0174     pair<double, double> etaRange
0175   ) {
0176 
0177     // create maximal range
0178     pair<Types::ClustInfo, Types::ClustInfo> clustAccept = {
0179       Types::ClustInfo(Const::Init::Minimize),
0180       Types::ClustInfo(Const::Init::Maximize)
0181     };
0182 
0183     // set specific bounds
0184     clustAccept.first.SetEne( eRange.first );
0185     clustAccept.first.SetEta( etaRange.first );
0186     clustAccept.second.SetEne( eRange.second );
0187     clustAccept.second.SetEta( etaRange.second );
0188     return clustAccept;
0189 
0190   }  // end 'GetClustAccept(pair<double, double>, pair<double, double>)'
0191 
0192 
0193 
0194   // --------------------------------------------------------------------------
0195   //! Bundle MC particle acceptance cuts into a pair
0196   // --------------------------------------------------------------------------
0197   pair<Types::ParInfo, Types::ParInfo> GetParAccept() {
0198 
0199     // create maximal range
0200     pair<Types::ParInfo, Types::ParInfo> parAccept = {
0201       Types::ParInfo(Const::Init::Minimize),
0202       Types::ParInfo(Const::Init::Maximize)
0203     };
0204 
0205     // set specific bounds
0206     parAccept.first.SetPT( ptParRange.first );
0207     parAccept.first.SetEta( etaParRange.first );
0208     parAccept.second.SetPT( ptParRange.second );
0209     parAccept.second.SetEta( etaParRange.second );
0210     return parAccept;
0211 
0212   }  // end 'GetParAccept()'
0213 
0214 
0215 
0216   // make sigma-dca fit funtions ==============================================
0217 
0218   // --------------------------------------------------------------------------
0219   //! Construct DCA sigma functions
0220   // --------------------------------------------------------------------------
0221   pair<TF1*, TF1*> GetSigmaDcaFunctions() {
0222 
0223     TF1* fSigmaDcaXY = Interfaces::GetSigmaDcaTF1( "fSigmaDcaXY", dcaSigmaParsXY, make_pair(ptTrkRange.first, dcaPtFitMax.first) );
0224     TF1* fSigmaDcaZ  = Interfaces::GetSigmaDcaTF1( "fSigmaDcaZ",  dcaSigmaParsZ,  make_pair(ptTrkRange.first, dcaPtFitMax.second) );
0225     return make_pair(fSigmaDcaXY, fSigmaDcaZ);
0226 
0227   }  // end 'GetSigmaDcaFunctions()'
0228 
0229 
0230 
0231   // set up configuration =====================================================
0232 
0233   // --------------------------------------------------------------------------
0234   //! Generate configuration for running jet reconstruction in module
0235   // --------------------------------------------------------------------------
0236   SCorrelatorJetTreeMakerConfig GetConfig(
0237     const int verbosity,
0238     const string outFile,
0239     const bool doDcaSigmaCut = false
0240   ) {
0241 
0242     SCorrelatorJetTreeMakerConfig cfg {
0243       .verbosity       = verbosity,
0244       .readJetNodes    = false,
0245       .isDebugOn       = true,
0246       .isSimulation    = true,
0247       .isEmbed         = false,
0248       .moduleName      = "SCorrelatorJetTreeMaker",
0249       .inRecoNodeName  = "",
0250       .inTrueNodeName  = "",
0251       .outFileName     = outFile,
0252       .recoJetTreeName = "RecoJetTree",
0253       .trueJetTreeName = "TrueJetTree",
0254       .rJet            = 0.4,
0255       .jetAlgo         = "antikt",
0256       .jetRecomb       = "pt",
0257       .jetArea         = "active",
0258       .jetType         = Const::JetType::Tower,
0259       .doVtxCut        = false,
0260       .doDcaSigmaCut   = doDcaSigmaCut,
0261       .requireSiSeeds  = true,
0262       .useOnlyPrimVtx  = true,
0263       .subEvtOpt       = Const::SubEvtOpt::Everything,
0264       .vrAccept        = vrEvtRange,
0265       .vzAccept        = vzEvtRange,
0266       .trkAccept       = GetTrkAccept(doDcaSigmaCut),
0267       .flowAccept      = GetFlowAccept(),
0268       .eTwrAccept      = GetTowerAccept(eETwrRange, etaETwrRange),
0269       .hTwrAccept      = GetTowerAccept(eHTwrRange, etaHTwrRange),
0270       .eClustAccept    = GetClustAccept(eEClustRange, etaEClustRange),
0271       .hClustAccept    = GetClustAccept(eHClustRange, etaHClustRange),
0272       .parAccept       = GetParAccept(),
0273       .nSigCut         = nDcaSigmaTrk,
0274       .ptFitMax        = dcaPtFitMax,
0275       .fSigDca         = GetSigmaDcaFunctions()
0276     };
0277     return cfg;
0278 
0279   }  // end 'GetConfig(int, string, bool)'
0280 
0281 
0282 
0283   // --------------------------------------------------------------------------
0284   //! Generate configuration for reading in a jet node
0285   // --------------------------------------------------------------------------
0286   SCorrelatorJetTreeMakerConfig GetConfig(
0287     const int verbosity,
0288     const float reso,
0289     const string inRecoNode,
0290     const string inTrueNode,
0291     const string outFile
0292   ) {
0293 
0294     SCorrelatorJetTreeMakerConfig cfg {
0295       .verbosity       = verbosity,
0296       .readJetNodes    = true,
0297       .isDebugOn       = true,
0298       .isSimulation    = true,
0299       .isEmbed         = false,
0300       .moduleName      = "SCorrelatorJetTreeMaker",
0301       .inRecoNodeName  = inRecoNode,
0302       .inTrueNodeName  = inTrueNode,
0303       .outFileName     = outFile,
0304       .recoJetTreeName = "RecoJetTree",
0305       .trueJetTreeName = "TrueJetTree",
0306       .rJet            = reso,
0307       .jetAlgo         = "",
0308       .jetRecomb       = "",
0309       .jetArea         = "",
0310       .jetType         = Const::JetType::Tower,
0311       .doVtxCut        = false,
0312       .doDcaSigmaCut   = false,
0313       .requireSiSeeds  = false,
0314       .useOnlyPrimVtx  = true,
0315       .subEvtOpt       = Const::SubEvtOpt::Everything,
0316       .vrAccept        = vrEvtRange,
0317       .vzAccept        = vzEvtRange,
0318       .trkAccept       = GetTrkAccept(false),
0319       .flowAccept      = GetFlowAccept(),
0320       .eTwrAccept      = GetTowerAccept(eETwrRange, etaETwrRange),
0321       .hTwrAccept      = GetTowerAccept(eHTwrRange, etaHTwrRange),
0322       .eClustAccept    = GetClustAccept(eEClustRange, etaEClustRange),
0323       .hClustAccept    = GetClustAccept(eHClustRange, etaHClustRange),
0324       .parAccept       = GetParAccept(),
0325       .nSigCut         = nDcaSigmaTrk,
0326       .ptFitMax        = dcaPtFitMax,
0327       .fSigDca         = GetSigmaDcaFunctions()
0328     };
0329     return cfg;
0330 
0331   }  // end 'GetConfig(int, float, string, string, string)'
0332 
0333 }  // end JetTreeMakerOptions namespace
0334 
0335 #endif
0336 
0337 // end ------------------------------------------------------------------------