8 |
|
#include "MitPhysics/Utils/interface/IsolationTools.h" |
9 |
|
#include "MitPhysics/Utils/interface/PhotonTools.h" |
10 |
|
#include "MitPhysics/Utils/interface/VertexTools.h" |
11 |
+ |
#include "MitPhysics/Utils/interface/PFMetCorrectionTools.h" |
12 |
+ |
#include "MitAna/DataTree/interface/PFJetCol.h" |
13 |
+ |
#include "MitAna/DataTree/interface/GenJetCol.h" |
14 |
|
#include "TDataMember.h" |
15 |
|
#include <TNtuple.h> |
16 |
|
#include <TRandom3.h> |
41 |
|
fSuperClusterName ("PFSuperClusters"), |
42 |
|
fPFMetName ("PFMet"), |
43 |
|
fPFJetName (Names::gkPFJetBrn), |
44 |
< |
|
44 |
> |
funcorrPFJetName ("AKt5PFJets"), |
45 |
> |
fGenJetName ("AKT5GenJets"), |
46 |
|
fLeptonTagElectronsName ("HggLeptonTagElectrons"), |
47 |
|
fLeptonTagMuonsName ("HggLeptonTagMuons"), |
48 |
|
|
65 |
|
fPileUp (0), |
66 |
|
fSuperClusters (0), |
67 |
|
fPFJets (0), |
68 |
+ |
fGenJets (0), |
69 |
+ |
funcorrPFJets (0), |
70 |
|
|
71 |
|
fLeptonTagElectrons (0), |
72 |
|
fLeptonTagMuons (0), |
122 |
|
LoadEventObject(fPFCandName, fPFCands); |
123 |
|
LoadEventObject(fSuperClusterName, fSuperClusters); |
124 |
|
LoadEventObject(fPFMetName, fPFMet); |
125 |
< |
if (fEnableJets) |
125 |
> |
if (fEnableJets){ |
126 |
|
LoadEventObject(fPFJetName, fPFJets); |
127 |
< |
|
127 |
> |
//LoadEventObject(funcorrPFJetName, funcorrPFJets); |
128 |
> |
LoadBranch(funcorrPFJetName); |
129 |
> |
// if(!fIsData) LoadEventObject(fGenJetName, fGenJets); |
130 |
> |
} |
131 |
|
// ------------------------------------------------------------ |
132 |
|
// load event based information |
133 |
|
Int_t _numPU = -1.; // some sensible default values.... |
143 |
|
if( !fIsData ) { |
144 |
|
LoadBranch(fMCParticleName); |
145 |
|
LoadBranch(fPileUpName); |
146 |
< |
} |
146 |
> |
if (fEnableJets) LoadEventObject(fGenJetName, fGenJets); |
147 |
> |
} else fGenJets = NULL; |
148 |
|
|
149 |
|
if( !fIsData ) { |
150 |
|
for (UInt_t i=0; i<fPileUp->GetEntries(); ++i) { |
364 |
|
} |
365 |
|
} |
366 |
|
|
367 |
+ |
|
368 |
+ |
//added gen. info of whether a lep. or nutrino is from W or Z --Heng 02/14/2012 12:30 EST |
369 |
+ |
Double_t _fromZ = -99; |
370 |
+ |
Double_t _fromW = -99; |
371 |
+ |
Float_t _zpt = -99; |
372 |
+ |
Float_t _zEta = -99; |
373 |
+ |
Float_t _allZpt = -99; |
374 |
+ |
Float_t _allZEta = -99; |
375 |
+ |
|
376 |
+ |
if( !fIsData ){ |
377 |
+ |
|
378 |
+ |
// loop over all GEN particles and look for nutrinos whoes mother is Z |
379 |
+ |
for(UInt_t j=0; j<fMCParticles->GetEntries(); ++j) { |
380 |
+ |
const MCParticle* p = fMCParticles->At(j); |
381 |
+ |
if( p->AbsPdgId()==23 ||p->AbsPdgId()==32 || p->AbsPdgId()==33 ) { |
382 |
+ |
_allZpt=p->Pt(); |
383 |
+ |
_allZEta=p->Eta(); |
384 |
+ |
if (p->HasDaughter(12,kFALSE) || p->HasDaughter(14,kFALSE) || p->HasDaughter(16,kFALSE) ||p->HasDaughter(18,kFALSE) ) { |
385 |
+ |
_fromZ=1; |
386 |
+ |
_zpt=p->Pt(); |
387 |
+ |
_zEta=p->Eta(); |
388 |
+ |
} |
389 |
+ |
} |
390 |
+ |
else _fromW=1; |
391 |
+ |
} |
392 |
+ |
} |
393 |
+ |
|
394 |
+ |
/* |
395 |
+ |
for(UInt_t j=0; j<fMCParticles->GetEntries(); ++j) { |
396 |
+ |
const MCParticle* p = fMCParticles->At(j); |
397 |
+ |
if( p->AbsPdgId()==23 ||p->AbsPdgId()==32 || p->AbsPdgId()==33 ) { |
398 |
+ |
_fromZ=1; |
399 |
+ |
_zpt=p->Pt(); |
400 |
+ |
} |
401 |
+ |
else _fromW=1; |
402 |
+ |
} |
403 |
+ |
} |
404 |
+ |
|
405 |
+ |
*/ |
406 |
+ |
fDiphotonEvent->fromZ = _fromZ; |
407 |
+ |
fDiphotonEvent->fromW = _fromW; |
408 |
+ |
fDiphotonEvent->zpt = _zpt; |
409 |
+ |
fDiphotonEvent->zEta = _zEta; |
410 |
+ |
fDiphotonEvent->allZpt = _allZpt; |
411 |
+ |
fDiphotonEvent->allZEta = _allZEta; |
412 |
+ |
|
413 |
+ |
Double_t _dphiMetgg = -99; |
414 |
+ |
Double_t _cosdphiMetgg = -99; |
415 |
+ |
Double_t _dphiPhPh = -99; |
416 |
|
Double_t _mass = -99.; |
417 |
|
Double_t _masserr = -99.; |
418 |
|
Double_t _masserrsmeared = -99.; |
424 |
|
Double_t _costheta = -99.; |
425 |
|
PhotonTools::DiphotonR9EtaPtCats _evtcat = PhotonTools::kOctCat0; |
426 |
|
if (phHard && phSoft) { |
427 |
+ |
_dphiMetgg = MathUtils::DeltaPhi((phHard->Mom()+phSoft->Mom()).Phi(),fPFMet->At(0)->Phi()); |
428 |
+ |
_cosdphiMetgg = TMath::Cos(_dphiMetgg); |
429 |
+ |
_dphiPhPh = MathUtils::DeltaPhi((phHard->Mom()).Phi(),(phSoft->Mom()).Phi()); |
430 |
|
_mass = (phHard->Mom()+phSoft->Mom()).M(); |
431 |
|
_masserr = 0.5*_mass*TMath::Sqrt(phHard->EnergyErr()*phHard->EnergyErr()/phHard->E()/phHard->E() + phSoft->EnergyErr()*phSoft->EnergyErr()/phSoft->E()/phSoft->E()); |
432 |
|
_masserrsmeared = 0.5*_mass*TMath::Sqrt(phHard->EnergyErrSmeared()*phHard->EnergyErrSmeared()/phHard->E()/phHard->E() + phSoft->EnergyErrSmeared()*phSoft->EnergyErrSmeared()/phSoft->E()/phSoft->E()); |
459 |
|
|
460 |
|
} |
461 |
|
|
462 |
+ |
Met *corrMet = new Met(fPFMet->At(0)->Px(),fPFMet->At(0)->Py()); |
463 |
+ |
PFMetCorrectionTools::correctMet(corrMet,phHard,phSoft,1,1,funcorrPFJets,fGenJets,fPFJets); |
464 |
+ |
PFMetCorrectionTools::shiftMet(corrMet,fIsData); |
465 |
+ |
|
466 |
+ |
fDiphotonEvent->corrpfmet = corrMet->Pt(); |
467 |
+ |
fDiphotonEvent->corrpfmetphi = corrMet->Phi(); |
468 |
+ |
fDiphotonEvent->corrpfmetx = corrMet->Px(); |
469 |
+ |
fDiphotonEvent->corrpfmety = corrMet->Py(); |
470 |
+ |
|
471 |
|
Float_t _massele = -99.; |
472 |
|
Float_t _ptee = -99.; |
473 |
|
Float_t _costhetaele = -99.; |
483 |
|
} |
484 |
|
|
485 |
|
fDiphotonEvent->gencostheta = _gencostheta; |
486 |
+ |
fDiphotonEvent->dphiMetgg = _dphiMetgg; |
487 |
+ |
fDiphotonEvent->cosdphiMetgg = _cosdphiMetgg; |
488 |
+ |
fDiphotonEvent->dphiPhPh = _dphiPhPh; |
489 |
|
fDiphotonEvent->mass = _mass; |
490 |
|
fDiphotonEvent->masserr = _masserr; |
491 |
|
fDiphotonEvent->masserrsmeared = _masserrsmeared; |
696 |
|
fElectrons,fApplyElectronVeto); |
697 |
|
hCiCTupleSingle->Fill(); |
698 |
|
} |
699 |
+ |
|
700 |
+ |
|
701 |
+ |
|
702 |
|
|
703 |
|
return; |
704 |
|
} |
725 |
|
ReqEventObject(fPFCandName, fPFCands, true); |
726 |
|
ReqEventObject(fSuperClusterName,fSuperClusters,true); |
727 |
|
ReqEventObject(fPFMetName, fPFMet, true); |
728 |
< |
if (fEnableJets) |
729 |
< |
ReqEventObject(fPFJetName, fPFJets, fPFJetsFromBranch); |
728 |
> |
if (fEnableJets){ |
729 |
> |
ReqEventObject(fPFJetName, fPFJets, fPFJetsFromBranch); |
730 |
> |
ReqBranch(funcorrPFJetName, funcorrPFJets); |
731 |
> |
// if (!fIsData) ReqEventObject(fGenJetName, fGenJets, true); |
732 |
> |
} |
733 |
|
if (!fIsData) { |
734 |
|
ReqBranch(fPileUpName, fPileUp); |
735 |
|
ReqBranch(fMCParticleName, fMCParticles); |
736 |
+ |
if (fEnableJets) ReqEventObject(fGenJetName, fGenJets, true); |
737 |
|
} |
738 |
|
if (fIsData) { |
739 |
|
fPhFixDataFile = gSystem->Getenv("CMSSW_BASE") + |