source: Sophya/trunk/SophyaPI/PIext/servnobjm.cc@ 1850

Last change on this file since 1850 was 1797, checked in by aubourg, 24 years ago

darwin

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