| [165] | 1 | #include <stdio.h> | 
|---|
|  | 2 | #include <stdlib.h> | 
|---|
|  | 3 | #include <ctype.h> | 
|---|
|  | 4 |  | 
|---|
| [295] | 5 | #include <typeinfo> | 
|---|
| [2322] | 6 | #include <iostream> | 
|---|
| [165] | 7 | #include <string> | 
|---|
|  | 8 | #include <list> | 
|---|
|  | 9 | #include <map> | 
|---|
|  | 10 |  | 
|---|
| [2615] | 11 | #include "sopnamsp.h" | 
|---|
| [165] | 12 | #include "strutil.h" | 
|---|
|  | 13 |  | 
|---|
|  | 14 | #include "nobjmgr.h" | 
|---|
|  | 15 | #include "servnobjm.h" | 
|---|
| [330] | 16 | #include "nomgadapter.h" | 
|---|
| [165] | 17 | #include "pistdimgapp.h" | 
|---|
|  | 18 |  | 
|---|
| [333] | 19 | #include "fct1dfit.h" | 
|---|
|  | 20 | #include "fct2dfit.h" | 
|---|
|  | 21 |  | 
|---|
| [544] | 22 | #ifdef SANS_EVOLPLANCK | 
|---|
| [333] | 23 | #include "matrix.h" | 
|---|
|  | 24 | #include "cvector.h" | 
|---|
| [544] | 25 | #else | 
|---|
|  | 26 | #include "tmatrix.h" | 
|---|
|  | 27 | #include "tvector.h" | 
|---|
| [584] | 28 | #include "pitvmaad.h" | 
|---|
| [544] | 29 | #endif | 
|---|
|  | 30 |  | 
|---|
| [333] | 31 | #include "ntuple.h" | 
|---|
|  | 32 | #include "cimage.h" | 
|---|
|  | 33 |  | 
|---|
| [165] | 34 | #include "histos.h" | 
|---|
|  | 35 | #include "histos2.h" | 
|---|
|  | 36 | #include "ntuple.h" | 
|---|
|  | 37 | #include "hisprof.h" | 
|---|
|  | 38 |  | 
|---|
| [1905] | 39 | #include "piyfxdrw.h" | 
|---|
| [326] | 40 | #include "pisurfdr.h" | 
|---|
| [333] | 41 |  | 
|---|
|  | 42 | #include "pintuple.h" | 
|---|
|  | 43 | #include "pintup3d.h" | 
|---|
|  | 44 |  | 
|---|
| [326] | 45 | #include "pipodrw.h" | 
|---|
| [165] | 46 |  | 
|---|
|  | 47 |  | 
|---|
| [326] | 48 |  | 
|---|
| [165] | 49 | /* --Methode-- */ | 
|---|
| [2491] | 50 | Services2NObjMgr::Services2NObjMgr(string& tmpdir) | 
|---|
| [165] | 51 | { | 
|---|
| [1276] | 52 | SetTmpDir(tmpdir); | 
|---|
| [333] | 53 | mImgapp = NULL; | 
|---|
| [2491] | 54 | mOmg = NULL; | 
|---|
| [171] | 55 | dynlink = NULL; | 
|---|
| [165] | 56 | } | 
|---|
|  | 57 |  | 
|---|
|  | 58 | /* --Methode-- */ | 
|---|
|  | 59 | Services2NObjMgr::~Services2NObjMgr() | 
|---|
|  | 60 | { | 
|---|
|  | 61 | CloseDLL(); | 
|---|
| [2491] | 62 | if (mOmg) delete mOmg; | 
|---|
| [165] | 63 | } | 
|---|
|  | 64 |  | 
|---|
|  | 65 | /* --Methode-- */ | 
|---|
| [295] | 66 | void Services2NObjMgr::RegisterClass(AnyDataObj* o, NObjMgrAdapter* oa) | 
|---|
| [165] | 67 | { | 
|---|
| [295] | 68 | ObjAdaptList::iterator it; | 
|---|
|  | 69 | for(it = objadaplist.begin(); it != objadaplist.end(); it++) | 
|---|
| [495] | 70 | #ifdef SANS_EVOLPLANCK | 
|---|
| [295] | 71 | if (typeid(*o) == typeid(*((*it).obj)))  THROW(dupIdErr); | 
|---|
| [495] | 72 | #else | 
|---|
|  | 73 | if (typeid(*o) == typeid(*((*it).obj))) | 
|---|
|  | 74 | throw(DuplicateIdExc("Services2NObjMgr::RegisterClass() - Duplicate class")); | 
|---|
|  | 75 | #endif | 
|---|
| [295] | 76 | dataobj_adapter oba; | 
|---|
|  | 77 | oba.obj = o; | 
|---|
|  | 78 | oba.obja = oa; | 
|---|
|  | 79 | objadaplist.push_back(oba); | 
|---|
|  | 80 | } | 
|---|
| [165] | 81 |  | 
|---|
| [295] | 82 | /* --Methode-- */ | 
|---|
|  | 83 | NObjMgrAdapter* Services2NObjMgr::GetAdapter(AnyDataObj* o) | 
|---|
|  | 84 | { | 
|---|
|  | 85 | ObjAdaptList::iterator it; | 
|---|
|  | 86 | for(it = objadaplist.begin(); it != objadaplist.end(); it++) | 
|---|
|  | 87 | if (typeid(*o) == typeid(*((*it).obj)))  return((*it).obja->Clone(o)); | 
|---|
|  | 88 | return(new NObjMgrAdapter(o)); | 
|---|
|  | 89 | } | 
|---|
| [165] | 90 |  | 
|---|
| [295] | 91 | /* --Methode-- */ | 
|---|
| [1276] | 92 | void Services2NObjMgr::SetTmpDir(string const & tmpdir) | 
|---|
|  | 93 | { | 
|---|
|  | 94 | TmpDir = tmpdir; | 
|---|
|  | 95 | PDynLinkMgr::SetTmpDir(tmpdir); | 
|---|
|  | 96 | return; | 
|---|
|  | 97 | } | 
|---|
|  | 98 |  | 
|---|
|  | 99 | /* --Methode-- */ | 
|---|
| [333] | 100 | void Services2NObjMgr::PlotFunc(string const & expfunc, string & nom, double xmin, double xmax, int np, string dopt) | 
|---|
| [295] | 101 | { | 
|---|
| [165] | 102 | FILE *fip; | 
|---|
| [326] | 103 | string fname = TmpDir + "func1_pia_dl.c"; | 
|---|
|  | 104 | string  cmd; | 
|---|
|  | 105 | int rc; | 
|---|
|  | 106 |  | 
|---|
|  | 107 | if (!mImgapp)  return; | 
|---|
|  | 108 |  | 
|---|
|  | 109 | cmd = "rm -f " + fname; | 
|---|
|  | 110 | rc = system(cmd.c_str()); | 
|---|
|  | 111 | // printf("PlotFunc_Do> %s  (Rc=%d)\n", cmd.c_str(), rc); | 
|---|
|  | 112 |  | 
|---|
|  | 113 | if ((fip = fopen(fname.c_str(), "w")) == NULL)   { | 
|---|
|  | 114 | string sn = fname; | 
|---|
| [449] | 115 | cout << "Services2NObjMgr/PlotFunc_Error: fopen( " << sn << endl; | 
|---|
| [326] | 116 | return; | 
|---|
|  | 117 | } | 
|---|
|  | 118 |  | 
|---|
|  | 119 | // constitution du fichier a compiler | 
|---|
|  | 120 | fputs("#include <math.h> \n", fip); | 
|---|
|  | 121 | fputs("double func1_pia_dl_func(double x) \n{\n", fip); | 
|---|
|  | 122 | fprintf(fip,"return(%s); \n}\n", expfunc.c_str()); | 
|---|
|  | 123 | fclose(fip); | 
|---|
|  | 124 |  | 
|---|
|  | 125 | string func = "func1_pia_dl_func"; | 
|---|
|  | 126 | DlFunctionOfX f = (DlFunctionOfX) LinkFunctionFromFile(fname, func); | 
|---|
|  | 127 | if (!f) return; | 
|---|
| [333] | 128 | PlotFunc(f, nom, xmin, xmax, np, dopt); | 
|---|
| [326] | 129 | CloseDLL(); | 
|---|
|  | 130 | return; | 
|---|
|  | 131 | } | 
|---|
|  | 132 |  | 
|---|
|  | 133 | /* --Methode-- */ | 
|---|
| [333] | 134 | void Services2NObjMgr::PlotFunc2D(string const & expfunc, string & nom, double xmin, double xmax, | 
|---|
|  | 135 | double ymin, double ymax, int npx, int npy, string dopt) | 
|---|
| [326] | 136 | { | 
|---|
|  | 137 | FILE *fip; | 
|---|
|  | 138 | string fname = TmpDir + "func2_pia_dl.c"; | 
|---|
|  | 139 | string cmd; | 
|---|
|  | 140 | int rc; | 
|---|
|  | 141 |  | 
|---|
|  | 142 | if (!mImgapp)  return; | 
|---|
|  | 143 |  | 
|---|
|  | 144 | cmd = "rm " + fname; | 
|---|
|  | 145 | rc = system(cmd.c_str()); | 
|---|
|  | 146 | // printf("PlotFunc2D_Do> %s  (Rc=%d)\n", cmd.c_str(), rc); | 
|---|
|  | 147 |  | 
|---|
|  | 148 | if ((fip = fopen(fname.c_str(), "w")) == NULL)   { | 
|---|
|  | 149 | string sn = fname; | 
|---|
| [449] | 150 | cout << "Services2NObjMgr/PlotFunc2D_Error:  fopen( " << sn << endl; | 
|---|
| [326] | 151 | return; | 
|---|
|  | 152 | } | 
|---|
|  | 153 |  | 
|---|
|  | 154 | // constitution du fichier a compiler | 
|---|
|  | 155 | fputs("#include <math.h> \n", fip); | 
|---|
|  | 156 | fputs("double func2_pia_dl_func(double x, double y) \n{\n", fip); | 
|---|
|  | 157 | fprintf(fip,"return(%s); \n}\n", expfunc.c_str()); | 
|---|
|  | 158 | fclose(fip); | 
|---|
|  | 159 |  | 
|---|
|  | 160 | string func = "func2_pia_dl_func"; | 
|---|
|  | 161 | DlFunctionOfXY f = (DlFunctionOfXY) LinkFunctionFromFile(fname, func); | 
|---|
|  | 162 | if (!f)  return; | 
|---|
| [333] | 163 | PlotFunc2D(f, nom, xmin, xmax, ymin, ymax, npx, npy, dopt); | 
|---|
| [326] | 164 | CloseDLL(); | 
|---|
|  | 165 | return; | 
|---|
|  | 166 | } | 
|---|
|  | 167 |  | 
|---|
|  | 168 | /* --Methode-- */ | 
|---|
| [333] | 169 | void Services2NObjMgr::PlotFuncFrCFile(string const & fname, string const & func, string & nom, | 
|---|
|  | 170 | double xmin, double xmax, int np, string dopt) | 
|---|
| [326] | 171 | { | 
|---|
|  | 172 | DlFunctionOfX f = (DlFunctionOfX) LinkFunctionFromFile(fname, func); | 
|---|
|  | 173 | if (!f) return; | 
|---|
| [333] | 174 | PlotFunc(f, nom, xmin, xmax, np, dopt); | 
|---|
| [326] | 175 | CloseDLL(); | 
|---|
|  | 176 | return; | 
|---|
|  | 177 | } | 
|---|
|  | 178 |  | 
|---|
|  | 179 | /* --Methode-- */ | 
|---|
| [333] | 180 | void Services2NObjMgr::PlotFunc2DFrCFile(string const & fname, string const & func, string & nom, | 
|---|
|  | 181 | double xmin, double xmax, double ymin, double ymax, int npx, int npy, string dopt) | 
|---|
| [326] | 182 | { | 
|---|
|  | 183 | DlFunctionOfXY f = (DlFunctionOfXY) LinkFunctionFromFile(fname, func); | 
|---|
|  | 184 | if (!f)  return; | 
|---|
| [333] | 185 | PlotFunc2D(f, nom, xmin, xmax, ymin, ymax, npx, npy, dopt); | 
|---|
| [326] | 186 | CloseDLL(); | 
|---|
|  | 187 | return; | 
|---|
|  | 188 | } | 
|---|
|  | 189 |  | 
|---|
|  | 190 | /* --Methode-- */ | 
|---|
| [333] | 191 | void Services2NObjMgr::PlotFunc(DlFunctionOfX f, string & nom, double xmin, double xmax, int np, string dopt) | 
|---|
| [326] | 192 | { | 
|---|
|  | 193 | if (!mImgapp)  return; | 
|---|
|  | 194 |  | 
|---|
|  | 195 | int k; | 
|---|
|  | 196 | if (np < 1) np = 1; | 
|---|
|  | 197 | if (xmax <= xmin) xmax = xmin+1.; | 
|---|
|  | 198 | Vector* vpy = new Vector(np); | 
|---|
|  | 199 |  | 
|---|
|  | 200 | double xx; | 
|---|
|  | 201 | double dx = (xmax-xmin)/np; | 
|---|
| [500] | 202 |  | 
|---|
|  | 203 | try { | 
|---|
|  | 204 | for(k=0; k<np; k++) { xx = xmin+dx*k; (*vpy)(k) = f(xx); } | 
|---|
|  | 205 | } | 
|---|
| [495] | 206 | #ifdef SANS_EVOLPLANCK | 
|---|
| [500] | 207 | CATCH(merr) { | 
|---|
| [326] | 208 | fflush(stdout); | 
|---|
|  | 209 | cout << endl; | 
|---|
|  | 210 | cerr << endl; | 
|---|
|  | 211 | string es = PeidaExc(merr); | 
|---|
|  | 212 | cerr << "Services2NObjMgr::PlotFunc()  Exception :" << merr << es; | 
|---|
|  | 213 | delete vpy; | 
|---|
|  | 214 | vpy = NULL; | 
|---|
|  | 215 | } ENDTRY; | 
|---|
| [495] | 216 | #else | 
|---|
|  | 217 | catch ( PException exc ) { | 
|---|
|  | 218 | fflush(stdout); | 
|---|
|  | 219 | cout << endl; | 
|---|
|  | 220 | cerr << endl; | 
|---|
|  | 221 | cerr << "Services2NObjMgr::PlotFunc()  Exception :"  << exc.Msg() << endl; | 
|---|
|  | 222 | delete vpy; | 
|---|
|  | 223 | vpy = NULL; | 
|---|
|  | 224 | } | 
|---|
|  | 225 | #endif | 
|---|
| [326] | 226 |  | 
|---|
|  | 227 | if (vpy) { | 
|---|
| [344] | 228 | string titre; | 
|---|
|  | 229 | if (nom.length() < 1) { | 
|---|
|  | 230 | titre = "Function f(x)"; | 
|---|
| [466] | 231 | nom = "/autoc/f_x"; | 
|---|
| [344] | 232 | } | 
|---|
|  | 233 | else titre = nom; | 
|---|
|  | 234 |  | 
|---|
|  | 235 | P1DArrayAdapter* vya = new POVectorAdapter(vpy, false); | 
|---|
| [326] | 236 | vya->DefineXCoordinate(xmin, (xmax-xmin)/np); | 
|---|
|  | 237 | PIYfXDrawer* dr = new   PIYfXDrawer(vya, NULL, true) ; | 
|---|
| [1971] | 238 | dopt = "thinline " + dopt; | 
|---|
|  | 239 | int rsid = mImgapp->DispScDrawer(dr, titre, dopt); | 
|---|
| [333] | 240 | if (nom.length() > 0) { | 
|---|
| [2491] | 241 | MyObjMgr()->AddObj(vpy, nom); | 
|---|
|  | 242 | MyObjMgr()->AddWRsId(nom, rsid); | 
|---|
| [333] | 243 | } | 
|---|
| [326] | 244 | } | 
|---|
|  | 245 | return; | 
|---|
|  | 246 | } | 
|---|
|  | 247 |  | 
|---|
|  | 248 | /* --Methode-- */ | 
|---|
| [333] | 249 | void Services2NObjMgr::PlotFunc2D(DlFunctionOfXY f, string & nom, double xmin, double xmax, double ymin, double ymax, | 
|---|
| [326] | 250 | int npx, int npy, string dopt) | 
|---|
|  | 251 | { | 
|---|
|  | 252 | if (!mImgapp)  return; | 
|---|
|  | 253 |  | 
|---|
|  | 254 | if (npx < 3) npx = 3; | 
|---|
|  | 255 | if (npy < 3) npy = 3; | 
|---|
|  | 256 | if (npx > 250) npx = 250; | 
|---|
|  | 257 | if (npy > 250) npy = 250; | 
|---|
|  | 258 | if (xmax <= xmin) xmax = xmin+1.; | 
|---|
|  | 259 | if (ymax <= ymin) ymax = ymin+1.; | 
|---|
|  | 260 |  | 
|---|
|  | 261 | Matrix* mtx = new Matrix(npy, npx); | 
|---|
|  | 262 |  | 
|---|
|  | 263 | int i,j; | 
|---|
|  | 264 | double xx, yy; | 
|---|
|  | 265 | double dx = (xmax-xmin)/npx; | 
|---|
|  | 266 | double dy = (ymax-ymin)/npy; | 
|---|
|  | 267 | // printf(" -- DBG -- %d %d , %g %g , %g %g \n", npx, npy, xmin, xmax, ymin, ymax); | 
|---|
| [500] | 268 | try { | 
|---|
| [326] | 269 | for(j=0; j<npy; j++) { | 
|---|
|  | 270 | yy = ymin+dy*j; | 
|---|
|  | 271 | for(i=0; i<npx; i++) { | 
|---|
|  | 272 | xx = xmin+dx*i; | 
|---|
|  | 273 | (*mtx)(j, i) = f(xx, yy); | 
|---|
|  | 274 | } | 
|---|
|  | 275 | } | 
|---|
| [500] | 276 | } | 
|---|
|  | 277 | #ifdef SANS_EVOLPLANCK | 
|---|
|  | 278 | CATCH(merr) { | 
|---|
| [326] | 279 | fflush(stdout); | 
|---|
|  | 280 | cout << endl; | 
|---|
|  | 281 | cerr << endl; | 
|---|
|  | 282 | string es = PeidaExc(merr); | 
|---|
|  | 283 | cerr << "Services2NObjMgr::PlotFunc2D()  Exception :" << merr << es; | 
|---|
|  | 284 | delete mtx;  mtx = NULL; | 
|---|
|  | 285 | } ENDTRY; | 
|---|
| [495] | 286 | #else | 
|---|
|  | 287 | catch ( PException exc ) { | 
|---|
|  | 288 | fflush(stdout); | 
|---|
|  | 289 | cout << endl; | 
|---|
|  | 290 | cerr << endl; | 
|---|
|  | 291 | cerr << "Services2NObjMgr::PlotFunc2D()  Exception :"  << exc.Msg() << endl; | 
|---|
|  | 292 | delete mtx;  mtx = NULL; | 
|---|
|  | 293 | } | 
|---|
|  | 294 | #endif | 
|---|
| [326] | 295 |  | 
|---|
|  | 296 | if (mtx) { | 
|---|
| [344] | 297 | string titre; | 
|---|
|  | 298 | if (nom.length() < 1) { | 
|---|
|  | 299 | titre = "Function f(x,y)"; | 
|---|
| [466] | 300 | nom = "/autoc/f2d_xy"; | 
|---|
| [344] | 301 | } | 
|---|
|  | 302 | else titre = nom; | 
|---|
|  | 303 | P2DArrayAdapter* arr = new POMatrixAdapter(mtx, false); | 
|---|
| [326] | 304 | arr->DefineXYCoordinates(xmin, ymin, dx, dy); | 
|---|
|  | 305 | PISurfaceDrawer* sdr = new PISurfaceDrawer(arr, true, true, true); | 
|---|
| [1971] | 306 | int rsid = mImgapp->Disp3DDrawer(sdr, titre, dopt); | 
|---|
| [333] | 307 | if (nom.length() > 0)  { | 
|---|
| [2491] | 308 | MyObjMgr()->AddObj(mtx, nom); | 
|---|
|  | 309 | MyObjMgr()->AddWRsId(nom, rsid); | 
|---|
| [333] | 310 | } | 
|---|
| [326] | 311 | } | 
|---|
|  | 312 |  | 
|---|
|  | 313 | return; | 
|---|
|  | 314 | } | 
|---|
|  | 315 |  | 
|---|
|  | 316 | /* --Methode-- */ | 
|---|
| [2180] | 317 | void Services2NObjMgr::ExpVal(string expval,string resultvarname) | 
|---|
|  | 318 | { | 
|---|
|  | 319 | // Fill C-file to be executed | 
|---|
|  | 320 | FILE *fip; | 
|---|
|  | 321 | string func = "eval_pia_dl_func"; | 
|---|
|  | 322 | string fname = TmpDir + func; fname += ".c"; | 
|---|
|  | 323 | string  cmd = "rm -f " + fname; system(cmd.c_str()); | 
|---|
|  | 324 | if((fip=fopen(fname.c_str(), "w"))==NULL) { | 
|---|
|  | 325 | cout << "Services2NObjMgr/EvalExp_Error: fopen("<<fname<<")"<<endl; | 
|---|
|  | 326 | return; | 
|---|
|  | 327 | } | 
|---|
|  | 328 | fprintf(fip,"#include <math.h>\n"); | 
|---|
|  | 329 | fprintf(fip,"double %s(double ___dummy_variable___) \n{\n",func.c_str()); | 
|---|
|  | 330 | // Add all variables already declared | 
|---|
| [2491] | 331 | DVList& varlist = MyObjMgr()->GetVarList(); | 
|---|
| [2180] | 332 | DVList::ValList::const_iterator it; | 
|---|
|  | 333 | for(it = varlist.Begin(); it != varlist.End(); it++) { | 
|---|
|  | 334 | #ifdef SANS_EVOLPLANCK | 
|---|
|  | 335 | MuTyV mtv = (*it).second; | 
|---|
|  | 336 | double value = (double)(mtv); | 
|---|
|  | 337 | #else | 
|---|
|  | 338 | double value = (double)((*it).second.elval); | 
|---|
|  | 339 | #endif | 
|---|
|  | 340 | string name_var = (*it).first; | 
|---|
|  | 341 | fprintf(fip,"double %s = %.17f;\n",name_var.c_str(),value); | 
|---|
|  | 342 | } | 
|---|
|  | 343 | fprintf(fip,"return %s;\n}\n",expval.c_str()); | 
|---|
|  | 344 | fclose(fip); | 
|---|
|  | 345 |  | 
|---|
|  | 346 | // Dynamically link function | 
|---|
|  | 347 | DlFunctionOfX f = (DlFunctionOfX) LinkFunctionFromFile(fname,func); | 
|---|
|  | 348 | if(!f) { | 
|---|
|  | 349 | cout<<"Services2NObjMgr/EvalExp_Error: linking DlFunctionOfX"<<endl; | 
|---|
|  | 350 | cout<<"...expval = "<<expval<<endl; | 
|---|
|  | 351 | return; | 
|---|
|  | 352 | } | 
|---|
|  | 353 |  | 
|---|
|  | 354 | // Evaluate function and close dynamic link | 
|---|
|  | 355 | double result; | 
|---|
|  | 356 | try { | 
|---|
|  | 357 | result = f(0.); | 
|---|
|  | 358 | CloseDLL(); | 
|---|
|  | 359 | } catch ( ... ) { | 
|---|
|  | 360 | cout<<"Services2NObjMgr/EvalExp_Error: Arithmetic exception"<<endl; | 
|---|
|  | 361 | CloseDLL(); | 
|---|
|  | 362 | return; | 
|---|
|  | 363 | } | 
|---|
|  | 364 |  | 
|---|
|  | 365 | // Eventually store the result into variable or just print it | 
|---|
|  | 366 | if(resultvarname.size()>0) { | 
|---|
| [2491] | 367 | if(MyObjMgr()->HasVar(resultvarname)) MyObjMgr()->DeleteVar(resultvarname); | 
|---|
| [2180] | 368 | char str[512]; | 
|---|
|  | 369 | if(result==0.) sprintf(str,"%f",result); | 
|---|
|  | 370 | else { | 
|---|
|  | 371 | double lr = log10(fabs(result)); | 
|---|
|  | 372 | if(lr>-17. && lr<17.) sprintf(str,"%17f",result); | 
|---|
|  | 373 | else                   sprintf(str,"%.17e",result); | 
|---|
|  | 374 | } | 
|---|
| [2491] | 375 | MyObjMgr()->SetVar(resultvarname,(string)str); | 
|---|
| [2180] | 376 | } else cout<<result<<" = "<<expval<<endl; | 
|---|
|  | 377 |  | 
|---|
|  | 378 | } | 
|---|
|  | 379 |  | 
|---|
|  | 380 | /* --Methode-- */ | 
|---|
| [333] | 381 | void Services2NObjMgr::DisplayPoints2D(string& nom,  string& expx, string& expy, | 
|---|
|  | 382 | string& experrx, string& experry, | 
|---|
| [357] | 383 | string& expcut, string dopt, string loop) | 
|---|
| [333] | 384 | { | 
|---|
|  | 385 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 386 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [333] | 387 | if (obja == NULL) { | 
|---|
| [449] | 388 | cout << "Services2NObjMgr::DisplayPoints2D() Error , No such object " << nom << endl; | 
|---|
| [333] | 389 | return; | 
|---|
|  | 390 | } | 
|---|
|  | 391 | if (!mImgapp)  return; | 
|---|
|  | 392 |  | 
|---|
|  | 393 | // Creation NTuple | 
|---|
|  | 394 | char* ntn[4] = {"expx","expy","expex","expey",}; | 
|---|
|  | 395 | NTuple* nt = NULL; | 
|---|
|  | 396 | bool haserr = false; | 
|---|
|  | 397 |  | 
|---|
|  | 398 | if ( (experrx.length() > 0 ) && (experry.length() > 0 ) ) {  haserr = true;   nt = new NTuple(4, ntn); } | 
|---|
|  | 399 | else {  haserr = false;  experrx = experry = "0."; nt = new NTuple(2, ntn); } | 
|---|
|  | 400 |  | 
|---|
| [357] | 401 | ComputeExpressions(obja, expx, expy, experrx, experry, expcut, loop, nt, NULL, NULL); | 
|---|
| [333] | 402 |  | 
|---|
|  | 403 | if (nt->NEntry() < 1) { | 
|---|
|  | 404 | cout << "Services2NObjMgr::DisplayPoints2D() Warning  Zero points satisfy cut !" << endl; | 
|---|
|  | 405 | delete nt; | 
|---|
|  | 406 | return; | 
|---|
|  | 407 | } | 
|---|
|  | 408 |  | 
|---|
|  | 409 | // nt->Show(); | 
|---|
|  | 410 | // nt->Print(0,10); | 
|---|
|  | 411 | PINTuple* pin = new PINTuple(nt, true); | 
|---|
|  | 412 | pin->SelectXY(ntn[0], ntn[1]); | 
|---|
|  | 413 | if ( haserr ) pin->SelectErrBar(ntn[2], ntn[3]); | 
|---|
|  | 414 |  | 
|---|
| [1971] | 415 | dopt = "defline " + dopt; | 
|---|
| [333] | 416 | string titre =  nom + ":" + expy + "%" + expx; | 
|---|
| [1971] | 417 | mImgapp->DispScDrawer( (PIDrawer*)pin, titre, dopt); | 
|---|
| [333] | 418 | return; | 
|---|
|  | 419 | } | 
|---|
|  | 420 |  | 
|---|
|  | 421 | /* --Methode-- */ | 
|---|
|  | 422 | void Services2NObjMgr::DisplayPoints3D(string& nom,  string& expx, string& expy, | 
|---|
| [357] | 423 | string& expz, string& expcut, string dopt, string loop) | 
|---|
| [333] | 424 | { | 
|---|
|  | 425 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 426 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [333] | 427 | if (obja == NULL) { | 
|---|
| [449] | 428 | cout << "Services2NObjMgr::DisplayPoints3D() Error , No such object " << nom << endl; | 
|---|
| [333] | 429 | return; | 
|---|
|  | 430 | } | 
|---|
|  | 431 | if (!mImgapp)  return; | 
|---|
|  | 432 |  | 
|---|
|  | 433 | char* ntn[3] = {"expx","expy","expz"}; | 
|---|
|  | 434 | NTuple* nt = new NTuple(3,ntn);  // Creation NTuple | 
|---|
|  | 435 |  | 
|---|
|  | 436 | string expwt = "1."; | 
|---|
| [357] | 437 | ComputeExpressions(obja, expx, expy, expz, expwt, expcut, loop, nt, NULL, NULL); | 
|---|
| [333] | 438 |  | 
|---|
|  | 439 | if (nt->NEntry() < 1) { | 
|---|
|  | 440 | cout << "Services2NObjMgr::DisplayPoints3D() Warning  Zero points satisfy cut !" << endl; | 
|---|
|  | 441 | delete nt; | 
|---|
|  | 442 | return; | 
|---|
|  | 443 | } | 
|---|
| [2494] | 444 | //DBG nt->Show(); | 
|---|
|  | 445 | //DBG nt->Print(0,10); | 
|---|
| [333] | 446 | PINTuple3D* pin = new PINTuple3D(nt, true); | 
|---|
|  | 447 | pin->SelectXYZ(ntn[0], ntn[1], ntn[2]); | 
|---|
| [1971] | 448 | dopt = "defline " + dopt; | 
|---|
| [333] | 449 |  | 
|---|
|  | 450 | // Pour plot a partir de DispScDrawer | 
|---|
|  | 451 | // string nomdisp = "_NT3D_"; | 
|---|
|  | 452 | // mImgapp->DispScDrawer( (PIDrawer*)pin, nomdisp, opt); | 
|---|
|  | 453 | // Pour plot a partir de Disp3DDrawer | 
|---|
|  | 454 | string titre =  nom + ":" + expy + "%" + expx; | 
|---|
| [1971] | 455 | mImgapp->Disp3DDrawer(pin, titre, dopt); | 
|---|
| [333] | 456 |  | 
|---|
|  | 457 | return; | 
|---|
|  | 458 | } | 
|---|
|  | 459 |  | 
|---|
|  | 460 | /* --Methode-- */ | 
|---|
|  | 461 | void Services2NObjMgr::DisplayPoints2DW(string& nom, string& expx, string& expy, | 
|---|
| [357] | 462 | string& expwt, string& expcut, string dopt, string loop) | 
|---|
| [333] | 463 | { | 
|---|
|  | 464 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 465 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [333] | 466 | if (obja == NULL) { | 
|---|
| [449] | 467 | cout << "Services2NObjMgr::DisplayPoints2DW() Error , No such object " << nom << endl; | 
|---|
| [333] | 468 | return; | 
|---|
|  | 469 | } | 
|---|
|  | 470 | if (!mImgapp)  return; | 
|---|
|  | 471 |  | 
|---|
|  | 472 | char* ntn[3] = {"expx","expy","expw"}; | 
|---|
|  | 473 | NTuple* nt = new NTuple(3,ntn);  // Creation NTuple | 
|---|
|  | 474 |  | 
|---|
|  | 475 | string exp = "1."; | 
|---|
| [357] | 476 | ComputeExpressions(obja, expx, expy, expwt, exp, expcut, loop, nt, NULL, NULL); | 
|---|
| [333] | 477 |  | 
|---|
|  | 478 | if (nt->NEntry() < 1) { | 
|---|
|  | 479 | cout << "Services2NObjMgr::DisplayPoints2DW() Warning  Zero points satisfy cut !" << endl; | 
|---|
|  | 480 | delete nt; | 
|---|
|  | 481 | return; | 
|---|
|  | 482 | } | 
|---|
|  | 483 |  | 
|---|
|  | 484 | PINTuple* pin = new PINTuple(nt, true); | 
|---|
|  | 485 | pin->SelectXY(ntn[0], ntn[1]); | 
|---|
|  | 486 | pin->SelectWt(ntn[2]); | 
|---|
|  | 487 |  | 
|---|
|  | 488 | string titre =  nom + ":" + expwt + "_" + expy + "%" + expx ; | 
|---|
| [1971] | 489 | mImgapp->DispScDrawer( (PIDrawer*)pin, titre, dopt); | 
|---|
| [333] | 490 | return; | 
|---|
|  | 491 | } | 
|---|
|  | 492 |  | 
|---|
|  | 493 | /* --Methode-- */ | 
|---|
|  | 494 | void Services2NObjMgr::ProjectH1(string& nom, string& expx, string& expwt, | 
|---|
| [357] | 495 | string& expcut, string& nomh1, string dopt, string loop) | 
|---|
| [333] | 496 | { | 
|---|
|  | 497 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 498 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [333] | 499 | if (obja == NULL) { | 
|---|
| [449] | 500 | cout << "Services2NObjMgr::ProjectH1() Error , No such object " << nom << endl; | 
|---|
| [333] | 501 | return; | 
|---|
|  | 502 | } | 
|---|
|  | 503 | if (!mImgapp)  return; | 
|---|
|  | 504 |  | 
|---|
|  | 505 | Histo* h1 = NULL; | 
|---|
|  | 506 | NTuple* nt = NULL; | 
|---|
|  | 507 | AnyDataObj* oh = NULL; | 
|---|
| [2491] | 508 | if (nomh1.length() > 0) oh=MyObjMgr()->GetObj(nomh1); | 
|---|
| [333] | 509 | else nomh1 = "/tmp/projh1d"; | 
|---|
|  | 510 | if ( (oh != NULL) && (typeid(*oh) == typeid(Histo)) )  h1 = (Histo*)oh;  // Pas de remise a zero ! h1->Zero(); | 
|---|
|  | 511 | else { | 
|---|
|  | 512 | char* ntn[2]= {"hxval", "hwt"}; | 
|---|
|  | 513 | nt = new NTuple(2,ntn);  // Creation NTuple | 
|---|
|  | 514 | } | 
|---|
|  | 515 | string expz = "0."; | 
|---|
| [357] | 516 | ComputeExpressions(obja, expx, expwt, expz, expwt, expcut, loop, nt, h1, NULL); | 
|---|
| [333] | 517 |  | 
|---|
|  | 518 | if ((!h1) && (!nt)) return; | 
|---|
|  | 519 | if (!h1) { | 
|---|
|  | 520 | if (nt->NEntry() < 1) { | 
|---|
|  | 521 | cout << "Services2NObjMgr::ProjectH1() Warning  Zero points satisfy cut !" << endl; | 
|---|
|  | 522 | delete nt; | 
|---|
|  | 523 | return; | 
|---|
|  | 524 | } | 
|---|
|  | 525 | double xmin, xmax; | 
|---|
|  | 526 | nt->GetMinMax(0, xmin, xmax); | 
|---|
|  | 527 | h1 = new Histo(xmin, xmax, 100); | 
|---|
|  | 528 | int k; | 
|---|
|  | 529 | float* xn; | 
|---|
|  | 530 | for(k=0; k<nt->NEntry(); k++)    { | 
|---|
|  | 531 | xn = nt->GetVec(k); | 
|---|
|  | 532 | h1->Add(xn[0], xn[1]); | 
|---|
|  | 533 | } | 
|---|
|  | 534 | delete nt; | 
|---|
| [2491] | 535 | MyObjMgr()->AddObj(h1, nomh1); | 
|---|
| [333] | 536 | } | 
|---|
|  | 537 |  | 
|---|
| [2491] | 538 | MyObjMgr()->DisplayObj(nomh1, dopt); | 
|---|
| [333] | 539 | return; | 
|---|
|  | 540 | } | 
|---|
|  | 541 |  | 
|---|
|  | 542 | /* --Methode-- */ | 
|---|
|  | 543 | void Services2NObjMgr::ProjectH2(string& nom, string& expx, string& expy, string& expwt, | 
|---|
| [357] | 544 | string& expcut, string& nomh2, string dopt, string loop) | 
|---|
| [333] | 545 | { | 
|---|
|  | 546 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 547 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [333] | 548 | if (obja == NULL) { | 
|---|
| [449] | 549 | cout << "Services2NObjMgr::ProjectH2() Error , No such object " << nom << endl; | 
|---|
| [333] | 550 | return; | 
|---|
|  | 551 | } | 
|---|
|  | 552 | if (!mImgapp)  return; | 
|---|
|  | 553 |  | 
|---|
|  | 554 | Histo2D* h2 = NULL; | 
|---|
|  | 555 | NTuple* nt = NULL; | 
|---|
|  | 556 | AnyDataObj* oh = NULL; | 
|---|
| [2491] | 557 | if (nomh2.length() > 0)  oh=MyObjMgr()->GetObj(nomh2); | 
|---|
| [333] | 558 | else nomh2 = "/tmp/projh2d"; | 
|---|
|  | 559 | if ( (oh != NULL) && (typeid(*oh) == typeid(Histo2D)) )  h2 = (Histo2D*)oh;  // Pas de remise a zero ! h2->Zero(); | 
|---|
|  | 560 | else { | 
|---|
|  | 561 | char* ntn[3]= {"hxval", "hyval", "hwt"}; | 
|---|
|  | 562 | nt = new NTuple(3,ntn);  // Creation NTuple | 
|---|
|  | 563 | } | 
|---|
|  | 564 | string expz = "0."; | 
|---|
| [357] | 565 | ComputeExpressions(obja, expx, expy, expwt, expwt, expcut, loop, nt, NULL, h2); | 
|---|
| [333] | 566 |  | 
|---|
|  | 567 | if ((!h2) && (!nt)) return; | 
|---|
|  | 568 | if (!h2) { | 
|---|
|  | 569 | if (nt->NEntry() < 1) { | 
|---|
|  | 570 | cout << "Services2NObjMgr::ProjectH2() Warning  Zero points satisfy cut !" << endl; | 
|---|
|  | 571 | delete nt; | 
|---|
|  | 572 | return; | 
|---|
|  | 573 | } | 
|---|
|  | 574 | double xmin, xmax, ymin, ymax; | 
|---|
|  | 575 | nt->GetMinMax(0, xmin, xmax); | 
|---|
| [466] | 576 | nt->GetMinMax(1, ymin, ymax); | 
|---|
| [333] | 577 | h2 = new Histo2D(xmin, xmax, 50, ymin, ymax, 50); | 
|---|
|  | 578 | int k; | 
|---|
|  | 579 | float* xn; | 
|---|
|  | 580 | for(k=0; k<nt->NEntry(); k++)    { | 
|---|
|  | 581 | xn = nt->GetVec(k); | 
|---|
|  | 582 | h2->Add(xn[0], xn[1], xn[2]); | 
|---|
|  | 583 | } | 
|---|
|  | 584 | delete nt; | 
|---|
| [2491] | 585 | MyObjMgr()->AddObj(h2, nomh2); | 
|---|
| [333] | 586 | } | 
|---|
|  | 587 |  | 
|---|
| [2491] | 588 | MyObjMgr()->DisplayObj(nomh2, dopt); | 
|---|
| [333] | 589 | return; | 
|---|
|  | 590 |  | 
|---|
|  | 591 | } | 
|---|
|  | 592 |  | 
|---|
|  | 593 | /* --Methode-- cmv 13/10/98 */ | 
|---|
|  | 594 | void Services2NObjMgr::ProjectHProf(string& nom, string& expx, string& expy, string& expwt, | 
|---|
| [357] | 595 | string& expcut, string& nomprof, string dopt, string loop) | 
|---|
|  | 596 | //      Pour remplir un ``GeneralFitData'' a partir de divers objets: | 
|---|
| [333] | 597 | //| nom = nom de l'objet a projeter dans un HProf. | 
|---|
|  | 598 | //| expx = expression X de definition du bin. | 
|---|
|  | 599 | //| expy = expression Y a additionner dans le bin. | 
|---|
|  | 600 | //| expwt = expression W du poids a additionner. | 
|---|
|  | 601 | //| expcut = expression du test de selection. | 
|---|
|  | 602 | //| nomprof = nom du HProf engendre (optionnel). Si l'objet n'existe pas | 
|---|
|  | 603 | //|           les limites Xmin,Xmax sont calculees automatiquement. | 
|---|
|  | 604 | //|           sinon ce sont celles de l'objet preexistant. | 
|---|
|  | 605 | //| opt = options generales pour le display. | 
|---|
|  | 606 | { | 
|---|
|  | 607 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 608 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [333] | 609 | if (obja == NULL) { | 
|---|
| [449] | 610 | cout << "Services2NObjMgr::ProjectHProf() Error , No such object " << nom << endl; | 
|---|
| [333] | 611 | return; | 
|---|
|  | 612 | } | 
|---|
|  | 613 | if (!mImgapp)  return; | 
|---|
|  | 614 |  | 
|---|
|  | 615 | HProf* hprof = NULL; | 
|---|
|  | 616 | NTuple* nt = NULL; | 
|---|
|  | 617 | AnyDataObj* oh = NULL; | 
|---|
| [2491] | 618 | if (nomprof.length() > 0)  oh=MyObjMgr()->GetObj(nomprof); | 
|---|
| [333] | 619 | else nomprof = "/tmp/projprof"; | 
|---|
|  | 620 | if( (oh!=NULL) && (typeid(*oh) == typeid(HProf)) )  hprof = (HProf*)oh; | 
|---|
|  | 621 | else { | 
|---|
|  | 622 | char* ntn[3]= {"hxval", "hyval", "hwt"}; | 
|---|
|  | 623 | nt = new NTuple(3,ntn);  // Creation NTuple | 
|---|
|  | 624 | } | 
|---|
|  | 625 | string expz = "0."; | 
|---|
| [357] | 626 | ComputeExpressions(obja, expx, expy, expwt, expwt, expcut, loop, nt, NULL, NULL, hprof); | 
|---|
| [333] | 627 |  | 
|---|
|  | 628 | if((!hprof) && (!nt)) return; | 
|---|
|  | 629 | if(!hprof) { | 
|---|
|  | 630 | if (nt->NEntry() < 1) { | 
|---|
|  | 631 | cout << "Services2NObjMgr::ProjectHProf() Warning  Zero points satisfy cut !" << endl; | 
|---|
|  | 632 | delete nt; | 
|---|
|  | 633 | return; | 
|---|
|  | 634 | } | 
|---|
| [1091] | 635 | r_8 xmin, xmax; | 
|---|
| [333] | 636 | nt->GetMinMax(0, xmin, xmax); | 
|---|
|  | 637 | hprof = new HProf(xmin, xmax, 100); | 
|---|
|  | 638 | int k; | 
|---|
|  | 639 | float* xn; | 
|---|
|  | 640 | for(k=0; k<nt->NEntry(); k++)    { | 
|---|
|  | 641 | xn = nt->GetVec(k); | 
|---|
|  | 642 | hprof->Add(xn[0], xn[1], xn[2]); | 
|---|
|  | 643 | } | 
|---|
|  | 644 | delete nt; | 
|---|
| [2491] | 645 | MyObjMgr()->AddObj(hprof, nomprof); | 
|---|
| [333] | 646 | } | 
|---|
| [1090] | 647 | hprof->UpdateHisto(); | 
|---|
| [333] | 648 |  | 
|---|
| [2491] | 649 | MyObjMgr()->DisplayObj(nomprof, dopt); | 
|---|
| [333] | 650 | return; | 
|---|
|  | 651 | } | 
|---|
|  | 652 |  | 
|---|
| [357] | 653 |  | 
|---|
| [333] | 654 | /* --Methode-- */ | 
|---|
| [357] | 655 | void Services2NObjMgr::FillVect(string& nom, string& expx, string& expv, | 
|---|
|  | 656 | string& expcut, string& nomvec, string dopt, string loop) | 
|---|
| [333] | 657 | { | 
|---|
|  | 658 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 659 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [333] | 660 | if (obja == NULL) { | 
|---|
| [357] | 661 | cout << "Services2NObjMgr::FillVect() Error , No such object: " << nom << endl; | 
|---|
| [333] | 662 | return; | 
|---|
|  | 663 | } | 
|---|
|  | 664 | if (!mImgapp)  return; | 
|---|
|  | 665 |  | 
|---|
| [357] | 666 | Vector* v1 = NULL; | 
|---|
|  | 667 | AnyDataObj* ov = NULL; | 
|---|
| [2491] | 668 | ov=MyObjMgr()->GetObj(nomvec); | 
|---|
| [357] | 669 | if (ov != NULL) v1 = dynamic_cast<Vector *>(ov); | 
|---|
|  | 670 | if (v1 == NULL) { | 
|---|
|  | 671 | cout << "Services2NObjMgr::FillVect() Error , No such object or not a vector: " << nomvec << endl; | 
|---|
|  | 672 | return; | 
|---|
|  | 673 | } | 
|---|
|  | 674 |  | 
|---|
|  | 675 | char* ntn[2]= {"vi", "vv"}; | 
|---|
|  | 676 | NTuple* nt = new NTuple(2,ntn);  // Creation NTuple | 
|---|
|  | 677 |  | 
|---|
|  | 678 | string expz = "0."; | 
|---|
|  | 679 | ComputeExpressions(obja, expx, expv, expz, expz, expcut, loop, nt); | 
|---|
|  | 680 |  | 
|---|
|  | 681 | if (!nt) return; | 
|---|
|  | 682 | if (nt->NEntry() < 1) { | 
|---|
|  | 683 | cout << "Services2NObjMgr::FillVect() Warning  Zero points satisfy cut !" << endl; | 
|---|
|  | 684 | delete nt; | 
|---|
|  | 685 | return; | 
|---|
|  | 686 | } | 
|---|
|  | 687 |  | 
|---|
|  | 688 | int i,k; | 
|---|
|  | 689 | double* xn; | 
|---|
|  | 690 | for(k=0; k<nt->NEntry(); k++)    { | 
|---|
|  | 691 | xn = nt->GetLineD(k); | 
|---|
| [2180] | 692 | i = int(xn[0]+0.5); | 
|---|
| [357] | 693 | if ( (i < 0) || i >= v1->NElts() ) continue; | 
|---|
|  | 694 | (*v1)(i) = xn[1]; | 
|---|
|  | 695 | } | 
|---|
|  | 696 | delete nt; | 
|---|
|  | 697 |  | 
|---|
|  | 698 |  | 
|---|
| [2491] | 699 | MyObjMgr()->DisplayObj(nomvec, dopt); | 
|---|
| [357] | 700 | return; | 
|---|
|  | 701 | } | 
|---|
|  | 702 |  | 
|---|
|  | 703 | /* --Methode-- */ | 
|---|
|  | 704 | void Services2NObjMgr::FillMatx(string& nom, string& expx, string& expy, string& expv, | 
|---|
|  | 705 | string& expcut, string& nommtx, string dopt, string loop) | 
|---|
|  | 706 | { | 
|---|
|  | 707 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 708 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [357] | 709 | if (obja == NULL) { | 
|---|
|  | 710 | cout << "Services2NObjMgr::FillMatx() Error , No such objet " << nom << endl; | 
|---|
|  | 711 | return; | 
|---|
|  | 712 | } | 
|---|
|  | 713 | if (!mImgapp)  return; | 
|---|
|  | 714 |  | 
|---|
|  | 715 | Matrix* mtx = NULL; | 
|---|
|  | 716 | AnyDataObj* om = NULL; | 
|---|
| [2491] | 717 | om=MyObjMgr()->GetObj(nommtx); | 
|---|
| [357] | 718 | if (om != NULL) mtx = dynamic_cast<Matrix *>(om); | 
|---|
|  | 719 | if (mtx == NULL) { | 
|---|
|  | 720 | cout << "Services2NObjMgr::FillMatx() Error , No such object or not a matrix " << nommtx << endl; | 
|---|
|  | 721 | return; | 
|---|
|  | 722 | } | 
|---|
|  | 723 |  | 
|---|
|  | 724 | char* ntn[3]= {"mi", "mj", "mv"}; | 
|---|
|  | 725 | NTuple* nt = new NTuple(3,ntn);  // Creation NTuple | 
|---|
|  | 726 |  | 
|---|
|  | 727 | string expz = "0."; | 
|---|
|  | 728 | ComputeExpressions(obja, expx, expy, expv, expz, expcut, loop, nt); | 
|---|
|  | 729 |  | 
|---|
|  | 730 | if (!nt) return; | 
|---|
|  | 731 | if (nt->NEntry() < 1) { | 
|---|
|  | 732 | cout << "Services2NObjMgr::FillMatx() Warning  Zero points satisfy cut !" << endl; | 
|---|
|  | 733 | delete nt; | 
|---|
|  | 734 | return; | 
|---|
|  | 735 | } | 
|---|
|  | 736 |  | 
|---|
|  | 737 | int ic, jl, k; | 
|---|
|  | 738 | double* xn; | 
|---|
|  | 739 | for(k=0; k<nt->NEntry(); k++)    { | 
|---|
|  | 740 | xn = nt->GetLineD(k); | 
|---|
| [2180] | 741 | ic = int(xn[0]+0.5); | 
|---|
|  | 742 | jl = int(xn[1]+0.5); | 
|---|
| [357] | 743 | if ( (ic < 0) || ic >= mtx->NCol() ) continue; | 
|---|
|  | 744 | if ( (jl < 0) || jl >= mtx->NRows() ) continue; | 
|---|
|  | 745 | (*mtx)(jl, ic) = xn[2]; | 
|---|
|  | 746 | } | 
|---|
|  | 747 | delete nt; | 
|---|
|  | 748 |  | 
|---|
|  | 749 |  | 
|---|
| [2491] | 750 | MyObjMgr()->DisplayObj(nommtx, dopt); | 
|---|
| [357] | 751 | return; | 
|---|
|  | 752 |  | 
|---|
|  | 753 | } | 
|---|
|  | 754 |  | 
|---|
|  | 755 | /* --Methode-- */ | 
|---|
|  | 756 | void Services2NObjMgr::ExpressionToVector(string& nom, string& expx, string& expcut, | 
|---|
|  | 757 | string& nomvec, string dopt, string loop) | 
|---|
|  | 758 | { | 
|---|
|  | 759 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 760 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [357] | 761 | if (obja == NULL) { | 
|---|
| [449] | 762 | cout << "Services2NObjMgr::ExpressionToVector() Error , No such object " << nom << endl; | 
|---|
| [357] | 763 | return; | 
|---|
|  | 764 | } | 
|---|
|  | 765 | if (!mImgapp)  return; | 
|---|
|  | 766 |  | 
|---|
| [333] | 767 | NTuple* nt = NULL; | 
|---|
| [357] | 768 | if (nomvec.length() < 1) nomvec = "/tmp/expvec"; | 
|---|
| [333] | 769 |  | 
|---|
|  | 770 | char* ntn[2]= {"vecval", "vecwt"}; | 
|---|
|  | 771 | nt = new NTuple(1,ntn);  // Creation NTuple | 
|---|
|  | 772 |  | 
|---|
|  | 773 | string expwt = "1."; | 
|---|
| [1486] | 774 | string expz = "0."; | 
|---|
|  | 775 | string dumexpcut = expcut; if(dumexpcut.size()<=0) dumexpcut = "1."; | 
|---|
|  | 776 | ComputeExpressions(obja,expx,expz,expz,expwt,dumexpcut,loop,nt,NULL,NULL); | 
|---|
| [333] | 777 |  | 
|---|
|  | 778 | if (!nt) return; | 
|---|
|  | 779 | if (nt->NEntry() < 1) { | 
|---|
| [357] | 780 | cout << "Services2NObjMgr::ExpressionToVector() Warning  Zero points satisfy cut !" << endl; | 
|---|
| [333] | 781 | delete nt; | 
|---|
|  | 782 | return; | 
|---|
|  | 783 | } | 
|---|
|  | 784 |  | 
|---|
|  | 785 | Vector* vec = new Vector(nt->NEntry()); | 
|---|
|  | 786 | int k; | 
|---|
|  | 787 | float* xn; | 
|---|
|  | 788 | for(k=0; k<nt->NEntry(); k++)    { | 
|---|
|  | 789 | xn = nt->GetVec(k); | 
|---|
|  | 790 | (*vec)(k) = xn[0]; | 
|---|
|  | 791 | } | 
|---|
|  | 792 | delete nt; | 
|---|
| [2491] | 793 | MyObjMgr()->AddObj(vec, nomvec); | 
|---|
|  | 794 | MyObjMgr()->DisplayObj(nomvec, dopt); | 
|---|
| [333] | 795 | return; | 
|---|
|  | 796 | } | 
|---|
|  | 797 |  | 
|---|
|  | 798 | /* --Methode-- */ | 
|---|
| [447] | 799 | void Services2NObjMgr::NtFromASCIIFile(string& nom,string& filename,double def_val) | 
|---|
|  | 800 | //      Pour remplir un ntuple "nom" existant a partir du fichier | 
|---|
|  | 801 | //      ASCII table "filename". Si il y a plus de variables dans le | 
|---|
|  | 802 | //      ntuple que dans le fichier "filename", | 
|---|
|  | 803 | //      les sur-numeraires sont mises a "def_val" par defaut. | 
|---|
|  | 804 | { | 
|---|
| [2491] | 805 | AnyDataObj* mobj = MyObjMgr()->GetObj(nom); | 
|---|
| [447] | 806 | if(mobj == NULL) | 
|---|
|  | 807 | {cout<<"NtFromASCIIFile() Error, object "<<nom<<" not existing"<<endl; | 
|---|
|  | 808 | return;} | 
|---|
|  | 809 | if(typeid(*mobj) != typeid(NTuple)) | 
|---|
|  | 810 | {cout<<"NtFromASCIIFile() Error, object "<<nom<<" not an NTuple"<<endl; | 
|---|
|  | 811 | return;} | 
|---|
|  | 812 | if (!mImgapp)  return; | 
|---|
|  | 813 |  | 
|---|
|  | 814 | NTuple* nt = (NTuple*) mobj; | 
|---|
| [449] | 815 | nt->FillFromASCIIFile(filename, def_val); | 
|---|
| [447] | 816 | return; | 
|---|
|  | 817 | } | 
|---|
|  | 818 |  | 
|---|
|  | 819 | /* --Methode-- */ | 
|---|
| [333] | 820 | void Services2NObjMgr::FillNT(string& nom, string& expx, string& expy, string& expz, | 
|---|
| [357] | 821 | string& expt, string& expcut, string& nomnt, string loop) | 
|---|
| [333] | 822 | { | 
|---|
|  | 823 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 824 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [333] | 825 | if (obja == NULL) { | 
|---|
| [449] | 826 | cout << "Services2NObjMgr::FillNT() Error , No such object " << nom << endl; | 
|---|
| [333] | 827 | return; | 
|---|
|  | 828 | } | 
|---|
|  | 829 | if (!mImgapp)  return; | 
|---|
|  | 830 |  | 
|---|
|  | 831 | bool fgnnt = false; | 
|---|
|  | 832 | NTuple* nt = NULL; | 
|---|
|  | 833 | AnyDataObj* oh = NULL; | 
|---|
| [2491] | 834 | if (nomnt.length() > 0)  oh=MyObjMgr()->GetObj(nomnt); | 
|---|
| [333] | 835 | else nomnt = "/tmp/fillnt"; | 
|---|
|  | 836 | if ( (oh != NULL) && (typeid(*oh) == typeid(NTuple)) )  { | 
|---|
|  | 837 | nt = (NTuple*)oh; | 
|---|
|  | 838 | if (nt->NVar() > 10) { | 
|---|
| [449] | 839 | cout << "Services2NObjMgr::FillNT() Warning , Max 10 var in NTuple -> new NTuple" << endl; | 
|---|
| [333] | 840 | nt = NULL; | 
|---|
|  | 841 | } | 
|---|
|  | 842 | } | 
|---|
|  | 843 | if (nt == NULL) { | 
|---|
|  | 844 | char* ntn[4]= {"x", "y","z","t"}; | 
|---|
|  | 845 | nt = new NTuple(4,ntn);  // Creation NTuple | 
|---|
|  | 846 | fgnnt = true; | 
|---|
|  | 847 | } | 
|---|
|  | 848 |  | 
|---|
| [357] | 849 | ComputeExpressions(obja, expx, expy, expz, expt, expcut, loop, nt, NULL, NULL); | 
|---|
| [333] | 850 |  | 
|---|
| [2491] | 851 | if (fgnnt) MyObjMgr()->AddObj(nt, nomnt); | 
|---|
| [333] | 852 | return; | 
|---|
|  | 853 |  | 
|---|
|  | 854 | } | 
|---|
|  | 855 |  | 
|---|
|  | 856 | /* --Methode-- */ | 
|---|
|  | 857 | void Services2NObjMgr::FillNTFrCFile(string & nom, string const & fname, | 
|---|
| [357] | 858 | string const & funcname, string & nomnt, string loop) | 
|---|
| [333] | 859 | { | 
|---|
|  | 860 | if (!mImgapp)  return; | 
|---|
|  | 861 |  | 
|---|
|  | 862 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 863 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [333] | 864 | if (obja == NULL) { | 
|---|
|  | 865 | cout << "Services2NObjMgr::FillNTFrCFile( " << nom << "...) No such object" <<endl; | 
|---|
|  | 866 | return; | 
|---|
|  | 867 | } | 
|---|
| [344] | 868 | bool adel = true; | 
|---|
|  | 869 | NTupleInterface* objnt = obja->GetNTupleInterface(adel); | 
|---|
| [333] | 870 | if (objnt == NULL)  { | 
|---|
| [449] | 871 | cout << "Services2NObjMgr::FillNTFrCFile( " << nom << "...) Not an NTupleInterface !" <<endl; | 
|---|
| [333] | 872 | return; | 
|---|
|  | 873 | } | 
|---|
|  | 874 |  | 
|---|
|  | 875 | NTLoopExprFunc f = (NTLoopExprFunc)LinkFunctionFromFile(fname, funcname); | 
|---|
|  | 876 | if (!f) { | 
|---|
|  | 877 | cerr << "Services2NObjMgr::FillNTFrCFile Error Creation  NTLoopExprFunc" <<  endl; | 
|---|
| [344] | 878 | if (adel) delete objnt;   // Delete de l'objet NTupleInterface si necessaire | 
|---|
| [333] | 879 | return; | 
|---|
|  | 880 | } | 
|---|
|  | 881 |  | 
|---|
|  | 882 | bool fgnnt = false; | 
|---|
|  | 883 | NTuple* nt = NULL; | 
|---|
|  | 884 | if (nomnt.length() > 0) { | 
|---|
|  | 885 | AnyDataObj* oh = NULL; | 
|---|
| [2491] | 886 | oh=MyObjMgr()->GetObj(nomnt); | 
|---|
| [333] | 887 | if ( (oh != NULL) && (typeid(*oh) == typeid(NTuple)) )  { | 
|---|
|  | 888 | nt = (NTuple*)oh; | 
|---|
|  | 889 | if (nt->NVar() > 10) { | 
|---|
| [449] | 890 | cout << "Services2NObjMgr::FillNTFrCFile() Warning , Max 10 var in NTuple -> new NTuple" << endl; | 
|---|
| [333] | 891 | nt = NULL; | 
|---|
|  | 892 | } | 
|---|
|  | 893 | } | 
|---|
|  | 894 | if (nt == NULL) { | 
|---|
|  | 895 | char* ntn[4]= {"x", "y","z","t"}; | 
|---|
|  | 896 | nt = new NTuple(4,ntn);  // Creation NTuple | 
|---|
|  | 897 | fgnnt = true; | 
|---|
|  | 898 | } | 
|---|
|  | 899 | } | 
|---|
|  | 900 |  | 
|---|
|  | 901 | double xnt[10]; | 
|---|
|  | 902 | float  fxnt[10]; | 
|---|
|  | 903 |  | 
|---|
|  | 904 | int i,k; | 
|---|
|  | 905 | for(i=0; i<10; i++) fxnt[i] = xnt[i] = 0.; | 
|---|
|  | 906 |  | 
|---|
|  | 907 |  | 
|---|
|  | 908 | // $CHECK$ A virer des que possible  - Pb blocage application quand trop d'impression | 
|---|
|  | 909 | // redirige -    On redirige la sortie sur le terminal | 
|---|
|  | 910 | bool red = mImgapp->HasRedirectedStdOutErr(); | 
|---|
|  | 911 | mImgapp->RedirectStdOutErr(false); | 
|---|
|  | 912 |  | 
|---|
| [2419] | 913 | int_8 k1,k2,dk; | 
|---|
| [357] | 914 | k1 = 0;  k2 = objnt->NbLines();  dk = 1; | 
|---|
|  | 915 | DecodeLoopParameters(loop, k1, k2, dk); | 
|---|
|  | 916 | if (k1 < 0) k1 = 0; | 
|---|
|  | 917 | if (k2 < 0) k2 = objnt->NbLines(); | 
|---|
| [2419] | 918 | if (k2 > (int_8)objnt->NbLines()) k2 = objnt->NbLines(); | 
|---|
| [357] | 919 | if (dk <= 0) dk = 1; | 
|---|
|  | 920 |  | 
|---|
| [500] | 921 | try  { | 
|---|
| [333] | 922 | double* xn; | 
|---|
| [2419] | 923 | int_8 kstart = k1, kend = k2; | 
|---|
|  | 924 | for(k=kstart; k<kend; k+=dk)    { | 
|---|
| [333] | 925 | xn = objnt->GetLineD(k); | 
|---|
| [2419] | 926 | if (f((int_8_exprf)k, xn, xnt, xnt+1, xnt+2, xnt+3, (int_8_exprf)kstart,(int_8_exprf) kend) != 0) { | 
|---|
| [333] | 927 | if (nt) { | 
|---|
| [2419] | 928 | for(int i=0; i<4; i++) fxnt[i] = xnt[i]; | 
|---|
| [333] | 929 | nt->Fill(fxnt); | 
|---|
|  | 930 | } | 
|---|
|  | 931 | } | 
|---|
|  | 932 | } | 
|---|
|  | 933 | } | 
|---|
| [500] | 934 | #ifdef SANS_EVOLPLANCK | 
|---|
| [333] | 935 | CATCH(merr) { | 
|---|
|  | 936 | fflush(stdout); | 
|---|
|  | 937 | cout << endl; | 
|---|
|  | 938 | cerr << endl; | 
|---|
|  | 939 | string es = PeidaExc(merr); | 
|---|
|  | 940 | cerr << "Services2NObjMgr::FillNTFrCFile()  Exception :" << merr << es; | 
|---|
|  | 941 | } ENDTRY; | 
|---|
| [500] | 942 | #else | 
|---|
|  | 943 | catch ( PException exc ) { | 
|---|
|  | 944 | fflush(stdout); | 
|---|
|  | 945 | cout << endl; | 
|---|
|  | 946 | cerr << endl; | 
|---|
|  | 947 | cerr << "Services2NObjMgr::FillNTFrCFile()  Exception :" << exc.Msg() << endl; | 
|---|
|  | 948 | } | 
|---|
|  | 949 | #endif | 
|---|
| [344] | 950 |  | 
|---|
|  | 951 | if (adel) delete objnt;   // Delete de l'objet NTupleInterface si necessaire | 
|---|
| [333] | 952 | CloseDLL(); | 
|---|
|  | 953 |  | 
|---|
|  | 954 | // $CHECK$ A virer des que possible  On redirige la sortie sur la fenetre PIConsole | 
|---|
|  | 955 | mImgapp->RedirectStdOutErr(red); | 
|---|
|  | 956 |  | 
|---|
| [2491] | 957 | if (fgnnt) MyObjMgr()->AddObj(nt, nomnt); | 
|---|
| [333] | 958 | return; | 
|---|
|  | 959 | } | 
|---|
|  | 960 |  | 
|---|
|  | 961 | /* --Methode-- */ | 
|---|
|  | 962 | void Services2NObjMgr::PrepareNTExpressionCFile(string & nom, string const & fname, | 
|---|
|  | 963 | string const & funcname) | 
|---|
|  | 964 | { | 
|---|
|  | 965 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 966 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [333] | 967 | if (obja == NULL) { | 
|---|
|  | 968 | cout << "Services2NObjMgr::PrepareNTExpressionCFile( " << nom << "...) No such object" <<endl; | 
|---|
|  | 969 | return; | 
|---|
|  | 970 | } | 
|---|
| [344] | 971 | bool adel = true; | 
|---|
|  | 972 | NTupleInterface* objnt = obja->GetNTupleInterface(adel); | 
|---|
| [333] | 973 | if (objnt == NULL)  { | 
|---|
|  | 974 | cout << "Services2NObjMgr::PrepareNTExpressionCFile( " << nom | 
|---|
|  | 975 | << "...) No NTupleInterface !" <<endl; | 
|---|
|  | 976 | return; | 
|---|
|  | 977 | } | 
|---|
|  | 978 | string  vardec = objnt->VarList_C("_xnti_"); | 
|---|
|  | 979 |  | 
|---|
|  | 980 | FILE *fip; | 
|---|
|  | 981 | if ((fip = fopen(fname.c_str(), "w")) == NULL)   { | 
|---|
|  | 982 | cout << "Services2NObjMgr::PrepareNTExpressionCFile()_Error: fopen " << fname << endl; | 
|---|
| [344] | 983 | if (adel) delete objnt;   // Delete de l'objet NTupleInterface si necessaire | 
|---|
| [333] | 984 | return; | 
|---|
|  | 985 | } | 
|---|
| [344] | 986 |  | 
|---|
| [333] | 987 | // constitution du fichier des decalarations des variables de l'interface NTuple | 
|---|
|  | 988 | fputs("#include <stdlib.h> \n", fip); | 
|---|
|  | 989 | fputs("#include <stdio.h> \n", fip); | 
|---|
|  | 990 | fputs("#include <math.h> \n\n", fip); | 
|---|
| [344] | 991 |  | 
|---|
| [1469] | 992 | fputs("/* ------ Compare bits on double --------- */ \n", fip); | 
|---|
| [2419] | 993 | fputs("typedef long long int_8_exprf;\n", fip); | 
|---|
|  | 994 | fputs("int_8_exprf BitCmp64(double v,int_8_exprf flg)\n", fip); | 
|---|
|  | 995 | fputs("{return ((int_8_exprf)((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip); | 
|---|
| [344] | 996 | fputs("/* ------ Some random number generators --------- */ \n", fip); | 
|---|
| [1931] | 997 | fputs("#if defined(__ppc__) && defined(__MACH__) \n",fip); | 
|---|
|  | 998 | fputs("#include <limits.h> \n", fip); | 
|---|
|  | 999 | fputs("#define drand48() ((double)(random())/LONG_MAX) \n",fip); | 
|---|
|  | 1000 | fputs("#endif \n",fip); | 
|---|
| [344] | 1001 | fputs("#define frand01() ( (float) drand48() ) \n", fip); | 
|---|
|  | 1002 | fputs("#define drand01() drand48()  \n", fip); | 
|---|
|  | 1003 | fputs("#define rand01()  drand48()  \n", fip); | 
|---|
|  | 1004 | fputs("#define frandpm1() ( 2. * frand01() - 1.) \n", fip); | 
|---|
|  | 1005 | fputs("#define drandpm1() ( 2. * drand01() - 1.) \n", fip); | 
|---|
|  | 1006 | fputs("#define randpm1() ( 2. * drand01() - 1.) \n", fip); | 
|---|
|  | 1007 | fputs("double NorRand(void) \n", fip); | 
|---|
|  | 1008 | fputs(" { \n double x,A,B; \n LAB10: \n A = drand01(); \n", fip); | 
|---|
|  | 1009 | fputs(" if ( A == 0. ) goto LAB10; \n B = drand01(); \n", fip); | 
|---|
| [345] | 1010 | fputs(" x = sqrt(-2.*log(A))*cos(2.*M_PI*B); \n", fip); | 
|---|
| [344] | 1011 | fputs(" return(x); \n } \n", fip); | 
|---|
|  | 1012 | fputs("#define GauRand() NorRand() \n", fip); | 
|---|
|  | 1013 | fputs("#define gaurand() NorRand() \n\n", fip); | 
|---|
|  | 1014 |  | 
|---|
| [2419] | 1015 | fputs("/* NTupleInterface Variable declaration - Generated by piapp    */\n", fip); | 
|---|
|  | 1016 | fputs("/*    -- Services2NObjMgr::PrepareNTExpressionCFile()  --       */ \n", fip); | 
|---|
|  | 1017 | fputs("/* _nl line number or sequential index : _nstart <= _nl < _nend */ \n\n", fip); | 
|---|
|  | 1018 | fprintf(fip,"int %s(int_8_exprf _nl, double* _xnti_, double* _rx_, double* _ry_, double* _rz_, \n", | 
|---|
| [333] | 1019 | funcname.c_str()); | 
|---|
| [2419] | 1020 | fprintf(fip,"       double* _rt_, int_8_exprf _nstart, int_8_exprf _nend) \n"); | 
|---|
| [333] | 1021 | fprintf(fip, "{ \n %s \n", vardec.c_str()); | 
|---|
|  | 1022 | fputs("  if (!1) { /* Cut Expression failed */ \n", fip); | 
|---|
|  | 1023 | fputs("    *_rx_ = *_ry_ = *_rz_ = *_rt_ = 0.;  return(0);", fip); | 
|---|
|  | 1024 | fputs("  } \n  /* Cut expression satisfied */ \n", fip); | 
|---|
|  | 1025 | fputs("  *_rx_ = 1.; \n  *_ry_ = 1.; \n  *_rz_ = 1.; \n  *_rt_ = 1.; \n", fip); | 
|---|
|  | 1026 | fputs("  return(1); \n} \n", fip); | 
|---|
|  | 1027 |  | 
|---|
|  | 1028 | fclose(fip); | 
|---|
| [344] | 1029 |  | 
|---|
|  | 1030 | if (adel) delete objnt;   // Delete de l'objet NTupleInterface si necessaire | 
|---|
| [333] | 1031 | return; | 
|---|
|  | 1032 | } | 
|---|
|  | 1033 |  | 
|---|
|  | 1034 | /* --Methode-- cmv 13/10/98 */ | 
|---|
|  | 1035 | void Services2NObjMgr::FillGFD(string& nom, string& expx, string& expy, string& expz, | 
|---|
| [357] | 1036 | string& experr, string& expcut, string& nomgfd, string loop) | 
|---|
| [333] | 1037 | //      Pour remplir un ``GeneralFitData'' a partir de divers objets: | 
|---|
|  | 1038 | //| nom = nom de l'objet a transcrire selon 1D: Z=f(X) ou 2D: Z=f(X,Y) . | 
|---|
|  | 1039 | //|       Vector,Matrix,Histo,HProf,Histo2D,Image<T>,StarList,NTuple,GeneralFitData | 
|---|
|  | 1040 | //| expx = expression X du GeneralFitData (1er abscisse) | 
|---|
|  | 1041 | //| expy = expression Y du GeneralFitData (2sd abscisse si non "", Z=f(X,Y)) | 
|---|
|  | 1042 | //| expz = expression Z du GeneralFitData (valeur de l'ordonnee) | 
|---|
|  | 1043 | //| experr = expression de l'erreur sur l'ordonnee Z | 
|---|
|  | 1044 | //| expcut = expression du test de selection | 
|---|
|  | 1045 | //| nomgfd = nom du GeneralFitData engendre (optionnel) | 
|---|
|  | 1046 | { | 
|---|
|  | 1047 | NObjMgrAdapter* obja=NULL; | 
|---|
| [2491] | 1048 | obja = MyObjMgr()->GetObjAdapter(nom); | 
|---|
| [333] | 1049 | if (obja == NULL) { | 
|---|
| [449] | 1050 | cout << "Services2NObjMgr::FillGFD() Error , No such object "<<nom<<endl; | 
|---|
| [333] | 1051 | return; | 
|---|
|  | 1052 | } | 
|---|
|  | 1053 | if(!mImgapp)  return; | 
|---|
|  | 1054 |  | 
|---|
|  | 1055 | // 2D ou 3D? | 
|---|
|  | 1056 | int nvar = 2; | 
|---|
|  | 1057 | if(expy.length()<=0) {nvar = 1; expy = "0.";} | 
|---|
|  | 1058 |  | 
|---|
|  | 1059 | // Creation NTuple Buffer | 
|---|
|  | 1060 | char* ntn[4]= {"x","y","f","e"}; | 
|---|
|  | 1061 | NTuple*nt = new NTuple(4,ntn); | 
|---|
|  | 1062 |  | 
|---|
|  | 1063 | // Remplissage NTuple buffer | 
|---|
| [357] | 1064 | ComputeExpressions(obja, expx, expy, expz, experr, expcut, loop, nt, NULL, NULL); | 
|---|
| [333] | 1065 | if(nt->NEntry() < 1) | 
|---|
|  | 1066 | {cout<<"Services2NObjMgr::FillGFD() Warning  Zero points satisfy cut !"<<endl; | 
|---|
|  | 1067 | delete nt; return;} | 
|---|
|  | 1068 |  | 
|---|
|  | 1069 | //Remplissage de la structure GeneraFitData | 
|---|
|  | 1070 | if (nt->NEntry() <= 0) { | 
|---|
|  | 1071 | cout<<"Services2NObjMgr::FillGFD() Warning - NData= " << nt->NEntry() << endl; | 
|---|
|  | 1072 | delete nt; | 
|---|
|  | 1073 | return; | 
|---|
|  | 1074 | } | 
|---|
|  | 1075 |  | 
|---|
|  | 1076 | GeneralFitData* gfd = new GeneralFitData(nvar,nt->NEntry(),0); | 
|---|
|  | 1077 | int k; | 
|---|
|  | 1078 | float* xn; | 
|---|
|  | 1079 | for(k=0; k<nt->NEntry(); k++) { | 
|---|
|  | 1080 | xn = nt->GetVec(k); | 
|---|
|  | 1081 | gfd->AddData(xn,xn[2],xn[3]); | 
|---|
|  | 1082 | } | 
|---|
|  | 1083 |  | 
|---|
|  | 1084 | // Menage et table d'objets | 
|---|
|  | 1085 | delete nt; | 
|---|
| [2491] | 1086 | MyObjMgr()->AddObj(gfd, nomgfd); | 
|---|
| [333] | 1087 | return; | 
|---|
|  | 1088 | } | 
|---|
|  | 1089 |  | 
|---|
| [1067] | 1090 | /* --Methode-- cmv 12/07/00 */ | 
|---|
|  | 1091 | void Services2NObjMgr::FillGFDfrVec(string nomgfd,string namx,string namy,string namz,string name) | 
|---|
|  | 1092 | //      Pour remplir un ``GeneralFitData'' a partir de vecteurs | 
|---|
|  | 1093 | //| gdfrvec nomgd X Y ! ! | 
|---|
|  | 1094 | //| gdfrvec nomgd X Y ! EY | 
|---|
|  | 1095 | //| gdfrvec nomgd X Y Z ! | 
|---|
|  | 1096 | //| gdfrvec nomgd X Y Z EZ | 
|---|
|  | 1097 | //| - nomgfd = nom du generaldata a remplir | 
|---|
|  | 1098 | //| - namx = nom du vecteur contenant les valeurs X | 
|---|
|  | 1099 | //| - namy = nom du vecteur contenant les valeurs Y | 
|---|
|  | 1100 | //| - namz = nom du vecteur contenant les valeurs Z (ou "!") | 
|---|
|  | 1101 | //| - name = nom du vecteur contenant les valeurs des erreurs EY ou EZ | 
|---|
|  | 1102 | { | 
|---|
|  | 1103 | // Decodage des noms des vecteurs pour le remplissage du generaldata | 
|---|
|  | 1104 | if(nomgfd=="!" || nomgfd.length()<1) | 
|---|
|  | 1105 | {cout<<"FillGFDfrVec_Error: bad GenaralData name "<<nomgfd<<endl; return;} | 
|---|
|  | 1106 | if(namx=="!" || namx.length()<1) | 
|---|
|  | 1107 | {cout<<"FillGFDfrVec_Error: bad X vector name "<<namx<<endl; return;} | 
|---|
|  | 1108 | if(namy=="!" || namy.length()<1) | 
|---|
|  | 1109 | {cout<<"FillGFDfrVec_Error: bad Y vector name "<<namy<<endl; return;} | 
|---|
|  | 1110 | if(namz.length()<1) namz = "!"; | 
|---|
|  | 1111 | if(name.length()<1) name = "!"; | 
|---|
|  | 1112 | int nvar = 0; | 
|---|
|  | 1113 | if(namz=="!") nvar = 1; else nvar = 2; | 
|---|
| [333] | 1114 |  | 
|---|
| [1067] | 1115 | // Identify data | 
|---|
|  | 1116 | NamedObjMgr omg; | 
|---|
|  | 1117 | AnyDataObj* mobj = NULL; | 
|---|
|  | 1118 | Vector* v; | 
|---|
|  | 1119 | int nel = 0; | 
|---|
|  | 1120 | r_8 *x=NULL, *y=NULL, *z=NULL,* ez=NULL; | 
|---|
|  | 1121 |  | 
|---|
|  | 1122 | if( (mobj=omg.GetObj(namx)) == NULL) { | 
|---|
|  | 1123 | cout<<"FillGFDfrVec_Error: unknown X object "<<namx<<endl; return; | 
|---|
|  | 1124 | } else { | 
|---|
|  | 1125 | v = (Vector*) mobj; x = v->Data(); nel=v->NElts(); | 
|---|
|  | 1126 | } | 
|---|
|  | 1127 |  | 
|---|
|  | 1128 | if( (mobj=omg.GetObj(namy)) == NULL) { | 
|---|
|  | 1129 | cout<<"FillGFDfrVec_Error: unknown Y object "<<namy<<endl; return; | 
|---|
|  | 1130 | } else { | 
|---|
|  | 1131 | v = (Vector*) mobj; y = z = v->Data(); if(v->NElts()<nel) nel=v->NElts(); | 
|---|
|  | 1132 | } | 
|---|
|  | 1133 |  | 
|---|
|  | 1134 | if( nvar==2 && (mobj=omg.GetObj(namz)) == NULL) { | 
|---|
|  | 1135 | cout<<"FillGFDfrVec_Error: unknown Z object "<<namz<<endl; return; | 
|---|
|  | 1136 | } else { | 
|---|
|  | 1137 | v = (Vector*) mobj; z = v->Data(); if(v->NElts()<nel) nel=v->NElts(); | 
|---|
|  | 1138 | } | 
|---|
|  | 1139 |  | 
|---|
|  | 1140 | if(name!="!") { | 
|---|
|  | 1141 | if( (mobj=omg.GetObj(name)) == NULL) { | 
|---|
|  | 1142 | cout<<"FillGFDfrVec_Error: unknown EZ object "<<name<<endl; return; | 
|---|
|  | 1143 | } else { | 
|---|
|  | 1144 | v = (Vector*) mobj; ez = v->Data(); if(v->NElts()<nel) nel=v->NElts(); | 
|---|
|  | 1145 | } | 
|---|
|  | 1146 | } | 
|---|
|  | 1147 |  | 
|---|
|  | 1148 | if(nel<=0) | 
|---|
|  | 1149 | {cout<<"FillGFDfrVec_Error: bad number of elements "<<nel<<endl; return;} | 
|---|
|  | 1150 |  | 
|---|
|  | 1151 | // Create GeneralData and fill it with vectors | 
|---|
|  | 1152 | GeneralFitData* gfd = new GeneralFitData(nvar,nel+5,0); | 
|---|
|  | 1153 | if(nvar==1) gfd->SetData1(nel,x,z,ez);     // On remplit Y=f(X) | 
|---|
|  | 1154 | else        gfd->SetData2(nel,x,y,z,ez);   // On remplit Z=f(X,y) | 
|---|
|  | 1155 |  | 
|---|
|  | 1156 | // Menage et table d'objets | 
|---|
|  | 1157 | if( omg.GetObj(nomgfd) != NULL ) omg.DelObj(nomgfd); | 
|---|
| [2491] | 1158 | MyObjMgr()->AddObj(gfd,nomgfd); | 
|---|
| [1067] | 1159 | return; | 
|---|
|  | 1160 | } | 
|---|
|  | 1161 |  | 
|---|
| [333] | 1162 | /* --Methode-- */ | 
|---|
|  | 1163 | void Services2NObjMgr::ComputeExpressions(NObjMgrAdapter* obja, string& expx, | 
|---|
| [357] | 1164 | string& expy, string& expz, string& expt, string& expcut, string& loop, | 
|---|
| [333] | 1165 | NTuple* nt, Histo* h1, Histo2D* h2, HProf* hp) | 
|---|
|  | 1166 | { | 
|---|
|  | 1167 | if (obja == NULL) return; | 
|---|
| [344] | 1168 | bool adel = true; | 
|---|
|  | 1169 | NTupleInterface* objnt = obja->GetNTupleInterface(adel); | 
|---|
| [333] | 1170 | if (objnt == NULL)  return; | 
|---|
|  | 1171 | string  vardec = objnt->VarList_C("_zz6qi_"); | 
|---|
|  | 1172 |  | 
|---|
|  | 1173 | PlotExprFunc f = LinkExprFunc(vardec, expx, expy, expz, expt, expcut); | 
|---|
|  | 1174 | if (!f) { | 
|---|
|  | 1175 | cerr << "Services2NObjMgr::::ComputeExpressions() Error Creation PlotExprFunc " <<  endl; | 
|---|
| [344] | 1176 | if (adel) delete objnt;  // Delete de l'objet NTupleInterface si necessaire | 
|---|
| [333] | 1177 | return; | 
|---|
|  | 1178 | } | 
|---|
|  | 1179 |  | 
|---|
|  | 1180 | double xnt[10]; | 
|---|
|  | 1181 | float  fxnt[10]; | 
|---|
|  | 1182 |  | 
|---|
| [2419] | 1183 | int_8 k; | 
|---|
|  | 1184 | for(k=0; k<10; k++) xnt[k] = 0.; | 
|---|
|  | 1185 | int_8 k1,k2,dk; | 
|---|
| [357] | 1186 | k1 = 0;  k2 = objnt->NbLines();  dk = 1; | 
|---|
|  | 1187 | DecodeLoopParameters(loop, k1, k2, dk); | 
|---|
|  | 1188 | if (k1 < 0) k1 = 0; | 
|---|
|  | 1189 | if (k2 < 0) k2 = objnt->NbLines(); | 
|---|
| [2419] | 1190 | if (k2 > (int_8)objnt->NbLines()) k2 = objnt->NbLines(); | 
|---|
| [357] | 1191 | if (dk <= 0) dk = 1; | 
|---|
| [500] | 1192 |  | 
|---|
|  | 1193 | try  { | 
|---|
| [333] | 1194 | double* xn; | 
|---|
| [357] | 1195 | for(k=k1; k<k2; k += dk)    { | 
|---|
| [333] | 1196 | xn = objnt->GetLineD(k); | 
|---|
| [2419] | 1197 | if (f((int_8_exprf)k,xn, xnt, xnt+1, xnt+2, xnt+3) != 0) { | 
|---|
| [333] | 1198 | if (nt) { | 
|---|
| [2419] | 1199 | for(int i=0; i<4; i++) fxnt[i] = xnt[i]; | 
|---|
| [333] | 1200 | nt->Fill(fxnt); | 
|---|
|  | 1201 | } | 
|---|
|  | 1202 | if (h1) h1->Add(xnt[0], xnt[3]); | 
|---|
|  | 1203 | if (h2) h2->Add(xnt[0], xnt[1], xnt[3]); | 
|---|
|  | 1204 | if (hp) hp->Add(xnt[0], xnt[1], xnt[3]); | 
|---|
|  | 1205 | } | 
|---|
|  | 1206 | } | 
|---|
|  | 1207 | } | 
|---|
| [500] | 1208 | #ifdef SANS_EVOLPLANCK | 
|---|
| [333] | 1209 | CATCH(merr) { | 
|---|
|  | 1210 | fflush(stdout); | 
|---|
|  | 1211 | cout << endl; | 
|---|
|  | 1212 | cerr << endl; | 
|---|
|  | 1213 | string es = PeidaExc(merr); | 
|---|
|  | 1214 | cerr << "Services2NObjMgr::ComputeExpressions()  Exception :" << merr << es; | 
|---|
|  | 1215 | } ENDTRY; | 
|---|
| [500] | 1216 | #else | 
|---|
|  | 1217 | catch ( PException exc ) { | 
|---|
|  | 1218 | fflush(stdout); | 
|---|
|  | 1219 | cout << endl; | 
|---|
|  | 1220 | cerr << endl; | 
|---|
|  | 1221 | cerr << "Services2NObjMgr::ComputeExpressions()  Exception :" << exc.Msg() << endl; | 
|---|
|  | 1222 | } | 
|---|
|  | 1223 | #endif | 
|---|
| [333] | 1224 |  | 
|---|
| [344] | 1225 | if (adel) delete objnt;  // Delete de l'objet NTupleInterface si necessaire | 
|---|
| [333] | 1226 | // Fermeture du fichier .so | 
|---|
|  | 1227 | CloseDLL(); | 
|---|
|  | 1228 | return; | 
|---|
|  | 1229 | } | 
|---|
|  | 1230 |  | 
|---|
|  | 1231 |  | 
|---|
|  | 1232 | /* --Methode-- */ | 
|---|
|  | 1233 | PlotExprFunc Services2NObjMgr::LinkExprFunc(string& vardec, string& expx, string& expy, | 
|---|
|  | 1234 | string& expz, string& expt, string& cut) | 
|---|
|  | 1235 | { | 
|---|
|  | 1236 | FILE *fip; | 
|---|
|  | 1237 | string fname = TmpDir + "expf_pia_dl.c"; | 
|---|
|  | 1238 | string cmd; | 
|---|
|  | 1239 | int rc; | 
|---|
|  | 1240 |  | 
|---|
|  | 1241 | cmd = "rm -f " + fname; | 
|---|
|  | 1242 | rc = system(cmd.c_str()); | 
|---|
|  | 1243 | //DBG printf("LinkExprFunc_Do> %s  (Rc=%d)\n", cmd.c_str(), rc); | 
|---|
|  | 1244 |  | 
|---|
|  | 1245 | if ((fip = fopen(fname.c_str(), "w")) == NULL)   { | 
|---|
|  | 1246 | string sn = fname; | 
|---|
| [449] | 1247 | cout << "Services2NObjMgr/LinkExprFunc_Error: fopen( " << sn << endl; | 
|---|
| [333] | 1248 | return(NULL); | 
|---|
|  | 1249 | } | 
|---|
|  | 1250 |  | 
|---|
|  | 1251 | // constitution du fichier a compiler | 
|---|
|  | 1252 | fputs("#include <stdlib.h> \n", fip); | 
|---|
|  | 1253 | fputs("#include <math.h> \n", fip); | 
|---|
| [344] | 1254 |  | 
|---|
| [1469] | 1255 | fputs("/* ------ Compare bits on double --------- */ \n", fip); | 
|---|
| [2419] | 1256 | fputs("typedef long long int_8_exprf;\n", fip); | 
|---|
|  | 1257 | fputs("int_8_exprf BitCmp64(double v,int_8_exprf flg)\n", fip); | 
|---|
|  | 1258 | fputs("{return ((int_8_exprf)((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip); | 
|---|
| [344] | 1259 | fputs("/* ------ Some random number generators --------- */ \n", fip); | 
|---|
| [1931] | 1260 | fputs("#if defined(__ppc__) && defined(__MACH__) \n",fip); | 
|---|
|  | 1261 | fputs("#include <limits.h> \n", fip); | 
|---|
|  | 1262 | fputs("#define drand48() ((double)(random())/LONG_MAX) \n",fip); | 
|---|
|  | 1263 | fputs("#endif \n",fip); | 
|---|
| [344] | 1264 | fputs("#define frand01() ( (float) drand48() ) \n", fip); | 
|---|
|  | 1265 | fputs("#define drand01() drand48()  \n", fip); | 
|---|
|  | 1266 | fputs("#define rand01()  drand48()  \n", fip); | 
|---|
|  | 1267 | fputs("#define frandpm1() ( 2. * frand01() - 1.) \n", fip); | 
|---|
|  | 1268 | fputs("#define drandpm1() ( 2. * drand01() - 1.) \n", fip); | 
|---|
|  | 1269 | fputs("#define randpm1() ( 2. * drand01() - 1.) \n", fip); | 
|---|
|  | 1270 | fputs("double NorRand(void) \n", fip); | 
|---|
|  | 1271 | fputs(" { \n double x,A,B; \n LAB10: \n A = drand01(); \n", fip); | 
|---|
|  | 1272 | fputs(" if ( A == 0. ) goto LAB10; \n B = drand01(); \n", fip); | 
|---|
| [345] | 1273 | fputs(" x = sqrt(-2.*log(A))*cos(2.*M_PI*B); \n", fip); | 
|---|
| [344] | 1274 | fputs(" return(x); \n } \n", fip); | 
|---|
|  | 1275 | fputs("#define GauRand() NorRand() \n", fip); | 
|---|
|  | 1276 | fputs("#define gaurand() NorRand() \n\n", fip); | 
|---|
|  | 1277 |  | 
|---|
| [2419] | 1278 | fputs("int expf_pia_dl_func(int_8_exprf _nl, double* _zz6qi_, double* _rx_6q_, double* _ry_6q_, double* _rz_6q_, double* _rt_6q_) \n{\n", fip); | 
|---|
| [333] | 1279 | fprintf(fip,"%s \n", vardec.c_str()); | 
|---|
|  | 1280 | fprintf(fip, "if (!(%s)) { *_rx_6q_ = *_ry_6q_ = *_rz_6q_ = *_rt_6q_ = 0.;  return(0); } \n", cut.c_str()); | 
|---|
|  | 1281 | fprintf(fip, "*_rx_6q_ = %s ; \n", expx.c_str()); | 
|---|
|  | 1282 | fprintf(fip, "*_ry_6q_ = %s ; \n", expy.c_str()); | 
|---|
|  | 1283 | fprintf(fip, "*_rz_6q_ = %s ; \n", expz.c_str()); | 
|---|
|  | 1284 | fprintf(fip, "*_rt_6q_ = %s ; \n", expt.c_str()); | 
|---|
|  | 1285 | fputs("return(1); \n} \n", fip); | 
|---|
|  | 1286 | fclose(fip); | 
|---|
|  | 1287 | string func = "expf_pia_dl_func"; | 
|---|
|  | 1288 | return((PlotExprFunc)LinkFunctionFromFile(fname, func)); | 
|---|
|  | 1289 | } | 
|---|
|  | 1290 |  | 
|---|
|  | 1291 |  | 
|---|
|  | 1292 | /* --Methode-- */ | 
|---|
|  | 1293 | DlFunction Services2NObjMgr::LinkFunctionFromFile(string const & fname, string const & funcname) | 
|---|
|  | 1294 | { | 
|---|
|  | 1295 | //  Le link dynamique | 
|---|
|  | 1296 | CloseDLL(); | 
|---|
|  | 1297 | dynlink = PDynLinkMgr::BuildFromCFile(fname); | 
|---|
|  | 1298 | if (dynlink == NULL) { | 
|---|
|  | 1299 | cerr << "Services2NObjMgr/LinkFunctionFromFile_Erreur: Erreur creation/Ouverture SO " << endl; | 
|---|
|  | 1300 | return(NULL); | 
|---|
|  | 1301 | } | 
|---|
|  | 1302 |  | 
|---|
|  | 1303 | DlFunction retfunc = dynlink->GetFunction(funcname); | 
|---|
|  | 1304 | if (retfunc == NULL) { | 
|---|
|  | 1305 | string sn = funcname; | 
|---|
|  | 1306 | cerr << "Services2NObjMgr/LinkExprFunc_Erreur: Erreur linking " << sn << endl; | 
|---|
|  | 1307 | CloseDLL(); | 
|---|
|  | 1308 | return(NULL); | 
|---|
|  | 1309 | } | 
|---|
|  | 1310 | else return(retfunc); | 
|---|
|  | 1311 | } | 
|---|
|  | 1312 |  | 
|---|
|  | 1313 | /* --Methode-- */ | 
|---|
|  | 1314 | void Services2NObjMgr::CloseDLL() | 
|---|
|  | 1315 | { | 
|---|
|  | 1316 | if (dynlink) delete dynlink;   dynlink = NULL; | 
|---|
|  | 1317 | } | 
|---|
|  | 1318 |  | 
|---|
| [1319] | 1319 | /* --Methode-- */ | 
|---|
|  | 1320 | int Services2NObjMgr::ExecuteCommand(string line) | 
|---|
|  | 1321 | { | 
|---|
|  | 1322 | if (mImgapp == NULL) return(99); | 
|---|
|  | 1323 | return(mImgapp->CmdInterpreter()->Interpret(line)); | 
|---|
|  | 1324 | } | 
|---|
|  | 1325 |  | 
|---|
| [357] | 1326 | // Fonction static | 
|---|
|  | 1327 | /* --Methode-- */ | 
|---|
| [2419] | 1328 | void Services2NObjMgr::DecodeLoopParameters(string& loop, int_8& i1, int_8& i2, int_8& di) | 
|---|
| [357] | 1329 | { | 
|---|
|  | 1330 | // Decode des paramatres de boucle for(int i=i1; i<i2; i+=di) specifies | 
|---|
|  | 1331 | // sous forme i1[:i2[:di]] | 
|---|
|  | 1332 | // cout << "LoopParam() " << loop << " I1=" << i1 << " I2=" << i2 << " DI=" << di; | 
|---|
|  | 1333 | size_t l = loop.length(); | 
|---|
|  | 1334 | if (l < 1) return; | 
|---|
|  | 1335 | size_t p = loop.find(':'); | 
|---|
| [2419] | 1336 | if (p >= l) { i1 = atol(loop.c_str()); return; } | 
|---|
|  | 1337 | i1 = atol(loop.substr(0, p).c_str()); | 
|---|
| [357] | 1338 | string aa = loop.substr(p+1); | 
|---|
|  | 1339 | p = aa.find(':'); | 
|---|
|  | 1340 | if (p < aa.length() ) { | 
|---|
| [2419] | 1341 | i2 = atol(aa.substr(0,p).c_str()); | 
|---|
|  | 1342 | di = atol(aa.substr(p+1).c_str()); | 
|---|
| [357] | 1343 | } | 
|---|
| [2419] | 1344 | else i2 = atol(aa.c_str()); | 
|---|
| [357] | 1345 | // cout << "-> I1= " << i1 << " I2= " << i2 << " DI= " << di << endl; | 
|---|
|  | 1346 | return; | 
|---|
|  | 1347 | } | 
|---|
| [333] | 1348 |  | 
|---|
|  | 1349 | /* --Methode-- */ | 
|---|
| [165] | 1350 | string Services2NObjMgr::FileName2Name(string const & fn) | 
|---|
|  | 1351 | { | 
|---|
|  | 1352 |  | 
|---|
|  | 1353 | char fsep[2] = {FILESEP, '\0'}; | 
|---|
|  | 1354 | char tsep[2] = {'.', '\0'}; | 
|---|
|  | 1355 | size_t p = fn.find_last_of(fsep); | 
|---|
| [194] | 1356 | size_t l = fn.length(); | 
|---|
|  | 1357 | if (p >= l)  p = 0; | 
|---|
|  | 1358 | else p++; | 
|---|
|  | 1359 | size_t q = fn.find_first_of(tsep,p); | 
|---|
|  | 1360 | if (q < p) q = l; | 
|---|
| [165] | 1361 | return(fn.substr(p,q-p)); | 
|---|
|  | 1362 | } | 
|---|
|  | 1363 |  | 
|---|
|  | 1364 |  | 
|---|
| [546] | 1365 |  | 
|---|
| [165] | 1366 |  | 
|---|
| [333] | 1367 | // SANS_EVOLPLANCK     Attention ! | 
|---|
| [1105] | 1368 | #ifdef SANS_EVOLPLANCK | 
|---|
| [333] | 1369 | #include "pclassids.h" | 
|---|
|  | 1370 |  | 
|---|
|  | 1371 | /* --Methode-- */ | 
|---|
|  | 1372 | char* Services2NObjMgr::PClassIdToClassName(int cid) | 
|---|
|  | 1373 | { | 
|---|
|  | 1374 | switch (cid) { | 
|---|
|  | 1375 | case ClassId_Poly1 : | 
|---|
|  | 1376 | return("Poly1"); | 
|---|
|  | 1377 | case ClassId_Poly2 : | 
|---|
|  | 1378 | return("Poly2"); | 
|---|
|  | 1379 | case ClassId_Matrix : | 
|---|
|  | 1380 | return("Matrix"); | 
|---|
|  | 1381 | case ClassId_Vector : | 
|---|
|  | 1382 | return("Vector"); | 
|---|
|  | 1383 |  | 
|---|
|  | 1384 | case ClassId_DVList : | 
|---|
|  | 1385 | return("DVList"); | 
|---|
|  | 1386 |  | 
|---|
|  | 1387 | case ClassId_Histo1D : | 
|---|
|  | 1388 | return("Histo1D"); | 
|---|
|  | 1389 | case ClassId_Histo2D : | 
|---|
|  | 1390 | return("Histo2D"); | 
|---|
|  | 1391 | case ClassId_HProf : | 
|---|
|  | 1392 | return("HProf"); | 
|---|
| [2605] | 1393 | case ClassId_HistoErr : | 
|---|
|  | 1394 | return("HistoErr"); | 
|---|
| [333] | 1395 | case ClassId_NTuple : | 
|---|
|  | 1396 | return("NTuple"); | 
|---|
| [361] | 1397 | case ClassId_XNTuple : | 
|---|
|  | 1398 | return("XNTuple"); | 
|---|
| [333] | 1399 | case ClassId_GeneralFitData : | 
|---|
|  | 1400 | return("GeneralFitData"); | 
|---|
|  | 1401 |  | 
|---|
|  | 1402 | case ClassId_Image : | 
|---|
|  | 1403 | return("RzImage"); | 
|---|
|  | 1404 | case ClassId_Image + kuint_1 : | 
|---|
|  | 1405 | return("ImageU1"); | 
|---|
|  | 1406 | case ClassId_Image + kint_1 : | 
|---|
|  | 1407 | return("ImageI1"); | 
|---|
|  | 1408 | case ClassId_Image + kuint_2 : | 
|---|
|  | 1409 | return("ImageU2"); | 
|---|
|  | 1410 | case ClassId_Image + kint_2 : | 
|---|
|  | 1411 | return("ImageI2"); | 
|---|
|  | 1412 | case ClassId_Image + kuint_4 : | 
|---|
|  | 1413 | return("ImageU4"); | 
|---|
|  | 1414 | case ClassId_Image + kint_4 : | 
|---|
|  | 1415 | return("ImageI4"); | 
|---|
|  | 1416 | case ClassId_Image + kr_4 : | 
|---|
|  | 1417 | return("ImageR4"); | 
|---|
|  | 1418 | case ClassId_Image + kr_8 : | 
|---|
|  | 1419 | return("ImageR8"); | 
|---|
|  | 1420 | case ClassId_ZFidu : | 
|---|
|  | 1421 | return("ZFidu"); | 
|---|
|  | 1422 |  | 
|---|
|  | 1423 | case ClassId_StarList : | 
|---|
|  | 1424 | return("StarList"); | 
|---|
|  | 1425 | case ClassId_Transfo : | 
|---|
|  | 1426 | return("Transfo"); | 
|---|
|  | 1427 | case ClassId_PSF : | 
|---|
|  | 1428 | return("PSF"); | 
|---|
|  | 1429 |  | 
|---|
|  | 1430 |  | 
|---|
|  | 1431 | // - Ajout objet PPF | 
|---|
|  | 1432 | default: | 
|---|
|  | 1433 | return("AnyDataObj"); | 
|---|
|  | 1434 | } | 
|---|
|  | 1435 | } | 
|---|
|  | 1436 |  | 
|---|
| [1105] | 1437 | #else | 
|---|
|  | 1438 | char* Services2NObjMgr::PClassIdToClassName(int cid) | 
|---|
|  | 1439 | { | 
|---|
|  | 1440 | return("AnyDataObj"); | 
|---|
|  | 1441 | } | 
|---|
|  | 1442 | #endif | 
|---|