{"action":"created","issue":{"url":"https://api.github.com/repos/GRIFFINCollaboration/GRSISort/issues/324","labels_url":"https://api.github.com/repos/GRIFFINCollaboration/GRSISort/issues/324/labels{/name}","comments_url":"https://api.github.com/repos/GRIFFINCollaboration/GRSISort/issues/324/comments","events_url":"https://api.github.com/repos/GRIFFINCollaboration/GRSISort/issues/324/events","html_url":"https://github.com/GRIFFINCollaboration/GRSISort/issues/324","id":75798528,"number":324,"title":"griffin_hits.time type","user":{"login":"SmithJK","id":10604745,"avatar_url":"https://avatars.githubusercontent.com/u/10604745?v=3","gravatar_id":"","url":"https://api.github.com/users/SmithJK","html_url":"https://github.com/SmithJK","followers_url":"https://api.github.com/users/SmithJK/followers","following_url":"https://api.github.com/users/SmithJK/following{/other_user}","gists_url":"https://api.github.com/users/SmithJK/gists{/gist_id}","starred_url":"https://api.github.com/users/SmithJK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SmithJK/subscriptions","organizations_url":"https://api.github.com/users/SmithJK/orgs","repos_url":"https://api.github.com/users/SmithJK/repos","events_url":"https://api.github.com/users/SmithJK/events{/privacy}","received_events_url":"https://api.github.com/users/SmithJK/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GRIFFINCollaboration/GRSISort/labels/Griffin","name":"Griffin","color":"eb6420"},{"url":"https://api.github.com/repos/GRIFFINCollaboration/GRSISort/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-13T01:05:45Z","updated_at":"2015-05-13T18:30:48Z","closed_at":null,"body":"In SetCoreTime, GetTimeStamp returns a double, but fCoreTime is a long. This inconsistency is noted when a walk correction is applied, when the smooth function is effectively being cast as an integer. The plot below shows a corrected time difference against the energy of the second interaction (the first interaction was in the 1332 keV peak) and my walk correction function (red) as well as the integer version of it (magenta).\r\n\r\n![walkcorrection_notsmooth_withfunctions](https://cloud.githubusercontent.com/assets/10604745/7601837/ccebebec-f8d0-11e4-8329-55197720352f.png)\r\n\r\nI initially thought that griffin_hits.time should be a double to fix this, but I can imagine that letting it be a double implies more precision than we actually have. If that's true, I think there's a way we can cast from double to long better. I think it involves adding or subtracting 0.5? Thoughts?"},"comment":{"url":"https://api.github.com/repos/GRIFFINCollaboration/GRSISort/issues/comments/101769130","html_url":"https://github.com/GRIFFINCollaboration/GRSISort/issues/324#issuecomment-101769130","issue_url":"https://api.github.com/repos/GRIFFINCollaboration/GRSISort/issues/324","id":101769130,"user":{"login":"r3dunlop","id":5428160,"avatar_url":"https://avatars.githubusercontent.com/u/5428160?v=3","gravatar_id":"","url":"https://api.github.com/users/r3dunlop","html_url":"https://github.com/r3dunlop","followers_url":"https://api.github.com/users/r3dunlop/followers","following_url":"https://api.github.com/users/r3dunlop/following{/other_user}","gists_url":"https://api.github.com/users/r3dunlop/gists{/gist_id}","starred_url":"https://api.github.com/users/r3dunlop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/r3dunlop/subscriptions","organizations_url":"https://api.github.com/users/r3dunlop/orgs","repos_url":"https://api.github.com/users/r3dunlop/repos","events_url":"https://api.github.com/users/r3dunlop/events{/privacy}","received_events_url":"https://api.github.com/users/r3dunlop/received_events","type":"User","site_admin":false},"created_at":"2015-05-13T18:30:48Z","updated_at":"2015-05-13T18:30:48Z","body":"Thanks for clarifying the other direction!\r\n\r\n> On May 13, 2015, at 8:15 PM, Vinzenz Bildstein <notifications@github.com> wrote:\r\n> \r\n> If you want to convert from integer to double and actually use a resolution of less than 1, you need to randomize. If you want to convert a double to an integer, you either add 0.5 to the value before casting or (better) use std::round (c++11). The reason is that an integer stored as a double can be rounded down slightly (by the resolution of a double) and a direct conversion from the double always rounds down. So you could store 42 in a double, and when you cast it back to an integer, that integer is 41. The same holds true for float.\r\n> \r\n> —\r\n> Reply to this email directly or view it on GitHub.\r\n> \r\n"}}