1 #include "StEStructFitter.h"
19 StEStructFitter::StEStructFitter(): mhists(NULL) {
20 mpi=3.141593; m2pi=2.0*mpi;
26 StEStructFitter::~StEStructFitter(){};
30 double StEStructFitter::detadphiFit(
double* x,
double* par){
40 if(par[0]!=0)arg1=(xval)/par[0];
41 if(par[1]!=0)arg2=(yval)/par[1];
42 double fitval=par[2]*TMath::Exp(-0.5*arg1*arg1);
43 fitval*=TMath::Exp(-0.5*arg2*arg2);
45 if(par[3]!=0)arg3=(yval-mpi)/par[3];
46 fitval+=par[4]*TMath::Exp(-0.5*arg3*arg3);
48 if(par[6]!=0)arg4=(xval)/par[6];
49 fitval+=par[7]*TMath::Exp(-0.5*arg4*arg4);
56 if(par[8]!=0)arg1=(xval)/par[8];
57 if(par[9]!=0)arg2=(yval-mpi)/par[9];
58 double fitval2=par[10]*TMath::Exp(-0.5*arg1*arg1);
59 fitval2*=TMath::Exp(-0.5*arg2*arg2);
62 if(yval<0. || yval>mpi){
71 fitval+=seconddetadphiFit(xnew,par);
77 double StEStructFitter::seconddetadphiFit(
double* x,
double* par){
87 if(par[0]!=0)arg1=(xval)/par[0];
88 if(par[1]!=0)arg2=(yval)/par[1];
89 double fitval=par[2]*TMath::Exp(-0.5*arg1*arg1);
90 fitval*=TMath::Exp(-0.5*arg2*arg2);
92 if(par[3]!=0)arg3=(yval-mpi)/par[3];
93 fitval+=par[4]*TMath::Exp(-0.5*arg3*arg3);
99 if(par[8]!=0)arg1=(xval)/par[8];
100 if(par[9]!=0)arg2=(yval-mpi)/par[9];
101 double fitval2=par[10]*TMath::Exp(-0.5*arg1*arg1);
102 fitval2*=TMath::Exp(-0.5*arg2*arg2);
114 double StEStructFitter::softLS(
double* x,
double* par){
121 if(par[0]!=0)arg1=(xval)/par[0];
122 if(par[1]!=0)arg2=(yval)/par[1];
123 double fitval=par[2]*TMath::Exp(-0.5*arg1*arg1);
124 fitval*=TMath::Exp(-0.5*arg2*arg2);
126 if(yval<0. || yval>mpi){
135 fitval+=secondSoftLS(xnew,par);
141 double StEStructFitter::secondSoftLS(
double* x,
double* par){
148 if(par[0]!=0)arg1=(xval)/par[0];
149 if(par[1]!=0)arg2=(yval)/par[1];
150 double fitval=par[2]*TMath::Exp(-0.5*arg1*arg1);
151 fitval*=TMath::Exp(-0.5*arg2*arg2);
156 double StEStructFitter::softUS(
double* x,
double* par){
161 if(par[0]!=0)arg1=(xval)/par[0];
162 double fitval=par[1]*TMath::Exp(-0.5*arg1*arg1);
168 double StEStructFitter::syt(
double* x,
double* par){
174 if(par[2]!=0)arg1=(xval-par[1])/par[2];
175 double fitval=par[3]*TMath::Exp(-0.5*arg1*arg1);
176 arg2=(xval-mmean)/msigma;
177 fitval+=(par[0]*TMath::Exp(-0.5*arg2*arg2));
184 double StEStructFitter::softCD(
double* x,
double* par){
192 if(par[0]!=0)arg1=(xval)/par[0];
193 if(par[1]!=0)arg2=(yval)/par[1];
194 double fitval=par[2]*TMath::Exp(-0.5*arg1*arg1);
195 fitval*=TMath::Exp(-0.5*arg2*arg2);
196 if(par[3]!=0)arg3=(xval)/par[3];
197 fitval+=par[4]*TMath::Exp(-0.5*arg3*arg3);
200 if(yval<0. || yval>mpi){
209 fitval+=secondSoftCD(xnew,par);
216 double StEStructFitter::secondSoftCD(
double* x,
double* par){
223 if(par[0]!=0)arg1=(xval)/par[0];
224 if(par[1]!=0)arg2=(yval)/par[1];
225 double fitval=par[2]*TMath::Exp(-0.5*arg1*arg1);
226 fitval*=TMath::Exp(-0.5*arg2*arg2);
231 double StEStructFitter::hardCI(
double* x,
double* par){
239 if(par[0]!=0)arg1=(xval)/par[0];
240 if(par[1]!=0)arg2=(yval)/par[1];
241 double fitval=par[2]*TMath::Exp(-0.5*arg1*arg1);
242 fitval*=TMath::Exp(-0.5*arg2*arg2);
243 if(par[3]!=0)arg3=(yval-mpi)/par[3];
244 fitval+=par[4]*TMath::Exp(-0.5*arg3*arg3);
245 fitval+=(par[5]-mmean*xval*xval);
247 if(yval<0. || yval>mpi){
256 fitval+=secondHardCI(xnew,par);
263 double StEStructFitter::secondHardCI(
double* x,
double* par){
271 if(par[0]!=0)arg1=(xval)/par[0];
272 if(par[1]!=0)arg2=(yval)/par[1];
273 double fitval=par[2]*TMath::Exp(-0.5*arg1*arg1);
274 fitval*=TMath::Exp(-0.5*arg2*arg2);
275 if(par[3]!=0)arg3=(yval-mpi)/par[3];
276 fitval+=par[4]*TMath::Exp(-0.5*arg3*arg3);
281 double StEStructFitter::hardCICosine(
double* x,
double* par){
289 if(par[0]!=0)arg1=(xval)/par[0];
290 if(par[1]!=0)arg2=(yval)/par[1];
291 double fitval=par[2]*TMath::Exp(-0.5*arg1*arg1);
292 fitval*=TMath::Exp(-0.5*arg2*arg2);
293 if(par[3]!=0)arg3=(yval-mpi)/par[3];
294 fitval+=par[4]*TMath::Exp(-0.5*arg3*arg3);
295 fitval+=(par[5]-mmean*xval*xval);
297 if(yval<0. || yval>mpi){
306 fitval+=secondHardCI(xnew,par);
313 double StEStructFitter::secondHardCICosine(
double* x,
double* par){
321 if(par[0]!=0)arg1=(xval)/par[0];
322 if(par[1]!=0)arg2=(yval)/par[1];
323 double fitval=par[2]*TMath::Exp(-0.5*arg1*arg1);
324 fitval*=TMath::Exp(-0.5*arg2*arg2);
325 if(par[3]!=0)arg3=(yval-mpi)/par[3];
326 fitval+=par[4]*TMath::Exp(-0.5*arg3*arg3);
333 double StEStructFitter::detadphiSS(
double* x,
double* par){
341 if(par[0]!=0)arg1=(xval)/par[0];
342 if(par[1]!=0)arg2=(yval)/par[1];
343 double fitval=par[2]*TMath::Exp(-0.5*arg1*arg1);
344 fitval*=TMath::Exp(-0.5*arg2*arg2);
366 double StEStructFitter::seconddetadphiSS(
double* x,
double* par){
373 if(par[0]!=0)arg1=(xval)/par[0];
374 if(par[1]!=0)arg2=(yval)/par[1];
375 double fitval=par[2]*TMath::Exp(-0.5*arg1*arg1);
376 fitval*=TMath::Exp(-0.5*arg2*arg2);
384 double StEStructFitter::mcComponents(
double* x,
double* par){
387 cout<<
"opening file rmxTest2.root"<<endl;
388 TFile* tf=
new TFile(
"rmxTest2.root");
391 const char* snames[]={
"S001",
"S010",
"S100",
"S011",
"S101",
"S110"};
394 for(
int i=0;i<6;i++){
395 mhists[i]=(TH2F*)(tf->Get(snames[i]))->Clone();
396 float xval=mhists[i]->Integral();
397 cout<<
"scale for i="<<i<<
" is "<<xval<<endl;
398 xsum+=mhists[i]->Integral();
400 for(
int i=0;i<6;i++)mhists[i]->Scale(1.0/xsum);
403 int ibin=mhists[0]->FindBin(x[0],x[1]);
405 double retVal=par[0]*mhists[0]->GetBinContent(ibin);
406 retVal+=par[1]*mhists[1]->GetBinContent(ibin);
407 retVal+=par[2]*mhists[2]->GetBinContent(ibin);
408 retVal+=par[3]*mhists[3]->GetBinContent(ibin);
409 retVal+=par[4]*mhists[4]->GetBinContent(ibin);
410 retVal+=par[5]*mhists[5]->GetBinContent(ibin);
418 double StEStructFitter::dytGsytG(
double* x,
double* par){
427 if(par[0]!=0)arg1=(xval-par[1])/par[0];
428 if(par[1]!=0)arg2=(yval)/par[2];
430 double fitval=par[3]*TMath::Exp(-0.5*arg1*arg1);
431 fitval*=TMath::Exp(-0.5*arg2*arg2);
439 double StEStructFitter::DoubleE(
double* x,
double* par){
446 if(par[0]!=0)arg1=(yval)/par[0];
447 if(par[2]!=0)arg2=(yval-mpi)/par[2];
448 double fitval=par[1]*TMath::Exp(-0.5*arg1*arg1);
449 fitval+=par[3]*TMath::Exp(-0.5*arg2*arg2);
452 if(yval<0. || yval>mpi){
461 fitval+=secondDoubleE(xnew,par);
468 double StEStructFitter::secondDoubleE(
double* x,
double* par){
475 if(par[0]!=0)arg1=(yval)/par[0];
476 if(par[2]!=0)arg2=(yval-mpi)/par[2];
477 double fitval=par[1]*TMath::Exp(-0.5*arg1*arg1);
478 fitval+=par[3]*TMath::Exp(-0.5*arg2*arg2);