{"action":"created","comment":{"url":"https://api.github.com/repos/PandoraPFA/LArContent/pulls/comments/154979979","pull_request_review_id":81222725,"id":154979979,"diff_hunk":"@@ -38,41 +40,76 @@ bool SvmPfoCharacterisationAlgorithm::IsClearTrack(const Cluster *const pCluster\n \n     SupportVectorMachine::DoubleVector featureVector(LArSvmHelper::CalculateFeatures(m_featureToolVector, this, pCluster));\n \n-    if (m_ratioVariables)\n+    if (m_trainingSetMode)\n     {\n-        // TODO This assumption is very bad - remove\n-        const double straightLineLength(featureVector.at(0));\n+        bool isTrueTrack(false);\n \n-        if (straightLineLength > std::numeric_limits<double>::epsilon())\n+        try\n         {\n-            for (unsigned int i = 1; i < featureVector.size(); ++i)\n-                featureVector[i] /= straightLineLength;\n+            const MCParticle *const pMCParticle(MCParticleHelper::GetMainMCParticle(pCluster));\n+            isTrueTrack = ((PHOTON != pMCParticle->GetParticleId()) && (E_MINUS != std::abs(pMCParticle->GetParticleId())));\n         }\n+        catch (const StatusCodeException &) {}\n+\n+        LArSvmHelper::ProduceTrainingExample(m_trainingOutputFile, isTrueTrack, featureVector);\n+        return isTrueTrack;\n     }\n \n+    if (!m_enableProbability)\n+    {\n+        return LArSvmHelper::Classify(m_supportVectorMachine, featureVector);\n+    }\n+    else\n+    {\n+        return (LArSvmHelper::CalculateProbability(m_supportVectorMachine, featureVector) > m_minProbabilityCut);\n+    }\n+}\n+\n+//------------------------------------------------------------------------------------------------------------------------------------------\n+\n+bool SvmPfoCharacterisationAlgorithm::IsClearTrack(const pandora::ParticleFlowObject *const pPfo) const\n+{\n+    //charge related features are only calculated using hits in W view\n+    ClusterList wClusterList;\n+    LArPfoHelper::GetClusters(pPfo, TPC_VIEW_W, wClusterList);\n+\n+    PfoCharacterisationFeatureTool::FeatureToolVector featureToolVector(wClusterList.empty() ? m_featureToolVectorMissingW : m_featureToolVectorThreeD);\n+    SupportVectorMachine::DoubleVector featureVector(LArSvmHelper::CalculateFeatures(featureToolVector, this, pPfo));","path":"larpandoracontent/LArTrackShowerId/SvmPfoCharacterisationAlgorithm.cc","position":63,"original_position":63,"commit_id":"2506d81ef7efcf6c5b40c29c9d90d009fa9f78fc","original_commit_id":"2506d81ef7efcf6c5b40c29c9d90d009fa9f78fc","user":{"login":"loressa","id":17066227,"avatar_url":"https://avatars3.githubusercontent.com/u/17066227?v=4","gravatar_id":"","url":"https://api.github.com/users/loressa","html_url":"https://github.com/loressa","followers_url":"https://api.github.com/users/loressa/followers","following_url":"https://api.github.com/users/loressa/following{/other_user}","gists_url":"https://api.github.com/users/loressa/gists{/gist_id}","starred_url":"https://api.github.com/users/loressa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loressa/subscriptions","organizations_url":"https://api.github.com/users/loressa/orgs","repos_url":"https://api.github.com/users/loressa/repos","events_url":"https://api.github.com/users/loressa/events{/privacy}","received_events_url":"https://api.github.com/users/loressa/received_events","type":"User","site_admin":false},"body":"yup","created_at":"2017-12-05T15:27:17Z","updated_at":"2017-12-05T15:27:17Z","html_url":"https://github.com/PandoraPFA/LArContent/pull/21#discussion_r154979979","pull_request_url":"https://api.github.com/repos/PandoraPFA/LArContent/pulls/21","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/PandoraPFA/LArContent/pulls/comments/154979979"},"html":{"href":"https://github.com/PandoraPFA/LArContent/pull/21#discussion_r154979979"},"pull_request":{"href":"https://api.github.com/repos/PandoraPFA/LArContent/pulls/21"}},"in_reply_to_id":154688714},"pull_request":{"url":"https://api.github.com/repos/PandoraPFA/LArContent/pulls/21","id":151200462,"html_url":"https://github.com/PandoraPFA/LArContent/pull/21","diff_url":"https://github.com/PandoraPFA/LArContent/pull/21.diff","patch_url":"https://github.com/PandoraPFA/LArContent/pull/21.patch","issue_url":"https://api.github.com/repos/PandoraPFA/LArContent/issues/21","number":21,"state":"open","locked":false,"title":"Svm pfo characterisation using 3d information ","user":{"login":"loressa","id":17066227,"avatar_url":"https://avatars3.githubusercontent.com/u/17066227?v=4","gravatar_id":"","url":"https://api.github.com/users/loressa","html_url":"https://github.com/loressa","followers_url":"https://api.github.com/users/loressa/followers","following_url":"https://api.github.com/users/loressa/following{/other_user}","gists_url":"https://api.github.com/users/loressa/gists{/gist_id}","starred_url":"https://api.github.com/users/loressa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loressa/subscriptions","organizations_url":"https://api.github.com/users/loressa/orgs","repos_url":"https://api.github.com/users/loressa/repos","events_url":"https://api.github.com/users/loressa/events{/privacy}","received_events_url":"https://api.github.com/users/loressa/received_events","type":"User","site_admin":false},"body":"These are the changes to LArContent for the updated svm pfo characterisation using 3D information. While cleaning the code prior to this PR, I modified some classes wrt my local changes. It has been checked that it preserves the same results and hopefully it's better structured and have less repetitions than my local versions. In any case, we can iterate on this, as I said I made these modifications recently, so maybe better options are to appear after another look (and/or pair of eyes). Some of these changes to be highlighted:\r\n    - Edited SvmPfoCharacterisationBaseAlgorithm to work with either 2D information at the cluster level (and then a minimum number of views to separate tracks and showers), as used previously, or 3D information at the PFO level. For this reason I modified the algorithms inheriting from this algorithm (i.e. cut-based and svm-based) to use a local version of IsClearTrack(pfo), which now in the base algorithm is replaced by IsTrackLike(pfo). Option m_useThreeDInformation added.\r\n    - Removed the terrible use of featureVector[0] assumed as length always to produce the ratio of variables, now calculated inside the appropriate TrackShowerIDFeatureTools. \r\n    - Should work as it is at the moment. To replace the 2D -> 3D SVM characterisation, changes to MachineLearningData and settings files are to be included as well (PRs to follow)\r\n\r\nHopefully indentation is all good this time and no tabs remained after my checks. ","created_at":"2017-11-07T19:07:42Z","updated_at":"2017-12-05T15:27:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c4e49494ef3080c594ff410ca27e70b2b9b1e911","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/PandoraPFA/LArContent/pulls/21/commits","review_comments_url":"https://api.github.com/repos/PandoraPFA/LArContent/pulls/21/comments","review_comment_url":"https://api.github.com/repos/PandoraPFA/LArContent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PandoraPFA/LArContent/issues/21/comments","statuses_url":"https://api.github.com/repos/PandoraPFA/LArContent/statuses/2506d81ef7efcf6c5b40c29c9d90d009fa9f78fc","head":{"label":"loressa:SVMPfo3D","ref":"SVMPfo3D","sha":"2506d81ef7efcf6c5b40c29c9d90d009fa9f78fc","user":{"login":"loressa","id":17066227,"avatar_url":"https://avatars3.githubusercontent.com/u/17066227?v=4","gravatar_id":"","url":"https://api.github.com/users/loressa","html_url":"https://github.com/loressa","followers_url":"https://api.github.com/users/loressa/followers","following_url":"https://api.github.com/users/loressa/following{/other_user}","gists_url":"https://api.github.com/users/loressa/gists{/gist_id}","starred_url":"https://api.github.com/users/loressa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loressa/subscriptions","organizations_url":"https://api.github.com/users/loressa/orgs","repos_url":"https://api.github.com/users/loressa/repos","events_url":"https://api.github.com/users/loressa/events{/privacy}","received_events_url":"https://api.github.com/users/loressa/received_events","type":"User","site_admin":false},"repo":{"id":71049210,"name":"LArContent","full_name":"loressa/LArContent","owner":{"login":"loressa","id":17066227,"avatar_url":"https://avatars3.githubusercontent.com/u/17066227?v=4","gravatar_id":"","url":"https://api.github.com/users/loressa","html_url":"https://github.com/loressa","followers_url":"https://api.github.com/users/loressa/followers","following_url":"https://api.github.com/users/loressa/following{/other_user}","gists_url":"https://api.github.com/users/loressa/gists{/gist_id}","starred_url":"https://api.github.com/users/loressa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loressa/subscriptions","organizations_url":"https://api.github.com/users/loressa/orgs","repos_url":"https://api.github.com/users/loressa/repos","events_url":"https://api.github.com/users/loressa/events{/privacy}","received_events_url":"https://api.github.com/users/loressa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/loressa/LArContent","description":"Algorithms and tools for LAr TPC event reconstruction","fork":true,"url":"https://api.github.com/repos/loressa/LArContent","forks_url":"https://api.github.com/repos/loressa/LArContent/forks","keys_url":"https://api.github.com/repos/loressa/LArContent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/loressa/LArContent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/loressa/LArContent/teams","hooks_url":"https://api.github.com/repos/loressa/LArContent/hooks","issue_events_url":"https://api.github.com/repos/loressa/LArContent/issues/events{/number}","events_url":"https://api.github.com/repos/loressa/LArContent/events","assignees_url":"https://api.github.com/repos/loressa/LArContent/assignees{/user}","branches_url":"https://api.github.com/repos/loressa/LArContent/branches{/branch}","tags_url":"https://api.github.com/repos/loressa/LArContent/tags","blobs_url":"https://api.github.com/repos/loressa/LArContent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/loressa/LArContent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/loressa/LArContent/git/refs{/sha}","trees_url":"https://api.github.com/repos/loressa/LArContent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/loressa/LArContent/statuses/{sha}","languages_url":"https://api.github.com/repos/loressa/LArContent/languages","stargazers_url":"https://api.github.com/repos/loressa/LArContent/stargazers","contributors_url":"https://api.github.com/repos/loressa/LArContent/contributors","subscribers_url":"https://api.github.com/repos/loressa/LArContent/subscribers","subscription_url":"https://api.github.com/repos/loressa/LArContent/subscription","commits_url":"https://api.github.com/repos/loressa/LArContent/commits{/sha}","git_commits_url":"https://api.github.com/repos/loressa/LArContent/git/commits{/sha}","comments_url":"https://api.github.com/repos/loressa/LArContent/comments{/number}","issue_comment_url":"https://api.github.com/repos/loressa/LArContent/issues/comments{/number}","contents_url":"https://api.github.com/repos/loressa/LArContent/contents/{+path}","compare_url":"https://api.github.com/repos/loressa/LArContent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/loressa/LArContent/merges","archive_url":"https://api.github.com/repos/loressa/LArContent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/loressa/LArContent/downloads","issues_url":"https://api.github.com/repos/loressa/LArContent/issues{/number}","pulls_url":"https://api.github.com/repos/loressa/LArContent/pulls{/number}","milestones_url":"https://api.github.com/repos/loressa/LArContent/milestones{/number}","notifications_url":"https://api.github.com/repos/loressa/LArContent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/loressa/LArContent/labels{/name}","releases_url":"https://api.github.com/repos/loressa/LArContent/releases{/id}","deployments_url":"https://api.github.com/repos/loressa/LArContent/deployments","created_at":"2016-10-16T12:33:23Z","updated_at":"2016-10-16T12:33:26Z","pushed_at":"2017-11-08T13:46:51Z","git_url":"git://github.com/loressa/LArContent.git","ssh_url":"git@github.com:loressa/LArContent.git","clone_url":"https://github.com/loressa/LArContent.git","svn_url":"https://github.com/loressa/LArContent","homepage":"","size":23446,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"PandoraPFA:master","ref":"master","sha":"d3eb30c6e087257b83acee451cc368d6d2ce819f","user":{"login":"PandoraPFA","id":13437413,"avatar_url":"https://avatars2.githubusercontent.com/u/13437413?v=4","gravatar_id":"","url":"https://api.github.com/users/PandoraPFA","html_url":"https://github.com/PandoraPFA","followers_url":"https://api.github.com/users/PandoraPFA/followers","following_url":"https://api.github.com/users/PandoraPFA/following{/other_user}","gists_url":"https://api.github.com/users/PandoraPFA/gists{/gist_id}","starred_url":"https://api.github.com/users/PandoraPFA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PandoraPFA/subscriptions","organizations_url":"https://api.github.com/users/PandoraPFA/orgs","repos_url":"https://api.github.com/users/PandoraPFA/repos","events_url":"https://api.github.com/users/PandoraPFA/events{/privacy}","received_events_url":"https://api.github.com/users/PandoraPFA/received_events","type":"User","site_admin":false},"repo":{"id":43431205,"name":"LArContent","full_name":"PandoraPFA/LArContent","owner":{"login":"PandoraPFA","id":13437413,"avatar_url":"https://avatars2.githubusercontent.com/u/13437413?v=4","gravatar_id":"","url":"https://api.github.com/users/PandoraPFA","html_url":"https://github.com/PandoraPFA","followers_url":"https://api.github.com/users/PandoraPFA/followers","following_url":"https://api.github.com/users/PandoraPFA/following{/other_user}","gists_url":"https://api.github.com/users/PandoraPFA/gists{/gist_id}","starred_url":"https://api.github.com/users/PandoraPFA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PandoraPFA/subscriptions","organizations_url":"https://api.github.com/users/PandoraPFA/orgs","repos_url":"https://api.github.com/users/PandoraPFA/repos","events_url":"https://api.github.com/users/PandoraPFA/events{/privacy}","received_events_url":"https://api.github.com/users/PandoraPFA/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/PandoraPFA/LArContent","description":"Algorithms and tools for LAr TPC event reconstruction","fork":false,"url":"https://api.github.com/repos/PandoraPFA/LArContent","forks_url":"https://api.github.com/repos/PandoraPFA/LArContent/forks","keys_url":"https://api.github.com/repos/PandoraPFA/LArContent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PandoraPFA/LArContent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PandoraPFA/LArContent/teams","hooks_url":"https://api.github.com/repos/PandoraPFA/LArContent/hooks","issue_events_url":"https://api.github.com/repos/PandoraPFA/LArContent/issues/events{/number}","events_url":"https://api.github.com/repos/PandoraPFA/LArContent/events","assignees_url":"https://api.github.com/repos/PandoraPFA/LArContent/assignees{/user}","branches_url":"https://api.github.com/repos/PandoraPFA/LArContent/branches{/branch}","tags_url":"https://api.github.com/repos/PandoraPFA/LArContent/tags","blobs_url":"https://api.github.com/repos/PandoraPFA/LArContent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PandoraPFA/LArContent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PandoraPFA/LArContent/git/refs{/sha}","trees_url":"https://api.github.com/repos/PandoraPFA/LArContent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PandoraPFA/LArContent/statuses/{sha}","languages_url":"https://api.github.com/repos/PandoraPFA/LArContent/languages","stargazers_url":"https://api.github.com/repos/PandoraPFA/LArContent/stargazers","contributors_url":"https://api.github.com/repos/PandoraPFA/LArContent/contributors","subscribers_url":"https://api.github.com/repos/PandoraPFA/LArContent/subscribers","subscription_url":"https://api.github.com/repos/PandoraPFA/LArContent/subscription","commits_url":"https://api.github.com/repos/PandoraPFA/LArContent/commits{/sha}","git_commits_url":"https://api.github.com/repos/PandoraPFA/LArContent/git/commits{/sha}","comments_url":"https://api.github.com/repos/PandoraPFA/LArContent/comments{/number}","issue_comment_url":"https://api.github.com/repos/PandoraPFA/LArContent/issues/comments{/number}","contents_url":"https://api.github.com/repos/PandoraPFA/LArContent/contents/{+path}","compare_url":"https://api.github.com/repos/PandoraPFA/LArContent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PandoraPFA/LArContent/merges","archive_url":"https://api.github.com/repos/PandoraPFA/LArContent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PandoraPFA/LArContent/downloads","issues_url":"https://api.github.com/repos/PandoraPFA/LArContent/issues{/number}","pulls_url":"https://api.github.com/repos/PandoraPFA/LArContent/pulls{/number}","milestones_url":"https://api.github.com/repos/PandoraPFA/LArContent/milestones{/number}","notifications_url":"https://api.github.com/repos/PandoraPFA/LArContent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PandoraPFA/LArContent/labels{/name}","releases_url":"https://api.github.com/repos/PandoraPFA/LArContent/releases{/id}","deployments_url":"https://api.github.com/repos/PandoraPFA/LArContent/deployments","created_at":"2015-09-30T12:19:46Z","updated_at":"2016-11-04T15:25:24Z","pushed_at":"2017-12-05T12:32:35Z","git_url":"git://github.com/PandoraPFA/LArContent.git","ssh_url":"git@github.com:PandoraPFA/LArContent.git","clone_url":"https://github.com/PandoraPFA/LArContent.git","svn_url":"https://github.com/PandoraPFA/LArContent","homepage":"","size":23523,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":2,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0"},"forks":7,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PandoraPFA/LArContent/pulls/21"},"html":{"href":"https://github.com/PandoraPFA/LArContent/pull/21"},"issue":{"href":"https://api.github.com/repos/PandoraPFA/LArContent/issues/21"},"comments":{"href":"https://api.github.com/repos/PandoraPFA/LArContent/issues/21/comments"},"review_comments":{"href":"https://api.github.com/repos/PandoraPFA/LArContent/pulls/21/comments"},"review_comment":{"href":"https://api.github.com/repos/PandoraPFA/LArContent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PandoraPFA/LArContent/pulls/21/commits"},"statuses":{"href":"https://api.github.com/repos/PandoraPFA/LArContent/statuses/2506d81ef7efcf6c5b40c29c9d90d009fa9f78fc"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"loressa"}}