22 |
|
#include "HistHeaders.h" |
23 |
|
#include "TriggerUtils.h" |
24 |
|
#include "JetDefs.h" |
25 |
– |
#include "JetInfoStruct.h" |
25 |
|
#include "FR_struct.h" |
26 |
|
#include "SelectionFuncs.h" |
27 |
|
#include "SampleWeight.h" |
80 |
|
// |
81 |
|
// ctrl.makeFakeTuples: write out zznt-type ntuples to be read by plotH4l or by SR mode |
82 |
|
// ctrl.hiStatFakes: same as makeFakeTuples, but reverse charge and flavor req's to get a larger sample for BDT training (or to plot the WrongFlavorCharge control region) |
83 |
< |
// ctrl.ssof: look only at ssof region |
83 |
> |
// ctrl.ssof: look only at ssof region. NOTE: I know there was a good reason I named it '-of', but at the moment it escapes me utterly, since it's same-flavor. wtf, dude? |
84 |
|
// ctrl.writessofratio: write the OS / SS ratio to text files that can be read later in ssof mode |
85 |
|
// ctrl.plotWholeSample: plot the whole fake sample without weighting with the fake rate |
86 |
|
|
152 |
|
filestuff *fs = (cs->fsv)[ifs]; |
153 |
|
if(ctrl.makeFakeTuples && fs->dataset_!="fakes") { // write a copy of the input trees for events that will be used for the SR fake prediction |
154 |
|
TString fakefilename(fs->fname_); |
155 |
< |
fakefilename.ReplaceAll(".root","-"+ctrl.faketype+(ctrl.ssof ? "-ssof" : "")+"-fakes.root"); |
155 |
> |
TString xtraStr(""); |
156 |
> |
if(ctrl.ssof) xtraStr = "-ssof"; |
157 |
> |
if(ctrl.heavyFlavor) xtraStr = "-heavy"; |
158 |
> |
fakefilename.ReplaceAll(".root","-"+ctrl.faketype+xtraStr+"-fakes.root"); |
159 |
|
if(ctrl.hiStatFakes) fakefilename.ReplaceAll("-fakes.root","-fakes-histat.root"); |
160 |
|
fs->makeOutputFile(fakefilename); |
161 |
|
} |
191 |
|
double best_mz1 = findZ1(fs->passingL,best_z_indices,40); |
192 |
|
if(best_mz1<=0) nBadZs++; |
193 |
|
if(best_mz1 < 40 || best_mz1 > 120) continue; |
194 |
< |
if(ctrl.heavyFlavor && best_mz1<60) continue; |
194 |
> |
if(ctrl.heavyFlavor && !ctrl.makeFakeTuples && best_mz1<60) continue; |
195 |
|
EventData evtdata; |
196 |
|
evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.first]); |
197 |
|
evtdata.Z1leptons.push_back((*fs->passingL)[best_z_indices.second]); |
200 |
|
vector<pair<SimpleLepton,SimpleLepton> > z2cands; |
201 |
|
vector<TString> types; |
202 |
|
TString signFlavor; |
203 |
< |
if(ctrl.heavyFlavor) signFlavor = ""; |
203 |
> |
if(ctrl.heavyFlavor && !ctrl.makeFakeTuples) signFlavor = ""; |
204 |
|
else if(ctrl.ssof) signFlavor = "SS-SF"; |
205 |
|
else if(ctrl.hiStatFakes) signFlavor = "signalExclude"; |
206 |
|
else signFlavor = "OS-SF"; |
207 |
< |
double minMz2 = ctrl.heavyFlavor ? 0 : 12; |
207 |
> |
double minMz2 = (ctrl.heavyFlavor && !ctrl.makeFakeTuples) ? 0 : 12; |
208 |
|
int hiPtPassingZ2 = findZ2CandidatesPassFail(fs->passingL, z2cands, types, signFlavor, minMz2, "pass",&best_z_indices); // signal region |
209 |
|
int hiPtFailingZ2 = findZ2CandidatesPassFail(fs->failingL, z2cands, types, signFlavor, minMz2, "fail"); // 2P+2F |
210 |
|
int hiPtPfZ2 = findZ2CandidatesPassFail(fs->passingL, z2cands, types, signFlavor, minMz2, "PF", &best_z_indices, fs->failingL); // 3P+1F |
242 |
|
fillKinematics(evtdata,kine); |
243 |
|
lepFrs fwgts; |
244 |
|
fillLeptonFakeWeights(fwgts, (fs->era_==2011) ? &fr2011 : &fr2012, lep3, lep4); |
245 |
< |
TString channel = getChannel(lep1,lep2,lep3,lep4); |
245 |
> |
TString channel = ctrl.hiStatFakes ? "" : getChannel(lep1,lep2,lep3,lep4); |
246 |
|
// bool hltPass = fs->isdata_ ? passHlt(ctrl,ti,fs->info,lep1.scID,lep2.scID,lep3.scID,lep4.scID) : true; |
247 |
|
|
248 |
|
if(ctrl.heavyFlavor) { |