-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Adding PAIReDJet Table to NanoAOD #45207
Open
tajrussell
wants to merge
4
commits into
cms-sw:master
Choose a base branch
from
tajrussell:new-paired-jets
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
from PhysicsTools.NanoAOD.common_cff import * | ||
|
||
pairedJetTable = cms.EDProducer("PAIReDONNXJetTagsProducer") | ||
|
||
pairedJetTableTask = cms.Task(pairedJetTable) | ||
|
||
pairedJetTableMC = cms.EDProducer("PAIReDONNXJetTagsProducer") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if there is no specific parameter difference between data and MC, you should keep the same module |
||
|
||
pairedJetTableMCTask = cms.Task(pairedJetTableMC) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/*#ifdef __CLING__ | ||
R__LOAD_LIBRARY(libDelphes) | ||
#include "classes/DelphesClasses.h" | ||
#endif*/ | ||
//#include "external/ExRootAnalysis/ExRootTreeReader.h" | ||
//#include "external/ExRootAnalysis/ExRootResult.h" | ||
#include <cstdlib> | ||
#include <iostream> | ||
#include <functional> | ||
#include <time.h> | ||
#include <iostream> | ||
#include <fstream> | ||
#include <string> | ||
#include "TH1F.h" | ||
#include "TH2F.h" | ||
#include "TClonesArray.h" | ||
#include "TTree.h" | ||
#include <iostream> | ||
#include <fstream> | ||
#include <sstream> | ||
#include <string> | ||
#include <TROOT.h> | ||
#include <TLorentzVector.h> | ||
#include <TFile.h> | ||
#include <TTree.h> | ||
#include <TBranch.h> | ||
#include <TMath.h> | ||
#include <Rtypes.h> | ||
#include <TString.h> | ||
#include <TRandom.h> | ||
#include <TRandom3.h> | ||
#include "TParticle.h" | ||
#include <vector> | ||
|
||
const double pi = TMath::Pi(); | ||
|
||
double tDeltaPhi(double phi1, double phi2) { return TVector2::Phi_mpi_pi(phi1 - phi2); } | ||
|
||
double deltaR(double eta1, double phi1, double eta2, double phi2) { | ||
double deta = eta1 - eta2; | ||
double dphi = tDeltaPhi(phi1, phi2); | ||
return std::hypot(deta, dphi); | ||
} | ||
|
||
double shiftpi(double phi, double shift, double lim) { | ||
if (shift == 0) | ||
return phi; | ||
if (shift > 0) { | ||
if (phi < lim) | ||
return phi + shift; | ||
} else if (phi > lim) { | ||
return phi + shift; | ||
} | ||
return phi; | ||
} | ||
|
||
bool inEllipse(double jet1_eta, double jet1_phi, double jet2_eta, double jet2_phi, double cand_eta, double cand_phi) { | ||
float eta1 = static_cast<float>(jet1_eta); | ||
float phi1 = static_cast<float>(jet1_phi); | ||
float eta2 = static_cast<float>(jet2_eta); | ||
float phi2 = static_cast<float>(jet2_phi); | ||
float eta0 = static_cast<float>(cand_eta); | ||
float phi0 = static_cast<float>(cand_phi); | ||
float semimajoradd = 1.0; | ||
float djet, semimajor, focus, eta_center, phi_center, eta_f1, phi_f1, eta_f2, phi_f2, f1dist, f2dist, | ||
distsum; //, phi_m1, phi_m2; | ||
double semiminor; | ||
|
||
djet = deltaR(eta1, phi1, eta2, phi2); | ||
semiminor = 1.5; | ||
semimajor = std::max({semiminor, double(djet / 2 + semimajoradd)}); | ||
focus = pow(pow(semimajor, 2) - pow(semiminor, 2), 0.5); // Distance of focus to center | ||
|
||
eta_center = (eta1 + eta2) / 2; | ||
phi_center = TVector2::Phi_mpi_pi(phi1 + TVector2::Phi_mpi_pi(phi2 - phi1) / 2); | ||
|
||
//focus 1 | ||
eta_f1 = eta_center + focus / (djet / 2) * (eta1 - eta_center); | ||
phi_f1 = TVector2::Phi_mpi_pi(phi_center + focus / (djet / 2) * TVector2::Phi_mpi_pi(phi1 - phi_center)); | ||
|
||
//focus 2 | ||
eta_f2 = eta_center + focus / (djet / 2) * (eta2 - eta_center); | ||
phi_f2 = TVector2::Phi_mpi_pi(phi_center + focus / (djet / 2) * TVector2::Phi_mpi_pi(phi2 - phi_center)); | ||
|
||
// Two ends of major axis. This is necesssary to make sure that the point p is not in between the foci on the wrong side of the phi axis | ||
// phi_m1 = TVector2::Phi_mpi_pi(phi_center + semimajor/(djet/2) *TVector2::Phi_mpi_pi(phi1-phi_center)); | ||
// phi_m2 = TVector2::Phi_mpi_pi(phi_center + semimajor/(djet/2) *TVector2::Phi_mpi_pi(phi2-phi_center)); | ||
|
||
double shift = 0, lim = 0; | ||
// if (phi_center > phi_m1 && phi_center > phi_m2) shift = 2*pi; | ||
// if (phi_center < phi_m1 && phi_center < phi_m2) shift = -2*pi; | ||
|
||
if (phi_center >= 0) { | ||
shift = 2 * pi; | ||
lim = phi_center - pi; | ||
} else { | ||
shift = -2 * pi; | ||
lim = phi_center + pi; | ||
} | ||
|
||
// if (abs(phi1-phi2) > 3.4) cout << "(" << eta1 << "," << phi1 << "), " << "(" << eta2 << "," << phi2 << "), " << "(" << eta_f1 << "," << phi_f1 << "), "<< "(" << eta_f2 << "," << phi_f2 << "), " << "(" << eta_center << "," << phi_center << ")" << endl; | ||
float phi0_s = shiftpi(phi0, shift, lim); | ||
|
||
f1dist = std::hypot(eta0 - eta_f1, phi0_s - shiftpi(phi_f1, shift, lim)); | ||
f2dist = std::hypot(eta0 - eta_f2, phi0_s - shiftpi(phi_f2, shift, lim)); | ||
distsum = f1dist + f2dist; | ||
|
||
//if in ellipse, the sum of the distances will be less than 2*semimajor | ||
if (distsum < 2 * semimajor) | ||
return true; | ||
else | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
<use name="FWCore/Framework"/> | ||
<use name="FWCore/Utilities"/> | ||
<library file="*.cc" name="RecoBTagONNXRuntimePlugins"> | ||
<use name="json"/> | ||
<use name="DataFormats/BTauReco"/> | ||
<use name="PhysicsTools/ONNXRuntime"/> | ||
<use name="DataFormats/PatCandidates"/> | ||
<use name="DataFormats/NanoAOD"/> | ||
<use name="RecoBTag/FeatureTools"/> | ||
<use name="RecoBTag/ONNXRuntime"/> | ||
<use name="HeterogeneousCore/SonicTriton"/> | ||
<use name="Rivet"/> | ||
<flags EDM_PLUGIN="1"/> | ||
</library> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like you are using all default values from the fillDescription, which. is actually good to have. but I'd rather, so that the actual parameters are visible (and modifiable) in the configuration, that you import from the default cfi generated from the fillDescription (See below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean adding a file similar to this one https://cmssdt.cern.ch/lxr/source/cfipython/RecoBTag/ONNXRuntime/UnifiedParticleTransformerAK4ONNXJetTagsProducer.py that specifies the descriptions outside of the producer? Or if not is there by any chance a different piece of code you could point me to that accomplishes something similar to what you would like to see here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideConfigurationValidationAndHelp for documentation. you do not have to add the file in cfipython yourself, the fwk will do this for your upon "scram build". You should be able to do something like
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from RecoBTag.ONNXRuntime.pAIRrDONNXJetTagsProducer_cfi import pAIRrDONNXJetTagsProducer
is whatdescriptions.addWithDefaultLabel(desc);
provides