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

TauIDs added and filled #14

Open
wants to merge 4 commits into
base: devworkshop
Choose a base branch
from
Open
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
48 changes: 46 additions & 2 deletions src/AOD2NanoAOD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ class AOD2NanoAOD : public edm::EDAnalyzer {
bool value_tau_idantimumedium[max_tau];
bool value_tau_idantimutight[max_tau];

//added Tau IDs
float value_tau_idCombinedisoDBSumPtCorr3Hitsloose[max_tau];
float value_tau_idCombinedisoDBSumPtCorr3Hitsmedium[max_tau];
float value_tau_idCombinedisoDBSumPtCorr3Hitstight[max_tau];
float value_tau_idisoMVAloose[max_tau];
float value_tau_idisoMVAmedium[max_tau];
float value_tau_idisoMVAtight[max_tau];

/*
// Photons
const static int max_ph = 1000;
Expand Down Expand Up @@ -325,7 +333,14 @@ AOD2NanoAOD::AOD2NanoAOD(const edm::ParameterSet &iConfig)
tree->Branch("Tau_idAntiMuLoose", value_tau_idantimuloose, "Tau_idAntiMuLoose[nTau]/O");
tree->Branch("Tau_idAntiMuMedium", value_tau_idantimumedium, "Tau_idAntiMuMedium[nTau]/O");
tree->Branch("Tau_idAntiMuTight", value_tau_idantimutight, "Tau_idAntiMuTight[nTau]/O");


//added Tau IDs
tree->Branch("Tau_idCombinedIsoDBSumPtCorr3HitsLoose",value_tau_idCombinedisoDBSumPtCorr3Hitsloose, "Tau_idCombinedIsoDBSumPtCorr3HitsLoose[nTau]/O");
tree->Branch("Tau_idCombinedIsoDBSumPtCorr3HitsMedium",value_tau_idCombinedisoDBSumPtCorr3Hitsmedium, "Tau_idCombinedIsoDBSumPtCorr3HitsMedium[nTau]/O");
tree->Branch("Tau_idCombinedIsoDBSumPtCorr3HitsTight", value_tau_idCombinedisoDBSumPtCorr3Hitstight, "Tau_idCombinedIsoDBSumPtCorr3HitsTight[nTau]/O");
tree->Branch("Tau_idIsoMVALoose",value_tau_idisoMVAloose, "Tau_idIsoMVALoose[nTau]/O");
tree->Branch("Tau_idIsoMVAMedium",value_tau_idisoMVAmedium, "Tau_idIsoMVAMedium[nTau]/O");
tree->Branch("Tau_idIsoMVATight",value_tau_idisoMVAtight, "Tau_idIsoMVATight[nTau]/O");
/*
// Photons
tree->Branch("nPhoton", &value_ph_n, "nPhoton/i");
Expand Down Expand Up @@ -511,7 +526,8 @@ void AOD2NanoAOD::analyze(const edm::Event &iEvent,
Handle<PFTauDiscriminator> tausLooseIso, tausVLooseIso, tausMediumIso, tausTightIso,
tausDecayMode, tausLooseEleRej, tausMediumEleRej,
tausTightEleRej, tausLooseMuonRej, tausMediumMuonRej,
tausTightMuonRej, tausRawIso;
tausTightMuonRej, tausRawIso, tausLooseIsoMVA, tausMediumIsoMVA, tausTightIsoMVA,
tausLooseIso3Hits, tausMediumIso3Hits, tausTightIso3Hits;

iEvent.getByLabel(InputTag("hpsPFTauDiscriminationByDecayModeFinding"),
tausDecayMode);
Expand Down Expand Up @@ -541,6 +557,21 @@ void AOD2NanoAOD::analyze(const edm::Event &iEvent,
iEvent.getByLabel(InputTag("hpsPFTauDiscriminationByTightMuonRejection"),
tausTightMuonRej);

//added Tau Discriminators

iEvent.getByLabel(InputTag("hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr3Hits"),
tausLooseIso3Hits);
iEvent.getByLabel(InputTag("hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr3Hits"),
tausMediumIso3Hits);
iEvent.getByLabel(InputTag("hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr3Hits"),
tausTightIso3Hits);
iEvent.getByLabel(InputTag("hpsPFTauDiscriminationByLooseIsolationMVA"),
tausLooseIsoMVA);
iEvent.getByLabel(InputTag("hpsPFTauDiscriminationByMediumIsolationMVA"),
tausMediumIsoMVA);
iEvent.getByLabel(InputTag("hpsPFTauDiscriminationByTightIsolationMVA"),
tausTightIsoMVA);

const float tau_min_pt = 15;
value_tau_n = 0;
std::vector<PFTau> selectedTaus;
Expand All @@ -553,6 +584,7 @@ void AOD2NanoAOD::analyze(const edm::Event &iEvent,
value_tau_charge[value_tau_n] = it->charge();
value_tau_mass[value_tau_n] = it->mass();
value_tau_decaymode[value_tau_n] = it->decayMode();

// Discriminators
const auto idx = it - taus->begin();
value_tau_iddecaymode[value_tau_n] = tausDecayMode->operator[](idx).second;
Expand All @@ -568,9 +600,21 @@ void AOD2NanoAOD::analyze(const edm::Event &iEvent,
value_tau_idantimumedium[value_tau_n] = tausMediumMuonRej->operator[](idx).second;
value_tau_idantimutight[value_tau_n] = tausTightMuonRej->operator[](idx).second;

//added TauIDs filled

value_tau_idisoMVAloose[value_tau_n] = tausLooseIsoMVA->operator[](idx).second;
value_tau_idisoMVAmedium[value_tau_n] = tausMediumIsoMVA->operator[](idx).second;
value_tau_idisoMVAtight[value_tau_n] = tausTightIsoMVA->operator[](idx).second;
value_tau_idCombinedisoDBSumPtCorr3Hitstight[value_tau_n] = tausLooseIso3Hits->operator[](idx).second;
value_tau_idCombinedisoDBSumPtCorr3Hitsmedium[value_tau_n] = tausMediumIso3Hits->operator[](idx).second;
value_tau_idCombinedisoDBSumPtCorr3Hitsloose[value_tau_n] = tausTightIso3Hits->operator[](idx).second;


value_tau_reliso_all[value_tau_n] = (it->isolationPFChargedHadrCandsPtSum() + it->isolationPFGammaCandsEtSum()) / it->pt();
value_tau_jetidx[value_tau_n] = -1;
value_tau_genpartidx[value_tau_n] = -1;


value_tau_n++;
}
}
Expand Down