{"action":"created","issue":{"url":"https://api.github.com/repos/UCATLAS/xAODAnaHelpers/issues/234","labels_url":"https://api.github.com/repos/UCATLAS/xAODAnaHelpers/issues/234/labels{/name}","comments_url":"https://api.github.com/repos/UCATLAS/xAODAnaHelpers/issues/234/comments","events_url":"https://api.github.com/repos/UCATLAS/xAODAnaHelpers/issues/234/events","html_url":"https://github.com/UCATLAS/xAODAnaHelpers/pull/234","id":101355140,"number":234,"title":"Add branches with number of BTagged jets PLUS bug(?)fix","user":{"login":"mmilesi","id":12515122,"avatar_url":"https://avatars.githubusercontent.com/u/12515122?v=3","gravatar_id":"","url":"https://api.github.com/users/mmilesi","html_url":"https://github.com/mmilesi","followers_url":"https://api.github.com/users/mmilesi/followers","following_url":"https://api.github.com/users/mmilesi/following{/other_user}","gists_url":"https://api.github.com/users/mmilesi/gists{/gist_id}","starred_url":"https://api.github.com/users/mmilesi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmilesi/subscriptions","organizations_url":"https://api.github.com/users/mmilesi/orgs","repos_url":"https://api.github.com/users/mmilesi/repos","events_url":"https://api.github.com/users/mmilesi/events{/privacy}","received_events_url":"https://api.github.com/users/mmilesi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/UCATLAS/xAODAnaHelpers/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/UCATLAS/xAODAnaHelpers/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"gfacini","id":10064627,"avatar_url":"https://avatars.githubusercontent.com/u/10064627?v=3","gravatar_id":"","url":"https://api.github.com/users/gfacini","html_url":"https://github.com/gfacini","followers_url":"https://api.github.com/users/gfacini/followers","following_url":"https://api.github.com/users/gfacini/following{/other_user}","gists_url":"https://api.github.com/users/gfacini/gists{/gist_id}","starred_url":"https://api.github.com/users/gfacini/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gfacini/subscriptions","organizations_url":"https://api.github.com/users/gfacini/orgs","repos_url":"https://api.github.com/users/gfacini/repos","events_url":"https://api.github.com/users/gfacini/events{/privacy}","received_events_url":"https://api.github.com/users/gfacini/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2015-08-17T07:20:15Z","updated_at":"2015-08-17T09:29:17Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/UCATLAS/xAODAnaHelpers/pulls/234","html_url":"https://github.com/UCATLAS/xAODAnaHelpers/pull/234","diff_url":"https://github.com/UCATLAS/xAODAnaHelpers/pull/234.diff","patch_url":"https://github.com/UCATLAS/xAODAnaHelpers/pull/234.patch"},"body":"Hi @gfacini ,\r\n\r\nthis adds a branch with the number of jets fulfilling some BTag requirement (which I think is very useful, at least for my analysis purposes is :blush: ) plus...a fix to what I suspect is a bug in BJetEfficiencyCorrector.cxx.\r\n\r\nBasically I have noticed that, with such an implementation of the BTag decoration:\r\n\r\n```\r\n      //\r\n      // Add decorator for decision\r\n      // \r\n      SG::AuxElement::Decorator< int > isBTag( m_decor );\r\n      if( !isBTag.isAvailable( *jet_itr ) ) {\r\n        if( m_BJetSelectTool->accept( *jet_itr ) ) { \r\n          isBTag( *jet_itr ) = 1; \r\n          tagged = true;\r\n        }\r\n        else { \r\n          isBTag( *jet_itr ) = 0; \r\n          tagged = false;\r\n        }\r\n      }\r\n``` \r\n\r\n, an event with >=2 jets that pass the BTag requirement will end up having only the first one decorated, but not the others because of the `isBTag.isAvailable( *jet_itr )` check. The final outcome is that I do not see events with more than 1 bjet, even when checking a ttbar sample!\r\n\r\nTo be honest, I haven't really understood why the decoration availability check is working that way: my guess was that SG::Decorator was a property of a single xAOD object, but apparently is not.\r\n\r\n@kratsg, can you shed some light on this maybe?\r\n\r\nCheers\r\n\r\nMarco"},"comment":{"url":"https://api.github.com/repos/UCATLAS/xAODAnaHelpers/issues/comments/131742758","html_url":"https://github.com/UCATLAS/xAODAnaHelpers/pull/234#issuecomment-131742758","issue_url":"https://api.github.com/repos/UCATLAS/xAODAnaHelpers/issues/234","id":131742758,"user":{"login":"mmilesi","id":12515122,"avatar_url":"https://avatars.githubusercontent.com/u/12515122?v=3","gravatar_id":"","url":"https://api.github.com/users/mmilesi","html_url":"https://github.com/mmilesi","followers_url":"https://api.github.com/users/mmilesi/followers","following_url":"https://api.github.com/users/mmilesi/following{/other_user}","gists_url":"https://api.github.com/users/mmilesi/gists{/gist_id}","starred_url":"https://api.github.com/users/mmilesi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmilesi/subscriptions","organizations_url":"https://api.github.com/users/mmilesi/orgs","repos_url":"https://api.github.com/users/mmilesi/repos","events_url":"https://api.github.com/users/mmilesi/events{/privacy}","received_events_url":"https://api.github.com/users/mmilesi/received_events","type":"User","site_admin":false},"created_at":"2015-08-17T09:29:17Z","updated_at":"2015-08-17T09:29:17Z","body":"Hey all,\r\n\r\nI have unearthed an old PAT help topic, where Attila and TJ explained why doing as above is a (nasty!) mistake:\r\n\r\nhttps://groups.cern.ch/group/hn-atlas-PATHelp/Lists/Archive/Flat.aspx?RootFolder=%2fgroup%2fhn-atlas-PATHelp%2fLists%2fArchive%2fIParticle%2eisAvailable%28%29%20on%20i%2b1th%20object&FolderCTID=0x0120020084D7E80CB0C3394A8D54EF07C309B044\r\n\r\nSo, the bottom line is: **never ever use isAvailable() for decorators, i.e., decorate selectively!**.\r\n\r\nWe should all check if any of such bugs is somewhere else in our code ASAP!!\r\n\r\nCheers\r\n\r\nMarco \r\n\r\n@gfacini @kratsg @jdandoy @johnda102"}}