50 |
|
#include "MuonSelection.h" |
51 |
|
#include "ElectronSelection.h" |
52 |
|
#include "IsolationSelection.h" |
53 |
< |
|
54 |
< |
//#include "Selection.h" |
55 |
< |
//#include "ReferenceSelection.h" |
56 |
< |
#include "ReferenceSelection2.h" |
53 |
> |
#include "ReferenceSelection.h" |
54 |
|
|
55 |
|
#include "TriggerUtils.h" |
56 |
|
#include "PassHLT.h" |
57 |
|
#include "Angles.h" |
58 |
|
#include "KinematicsStruct.h" |
59 |
|
#include "InfoStruct.h" |
60 |
< |
//#include "GenInfoStruct.h" |
60 |
> |
#include "GenInfoStruct.h" |
61 |
|
#include "WeightStruct.h" |
62 |
|
//#include "GlobalDataAndFuncs.h" |
63 |
|
#include "RunLumiRangeMap.h" |
96 |
|
//---------------------------------------------------------------------------- |
97 |
|
void initPUWeights(); |
98 |
|
double getPUWeight(unsigned npu); |
99 |
+ |
void setEra(string, ControlFlags&); |
100 |
|
void setEffiencyWeights(EventData&, WeightStruct& ); |
101 |
|
void initRunLumiRangeMap(); |
102 |
|
void initEvtRhoMap(map<unsigned,float> &); |
103 |
|
unsigned makePFnoPUArray(mithep::Array<PFCandidate> * fPFCandidates, |
104 |
|
vector<bool> &pfNoPileUpFlag, |
105 |
< |
const mithep::VertexCol * vtxArr ); |
105 |
> |
const mithep::Array<mithep::Vertex> * vtxArr ); |
106 |
|
//---------------------------------------------------------------------------- |
107 |
|
|
108 |
|
|
212 |
|
KinematicsStruct kinematics; |
213 |
|
InfoStruct evtinfo; |
214 |
|
WeightStruct weights; |
215 |
< |
// GenInfoStruct geninfo; |
215 |
> |
GenInfoStruct geninfo; |
216 |
|
|
217 |
|
AngleTuple nt( (const char*)ofname, (const char*)"zznt"); |
218 |
|
nt.makeAngleBranch(angles); |
223 |
|
foTree.makeFailedLeptonBranch(failingLeptons); |
224 |
|
foTree.makeZLeptonBranch(passingLeptons); |
225 |
|
|
226 |
< |
TH1F * h_w_hpt; |
226 |
> |
TH1F * h_wf11_hpt; |
227 |
|
if(ctrl.mc) { |
228 |
|
nt.makeWeightBranch(weights); |
229 |
< |
// nt.makeGenInfoBranch(geninfo); |
229 |
> |
nt.makeGenInfoBranch(geninfo); |
230 |
|
initEfficiencyWeights(); |
231 |
|
initPUWeights(); |
232 |
< |
/* |
232 |
> |
|
233 |
|
// Higgs only, pt reweighting |
234 |
|
if( ctrl.mH <= 140 ) { |
235 |
|
char wptname[256]; |
237 |
|
TFile * f_hpt = new TFile(wptname); |
238 |
|
f_hpt->Print(); |
239 |
|
sprintf(wptname, "weight_hqt_fehipro_fit_%i", ctrl.mH); |
240 |
< |
h_w_hpt = (TH1F*)(f_hpt->FindObjectAny(wptname)); |
243 |
< |
h_w_hpt->Print(); |
240 |
> |
h_wf11_hpt = (TH1F*)(f_hpt->FindObjectAny(wptname)); |
241 |
|
} |
242 |
< |
*/ |
242 |
> |
|
243 |
|
} else { |
244 |
|
initRunLumiRangeMap(); |
245 |
|
} |
262 |
|
string currentFile(""); |
263 |
|
|
264 |
|
mithep::EventHeader *info = new mithep::EventHeader(); |
268 |
– |
// mithep::TGenInfo *ginfo = new mithep::TGenInfo(); |
265 |
|
mithep::Array<mithep::Electron> *electronArr = new mithep::Array<mithep::Electron>(); |
266 |
|
mithep::Array<mithep::Muon> *muonArr = new mithep::Array<mithep::Muon>(); |
267 |
< |
const mithep::VertexCol *vtxArr = 0;//new mithep::Array<mithep::Vertex>(); |
267 |
> |
mithep::Array<mithep::Vertex> *vtxArr = new mithep::Array<mithep::Vertex>(); |
268 |
|
mithep::Array<mithep::PFCandidate> *pfArr = new mithep::Array<mithep::PFCandidate>(); |
269 |
|
mithep::Array<mithep::PileupInfo> *puArr = new mithep::Array<mithep::PileupInfo>(); |
270 |
|
mithep::Array<mithep::PileupEnergyDensity> *puDArr = new mithep::Array<mithep::PileupEnergyDensity>(); |
271 |
|
mithep::Array<mithep::Track> *trkArr = new mithep::Array<mithep::Track>(); |
272 |
|
mithep::Array<mithep::MCParticle> *mcArr = new mithep::Array<mithep::MCParticle>(); |
273 |
+ |
mithep::MCEventInfo *mcEvtInfo = new mithep::MCEventInfo(); |
274 |
|
mithep::TriggerMask *trigMask = new mithep::TriggerMask(); |
275 |
|
mithep::TriggerTable *hltTable = new mithep::TriggerTable(); |
276 |
|
vector<string> *hltTableStrings = new vector<string>(); |
284 |
|
TString fPileupEnergyDensityName(Names::gkPileupEnergyDensityBrn); |
285 |
|
TString fTrackName(Names::gkTrackBrn); |
286 |
|
TString fMCParticleName(Names::gkMCPartBrn); |
287 |
+ |
TString fMCEvtInfoName(Names::gkMCEvtInfoBrn); |
288 |
|
TString fTriggerMaskName(Names::gkHltBitBrn); |
289 |
|
TString fTriggerTableName(Names::gkHltTableBrn); |
290 |
|
|
296 |
|
if( ctrl.mc ) { |
297 |
|
chain->SetBranchAddress(fPileupInfoName, &puArr); |
298 |
|
chain->SetBranchAddress(fMCParticleName, &mcArr); |
299 |
+ |
chain->SetBranchAddress(fMCEvtInfoName, &mcEvtInfo); |
300 |
|
} |
301 |
|
chain->SetBranchAddress(fPileupEnergyDensityName, &puDArr); |
302 |
|
chain->SetBranchAddress(fTrackName, &trkArr); |
329 |
|
for(UInt_t ientry=0; ientry<imax; ientry++) |
330 |
|
{ |
331 |
|
chain->GetEntry(ientry); |
333 |
– |
|
334 |
– |
/* |
335 |
– |
bool found_tau=false; |
336 |
– |
if( ctrl.mc) { // && ctrl.debug |
337 |
– |
cout << "nparticles: " << mcArr->GetEntries() << endl; |
338 |
– |
cout << "-----------------------------------" << endl; |
339 |
– |
for( int i=0; i<mcArr->GetEntries(); i++ ) { |
340 |
– |
const mithep::MCParticle *mc = mcArr->At(i); |
341 |
– |
cout << "i: " << i << "\t" |
342 |
– |
<< "id: " << mc->AbsPdgId() |
343 |
– |
<< endl; |
344 |
– |
if( mc->Is(MCParticle::kTau) ) { |
345 |
– |
found_tau=true; |
346 |
– |
} |
347 |
– |
} |
348 |
– |
} |
349 |
– |
cout << "-----------------------------------" << endl; |
350 |
– |
cout << "found tau: " << found_tau << endl; |
351 |
– |
*/ |
352 |
– |
|
353 |
– |
// events that fail bc ele overlaps w/ reco mu |
354 |
– |
/* |
355 |
– |
if( info->EvtNum() != 67315 && |
356 |
– |
info->EvtNum() != 288693 ) continue; |
357 |
– |
*/ |
358 |
– |
|
359 |
– |
// events where they apparently don't veto electrons ... |
360 |
– |
/* |
361 |
– |
if( info->EvtNum() != 141713 && |
362 |
– |
info->EvtNum() != 178019 && |
363 |
– |
info->EvtNum() != 60823 && |
364 |
– |
info->EvtNum() != 192795 ) continue; |
365 |
– |
*/ |
366 |
– |
|
332 |
|
if(!(ientry%1000)) cerr << "entry: " << ientry << endl; |
368 |
– |
//if (!(setPV( ctrl, vtxArr, vtx)) ) continue; |
333 |
|
|
334 |
+ |
#ifdef HACKED_RHOS |
335 |
|
float rho = evtrhoMap[info->EvtNum()]; |
336 |
+ |
#endif |
337 |
+ |
string fname = string(chain->GetFile()->GetEndpointUrl()->GetFile()); |
338 |
+ |
setEra( fname, ctrl ); |
339 |
+ |
|
340 |
|
|
341 |
|
// |
342 |
|
// pfNoPU |
351 |
|
// |
352 |
|
if(ctrl.mc) { |
353 |
|
// |
354 |
+ |
// gen info |
355 |
+ |
// |
356 |
+ |
if(ctrl.fillGen) |
357 |
+ |
fillGenInfo( mcArr, mcEvtInfo, geninfo, ESampleType::kHZZ, ctrl); |
358 |
+ |
|
359 |
+ |
// |
360 |
|
// xsec & PU weights |
361 |
|
// |
362 |
< |
weights.w = 1;//getWeight(xstab,entrymap,chain)/ctrl.totalMC; |
362 |
> |
weights.w = getWeight(xstab,entrymap,chain)/ctrl.totalMC; |
363 |
|
cout << "xsec weight: " << weights.w << endl; |
364 |
|
int npu = -1; |
365 |
|
for(int i=0;i<puArr->GetEntries();i++) { |
369 |
|
assert(npu>=0); |
370 |
|
evtinfo.npu; |
371 |
|
weights.npuw = getPUWeight(evtinfo.npu); |
372 |
< |
// cout << "weight: " << weights.w << endl; |
372 |
> |
|
373 |
> |
// |
374 |
> |
// pt reweighting for Higgs < 140, F11 |
375 |
> |
// |
376 |
> |
if( ctrl.fillGen ) { |
377 |
> |
if( (fname.find("f11-h115zz4l") != string::npos) || |
378 |
> |
(fname.find("f11-h120zz4l") != string::npos) || |
379 |
> |
(fname.find("f11-h130zz4l") != string::npos) ) { |
380 |
> |
weights.w *= h_wf11_hpt->GetBinContent(h_wf11_hpt->FindBin(geninfo.pt_zz)); |
381 |
> |
} |
382 |
> |
} |
383 |
> |
|
384 |
|
// |
385 |
|
// trigger |
386 |
|
// |
437 |
|
|
438 |
|
|
439 |
|
// reference |
440 |
< |
apply_HZZ4L_reference2_selection(ctrl, info, |
440 |
> |
apply_HZZ4L_reference_selection(ctrl, info, |
441 |
|
vtxArr, |
442 |
|
pfArr, |
443 |
|
#ifdef HACKED_RHOS |
506 |
|
<< "woff: " << weights.woff << endl; |
507 |
|
} |
508 |
|
|
509 |
< |
/* |
524 |
< |
// only for Higgs < 140 |
525 |
< |
geninfo.weight *= h_w_hpt->GetBinContent(h_w_hpt->FindBin(geninfo.pt_zz)); |
526 |
< |
angles.bdt = reader->EvaluateMVA("BDTG"); |
527 |
< |
*/ |
509 |
> |
|
510 |
|
nt.Fill(); |
511 |
|
|
512 |
|
cerr << "PASS:: " |
669 |
|
|
670 |
|
//---------------------------------------------------------------------------- |
671 |
|
unsigned makePFnoPUArray(mithep::Array<PFCandidate> * fPFCandidates, |
672 |
< |
vector<bool> &pfNoPileUpflag, |
673 |
< |
const mithep::VertexCol * vtxArr ) |
672 |
> |
vector<bool> &pfNoPileUpflag, |
673 |
> |
const mithep::Array<mithep::Vertex> * vtxArr ) |
674 |
|
//---------------------------------------------------------------------------- |
675 |
|
{ |
676 |
|
for(UInt_t i = 0; i < fPFCandidates->GetEntries(); i++) { |
738 |
|
return pfNoPileUpflag.size(); |
739 |
|
} |
740 |
|
|
741 |
+ |
void setEra(string fname, ControlFlags &ctrl) |
742 |
+ |
{ |
743 |
+ |
if( ctrl.mc && (fname.find("f11-") != string::npos) ) ctrl.era=2011 ; |
744 |
+ |
if( ctrl.mc && (fname.find("s12-") != string::npos) ) ctrl.era=2012 ; |
745 |
+ |
if( !ctrl.mc && (fname.find("r11-") != string::npos) ) ctrl.era=2011 ; |
746 |
+ |
if( !ctrl.mc && (fname.find("r12-") != string::npos) ) ctrl.era=2012 ; |
747 |
+ |
} |