[165] | 1 | #include <stdio.h>
|
---|
| 2 | #include <stdlib.h>
|
---|
| 3 | #include <ctype.h>
|
---|
| 4 |
|
---|
[295] | 5 | #include <typeinfo>
|
---|
[165] | 6 | #include <iostream.h>
|
---|
| 7 | #include <string>
|
---|
| 8 | #include <list>
|
---|
| 9 | #include <map>
|
---|
| 10 |
|
---|
| 11 | #include "strutil.h"
|
---|
| 12 |
|
---|
| 13 | #include "nobjmgr.h"
|
---|
| 14 | #include "servnobjm.h"
|
---|
[330] | 15 | #include "nomgadapter.h"
|
---|
[165] | 16 | #include "pistdimgapp.h"
|
---|
| 17 |
|
---|
[333] | 18 | #include "fct1dfit.h"
|
---|
| 19 | #include "fct2dfit.h"
|
---|
| 20 |
|
---|
[544] | 21 | #ifdef SANS_EVOLPLANCK
|
---|
[333] | 22 | #include "matrix.h"
|
---|
| 23 | #include "cvector.h"
|
---|
[544] | 24 | #else
|
---|
| 25 | #include "tmatrix.h"
|
---|
| 26 | #include "tvector.h"
|
---|
[584] | 27 | #include "pitvmaad.h"
|
---|
[544] | 28 | #endif
|
---|
| 29 |
|
---|
[333] | 30 | #include "ntuple.h"
|
---|
| 31 | #include "cimage.h"
|
---|
| 32 |
|
---|
[165] | 33 | #include "histos.h"
|
---|
| 34 | #include "histos2.h"
|
---|
| 35 | #include "ntuple.h"
|
---|
| 36 | #include "hisprof.h"
|
---|
| 37 |
|
---|
[326] | 38 | #include "piscdrawwdg.h"
|
---|
| 39 | #include "pisurfdr.h"
|
---|
[333] | 40 |
|
---|
| 41 | #include "pintuple.h"
|
---|
| 42 | #include "pintup3d.h"
|
---|
| 43 |
|
---|
[326] | 44 | #include "pipodrw.h"
|
---|
[165] | 45 |
|
---|
| 46 |
|
---|
[326] | 47 |
|
---|
[165] | 48 | /* --Methode-- */
|
---|
[333] | 49 | Services2NObjMgr::Services2NObjMgr(NamedObjMgr* omg, string& tmpdir)
|
---|
[165] | 50 | {
|
---|
| 51 | TmpDir = tmpdir;
|
---|
[171] | 52 | PDynLinkMgr::SetTmpDir(tmpdir);
|
---|
[333] | 53 | mImgapp = NULL;
|
---|
| 54 | mOmg = omg;
|
---|
[171] | 55 | dynlink = NULL;
|
---|
[165] | 56 | InitGrAttNames();
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | /* --Methode-- */
|
---|
| 60 | Services2NObjMgr::~Services2NObjMgr()
|
---|
| 61 | {
|
---|
| 62 | CloseDLL();
|
---|
| 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-- */
|
---|
[333] | 92 | void Services2NObjMgr::PlotFunc(string const & expfunc, string & nom, double xmin, double xmax, int np, string dopt)
|
---|
[295] | 93 | {
|
---|
[165] | 94 | FILE *fip;
|
---|
[326] | 95 | string fname = TmpDir + "func1_pia_dl.c";
|
---|
| 96 | string cmd;
|
---|
| 97 | int rc;
|
---|
| 98 |
|
---|
| 99 | if (!mImgapp) return;
|
---|
| 100 |
|
---|
| 101 | cmd = "rm -f " + fname;
|
---|
| 102 | rc = system(cmd.c_str());
|
---|
| 103 | // printf("PlotFunc_Do> %s (Rc=%d)\n", cmd.c_str(), rc);
|
---|
| 104 |
|
---|
| 105 | if ((fip = fopen(fname.c_str(), "w")) == NULL) {
|
---|
| 106 | string sn = fname;
|
---|
[449] | 107 | cout << "Services2NObjMgr/PlotFunc_Error: fopen( " << sn << endl;
|
---|
[326] | 108 | return;
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | // constitution du fichier a compiler
|
---|
| 112 | fputs("#include <math.h> \n", fip);
|
---|
| 113 | fputs("double func1_pia_dl_func(double x) \n{\n", fip);
|
---|
| 114 | fprintf(fip,"return(%s); \n}\n", expfunc.c_str());
|
---|
| 115 | fclose(fip);
|
---|
| 116 |
|
---|
| 117 | string func = "func1_pia_dl_func";
|
---|
| 118 | DlFunctionOfX f = (DlFunctionOfX) LinkFunctionFromFile(fname, func);
|
---|
| 119 | if (!f) return;
|
---|
[333] | 120 | PlotFunc(f, nom, xmin, xmax, np, dopt);
|
---|
[326] | 121 | CloseDLL();
|
---|
| 122 | return;
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | /* --Methode-- */
|
---|
[333] | 126 | void Services2NObjMgr::PlotFunc2D(string const & expfunc, string & nom, double xmin, double xmax,
|
---|
| 127 | double ymin, double ymax, int npx, int npy, string dopt)
|
---|
[326] | 128 | {
|
---|
| 129 | FILE *fip;
|
---|
| 130 | string fname = TmpDir + "func2_pia_dl.c";
|
---|
| 131 | string cmd;
|
---|
| 132 | int rc;
|
---|
| 133 |
|
---|
| 134 | if (!mImgapp) return;
|
---|
| 135 |
|
---|
| 136 | cmd = "rm " + fname;
|
---|
| 137 | rc = system(cmd.c_str());
|
---|
| 138 | // printf("PlotFunc2D_Do> %s (Rc=%d)\n", cmd.c_str(), rc);
|
---|
| 139 |
|
---|
| 140 | if ((fip = fopen(fname.c_str(), "w")) == NULL) {
|
---|
| 141 | string sn = fname;
|
---|
[449] | 142 | cout << "Services2NObjMgr/PlotFunc2D_Error: fopen( " << sn << endl;
|
---|
[326] | 143 | return;
|
---|
| 144 | }
|
---|
| 145 |
|
---|
| 146 | // constitution du fichier a compiler
|
---|
| 147 | fputs("#include <math.h> \n", fip);
|
---|
| 148 | fputs("double func2_pia_dl_func(double x, double y) \n{\n", fip);
|
---|
| 149 | fprintf(fip,"return(%s); \n}\n", expfunc.c_str());
|
---|
| 150 | fclose(fip);
|
---|
| 151 |
|
---|
| 152 | string func = "func2_pia_dl_func";
|
---|
| 153 | DlFunctionOfXY f = (DlFunctionOfXY) LinkFunctionFromFile(fname, func);
|
---|
| 154 | if (!f) return;
|
---|
[333] | 155 | PlotFunc2D(f, nom, xmin, xmax, ymin, ymax, npx, npy, dopt);
|
---|
[326] | 156 | CloseDLL();
|
---|
| 157 | return;
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | /* --Methode-- */
|
---|
[333] | 161 | void Services2NObjMgr::PlotFuncFrCFile(string const & fname, string const & func, string & nom,
|
---|
| 162 | double xmin, double xmax, int np, string dopt)
|
---|
[326] | 163 | {
|
---|
| 164 | DlFunctionOfX f = (DlFunctionOfX) LinkFunctionFromFile(fname, func);
|
---|
| 165 | if (!f) return;
|
---|
[333] | 166 | PlotFunc(f, nom, xmin, xmax, np, dopt);
|
---|
[326] | 167 | CloseDLL();
|
---|
| 168 | return;
|
---|
| 169 | }
|
---|
| 170 |
|
---|
| 171 | /* --Methode-- */
|
---|
[333] | 172 | void Services2NObjMgr::PlotFunc2DFrCFile(string const & fname, string const & func, string & nom,
|
---|
| 173 | double xmin, double xmax, double ymin, double ymax, int npx, int npy, string dopt)
|
---|
[326] | 174 | {
|
---|
| 175 | DlFunctionOfXY f = (DlFunctionOfXY) LinkFunctionFromFile(fname, func);
|
---|
| 176 | if (!f) return;
|
---|
[333] | 177 | PlotFunc2D(f, nom, xmin, xmax, ymin, ymax, npx, npy, dopt);
|
---|
[326] | 178 | CloseDLL();
|
---|
| 179 | return;
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | /* --Methode-- */
|
---|
[333] | 183 | void Services2NObjMgr::PlotFunc(DlFunctionOfX f, string & nom, double xmin, double xmax, int np, string dopt)
|
---|
[326] | 184 | {
|
---|
| 185 | if (!mImgapp) return;
|
---|
| 186 |
|
---|
| 187 | int k;
|
---|
| 188 | if (np < 1) np = 1;
|
---|
| 189 | if (xmax <= xmin) xmax = xmin+1.;
|
---|
| 190 | Vector* vpy = new Vector(np);
|
---|
| 191 |
|
---|
| 192 | double xx;
|
---|
| 193 | double dx = (xmax-xmin)/np;
|
---|
[500] | 194 |
|
---|
| 195 | try {
|
---|
| 196 | for(k=0; k<np; k++) { xx = xmin+dx*k; (*vpy)(k) = f(xx); }
|
---|
| 197 | }
|
---|
[495] | 198 | #ifdef SANS_EVOLPLANCK
|
---|
[500] | 199 | CATCH(merr) {
|
---|
[326] | 200 | fflush(stdout);
|
---|
| 201 | cout << endl;
|
---|
| 202 | cerr << endl;
|
---|
| 203 | string es = PeidaExc(merr);
|
---|
| 204 | cerr << "Services2NObjMgr::PlotFunc() Exception :" << merr << es;
|
---|
| 205 | delete vpy;
|
---|
| 206 | vpy = NULL;
|
---|
| 207 | } ENDTRY;
|
---|
[495] | 208 | #else
|
---|
| 209 | catch ( PException exc ) {
|
---|
| 210 | fflush(stdout);
|
---|
| 211 | cout << endl;
|
---|
| 212 | cerr << endl;
|
---|
| 213 | cerr << "Services2NObjMgr::PlotFunc() Exception :" << exc.Msg() << endl;
|
---|
| 214 | delete vpy;
|
---|
| 215 | vpy = NULL;
|
---|
| 216 | }
|
---|
| 217 | #endif
|
---|
[326] | 218 |
|
---|
| 219 | if (vpy) {
|
---|
[344] | 220 | string titre;
|
---|
| 221 | if (nom.length() < 1) {
|
---|
| 222 | titre = "Function f(x)";
|
---|
[466] | 223 | nom = "/autoc/f_x";
|
---|
[344] | 224 | }
|
---|
| 225 | else titre = nom;
|
---|
| 226 |
|
---|
| 227 | P1DArrayAdapter* vya = new POVectorAdapter(vpy, false);
|
---|
[326] | 228 | vya->DefineXCoordinate(xmin, (xmax-xmin)/np);
|
---|
| 229 | PIYfXDrawer* dr = new PIYfXDrawer(vya, NULL, true) ;
|
---|
| 230 | bool fgsr = true;
|
---|
| 231 | dopt = "thinline," + dopt;
|
---|
| 232 | int opt = DecodeDispOption(dopt, fgsr);
|
---|
[333] | 233 | int rsid = mImgapp->DispScDrawer(dr, titre, opt);
|
---|
[326] | 234 | if (fgsr) mImgapp->RestoreGraphicAtt();
|
---|
[333] | 235 | if (nom.length() > 0) {
|
---|
| 236 | mOmg->AddObj(vpy, nom);
|
---|
| 237 | mOmg->AddWRsId(nom, rsid);
|
---|
| 238 | }
|
---|
[326] | 239 | }
|
---|
| 240 |
|
---|
| 241 | return;
|
---|
| 242 | }
|
---|
| 243 |
|
---|
| 244 | /* --Methode-- */
|
---|
[333] | 245 | void Services2NObjMgr::PlotFunc2D(DlFunctionOfXY f, string & nom, double xmin, double xmax, double ymin, double ymax,
|
---|
[326] | 246 | int npx, int npy, string dopt)
|
---|
| 247 | {
|
---|
| 248 | if (!mImgapp) return;
|
---|
| 249 |
|
---|
| 250 | if (npx < 3) npx = 3;
|
---|
| 251 | if (npy < 3) npy = 3;
|
---|
| 252 | if (npx > 250) npx = 250;
|
---|
| 253 | if (npy > 250) npy = 250;
|
---|
| 254 | if (xmax <= xmin) xmax = xmin+1.;
|
---|
| 255 | if (ymax <= ymin) ymax = ymin+1.;
|
---|
| 256 |
|
---|
| 257 | Matrix* mtx = new Matrix(npy, npx);
|
---|
| 258 |
|
---|
| 259 | int i,j;
|
---|
| 260 | double xx, yy;
|
---|
| 261 | double dx = (xmax-xmin)/npx;
|
---|
| 262 | double dy = (ymax-ymin)/npy;
|
---|
| 263 | // printf(" -- DBG -- %d %d , %g %g , %g %g \n", npx, npy, xmin, xmax, ymin, ymax);
|
---|
[500] | 264 | try {
|
---|
[326] | 265 | for(j=0; j<npy; j++) {
|
---|
| 266 | yy = ymin+dy*j;
|
---|
| 267 | for(i=0; i<npx; i++) {
|
---|
| 268 | xx = xmin+dx*i;
|
---|
| 269 | (*mtx)(j, i) = f(xx, yy);
|
---|
| 270 | }
|
---|
| 271 | }
|
---|
[500] | 272 | }
|
---|
| 273 | #ifdef SANS_EVOLPLANCK
|
---|
| 274 | CATCH(merr) {
|
---|
[326] | 275 | fflush(stdout);
|
---|
| 276 | cout << endl;
|
---|
| 277 | cerr << endl;
|
---|
| 278 | string es = PeidaExc(merr);
|
---|
| 279 | cerr << "Services2NObjMgr::PlotFunc2D() Exception :" << merr << es;
|
---|
| 280 | delete mtx; mtx = NULL;
|
---|
| 281 | } ENDTRY;
|
---|
[495] | 282 | #else
|
---|
| 283 | catch ( PException exc ) {
|
---|
| 284 | fflush(stdout);
|
---|
| 285 | cout << endl;
|
---|
| 286 | cerr << endl;
|
---|
| 287 | cerr << "Services2NObjMgr::PlotFunc2D() Exception :" << exc.Msg() << endl;
|
---|
| 288 | delete mtx; mtx = NULL;
|
---|
| 289 | }
|
---|
| 290 | #endif
|
---|
[326] | 291 |
|
---|
| 292 | if (mtx) {
|
---|
[344] | 293 | string titre;
|
---|
| 294 | if (nom.length() < 1) {
|
---|
| 295 | titre = "Function f(x,y)";
|
---|
[466] | 296 | nom = "/autoc/f2d_xy";
|
---|
[344] | 297 | }
|
---|
| 298 | else titre = nom;
|
---|
[326] | 299 | bool fgsr = true;
|
---|
| 300 | int opt = DecodeDispOption(dopt, fgsr);
|
---|
[344] | 301 | P2DArrayAdapter* arr = new POMatrixAdapter(mtx, false);
|
---|
[326] | 302 | arr->DefineXYCoordinates(xmin, ymin, dx, dy);
|
---|
| 303 | PISurfaceDrawer* sdr = new PISurfaceDrawer(arr, true, true, true);
|
---|
[333] | 304 | int rsid = mImgapp->Disp3DDrawer(sdr, titre, opt);
|
---|
[326] | 305 | if (fgsr) mImgapp->RestoreGraphicAtt();
|
---|
[333] | 306 | if (nom.length() > 0) {
|
---|
| 307 | mOmg->AddObj(mtx, nom);
|
---|
| 308 | mOmg->AddWRsId(nom, rsid);
|
---|
| 309 | }
|
---|
[326] | 310 | }
|
---|
| 311 |
|
---|
| 312 | return;
|
---|
| 313 | }
|
---|
| 314 |
|
---|
| 315 | /* --Methode-- */
|
---|
[333] | 316 | void Services2NObjMgr::DisplayPoints2D(string& nom, string& expx, string& expy,
|
---|
| 317 | string& experrx, string& experry,
|
---|
[357] | 318 | string& expcut, string dopt, string loop)
|
---|
[333] | 319 | {
|
---|
| 320 | NObjMgrAdapter* obja=NULL;
|
---|
| 321 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 322 | if (obja == NULL) {
|
---|
[449] | 323 | cout << "Services2NObjMgr::DisplayPoints2D() Error , No such object " << nom << endl;
|
---|
[333] | 324 | return;
|
---|
| 325 | }
|
---|
| 326 | if (!mImgapp) return;
|
---|
| 327 |
|
---|
| 328 | // Creation NTuple
|
---|
| 329 | char* ntn[4] = {"expx","expy","expex","expey",};
|
---|
| 330 | NTuple* nt = NULL;
|
---|
| 331 | bool haserr = false;
|
---|
| 332 |
|
---|
| 333 | if ( (experrx.length() > 0 ) && (experry.length() > 0 ) ) { haserr = true; nt = new NTuple(4, ntn); }
|
---|
| 334 | else { haserr = false; experrx = experry = "0."; nt = new NTuple(2, ntn); }
|
---|
| 335 |
|
---|
[357] | 336 | ComputeExpressions(obja, expx, expy, experrx, experry, expcut, loop, nt, NULL, NULL);
|
---|
[333] | 337 |
|
---|
| 338 | if (nt->NEntry() < 1) {
|
---|
| 339 | cout << "Services2NObjMgr::DisplayPoints2D() Warning Zero points satisfy cut !" << endl;
|
---|
| 340 | delete nt;
|
---|
| 341 | return;
|
---|
| 342 | }
|
---|
| 343 |
|
---|
| 344 | // nt->Show();
|
---|
| 345 | // nt->Print(0,10);
|
---|
| 346 | PINTuple* pin = new PINTuple(nt, true);
|
---|
[546] | 347 | pin->SetStats(Services2NObjMgr::GetStatsOption(dopt));
|
---|
[333] | 348 | pin->SelectXY(ntn[0], ntn[1]);
|
---|
| 349 | if ( haserr ) pin->SelectErrBar(ntn[2], ntn[3]);
|
---|
| 350 |
|
---|
| 351 | bool fgsr = true;
|
---|
| 352 | dopt = "defline," + dopt;
|
---|
| 353 | int opt = DecodeDispOption(dopt, fgsr);
|
---|
| 354 | string titre = nom + ":" + expy + "%" + expx;
|
---|
| 355 | mImgapp->DispScDrawer( (PIDrawer*)pin, titre, opt);
|
---|
| 356 | if (fgsr) mImgapp->RestoreGraphicAtt();
|
---|
| 357 | return;
|
---|
| 358 | }
|
---|
| 359 |
|
---|
| 360 | /* --Methode-- */
|
---|
| 361 | void Services2NObjMgr::DisplayPoints3D(string& nom, string& expx, string& expy,
|
---|
[357] | 362 | string& expz, string& expcut, string dopt, string loop)
|
---|
[333] | 363 | {
|
---|
| 364 | NObjMgrAdapter* obja=NULL;
|
---|
| 365 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 366 | if (obja == NULL) {
|
---|
[449] | 367 | cout << "Services2NObjMgr::DisplayPoints3D() Error , No such object " << nom << endl;
|
---|
[333] | 368 | return;
|
---|
| 369 | }
|
---|
| 370 | if (!mImgapp) return;
|
---|
| 371 |
|
---|
| 372 | char* ntn[3] = {"expx","expy","expz"};
|
---|
| 373 | NTuple* nt = new NTuple(3,ntn); // Creation NTuple
|
---|
| 374 |
|
---|
| 375 | string expwt = "1.";
|
---|
[357] | 376 | ComputeExpressions(obja, expx, expy, expz, expwt, expcut, loop, nt, NULL, NULL);
|
---|
[333] | 377 |
|
---|
| 378 | if (nt->NEntry() < 1) {
|
---|
| 379 | cout << "Services2NObjMgr::DisplayPoints3D() Warning Zero points satisfy cut !" << endl;
|
---|
| 380 | delete nt;
|
---|
| 381 | return;
|
---|
| 382 | }
|
---|
| 383 | nt->Show();
|
---|
| 384 | nt->Print(0,10);
|
---|
| 385 | PINTuple3D* pin = new PINTuple3D(nt, true);
|
---|
| 386 | pin->SelectXYZ(ntn[0], ntn[1], ntn[2]);
|
---|
| 387 | bool fgsr = true;
|
---|
| 388 | dopt = "defline," + dopt;
|
---|
| 389 | int opt = DecodeDispOption(dopt, fgsr);
|
---|
| 390 |
|
---|
| 391 | // Pour plot a partir de DispScDrawer
|
---|
| 392 | // string nomdisp = "_NT3D_";
|
---|
| 393 | // mImgapp->DispScDrawer( (PIDrawer*)pin, nomdisp, opt);
|
---|
| 394 | // Pour plot a partir de Disp3DDrawer
|
---|
| 395 | string titre = nom + ":" + expy + "%" + expx;
|
---|
| 396 | mImgapp->Disp3DDrawer(pin, titre, opt);
|
---|
| 397 |
|
---|
| 398 | if (fgsr) mImgapp->RestoreGraphicAtt();
|
---|
| 399 | return;
|
---|
| 400 | }
|
---|
| 401 |
|
---|
| 402 | /* --Methode-- */
|
---|
| 403 | void Services2NObjMgr::DisplayPoints2DW(string& nom, string& expx, string& expy,
|
---|
[357] | 404 | string& expwt, string& expcut, string dopt, string loop)
|
---|
[333] | 405 | {
|
---|
| 406 | NObjMgrAdapter* obja=NULL;
|
---|
| 407 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 408 | if (obja == NULL) {
|
---|
[449] | 409 | cout << "Services2NObjMgr::DisplayPoints2DW() Error , No such object " << nom << endl;
|
---|
[333] | 410 | return;
|
---|
| 411 | }
|
---|
| 412 | if (!mImgapp) return;
|
---|
| 413 |
|
---|
| 414 | char* ntn[3] = {"expx","expy","expw"};
|
---|
| 415 | NTuple* nt = new NTuple(3,ntn); // Creation NTuple
|
---|
| 416 |
|
---|
| 417 | string exp = "1.";
|
---|
[357] | 418 | ComputeExpressions(obja, expx, expy, expwt, exp, expcut, loop, nt, NULL, NULL);
|
---|
[333] | 419 |
|
---|
| 420 | if (nt->NEntry() < 1) {
|
---|
| 421 | cout << "Services2NObjMgr::DisplayPoints2DW() Warning Zero points satisfy cut !" << endl;
|
---|
| 422 | delete nt;
|
---|
| 423 | return;
|
---|
| 424 | }
|
---|
| 425 |
|
---|
| 426 | PINTuple* pin = new PINTuple(nt, true);
|
---|
[546] | 427 | pin->SetStats(Services2NObjMgr::GetStatsOption(dopt));
|
---|
[333] | 428 | pin->SelectXY(ntn[0], ntn[1]);
|
---|
| 429 | pin->SelectWt(ntn[2]);
|
---|
| 430 |
|
---|
| 431 | bool fgsr = true;
|
---|
| 432 | int opt = DecodeDispOption(dopt, fgsr);
|
---|
| 433 | string titre = nom + ":" + expwt + "_" + expy + "%" + expx ;
|
---|
| 434 | mImgapp->DispScDrawer( (PIDrawer*)pin, titre, opt);
|
---|
| 435 | if (fgsr) mImgapp->RestoreGraphicAtt();
|
---|
| 436 | return;
|
---|
| 437 | }
|
---|
| 438 |
|
---|
| 439 | /* --Methode-- */
|
---|
| 440 | void Services2NObjMgr::ProjectH1(string& nom, string& expx, string& expwt,
|
---|
[357] | 441 | string& expcut, string& nomh1, string dopt, string loop)
|
---|
[333] | 442 | {
|
---|
| 443 | NObjMgrAdapter* obja=NULL;
|
---|
| 444 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 445 | if (obja == NULL) {
|
---|
[449] | 446 | cout << "Services2NObjMgr::ProjectH1() Error , No such object " << nom << endl;
|
---|
[333] | 447 | return;
|
---|
| 448 | }
|
---|
| 449 | if (!mImgapp) return;
|
---|
| 450 |
|
---|
| 451 | Histo* h1 = NULL;
|
---|
| 452 | NTuple* nt = NULL;
|
---|
| 453 | AnyDataObj* oh = NULL;
|
---|
| 454 | if (nomh1.length() > 0) oh=mOmg->GetObj(nomh1);
|
---|
| 455 | else nomh1 = "/tmp/projh1d";
|
---|
| 456 | if ( (oh != NULL) && (typeid(*oh) == typeid(Histo)) ) h1 = (Histo*)oh; // Pas de remise a zero ! h1->Zero();
|
---|
| 457 | else {
|
---|
| 458 | char* ntn[2]= {"hxval", "hwt"};
|
---|
| 459 | nt = new NTuple(2,ntn); // Creation NTuple
|
---|
| 460 | }
|
---|
| 461 | string expz = "0.";
|
---|
[357] | 462 | ComputeExpressions(obja, expx, expwt, expz, expwt, expcut, loop, nt, h1, NULL);
|
---|
[333] | 463 |
|
---|
| 464 | if ((!h1) && (!nt)) return;
|
---|
| 465 | if (!h1) {
|
---|
| 466 | if (nt->NEntry() < 1) {
|
---|
| 467 | cout << "Services2NObjMgr::ProjectH1() Warning Zero points satisfy cut !" << endl;
|
---|
| 468 | delete nt;
|
---|
| 469 | return;
|
---|
| 470 | }
|
---|
| 471 | double xmin, xmax;
|
---|
| 472 | nt->GetMinMax(0, xmin, xmax);
|
---|
| 473 | h1 = new Histo(xmin, xmax, 100);
|
---|
| 474 | int k;
|
---|
| 475 | float* xn;
|
---|
| 476 | for(k=0; k<nt->NEntry(); k++) {
|
---|
| 477 | xn = nt->GetVec(k);
|
---|
| 478 | h1->Add(xn[0], xn[1]);
|
---|
| 479 | }
|
---|
| 480 | delete nt;
|
---|
| 481 | mOmg->AddObj(h1, nomh1);
|
---|
| 482 | }
|
---|
| 483 |
|
---|
| 484 | mOmg->DisplayObj(nomh1, dopt);
|
---|
| 485 | return;
|
---|
| 486 | }
|
---|
| 487 |
|
---|
| 488 | /* --Methode-- */
|
---|
| 489 | void Services2NObjMgr::ProjectH2(string& nom, string& expx, string& expy, string& expwt,
|
---|
[357] | 490 | string& expcut, string& nomh2, string dopt, string loop)
|
---|
[333] | 491 | {
|
---|
| 492 | NObjMgrAdapter* obja=NULL;
|
---|
| 493 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 494 | if (obja == NULL) {
|
---|
[449] | 495 | cout << "Services2NObjMgr::ProjectH2() Error , No such object " << nom << endl;
|
---|
[333] | 496 | return;
|
---|
| 497 | }
|
---|
| 498 | if (!mImgapp) return;
|
---|
| 499 |
|
---|
| 500 | Histo2D* h2 = NULL;
|
---|
| 501 | NTuple* nt = NULL;
|
---|
| 502 | AnyDataObj* oh = NULL;
|
---|
| 503 | if (nomh2.length() > 0) oh=mOmg->GetObj(nomh2);
|
---|
| 504 | else nomh2 = "/tmp/projh2d";
|
---|
| 505 | if ( (oh != NULL) && (typeid(*oh) == typeid(Histo2D)) ) h2 = (Histo2D*)oh; // Pas de remise a zero ! h2->Zero();
|
---|
| 506 | else {
|
---|
| 507 | char* ntn[3]= {"hxval", "hyval", "hwt"};
|
---|
| 508 | nt = new NTuple(3,ntn); // Creation NTuple
|
---|
| 509 | }
|
---|
| 510 | string expz = "0.";
|
---|
[357] | 511 | ComputeExpressions(obja, expx, expy, expwt, expwt, expcut, loop, nt, NULL, h2);
|
---|
[333] | 512 |
|
---|
| 513 | if ((!h2) && (!nt)) return;
|
---|
| 514 | if (!h2) {
|
---|
| 515 | if (nt->NEntry() < 1) {
|
---|
| 516 | cout << "Services2NObjMgr::ProjectH2() Warning Zero points satisfy cut !" << endl;
|
---|
| 517 | delete nt;
|
---|
| 518 | return;
|
---|
| 519 | }
|
---|
| 520 | double xmin, xmax, ymin, ymax;
|
---|
| 521 | nt->GetMinMax(0, xmin, xmax);
|
---|
[466] | 522 | nt->GetMinMax(1, ymin, ymax);
|
---|
[333] | 523 | h2 = new Histo2D(xmin, xmax, 50, ymin, ymax, 50);
|
---|
| 524 | int k;
|
---|
| 525 | float* xn;
|
---|
| 526 | for(k=0; k<nt->NEntry(); k++) {
|
---|
| 527 | xn = nt->GetVec(k);
|
---|
| 528 | h2->Add(xn[0], xn[1], xn[2]);
|
---|
| 529 | }
|
---|
| 530 | delete nt;
|
---|
| 531 | mOmg->AddObj(h2, nomh2);
|
---|
| 532 | }
|
---|
| 533 |
|
---|
| 534 | mOmg->DisplayObj(nomh2, dopt);
|
---|
| 535 | return;
|
---|
| 536 |
|
---|
| 537 | }
|
---|
| 538 |
|
---|
| 539 | /* --Methode-- cmv 13/10/98 */
|
---|
| 540 | void Services2NObjMgr::ProjectHProf(string& nom, string& expx, string& expy, string& expwt,
|
---|
[357] | 541 | string& expcut, string& nomprof, string dopt, string loop)
|
---|
| 542 | // Pour remplir un ``GeneralFitData'' a partir de divers objets:
|
---|
[333] | 543 | //| nom = nom de l'objet a projeter dans un HProf.
|
---|
| 544 | //| expx = expression X de definition du bin.
|
---|
| 545 | //| expy = expression Y a additionner dans le bin.
|
---|
| 546 | //| expwt = expression W du poids a additionner.
|
---|
| 547 | //| expcut = expression du test de selection.
|
---|
| 548 | //| nomprof = nom du HProf engendre (optionnel). Si l'objet n'existe pas
|
---|
| 549 | //| les limites Xmin,Xmax sont calculees automatiquement.
|
---|
| 550 | //| sinon ce sont celles de l'objet preexistant.
|
---|
| 551 | //| opt = options generales pour le display.
|
---|
| 552 | {
|
---|
| 553 | NObjMgrAdapter* obja=NULL;
|
---|
| 554 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 555 | if (obja == NULL) {
|
---|
[449] | 556 | cout << "Services2NObjMgr::ProjectHProf() Error , No such object " << nom << endl;
|
---|
[333] | 557 | return;
|
---|
| 558 | }
|
---|
| 559 | if (!mImgapp) return;
|
---|
| 560 |
|
---|
| 561 | HProf* hprof = NULL;
|
---|
| 562 | NTuple* nt = NULL;
|
---|
| 563 | AnyDataObj* oh = NULL;
|
---|
| 564 | if (nomprof.length() > 0) oh=mOmg->GetObj(nomprof);
|
---|
| 565 | else nomprof = "/tmp/projprof";
|
---|
| 566 | if( (oh!=NULL) && (typeid(*oh) == typeid(HProf)) ) hprof = (HProf*)oh;
|
---|
| 567 | else {
|
---|
| 568 | char* ntn[3]= {"hxval", "hyval", "hwt"};
|
---|
| 569 | nt = new NTuple(3,ntn); // Creation NTuple
|
---|
| 570 | }
|
---|
| 571 | string expz = "0.";
|
---|
[357] | 572 | ComputeExpressions(obja, expx, expy, expwt, expwt, expcut, loop, nt, NULL, NULL, hprof);
|
---|
[333] | 573 |
|
---|
| 574 | if((!hprof) && (!nt)) return;
|
---|
| 575 | if(!hprof) {
|
---|
| 576 | if (nt->NEntry() < 1) {
|
---|
| 577 | cout << "Services2NObjMgr::ProjectHProf() Warning Zero points satisfy cut !" << endl;
|
---|
| 578 | delete nt;
|
---|
| 579 | return;
|
---|
| 580 | }
|
---|
[1091] | 581 | r_8 xmin, xmax;
|
---|
[333] | 582 | nt->GetMinMax(0, xmin, xmax);
|
---|
| 583 | hprof = new HProf(xmin, xmax, 100);
|
---|
| 584 | int k;
|
---|
| 585 | float* xn;
|
---|
| 586 | for(k=0; k<nt->NEntry(); k++) {
|
---|
| 587 | xn = nt->GetVec(k);
|
---|
| 588 | hprof->Add(xn[0], xn[1], xn[2]);
|
---|
| 589 | }
|
---|
| 590 | delete nt;
|
---|
| 591 | mOmg->AddObj(hprof, nomprof);
|
---|
| 592 | }
|
---|
[1090] | 593 | hprof->UpdateHisto();
|
---|
[333] | 594 |
|
---|
| 595 | mOmg->DisplayObj(nomprof, dopt);
|
---|
| 596 | return;
|
---|
| 597 | }
|
---|
| 598 |
|
---|
[357] | 599 |
|
---|
[333] | 600 | /* --Methode-- */
|
---|
[357] | 601 | void Services2NObjMgr::FillVect(string& nom, string& expx, string& expv,
|
---|
| 602 | string& expcut, string& nomvec, string dopt, string loop)
|
---|
[333] | 603 | {
|
---|
| 604 | NObjMgrAdapter* obja=NULL;
|
---|
| 605 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 606 | if (obja == NULL) {
|
---|
[357] | 607 | cout << "Services2NObjMgr::FillVect() Error , No such object: " << nom << endl;
|
---|
[333] | 608 | return;
|
---|
| 609 | }
|
---|
| 610 | if (!mImgapp) return;
|
---|
| 611 |
|
---|
[357] | 612 | Vector* v1 = NULL;
|
---|
| 613 | AnyDataObj* ov = NULL;
|
---|
| 614 | ov=mOmg->GetObj(nomvec);
|
---|
| 615 | if (ov != NULL) v1 = dynamic_cast<Vector *>(ov);
|
---|
| 616 | if (v1 == NULL) {
|
---|
| 617 | cout << "Services2NObjMgr::FillVect() Error , No such object or not a vector: " << nomvec << endl;
|
---|
| 618 | return;
|
---|
| 619 | }
|
---|
| 620 |
|
---|
| 621 | char* ntn[2]= {"vi", "vv"};
|
---|
| 622 | NTuple* nt = new NTuple(2,ntn); // Creation NTuple
|
---|
| 623 |
|
---|
| 624 | string expz = "0.";
|
---|
| 625 | ComputeExpressions(obja, expx, expv, expz, expz, expcut, loop, nt);
|
---|
| 626 |
|
---|
| 627 | if (!nt) return;
|
---|
| 628 | if (nt->NEntry() < 1) {
|
---|
| 629 | cout << "Services2NObjMgr::FillVect() Warning Zero points satisfy cut !" << endl;
|
---|
| 630 | delete nt;
|
---|
| 631 | return;
|
---|
| 632 | }
|
---|
| 633 |
|
---|
| 634 | int i,k;
|
---|
| 635 | double* xn;
|
---|
| 636 | for(k=0; k<nt->NEntry(); k++) {
|
---|
| 637 | xn = nt->GetLineD(k);
|
---|
| 638 | i = xn[0]+0.5;
|
---|
| 639 | if ( (i < 0) || i >= v1->NElts() ) continue;
|
---|
| 640 | (*v1)(i) = xn[1];
|
---|
| 641 | }
|
---|
| 642 | delete nt;
|
---|
| 643 |
|
---|
| 644 |
|
---|
| 645 | mOmg->DisplayObj(nomvec, dopt);
|
---|
| 646 | return;
|
---|
| 647 | }
|
---|
| 648 |
|
---|
| 649 | /* --Methode-- */
|
---|
| 650 | void Services2NObjMgr::FillMatx(string& nom, string& expx, string& expy, string& expv,
|
---|
| 651 | string& expcut, string& nommtx, string dopt, string loop)
|
---|
| 652 | {
|
---|
| 653 | NObjMgrAdapter* obja=NULL;
|
---|
| 654 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 655 | if (obja == NULL) {
|
---|
| 656 | cout << "Services2NObjMgr::FillMatx() Error , No such objet " << nom << endl;
|
---|
| 657 | return;
|
---|
| 658 | }
|
---|
| 659 | if (!mImgapp) return;
|
---|
| 660 |
|
---|
| 661 | Matrix* mtx = NULL;
|
---|
| 662 | AnyDataObj* om = NULL;
|
---|
| 663 | om=mOmg->GetObj(nommtx);
|
---|
| 664 | if (om != NULL) mtx = dynamic_cast<Matrix *>(om);
|
---|
| 665 | if (mtx == NULL) {
|
---|
| 666 | cout << "Services2NObjMgr::FillMatx() Error , No such object or not a matrix " << nommtx << endl;
|
---|
| 667 | return;
|
---|
| 668 | }
|
---|
| 669 |
|
---|
| 670 | char* ntn[3]= {"mi", "mj", "mv"};
|
---|
| 671 | NTuple* nt = new NTuple(3,ntn); // Creation NTuple
|
---|
| 672 |
|
---|
| 673 | string expz = "0.";
|
---|
| 674 | ComputeExpressions(obja, expx, expy, expv, expz, expcut, loop, nt);
|
---|
| 675 |
|
---|
| 676 | if (!nt) return;
|
---|
| 677 | if (nt->NEntry() < 1) {
|
---|
| 678 | cout << "Services2NObjMgr::FillMatx() Warning Zero points satisfy cut !" << endl;
|
---|
| 679 | delete nt;
|
---|
| 680 | return;
|
---|
| 681 | }
|
---|
| 682 |
|
---|
| 683 | int ic, jl, k;
|
---|
| 684 | double* xn;
|
---|
| 685 | for(k=0; k<nt->NEntry(); k++) {
|
---|
| 686 | xn = nt->GetLineD(k);
|
---|
| 687 | ic = xn[0]+0.5;
|
---|
| 688 | jl = xn[1]+0.5;
|
---|
| 689 | if ( (ic < 0) || ic >= mtx->NCol() ) continue;
|
---|
| 690 | if ( (jl < 0) || jl >= mtx->NRows() ) continue;
|
---|
| 691 | (*mtx)(jl, ic) = xn[2];
|
---|
| 692 | }
|
---|
| 693 | delete nt;
|
---|
| 694 |
|
---|
| 695 |
|
---|
| 696 | mOmg->DisplayObj(nommtx, dopt);
|
---|
| 697 | return;
|
---|
| 698 |
|
---|
| 699 | }
|
---|
| 700 |
|
---|
| 701 | /* --Methode-- */
|
---|
| 702 | void Services2NObjMgr::ExpressionToVector(string& nom, string& expx, string& expcut,
|
---|
| 703 | string& nomvec, string dopt, string loop)
|
---|
| 704 | {
|
---|
| 705 | NObjMgrAdapter* obja=NULL;
|
---|
| 706 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 707 | if (obja == NULL) {
|
---|
[449] | 708 | cout << "Services2NObjMgr::ExpressionToVector() Error , No such object " << nom << endl;
|
---|
[357] | 709 | return;
|
---|
| 710 | }
|
---|
| 711 | if (!mImgapp) return;
|
---|
| 712 |
|
---|
[333] | 713 | NTuple* nt = NULL;
|
---|
[357] | 714 | if (nomvec.length() < 1) nomvec = "/tmp/expvec";
|
---|
[333] | 715 |
|
---|
| 716 | char* ntn[2]= {"vecval", "vecwt"};
|
---|
| 717 | nt = new NTuple(1,ntn); // Creation NTuple
|
---|
| 718 |
|
---|
| 719 | string expwt = "1.";
|
---|
| 720 | string expz = "0.";
|
---|
[357] | 721 | ComputeExpressions(obja, expx, expz, expz, expwt, expcut, loop, nt, NULL, NULL);
|
---|
[333] | 722 |
|
---|
| 723 | if (!nt) return;
|
---|
| 724 | if (nt->NEntry() < 1) {
|
---|
[357] | 725 | cout << "Services2NObjMgr::ExpressionToVector() Warning Zero points satisfy cut !" << endl;
|
---|
[333] | 726 | delete nt;
|
---|
| 727 | return;
|
---|
| 728 | }
|
---|
| 729 |
|
---|
| 730 | Vector* vec = new Vector(nt->NEntry());
|
---|
| 731 | int k;
|
---|
| 732 | float* xn;
|
---|
| 733 | for(k=0; k<nt->NEntry(); k++) {
|
---|
| 734 | xn = nt->GetVec(k);
|
---|
| 735 | (*vec)(k) = xn[0];
|
---|
| 736 | }
|
---|
| 737 | delete nt;
|
---|
| 738 | mOmg->AddObj(vec, nomvec);
|
---|
| 739 | mOmg->DisplayObj(nomvec, dopt);
|
---|
| 740 | return;
|
---|
| 741 | }
|
---|
| 742 |
|
---|
| 743 | /* --Methode-- */
|
---|
[447] | 744 | void Services2NObjMgr::NtFromASCIIFile(string& nom,string& filename,double def_val)
|
---|
| 745 | // Pour remplir un ntuple "nom" existant a partir du fichier
|
---|
| 746 | // ASCII table "filename". Si il y a plus de variables dans le
|
---|
| 747 | // ntuple que dans le fichier "filename",
|
---|
| 748 | // les sur-numeraires sont mises a "def_val" par defaut.
|
---|
| 749 | {
|
---|
[455] | 750 | AnyDataObj* mobj = mOmg->GetObj(nom);
|
---|
[447] | 751 | if(mobj == NULL)
|
---|
| 752 | {cout<<"NtFromASCIIFile() Error, object "<<nom<<" not existing"<<endl;
|
---|
| 753 | return;}
|
---|
| 754 | if(typeid(*mobj) != typeid(NTuple))
|
---|
| 755 | {cout<<"NtFromASCIIFile() Error, object "<<nom<<" not an NTuple"<<endl;
|
---|
| 756 | return;}
|
---|
| 757 | if (!mImgapp) return;
|
---|
| 758 |
|
---|
| 759 | NTuple* nt = (NTuple*) mobj;
|
---|
[449] | 760 | nt->FillFromASCIIFile(filename, def_val);
|
---|
[447] | 761 | return;
|
---|
| 762 | }
|
---|
| 763 |
|
---|
| 764 | /* --Methode-- */
|
---|
[333] | 765 | void Services2NObjMgr::FillNT(string& nom, string& expx, string& expy, string& expz,
|
---|
[357] | 766 | string& expt, string& expcut, string& nomnt, string loop)
|
---|
[333] | 767 | {
|
---|
| 768 | NObjMgrAdapter* obja=NULL;
|
---|
| 769 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 770 | if (obja == NULL) {
|
---|
[449] | 771 | cout << "Services2NObjMgr::FillNT() Error , No such object " << nom << endl;
|
---|
[333] | 772 | return;
|
---|
| 773 | }
|
---|
| 774 | if (!mImgapp) return;
|
---|
| 775 |
|
---|
| 776 | bool fgnnt = false;
|
---|
| 777 | NTuple* nt = NULL;
|
---|
| 778 | AnyDataObj* oh = NULL;
|
---|
| 779 | if (nomnt.length() > 0) oh=mOmg->GetObj(nomnt);
|
---|
| 780 | else nomnt = "/tmp/fillnt";
|
---|
| 781 | if ( (oh != NULL) && (typeid(*oh) == typeid(NTuple)) ) {
|
---|
| 782 | nt = (NTuple*)oh;
|
---|
| 783 | if (nt->NVar() > 10) {
|
---|
[449] | 784 | cout << "Services2NObjMgr::FillNT() Warning , Max 10 var in NTuple -> new NTuple" << endl;
|
---|
[333] | 785 | nt = NULL;
|
---|
| 786 | }
|
---|
| 787 | }
|
---|
| 788 | if (nt == NULL) {
|
---|
| 789 | char* ntn[4]= {"x", "y","z","t"};
|
---|
| 790 | nt = new NTuple(4,ntn); // Creation NTuple
|
---|
| 791 | fgnnt = true;
|
---|
| 792 | }
|
---|
| 793 |
|
---|
[357] | 794 | ComputeExpressions(obja, expx, expy, expz, expt, expcut, loop, nt, NULL, NULL);
|
---|
[333] | 795 |
|
---|
| 796 | if (fgnnt) mOmg->AddObj(nt, nomnt);
|
---|
| 797 | return;
|
---|
| 798 |
|
---|
| 799 | }
|
---|
| 800 |
|
---|
| 801 | /* --Methode-- */
|
---|
| 802 | void Services2NObjMgr::FillNTFrCFile(string & nom, string const & fname,
|
---|
[357] | 803 | string const & funcname, string & nomnt, string loop)
|
---|
[333] | 804 | {
|
---|
| 805 | if (!mImgapp) return;
|
---|
| 806 |
|
---|
| 807 | NObjMgrAdapter* obja=NULL;
|
---|
| 808 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 809 | if (obja == NULL) {
|
---|
| 810 | cout << "Services2NObjMgr::FillNTFrCFile( " << nom << "...) No such object" <<endl;
|
---|
| 811 | return;
|
---|
| 812 | }
|
---|
[344] | 813 | bool adel = true;
|
---|
| 814 | NTupleInterface* objnt = obja->GetNTupleInterface(adel);
|
---|
[333] | 815 | if (objnt == NULL) {
|
---|
[449] | 816 | cout << "Services2NObjMgr::FillNTFrCFile( " << nom << "...) Not an NTupleInterface !" <<endl;
|
---|
[333] | 817 | return;
|
---|
| 818 | }
|
---|
| 819 |
|
---|
| 820 | NTLoopExprFunc f = (NTLoopExprFunc)LinkFunctionFromFile(fname, funcname);
|
---|
| 821 | if (!f) {
|
---|
| 822 | cerr << "Services2NObjMgr::FillNTFrCFile Error Creation NTLoopExprFunc" << endl;
|
---|
[344] | 823 | if (adel) delete objnt; // Delete de l'objet NTupleInterface si necessaire
|
---|
[333] | 824 | return;
|
---|
| 825 | }
|
---|
| 826 |
|
---|
| 827 | bool fgnnt = false;
|
---|
| 828 | NTuple* nt = NULL;
|
---|
| 829 | if (nomnt.length() > 0) {
|
---|
| 830 | AnyDataObj* oh = NULL;
|
---|
| 831 | oh=mOmg->GetObj(nomnt);
|
---|
| 832 | if ( (oh != NULL) && (typeid(*oh) == typeid(NTuple)) ) {
|
---|
| 833 | nt = (NTuple*)oh;
|
---|
| 834 | if (nt->NVar() > 10) {
|
---|
[449] | 835 | cout << "Services2NObjMgr::FillNTFrCFile() Warning , Max 10 var in NTuple -> new NTuple" << endl;
|
---|
[333] | 836 | nt = NULL;
|
---|
| 837 | }
|
---|
| 838 | }
|
---|
| 839 | if (nt == NULL) {
|
---|
| 840 | char* ntn[4]= {"x", "y","z","t"};
|
---|
| 841 | nt = new NTuple(4,ntn); // Creation NTuple
|
---|
| 842 | fgnnt = true;
|
---|
| 843 | }
|
---|
| 844 | }
|
---|
| 845 |
|
---|
| 846 | double xnt[10];
|
---|
| 847 | float fxnt[10];
|
---|
| 848 |
|
---|
| 849 | int i,k;
|
---|
| 850 | for(i=0; i<10; i++) fxnt[i] = xnt[i] = 0.;
|
---|
| 851 |
|
---|
| 852 |
|
---|
| 853 | // $CHECK$ A virer des que possible - Pb blocage application quand trop d'impression
|
---|
| 854 | // redirige - On redirige la sortie sur le terminal
|
---|
| 855 | bool red = mImgapp->HasRedirectedStdOutErr();
|
---|
| 856 | mImgapp->RedirectStdOutErr(false);
|
---|
| 857 |
|
---|
[357] | 858 | int k1,k2,dk;
|
---|
| 859 | k1 = 0; k2 = objnt->NbLines(); dk = 1;
|
---|
| 860 | DecodeLoopParameters(loop, k1, k2, dk);
|
---|
| 861 | if (k1 < 0) k1 = 0;
|
---|
| 862 | if (k2 < 0) k2 = objnt->NbLines();
|
---|
| 863 | if (k2 > objnt->NbLines()) k2 = objnt->NbLines();
|
---|
| 864 | if (dk <= 0) dk = 1;
|
---|
| 865 |
|
---|
[500] | 866 | try {
|
---|
[333] | 867 | double* xn;
|
---|
[357] | 868 | int kmax = k2;
|
---|
| 869 | for(k=k1; k<kmax; k+=dk) {
|
---|
[333] | 870 | xn = objnt->GetLineD(k);
|
---|
| 871 | if (f(xn, xnt, xnt+1, xnt+2, xnt+3, k, kmax) != 0) {
|
---|
| 872 | if (nt) {
|
---|
| 873 | for(i=0; i<4; i++) fxnt[i] = xnt[i];
|
---|
| 874 | nt->Fill(fxnt);
|
---|
| 875 | }
|
---|
| 876 | }
|
---|
| 877 | }
|
---|
| 878 | }
|
---|
[500] | 879 | #ifdef SANS_EVOLPLANCK
|
---|
[333] | 880 | CATCH(merr) {
|
---|
| 881 | fflush(stdout);
|
---|
| 882 | cout << endl;
|
---|
| 883 | cerr << endl;
|
---|
| 884 | string es = PeidaExc(merr);
|
---|
| 885 | cerr << "Services2NObjMgr::FillNTFrCFile() Exception :" << merr << es;
|
---|
| 886 | } ENDTRY;
|
---|
[500] | 887 | #else
|
---|
| 888 | catch ( PException exc ) {
|
---|
| 889 | fflush(stdout);
|
---|
| 890 | cout << endl;
|
---|
| 891 | cerr << endl;
|
---|
| 892 | cerr << "Services2NObjMgr::FillNTFrCFile() Exception :" << exc.Msg() << endl;
|
---|
| 893 | }
|
---|
| 894 | #endif
|
---|
[344] | 895 |
|
---|
| 896 | if (adel) delete objnt; // Delete de l'objet NTupleInterface si necessaire
|
---|
[333] | 897 | CloseDLL();
|
---|
| 898 |
|
---|
| 899 | // $CHECK$ A virer des que possible On redirige la sortie sur la fenetre PIConsole
|
---|
| 900 | mImgapp->RedirectStdOutErr(red);
|
---|
| 901 |
|
---|
| 902 | if (fgnnt) mOmg->AddObj(nt, nomnt);
|
---|
| 903 | return;
|
---|
| 904 | }
|
---|
| 905 |
|
---|
| 906 | /* --Methode-- */
|
---|
| 907 | void Services2NObjMgr::PrepareNTExpressionCFile(string & nom, string const & fname,
|
---|
| 908 | string const & funcname)
|
---|
| 909 | {
|
---|
| 910 | NObjMgrAdapter* obja=NULL;
|
---|
| 911 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 912 | if (obja == NULL) {
|
---|
| 913 | cout << "Services2NObjMgr::PrepareNTExpressionCFile( " << nom << "...) No such object" <<endl;
|
---|
| 914 | return;
|
---|
| 915 | }
|
---|
[344] | 916 | bool adel = true;
|
---|
| 917 | NTupleInterface* objnt = obja->GetNTupleInterface(adel);
|
---|
[333] | 918 | if (objnt == NULL) {
|
---|
| 919 | cout << "Services2NObjMgr::PrepareNTExpressionCFile( " << nom
|
---|
| 920 | << "...) No NTupleInterface !" <<endl;
|
---|
| 921 | return;
|
---|
| 922 | }
|
---|
| 923 | string vardec = objnt->VarList_C("_xnti_");
|
---|
| 924 |
|
---|
| 925 | FILE *fip;
|
---|
| 926 | if ((fip = fopen(fname.c_str(), "w")) == NULL) {
|
---|
| 927 | cout << "Services2NObjMgr::PrepareNTExpressionCFile()_Error: fopen " << fname << endl;
|
---|
[344] | 928 | if (adel) delete objnt; // Delete de l'objet NTupleInterface si necessaire
|
---|
[333] | 929 | return;
|
---|
| 930 | }
|
---|
[344] | 931 |
|
---|
[333] | 932 | // constitution du fichier des decalarations des variables de l'interface NTuple
|
---|
| 933 | fputs("#include <stdlib.h> \n", fip);
|
---|
| 934 | fputs("#include <stdio.h> \n", fip);
|
---|
| 935 | fputs("#include <math.h> \n\n", fip);
|
---|
[344] | 936 |
|
---|
| 937 | fputs("/* ------ Some random number generators --------- */ \n", fip);
|
---|
| 938 | fputs("#define frand01() ( (float) drand48() ) \n", fip);
|
---|
| 939 | fputs("#define drand01() drand48() \n", fip);
|
---|
| 940 | fputs("#define rand01() drand48() \n", fip);
|
---|
| 941 | fputs("#define frandpm1() ( 2. * frand01() - 1.) \n", fip);
|
---|
| 942 | fputs("#define drandpm1() ( 2. * drand01() - 1.) \n", fip);
|
---|
| 943 | fputs("#define randpm1() ( 2. * drand01() - 1.) \n", fip);
|
---|
| 944 | fputs("double NorRand(void) \n", fip);
|
---|
| 945 | fputs(" { \n double x,A,B; \n LAB10: \n A = drand01(); \n", fip);
|
---|
| 946 | fputs(" if ( A == 0. ) goto LAB10; \n B = drand01(); \n", fip);
|
---|
[345] | 947 | fputs(" x = sqrt(-2.*log(A))*cos(2.*M_PI*B); \n", fip);
|
---|
[344] | 948 | fputs(" return(x); \n } \n", fip);
|
---|
| 949 | fputs("#define GauRand() NorRand() \n", fip);
|
---|
| 950 | fputs("#define gaurand() NorRand() \n\n", fip);
|
---|
| 951 |
|
---|
[333] | 952 | fputs("/* NTupleInterface Variable declaration - Generated by piapp \n", fip);
|
---|
| 953 | fputs(" -- Services2NObjMgr::PrepareNTExpressionCFile() -- */ \n\n", fip);
|
---|
| 954 | fprintf(fip,"int %s(double* _xnti_, double* _rx_, double* _ry_, double* _rz_, \n",
|
---|
| 955 | funcname.c_str());
|
---|
| 956 | fprintf(fip," double* _rt_, int _n_, int _nmax_) \n");
|
---|
| 957 | fprintf(fip, "{ \n %s \n", vardec.c_str());
|
---|
| 958 | fputs(" if (!1) { /* Cut Expression failed */ \n", fip);
|
---|
| 959 | fputs(" *_rx_ = *_ry_ = *_rz_ = *_rt_ = 0.; return(0);", fip);
|
---|
| 960 | fputs(" } \n /* Cut expression satisfied */ \n", fip);
|
---|
| 961 | fputs(" *_rx_ = 1.; \n *_ry_ = 1.; \n *_rz_ = 1.; \n *_rt_ = 1.; \n", fip);
|
---|
| 962 | fputs(" return(1); \n} \n", fip);
|
---|
| 963 |
|
---|
| 964 | fclose(fip);
|
---|
[344] | 965 |
|
---|
| 966 | if (adel) delete objnt; // Delete de l'objet NTupleInterface si necessaire
|
---|
[333] | 967 | return;
|
---|
| 968 | }
|
---|
| 969 |
|
---|
| 970 | /* --Methode-- cmv 13/10/98 */
|
---|
| 971 | void Services2NObjMgr::FillGFD(string& nom, string& expx, string& expy, string& expz,
|
---|
[357] | 972 | string& experr, string& expcut, string& nomgfd, string loop)
|
---|
[333] | 973 | // Pour remplir un ``GeneralFitData'' a partir de divers objets:
|
---|
| 974 | //| nom = nom de l'objet a transcrire selon 1D: Z=f(X) ou 2D: Z=f(X,Y) .
|
---|
| 975 | //| Vector,Matrix,Histo,HProf,Histo2D,Image<T>,StarList,NTuple,GeneralFitData
|
---|
| 976 | //| expx = expression X du GeneralFitData (1er abscisse)
|
---|
| 977 | //| expy = expression Y du GeneralFitData (2sd abscisse si non "", Z=f(X,Y))
|
---|
| 978 | //| expz = expression Z du GeneralFitData (valeur de l'ordonnee)
|
---|
| 979 | //| experr = expression de l'erreur sur l'ordonnee Z
|
---|
| 980 | //| expcut = expression du test de selection
|
---|
| 981 | //| nomgfd = nom du GeneralFitData engendre (optionnel)
|
---|
| 982 | {
|
---|
| 983 | NObjMgrAdapter* obja=NULL;
|
---|
| 984 | obja = mOmg->GetObjAdapter(nom);
|
---|
| 985 | if (obja == NULL) {
|
---|
[449] | 986 | cout << "Services2NObjMgr::FillGFD() Error , No such object "<<nom<<endl;
|
---|
[333] | 987 | return;
|
---|
| 988 | }
|
---|
| 989 | if(!mImgapp) return;
|
---|
| 990 |
|
---|
| 991 | // 2D ou 3D?
|
---|
| 992 | int nvar = 2;
|
---|
| 993 | if(expy.length()<=0) {nvar = 1; expy = "0.";}
|
---|
| 994 |
|
---|
| 995 | // Creation NTuple Buffer
|
---|
| 996 | char* ntn[4]= {"x","y","f","e"};
|
---|
| 997 | NTuple*nt = new NTuple(4,ntn);
|
---|
| 998 |
|
---|
| 999 | // Remplissage NTuple buffer
|
---|
[357] | 1000 | ComputeExpressions(obja, expx, expy, expz, experr, expcut, loop, nt, NULL, NULL);
|
---|
[333] | 1001 | if(nt->NEntry() < 1)
|
---|
| 1002 | {cout<<"Services2NObjMgr::FillGFD() Warning Zero points satisfy cut !"<<endl;
|
---|
| 1003 | delete nt; return;}
|
---|
| 1004 |
|
---|
| 1005 | //Remplissage de la structure GeneraFitData
|
---|
| 1006 | if (nt->NEntry() <= 0) {
|
---|
| 1007 | cout<<"Services2NObjMgr::FillGFD() Warning - NData= " << nt->NEntry() << endl;
|
---|
| 1008 | delete nt;
|
---|
| 1009 | return;
|
---|
| 1010 | }
|
---|
| 1011 |
|
---|
| 1012 | GeneralFitData* gfd = new GeneralFitData(nvar,nt->NEntry(),0);
|
---|
| 1013 | int k;
|
---|
| 1014 | float* xn;
|
---|
| 1015 | for(k=0; k<nt->NEntry(); k++) {
|
---|
| 1016 | xn = nt->GetVec(k);
|
---|
| 1017 | gfd->AddData(xn,xn[2],xn[3]);
|
---|
| 1018 | }
|
---|
| 1019 |
|
---|
| 1020 | // Menage et table d'objets
|
---|
| 1021 | delete nt;
|
---|
| 1022 | mOmg->AddObj(gfd, nomgfd);
|
---|
| 1023 | return;
|
---|
| 1024 | }
|
---|
| 1025 |
|
---|
[1067] | 1026 | /* --Methode-- cmv 12/07/00 */
|
---|
| 1027 | void Services2NObjMgr::FillGFDfrVec(string nomgfd,string namx,string namy,string namz,string name)
|
---|
| 1028 | // Pour remplir un ``GeneralFitData'' a partir de vecteurs
|
---|
| 1029 | //| gdfrvec nomgd X Y ! !
|
---|
| 1030 | //| gdfrvec nomgd X Y ! EY
|
---|
| 1031 | //| gdfrvec nomgd X Y Z !
|
---|
| 1032 | //| gdfrvec nomgd X Y Z EZ
|
---|
| 1033 | //| - nomgfd = nom du generaldata a remplir
|
---|
| 1034 | //| - namx = nom du vecteur contenant les valeurs X
|
---|
| 1035 | //| - namy = nom du vecteur contenant les valeurs Y
|
---|
| 1036 | //| - namz = nom du vecteur contenant les valeurs Z (ou "!")
|
---|
| 1037 | //| - name = nom du vecteur contenant les valeurs des erreurs EY ou EZ
|
---|
| 1038 | {
|
---|
| 1039 | // Decodage des noms des vecteurs pour le remplissage du generaldata
|
---|
| 1040 | if(nomgfd=="!" || nomgfd.length()<1)
|
---|
| 1041 | {cout<<"FillGFDfrVec_Error: bad GenaralData name "<<nomgfd<<endl; return;}
|
---|
| 1042 | if(namx=="!" || namx.length()<1)
|
---|
| 1043 | {cout<<"FillGFDfrVec_Error: bad X vector name "<<namx<<endl; return;}
|
---|
| 1044 | if(namy=="!" || namy.length()<1)
|
---|
| 1045 | {cout<<"FillGFDfrVec_Error: bad Y vector name "<<namy<<endl; return;}
|
---|
| 1046 | if(namz.length()<1) namz = "!";
|
---|
| 1047 | if(name.length()<1) name = "!";
|
---|
| 1048 | int nvar = 0;
|
---|
| 1049 | if(namz=="!") nvar = 1; else nvar = 2;
|
---|
[333] | 1050 |
|
---|
[1067] | 1051 | // Identify data
|
---|
| 1052 | NamedObjMgr omg;
|
---|
| 1053 | AnyDataObj* mobj = NULL;
|
---|
| 1054 | Vector* v;
|
---|
| 1055 | int nel = 0;
|
---|
| 1056 | r_8 *x=NULL, *y=NULL, *z=NULL,* ez=NULL;
|
---|
| 1057 |
|
---|
| 1058 | if( (mobj=omg.GetObj(namx)) == NULL) {
|
---|
| 1059 | cout<<"FillGFDfrVec_Error: unknown X object "<<namx<<endl; return;
|
---|
| 1060 | } else {
|
---|
| 1061 | v = (Vector*) mobj; x = v->Data(); nel=v->NElts();
|
---|
| 1062 | }
|
---|
| 1063 |
|
---|
| 1064 | if( (mobj=omg.GetObj(namy)) == NULL) {
|
---|
| 1065 | cout<<"FillGFDfrVec_Error: unknown Y object "<<namy<<endl; return;
|
---|
| 1066 | } else {
|
---|
| 1067 | v = (Vector*) mobj; y = z = v->Data(); if(v->NElts()<nel) nel=v->NElts();
|
---|
| 1068 | }
|
---|
| 1069 |
|
---|
| 1070 | if( nvar==2 && (mobj=omg.GetObj(namz)) == NULL) {
|
---|
| 1071 | cout<<"FillGFDfrVec_Error: unknown Z object "<<namz<<endl; return;
|
---|
| 1072 | } else {
|
---|
| 1073 | v = (Vector*) mobj; z = v->Data(); if(v->NElts()<nel) nel=v->NElts();
|
---|
| 1074 | }
|
---|
| 1075 |
|
---|
| 1076 | if(name!="!") {
|
---|
| 1077 | if( (mobj=omg.GetObj(name)) == NULL) {
|
---|
| 1078 | cout<<"FillGFDfrVec_Error: unknown EZ object "<<name<<endl; return;
|
---|
| 1079 | } else {
|
---|
| 1080 | v = (Vector*) mobj; ez = v->Data(); if(v->NElts()<nel) nel=v->NElts();
|
---|
| 1081 | }
|
---|
| 1082 | }
|
---|
| 1083 |
|
---|
| 1084 | if(nel<=0)
|
---|
| 1085 | {cout<<"FillGFDfrVec_Error: bad number of elements "<<nel<<endl; return;}
|
---|
| 1086 |
|
---|
| 1087 | // Create GeneralData and fill it with vectors
|
---|
| 1088 | GeneralFitData* gfd = new GeneralFitData(nvar,nel+5,0);
|
---|
| 1089 | if(nvar==1) gfd->SetData1(nel,x,z,ez); // On remplit Y=f(X)
|
---|
| 1090 | else gfd->SetData2(nel,x,y,z,ez); // On remplit Z=f(X,y)
|
---|
| 1091 |
|
---|
| 1092 | // Menage et table d'objets
|
---|
| 1093 | if( omg.GetObj(nomgfd) != NULL ) omg.DelObj(nomgfd);
|
---|
| 1094 | mOmg->AddObj(gfd,nomgfd);
|
---|
| 1095 | return;
|
---|
| 1096 | }
|
---|
| 1097 |
|
---|
[333] | 1098 | /* --Methode-- */
|
---|
| 1099 | void Services2NObjMgr::ComputeExpressions(NObjMgrAdapter* obja, string& expx,
|
---|
[357] | 1100 | string& expy, string& expz, string& expt, string& expcut, string& loop,
|
---|
[333] | 1101 | NTuple* nt, Histo* h1, Histo2D* h2, HProf* hp)
|
---|
| 1102 | {
|
---|
| 1103 | if (obja == NULL) return;
|
---|
[344] | 1104 | bool adel = true;
|
---|
| 1105 | NTupleInterface* objnt = obja->GetNTupleInterface(adel);
|
---|
[333] | 1106 | if (objnt == NULL) return;
|
---|
| 1107 | string vardec = objnt->VarList_C("_zz6qi_");
|
---|
| 1108 |
|
---|
| 1109 | PlotExprFunc f = LinkExprFunc(vardec, expx, expy, expz, expt, expcut);
|
---|
| 1110 | if (!f) {
|
---|
| 1111 | cerr << "Services2NObjMgr::::ComputeExpressions() Error Creation PlotExprFunc " << endl;
|
---|
[344] | 1112 | if (adel) delete objnt; // Delete de l'objet NTupleInterface si necessaire
|
---|
[333] | 1113 | return;
|
---|
| 1114 | }
|
---|
| 1115 |
|
---|
| 1116 | double xnt[10];
|
---|
| 1117 | float fxnt[10];
|
---|
| 1118 |
|
---|
| 1119 | int i,k;
|
---|
| 1120 | for(i=0; i<10; i++) xnt[i] = 0.;
|
---|
[357] | 1121 | int k1,k2,dk;
|
---|
| 1122 | k1 = 0; k2 = objnt->NbLines(); dk = 1;
|
---|
| 1123 | DecodeLoopParameters(loop, k1, k2, dk);
|
---|
| 1124 | if (k1 < 0) k1 = 0;
|
---|
| 1125 | if (k2 < 0) k2 = objnt->NbLines();
|
---|
| 1126 | if (k2 > objnt->NbLines()) k2 = objnt->NbLines();
|
---|
| 1127 | if (dk <= 0) dk = 1;
|
---|
[500] | 1128 |
|
---|
| 1129 | try {
|
---|
[333] | 1130 | double* xn;
|
---|
[357] | 1131 | for(k=k1; k<k2; k += dk) {
|
---|
[333] | 1132 | xn = objnt->GetLineD(k);
|
---|
| 1133 | if (f(xn, xnt, xnt+1, xnt+2, xnt+3) != 0) {
|
---|
| 1134 | if (nt) {
|
---|
| 1135 | for(i=0; i<4; i++) fxnt[i] = xnt[i];
|
---|
| 1136 | nt->Fill(fxnt);
|
---|
| 1137 | }
|
---|
| 1138 | if (h1) h1->Add(xnt[0], xnt[3]);
|
---|
| 1139 | if (h2) h2->Add(xnt[0], xnt[1], xnt[3]);
|
---|
| 1140 | if (hp) hp->Add(xnt[0], xnt[1], xnt[3]);
|
---|
| 1141 | }
|
---|
| 1142 | }
|
---|
| 1143 | }
|
---|
[500] | 1144 | #ifdef SANS_EVOLPLANCK
|
---|
[333] | 1145 | CATCH(merr) {
|
---|
| 1146 | fflush(stdout);
|
---|
| 1147 | cout << endl;
|
---|
| 1148 | cerr << endl;
|
---|
| 1149 | string es = PeidaExc(merr);
|
---|
| 1150 | cerr << "Services2NObjMgr::ComputeExpressions() Exception :" << merr << es;
|
---|
| 1151 | } ENDTRY;
|
---|
[500] | 1152 | #else
|
---|
| 1153 | catch ( PException exc ) {
|
---|
| 1154 | fflush(stdout);
|
---|
| 1155 | cout << endl;
|
---|
| 1156 | cerr << endl;
|
---|
| 1157 | cerr << "Services2NObjMgr::ComputeExpressions() Exception :" << exc.Msg() << endl;
|
---|
| 1158 | }
|
---|
| 1159 | #endif
|
---|
[333] | 1160 |
|
---|
[344] | 1161 | if (adel) delete objnt; // Delete de l'objet NTupleInterface si necessaire
|
---|
[333] | 1162 | // Fermeture du fichier .so
|
---|
| 1163 | CloseDLL();
|
---|
| 1164 | return;
|
---|
| 1165 | }
|
---|
| 1166 |
|
---|
| 1167 |
|
---|
| 1168 | /* --Methode-- */
|
---|
| 1169 | PlotExprFunc Services2NObjMgr::LinkExprFunc(string& vardec, string& expx, string& expy,
|
---|
| 1170 | string& expz, string& expt, string& cut)
|
---|
| 1171 | {
|
---|
| 1172 | FILE *fip;
|
---|
| 1173 | string fname = TmpDir + "expf_pia_dl.c";
|
---|
| 1174 | string cmd;
|
---|
| 1175 | int rc;
|
---|
| 1176 |
|
---|
| 1177 | cmd = "rm -f " + fname;
|
---|
| 1178 | rc = system(cmd.c_str());
|
---|
| 1179 | //DBG printf("LinkExprFunc_Do> %s (Rc=%d)\n", cmd.c_str(), rc);
|
---|
| 1180 |
|
---|
| 1181 | if ((fip = fopen(fname.c_str(), "w")) == NULL) {
|
---|
| 1182 | string sn = fname;
|
---|
[449] | 1183 | cout << "Services2NObjMgr/LinkExprFunc_Error: fopen( " << sn << endl;
|
---|
[333] | 1184 | return(NULL);
|
---|
| 1185 | }
|
---|
| 1186 |
|
---|
| 1187 | // constitution du fichier a compiler
|
---|
| 1188 | fputs("#include <stdlib.h> \n", fip);
|
---|
| 1189 | fputs("#include <math.h> \n", fip);
|
---|
[344] | 1190 |
|
---|
| 1191 | fputs("/* ------ Some random number generators --------- */ \n", fip);
|
---|
| 1192 | fputs("#define frand01() ( (float) drand48() ) \n", fip);
|
---|
| 1193 | fputs("#define drand01() drand48() \n", fip);
|
---|
| 1194 | fputs("#define rand01() drand48() \n", fip);
|
---|
| 1195 | fputs("#define frandpm1() ( 2. * frand01() - 1.) \n", fip);
|
---|
| 1196 | fputs("#define drandpm1() ( 2. * drand01() - 1.) \n", fip);
|
---|
| 1197 | fputs("#define randpm1() ( 2. * drand01() - 1.) \n", fip);
|
---|
| 1198 | fputs("double NorRand(void) \n", fip);
|
---|
| 1199 | fputs(" { \n double x,A,B; \n LAB10: \n A = drand01(); \n", fip);
|
---|
| 1200 | fputs(" if ( A == 0. ) goto LAB10; \n B = drand01(); \n", fip);
|
---|
[345] | 1201 | fputs(" x = sqrt(-2.*log(A))*cos(2.*M_PI*B); \n", fip);
|
---|
[344] | 1202 | fputs(" return(x); \n } \n", fip);
|
---|
| 1203 | fputs("#define GauRand() NorRand() \n", fip);
|
---|
| 1204 | fputs("#define gaurand() NorRand() \n\n", fip);
|
---|
| 1205 |
|
---|
[333] | 1206 | fputs("int expf_pia_dl_func(double* _zz6qi_, double* _rx_6q_, double* _ry_6q_, double* _rz_6q_, double* _rt_6q_) \n{\n", fip);
|
---|
| 1207 | fprintf(fip,"%s \n", vardec.c_str());
|
---|
| 1208 | fprintf(fip, "if (!(%s)) { *_rx_6q_ = *_ry_6q_ = *_rz_6q_ = *_rt_6q_ = 0.; return(0); } \n", cut.c_str());
|
---|
| 1209 | fprintf(fip, "*_rx_6q_ = %s ; \n", expx.c_str());
|
---|
| 1210 | fprintf(fip, "*_ry_6q_ = %s ; \n", expy.c_str());
|
---|
| 1211 | fprintf(fip, "*_rz_6q_ = %s ; \n", expz.c_str());
|
---|
| 1212 | fprintf(fip, "*_rt_6q_ = %s ; \n", expt.c_str());
|
---|
| 1213 | fputs("return(1); \n} \n", fip);
|
---|
| 1214 | fclose(fip);
|
---|
| 1215 | string func = "expf_pia_dl_func";
|
---|
| 1216 | return((PlotExprFunc)LinkFunctionFromFile(fname, func));
|
---|
| 1217 | }
|
---|
| 1218 |
|
---|
| 1219 |
|
---|
| 1220 | /* --Methode-- */
|
---|
| 1221 | DlFunction Services2NObjMgr::LinkFunctionFromFile(string const & fname, string const & funcname)
|
---|
| 1222 | {
|
---|
| 1223 | // Le link dynamique
|
---|
| 1224 | CloseDLL();
|
---|
| 1225 | dynlink = PDynLinkMgr::BuildFromCFile(fname);
|
---|
| 1226 | if (dynlink == NULL) {
|
---|
| 1227 | cerr << "Services2NObjMgr/LinkFunctionFromFile_Erreur: Erreur creation/Ouverture SO " << endl;
|
---|
| 1228 | return(NULL);
|
---|
| 1229 | }
|
---|
| 1230 |
|
---|
| 1231 | DlFunction retfunc = dynlink->GetFunction(funcname);
|
---|
| 1232 | if (retfunc == NULL) {
|
---|
| 1233 | string sn = funcname;
|
---|
| 1234 | cerr << "Services2NObjMgr/LinkExprFunc_Erreur: Erreur linking " << sn << endl;
|
---|
| 1235 | CloseDLL();
|
---|
| 1236 | return(NULL);
|
---|
| 1237 | }
|
---|
| 1238 | else return(retfunc);
|
---|
| 1239 | }
|
---|
| 1240 |
|
---|
| 1241 | /* --Methode-- */
|
---|
| 1242 | void Services2NObjMgr::CloseDLL()
|
---|
| 1243 | {
|
---|
| 1244 | if (dynlink) delete dynlink; dynlink = NULL;
|
---|
| 1245 | }
|
---|
| 1246 |
|
---|
[357] | 1247 | // Fonction static
|
---|
| 1248 | /* --Methode-- */
|
---|
| 1249 | void Services2NObjMgr::DecodeLoopParameters(string& loop, int& i1, int& i2, int& di)
|
---|
| 1250 | {
|
---|
| 1251 | // Decode des paramatres de boucle for(int i=i1; i<i2; i+=di) specifies
|
---|
| 1252 | // sous forme i1[:i2[:di]]
|
---|
| 1253 | // cout << "LoopParam() " << loop << " I1=" << i1 << " I2=" << i2 << " DI=" << di;
|
---|
| 1254 | size_t l = loop.length();
|
---|
| 1255 | if (l < 1) return;
|
---|
| 1256 | size_t p = loop.find(':');
|
---|
| 1257 | if (p >= l) { i1 = atoi(loop.c_str()); return; }
|
---|
| 1258 | i1 = atoi(loop.substr(0, p).c_str());
|
---|
| 1259 | string aa = loop.substr(p+1);
|
---|
| 1260 | p = aa.find(':');
|
---|
| 1261 | if (p < aa.length() ) {
|
---|
| 1262 | i2 = atoi(aa.substr(0,p).c_str());
|
---|
| 1263 | di = atoi(aa.substr(p+1).c_str());
|
---|
| 1264 | }
|
---|
| 1265 | else i2 = atoi(aa.c_str());
|
---|
| 1266 | // cout << "-> I1= " << i1 << " I2= " << i2 << " DI= " << di << endl;
|
---|
| 1267 | return;
|
---|
| 1268 | }
|
---|
[333] | 1269 |
|
---|
| 1270 | /* --Methode-- */
|
---|
[165] | 1271 | string Services2NObjMgr::FileName2Name(string const & fn)
|
---|
| 1272 | {
|
---|
| 1273 |
|
---|
| 1274 | char fsep[2] = {FILESEP, '\0'};
|
---|
| 1275 | char tsep[2] = {'.', '\0'};
|
---|
| 1276 | size_t p = fn.find_last_of(fsep);
|
---|
[194] | 1277 | size_t l = fn.length();
|
---|
| 1278 | if (p >= l) p = 0;
|
---|
| 1279 | else p++;
|
---|
| 1280 | size_t q = fn.find_first_of(tsep,p);
|
---|
| 1281 | if (q < p) q = l;
|
---|
[165] | 1282 | return(fn.substr(p,q-p));
|
---|
| 1283 | }
|
---|
| 1284 |
|
---|
| 1285 |
|
---|
[546] | 1286 | // Variable pour stocker l'option de stat des drawers
|
---|
| 1287 | static bool stats_option = true;
|
---|
| 1288 | /* --Methode-- */
|
---|
| 1289 | void Services2NObjMgr::SetDefaultStatsOption(bool opt)
|
---|
| 1290 | {
|
---|
| 1291 | stats_option = opt;
|
---|
| 1292 | }
|
---|
| 1293 |
|
---|
[165] | 1294 | typedef vector<string> GraTok;
|
---|
| 1295 |
|
---|
| 1296 | /* --Methode-- */
|
---|
[546] | 1297 | bool Services2NObjMgr::GetStatsOption(string& gratt)
|
---|
| 1298 | {
|
---|
| 1299 | int ropt = Disp_Next;
|
---|
| 1300 | for(int i=0; i<gratt.length(); i++) gratt[i] = tolower(gratt[i]);
|
---|
| 1301 | // On separe en mots separes par des virgules
|
---|
| 1302 | gratt = ","+gratt;
|
---|
| 1303 | size_t p = 0;
|
---|
| 1304 | size_t q = 0;
|
---|
| 1305 | size_t l = gratt.length();
|
---|
| 1306 | string token;
|
---|
| 1307 |
|
---|
| 1308 | GraTok grt;
|
---|
| 1309 |
|
---|
| 1310 | while (q < l) {
|
---|
| 1311 | p = gratt.find_first_not_of(" ,",q+1); // au debut d'un token
|
---|
| 1312 | if (p>=l) break;
|
---|
| 1313 | q = gratt.find_first_of(" ,",p); // la fin du token;
|
---|
| 1314 | token = gratt.substr(p,q-p);
|
---|
| 1315 | grt.push_back(token);
|
---|
| 1316 | }
|
---|
| 1317 | int k;
|
---|
| 1318 | bool fgsame = false;
|
---|
| 1319 | int option = 0;
|
---|
| 1320 | for(k=0; k<grt.size(); k++) {
|
---|
| 1321 | if ( (grt[k] == "same") || (grt[k] == "s") ) option = 1;
|
---|
| 1322 | else if ( (grt[k] == "stat") || (grt[k] == "stats") ) option = 2;
|
---|
| 1323 | else if ( (grt[k] == "nostat") || (grt[k] == "nostats") ) option = 3;
|
---|
| 1324 | }
|
---|
| 1325 |
|
---|
| 1326 | if (option == 0) return(stats_option);
|
---|
| 1327 | else if ( (option == 1) || (option == 3) ) return(false);
|
---|
| 1328 | else return(true);
|
---|
| 1329 | }
|
---|
| 1330 |
|
---|
| 1331 | /* --Methode-- */
|
---|
[165] | 1332 | int Services2NObjMgr::DecodeDispOption(string& gratt, bool& fgsrgr)
|
---|
| 1333 | {
|
---|
| 1334 | int ropt = Disp_Next;
|
---|
| 1335 | if (!mImgapp) return(ropt);
|
---|
| 1336 |
|
---|
| 1337 | for(int i=0; i<gratt.length(); i++) gratt[i] = tolower(gratt[i]);
|
---|
| 1338 |
|
---|
| 1339 | if (fgsrgr) mImgapp->SaveGraphicAtt();
|
---|
| 1340 |
|
---|
[326] | 1341 | if ( (gratt == "def") || (gratt == "default") ) { // Remise aux valeurs par defaut = non defini
|
---|
[165] | 1342 | mImgapp->SetColAtt();
|
---|
| 1343 | mImgapp->SetLineAtt();
|
---|
| 1344 | mImgapp->SetFontAtt();
|
---|
| 1345 | mImgapp->SetMarkerAtt();
|
---|
| 1346 | mImgapp->SetColMapId();
|
---|
| 1347 | mImgapp->SetZoomAtt();
|
---|
[331] | 1348 | mImgapp->SetAxesAtt();
|
---|
| 1349 | mImgapp->SetXYLimits();
|
---|
| 1350 | mImgapp->UseXYLimits();
|
---|
[558] | 1351 | mImgapp->SetImageCenterPosition();
|
---|
| 1352 | mImgapp->UseImageCenter();
|
---|
[506] | 1353 | mImgapp->SetXLogScale();
|
---|
| 1354 | mImgapp->SetYLogScale();
|
---|
[1131] | 1355 | mImgapp->SetAutoAddTitle();
|
---|
[546] | 1356 | stats_option = true;
|
---|
[165] | 1357 | return(ropt);
|
---|
| 1358 | }
|
---|
| 1359 |
|
---|
| 1360 | // On separe en mots separes par des virgules
|
---|
| 1361 | gratt = ","+gratt;
|
---|
| 1362 | size_t p = 0;
|
---|
| 1363 | size_t q = 0;
|
---|
| 1364 | size_t l = gratt.length();
|
---|
| 1365 | string token;
|
---|
| 1366 |
|
---|
| 1367 | GraTok grt;
|
---|
| 1368 |
|
---|
| 1369 | while (q < l) {
|
---|
| 1370 | p = gratt.find_first_not_of(" ,",q+1); // au debut d'un token
|
---|
| 1371 | if (p>=l) break;
|
---|
| 1372 | q = gratt.find_first_of(" ,",p); // la fin du token;
|
---|
| 1373 | token = gratt.substr(p,q-p);
|
---|
| 1374 | grt.push_back(token);
|
---|
| 1375 | }
|
---|
| 1376 |
|
---|
| 1377 |
|
---|
| 1378 | static GrAttNames::iterator it;
|
---|
| 1379 |
|
---|
| 1380 | int k;
|
---|
| 1381 | bool fgcont = true;
|
---|
| 1382 | fgsrgr = false;
|
---|
| 1383 |
|
---|
| 1384 | for(k=0; k<grt.size(); k++) {
|
---|
| 1385 | // cout << "--DBG--SetGraphicAttributes() " << grt[k] << endl;
|
---|
| 1386 |
|
---|
| 1387 | // Decodage option affichage (win, next, etc
|
---|
| 1388 | fgcont = true;
|
---|
| 1389 | if ( (grt[k] == "win") || (grt[k] == "w") ) ropt = Disp_Win;
|
---|
| 1390 | else if ( (grt[k] == "same") || (grt[k] == "s") ) ropt = Disp_Same;
|
---|
[548] | 1391 | else if ( (grt[k] == "inset") || (grt[k] == "ins") ) ropt = Disp_Inset;
|
---|
[165] | 1392 | else if ( (grt[k] == "stack") || (grt[k] == "st") ) ropt = Disp_Stack;
|
---|
| 1393 | else fgcont = false;
|
---|
| 1394 | if (fgcont) continue;
|
---|
[331] | 1395 |
|
---|
| 1396 | // Utilisation limites X-Y
|
---|
[506] | 1397 | if ( grt[k] == "xylimits" ) { mImgapp->UseXYLimits(true); fgsrgr = true; continue; }
|
---|
[558] | 1398 | if ( grt[k] == "centerimg" ) { mImgapp->UseImageCenter(true); fgsrgr = true; continue; }
|
---|
[506] | 1399 | // Echelle logarithmique d'axe
|
---|
| 1400 | if ( grt[k] == "logx" ) { mImgapp->SetXLogScale(true); fgsrgr = true; continue; }
|
---|
| 1401 | if ( grt[k] == "linx" ) { mImgapp->SetXLogScale(false); fgsrgr = true; continue; }
|
---|
| 1402 | if ( grt[k] == "logy" ) { mImgapp->SetYLogScale(true); fgsrgr = true; continue; }
|
---|
| 1403 | if ( grt[k] == "liny" ) { mImgapp->SetYLogScale(false); fgsrgr = true; continue; }
|
---|
[1131] | 1404 | // Ajout automatique de titre
|
---|
| 1405 | if ( ( grt[k] == "tit" ) || ( grt[k] == "title" ) )
|
---|
| 1406 | { mImgapp->SetAutoAddTitle(true); fgsrgr = true; continue; }
|
---|
| 1407 | if ( ( grt[k] == "notit" ) || ( grt[k] == "notitle" ) )
|
---|
| 1408 | { mImgapp->SetAutoAddTitle(false); fgsrgr = true; continue; }
|
---|
[506] | 1409 |
|
---|
[165] | 1410 | // Si c'est une couleur
|
---|
| 1411 | it = GrAcolors.find(grt[k]);
|
---|
| 1412 | if (it != GrAcolors.end()) { mImgapp->SetColAtt((PIColors)((*it).second.a1)); fgsrgr = true; continue; }
|
---|
| 1413 | // Si c'est un attribut de lignes
|
---|
| 1414 | it = GrAlines.find(grt[k]);
|
---|
| 1415 | if (it != GrAlines.end()) { mImgapp->SetLineAtt((PILineAtt)((*it).second.a1)); fgsrgr = true; continue; }
|
---|
| 1416 | // Si c'est un attribut de fontes
|
---|
| 1417 | it = GrAfonts.find(grt[k]);
|
---|
| 1418 | if (it != GrAfonts.end()) { mImgapp->SetFontAtt((PIFontSize)((*it).second.a2), (PIFontAtt)((*it).second.a1) );
|
---|
| 1419 | fgsrgr = true; continue; }
|
---|
| 1420 | // Si c'est un attribut de markers
|
---|
| 1421 | it = GrAmarkers.find(grt[k]);
|
---|
| 1422 | if (it != GrAmarkers.end()) { mImgapp->SetMarkerAtt((*it).second.a2, (PIMarker)((*it).second.a1) );
|
---|
| 1423 | fgsrgr = true; continue; }
|
---|
| 1424 | // Si c'est un colormap
|
---|
| 1425 | it = GrAcmap.find(grt[k]);
|
---|
| 1426 | if (it != GrAcmap.end()) { mImgapp->SetColMapId( (CMapId)((*it).second.a1) ); fgsrgr = true; continue; }
|
---|
| 1427 | // Si c'est un facteur de zoom
|
---|
| 1428 | it = GrAzoom.find(grt[k]);
|
---|
| 1429 | if (it != GrAzoom.end()) { mImgapp->SetZoomAtt( (*it).second.a1 ); fgsrgr = true; continue; }
|
---|
[203] | 1430 | // Si c'est un attribut d'axe
|
---|
| 1431 | it = GrAaxes.find(grt[k]);
|
---|
| 1432 | if (it != GrAaxes.end()) { mImgapp->SetAxesAtt( (*it).second.a1 ); fgsrgr = true; continue; }
|
---|
[165] | 1433 |
|
---|
| 1434 | }
|
---|
| 1435 |
|
---|
| 1436 | return(ropt);
|
---|
| 1437 | }
|
---|
| 1438 |
|
---|
| 1439 |
|
---|
| 1440 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
---|
| 1441 | // Initialisation des chaines de caracteres designant les attributs graphiques
|
---|
| 1442 |
|
---|
| 1443 | /* --Methode-- */
|
---|
| 1444 | void Services2NObjMgr::InitGrAttNames()
|
---|
| 1445 | {
|
---|
| 1446 | gratt_item gi;
|
---|
| 1447 | // Les couleurs
|
---|
| 1448 | gi.a2 = 0;
|
---|
| 1449 | gi.a1 = PI_NotDefColor;
|
---|
| 1450 | GrAcolors["defcol"] = gi;
|
---|
| 1451 | gi.a1 = PI_Black;
|
---|
| 1452 | GrAcolors["black"] = gi;
|
---|
| 1453 | gi.a1 = PI_White;
|
---|
| 1454 | GrAcolors["white"] = gi;
|
---|
| 1455 | gi.a1 = PI_Grey;
|
---|
| 1456 | GrAcolors["grey"] = gi;
|
---|
| 1457 | gi.a1 = PI_Red;
|
---|
| 1458 | GrAcolors["red"] = gi;
|
---|
| 1459 | gi.a1 = PI_Blue;
|
---|
| 1460 | GrAcolors["blue"] = gi;
|
---|
| 1461 | gi.a1 = PI_Green;
|
---|
| 1462 | GrAcolors["green"] = gi;
|
---|
| 1463 | gi.a1 = PI_Yellow;
|
---|
| 1464 | GrAcolors["yellow"] = gi;
|
---|
| 1465 | gi.a1 = PI_Magenta;
|
---|
| 1466 | GrAcolors["magenta"] = gi;
|
---|
| 1467 |
|
---|
| 1468 | gi.a1 = PI_Cyan;
|
---|
| 1469 | GrAcolors["cyan"] = gi;
|
---|
| 1470 | gi.a1 = PI_Turquoise;
|
---|
| 1471 | GrAcolors["turquoise"] = gi;
|
---|
| 1472 | gi.a1 = PI_NavyBlue;
|
---|
| 1473 | GrAcolors["navyblue"] = gi;
|
---|
| 1474 | gi.a1 = PI_Orange;
|
---|
| 1475 | GrAcolors["orange"] = gi;
|
---|
| 1476 | gi.a1 = PI_SiennaRed;
|
---|
| 1477 | GrAcolors["siennared"] = gi;
|
---|
| 1478 | gi.a1 = PI_Purple;
|
---|
| 1479 | GrAcolors["purple"] = gi;
|
---|
| 1480 | gi.a1 = PI_LimeGreen;
|
---|
| 1481 | GrAcolors["limegreen"] = gi;
|
---|
| 1482 | gi.a1 = PI_Gold;
|
---|
| 1483 | GrAcolors["gold"] = gi;
|
---|
| 1484 |
|
---|
| 1485 | // Les attributs de lignes
|
---|
| 1486 | gi.a2 = 0;
|
---|
| 1487 | gi.a1 = PI_NotDefLineAtt;
|
---|
| 1488 | GrAlines["defline"] = gi;
|
---|
| 1489 | gi.a1 = PI_NormalLine;
|
---|
| 1490 | GrAlines["normalline"] = gi;
|
---|
| 1491 | gi.a1 = PI_ThinLine;
|
---|
| 1492 | GrAlines["thinline"] = gi;
|
---|
| 1493 | gi.a1 = PI_ThickLine;
|
---|
| 1494 | GrAlines["thickline"] = gi;
|
---|
| 1495 | gi.a1 = PI_DashedLine;
|
---|
| 1496 | GrAlines["dashedline"] = gi;
|
---|
| 1497 | gi.a1 = PI_ThinDashedLine;
|
---|
| 1498 | GrAlines["thindashedline"] = gi;
|
---|
| 1499 | gi.a1 = PI_ThickDashedLine;
|
---|
| 1500 | GrAlines["thickdashedline"] = gi;
|
---|
[192] | 1501 | gi.a1 = PI_DottedLine;
|
---|
| 1502 | GrAlines["dottedline"] = gi;
|
---|
| 1503 | gi.a1 = PI_ThinDottedLine;
|
---|
| 1504 | GrAlines["thindottedline"] = gi;
|
---|
| 1505 | gi.a1 = PI_ThickDottedLine;
|
---|
| 1506 | GrAlines["thickdottedline"] = gi;
|
---|
[165] | 1507 |
|
---|
[293] | 1508 | // Les fontes
|
---|
[165] | 1509 | gi.a2 = PI_NotDefFontSize;
|
---|
| 1510 | gi.a1 = PI_NotDefFontAtt;
|
---|
[349] | 1511 | GrAfonts["deffont"] = gi;
|
---|
[165] | 1512 |
|
---|
| 1513 | gi.a2 = PI_NormalSizeFont;
|
---|
| 1514 | gi.a1 = PI_RomanFont;
|
---|
[349] | 1515 | GrAfonts["normalfont"] = gi;
|
---|
[165] | 1516 | gi.a1 = PI_BoldFont;
|
---|
[349] | 1517 | GrAfonts["boldfont"] = gi;
|
---|
[165] | 1518 | gi.a1 = PI_ItalicFont;
|
---|
[349] | 1519 | GrAfonts["italicfont"] = gi;
|
---|
[165] | 1520 | gi.a2 = PI_SmallSizeFont;
|
---|
| 1521 | gi.a1 = PI_RomanFont;
|
---|
[349] | 1522 | GrAfonts["smallfont"] = gi;
|
---|
[165] | 1523 | gi.a1 = PI_BoldFont;
|
---|
[349] | 1524 | GrAfonts["smallboldfont"] = gi;
|
---|
[165] | 1525 | gi.a1 = PI_ItalicFont;
|
---|
[349] | 1526 | GrAfonts["smallitalicfont"] = gi;
|
---|
[165] | 1527 | gi.a2 = PI_BigSizeFont;
|
---|
| 1528 | gi.a1 = PI_RomanFont;
|
---|
[349] | 1529 | GrAfonts["bigfont"] = gi;
|
---|
[165] | 1530 | gi.a1 = PI_BoldFont;
|
---|
[349] | 1531 | GrAfonts["bigboldfont"] = gi;
|
---|
[165] | 1532 | gi.a1 = PI_ItalicFont;
|
---|
[349] | 1533 | GrAfonts["bigitalicfont"] = gi;
|
---|
[192] | 1534 | gi.a2 = PI_HugeSizeFont;
|
---|
| 1535 | gi.a1 = PI_RomanFont;
|
---|
[349] | 1536 | GrAfonts["hugefont"] = gi;
|
---|
[192] | 1537 | gi.a1 = PI_BoldFont;
|
---|
[349] | 1538 | GrAfonts["hugeboldfont"] = gi;
|
---|
[192] | 1539 | gi.a1 = PI_ItalicFont;
|
---|
[349] | 1540 | GrAfonts["hugeitalicfont"] = gi;
|
---|
[165] | 1541 |
|
---|
| 1542 |
|
---|
| 1543 | // Les markers
|
---|
[176] | 1544 | const char* mrkn[11] = { "dotmarker", "plusmarker", "crossmarker",
|
---|
| 1545 | "circlemarker", "fcirclemarker", "boxmarker", "fboxmarker",
|
---|
| 1546 | "trianglemarker", "ftrianglemarker", "starmarker", "fstarmarker"};
|
---|
[165] | 1547 | PIMarker mrk[11] = { PI_DotMarker, PI_PlusMarker, PI_CrossMarker,
|
---|
| 1548 | PI_CircleMarker, PI_FCircleMarker, PI_BoxMarker, PI_FBoxMarker,
|
---|
| 1549 | PI_TriangleMarker, PI_FTriangleMarker, PI_StarMarker, PI_FStarMarker};
|
---|
| 1550 |
|
---|
| 1551 | gi.a2 = 0;
|
---|
| 1552 | gi.a1 = PI_NotDefMarker;
|
---|
| 1553 | GrAmarkers["defmarker"] = gi;
|
---|
| 1554 |
|
---|
| 1555 | for(int j=0; j<11; j++) {
|
---|
| 1556 | string smrk;
|
---|
| 1557 | char buff[16];
|
---|
| 1558 | for(int m=1; m<10; m+=2) {
|
---|
| 1559 | sprintf(buff,"%d",m);
|
---|
| 1560 | smrk = (string)mrkn[j] + (string)buff;
|
---|
| 1561 | gi.a1 = mrk[j]; gi.a2 = m;
|
---|
| 1562 | GrAmarkers[smrk] = gi;
|
---|
| 1563 | }
|
---|
| 1564 | }
|
---|
| 1565 |
|
---|
| 1566 | // Les tables de couleurs
|
---|
| 1567 | gi.a2 = 0;
|
---|
| 1568 | gi.a1 = CMAP_OTHER;
|
---|
| 1569 | GrAcmap["defcmap"] = gi;
|
---|
[1126] | 1570 | for(int kcc=0; kcc<PIColorMap::NumberStandardColorMaps(); kcc++) {
|
---|
| 1571 | gi.a1 = PIColorMap::GetStandardColorMapId(kcc);
|
---|
| 1572 | string colname = PIColorMap::GetStandardColorMapName(kcc);
|
---|
| 1573 | for(int jll=0; jll<colname.length(); jll++)
|
---|
| 1574 | colname[jll] = tolower(colname[jll]);
|
---|
| 1575 | GrAcmap[colname] = gi;
|
---|
| 1576 | }
|
---|
[165] | 1577 |
|
---|
[1126] | 1578 |
|
---|
[203] | 1579 | // La valeur de zoom
|
---|
[165] | 1580 | gi.a2 = 0;
|
---|
| 1581 | gi.a1 = 0;
|
---|
| 1582 | GrAzoom["defzoom"] = gi;
|
---|
| 1583 | gi.a1 = 1;
|
---|
| 1584 | GrAzoom["zoomx1"] = gi;
|
---|
| 1585 | gi.a1 = 2;
|
---|
| 1586 | GrAzoom["zoomx2"] = gi;
|
---|
| 1587 | gi.a1 = 3;
|
---|
| 1588 | GrAzoom["zoomx3"] = gi;
|
---|
| 1589 | gi.a1 = 4;
|
---|
| 1590 | GrAzoom["zoomx4"] = gi;
|
---|
| 1591 | gi.a1 = 5;
|
---|
| 1592 | GrAzoom["zoomx5"] = gi;
|
---|
| 1593 | gi.a1 = -2;
|
---|
| 1594 | GrAzoom["zoom/2"] = gi;
|
---|
| 1595 | gi.a1 = -3;
|
---|
| 1596 | GrAzoom["zoom/3"] = gi;
|
---|
| 1597 | gi.a1 = -4;
|
---|
| 1598 | GrAzoom["zoom/4"] = gi;
|
---|
| 1599 | gi.a1 = -5;
|
---|
| 1600 | GrAzoom["zoom/5"] = gi;
|
---|
[203] | 1601 |
|
---|
| 1602 | // Attributs d'axes
|
---|
| 1603 | gi.a2 = 0;
|
---|
| 1604 | gi.a1 = (int)(kBoxAxes | kExtTicks | kLabels);
|
---|
| 1605 | GrAaxes["stdaxes"] = gi;
|
---|
| 1606 | GrAaxes["defaxes"] = gi;
|
---|
| 1607 | GrAaxes["boxaxes"] = gi;
|
---|
| 1608 | gi.a1 = (int)kAxesDflt;
|
---|
| 1609 | GrAaxes["simpleaxes"] = gi;
|
---|
| 1610 | gi.a1 = (int)(kBoxAxes | kExtTicks | kLabels | kGridOn);
|
---|
| 1611 | GrAaxes["boxaxesgrid"] = gi;
|
---|
| 1612 |
|
---|
| 1613 | gi.a1 = (int)(kBoxAxes | kTicks | kLabels | kMinTicks | kMajTicks);
|
---|
| 1614 | GrAaxes["fineaxes"] = gi;
|
---|
| 1615 | gi.a1 = (int)(kBoxAxes | kTicks | kLabels | kMinTicks | kMajTicks | kGridOn);
|
---|
| 1616 | GrAaxes["grid"] = gi;
|
---|
| 1617 | GrAaxes["fineaxesgrid"] = gi;
|
---|
| 1618 |
|
---|
[165] | 1619 | }
|
---|
[333] | 1620 |
|
---|
| 1621 |
|
---|
| 1622 | // SANS_EVOLPLANCK Attention !
|
---|
[1105] | 1623 | #ifdef SANS_EVOLPLANCK
|
---|
[333] | 1624 | #include "pclassids.h"
|
---|
| 1625 |
|
---|
| 1626 | /* --Methode-- */
|
---|
| 1627 | char* Services2NObjMgr::PClassIdToClassName(int cid)
|
---|
| 1628 | {
|
---|
| 1629 | switch (cid) {
|
---|
| 1630 | case ClassId_Poly1 :
|
---|
| 1631 | return("Poly1");
|
---|
| 1632 | case ClassId_Poly2 :
|
---|
| 1633 | return("Poly2");
|
---|
| 1634 | case ClassId_Matrix :
|
---|
| 1635 | return("Matrix");
|
---|
| 1636 | case ClassId_Vector :
|
---|
| 1637 | return("Vector");
|
---|
| 1638 |
|
---|
| 1639 | case ClassId_DVList :
|
---|
| 1640 | return("DVList");
|
---|
| 1641 |
|
---|
| 1642 | case ClassId_Histo1D :
|
---|
| 1643 | return("Histo1D");
|
---|
| 1644 | case ClassId_Histo2D :
|
---|
| 1645 | return("Histo2D");
|
---|
| 1646 | case ClassId_HProf :
|
---|
| 1647 | return("HProf");
|
---|
| 1648 | case ClassId_NTuple :
|
---|
| 1649 | return("NTuple");
|
---|
[361] | 1650 | case ClassId_XNTuple :
|
---|
| 1651 | return("XNTuple");
|
---|
[333] | 1652 | case ClassId_GeneralFitData :
|
---|
| 1653 | return("GeneralFitData");
|
---|
| 1654 |
|
---|
| 1655 | case ClassId_Image :
|
---|
| 1656 | return("RzImage");
|
---|
| 1657 | case ClassId_Image + kuint_1 :
|
---|
| 1658 | return("ImageU1");
|
---|
| 1659 | case ClassId_Image + kint_1 :
|
---|
| 1660 | return("ImageI1");
|
---|
| 1661 | case ClassId_Image + kuint_2 :
|
---|
| 1662 | return("ImageU2");
|
---|
| 1663 | case ClassId_Image + kint_2 :
|
---|
| 1664 | return("ImageI2");
|
---|
| 1665 | case ClassId_Image + kuint_4 :
|
---|
| 1666 | return("ImageU4");
|
---|
| 1667 | case ClassId_Image + kint_4 :
|
---|
| 1668 | return("ImageI4");
|
---|
| 1669 | case ClassId_Image + kr_4 :
|
---|
| 1670 | return("ImageR4");
|
---|
| 1671 | case ClassId_Image + kr_8 :
|
---|
| 1672 | return("ImageR8");
|
---|
| 1673 | case ClassId_ZFidu :
|
---|
| 1674 | return("ZFidu");
|
---|
| 1675 |
|
---|
| 1676 | case ClassId_StarList :
|
---|
| 1677 | return("StarList");
|
---|
| 1678 | case ClassId_Transfo :
|
---|
| 1679 | return("Transfo");
|
---|
| 1680 | case ClassId_PSF :
|
---|
| 1681 | return("PSF");
|
---|
| 1682 |
|
---|
| 1683 |
|
---|
| 1684 | // - Ajout objet PPF
|
---|
| 1685 | default:
|
---|
| 1686 | return("AnyDataObj");
|
---|
| 1687 | }
|
---|
| 1688 | }
|
---|
| 1689 |
|
---|
[1105] | 1690 | #else
|
---|
| 1691 | char* Services2NObjMgr::PClassIdToClassName(int cid)
|
---|
| 1692 | {
|
---|
| 1693 | return("AnyDataObj");
|
---|
| 1694 | }
|
---|
| 1695 | #endif
|
---|