18 #include "Math/Integrator.h" 19 #include "Math/Functor.h" 20 #include "Math/GSLIntegrator.h" 31 for(
unsigned int i= 1; i<_pat.size(); i++){
32 min_m += _pat[i].mass()/
GeV;
34 _min_s_inGeV2 = min_m*min_m;
40 cout <<
"RunningWidthCalculator::RunningWidthCalculator: I got called." << endl;
53 cout <<
"ERROR in RunningWidthCalculator::makeHisto_dalitz: I can handle only 3 body decays but the pattern " <<
_pat 54 <<
" has " <<
_pat.
size()-1 <<
" final state particles. I'll return 0." << endl;
64 if(OutputFileName==
"")
67 TFile* f=
new TFile(OutputFileName.c_str(),
"RECREATE");
68 TH1D* h=
new TH1D(
"RunningWidth",
"RunningWidth",nBins,
_min_s_inGeV2,max_s_inGeV2);
73 for (
int b=1; b<= h->GetNbinsX(); b++) {
79 pp->
setMass(sqrt(h->GetXaxis()->GetBinCenter(b))*
GeV);
93 for (
unsigned int i= 0; i< eventList.
size(); i++) {
94 integral += amps->
RealVal(eventList[i])*eventList[i].getWeight()/(eventList[i].getGeneratorPdfRelativeToPhaseSpace());
95 sumw += eventList[i].getWeight()/(eventList[i].getGeneratorPdfRelativeToPhaseSpace());
104 h->Scale(h->GetNbinsX()/h->Integral());
113 Double_t
Bl_2(
double q,
double r,
int l){
116 if(l==1)
return (2*z*z)/(1.+z*z);
117 if(l==2)
return (13*pow(z,4))/(9.+3.*z*z+pow(z,4));
121 Double_t
Q(
double M,
double m1,
double m2)
123 Double_t q2 = (M*M-(m1+
m2)*(m1+
m2) ) * (M*M-(m1-
m2)*(m1-
m2) ) / (4.*M*M) ;
125 cout <<
" q2 = " << q2 <<
" M = " << M <<
" m1 = " << m1 <<
" m2 = " <<
m2 << endl;
134 double q =
Q(M,m1,
m2);
136 double bl_2 =
Bl_2(q,r,l);
142 if(sqrt(x[0])*
GeV< (par[0]+par[1]))
return 0;
143 return Gamma_2body(sqrt(x[0])*
GeV,par[0],par[1],(
int)par[2],par[3]);
146 Double_t
BW_resonance(
double m12,
double m1,
double m2,
int l,
double mass ,
double width ,
double r ){
150 gamma= width*gamma/gamma0;
152 return m12*gamma/((mass*mass-m12*m12)*(mass*mass-m12*m12)+(mass*gamma)*(mass*gamma));
168 return Gamma_2body(par[10],x[0],par[3],par[4],par[0])*
BW_resonance(x[0],par[1],par[2],par[5],par[6],par[7],par[8])*x[0];
174 const int nPar_new = 11;
175 double min_s12 = par[1]+par[2];
176 double bachelorMass = par[3] ;
179 Double_t par_new[nPar_new];
180 for (
int i=0; i< nPar; i++) {
184 par_new[10] = sqrt(x[0])*
GeV;
186 if(sqrt(x[0])*
GeV-bachelorMass<min_s12)
return 0.;
189 gamma_byS12->SetParameters(par_new);
190 double gamma = gamma_byS12->Integral(min_s12, sqrt(x[0])*
GeV-bachelorMass);
202 cout <<
"ERROR in RunningWidthCalculator::makeHisto_3body: I can handle only 3 body decays but the decay " << thisDcy
203 <<
" has " << thisDcy.
finalState().size() <<
" final state particles. I'll return 0." << endl;
207 if(thisDcy.
nDgtr() != 2){
208 cout <<
"ERROR in RunningWidthCalculator::makeHisto_3body: " 209 <<
" Mother should have 2 daughters, but it says it has " 210 << thisDcy.
nDgtr() <<
". I'll return 0." << endl;
215 cout <<
"ERROR in RunningWidthCalculator::makeHisto_3body:" 216 <<
"DalitzEventPattern and DecayTree are not compatible. I'll return 0." << endl;
222 for(
int i=0; i< thisDcy.
nDgtr(); i++){
224 if(dgtr->
nDgtr() == 2) R = dgtr;
225 else bachelor = dgtr;
228 if(0==R || 0== bachelor){
229 cout <<
"ERROR in RunningWidthCalculator::makeHisto_3body:" 230 <<
" Didn't find resonance or bachelor. I'll return 0. " << endl;
262 par[9] = max_s_inGeV2 *
GeV *
GeV;
264 if(dbThis)
for(
int i=0; i<nPar; i++) cout <<
"Parameter " << i <<
" = " << par[i] << endl;
266 if(OutputFileName==
"")
268 TFile* f=
new TFile(OutputFileName.c_str(),
"RECREATE");
271 gamma->SetParameters(par);
273 TH1D* h=
new TH1D(
"RunningWidth",
";s [GeV^2]; #Gamma (s) [a.u.]",nBins,0,max_s_inGeV2);
274 for (
int i=1; i<= h->GetNbinsX(); i++) {
275 h->SetBinContent(i,gamma->Eval(h->GetXaxis()->GetBinCenter(i) ));
291 cout <<
"ERROR in RunningWidthCalculator::makeHisto_3body: I can handle only 3 body decays but the decay " << thisDcy
292 <<
" has " << thisDcy.
finalState().size() <<
" final state particles. I'll return 0." << endl;
296 if(thisDcy.
nDgtr() != 2){
297 cout <<
"ERROR in RunningWidthCalculator::makeHisto_3body: " 298 <<
" Mother should have 2 daughters, but it says it has " 299 << thisDcy.
nDgtr() <<
". I'll return 0." << endl;
304 cout <<
"ERROR in RunningWidthCalculator::makeHisto_3body:" 305 <<
"DalitzEventPattern and DecayTree are not compatible. I'll return 0." << endl;
311 for(
int i=0; i< thisDcy.
nDgtr(); i++){
313 if(dgtr->
nDgtr() == 2) R = dgtr;
314 else bachelor = dgtr;
317 if(0==R || 0== bachelor){
318 cout <<
"ERROR in RunningWidthCalculator::makeHisto_3body:" 319 <<
" Didn't find resonance or bachelor. I'll return 0. " << endl;
351 par[9] = max_s_inGeV2 *
GeV *
GeV;
353 if(dbThis)
for(
int i=0; i<nPar; i++) cout <<
"Parameter " << i <<
" = " << par[i] << endl;
356 gamma->SetParameters(par);
370 BF_Integrand(std::vector<TF1*> partialWidths, std::vector<FitParameter*> fit_couplings,
double m0,
double gamma0):
383 double totalWidth = 0.;
384 double totalWidth_norm = 0.;
398 totalWidth = totalWidth/totalWidth_norm *
_gamma0/
GeV;
424 chi2BF(std::vector<double> BF, std::vector<TF1*> partialWidths, std::vector<FitParameter*> fit_couplings,
double m0,
double gamma0,
double precision = 0.001):
433 vector<double> integrals;
434 for (
unsigned int i=0; i <
_BF.size() ; i++) {
436 ROOT::Math::IntegratorOneDim integrator(integrand) ;
437 double integral = integrator.Integral(
_s_min,
_s_max );
438 integrals.push_back(integral);
441 for (
unsigned int i=0; i <
_BF.size() ; i++) {
442 norm += integrals[i];
444 for (
unsigned int i=0; i <
_BF.size() ; i++) {
456 std::vector<FitParameter*> fit_couplings;
459 fit_couplings.push_back(scale);
461 for (
unsigned int i=1; i < BF.size() ; i++) {
465 fit_couplings.push_back(
g);
468 chi2BF f(BF, partialWidths, fit_couplings, m0, gamma0);
472 vector<double> couplings;
477 for (
unsigned int i=1; i<fit_couplings.size(); i++) {
478 sum += *fit_couplings[i];
481 for (
unsigned int i=0; i<fit_couplings.size(); i++) {
484 else c = *fit_couplings[i];
485 norm += c*partialWidths[i]->Eval(m0*m0/(
GeV*
GeV));
488 for (
unsigned int i=0; i<fit_couplings.size(); i++) {
491 else c = *fit_couplings[i];
492 couplings.push_back(c / norm * gamma0/
GeV);
510 for (
unsigned int i=0; i<
_gamma.size(); i++) sum +=
_g[i]*
_gamma[i]->Eval(x);
517 double absTol = 0.0001;
518 double relTol = 0.001;
519 unsigned int size = 1000;
521 double epsilon= 0.00001;
523 if(OutputFileName==
"")
525 TFile* f=
new TFile(OutputFileName.c_str(),
"RECREATE");
526 TH1D* h_m=
new TH1D(
"RunningMass",
";s [GeV^{2}]; m^{2} (s) [GeV^{2}]",nBins,
_min_s_inGeV2,max_s_inGeV2);
527 for (
int i=1; i<= h_m->GetNbinsX(); i++) {
528 double singularity = h_m->GetXaxis()->GetBinCenter(i);
530 h_m->SetBinContent(i,0);
534 ROOT::Math::IntegratorOneDim integrator(integrand, ROOT::Math::IntegrationOneDim::kADAPTIVESINGULAR, absTol , relTol , size , rule ) ;
535 h_m->SetBinContent(i,(integrator.Integral(
_min_s_inGeV2,singularity-epsilon) + integrator.Integral(singularity+epsilon,max_s_inGeV2*10000))/TMath::Pi());
570 cout <<
"ERROR in RunningWidthCalculator::makeHisto_2body: I can handle only 2 body decays but the decay " << thisDcy
571 <<
" has " << thisDcy.
finalState().size() <<
" final state particles. I'll return 0." << endl;
575 if(thisDcy.
nDgtr() != 2){
576 cout <<
"ERROR in RunningWidthCalculator::makeHisto_2body: " 577 <<
" Mother should have 2 daughters, but it says it has " 578 << thisDcy.
nDgtr() <<
". I'll return 0." << endl;
583 cout <<
"ERROR in RunningWidthCalculator::makeHisto_2body:" 584 <<
"DalitzEventPattern and DecayTree are not compatible. I'll return 0." << endl;
607 TF1 *gamma =
new TF1(
"Gamma_2body",
Gamma_2body,0,max_s_inGeV2,nPar);
608 gamma->SetParameters(par);
621 cout <<
"ERROR in RunningWidthCalculator::makeHisto_2body: I can handle only 2 body decays but the decay " << thisDcy
622 <<
" has " << thisDcy.
finalState().size() <<
" final state particles. I'll return 0." << endl;
626 if(thisDcy.
nDgtr() != 2){
627 cout <<
"ERROR in RunningWidthCalculator::makeHisto_2body: " 628 <<
" Mother should have 2 daughters, but it says it has " 629 << thisDcy.
nDgtr() <<
". I'll return 0." << endl;
634 cout <<
"ERROR in RunningWidthCalculator::makeHisto_2body:" 635 <<
"DalitzEventPattern and DecayTree are not compatible. I'll return 0." << endl;
658 if(OutputFileName==
"")
660 TFile* f=
new TFile(OutputFileName.c_str(),
"RECREATE");
662 TH1D* h=
new TH1D(
"RunningWidth",
";s [GeV^2]; #Gamma (s) [a.u.]",nBins,
_min_s_inGeV2,max_s_inGeV2);
663 for (
int i=1; i<= h->GetNbinsX(); i++) {
664 h->SetBinContent(i,
Gamma_2body( sqrt(h->GetXaxis()->GetBinCenter(i))*
GeV , m1,
m2, l, r));
683 double ps_val = ps.
getVal(sqrt(x[0])*
GeV,par[1],par[2],par[3]);
684 double ps0_val = ps.
getVal(par[0],par[1],par[2],par[3]);
687 if(ps0_val>0)ps_ratio= ps_val/ps0_val;
689 return ps_ratio * par[0]/(sqrt(x[0])*
GeV);
695 cout <<
"ERROR in RunningWidthCalculator::makeHisto_phaseSpace: I can handle only 3 body decays but the pattern " <<
_pat 696 <<
" has " <<
_pat.
size()-1 <<
" final state particles. I'll return 0." << endl;
700 if(OutputFileName==
"")
704 TFile* f=
new TFile(OutputFileName.c_str(),
"RECREATE");
705 TH1D* h=
new TH1D(
"RunningWidth",
"RunningWidth",nBins,
_min_s_inGeV2,max_s_inGeV2);
715 ps->SetParameters(par);
717 for (
int i=1; i<= h->GetNbinsX(); i++) {
718 h->SetBinContent(i,ps->Eval(h->GetXaxis()->GetBinCenter(i)));
721 h->Scale(h->GetNbinsX()/h->Integral());
731 cout <<
"ERROR in RunningWidthCalculator::makeHisto_phaseSpace: I can handle only 3 body decays but the pattern " <<
_pat 732 <<
" has " <<
_pat.
size()-1 <<
" final state particles. I'll return 0." << endl;
744 ps->SetParameters(par);
750 if (
s<threshold)
return 0;
751 return sqrt(1.- threshold/
s)/(1.+ exp(
lambda * (s0-
s) ) );
767 TF1 *gamma =
new TF1(
"Fermi_phaseSpace",
Fermi_phaseSpace,0,max_s_inGeV2,nPar);
768 gamma->SetParameters(par);
Double_t Gamma_mother_3body_byM12(Double_t *x, Double_t *par)
TH1D * makeHisto_dalitz(int nBins, double max_m_inMeV, int nIntegrationEvents, IFastAmplitudeIntegrable *amps=0, std::string OutputFileName="")
Dispersion_Integrand(vector< TF1 * > f, vector< double > g, double singularity)
void changeMassForDebug(double newVal) const
TH1D * makeHisto_phaseSpace(int nBins, double max_m_inMeV, std::string OutputFileName="")
std::vector< double > _BF
chi2BF(std::vector< double > BF, std::vector< TF1 * > partialWidths, std::vector< FitParameter * > fit_couplings, double m0, double gamma0, double precision=0.001)
virtual int twoLPlusOne() const
Double_t Gamma_mother_3body(Double_t *x, Double_t *par)
double operator()(double x)
bool compatibleWith(const DecayTree &tree) const
virtual double RealVal(EVENT_TYPE &evt)=0
TF1 * getRunningWidthFunction_2body(double max_s_inGeV2, const DecayTree &thisDcy)
void setDalitzEventPattern(const DalitzEventPattern &pat)
TF1 * getRunningWidthFunction_3body(double max_s_inGeV2, const DecayTree &thisDcy)
void setIndex(const int i)
const ResonanceProperties * get(int i) const
Double_t BW_resonance(double m12, double m1, double m2, int l, double mass, double width, double r)
const ValueType & getVal() const
TH1D * makeHisto_3body(int nBins, double max_m_inMeV, const DecayTree &thisDcy, std::string OutputFileName="")
BF_Integrand(std::vector< TF1 * > partialWidths, std::vector< FitParameter * > fit_couplings, double m0, double gamma0)
static ResonancePropertiesList * getMe(const std::string &prefix="", MINT::MinuitParameterSet *mps=0)
std::vector< double > getPartialWidthCouplingsFromBF(std::vector< double > BF, std::vector< TF1 * > partialWidths, double m0, double gamma0)
double getVal(const DalitzEventPattern &_pat)
std::vector< FitParameter * > _fit_couplings
MINT::const_counted_ptr< DDTree< ValueType > > getDgtrTreePtr(int i) const
void setWeighted(bool w=true)
void setMass(double m) const
double operator()(Double_t *x, Double_t *par=0)
TF1 * getRunningWidthFunction_phaseSpace(double max_s_inGeV2)
const AssociatedDecayTree & getTree(const DalitzEventPattern &pat) const
std::vector< TF1 * > _partialWidths
RunningWidthCalculator(const DalitzEventPattern &pat)
TH1D * makeHisto_2body(int nBins, double max_m_inMeV, const DecayTree &thisDcy, std::string OutputFileName="")
const ParticleProperties * get(const std::string &name) const
std::vector< TF1 * > _partialWidths
unsigned int size() const
virtual unsigned int size() const
std::string anythingToString(const T &anything)
std::vector< FitParameter * > _fit_couplings
Double_t Gamma_2body(double M, double m1, double m2, int l, double r)
static const ParticlePropertiesList * getMe()
double Fermi_phaseSpace(double s, double lambda, double s0, double threshold)
TF1 * getRunningWidthFunction_Fermi(double max_s_inGeV2, double lambda, double s0)
std::vector< const ValueType * > finalState() const
Double_t Bl_2(double q, double r, int l)
TH1D * makeRunningMassHisto_3body(int nBins, double max_s_inGeV2, std::vector< TF1 * > gamma, std::vector< double > g, std::string OutputFileName="")
double lambda(double x, double y, double z)
int generatePhaseSpaceEvents(int NumEvents, const DalitzEventPattern &pat, TRandom *rnd=0)
Double_t phaseSpace(Double_t *x, Double_t *par)
Double_t phaseSpaceIntegral(Double_t *x, Double_t *par)
void FillEventList(DalitzEventList &evtList, int NEvents)
Double_t Q(double M, double m1, double m2)
double operator()(double x)