53 #include "RooRealConstant.h" 54 #include "RooAbsReal.h" 55 #include "RooRealVar.h" 56 #include "RooDataSet.h" 57 #include "RooGlobalFunc.h" 58 #include "RooRealVar.h" 60 #include "RooBDecay.h" 62 #include "RooEffProd.h" 63 #include "RooGenericPdf.h" 64 #include "RooGaussModel.h" 65 #include "RooProdPdf.h" 66 #include "RooConstVar.h" 67 #include "RooCategory.h" 69 #include "RooGlobalFunc.h" 77 using namespace RooFit ;
89 std::string _integratorFileName;
92 double ampSq = _amps->RealVal(evt);
97 return _amps->ComplexVal(evt);
103 ,
double precision=1.e-4
104 , std::string method=
"efficient" 105 , std::string fname =
"SignalIntegrationEvents.root",
bool genMoreEvents =
false 112 , _integratorSource(
"IntegratorSource", (std::string)
"new", (char*) 0)
113 , _integratorFileName(fname)
115 cout <<
" AmpsPdfFlexiFast with integ method " << method << endl;
116 bool nonFlat =
"efficient" == method;
117 bool generateNew = ((string)_integratorSource == (
string)
"new");
119 cout <<
"AmpsPdfFlexiFast uses nonFlat integration." << endl;
131 _localRnd =
new TRandom3(time(0));
138 cout <<
"not going to generate any more events" << endl;
140 _chosenGen = _fileGen;
142 this->setEventGenerator(_chosenGen);
144 cout <<
"AmpsPdfFlexiFast uses flat integration." << endl;
151 if(0 != _fileGen)
delete _fileGen;
152 if(0 != _sgGen)
delete _sgGen;
153 if(0 != _localRnd)
delete _localRnd;
163 : _re(re), _im(im), _f(f) {}
166 std::complex<double> result(_re,static_cast<double>(_f) * _im);
177 : _re(re), _im(im), _sign(sign) {}
180 std::complex<double> result((
double) ( 1.+ _re * (
double) _sign),(
double) (_im * (
double) _sign) );
191 : _r(r), _delta(delta), _sign(sign) {}
194 std::complex<double> result= polar((
double) sqrt( 1.+ _r * (
double) _sign),(
double) (_delta/360.*2.*
pi * (
double) _sign) );
214 cout <<
"Calculating coherence factor ..." << endl << endl;
218 std::complex<double> valK(0,0);
222 const complex<double> phase_diff = polar(r, delta/360.*2*
pi);
224 for(
unsigned int i=0; i<eventList.
size(); i++){
225 const std::complex<double> amp = fas.
getVal(eventList[i]) ;
226 const std::complex<double> amp_bar = fas_bar.
getVal(eventList[i])*phase_diff ;
227 valK += amp_bar*conj(amp)*eventList[i].getWeight()/ eventList[i].getGeneratorPdfRelativeToPhaseSpace();
228 val1 += norm(amp)*eventList[i].getWeight()/ eventList[i].getGeneratorPdfRelativeToPhaseSpace();
229 val2 += norm(amp_bar)*eventList[i].getWeight()/ eventList[i].getGeneratorPdfRelativeToPhaseSpace();
232 std::vector<double> result;
234 result.push_back(std::abs(valK)/sqrt(val1)/sqrt(val2));
235 result.push_back(std::arg(valK)/(2.*
pi)*360.);
237 cout <<
"r = " << result[0] << endl;
238 cout <<
"k = " << result[1] << endl;
239 cout <<
"d = " << result[2] <<
" [deg]" << endl << endl;
312 cout <<
"intA = " << _intA << endl;
313 cout <<
"intAbar = " << _intAbar << endl;
314 cout <<
"intAAbar = " << _intAAbar.real() << endl;
324 if(t < _min_TAU || t > _max_TAU )
return 0.;
328 _r_mistag->setVal(w);
331 double r = (double)_r;
332 const complex<double> phase_diff = polar((
double)r,((
double) _delta -(
double)_gamma*f)/360.*2*
pi);
337 const double val = exp(-fabs(t)/(
double)_tau) *
339 (norm(amp) + norm(amp_bar)) *cosh((
double)_dGamma/2.*t) * _cosh_coeff->
evaluate()
340 +(norm(amp) - norm(amp_bar)) *cos((
double)_dm*t) * _cos_coeff->
evaluate()
341 +real(amp_bar*conj(amp)) *sinh((
double)_dGamma/2.*t) * _sinh_coeff->
evaluate()
342 +imag(amp_bar*conj(amp)) *sin((
double)_dm*t) * _sin_coeff->
evaluate()
343 ) *_pdf_sigma_t->getVal()*_spline->getVal();
351 dt = r.Uniform(0.,0.25);
352 t = t + r.Gaus(0,_r_scale_sigma_dt->getVal()*dt);
353 if(_min_TAU< t && t < _max_TAU)
return;
364 if(t < _min_TAU || t > _max_TAU )
return 0.;
368 _r_mistag->setVal(w);
371 double r = (double)_r;
372 const complex<double> phase_diff = polar((
double)r,((
double) _delta -(
double)_gamma*f)/360.*2*
pi);
384 (norm(amp) + norm(amp_bar)) *cosh_term * _cosh_coeff->
evaluate()
385 + (norm(amp) - norm(amp_bar)) *cos_term * _cos_coeff->
evaluate()
386 + real(amp_bar*conj(amp)) *sinh_term * _sinh_coeff->
evaluate()
387 + imag(amp_bar*conj(amp)) *sin_term * _sin_coeff->
evaluate()
388 )* _pdf_sigma_t->getVal();
395 const double val = un_normalised_noPs(evt);
396 double r = (double)_r;
399 const complex<double> phase_diff_m = polar((
double)r,((
double) _delta + (
double)_gamma)/360.*2*
pi);
400 const complex<double> int_interference_m = phase_diff_m * _intAAbar ;
402 const complex<double> phase_diff_p = polar((
double)r,((
double) _delta -(
double)_gamma)/360.*2*
pi);
403 const complex<double> int_interference_p = phase_diff_p * _intAAbar ;
405 const complex<double> phase_diff = polar((
double)r,((
double) _delta -(
double)_gamma*f)/360.*2*
pi);
406 const complex<double> int_interference = phase_diff * _intAAbar ;
414 cout <<
"AmpsPdfFlexiFastCPV:: _norm = -1, should not have happened." << endl;
415 throw "can't deal with that";
465 if(0 == evt)
return 0;
469 if(0 == evt)
return 0;
470 return getVal_withPs(*evt);
473 if(0 == evt)
return 0;
474 return getVal_noPs(*evt);
482 _amps1->
doFinalStatsAndSave(min,((
string)fname+
".txt").c_str(),((
string)fnameROOT+
".root").c_str());
483 _amps2->
doFinalStatsAndSave(min,((
string)fname+
"_CC.txt").c_str(),((
string)fnameROOT+
"_CC.root").c_str());
489 _amps1(amps1),_amps2(amps2),_ampsSum(ampsSum),_r(r),_delta(delta),_gamma(gamma),_tau(tau),_dGamma(dGamma),_dm(dm),_eff_tag(eff_tag),_w(w),
490 _intA(-1),_intAbar(-1),_intAAbar(-1),_min_TAU(
"min_TAU", 0.4), _max_TAU(
"max_TAU", 10.)
493 _r_t =
new RooRealVar(
"t",
"time", _min_TAU, _max_TAU);
494 _r_dt =
new RooRealVar(
"dt",
"per-candidate time resolution estimate",0., 0.25);
495 _r_mistag =
new RooRealVar(
"mistag",
"mistag",0.);
496 _r_f =
new RooCategory(
"qf",
"qf");
497 _r_f->defineType(
"h+", +1);
498 _r_f->defineType(
"h-", -1);
499 _r_f->setRange(
"Range_p",
"h+");
500 _r_f->setRange(
"Range_m",
"h-");
501 _r_q =
new RooCategory(
"qt",
"qt");
502 _r_q->defineType(
"B+", +1);
503 _r_q->defineType(
"B-", -1) ;
504 _r_q->defineType(
"untagged", 0);
510 RooRealConstant::value(1.),
511 RooRealConstant::value(1.),
514 RooRealConstant::value(0.),
515 RooRealConstant::value(1.),
516 RooRealConstant::value(0.),
517 RooRealConstant::value(0.),
518 RooRealConstant::value(0.),
519 RooRealConstant::value(_eff_tag),
520 RooRealConstant::value(0.),
521 RooRealConstant::value(0.),
522 RooRealConstant::value(0.));
528 RooRealConstant::value(1.),
529 RooRealConstant::value(-1.),
532 RooRealConstant::value(0.),
533 RooRealConstant::value(1.),
534 RooRealConstant::value(0.),
535 RooRealConstant::value(0.),
536 RooRealConstant::value(0.),
537 RooRealConstant::value(_eff_tag),
538 RooRealConstant::value(0.),
539 RooRealConstant::value(0.),
540 RooRealConstant::value(0.));
546 RooRealConstant::value(-2.),
547 RooRealConstant::value(-2.),
550 RooRealConstant::value(0.),
551 RooRealConstant::value(1.),
552 RooRealConstant::value(0.),
553 RooRealConstant::value(0.),
554 RooRealConstant::value(0.),
555 RooRealConstant::value(_eff_tag),
556 RooRealConstant::value(0.),
557 RooRealConstant::value(0.),
558 RooRealConstant::value(0.));
564 RooRealConstant::value(2.),
565 RooRealConstant::value(-2.),
568 RooRealConstant::value(0.),
569 RooRealConstant::value(1.),
570 RooRealConstant::value(0.),
571 RooRealConstant::value(0.),
572 RooRealConstant::value(0.),
573 RooRealConstant::value(_eff_tag),
574 RooRealConstant::value(0.),
575 RooRealConstant::value(0.),
576 RooRealConstant::value(0.));
578 _r_scale_mean_dt =
new RooRealVar(
"scale_mean_dt",
"scale_mean_dt", 0);
579 _r_scale_sigma_dt =
new RooRealVar(
"scale_sigma_dt",
"scale_sigma_dt", 1.2);
583 vector<double> myBinning = knot_positions.
getVector();
586 vector<double> values = knot_values.
getVector() ;
589 RooArgList tacc_list;
590 for(
int i= 0; i< values.size(); i++){
595 RooFormulaVar* coeff_last =
new RooFormulaVar((
"coeff_"+
anythingToString((
int)values.size()+1)).c_str(),(
"coeff_"+
anythingToString((
int)values.size()+1)).c_str(),
"@0 + ((@0-@1)/(@2-@3)) * (@4 - @2)", RooArgList(RooRealConstant::value(1.0), *tacc_list.find((
"coeff_"+
anythingToString((
int)values.size()-1)).c_str()) , RooRealConstant::value(myBinning[myBinning.size()-1]), RooRealConstant::value(myBinning[myBinning.size()-2]), RooRealConstant::value(_r_t->getMax()) ));
597 tacc_list.add(*coeff_last);
600 _spline =
new RooCubicSplineFun(
"splinePdf",
"splinePdf", *_r_t, myBinning, tacc_list);
601 _efficiency =
new RooGaussEfficiencyModel(
"resmodel",
"resmodel", *_r_t, *_spline, RooRealConstant::value(0.), *_r_dt, *_r_scale_mean_dt, *_r_scale_sigma_dt );
604 TH1F *h_spline =
new TH1F(
"",
"", 100, _min_TAU, _max_TAU);
605 for (
int i = 1; i<=h_spline->GetNbinsX(); i++) {
606 _r_t->setVal(h_spline->GetXaxis()->GetBinCenter(i));
607 h_spline->SetBinContent(i,_spline->getVal());
610 TCanvas* c =
new TCanvas();
611 h_spline->SetLineColor(kRed);
612 h_spline->Draw(
"histc");
613 c->Print(
"spline.eps");
614 c->Print(
"spline.pdf");
617 _pdf_sigma_t =
new RooGenericPdf(
"pdf_sigma_t",
"pow(7. / @1, 7) / 720. * pow(@0, 6) * exp(-7. * @0 / @1)",RooArgList(*_r_dt, RooRealConstant::value(0.04)));
685 cout <<
"intA = " << _intA << endl;
686 cout <<
"intAbar = " << _intAbar << endl;
687 cout <<
"intAAbar = " << _intAAbar.real() << endl;
699 _r_mistag->setVal(w);
703 double r = (double)_r;
704 const complex<double> phase_diff = polar((
double)r,((
double) _delta -(
double)_gamma*f)/360.*2*
pi);
709 const double val = exp(-fabs(t)/(
double)_tau) *
711 (norm(amp) + norm(amp_bar))*cosh((
double)_dGamma/2.*t)* _cosh_coeff->
evaluate()
712 +(norm(amp) - norm(amp_bar)) *cos((
double)_dm*t) * _cos_coeff->
evaluate()
713 +real(amp_bar*conj(amp))*sinh((
double)_dGamma/2.*t) * _sinh_coeff->
evaluate()
714 +imag(amp_bar*conj(amp))*sin((
double)_dm*t) * _sin_coeff->
evaluate()
723 const double val = un_normalised_noPs(evt);
725 double r = (double)_r;
726 const double Gamma = 1./((double) _tau);
727 const complex<double> phase_diff = polar((
double)r,((
double) _delta -(
double)_gamma*f)/360.*2*
pi);
728 const double int_interference = (phase_diff*_intAAbar).real();
730 const complex<double> phase_diff_m = polar((
double)r,((
double) _delta + (
double)_gamma)/360.*2*
pi);
731 const complex<double> int_interference_m = phase_diff_m * _intAAbar ;
733 const complex<double> phase_diff_p = polar((
double)r,((
double) _delta -(
double)_gamma)/360.*2*
pi);
734 const complex<double> int_interference_p = phase_diff_p * _intAAbar ;
738 cout <<
"AmpsPdfFlexiFastCPV:: _norm = -1, should not have happened." << endl;
739 throw "can't deal with that";
744 return val/(( _cosh_coeff->
analyticalIntegral(1) * (_intA + r* r * _intAbar) * 4.*Gamma + _sinh_coeff->
analyticalIntegral(1) * int_interference/2. * 2. * _dGamma )/ (4.*Gamma*Gamma-_dGamma*_dGamma))*2.;
751 if(0 == evt)
return 0;
755 if(0 == evt)
return 0;
756 return getVal_withPs(*evt);
759 if(0 == evt)
return 0;
760 return getVal_noPs(*evt);
768 _amps1->
doFinalStatsAndSave(min,((
string)fname+
".txt").c_str(),((
string)fnameROOT+
".root").c_str());
769 _amps2->
doFinalStatsAndSave(min,((
string)fname+
"_CC.txt").c_str(),((
string)fnameROOT+
"_CC.root").c_str());
775 _amps1(amps1),_amps2(amps2),_ampsSum(ampsSum),_r(r),_delta(delta),_gamma(gamma),_tau(tau),_dGamma(dGamma),_dm(dm),_eff_tag(eff_tag),_w(w),
776 _intA(-1),_intAbar(-1),_intAAbar(-1),_min_TAU(
"min_TAU", 0.4), _max_TAU(
"max_TAU", 10.)
779 _r_t =
new RooRealVar(
"t",
"time", _min_TAU, _max_TAU);
780 _r_dt =
new RooRealVar(
"dt",
"per-candidate time resolution estimate",0., 0.25);
781 _r_mistag =
new RooRealVar(
"mistag",
"mistag",0.);
782 _r_f =
new RooCategory(
"qf",
"qf");
783 _r_f->defineType(
"h+", +1);
784 _r_f->defineType(
"h-", -1);
785 _r_f->setRange(
"Range_p",
"h+");
786 _r_f->setRange(
"Range_m",
"h-");
787 _r_q =
new RooCategory(
"qt",
"qt");
788 _r_q->defineType(
"B+", +1);
789 _r_q->defineType(
"B-", -1) ;
790 _r_q->defineType(
"untagged", 0);
796 RooRealConstant::value(1.),
797 RooRealConstant::value(1.),
800 RooRealConstant::value(0.),
801 RooRealConstant::value(1.),
802 RooRealConstant::value(0.),
803 RooRealConstant::value(0.),
804 RooRealConstant::value(0.),
805 RooRealConstant::value(_eff_tag),
806 RooRealConstant::value(0.),
807 RooRealConstant::value(0.),
808 RooRealConstant::value(0.));
814 RooRealConstant::value(1.),
815 RooRealConstant::value(-1.),
818 RooRealConstant::value(0.),
819 RooRealConstant::value(1.),
820 RooRealConstant::value(0.),
821 RooRealConstant::value(0.),
822 RooRealConstant::value(0.),
823 RooRealConstant::value(_eff_tag),
824 RooRealConstant::value(0.),
825 RooRealConstant::value(0.),
826 RooRealConstant::value(0.));
832 RooRealConstant::value(-2.),
833 RooRealConstant::value(-2.),
836 RooRealConstant::value(0.),
837 RooRealConstant::value(1.),
838 RooRealConstant::value(0.),
839 RooRealConstant::value(0.),
840 RooRealConstant::value(0.),
841 RooRealConstant::value(_eff_tag),
842 RooRealConstant::value(0.),
843 RooRealConstant::value(0.),
844 RooRealConstant::value(0.));
850 RooRealConstant::value(2.),
851 RooRealConstant::value(-2.),
854 RooRealConstant::value(0.),
855 RooRealConstant::value(1.),
856 RooRealConstant::value(0.),
857 RooRealConstant::value(0.),
858 RooRealConstant::value(0.),
859 RooRealConstant::value(_eff_tag),
860 RooRealConstant::value(0.),
861 RooRealConstant::value(0.),
862 RooRealConstant::value(0.));
864 _pdf_sigma_t =
new RooGenericPdf(
"pdf_sigma_t",
"pow(7. / @1, 7) / 720. * pow(@0, 6) * exp(-7. * @0 / @1)",RooArgList(*_r_dt, RooRealConstant::value(0.04)));
911 cout <<
"intA = " << _intA << endl;
912 cout <<
"intAbar = " << _intAbar << endl;
913 cout <<
"intAAbar = " << _intAAbar.real() << endl;
923 const double e_eff = fabs(q)*_eff_tag + (1.-fabs(q))*(1.-_eff_tag);
925 double r = (double)_r;
926 const complex<double> phase_diff = polar((
double)r,((
double) _delta -(
double)_gamma*f)/360.*2*
pi);
931 const double val = exp(-fabs(t)/(
double)_tau) *
933 (2.-fabs(q))*(norm(amp) + norm(amp_bar))*cosh((
double)_dGamma/2.*t)
934 +f*q*(1.-2.*w)*(norm(amp) - norm(amp_bar)) *cos((
double)_dm*t)
935 -(2.-fabs(q))*2.0*real(amp_bar*conj(amp))*sinh((
double)_dGamma/2.*t)
936 -f*2.0*q*(1.-2.*w)*imag(amp_bar*conj(amp))*sin((
double)_dm*t)
945 const double val = un_normalised_noPs(evt);
947 double r = (double)_r;
948 const double Gamma = 1./((double) _tau);
949 const complex<double> phase_diff = polar((
double)r,((
double) _delta -(
double)_gamma*f)/360.*2*
pi);
950 const double int_interference = (phase_diff*_intAAbar).real();
953 cout <<
"AmpsPdfFlexiFastCPV:: _norm = -1, should not have happened." << endl;
954 throw "can't deal with that";
957 return val/(2.* ((_intA + r* r * _intAbar) * 4.*Gamma - int_interference * 2. * _dGamma )/ (4.*Gamma*Gamma-_dGamma*_dGamma));
964 if(0 == evt)
return 0;
968 if(0 == evt)
return 0;
969 return getVal_withPs(*evt);
972 if(0 == evt)
return 0;
973 return getVal_noPs(*evt);
981 _amps1->
doFinalStatsAndSave(min,((
string)fname+
".txt").c_str(),((
string)fnameROOT+
".root").c_str());
982 _amps2->
doFinalStatsAndSave(min,((
string)fname+
"_CC.txt").c_str(),((
string)fnameROOT+
"_CC.root").c_str());
988 _amps1(amps1),_amps2(amps2),_ampsSum(ampsSum),_r(r),_delta(delta),_gamma(gamma),_tau(tau),_dGamma(dGamma),_dm(dm),_eff_tag(eff_tag),_w(w),
989 _intA(-1),_intAbar(-1),_intAAbar(-1)
1024 printIntegralVals();
1027 printIntegralVals();
1033 cout <<
"intA = " << _intA << endl;
1034 cout <<
"intAbar = " << _intAbar << endl;
1035 cout <<
"intAAbar = " << _intAAbar.real() << endl;
1045 const double e_eff = fabs(q)*_eff_tag + (1.-fabs(q))*(1.-_eff_tag);
1047 double r = (double)_r;
1048 const complex<double> phase_diff = polar((
double)r,((
double) _delta -(
double)_gamma*f)/360.*2*
pi);
1053 double Gamma = 1./((double) _tau);
1057 (2.-fabs(q))*(norm(amp) + norm(amp_bar))*(4.*Gamma/(4.*Gamma*Gamma-_dGamma*_dGamma))
1058 +f*q*(1.-2.*w)*(norm(amp) - norm(amp_bar)) *(Gamma/(Gamma*Gamma+_dm*_dm))
1059 -(2.-fabs(q))*2.0*real(amp_bar*conj(amp))*(2.*_dGamma/(4.*Gamma*Gamma-_dGamma*_dGamma))
1060 -f*2.0*q*(1.-2.*w)*imag(amp_bar*conj(amp))*(_dm/(Gamma*Gamma+_dm*_dm))
1069 const double val = un_normalised_noPs(evt);
1071 double r = (double)_r;
1072 const double Gamma = 1./((double) _tau);
1073 const complex<double> phase_diff = polar((
double)r,((
double) _delta -(
double)_gamma*f)/360.*2*
pi);
1074 const double int_interference = (phase_diff*_intAAbar).real();
1077 cout <<
"AmpsPdfFlexiFastCPV:: _norm = -1, should not have happened." << endl;
1078 throw "can't deal with that";
1081 return val/(2.* ((_intA + r* r * _intAbar) * 4.*Gamma - int_interference * 2. * _dGamma )/ (4.*Gamma*Gamma-_dGamma*_dGamma));
1088 if(0 == evt)
return 0;
1089 return getVal(*evt);
1092 if(0 == evt)
return 0;
1093 return getVal_withPs(*evt);
1096 if(0 == evt)
return 0;
1097 return getVal_noPs(*evt);
1106 _amps1->
doFinalStatsAndSave(min,((
string)fname+
".txt").c_str(),((
string)fnameROOT+
"_TI.root").c_str());
1107 _amps2->
doFinalStatsAndSave(min,((
string)fname+
"_CC.txt").c_str(),((
string)fnameROOT+
"_TI_CC.root").c_str());
1113 _amps1(amps1),_amps2(amps2),_ampsSum(ampsSum),_r(r),_delta(delta),_gamma(gamma),_tau(tau),_dGamma(dGamma),_dm(dm),_eff_tag(eff_tag),_w(w),
1114 _intA(-1),_intAbar(-1),_intAAbar(-1)
1150 const double e_eff = fabs(q)*_eff_tag + (1.-fabs(q))*(1.-_eff_tag);
1152 const double D = 1./2. * ((1.+f) * _D + (1.-f) * _D_bar);
1153 const double S = 1./2. * ((1.+f) * _S + (1.-f) * _S_bar);
1155 const double val = exp(-fabs(t)/(
double)_tau) *
1157 (2.-fabs(q))*cosh((
double)_dGamma/2.*t)
1158 +f*q*(1.-2.*w)* _C *cos((
double)_dm*t)
1159 -(2.-fabs(q))*2.0*_k* D *sinh((
double)_dGamma/2.*t)
1160 -f*2.0*q*(1.-2.*w)*_k* S *sin((
double)_dm*t)
1169 const double D = 1./2. * ((1.+f) * _D + (1.-f) * _D_bar);
1171 const double Gamma = 1./((double) _tau);
1173 double val = un_normalised(evt);
1175 double norm = 2.* ((4.*Gamma/(4.*Gamma*Gamma-_dGamma*_dGamma)) - 2.0*_k* D * (2.*_dGamma/(4.*Gamma*Gamma-_dGamma*_dGamma)));
1184 if(0 == evt)
return 0;
1185 return getVal(*evt);
1188 if(0 == evt)
return 0;
1189 return getVal_withPs(*evt);
1192 if(0 == evt)
return 0;
1193 return getVal_noPs(*evt);
1196 TimePdf(
MINT::FitParameter& C,
MINT::FitParameter& D,
MINT::FitParameter& D_bar,
MINT::FitParameter& S,
MINT::FitParameter& S_bar,
MINT::FitParameter& k,
MINT::FitParameter& tau,
MINT::FitParameter& dGamma,
MINT::FitParameter& dm,
MINT::FitParameter& eff_tag,
MINT::FitParameter& w ):
1197 _C(C),_D(D),_D_bar(D_bar),_S(S),_S_bar(S_bar),_k(k),_tau(tau),_dGamma(dGamma),_dm(dm),_eff_tag(eff_tag), _w(w) {;}
1231 const double e_eff = fabs(q)*_eff_tag + (1.-fabs(q))*(1.-_eff_tag);
1233 const double C = (1.-(double)_r*(
double)_r)/(1.+(
double)_r*(double)_r);
1234 const double D = (double)_r * cos(((
double)_delta-(double)_gamma*f)/360.*2*
pi)/(1.+(
double)_r*(double)_r);
1235 const double S = (double)_r * sin(((
double)_delta-(double)_gamma*f)/360.*2*
pi)/(1.+(
double)_r*(double)_r);
1237 const double val = exp(-fabs(t)/(
double)_tau) *
1239 (2.-fabs(q))*cosh((
double)_dGamma/2.*t)
1240 +f*q*(1.-2.*w)* C *cos((
double)_dm*t)
1241 -(2.-fabs(q))*2.0*_k* D *sinh((
double)_dGamma/2.*t)
1242 -f*2.0*q*(1.-2.*w)*_k* S *sin((
double)_dm*t)
1251 const double D = (double)_r * cos(((
double)_delta-(double)_gamma*f)/360.*2*
pi)/(1.+(
double)_r*(double)_r);
1253 const double Gamma = 1./((double) _tau);
1255 double val = un_normalised(evt);
1257 double norm = 2.* ((4.*Gamma/(4.*Gamma*Gamma-_dGamma*_dGamma)) - 2.0*_k* D * (2.*_dGamma/(4.*Gamma*Gamma-_dGamma*_dGamma)));
1266 if(0 == evt)
return 0;
1267 return getVal(*evt);
1270 if(0 == evt)
return 0;
1271 return getVal_withPs(*evt);
1274 if(0 == evt)
return 0;
1275 return getVal_noPs(*evt);
1279 _r(r),_delta(delta),_gamma(gamma),_k(k),_tau(tau),_dGamma(dGamma),_dm(dm),_eff_tag(eff_tag), _w(w) {;}
1289 int seed = RandomSeed + step;
1290 ranLux.SetSeed((
int)seed);
1298 std::string inputFile = InputFileName;
1299 bool generateNew = (std::string) InputFileName ==
"";
1300 std::cout <<
"InputFileName: " << InputFileName << std::endl;
1306 NamedParameter<string> IntegratorEventFile(
"IntegratorEventFile", (std::string)
"SignalIntegrationEvents.root", (
char*) 0);
1307 TString integratorEventFile = (string) IntegratorEventFile;
1308 if(EvtGenTest) integratorEventFile.ReplaceAll(
".root",(
"_" +
anythingToString(seed) +
".root").c_str() );
1316 cout <<
" got event pattern: " << pat << endl;
1366 fas_tmp.
getVal(eventListPhsp[0]);
1393 AddScaledAmpsToList(fas_tmp, fas, fasCC,
"NonResV0(->Ds-,pi+),K*(892)0(->K+,pi-)", r_3_plus, r_3_minus );
1394 AddScaledAmpsToList(fas_tmp, fas, fasCC,
"NonResS0(->Ds-,pi+),K*(892)0(->K+,pi-)", r_3_plus, r_3_minus );
1395 AddScaledAmpsToList(fas_tmp, fas, fasCC,
"NonResV0(->Ds-,K+),sigma10(->pi+,pi-)", r_3_plus, r_3_minus );
1405 vector<double> k_gen =
coherenceFactor(fas,fasCC,(
double)r, (
double)delta,eventListPhsp);
1410 fas_sum.
getVal(eventListPhsp[0]);
1412 AmpsPdfFlexiFast ampsSig(pat, &fas, 0, integPrecision,integMethod, (std::string) integratorEventFile);
1413 AmpsPdfFlexiFast ampsSigCC(pat, &fasCC, 0, integPrecision,integMethod, (std::string) integratorEventFile);
1414 AmpsPdfFlexiFast ampsSum(pat, &fas_sum, 0, integPrecision,integMethod, (std::string) integratorEventFile);
1417 AmpsPdfFlexiFastCPV pdf(&sSig,&sSigCC,&sSum, r, delta, gamma, tau, dGamma, dm, eff_tag, mistag );
1421 time_t startTime = time(0);
1423 TFile* fileTD= TFile::Open(
"dummy.root",
"RECREATE");
1426 TTree *tree =
new TTree(
"TD",
"TD");
1429 tree->Branch(
"t",&t,
"t/D");
1430 tree->Branch(
"dt",&dt,
"dt/D");
1431 tree->Branch(
"q",&q,
"q/I");
1432 tree->Branch(
"w",&w,
"w/D");
1433 tree->Branch(
"f",&f,
"f/I");
1440 fasGen.
getVal(eventListPhsp[0]);
1446 for(
int i = 0; i < Nevents; i++){
1449 t = ranLux.Exp(tau);
1450 dt = ranLux.Uniform(0.,0.25);
1453 const double q_rand = ranLux.Uniform();
1455 if (q_rand < 1./3.) q = -1;
1456 if (q_rand > 2./3.) q = 1;
1460 const double f_rand = ranLux.Uniform();
1461 if(f_rand < 0.5)f = 1;
1474 evt.setValueInVector(0, t);
1475 evt.setValueInVector(1, dt);
1476 evt.setValueInVector(2, q);
1477 evt.setValueInVector(3, w);
1478 evt.setValueInVector(4, f);
1485 const double height = ranLux.Uniform(0,maxVal);
1487 if( pdfVal > maxVal ){
1488 std::cout <<
"ERROR: PDF above determined maximum." << std::endl;
1489 std::cout << pdfVal <<
" > " << maxVal << std::endl;
1491 pdf_max = pdf_max * 2.;
1495 if( height < pdfVal ){
1497 if(f==1)eventList_f.
Add(evt);
1498 else eventList_fbar.
Add(evt);
1505 cout <<
" Generated " << Nevents <<
" Events. Took " << (time(0) - startTime)/60 <<
" mins "<< endl;
1511 TFile* file= TFile::Open(((std::string) OutputRootFile).c_str(),
"UPDATE");
1513 tree->CloneTree()->Write();
1520 cout <<
"reading events from file " << inputFile << endl;
1522 TFile *_InputFile = TFile::Open(inputFile.c_str());
1523 TTree* in_tree, *in_treeTD;
1524 in_tree=dynamic_cast<TTree*>(_InputFile->Get(
"DalitzEventList"));
1526 in_treeTD=dynamic_cast<TTree*>(_InputFile->Get(
"TD"));
1529 in_treeTD->SetBranchAddress(
"t",&t);
1530 in_treeTD->SetBranchAddress(
"dt",&dt);
1531 in_treeTD->SetBranchAddress(
"q",&q);
1532 in_treeTD->SetBranchAddress(
"w",&w);
1533 in_treeTD->SetBranchAddress(
"f",&f);
1537 if(in_treeTD->GetEntries() != in_tree->GetEntries()){cout <<
"ERROR: Different number of DalitzEvents and time information " << endl;
throw "crash"; }
1539 for (
unsigned int i = 0; i < in_treeTD->GetEntries(); i++) {
1540 in_treeTD->GetEntry(i);
1542 eventList[i].setValueInVector(0, t);
1543 eventList[i].setValueInVector(1, dt);
1544 eventList[i].setValueInVector(2, q);
1545 eventList[i].setValueInVector(3, w);
1546 eventList[i].setValueInVector(4, f);
1548 if(f==1)eventList_f.
Add(eventList[i]);
1549 else eventList_fbar.
Add(eventList[i]);
1552 cout <<
" I've got " << eventList.
size() <<
" events." << endl;
1553 _InputFile->Close();
1557 Neg2LL fcn(pdf, eventList_f);
1558 Neg2LL fcn_bar(pdf, eventList_fbar);
1560 Neg2LL neg2LL(pdf, eventList);
1570 TFile* paraFile =
new TFile(((
string)OutputDir+
"pull_"+
anythingToString((
int)seed)+
".root").c_str(),
"RECREATE");
1573 TTree* tree =
new TTree(
"Coherence",
"Coherence");
1574 double r_val,delta_val,gamma_val,k_val,n2ll;
1575 TBranch* br_r = tree->Branch(
"r", &r_val,
"r_val/D" );
1576 TBranch* br_delta = tree->Branch(
"delta", &delta_val,
"delta_val/D" );
1577 TBranch* br_gamma = tree->Branch(
"gamma", &gamma_val,
"gamma_val/D" );
1578 TBranch* br_k = tree->Branch(
"k", &k_val,
"k_val/D" );
1579 TBranch* br_n2ll = tree->Branch(
"n2ll", &n2ll,
"n2ll/D" );
1581 double r_val_t,delta_val_t,gamma_val_t,k_val_t,n2ll_t;
1582 TBranch* br_r_t = tree->Branch(
"r_t", &r_val_t,
"r_val_t/D" );
1583 TBranch* br_delta_t = tree->Branch(
"delta_t", &delta_val_t,
"delta_val_t/D" );
1584 TBranch* br_gamma_t = tree->Branch(
"gamma_t", &gamma_val_t,
"gamma_val_t/D" );
1585 TBranch* br_k_t = tree->Branch(
"k_t", &k_val_t,
"k_val_t/D" );
1586 TBranch* br_n2ll_t = tree->Branch(
"n2ll_t", &n2ll_t,
"n2ll_t/D" );
1588 double r_val_t_fixed_k,delta_val_t_fixed_k,gamma_val_t_fixed_k,k_val_t_fixed_k,n2ll_t_fixed_k;
1589 TBranch* br_r_t_fixed_k = tree->Branch(
"r_t_fixed_k", &r_val_t_fixed_k,
"r_val_t_fixed_k/D" );
1590 TBranch* br_delta_t_fixed_k = tree->Branch(
"delta_t_fixed_k", &delta_val_t_fixed_k,
"delta_val_t_fixed_k/D" );
1591 TBranch* br_gamma_t_fixed_k = tree->Branch(
"gamma_t_fixed_k", &gamma_val_t_fixed_k,
"gamma_val_t_fixed_k/D" );
1592 TBranch* br_k_t_fixed_k = tree->Branch(
"k_t_fixed_k", &k_val_t_fixed_k,
"k_val_t_fixed_k/D" );
1593 TBranch* br_n2ll_t_fixed_k = tree->Branch(
"n2ll_t_fixed_k", &n2ll_t_fixed_k,
"n2ll_t_fixed_k/D" );
1595 double r_val_time_integrated,delta_val_time_integrated,gamma_val_time_integrated,k_val_time_integrated,n2ll_time_integrated;
1596 TBranch* br_r_time_integrated = tree->Branch(
"r_time_integrated", &r_val_time_integrated,
"r_val_time_integrated/D" );
1597 TBranch* br_delta_time_integrated = tree->Branch(
"delta_time_integrated", &delta_val_time_integrated,
"delta_val_time_integrated/D" );
1598 TBranch* br_gamma_time_integrated = tree->Branch(
"gamma_time_integrated", &gamma_val_time_integrated,
"gamma_val_time_integrated/D" );
1599 TBranch* br_k_time_integrated = tree->Branch(
"k_time_integrated", &k_val_time_integrated,
"k_val_time_integrated/D" );
1600 TBranch* br_n2ll_time_integrated = tree->Branch(
"n2ll_time_integrated", &n2ll_time_integrated,
"n2ll_time_integrated/D" );
1602 TBranch* br_seed = tree->Branch(
"seed", &seed,
"seed/I" );
1604 MinuitParameterSet::getDefaultSet()->fillNtp(paraFile, ntp);
1607 n2ll = neg2LLSum.
getVal();
1609 for(
unsigned int i=0; i < MinuitParameterSet::getDefaultSet()->size(); i++){
1610 if(0 == MinuitParameterSet::getDefaultSet()->getParPtr(i))
continue;
1611 if(
A_is_in_B(
"gamma",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name()))gamma_val = MinuitParameterSet::getDefaultSet()->getParPtr(i)->mean();
1614 vector<double> k_fit =
coherenceFactor(fas,fasCC,(
double)r, (
double)delta,eventListPhsp);
1617 delta_val = k_fit[2];
1624 for(
unsigned int i=0; i < MinuitParameterSet::getDefaultSet()->size(); i++){
1625 if(0 == MinuitParameterSet::getDefaultSet()->getParPtr(i))
continue;
1626 MinuitParameterSet::getDefaultSet()->getParPtr(i)->setCurrentFitVal(MinuitParameterSet::getDefaultSet()->getParPtr(i)->meanInit());
1629 AmpsPdfFlexiFastCPV_time_integrated pdf_time_integrated(&sSig,&sSigCC,&sSum, r, delta, gamma, tau, dGamma, dm, eff_tag, mistag );
1630 Neg2LL fcn_time_integrated(pdf_time_integrated, eventList_f);
1631 Neg2LL fcn_bar_time_integrated(pdf_time_integrated, eventList_fbar);
1632 Neg2LLSum neg2LLSum_time_integrated(&fcn_time_integrated,&fcn_bar_time_integrated);
1633 Minimiser mini_time_integrated(&neg2LLSum_time_integrated);
1634 mini_time_integrated.
doFit();
1637 n2ll_time_integrated = neg2LLSum_time_integrated.
getVal();
1639 for(
unsigned int i=0; i < MinuitParameterSet::getDefaultSet()->size(); i++){
1640 if(0 == MinuitParameterSet::getDefaultSet()->getParPtr(i))
continue;
1641 if(
A_is_in_B(
"gamma",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name()))gamma_val_time_integrated = MinuitParameterSet::getDefaultSet()->getParPtr(i)->mean();
1644 vector<double> k_fit_time_integrated =
coherenceFactor(fas,fasCC,(
double)r, (
double)delta,eventListPhsp);
1645 r_val_time_integrated = k_fit_time_integrated[0];
1646 k_val_time_integrated = k_fit_time_integrated[1];
1647 delta_val_time_integrated = k_fit_time_integrated[2];
1651 for(
unsigned int i=0; i < MinuitParameterSet::getDefaultSet()->size(); i++){
1652 if(0 == MinuitParameterSet::getDefaultSet()->getParPtr(i))
continue;
1653 MinuitParameterSet::getDefaultSet()->getParPtr(i)->setCurrentFitVal(MinuitParameterSet::getDefaultSet()->getParPtr(i)->meanInit());
1656 for(
unsigned int i=0; i < MinuitParameterSet::getDefaultSet()->size(); i++){
1657 if(0 == MinuitParameterSet::getDefaultSet()->getParPtr(i))
continue;
1658 if(
A_is_in_B(
"_Re",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name())){
1659 MinuitParameterSet::getDefaultSet()->unregister(MinuitParameterSet::getDefaultSet()->getParPtr(i));
1662 else if(
A_is_in_B(
"_Im",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name())){
1663 MinuitParameterSet::getDefaultSet()->unregister(MinuitParameterSet::getDefaultSet()->getParPtr(i));
1666 else if(
A_is_in_B(
"ratio",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name())){
1667 MinuitParameterSet::getDefaultSet()->unregister(MinuitParameterSet::getDefaultSet()->getParPtr(i));
1674 TimePdf_mod t_pdf(r2,delta,gamma,k,tau,dGamma,dm,eff_tag,mistag );
1675 Neg2LL fcn_t(t_pdf, eventList_f);
1676 Neg2LL fcn_t_bar(t_pdf, eventList_fbar);
1677 Neg2LLSum neg2LLSum_t(&fcn_t,&fcn_t_bar);
1682 n2ll_t = neg2LLSum_t.
getVal();
1684 for(
unsigned int i=0; i < MinuitParameterSet::getDefaultSet()->size(); i++){
1685 if(0 == MinuitParameterSet::getDefaultSet()->getParPtr(i))
continue;
1686 if(
A_is_in_B(
"gamma",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name()))gamma_val_t= MinuitParameterSet::getDefaultSet()->getParPtr(i)->mean();
1687 if(
A_is_in_B(
"ratio2",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name()))r_val_t= MinuitParameterSet::getDefaultSet()->getParPtr(i)->mean();
1688 if(
A_is_in_B(
"delta",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name()))delta_val_t= MinuitParameterSet::getDefaultSet()->getParPtr(i)->mean();
1689 if(
A_is_in_B(
"kappa",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name()))k_val_t= MinuitParameterSet::getDefaultSet()->getParPtr(i)->mean();
1692 for(
unsigned int i=0; i < MinuitParameterSet::getDefaultSet()->size(); i++){
1693 if(0 == MinuitParameterSet::getDefaultSet()->getParPtr(i))
continue;
1694 MinuitParameterSet::getDefaultSet()->getParPtr(i)->setCurrentFitVal(MinuitParameterSet::getDefaultSet()->getParPtr(i)->meanInit());
1700 n2ll_t_fixed_k = neg2LLSum_t.
getVal();
1702 for(
unsigned int i=0; i < MinuitParameterSet::getDefaultSet()->size(); i++){
1703 if(0 == MinuitParameterSet::getDefaultSet()->getParPtr(i))
continue;
1704 if(
A_is_in_B(
"gamma",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name()))gamma_val_t_fixed_k= MinuitParameterSet::getDefaultSet()->getParPtr(i)->mean();
1705 if(
A_is_in_B(
"ratio2",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name()))r_val_t_fixed_k= MinuitParameterSet::getDefaultSet()->getParPtr(i)->mean();
1706 if(
A_is_in_B(
"delta",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name()))delta_val_t_fixed_k= MinuitParameterSet::getDefaultSet()->getParPtr(i)->mean();
1707 if(
A_is_in_B(
"kappa",MinuitParameterSet::getDefaultSet()->getParPtr(i)->name()))k_val_t_fixed_k= MinuitParameterSet::getDefaultSet()->getParPtr(i)->mean();
1713 tree->SetDirectory(paraFile);
1719 cout <<
"Now plotting:" << endl;
1727 TH1D* h_t =
new TH1D(
"",
";t (ps);Events (norm.) ",nBinst,0,6);
1728 TH1D* s_Kpipi =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0.8,12);
1729 TH1D* s_Kpi =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0.,4);
1730 TH1D* s_pipi =
new TH1D(
"",
";#left[m^{2}(#pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,2);
1731 TH1D* s_Dspipi =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,30);
1732 TH1D* s_DsK =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} K^{+})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,30) ;
1733 TH1D* s_DsKpi =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} K^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,5,30);
1734 TH1D* s_Dspi =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} #pi^{+})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,25);
1735 TH1D* s_Dspim =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,25);
1737 for (
int i=0; i<eventList.
size(); i++) {
1738 h_t->Fill(eventList[i].getValueFromVector(0));
1739 s_Kpipi->Fill(eventList[i].sij(s234)/(
GeV*
GeV));
1740 s_Kpi->Fill(eventList[i].
s(2,4)/(
GeV*
GeV));
1741 s_pipi->Fill(eventList[i].
s(3,4)/(
GeV*
GeV));
1742 s_Dspipi->Fill(eventList[i].sij(s134)/(
GeV*
GeV));
1743 s_DsK->Fill(eventList[i].
s(1,2)/(
GeV*
GeV));
1744 s_DsKpi->Fill(eventList[i].sij(s124)/(
GeV*
GeV));
1745 s_Dspi->Fill(eventList[i].
s(1,3)/(
GeV*
GeV));
1746 s_Dspim->Fill(eventList[i].
s(1,4)/(
GeV*
GeV));
1749 TH1D* h_t_fit =
new TH1D(
"",
";t",nBinst,0,6);
1750 TH1D* h_t_fit_mp =
new TH1D(
"",
";t",nBinst,0,6);
1751 TH1D* h_t_fit_0p =
new TH1D(
"",
";t",nBinst,0,6);
1752 TH1D* h_t_fit_pp =
new TH1D(
"",
";t",nBinst,0,6);
1753 TH1D* h_t_fit_mm =
new TH1D(
"",
";t",nBinst,0,6);
1754 TH1D* h_t_fit_0m =
new TH1D(
"",
";t",nBinst,0,6);
1755 TH1D* h_t_fit_pm =
new TH1D(
"",
";t",nBinst,0,6);
1757 TH1D* s_Kpipi_fit =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0.8,12);
1758 TH1D* s_Kpi_fit =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0.,4);
1759 TH1D* s_pipi_fit =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,2);
1760 TH1D* s_Dspipi_fit =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,30);
1761 TH1D* s_DsK_fit =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} K^{+})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,30);
1762 TH1D* s_DsKpi_fit =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} K^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,5,30);
1763 TH1D* s_Dspi_fit =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} #pi^{+})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,25);
1764 TH1D* s_Dspim_fit =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,25);
1766 TH1D* s_Kpipi_fitBs =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0.8,3.5);
1767 TH1D* s_Kpi_fitBs =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0.3,2.);
1768 TH1D* s_pipi_fitBs =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,2);
1769 TH1D* s_Dspipi_fitBs =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",20,4,25);
1770 TH1D* s_DsK_fitBs =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} K^{+})#right] (GeV^{2}/c^{4});Events (norm.) ",20,4,26);
1772 TH1D* s_Kpipi_fitBsbar =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0.8,3.5);
1773 TH1D* s_Kpi_fitBsbar =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0.3,2.);
1774 TH1D* s_pipi_fitBsbar =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,2);
1775 TH1D* s_Dspipi_fitBsbar =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",20,4,25);
1776 TH1D* s_DsK_fitBsbar =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} K^{+})#right] (GeV^{2}/c^{4});Events (norm.) ",20,4,26);
1778 TH1D* s_Kpipi_fit_notag =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0.8,3.5);
1779 TH1D* s_Kpi_fit_notag =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0.3,2.);
1780 TH1D* s_pipi_fit_notag =
new TH1D(
"",
";#left[m^{2}(K^{+} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",nBins,0,2);
1781 TH1D* s_Dspipi_fit_notag =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} #pi^{+} #pi^{-})#right] (GeV^{2}/c^{4});Events (norm.) ",20,4,25);
1782 TH1D* s_DsK_fit_notag =
new TH1D(
"",
";#left[m^{2}(D_{s}^{-} K^{+})#right] (GeV^{2}/c^{4});Events (norm.) ",20,4,26);
1787 for(
int i = 0; i < 2000000; i++){
1789 const double t = ranLux.Exp(tau);
1790 const double dt = ranLux.Uniform(0.00001,0.25);
1791 const double w = mistag;
1799 evt.setValueInVector(1, dt);
1800 evt.setValueInVector(3, w);
1802 evt.setValueInVector(2, -1);
1803 evt.setValueInVector(4, 1);
1804 double weight_mp = pdf.
un_normalised_noPs(evt)*evt.getWeight()/evt.getGeneratorPdfRelativeToPhaseSpace()/exp(-fabs(t)/(tau));
1806 evt.setValueInVector(2, 0);
1807 evt.setValueInVector(4, 1);
1808 double weight_0p = pdf.
un_normalised_noPs(evt)*evt.getWeight()/evt.getGeneratorPdfRelativeToPhaseSpace()/exp(-fabs(t)/(tau));
1810 evt.setValueInVector(2, 1);
1811 evt.setValueInVector(4, 1);
1812 double weight_pp = pdf.
un_normalised_noPs(evt)*evt.getWeight()/evt.getGeneratorPdfRelativeToPhaseSpace()/exp(-fabs(t)/(tau));
1814 evt.setValueInVector(2, -1);
1815 evt.setValueInVector(4, -1);
1816 double weight_mm = pdf.
un_normalised_noPs(evt)*evt.getWeight()/evt.getGeneratorPdfRelativeToPhaseSpace()/exp(-fabs(t)/(tau));
1818 evt.setValueInVector(2, 0);
1819 evt.setValueInVector(4, -1);
1820 double weight_0m = pdf.
un_normalised_noPs(evt)*evt.getWeight()/evt.getGeneratorPdfRelativeToPhaseSpace()/exp(-fabs(t)/(tau));
1822 evt.setValueInVector(2, 1);
1823 evt.setValueInVector(4, -1);
1824 double weight_pm = pdf.
un_normalised_noPs(evt)*evt.getWeight()/evt.getGeneratorPdfRelativeToPhaseSpace()/exp(-fabs(t)/(tau));
1826 double weight = weight_mp + weight_0p + weight_pp + weight_mm + weight_0m + weight_pm ;
1828 h_t_fit->Fill(t,weight);
1829 h_t_fit_mp->Fill(t,weight_mp);
1830 h_t_fit_0p->Fill(t,weight_0p);
1831 h_t_fit_pp->Fill(t,weight_pp);
1832 h_t_fit_mm->Fill(t,weight_mm);
1833 h_t_fit_0m->Fill(t,weight_0m);
1834 h_t_fit_pm->Fill(t,weight_pm);
1836 double weight_B = fas.
RealVal(evt)*evt.getWeight()/evt.getGeneratorPdfRelativeToPhaseSpace();
1837 double weight_Bbar = fasCC.
RealVal(evt)*evt.getWeight()/evt.getGeneratorPdfRelativeToPhaseSpace();
1838 double weight_notag = weight_Bbar+ (double)r * (
double)r * weight_Bbar;
1840 const complex<double> phase_diff = polar((
double)r, (
double)delta/360.*2*
pi);
1841 double weight_coherence = std::abs(conj(fas.
getVal(evt)) * fasCC.
getVal(evt)*phase_diff) *evt.getWeight()/evt.getGeneratorPdfRelativeToPhaseSpace();
1843 s_Kpipi_fit->Fill(evt.sij(s234)/(
GeV*
GeV),weight);
1844 s_Kpi_fit->Fill(evt.s(2,4)/(
GeV*
GeV),weight);
1845 s_pipi_fit->Fill(evt.s(3,4)/(
GeV*
GeV),weight);
1846 s_Dspipi_fit->Fill(evt.sij(s134)/(
GeV*
GeV),weight);
1847 s_DsK_fit->Fill(evt.s(1,2)/(
GeV*
GeV),weight);
1848 s_DsKpi_fit->Fill(evt.sij(s124)/(
GeV*
GeV),weight);
1849 s_Dspi_fit->Fill(evt.s(1,3)/(
GeV*
GeV),weight);
1850 s_Dspim_fit->Fill(evt.s(1,4)/(
GeV*
GeV),weight);
1852 s_Kpipi_fitBs->Fill(evt.sij(s234)/(
GeV*
GeV),weight_B);
1853 s_Kpi_fitBs->Fill(evt.s(2,4)/(
GeV*
GeV),weight_B);
1854 s_pipi_fitBs->Fill(evt.s(3,4)/(
GeV*
GeV),weight_B);
1855 s_Dspipi_fitBs->Fill(evt.sij(s134)/(
GeV*
GeV),weight_B);
1856 s_DsK_fitBs->Fill(evt.s(1,2)/(
GeV*
GeV),weight_B);
1858 s_Kpipi_fitBsbar->Fill(evt.sij(s234)/(
GeV*
GeV),weight_Bbar);
1859 s_Kpi_fitBsbar->Fill(evt.s(2,4)/(
GeV*
GeV),weight_Bbar);
1860 s_pipi_fitBsbar->Fill(evt.s(3,4)/(
GeV*
GeV),weight_Bbar);
1861 s_Dspipi_fitBsbar->Fill(evt.sij(s134)/(
GeV*
GeV),weight_Bbar);
1862 s_DsK_fitBsbar->Fill(evt.s(1,2)/(
GeV*
GeV),weight_Bbar);
1864 s_Kpipi_fit_notag->Fill(evt.sij(s234)/(
GeV*
GeV),weight_notag);
1865 s_Kpi_fit_notag->Fill(evt.s(2,4)/(
GeV*
GeV),weight_notag);
1866 s_pipi_fit_notag->Fill(evt.s(3,4)/(
GeV*
GeV),weight_notag);
1867 s_Dspipi_fit_notag->Fill(evt.sij(s134)/(
GeV*
GeV),weight_notag);
1868 s_DsK_fit_notag->Fill(evt.s(1,2)/(
GeV*
GeV),weight_notag);
1872 TCanvas* c =
new TCanvas();
1874 h_t->SetLineColor(kBlack);
1875 h_t->DrawNormalized(
"e1",1);
1876 h_t_fit->SetLineColor(kBlue);
1877 h_t_fit->SetLineWidth(3);
1878 h_t_fit->DrawNormalized(
"histcsame",1);
1880 c->Print(((
string)OutputDir+
"h_t.eps").c_str());
1882 c->Print(((
string)OutputDir+
"h_t_log.eps").c_str());
1885 h_t->SetLineColor(kBlack);
1886 h_t->DrawNormalized(
"e1",1);
1887 h_t_fit->SetLineColor(kBlack);
1888 h_t_fit->SetLineWidth(3);
1889 h_t_fit->DrawNormalized(
"histcsame",1);
1891 h_t_fit_pm->SetLineColor(kBlue);
1892 h_t_fit_pm->SetLineWidth(3);
1893 h_t_fit_pm->DrawNormalized(
"histcsame",0.5*0.5*eff_tag);
1894 h_t_fit_mm->SetLineColor(kBlue);
1895 h_t_fit_mm->SetLineWidth(3);
1896 h_t_fit_mm->SetLineStyle(kDashed);
1897 h_t_fit_mm->DrawNormalized(
"histcsame",0.5*0.5*eff_tag);
1899 h_t_fit_pp->SetLineColor(kRed);
1900 h_t_fit_pp->SetLineWidth(3);
1901 h_t_fit_pp->DrawNormalized(
"histcsame",0.5*0.5*eff_tag);
1902 h_t_fit_mp->SetLineColor(kRed);
1903 h_t_fit_mp->SetLineWidth(3);
1904 h_t_fit_mp->SetLineStyle(kDashed);
1905 h_t_fit_mp->DrawNormalized(
"histcsame",0.5*0.5*eff_tag);
1907 h_t_fit_0p->SetLineColor(kGreen);
1908 h_t_fit_0p->SetLineWidth(3);
1909 h_t_fit_0p->DrawNormalized(
"histcsame",0.5*0.5*(1.-eff_tag));
1910 h_t_fit_0m->SetLineColor(kGreen);
1911 h_t_fit_0m->SetLineWidth(3);
1912 h_t_fit_0m->SetLineStyle(kDashed);
1913 h_t_fit_0m->DrawNormalized(
"histcsame",0.5*0.5*(1.-eff_tag));
1915 c->Print(((
string)OutputDir+
"h_t_2.eps").c_str());
1917 c->Print(((
string)OutputDir+
"h_t_2_log.eps").c_str());
1920 TLegend leg_t(0,0,1,1,
"");
1921 leg_t.SetLineStyle(0);
1922 leg_t.SetLineColor(0);
1923 leg_t.SetFillColor(0);
1925 leg_t.SetTextColor(1);
1927 leg_t.SetTextAlign(12);
1929 leg_t.AddEntry(h_t_fit_pm,
"B_{s} #rightarrow D_{s}^{-} K^{+} #pi^{+} #pi^{-}",
"l");
1930 leg_t.AddEntry(h_t_fit_mm,
"#bar{B}_{s} #rightarrow D_{s}^{-} K^{+} #pi^{+} #pi^{-}",
"l");
1931 leg_t.AddEntry(h_t_fit_0m,
"Untagged #rightarrow D_{s}^{-} K^{+} #pi^{+} #pi^{-}",
"l");
1932 leg_t.AddEntry(h_t_fit_mp,
"#bar{B}_{s} #rightarrow D_{s}^{+} K^{-} #pi^{-} #pi^{+}",
"l");
1933 leg_t.AddEntry(h_t_fit_pp,
"B_{s} #rightarrow D_{s}^{+} K^{-} #pi^{-} #pi^{+}",
"l");
1934 leg_t.AddEntry(h_t_fit_0p,
"Untagged #rightarrow D_{s}^{+} K^{-} #pi^{-} #pi^{+}",
"l");
1936 c->Print(((
string)OutputDir+
"leg_t.eps").c_str());
1938 s_Kpipi->SetLineColor(kBlack);
1939 s_Kpipi->DrawNormalized(
"e1",1);
1940 s_Kpipi_fit->SetLineColor(kBlue);
1941 s_Kpipi_fit->SetLineWidth(3);
1942 s_Kpipi_fit->DrawNormalized(
"histcsame",1);
1943 c->Print(((
string)OutputDir+
"s_Kpipi.eps").c_str());
1945 s_Kpipi->SetLineColor(kBlack);
1946 s_Kpipi->DrawNormalized(
"e1",1);
1947 s_Kpipi_fit->SetLineColor(kBlack);
1948 s_Kpipi_fit->SetLineWidth(3);
1949 s_Kpipi_fit->DrawNormalized(
"histcsame",1);
1950 s_Kpipi_fitBs->SetLineColor(kRed);
1951 s_Kpipi_fitBs->SetLineWidth(3);
1952 s_Kpipi_fitBs->SetLineStyle(kDashed);
1953 s_Kpipi_fitBs->DrawNormalized(
"histcsame",1./(1.+k_fit[0]*k_fit[0])*eff_tag);
1954 s_Kpipi_fitBsbar->SetLineWidth(3);
1955 s_Kpipi_fitBsbar->SetLineColor(kBlue);
1956 s_Kpipi_fitBsbar->SetLineStyle(kDashed);
1957 s_Kpipi_fitBsbar->DrawNormalized(
"histcsame",k_fit[0]*k_fit[0]/(1.+k_fit[0]*k_fit[0])*eff_tag);
1958 s_Kpipi_fit_notag->SetLineWidth(3);
1959 s_Kpipi_fit_notag->SetLineColor(kMagenta);
1960 s_Kpipi_fit_notag->SetLineStyle(kDashed);
1961 s_Kpipi_fit_notag->DrawNormalized(
"histcsame",(1.-eff_tag));
1962 c->Print(((
string)OutputDir+
"s_Kpipi_2.eps").c_str());
1965 s_Kpi->SetLineColor(kBlack);
1966 s_Kpi->DrawNormalized(
"e1",1);
1967 s_Kpi_fit->SetLineColor(kBlue);
1968 s_Kpi_fit->SetLineWidth(3);
1969 s_Kpi_fit->DrawNormalized(
"histcsame",1);
1970 c->Print(((
string)OutputDir+
"s_Kpi.eps").c_str());
1972 s_Kpi->SetLineColor(kBlack);
1973 s_Kpi->DrawNormalized(
"e1",1);
1974 s_Kpi_fit->SetLineColor(kBlack);
1975 s_Kpi_fit->SetLineWidth(3);
1976 s_Kpi_fit->DrawNormalized(
"histcsame",1);
1977 s_Kpi_fitBs->SetLineColor(kRed);
1978 s_Kpi_fitBs->SetLineWidth(3);
1979 s_Kpi_fitBs->SetLineStyle(kDashed);
1980 s_Kpi_fitBs->DrawNormalized(
"histcsame",1./(1.+k_fit[0]*k_fit[0])*eff_tag);
1981 s_Kpi_fitBsbar->SetLineWidth(3);
1982 s_Kpi_fitBsbar->SetLineColor(kBlue);
1983 s_Kpi_fitBsbar->SetLineStyle(kDashed);
1984 s_Kpi_fitBsbar->DrawNormalized(
"histcsame",k_fit[0]*k_fit[0]/(1.+k_fit[0]*k_fit[0])*eff_tag);
1985 s_Kpi_fit_notag->SetLineWidth(3);
1986 s_Kpi_fit_notag->SetLineColor(kMagenta);
1987 s_Kpi_fit_notag->SetLineStyle(kDashed);
1988 s_Kpi_fit_notag->DrawNormalized(
"histcsame",(1.-eff_tag));
1989 c->Print(((
string)OutputDir+
"s_Kpi_2.eps").c_str());
1991 s_pipi->SetLineColor(kBlack);
1992 s_pipi->DrawNormalized(
"e1",1);
1993 s_pipi_fit->SetLineColor(kBlue);
1994 s_pipi_fit->SetLineWidth(3);
1995 s_pipi_fit->DrawNormalized(
"histcsame",1);
1996 c->Print(((
string)OutputDir+
"s_pipi.eps").c_str());
1998 s_pipi->SetLineColor(kBlack);
1999 s_pipi->DrawNormalized(
"e1",1);
2000 s_pipi_fit->SetLineColor(kBlack);
2001 s_pipi_fit->SetLineWidth(3);
2002 s_pipi_fit->DrawNormalized(
"histcsame",1);
2003 s_pipi_fitBs->SetLineColor(kRed);
2004 s_pipi_fitBs->SetLineWidth(3);
2005 s_pipi_fitBs->SetLineStyle(kDashed);
2006 s_pipi_fitBs->DrawNormalized(
"histcsame",1./(1.+k_fit[0]*k_fit[0])*eff_tag);
2007 s_pipi_fitBsbar->SetLineWidth(3);
2008 s_pipi_fitBsbar->SetLineColor(kBlue);
2009 s_pipi_fitBsbar->SetLineStyle(kDashed);
2010 s_pipi_fitBsbar->DrawNormalized(
"histcsame",k_fit[0]*k_fit[0]/(1.+k_fit[0]*k_fit[0])*eff_tag);
2011 s_pipi_fit_notag->SetLineWidth(3);
2012 s_pipi_fit_notag->SetLineColor(kMagenta);
2013 s_pipi_fit_notag->SetLineStyle(kDashed);
2014 s_pipi_fit_notag->DrawNormalized(
"histcsame",(1.-eff_tag));
2015 c->Print(((
string)OutputDir+
"s_pipi_2.eps").c_str());
2017 s_Dspipi->SetLineColor(kBlack);
2018 s_Dspipi->DrawNormalized(
"e1",1);
2019 s_Dspipi_fit->SetLineColor(kBlue);
2020 s_Dspipi_fit->SetLineWidth(3);
2021 s_Dspipi_fit->DrawNormalized(
"histcsame",1);
2022 c->Print(((
string)OutputDir+
"s_Dspipi.eps").c_str());
2024 s_Dspipi->SetLineColor(kBlack);
2025 s_Dspipi->DrawNormalized(
"e1",1);
2026 s_Dspipi_fit->SetLineColor(kBlack);
2027 s_Dspipi_fit->SetLineWidth(3);
2028 s_Dspipi_fit->DrawNormalized(
"histcsame",1);
2029 s_Dspipi_fitBs->SetLineColor(kRed);
2030 s_Dspipi_fitBs->SetLineWidth(3);
2031 s_Dspipi_fitBs->SetLineStyle(kDashed);
2032 s_Dspipi_fitBs->DrawNormalized(
"histcsame",1./(1.+k_fit[0]*k_fit[0])*eff_tag);
2033 s_Dspipi_fitBsbar->SetLineWidth(3);
2034 s_Dspipi_fitBsbar->SetLineColor(kBlue);
2035 s_Dspipi_fitBsbar->SetLineStyle(kDashed);
2036 s_Dspipi_fitBsbar->DrawNormalized(
"histcsame",k_fit[0]*k_fit[0]/(1.+k_fit[0]*k_fit[0])*eff_tag);
2037 s_Dspipi_fit_notag->SetLineWidth(3);
2038 s_Dspipi_fit_notag->SetLineColor(kMagenta);
2039 s_Dspipi_fit_notag->SetLineStyle(kDashed);
2040 s_Dspipi_fit_notag->DrawNormalized(
"histcsame",(1.-eff_tag));
2041 c->Print(((
string)OutputDir+
"s_Dspipi_2.eps").c_str());
2044 s_DsK->SetLineColor(kBlack);
2045 s_DsK->DrawNormalized(
"e1",1);
2046 s_DsK_fit->SetLineColor(kBlue);
2047 s_DsK_fit->SetLineWidth(3);
2048 s_DsK_fit->DrawNormalized(
"histcsame",1);
2049 c->Print(((
string)OutputDir+
"s_DsK.eps").c_str());
2051 s_DsK->SetLineColor(kBlack);
2052 s_DsK->DrawNormalized(
"e1",1);
2053 s_DsK_fit->SetLineColor(kBlack);
2054 s_DsK_fit->SetLineWidth(3);
2055 s_DsK_fit->DrawNormalized(
"histcsame",1);
2056 s_DsK_fitBs->SetLineColor(kRed);
2057 s_DsK_fitBs->SetLineWidth(3);
2058 s_DsK_fitBs->SetLineStyle(kDashed);
2059 s_DsK_fitBs->DrawNormalized(
"histcsame",1./(1.+k_fit[0]*k_fit[0])*eff_tag);
2060 s_DsK_fitBsbar->SetLineWidth(3);
2061 s_DsK_fitBsbar->SetLineColor(kBlue);
2062 s_DsK_fitBsbar->SetLineStyle(kDashed);
2063 s_DsK_fitBsbar->DrawNormalized(
"histcsame",k_fit[0]*k_fit[0]/(1.+k_fit[0]*k_fit[0])*eff_tag);
2064 s_DsK_fit_notag->SetLineWidth(3);
2065 s_DsK_fit_notag->SetLineColor(kMagenta);
2066 s_DsK_fit_notag->SetLineStyle(kDashed);
2067 s_DsK_fit_notag->DrawNormalized(
"histcsame",(1.-eff_tag));
2068 c->Print(((
string)OutputDir+
"s_DsK_2.eps").c_str());
2070 s_DsKpi->SetLineColor(kBlack);
2071 s_DsKpi->DrawNormalized(
"e1",1);
2072 s_DsKpi_fit->SetLineColor(kBlue);
2073 s_DsKpi_fit->SetLineWidth(3);
2074 s_DsKpi_fit->DrawNormalized(
"histcsame",1);
2075 c->Print(((
string)OutputDir+
"s_DsKpi.eps").c_str());
2077 s_Dspi->SetLineColor(kBlack);
2078 s_Dspi->DrawNormalized(
"e1",1);
2079 s_Dspi_fit->SetLineColor(kBlue);
2080 s_Dspi_fit->SetLineWidth(3);
2081 s_Dspi_fit->DrawNormalized(
"histcsame",1);
2082 c->Print(((
string)OutputDir+
"s_Dspi.eps").c_str());
2084 s_Dspim->SetLineColor(kBlack);
2085 s_Dspim->DrawNormalized(
"e1",1);
2086 s_Dspim_fit->SetLineColor(kBlue);
2087 s_Dspim_fit->SetLineWidth(3);
2088 s_Dspim_fit->DrawNormalized(
"histcsame",1);
2089 c->Print(((
string)OutputDir+
"s_Dspim.eps").c_str());
2094 cout <<
"Now doing 2D scan:" << endl;
2096 double scanMin=0, scanMax=360;
2097 double nSigmaZoom = 2;
2098 double scanMinGammaZoom=min(gamma.
meanInit(), gamma.
mean()) - nSigmaZoom*gamma.
err();
2099 double scanMaxGammaZoom=max(gamma.
meanInit(), gamma.
mean()) + nSigmaZoom*gamma.
err();
2100 double scanMinDeltaZoom=min(delta.meanInit(), delta.mean()) - nSigmaZoom*delta.err();
2101 double scanMaxDeltaZoom=max(delta.meanInit(), delta.mean()) + nSigmaZoom*delta.err();
2102 double gammaZoomRange = scanMaxGammaZoom - scanMinGammaZoom;
2103 double deltaZoomRange = scanMaxDeltaZoom - scanMinDeltaZoom;
2105 TFile* scanFile =
new TFile(
"scan.root",
"RECREATE");
2106 TH2D* scanHisto =
new TH2D(
"scan",
"; #gamma [deg]; #delta [deg]", scanBins, scanMin, scanMax, scanBins, scanMin, scanMax);
2107 TH2D* scanHistoP =
new TH2D(
"scanP",
"; #gamma [deg]; #delta [deg]", scanBins, scanMin, scanMax, scanBins, scanMin, scanMax);
2108 TH2D* scanHistoM =
new TH2D(
"scanM" ,
"; #gamma [deg]; #delta [deg]", scanBins, scanMin, scanMax, scanBins, scanMin, scanMax);
2109 TH2D* scanZoomHisto =
new TH2D(
"scanZoom",
"; #gamma [deg]; #delta [deg]", scanBins, scanMinGammaZoom, scanMaxGammaZoom, scanBins, scanMinDeltaZoom, scanMaxDeltaZoom);
2111 double scanMinLL=-9999;
2112 double scanMinLLP=-9999;
2113 double scanMinLLM=-9999;
2114 double scanMinLLZ=-9999;
2116 for(
int i=0; i < scanBins; i++){
2117 double gamma_value = ((double)i+0.5)*360/((double)scanBins);
2119 for(
int j=0; j < scanBins; j++){
2120 double delta_value = ((double)j+0.5)*360/((double)scanBins);
2121 delta.setCurrentFitVal(delta_value);
2124 if( (i==0 && j==0) || v < scanMinLL) scanMinLL=v;
2125 scanHisto->Fill(gamma_value, delta_value, v);
2128 if( (i==0 && j==0) || vP < scanMinLLP) scanMinLLP=vP;
2129 scanHistoP->Fill(gamma_value, delta_value, vP);
2132 if( (i==0 && j==0) || vM < scanMinLLM) scanMinLLM=vM;
2133 scanHistoM->Fill(gamma_value, delta_value, vM);
2136 for(
int i=0; i < scanBins; i++){
2137 double gamma_value = scanMinGammaZoom + ((double)i+0.5) * gammaZoomRange/((double)scanBins);
2139 for(
int j=0; j < scanBins; j++){
2140 double delta_value = scanMinDeltaZoom + ((double)j+0.5) * deltaZoomRange/((double)scanBins);
2141 delta.setCurrentFitVal(delta_value);
2144 if( (i==0 && j==0) || v < scanMinLLZ) scanMinLLZ=v;
2146 scanZoomHisto->Fill(gamma_value, delta_value, v);
2150 for(
int i=0; i < scanBins; i++){
2151 double gamma_value = ((double)i+0.5)*360/((double)scanBins);
2152 for(
int j=0; j < scanBins; j++){
2153 double delta_value = ((double)j+0.5)*360/((double)scanBins);
2154 scanHisto->Fill(gamma_value, delta_value, -scanMinLL);
2155 scanHistoP->Fill(gamma_value, delta_value, -scanMinLLP);
2156 scanHistoM->Fill(gamma_value, delta_value, -scanMinLLM);
2159 for(
int i=0; i < scanBins; i++){
2160 double gamma_value = scanMinGammaZoom + ((double)i+0.5) * gammaZoomRange/((double)scanBins);
2161 for(
int j=0; j < scanBins; j++){
2162 double delta_value = scanMinDeltaZoom + ((double)j+0.5) * deltaZoomRange/((double)scanBins);
2163 scanZoomHisto->Fill(gamma_value, delta_value, -scanMinLLZ);
2168 scanHistoP->Write();
2169 scanHistoM->Write();
2170 scanZoomHisto->Write();
2173 cout<<
"done 2-D scan" << endl;
2184 int seed = RandomSeed + step;
2185 ranLux.SetSeed((
int)seed);
2190 NamedParameter<string> IntegratorEventFile(
"IntegratorEventFile", (std::string)
"SignalIntegrationEvents.root", (
char*) 0);
2193 cout <<
" got event pattern: " << pat << endl;
2196 TFile* paraFile =
new TFile(((
string)OutputDir+
"coherence_"+
anythingToString((
int)seed)+
".root").c_str(),
"RECREATE");
2198 TTree* tree =
new TTree(
"coherence",
"coherence");
2199 double r_val,k,delta_val;
2201 TBranch* br_r = tree->Branch(
"r", &r_val,
"r_val/D" );
2202 TBranch* br_k = tree->Branch(
"k", &k,
"k/D" );
2203 TBranch* br_delta = tree->Branch(
"delta", &delta_val,
"delta_val/D" );
2205 double r_Ks_val,k_Ks,delta_Ks_val;
2206 double r_rho_val,k_rho,delta_rho_val;
2207 double r_Ks_rho_val,k_Ks_rho,delta_Ks_rho_val;
2208 double r_K1_val,k_K1,delta_K1_val;
2210 TBranch* br_r_Ks = tree->Branch(
"r_Ks", &r_Ks_val,
"r_Ks_val/D" );
2211 TBranch* br_k_Ks = tree->Branch(
"k_Ks", &k_Ks,
"k_Ks/D" );
2212 TBranch* br_delta_Ks = tree->Branch(
"delta_Ks", &delta_Ks_val,
"delta_Ks_val/D" );
2213 TBranch* br_r_Ks_rho = tree->Branch(
"r_Ks_rho", &r_Ks_rho_val,
"r_Ks_rho_val/D" );
2214 TBranch* br_k_Ks_rho = tree->Branch(
"k_Ks_rho", &k_Ks_rho,
"k_Ks_rho/D" );
2215 TBranch* br_delta_Ks_rho = tree->Branch(
"delta_Ks_rho", &delta_Ks_rho_val,
"delta_Ks_rho_val/D" );
2216 TBranch* br_r_rho = tree->Branch(
"r_rho", &r_rho_val,
"r_rho_val/D" );
2217 TBranch* br_k_rho = tree->Branch(
"k_rho", &k_rho,
"k_rho/D" );
2218 TBranch* br_delta_rho = tree->Branch(
"delta_rho", &delta_rho_val,
"delta_rho_val/D" );
2219 TBranch* br_r_K1 = tree->Branch(
"r_K1", &r_K1_val,
"r_K1_val/D" );
2220 TBranch* br_k_K1 = tree->Branch(
"k_K1", &k_K1,
"k_K1/D" );
2221 TBranch* br_delta_K1 = tree->Branch(
"delta_K1", &delta_K1_val,
"delta_K1_val/D" );
2223 double r_Ks_val_2,k_Ks_2,delta_Ks_val_2;
2224 double r_rho_val_2,k_rho_2,delta_rho_val_2;
2225 double r_Ks_rho_val_2,k_Ks_rho_2,delta_Ks_rho_val_2;
2226 double r_K1_val_2,k_K1_2,delta_K1_val_2;
2228 TBranch* br_r_Ks_2 = tree->Branch(
"r_Ks_2", &r_Ks_val_2,
"r_Ks_val_2/D" );
2229 TBranch* br_k_Ks_2 = tree->Branch(
"k_Ks_2", &k_Ks_2,
"k_Ks_2/D" );
2230 TBranch* br_delta_Ks_2 = tree->Branch(
"delta_Ks_2", &delta_Ks_val_2,
"delta_Ks_val_2/D" );
2231 TBranch* br_r_Ks_rho_2 = tree->Branch(
"r_Ks_rho_2", &r_Ks_rho_val_2,
"r_Ks_rho_val_2/D" );
2232 TBranch* br_k_Ks_rho_2 = tree->Branch(
"k_Ks_rho_2", &k_Ks_rho_2,
"k_Ks_rho_2/D" );
2233 TBranch* br_delta_Ks_rho_2 = tree->Branch(
"delta_Ks_rho_2", &delta_Ks_rho_val_2,
"delta_Ks_rho_val_2/D" );
2234 TBranch* br_r_rho_2 = tree->Branch(
"r_rho_2", &r_rho_val_2,
"r_rho_val_2/D" );
2235 TBranch* br_k_rho_2 = tree->Branch(
"k_rho_2", &k_rho_2,
"k_rho_2/D" );
2236 TBranch* br_delta_rho_2 = tree->Branch(
"delta_rho_2", &delta_rho_val_2,
"delta_rho_val_2/D" );
2237 TBranch* br_r_K1_2 = tree->Branch(
"r_K1_2", &r_K1_val_2,
"r_K1_val_2/D" );
2238 TBranch* br_k_K1_2 = tree->Branch(
"k_K1_2", &k_K1_2,
"k_K1_2/D" );
2239 TBranch* br_delta_K1_2 = tree->Branch(
"delta_K1_2", &delta_K1_val_2,
"delta_K1_val_2/D" );
2241 TBranch* br_x = tree->Branch(
"x", &x,
"x/D" );
2242 TBranch* br_y = tree->Branch(
"y", &y,
"y/D" );
2257 TFile *FileMC = TFile::Open(((
string) IntegratorEventFile).c_str());
2258 TTree* treeMC = dynamic_cast<TTree*>(FileMC->Get(
"DalitzEventList"));
2267 DalitzEventList eventList_Ks,eventList_rho,eventList_Ks_rho,eventList_K1;
2268 DalitzEventList eventList_Ks_2,eventList_rho_2,eventList_Ks_rho_2,eventList_K1_2;
2270 for(
unsigned int i=0; i<eventList.
size(); i++){
2271 if(abs(sqrt(eventList[i].
s(2,4)/(
GeV*
GeV))-0.89166)<0.0474) eventList_Ks.
Add(eventList[i]);
2272 if(abs(sqrt(eventList[i].sij(s234)/(
GeV*
GeV))-1.272)<0.09) eventList_K1.
Add(eventList[i]);
2273 if(abs(sqrt(eventList[i].
s(3,4)/(
GeV*
GeV))-0.7755)<0.1494) eventList_rho.
Add(eventList[i]);
2274 if(abs(sqrt(eventList[i].
s(2,4)/(
GeV*
GeV))-0.89166)<0.0474 || abs(sqrt(eventList[i].
s(3,4)/(
GeV*
GeV))-0.7755)<0.1494) eventList_Ks_rho.
Add(eventList[i]);
2276 if(abs(sqrt(eventList[i].
s(2,4)/(
GeV*
GeV))-0.89166)<0.0474/2.) eventList_Ks_2.
Add(eventList[i]);
2277 if(abs(sqrt(eventList[i].sij(s234)/(
GeV*
GeV))-1.272)<0.09/2.) eventList_K1_2.
Add(eventList[i]);
2278 if(abs(sqrt(eventList[i].
s(3,4)/(
GeV*
GeV))-0.7755)<0.1494/2.) eventList_rho_2.
Add(eventList[i]);
2279 if(abs(sqrt(eventList[i].
s(2,4)/(
GeV*
GeV))-0.89166)<0.0474/2. || abs(sqrt(eventList[i].
s(3,4)/(
GeV*
GeV))-0.7755)<0.1494/2.) eventList_Ks_rho_2.
Add(eventList[i]);
2283 fas_tmp.
getVal(eventListPhsp[0]);
2291 x = ranLux.Uniform(-1,1);
2292 y = ranLux.Uniform(-180,180);
2302 x = ranLux.Uniform(-1,1);
2303 y = ranLux.Uniform(-180,180);
2310 x = ranLux.Uniform(-1,1);
2311 y = ranLux.Uniform(-180,180);
2316 AddScaledAmpsToList(fas_tmp, fas, fasCC,
"NonResV0(->Ds-,pi+),K*(892)0(->K+,pi-)", r_3_plus, r_3_minus );
2317 AddScaledAmpsToList(fas_tmp, fas, fasCC,
"NonResS0(->Ds-,pi+),K*(892)0(->K+,pi-)", r_3_plus, r_3_minus );
2318 AddScaledAmpsToList(fas_tmp, fas, fasCC,
"NonResV0(->Ds-,K+),sigma10(->pi+,pi-)", r_3_plus, r_3_minus );
2320 x = ranLux.Uniform(-1,1);
2321 y = ranLux.Uniform(-180,180);
2326 AddScaledAmpsToList(fas_tmp, fas, fasCC,
"NonResA0(->sigma10(->pi+,pi-),Ds-)", r_4_plus, r_4_minus );
2327 AddScaledAmpsToList(fas_tmp, fas, fasCC,
"NonResA0(->rho(770)0(->pi+,pi-),Ds-),K+", r_4_plus, r_4_minus );
2330 fas.
getVal(eventListPhsp[0]);
2331 fasCC.
getVal(eventListPhsp[0]);
2333 cout <<
" Have " << eventList.
size() <<
" integration events " << endl;
2334 cout <<
" Have " << eventList_Ks.
size() <<
" Ks integration events " << endl;
2335 cout <<
" Have " << eventList_rho.
size() <<
" rho integration events " << endl;
2336 cout <<
" Have " << eventList_Ks_rho.
size() <<
" Ks/rho integration events " << endl;
2337 cout <<
" Have " << eventList_K1.
size() <<
" K1 integration events " << endl;
2339 cout <<
" Have " << eventList_Ks_2.
size() <<
" Ks_2 integration events " << endl;
2340 cout <<
" Have " << eventList_rho_2.
size() <<
" rho_2 integration events " << endl;
2341 cout <<
" Have " << eventList_Ks_rho_2.
size() <<
" Ks/rho_2 integration events " << endl;
2342 cout <<
" Have " << eventList_K1_2.
size() <<
" K1_2 integration events " << endl;
2345 vector<double> kappa =
coherenceFactor(fas,fasCC,(
double)r, (
double)delta,eventList);
2347 vector<double> kappa_Ks =
coherenceFactor(fas,fasCC,(
double)r, (
double)delta,eventList_Ks);
2348 vector<double> kappa_rho =
coherenceFactor(fas,fasCC,(
double)r, (
double)delta,eventList_rho);
2349 vector<double> kappa_Ks_rho =
coherenceFactor(fas,fasCC,(
double)r, (
double)delta,eventList_Ks_rho);
2350 vector<double> kappa_K1 =
coherenceFactor(fas,fasCC,(
double)r, (
double)delta,eventList_K1);
2352 vector<double> kappa_Ks_2 =
coherenceFactor(fas,fasCC,(
double)r, (
double)delta,eventList_Ks_2);
2353 vector<double> kappa_rho_2 =
coherenceFactor(fas,fasCC,(
double)r, (
double)delta,eventList_rho_2);
2354 vector<double> kappa_Ks_rho_2 =
coherenceFactor(fas,fasCC,(
double)r, (
double)delta,eventList_Ks_rho_2);
2355 vector<double> kappa_K1_2 =
coherenceFactor(fas,fasCC,(
double)r, (
double)delta,eventList_K1_2);
2359 delta_val = kappa[2];
2361 r_Ks_val = kappa_Ks[0];
2363 delta_Ks_val = kappa_Ks[2];
2365 r_Ks_rho_val = kappa_Ks_rho[0];
2366 k_Ks_rho = kappa_Ks_rho[1];
2367 delta_Ks_rho_val = kappa_Ks_rho[2];
2369 r_rho_val = kappa_rho[0];
2370 k_rho = kappa_rho[1];
2371 delta_rho_val = kappa_rho[2];
2373 r_K1_val = kappa_K1[0];
2375 delta_K1_val = kappa_K1[2];
2377 r_Ks_val_2 = kappa_Ks_2[0];
2378 k_Ks_2 = kappa_Ks_2[1];
2379 delta_Ks_val_2 = kappa_Ks_2[2];
2381 r_Ks_rho_val_2 = kappa_Ks_rho_2[0];
2382 k_Ks_rho_2 = kappa_Ks_rho_2[1];
2383 delta_Ks_rho_val_2 = kappa_Ks_rho_2[2];
2385 r_rho_val_2 = kappa_rho_2[0];
2386 k_rho_2 = kappa_rho_2[1];
2387 delta_rho_val_2 = kappa_rho_2[2];
2389 r_K1_val_2 = kappa_K1_2[0];
2390 k_K1_2 = kappa_K1_2[1];
2391 delta_K1_val_2 = kappa_K1_2[2];
2395 tree->SetDirectory(paraFile);
2407 TFile *File = TFile::Open(((
string)OutputDir+
"coherence.root").c_str());
2409 tree=dynamic_cast<TTree*>(File->Get(
"coherence"));
2410 Double_t k,k_Ks,k_rho,k_K1;
2411 tree->SetBranchAddress(
"k",&k) ;
2412 tree->SetBranchAddress(
"k_Ks",&k_Ks) ;
2413 tree->SetBranchAddress(
"k_rho",&k_rho) ;
2414 tree->SetBranchAddress(
"k_K1",&k_K1) ;
2416 TH1D* h_k =
new TH1D(
"",
";#kappa; Number of experiments ",50,0,1);
2418 TH1D* h_k_Ks =
new TH1D(
"",
"K^{*0}(892) region ;#kappa; Number of experiments ",50,0,1);
2419 TH1D* h_k_rho =
new TH1D(
"",
"#rho^{0}(770) region ;#kappa; Number of experiments ",50,0,1);
2420 TH1D* h_k_K1 =
new TH1D(
"",
"K_{1}(1270) region ;#kappa; Number of experiments ",50,0,1);
2422 for(
int i = 0; i<tree->GetEntries(); i++){
2426 h_k_rho->Fill(k_rho);
2430 TCanvas *c =
new TCanvas();
2431 h_k->SetLineColor(kBlue);
2433 c->Print(((
string)OutputDir+
"k.eps").c_str());
2435 h_k_Ks->SetLineColor(kBlue);
2436 h_k_Ks->Draw(
"hist");
2437 c->Print(((
string)OutputDir+
"k_Ks.eps").c_str());
2439 h_k_rho->SetLineColor(kBlue);
2440 h_k_rho->Draw(
"hist");
2441 c->Print(((
string)OutputDir+
"k_rho.eps").c_str());
2443 h_k_K1->SetLineColor(kBlue);
2444 h_k_K1->Draw(
"hist");
2445 c->Print(((
string)OutputDir+
"k_K1.eps").c_str());
2448 TFile *_InputFile = TFile::Open(
"/auto/data/dargent/Bs2DsKpipi/MINT2/MINT_data_3sigma.root");
2450 in_tree=dynamic_cast<TTree*>(_InputFile->Get(
"DalitzEventList"));
2452 _InputFile->Close();
2454 cout <<
" I've got " << eventList.
size() <<
" events." << endl;
2456 DalitzEventList eventList_Ks,eventList_rho,eventList_Ks_rho,eventList_K1;
2457 DalitzEventList eventList_Ks_2,eventList_rho_2,eventList_Ks_rho_2,eventList_K1_2;
2463 for(
unsigned int i=0; i<eventList.
size(); i++){
2464 if(abs(sqrt(eventList[i].
s(2,4)/(
GeV*
GeV))-0.89166)<0.0474) eventList_Ks.
Add(eventList[i]);
2465 if(abs(sqrt(eventList[i].sij(s234)/(
GeV*
GeV))-1.272)<0.09) eventList_K1.
Add(eventList[i]);
2466 if(abs(sqrt(eventList[i].
s(3,4)/(
GeV*
GeV))-0.7755)<0.1494) eventList_rho.
Add(eventList[i]);
2467 if(abs(sqrt(eventList[i].
s(2,4)/(
GeV*
GeV))-0.89166)<0.0474 || abs(sqrt(eventList[i].
s(3,4)/(
GeV*
GeV))-0.7755)<0.1494) eventList_Ks_rho.
Add(eventList[i]);
2469 if(abs(sqrt(eventList[i].
s(2,4)/(
GeV*
GeV))-0.89166)<0.0474/2.) eventList_Ks_2.
Add(eventList[i]);
2470 if(abs(sqrt(eventList[i].sij(s234)/(
GeV*
GeV))-1.272)<0.09/2.) eventList_K1_2.
Add(eventList[i]);
2471 if(abs(sqrt(eventList[i].
s(3,4)/(
GeV*
GeV))-0.7755)<0.1494/2.) eventList_rho_2.
Add(eventList[i]);
2472 if(abs(sqrt(eventList[i].
s(2,4)/(
GeV*
GeV))-0.89166)<0.0474/2. || abs(sqrt(eventList[i].
s(3,4)/(
GeV*
GeV))-0.7755)<0.1494/2.) eventList_Ks_rho_2.
Add(eventList[i]);
2475 cout <<
" Have " << eventList_Ks.
size()/(double)eventList.
size() <<
" Ks integration events " << endl;
2476 cout <<
" Have " << eventList_rho.
size()/(double)eventList.
size() <<
" rho integration events " << endl;
2477 cout <<
" Have " << eventList_Ks_rho.
size()/(double)eventList.
size() <<
" Ks/rho integration events " << endl;
2478 cout <<
" Have " << eventList_K1.
size()/(double)eventList.
size() <<
" K1 integration events " << endl;
2480 cout <<
" Have " << eventList_Ks_2.
size()/(double)eventList.
size() <<
" Ks_2 integration events " << endl;
2481 cout <<
" Have " << eventList_rho_2.
size()/(double)eventList.
size() <<
" rho_2 integration events " << endl;
2482 cout <<
" Have " << eventList_Ks_rho_2.
size()/(double)eventList.
size() <<
" Ks/rho_2 integration events " << endl;
2483 cout <<
" Have " << eventList_K1_2.
size()/(double)eventList.
size() <<
" K1_2 integration events " << endl;
2492 NamedParameter<string> IntegratorEventFile(
"IntegratorEventFile", (std::string)
"SignalIntegrationEvents.root", (
char*) 0);
2495 cout <<
" got event pattern: " << pat << endl;
2505 fas.
getVal(eventListPhsp[0]);
2516 for(
int i = 0; i < eventList.
size(); i++){
2517 if(sqrt(eventList[i].sij(s234)/(
GeV*
GeV)) < 1.95 && sqrt(eventList[i].
s(2,4)/(
GeV*
GeV)) < 1.2 && sqrt(eventList[i].
s(3,4)/(
GeV*
GeV)) < 1.2)eventList_cut.
Add(eventList[i]);
2520 cout <<
"Generated " << eventList_cut.
size() <<
" events inside selected phasespace region" << endl;
2529 time_t startTime = time(0);
2531 TH1::SetDefaultSumw2();
2532 TH2::SetDefaultSumw2();
2533 gROOT->ProcessLine(
".x ../lhcbStyle.C");
2536 NamedParameter<string> IntegratorEventFile(
"IntegratorEventFile", (std::string)
"SignalIntegrationEvents.root", (
char*) 0);
2538 if(!EvtGenTest)
if(! std::ifstream(((
string)IntegratorEventFile).c_str()).good())
makeIntegratorFile();
2542 cout <<
"==============================================" << endl;
2543 cout <<
" Done. " <<
" Total time since start " << (time(0) - startTime)/60.0 <<
" min." << endl;
2544 cout <<
"==============================================" << endl;
virtual Double_t evaluate(Int_t basisCodeInt, Double_t tau, Double_t omega, Double_t dGamma) const
virtual double getVal_withPs(IDalitzEvent &evt)
double un_normalised(IDalitzEvent &evt)
virtual bool Add(const EVENT_TYPE &evt)
RooAbsPdf * _pdf_omega_os
virtual MINT::counted_ptr< FitAmpListBase > GetCloneOfSubsetSameFitParameters(std::string name) const
void AddScaledAmpsToList(FitAmpSum &fas_tmp, FitAmpSum &fas, FitAmpSum &fasCC, std::string name, counted_ptr< IReturnComplex > &r_plus, counted_ptr< IReturnComplex > &r_minus)
virtual double getVal_noPs(IDalitzEvent *evt)
virtual double getVal_withPs(IDalitzEvent &evt)
IFastAmplitudeIntegrable * getAmpSum()
DecRateCoeff_Bd * _cosh_coeff
virtual double getVal_noPs(IDalitzEvent &evt)
static void AutogenerateFitFile(const std::string &fname="protoFitAmplitudeFile.txt", const DalitzEventPattern &pat=DalitzEventPattern::NoPattern)
AmpsPdfFlexiFast * _ampsSum
complex< double > _intAAbar
virtual double getNewVal()
virtual double getVal_withPs(IDalitzEvent *evt)
AmpsPdfFlexiFastCPV_time_integrated(AmpsPdfFlexiFast *amps1, AmpsPdfFlexiFast *amps2, AmpsPdfFlexiFast *ampsSum, MINT::FitParameter &r, MINT::FitParameter &delta, MINT::FitParameter &gamma, MINT::FitParameter &tau, MINT::FitParameter &dGamma, MINT::FitParameter &dm, MINT::FitParameter &eff_tag, MINT::FitParameter &w)
void getSmearedTime(double &t, double &dt, TRandom3 &r)
void push_back(const T &c)
double un_normalised_noPs(IDalitzEvent &evt)
virtual double getVal_noPs(IDalitzEvent &evt)
complex< double > ComplexVal()
virtual bool CPConjugateSameFitParameters()
virtual MINT::counted_ptr< IDalitzEvent > newEvent()
void doFinalStatsAndSaveForAmp12(MINT::Minimiser *min=0, const std::string &fname="FitAmpResults", const std::string &fnameROOT="fitFractions")
double un_normalised_noPs(IDalitzEvent &evt)
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
virtual MINT::counted_ptr< FitAmpListBase > GetCloneSameFitParameters() const
complex< double > _intAAbar
virtual double getVal(IDalitzEvent &evt)
virtual double getVal(IDalitzEvent *evt)
NamedParameter< double > _min_TAU
TimePdf_mod(MINT::FitParameter &r, MINT::FitParameter &delta, MINT::FitParameter &gamma, MINT::FitParameter &k, MINT::FitParameter &tau, MINT::FitParameter &dGamma, MINT::FitParameter &dm, MINT::FitParameter &eff_tag, MINT::FitParameter &w)
virtual double getVal(IDalitzEvent *evt)
virtual double getVal_withPs(IDalitzEvent *evt)
Double_t evaluate() const
AmpsPdfFlexiFast * _amps1
NamedParameter< double > _max_TAU
virtual void setValueInVector(unsigned int i, double value)
virtual double getVal_noPs(IDalitzEvent &evt)
AmpsPdfFlexiFast * _ampsSum
CPV_amp_polar(FitParameter &r, FitParameter &delta, int sign)
std::vector< double > coherenceFactor(FitAmpSum &fas, FitAmpSum &fas_bar, double r, double delta, DalitzEventList &eventList)
RooAbsPdf * _pdf_omega_os
RooCubicSplineFun * _spline
double un_normalised_noPs(IDalitzEvent &evt)
RooAbsPdf * _pdf_omega_ss
virtual std::complex< double > getVal(IDalitzEvent &evt)
double getIntegralValue() const
CPV_amp(FitParameter &re, FitParameter &im, int sign)
DecRateCoeff_Bd * _sin_coeff
AmpsPdfFlexiFast * _amps1
DecRateCoeff_Bd * _cos_coeff
int main(int argc, char **argv)
virtual double getVal_noPs(IDalitzEvent *evt)
AmpRatio(FitParameter &re, FitParameter &im, int f)
void printResultVsInput(std::ostream &os=std::cout) const
virtual int addAsList(const FitAmpListBase &other, double factor=1)
AmpsPdfFlexiFast * _ampsSum
double un_normalised(IDalitzEvent &evt)
RooRealVar * _r_scale_sigma_dt
AmpsPdfFlexiFastCPV(AmpsPdfFlexiFast *amps1, AmpsPdfFlexiFast *amps2, AmpsPdfFlexiFast *ampsSum, MINT::FitParameter &r, MINT::FitParameter &delta, MINT::FitParameter &gamma, MINT::FitParameter &tau, MINT::FitParameter &dGamma, MINT::FitParameter &dm, MINT::FitParameter &eff_tag, MINT::FitParameter &w)
virtual double getVal_withPs(IDalitzEvent &evt)
virtual double getVal(IDalitzEvent *evt)
virtual double getVal(IDalitzEvent &evt)
virtual double getVal_withPs(IDalitzEvent *evt)
NamedParameter< std::string > _integratorSource
complex< double > ComplexVal()
void doFinalStatsAndSaveForAmp12(MINT::Minimiser *min=0, const std::string &fname="FitAmpResults", const std::string &fnameROOT="fitFractions")
virtual double getVal_noPs(IDalitzEvent *evt)
complex< double > _intAAbar
bool A_is_in_B(const std::string &a, const std::string &b)
virtual Double_t analyticalIntegral(Int_t code, const char *rangeName) const
bool fromNtuple(TTree *ntp)
std::complex< double > ComplexSumForMatchingPatterns(bool match)
virtual double getVal_noPs(IDalitzEvent *evt)
double getVal(IDalitzEvent &evt)
void makeIntegratorFile()
void setWeighted(bool w=true)
virtual void setCurrentFitVal(double fv)
AmpsPdfFlexiFast(const DalitzEventPattern &pat, IFastAmplitudeIntegrable *amps, MinuitParameterSet *mps, double precision=1.e-4, std::string method="efficient", std::string fname="SignalIntegrationEvents.root", bool genMoreEvents=false)
DecRateCoeff_Bd * _sin_coeff
virtual double getVal(IDalitzEvent *evt)
virtual double getVal_withPs(IDalitzEvent &evt)
virtual double getVal(IDalitzEvent &evt)
virtual double getVal_withPs(IDalitzEvent &evt)
virtual double getVal_withPs(IDalitzEvent *evt)
virtual double getGeneratorPdfRelativeToPhaseSpace() const
void normalizeAmps(DalitzEventList &evtList)
double getValForGeneration(IDalitzEvent &evt)
const std::vector< T > & getVector() const
RooGaussEfficiencyModel * _efficiency
complex< double > _intAAbar
AmpsPdfFlexiFast * _amps2
virtual double getValueFromVector(unsigned int i) const =0
virtual double getVal_noPs(IDalitzEvent &evt)
IEventGenerator< IDalitzEvent > * _chosenGen
double integralForMatchingPatterns(bool match, int pattern_sign)
virtual double getVal_noPs(IDalitzEvent &evt)
NamedParameter< double > _max_TAU
virtual unsigned int size() const
std::string anythingToString(const T &anything)
virtual DalitzHistoSet histoSet() const
DecRateCoeff_Bd * _sinh_coeff
RooRealVar * _r_scale_mean_dt
RooRealVar * _r_scale_mean_dt
virtual double getVal(IDalitzEvent &evt)
AmpsPdfFlexiFastCPV_mod(AmpsPdfFlexiFast *amps1, AmpsPdfFlexiFast *amps2, AmpsPdfFlexiFast *ampsSum, MINT::FitParameter &r, MINT::FitParameter &delta, MINT::FitParameter &gamma, MINT::FitParameter &tau, MINT::FitParameter &dGamma, MINT::FitParameter &dm, MINT::FitParameter &eff_tag, MINT::FitParameter &w)
TimePdf(MINT::FitParameter &C, MINT::FitParameter &D, MINT::FitParameter &D_bar, MINT::FitParameter &S, MINT::FitParameter &S_bar, MINT::FitParameter &k, MINT::FitParameter &tau, MINT::FitParameter &dGamma, MINT::FitParameter &dm, MINT::FitParameter &eff_tag, MINT::FitParameter &w)
RooGaussEfficiencyModel * _efficiency
virtual void print(std::ostream &os=std::cout) const
virtual double getVal(IDalitzEvent *evt)
double un_normalised_noPs(IDalitzEvent &evt)
cosh/sinh/cos/sin coefficients in decay rate equations
virtual DalitzHistoSet histoSet()
RooRealVar * _r_scale_sigma_dt
virtual double getVal_withPs(IDalitzEvent *evt)
virtual double getVal_noPs(IDalitzEvent &evt)
DecRateCoeff_Bd * _cosh_coeff
virtual double getVal(IDalitzEvent *evt)
std::complex< double > ComplexVal_un_normalised_noPs(IDalitzEvent &evt)
void doFinalStatsAndSaveForAmp12(MINT::Minimiser *min=0, const std::string &fname="FitAmpResults", const std::string &fnameROOT="fitFractions")
RooCubicSplineFun * _spline
void calculateCoherence(int step=0)
bool saveAsNtuple(const std::string &fname="DalitzEvents.root") const
virtual bool CConjugateFinalStateSameFitParameters()
virtual double getVal_noPs(IDalitzEvent *evt)
int generatePhaseSpaceEvents(int NumEvents, const DalitzEventPattern &pat, TRandom *rnd=0)
virtual double getVal(IDalitzEvent &evt)
void doFinalStatsAndSave(MINT::Minimiser *min=0, const std::string &fname="FitAmpResults.txt", const std::string &fnameROOT="fitFractions.root")
AmpsPdfFlexiFast * _amps1
AmpsPdfFlexiFast * _amps2
AmpsPdfFlexiFast * _amps2
virtual double getVal_noPs(IDalitzEvent *evt)
virtual DalitzHistoSet histoSet()
virtual double RealVal(IDalitzEvent &evt)
double un_normalised_noPs(IDalitzEvent &evt)
virtual DalitzHistoSet histoSet()
DecRateCoeff_Bd * _sinh_coeff
virtual double getVal_withPs(IDalitzEvent *evt)
NamedParameter< double > _min_TAU
void FillEventList(DalitzEventList &evtList, int NEvents)
complex< double > ComplexVal()
virtual double getVal_withPs(IDalitzEvent &evt)
RooAbsPdf * _pdf_omega_ss
void doFinalStatsAndSaveForAmp12(MINT::Minimiser *min=0, const std::string &fname="FitAmpResults", const std::string &fnameROOT="fitFractions")
virtual void multiply(double r)
FullAmpsPdfFlexiFastCPV(AmpsPdfFlexiFast *amps1, AmpsPdfFlexiFast *amps2, AmpsPdfFlexiFast *ampsSum, MINT::FitParameter &r, MINT::FitParameter &delta, MINT::FitParameter &gamma, MINT::FitParameter &tau, MINT::FitParameter &dGamma, MINT::FitParameter &dm, MINT::FitParameter &eff_tag, MINT::FitParameter &w)
virtual double getVal(IDalitzEvent &evt)
virtual DalitzHistoSet histoSet()
DecRateCoeff_Bd * _cos_coeff