{"action":"created","comment":{"url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls/comments/30389005","id":30389005,"diff_hunk":"@@ -0,0 +1,318 @@\n+#include \"pwaNloptFit.h\"\n+\n+#include <complex>\n+\n+#include \"TROOT.h\"\n+#include \"TTree.h\"\n+#include \"TFile.h\"\n+#include \"TString.h\"\n+#include \"TComplex.h\"\n+#include \"TRandom3.h\"\n+#include \"TVectorT.h\"\n+#include <boost/progress.hpp>\n+#include \"Math/Minimizer.h\"\n+#include \"Math/Factory.h\"\n+#include \"TFile.h\"\n+#include \"TTree.h\"\n+#include \"TRandom3.h\"\n+#include \"TStopwatch.h\"\n+#include \"Minuit2/Minuit2Minimizer.h\"\n+\n+#include <nlopt.hpp>\n+\n+#include \"reportingUtilsEnvironment.h\"\n+#include \"conversionUtils.hpp\"\n+#include \"pwaLikelihood.h\"\n+\n+#include <reportingUtils.hpp>\n+\n+using namespace std;\n+using namespace ROOT::Math;\n+using namespace rpwa;\n+\n+const std::string valTreeName   = \"pwa\";\n+const std::string valBranchName = \"fitResult_v2\";\n+\n+double rpwaNloptFunc(unsigned n, const double* x, double* gradient, void* func_data)\n+{\n+\tpwaLikelihood<complex<double> >* L = (pwaLikelihood<complex<double> >*)func_data;\n+\tif(n != L->nmbPars()) {\n+\t\tprintErr << \"parameter mismatch between NLopt and pwaLikelihood. Aborting...\" << endl;\n+\t\tthrow;\n+\t}\n+\tdouble likeli;\n+\tif(gradient) {\n+\t\tL->FdF(x, likeli, gradient);\n+\t} else {\n+\t\tlikeli = L->DoEval(x);\n+\t}\n+\treturn likeli;\n+}\n+\n+rpwa::fitResultPtr\n+rpwa::hli::pwaNloptFit(std::map<std::string, TTree*>&  ampTrees,\n+                       const rpwa::ampIntegralMatrix&  normMatrix,\n+                       rpwa::ampIntegralMatrix&        accMatrix,\n+                       const std::vector<std::string>& waveNames,\n+                       const std::vector<double>&      waveThresholds,\n+                       const double                    massBinMin=0,\n+                       const double                    massBinMax=0,\n+                       const unsigned int              seed=0,\n+                       const bool                      cauchy=false,\n+                       const std::string               startValFileName=\"\",\n+                       const unsigned int              accEventsOverride=0,\n+                       const unsigned int              rank=1,\n+                       const bool                      checkHessian=false,\n+                       const bool                      saveSpace=false,\n+                       const bool                      verbose=false)\n+{\n+\n+#if ROOT_VERSION_CODE < ROOT_VERSION(6, 0, 0)\n+\t// force loading predefined std::complex dictionary\n+\t// see http://root.cern.ch/phpBB3/viewtopic.php?f=5&t=9618&p=50164\n+\tgROOT->ProcessLine(\"#include <complex>\");\n+#endif\n+\n+\t// ---------------------------------------------------------------------------\n+\t// internal parameters\n+\tconst string       valTreeName           = \"pwa\";\n+\tconst string       valBranchName         = \"fitResult_v2\";\n+\tdouble             defaultStartValue     = 0.01;\n+\tbool               useFixedStartValues   = false;\n+\tconst unsigned int maxNmbOfIterations    = 50000;\n+\tconst double             minimizerTolerance    = 1e-4;                   // minimizer tolerance\n+\tconst double             likelihoodTolerance   = 1e-6;                   // tolerance of likelihood function\n+#if ROOT_VERSION_CODE >= ROOT_VERSION(5, 34, 19)\n+//\tbool         saveMinimizerMemory      = true;\n+#endif\n+//\tbool         cudaEnabled              = false;                  // if true CUDA kernels are activated\n+\tbool         quiet               = not verbose;\n+\n+\t// report parameters\n+\tprintInfo << \"running pwaNloptFit with the following parameters:\" << endl;\n+\tcout << \"    mass bin [\" <<  massBinMin << \", \" <<  massBinMax << \"] MeV/c^2\" << endl\n+\t     << \"    path to file with start values ................. '\" << startValFileName << \"'\" << endl\n+\t     << \"    seed for random start values ................... \"  << seed            << endl;\n+\tif (useFixedStartValues)\n+\t\tcout << \"    using fixed instead of random start values ..... \" << defaultStartValue << endl;\n+\tcout << \"    rank of spin density matrix .................... \"  << rank                    << endl\n+\t\t     << \"    minimizer tolerance ............................ \"  << minimizerTolerance << endl\n+\t\t     << \"    likelihood tolerance ........................... \"  << likelihoodTolerance << endl","path":"highLevelInterface/pwaNloptFit.cc","position":100,"original_position":100,"commit_id":"0c1cdeb197f5b7f2a9babef914130dabb8992e72","original_commit_id":"0c1cdeb197f5b7f2a9babef914130dabb8992e72","user":{"login":"suhlatwork","id":7747454,"avatar_url":"https://avatars.githubusercontent.com/u/7747454?v=3","gravatar_id":"","url":"https://api.github.com/users/suhlatwork","html_url":"https://github.com/suhlatwork","followers_url":"https://api.github.com/users/suhlatwork/followers","following_url":"https://api.github.com/users/suhlatwork/following{/other_user}","gists_url":"https://api.github.com/users/suhlatwork/gists{/gist_id}","starred_url":"https://api.github.com/users/suhlatwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/suhlatwork/subscriptions","organizations_url":"https://api.github.com/users/suhlatwork/orgs","repos_url":"https://api.github.com/users/suhlatwork/repos","events_url":"https://api.github.com/users/suhlatwork/events{/privacy}","received_events_url":"https://api.github.com/users/suhlatwork/received_events","type":"User","site_admin":false},"body":"indentation errors lines 99-100","created_at":"2015-05-15T07:06:40Z","updated_at":"2015-05-15T07:06:40Z","html_url":"https://github.com/ROOTPWA-Maintainers/ROOTPWA/pull/86#discussion_r30389005","pull_request_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls/86","_links":{"self":{"href":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls/comments/30389005"},"html":{"href":"https://github.com/ROOTPWA-Maintainers/ROOTPWA/pull/86#discussion_r30389005"},"pull_request":{"href":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls/86"}}},"pull_request":{"url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls/86","id":35108912,"html_url":"https://github.com/ROOTPWA-Maintainers/ROOTPWA/pull/86","diff_url":"https://github.com/ROOTPWA-Maintainers/ROOTPWA/pull/86.diff","patch_url":"https://github.com/ROOTPWA-Maintainers/ROOTPWA/pull/86.patch","issue_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/issues/86","number":86,"state":"open","locked":false,"title":"Usr iface","user":{"login":"odrotleff","id":8873851,"avatar_url":"https://avatars.githubusercontent.com/u/8873851?v=3","gravatar_id":"","url":"https://api.github.com/users/odrotleff","html_url":"https://github.com/odrotleff","followers_url":"https://api.github.com/users/odrotleff/followers","following_url":"https://api.github.com/users/odrotleff/following{/other_user}","gists_url":"https://api.github.com/users/odrotleff/gists{/gist_id}","starred_url":"https://api.github.com/users/odrotleff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odrotleff/subscriptions","organizations_url":"https://api.github.com/users/odrotleff/orgs","repos_url":"https://api.github.com/users/odrotleff/repos","events_url":"https://api.github.com/users/odrotleff/events{/privacy}","received_events_url":"https://api.github.com/users/odrotleff/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-11T09:03:19Z","updated_at":"2015-05-15T07:06:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f287c0ab11ad0c0d5e1d0039f7d96ed8bb37a9e3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls/86/commits","review_comments_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls/86/comments","review_comment_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/issues/86/comments","statuses_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/statuses/0c1cdeb197f5b7f2a9babef914130dabb8992e72","head":{"label":"odrotleff:usrIface","ref":"usrIface","sha":"0c1cdeb197f5b7f2a9babef914130dabb8992e72","user":{"login":"odrotleff","id":8873851,"avatar_url":"https://avatars.githubusercontent.com/u/8873851?v=3","gravatar_id":"","url":"https://api.github.com/users/odrotleff","html_url":"https://github.com/odrotleff","followers_url":"https://api.github.com/users/odrotleff/followers","following_url":"https://api.github.com/users/odrotleff/following{/other_user}","gists_url":"https://api.github.com/users/odrotleff/gists{/gist_id}","starred_url":"https://api.github.com/users/odrotleff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odrotleff/subscriptions","organizations_url":"https://api.github.com/users/odrotleff/orgs","repos_url":"https://api.github.com/users/odrotleff/repos","events_url":"https://api.github.com/users/odrotleff/events{/privacy}","received_events_url":"https://api.github.com/users/odrotleff/received_events","type":"User","site_admin":false},"repo":{"id":24365112,"name":"ROOTPWA","full_name":"odrotleff/ROOTPWA","owner":{"login":"odrotleff","id":8873851,"avatar_url":"https://avatars.githubusercontent.com/u/8873851?v=3","gravatar_id":"","url":"https://api.github.com/users/odrotleff","html_url":"https://github.com/odrotleff","followers_url":"https://api.github.com/users/odrotleff/followers","following_url":"https://api.github.com/users/odrotleff/following{/other_user}","gists_url":"https://api.github.com/users/odrotleff/gists{/gist_id}","starred_url":"https://api.github.com/users/odrotleff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odrotleff/subscriptions","organizations_url":"https://api.github.com/users/odrotleff/orgs","repos_url":"https://api.github.com/users/odrotleff/repos","events_url":"https://api.github.com/users/odrotleff/events{/privacy}","received_events_url":"https://api.github.com/users/odrotleff/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/odrotleff/ROOTPWA","description":"ROOTPWA is a toolkit for partial-wave analysis of multi-particle final states produced in high-energy particle reactions. It is used to determine hadron spectra from experimental data.","fork":true,"url":"https://api.github.com/repos/odrotleff/ROOTPWA","forks_url":"https://api.github.com/repos/odrotleff/ROOTPWA/forks","keys_url":"https://api.github.com/repos/odrotleff/ROOTPWA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odrotleff/ROOTPWA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odrotleff/ROOTPWA/teams","hooks_url":"https://api.github.com/repos/odrotleff/ROOTPWA/hooks","issue_events_url":"https://api.github.com/repos/odrotleff/ROOTPWA/issues/events{/number}","events_url":"https://api.github.com/repos/odrotleff/ROOTPWA/events","assignees_url":"https://api.github.com/repos/odrotleff/ROOTPWA/assignees{/user}","branches_url":"https://api.github.com/repos/odrotleff/ROOTPWA/branches{/branch}","tags_url":"https://api.github.com/repos/odrotleff/ROOTPWA/tags","blobs_url":"https://api.github.com/repos/odrotleff/ROOTPWA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odrotleff/ROOTPWA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odrotleff/ROOTPWA/git/refs{/sha}","trees_url":"https://api.github.com/repos/odrotleff/ROOTPWA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odrotleff/ROOTPWA/statuses/{sha}","languages_url":"https://api.github.com/repos/odrotleff/ROOTPWA/languages","stargazers_url":"https://api.github.com/repos/odrotleff/ROOTPWA/stargazers","contributors_url":"https://api.github.com/repos/odrotleff/ROOTPWA/contributors","subscribers_url":"https://api.github.com/repos/odrotleff/ROOTPWA/subscribers","subscription_url":"https://api.github.com/repos/odrotleff/ROOTPWA/subscription","commits_url":"https://api.github.com/repos/odrotleff/ROOTPWA/commits{/sha}","git_commits_url":"https://api.github.com/repos/odrotleff/ROOTPWA/git/commits{/sha}","comments_url":"https://api.github.com/repos/odrotleff/ROOTPWA/comments{/number}","issue_comment_url":"https://api.github.com/repos/odrotleff/ROOTPWA/issues/comments{/number}","contents_url":"https://api.github.com/repos/odrotleff/ROOTPWA/contents/{+path}","compare_url":"https://api.github.com/repos/odrotleff/ROOTPWA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odrotleff/ROOTPWA/merges","archive_url":"https://api.github.com/repos/odrotleff/ROOTPWA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odrotleff/ROOTPWA/downloads","issues_url":"https://api.github.com/repos/odrotleff/ROOTPWA/issues{/number}","pulls_url":"https://api.github.com/repos/odrotleff/ROOTPWA/pulls{/number}","milestones_url":"https://api.github.com/repos/odrotleff/ROOTPWA/milestones{/number}","notifications_url":"https://api.github.com/repos/odrotleff/ROOTPWA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odrotleff/ROOTPWA/labels{/name}","releases_url":"https://api.github.com/repos/odrotleff/ROOTPWA/releases{/id}","created_at":"2014-09-23T09:29:47Z","updated_at":"2014-09-10T08:21:00Z","pushed_at":"2015-05-13T09:46:50Z","git_url":"git://github.com/odrotleff/ROOTPWA.git","ssh_url":"git@github.com:odrotleff/ROOTPWA.git","clone_url":"https://github.com/odrotleff/ROOTPWA.git","svn_url":"https://github.com/odrotleff/ROOTPWA","homepage":"","size":29177,"stargazers_count":0,"watchers_count":0,"language":null,"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":"ROOTPWA-Maintainers:master","ref":"master","sha":"c4a515f73c03b9e0be1e458b2ee83fb14185765b","user":{"login":"ROOTPWA-Maintainers","id":8570007,"avatar_url":"https://avatars.githubusercontent.com/u/8570007?v=3","gravatar_id":"","url":"https://api.github.com/users/ROOTPWA-Maintainers","html_url":"https://github.com/ROOTPWA-Maintainers","followers_url":"https://api.github.com/users/ROOTPWA-Maintainers/followers","following_url":"https://api.github.com/users/ROOTPWA-Maintainers/following{/other_user}","gists_url":"https://api.github.com/users/ROOTPWA-Maintainers/gists{/gist_id}","starred_url":"https://api.github.com/users/ROOTPWA-Maintainers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ROOTPWA-Maintainers/subscriptions","organizations_url":"https://api.github.com/users/ROOTPWA-Maintainers/orgs","repos_url":"https://api.github.com/users/ROOTPWA-Maintainers/repos","events_url":"https://api.github.com/users/ROOTPWA-Maintainers/events{/privacy}","received_events_url":"https://api.github.com/users/ROOTPWA-Maintainers/received_events","type":"Organization","site_admin":false},"repo":{"id":23422237,"name":"ROOTPWA","full_name":"ROOTPWA-Maintainers/ROOTPWA","owner":{"login":"ROOTPWA-Maintainers","id":8570007,"avatar_url":"https://avatars.githubusercontent.com/u/8570007?v=3","gravatar_id":"","url":"https://api.github.com/users/ROOTPWA-Maintainers","html_url":"https://github.com/ROOTPWA-Maintainers","followers_url":"https://api.github.com/users/ROOTPWA-Maintainers/followers","following_url":"https://api.github.com/users/ROOTPWA-Maintainers/following{/other_user}","gists_url":"https://api.github.com/users/ROOTPWA-Maintainers/gists{/gist_id}","starred_url":"https://api.github.com/users/ROOTPWA-Maintainers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ROOTPWA-Maintainers/subscriptions","organizations_url":"https://api.github.com/users/ROOTPWA-Maintainers/orgs","repos_url":"https://api.github.com/users/ROOTPWA-Maintainers/repos","events_url":"https://api.github.com/users/ROOTPWA-Maintainers/events{/privacy}","received_events_url":"https://api.github.com/users/ROOTPWA-Maintainers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ROOTPWA-Maintainers/ROOTPWA","description":"ROOTPWA is a toolkit for partial-wave analysis of multi-particle final states produced in high-energy particle reactions. It is used to determine hadron spectra from experimental data.","fork":false,"url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA","forks_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/forks","keys_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/teams","hooks_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/hooks","issue_events_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/issues/events{/number}","events_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/events","assignees_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/assignees{/user}","branches_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/branches{/branch}","tags_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/tags","blobs_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/git/refs{/sha}","trees_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/statuses/{sha}","languages_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/languages","stargazers_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/stargazers","contributors_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/contributors","subscribers_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/subscribers","subscription_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/subscription","commits_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/commits{/sha}","git_commits_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/git/commits{/sha}","comments_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/comments{/number}","issue_comment_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/issues/comments{/number}","contents_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/contents/{+path}","compare_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/merges","archive_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/downloads","issues_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/issues{/number}","pulls_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls{/number}","milestones_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/milestones{/number}","notifications_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/labels{/name}","releases_url":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/releases{/id}","created_at":"2014-08-28T09:19:07Z","updated_at":"2015-05-05T09:28:00Z","pushed_at":"2015-05-13T09:46:51Z","git_url":"git://github.com/ROOTPWA-Maintainers/ROOTPWA.git","ssh_url":"git@github.com:ROOTPWA-Maintainers/ROOTPWA.git","clone_url":"https://github.com/ROOTPWA-Maintainers/ROOTPWA.git","svn_url":"https://github.com/ROOTPWA-Maintainers/ROOTPWA","homepage":"","size":30359,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":21,"forks":8,"open_issues":21,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls/86"},"html":{"href":"https://github.com/ROOTPWA-Maintainers/ROOTPWA/pull/86"},"issue":{"href":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/issues/86"},"comments":{"href":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/issues/86/comments"},"review_comments":{"href":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls/86/comments"},"review_comment":{"href":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/pulls/86/commits"},"statuses":{"href":"https://api.github.com/repos/ROOTPWA-Maintainers/ROOTPWA/statuses/0c1cdeb197f5b7f2a9babef914130dabb8992e72"}}}}