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
VID Selectors don't work in FWLite anymore #23676
Comments
A new Issue was created by @guitargeek Jonas Rembser. @davidlange6, @Dr15Jones, @smuzaffar, @fabiocos can you please review it and eventually sign/assign? Thanks. cms-bot commands are listed here |
@smuzaffar looks like you made the original change? |
assign reconstruction |
@guitargeek |
Hi @slava77, I have not tried it recently but I suppose the VID in FWLite is still broken. It does not seem that people care too much however. The discussion in #24131 was not related to the VID selectors, but to using the Egamma MVAEstimator classes in FWLite. Sorry I can't say much on these FWLite issues, since I don't use it. But recently I got in contact with someone who wants to use the new Egamma MVAs in FWLite [1], so maybe things will move forward from there. [1] https://hypernews.cern.ch/HyperNews/CMS/get/egamma-elecid/132.html |
Hello, I would just like to point out that the fact that electron ID V2 does not work in FWLite is a verious serious blocker for our analyses. Indeed, we are reading mini AODs and re-running POG recipes in FWLite when necessary before making our ntuples. Having to run the full framework at this stage just for electron ID would force us to add a step to our computing workflow and to store the resulting modified mini AODs, hence a waste of computing time and space. I think the main issue is here: Starting from there, the code is designed to run on an In mvaValue the ptr is used in the following ways:
@GaelTouquet @lucastorterotot are certainly willing to help on this, but we do not see how we could do it alone at this stage. @guitargeek @Dr15Jones could we maybe set up a discussion on skype so that we could try and find a solution? |
@cbernet if you have an |
@cbernet both |
Thanks for your comments Chris, this is helping a lot. We’ll give it a try and will comment back here in a few days.
… Le 20 nov. 2018 à 16:30, Chris Jones ***@***.***> a écrit :
@cbernet <https://github.com/cbernet> both fwlite::Event and edm::Event inherit from edm::EventBase. So any function that takes a edm::EventBase will work in FWLite.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#23676 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AD8ku4m5KGePCghOtGVoOATBSzo4XmFlks5uxCAQgaJpZM4U2dZ4>.
|
Hi @cbernet, that's very interesting that the new implementation might not work in a real use case! I would have taken much care about fwlite compatibility if I I would have had any code to test it with, maybe you can point me to some code where you were running the old 2016 Egamma MVA recipe with fwlite and it worked? |
Hi @Dr15Jones, could you please tell me how to read an edm::Ptr from the input file in FWLite with python? I'm doing the following which gives me a import ROOT
from DataFormats.FWLite import Events, Handle
events = Events('root://cms-xrd-global.cern.ch//store/mc/RunIIFall17MiniAODv2/VBFHToTauTau_M125_13TeV_powheg_pythia8/MINIAODSIM/PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/90000/549B2DC8-C443-E811-9DAF-A0369FE2C17C.root')
# events = Events('test.root')
handle = Handle ('std::vector<pat::Electron>')
for i,event in enumerate(events):
event.getByLabel(('slimmedElectrons'),handle)
electrons = handle.product()
if not len(electrons):
continue
print electrons[0]
# gives : <ROOT.pat::Electron object at 0x10270900>
import pdb; pdb.set_trace()
if i==100:
break |
I just meant that if a |
Ok, I see. But my issue here is that when I read electrons using FWLite in python, I get a @guitargeek could you please tell me where the mvaValue method is used in the full framework when re-running on miniaod? I would need to understand how you get the edm::Ptr to the electron before calling the method. |
Does
really need an |
@makortel, since I have to get some information from precomputed value maps [1] I thought the edm::Ptr is necessary. Or is there another way? For sure I remember that it did not work with the bare reco::Candidate... |
@cbernet The mvaValue method is used here: |
@guitargeek Thanks for pointing it out. The cmssw/DataFormats/Common/interface/ValueMap.h Lines 127 to 130 in e33a0d8
In principle @cbernet's example #23676 (comment) has all the needed ingredients. Maybe one could provide variants of the interface? Can one create an edm::Ref in FWLite?
|
Or would handle = Handle ('edm::View<pat::Electron>') work? |
guys, really thanks for the suggestions. But in python FWLite, the Handle object does not seem to have a ptrAt method:
@Dr15Jones sorry to disturb again, and sorry if it's a silly question. Is there a way to build an edm::Ptr in python FWLite from a FWLite Handle? If not, maybe I could read the input valuemaps mentioned by @guitargeek instead of the electron collection, and get the electron ptr from there, what do you think? |
I do not believe so. |
I think that's not the simplest solution @cbernet. I think the easiest way would be to reorganize the MVA code a little bit such that the missing ID variables are not calculated by a separate producer and therefore have to be stored in value maps, but it's done within the MVAValueMapProducer starting from the GsfElectron and the other products without the need of edm::Ptr. Actually I already started to write code for that some time age, but then I realized it somehow contradicts the idea of a modular framework if one producer gets to do too much and abandoned that idea. Maybe I should come back to that. |
The We could presumably add a new method to fwlite::Event which gives a type safe access to the ProductID for a data product in the event. |
Thanks @Dr15Jones, Jonas and I are now in touch, we will try and get the V2 e ID to run in python fwlite without modification of fwlite::Event for now (though what you propose sounds very useful to me) |
Hi, I made a PR to address the issue raised by @cbernet as GitHub was automatically referencing here. We should continue the discussion there, in particular because actually this issue has actually nothing to do with it. I opened the issue because the VID selectors don't work, which is separate from the calculation of the MVA ID variables (that can be later used by VID). Just wanted to point that out so nobody thinks the original issue was solved... |
Hi @guitargeek, again thank you! Could you please explain what the VID selectors are and point me to some place where they are used in the full framework? |
Hi @cbernet, the VID selectors allow you to specify cutflows and hash them, such that nobody can accidentally mess with the official cuts without triggering a warning in the log. They are also used in production to calculate the cut decisions stored in MiniAOD and NanoAOD. I don't know much about them in FWlite, only that there is this test script here which does not work for a long time: https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/SelectorUtils/test/pyfwlite_test.py For the MVA, the VID cutflow is configured here: https://github.com/cms-sw/cmssw/blob/master/RecoEgamma/ElectronIdentification/python/Identification/mvaElectronID_tools.py#L97 You probably observe that the VID cutflow is not very interesting for MVAs since there is only one single cut on the MVA value. In fact you basically implemented the same functionality in FWlite in your recent PR [1] :) In any case I don't have time to support the Electron VID selectors and this time it's also not my fault they don't work. |
@guitargeek @Sam-Harper |
I agree. Looking at CERN-PH-CMG/cmg-cmssw#749 it seems the FWLite community has written new code to deal with the IDs anyway. Should I just close it like that or you have to do something to mark it was "will not fix"? |
yes, please close. |
Hello fellow cms devs,
some time ago a remark about electron IDs not working in FWLite appeared on the hypernews [1]. I investigated this problem, made some tests and found out that these VID Selectors don't work for a long time actually: since 8_2_0. I was testing it with this script [2].
Now, I basically found the problem, its this guard here [3] which is always guarding that line since I suspect this PR [4]. Since I have no clue what was the intended purpose of all these precompiler directives I refrained from trying to fix it myself and just wanted to make you aware of this issue.
Cheers,
Jonas
[1] https://hypernews.cern.ch/HyperNews/CMS/get/egamma/2091.html
[2] https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/SelectorUtils/test/pyfwlite_test.py
[3] https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/SelectorUtils/interface/VersionedSelector.h#L226
[4] 24556e3#diff-02450dcd86ab6ff6590c4439d9f6acd2
The text was updated successfully, but these errors were encountered: