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

Izisopou patch miniaod #29

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

izisopou
Copy link

Changes suggested by JERC conveners and implemented to run and produce ntuples from MINIAOD:

  1. Replace genParticles with prunedGenParticles
  2. Change the gen jet clustering to packedGenParticles
  3. Switch fast jet producer to use packed PF candidates, both the target jets and the kt6 rho
  4. replace PV with offlineSlimmedPrimaryVertices
  5. Ditch the pfPileUpJME and pfNoPileUpJME - replace with process.PFCandCHS = cms.EDFilter("CandPtrSelector", src = cms.InputTag("packedPFCandidates"), cut = cms.string("fromPV() > 1")), and replace the relevant thing inside pfNoPileUpJME with PFCandCHS

A slightly modified script of the xrootd/XrdCl/XrdClFileSystem.hh one, in order to avoid compilation errors.
This change includes the XrdClFileSystem_v2.hh script instead of the XrdClFileSystem.hh so as to avoid compilation errors.
@aperloff
Copy link
Member

aperloff commented Nov 3, 2020

Why did you copy an entire file from the XRootD code into this package, much less a header not in the interface folder? You're not going to want to maintain XrdClFileSystem_v2.hh. A better strategy is to put in static_asserts and header guards to make sure you pick up the correct files or exit right away upon a missing dependency.

@@ -104,7 +105,8 @@ private:
//edm::EDGetTokenT<vector<reco::PFCandidate> > srcPFCandidates_;
edm::EDGetTokenT<PFCandidateView> srcPFCandidates_;
edm::EDGetTokenT<std::vector<edm::FwdPtr<reco::PFCandidate> > > srcPFCandidatesAsFwdPtr_;
edm::EDGetTokenT<vector<reco::GenParticle> > srcGenParticles_;
// edm::EDGetTokenT<vector<reco::GenParticle> > srcGenParticles_;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should remove code, specifically commented code, which is no longer needed. If you need to switch back an forth you should consider using an `edm::View``` and then casting to the correct base type.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I removed the code that is no longer needed.

doRefPt = cms.bool(True),
doJetPt = cms.bool(True),
saveCandidates = cms.bool(False),
# MATCHING MODE: deltaR(ref,jet)
deltaRMax = cms.double(0.25),
deltaRMax = cms.double(0.4),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been out of the loop for a while, so feel free to tell me I don't know the latest developments. That said, 0.4 seems awfully permissive for the deltaR matching. That's the entire cone radius for an R=0.4 jet. The default here should be the most often used value and should not change much. Is that why you changed this to 0.4.

Copy link

@magdadiamant magdadiamant Nov 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the confusion, this was actually a test version and we will fix it and upload the correct one with the values that were before. (However, this does not affect the results because we require dr max value of 0.2 in the MC Truth JECs derivation.)

@@ -76,7 +76,7 @@
dobalance = cms.bool(False),
doflavor = cms.bool(False),
noabsflavors = cms.bool(False),
drmax = cms.double(0.3),
drmax = cms.double(0.4),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would imagine this should match the value in the JetResponseParameters, so keep that in mind when answering my previous comment.

@@ -87,7 +87,9 @@
#!
#! PF JETS CHS
#!
ak1PFCHSJets = ak1PFJets.clone( src = 'pfNoPileUpJME' )

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these newlines to keep the style the same among the various sections of the code. You should strive to keep the formatting consistent throughout the code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay!

@@ -20,6 +20,11 @@
from JetMETAnalysis.JetAnalyzers.JetCorrection_cff import *
from RecoTauTag.TauTagTools.tauDecayModes_cfi import *
from CommonTools.PileupAlgos.Puppi_cff import *
from JetMETAnalysis.JetAnalyzers.customizePuppiTune_cff import *


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this to 1 newline to maintain the style.

@@ -115,6 +115,50 @@ void JetResponseAnalyzer::beginJob()
}



Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to match the style for this entire section (the getMult function).


switch (std::abs(pfCand->pdgId())) {

case 211: //PFCandidate::h: // charged hadron
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use unnamed constants. Instead, you should define enums as in

enum Flavor{all=0, h, e, mu, gamma, h0, h_HF, egamma_HF, chs, numFlavors, X}; //X=undefined
and use those as your cases.

You also only really have two cases:

  1. You add one to the nMult variable
  2. You add one to the chMult variable
    You should combine these cases using and OR of the conditions inside if, else if, else statements. This will reduce the number of comparisons. You can use the std::any_of function to reduce the verbosity of the conditional (https://www.cplusplus.com/reference/algorithm/any_of/).

@@ -439,12 +480,21 @@ void JetResponseAnalyzer::analyze(const edm::Event& iEvent,
JRAEvt_->jtmuf ->push_back(pfJetRef->muonEnergyFraction() *JRAEvt_->jtjec->at(JRAEvt_->nref));
JRAEvt_->jthfhf->push_back(pfJetRef->HFHadronEnergyFraction() *JRAEvt_->jtjec->at(JRAEvt_->nref));
JRAEvt_->jthfef->push_back(pfJetRef->HFEMEnergyFraction() *JRAEvt_->jtjec->at(JRAEvt_->nref));
int chMult=0, nMult=0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spacing issue

@@ -80,6 +80,8 @@ public :
vector<Int_t>* refpdgid_physicsDef;
vector<Float_t>* refe;
vector<Float_t>* refpt;
vector<Int_t>* refnMult;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Match style

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment for all of the nMult and chMult lines.

@@ -84,8 +84,8 @@ void JRAEvent::MakeTree(TTree* tree)
fChain->Branch("evt", &evt, "evt/L");
fChain->Branch("nref", &nref, "nref/b");
fChain->Branch("refrank", "vector<UChar_t>", &refrank);
fChain->Branch("refpdgid", "vector<Int_t>", &refpdgid);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change means that the refpdgid branch will always be loaded. Is that want you want?

@aperloff
Copy link
Member

aperloff commented Nov 3, 2020

You might also consider adding a GitHub action to run clang-tidy/clang-format on the code each time there is a PR or or push to the repo. This will help to keep the code in good shape and to help with formatting.

sparedes pushed a commit to sparedes/JetMETAnalysis that referenced this pull request Dec 20, 2021
1st recipe for Run-3 PF-Hadron Calibrations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants