source: Sophya/trunk/SophyaPI/PIext/flowmodex.cc@ 1924

Last change on this file since 1924 was 1924, checked in by perderos, 24 years ago

* empty log message *

File size: 3.8 KB
Line 
1#include "flowmodex.h"
2#include "pi2dvec.h"
3
4#include <typeinfo>
5
6#include <vector>
7#include <string>
8#include "nobjmgr.h"
9#include "ntuple.h"
10
11#include "pidrawer.h"
12#include "nomgadapter.h"
13#include "servnobjm.h"
14
15
16/* --Methode-- */
17FlowModExecutor::FlowModExecutor(PIACmd* mpiac, PIStdImgApp* app)
18{
19
20
21 //cout << " FlowModExecutor::FlowModExecutor() mpiac = " << (unsigned long)mpiac << endl;
22 cout << " registration of flow chart commands "<<endl;
23 string hgrp,kw,usage;
24 hgrp = "Obj. Display";
25
26 kw = "nt2dvec";
27 usage = "Creates and displays a flow chart from ntuple variables";
28 usage += "\n Usage: nt2dvec x y vx vy [graphic_att] ";
29 mpiac->RegisterCommand(kw, usage, this, hgrp);
30
31
32 hgrp = "Expr. Plotting";
33 kw = "plot2dvec";
34 usage = "Creates and displays a flow chart from ntuple expressions ";
35 usage += "\n Usage: plot2dvec ntuple expx expy expvx expvy [cut graphic_att loop_par]";
36
37 mpiac->RegisterCommand(kw, usage, this, hgrp);
38
39 //cout << " Out of ContModExecutor::ContModExecutor() " << endl;
40
41}
42
43
44
45/* --Methode-- */
46FlowModExecutor::~FlowModExecutor()
47{
48}
49
50/* --Methode-- */
51int FlowModExecutor::Execute(string& kw, vector<string>& tokens, string& toks)
52{
53
54int nz=-1;
55double z0,dz;
56PI2dVecDrawer *p2dv;
57string dopt="";
58NamedObjMgr omg;
59
60if ( kw == "nt2dvec") {
61
62
63 if (tokens.size() < 5) {
64 cout << "Usage: nt2dvec ntuple x y vx vy [graphic_att]" << endl;
65 return(0);
66 }
67 NObjMgrAdapter* obja = omg.GetObjAdapter(tokens[0]);
68 if (obja == NULL) {
69 cout << "contour Error , No object with name " << tokens[0] << endl;
70 return(0);
71 }
72
73 if (tokens.size() > 5) dopt = tokens[5];
74 bool adel;
75
76 NTupleInterface *ntin = obja->GetNTupleInterface(adel);
77
78 p2dv = new PI2dVecDrawer(ntin,adel);
79 string expx,expy;
80 expx = tokens[1];
81 expy = tokens[2];
82 int ret = p2dv->SelectXY(expx.c_str(),expy.c_str());
83 if(ret<0){ cout << "Usage: nt2dvec ntuple x y vx vy [graphic_att]" << endl; return(0);}
84 expx = tokens[3];
85 expy = tokens[4];
86 ret = p2dv->SelectVW(expx.c_str(),expy.c_str());
87 if(ret<0){ cout << "Usage: nt2dvec ntuple x y vx vy [graphic_att ]" << endl; return(0);}
88
89 // On affiche le Drawer
90 int wrsid = 0;
91 bool fgsr = true;
92 int opt = omg.GetServiceObj()->DecodeDispOption(dopt, fgsr);
93
94 string name = "ChampVec";
95
96 wrsid = omg.GetImgApp()->DispScDrawer(p2dv , name, opt);
97
98}else if(kw == "plot2dvec"){
99
100
101 if (tokens.size() < 5) {
102 cout << "Usage: plot2dvec ntuple expx expy expvx expvy [cut graphic_att loop_par]" << endl;
103 return(0);
104 }
105
106
107 NObjMgrAdapter* obja=NULL;
108 obja = omg.GetObjAdapter(tokens[0]);
109 if (obja == NULL) {
110 cout << "plot2dvec Error , No object with name " << tokens[0] << endl;
111 return(0);
112 }
113
114 Services2NObjMgr* srvo = omg.GetServiceObj();
115
116 bool adel=true;
117 //NTupleInterface *ntin = obja->GetNTupleInterface(adel);
118
119 // Creation NTuple
120 char* ntn[4] = {"expx","expy","expex","expey"};
121 NTuple * ntint = NULL;
122 ntint = new NTuple(4,ntn);
123 // remplissage du ntuple
124 string bidon = "0.";
125 string nocut = "1.";
126 if(tokens.size()>7) bidon = tokens[7];
127 if(tokens.size()>5) nocut = tokens[5];
128 cout << " nocut "<<nocut<<" bidon "<<bidon<<endl;
129
130 srvo->ComputeExpressions(obja,tokens[1],tokens[2],tokens[3],tokens[4],nocut,bidon,ntint,NULL,NULL);
131
132 if(ntint->NEntry()<=0){
133 cerr << " FlowModExecutor::Execute plot2dvec <=0 evts selectionness "<<endl;
134 return(0);
135 }
136
137 cout << " avant creation de p2dv "<<endl;
138 p2dv = new PI2dVecDrawer(ntint,adel);
139 p2dv->SelectXY(ntn[0],ntn[1]);
140 p2dv->SelectVW(ntn[2],ntn[3]);
141
142 bool fgsr = true;
143 if (tokens.size() > 6) dopt = tokens[6];
144
145 int opt = omg.GetServiceObj()->DecodeDispOption(dopt, fgsr);
146 string name = "ChampVec";
147
148 int wrsid = omg.GetImgApp()->DispScDrawer(p2dv , name, opt);
149
150}
151
152
153return(0);
154
155}
156
157
158
Note: See TracBrowser for help on using the repository browser.