Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DoStandaloneCorrelatorCalculation.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DoStandaloneCorrelatorCalculation.C
1 // ----------------------------------------------------------------------------
2 // 'DoStandaloneCorrelatorCalculation.C'
3 // Derek Anderson
4 // 02.02.2023
5 //
6 // Use this to run the SEnergyCorrelator
7 // class in standalone mode.
8 //
9 // NOTE: subEvtOpt controls which sub-event
10 // to use in MC
11 // 0 -- use everything
12 // 1 -- use only signal subevent
13 // 2 -- use only background subevents
14 // (pileup and underlying event)
15 // 3 -- use only primary background
16 // (i.e. underlying event)
17 // 4 -- use only pileup subevents
18 // 5 -- use specific set of subevents
19 // ----------------------------------------------------------------------------
20 
21 #ifndef DOSTANDALONECORRELATORCALCULATION_C
22 #define DOSTANDALONECORRELATORCALCULATION_C
23 
24 // standard c includes
25 #include <string>
26 #include <vector>
27 #include <cstdlib>
28 #include <utility>
29 // user includes
30 #include "/sphenix/user/danderson/install/include/senergycorrelator/SEnergyCorrelator.h"
31 
32 // load libraries
33 R__LOAD_LIBRARY(/sphenix/user/danderson/install/lib/libsenergycorrelator.so)
34 
35 using namespace std;
36 using namespace SColdQcdCorrelatorAnalysis;
37 
38 
39 
41 
42  // io parameters
43  const vector<vector<string>> inFile = {
44  {"../SCorrelatorJetTree/output/condor/final_merge/correlatorJetTree.pp200py8jet10run8_trksWithRoughCuts.d26m9y2023.root"},
45  {"../SCorrelatorJetTree/output/condor/final_merge/correlatorJetTree.pp200py8jet10run8_trksWithRoughCuts.d26m9y2023.root"}
46  };
47  const vector<string> inTree = {
48  "RecoJetTree",
49  "TruthJetTree"
50  };
51  const vector<string> outFile = {
52  "twoPoint.pp200py8jet10run8.testCstPtUpperLimit_pt10100_roughCutsWithGoodJetEta_reco.d25m10y2023.root",
53  "twoPoint.pp200py8jet10run8.testCstPtUpperLimit_pt10100_roughCutsWithGoodJetEta_true.d25m10y2023.root"
54  };
55 
56  // module parameters
57  const vector<string> moduleName = {
58  "SRecoEnergyCorrelator",
59  "STrueEnergyCorrelator"
60  };
61  const vector<bool> isTruth = {
62  false,
63  true
64  };
65 
66  // correlator parameters
67  const uint32_t nPointCorr = 2;
68  const uint64_t nBinsDr = 75;
69  const pair<double, double> binRangeDr = {1e-5, 1.};
70 
71  // jet/cst parameters
72  const pair<double, double> etaJetRange = {-0.7, 0.7};
73  const pair<double, double> momCstRange = {10., 100.};
74  const pair<double, double> drCstRange = {0., 100.};
75 
76  // jet pT bins
77  const vector<pair<double, double>> ptJetBins = {{5., 10.}, {10., 15.}, {15., 20.}, {20., 30.}, {30., 50.}};
78 
79  // embedding-specific options
80  const int subEvtOpt = 0;
81  const bool isEmbed = false;
82 
83  // misc parameters
84  const int verbosity = 0;
85  const bool isComplex = false;
86  const bool doCstCuts = true;
87  const bool doDebug = false;
88  const bool doCstLoop2 = false;
89  const bool inBatch = false;
90 
91  // do correlator calculation on reco jets
92  SEnergyCorrelator* recoCorrelator = new SEnergyCorrelator(moduleName[0], isComplex, doDebug, inBatch);
93  recoCorrelator -> SetVerbosity(verbosity);
94  recoCorrelator -> SetInputFiles(inFile[0]);
95  recoCorrelator -> SetInputTree(inTree[0], isTruth[0]);
96  recoCorrelator -> SetOutputFile(outFile[0]);
97  recoCorrelator -> SetJetParameters(ptJetBins, etaJetRange);
98  recoCorrelator -> SetConstituentParameters(momCstRange, drCstRange, doCstCuts);
99  recoCorrelator -> SetCorrelatorParameters(nPointCorr, nBinsDr, binRangeDr);
100  recoCorrelator -> SetDoSecondCstLoop(doCstLoop2);
101  recoCorrelator -> Init();
102  recoCorrelator -> Analyze();
103  recoCorrelator -> End();
104 
105  // do correlator calculation on truth jets
106  SEnergyCorrelator* trueCorrelator = new SEnergyCorrelator(moduleName[1], isComplex, doDebug, inBatch);
107  trueCorrelator -> SetVerbosity(verbosity);
108  trueCorrelator -> SetInputFiles(inFile[1]);
109  trueCorrelator -> SetInputTree(inTree[1], isTruth[1], isEmbed);
110  trueCorrelator -> SetOutputFile(outFile[1]);
111  trueCorrelator -> SetJetParameters(ptJetBins, etaJetRange);
112  trueCorrelator -> SetConstituentParameters(momCstRange, drCstRange, doCstCuts);
113  trueCorrelator -> SetCorrelatorParameters(nPointCorr, nBinsDr, binRangeDr);
114  if (isEmbed) {
115  trueCorrelator -> SetSubEventsToUse(subEvtOpt);
116  }
117  trueCorrelator -> SetDoSecondCstLoop(doCstLoop2);
118  trueCorrelator -> Init();
119  trueCorrelator -> Analyze();
120  trueCorrelator -> End();
121  return;
122 
123 }
124 
125 #endif
126 
127 // end ------------------------------------------------------------------------