vhbb / nanoAOD-tools

Tools for working with NanoAOD (requiring only python + root, not CMSSW)
1 stars 1 forks source link

error including mht() module in post-processor #12

Open scooperstein opened 6 years ago

scooperstein commented 6 years ago

@arizzi If one tries to include the mht() module in the vhbb post-processor, for example via uncommenting this import line

https://github.com/scooperstein/nanoAOD-tools/blob/vhbb_crab_setup/python/postprocessing/analysis/higgs/vhbb/postproc.py#L12

and including the mht() module in the sequence as in here

https://github.com/scooperstein/nanoAOD-tools/blob/vhbb_crab_setup/python/postprocessing/analysis/higgs/vhbb/postproc.py#L50

it fails with the error below. It seems to be referencing a branch "Electron_miniPFIso_all" that is not in the nanoAOD tree. Should this branch name be updated in NanoAODTools/postprocessing/modules/jme/mht.py?

Thanks, Stephane

File "postproc_local.py", line 46, in p.run() File "/afs/cern.ch/work/s/scoopers/private/nanoAOD_dev/CMSSW_9_4_0_pre3/python/PhysicsTools/NanoAODTools/postprocessing/framework/postprocessor.py", line 97, in run (nall, npass, timeLoop) = eventLoop(self.modules, inFile, outFile, inTree, outTree) File "/afs/cern.ch/work/s/scoopers/private/nanoAOD_dev/CMSSW_9_4_0_pre3/python/PhysicsTools/NanoAODTools/postprocessing/framework/eventloop.py", line 34, in eventLoop ret = m.analyze(e) File "/afs/cern.ch/work/s/scoopers/private/nanoAOD_dev/CMSSW_9_4_0_pre3/python/PhysicsTools/NanoAODTools/postprocessing/modules/jme/mht.py", line 33, in analyze for lep in filter(self.elSel,electrons): File "/afs/cern.ch/work/s/scoopers/private/nanoAOD_dev/CMSSW_9_4_0_pre3/python/PhysicsTools/NanoAODTools/postprocessing/modules/jme/mht.py", line 58, in lambda el : el.pt > 20 and el.miniPFIso_all/el.pt < 0.2 ) File "/afs/cern.ch/work/s/scoopers/private/nanoAOD_dev/CMSSW_9_4_0_pre3/python/PhysicsTools/NanoAODTools/postprocessing/framework/datamodel.py", line 58, in getattr val = getattr(self._event,self._prefix+name) File "/afs/cern.ch/work/s/scoopers/private/nanoAOD_dev/CMSSW_9_4_0_pre3/python/PhysicsTools/NanoAODTools/postprocessing/framework/datamodel.py", line 13, in getattr return self._tree.readBranch(name) File "/afs/cern.ch/work/s/scoopers/private/nanoAOD_dev/CMSSW_9_4_0_pre3/python/PhysicsTools/NanoAODTools/postprocessing/framework/treeReaderArrayTools.py", line 63, in readBranch if not branch: raise RuntimeError, "Unknown branch %s" % branchName RuntimeError: Unknown branch Electron_miniPFIso_all

arizzi commented 6 years ago

probably the example need an update, anyhow we should rather use our own selection of leptons/jets for computing MHT, rather than the selection of the example

scooperstein commented 6 years ago

I see so instead of importing this directly we can instead just import something like the code here https://github.com/scooperstein/nanoAOD-tools/blob/vhbb_crab_setup/python/postprocessing/modules/jme/mht.py#L24 into VHbbProducer.py and include directly our collection of jets/leptons?

arizzi commented 6 years ago

nope, you just import mhtProducer and then define a different

mht = lambda : mhtProducer( lambda j : j.pt > 40, lambda mu : ...something....., lambda el : ...something..... ) or mhtVhbb = same

On Mon, Jan 22, 2018 at 1:59 PM, scooperstein notifications@github.com wrote:

I see so instead of importing this directly we can instead just import something like the code here https://github.com/ scooperstein/nanoAOD-tools/blob/vhbb_crab_setup/python/ postprocessing/modules/jme/mht.py#L24 into VHbbProducer.py and include directly our collection of jets/leptons?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vhbb/nanoAOD-tools/issues/12#issuecomment-359416424, or mute the thread https://github.com/notifications/unsubscribe-auth/AEyilk4rnJGOTaJV8ePdqCOyM17pBhSfks5tNIY5gaJpZM4RmnfF .