1 |
|
#include "ZeeTreeWriterMod.h" |
2 |
|
#include "SelectionFuncs.h" |
3 |
|
#include "TDataMember.h" |
4 |
< |
|
4 |
> |
#include "TriggerUtils.h" |
5 |
> |
#include "ElectronTools.h" |
6 |
|
|
7 |
|
const Float_t g_electron_mass = 0.51099892e-3; |
8 |
|
const Float_t g_muon_mass = 105.658369e-3; |
15 |
|
|
16 |
|
void mithep::ZeeTreeWriterMod::SlaveBegin() |
17 |
|
{ |
18 |
+ |
initElectronIDMVAV1(); |
19 |
+ |
|
20 |
+ |
|
21 |
|
if(use_gen) |
22 |
|
ReqBranch(mithep::Names::gkMCPartBrn, fParticles); |
23 |
|
ReqBranch(mithep::Names::gkElectronBrn, fElectrons); |
25 |
|
ReqBranch(mithep::Names::gkPileupEnergyDensityBrn, fPileupEnergyDensity); |
26 |
|
ReqBranch(mithep::Names::gkPFCandidatesBrn, fPFCandidates); |
27 |
|
ReqBranch(mithep::Names::gkMvfConversionBrn, fConversions); |
28 |
+ |
ReqBranch(mithep::Names::gkHltBitBrn, fTrigMask); |
29 |
+ |
|
30 |
|
|
31 |
|
|
32 |
|
fOutputFile = new TFile(fOutputName, "RECREATE"); |
93 |
|
} |
94 |
|
|
95 |
|
|
96 |
< |
//fOutputTree->Branch("electron2_gene",&electron_gene,"electron2_gene/F");\ |
97 |
< |
|
98 |
< |
rlrm.AddJSONFile("/afs/cern.ch/user/m/mangano/public/ichep2012_json/Jun24_190456-196531_noLowPU.json"); |
99 |
< |
|
96 |
> |
//fOutputTree->Branch("electron2_gene",&electron_gene,"electron2_gene/F"); |
97 |
> |
if(use_JSON) |
98 |
> |
rlrm.AddJSONFile(json_file); |
99 |
> |
|
100 |
|
|
101 |
|
} |
102 |
|
|
123 |
|
LoadBranch(mithep::Names::gkPileupEnergyDensityBrn); |
124 |
|
LoadBranch(mithep::Names::gkMvfConversionBrn); |
125 |
|
LoadBranch(mithep::Names::gkPFCandidatesBrn); |
126 |
+ |
LoadBranch(mithep::Names::gkHltBitBrn); |
127 |
|
|
128 |
|
mithep::RunLumiRangeMap::RunLumiPairType rl(GetEventHeader()->RunNum(), GetEventHeader()->LumiSec()); |
129 |
|
if(use_JSON && !rlrm.HasRunLumi(rl)) return; |
130 |
|
|
131 |
+ |
fillTriggerBits( GetHLTTable(), fTrigMask, fTriggerBits ); |
132 |
+ |
|
133 |
+ |
if(apply_trigger && !fTriggerBits.test(trigger)) |
134 |
+ |
return; |
135 |
+ |
|
136 |
|
PFnoPUflag.clear(); |
137 |
|
makePFnoPUArray(fPFCandidates, PFnoPUflag, fPrimVerts ); |
138 |
|
|
169 |
|
const Electron *ele1 = fElectrons->At(i); |
170 |
|
const Electron *ele2 = fElectrons->At(j); |
171 |
|
|
172 |
< |
if(ele1->Pt() < 7) continue; |
172 |
> |
if(ele1->Pt() < 27) continue; |
173 |
|
if(fabs(ele1->Eta()) > 2.5) continue; |
174 |
|
if(ele2->Pt() < 7) continue; |
175 |
|
if(fabs(ele2->Eta()) > 2.5) continue; |
181 |
|
if(use_gen && MathUtils::DeltaR(Z_electron1->Phi(),Z_electron1->Eta(),ele2->Phi(),ele2->Eta()) > 0.1 |
182 |
|
&& MathUtils::DeltaR(Z_electron2->Phi(),Z_electron2->Eta(),ele2->Phi(),ele2->Eta()) > 0.1) continue; |
183 |
|
|
184 |
+ |
Float_t electron_id_rho; |
185 |
+ |
mithep::ElectronTools::EElectronEffectiveAreaTarget eff_area_version_leading; |
186 |
+ |
mithep::ElectronTools::EElectronEffectiveAreaTarget eff_area_version_trailing; |
187 |
+ |
|
188 |
|
//a tight cut on the tag based on the egamma pog |
189 |
< |
if(!electronPOG2012CutBasedIDMedium(ele1, fPrimVerts->At(0), fPFCandidates,fConversions,fPileupEnergyDensity)) continue; |
190 |
< |
if(!electronPOG2012CutBasedIDMedium(ele2, fPrimVerts->At(0), fPFCandidates,fConversions,fPileupEnergyDensity)) continue; |
191 |
< |
|
189 |
> |
if(electron_id_version == e_2011_electron_id){ |
190 |
> |
electron_id_rho = fPileupEnergyDensity->At(0)->RhoLowEta(); |
191 |
> |
eff_area_version_leading = mithep::ElectronTools::kEleEAData2011; |
192 |
> |
eff_area_version_trailing = mithep::ElectronTools::kEleEAData2011; |
193 |
> |
} |
194 |
> |
else if (electron_id_version == e_2012_electron_id){ |
195 |
> |
electron_id_rho = fPileupEnergyDensity->At(0)->RhoLowEta(); |
196 |
> |
eff_area_version_leading = mithep::ElectronTools::kEleEAData2011; |
197 |
> |
eff_area_version_trailing = mithep::ElectronTools::kEleEAData2012; |
198 |
> |
} |
199 |
> |
else |
200 |
> |
assert(0); |
201 |
> |
|
202 |
> |
ControlFlags ctrl; |
203 |
> |
|
204 |
> |
//this is similar to WP 80 according to https://twiki.cern.ch/twiki/bin/view/CMS/EgammaCutBasedIdentification |
205 |
> |
if(!electronPOG2012CutBasedIDMedium(ele1, fPrimVerts->At(0), fPFCandidates, fConversions, electron_id_rho, eff_area_version_leading)) continue; |
206 |
> |
|
207 |
> |
vector<const mithep::PFCandidate*> photonsToVeto; |
208 |
> |
|
209 |
> |
if(!electronReferencePreSelection(ctrl, ele2, fPrimVerts->At(0)).passPre()) continue; |
210 |
> |
if(fabs(ele2->Ip3dPVSignificance()) > 4) continue; |
211 |
> |
if(!electronReferenceIDMVASelectionV1(ctrl, ele2, fPrimVerts->At(0)).looseID()) continue; |
212 |
> |
if(!electronReferenceIsoSelection(ctrl,ele2,fPrimVerts->At(0),fPFCandidates,fPileupEnergyDensity,eff_area_version_trailing,photonsToVeto).passLooseIso()) continue; |
213 |
> |
|
214 |
|
TLorentzVector vele1,vele2; |
215 |
|
|
216 |
|
vele1.SetPtEtaPhiM(ele1->Pt(), ele1->Eta(), ele1->Phi(), g_electron_mass); |