Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removed old config for synch ntuple producer #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 36 additions & 27 deletions DesyTauAnalyses/NTupleMaker/bin/SynchNTupleProducer_em.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ int main(int argc, char * argv[]) {
const float isoElectronLowCut = cfg.get<float>("isoElectronLowCut");
const float isoElectronHighCut = cfg.get<float>("isoElectronHighCut");
const bool applyElectronId = cfg.get<bool>("ApplyElectronId");
const bool applyElectronConversionVeto = cfg.get<bool>("ApplyElectronConversionVeto");
const string lowPtLegElectron = cfg.get<string>("LowPtLegElectron");
const string highPtLegElectron = cfg.get<string>("HighPtLegElectron");

Expand All @@ -302,6 +303,7 @@ int main(int argc, char * argv[]) {
const float dxyVetoElectronCut = cfg.get<float>("dxyVetoElectronCut");
const float dzVetoElectronCut = cfg.get<float>("dzVetoElectronCut");
const float isoVetoElectronCut = cfg.get<float>("isoVetoElectronCut");
const bool applyVetoElectronConversionVeto = cfg.get<bool>("ApplyVetoElectronConversionVeto");
const bool applyVetoElectronId = cfg.get<bool>("ApplyVetoElectronId");

// kinematic cuts on muons
Expand Down Expand Up @@ -332,6 +334,7 @@ int main(int argc, char * argv[]) {
// topological cuts
const float dRleptonsCut = cfg.get<float>("dRleptonsCut");
const bool isIsoR03 = cfg.get<bool>("IsIsoR03");
const bool applyTriggerMatch = cfg.get<bool>("ApplyTriggerMatch");
const float deltaRTrigMatch = cfg.get<float>("DRTrigMatch");

// jets
Expand Down Expand Up @@ -665,12 +668,11 @@ int main(int argc, char * argv[]) {
Long64_t numberOfEntries = analysisTree.GetEntries();

std::cout << " number of entries in Tree = " << numberOfEntries << std::endl;

for (Long64_t iEntry=0; iEntry<numberOfEntries; iEntry++) {

analysisTree.GetEntry(iEntry);
nEvents++;


if (nEvents%10000==0)
cout << " processed " << nEvents << " events" << endl;
Expand Down Expand Up @@ -734,19 +736,19 @@ int main(int argc, char * argv[]) {
}
if (!isLowPtLegElectron) {
std::cout << "HLT filter " << LowPtLegElectron << " not found" << std::endl;
return(-1);
exit(-1);
}
if (!isHighPtLegElectron) {
std::cout << "HLT filter " << HighPtLegElectron << " not found" << std::endl;
return(-1);
exit(-1);
}
if (!isLowPtLegMuon) {
std::cout << "HLT filter " << LowPtLegMuon << " not found" << std::endl;
return(-1);
exit(-1);
}
if (!isHighPtLegMuon) {
std::cout << "HLT filter " << HighPtLegMuon << " not found" << std::endl;
return(-1);
exit(-1);
}
// std::cout << "LowPtE : " << LowPtLegElectron << " : " << nLowPtLegElectron << std::endl;
// std::cout << "HighPtE : " << HighPtLegElectron << " : " << nHighPtLegElectron << std::endl;
Expand Down Expand Up @@ -778,8 +780,8 @@ int main(int argc, char * argv[]) {
analysisTree.electron_superclusterEta[ie],
analysisTree.electron_mva_id_nontrigPhys14[ie]);
if (!electronMvaId&&applyElectronId) continue;
if (!analysisTree.electron_pass_conversion[ie]&&applyElectronId) continue;
if (analysisTree.electron_nmissinginnerhits[ie]!=0&&applyElectronId) continue;
if (!analysisTree.electron_pass_conversion[ie]&&applyElectronId&&applyElectronConversionVeto) continue;
if (analysisTree.electron_nmissinginnerhits[ie]!=0&&applyElectronId&&applyElectronConversionVeto) continue;
electrons.push_back(ie);
}

Expand All @@ -803,6 +805,8 @@ int main(int argc, char * argv[]) {

float isoMuMin = 1e+10;
float isoEleMin = 1e+10;
// if (muons.size()>1||electrons.size()>1)
// std::cout << "muons = " << muons.size() << " electrons = " << electrons.size() << std::endl;
for (unsigned int im=0; im<muons.size(); ++im) {
bool isMu23 = false;
bool isMu8 = false;
Expand Down Expand Up @@ -838,7 +842,7 @@ int main(int argc, char * argv[]) {
}
}

if ((!isMu23) && (!isMu8)) continue;
if (applyTriggerMatch && (!isMu23) && (!isMu8)) continue;

for (unsigned int ie=0; ie<electrons.size(); ++ie) {

Expand Down Expand Up @@ -875,19 +879,18 @@ int main(int argc, char * argv[]) {
bool trigMatch = (isMu23&&isEle12) || (isMu8&&isEle23);
// std::cout << "Trigger match = " << trigMatch << std::endl;

if (!trigMatch) continue;
if (applyTriggerMatch && !trigMatch) continue;

bool isKinematicMatch = false;
if (isMu23&&isEle12) {
if (analysisTree.muon_pt[mIndex]>ptMuonHighCut&&analysisTree.electron_pt[eIndex]>ptElectronLowCut)
isKinematicMatch = true;
}
if (isMu8&&isEle23) {
if (analysisTree.muon_pt[mIndex]>ptMuonLowCut&&analysisTree.electron_pt[eIndex]>ptElectronHighCut)
isKinematicMatch = true;
}
if (!isKinematicMatch) continue;

// bool isKinematicMatch = false;
// if (isMu23&&isEle12) {
// if (analysisTree.muon_pt[mIndex]>ptMuonHighCut&&analysisTree.electron_pt[eIndex]>ptElectronLowCut)
// isKinematicMatch = true;
// }
// if (isMu8&&isEle23) {
// if (analysisTree.muon_pt[mIndex]>ptMuonLowCut&&analysisTree.electron_pt[eIndex]>ptElectronHighCut)
// isKinematicMatch = true;
// }
// if (!isKinematicMatch) continue;

float neutralHadIsoEle = analysisTree.electron_neutralHadIso[eIndex];
float photonIsoEle = analysisTree.electron_photonIso[eIndex];
Expand All @@ -907,23 +910,29 @@ int main(int argc, char * argv[]) {
if (int(mIndex)!=muonIndex) {
if (relIsoMu<isoMuMin) {
isoMuMin = relIsoMu;
muonIndex = mIndex;
muonIndex = int(mIndex);
isoEleMin = relIsoEle;
electronIndex = eIndex;
electronIndex = int(eIndex);
}
}
else {
if (relIsoEle<isoEleMin) {
isoEleMin = relIsoEle;
electronIndex = eIndex;
electronIndex = int(eIndex);
}
}

}
}

// std::cout << "mIndex = " << muonIndex << " eIndex = " << electronIndex << std::endl;

if (electronIndex<0) continue;
if (muonIndex<0) continue;
// std::cout << "OK " << std::endl;
// std::cout << std::endl;



os = (analysisTree.muon_charge[muonIndex]*analysisTree.electron_charge[electronIndex]) < 0;

Expand All @@ -939,8 +948,8 @@ int main(int argc, char * argv[]) {
analysisTree.electron_superclusterEta[ie],
analysisTree.electron_mva_id_nontrigPhys14[ie]);
if (!electronMvaId&&applyVetoElectronId) continue;
if (!analysisTree.electron_pass_conversion[ie]&&applyVetoElectronId) continue;
if (analysisTree.electron_nmissinginnerhits[ie]!=0&&applyVetoElectronId) continue;
if (!analysisTree.electron_pass_conversion[ie]&&applyVetoElectronId&&applyVetoElectronConversionVeto) continue;
if (analysisTree.electron_nmissinginnerhits[ie]!=0&&applyVetoElectronId&&applyVetoElectronConversionVeto) continue;
float neutralHadIsoEle = analysisTree.electron_neutralHadIso[ie];
float photonIsoEle = analysisTree.electron_photonIso[ie];
float chargedHadIsoEle = analysisTree.electron_chargedHadIso[ie];
Expand Down
Loading