ROOTPWA
testFitBin.C
Go to the documentation of this file.
1 
2 //
3 // Copyright 2009 Sebastian Neubert
4 //
5 // This file is part of rootpwa
6 //
7 // rootpwa is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 //
12 // rootpwa is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with rootpwa. If not, see <http://www.gnu.org/licenses/>.
19 //
21 #include "../TFitBin.h"
22 #include "../TCMatrix.h"
23 #include "TMatrixD.h"
24 #include "TString.h"
25 #include <vector>
26 #include <iostream>
27 #include <map>
28 #include "TComplex.h"
29 
30 
31 using namespace std;
32 
33 
34 void testFitBin(){
35  TFitBin bin;
36  double mass=1000;
37 
38  vector<TString> wavenames; // contains rank information
39  //wavenames.push_back("V0_B");
40  wavenames.push_back("V0_A");
41  wavenames.push_back("V1_A");
42  wavenames.push_back("V_flat");
43 
44  double logli=10;
45  vector<TComplex> amps;
46 
47  //amps.push_back(TComplex(1,0));
48  amps.push_back(TComplex(2,0));
49  amps.push_back(TComplex(1.4,0.6));
50  amps.push_back(TComplex(1.2,0));
51 
52  int npar=5;
53  TMatrixD errm(npar,npar);
54  for(int i=0;i<npar;++i){
55  for(int j=i;j<npar;++j){
56  errm[i][j]=0.1;
57  errm[j][i]=0.1;
58  //if(i==j)cout << "Sig"<< i << "=" << sqrt(errm[i][i]) << endl;
59  }
60  }
61  errm.Print();
62  //cout << " Created error matrix." << endl;
63 
64 
65  vector<pair<int,int> > indices;
66  indices.push_back(pair<int,int>(0,1));
67  //indices.push_back(pair<int,int>(1,2));
68  indices.push_back(pair<int,int>(2,3));
69  indices.push_back(pair<int,int>(4,-1));
70 
71  TCMatrix integr(1,1);
72  integr.set(0,0,2);
73  //integr.set(1,1,2);
74 
75  cout << "filling TFitBin" << endl;
76  cout << "npar=" << npar << endl;
77  cout << "Number of amps=" << amps.size()<< endl;
78  cout << "Number of indices=" << indices.size() << endl;
79  cout << "Number of wavenames=" << wavenames.size()<< endl;
80 
81  cout << "Dimension of errormatrix=" << errm.GetNrows() << endl;
82  cout << "Dimension of integral matrix=" << integr.nrows() << endl;
83 
84  bin.fill(amps,
85  indices,
86  wavenames,
87  1,
88  1,
89  mass,
90  integr,
91  errm,
92  logli,
93  2);
94  bin.PrintParameters();
95 
96  cout << "Error of A: " << bin.err("A") << endl;
97 
98  return;
99 }