+ std::cout << "FitDP_Bs2KSKpi::ERROR - Wrong configuration of the resonance. Please only use input resonances neutral or positive charged." << std::endl;
+ return EXIT_FAILURE;
+ }
+ if ( DP_type == "KSKpi" ){
+ if ((tmp_resName.Contains("a")) && (tmp_resName.Contains("("))){
+ bachelarRef = 2;
+ } else if (tmp_resName.Contains("K*+")){
+ tmp_resName.ReplaceAll("+","-");
+ bachelarRef = 1;
+ } else if (tmp_resName.Contains("K*0")){
+ bachelarRef = 3;
+ } else if (tmp_resName.Contains("kappa+")){
+ tmp_resName.ReplaceAll("+","-");
+ bachelarRef = 1;
+ } else if (tmp_resName.Contains("kappa0")){
+ bachelarRef = 3;
+ } else if (tmp_resName.Contains("BelleNR+")){
+ tmp_resName.ReplaceAll("+","-");
+ bachelarRef = 1;
+ } else if (tmp_resName == "BelleNR"){
+ bachelarRef = 3;
+ }
+ } else {
+ if ((tmp_resName.Contains("a")) && (tmp_resName.Contains("("))){
+ //! Split the signal component into well-reconstructed and mis-reconstructed parts
+ /*!
+ The nomenclature used here is TM (truth-matched) and SCF (self cross feed)
+ In this option, the SCF fraction is DP-dependent
+ Can also optionally provide a smearing matrix to smear the SCF DP PDF
+
+ \param [in] dpHisto the DP histogram of the SCF fraction value
+ \param [in] upperHalf whether this histogram is only in the upper half of a symmetric DP
+ \param [in] fluctuateBins whether the bins on the histogram should be varied in accordance with their uncertainties (for evaluation of systematic uncertainties)
+ \param [in] scfMap the (optional) smearing matrix
+ std::cerr << "ERROR in LauBsCPFitModel::setNBgkndEvents : The background yield LauParameter pointer is null." << std::endl;
+ gSystem->Exit(EXIT_FAILURE);
+ }
+
+ if ( ! this->validBkgndClass( nBkgndEvents->name() ) ) {
+ std::cerr << "ERROR in LauBsCPFitModel::setNBkgndEvents : Invalid background class \"" << nBkgndEvents->name() << "\"." << std::endl;
+ std::cerr << " : Background class names must be provided in \"setBkgndClassNames\" before any other background-related actions can be performed." << std::endl;
+ std::cerr << "ERROR in LauBsCPFitModel::setBkgndDPModels : the model pointer is null." << std::endl;
+ return;
+ }
+
+ // check that this background name is valid
+ if ( ! this->validBkgndClass( bkgndClass) ) {
+ std::cerr << "ERROR in LauBsCPFitModel::setBkgndDPModel : Invalid background class \"" << bkgndClass << "\"." << std::endl;
+ std::cerr << " : Background class names must be provided in \"setBkgndClassNames\" before any other background-related actions can be performed." << std::endl;
+ // if we're doing an untagged analysis we will only use the negative PDFs
+ if ( pdf==0 ) {
+ std::cerr << "ERROR in LauBsCPFitModel::setBkgndPdfs : The PDF pointer is null." << std::endl;
+ return;
+ }
+
+ // check that this background name is valid
+ if ( ! this->validBkgndClass( bkgndClass ) ) {
+ std::cerr << "ERROR in LauBsCPFitModel::setBkgndPdfs : Invalid background class \"" << bkgndClass << "\"." << std::endl;
+ std::cerr << " : Background class names must be provided in \"setBkgndClassNames\" before any other background-related actions can be performed." << std::endl;
+ std::cerr << "ERROR in LauBsCPFitModel::initialise : There are " << nsigpdfvars << " TM signal PDF variables but " << nscfpdfvars << " SCF signal PDF variables." << std::endl;
+ std::cerr << "ERROR in LauBsCPFitModel::initialise : There are " << nsigpdfvars << " signal PDF variables but " << nbkgndpdfvars << " bkgnd PDF variables." << std::endl;
+ gSystem->Exit(EXIT_FAILURE);
+ }
+ }
+ }
+
+ // Clear the vectors of parameter information so we can start from scratch
+ this->clearFitParVectors();
+
+ // Set the fit parameters for signal and background models
+ this->setSignalDPParameters();
+
+ // Set the fit parameters for the various extra PDFs
+ this->setExtraPdfParameters();
+
+ // Set the initial bg and signal events
+ this->setFitNEvents();
+
+ // Check that we have the expected number of fit variables
+ if (fitVars.size() != (nSigDPPar_ + nExtraPdfPar_ + nNormPar_)) {
+ std::cerr << "ERROR in LauBsCPFitModel::initialise : Number of fit parameters not of expected size. Exiting" << std::endl;
+ gSystem->Exit(EXIT_FAILURE);
+ }
+
+ this->setExtraNtupleVars();
+}
+
+void LauBsCPFitModel::recalculateNormalisation()
+{
+ //std::cout << "INFO in LauBsCPFitModel::recalculateNormalizationInDPModels : Recalc Norm in DP model" << std::endl;
+ negSigModel_->recalculateNormalisation();
+ posSigModel_->recalculateNormalisation();
+ negSigModel_->modifyDataTree();
+ posSigModel_->modifyDataTree();
+ this->calcInterferenceTermIntegrals();
+}
+
+void LauBsCPFitModel::initialiseDPModels()
+{
+ // Need to check that the number of components we have and that the dynamics has matches up
+ UInt_t nNegAmp = negSigModel_->getnTotAmp();
+ UInt_t nPosAmp = posSigModel_->getnTotAmp();
+ if ( nNegAmp != nPosAmp ) {
+ std::cerr << "ERROR in LauBsCPFitModel::initialiseDPModels : Unequal number of signal DP components in the negative and positive models: " << nNegAmp << " != " << nPosAmp << std::endl;
+ gSystem->Exit(EXIT_FAILURE);
+ }
+ if ( nNegAmp != nSigComp_ ) {
+ std::cerr << "ERROR in LauBsCPFitModel::initialiseDPModels : Number of signal DP components in the model (" << nNegAmp << ") not equal to number of coefficients supplied (" << nSigComp_ << ")." << std::endl;
+ gSystem->Exit(EXIT_FAILURE);
+ }
+
+
+ std::cout << "INFO in LauBsCPFitModel::initialiseDPModels : Initialising signal DP model" << std::endl;
+ negSigModel_->initialise(negCoeffs_);
+ posSigModel_->initialise(posCoeffs_);
+
+ if (usingBkgnd_ == kTRUE) {
+ for (LauBkgndDPModelList::iterator iter = bkgndDPModels_.begin(); iter != bkgndDPModels_.end(); ++iter) {
+ std::cerr << "ERROR in LauBsCPFitModel::cacheInputFitVars : Input data does not contain DP branches and so can't cache the SCF fraction." << std::endl;
+ std::cerr << "ERROR in LauBsCPFitModel::embedBkgnd : Invalid background class \"" << bkgndClass << "\"." << std::endl;
+ std::cerr << " : Background class names must be provided in \"setBkgndClassNames\" before any other background-related actions can be performed." << std::endl;