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