File indexing completed on 2025-08-05 08:13:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 int get_luminosity_182630(string rnlist, int zsel)
0041 {
0042 gStyle->SetOptStat(0);
0043
0044 if(zsel > 5 || zsel < 0)
0045 {
0046 cout << "z selection must be between 0 and 5 (inclusive) for |zvtx| < 30/60/200/10/1000/none, respectively! Exiting." << endl;
0047 return 2;
0048 }
0049 const int ntrig = 3;
0050 float mbsig = 25.2;
0051 int upperrun = 53000;
0052 int lowerrun = 47200;
0053 ifstream is(rnlist);
0054 string rnstr;
0055 TH1D* mbdrate = new TH1D("mbdrate","",upperrun-lowerrun,lowerrun-.5,upperrun-.5);
0056 TH1D* nSB10 = new TH1D("nSB10","",upperrun-lowerrun,lowerrun-0.5,upperrun-0.5);
0057 TH1D* nSB18 = new TH1D("nSB18","",upperrun-lowerrun,lowerrun-0.5,upperrun-0.5);
0058 TH1D* fsb10l30 = new TH1D("fsb10l30","",upperrun-lowerrun,lowerrun-0.5,upperrun-0.5);
0059 TH1D* fsb18l30 = new TH1D("fsb18l30","",upperrun-lowerrun,lowerrun-0.5,upperrun-0.5);
0060
0061 float lumi[ntrig] = {0};
0062 float uclumi[ntrig] = {0};
0063 int trigs[ntrig] = {18,22,30};
0064 cout << "RN Bit"<<to_string(trigs[0])<<"Corr Bit"<<to_string(trigs[0])<<"UC Bit"<<to_string(trigs[1])<<"Corr Bit"<<to_string(trigs[1])<<"UC Bit"<<to_string(trigs[2])<<"Corr Bit"<<to_string(trigs[2])<<"UC (units pb^-1)" << endl << endl;
0065 while(getline(is, rnstr))
0066 {
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078 TFile* file;
0079 file = TFile::Open(("output/added_nblair/triggeroutput_nblair_"+rnstr+".root").c_str(),"READ");
0080 if(!file)
0081 {
0082 cerr << "RN " << rnstr << " not found! Continuing." << endl;
0083 cout << rnstr << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << endl;
0084 continue;
0085 }
0086 long long unsigned int tottrigcounts[6][64];
0087 double avgPS[64];
0088 long long unsigned int sumgoodscaled[64];
0089 long long unsigned int sumgoodraw[64];
0090 long long unsigned int sumgoodlive[64];
0091 float nmbdc;
0092 float ttseg;
0093 float nblair;
0094 TTree* tree = (TTree*)file->Get("outt");
0095
0096 if(!tree)
0097 {
0098 cerr << "RN " << rnstr << " does not contain tree outt! Continuing." << endl;
0099 cout << rnstr << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0 << endl;
0100 continue;
0101 }
0102 tree->SetBranchAddress("avgPS",avgPS);
0103 tree->SetBranchAddress("sumgoodscaled",sumgoodscaled);
0104 tree->SetBranchAddress("sumgoodlive",sumgoodlive);
0105 tree->SetBranchAddress("sumgoodraw",sumgoodraw);
0106 tree->SetBranchAddress("tottrigcounts",tottrigcounts);
0107 tree->SetBranchAddress("nmbdc",&nmbdc);
0108 tree->SetBranchAddress("ttseg",&ttseg);
0109 tree->SetBranchAddress("nblair",&nblair);
0110 tree->GetEntry(0);
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143 if(nmbdc/((double)sumgoodraw[10]) < 1)
0144 {
0145 cerr << rnstr << " " << nmbdc << " " << sumgoodraw[10] << " " << nmbdc / (double)sumgoodraw[10] << endl;
0146 continue;
0147 }
0148 cout << rnstr;
0149
0150
0151
0152 for(int i=0; i<3; ++i)
0153 {
0154 int trigger = trigs[i];
0155 if(avgPS[trigger] > 0 && !isnan(avgPS[trigger]) && !isnan(avgPS[10]) && !isnan((tottrigcounts[zsel][10])) && !isinf(avgPS[10]) && !isinf(avgPS[trigger]) && !isinf((tottrigcounts[zsel][10])) && avgPS[10] > 0)
0156 {
0157
0158 float clumiseg = (tottrigcounts[zsel][10])*avgPS[10]*((((nmbdc/((double)sumgoodraw[10])))))/avgPS[trigger]/(mbsig*1e9);
0159 float uclumiseg = (tottrigcounts[zsel][10])*((double)avgPS[10])/avgPS[trigger]/(mbsig*1e9);
0160 float blumiseg = (tottrigcounts[zsel][10])*avgPS[10]*((((nblair/((double)sumgoodraw[10]))-1)/2)+1)/avgPS[trigger]/(mbsig*1e9);
0161 uclumi[i] += uclumiseg;
0162 lumi[i] += clumiseg;
0163 cout << " " << fixed << setprecision(7) << clumiseg << " " << uclumiseg;
0164 }
0165 else
0166 {
0167 cout << " " << 0 << " " << 0;
0168 }
0169
0170
0171 }
0172 cout << endl;
0173 }
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188 cout << "RN Bit"<<to_string(trigs[0])<<"Corr Bit"<<to_string(trigs[0])<<"UC Bit"<<to_string(trigs[1])<<"Corr Bit"<<to_string(trigs[1])<<"UC Bit"<<to_string(trigs[2])<<"Corr Bit"<<to_string(trigs[2])<<"UC (units pb^-1)" << endl << endl;
0189 cout << "Totals: " << fixed << setprecision(5)<< lumi[0] << " " << uclumi[0] << " " << lumi[1] << " " << uclumi[1] << " " << lumi[2] << " " << uclumi[2] << " " << " pb^-1" << endl;
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211 return 0;
0212 }