{"action":"created","issue":{"url":"https://api.github.com/repos/cms-sw/cmssw/issues/16716","repository_url":"https://api.github.com/repos/cms-sw/cmssw","labels_url":"https://api.github.com/repos/cms-sw/cmssw/issues/16716/labels{/name}","comments_url":"https://api.github.com/repos/cms-sw/cmssw/issues/16716/comments","events_url":"https://api.github.com/repos/cms-sw/cmssw/issues/16716/events","html_url":"https://github.com/cms-sw/cmssw/issues/16716","id":190799263,"number":16716,"title":"reco::FormulaEvaluator does not give the same value that a TF1","user":{"login":"blinkseb","id":386274,"avatar_url":"https://avatars.githubusercontent.com/u/386274?v=3","gravatar_id":"","url":"https://api.github.com/users/blinkseb","html_url":"https://github.com/blinkseb","followers_url":"https://api.github.com/users/blinkseb/followers","following_url":"https://api.github.com/users/blinkseb/following{/other_user}","gists_url":"https://api.github.com/users/blinkseb/gists{/gist_id}","starred_url":"https://api.github.com/users/blinkseb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blinkseb/subscriptions","organizations_url":"https://api.github.com/users/blinkseb/orgs","repos_url":"https://api.github.com/users/blinkseb/repos","events_url":"https://api.github.com/users/blinkseb/events{/privacy}","received_events_url":"https://api.github.com/users/blinkseb/received_events","type":"User","site_admin":false},"labels":[{"id":52822606,"url":"https://api.github.com/repos/cms-sw/cmssw/labels/core-pending","name":"core-pending","color":"fbca04","default":false},{"id":53167770,"url":"https://api.github.com/repos/cms-sw/cmssw/labels/pending-signatures","name":"pending-signatures","color":"eb6420","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2016-11-21T18:30:25Z","updated_at":"2016-11-23T17:08:36Z","closed_at":null,"body":"Dear expert,\r\n\r\nSome users noticed some strange features with JEC L2L3Residuals (see [here](https://hypernews.cern.ch/HyperNews/CMS/get/jes/633.html)). After careful inspection, I found that the cause is that the `reco::FormulaEvaluator` instance used to evaluate the formula does not give the correct value. I attach a small ROOT macro reproducing the issue, which need to be executed inside a CMSSW environment:\r\n\r\n```\r\n#include <TF1.h>\r\n#include <CommonTools/Utils/interface/FormulaEvaluator.h>\r\n\r\nR__LOAD_LIBRARY(libCommonToolsUtils)\r\n\r\nvoid jec_issue() {\r\n\r\n    const char* formula = \"[2]*([3]*([4]+[5]*TMath::Log(max([0],min([1],x))))*1./([6]+[7]*100./3.*(TMath::Max(0.,1.03091-0.051154*pow(x,-0.154227))-TMath::Max(0.,1.03091-0.051154*TMath::Power(208.,-0.154227)))+[8]*((1+0.04432-1.304*pow(max(30.,min(6500.,x)),-0.4624)+(0+1.724*TMath::Log(max(30.,min(6500.,x))))/max(30.,min(6500.,x)))-(1+0.04432-1.304*pow(208.,-0.4624)+(0+1.724*TMath::Log(208.))/208.))))\";\r\n\r\n    TF1 f(\"f\", formula, 10, 6500);\r\n    reco::FormulaEvaluator cmssw_f(formula);\r\n\r\n    double params[] = {\r\n        55, 2510, 0.997756, 1.000155, 0.979016, 0.001834, 0.982, -0.048, 1.250\r\n    };\r\n\r\n    double x[] = {100};\r\n\r\n    std::cout << \"ROOT TF1: \" << f.EvalPar(x, params) << std::endl;\r\n    std::cout << \"CMSSW formula: \" << cmssw_f.evaluate(reco::formula::ArrayAdaptor(x, 1), reco::formula::ArrayAdaptor(params, 9)) << std::endl;\r\n}\r\n```\r\n\r\nOutput:\r\n```\r\nROOT TF1: 1.01112\r\nCMSSW formula: 0.921678\r\n```\r\n\r\nThe formula is extracted from one of the text files used for JECs.\r\n\r\nCan an expert look at this issue? I want to stress that this is major issue since there's no way currently to retrieve a correct JEC factor from the software.\r\n\r\nThanks a lot!"},"comment":{"url":"https://api.github.com/repos/cms-sw/cmssw/issues/comments/262574890","html_url":"https://github.com/cms-sw/cmssw/issues/16716#issuecomment-262574890","issue_url":"https://api.github.com/repos/cms-sw/cmssw/issues/16716","id":262574890,"user":{"login":"schoef","id":5529504,"avatar_url":"https://avatars.githubusercontent.com/u/5529504?v=3","gravatar_id":"","url":"https://api.github.com/users/schoef","html_url":"https://github.com/schoef","followers_url":"https://api.github.com/users/schoef/followers","following_url":"https://api.github.com/users/schoef/following{/other_user}","gists_url":"https://api.github.com/users/schoef/gists{/gist_id}","starred_url":"https://api.github.com/users/schoef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schoef/subscriptions","organizations_url":"https://api.github.com/users/schoef/orgs","repos_url":"https://api.github.com/users/schoef/repos","events_url":"https://api.github.com/users/schoef/events{/privacy}","received_events_url":"https://api.github.com/users/schoef/received_events","type":"User","site_admin":false},"created_at":"2016-11-23T17:08:36Z","updated_at":"2016-11-23T17:08:36Z","body":"@Dr15Jones On behalf of JME: thank you very much for the quick follow up, it's very much appreciated."}}
{"actor":{"display_login":"schoef"}}