You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When setting the option "smearJets = True" for the JetAnalyzer the code no longer runs and reports the following error (note the second to last file in the trace):
Traceback (most recent call last):
File "/afs/cern.ch/work/c/cbeiraod/Stop4Body/CMSSW_8_0_25/python/PhysicsTools/HeppyCore/framework/heppy_loop.py", line 35, in runLoopAsync
loop = runLoop( comp, outDir, copy.copy(sys.modules[configName].config), options)
File "/afs/cern.ch/work/c/cbeiraod/Stop4Body/CMSSW_8_0_25/python/PhysicsTools/HeppyCore/framework/heppy_loop.py", line 61, in runLoop
loop.loop()
File "/afs/cern.ch/work/c/cbeiraod/Stop4Body/CMSSW_8_0_25/python/PhysicsTools/HeppyCore/framework/looper.py", line 198, in loop
self.process( iEv )
File "/afs/cern.ch/work/c/cbeiraod/Stop4Body/CMSSW_8_0_25/python/PhysicsTools/HeppyCore/framework/looper.py", line 256, in process
ret = analyzer.process( self.event )
File "/afs/cern.ch/work/c/cbeiraod/Stop4Body/CMSSW_8_0_25/python/PhysicsTools/Heppy/analyzers/objects/JetAnalyzer.py", line 184, in process
self.smearJets(event, allJets)
File "/afs/cern.ch/work/c/cbeiraod/Stop4Body/CMSSW_8_0_25/python/PhysicsTools/Heppy/analyzers/objects/JetAnalyzer.py", line 468, in smearJets
gen = jet.mcJet
File "/afs/cern.ch/work/c/cbeiraod/Stop4Body/CMSSW_8_0_25/python/PhysicsTools/Heppy/physicsobjects/PhysicsObject.py", line 28, in __getattr__
return getattr(self.physObj, name)
AttributeError: 'pat::Jet' object has no attribute 'mcJet'
I have traced this problem to the fact that not all jets have a matched genJet. The cause can be easily observed by looking at the following lines of code:
self.matchJets(event, [ jforjinallJetsifj.pt()>self.cfg_ana.jetPt ]) # To match only jets above chosen thresholdifgetattr(self.cfg_ana, 'smearJets', False):
self.smearJets(event, allJets)
To fix, it should be fairly straightforward, either match all jets or smear only the jets that were matched. The intended behavior is not clear and choosing between the two options is not as straightforward. The two fixes, below:
Just noticed that this is a duplicate issue to #640
However it seems discussion in this stopped on May 2016. It would be good to fix this. If it is ok, I would implement the solution proposed by @mmasciov and make a pull request
I am on branch heppy_80X, as recommended for Moriond 2017 analyses (https://twiki.cern.ch/twiki/bin/viewauth/CMS/CMGToolsReleasesExperimental)
When setting the option "smearJets = True" for the JetAnalyzer the code no longer runs and reports the following error (note the second to last file in the trace):
I have traced this problem to the fact that not all jets have a matched genJet. The cause can be easily observed by looking at the following lines of code:
From here: JetAnalyzer.py lines 182-184
To fix, it should be fairly straightforward, either match all jets or smear only the jets that were matched. The intended behavior is not clear and choosing between the two options is not as straightforward. The two fixes, below:
I would be happy to implement the fix and make a pull request if the desired behavior can be made clear.
The text was updated successfully, but these errors were encountered: