CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/PhysicsTools/Utilities/interface/rootTf1.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_Utilities_rootTf1_h
00002 #define PhysicsTools_Utilities_rootTf1_h
00003 #include "PhysicsTools/Utilities/interface/rootFunction.h"
00004 #include "PhysicsTools/Utilities/interface/Parameter.h"
00005 #include "TF1.h"
00006 
00007 namespace root {
00008 
00009   template<typename Tag, typename F>
00010   TF1 tf1_t(const char * name, F& f, double min, double max) {
00011     TF1 fun(name, root::function_t<1, Tag>(f), min, max, 0);
00012     return fun;
00013   }
00014 
00015   template<typename F>
00016   TF1 tf1(const char * name, F& f, double min, double max) {
00017     return tf1_t<helper::null_t>(name, f, min, max);
00018   }
00019 
00020   template<typename Tag, typename F>
00021   TF1 tf1_t(const char * name, F& f, double min, double max,
00022             const funct::Parameter & p0) {
00023     TF1 fun(name, root::function_t<1, Tag>(f, p0), min, max, 1);
00024     fun.SetParameter(0, *p0.ptr());
00025     fun.SetParName(0, p0.name().c_str());
00026     return fun;
00027   }
00028 
00029   template<typename F>
00030   TF1 tf1(const char * name, F& f, double min, double max,
00031           const funct::Parameter & p0) {
00032     return tf1_t<helper::null_t>(name, f, min, max, p0);
00033   }
00034 
00035   template<typename Tag, typename F>
00036   TF1 tf1_t(const char * name, F& f, double min, double max,
00037           const funct::Parameter & p0,
00038           const funct::Parameter & p1) {
00039     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1), min, max, 2);
00040     fun.SetParameter(0, *p0.ptr());
00041     fun.SetParName(0, p0.name().c_str());
00042     fun.SetParameter(1, *p1.ptr());
00043     fun.SetParName(1, p1.name().c_str());
00044     return fun;
00045   }
00046 
00047   template<typename F>
00048   TF1 tf1(const char * name, F& f, double min, double max,
00049           const funct::Parameter & p0,
00050           const funct::Parameter & p1) {
00051     return tf1_t<helper::null_t>(name, f, min, max, p0, p1);
00052   }
00053 
00054   template<typename Tag, typename F>
00055   TF1 tf1_t(const char * name, F& f, double min, double max,
00056           const funct::Parameter & p0,
00057           const funct::Parameter & p1,
00058           const funct::Parameter & p2) {
00059     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2), min, max, 3);
00060     fun.SetParameter(0, *p0.ptr());
00061     fun.SetParName(0, p0.name().c_str());
00062     fun.SetParameter(1, *p1.ptr());
00063     fun.SetParName(1, p1.name().c_str());
00064     fun.SetParameter(2, *p2.ptr());
00065     fun.SetParName(2, p2.name().c_str());
00066     return fun;
00067   }
00068 
00069   template<typename F>
00070   TF1 tf1(const char * name, F& f, double min, double max,
00071           const funct::Parameter & p0,
00072           const funct::Parameter & p1,
00073           const funct::Parameter & p2) {
00074     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2);
00075   }
00076 
00077   template<typename Tag, typename F>
00078   TF1 tf1_t(const char * name, F& f, double min, double max,
00079           const funct::Parameter & p0,
00080           const funct::Parameter & p1,
00081           const funct::Parameter & p2,
00082           const funct::Parameter & p3) {
00083     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3), min, max, 4);
00084     fun.SetParameter(0, *p0.ptr());
00085     fun.SetParName(0, p0.name().c_str());
00086     fun.SetParameter(1, *p1.ptr());
00087     fun.SetParName(1, p1.name().c_str());
00088     fun.SetParameter(2, *p2.ptr());
00089     fun.SetParName(2, p2.name().c_str());
00090     fun.SetParameter(3, *p3.ptr());
00091     fun.SetParName(3, p3.name().c_str());
00092     return fun;
00093   }
00094 
00095   template<typename F>
00096   TF1 tf1(const char * name, F& f, double min, double max,
00097           const funct::Parameter & p0,
00098           const funct::Parameter & p1,
00099           const funct::Parameter & p2,
00100           const funct::Parameter & p3) {
00101     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3);
00102   }
00103 
00104   template<typename Tag, typename F>
00105   TF1 tf1_t(const char * name, F& f, double min, double max,
00106           const funct::Parameter & p0,
00107           const funct::Parameter & p1,
00108           const funct::Parameter & p2,
00109           const funct::Parameter & p3,
00110           const funct::Parameter & p4) {
00111     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4), min, max, 5);
00112     fun.SetParameter(0, *p0.ptr());
00113     fun.SetParName(0, p0.name().c_str());
00114     fun.SetParameter(1, *p1.ptr());
00115     fun.SetParName(1, p1.name().c_str());
00116     fun.SetParameter(2, *p2.ptr());
00117     fun.SetParName(2, p2.name().c_str());
00118     fun.SetParameter(3, *p3.ptr());
00119     fun.SetParName(3, p3.name().c_str());
00120     fun.SetParameter(4, *p4.ptr());
00121     fun.SetParName(4, p4.name().c_str());
00122     return fun;
00123   }
00124   
00125   template<typename F>
00126   TF1 tf1(const char * name, F& f, double min, double max,
00127           const funct::Parameter & p0,
00128           const funct::Parameter & p1,
00129           const funct::Parameter & p2,
00130           const funct::Parameter & p3,
00131           const funct::Parameter & p4) {
00132     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4);
00133   }
00134 
00135   template<typename Tag, typename F>
00136   TF1 tf1_t(const char * name, F& f, double min, double max,
00137           const funct::Parameter & p0,
00138           const funct::Parameter & p1,
00139           const funct::Parameter & p2,
00140           const funct::Parameter & p3,
00141           const funct::Parameter & p4, 
00142           const funct::Parameter & p5) {
00143     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5), min, max, 6);
00144     fun.SetParameter(0, *p0.ptr());
00145     fun.SetParName(0, p0.name().c_str());
00146     fun.SetParameter(1, *p1.ptr());
00147     fun.SetParName(1, p1.name().c_str());
00148     fun.SetParameter(2, *p2.ptr());
00149     fun.SetParName(2, p2.name().c_str());
00150     fun.SetParameter(3, *p3.ptr());
00151     fun.SetParName(3, p3.name().c_str());
00152     fun.SetParameter(4, *p4.ptr());
00153     fun.SetParName(4, p4.name().c_str());
00154     fun.SetParameter(5, *p5.ptr());
00155     fun.SetParName(5, p5.name().c_str());
00156     return fun;
00157   }
00158   
00159   template<typename F>
00160   TF1 tf1(const char * name, F& f, double min, double max,
00161           const funct::Parameter & p0,
00162           const funct::Parameter & p1,
00163           const funct::Parameter & p2,
00164           const funct::Parameter & p3,
00165           const funct::Parameter & p4,
00166           const funct::Parameter & p5) {
00167     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5);
00168   }
00169 
00170   template<typename Tag, typename F>
00171   TF1 tf1_t(const char * name, F& f, double min, double max,
00172           const funct::Parameter & p0,
00173           const funct::Parameter & p1,
00174           const funct::Parameter & p2,
00175           const funct::Parameter & p3,
00176           const funct::Parameter & p4, 
00177           const funct::Parameter & p5, 
00178           const funct::Parameter & p6) {
00179     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6), min, max, 7);
00180     fun.SetParameter(0, *p0.ptr());
00181     fun.SetParName(0, p0.name().c_str());
00182     fun.SetParameter(1, *p1.ptr());
00183     fun.SetParName(1, p1.name().c_str());
00184     fun.SetParameter(2, *p2.ptr());
00185     fun.SetParName(2, p2.name().c_str());
00186     fun.SetParameter(3, *p3.ptr());
00187     fun.SetParName(3, p3.name().c_str());
00188     fun.SetParameter(4, *p4.ptr());
00189     fun.SetParName(4, p4.name().c_str());
00190     fun.SetParameter(5, *p5.ptr());
00191     fun.SetParName(5, p5.name().c_str());
00192     fun.SetParameter(6, *p6.ptr());
00193     fun.SetParName(6, p6.name().c_str());
00194     return fun;
00195   }
00196   
00197   template<typename F>
00198   TF1 tf1(const char * name, F& f, double min, double max,
00199           const funct::Parameter & p0,
00200           const funct::Parameter & p1,
00201           const funct::Parameter & p2,
00202           const funct::Parameter & p3,
00203           const funct::Parameter & p4,
00204           const funct::Parameter & p5,
00205           const funct::Parameter & p6) {
00206     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6);
00207   }
00208 
00209   template<typename Tag, typename F>
00210   TF1 tf1_t(const char * name, F& f, double min, double max,
00211           const funct::Parameter & p0,
00212           const funct::Parameter & p1,
00213           const funct::Parameter & p2,
00214           const funct::Parameter & p3,
00215           const funct::Parameter & p4, 
00216           const funct::Parameter & p5, 
00217           const funct::Parameter & p6,
00218           const funct::Parameter & p7) {
00219     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7), min, max, 8);
00220     fun.SetParameter(0, *p0.ptr());
00221     fun.SetParName(0, p0.name().c_str());
00222     fun.SetParameter(1, *p1.ptr());
00223     fun.SetParName(1, p1.name().c_str());
00224     fun.SetParameter(2, *p2.ptr());
00225     fun.SetParName(2, p2.name().c_str());
00226     fun.SetParameter(3, *p3.ptr());
00227     fun.SetParName(3, p3.name().c_str());
00228     fun.SetParameter(4, *p4.ptr());
00229     fun.SetParName(4, p4.name().c_str());
00230     fun.SetParameter(5, *p5.ptr());
00231     fun.SetParName(5, p5.name().c_str());
00232     fun.SetParameter(6, *p6.ptr());
00233     fun.SetParName(6, p6.name().c_str());
00234     fun.SetParameter(7, *p7.ptr());
00235     fun.SetParName(7, p7.name().c_str());
00236     return fun;
00237   }
00238   
00239   template<typename F>
00240   TF1 tf1(const char * name, F& f, double min, double max,
00241           const funct::Parameter & p0,
00242           const funct::Parameter & p1,
00243           const funct::Parameter & p2,
00244           const funct::Parameter & p3,
00245           const funct::Parameter & p4,
00246           const funct::Parameter & p5,
00247           const funct::Parameter & p6,
00248           const funct::Parameter & p7) {
00249     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7);
00250   }
00251 
00252   template<typename Tag, typename F>
00253   TF1 tf1_t(const char * name, F& f, double min, double max,
00254           const funct::Parameter & p0,
00255           const funct::Parameter & p1,
00256           const funct::Parameter & p2,
00257           const funct::Parameter & p3,
00258           const funct::Parameter & p4, 
00259           const funct::Parameter & p5, 
00260           const funct::Parameter & p6,
00261           const funct::Parameter & p7, 
00262           const funct::Parameter & p8) {
00263     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7, p8), min, max, 9);
00264     fun.SetParameter(0, *p0.ptr());
00265     fun.SetParName(0, p0.name().c_str());
00266     fun.SetParameter(1, *p1.ptr());
00267     fun.SetParName(1, p1.name().c_str());
00268     fun.SetParameter(2, *p2.ptr());
00269     fun.SetParName(2, p2.name().c_str());
00270     fun.SetParameter(3, *p3.ptr());
00271     fun.SetParName(3, p3.name().c_str());
00272     fun.SetParameter(4, *p4.ptr());
00273     fun.SetParName(4, p4.name().c_str());
00274     fun.SetParameter(5, *p5.ptr());
00275     fun.SetParName(5, p5.name().c_str());
00276     fun.SetParameter(6, *p6.ptr());
00277     fun.SetParName(6, p6.name().c_str());
00278     fun.SetParameter(7, *p7.ptr());
00279     fun.SetParName(7, p7.name().c_str());
00280     fun.SetParameter(8, *p8.ptr());
00281     fun.SetParName(8, p8.name().c_str());
00282     return fun;
00283   }
00284   
00285   template<typename F>
00286   TF1 tf1(const char * name, F& f, double min, double max,
00287           const funct::Parameter & p0,
00288           const funct::Parameter & p1,
00289           const funct::Parameter & p2,
00290           const funct::Parameter & p3,
00291           const funct::Parameter & p4,
00292           const funct::Parameter & p5,
00293           const funct::Parameter & p6,
00294           const funct::Parameter & p7,
00295           const funct::Parameter & p8) {
00296     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8);
00297   }
00298 
00299   template<typename Tag, typename F>
00300   TF1 tf1_t(const char * name, F& f, double min, double max,
00301           const funct::Parameter & p0,
00302           const funct::Parameter & p1,
00303           const funct::Parameter & p2,
00304           const funct::Parameter & p3,
00305           const funct::Parameter & p4, 
00306           const funct::Parameter & p5, 
00307           const funct::Parameter & p6,
00308           const funct::Parameter & p7, 
00309           const funct::Parameter & p8, 
00310           const funct::Parameter & p9) {
00311     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9), min, max, 10);
00312     fun.SetParameter(0, *p0.ptr());
00313     fun.SetParName(0, p0.name().c_str());
00314     fun.SetParameter(1, *p1.ptr());
00315     fun.SetParName(1, p1.name().c_str());
00316     fun.SetParameter(2, *p2.ptr());
00317     fun.SetParName(2, p2.name().c_str());
00318     fun.SetParameter(3, *p3.ptr());
00319     fun.SetParName(3, p3.name().c_str());
00320     fun.SetParameter(4, *p4.ptr());
00321     fun.SetParName(4, p4.name().c_str());
00322     fun.SetParameter(5, *p5.ptr());
00323     fun.SetParName(5, p5.name().c_str());
00324     fun.SetParameter(6, *p6.ptr());
00325     fun.SetParName(6, p6.name().c_str());
00326     fun.SetParameter(7, *p7.ptr());
00327     fun.SetParName(7, p7.name().c_str());
00328     fun.SetParameter(8, *p8.ptr());
00329     fun.SetParName(8, p8.name().c_str());
00330     fun.SetParameter(9, *p9.ptr());
00331     fun.SetParName(9, p9.name().c_str());
00332     return fun;
00333   }
00334   
00335   template<typename F>
00336   TF1 tf1(const char * name, F& f, double min, double max,
00337           const funct::Parameter & p0,
00338           const funct::Parameter & p1,
00339           const funct::Parameter & p2,
00340           const funct::Parameter & p3,
00341           const funct::Parameter & p4,
00342           const funct::Parameter & p5,
00343           const funct::Parameter & p6,
00344           const funct::Parameter & p7,
00345           const funct::Parameter & p8,
00346           const funct::Parameter & p9) {
00347     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
00348   }
00349 
00350   template<typename Tag, typename F>
00351   TF1 tf1_t(const char * name, F& f, double min, double max,
00352           const funct::Parameter & p0,
00353           const funct::Parameter & p1,
00354           const funct::Parameter & p2,
00355           const funct::Parameter & p3,
00356           const funct::Parameter & p4, 
00357           const funct::Parameter & p5, 
00358           const funct::Parameter & p6,
00359           const funct::Parameter & p7, 
00360           const funct::Parameter & p8, 
00361           const funct::Parameter & p9, 
00362           const funct::Parameter & p10) {
00363     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10), min, max, 11);
00364     fun.SetParameter(0, *p0.ptr());
00365     fun.SetParName(0, p0.name().c_str());
00366     fun.SetParameter(1, *p1.ptr());
00367     fun.SetParName(1, p1.name().c_str());
00368     fun.SetParameter(2, *p2.ptr());
00369     fun.SetParName(2, p2.name().c_str());
00370     fun.SetParameter(3, *p3.ptr());
00371     fun.SetParName(3, p3.name().c_str());
00372     fun.SetParameter(4, *p4.ptr());
00373     fun.SetParName(4, p4.name().c_str());
00374     fun.SetParameter(5, *p5.ptr());
00375     fun.SetParName(5, p5.name().c_str());
00376     fun.SetParameter(6, *p6.ptr());
00377     fun.SetParName(6, p6.name().c_str());
00378     fun.SetParameter(7, *p7.ptr());
00379     fun.SetParName(7, p7.name().c_str());
00380     fun.SetParameter(8, *p8.ptr());
00381     fun.SetParName(8, p8.name().c_str());
00382     fun.SetParameter(9, *p9.ptr());
00383     fun.SetParName(9, p9.name().c_str());
00384     fun.SetParameter(10, *p10.ptr());
00385     fun.SetParName(10, p10.name().c_str());
00386     return fun;
00387   }
00388   
00389   template<typename F>
00390   TF1 tf1(const char * name, F& f, double min, double max,
00391           const funct::Parameter & p0,
00392           const funct::Parameter & p1,
00393           const funct::Parameter & p2,
00394           const funct::Parameter & p3,
00395           const funct::Parameter & p4,
00396           const funct::Parameter & p5,
00397           const funct::Parameter & p6,
00398           const funct::Parameter & p7,
00399           const funct::Parameter & p8,
00400           const funct::Parameter & p9,
00401           const funct::Parameter & p10) {
00402     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10);
00403   }
00404   
00405   template<typename Tag, typename F>
00406   TF1 tf1_t(const char * name, F& f, double min, double max,
00407           const funct::Parameter & p0,
00408           const funct::Parameter & p1,
00409           const funct::Parameter & p2,
00410           const funct::Parameter & p3,
00411           const funct::Parameter & p4, 
00412           const funct::Parameter & p5, 
00413           const funct::Parameter & p6,
00414           const funct::Parameter & p7, 
00415           const funct::Parameter & p8, 
00416           const funct::Parameter & p9, 
00417           const funct::Parameter & p10, 
00418           const funct::Parameter & p11) {
00419     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11), min, max, 12);
00420     fun.SetParameter(0, *p0.ptr());
00421     fun.SetParName(0, p0.name().c_str());
00422     fun.SetParameter(1, *p1.ptr());
00423     fun.SetParName(1, p1.name().c_str());
00424     fun.SetParameter(2, *p2.ptr());
00425     fun.SetParName(2, p2.name().c_str());
00426     fun.SetParameter(3, *p3.ptr());
00427     fun.SetParName(3, p3.name().c_str());
00428     fun.SetParameter(4, *p4.ptr());
00429     fun.SetParName(4, p4.name().c_str());
00430     fun.SetParameter(5, *p5.ptr());
00431     fun.SetParName(5, p5.name().c_str());
00432     fun.SetParameter(6, *p6.ptr());
00433     fun.SetParName(6, p6.name().c_str());
00434     fun.SetParameter(7, *p7.ptr());
00435     fun.SetParName(7, p7.name().c_str());
00436     fun.SetParameter(8, *p8.ptr());
00437     fun.SetParName(8, p8.name().c_str());
00438     fun.SetParameter(9, *p9.ptr());
00439     fun.SetParName(9, p9.name().c_str());
00440     fun.SetParameter(10, *p10.ptr());
00441     fun.SetParName(10, p10.name().c_str());
00442     fun.SetParameter(11, *p11.ptr());
00443     fun.SetParName(11, p11.name().c_str());
00444     return fun;
00445   }
00446   
00447   template<typename F>
00448   TF1 tf1(const char * name, F& f, double min, double max,
00449           const funct::Parameter & p0,
00450           const funct::Parameter & p1,
00451           const funct::Parameter & p2,
00452           const funct::Parameter & p3,
00453           const funct::Parameter & p4,
00454           const funct::Parameter & p5,
00455           const funct::Parameter & p6,
00456           const funct::Parameter & p7,
00457           const funct::Parameter & p8,
00458           const funct::Parameter & p9,
00459           const funct::Parameter & p10,
00460           const funct::Parameter & p11) {
00461     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11);
00462   }
00463   
00464   template<typename Tag, typename F>
00465   TF1 tf1_t(const char * name, F& f, double min, double max,
00466           const funct::Parameter & p0,
00467           const funct::Parameter & p1,
00468           const funct::Parameter & p2,
00469           const funct::Parameter & p3,
00470           const funct::Parameter & p4, 
00471           const funct::Parameter & p5, 
00472           const funct::Parameter & p6,
00473           const funct::Parameter & p7, 
00474           const funct::Parameter & p8, 
00475           const funct::Parameter & p9, 
00476           const funct::Parameter & p10, 
00477           const funct::Parameter & p11, 
00478           const funct::Parameter & p12) {
00479     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12), min, max, 13);
00480     fun.SetParameter(0, *p0.ptr());
00481     fun.SetParName(0, p0.name().c_str());
00482     fun.SetParameter(1, *p1.ptr());
00483     fun.SetParName(1, p1.name().c_str());
00484     fun.SetParameter(2, *p2.ptr());
00485     fun.SetParName(2, p2.name().c_str());
00486     fun.SetParameter(3, *p3.ptr());
00487     fun.SetParName(3, p3.name().c_str());
00488     fun.SetParameter(4, *p4.ptr());
00489     fun.SetParName(4, p4.name().c_str());
00490     fun.SetParameter(5, *p5.ptr());
00491     fun.SetParName(5, p5.name().c_str());
00492     fun.SetParameter(6, *p6.ptr());
00493     fun.SetParName(6, p6.name().c_str());
00494     fun.SetParameter(7, *p7.ptr());
00495     fun.SetParName(7, p7.name().c_str());
00496     fun.SetParameter(8, *p8.ptr());
00497     fun.SetParName(8, p8.name().c_str());
00498     fun.SetParameter(9, *p9.ptr());
00499     fun.SetParName(9, p9.name().c_str());
00500     fun.SetParameter(10, *p10.ptr());
00501     fun.SetParName(10, p10.name().c_str());
00502     fun.SetParameter(11, *p11.ptr());
00503     fun.SetParName(11, p11.name().c_str());
00504     fun.SetParameter(12, *p12.ptr());
00505     fun.SetParName(12, p12.name().c_str());
00506     return fun;
00507   }
00508   
00509   template<typename F>
00510   TF1 tf1(const char * name, F& f, double min, double max,
00511           const funct::Parameter & p0,
00512           const funct::Parameter & p1,
00513           const funct::Parameter & p2,
00514           const funct::Parameter & p3,
00515           const funct::Parameter & p4,
00516           const funct::Parameter & p5,
00517           const funct::Parameter & p6,
00518           const funct::Parameter & p7,
00519           const funct::Parameter & p8,
00520           const funct::Parameter & p9,
00521           const funct::Parameter & p10,
00522           const funct::Parameter & p11,
00523           const funct::Parameter & p12) {
00524     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12);
00525   }
00526   
00527   template<typename Tag, typename F>
00528   TF1 tf1_t(const char * name, F& f, double min, double max,
00529           const funct::Parameter & p0,
00530           const funct::Parameter & p1,
00531           const funct::Parameter & p2,
00532           const funct::Parameter & p3,
00533           const funct::Parameter & p4, 
00534           const funct::Parameter & p5, 
00535           const funct::Parameter & p6,
00536           const funct::Parameter & p7, 
00537           const funct::Parameter & p8, 
00538           const funct::Parameter & p9, 
00539           const funct::Parameter & p10, 
00540           const funct::Parameter & p11, 
00541           const funct::Parameter & p12, 
00542           const funct::Parameter & p13) {
00543     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), min, max, 14);
00544     fun.SetParameter(0, *p0.ptr());
00545     fun.SetParName(0, p0.name().c_str());
00546     fun.SetParameter(1, *p1.ptr());
00547     fun.SetParName(1, p1.name().c_str());
00548     fun.SetParameter(2, *p2.ptr());
00549     fun.SetParName(2, p2.name().c_str());
00550     fun.SetParameter(3, *p3.ptr());
00551     fun.SetParName(3, p3.name().c_str());
00552     fun.SetParameter(4, *p4.ptr());
00553     fun.SetParName(4, p4.name().c_str());
00554     fun.SetParameter(5, *p5.ptr());
00555     fun.SetParName(5, p5.name().c_str());
00556     fun.SetParameter(6, *p6.ptr());
00557     fun.SetParName(6, p6.name().c_str());
00558     fun.SetParameter(7, *p7.ptr());
00559     fun.SetParName(7, p7.name().c_str());
00560     fun.SetParameter(8, *p8.ptr());
00561     fun.SetParName(8, p8.name().c_str());
00562     fun.SetParameter(9, *p9.ptr());
00563     fun.SetParName(9, p9.name().c_str());
00564     fun.SetParameter(10, *p10.ptr());
00565     fun.SetParName(10, p10.name().c_str());
00566     fun.SetParameter(11, *p11.ptr());
00567     fun.SetParName(11, p11.name().c_str());
00568     fun.SetParameter(12, *p12.ptr());
00569     fun.SetParName(12, p12.name().c_str());
00570     fun.SetParameter(13, *p13.ptr());
00571     fun.SetParName(13, p13.name().c_str());
00572     return fun;
00573   }
00574   
00575   template<typename F>
00576   TF1 tf1(const char * name, F& f, double min, double max,
00577           const funct::Parameter & p0,
00578           const funct::Parameter & p1,
00579           const funct::Parameter & p2,
00580           const funct::Parameter & p3,
00581           const funct::Parameter & p4,
00582           const funct::Parameter & p5,
00583           const funct::Parameter & p6,
00584           const funct::Parameter & p7,
00585           const funct::Parameter & p8,
00586           const funct::Parameter & p9,
00587           const funct::Parameter & p10,
00588           const funct::Parameter & p11,
00589           const funct::Parameter & p12,
00590           const funct::Parameter & p13) {
00591     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13);
00592   }
00593   
00594   template<typename Tag, typename F>
00595   TF1 tf1_t(const char * name, F& f, double min, double max,
00596           const funct::Parameter & p0,
00597           const funct::Parameter & p1,
00598           const funct::Parameter & p2,
00599           const funct::Parameter & p3,
00600           const funct::Parameter & p4, 
00601           const funct::Parameter & p5, 
00602           const funct::Parameter & p6,
00603           const funct::Parameter & p7, 
00604           const funct::Parameter & p8, 
00605           const funct::Parameter & p9, 
00606           const funct::Parameter & p10, 
00607           const funct::Parameter & p11, 
00608           const funct::Parameter & p12, 
00609           const funct::Parameter & p13, 
00610           const funct::Parameter & p14) {
00611     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14), min, max, 15);
00612     fun.SetParameter(0, *p0.ptr());
00613     fun.SetParName(0, p0.name().c_str());
00614     fun.SetParameter(1, *p1.ptr());
00615     fun.SetParName(1, p1.name().c_str());
00616     fun.SetParameter(2, *p2.ptr());
00617     fun.SetParName(2, p2.name().c_str());
00618     fun.SetParameter(3, *p3.ptr());
00619     fun.SetParName(3, p3.name().c_str());
00620     fun.SetParameter(4, *p4.ptr());
00621     fun.SetParName(4, p4.name().c_str());
00622     fun.SetParameter(5, *p5.ptr());
00623     fun.SetParName(5, p5.name().c_str());
00624     fun.SetParameter(6, *p6.ptr());
00625     fun.SetParName(6, p6.name().c_str());
00626     fun.SetParameter(7, *p7.ptr());
00627     fun.SetParName(7, p7.name().c_str());
00628     fun.SetParameter(8, *p8.ptr());
00629     fun.SetParName(8, p8.name().c_str());
00630     fun.SetParameter(9, *p9.ptr());
00631     fun.SetParName(9, p9.name().c_str());
00632     fun.SetParameter(10, *p10.ptr());
00633     fun.SetParName(10, p10.name().c_str());
00634     fun.SetParameter(11, *p11.ptr());
00635     fun.SetParName(11, p11.name().c_str());
00636     fun.SetParameter(12, *p12.ptr());
00637     fun.SetParName(12, p12.name().c_str());
00638     fun.SetParameter(13, *p13.ptr());
00639     fun.SetParName(13, p13.name().c_str());
00640     fun.SetParameter(14, *p14.ptr());
00641     fun.SetParName(14, p14.name().c_str());
00642     return fun;
00643   }
00644   
00645   template<typename F>
00646   TF1 tf1(const char * name, F& f, double min, double max,
00647           const funct::Parameter & p0,
00648           const funct::Parameter & p1,
00649           const funct::Parameter & p2,
00650           const funct::Parameter & p3,
00651           const funct::Parameter & p4,
00652           const funct::Parameter & p5,
00653           const funct::Parameter & p6,
00654           const funct::Parameter & p7,
00655           const funct::Parameter & p8,
00656           const funct::Parameter & p9,
00657           const funct::Parameter & p10,
00658           const funct::Parameter & p11,
00659           const funct::Parameter & p12,
00660           const funct::Parameter & p13,
00661           const funct::Parameter & p14) {
00662     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14);
00663   }
00664   
00665   template<typename Tag, typename F>
00666   TF1 tf1_t(const char * name, F& f, double min, double max,
00667           const funct::Parameter & p0,
00668           const funct::Parameter & p1,
00669           const funct::Parameter & p2,
00670           const funct::Parameter & p3,
00671           const funct::Parameter & p4, 
00672           const funct::Parameter & p5, 
00673           const funct::Parameter & p6,
00674           const funct::Parameter & p7, 
00675           const funct::Parameter & p8, 
00676           const funct::Parameter & p9, 
00677           const funct::Parameter & p10, 
00678           const funct::Parameter & p11, 
00679           const funct::Parameter & p12, 
00680           const funct::Parameter & p13, 
00681           const funct::Parameter & p14, 
00682           const funct::Parameter & p15) {
00683     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, 
00684                                     p10, p11, p12, p13, p14, p15), min, max, 16);
00685     fun.SetParameter(0, *p0.ptr());
00686     fun.SetParName(0, p0.name().c_str());
00687     fun.SetParameter(1, *p1.ptr());
00688     fun.SetParName(1, p1.name().c_str());
00689     fun.SetParameter(2, *p2.ptr());
00690     fun.SetParName(2, p2.name().c_str());
00691     fun.SetParameter(3, *p3.ptr());
00692     fun.SetParName(3, p3.name().c_str());
00693     fun.SetParameter(4, *p4.ptr());
00694     fun.SetParName(4, p4.name().c_str());
00695     fun.SetParameter(5, *p5.ptr());
00696     fun.SetParName(5, p5.name().c_str());
00697     fun.SetParameter(6, *p6.ptr());
00698     fun.SetParName(6, p6.name().c_str());
00699     fun.SetParameter(7, *p7.ptr());
00700     fun.SetParName(7, p7.name().c_str());
00701     fun.SetParameter(8, *p8.ptr());
00702     fun.SetParName(8, p8.name().c_str());
00703     fun.SetParameter(9, *p9.ptr());
00704     fun.SetParName(9, p9.name().c_str());
00705     fun.SetParameter(10, *p10.ptr());
00706     fun.SetParName(10, p10.name().c_str());
00707     fun.SetParameter(11, *p11.ptr());
00708     fun.SetParName(11, p11.name().c_str());
00709     fun.SetParameter(12, *p12.ptr());
00710     fun.SetParName(12, p12.name().c_str());
00711     fun.SetParameter(13, *p13.ptr());
00712     fun.SetParName(13, p13.name().c_str());
00713     fun.SetParameter(14, *p14.ptr());
00714     fun.SetParName(14, p14.name().c_str());
00715     fun.SetParameter(15, *p15.ptr());
00716     fun.SetParName(15, p15.name().c_str());
00717     return fun;
00718   }
00719   
00720   template<typename F>
00721   TF1 tf1(const char * name, F& f, double min, double max,
00722           const funct::Parameter & p0,
00723           const funct::Parameter & p1,
00724           const funct::Parameter & p2,
00725           const funct::Parameter & p3,
00726           const funct::Parameter & p4,
00727           const funct::Parameter & p5,
00728           const funct::Parameter & p6,
00729           const funct::Parameter & p7,
00730           const funct::Parameter & p8,
00731           const funct::Parameter & p9,
00732           const funct::Parameter & p10,
00733           const funct::Parameter & p11,
00734           const funct::Parameter & p12,
00735           const funct::Parameter & p13,
00736           const funct::Parameter & p14,
00737           const funct::Parameter & p15) {
00738     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15);
00739   }
00740 
00741   template<typename Tag, typename F>
00742   TF1 tf1_t(const char * name, F& f, double min, double max,
00743           const funct::Parameter & p0,
00744           const funct::Parameter & p1,
00745           const funct::Parameter & p2,
00746           const funct::Parameter & p3,
00747           const funct::Parameter & p4, 
00748           const funct::Parameter & p5, 
00749           const funct::Parameter & p6,
00750           const funct::Parameter & p7, 
00751           const funct::Parameter & p8, 
00752           const funct::Parameter & p9, 
00753           const funct::Parameter & p10, 
00754           const funct::Parameter & p11, 
00755           const funct::Parameter & p12, 
00756           const funct::Parameter & p13, 
00757           const funct::Parameter & p14, 
00758           const funct::Parameter & p15, 
00759           const funct::Parameter & p16) {
00760     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, 
00761                                     p10, p11, p12, p13, p14, p15, p16), min, max, 17);
00762     fun.SetParameter(0, *p0.ptr());
00763     fun.SetParName(0, p0.name().c_str());
00764     fun.SetParameter(1, *p1.ptr());
00765     fun.SetParName(1, p1.name().c_str());
00766     fun.SetParameter(2, *p2.ptr());
00767     fun.SetParName(2, p2.name().c_str());
00768     fun.SetParameter(3, *p3.ptr());
00769     fun.SetParName(3, p3.name().c_str());
00770     fun.SetParameter(4, *p4.ptr());
00771     fun.SetParName(4, p4.name().c_str());
00772     fun.SetParameter(5, *p5.ptr());
00773     fun.SetParName(5, p5.name().c_str());
00774     fun.SetParameter(6, *p6.ptr());
00775     fun.SetParName(6, p6.name().c_str());
00776     fun.SetParameter(7, *p7.ptr());
00777     fun.SetParName(7, p7.name().c_str());
00778     fun.SetParameter(8, *p8.ptr());
00779     fun.SetParName(8, p8.name().c_str());
00780     fun.SetParameter(9, *p9.ptr());
00781     fun.SetParName(9, p9.name().c_str());
00782     fun.SetParameter(10, *p10.ptr());
00783     fun.SetParName(10, p10.name().c_str());
00784     fun.SetParameter(11, *p11.ptr());
00785     fun.SetParName(11, p11.name().c_str());
00786     fun.SetParameter(12, *p12.ptr());
00787     fun.SetParName(12, p12.name().c_str());
00788     fun.SetParameter(13, *p13.ptr());
00789     fun.SetParName(13, p13.name().c_str());
00790     fun.SetParameter(14, *p14.ptr());
00791     fun.SetParName(14, p14.name().c_str());
00792     fun.SetParameter(15, *p15.ptr());
00793     fun.SetParName(15, p15.name().c_str());
00794     fun.SetParameter(16, *p16.ptr());
00795     fun.SetParName(16, p16.name().c_str());
00796     return fun;
00797   }
00798   
00799   template<typename F>
00800   TF1 tf1(const char * name, F& f, double min, double max,
00801           const funct::Parameter & p0,
00802           const funct::Parameter & p1,
00803           const funct::Parameter & p2,
00804           const funct::Parameter & p3,
00805           const funct::Parameter & p4,
00806           const funct::Parameter & p5,
00807           const funct::Parameter & p6,
00808           const funct::Parameter & p7,
00809           const funct::Parameter & p8,
00810           const funct::Parameter & p9,
00811           const funct::Parameter & p10,
00812           const funct::Parameter & p11,
00813           const funct::Parameter & p12,
00814           const funct::Parameter & p13,
00815           const funct::Parameter & p14,
00816           const funct::Parameter & p15,
00817           const funct::Parameter & p16) {
00818     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16);
00819   }
00820 
00821   template<typename Tag, typename F>
00822   TF1 tf1_t(const char * name, F& f, double min, double max,
00823           const funct::Parameter & p0,
00824           const funct::Parameter & p1,
00825           const funct::Parameter & p2,
00826           const funct::Parameter & p3,
00827           const funct::Parameter & p4, 
00828           const funct::Parameter & p5, 
00829           const funct::Parameter & p6,
00830           const funct::Parameter & p7, 
00831           const funct::Parameter & p8, 
00832           const funct::Parameter & p9, 
00833           const funct::Parameter & p10, 
00834           const funct::Parameter & p11, 
00835           const funct::Parameter & p12, 
00836           const funct::Parameter & p13, 
00837           const funct::Parameter & p14, 
00838           const funct::Parameter & p15, 
00839           const funct::Parameter & p16, 
00840           const funct::Parameter & p17) {
00841     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, 
00842                                     p10, p11, p12, p13, p14, p15, p16, p17), min, max, 18);
00843     fun.SetParameter(0, *p0.ptr());
00844     fun.SetParName(0, p0.name().c_str());
00845     fun.SetParameter(1, *p1.ptr());
00846     fun.SetParName(1, p1.name().c_str());
00847     fun.SetParameter(2, *p2.ptr());
00848     fun.SetParName(2, p2.name().c_str());
00849     fun.SetParameter(3, *p3.ptr());
00850     fun.SetParName(3, p3.name().c_str());
00851     fun.SetParameter(4, *p4.ptr());
00852     fun.SetParName(4, p4.name().c_str());
00853     fun.SetParameter(5, *p5.ptr());
00854     fun.SetParName(5, p5.name().c_str());
00855     fun.SetParameter(6, *p6.ptr());
00856     fun.SetParName(6, p6.name().c_str());
00857     fun.SetParameter(7, *p7.ptr());
00858     fun.SetParName(7, p7.name().c_str());
00859     fun.SetParameter(8, *p8.ptr());
00860     fun.SetParName(8, p8.name().c_str());
00861     fun.SetParameter(9, *p9.ptr());
00862     fun.SetParName(9, p9.name().c_str());
00863     fun.SetParameter(10, *p10.ptr());
00864     fun.SetParName(10, p10.name().c_str());
00865     fun.SetParameter(11, *p11.ptr());
00866     fun.SetParName(11, p11.name().c_str());
00867     fun.SetParameter(12, *p12.ptr());
00868     fun.SetParName(12, p12.name().c_str());
00869     fun.SetParameter(13, *p13.ptr());
00870     fun.SetParName(13, p13.name().c_str());
00871     fun.SetParameter(14, *p14.ptr());
00872     fun.SetParName(14, p14.name().c_str());
00873     fun.SetParameter(15, *p15.ptr());
00874     fun.SetParName(15, p15.name().c_str());
00875     fun.SetParameter(16, *p16.ptr());
00876     fun.SetParName(16, p16.name().c_str());
00877     fun.SetParameter(17, *p17.ptr());
00878     fun.SetParName(17, p17.name().c_str());
00879     return fun;
00880   }
00881   
00882   template<typename F>
00883   TF1 tf1(const char * name, F& f, double min, double max,
00884           const funct::Parameter & p0,
00885           const funct::Parameter & p1,
00886           const funct::Parameter & p2,
00887           const funct::Parameter & p3,
00888           const funct::Parameter & p4,
00889           const funct::Parameter & p5,
00890           const funct::Parameter & p6,
00891           const funct::Parameter & p7,
00892           const funct::Parameter & p8,
00893           const funct::Parameter & p9,
00894           const funct::Parameter & p10,
00895           const funct::Parameter & p11,
00896           const funct::Parameter & p12,
00897           const funct::Parameter & p13,
00898           const funct::Parameter & p14,
00899           const funct::Parameter & p15,
00900           const funct::Parameter & p16,
00901           const funct::Parameter & p17) {
00902     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17);
00903   }
00904 
00905   template<typename Tag, typename F>
00906   TF1 tf1_t(const char * name, F& f, double min, double max,
00907           const funct::Parameter & p0,
00908           const funct::Parameter & p1,
00909           const funct::Parameter & p2,
00910           const funct::Parameter & p3,
00911           const funct::Parameter & p4, 
00912           const funct::Parameter & p5, 
00913           const funct::Parameter & p6,
00914           const funct::Parameter & p7, 
00915           const funct::Parameter & p8, 
00916           const funct::Parameter & p9, 
00917           const funct::Parameter & p10, 
00918           const funct::Parameter & p11, 
00919           const funct::Parameter & p12, 
00920           const funct::Parameter & p13, 
00921           const funct::Parameter & p14, 
00922           const funct::Parameter & p15, 
00923           const funct::Parameter & p16, 
00924           const funct::Parameter & p17, 
00925           const funct::Parameter & p18) {
00926     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, 
00927                                            p10, p11, p12, p13, p14, p15, p16, p17, p18), min, max, 19);
00928     fun.SetParameter(0, *p0.ptr());
00929     fun.SetParName(0, p0.name().c_str());
00930     fun.SetParameter(1, *p1.ptr());
00931     fun.SetParName(1, p1.name().c_str());
00932     fun.SetParameter(2, *p2.ptr());
00933     fun.SetParName(2, p2.name().c_str());
00934     fun.SetParameter(3, *p3.ptr());
00935     fun.SetParName(3, p3.name().c_str());
00936     fun.SetParameter(4, *p4.ptr());
00937     fun.SetParName(4, p4.name().c_str());
00938     fun.SetParameter(5, *p5.ptr());
00939     fun.SetParName(5, p5.name().c_str());
00940     fun.SetParameter(6, *p6.ptr());
00941     fun.SetParName(6, p6.name().c_str());
00942     fun.SetParameter(7, *p7.ptr());
00943     fun.SetParName(7, p7.name().c_str());
00944     fun.SetParameter(8, *p8.ptr());
00945     fun.SetParName(8, p8.name().c_str());
00946     fun.SetParameter(9, *p9.ptr());
00947     fun.SetParName(9, p9.name().c_str());
00948     fun.SetParameter(10, *p10.ptr());
00949     fun.SetParName(10, p10.name().c_str());
00950     fun.SetParameter(11, *p11.ptr());
00951     fun.SetParName(11, p11.name().c_str());
00952     fun.SetParameter(12, *p12.ptr());
00953     fun.SetParName(12, p12.name().c_str());
00954     fun.SetParameter(13, *p13.ptr());
00955     fun.SetParName(13, p13.name().c_str());
00956     fun.SetParameter(14, *p14.ptr());
00957     fun.SetParName(14, p14.name().c_str());
00958     fun.SetParameter(15, *p15.ptr());
00959     fun.SetParName(15, p15.name().c_str());
00960     fun.SetParameter(16, *p16.ptr());
00961     fun.SetParName(16, p16.name().c_str());
00962     fun.SetParameter(17, *p17.ptr());
00963     fun.SetParName(17, p17.name().c_str());
00964     fun.SetParameter(18, *p18.ptr());
00965     fun.SetParName(18, p18.name().c_str());
00966     return fun;
00967   }
00968   
00969   template<typename F>
00970   TF1 tf1(const char * name, F& f, double min, double max,
00971           const funct::Parameter & p0,
00972           const funct::Parameter & p1,
00973           const funct::Parameter & p2,
00974           const funct::Parameter & p3,
00975           const funct::Parameter & p4,
00976           const funct::Parameter & p5,
00977           const funct::Parameter & p6,
00978           const funct::Parameter & p7,
00979           const funct::Parameter & p8,
00980           const funct::Parameter & p9,
00981           const funct::Parameter & p10,
00982           const funct::Parameter & p11,
00983           const funct::Parameter & p12,
00984           const funct::Parameter & p13,
00985           const funct::Parameter & p14,
00986           const funct::Parameter & p15,
00987           const funct::Parameter & p16,
00988           const funct::Parameter & p17,
00989           const funct::Parameter & p18) {
00990     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18);
00991   }
00992 
00993   template<typename Tag, typename F>
00994   TF1 tf1_t(const char * name, F& f, double min, double max,
00995           const funct::Parameter & p0,
00996           const funct::Parameter & p1,
00997           const funct::Parameter & p2,
00998           const funct::Parameter & p3,
00999           const funct::Parameter & p4, 
01000           const funct::Parameter & p5, 
01001           const funct::Parameter & p6,
01002           const funct::Parameter & p7, 
01003           const funct::Parameter & p8, 
01004           const funct::Parameter & p9, 
01005           const funct::Parameter & p10, 
01006           const funct::Parameter & p11, 
01007           const funct::Parameter & p12, 
01008           const funct::Parameter & p13, 
01009           const funct::Parameter & p14, 
01010           const funct::Parameter & p15, 
01011           const funct::Parameter & p16, 
01012           const funct::Parameter & p17, 
01013           const funct::Parameter & p18, 
01014           const funct::Parameter & p19) {
01015     TF1 fun(name, root::function_t<1, Tag>(f, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, 
01016                                            p10, p11, p12, p13, p14, p15, p16, p17, p18, p19), min, max, 20);
01017     fun.SetParameter(0, *p0.ptr());
01018     fun.SetParName(0, p0.name().c_str());
01019     fun.SetParameter(1, *p1.ptr());
01020     fun.SetParName(1, p1.name().c_str());
01021     fun.SetParameter(2, *p2.ptr());
01022     fun.SetParName(2, p2.name().c_str());
01023     fun.SetParameter(3, *p3.ptr());
01024     fun.SetParName(3, p3.name().c_str());
01025     fun.SetParameter(4, *p4.ptr());
01026     fun.SetParName(4, p4.name().c_str());
01027     fun.SetParameter(5, *p5.ptr());
01028     fun.SetParName(5, p5.name().c_str());
01029     fun.SetParameter(6, *p6.ptr());
01030     fun.SetParName(6, p6.name().c_str());
01031     fun.SetParameter(7, *p7.ptr());
01032     fun.SetParName(7, p7.name().c_str());
01033     fun.SetParameter(8, *p8.ptr());
01034     fun.SetParName(8, p8.name().c_str());
01035     fun.SetParameter(9, *p9.ptr());
01036     fun.SetParName(9, p9.name().c_str());
01037     fun.SetParameter(10, *p10.ptr());
01038     fun.SetParName(10, p10.name().c_str());
01039     fun.SetParameter(11, *p11.ptr());
01040     fun.SetParName(11, p11.name().c_str());
01041     fun.SetParameter(12, *p12.ptr());
01042     fun.SetParName(12, p12.name().c_str());
01043     fun.SetParameter(13, *p13.ptr());
01044     fun.SetParName(13, p13.name().c_str());
01045     fun.SetParameter(14, *p14.ptr());
01046     fun.SetParName(14, p14.name().c_str());
01047     fun.SetParameter(15, *p15.ptr());
01048     fun.SetParName(15, p15.name().c_str());
01049     fun.SetParameter(16, *p16.ptr());
01050     fun.SetParName(16, p16.name().c_str());
01051     fun.SetParameter(17, *p17.ptr());
01052     fun.SetParName(17, p17.name().c_str());
01053     fun.SetParameter(18, *p18.ptr());
01054     fun.SetParName(18, p18.name().c_str());
01055     fun.SetParameter(19, *p19.ptr());
01056     fun.SetParName(19, p19.name().c_str());
01057     return fun;
01058   }
01059   
01060   
01061   template<typename F>
01062   TF1 tf1(const char * name, F& f, double min, double max,
01063           const funct::Parameter & p0,
01064           const funct::Parameter & p1,
01065           const funct::Parameter & p2,
01066           const funct::Parameter & p3,
01067           const funct::Parameter & p4,
01068           const funct::Parameter & p5,
01069           const funct::Parameter & p6,
01070           const funct::Parameter & p7,
01071           const funct::Parameter & p8,
01072           const funct::Parameter & p9,
01073           const funct::Parameter & p10,
01074           const funct::Parameter & p11,
01075           const funct::Parameter & p12,
01076           const funct::Parameter & p13,
01077           const funct::Parameter & p14,
01078           const funct::Parameter & p15,
01079           const funct::Parameter & p16,
01080           const funct::Parameter & p17,
01081           const funct::Parameter & p18,
01082           const funct::Parameter & p19) {
01083     return tf1_t<helper::null_t>(name, f, min, max, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19);
01084   }
01085 
01086   template<typename Tag, typename F>
01087   TF1 tf1_t(const char * name, F& f, double min, double max,
01088           const std::vector<funct::Parameter> & p) {
01089     TF1 fun(name, root::function_t<1, Tag>(f, p), min, max, p.size());
01090     for(size_t i = 0; i < p.size(); ++i) {
01091       fun.SetParameter(i, *p[i].ptr());
01092       fun.SetParName(i, p[i].name().c_str());
01093     }
01094     return fun;
01095   }  
01096   
01097   template<typename F>
01098   TF1 tf1(const char * name, F& f, double min, double max,
01099           const std::vector<funct::Parameter> & p) {
01100     return tf1_t<helper::null_t>(name, f, min, max, p);
01101   }
01102 
01103   template<typename Tag, typename F>
01104   TF1 tf1_t(const char * name, F& f, double min, double max,
01105             const std::vector<boost::shared_ptr<double> > & p) {
01106     TF1 fun(name, root::function_t<1, Tag>(f, p), min, max, p.size());
01107     for(size_t i = 0; i < p.size(); ++i)
01108       fun.SetParameter(i, *p[i]);
01109     return fun;
01110   }  
01111  
01112   template<typename F>
01113   TF1 tf1(const char * name, F& f, double min, double max,
01114           const std::vector<boost::shared_ptr<double> > & p) {
01115     return tf1_t<helper::null_t>(name, f, min, max, p);
01116   }
01117 
01118 }
01119 
01120 #endif