vhbb / cmssw

CMS Offline Software
cms-sw.github.io/cmssw
4 stars 5 forks source link

Add new electron ID MVAs #582

Closed veelken closed 7 years ago

veelken commented 7 years ago

add new electron ID MVAs announced in https://hypernews.cern.ch/HyperNews/CMS/get/egamma/1824.html

capalmer85 commented 7 years ago

I'm working on this now. It looks pretty straightforward to implement. That should be ready in 20-30 minutes, but I need to run it on some signal to see that it actually works as we'd like it to.

capalmer85 commented 7 years ago

@veelken @arizzi I have made a PR ( #624 ), but this line of code is wrong and I'm not sure how to fix it.

https://github.com/vhbb/cmssw/pull/624/files#diff-494d8fe1d85bddc5a8257b3b76287216R16

I'm not sure where ROOT.heppy.EGammaMvaEleEstimatorFWLite() is. I believe I need to edit that to making a working line like: if type == "GenSpring16": self.etype = self.estimator.kGenSpring16;

veelken commented 7 years ago

Hi Chris,

I think you need to change theline if type == "GenSpring16": self.etype = "GenSprint16"; to if type == "GenSpring16": self.etype = self.estimator.kSpring16;

You then need to edit https://github.com/capalmer85/cmssw/blob/8281a3241ba76926bdeb94cd3a55f3ab0898939d/PhysicsTools/Heppy/interface/EGammaMvaEleEstimatorFWLite.h and add kGenSpring16 as an enum after line 24 in EGammaMvaEleEstimatorFWLite.h .

The enum kGenSpring16 probably also needs to be added to the code https://github.com/capalmer85/cmssw/blob/8281a3241ba76926bdeb94cd3a55f3ab0898939d/PhysicsTools/Heppy/src/EGammaMvaEleEstimatorFWLite.cc I am not sure if we can use the class EGammaMvaEleEstimatorCSA14 also for the GenSpring16 MVA, or we need a new class. Do you now what the input variables of the GenSpreing16 MVA are - are the input variables still float EGammaMvaEleEstimatorFWLite::mvaValue(const pat::Electron& ele, const reco::Vertex& vertex, double rho, bool full5x5, bool printDebug) ?

capalmer85 commented 7 years ago

I have some new code I'm trying to test, but I get some errors (without my updates). So I want to check if I am making the test properly @arizzi (or anyone who knows better than me):

My test: cmsrel CMSSW_8_0_25 cd CMSSW_8_0_25/src cmsenv git cms-merge-topic -u vhbb:vhbbHeppy80X scram b -j 16 cd VHbbAnalysis/Heppy/test python vhbb.py

Error: Loading FW Lite Initialize regression {'name': 'jet0Regression_vbf', 'weight': 'ttbar-pumoriond17--500k-13d-300t.weights.xml', 'vtypes': [0, 1, 2, 3, 4, 5, -1]} Initialize regression {'name': 'jet0Regression', 'weight': 'ttbar-pumoriond17--500k-13d-300t.weights.xml', 'vtypes': [0, 1, 2, 3, 4, 5, -1]} Initialize VBF blikelihood {'name': 'BDGT', 'weight': 'TMVA_blikelihood_vbf_cmssw76_h21trained.weights.xml'} [ZllKinematicFit]: resolutions successfully loaded Using outputfile given in PhysicsTools.HeppyCore.framework.services.tfile.TFileService_outputfile Disabling as there is no fallback ('PDFWeightsProducer', 'outputHessianWeights', 'EX') std::vector at first failure Disabling as there is no fallback ('rivetProducerHTXS', 'stage0cat', 'EX') int at first failure Traceback (most recent call last): File "vhbb.py", line 645, in p.runcall(looper.loop) File "/cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/python/2.7.11-ikhhed2/lib/python2.7/cProfile.py", line 149, in runcall return func(*args, **kw) File "/afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/python/PhysicsTools/HeppyCore/framework/looper.py", line 226, in loop self.process( iEv ) File "/afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/python/PhysicsTools/HeppyCore/framework/looper.py", line 313, in process return self._run_analyzers_on_event() File "/afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/python/PhysicsTools/HeppyCore/framework/looper.py", line 328, in _run_analyzers_on_event ret = analyzer.process( self.event ) File "/afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/python/VHbbAnalysis/Heppy/VHbbAnalyzer.py", line 544, in process event.HTXSRivetProducer_cat0 = self.handles['HTXSRivetProducer_cat0'].product() File "/afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/python/PhysicsTools/Heppy/analyzers/core/AutoHandle.py", line 23, in product self.ReallyLoad(self.event) File "/afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/python/PhysicsTools/Heppy/analyzers/core/AutoHandle.py", line 52, in ReallyLoad raise Exception(errstr) Exception: Cannot find collection with: type = int label = ('rivetProducerHTXS', 'stage0cat', 'EX')

arizzi commented 7 years ago

@perrozzi it seem the protection on the python side is not there?

arizzi commented 7 years ago

@capalmer85 can you try on a sample with some higgs content?

capalmer85 commented 7 years ago

I'm trying this file. "root://cmsxrootd.fnal.gov///store/mc/RunIISummer16MiniAODv2/WH_HToBB_WToLNu_M125_13TeV_amcatnloFXFX_madspin_pythia8/MINIAODSIM/PUMoriond17_80X_mcRun2_asymptotic_2016_TrancheIV_v6-v1/120000/7C89D7C0-B7D0-E611-AB35-0CC47A4C8EE8.root"

arizzi commented 7 years ago

then just try git checkout 7ce560785fad186078d02f1a3992f548902efc9c

capalmer85 commented 7 years ago

I get the same result.

capalmer85 commented 7 years ago

git checkout 7ce5607 Note: checking out '7ce5607'.

You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

HEAD is now at 7ce5607... Merge pull request #638 from gkasieczka/dev-fix-jecForBoost

...

python vhbb.py

...

[ZllKinematicFit]: resolutions successfully loaded Using outputfile given in PhysicsTools.HeppyCore.framework.services.tfile.TFileService_outputfile Disabling as there is no fallback ('PDFWeightsProducer', 'outputHessianWeights', 'EX') std::vector at first failure Disabling as there is no fallback ('rivetProducerHTXS', 'stage0cat', 'EX') int at first failure Traceback (most recent call last): File "vhbb.py", line 645, in p.runcall(looper.loop) File "/cvmfs/cms.cern.ch/slc6_amd64_gcc530/external/python/2.7.11-ikhhed2/lib/python2.7/cProfile.py", line 149, in runcall return func(*args, **kw) File "/afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/python/PhysicsTools/HeppyCore/framework/looper.py", line 226, in loop self.process( iEv ) File "/afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/python/PhysicsTools/HeppyCore/framework/looper.py", line 313, in process return self._run_analyzers_on_event() File "/afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/python/PhysicsTools/HeppyCore/framework/looper.py", line 328, in _run_analyzers_on_event ret = analyzer.process( self.event ) File "/afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/python/VHbbAnalysis/Heppy/VHbbAnalyzer.py", line 544, in process event.HTXSRivetProducer_cat0 = self.handles['HTXSRivetProducer_cat0'].product() File "/afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/python/PhysicsTools/Heppy/analyzers/core/AutoHandle.py", line 23, in product self.ReallyLoad(self.event) File "/afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/python/PhysicsTools/Heppy/analyzers/core/AutoHandle.py", line 52, in ReallyLoad raise Exception(errstr) Exception: Cannot find collection with: type = int label = ('rivetProducerHTXS', 'stage0cat', 'EX')

arizzi commented 7 years ago

ah, try vhbb_combine.py... some PR were probably made with no protections for missing products

capalmer85 commented 7 years ago

that got farther:

[QGLikelihoodCalculator]: Initializing from file: /afs/cern.ch/work/c/capalmer/private/hbb/2017/Q1/heppy/try2/CMSSW_8_0_25/src/PhysicsTools/Heppy/data/pdfQG_AK4chs_13TeV_cmssw8020_v2.root [QGLikelihoodCalculator]: Initialized binning of pdfs... [QGLikelihoodCalculator]: pdfs initialized...

Conditions read from CMS_CONDITIONS via FrontierProd


b tagging needs to be run on uncorrected jets. Hence, the JECs will first be undone for 'updatedPatJets' and then applied to 'updatedPatJetsTransientCorrected'.


skipping newdeepFlavourCMVAJetTags as it has already been loaded in the process skipping newdeepFlavourCMVAJetTags as it has already been loaded in the process skipping newdeepFlavourCMVAJetTags as it has already been loaded in the process skipping newdeepFlavourCMVAJetTags as it has already been loaded in the process skipping newdeepFlavourJetTags as it has already been loaded in the process skipping newdeepFlavourJetTags as it has already been loaded in the process skipping newdeepFlavourJetTags as it has already been loaded in the process skipping newdeepFlavourJetTags as it has already been loaded in the process Running pre-processor: cmsRun Loop_4/cmsRun_config.py >& Loop_4/cmsRun.log CMSRUN failed

capalmer85 commented 7 years ago

ah... that might be my fault... voms...

capalmer85 commented 7 years ago

This seems to be working now. Thanks for the tutorial. :)

capalmer85 commented 7 years ago

640 should resolve this issue.