double LegendreMomentShape::Moment(const int l, const int i, const int k, const int j, const double mKK_mapped, const double phi, const double ctheta_1, const double ctheta_2) { if(j < k) return 0; if(std::abs(mKK_mapped) > 1) return 0; double Q_l = gsl_sf_legendre_Pl (l, mKK_mapped ); double P_i = gsl_sf_legendre_Pl (i, ctheta_2 ); double Y_jk = gsl_sf_legendre_sphPlm (j, k, ctheta_1); if(k != 0) Y_jk *= sqrt(2) * cos(k * phi); return Q_l * P_i * Y_jk; }
double Bd2JpsiKstar_sWave_Fs_withAcc::angularFactor( ) { return 1; double returnValue(0.); #ifdef __RAPIDFIT_USE_GSL double P_i(0.); double Y_jk(0.); for ( int i = 0; i < i_max+1; i++ ) { for ( int k = 0; k < k_max; k+=2) // limiting the loop here to only look at terms we need { for ( int j = 0; j < j_max; j+=2 ) // must have l >= k { if (j < k) continue; P_i = gsl_sf_legendre_Pl (i, cosPsi); // only consider case where k >= 0 // these are the real valued spherical harmonics if ( k == 0 ) Y_jk = gsl_sf_legendre_sphPlm (j, k, cosTheta); else Y_jk = sqrt(2) * gsl_sf_legendre_sphPlm (j, k, cosTheta) * cos(k*phi); returnValue += c[i][k][j]*(P_i * Y_jk); } } } #endif return returnValue; }
//Calculate the function value double DPBackground::Evaluate(DataPoint * measurement) { // Observables m23 = measurement->GetObservable( m23Name )->GetValue(); cosTheta1 = measurement->GetObservable( cosTheta1Name )->GetValue(); cosTheta2 = measurement->GetObservable( cosTheta2Name )->GetValue(); phi = measurement->GetObservable( phiName )->GetValue(); double m23_mapped = (m23 - 0.64)/(1.59 - 0.64)*2. + (-1); // should really do this in a generic way #ifdef __RAPIDFIT_USE_GSL double returnable_value(0.); double Q_l(0.); double P_i(0.); double Y_jk(0.); for ( int l = 0; l < l_max+1; l++ ) { for ( int i = 0; i < i_max+1; i++ ) { for ( int k = 0; k < 3; k++) { for ( int j = 0; j < 3; j+=2 ) // limiting the loop here to only look at terms we need { //cout << "likj" << l << " " << i << " " << k << " " << j << endl; if (j < k) continue; // must have l >= k Q_l = gsl_sf_legendre_Pl (l, m23_mapped); P_i = gsl_sf_legendre_Pl (i, cosTheta2); // only consider case where k >= 0 // these are the real valued spherical harmonics if ( k == 0 ) Y_jk = gsl_sf_legendre_sphPlm (j, k, cosTheta1); else Y_jk = sqrt(2) * gsl_sf_legendre_sphPlm (j, k, cosTheta1) * cos(k*phi); returnable_value += c[l][i][k][j]*(Q_l * P_i * Y_jk); } } } } if( std::isnan(returnable_value) || returnable_value < 0 ) return 0.; else return returnable_value; #endif return 0 ; }
double Bd2JpsiKstar_sWave_Fscopy::angularFactor( ) { double returnValue(0.); #ifdef __RAPIDFIT_USE_GSL double _cosPsi(0.); double _cosTheta(0.); double _phi(0.); if( useHelicityBasis() ) { _cosTheta = helcosthetaL; _phi = helphi; _cosPsi = helcosthetaK; } else { _cosTheta = cosTheta; _phi = phi; _cosPsi = cosPsi; } double P_i(0.); double Y_jk(0.); for ( int i = 0; i < i_max+1; i++ ) { for ( int k = 0; k < k_max; k+=2) // limiting the loop here to only look at terms we need { for ( int j = 0; j < j_max; j+=2 ) // must have l >= k { if (j < k) continue; P_i = gsl_sf_legendre_Pl (i, _cosPsi); // only consider case where k >= 0 // these are the real valued spherical harmonics if ( k == 0 ) Y_jk = gsl_sf_legendre_sphPlm (j, k, _cosTheta); else Y_jk = sqrt(2) * gsl_sf_legendre_sphPlm (j, k, _cosTheta) * cos(k*_phi); returnValue += c[i][k][j]*(P_i * Y_jk); } } } #endif return returnValue; }
//------------------------------------------------------------------------------ /// Legendre Polynomial \f$ P_l(x) \f$ inline double legendrePl(const int l, const double x) { return gsl_sf_legendre_Pl(l, x); }
//Calculate the function value double DPTotalAmplitudePDF_withAcc_withBkg::Evaluate(DataPoint * measurement) { // Observables m23 = measurement->GetObservable( m23Name )->GetValue(); cosTheta1 = measurement->GetObservable( cosTheta1Name )->GetValue(); cosTheta2 = measurement->GetObservable( cosTheta2Name )->GetValue(); phi = measurement->GetObservable( phiName )->GetValue(); //m13 = measurement->GetObservable( m13Name )->GetValue(); //cosZ = measurement->GetObservable( cosZName )->GetValue(); //cosPsiZ = measurement->GetObservable( cosPsiZName )->GetValue(); //phiZ = measurement->GetObservable( phiZName )->GetValue(); //alpha = measurement->GetObservable( alphaName )->GetValue(); pionID = measurement->GetObservable( pionIDName )->GetValue(); double m23_mapped = (m23 - 0.64)/(1.59 - 0.64)*2. + (-1); // should really do this in a generic way //double m23_mapped = (m23 - 0.64)/(1.68 - 0.64)*2. + (-1); // should really do this in a generic way #ifdef __RAPIDFIT_USE_GSL double angularAcc(0.); double Q_l(0.); double P_i(0.); double Y_jk(0.); if ( useAngularAcceptance ) { for ( int l = 0; l < l_max+1; l++ ) { for ( int i = 0; i < i_max+1; i++ ) { for ( int k = 0; k < 3; k++ ) { for ( int j = 0; j < 3; j+=2 ) // limiting the loop here to only look at terms we need { if (j < k) continue; // must have l >= k Q_l = gsl_sf_legendre_Pl (l, m23_mapped); P_i = gsl_sf_legendre_Pl (i, cosTheta2); // only consider case where k >= 0 // these are the real valued spherical harmonics if ( k == 0 ) Y_jk = gsl_sf_legendre_sphPlm (j, k, cosTheta1); else Y_jk = sqrt(2) * gsl_sf_legendre_sphPlm (j, k, cosTheta1) * cos(k*phi); angularAcc += c[l][i][k][j]*(Q_l * P_i * Y_jk); } } } } } else { angularAcc = 1.;//0.0195; } //if (angularAcc <= 0.) cout << "angular acc " << angularAcc << " " << m23 << " " << m23_mapped << " " << cosTheta1 << " " << phi << " " << cosTheta2 << endl; // Calculate the Z angles //DPHelpers::calculateFinalStateMomenta(massB, m23, massPsi, //cosTheta1, cosTheta2, phi, pionID, 0.1056583715, 0.1056583715, 0.13957018, 0.493677, //pMuPlus, pMuMinus, pPi, pK); DPHelpers::calculateFinalStateMomentaBelle(massB, m23, massPsi, cosTheta1, cosTheta2, phi, 0.1056583715, 0.139570, 0.493677, pMuPlus, pMuMinus, pPi, pK); double belle_m23(0.); double belle_cosKPi(0.); double belle_cosPsi(0.); double belle_phiKPiPsi(0.); double belle_m13(0.); double belle_cosZ(0.); double belle_cosPsi_Z(0.); double belle_phiPsiZ(0.); double belle_phiZPsiPsi(0.); const TLorentzVector myMuPlus(pMuPlus); const TLorentzVector myMuMinus(pMuMinus); const TLorentzVector myPi(pPi); const TLorentzVector myK(pK); DPHelpers::Belle(myMuPlus, myMuMinus, myPi, myK , belle_m23 , belle_cosKPi , belle_cosPsi , belle_phiKPiPsi , belle_m13 , belle_cosZ , belle_cosPsi_Z , belle_phiPsiZ , belle_phiZPsiPsi ); //cout << "K* ntuple " << m23 << " " << cosTheta2 << " " << cosTheta1 << " " << phi << " " << pionID << endl; //cout << "K* calcul " << belle_m23 << " " << belle_cosKPi << " " << belle_cosPsi << " " << belle_phiKPiPsi << endl; //cout << "Z ntuple " << m13 << " " << cosZ << " " << cosPsiZ << " " << phiZ << " " << alpha << endl; //cout << "Z calcul " << belle_m13 << " " << belle_cosZ << " " << belle_cosPsi_Z << " " << belle_phiPsiZ << " " << belle_phiZPsiPsi << endl; double result = 0.; TComplex tmp(0,0); // This deals with the separate Kpi components unsigned int lower = (unsigned)(componentIndex - 1); unsigned int upper = (unsigned)componentIndex; unsigned int lowerZ = 0; unsigned int upperZ = 0; // And this switchs things to deal with the Z components. if ( (unsigned)componentIndex > KpiComponents.size() ) { lower = 0; upper = 0; lowerZ = (unsigned)(componentIndex - KpiComponents.size() - 1); upperZ = (unsigned)(componentIndex - KpiComponents.size()); } // just plot the background if ( componentIndex == 13 ) { lower = 0; upper = 0; lowerZ = 0; upperZ = 0; } if ( componentIndex == 100 ){ lower = 0; upper = (unsigned)KpiComponents.size(); lowerZ = 0; upperZ = 0; } // Finally, for the total of all components if ( componentIndex == 0 ) { lower = 0; upper = (unsigned)KpiComponents.size(); lowerZ = 0; upperZ = (unsigned)ZComponents.size(); } // Now sum over final state helicities (this is not general code, but // knows about internals of components for (int twoLambda = -2; twoLambda <= 2; twoLambda += 4) // Sum over +-1 { tmp = TComplex(0,0); for (int twoLambdaPsi = -2; twoLambdaPsi <= 2; twoLambdaPsi += 2) // Sum over -1,0,+1 { for (unsigned int i = lower; i < upper; ++i) // sum over all components { tmp += KpiComponents[i]->amplitude(m23, cosTheta1, cosTheta2, phi, twoLambda, twoLambdaPsi); } // Now comes sum over Z+ components and lambdaPsiPrime for (unsigned int i = lowerZ; i < upperZ; ++i) { //tmp += ZComponents[i]->amplitudeProperVars(belle_m13, belle_cosZ, belle_cosPsi_Z, belle_phiPsiZ, pionID, twoLambda, twoLambdaPsi); tmp += TComplex::Exp((0.5*TComplex::I())*(twoLambda*belle_phiZPsiPsi))*(ZComponents[i]->amplitudeProperVars(belle_m13, belle_cosZ, belle_cosPsi_Z, belle_phiPsiZ, pionID, twoLambda, twoLambdaPsi)); //std::cout << TComplex::Exp(0.5*TComplex::I()*twoLambda*belle_phiZPsiPsi) << " " << TComplex(cos(belle_phiZPsiPsi), 0.5*twoLambda*sin(belle_phiZPsiPsi)) << std::endl; } } result += tmp.Rho2(); } //momenta are defined on eq 39.20a/b of the 2010 PDG const double m1 = 0.493677; // kaon mass const double m2 = 0.139570; // pion mass const double MB0= massB; // B0 mass double t1 = m23*m23-(m1+m2)*(m1+m2); double t2 = m23*m23-(m1-m2)*(m1-m2); double t31 = MB0*MB0 - (m23 + massPsi)*(m23 + massPsi); double t32 = MB0*MB0 - (m23 - massPsi)*(m23 - massPsi); double p1_st = sqrt(t1*t2)/m23/2.; double p3 = sqrt(t31*t32)/MB0/2.; //std::cout << result << " " << angularAcc << " " << p1_st << " " << p3 << " " << result*p1_st*p3 << std::endl; double returnable_value = result * angularAcc * p1_st * p3; double background(0.); if ( (componentIndex == 0 || componentIndex == 13) && fraction > 0. ) { for ( int l = 0; l < l_max_b+1; l++ ) { for ( int i = 0; i < i_max_b+1; i++ ) { for ( int k = 0; k < k_max_b+1; k++) { for ( int j = 0; j < 3; j+=2 ) // limiting the loop here to only look at terms we need { //cout << "likj" << l << " " << i << " " << k << " " << j << endl; if (j < k) continue; // must have l >= k Q_l = gsl_sf_legendre_Pl (l, m23_mapped); P_i = gsl_sf_legendre_Pl (i, cosTheta2); // only consider case where k >= 0 // these are the real valued spherical harmonics if ( k == 0 ) Y_jk = gsl_sf_legendre_sphPlm (j, k, cosTheta1); else Y_jk = sqrt(2) * gsl_sf_legendre_sphPlm (j, k, cosTheta1) * cos(k*phi); background += b[l][i][k][j]*(Q_l * P_i * Y_jk); } } } } } //cout << background << " " << fraction << " " << returnable_value << endl; //returnable_value = background; returnable_value = returnable_value + fraction*background; if( std::isnan(returnable_value) || returnable_value < 0. ) return 0.; else return returnable_value; #endif return 0.; }
/* See Remark 2.17 */ double pkd_eval_square( int j, int k, point p) { double leg = gsl_sf_legendre_Pl( j, p.x); double pwr = gsl_pow_int( (1.0-p.y)/2.0, j); double jac = jacobi( k, 2.0*j+1.0, p.y); return leg*pwr*jac; }