{"action":"created","comment":{"url":"https://api.github.com/repos/cbernet/heppy/pulls/comments/68710337","id":68710337,"diff_hunk":"@@ -1,48 +1,233 @@\n from heppy.framework.analyzer import Analyzer\n-from ROOT import TVector3\n-#from heppy.framework.event import Event\n+from ROOT import TFile, TH1F\n+from ROOT import TVector3, TLorentzVector\n from heppy.papas.path import Helix\n-#import collections\n+import math\n+from heppy.utils.deltar import deltaR\n \n class ImpactParameter(Analyzer):\n-\n+    '''This analyzer puts an impact parameter for every charged particle\n+    as an attribute of its path : particle.path.IP\n+    The significance is calculated, the calculus are a first order approximation,\n+    thus this may not be correct for large impact parameters (more than 3 mm)\n+    It also computes W, the likelihood value for the jet to contain beauty,\n+    using a likelihood ratio method for each particle in the jet.\n+    Computes TCHE and TCHP for the jet for b-tagging'''\n         \n     def process(self, event):\n         assumed_vertex = TVector3(0, 0, 0)\n         jets = getattr(event, self.cfg_ana.jets)\n+        enable_matter_scattering = self.cfg_ana.enable_matter_scattering\n         for jet in jets:\n-            #for ptc in jet.constituents[211]:\n-            #    IPsn = 1\n-            #    N_charge = 0\n-                #for i in range(len(const)):\n-                #    if const[i][1][0]._charge <> 0:\n-                #        if len const[i][1] > 0:\n-                #            for l in range(len(const[i][1]))\n-                #                partic = const[i][1][l]\n-                #                h = partic.path\n-                #                Helix.compute_IP(h, assumed_vertex)\n-                #                setattr(partic, self.IP, h.IP)\n-                #                setattr(partic, self.tIP, h.closest.t)\n-                #                setattr(partic, self.xIP, h.closest.x)\n-                #                setattr(partic, self.yIP, h.closest.y)\n-                #                setattr(partic, self.zIP, h.closest.z)\n-                #                IPsn *= h.IP\n-                #                N_charge += 1\n-                #        else :\n-                #            pass\n-                #    else :\n-                #        pass\n-                #if N_charge <> 0 :\n-                #    IPs = IPSn**(1.0/N_charge)\n-                #else :\n-                #    pass\n+            IP_b_LL = 0\n+            IPs_b_LL = 0\n+            ptcs_pt = []\n+            ptcs_IP = []\n+            ptcs_IPxy = []\n+            ptcs_IPz = []\n+            ptcs_IP_signif = []\n+            ptcs_IP_signif_sorted = []\n+            ptcs_x_at_time_0 = []\n+            ptcs_y_at_time_0 = []\n+            ptcs_z_at_time_0 = []\n+            ptcs_dr = []\n             for id, ptcs in jet.constituents.iteritems():\n-                if id in [22,130]:\n+                if abs(id) in [22,130, 11]:\n                     continue\n                 for ptc in ptcs :\n                     if ptc._charge == 0 :\n                         continue\n-                    ptc.path.compute_IP(assumed_vertex)\n-                    #jet.IP = ptc.path.IP\n-            #setattr(event, self.cfg_ana.output, IPs)\n+                    ptc.path.compute_IP(assumed_vertex,jet)\n+                    \n+                    ptc_IP_signif = 0\n+                    if hasattr(ptc.path, 'points') == True and 'beampipe_in' in ptc.path.points:\n+                        ptc.path.compute_theta_0()\n+                        ptc.path.compute_IP_signif(ptc.path.IP,\n+                                                   ptc.path.theta_0,\n+                                                   ptc.path.points['beampipe_in'])\n+                    else :\n+                        ptc.path.compute_IP_signif(ptc.path.IP, None, None)\n+                    \n+                    if ptc.path.p4.Perp() > 1 and (ptc.path.IPx**2 + ptc.path.IPy**2)**0.5 < 0.002 and ptc.path.IPz**2 < 0.17**2 :\n+                        \n+                        dr = deltaR(jet.eta(), jet.phi(), ptc.eta(), ptc.phi())\n+                        \n+                        ptcs_pt.append(ptc.path.p4.Perp())\n+                        ptcs_IP.append(ptc.path.IP)","path":"analyzers/ImpactParameter.py","position":89,"original_position":89,"commit_id":"e23c526f463f224615af38ce5d93daa522f815d7","original_commit_id":"e23c526f463f224615af38ce5d93daa522f815d7","user":{"login":"lucastorterotot","id":19221936,"avatar_url":"https://avatars.githubusercontent.com/u/19221936?v=3","gravatar_id":"","url":"https://api.github.com/users/lucastorterotot","html_url":"https://github.com/lucastorterotot","followers_url":"https://api.github.com/users/lucastorterotot/followers","following_url":"https://api.github.com/users/lucastorterotot/following{/other_user}","gists_url":"https://api.github.com/users/lucastorterotot/gists{/gist_id}","starred_url":"https://api.github.com/users/lucastorterotot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucastorterotot/subscriptions","organizations_url":"https://api.github.com/users/lucastorterotot/orgs","repos_url":"https://api.github.com/users/lucastorterotot/repos","events_url":"https://api.github.com/users/lucastorterotot/events{/privacy}","received_events_url":"https://api.github.com/users/lucastorterotot/received_events","type":"User","site_admin":false},"body":"ptc.path.IP is a numpy.float64","created_at":"2016-06-28T07:40:11Z","updated_at":"2016-06-28T07:40:11Z","html_url":"https://github.com/cbernet/heppy/pull/15#discussion_r68710337","pull_request_url":"https://api.github.com/repos/cbernet/heppy/pulls/15","_links":{"self":{"href":"https://api.github.com/repos/cbernet/heppy/pulls/comments/68710337"},"html":{"href":"https://github.com/cbernet/heppy/pull/15#discussion_r68710337"},"pull_request":{"href":"https://api.github.com/repos/cbernet/heppy/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/cbernet/heppy/pulls/15","id":75335697,"html_url":"https://github.com/cbernet/heppy/pull/15","diff_url":"https://github.com/cbernet/heppy/pull/15.diff","patch_url":"https://github.com/cbernet/heppy/pull/15.patch","issue_url":"https://api.github.com/repos/cbernet/heppy/issues/15","number":15,"state":"open","locked":false,"title":"b-tagging first improvements -- need to check","user":{"login":"lucastorterotot","id":19221936,"avatar_url":"https://avatars.githubusercontent.com/u/19221936?v=3","gravatar_id":"","url":"https://api.github.com/users/lucastorterotot","html_url":"https://github.com/lucastorterotot","followers_url":"https://api.github.com/users/lucastorterotot/followers","following_url":"https://api.github.com/users/lucastorterotot/following{/other_user}","gists_url":"https://api.github.com/users/lucastorterotot/gists{/gist_id}","starred_url":"https://api.github.com/users/lucastorterotot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucastorterotot/subscriptions","organizations_url":"https://api.github.com/users/lucastorterotot/orgs","repos_url":"https://api.github.com/users/lucastorterotot/repos","events_url":"https://api.github.com/users/lucastorterotot/events{/privacy}","received_events_url":"https://api.github.com/users/lucastorterotot/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-27T15:54:55Z","updated_at":"2016-06-28T07:40:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ce87ae78f0b21e7010fbabf0fc936dc0aa47b4e6","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cbernet/heppy/pulls/15/commits","review_comments_url":"https://api.github.com/repos/cbernet/heppy/pulls/15/comments","review_comment_url":"https://api.github.com/repos/cbernet/heppy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cbernet/heppy/issues/15/comments","statuses_url":"https://api.github.com/repos/cbernet/heppy/statuses/e23c526f463f224615af38ce5d93daa522f815d7","head":{"label":"lucastorterotot:master","ref":"master","sha":"e23c526f463f224615af38ce5d93daa522f815d7","user":{"login":"lucastorterotot","id":19221936,"avatar_url":"https://avatars.githubusercontent.com/u/19221936?v=3","gravatar_id":"","url":"https://api.github.com/users/lucastorterotot","html_url":"https://github.com/lucastorterotot","followers_url":"https://api.github.com/users/lucastorterotot/followers","following_url":"https://api.github.com/users/lucastorterotot/following{/other_user}","gists_url":"https://api.github.com/users/lucastorterotot/gists{/gist_id}","starred_url":"https://api.github.com/users/lucastorterotot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucastorterotot/subscriptions","organizations_url":"https://api.github.com/users/lucastorterotot/orgs","repos_url":"https://api.github.com/users/lucastorterotot/repos","events_url":"https://api.github.com/users/lucastorterotot/events{/privacy}","received_events_url":"https://api.github.com/users/lucastorterotot/received_events","type":"User","site_admin":false},"repo":{"id":58357599,"name":"heppy","full_name":"lucastorterotot/heppy","owner":{"login":"lucastorterotot","id":19221936,"avatar_url":"https://avatars.githubusercontent.com/u/19221936?v=3","gravatar_id":"","url":"https://api.github.com/users/lucastorterotot","html_url":"https://github.com/lucastorterotot","followers_url":"https://api.github.com/users/lucastorterotot/followers","following_url":"https://api.github.com/users/lucastorterotot/following{/other_user}","gists_url":"https://api.github.com/users/lucastorterotot/gists{/gist_id}","starred_url":"https://api.github.com/users/lucastorterotot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lucastorterotot/subscriptions","organizations_url":"https://api.github.com/users/lucastorterotot/orgs","repos_url":"https://api.github.com/users/lucastorterotot/repos","events_url":"https://api.github.com/users/lucastorterotot/events{/privacy}","received_events_url":"https://api.github.com/users/lucastorterotot/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lucastorterotot/heppy","description":"A python event processing framework for high energy physics based on ROOT","fork":true,"url":"https://api.github.com/repos/lucastorterotot/heppy","forks_url":"https://api.github.com/repos/lucastorterotot/heppy/forks","keys_url":"https://api.github.com/repos/lucastorterotot/heppy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lucastorterotot/heppy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lucastorterotot/heppy/teams","hooks_url":"https://api.github.com/repos/lucastorterotot/heppy/hooks","issue_events_url":"https://api.github.com/repos/lucastorterotot/heppy/issues/events{/number}","events_url":"https://api.github.com/repos/lucastorterotot/heppy/events","assignees_url":"https://api.github.com/repos/lucastorterotot/heppy/assignees{/user}","branches_url":"https://api.github.com/repos/lucastorterotot/heppy/branches{/branch}","tags_url":"https://api.github.com/repos/lucastorterotot/heppy/tags","blobs_url":"https://api.github.com/repos/lucastorterotot/heppy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lucastorterotot/heppy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lucastorterotot/heppy/git/refs{/sha}","trees_url":"https://api.github.com/repos/lucastorterotot/heppy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lucastorterotot/heppy/statuses/{sha}","languages_url":"https://api.github.com/repos/lucastorterotot/heppy/languages","stargazers_url":"https://api.github.com/repos/lucastorterotot/heppy/stargazers","contributors_url":"https://api.github.com/repos/lucastorterotot/heppy/contributors","subscribers_url":"https://api.github.com/repos/lucastorterotot/heppy/subscribers","subscription_url":"https://api.github.com/repos/lucastorterotot/heppy/subscription","commits_url":"https://api.github.com/repos/lucastorterotot/heppy/commits{/sha}","git_commits_url":"https://api.github.com/repos/lucastorterotot/heppy/git/commits{/sha}","comments_url":"https://api.github.com/repos/lucastorterotot/heppy/comments{/number}","issue_comment_url":"https://api.github.com/repos/lucastorterotot/heppy/issues/comments{/number}","contents_url":"https://api.github.com/repos/lucastorterotot/heppy/contents/{+path}","compare_url":"https://api.github.com/repos/lucastorterotot/heppy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lucastorterotot/heppy/merges","archive_url":"https://api.github.com/repos/lucastorterotot/heppy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lucastorterotot/heppy/downloads","issues_url":"https://api.github.com/repos/lucastorterotot/heppy/issues{/number}","pulls_url":"https://api.github.com/repos/lucastorterotot/heppy/pulls{/number}","milestones_url":"https://api.github.com/repos/lucastorterotot/heppy/milestones{/number}","notifications_url":"https://api.github.com/repos/lucastorterotot/heppy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lucastorterotot/heppy/labels{/name}","releases_url":"https://api.github.com/repos/lucastorterotot/heppy/releases{/id}","deployments_url":"https://api.github.com/repos/lucastorterotot/heppy/deployments","created_at":"2016-05-09T07:35:09Z","updated_at":"2016-05-09T07:35:11Z","pushed_at":"2016-06-27T15:53:15Z","git_url":"git://github.com/lucastorterotot/heppy.git","ssh_url":"git@github.com:lucastorterotot/heppy.git","clone_url":"https://github.com/lucastorterotot/heppy.git","svn_url":"https://github.com/lucastorterotot/heppy","homepage":"","size":580,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cbernet:master","ref":"master","sha":"d76fdc0c750bae85e500d6670425e59ea2459ab1","user":{"login":"cbernet","id":4138171,"avatar_url":"https://avatars.githubusercontent.com/u/4138171?v=3","gravatar_id":"","url":"https://api.github.com/users/cbernet","html_url":"https://github.com/cbernet","followers_url":"https://api.github.com/users/cbernet/followers","following_url":"https://api.github.com/users/cbernet/following{/other_user}","gists_url":"https://api.github.com/users/cbernet/gists{/gist_id}","starred_url":"https://api.github.com/users/cbernet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbernet/subscriptions","organizations_url":"https://api.github.com/users/cbernet/orgs","repos_url":"https://api.github.com/users/cbernet/repos","events_url":"https://api.github.com/users/cbernet/events{/privacy}","received_events_url":"https://api.github.com/users/cbernet/received_events","type":"User","site_admin":false},"repo":{"id":20684927,"name":"heppy","full_name":"cbernet/heppy","owner":{"login":"cbernet","id":4138171,"avatar_url":"https://avatars.githubusercontent.com/u/4138171?v=3","gravatar_id":"","url":"https://api.github.com/users/cbernet","html_url":"https://github.com/cbernet","followers_url":"https://api.github.com/users/cbernet/followers","following_url":"https://api.github.com/users/cbernet/following{/other_user}","gists_url":"https://api.github.com/users/cbernet/gists{/gist_id}","starred_url":"https://api.github.com/users/cbernet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbernet/subscriptions","organizations_url":"https://api.github.com/users/cbernet/orgs","repos_url":"https://api.github.com/users/cbernet/repos","events_url":"https://api.github.com/users/cbernet/events{/privacy}","received_events_url":"https://api.github.com/users/cbernet/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cbernet/heppy","description":"A python event processing framework for high energy physics based on ROOT","fork":false,"url":"https://api.github.com/repos/cbernet/heppy","forks_url":"https://api.github.com/repos/cbernet/heppy/forks","keys_url":"https://api.github.com/repos/cbernet/heppy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cbernet/heppy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cbernet/heppy/teams","hooks_url":"https://api.github.com/repos/cbernet/heppy/hooks","issue_events_url":"https://api.github.com/repos/cbernet/heppy/issues/events{/number}","events_url":"https://api.github.com/repos/cbernet/heppy/events","assignees_url":"https://api.github.com/repos/cbernet/heppy/assignees{/user}","branches_url":"https://api.github.com/repos/cbernet/heppy/branches{/branch}","tags_url":"https://api.github.com/repos/cbernet/heppy/tags","blobs_url":"https://api.github.com/repos/cbernet/heppy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cbernet/heppy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cbernet/heppy/git/refs{/sha}","trees_url":"https://api.github.com/repos/cbernet/heppy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cbernet/heppy/statuses/{sha}","languages_url":"https://api.github.com/repos/cbernet/heppy/languages","stargazers_url":"https://api.github.com/repos/cbernet/heppy/stargazers","contributors_url":"https://api.github.com/repos/cbernet/heppy/contributors","subscribers_url":"https://api.github.com/repos/cbernet/heppy/subscribers","subscription_url":"https://api.github.com/repos/cbernet/heppy/subscription","commits_url":"https://api.github.com/repos/cbernet/heppy/commits{/sha}","git_commits_url":"https://api.github.com/repos/cbernet/heppy/git/commits{/sha}","comments_url":"https://api.github.com/repos/cbernet/heppy/comments{/number}","issue_comment_url":"https://api.github.com/repos/cbernet/heppy/issues/comments{/number}","contents_url":"https://api.github.com/repos/cbernet/heppy/contents/{+path}","compare_url":"https://api.github.com/repos/cbernet/heppy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cbernet/heppy/merges","archive_url":"https://api.github.com/repos/cbernet/heppy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cbernet/heppy/downloads","issues_url":"https://api.github.com/repos/cbernet/heppy/issues{/number}","pulls_url":"https://api.github.com/repos/cbernet/heppy/pulls{/number}","milestones_url":"https://api.github.com/repos/cbernet/heppy/milestones{/number}","notifications_url":"https://api.github.com/repos/cbernet/heppy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cbernet/heppy/labels{/name}","releases_url":"https://api.github.com/repos/cbernet/heppy/releases{/id}","deployments_url":"https://api.github.com/repos/cbernet/heppy/deployments","created_at":"2014-06-10T12:51:12Z","updated_at":"2016-02-08T14:39:46Z","pushed_at":"2016-06-27T15:54:55Z","git_url":"git://github.com/cbernet/heppy.git","ssh_url":"git@github.com:cbernet/heppy.git","clone_url":"https://github.com/cbernet/heppy.git","svn_url":"https://github.com/cbernet/heppy","homepage":"","size":557,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":16,"mirror_url":null,"open_issues_count":3,"forks":16,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cbernet/heppy/pulls/15"},"html":{"href":"https://github.com/cbernet/heppy/pull/15"},"issue":{"href":"https://api.github.com/repos/cbernet/heppy/issues/15"},"comments":{"href":"https://api.github.com/repos/cbernet/heppy/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/cbernet/heppy/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/cbernet/heppy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cbernet/heppy/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/cbernet/heppy/statuses/e23c526f463f224615af38ce5d93daa522f815d7"}}}}
{"actor":{"display_login":"lucastorterotot"}}