{"action":"created","issue":{"url":"https://api.github.com/repos/KappaAnalysis/Kappa/issues/23","repository_url":"https://api.github.com/repos/KappaAnalysis/Kappa","labels_url":"https://api.github.com/repos/KappaAnalysis/Kappa/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/KappaAnalysis/Kappa/issues/23/comments","events_url":"https://api.github.com/repos/KappaAnalysis/Kappa/issues/23/events","html_url":"https://github.com/KappaAnalysis/Kappa/issues/23","id":160156439,"number":23,"title":"Polymorphic dataformat types","user":{"login":"thomas-mueller","id":5478445,"avatar_url":"https://avatars.githubusercontent.com/u/5478445?v=3","gravatar_id":"","url":"https://api.github.com/users/thomas-mueller","html_url":"https://github.com/thomas-mueller","followers_url":"https://api.github.com/users/thomas-mueller/followers","following_url":"https://api.github.com/users/thomas-mueller/following{/other_user}","gists_url":"https://api.github.com/users/thomas-mueller/gists{/gist_id}","starred_url":"https://api.github.com/users/thomas-mueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomas-mueller/subscriptions","organizations_url":"https://api.github.com/users/thomas-mueller/orgs","repos_url":"https://api.github.com/users/thomas-mueller/repos","events_url":"https://api.github.com/users/thomas-mueller/events{/privacy}","received_events_url":"https://api.github.com/users/thomas-mueller/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-06-14T11:18:47Z","updated_at":"2016-06-14T12:03:14Z","closed_at":null,"body":"I would like to use `dynamic_cast` to identify the actual types of objects of Kappa dataformats. As an example, the `static_cast` [here](https://github.com/cms-analysis/HiggsAnalysis-KITHiggsToTauTau/blob/master/src/Utility/GeneratorInfo.cc#L39-L47) does not give the desired result, whereas `dynamic_cast` does.\r\n\r\nCurrently it is not possible to `dynamic_cast` objects of Kappa dataformats, because the types are not polymorphic. On [stackoverflow](http://stackoverflow.com/questions/8469900/cant-downcast-because-class-is-not-polymorphic/8469954#8469954) it is explained that this is due to the lack of virtual functions and it is suggested to add virtual destructors. I tested this in the `struct KGenParticle` and was then able to exchange the `static_cast` in the example above by a `dynamic_cast`.\r\n\r\nTherefore I would like to understand, if there are any problems expected with such a change. I will test as well, wether the skim still works with such changes in the dataformats and I will then propose a pull request in the next time. Comments and explanations are very welcome."},"comment":{"url":"https://api.github.com/repos/KappaAnalysis/Kappa/issues/comments/225860498","html_url":"https://github.com/KappaAnalysis/Kappa/issues/23#issuecomment-225860498","issue_url":"https://api.github.com/repos/KappaAnalysis/Kappa/issues/23","id":225860498,"user":{"login":"thomas-mueller","id":5478445,"avatar_url":"https://avatars.githubusercontent.com/u/5478445?v=3","gravatar_id":"","url":"https://api.github.com/users/thomas-mueller","html_url":"https://github.com/thomas-mueller","followers_url":"https://api.github.com/users/thomas-mueller/followers","following_url":"https://api.github.com/users/thomas-mueller/following{/other_user}","gists_url":"https://api.github.com/users/thomas-mueller/gists{/gist_id}","starred_url":"https://api.github.com/users/thomas-mueller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomas-mueller/subscriptions","organizations_url":"https://api.github.com/users/thomas-mueller/orgs","repos_url":"https://api.github.com/users/thomas-mueller/repos","events_url":"https://api.github.com/users/thomas-mueller/events{/privacy}","received_events_url":"https://api.github.com/users/thomas-mueller/received_events","type":"User","site_admin":false},"created_at":"2016-06-14T12:03:14Z","updated_at":"2016-06-14T12:03:14Z","body":"@rfriese: In this special example (is not the single one that exists) I am talking about KGenParticle and KGenTau (not KParticle). And both have a p4 member. Additionally, KGenTau has a vis_p4 member, which is needed in my example in some cases."}}
{"actor":{"display_login":"thomas-mueller"}}