20 void kalman(std::string machine =
"",
int sym=1,
int cut =6) {
22 cout <<
"loading lib smatrix" << std::endl;
25 std::string fname =
"kalman";
27 fname =
"kalman_" + machine;
36 int read_data(
const char * machine,
double * s,
double * ss,
double * t) {
39 sprintf(filename,
"%s.root",machine);
40 TFile *
file =
new TFile(filename,machine);
41 if (file == 0)
return -1;
46 file->GetObject(
"SMatrix",ms);
47 file->GetObject(
"SMatrix_sym",mss);
48 file->GetObject(
"TMatrix",mt);
52 file->GetObject(
"SMatrix_2",ms);
53 file->GetObject(
"SMatrix_sym_2",mss);
54 file->GetObject(
"TMatrix_2",mt);
56 if (ms == 0 || mss == 0 || mt == 0)
return -1;
57 for (
int i=0; i<
n; ++i){
59 ss[i] = mss->
apply(i);
76 static Int_t xtop = 0, ytop = 0;
77 xtop += 10; ytop += 10;
85 sprintf(tmachine,
"%s",machine);
86 c1 =
new TCanvas(machine,machine,xtop,ytop,800,650);
95 double dx = (xmax-
xmin)/
nx;
96 double dy = (ymax-
ymin)/
ny;
105 if (s[ny*i+j] > t[ny*i+j])
continue;
106 box.
DrawBox(xmin+i*dx,ymax-(j+1)*dy,xmin+(i+1)*dx,ymax-j*dy);
107 pl =
new TPaveLabel(xmin+5*dx,0.025,xmax,0.075,
"SMatrix better than TMatrix",
"brNDC");
109 if (ss[ny*i+j] > t[ny*i+j])
continue;
110 box.
DrawBox(xmin+i*dx,ymax-(j+1)*dy,xmin+(i+1)*dx,ymax-j*dy);
111 pl =
new TPaveLabel(xmin+5*dx,0.025,xmax,0.075,
"SMatrix_Sym better than TMatrix",
"brNDC");
130 for (i=0;i<=
nx;i++) {
131 line.
DrawLine(xmin+i*dx,ymin,xmin+i*dx,ymax);
133 sprintf(text,
"%d",i+2);
134 ts.
DrawText(xmin+(i+0.5)*dx,ymax+0.1*dy,text);
137 for (i=0;i<=
ny;i++) {
138 line.
DrawLine(xmin,ymax-i*dy,xmax,ymax-i*dy);
140 sprintf(text,
"%d",i+2);
141 ts.
DrawText(xmin-0.1*dx,ymax-(i+0.5)*dy,text);
154 sprintf(text,
"%6.2f",ss[ny*i+j]);
155 tss.
DrawText(xmin+(i+0.5)*dx,ymax -(j+0.22)*dy,text);
156 sprintf(text,
"%6.2f",s[ny*i+j]);
157 ts.
DrawText(xmin+(i+0.5)*dx,ymax -(j+0.5)*dy,text);
158 sprintf(text,
"%6.2f",t[ny*i+j]);
159 tt.
DrawText(xmin+(i+0.5)*dx,ymax -(j+0.78)*dy,text);
160 if ( i <=cut-2 && j <=cut-2) {
162 sumss1 += ss[ny*i+j];
167 sumss2 += ss[ny*i+j];
172 tss.
DrawText(xmin+0.5*dx,0.05,
"SMatrix_Sym");
173 ts.
DrawText (xmin+2.5*dx,0.05,
"SMatrix");
174 tt.
DrawText (xmin+4*dx,0.05,
"TMatrix");
177 sprintf(title,
"TestKalman [nx,ny] : %s",tmachine);
199 sprintf(text,
"N1,N2 <= %d",cut);
200 tl.
DrawText (xmin+i*dx-0.15,ylow+0.04,text);
203 box.
DrawBox(xmin+i*dx,ylow,xmin+(i+1)*dx,ylow+dy);
207 box.
DrawBox(xmin+i*dx,ylow,xmin+(i+1)*dx,ylow+dy);
209 sprintf(text,
"%6.2f",sumss1);
210 tss.
DrawText(xmin+(i+0.5)*dx,ylow+0.078,text);
211 sprintf(text,
"%6.2f",sums1);
212 ts.
DrawText(xmin+(i+0.5)*dx,ylow+0.05,text);
213 sprintf(text,
"%6.2f",sumt1);
214 tt.
DrawText(xmin+(i+0.5)*dx,ylow+0.022,text);
218 sprintf(text,
"N1,N2 > %d",cut);
219 tl.
DrawText (xmin+i*dx-0.15,ylow+0.04,text);
222 box.
DrawBox(xmin+i*dx,ylow,xmin+(i+1)*dx,ylow+dy);
226 box.
DrawBox(xmin+i*dx,ylow,xmin+(i+1)*dx,ylow+dy);
228 sprintf(text,
"%6.2f",sumss2);
229 tss.
DrawText(xmin+(i+0.5)*dx,ylow+0.078,text);
230 sprintf(text,
"%6.2f",sums2);
231 ts.
DrawText(xmin+(i+0.5)*dx,ylow+0.05,text);
232 sprintf(text,
"%6.2f",sumt2);
233 tt.
DrawText(xmin+(i+0.5)*dx,ylow+0.022,text);
236 tl.
DrawText (xmin+i*dx-0.15,ylow+0.04,
"All N1,N2 ");
238 if (sums1+sums2 <= sumt1+sumt2)
239 box.
DrawBox(xmin+i*dx,ylow,xmin+(i+1)*dx,ylow+dy);
242 if (sumss1+sumss2 <= sumt1+sumt2)
243 box.
DrawBox(xmin+i*dx,ylow,xmin+(i+1)*dx,ylow+dy);
245 sprintf(text,
"%6.2f",sumss1+sumss2);
246 tss.
DrawText(xmin+(i+0.5)*dx,ylow+0.078,text);
247 sprintf(text,
"%6.2f",sums1+sums2);
248 ts.
DrawText(xmin+(i+0.5)*dx,ylow+0.05,text);
249 sprintf(text,
"%6.2f",sumt1+sumt2);
250 tt.
DrawText(xmin+(i+0.5)*dx,ylow+0.022,text);
virtual TBox * DrawBox(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this box with new coordinates.
virtual TLine * DrawLine(Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Draw this line with new coordinates.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void kalman(std::string machine="", int sym=1, int cut=6)
SMatrix: a generic fixed size D1 x D2 Matrix class.
Base class for several text objects.
int read_data(const char *machine, double *s, double *ss, double *t)
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
A Pave (see TPave) with a text centered in the Pave.
R__EXTERN TSystem * gSystem
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
void kalman_do(const char *machine, int sym, int cut)
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
T apply(unsigned int i) const
access the parse tree with the index starting from zero and following the C convention for the order ...
virtual Color_t GetFillColor() const
Return the fill area color.
virtual TText * DrawText(Double_t x, Double_t y, const char *text)
Draw this text with new coordinates.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual Style_t GetFillStyle() const
Return the fill area style.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
#define sym(otri1, otri2)
void SetHighLightColor(Color_t col)