{"action":"created","comment":{"url":"https://api.github.com/repos/cms-sw/cmssw/pulls/comments/47622355","id":47622355,"diff_hunk":"@@ -0,0 +1,108 @@\n+// -*- C++ -*-\n+//\n+// Package:    Alignment/CommonAlignment\n+// Class:      MagneticFieldFilter\n+//\n+/**\\class MagneticFieldFilter MagneticFieldFilter.cc Alignment/CommonAlignment/plugins/MagneticFieldFilter.cc\n+\n+ Description: Plugin to filter events based on the magnetic field value\n+\n+ Implementation:\n+     Takes the magnet current from the RunInfoRcd and translates it into a\n+     magnetic field value using the parameterization given here:\n+\n+     https://hypernews.cern.ch/HyperNews/CMS/get/magnetic-field/63/1/1/1.html\n+\n+     Agrees within an accuracy of ~20 mT with results of:\n+     https://cmswbm.web.cern.ch/cmswbm/cmsdb/servlet/RunSummary\n+\n+*/\n+//\n+// Original Author:  Gregor Mittag\n+//         Created:  Wed, 25 Nov 2015 12:59:02 GMT\n+//\n+//\n+\n+\n+// user include files\n+#include \"FWCore/Framework/interface/Frameworkfwd.h\"\n+#include \"FWCore/Framework/interface/MakerMacros.h\"\n+#include \"FWCore/Framework/interface/EventSetup.h\"\n+#include \"FWCore/Framework/interface/ESHandle.h\"\n+#include \"FWCore/ParameterSet/interface/ParameterSet.h\"\n+#include \"CondFormats/RunInfo/interface/RunInfo.h\"\n+#include \"CondFormats/DataRecord/interface/RunSummaryRcd.h\"\n+\n+//\n+// class declaration\n+//\n+\n+class MagneticFieldFilter : public edm::stream::EDFilter<> {\n+public:\n+  explicit MagneticFieldFilter(const edm::ParameterSet&);\n+  ~MagneticFieldFilter() = default;\n+\n+  static void fillDescriptions(edm::ConfigurationDescriptions&);\n+\n+private:\n+  virtual bool filter(edm::Event&, const edm::EventSetup&) override;\n+  virtual void beginRun(const edm::Run&, const edm::EventSetup&) override;\n+\n+  /// convert Ampere (A) to Tesla (T)\n+  float currentToField(const float& current) const;\n+\n+  // ----------member data ---------------------------\n+  const int magneticField_;     /// magnetic field that is filtered\n+  int magneticFieldCurrentRun_; /// magnetic field estimate of the current run\n+};\n+\n+\n+//\n+// constructor\n+//\n+MagneticFieldFilter::MagneticFieldFilter(const edm::ParameterSet& iConfig) :\n+  magneticField_(iConfig.getUntrackedParameter<int>(\"magneticField\")),\n+  magneticFieldCurrentRun_(-10000) {\n+}\n+\n+\n+//\n+// member functions\n+//\n+\n+// ------------ method called on each new Event  ------------\n+bool\n+MagneticFieldFilter::filter(edm::Event&, const edm::EventSetup&) {\n+  return magneticField_ == magneticFieldCurrentRun_;\n+}\n+\n+// ------------ method called when starting to processes a run  ------------\n+\n+void\n+MagneticFieldFilter::beginRun(const edm::Run&, const edm::EventSetup& iSetup) {\n+  edm::ESHandle<RunInfo> sum;\n+  iSetup.get<RunInfoRcd>().get(sum);\n+  auto summary = sum.product();\n+  magneticFieldCurrentRun_ =    // round to kGauss\n+    static_cast<int>(currentToField(summary->m_avg_current)*10.0 + 0.5);\n+}","path":"Alignment/CommonAlignment/plugins/MagneticFieldFilter.cc","position":88,"original_position":88,"commit_id":"1e3a5c18f787430a18673806b1071e7695299521","original_commit_id":"1e3a5c18f787430a18673806b1071e7695299521","user":{"login":"ghellwig","id":4136328,"avatar_url":"https://avatars.githubusercontent.com/u/4136328?v=3","gravatar_id":"","url":"https://api.github.com/users/ghellwig","html_url":"https://github.com/ghellwig","followers_url":"https://api.github.com/users/ghellwig/followers","following_url":"https://api.github.com/users/ghellwig/following{/other_user}","gists_url":"https://api.github.com/users/ghellwig/gists{/gist_id}","starred_url":"https://api.github.com/users/ghellwig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghellwig/subscriptions","organizations_url":"https://api.github.com/users/ghellwig/orgs","repos_url":"https://api.github.com/users/ghellwig/repos","events_url":"https://api.github.com/users/ghellwig/events{/privacy}","received_events_url":"https://api.github.com/users/ghellwig/received_events","type":"User","site_admin":false},"body":"Sorry, if I am insisting so much here, but if I add a reference to code, this might be dangling at some point, right?\r\n\r\nI mean, the only thing, I am doing here is to convert from Tesla to kGauss (as is stated in the comment, except for the input unit). It is from my point of view no magic number.","created_at":"2015-12-15T10:58:45Z","updated_at":"2015-12-15T10:58:45Z","html_url":"https://github.com/cms-sw/cmssw/pull/12776#discussion_r47622355","pull_request_url":"https://api.github.com/repos/cms-sw/cmssw/pulls/12776","_links":{"self":{"href":"https://api.github.com/repos/cms-sw/cmssw/pulls/comments/47622355"},"html":{"href":"https://github.com/cms-sw/cmssw/pull/12776#discussion_r47622355"},"pull_request":{"href":"https://api.github.com/repos/cms-sw/cmssw/pulls/12776"}}},"pull_request":{"url":"https://api.github.com/repos/cms-sw/cmssw/pulls/12776","id":53565689,"html_url":"https://github.com/cms-sw/cmssw/pull/12776","diff_url":"https://github.com/cms-sw/cmssw/pull/12776.diff","patch_url":"https://github.com/cms-sw/cmssw/pull/12776.patch","issue_url":"https://api.github.com/repos/cms-sw/cmssw/issues/12776","number":12776,"state":"open","locked":false,"title":"Alignment filters 80X","user":{"login":"ghellwig","id":4136328,"avatar_url":"https://avatars.githubusercontent.com/u/4136328?v=3","gravatar_id":"","url":"https://api.github.com/users/ghellwig","html_url":"https://github.com/ghellwig","followers_url":"https://api.github.com/users/ghellwig/followers","following_url":"https://api.github.com/users/ghellwig/following{/other_user}","gists_url":"https://api.github.com/users/ghellwig/gists{/gist_id}","starred_url":"https://api.github.com/users/ghellwig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghellwig/subscriptions","organizations_url":"https://api.github.com/users/ghellwig/orgs","repos_url":"https://api.github.com/users/ghellwig/repos","events_url":"https://api.github.com/users/ghellwig/events{/privacy}","received_events_url":"https://api.github.com/users/ghellwig/received_events","type":"User","site_admin":false},"body":"Tools to streamline the alignment work-flow and the corresponding validation.\r\nThese tools have been presented in\r\nhttps://indico.cern.ch/event/442133/session/0/contribution/4/attachments/1203128/1751921/talk.pdf","created_at":"2015-12-14T13:41:58Z","updated_at":"2015-12-15T10:58:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b5c3e7fa68aac815d3bd8387818b65da6f5c20eb","assignee":null,"milestone":{"url":"https://api.github.com/repos/cms-sw/cmssw/milestones/57","html_url":"https://github.com/cms-sw/cmssw/milestones/Next%20CMSSW_8_0_X","labels_url":"https://api.github.com/repos/cms-sw/cmssw/milestones/57/labels","id":1362157,"number":57,"title":"Next CMSSW_8_0_X","description":"","creator":{"login":"smuzaffar","id":4115138,"avatar_url":"https://avatars.githubusercontent.com/u/4115138?v=3","gravatar_id":"","url":"https://api.github.com/users/smuzaffar","html_url":"https://github.com/smuzaffar","followers_url":"https://api.github.com/users/smuzaffar/followers","following_url":"https://api.github.com/users/smuzaffar/following{/other_user}","gists_url":"https://api.github.com/users/smuzaffar/gists{/gist_id}","starred_url":"https://api.github.com/users/smuzaffar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smuzaffar/subscriptions","organizations_url":"https://api.github.com/users/smuzaffar/orgs","repos_url":"https://api.github.com/users/smuzaffar/repos","events_url":"https://api.github.com/users/smuzaffar/events{/privacy}","received_events_url":"https://api.github.com/users/smuzaffar/received_events","type":"User","site_admin":false},"open_issues":58,"closed_issues":367,"state":"open","created_at":"2015-10-18T08:35:44Z","updated_at":"2015-12-15T10:26:39Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/cms-sw/cmssw/pulls/12776/commits","review_comments_url":"https://api.github.com/repos/cms-sw/cmssw/pulls/12776/comments","review_comment_url":"https://api.github.com/repos/cms-sw/cmssw/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cms-sw/cmssw/issues/12776/comments","statuses_url":"https://api.github.com/repos/cms-sw/cmssw/statuses/1e3a5c18f787430a18673806b1071e7695299521","head":{"label":"ghellwig:alignment-filters_80X","ref":"alignment-filters_80X","sha":"1e3a5c18f787430a18673806b1071e7695299521","user":{"login":"ghellwig","id":4136328,"avatar_url":"https://avatars.githubusercontent.com/u/4136328?v=3","gravatar_id":"","url":"https://api.github.com/users/ghellwig","html_url":"https://github.com/ghellwig","followers_url":"https://api.github.com/users/ghellwig/followers","following_url":"https://api.github.com/users/ghellwig/following{/other_user}","gists_url":"https://api.github.com/users/ghellwig/gists{/gist_id}","starred_url":"https://api.github.com/users/ghellwig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghellwig/subscriptions","organizations_url":"https://api.github.com/users/ghellwig/orgs","repos_url":"https://api.github.com/users/ghellwig/repos","events_url":"https://api.github.com/users/ghellwig/events{/privacy}","received_events_url":"https://api.github.com/users/ghellwig/received_events","type":"User","site_admin":false},"repo":{"id":11170104,"name":"cmssw","full_name":"ghellwig/cmssw","owner":{"login":"ghellwig","id":4136328,"avatar_url":"https://avatars.githubusercontent.com/u/4136328?v=3","gravatar_id":"","url":"https://api.github.com/users/ghellwig","html_url":"https://github.com/ghellwig","followers_url":"https://api.github.com/users/ghellwig/followers","following_url":"https://api.github.com/users/ghellwig/following{/other_user}","gists_url":"https://api.github.com/users/ghellwig/gists{/gist_id}","starred_url":"https://api.github.com/users/ghellwig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghellwig/subscriptions","organizations_url":"https://api.github.com/users/ghellwig/orgs","repos_url":"https://api.github.com/users/ghellwig/repos","events_url":"https://api.github.com/users/ghellwig/events{/privacy}","received_events_url":"https://api.github.com/users/ghellwig/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ghellwig/cmssw","description":"CMS Offline Software","fork":true,"url":"https://api.github.com/repos/ghellwig/cmssw","forks_url":"https://api.github.com/repos/ghellwig/cmssw/forks","keys_url":"https://api.github.com/repos/ghellwig/cmssw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ghellwig/cmssw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ghellwig/cmssw/teams","hooks_url":"https://api.github.com/repos/ghellwig/cmssw/hooks","issue_events_url":"https://api.github.com/repos/ghellwig/cmssw/issues/events{/number}","events_url":"https://api.github.com/repos/ghellwig/cmssw/events","assignees_url":"https://api.github.com/repos/ghellwig/cmssw/assignees{/user}","branches_url":"https://api.github.com/repos/ghellwig/cmssw/branches{/branch}","tags_url":"https://api.github.com/repos/ghellwig/cmssw/tags","blobs_url":"https://api.github.com/repos/ghellwig/cmssw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ghellwig/cmssw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ghellwig/cmssw/git/refs{/sha}","trees_url":"https://api.github.com/repos/ghellwig/cmssw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ghellwig/cmssw/statuses/{sha}","languages_url":"https://api.github.com/repos/ghellwig/cmssw/languages","stargazers_url":"https://api.github.com/repos/ghellwig/cmssw/stargazers","contributors_url":"https://api.github.com/repos/ghellwig/cmssw/contributors","subscribers_url":"https://api.github.com/repos/ghellwig/cmssw/subscribers","subscription_url":"https://api.github.com/repos/ghellwig/cmssw/subscription","commits_url":"https://api.github.com/repos/ghellwig/cmssw/commits{/sha}","git_commits_url":"https://api.github.com/repos/ghellwig/cmssw/git/commits{/sha}","comments_url":"https://api.github.com/repos/ghellwig/cmssw/comments{/number}","issue_comment_url":"https://api.github.com/repos/ghellwig/cmssw/issues/comments{/number}","contents_url":"https://api.github.com/repos/ghellwig/cmssw/contents/{+path}","compare_url":"https://api.github.com/repos/ghellwig/cmssw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ghellwig/cmssw/merges","archive_url":"https://api.github.com/repos/ghellwig/cmssw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ghellwig/cmssw/downloads","issues_url":"https://api.github.com/repos/ghellwig/cmssw/issues{/number}","pulls_url":"https://api.github.com/repos/ghellwig/cmssw/pulls{/number}","milestones_url":"https://api.github.com/repos/ghellwig/cmssw/milestones{/number}","notifications_url":"https://api.github.com/repos/ghellwig/cmssw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ghellwig/cmssw/labels{/name}","releases_url":"https://api.github.com/repos/ghellwig/cmssw/releases{/id}","created_at":"2013-07-04T07:45:31Z","updated_at":"2014-05-06T16:19:27Z","pushed_at":"2015-12-15T10:24:19Z","git_url":"git://github.com/ghellwig/cmssw.git","ssh_url":"git@github.com:ghellwig/cmssw.git","clone_url":"https://github.com/ghellwig/cmssw.git","svn_url":"https://github.com/ghellwig/cmssw","homepage":"cms-sw.github.io/cmssw","size":806294,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"CMSSW_7_0_X"}},"base":{"label":"cms-sw:CMSSW_8_0_X","ref":"CMSSW_8_0_X","sha":"b6c018755b2e3373939c2729721ca7a2a67a5019","user":{"login":"cms-sw","id":3863500,"avatar_url":"https://avatars.githubusercontent.com/u/3863500?v=3","gravatar_id":"","url":"https://api.github.com/users/cms-sw","html_url":"https://github.com/cms-sw","followers_url":"https://api.github.com/users/cms-sw/followers","following_url":"https://api.github.com/users/cms-sw/following{/other_user}","gists_url":"https://api.github.com/users/cms-sw/gists{/gist_id}","starred_url":"https://api.github.com/users/cms-sw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cms-sw/subscriptions","organizations_url":"https://api.github.com/users/cms-sw/orgs","repos_url":"https://api.github.com/users/cms-sw/repos","events_url":"https://api.github.com/users/cms-sw/events{/privacy}","received_events_url":"https://api.github.com/users/cms-sw/received_events","type":"Organization","site_admin":false},"repo":{"id":10969551,"name":"cmssw","full_name":"cms-sw/cmssw","owner":{"login":"cms-sw","id":3863500,"avatar_url":"https://avatars.githubusercontent.com/u/3863500?v=3","gravatar_id":"","url":"https://api.github.com/users/cms-sw","html_url":"https://github.com/cms-sw","followers_url":"https://api.github.com/users/cms-sw/followers","following_url":"https://api.github.com/users/cms-sw/following{/other_user}","gists_url":"https://api.github.com/users/cms-sw/gists{/gist_id}","starred_url":"https://api.github.com/users/cms-sw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cms-sw/subscriptions","organizations_url":"https://api.github.com/users/cms-sw/orgs","repos_url":"https://api.github.com/users/cms-sw/repos","events_url":"https://api.github.com/users/cms-sw/events{/privacy}","received_events_url":"https://api.github.com/users/cms-sw/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cms-sw/cmssw","description":"CMS Offline Software","fork":false,"url":"https://api.github.com/repos/cms-sw/cmssw","forks_url":"https://api.github.com/repos/cms-sw/cmssw/forks","keys_url":"https://api.github.com/repos/cms-sw/cmssw/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cms-sw/cmssw/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cms-sw/cmssw/teams","hooks_url":"https://api.github.com/repos/cms-sw/cmssw/hooks","issue_events_url":"https://api.github.com/repos/cms-sw/cmssw/issues/events{/number}","events_url":"https://api.github.com/repos/cms-sw/cmssw/events","assignees_url":"https://api.github.com/repos/cms-sw/cmssw/assignees{/user}","branches_url":"https://api.github.com/repos/cms-sw/cmssw/branches{/branch}","tags_url":"https://api.github.com/repos/cms-sw/cmssw/tags","blobs_url":"https://api.github.com/repos/cms-sw/cmssw/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cms-sw/cmssw/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cms-sw/cmssw/git/refs{/sha}","trees_url":"https://api.github.com/repos/cms-sw/cmssw/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cms-sw/cmssw/statuses/{sha}","languages_url":"https://api.github.com/repos/cms-sw/cmssw/languages","stargazers_url":"https://api.github.com/repos/cms-sw/cmssw/stargazers","contributors_url":"https://api.github.com/repos/cms-sw/cmssw/contributors","subscribers_url":"https://api.github.com/repos/cms-sw/cmssw/subscribers","subscription_url":"https://api.github.com/repos/cms-sw/cmssw/subscription","commits_url":"https://api.github.com/repos/cms-sw/cmssw/commits{/sha}","git_commits_url":"https://api.github.com/repos/cms-sw/cmssw/git/commits{/sha}","comments_url":"https://api.github.com/repos/cms-sw/cmssw/comments{/number}","issue_comment_url":"https://api.github.com/repos/cms-sw/cmssw/issues/comments{/number}","contents_url":"https://api.github.com/repos/cms-sw/cmssw/contents/{+path}","compare_url":"https://api.github.com/repos/cms-sw/cmssw/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cms-sw/cmssw/merges","archive_url":"https://api.github.com/repos/cms-sw/cmssw/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cms-sw/cmssw/downloads","issues_url":"https://api.github.com/repos/cms-sw/cmssw/issues{/number}","pulls_url":"https://api.github.com/repos/cms-sw/cmssw/pulls{/number}","milestones_url":"https://api.github.com/repos/cms-sw/cmssw/milestones{/number}","notifications_url":"https://api.github.com/repos/cms-sw/cmssw/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cms-sw/cmssw/labels{/name}","releases_url":"https://api.github.com/repos/cms-sw/cmssw/releases{/id}","created_at":"2013-06-26T14:09:07Z","updated_at":"2015-12-15T09:43:04Z","pushed_at":"2015-12-15T10:32:12Z","git_url":"git://github.com/cms-sw/cmssw.git","ssh_url":"git@github.com:cms-sw/cmssw.git","clone_url":"https://github.com/cms-sw/cmssw.git","svn_url":"https://github.com/cms-sw/cmssw","homepage":"http://cms-sw.github.io/","size":991703,"stargazers_count":288,"watchers_count":288,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1656,"mirror_url":null,"open_issues_count":310,"forks":1656,"open_issues":310,"watchers":288,"default_branch":"CMSSW_8_0_X"}},"_links":{"self":{"href":"https://api.github.com/repos/cms-sw/cmssw/pulls/12776"},"html":{"href":"https://github.com/cms-sw/cmssw/pull/12776"},"issue":{"href":"https://api.github.com/repos/cms-sw/cmssw/issues/12776"},"comments":{"href":"https://api.github.com/repos/cms-sw/cmssw/issues/12776/comments"},"review_comments":{"href":"https://api.github.com/repos/cms-sw/cmssw/pulls/12776/comments"},"review_comment":{"href":"https://api.github.com/repos/cms-sw/cmssw/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cms-sw/cmssw/pulls/12776/commits"},"statuses":{"href":"https://api.github.com/repos/cms-sw/cmssw/statuses/1e3a5c18f787430a18673806b1071e7695299521"}}}}